diff --git a/source/glest_game/game/script_manager.cpp b/source/glest_game/game/script_manager.cpp index ba88e772..f0422c72 100644 --- a/source/glest_game/game/script_manager.cpp +++ b/source/glest_game/game/script_manager.cpp @@ -1014,7 +1014,7 @@ void ScriptManager::destroyUnit(int unitId){ // Make sure they die bool unit_dead = unit->decHp(unit->getHp() * unit->getHp()); if(unit_dead == false) { - throw megaglest_runtime_error("unit_dead == false"); + throw megaglest_runtime_error("unit_dead == false",true); } unit->kill(); // If called from an existing die event we get a stack overflow @@ -1025,8 +1025,8 @@ void ScriptManager::giveKills (int unitId, int amount){ if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d] unit [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,unitId); Unit *unit = world->findUnitById(unitId); if(unit != NULL) { - for(int i = 1; i <= amount; i++) { - unit->incKills(-1); + for(int index = 1; index <= amount; ++index) { + unit->incKills(-1); } } } @@ -1125,7 +1125,7 @@ void ScriptManager::giveAttackStoppedCommand(int unitId, const string &itemName, void ScriptManager::disableAi(int factionIndex){ if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); - if(factionIndex= 0 && factionIndex < GameConstants::maxPlayers) { playerModifiers[factionIndex].disableAi(); disableConsume(factionIndex); // by this we stay somehow compatible with old behaviour } @@ -1134,38 +1134,38 @@ void ScriptManager::disableAi(int factionIndex){ void ScriptManager::enableAi(int factionIndex){ if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); - if(factionIndex= 0 && factionIndex < GameConstants::maxPlayers) { playerModifiers[factionIndex].enableAi(); } } -bool ScriptManager::getAiEnabled(int factionIndex){ +bool ScriptManager::getAiEnabled(int factionIndex) { - if(factionIndex= 0 && factionIndex < GameConstants::maxPlayers) { return playerModifiers[factionIndex].getAiEnabled(); } return false; } -void ScriptManager::disableConsume(int factionIndex){ +void ScriptManager::disableConsume(int factionIndex) { if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); - if(factionIndex= 0 && factionIndex < GameConstants::maxPlayers) { playerModifiers[factionIndex].disableConsume(); } } -void ScriptManager::enableConsume(int factionIndex){ +void ScriptManager::enableConsume(int factionIndex) { if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); - if(factionIndex= 0 && factionIndex < GameConstants::maxPlayers) { playerModifiers[factionIndex].enableConsume(); } } -bool ScriptManager::getConsumeEnabled(int factionIndex){ +bool ScriptManager::getConsumeEnabled(int factionIndex) { - if(factionIndex < GameConstants::maxPlayers){ + if(factionIndex >= 0 && factionIndex < GameConstants::maxPlayers) { return playerModifiers[factionIndex].getConsumeEnabled(); } return false; @@ -1398,7 +1398,7 @@ void ScriptManager::setPlayerAsWinner(int factionIndex) { if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); - if(factionIndex= 0 && factionIndex < GameConstants::maxPlayers) { playerModifiers[factionIndex].setAsWinner(); } } @@ -1412,7 +1412,7 @@ void ScriptManager::endGame() { void ScriptManager::startPerformanceTimer() { if(world->getGame() == NULL) { - throw megaglest_runtime_error("world->getGame() == NULL"); + throw megaglest_runtime_error("#1 world->getGame() == NULL",true); } world->getGame()->startPerformanceTimer(); @@ -1421,7 +1421,7 @@ void ScriptManager::startPerformanceTimer() { void ScriptManager::endPerformanceTimer() { if(world->getGame() == NULL) { - throw megaglest_runtime_error("world->getGame() == NULL"); + throw megaglest_runtime_error("#2 world->getGame() == NULL",true); } world->getGame()->endPerformanceTimer(); @@ -1430,7 +1430,7 @@ void ScriptManager::endPerformanceTimer() { Vec2i ScriptManager::getPerformanceTimerResults() { if(world->getGame() == NULL) { - throw megaglest_runtime_error("world->getGame() == NULL"); + throw megaglest_runtime_error("#3 world->getGame() == NULL",true); } return world->getGame()->getPerformanceTimerResults(); } @@ -1666,7 +1666,7 @@ int ScriptManager::isFreeCellsOrHasUnit(int field, int unitId, Vec2i pos) { Unit* unit= world->findUnitById(unitId); if(unit == NULL) { - throw megaglest_runtime_error("unit == NULL"); + throw megaglest_runtime_error("unit == NULL",true); } int result = world->getMap()->isFreeCellsOrHasUnit(pos,unit->getType()->getSize(),static_cast(field),unit,NULL,true); @@ -1678,7 +1678,6 @@ int ScriptManager::isFreeCellsOrHasUnit(int field, int unitId, Vec2i pos) { int ScriptManager::isFreeCells(int unitSize, int field, Vec2i pos) { if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); - int result = world->getMap()->isFreeCellsOrHasUnit(pos,unitSize,static_cast(field),NULL,NULL,true); if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s] unitSize = %d, pos [%s] field = %d result = %d\n",__FUNCTION__,unitSize,pos.getString().c_str(),field,result); @@ -1907,7 +1906,7 @@ int ScriptManager::getIsDayTime() { const TimeFlow *tf= world->getTimeFlow(); if(tf == NULL) { - throw megaglest_runtime_error("tf == NULL"); + throw megaglest_runtime_error("#1 tf == NULL",true); } return tf->isDay(); } @@ -1917,7 +1916,7 @@ int ScriptManager::getIsNightTime() { const TimeFlow *tf= world->getTimeFlow(); if(tf == NULL) { - throw megaglest_runtime_error("tf == NULL"); + throw megaglest_runtime_error("#2 tf == NULL",true); } return tf->isNight(); } @@ -1929,7 +1928,7 @@ float ScriptManager::getTimeOfDay() { const TimeFlow *tf= world->getTimeFlow(); if(tf == NULL) { - throw megaglest_runtime_error("tf == NULL"); + throw megaglest_runtime_error("#3 tf == NULL",true); } //printf("File: %s line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__); return tf->getTime(); @@ -1937,20 +1936,20 @@ float ScriptManager::getTimeOfDay() { void ScriptManager::disableSpeedChange() { if(world->getGame() == NULL) { - throw megaglest_runtime_error("world->getGame() == NULL"); + throw megaglest_runtime_error("#4 world->getGame() == NULL"); } world->getGame()->setDisableSpeedChange(true); } void ScriptManager::enableSpeedChange() { if(world->getGame() == NULL) { - throw megaglest_runtime_error("world->getGame() == NULL"); + throw megaglest_runtime_error("#5 world->getGame() == NULL"); } world->getGame()->setDisableSpeedChange(false); } bool ScriptManager::getSpeedChangeEnabled() { if(world->getGame() == NULL) { - throw megaglest_runtime_error("world->getGame() == NULL"); + throw megaglest_runtime_error("#6 world->getGame() == NULL"); } return world->getGame()->getDisableSpeedChange(); } diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index aeb24685..221beb66 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -1719,8 +1719,12 @@ std::pair Unit::giveCommand(Command *command, bool tryQueu Chrono chrono; if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled) chrono.start(); - assert(command != NULL); - assert(command->getCommandType() != NULL); + if(command == NULL) { + throw megaglest_runtime_error("command == NULL"); + } + if(command->getCommandType() == NULL) { + throw megaglest_runtime_error("command->getCommandType() == NULL"); + } const int command_priority = command->getPriority(); @@ -1739,7 +1743,7 @@ std::pair Unit::giveCommand(Command *command, bool tryQueu // we just queue it! } - else{ + else { //Delete all lower-prioirty commands for(list::iterator i= commands.begin(); i != commands.end();){ if((*i)->getPriority() < command_priority){ @@ -1754,7 +1758,7 @@ std::pair Unit::giveCommand(Command *command, bool tryQueu safeMutex.ReleaseLock(); } - else{ + else { ++i; } } diff --git a/source/glest_game/world/world.cpp b/source/glest_game/world/world.cpp index d44689b9..0719cf28 100644 --- a/source/glest_game/world/world.cpp +++ b/source/glest_game/world/world.cpp @@ -1307,7 +1307,7 @@ void World::createUnit(const string &unitName, int factionIndex, const Vec2i &po Faction* faction= factions[factionIndex]; if(faction->getIndex() != factionIndex) { - throw megaglest_runtime_error("faction->getIndex() != factionIndex"); + throw megaglest_runtime_error("faction->getIndex() != factionIndex",true); } const FactionType* ft= faction->getType(); @@ -1319,7 +1319,7 @@ void World::createUnit(const string &unitName, int factionIndex, const Vec2i &po newpath = new UnitPathBasic(); break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw megaglest_runtime_error("detected unsupported pathfinder type!",true); } Unit* unit= new Unit(getNextUnitId(faction), newpath, pos, ut, faction, &map, CardinalDir::NORTH); @@ -1329,18 +1329,20 @@ void World::createUnit(const string &unitName, int factionIndex, const Vec2i &po if(placeUnit(pos, generationArea, unit, spaciated)) { unit->create(true); unit->born(NULL); - if(scriptManager) scriptManager->onUnitCreated(unit); + if(scriptManager) { + scriptManager->onUnitCreated(unit); + } } else { delete unit; unit = NULL; - throw megaglest_runtime_error("Unit cant be placed"); + throw megaglest_runtime_error("Unit cant be placed",true); } if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] unit created for unit [%s]\n",__FILE__,__FUNCTION__,__LINE__,unit->toString().c_str()); } else { - throw megaglest_runtime_error("Invalid faction index in createUnitAtPosition: " + intToStr(factionIndex)); + throw megaglest_runtime_error("Invalid faction index in createUnitAtPosition: " + intToStr(factionIndex),true); } if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); @@ -1353,7 +1355,7 @@ void World::giveResource(const string &resourceName, int factionIndex, int amoun faction->incResourceAmount(rt, amount); } else { - throw megaglest_runtime_error("Invalid faction index in giveResource: " + intToStr(factionIndex)); + throw megaglest_runtime_error("Invalid faction index in giveResource: " + intToStr(factionIndex),true); } } @@ -1382,7 +1384,7 @@ vector World::getUnitsForFaction(int factionIndex,const string& commandType vector units; if(factionIndex < 0 || factionIndex > getFactionCount()) { - throw megaglest_runtime_error("Invalid faction index in getUnitsForFaction: " + intToStr(factionIndex)); + throw megaglest_runtime_error("Invalid faction index in getUnitsForFaction: " + intToStr(factionIndex),true); } Faction *faction = getFaction(factionIndex); if(faction != NULL) { @@ -1436,18 +1438,18 @@ void World::givePositionCommand(int unitId, const string &commandName, const Vec cc= ccAttack; } else { - throw megaglest_runtime_error("Invalid position commmand: " + commandName); + throw megaglest_runtime_error("Invalid position commmand: " + commandName,true); } if(unit->getType()->getFirstCtOfClass(cc) == NULL) { - throw megaglest_runtime_error("Invalid commmand: [" + commandName + "] for unit: [" + unit->getType()->getName(false) + "] id [" + intToStr(unit->getId()) + "]"); + throw megaglest_runtime_error("Invalid commmand: [" + commandName + "] for unit: [" + unit->getType()->getName(false) + "] id [" + intToStr(unit->getId()) + "]",true); } if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] cc = %d Unit [%s]\n",__FILE__,__FUNCTION__,__LINE__,cc,unit->getFullName(false).c_str()); unit->giveCommand(new Command( unit->getType()->getFirstCtOfClass(cc), pos )); if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); } else { - throw megaglest_runtime_error("Invalid unitId index in givePositionCommand: " + intToStr(unitId) + " commandName = " + commandName); + throw megaglest_runtime_error("Invalid unitId index in givePositionCommand: " + intToStr(unitId) + " commandName = " + commandName,true); } } @@ -1462,11 +1464,11 @@ void World::giveStopCommand(int unitId) { if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); } else { - throw megaglest_runtime_error("Invalid ct in giveStopCommand: " + intToStr(unitId)); + throw megaglest_runtime_error("Invalid ct in giveStopCommand: " + intToStr(unitId),true); } } else { - throw megaglest_runtime_error("Invalid unitId index in giveStopCommand: " + intToStr(unitId)); + throw megaglest_runtime_error("Invalid unitId index in giveStopCommand: " + intToStr(unitId),true); } } @@ -1521,15 +1523,15 @@ void World::giveAttackCommand(int unitId, int unitToAttackId) { if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); } else { - throw megaglest_runtime_error("Invalid ct in giveAttackCommand: " + intToStr(unitId) + " unitToAttackId = " + intToStr(unitToAttackId)); + throw megaglest_runtime_error("Invalid ct in giveAttackCommand: " + intToStr(unitId) + " unitToAttackId = " + intToStr(unitToAttackId),true); } } else { - throw megaglest_runtime_error("Invalid unitToAttackId index in giveAttackCommand: " + intToStr(unitId) + " unitToAttackId = " + intToStr(unitToAttackId)); + throw megaglest_runtime_error("Invalid unitToAttackId index in giveAttackCommand: " + intToStr(unitId) + " unitToAttackId = " + intToStr(unitToAttackId),true); } } else { - throw megaglest_runtime_error("Invalid unitId index in giveAttackCommand: " + intToStr(unitId) + " unitToAttackId = " + intToStr(unitToAttackId)); + throw megaglest_runtime_error("Invalid unitId index in giveAttackCommand: " + intToStr(unitId) + " unitToAttackId = " + intToStr(unitToAttackId),true); } } @@ -1565,7 +1567,7 @@ void World::giveProductionCommand(int unitId, const string &producedName) { } } else { - throw megaglest_runtime_error("Invalid unitId index in giveProductionCommand: " + intToStr(unitId) + " producedName = " + producedName); + throw megaglest_runtime_error("Invalid unitId index in giveProductionCommand: " + intToStr(unitId) + " producedName = " + producedName,true); } //printf("File: %s line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__); } @@ -1579,12 +1581,15 @@ void World::giveAttackStoppedCommand(int unitId, const string &itemName, bool ig for(int i= 0; i < ut->getCommandTypeCount(); ++i) { const CommandType* ct= ut->getCommandType(i); if(ct != NULL && ct->getClass() == ccAttackStopped) { + const AttackStoppedCommandType *act= static_cast(ct); if(act != NULL && act->getName(false) == itemName) { + if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); try { if(unit->getFaction()->reqsOk(act) == false && ignoreRequirements == true) { + if(SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); unit->setIgnoreCheckCommand(true); } @@ -1606,7 +1611,7 @@ void World::giveAttackStoppedCommand(int unitId, const string &itemName, bool ig } } else { - throw megaglest_runtime_error("Invalid unitId index in giveAttackStoppedCommand: " + intToStr(unitId) + " itemName = " + itemName); + throw megaglest_runtime_error("Invalid unitId index in giveAttackStoppedCommand: " + intToStr(unitId) + " itemName = " + itemName,true); } } @@ -1680,7 +1685,7 @@ void World::moveToUnit(int unitId, int destUnitId) { } } else { - throw megaglest_runtime_error("Invalid unitId index in followUnit: " + intToStr(unitId)); + throw megaglest_runtime_error("Invalid unitId index in followUnit: " + intToStr(unitId),true); } } @@ -1745,7 +1750,7 @@ void World::giveUpgradeCommand(int unitId, const string &upgradeName) { } } else { - throw megaglest_runtime_error("Invalid unitId index in giveUpgradeCommand: " + intToStr(unitId) + " upgradeName = " + upgradeName); + throw megaglest_runtime_error("Invalid unitId index in giveUpgradeCommand: " + intToStr(unitId) + " upgradeName = " + upgradeName,true); } } @@ -1757,7 +1762,7 @@ int World::getResourceAmount(const string &resourceName, int factionIndex) { return faction->getResource(rt)->getAmount(); } else { - throw megaglest_runtime_error("Invalid faction index in giveResource: " + intToStr(factionIndex) + " resourceName = " + resourceName); + throw megaglest_runtime_error("Invalid faction index in giveResource: " + intToStr(factionIndex) + " resourceName = " + resourceName,true); } } @@ -1769,14 +1774,14 @@ Vec2i World::getStartLocation(int factionIndex) { else { printf("\n=================================================\n%s\n",game->getGameSettings()->toString().c_str()); - throw megaglest_runtime_error("Invalid faction index in getStartLocation: " + intToStr(factionIndex) + " : " + intToStr(factions.size())); + throw megaglest_runtime_error("Invalid faction index in getStartLocation: " + intToStr(factionIndex) + " : " + intToStr(factions.size()),true); } } Vec2i World::getUnitPosition(int unitId) { Unit* unit= findUnitById(unitId); if(unit == NULL) { - throw megaglest_runtime_error("Can not find unit to get position unitId = " + intToStr(unitId)); + throw megaglest_runtime_error("Can not find unit to get position unitId = " + intToStr(unitId),true); } return unit->getPos(); } @@ -1784,7 +1789,7 @@ Vec2i World::getUnitPosition(int unitId) { void World::setUnitPosition(int unitId, Vec2i pos) { Unit* unit= findUnitById(unitId); if(unit == NULL) { - throw megaglest_runtime_error("Can not find unit to set position unitId = " + intToStr(unitId)); + throw megaglest_runtime_error("Can not find unit to set position unitId = " + intToStr(unitId),true); } unit->setTargetPos(pos); this->moveUnitCells(unit); @@ -1799,7 +1804,7 @@ void World::addCellMarker(Vec2i pos, int factionIndex, const string ¬e, const Vec2i surfaceCellPos = map.toSurfCoords(pos); SurfaceCell *sc = map.getSurfaceCell(surfaceCellPos); if(sc == NULL) { - throw megaglest_runtime_error("sc == NULL"); + throw megaglest_runtime_error("sc == NULL",true); } Vec3f vertex = sc->getVertex(); Vec2i targetPos(vertex.x,vertex.z); @@ -1830,7 +1835,7 @@ void World::showMarker(Vec2i pos, int factionIndex, const string ¬e, const st Vec2i surfaceCellPos = map.toSurfCoords(pos); SurfaceCell *sc = map.getSurfaceCell(surfaceCellPos); if(sc == NULL) { - throw megaglest_runtime_error("sc == NULL"); + throw megaglest_runtime_error("sc == NULL",true); } Vec3f vertex = sc->getVertex(); Vec2i targetPos(vertex.x,vertex.z); @@ -1847,7 +1852,7 @@ void World::showMarker(Vec2i pos, int factionIndex, const string ¬e, const st void World::highlightUnit(int unitId,float radius, float thickness, Vec4f color) { Unit* unit= findUnitById(unitId); if(unit == NULL) { - throw megaglest_runtime_error("Can not find unit to set highlight unitId = " + intToStr(unitId)); + throw megaglest_runtime_error("Can not find unit to set highlight unitId = " + intToStr(unitId),true); } game->highlightUnit(unitId,radius, thickness, color); } @@ -1855,7 +1860,7 @@ void World::highlightUnit(int unitId,float radius, float thickness, Vec4f color) void World::unhighlightUnit(int unitId) { Unit* unit= findUnitById(unitId); if(unit == NULL) { - throw megaglest_runtime_error("Can not find unit to set highlight unitId = " + intToStr(unitId)); + throw megaglest_runtime_error("Can not find unit to set highlight unitId = " + intToStr(unitId),true); } game->unhighlightUnit(unitId); } @@ -1864,14 +1869,14 @@ void World::unhighlightUnit(int unitId) { int World::getUnitFactionIndex(int unitId) { Unit* unit= findUnitById(unitId); if(unit == NULL) { - throw megaglest_runtime_error("Can not find Faction unit to get position unitId = " + intToStr(unitId)); + throw megaglest_runtime_error("Can not find Faction unit to get position unitId = " + intToStr(unitId),true); } return unit->getFactionIndex(); } const string World::getUnitName(int unitId) { Unit* unit= findUnitById(unitId); if(unit == NULL) { - throw megaglest_runtime_error("Can not find Faction unit to get position unitId = " + intToStr(unitId)); + throw megaglest_runtime_error("Can not find Faction unit to get position unitId = " + intToStr(unitId),true); } return unit->getFullName(game->showTranslatedTechTree()); } @@ -1890,7 +1895,7 @@ int World::getUnitCount(int factionIndex) { return count; } else { - throw megaglest_runtime_error("Invalid faction index in getUnitCount: " + intToStr(factionIndex)); + throw megaglest_runtime_error("Invalid faction index in getUnitCount: " + intToStr(factionIndex),true); } } @@ -1908,7 +1913,7 @@ int World::getUnitCountOfType(int factionIndex, const string &typeName) { return count; } else { - throw megaglest_runtime_error("Invalid faction index in getUnitCountOfType: " + intToStr(factionIndex)); + throw megaglest_runtime_error("Invalid faction index in getUnitCountOfType: " + intToStr(factionIndex),true); } }