Example #1
0
/**
*	This is called when a battle event is deleted.
*/
void EventSystem::battleEventDeleted(QString ID) {
	for (int i = 0; i < _battleEvents.size(); i++) {
		BattleEvent *it = _battleEvents.at(i);
		if (it->getName() == ID)
			_battleEvents.remove(i);
	}
}
Example #2
0
/**
*	Get battle event with specified name.
*/
BattleEvent* EventSystem::getBattleEvent(QString ID) const {
	if (ID == QString())
		throw ProjectException("Cannot search for a battle event with an empty ID.");

	for (int i = 0; i < _battleEvents.size(); i++) {
		BattleEvent *it = _battleEvents.at(i);
		if (!!it && (it->getName() == ID))
			return it;
	}

	return 0;
}
Example #3
0
/**
*	Remove battle event with name <i>name</i> from the system.
*/
void EventSystem::removeBattleEvent(QString name) {
	if (name == QString())
		throw ProjectException("Cannot search for a battle event with an empty name.");

	for (int i = 0; i < _battleEvents.size(); i++) {
		BattleEvent *it = _battleEvents.at(i);
		if (!!it && (it->getName() == name)) {
			_battleEvents.remove(i);
			delete it;
			return;
		}
	}
}