diff --git a/source/g3d_viewer/renderer.cpp b/source/g3d_viewer/renderer.cpp index 6a4e99634..f0828c72e 100644 --- a/source/g3d_viewer/renderer.cpp +++ b/source/g3d_viewer/renderer.cpp @@ -111,7 +111,7 @@ namespace Shared { message += "ZetaGlest needs a version that supports\n"; message += "glActiveTexture (OpenGL 1.3) or the ARB_multitexture extension."; - throw megaglest_runtime_error(message.c_str()); + throw game_runtime_error(message.c_str()); } //opengl 1.3 @@ -124,7 +124,7 @@ namespace Shared { message += "ZetaGlest needs at least version 1.3 to work\n"; message += "You may solve this problem by installing your latest video card drivers"; - throw megaglest_runtime_error(message.c_str()); + throw game_runtime_error(message.c_str()); } //opengl 1.4 or extension @@ -137,7 +137,7 @@ namespace Shared { void Renderer::checkExtension(const string &extension, const string &msg) { if (isGlExtensionSupported(extension.c_str()) == false) { string str = "OpenGL extension not supported: " + extension + ", required for " + msg; - throw megaglest_runtime_error(str); + throw game_runtime_error(str); } } @@ -174,7 +174,7 @@ namespace Shared { if (glActiveTexture == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error: glActiveTexture == NULL\nglActiveTexture is only supported if the GL version is 1.3 or greater,\nor if the ARB_multitexture extension is supported!"); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } modelRenderer = gf->newModelRenderer(); @@ -434,7 +434,7 @@ namespace Shared { customTexture = customTextureMagenta; break; default: - throw megaglest_runtime_error("Unknown playercolor: " + intToStr(playerColor)); + throw game_runtime_error("Unknown playercolor: " + intToStr(playerColor)); break; } diff --git a/source/glest_game/ai/ai.cpp b/source/glest_game/ai/ai.cpp index 4b6587509..41eb4a7fc 100644 --- a/source/glest_game/ai/ai.cpp +++ b/source/glest_game/ai/ai.cpp @@ -475,7 +475,7 @@ namespace RandomGen * Ai::getRandom() { // if(Thread::isCurrentThreadMainThread() == false) { - // throw megaglest_runtime_error("Invalid access to AI random from outside main thread current id = " + + // throw game_runtime_error("Invalid access to AI random from outside main thread current id = " + // intToStr(Thread::getCurrentThreadId()) + " main = " + intToStr(Thread::getMainThreadId())); // } return &random; @@ -577,7 +577,7 @@ namespace rule = aiRules[ruleIdx]; if (rule == NULL) { throw - megaglest_runtime_error("rule == NULL"); + game_runtime_error("rule == NULL"); } if (SystemFlags:: diff --git a/source/glest_game/ai/ai_interface.cpp b/source/glest_game/ai/ai_interface.cpp index 7558f49a6..453dacf39 100644 --- a/source/glest_game/ai/ai_interface.cpp +++ b/source/glest_game/ai/ai_interface.cpp @@ -270,7 +270,7 @@ namespace __FUNCTION__, __LINE__); throw - megaglest_runtime_error(ex.what()); + game_runtime_error(ex.what()); } if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem). enabled) @@ -332,7 +332,7 @@ namespace #endif if (fp == NULL) { throw - megaglest_runtime_error("Can't open file: [" + aiLogFile + + game_runtime_error("Can't open file: [" + aiLogFile + "]"); } fprintf(fp, @@ -553,7 +553,7 @@ namespace printf("In [%s::%s Line: %d] Can not find AI unit in AI factionIndex = %d. Game out of sync.\n", __FILE__, __FUNCTION__, __LINE__, factionIndex); /*throw - megaglest_runtime_error(szBuf);*/ + game_runtime_error(szBuf);*/ return result; } Command* currentCommand = unit->getCurrCommand(); @@ -565,7 +565,7 @@ namespace printf("In [%s::%s Line: %d] Can not find AI unittype with unit id: %d, AI factionIndex = %d. Game out of sync.\n", __FILE__, __FUNCTION__, __LINE__, unit->getId(), factionIndex); /*throw - megaglest_runtime_error(szBuf);*/ + game_runtime_error(szBuf);*/ return result; } if (commandType == NULL) { @@ -573,7 +573,7 @@ namespace __FILE__, __FUNCTION__, __LINE__, unit->getId(), factionIndex); /*throw - megaglest_runtime_error(szBuf);*/ + game_runtime_error(szBuf);*/ return result; } const CommandType * @@ -597,7 +597,7 @@ namespace std::string sError = "worldLog = " + worldLog + " " + string(szBuf); throw - megaglest_runtime_error(sError);*/ + game_runtime_error(sError);*/ return result; } @@ -648,7 +648,7 @@ namespace __FILE__, __FUNCTION__, __LINE__, unitIndex, factionIndex); /*throw - megaglest_runtime_error(szBuf);*/ + game_runtime_error(szBuf);*/ return result; } Command* currentCommand = unit->getCurrCommand(); @@ -661,7 +661,7 @@ namespace __FILE__, __FUNCTION__, __LINE__, unitIndex, factionIndex); /*throw - megaglest_runtime_error(szBuf);*/ + game_runtime_error(szBuf);*/ return result; } const CommandType * @@ -685,7 +685,7 @@ namespace std::string sError = "worldLog = " + worldLog + " " + string(szBuf); throw - megaglest_runtime_error(sError);*/ + game_runtime_error(sError);*/ return result; } @@ -735,7 +735,7 @@ namespace __FILE__, __FUNCTION__, __LINE__, unitIndex, factionIndex); /*throw - megaglest_runtime_error(szBuf);*/ + game_runtime_error(szBuf);*/ return result; } Command* currentCommand = unit->getCurrCommand(); @@ -748,7 +748,7 @@ namespace __FILE__, __FUNCTION__, __LINE__, unitIndex, factionIndex); /*throw - megaglest_runtime_error(szBuf);*/ + game_runtime_error(szBuf);*/ return result; } const CommandType * @@ -772,7 +772,7 @@ namespace std::string sError = "worldLog = " + worldLog + " " + string(szBuf); throw - megaglest_runtime_error(sError);*/ + game_runtime_error(sError);*/ return result; } @@ -824,7 +824,7 @@ namespace __FILE__, __FUNCTION__, __LINE__, unitIndex, factionIndex); /*throw - megaglest_runtime_error(szBuf);*/ + game_runtime_error(szBuf);*/ return result; } Command* currentCommand = unit->getCurrCommand(); @@ -837,7 +837,7 @@ namespace __FILE__, __FUNCTION__, __LINE__, unitIndex, factionIndex); /*throw - megaglest_runtime_error(szBuf);*/ + game_runtime_error(szBuf);*/ return result; } const CommandType * ct = unit->getType()->findCommandTypeById(commandType->getId()); @@ -860,7 +860,7 @@ namespace std::string sError = "worldLog = " + worldLog + " " + string(szBuf); throw - megaglest_runtime_error(sError);*/ + game_runtime_error(sError);*/ return result; } @@ -973,7 +973,7 @@ namespace __FILE__, __FUNCTION__, __LINE__, unitIndex, world->getFaction(factionIndex)->getUnitCount()); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } return world->getFaction(factionIndex)->getUnit(unitIndex); diff --git a/source/glest_game/ai/ai_interface.h b/source/glest_game/ai/ai_interface.h index deda909b5..031ce9492 100644 --- a/source/glest_game/ai/ai_interface.h +++ b/source/glest_game/ai/ai_interface.h @@ -148,13 +148,13 @@ namespace AiInterface(const AiInterface & obj) { init(); throw - megaglest_runtime_error("class AiInterface is NOT safe to copy!"); + game_runtime_error("class AiInterface is NOT safe to copy!"); } AiInterface & operator= (const AiInterface & obj) { init(); throw - megaglest_runtime_error("class AiInterface is NOT safe to assign!"); + game_runtime_error("class AiInterface is NOT safe to assign!"); } //main diff --git a/source/glest_game/ai/ai_rule.cpp b/source/glest_game/ai/ai_rule.cpp index cc6ba04d9..fc90df698 100644 --- a/source/glest_game/ai/ai_rule.cpp +++ b/source/glest_game/ai/ai_rule.cpp @@ -1631,7 +1631,7 @@ namespace MorphCommandType *>(ct); if (mct == NULL) { throw - megaglest_runtime_error + game_runtime_error ("mct == NULL"); } if (mct-> @@ -1770,7 +1770,7 @@ namespace aiInterface->getMyUnitCount(), i, producers.size()); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } const Unit * @@ -1825,7 +1825,7 @@ namespace aiInterface->getMyUnitCount(), i, producers.size()); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } if (prIndex >= (int) producers.size()) { char @@ -1842,7 +1842,7 @@ namespace currentProducerIndex, i, producers.size()); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } currentCommandCount = @@ -1954,7 +1954,7 @@ namespace getMyUnitCount(), i, backupProducers.size()); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } if (prIndex >= (int) backupProducers.size()) { @@ -1973,7 +1973,7 @@ namespace currentProducerIndex, i, backupProducers.size()); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } int diff --git a/source/glest_game/ai/path_finder.cpp b/source/glest_game/ai/path_finder.cpp index 8aa6f0730..410ffde0e 100644 --- a/source/glest_game/ai/path_finder.cpp +++ b/source/glest_game/ai/path_finder.cpp @@ -191,7 +191,7 @@ namespace if (map == NULL) { throw - megaglest_runtime_error("map == NULL"); + game_runtime_error("map == NULL"); } unit->setCurrentPathFinderDesiredFinalPos(finalPos); @@ -346,7 +346,7 @@ namespace } } else { throw - megaglest_runtime_error + game_runtime_error ("unsupported or missing path finder detected!"); } } @@ -489,7 +489,7 @@ namespace factions.getFactionState(factionIndex); //if(Thread::isCurrentThreadMainThread() == false) { - // throw megaglest_runtime_error("#2 Invalid access to FactionState random from outside main thread current id = " + + // throw game_runtime_error("#2 Invalid access to FactionState random from outside main thread current id = " + // intToStr(Thread::getCurrentThreadId()) + " main = " + intToStr(Thread::getMainThreadId())); //} @@ -667,7 +667,7 @@ namespace if (faction.precachedPath[unit->getId()].size() <= 0) { throw - megaglest_runtime_error + game_runtime_error ("factions[unit->getFactionIndex()].precachedPath[unit->getId()].size() <= 0!"); } @@ -741,7 +741,7 @@ namespace } } else { throw - megaglest_runtime_error + game_runtime_error ("unsupported or missing path finder detected!"); } } @@ -770,7 +770,7 @@ namespace __FUNCTION__, __LINE__); throw - megaglest_runtime_error(ex.what()); + game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; @@ -778,7 +778,7 @@ namespace __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } return ts; @@ -818,7 +818,7 @@ namespace if (map == NULL) { throw - megaglest_runtime_error("map == NULL"); + game_runtime_error("map == NULL"); } @@ -883,7 +883,7 @@ namespace toSurfCoords(nodePos)) == false) { throw - megaglest_runtime_error + game_runtime_error ("Pathfinder invalid node path position = " + nodePos.getString() + " i = " + intToStr(i)); } @@ -924,7 +924,7 @@ namespace toSurfCoords (nodePos)) == false) { throw - megaglest_runtime_error + game_runtime_error ("Pathfinder invalid node path position = " + nodePos.getString() + " i = " + intToStr(i)); @@ -1019,7 +1019,7 @@ namespace firstNode = newNode(faction, maxNodeCount); if (firstNode == NULL) { throw - megaglest_runtime_error("firstNode == NULL"); + game_runtime_error("firstNode == NULL"); } firstNode->next = NULL; @@ -1398,7 +1398,7 @@ namespace || map->isInsideSurface(map->toSurfCoords(nodePos)) == false) { throw - megaglest_runtime_error + game_runtime_error ("Pathfinder invalid node path position = " + nodePos.getString() + " i = " + intToStr(i)); } @@ -1555,7 +1555,7 @@ namespace __FUNCTION__, __LINE__); throw - megaglest_runtime_error(ex.what()); + game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; @@ -1563,7 +1563,7 @@ namespace __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } return ts; @@ -1608,7 +1608,7 @@ namespace __FUNCTION__, __LINE__); throw - megaglest_runtime_error(ex.what()); + game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; @@ -1616,7 +1616,7 @@ namespace __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } } @@ -1631,7 +1631,7 @@ namespace if (map == NULL) { throw - megaglest_runtime_error("map == NULL"); + game_runtime_error("map == NULL"); } //unit data @@ -1675,7 +1675,7 @@ namespace __FUNCTION__, __LINE__); throw - megaglest_runtime_error(ex.what()); + game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; @@ -1683,7 +1683,7 @@ namespace __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } return nearestPos; @@ -1752,13 +1752,13 @@ namespace // SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] Error [%s]\n",__FILE__,__FUNCTION__,__LINE__,ex.what()); // if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__,__LINE__); // - // throw megaglest_runtime_error(ex.what()); + // throw game_runtime_error(ex.what()); // } // catch(...) { // char szBuf[8096]=""; // snprintf(szBuf,8096,"In [%s::%s %d] UNKNOWN error\n",__FILE__,__FUNCTION__,__LINE__); // SystemFlags::OutputDebug(SystemFlags::debugError,szBuf); - // throw megaglest_runtime_error(szBuf); + // throw game_runtime_error(szBuf); // } // // return unitImmediatelyBlocked; diff --git a/source/glest_game/ai/path_finder.h b/source/glest_game/ai/path_finder.h index 1bc25f0f6..9c807adad 100644 --- a/source/glest_game/ai/path_finder.h +++ b/source/glest_game/ai/path_finder.h @@ -278,12 +278,12 @@ namespace PathFinder(const PathFinder & obj) { init(); throw - megaglest_runtime_error("class PathFinder is NOT safe to copy!"); + game_runtime_error("class PathFinder is NOT safe to copy!"); } PathFinder & operator= (const PathFinder & obj) { init(); throw - megaglest_runtime_error("class PathFinder is NOT safe to assign!"); + game_runtime_error("class PathFinder is NOT safe to assign!"); } void @@ -351,7 +351,7 @@ namespace minHeuristicFastLookup(FactionState & faction) { if (faction.openNodesList.empty() == true) { throw - megaglest_runtime_error("openNodesList.empty() == true"); + game_runtime_error("openNodesList.empty() == true"); } Node * @@ -567,7 +567,7 @@ namespace cellCount = 0; // if(Thread::isCurrentThreadMainThread() == false) { - // throw megaglest_runtime_error("#1 Invalid access to FactionState random from outside main thread current id = " + + // throw game_runtime_error("#1 Invalid access to FactionState random from outside main thread current id = " + // intToStr(Thread::getCurrentThreadId()) + " main = " + intToStr(Thread::getMainThreadId())); // } diff --git a/source/glest_game/facilities/auto_test.cpp b/source/glest_game/facilities/auto_test.cpp index c26d56701..90c94b98c 100644 --- a/source/glest_game/facilities/auto_test.cpp +++ b/source/glest_game/facilities/auto_test.cpp @@ -73,7 +73,7 @@ namespace Glest { loadGameSettingsFile, &gameSettings); if (fileFound == false) { - throw megaglest_runtime_error("Specified game settings file [" + loadGameSettingsFile + "] was NOT found!"); + throw game_runtime_error("Specified game settings file [" + loadGameSettingsFile + "] was NOT found!"); } //printf("Got settings:\n%s",gameSettings.toString().c_str()); mainMenu->setState(new MenuStateCustomGame(program, mainMenu, false, pNewGame, true, &gameSettings)); diff --git a/source/glest_game/facilities/components.cpp b/source/glest_game/facilities/components.cpp index e0540c48b..5dd172d91 100644 --- a/source/glest_game/facilities/components.cpp +++ b/source/glest_game/facilities/components.cpp @@ -53,7 +53,7 @@ namespace Glest { if (containerName == "" || objName == "") { //char szBuf[8096]=""; //snprintf(szBuf,8096,"Control not properly registered Container [%s] Control [%s]\n",containerName.c_str(),objName.c_str()); - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); } if (objName != "" && registerControl) { registerGraphicComponent(containerName, objName); @@ -119,7 +119,7 @@ namespace Glest { if (containerName == "" || objName == "") { //char szBuf[8096]=""; //snprintf(szBuf,8096,"Control not properly registered Container [%s] Control [%s]\n",this->containerName.c_str(),objName.c_str()); - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); } this->containerName = containerName; @@ -139,7 +139,7 @@ namespace Glest { if (containerName == "" || objName == "") { //char szBuf[8096]=""; //snprintf(szBuf,8096,"Control not properly registered Container [%s] Control [%s]\n",this->containerName.c_str(),objName.c_str()); - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); } this->containerName = containerName; @@ -519,7 +519,7 @@ namespace Glest { if (errorOnMissing == true && (index < 0 || index >= (int) items.size())) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Index not found in listbox name: [%s] value index: %d size: %lu", this->instanceName.c_str(), index, (unsigned long) items.size()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } selectedItemIndex = index; setText(getSelectedItem()); @@ -594,7 +594,7 @@ namespace Glest { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Value not found in listbox name: [%s] value: %s", this->instanceName.c_str(), item.c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); }*/ } else { setSelectedItemIndex(iter - items.begin()); diff --git a/source/glest_game/facilities/logger.cpp b/source/glest_game/facilities/logger.cpp index 64e09aaf3..041a9a923 100644 --- a/source/glest_game/facilities/logger.cpp +++ b/source/glest_game/facilities/logger.cpp @@ -106,7 +106,7 @@ namespace Glest { FILE *f = fopen(fileName.c_str(), "wt+"); #endif if (f == NULL) { - throw megaglest_runtime_error("Error opening log file" + fileName); + throw game_runtime_error("Error opening log file" + fileName); } fprintf(f, "%s", s.c_str()); diff --git a/source/glest_game/game/chat_manager.cpp b/source/glest_game/game/chat_manager.cpp index 856402482..cc1a3bf8f 100644 --- a/source/glest_game/game/chat_manager.cpp +++ b/source/glest_game/game/chat_manager.cpp @@ -120,7 +120,7 @@ namespace __FUNCTION__, __LINE__, ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, @@ -497,7 +497,7 @@ namespace __FUNCTION__, __LINE__, ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } SystemFlags::OutputDebug(SystemFlags::debugSystem, @@ -706,7 +706,7 @@ namespace __FUNCTION__, __LINE__, ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } } diff --git a/source/glest_game/game/commander.cpp b/source/glest_game/game/commander.cpp index 51041d7ca..9d35b3408 100644 --- a/source/glest_game/game/commander.cpp +++ b/source/glest_game/game/commander.cpp @@ -685,7 +685,7 @@ namespace sendTextMessage(szMsg, -1, true, ""); } /*throw - megaglest_runtime_error(szBuf);*/ + game_runtime_error(szBuf);*/ return std::pair(crFailUndefined, ""); } } @@ -1046,7 +1046,7 @@ namespace vote = faction->getSwitchTeamVote(factionIndex); if (vote == NULL) { throw - megaglest_runtime_error("vote == NULL"); + game_runtime_error("vote == NULL"); } vote->voted = true; vote->allowSwitchTeam = allowSwitchTeam; @@ -1600,7 +1600,7 @@ namespace extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, networkCommand->getUnitId()); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } // Create the command. Command * @@ -1627,7 +1627,7 @@ namespace gameNetworkInterface->sendTextMessage(szMsg, -1, true, ""); /*throw - megaglest_runtime_error(szBuf);*/ + game_runtime_error(szBuf);*/ return command; } @@ -1715,7 +1715,7 @@ namespace || networkCommand->getTargetId() >= 4) { printf("networkCommand->getTargetId() >= 0 && networkCommand->getTargetId() < 4, [%s]", networkCommand->toString().c_str()); /*throw - megaglest_runtime_error(szBuf);*/ + game_runtime_error(szBuf);*/ return command; } facing = CardinalDir(networkCommand->getTargetId()); diff --git a/source/glest_game/game/console.cpp b/source/glest_game/game/console.cpp index ce120a2dc..9c6b4f4aa 100644 --- a/source/glest_game/game/console.cpp +++ b/source/glest_game/game/console.cpp @@ -198,7 +198,7 @@ namespace Glest { snprintf(szBuf, 8096, "In [%s::%s %d] error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -235,7 +235,7 @@ namespace Glest { snprintf(szBuf, 8096, "In [%s::%s %d] error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -261,25 +261,25 @@ namespace Glest { //string Console::getLine(int i) const { // if(i < 0 || i >= (int)lines.size()) - // throw megaglest_runtime_error("i >= Lines.size()"); + // throw game_runtime_error("i >= Lines.size()"); // return lines[i].text; //} //string Console::getStoredLine(int i) const { // if(i < 0 || i >= (int)storedLines.size()) - // throw megaglest_runtime_error("i >= storedLines.size()"); + // throw game_runtime_error("i >= storedLines.size()"); // return storedLines[i].text; //} ConsoleLineInfo Console::getLineItem(int i) const { if (i < 0 || i >= (int) lines.size()) - throw megaglest_runtime_error("i >= Lines.size()"); + throw game_runtime_error("i >= Lines.size()"); return lines[i]; } ConsoleLineInfo Console::getStoredLineItem(int i) const { if (i < 0 || i >= (int) storedLines.size()) - throw megaglest_runtime_error("i >= storedLines.size()"); + throw game_runtime_error("i >= storedLines.size()"); return storedLines[i]; } diff --git a/source/glest_game/game/game.cpp b/source/glest_game/game/game.cpp index cd02ca4ec..e2e5aab99 100644 --- a/source/glest_game/game/game.cpp +++ b/source/glest_game/game/game.cpp @@ -1683,7 +1683,7 @@ namespace Glest { "Line ref: %d, ERROR: Cannot find techtree: [%s]", __LINE__, techName.c_str()); - throw megaglest_runtime_error(szBuf, true); + throw game_runtime_error(szBuf, true); } } @@ -1836,7 +1836,7 @@ namespace Glest { "*" + lang.getString("AI") + "* "; if (map == NULL) { - throw megaglest_runtime_error("map == NULL"); + throw game_runtime_error("map == NULL"); } if (SystemFlags:: @@ -1871,7 +1871,7 @@ namespace Glest { try { world.init(this, gameSettings.getDefaultUnits()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { string sErrBuf = ""; if (ex.wantStackTrace() == true) { char szErrBuf[8096] = ""; @@ -2182,15 +2182,15 @@ namespace Glest { if (this->masterserverMode == false) { if (world.getThisFaction() == NULL) { - throw megaglest_runtime_error("world.getThisFaction() == NULL"); + throw game_runtime_error("world.getThisFaction() == NULL"); } if (world.getThisFaction()->getType() == NULL) { throw - megaglest_runtime_error + game_runtime_error ("world.getThisFaction()->getType() == NULL"); } //if(world.getThisFaction()->getType()->getMusic() == NULL) { - // throw megaglest_runtime_error("world.getThisFaction()->getType()->getMusic() == NULL"); + // throw game_runtime_error("world.getThisFaction()->getType()->getMusic() == NULL"); //} } @@ -2994,7 +2994,7 @@ namespace Glest { for (int j = 0; j < world.getFactionCount(); ++j) { Faction *faction = world.getFaction(j); if (faction == NULL) { - throw megaglest_runtime_error("faction == NULL"); + throw game_runtime_error("faction == NULL"); } if (faction->getCpuControl (enableServerControlledAI, @@ -4257,7 +4257,7 @@ namespace Glest { snprintf(szBuf, 8096, "In [%s::%s %d] error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -4289,7 +4289,7 @@ namespace Glest { snprintf(szBuf, 8096, "In [%s::%s %d] error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -4327,7 +4327,7 @@ namespace Glest { snprintf(szBuf, 8096, "In [%s::%s %d] error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -4351,7 +4351,7 @@ namespace Glest { const Faction *faction = mc.getFaction(); if (getWorld()->getThisFaction() == NULL) { throw - megaglest_runtime_error("getWorld()->getThisFaction() == NULL"); + game_runtime_error("getWorld()->getThisFaction() == NULL"); } //printf("faction [%p][%s]\n",faction,(faction != NULL ? faction->getType()->getName().c_str() : "")); if ((faction == NULL) || @@ -9018,7 +9018,7 @@ namespace Glest { snprintf(szBuf, 8096, lang.getString("SavedGameBadVersion").c_str(), gameVer.c_str(), GameVersionString.c_str()); - throw megaglest_runtime_error(szBuf, true); + throw game_runtime_error(szBuf, true); } if (SystemFlags::VERBOSE_MODE_ENABLED) @@ -9108,7 +9108,7 @@ namespace Glest { snprintf(szBuf, 8096, lang.getString("SavedGameBadVersion").c_str(), gameVer.c_str(), GameVersionString.c_str()); - throw megaglest_runtime_error(szBuf, true); + throw game_runtime_error(szBuf, true); } if (SystemFlags::VERBOSE_MODE_ENABLED) @@ -9134,7 +9134,7 @@ namespace Glest { snprintf(szBuf, 8096, lang.getString("SavedGameBadVersion").c_str(), gameVer.c_str(), GameVersionString.c_str()); - throw megaglest_runtime_error(szBuf, true); + throw game_runtime_error(szBuf, true); } // This is explored fog of war for the host player, clear it minimapNode->clearChild("fowPixmap1"); diff --git a/source/glest_game/game/game_settings.h b/source/glest_game/game/game_settings.h index db3199f51..3d00f3279 100644 --- a/source/glest_game/game/game_settings.h +++ b/source/glest_game/game/game_settings.h @@ -321,7 +321,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } return factionTypeNames[factionIndex]; } @@ -333,7 +333,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } string @@ -351,7 +351,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } string @@ -367,7 +367,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } return @@ -381,7 +381,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } return @@ -396,7 +396,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } return @@ -460,7 +460,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } return @@ -474,7 +474,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } return @@ -490,7 +490,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } return networkPlayerUUID[factionIndex]; @@ -529,7 +529,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } return @@ -544,7 +544,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } return @@ -558,7 +558,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid startIndex = %d\n", __FUNCTION__, startIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } for (int i = 0; i < GameConstants::maxPlayers; ++i) { @@ -701,7 +701,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } this->factionTypeNames[factionIndex] = factionTypeName; @@ -714,7 +714,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } this->networkPlayerNames[factionIndex] = playername; @@ -727,7 +727,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } this->networkPlayerPlatform[factionIndex] = platform; @@ -741,7 +741,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } this->networkPlayerStatuses[factionIndex] = status; @@ -755,7 +755,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } this->networkPlayerGameStatus[factionIndex] = status; @@ -768,7 +768,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } this->networkPlayerLanguages[factionIndex] = language; @@ -782,7 +782,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } this->factionControls[factionIndex] = controller; @@ -795,7 +795,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } //if(multiplierIndex >= 45) { @@ -813,7 +813,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } this->networkPlayerUUID[factionIndex] = uuid; @@ -835,7 +835,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } this->teams[factionIndex] = team; @@ -848,7 +848,7 @@ namespace snprintf(szBuf, 8096, "In [%s] Invalid factionIndex = %d\n", __FUNCTION__, factionIndex); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } this->startLocationIndex[factionIndex] = startLocationIndex; diff --git a/source/glest_game/game/script_manager.cpp b/source/glest_game/game/script_manager.cpp index 2a32e5fcd..22c269b1c 100644 --- a/source/glest_game/game/script_manager.cpp +++ b/source/glest_game/game/script_manager.cpp @@ -641,7 +641,7 @@ namespace luaScript.beginCall("onLoad"); luaScript.endCall(); } - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { //string sErrBuf = ""; //if(ex.wantStackTrace() == true) { char @@ -1733,7 +1733,7 @@ namespace lock); } else { throw - megaglest_runtime_error + game_runtime_error ("Invalid faction index in setLockedUnitForFaction: " + intToStr(factionIndex), true); } @@ -1754,7 +1754,7 @@ namespace unit_dead = unit->decHp(unit->getHp() * unit->getHp()); if (unit_dead == false) { throw - megaglest_runtime_error("unit_dead == false", true); + game_runtime_error("unit_dead == false", true); } unit->kill(); // If called from an existing die event we get a stack overflow @@ -2418,7 +2418,7 @@ namespace if (world->getGame() == NULL) { throw - megaglest_runtime_error("#1 world->getGame() == NULL", true); + game_runtime_error("#1 world->getGame() == NULL", true); } world->getGame()->startPerformanceTimer(); @@ -2429,7 +2429,7 @@ namespace if (world->getGame() == NULL) { throw - megaglest_runtime_error("#2 world->getGame() == NULL", true); + game_runtime_error("#2 world->getGame() == NULL", true); } world->getGame()->endPerformanceTimer(); @@ -2440,7 +2440,7 @@ namespace if (world->getGame() == NULL) { throw - megaglest_runtime_error("#3 world->getGame() == NULL", true); + game_runtime_error("#3 world->getGame() == NULL", true); } return world->getGame()->getPerformanceTimerResults(); } @@ -2882,7 +2882,7 @@ namespace unit = world->findUnitById(unitId); if (unit == NULL) { throw - megaglest_runtime_error("unit == NULL", true); + game_runtime_error("unit == NULL", true); } int result = @@ -3270,7 +3270,7 @@ namespace tf = world->getTimeFlow(); if (tf == NULL) { throw - megaglest_runtime_error("#1 tf == NULL", true); + game_runtime_error("#1 tf == NULL", true); } return tf->isDay(); } @@ -3287,7 +3287,7 @@ namespace tf = world->getTimeFlow(); if (tf == NULL) { throw - megaglest_runtime_error("#2 tf == NULL", true); + game_runtime_error("#2 tf == NULL", true); } return tf->isNight(); } @@ -3306,7 +3306,7 @@ namespace tf = world->getTimeFlow(); if (tf == NULL) { throw - megaglest_runtime_error("#3 tf == NULL", true); + game_runtime_error("#3 tf == NULL", true); } //printf("File: %s line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__); return tf->getTime(); @@ -3316,7 +3316,7 @@ namespace ScriptManager::disableSpeedChange() { if (world->getGame() == NULL) { throw - megaglest_runtime_error("#4 world->getGame() == NULL"); + game_runtime_error("#4 world->getGame() == NULL"); } world->getGame()->setDisableSpeedChange(true); } @@ -3324,7 +3324,7 @@ namespace ScriptManager::enableSpeedChange() { if (world->getGame() == NULL) { throw - megaglest_runtime_error("#5 world->getGame() == NULL"); + game_runtime_error("#5 world->getGame() == NULL"); } world->getGame()->setDisableSpeedChange(false); } @@ -3333,7 +3333,7 @@ namespace ScriptManager::getSpeedChangeEnabled() { if (world->getGame() == NULL) { throw - megaglest_runtime_error("#6 world->getGame() == NULL"); + game_runtime_error("#6 world->getGame() == NULL"); } return world->getGame()->getDisableSpeedChange(); } @@ -3397,7 +3397,7 @@ namespace getString(-2), luaArguments. getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3416,7 +3416,7 @@ namespace getString(-2), luaArguments. getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3433,7 +3433,7 @@ namespace getInt(-2), luaArguments. getVec2i(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3450,7 +3450,7 @@ namespace getInt(-2), luaArguments. getVec2i(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3465,7 +3465,7 @@ namespace try { thisScriptManager->setDisplayText(luaArguments.getString(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3479,7 +3479,7 @@ namespace try { thisScriptManager->addConsoleText(luaArguments.getString(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3493,7 +3493,7 @@ namespace try { luaArguments.returnString(thisScriptManager->translate(luaArguments.getString(-1))); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3507,7 +3507,7 @@ namespace try { thisScriptManager->clearDisplayText(); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3522,7 +3522,7 @@ namespace try { thisScriptManager-> setCameraPosition(Vec2i(luaArguments.getVec2i(-1))); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3537,7 +3537,7 @@ namespace try { thisScriptManager->shakeCamera(luaArguments.getInt(-2), luaArguments.getInt(-1), false, 0); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3553,7 +3553,7 @@ namespace thisScriptManager->shakeCamera(luaArguments.getInt(-3), luaArguments.getInt(-2), true, luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3577,7 +3577,7 @@ namespace thisScriptManager->createUnit(luaArguments.getString(-3), luaArguments.getInt(-2), luaArguments.getVec2i(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3586,7 +3586,7 @@ namespace void ScriptManager::error(LuaHandle * luaHandle, - const megaglest_runtime_error * mgErr, + const game_runtime_error * mgErr, const char *file, const char *function, int line) { char szErrBuf[8096] = ""; @@ -3649,7 +3649,7 @@ namespace thisScriptManager->createUnitNoSpacing(luaArguments.getString(-3), luaArguments.getInt(-2), luaArguments.getVec2i(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3670,7 +3670,7 @@ namespace try { thisScriptManager->destroyUnit(luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3697,7 +3697,7 @@ namespace (luaArguments. getInt(-1) == 0 ? false : true)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3719,7 +3719,7 @@ namespace try { thisScriptManager->giveKills(luaArguments.getInt(-2), luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3744,7 +3744,7 @@ namespace thisScriptManager->morphToUnit(luaArguments.getInt(-3), luaArguments.getString(-2), luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3767,7 +3767,7 @@ namespace try { thisScriptManager->moveToUnit(luaArguments.getInt(-2), luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3787,7 +3787,7 @@ namespace try { thisScriptManager->playStaticSound(luaArguments.getString(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3807,7 +3807,7 @@ namespace try { thisScriptManager->playStreamingSound(luaArguments.getString(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3827,7 +3827,7 @@ namespace try { thisScriptManager->stopStreamingSound(luaArguments.getString(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3846,7 +3846,7 @@ namespace try { thisScriptManager->stopAllSound(); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3866,7 +3866,7 @@ namespace try { thisScriptManager->playStaticVideo(luaArguments.getString(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3886,7 +3886,7 @@ namespace try { thisScriptManager->playStreamingVideo(luaArguments.getString(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3906,7 +3906,7 @@ namespace try { thisScriptManager->stopStreamingVideo(luaArguments.getString(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3926,7 +3926,7 @@ namespace try { thisScriptManager->stopAllVideo(); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3946,7 +3946,7 @@ namespace try { thisScriptManager->togglePauseGame(luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3960,7 +3960,7 @@ namespace thisScriptManager->giveResource(luaArguments.getString(-3), luaArguments.getInt(-2), luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3975,7 +3975,7 @@ namespace thisScriptManager->givePositionCommand(luaArguments.getInt(-3), luaArguments.getString(-2), luaArguments.getVec2i(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -3989,7 +3989,7 @@ namespace try { thisScriptManager->giveAttackCommand(luaArguments.getInt(-2), luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4004,7 +4004,7 @@ namespace thisScriptManager->giveProductionCommand(luaArguments.getInt(-2), luaArguments. getString(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4018,7 +4018,7 @@ namespace try { thisScriptManager->giveUpgradeCommand(luaArguments.getInt(-2), luaArguments.getString(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4035,7 +4035,7 @@ namespace getString(-2), luaArguments. getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4048,7 +4048,7 @@ namespace luaArguments(luaHandle); try { thisScriptManager->disableAi(luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4061,7 +4061,7 @@ namespace luaArguments(luaHandle); try { thisScriptManager->enableAi(luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4076,7 +4076,7 @@ namespace bool result = thisScriptManager->getAiEnabled(luaArguments.getInt(-1)); luaArguments.returnInt(result); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4089,7 +4089,7 @@ namespace luaArguments(luaHandle); try { thisScriptManager->disableConsume(luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4102,7 +4102,7 @@ namespace luaArguments(luaHandle); try { thisScriptManager->enableConsume(luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4118,7 +4118,7 @@ namespace result = thisScriptManager->getConsumeEnabled(luaArguments.getInt(-1)); luaArguments.returnInt(result); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4137,7 +4137,7 @@ namespace registerCellTriggerEventForUnitToUnit(luaArguments.getInt(-2), luaArguments.getInt(-1)); luaArguments.returnInt(result); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4157,7 +4157,7 @@ namespace luaArguments. getVec2i(-1)); luaArguments.returnInt(result); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4178,7 +4178,7 @@ namespace luaArguments. getVec4i(-1)); luaArguments.returnInt(result); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4197,7 +4197,7 @@ namespace registerCellTriggerEventForFactionToUnit(luaArguments.getInt(-2), luaArguments.getInt(-1)); luaArguments.returnInt(result); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4218,7 +4218,7 @@ namespace luaArguments. getVec2i(-1)); luaArguments.returnInt(result); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4239,7 +4239,7 @@ namespace luaArguments. getVec4i(-1)); luaArguments.returnInt(result); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4256,7 +4256,7 @@ namespace thisScriptManager->registerCellAreaTriggerEvent(luaArguments. getVec4i(-1)); luaArguments.returnInt(result); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4273,7 +4273,7 @@ namespace thisScriptManager->getCellTriggerEventCount(luaArguments. getInt(-1)); luaArguments.returnInt(result); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4287,7 +4287,7 @@ namespace try { thisScriptManager->unregisterCellTriggerEvent(luaArguments. getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4302,7 +4302,7 @@ namespace int result = thisScriptManager->startTimerEvent(); luaArguments.returnInt(result); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4319,7 +4319,7 @@ namespace thisScriptManager->startEfficientTimerEvent(luaArguments. getInt(-1)); luaArguments.returnInt(result); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4335,7 +4335,7 @@ namespace result = thisScriptManager->stopTimerEvent(luaArguments.getInt(-1)); luaArguments.returnInt(result); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4351,7 +4351,7 @@ namespace result = thisScriptManager->resetTimerEvent(luaArguments.getInt(-1)); luaArguments.returnInt(result); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4368,7 +4368,7 @@ namespace thisScriptManager->getTimerEventSecondsElapsed(luaArguments. getInt(-1)); luaArguments.returnInt(result); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4381,7 +4381,7 @@ namespace luaArguments(luaHandle); try { thisScriptManager->setPlayerAsWinner(luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4394,7 +4394,7 @@ namespace luaArguments(luaHandle); try { thisScriptManager->endGame(); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4407,7 +4407,7 @@ namespace luaArguments(luaHandle); try { thisScriptManager->startPerformanceTimer(); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4420,7 +4420,7 @@ namespace luaArguments(luaHandle); try { thisScriptManager->endPerformanceTimer(); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4435,7 +4435,7 @@ namespace Vec2i results = thisScriptManager->getPerformanceTimerResults(); luaArguments.returnVec2i(results); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4451,7 +4451,7 @@ namespace pos = thisScriptManager->getStartLocation(luaArguments.getInt(-1)); luaArguments.returnVec2i(pos); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4466,7 +4466,7 @@ namespace Vec2i pos = thisScriptManager->getUnitPosition(luaArguments.getInt(-1)); luaArguments.returnVec2i(pos); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4480,7 +4480,7 @@ namespace try { thisScriptManager->setUnitPosition(luaArguments.getInt(-2), luaArguments.getVec2i(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4516,7 +4516,7 @@ namespace //printf("LUA addCellMarker --> faction [%d] pos [%s] note [%s] texture [%s]\n",factionIndex,pos.getString().c_str(),note.c_str(),texture.c_str()); thisScriptManager->addCellMarker(pos, factionIndex, note, texture); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4535,7 +4535,7 @@ namespace pos = luaArguments.getVec2i(-1); thisScriptManager->removeCellMarker(pos, factionIndex); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4574,7 +4574,7 @@ namespace thisScriptManager->showMarker(pos, factionIndex, note, texture, flashCount); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4590,7 +4590,7 @@ namespace factionIndex = thisScriptManager->getUnitFaction(luaArguments.getInt(-1)); luaArguments.returnInt(factionIndex); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4606,7 +4606,7 @@ namespace unitname = thisScriptManager->getUnitName(luaArguments.getInt(-1)); luaArguments.returnString(unitname); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4622,7 +4622,7 @@ namespace unitname = thisScriptManager->getUnitDisplayName(luaArguments.getInt(-1)); luaArguments.returnString(unitname); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4639,7 +4639,7 @@ namespace getResourceAmount(luaArguments. getString(-2), luaArguments.getInt(-1))); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4653,7 +4653,7 @@ namespace try { luaArguments.returnString(thisScriptManager-> getLastCreatedUnitName()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4666,7 +4666,7 @@ namespace luaArguments(luaHandle); try { luaArguments.returnInt(thisScriptManager->getLastCreatedUnitId()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4680,7 +4680,7 @@ namespace try { luaArguments.returnInt(thisScriptManager-> getCellTriggeredEventId()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4694,7 +4694,7 @@ namespace try { luaArguments.returnInt(thisScriptManager-> getTimerTriggeredEventId()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4709,7 +4709,7 @@ namespace try { luaArguments.returnInt(thisScriptManager-> getCellTriggeredEventAreaEntryUnitId()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4723,7 +4723,7 @@ namespace try { luaArguments.returnInt(thisScriptManager-> getCellTriggeredEventAreaExitUnitId()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4737,7 +4737,7 @@ namespace try { luaArguments.returnInt(thisScriptManager-> getCellTriggeredEventUnitId()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4750,7 +4750,7 @@ namespace luaArguments(luaHandle); try { thisScriptManager->setRandomGenInit(luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4765,7 +4765,7 @@ namespace luaArguments.returnInt(thisScriptManager-> getRandomGen(luaArguments.getInt(-2), luaArguments.getInt(-1))); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4778,7 +4778,7 @@ namespace luaArguments(luaHandle); try { luaArguments.returnInt(thisScriptManager->getWorldFrameCount()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4791,7 +4791,7 @@ namespace luaArguments(luaHandle); try { luaArguments.returnString(thisScriptManager->getLastDeadUnitName()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4804,7 +4804,7 @@ namespace luaArguments(luaHandle); try { luaArguments.returnInt(thisScriptManager->getLastDeadUnitId()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4818,7 +4818,7 @@ namespace try { luaArguments.returnInt(thisScriptManager-> getLastDeadUnitCauseOfDeath()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4832,7 +4832,7 @@ namespace try { luaArguments.returnString(thisScriptManager-> getLastDeadUnitKillerName()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4846,7 +4846,7 @@ namespace try { luaArguments.returnInt(thisScriptManager-> getLastDeadUnitKillerId()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4860,7 +4860,7 @@ namespace try { luaArguments.returnString(thisScriptManager-> getLastAttackedUnitName()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4873,7 +4873,7 @@ namespace luaArguments(luaHandle); try { luaArguments.returnInt(thisScriptManager->getLastAttackedUnitId()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4887,7 +4887,7 @@ namespace try { luaArguments.returnString(thisScriptManager-> getLastAttackingUnitName()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4900,7 +4900,7 @@ namespace luaArguments(luaHandle); try { luaArguments.returnInt(thisScriptManager->getLastAttackingUnitId()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4915,7 +4915,7 @@ namespace luaArguments.returnString(thisScriptManager-> getSystemMacroValue(luaArguments. getString(-1))); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4929,7 +4929,7 @@ namespace try { luaArguments.returnString(thisScriptManager-> getSystemMacroValue("$SCENARIO_PATH")); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4943,7 +4943,7 @@ namespace try { luaArguments.returnString(thisScriptManager-> getPlayerName(luaArguments.getInt(-1))); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4957,7 +4957,7 @@ namespace try { luaArguments.returnString(thisScriptManager-> getFactionName(luaArguments.getInt(-1))); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4971,7 +4971,7 @@ namespace try { luaArguments.returnInt(thisScriptManager-> getUnitCount(luaArguments.getInt(-1))); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -4987,7 +4987,7 @@ namespace getUnitCountOfType(luaArguments.getInt(-2), luaArguments. getString(-1))); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5139,13 +5139,13 @@ namespace "Invalid parameter count in method [%s] args = %d [argument count must be between 1 and %d]", __FUNCTION__, args, max_args_allowed); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } //va_end(argList); } //lua_unlock(luaHandle); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5334,13 +5334,13 @@ namespace "Invalid parameter count in method [%s] args = %d [argument count must be between 1 and %d]", __FUNCTION__, args, max_args_allowed); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } //va_end(argList); } //lua_unlock(luaHandle); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5473,14 +5473,14 @@ namespace "Invalid parameter count in method [%s] args = %d [argument count must be between 1 and %d]", __FUNCTION__, args, max_args_allowed); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } //va_end(argList); } //lua_unlock(luaHandle); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5493,7 +5493,7 @@ namespace luaArguments(luaHandle); try { luaArguments.returnInt(thisScriptManager->getGameWon()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5506,7 +5506,7 @@ namespace luaArguments(luaHandle); try { luaArguments.returnInt(thisScriptManager->getIsGameOver()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5520,7 +5520,7 @@ namespace try { thisScriptManager->loadScenario(luaArguments.getString(-2), luaArguments.getInt(-1) != 0); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5538,7 +5538,7 @@ namespace luaArguments.getString(-2), luaArguments.getInt(-1)); luaArguments.returnVectorInt(units); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5554,7 +5554,7 @@ namespace luaArguments.returnInt(thisScriptManager-> getUnitCurrentField(luaArguments. getInt(-1))); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5568,7 +5568,7 @@ namespace try { luaArguments.returnInt(thisScriptManager-> getIsUnitAlive(luaArguments.getInt(-1))); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5589,7 +5589,7 @@ namespace getVec2i(-1)); luaArguments.returnInt(result); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5609,7 +5609,7 @@ namespace getVec2i(-1)); luaArguments.returnInt(result); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5627,7 +5627,7 @@ namespace luaArguments(luaHandle); try { luaArguments.returnInt(thisScriptManager->getHumanFactionId()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5643,7 +5643,7 @@ namespace luaArguments.getFloat(-3), luaArguments.getFloat(-2), luaArguments.getVec4f(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5656,7 +5656,7 @@ namespace luaArguments(luaHandle); try { thisScriptManager->unhighlightUnit(luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5669,7 +5669,7 @@ namespace luaArguments(luaHandle); try { thisScriptManager->giveStopCommand(luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5683,7 +5683,7 @@ namespace try { luaArguments.returnInt(thisScriptManager-> isBuilding(luaArguments.getInt(-1))); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5697,7 +5697,7 @@ namespace try { luaArguments.returnInt(thisScriptManager-> selectUnit(luaArguments.getInt(-1))); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5710,7 +5710,7 @@ namespace luaArguments(luaHandle); try { thisScriptManager->unselectUnit(luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5724,7 +5724,7 @@ namespace try { thisScriptManager->addUnitToGroupSelection(luaArguments.getInt(-2), luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5737,7 +5737,7 @@ namespace luaArguments(luaHandle); try { thisScriptManager->recallGroupSelection(luaArguments.getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5753,7 +5753,7 @@ namespace getInt(-2), luaArguments. getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5768,7 +5768,7 @@ namespace thisScriptManager-> setAttackWarningsEnabled((luaArguments.getInt(-1) == 0 ? false : true)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5781,7 +5781,7 @@ namespace try { luaArguments.returnInt(thisScriptManager-> getAttackWarningsEnabled()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5794,7 +5794,7 @@ namespace luaArguments(luaHandle); try { luaArguments.returnInt(thisScriptManager->getIsDayTime()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5806,7 +5806,7 @@ namespace luaArguments(luaHandle); try { luaArguments.returnInt(thisScriptManager->getIsNightTime()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5818,7 +5818,7 @@ namespace luaArguments(luaHandle); try { luaArguments.returnFloat(thisScriptManager->getTimeOfDay()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5831,7 +5831,7 @@ namespace luaArguments(luaHandle); try { thisScriptManager->registerDayNightEvent(); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5843,7 +5843,7 @@ namespace luaArguments(luaHandle); try { thisScriptManager->unregisterDayNightEvent(); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5857,7 +5857,7 @@ namespace try { thisScriptManager->registerUnitTriggerEvent(luaArguments. getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5870,7 +5870,7 @@ namespace try { thisScriptManager->unregisterUnitTriggerEvent(luaArguments. getInt(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5883,7 +5883,7 @@ namespace try { luaArguments.returnInt(thisScriptManager-> getLastUnitTriggerEventUnitId()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5897,7 +5897,7 @@ namespace luaArguments.returnInt(static_cast < int>(thisScriptManager-> getLastUnitTriggerEventType())); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5916,7 +5916,7 @@ namespace UnitTriggerEventType> (luaArguments.getInt(-1))); luaArguments.returnInt(value); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5935,7 +5935,7 @@ namespace UnitTriggerEventType> (luaArguments.getInt(-2)), luaArguments.getInt(-1)); luaArguments.returnInt(value); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5954,7 +5954,7 @@ namespace UnitTriggerEventType> (luaArguments.getInt(-1))); luaArguments.returnString(unitname); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5967,7 +5967,7 @@ namespace luaArguments(luaHandle); try { thisScriptManager->disableSpeedChange(); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5979,7 +5979,7 @@ namespace luaArguments(luaHandle); try { thisScriptManager->enableSpeedChange(); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -5991,7 +5991,7 @@ namespace luaArguments(luaHandle); try { luaArguments.returnInt(thisScriptManager->getSpeedChangeEnabled()); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -6005,7 +6005,7 @@ namespace try { thisScriptManager->storeSaveGameData(luaArguments.getString(-2), luaArguments.getString(-1)); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -6020,7 +6020,7 @@ namespace luaArguments.returnString(thisScriptManager-> loadSaveGameData(luaArguments. getString(-1))); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } @@ -6035,7 +6035,7 @@ namespace luaArguments.returnInt(thisScriptManager-> getFactionPlayerType(luaArguments. getInt(-1))); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { error(luaHandle, &ex, __FILE__, __FUNCTION__, __LINE__); } diff --git a/source/glest_game/game/script_manager.h b/source/glest_game/game/script_manager.h index 1219deb4b..681f6ecf5 100644 --- a/source/glest_game/game/script_manager.h +++ b/source/glest_game/game/script_manager.h @@ -785,7 +785,7 @@ namespace // ----------------------------------------------------------------------- static void - error(LuaHandle * luaHandle, const megaglest_runtime_error * mgErr, + error(LuaHandle * luaHandle, const game_runtime_error * mgErr, const char *file, const char *function, int line); //callbacks, commands diff --git a/source/glest_game/global/config.cpp b/source/glest_game/global/config.cpp index 1dde9707f..291d45cad 100644 --- a/source/glest_game/global/config.cpp +++ b/source/glest_game/global/config.cpp @@ -617,7 +617,7 @@ namespace Glest { result = SDLK_PAUSE; } else { string sError = "Unsupported key translation [" + value + "]"; - throw megaglest_runtime_error(sError.c_str()); + throw game_runtime_error(sError.c_str()); } } else if (value.length() >= 1) { if (value.length() == 3 && value[0] == '\'' && value[2] == '\'') { @@ -638,7 +638,7 @@ namespace Glest { } } else { string sError = "Unsupported key translation" + value; - throw megaglest_runtime_error(sError.c_str()); + throw game_runtime_error(sError.c_str()); } // Because SDL is based on lower Ascii @@ -1019,7 +1019,7 @@ namespace Glest { if (errorOnNotFound == true) { //abort(); - throw megaglest_runtime_error("Map not found [" + mapName + + throw game_runtime_error("Map not found [" + mapName + "]\nScenario [" + scenarioDir + "]"); } diff --git a/source/glest_game/global/core_data.cpp b/source/glest_game/global/core_data.cpp index 2ddfe1068..44d57b66f 100644 --- a/source/glest_game/global/core_data.cpp +++ b/source/glest_game/global/core_data.cpp @@ -263,7 +263,7 @@ namespace Glest { (*tex)->setTextureSystemId(texSystemId); renderer.initTexture(rsGlobal, *tex); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { message(ex.what(), GlobalStaticFlags::getIsNonGraphicalModeEnabled(), tempDataLocation); @@ -629,7 +629,7 @@ namespace Glest { intToStr (index) + ".wav")); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { message(ex.what(), GlobalStaticFlags::getIsNonGraphicalModeEnabled(), tempDataLocation); @@ -666,7 +666,7 @@ namespace Glest { // getGameCustomCoreDataPath(data_path, // CORE_MENU_SOUND_PATH + "sonar.wav")); // } - // catch (const megaglest_runtime_error& ex) { + // catch (const game_runtime_error& ex) { // message(ex.what(), GlobalStaticFlags::getIsNonGraphicalModeEnabled(), // tempDataLocation); // } @@ -682,7 +682,7 @@ namespace Glest { // getGameCustomCoreDataPath(data_path, // CORE_WATER_SOUNDS_PATH + "water" + intToStr(i) // + ".wav")); - // } catch (const megaglest_runtime_error& ex) { + // } catch (const game_runtime_error& ex) { // message(ex.what(), // GlobalStaticFlags::getIsNonGraphicalModeEnabled(), // tempDataLocation); @@ -736,7 +736,7 @@ namespace Glest { menuMusicPath + menuMusicFile)); menuMusic.setNext(&menuMusic); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { message(ex.what(), GlobalStaticFlags::getIsNonGraphicalModeEnabled(), tempDataLocation); @@ -1112,7 +1112,7 @@ namespace Glest { if (entityName == "") { printf("Register Font Callback detected a blank entityName!\n"); throw - megaglest_runtime_error + game_runtime_error ("Register Font Callback detected a blank entityName!"); } if (entityName != "") { @@ -1123,7 +1123,7 @@ namespace Glest { if (entityName == "") { printf("UnRegister Font Callback detected a blank entityName!\n"); throw - megaglest_runtime_error + game_runtime_error ("UnRegister Font Callback detected a blank entityName!"); } if (entityName != "") { @@ -1789,7 +1789,7 @@ namespace Glest { string data_path = coreData.getDataPath(); playSound[soundCtr].load(getGameCustomCoreDataPath(data_path, playSoundVal)); soundCtr++; - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { message(ex.what(), GlobalStaticFlags::getIsNonGraphicalModeEnabled(), tempDataLocation); diff --git a/source/glest_game/global/lang.cpp b/source/glest_game/global/lang.cpp index 7dbb2e389..c7c6e7baa 100644 --- a/source/glest_game/global/lang.cpp +++ b/source/glest_game/global/lang.cpp @@ -243,7 +243,7 @@ namespace Glest { "In [%s::%s Line: %d] path = [%s]\n", __FILE__, __FUNCTION__, __LINE__, languageFile.c_str()); - //throw megaglest_runtime_error("File NOT FOUND, can't open file: [" + languageFile + "]"); + //throw game_runtime_error("File NOT FOUND, can't open file: [" + languageFile + "]"); printf ("Language file NOT FOUND, can't open file: [%s] switching to default language: %s\n", languageFile.c_str(), DEFAULT_LANGUAGE); @@ -779,7 +779,7 @@ namespace Glest { vector < string > langResults2; findAll(data_path + "data/lang/*.lng", langResults2, true); if (langResults2.empty() && langResults.empty()) { - throw megaglest_runtime_error("There are no lang files"); + throw game_runtime_error("There are no lang files"); } for (unsigned int i = 0; i < langResults2.size(); ++i) { string testLanguage = langResults2[i]; diff --git a/source/glest_game/global/metrics.cpp b/source/glest_game/global/metrics.cpp index c1ba0739a..94861d3dc 100644 --- a/source/glest_game/global/metrics.cpp +++ b/source/glest_game/global/metrics.cpp @@ -81,21 +81,21 @@ namespace Glest { float Metrics::getAspectRatio() const { if (screenH == 0) { - throw megaglest_runtime_error("div by 0 screenH == 0"); + throw game_runtime_error("div by 0 screenH == 0"); } return static_cast (screenW) / screenH; } int Metrics::toVirtualX(int w) const { if (screenW == 0) { - throw megaglest_runtime_error("div by 0 screenW == 0"); + throw game_runtime_error("div by 0 screenW == 0"); } return w * virtualW / screenW; } int Metrics::toVirtualY(int h) const { if (screenH == 0) { - throw megaglest_runtime_error("div by 0 screenH == 0"); + throw game_runtime_error("div by 0 screenH == 0"); } //printf("h [%d] virtualH [%d] screenH [%d] result = %d\n",h,virtualH,screenH,(h*virtualH/screenH)); diff --git a/source/glest_game/graphics/particle_type.cpp b/source/glest_game/graphics/particle_type.cpp index fc093fa48..6e035710a 100644 --- a/source/glest_game/graphics/particle_type.cpp +++ b/source/glest_game/graphics/particle_type.cpp @@ -187,7 +187,7 @@ namespace Glest { if (modelNode->hasChild("cycles")) { modelCycle = modelNode->getChild("cycles")->getAttribute("value")->getFloatValue(); if (modelCycle < 0.0) - throw megaglest_runtime_error("negative model cycle value is bad"); + throw game_runtime_error("negative model cycle value is bad"); } } } else { @@ -502,7 +502,7 @@ namespace Glest { } } catch (const exception &e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, e.what()); - throw megaglest_runtime_error("Error loading ParticleSystem: " + path + "\n" + e.what()); + throw game_runtime_error("Error loading ParticleSystem: " + path + "\n" + e.what()); } } @@ -587,7 +587,7 @@ namespace Glest { horizontalSpreadB = horizontalSpreadNode->getAttribute("b")->getFloatValue(-1.0f, 1.0f); } catch (const exception &e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, e.what()); - throw megaglest_runtime_error("Error loading ParticleSystem: " + path + "\n" + e.what()); + throw game_runtime_error("Error loading ParticleSystem: " + path + "\n" + e.what()); } } diff --git a/source/glest_game/graphics/renderer.cpp b/source/glest_game/graphics/renderer.cpp index 4d756dab7..f073c8d87 100644 --- a/source/glest_game/graphics/renderer.cpp +++ b/source/glest_game/graphics/renderer.cpp @@ -298,7 +298,7 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, szBuf); - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); } } @@ -376,7 +376,7 @@ namespace Glest { if (glActiveTexture == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error: glActiveTexture == NULL\nglActiveTexture is only supported if the GL version is 1.3 or greater,\nor if the ARB_multitexture extension is supported!"); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); @@ -1688,15 +1688,15 @@ namespace Glest { if (game == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s] Line: %d game == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } else if (game->getGui() == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s] Line: %d game->getGui() == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } else if (game->getGui()->getMouse3d() == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s] Line: %d game->getGui()->getMouse3d() == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } const Gui *gui = game->getGui(); @@ -1705,7 +1705,7 @@ namespace Glest { if (map == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s] Line: %d map == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } assertGl(); @@ -1859,7 +1859,7 @@ namespace Glest { headerLine += ": "; if (fontMetrics == NULL) { - throw megaglest_runtime_error("fontMetrics == NULL"); + throw game_runtime_error("fontMetrics == NULL"); } renderTextShadow3D( @@ -1885,7 +1885,7 @@ namespace Glest { headerLine += ": "; if (fontMetrics == NULL) { - throw megaglest_runtime_error("fontMetrics == NULL"); + throw game_runtime_error("fontMetrics == NULL"); } renderTextShadow3D( @@ -1958,7 +1958,7 @@ namespace Glest { headerLine += ": "; if (fontMetrics == NULL) { - throw megaglest_runtime_error("fontMetrics == NULL"); + throw game_runtime_error("fontMetrics == NULL"); } renderTextShadow( @@ -1982,7 +1982,7 @@ namespace Glest { headerLine += ": "; if (fontMetrics == NULL) { - throw megaglest_runtime_error("fontMetrics == NULL"); + throw game_runtime_error("fontMetrics == NULL"); } renderTextShadow( @@ -2015,7 +2015,7 @@ namespace Glest { } if (console == NULL) { - throw megaglest_runtime_error("console == NULL"); + throw game_runtime_error("console == NULL"); } glPushAttrib(GL_ENABLE_BIT); @@ -2615,13 +2615,13 @@ namespace Glest { Vec2i computeCenteredPos(const string &text, Font2D *font, int x, int y) { if (font == NULL) { //abort(); - throw megaglest_runtime_error("font == NULL (1) text = " + text); + throw game_runtime_error("font == NULL (1) text = " + text); } const Metrics &metrics = Metrics::getInstance(); FontMetrics *fontMetrics = font->getMetrics(); if (fontMetrics == NULL) { - throw megaglest_runtime_error("fontMetrics == NULL (1) text = " + text); + throw game_runtime_error("fontMetrics == NULL (1) text = " + text); } int virtualX = (fontMetrics->getTextWidth(text) > 0 ? static_cast(fontMetrics->getTextWidth(text) / 2.f) : 5); @@ -2638,13 +2638,13 @@ namespace Glest { Vec2i computeCenteredPos(const string &text, Font3D *font, int x, int y) { if (font == NULL) { - throw megaglest_runtime_error("font == NULL (2) text = " + text); + throw game_runtime_error("font == NULL (2) text = " + text); } const Metrics &metrics = Metrics::getInstance(); FontMetrics *fontMetrics = font->getMetrics(); if (fontMetrics == NULL) { - throw megaglest_runtime_error("fontMetrics == NULL (2) text = " + text); + throw game_runtime_error("fontMetrics == NULL (2) text = " + text); } int virtualX = (fontMetrics->getTextWidth(text) > 0 ? static_cast(fontMetrics->getTextWidth(text) / 2.f) : 5); @@ -2769,11 +2769,11 @@ namespace Glest { if (centeredW == true) { if (font == NULL) { //abort(); - throw megaglest_runtime_error("font == NULL (5) text = " + text); + throw game_runtime_error("font == NULL (5) text = " + text); } else if (font->getTextHandler() == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "font->getTextHandler() == NULL(5) text = [%s] FontPtr = [%p]\n", text.c_str(), font); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } float lineWidth = (font->getTextHandler()->Advance(text.c_str()) * ::Shared::Graphics::Font::scaleFontValue); @@ -2784,9 +2784,9 @@ namespace Glest { if (centeredH) { if (font == NULL) { - throw megaglest_runtime_error("font == NULL (6) text = " + text); + throw game_runtime_error("font == NULL (6) text = " + text); } else if (font->getTextHandler() == NULL) { - throw megaglest_runtime_error("font->getTextHandler() == NULL (6) text = " + text); + throw game_runtime_error("font->getTextHandler() == NULL (6) text = " + text); } //const Metrics &metrics= Metrics::getInstance(); @@ -2987,7 +2987,7 @@ namespace Glest { } if (font == NULL) { - throw megaglest_runtime_error("font == NULL (3) text = " + text); + throw game_runtime_error("font == NULL (3) text = " + text); } glPushAttrib(GL_CURRENT_BIT); @@ -3015,7 +3015,7 @@ namespace Glest { } if (font == NULL) { - throw megaglest_runtime_error("font == NULL (4) text = " + text); + throw game_runtime_error("font == NULL (4) text = " + text); } glPushAttrib(GL_CURRENT_BIT); @@ -3209,7 +3209,7 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -3356,7 +3356,7 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -3861,7 +3861,7 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -4434,16 +4434,16 @@ namespace Glest { SurfaceCell *tc11 = map->getSurfaceCell(pos.x + 1, pos.y + 1); if (tc00 == NULL) { - throw megaglest_runtime_error("tc00 == NULL"); + throw game_runtime_error("tc00 == NULL"); } if (tc10 == NULL) { - throw megaglest_runtime_error("tc10 == NULL"); + throw game_runtime_error("tc10 == NULL"); } if (tc01 == NULL) { - throw megaglest_runtime_error("tc01 == NULL"); + throw game_runtime_error("tc01 == NULL"); } if (tc11 == NULL) { - throw megaglest_runtime_error("tc11 == NULL"); + throw game_runtime_error("tc11 == NULL"); } triangleCount += 2; @@ -4451,7 +4451,7 @@ namespace Glest { //set texture if (tc00->getSurfaceTexture() == NULL) { - throw megaglest_runtime_error("tc00->getSurfaceTexture() == NULL"); + throw game_runtime_error("tc00->getSurfaceTexture() == NULL"); } int currTex = static_cast(tc00->getSurfaceTexture())->getHandle(); if (currTex != lastTex) { @@ -4582,16 +4582,16 @@ namespace Glest { // SurfaceCell *tc11= map->getSurfaceCell(pos.x+1, pos.y+1); // // if(tc00 == NULL) { - // throw megaglest_runtime_error("tc00 == NULL"); + // throw game_runtime_error("tc00 == NULL"); // } // if(tc10 == NULL) { - // throw megaglest_runtime_error("tc10 == NULL"); + // throw game_runtime_error("tc10 == NULL"); // } // if(tc01 == NULL) { - // throw megaglest_runtime_error("tc01 == NULL"); + // throw game_runtime_error("tc01 == NULL"); // } // if(tc11 == NULL) { - // throw megaglest_runtime_error("tc11 == NULL"); + // throw game_runtime_error("tc11 == NULL"); // } // // triangleCount+= 2; @@ -4599,7 +4599,7 @@ namespace Glest { // // //set texture // if(tc00->getSurfaceTexture() == NULL) { - // throw megaglest_runtime_error("tc00->getSurfaceTexture() == NULL"); + // throw game_runtime_error("tc00->getSurfaceTexture() == NULL"); // } // // int surfaceDataIndex = -1; @@ -4890,7 +4890,7 @@ namespace Glest { if (textures3D) { Texture3D *waterTex = world->getTileset()->getWaterTex(); if (waterTex == NULL) { - throw megaglest_runtime_error("waterTex == NULL"); + throw game_runtime_error("waterTex == NULL"); } glEnable(GL_TEXTURE_3D); glBindTexture(GL_TEXTURE_3D, static_cast(waterTex)->getHandle()); @@ -4927,10 +4927,10 @@ namespace Glest { SurfaceCell *tc0 = map->getSurfaceCell(i, j); SurfaceCell *tc1 = map->getSurfaceCell(i, j + 1); if (tc0 == NULL) { - throw megaglest_runtime_error("tc0 == NULL"); + throw game_runtime_error("tc0 == NULL"); } if (tc1 == NULL) { - throw megaglest_runtime_error("tc1 == NULL"); + throw game_runtime_error("tc1 == NULL"); } if (cellExplored == false) { @@ -5121,7 +5121,7 @@ namespace Glest { if (map == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s] Line: %d map == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } glPushMatrix(); @@ -7494,7 +7494,7 @@ namespace Glest { textures3D = config.getBool("Textures3D"); float gammaValue = config.getFloat("GammaValue", "0.0"); if (this->program == NULL) { - throw megaglest_runtime_error("this->program == NULL"); + throw game_runtime_error("this->program == NULL"); } if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) { //if(this->program != NULL) { @@ -7872,7 +7872,7 @@ namespace Glest { message += "ZetaGlest needs a version that supports\n"; message += "glActiveTexture (OpenGL 1.3) or the ARB_multitexture extension."; - throw megaglest_runtime_error(message.c_str(), true); + throw game_runtime_error(message.c_str(), true); } //opengl 2.1 @@ -7884,7 +7884,7 @@ namespace Glest { message += "ZetaGlest needs at least version 2.1 to work\n"; message += "You may solve this problem by installing your latest video card drivers"; - throw megaglest_runtime_error(message.c_str(), true); + throw game_runtime_error(message.c_str(), true); } //opengl 1.4 or extension @@ -7903,7 +7903,7 @@ namespace Glest { //shadows if (shadows == sProjected || shadows == sShadowMapping) { if (getGlMaxTextureUnits() < 3) { - throw megaglest_runtime_error("Your system doesn't support 3 texture units, required for shadows"); + throw game_runtime_error("Your system doesn't support 3 texture units, required for shadows"); } } @@ -7926,7 +7926,7 @@ namespace Glest { if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); if (!isGlExtensionSupported(extension.c_str())) { string str = "OpenGL extension not supported: " + extension + ", required for " + msg; - throw megaglest_runtime_error(str); + throw game_runtime_error(str); } if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); } @@ -8116,7 +8116,7 @@ namespace Glest { } else { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s] Line: %d\nglActiveTexture == NULL\nglActiveTexture is only supported if the GL version is 1.3 or greater,\nor if the ARB_multitexture extension is supported!", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } //if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); @@ -8825,7 +8825,7 @@ namespace Glest { return Texture2D::fTrilinear; } - throw megaglest_runtime_error("Error converting from string to FilterType, found: " + s); + throw game_runtime_error("Error converting from string to FilterType, found: " + s); } void Renderer::setAllowRenderUnitTitles(bool value) { diff --git a/source/glest_game/graphics/unit_particle_type.cpp b/source/glest_game/graphics/unit_particle_type.cpp index fdf47e5c2..7fe152a0d 100644 --- a/source/glest_game/graphics/unit_particle_type.cpp +++ b/source/glest_game/graphics/unit_particle_type.cpp @@ -85,7 +85,7 @@ namespace Glest { direction.y = directionNode->getAttribute("y")->getFloatValue(); direction.z = directionNode->getAttribute("z")->getFloatValue(); if ((shape == UnitParticleSystem::sConical) && (0.0 == direction.length())) - throw megaglest_runtime_error("direction cannot be zero"); + throw game_runtime_error("direction cannot be zero"); // ought to warn about 0 directions generally } @@ -106,7 +106,7 @@ namespace Glest { const XmlNode *minRadiusNode = particleSystemNode->getChild("min-radius"); minRadius = minRadiusNode->getAttribute("value")->getFloatValue(); if (minRadius > radius) - throw megaglest_runtime_error("min-radius cannot be bigger than radius"); + throw game_runtime_error("min-radius cannot be bigger than radius"); } else { minRadius = 0; } @@ -186,7 +186,7 @@ namespace Glest { const XmlNode* delayNode = particleSystemNode->getChild("delay"); const float delay_secs = delayNode->getAttribute("value")->getFloatValue(); if (delay_secs < 0) - throw megaglest_runtime_error("particle effect delay cannot be negative"); + throw game_runtime_error("particle effect delay cannot be negative"); delay = (int) delay_secs * GameConstants::updateFps; } else { delay = 0; @@ -197,7 +197,7 @@ namespace Glest { const XmlNode* lifetimeNode = particleSystemNode->getChild("lifetime"); const float lifetime_secs = lifetimeNode->getAttribute("value")->getFloatValue(); if (lifetime_secs < 0 && lifetime_secs != -1) - throw megaglest_runtime_error("particle effect lifetime cannot be negative (-1 means inherited from parent particle)"); + throw game_runtime_error("particle effect lifetime cannot be negative (-1 means inherited from parent particle)"); lifetime = (int) lifetime_secs * GameConstants::updateFps; } else { lifetime = -1; //default @@ -301,7 +301,7 @@ namespace Glest { loadedFileList, parentLoader, techtreePath); } catch (const exception &e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, e.what()); - throw megaglest_runtime_error("Error loading ParticleSystem: " + path + "\n" + e.what()); + throw game_runtime_error("Error loading ParticleSystem: " + path + "\n" + e.what()); } } diff --git a/source/glest_game/gui/display.cpp b/source/glest_game/gui/display.cpp index 4aa285eb1..a3030e91f 100644 --- a/source/glest_game/gui/display.cpp +++ b/source/glest_game/gui/display.cpp @@ -65,7 +65,7 @@ namespace Glest { Vec4f Display::getColor() const { if (currentColor < 0 || currentColor >= colorCount) { - throw megaglest_runtime_error("currentColor >= colorCount"); + throw game_runtime_error("currentColor >= colorCount"); } return colors[currentColor]; } diff --git a/source/glest_game/gui/gui.cpp b/source/glest_game/gui/gui.cpp index 8e426c55f..4aa4859bc 100644 --- a/source/glest_game/gui/gui.cpp +++ b/source/glest_game/gui/gui.cpp @@ -172,13 +172,13 @@ namespace Glest { return NULL; } else { if (world == NULL) { - throw megaglest_runtime_error("world == NULL"); + throw game_runtime_error("world == NULL"); } if (world->getMap() == NULL) { - throw megaglest_runtime_error("world->getMap() == NULL"); + throw game_runtime_error("world->getMap() == NULL"); } if (world->getMap()->getSurfaceCell(highlightedResourceObjectPos) == NULL) { - throw megaglest_runtime_error("world->getMap()->getSurfaceCell(highlightedResourceObjectPos) == NULL"); + throw game_runtime_error("world->getMap()->getSurfaceCell(highlightedResourceObjectPos) == NULL"); } return world->getMap()->getSurfaceCell(highlightedResourceObjectPos)->getObject(); } @@ -886,20 +886,20 @@ namespace Glest { try { const Unit *unit = selection.getUnit(unitIndex); if (unit == NULL) { - throw megaglest_runtime_error("unit == NULL"); + throw game_runtime_error("unit == NULL"); } if (unit->getType() == NULL) { - throw megaglest_runtime_error("unit->getType() == NULL"); + throw game_runtime_error("unit->getType() == NULL"); } if (unit->getType()->getImage() == NULL) { - throw megaglest_runtime_error("unit->getType()->getImage()"); + throw game_runtime_error("unit->getType()->getImage()"); } display.setUpImage(unitIndex, unit->getType()->getImage()); } catch (exception &ex) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error in unit selection for index: %d error [%s]", unitIndex, ex.what()); - throw megaglest_runtime_error(szBuf, true); + throw game_runtime_error(szBuf, true); } } diff --git a/source/glest_game/gui/selection.cpp b/source/glest_game/gui/selection.cpp index e94dcc3eb..ae68419f0 100644 --- a/source/glest_game/gui/selection.cpp +++ b/source/glest_game/gui/selection.cpp @@ -234,7 +234,7 @@ namespace Glest { bool Selection::assignGroup(int groupIndex, bool clearGroup, const UnitContainer *pUnits) { if (groupIndex < 0 || groupIndex >= maxGroups) { - throw megaglest_runtime_error("Invalid value for groupIndex = " + intToStr(groupIndex)); + throw game_runtime_error("Invalid value for groupIndex = " + intToStr(groupIndex)); } //clear group @@ -262,7 +262,7 @@ namespace Glest { */ bool Selection::addUnitToGroup(int groupIndex, Unit *unit) { if (groupIndex < 0 || groupIndex >= maxGroups) { - throw megaglest_runtime_error("Invalid value for groupIndex = " + intToStr(groupIndex)); + throw game_runtime_error("Invalid value for groupIndex = " + intToStr(groupIndex)); } bool alreadyExists = false; for (int i = 0; i < (int) groups[groupIndex].size(); ++i) { @@ -314,7 +314,7 @@ namespace Glest { void Selection::removeUnitFromGroup(int groupIndex, int unitId) { if (groupIndex < 0 || groupIndex >= maxGroups) { - throw megaglest_runtime_error("Invalid value for groupIndex = " + intToStr(groupIndex)); + throw game_runtime_error("Invalid value for groupIndex = " + intToStr(groupIndex)); } for (unsigned int i = 0; i < groups[groupIndex].size(); ++i) { @@ -328,14 +328,14 @@ namespace Glest { //vector Selection::getUnitsForGroup(int groupIndex) { // if(groupIndex < 0 || groupIndex >= maxGroups) { - // throw megaglest_runtime_error("Invalid value for groupIndex = " + intToStr(groupIndex)); + // throw game_runtime_error("Invalid value for groupIndex = " + intToStr(groupIndex)); // } // return groups[groupIndex]; //} void Selection::recallGroup(int groupIndex, bool clearSelection) { if (groupIndex < 0 || groupIndex >= maxGroups) { - throw megaglest_runtime_error("Invalid value for groupIndex = " + intToStr(groupIndex)); + throw game_runtime_error("Invalid value for groupIndex = " + intToStr(groupIndex)); } if (clearSelection == true) { diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 111901049..86b3af1e4 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -210,7 +210,7 @@ namespace static void logError(const char *msg, bool confirmToConsole); static void - handleRuntimeError(const megaglest_runtime_error & ex); + handleRuntimeError(const game_runtime_error & ex); static void handleRuntimeError(const char *msg, bool getStackTraceString); static int @@ -820,7 +820,7 @@ namespace } void - ExceptionHandler::handleRuntimeError(const megaglest_runtime_error & ex) { + ExceptionHandler::handleRuntimeError(const game_runtime_error & ex) { const char * msg = ex.what(); handleRuntimeError(msg, false); @@ -1151,7 +1151,7 @@ namespace if (program == NULL) { throw - megaglest_runtime_error + game_runtime_error ("In [MainWindow::eventMouseDown] ERROR, program == NULL!"); } @@ -1247,7 +1247,7 @@ namespace if (program == NULL) { throw - megaglest_runtime_error + game_runtime_error ("In [MainWindow::eventMouseUp] ERROR, program == NULL!"); } @@ -1305,7 +1305,7 @@ namespace if (program == NULL) { throw - megaglest_runtime_error + game_runtime_error ("In [MainWindow::eventMouseDoubleClick] ERROR, program == NULL!"); } @@ -1361,7 +1361,7 @@ namespace if (program == NULL) { throw - megaglest_runtime_error + game_runtime_error ("In [MainWindow::eventMouseMove] ERROR, program == NULL!"); } @@ -1391,7 +1391,7 @@ namespace if (program == NULL) { throw - megaglest_runtime_error + game_runtime_error ("In [MainWindow::eventMouseMove] ERROR, program == NULL!"); } @@ -1465,7 +1465,7 @@ namespace findAll(data_path + "data/lang/*.lng", langResults2, true); if (langResults2.empty() && langResults.empty()) { throw - megaglest_runtime_error("There are no lang files"); + game_runtime_error("There are no lang files"); } for (unsigned int i = 0; i < langResults2.size(); ++i) { string @@ -1505,7 +1505,7 @@ namespace if (program == NULL) { throw - megaglest_runtime_error + game_runtime_error ("In [MainWindow::eventKeyDown] ERROR, program == NULL!"); } @@ -1523,7 +1523,7 @@ namespace MainWindow::eventSdlKeyDown(SDL_KeyboardEvent key) { if (program == NULL) { throw - megaglest_runtime_error + game_runtime_error ("In [MainWindow::eventKeyDown] ERROR, program == NULL!"); } return program->sdlKeyDown(key); @@ -1546,7 +1546,7 @@ namespace if (program == NULL) { throw - megaglest_runtime_error + game_runtime_error ("In [MainWindow::eventKeyDown] ERROR, program == NULL!"); } @@ -1735,7 +1735,7 @@ namespace __FUNCTION__, __LINE__, key); if (program == NULL) { throw - megaglest_runtime_error + game_runtime_error ("In [MainWindow::eventKeyUp] ERROR, program == NULL!"); } @@ -1752,7 +1752,7 @@ namespace __FUNCTION__, __LINE__, c); if (program == NULL) { throw - megaglest_runtime_error + game_runtime_error ("In [MainWindow::eventKeyPress] ERROR, program == NULL!"); } @@ -1803,7 +1803,7 @@ namespace __FUNCTION__, __LINE__, event.event); if (program == NULL) { throw - megaglest_runtime_error + game_runtime_error ("In [MainWindow::eventKeyPress] ERROR, program == NULL!"); } @@ -1896,7 +1896,7 @@ namespace MainWindow::eventResize(SizeState sizeState) { if (program == NULL) { throw - megaglest_runtime_error + game_runtime_error ("In [MainWindow::eventResize] ERROR, program == NULL!"); } @@ -2539,7 +2539,7 @@ namespace gitOk = executeShellCommand(szBuf, 0); if (gitOk == false) { throw - megaglest_runtime_error("Call to command failed [" + + game_runtime_error("Call to command failed [" + string(szBuf) + "]"); } } else { @@ -2675,7 +2675,7 @@ namespace gitOk = executeShellCommand(szBuf, 0); if (gitOk == false) { throw - megaglest_runtime_error("Call to command failed [" + game_runtime_error("Call to command failed [" + string(szBuf) + "]"); } printf @@ -2697,7 +2697,7 @@ namespace errmsg, duplicateFile.c_str(), expandedNewCommonFileName.c_str()); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } else { printf ("*** Duplicate file:\n[%s]\nwas renamed to:\n[%s]\n", @@ -2715,7 +2715,7 @@ namespace gitOk = executeShellCommand(szBuf, 0); if (gitOk == false) { throw - megaglest_runtime_error("Call to command failed [" + game_runtime_error("Call to command failed [" + string(szBuf) + "]"); } printf("*** Duplicate file:\n[%s]\nwas git rm\n", @@ -2774,7 +2774,7 @@ namespace __LINE__, searchText.c_str(), parentFile.c_str()); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } mapUniqueParentList[parentFile]++; } @@ -2836,7 +2836,7 @@ namespace szBuf); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } } } @@ -3128,7 +3128,7 @@ namespace gitOk = executeShellCommand(szBuf, 0); if (gitOk == false) { throw - megaglest_runtime_error("Call to command failed [" + + game_runtime_error("Call to command failed [" + string(szBuf) + "]"); } } else { @@ -3167,7 +3167,7 @@ namespace "Error calculating CRC for file [%s]", fileName.c_str()); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } mapDuplicateFiles[crcValue].push_back(fileName); } @@ -3321,7 +3321,7 @@ namespace gitOk = executeShellCommand(szBuf, 0); if (gitOk == false) { throw - megaglest_runtime_error + game_runtime_error ("Call to command failed [" + string(szBuf) + "]"); } @@ -3350,7 +3350,7 @@ namespace errmsg, duplicateFile.c_str(), expandedNewCommonFileName.c_str()); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } else { printf ("*** Duplicate file:\n[%s]\nwas renamed to:\n[%s]\n", @@ -3368,7 +3368,7 @@ namespace gitOk = executeShellCommand(szBuf, 0); if (gitOk == false) { throw - megaglest_runtime_error + game_runtime_error ("Call to command failed [" + string(szBuf) + "]"); } @@ -3471,7 +3471,7 @@ namespace szBuf); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } } mapUniqueParentList[parentFile]++; @@ -3562,7 +3562,7 @@ namespace szBuf); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } } } @@ -3587,7 +3587,7 @@ namespace printf("\nWarning, duplicate files were detected - END:\n"); } } - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { techtree_errors = true; printf ("\n\n****ERROR**** detected while validating the techName: %s\nMESSAGE: %s\n", @@ -3824,7 +3824,7 @@ namespace translationFile.c_str(), techPath.c_str(), techName.c_str()); } - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { printf ("\n\n****ERROR**** detected while loading the techName: %s\nMESSAGE: %s\n", techName.c_str(), ex.what()); @@ -4573,7 +4573,7 @@ namespace if (maps.empty() == true) { throw - megaglest_runtime_error("No maps were found!", true); + game_runtime_error("No maps were found!", true); } else if (invalidMapList.empty() == false) { string errorMsg = @@ -4638,7 +4638,7 @@ namespace "Error [%s]\nCould not rename [%s] to [%s]!", errmsg, oldFile.c_str(), newFile.c_str()); throw - megaglest_runtime_error(szBuf, true); + game_runtime_error(szBuf, true); } else { snprintf(szBuf, 8096, "map [%s] in [%s]\nwas renamed to [%s]", @@ -4660,7 +4660,7 @@ namespace if (tileSets.empty()) { throw - megaglest_runtime_error("No tilesets were found!", true); + game_runtime_error("No tilesets were found!", true); } vector < string > duplicateTilesetsToRename; @@ -4709,7 +4709,7 @@ namespace "Error [%s]\nCould not rename [%s] to [%s]!", errmsg, oldFile.c_str(), newFile.c_str()); throw - megaglest_runtime_error(szBuf, true); + game_runtime_error(szBuf, true); } else { snprintf(szBuf, 8096, "tileset [%s] in [%s]\nwas renamed to [%s]", @@ -4730,7 +4730,7 @@ namespace "Error [%s]\nCould not rename [%s] to [%s]!", errmsg, oldFile.c_str(), newFile.c_str()); throw - megaglest_runtime_error(szBuf, true); + game_runtime_error(szBuf, true); } } @@ -4746,7 +4746,7 @@ namespace findDirs(techPaths, techTrees, false, true); if (techTrees.empty()) { throw - megaglest_runtime_error("No tech-trees were found (dup)!", + game_runtime_error("No tech-trees were found (dup)!", true); } @@ -4796,7 +4796,7 @@ namespace "Error [%s]\nCould not rename [%s] to [%s]!", errmsg, oldFile.c_str(), newFile.c_str()); throw - megaglest_runtime_error(szBuf, true); + game_runtime_error(szBuf, true); } else { snprintf(szBuf, 8096, "techtree [%s] in [%s]\nwas renamed to [%s]", @@ -4821,7 +4821,7 @@ namespace } } - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { if (mainProgram) { mainProgram->getState()->setForceMouseRender(true); } @@ -5411,7 +5411,7 @@ namespace showfactions = true; } else { throw - megaglest_runtime_error("unknown command for techtreelist [" + + game_runtime_error("unknown command for techtreelist [" + cmd + "]"); } printf("Using special command for techtree list [%s]\n", @@ -6079,7 +6079,7 @@ namespace VideoPlayer::setDisabled(true); } - //throw megaglest_runtime_error("Test!"); + //throw game_runtime_error("Test!"); if (hasCommandArgument(argc, argv, GAME_ARGS[GAME_ARG_SDL_INFO]) == true) { @@ -6356,7 +6356,7 @@ namespace ("****WARNING**** your game data path and user data path are the same.\nThis will likely create problems: %s\n", data_path_check.c_str()); throw - megaglest_runtime_error + game_runtime_error ("Regular and User data paths cannot have the same value [" + userDataPath_check + "]"); } @@ -7323,7 +7323,7 @@ namespace szBuf); throw - megaglest_runtime_error(szBuf); + game_runtime_error(szBuf); } } } @@ -7824,7 +7824,7 @@ namespace // test //Shared::Platform::MessageBox(NULL,"Mark's test.","Test",0); - //throw megaglest_runtime_error("test!"); + //throw game_runtime_error("test!"); //ExceptionHandler::DisplayMessage("test!", false); // Check for commands being input from stdin @@ -7859,7 +7859,7 @@ namespace printf("All commands require you to press ENTER\n"); } - //throw megaglest_runtime_error("Test!"); + //throw game_runtime_error("Test!"); //printf("About to throw an exception...\n"); //throw 123; @@ -8021,7 +8021,7 @@ namespace __FUNCTION__, __LINE__); if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - } catch (const megaglest_runtime_error & e) { + } catch (const game_runtime_error & e) { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == false) { soundThreadManager = diff --git a/source/glest_game/main/program.cpp b/source/glest_game/main/program.cpp index 11d2f5fbc..3196bf598 100644 --- a/source/glest_game/main/program.cpp +++ b/source/glest_game/main/program.cpp @@ -1067,7 +1067,7 @@ namespace Glest { this->programState = programStateNew; assert(programStateNew != NULL); if (programStateNew == NULL) { - throw megaglest_runtime_error("programStateNew == NULL"); + throw game_runtime_error("programStateNew == NULL"); } programStateNew->load(); @@ -1109,7 +1109,7 @@ namespace Glest { extractFileFromDirectoryPath (__FILE__).c_str(), __FUNCTION__, __LINE__); - } catch (megaglest_runtime_error & e) { + } catch (game_runtime_error & e) { //printf("3333333 ex.wantStackTrace() = %d\n",e.wantStackTrace()); char szBuf[8096] = ""; @@ -1134,7 +1134,7 @@ namespace Glest { Renderer & renderer = Renderer::getInstance(); game->setQuitPendingIndicator(); // by this the world is no more updated renderer.initGame(game, game->getGameCameraPtr()); - } catch (megaglest_runtime_error & ex2) { + } catch (game_runtime_error & ex2) { errorMsg += "\n" + string(ex2.what()); } } diff --git a/source/glest_game/menu/menu_state_connected_game.cpp b/source/glest_game/menu/menu_state_connected_game.cpp index e3f95b4bf..43190661a 100644 --- a/source/glest_game/menu/menu_state_connected_game.cpp +++ b/source/glest_game/menu/menu_state_connected_game.cpp @@ -692,7 +692,7 @@ namespace Glest { getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s", szBuf); showMessageBox(szBuf, "Error", false); - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); } } for (int i = 0; i < (int) scenarioFiles.size(); ++i) @@ -1933,7 +1933,7 @@ namespace Glest { ClientInterface * clientInterface = networkManager.getClientInterface(); if (clientInterface == NULL) { - throw megaglest_runtime_error("clientInterface == NULL"); + throw game_runtime_error("clientInterface == NULL"); } if (getInProgressSavedGameFromFTPServerInProgress == true) { if (clientInterface != NULL) { @@ -2867,7 +2867,7 @@ namespace Glest { } if (results.empty() == true) { - //throw megaglest_runtime_error("(2)There are no factions for the tech tree [" + techTreeFiles[listBoxTechTree.getSelectedItemIndex()] + "]"); + //throw game_runtime_error("(2)There are no factions for the tech tree [" + techTreeFiles[listBoxTechTree.getSelectedItemIndex()] + "]"); //showGeneralError=true; //generalErrorToShow = "[#2] There are no factions for the tech tree [" + techTreeFiles[listBoxTechTree.getSelectedItemIndex()] + "]"; } @@ -3649,7 +3649,7 @@ namespace Glest { } if (fontMetrics == NULL) { - throw megaglest_runtime_error("fontMetrics == NULL"); + throw game_runtime_error("fontMetrics == NULL"); } int curWidth = @@ -3947,7 +3947,7 @@ namespace Glest { extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -5801,7 +5801,7 @@ namespace Glest { if (clientInterface->getAllowGameDataSynchCheck() == false) { if (errorOnNoFactions == true) { throw - megaglest_runtime_error + game_runtime_error ("(2)There are no factions for the tech tree [" + gameSettings->getTech() + "]"); } @@ -7166,7 +7166,7 @@ namespace Glest { vector < string > tilesets, techtree; if (gameSettings == NULL) { - throw megaglest_runtime_error("gameSettings == NULL"); + throw game_runtime_error("gameSettings == NULL"); } @@ -7959,7 +7959,7 @@ namespace Glest { } if (allMaps.empty()) { - throw megaglest_runtime_error("No maps were found!"); + throw game_runtime_error("No maps were found!"); } vector < string > results; copy(allMaps.begin(), allMaps.end(), std::back_inserter(results)); @@ -7992,7 +7992,7 @@ namespace Glest { Config::getMapPath(mapFiles.at(i), "", false).c_str(), mapInfo.desc.c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } playerSortedMaps[mapInfo.hardMaxPlayers].push_back(mapFiles.at(i)); formattedPlayerSortedMaps[mapInfo.hardMaxPlayers].push_back(formatString @@ -8037,7 +8037,7 @@ namespace Glest { getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); //abort(); } @@ -8058,7 +8058,7 @@ namespace Glest { findDirs(techPaths, results); if (results.empty()) { - throw megaglest_runtime_error("No tech-trees were found!"); + throw game_runtime_error("No tech-trees were found!"); } techTreeFiles = results; @@ -8092,7 +8092,7 @@ namespace Glest { getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return initialTechSelection; @@ -8109,7 +8109,7 @@ namespace Glest { findDirs(config.getPathListForType(ptTilesets, scenarioDir), results); if (results.empty()) { - //throw megaglest_runtime_error("No tile-sets were found!"); + //throw game_runtime_error("No tile-sets were found!"); showMessageBox("No tile-sets were found!", "Error", false); } else { tilesetFiles = results; @@ -8128,7 +8128,7 @@ namespace Glest { getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } diff --git a/source/glest_game/menu/menu_state_custom_game.cpp b/source/glest_game/menu/menu_state_custom_game.cpp index d3fc8e156..bad1be571 100644 --- a/source/glest_game/menu/menu_state_custom_game.cpp +++ b/source/glest_game/menu/menu_state_custom_game.cpp @@ -596,7 +596,7 @@ namespace Glest { getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s", szBuf); showMessageBox(szBuf, "Error", false); - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); } } resultsScenarios.clear(); @@ -918,7 +918,7 @@ namespace Glest { ServerInterface *serverInterface = NetworkManager::getInstance().getServerInterface(); if (serverInterface == NULL) { - throw megaglest_runtime_error("serverInterface == NULL"); + throw game_runtime_error("serverInterface == NULL"); } if (this->headlessServerMode == true) { listBoxControls[0].setSelectedItemIndex(ctNetwork); @@ -1025,7 +1025,7 @@ namespace Glest { getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -3002,7 +3002,7 @@ namespace Glest { fontMetrics = labelPlayers[i].getFont3D()->getMetrics(); } if (fontMetrics == NULL) { - throw megaglest_runtime_error("fontMetrics == NULL"); + throw game_runtime_error("fontMetrics == NULL"); } int curWidth = (fontMetrics->getTextWidth(labelPlayers[i].getText())); @@ -3196,7 +3196,7 @@ namespace Glest { snprintf(szBuf, 8096, "In [%s::%s %d]\nError detected:\n%s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, ex.what()); - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); if (SystemFlags:: @@ -3887,7 +3887,7 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s", szBuf); if (callingThread->getQuitStatus() == false) { - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); showGeneralError = true; generalErrorToShow = ex.what(); } @@ -4076,7 +4076,7 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s", szBuf); if (callingThread->getQuitStatus() == false) { - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); showGeneralError = true; generalErrorToShow = ex.what(); } @@ -5333,7 +5333,7 @@ namespace Glest { extractFileFromDirectoryPath (__FILE__).c_str(), __FUNCTION__, __LINE__, e.what(), file.c_str()); - throw megaglest_runtime_error("Error loading map file: [" + file + + throw game_runtime_error("Error loading map file: [" + file + "] msg: " + e.what()); } } @@ -5369,7 +5369,7 @@ namespace Glest { extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -6055,7 +6055,7 @@ namespace Glest { getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -6084,7 +6084,7 @@ namespace Glest { std::sort(allMaps.begin(), allMaps.end(), compareNonCaseSensitive); if (allMaps.empty()) { - throw megaglest_runtime_error("No maps were found!"); + throw game_runtime_error("No maps were found!"); } vector < string > results; copy(allMaps.begin(), allMaps.end(), std::back_inserter(results)); @@ -6117,7 +6117,7 @@ namespace Glest { Config::getMapPath(mapFiles.at(i), "", false).c_str(), mapInfo.desc.c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } playerSortedMaps[mapInfo.hardMaxPlayers].push_back(mapFiles.at(i)); formattedPlayerSortedMaps[mapInfo.hardMaxPlayers].push_back(formatString @@ -6156,7 +6156,7 @@ namespace Glest { getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); //abort(); } @@ -6175,7 +6175,7 @@ namespace Glest { findDirs(techPaths, results); if (results.empty()) { - //throw megaglest_runtime_error("No tech-trees were found!"); + //throw game_runtime_error("No tech-trees were found!"); printf("No tech-trees were found (custom)!\n"); } @@ -6208,7 +6208,7 @@ namespace Glest { getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return initialTechSelection; @@ -6246,7 +6246,7 @@ namespace Glest { } if (results.empty() == true) { - //throw megaglest_runtime_error("(2)There are no factions for the tech tree [" + techTreeFiles[listBoxTechTree.getSelectedItemIndex()] + "]"); + //throw game_runtime_error("(2)There are no factions for the tech tree [" + techTreeFiles[listBoxTechTree.getSelectedItemIndex()] + "]"); showGeneralError = true; if (listBoxTechTree.getItemCount() > 0) { generalErrorToShow = @@ -6346,7 +6346,7 @@ namespace Glest { getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -6374,7 +6374,7 @@ namespace Glest { findDirs(config.getPathListForType(ptTilesets, scenarioDir), results); if (results.empty()) { - throw megaglest_runtime_error("No tile-sets were found!"); + throw game_runtime_error("No tile-sets were found!"); } tilesetFiles = results; std::for_each(results.begin(), results.end(), FormatString()); @@ -6390,7 +6390,7 @@ namespace Glest { getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } diff --git a/source/glest_game/menu/menu_state_custom_game_update.cpp b/source/glest_game/menu/menu_state_custom_game_update.cpp index bbb445cfc..a12c60740 100644 --- a/source/glest_game/menu/menu_state_custom_game_update.cpp +++ b/source/glest_game/menu/menu_state_custom_game_update.cpp @@ -221,7 +221,7 @@ namespace Glest { chrono.start(); if (this->headlessServerMode == true && serverInterface == NULL) { - throw megaglest_runtime_error("serverInterface == NULL"); + throw game_runtime_error("serverInterface == NULL"); } if (this->headlessServerMode == true && serverInterface->getGameSettingsUpdateCount() > @@ -874,7 +874,7 @@ namespace Glest { PlayNow((autoStartSettings == NULL)); return; } - } catch (megaglest_runtime_error & ex) { + } catch (game_runtime_error & ex) { //abort(); //printf("1111111bbbb ex.wantStackTrace() = %d\n",ex.wantStackTrace()); char szBuf[8096] = ""; @@ -973,7 +973,7 @@ namespace Glest { extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -1065,7 +1065,7 @@ namespace Glest { if (SystemFlags:: getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s", szBuf); - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); showGeneralError = true; generalErrorToShow = szBuf; diff --git a/source/glest_game/menu/menu_state_keysetup.cpp b/source/glest_game/menu/menu_state_keysetup.cpp index ec02df45f..2226df529 100644 --- a/source/glest_game/menu/menu_state_keysetup.cpp +++ b/source/glest_game/menu/menu_state_keysetup.cpp @@ -194,7 +194,7 @@ namespace Glest { "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - //throw megaglest_runtime_error("Test!"); + //throw game_runtime_error("Test!"); for (int i = 0; i < (int) mergedProperties.size(); ++i) { diff --git a/source/glest_game/menu/menu_state_load_game.cpp b/source/glest_game/menu/menu_state_load_game.cpp index ddd429cbf..b1f8cbf3b 100644 --- a/source/glest_game/menu/menu_state_load_game.cpp +++ b/source/glest_game/menu/menu_state_load_game.cpp @@ -301,7 +301,7 @@ namespace Glest { try { Game::loadGame(filename, program, false); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s Line: %d]\nError [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), @@ -337,7 +337,7 @@ namespace Glest { previewTexture->load(screenShotFilename); previewTexture->init(); } - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s Line: %d]\nError [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), @@ -430,7 +430,7 @@ namespace Glest { getThisFactionIndex()). c_str() : "")); infoTextLabel.setText(szBuf); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s Line: %d]\nError [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), diff --git a/source/glest_game/menu/menu_state_masterserver.cpp b/source/glest_game/menu/menu_state_masterserver.cpp index 68d1714c5..13fc37e52 100644 --- a/source/glest_game/menu/menu_state_masterserver.cpp +++ b/source/glest_game/menu/menu_state_masterserver.cpp @@ -1232,7 +1232,7 @@ namespace Glest { if (pCB_DisplayMessage != NULL) { pCB_DisplayMessage(sError.c_str(), false); } else { - throw megaglest_runtime_error(sError.c_str()); + throw game_runtime_error(sError.c_str()); } } } diff --git a/source/glest_game/menu/menu_state_mods.cpp b/source/glest_game/menu/menu_state_mods.cpp index e7dd83605..51571fe9e 100644 --- a/source/glest_game/menu/menu_state_mods.cpp +++ b/source/glest_game/menu/menu_state_mods.cpp @@ -1098,7 +1098,7 @@ namespace Glest { "In [%s::%s Line: %d] Error [%s] loading map [%s]\n", __FILE__, __FUNCTION__, __LINE__, e.what(), file.c_str()); - throw megaglest_runtime_error("Error loading map file: [" + file + + throw game_runtime_error("Error loading map file: [" + file + "] msg: " + e.what()); } @@ -1293,7 +1293,7 @@ namespace Glest { MapPreview::findAllValidMaps(pathList, scenarioDir, false, false, &invalidMapList); if (allMaps.empty()) { - throw megaglest_runtime_error("No maps were found!"); + throw game_runtime_error("No maps were found!"); } vector < string > results; copy(allMaps.begin(), allMaps.end(), std::back_inserter(results)); @@ -3009,7 +3009,7 @@ namespace Glest { snprintf(szBuf, 8096, "i >= keyScenarioButtons.size(), i = %d keyScenarioButtons.size() = %d", i, (int) keyScenarioButtons.size()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } bool alreadyHasScenario = (std:: @@ -3156,7 +3156,7 @@ namespace Glest { snprintf(szBuf, 8096, "In [%s::%s %d] error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -3175,7 +3175,7 @@ namespace Glest { snprintf(szBuf, 8096, "i >= keyTechButtons.size(), i = %d, keyTechButtons.size() = %d", i, (int) keyTechButtons.size()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } keyTechButtons[i]->setY(keyButtonsYBase - keyButtonsLineHeight * (i @@ -3199,7 +3199,7 @@ namespace Glest { snprintf(szBuf, 8096, "i >= keyTilesetButtons.size(), i = %d, keyTilesetButtons.size() = %d", i, (int) keyTilesetButtons.size()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } int yPos = keyButtonsYBase - keyButtonsLineHeight * @@ -3217,7 +3217,7 @@ namespace Glest { snprintf(szBuf, 8096, "i >= keyMapButtons.size(), i = %d, keyMapButtons.size() = %d", i, (int) keyMapButtons.size()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } keyMapButtons[i]->setY(keyButtonsYBase - keyButtonsLineHeight * (i @@ -3241,7 +3241,7 @@ namespace Glest { snprintf(szBuf, 8096, "i >= keyScenarioButtons.size(), i = %d, keyScenarioButtons.size() = %d", i, (int) keyScenarioButtons.size()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } int yPos = keyButtonsYBase - keyButtonsLineHeight * diff --git a/source/glest_game/menu/menu_state_options.cpp b/source/glest_game/menu/menu_state_options.cpp index 45fe0a20a..8441302c9 100644 --- a/source/glest_game/menu/menu_state_options.cpp +++ b/source/glest_game/menu/menu_state_options.cpp @@ -478,7 +478,7 @@ namespace __FILE__, __FUNCTION__, __LINE__, e.what()); throw - megaglest_runtime_error(string("Error loading options msg: ") + + game_runtime_error(string("Error loading options msg: ") + e.what()); } } diff --git a/source/glest_game/menu/menu_state_options_graphics.cpp b/source/glest_game/menu/menu_state_options_graphics.cpp index 3ad66d912..3357ef614 100644 --- a/source/glest_game/menu/menu_state_options_graphics.cpp +++ b/source/glest_game/menu/menu_state_options_graphics.cpp @@ -485,7 +485,7 @@ namespace __FILE__, __FUNCTION__, __LINE__, e.what()); throw - megaglest_runtime_error(string("Error loading options msg: ") + + game_runtime_error(string("Error loading options msg: ") + e.what()); } } @@ -740,7 +740,7 @@ namespace } if (selectedMode == NULL) { throw - megaglest_runtime_error("selectedMode == NULL"); + game_runtime_error("selectedMode == NULL"); } #if defined(__APPLE__) diff --git a/source/glest_game/menu/menu_state_options_network.cpp b/source/glest_game/menu/menu_state_options_network.cpp index 4dbacb191..38818bf53 100644 --- a/source/glest_game/menu/menu_state_options_network.cpp +++ b/source/glest_game/menu/menu_state_options_network.cpp @@ -319,7 +319,7 @@ namespace __FILE__, __FUNCTION__, __LINE__, e.what()); throw - megaglest_runtime_error(string("Error loading options msg: ") + + game_runtime_error(string("Error loading options msg: ") + e.what()); } } diff --git a/source/glest_game/menu/menu_state_options_sound.cpp b/source/glest_game/menu/menu_state_options_sound.cpp index 88de86fee..823e295cf 100644 --- a/source/glest_game/menu/menu_state_options_sound.cpp +++ b/source/glest_game/menu/menu_state_options_sound.cpp @@ -246,7 +246,7 @@ namespace __FILE__, __FUNCTION__, __LINE__, e.what()); throw - megaglest_runtime_error(string("Error loading options msg: ") + + game_runtime_error(string("Error loading options msg: ") + e.what()); } } diff --git a/source/glest_game/menu/menu_state_scenario.cpp b/source/glest_game/menu/menu_state_scenario.cpp index dae1ec92a..4761ba43a 100644 --- a/source/glest_game/menu/menu_state_scenario.cpp +++ b/source/glest_game/menu/menu_state_scenario.cpp @@ -132,7 +132,7 @@ namespace Glest { //printf("scenarioFiles[0] [%s]\n",scenarioFiles[0].c_str()); if (results.empty() == true) { - //throw megaglest_runtime_error("There are no scenarios found to load"); + //throw game_runtime_error("There are no scenarios found to load"); mainMessageBoxState = 1; if (this->isTutorialMode == true) { showMessageBox("Error: There are no tutorials found to load", @@ -579,7 +579,7 @@ namespace Glest { snprintf(szBuf, 8096, "listBoxScenario.getSelectedItemIndex() < 0, = %d", listBoxScenario.getSelectedItemIndex()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } else if (listBoxScenario.getSelectedItemIndex() >= (int) scenarioFiles.size()) { char szBuf[8096] = ""; @@ -587,7 +587,7 @@ namespace Glest { "listBoxScenario.getSelectedItemIndex() >= scenarioFiles.size(), = [%d][%d]", listBoxScenario.getSelectedItemIndex(), (int) scenarioFiles.size()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } Scenario::loadGameSettings(dirList, scenarioInfo, gameSettings, diff --git a/source/glest_game/network/client_interface.cpp b/source/glest_game/network/client_interface.cpp index f2f90a75d..650f6d7c0 100644 --- a/source/glest_game/network/client_interface.cpp +++ b/source/glest_game/network/client_interface.cpp @@ -172,13 +172,13 @@ namespace Glest { if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); if (clientInterface == NULL || clientInterface->getSocket(true) == NULL || clientInterface->getSocket(true)->isConnected() == true) { - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } } catch (...) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] UNKNOWN error\n", __FILE__, __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s] Line: %d\n", __FILE__, __FUNCTION__, __LINE__); @@ -498,7 +498,7 @@ namespace Glest { sendTextMessage(sMsg, -1, true, ""); sleep(0); } - } catch (const megaglest_runtime_error &ex) { + } catch (const game_runtime_error &ex) { SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, ex.what()); @@ -510,7 +510,7 @@ namespace Glest { setQuit(true); } else { - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } } } @@ -924,7 +924,7 @@ namespace Glest { if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s Lined: %d] got networkMessageLaunch.getMessageType() = %d\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, networkMessageLaunch.getMessageType()); printf("In [%s::%s Line: %d] Invalid networkMessageLaunch.getMessageType() = %d\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, networkMessageLaunch.getMessageType()); - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); } networkMessageLaunch.buildGameSettings(&gameSettings); @@ -1054,7 +1054,7 @@ namespace Glest { default: { string sErr = string(extractFileFromDirectoryPath(__FILE__).c_str()) + "::" + string(__FUNCTION__) + " Unexpected network message: " + intToStr(networkMessageType); - //throw megaglest_runtime_error(string(extractFileFromDirectoryPath(__FILE__).c_str()) + "::" + string(__FUNCTION__) + " Unexpected network message: " + intToStr(networkMessageType)); + //throw game_runtime_error(string(extractFileFromDirectoryPath(__FILE__).c_str()) + "::" + string(__FUNCTION__) + " Unexpected network message: " + intToStr(networkMessageType)); sendTextMessage("Unexpected network message: " + intToStr(networkMessageType), -1, true, ""); DisplayErrorMessage(sErr); sleep(1); @@ -1126,7 +1126,7 @@ namespace Glest { setQuit(true); close(); } - //throw megaglest_runtime_error("error retrieving nmtCommandList returned false!"); + //throw game_runtime_error("error retrieving nmtCommandList returned false!"); printf("Network connection has been interrupted...\n"); return; } @@ -1221,7 +1221,7 @@ namespace Glest { return; } - //throw megaglest_runtime_error("error retrieving nmtQuit returned false!"); + //throw game_runtime_error("error retrieving nmtQuit returned false!"); done = true; } setQuit(true); @@ -1243,7 +1243,7 @@ namespace Glest { return; } - throw megaglest_runtime_error("error retrieving nmtText returned false!"); + throw game_runtime_error("error retrieving nmtText returned false!"); } ChatMsgInfo msg(networkMessageText.getText().c_str(), networkMessageText.getTeamIndex(), networkMessageText.getPlayerIndex(), networkMessageText.getTargetLanguage()); @@ -1310,7 +1310,7 @@ namespace Glest { char szBuf[1024] = ""; snprintf(szBuf, 1023, "In [%s::%s Line: %d] Invalid networkMessageLaunch.getMessageType() = %d", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, networkMessageLaunch.getMessageType()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } networkMessageLaunch.buildGameSettings(&gameSettings); diff --git a/source/glest_game/network/connection_slot.cpp b/source/glest_game/network/connection_slot.cpp index 4b3fcf6e3..60ee651ec 100644 --- a/source/glest_game/network/connection_slot.cpp +++ b/source/glest_game/network/connection_slot.cpp @@ -352,7 +352,7 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s] Line: %d\n", __FILE__, __FUNCTION__, __LINE__); } @@ -990,7 +990,7 @@ namespace Glest { char szBuf[1024] = ""; snprintf(szBuf, 1023, "In [%s::%s Line: %d] Invalid networkMessageLaunch.getMessageType() = %d", __FILE__, __FUNCTION__, __LINE__, networkMessageLaunch.getMessageType()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } int minHeadLessPlayersRequired = Config::getInstance().getInt("MinHeadlessPlayersRequired", "2"); @@ -1322,7 +1322,7 @@ namespace Glest { if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s Line: %d] networkMessageType = %d\n", __FILE__, __FUNCTION__, __LINE__, networkMessageType); if (gotIntro == true) { - //throw megaglest_runtime_error("Unexpected message in connection slot: " + intToStr(networkMessageType)); + //throw game_runtime_error("Unexpected message in connection slot: " + intToStr(networkMessageType)); string sErr = "Unexpected message in connection slot: " + intToStr(networkMessageType); //sendTextMessage(sErr,-1); //DisplayErrorMessage(sErr); diff --git a/source/glest_game/network/network_interface.cpp b/source/glest_game/network/network_interface.cpp index 9d8a67378..eb52dc990 100644 --- a/source/glest_game/network/network_interface.cpp +++ b/source/glest_game/network/network_interface.cpp @@ -150,7 +150,7 @@ namespace Glest { //sanity check new message type if(messageType < 0 || messageType >= nmtCount) { if(getConnectHasHandshaked() == true) { - throw megaglest_runtime_error("Invalid message type: " + intToStr(messageType)); + throw game_runtime_error("Invalid message type: " + intToStr(messageType)); } else { if(SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork,"In [%s::%s Line: %d] Invalid message type = %d (no packet handshake yet so ignored)\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,messageType); @@ -270,7 +270,7 @@ namespace Glest { if (pCB_DisplayMessage != NULL) { pCB_DisplayMessage(sErr.c_str(), false); } else { - throw megaglest_runtime_error(sErr); + throw game_runtime_error(sErr); } } diff --git a/source/glest_game/network/network_interface.h b/source/glest_game/network/network_interface.h index 8f0438344..7cf2be460 100644 --- a/source/glest_game/network/network_interface.h +++ b/source/glest_game/network/network_interface.h @@ -252,11 +252,11 @@ namespace Glest { NetworkInterface(const NetworkInterface& obj) { init(); - throw megaglest_runtime_error("class NetworkInterface is NOT safe to copy!"); + throw game_runtime_error("class NetworkInterface is NOT safe to copy!"); } NetworkInterface & operator=(const NetworkInterface& obj) { init(); - throw megaglest_runtime_error("class NetworkInterface is NOT safe to assign!"); + throw game_runtime_error("class NetworkInterface is NOT safe to assign!"); } uint32 getNetworkPlayerFactionCRC(int index); diff --git a/source/glest_game/network/network_manager.cpp b/source/glest_game/network/network_manager.cpp index 8d3db4795..2025ff4eb 100644 --- a/source/glest_game/network/network_manager.cpp +++ b/source/glest_game/network/network_manager.cpp @@ -107,7 +107,7 @@ namespace Glest { //assert(gameNetworkInterface!=NULL); if (gameNetworkInterface == NULL) { - throw megaglest_runtime_error("gameNetworkInterface==NULL"); + throw game_runtime_error("gameNetworkInterface==NULL"); } } return gameNetworkInterface; @@ -117,12 +117,12 @@ namespace Glest { if (throwErrorOnNull) { //assert(gameNetworkInterface!=NULL); if (gameNetworkInterface == NULL) { - throw megaglest_runtime_error("gameNetworkInterface==NULL"); + throw game_runtime_error("gameNetworkInterface==NULL"); } assert(networkRole == nrServer); if (networkRole != nrServer) { - throw megaglest_runtime_error("networkRole!=nrServer"); + throw game_runtime_error("networkRole!=nrServer"); } } return dynamic_cast(gameNetworkInterface); @@ -134,12 +134,12 @@ namespace Glest { if (throwErrorOnNull) { //assert(gameNetworkInterface!=NULL); if (gameNetworkInterface == NULL) { - throw megaglest_runtime_error("gameNetworkInterface==NULL"); + throw game_runtime_error("gameNetworkInterface==NULL"); } assert(networkRole == nrClient); if (networkRole != nrClient) { - throw megaglest_runtime_error("networkRole!=nrClient"); + throw game_runtime_error("networkRole!=nrClient"); } } return dynamic_cast(gameNetworkInterface); diff --git a/source/glest_game/network/network_message.cpp b/source/glest_game/network/network_message.cpp index f0822c75b..89ada8a6b 100644 --- a/source/glest_game/network/network_message.cpp +++ b/source/glest_game/network/network_message.cpp @@ -62,7 +62,7 @@ namespace Glest { if (SystemFlags::VERBOSE_MODE_ENABLED) printf("\nIn [%s::%s Line: %d] WARNING, dataReceived = %d dataSize = %d\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, dataReceived, dataSize); if (socket != NULL && socket->isSocketValid() == true) { - throw megaglest_runtime_error("Error receiving NetworkMessage, dataReceived = " + intToStr(dataReceived) + ", dataSize = " + intToStr(dataSize)); + throw game_runtime_error("Error receiving NetworkMessage, dataReceived = " + intToStr(dataReceived) + ", dataSize = " + intToStr(dataSize)); } else { if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s Line: %d] socket has been disconnected\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); } @@ -87,7 +87,7 @@ namespace Glest { if (socket != NULL && socket->isSocketValid() == true) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error sending NetworkMessage, sendResult = %d, dataSize = %d", sendResult, dataSize); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } else { if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s] Line: %d socket has been disconnected\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); } @@ -113,7 +113,7 @@ namespace Glest { if (socket != NULL && socket->isSocketValid() == true) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error sending NetworkMessage, sendResult = %d, dataSize = %d", sendResult, fullMsgSize); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } else { if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s] Line: %d socket has been disconnected\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); } @@ -143,7 +143,7 @@ namespace Glest { if (socket != NULL && socket->isSocketValid() == true) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error sending NetworkMessage, sendResult = %d, dataSize = %d", sendResult, fullMsgSize); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } else { if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s] Line: %d socket has been disconnected\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); } diff --git a/source/glest_game/network/server_interface.cpp b/source/glest_game/network/server_interface.cpp index 18bb85edc..0576613fe 100644 --- a/source/glest_game/network/server_interface.cpp +++ b/source/glest_game/network/server_interface.cpp @@ -139,7 +139,7 @@ namespace Glest { vector invalidMapList; vector allMaps = MapPreview::findAllValidMaps(pathList, scenarioDir, false, true, &invalidMapList); if (allMaps.empty()) { - //throw megaglest_runtime_error("No maps were found!"); + //throw game_runtime_error("No maps were found!"); printf("No maps were found (srv)!\n"); } std::sort(allMaps.begin(), allMaps.end(), compareNonCaseSensitive); @@ -168,7 +168,7 @@ namespace Glest { results.clear(); findDirs(config.getPathListForType(ptTilesets), results); if (results.empty()) { - //throw megaglest_runtime_error("No tile-sets were found!"); + //throw game_runtime_error("No tile-sets were found!"); printf("No tile-sets were found (srv)!"); } tilesetFiles = results; @@ -176,7 +176,7 @@ namespace Glest { results.clear(); findDirs(config.getPathListForType(ptTechs), results); if (results.empty()) { - //throw megaglest_runtime_error("No tech-trees were found!"); + //throw game_runtime_error("No tech-trees were found!"); printf("No tech-trees were found (srv)!\n"); } techTreeFiles = results; @@ -442,7 +442,7 @@ namespace Glest { if (playerIndex < 0 || playerIndex >= GameConstants::maxPlayers) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] playerIndex is invalid = %d", extractFileFromDirectoryPath(extractFileFromDirectoryPath(__FILE__).c_str()).c_str(), __FUNCTION__, __LINE__, playerIndex); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } MutexSafeWrapper safeMutex(serverSynchAccessor, CODE_AT_LINE); if (serverSocketAdmin != NULL && serverSocketAdmin->isSocketValid() == false) { @@ -487,7 +487,7 @@ namespace Glest { if (playerIndex < 0 || playerIndex >= GameConstants::maxPlayers) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] playerIndex is invalid = %d", extractFileFromDirectoryPath(extractFileFromDirectoryPath(__FILE__).c_str()).c_str(), __FUNCTION__, __LINE__, playerIndex); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } Lang &lang = Lang::getInstance(); @@ -565,13 +565,13 @@ namespace Glest { if (fromPlayerIndex < 0 || fromPlayerIndex >= GameConstants::maxPlayers) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] fromPlayerIndex is invalid = %d", extractFileFromDirectoryPath(extractFileFromDirectoryPath(__FILE__).c_str()).c_str(), __FUNCTION__, __LINE__, fromPlayerIndex); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (toPlayerIndex < 0 || toPlayerIndex >= GameConstants::maxPlayers) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] toPlayerIndex is invalid = %d", extractFileFromDirectoryPath(extractFileFromDirectoryPath(__FILE__).c_str()).c_str(), __FUNCTION__, __LINE__, toPlayerIndex); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (fromPlayerIndex == toPlayerIndex) { @@ -628,7 +628,7 @@ namespace Glest { if (playerIndex < 0 || playerIndex >= GameConstants::maxPlayers) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] playerIndex is invalid = %d", extractFileFromDirectoryPath(extractFileFromDirectoryPath(__FILE__).c_str()).c_str(), __FUNCTION__, __LINE__, playerIndex); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } MutexSafeWrapper safeMutexSlot((lockMutex == true ? slotAccessorMutexes[playerIndex] : NULL), CODE_AT_LINE_X(playerIndex)); @@ -640,7 +640,7 @@ namespace Glest { if (playerIndex < 0 || playerIndex >= GameConstants::maxPlayers) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] playerIndex is invalid = %d", extractFileFromDirectoryPath(extractFileFromDirectoryPath(__FILE__).c_str()).c_str(), __FUNCTION__, __LINE__, playerIndex); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } bool result = false; @@ -846,7 +846,7 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, ex.what()); if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s Line: %d] ERROR [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, ex.what()); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } alreadyInLagCheck = false; @@ -2470,7 +2470,7 @@ namespace Glest { if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s] Line: %d\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); if (gameSettingsBuffer == NULL) { - throw megaglest_runtime_error("gameSettingsBuffer == NULL"); + throw game_runtime_error("gameSettingsBuffer == NULL"); } for (unsigned int factionIndex = 0; factionIndex < (unsigned int) gameSettingsBuffer->getFactionCount(); ++factionIndex) { diff --git a/source/glest_game/type_instances/faction.cpp b/source/glest_game/type_instances/faction.cpp index 6c7a7bbcd..44eeb0f57 100644 --- a/source/glest_game/type_instances/faction.cpp +++ b/source/glest_game/type_instances/faction.cpp @@ -182,7 +182,7 @@ namespace Glest { // // printf("i = %d [%p]\n",i,&units[i]); // if(Unit::isUnitDeleted(units[i]) == true) { // printf("i = %d [%p]\n",i,&units[i]); - // throw megaglest_runtime_error("unit already deleted!"); + // throw game_runtime_error("unit already deleted!"); // } //} //printf("\nSorting\n"); @@ -393,11 +393,11 @@ namespace Glest { ExecutingTaskSafeWrapper safeExecutingTaskMutex(this); if (this->faction == NULL) { - throw megaglest_runtime_error("this->faction == NULL"); + throw game_runtime_error("this->faction == NULL"); } World *world = this->faction->getWorld(); if (world == NULL) { - throw megaglest_runtime_error("world == NULL"); + throw game_runtime_error("world == NULL"); } codeLocation = "7"; @@ -429,7 +429,7 @@ namespace Glest { codeLocation = "10"; Unit *unit = this->faction->getUnit(j); if (unit == NULL) { - throw megaglest_runtime_error("unit == NULL"); + throw game_runtime_error("unit == NULL"); } codeLocation = "11"; @@ -479,7 +479,7 @@ namespace Glest { if (world->getUnitUpdater() == NULL) { throw - megaglest_runtime_error + game_runtime_error ("world->getUnitUpdater() == NULL"); } @@ -577,13 +577,13 @@ namespace Glest { "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] UNKNOWN error Loc [%s]\n", __FILE__, __FUNCTION__, __LINE__, codeLocation.c_str()); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem). @@ -1185,7 +1185,7 @@ namespace Glest { bool Faction::reqsOk(const CommandType * ct) const { assert(ct != NULL); if (ct == NULL) { - throw megaglest_runtime_error("In [Faction::reqsOk] ct == NULL"); + throw game_runtime_error("In [Faction::reqsOk] ct == NULL"); } if (ct->getProduced() != NULL && reqsOk(ct->getProduced()) == false) { @@ -1241,7 +1241,7 @@ namespace Glest { snprintf(szBuf, 8096, "cannot apply costs for p [%s] %d of %d costs resource is null", p->getName(false).c_str(), i, p->getCostCount()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } const ResourceType *rt = r->getType(); @@ -1251,7 +1251,7 @@ namespace Glest { "cannot apply costs for p [%s] %d of %d costs resourcetype [%s] is null", p->getName(false).c_str(), i, p->getCostCount(), r->getDescription(false).c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } int cost = r->getAmount(); if ((cost > 0 || (rt->getClass() != rcStatic)) @@ -1298,7 +1298,7 @@ namespace Glest { const ResourceType *rt = p->getCost(i)->getType(); //assert(rt != NULL); if (rt == NULL) { - throw megaglest_runtime_error(string(__FUNCTION__) + + throw game_runtime_error(string(__FUNCTION__) + " rt == NULL for ProducibleType [" + p->getName(false) + "] index: " + intToStr(i)); @@ -1638,7 +1638,7 @@ namespace Glest { } } - throw megaglest_runtime_error("Could not remove unit from faction!"); + throw game_runtime_error("Could not remove unit from faction!"); //assert(false); } @@ -1873,7 +1873,7 @@ namespace Glest { // 0 means start looking leftbottom to top right // if(Thread::isCurrentThreadMainThread() == false) { - // throw megaglest_runtime_error("#1 Invalid access to Faction random from outside main thread current id = " + + // throw game_runtime_error("#1 Invalid access to Faction random from outside main thread current id = " + // intToStr(Thread::getCurrentThreadId()) + " main = " + intToStr(Thread::getMainThreadId())); // } int tryRadius = random.randRange(0, 1); @@ -2026,7 +2026,7 @@ namespace Glest { // 0 means start looking leftbottom to top right // if(Thread::isCurrentThreadMainThread() == false) { - // throw megaglest_runtime_error("#2 Invalid access to Faction random from outside main thread current id = " + + // throw game_runtime_error("#2 Invalid access to Faction random from outside main thread current id = " + // intToStr(Thread::getCurrentThreadId()) + " main = " + intToStr(Thread::getMainThreadId())); // } int tryRadius = random.randRange(0, 1); diff --git a/source/glest_game/type_instances/faction.h b/source/glest_game/type_instances/faction.h index 4137030be..a333e4fa9 100644 --- a/source/glest_game/type_instances/faction.h +++ b/source/glest_game/type_instances/faction.h @@ -209,12 +209,12 @@ namespace Glest { Faction(const Faction & obj) { init(); - throw megaglest_runtime_error("class Faction is NOT safe to copy!"); + throw game_runtime_error("class Faction is NOT safe to copy!"); } Faction & operator= (const Faction & obj) { init(); throw - megaglest_runtime_error("class Faction is NOT safe to assign!"); + game_runtime_error("class Faction is NOT safe to assign!"); } void notifyUnitAliveStatusChange(const Unit * unit); diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 0708d382f..5245c1f52 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -126,7 +126,7 @@ namespace Glest { void UnitPathBasic::add(const Vec2i & path) { if (this->map != NULL) { if (this->map->isInside(path) == false) { - throw megaglest_runtime_error("Invalid map path position = " + + throw game_runtime_error("Invalid map path position = " + path.getString() + " map w x h = " + intToStr(map->getW()) + " " + intToStr(map->getH())); @@ -134,7 +134,7 @@ namespace Glest { map->isInsideSurface(this->map->toSurfCoords(path)) == false) { throw - megaglest_runtime_error("Invalid map surface path position = " + + game_runtime_error("Invalid map surface path position = " + path.getString() + " map surface w x h = " + intToStr(map->getSurfaceW()) + " " + @@ -144,7 +144,7 @@ namespace Glest { if (Thread::isCurrentThreadMainThread() == false) { throw - megaglest_runtime_error + game_runtime_error ("Invalid access to UnitPathBasic add from outside main thread current id = " + intToStr(Thread::getCurrentThreadId()) + " main = " + intToStr(Thread::getMainThreadId())); @@ -155,14 +155,14 @@ namespace Glest { Vec2i UnitPathBasic::pop(bool removeFrontPos) { if (pathQueue.empty() == true) { - throw megaglest_runtime_error("pathQueue.size() = " + + throw game_runtime_error("pathQueue.size() = " + intToStr(pathQueue.size())); } Vec2i p = pathQueue.front(); if (removeFrontPos == true) { if (Thread::isCurrentThreadMainThread() == false) { throw - megaglest_runtime_error + game_runtime_error ("Invalid access to UnitPathBasic delete from outside main thread current id = " + intToStr(Thread::getCurrentThreadId()) + " main = " + intToStr(Thread::getMainThreadId())); @@ -312,7 +312,7 @@ namespace Glest { snprintf(szBuf, 8096, "factionIndex >= world->getFactionCount() [%d] : [%d]", factionIndex, world->getFactionCount()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } faction = world->getFaction(factionIndex); } @@ -694,7 +694,7 @@ namespace Glest { if (map->isInside(pos) == false || map->isInsideSurface(map->toSurfCoords(pos)) == false) { - throw megaglest_runtime_error("#2 Invalid path position = " + + throw game_runtime_error("#2 Invalid path position = " + pos.getString()); } @@ -1044,7 +1044,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return pos + Vec2i(type->getSize() / 2, type->getSize() / 2); @@ -1061,7 +1061,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return Vec2f(truncateDecimal < @@ -1077,7 +1077,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (type->hasCellMap()) { @@ -1221,7 +1221,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } float maxHpAllowed = type->getTotalMaxHp(&totalUpgrade); @@ -1238,7 +1238,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (type->getTotalMaxHp(&totalUpgrade) == 0) { @@ -1259,7 +1259,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (level == NULL && type->getLevelCount() > 0) { @@ -1281,7 +1281,7 @@ namespace Glest { } if (type == NULL) { throw - megaglest_runtime_error("type == NULL in Unit::getFullName()!"); + game_runtime_error("type == NULL in Unit::getFullName()!"); } str += type->getName(translatedValue); return str; @@ -1300,7 +1300,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } bool result = false; @@ -1339,7 +1339,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return (currSkill->getClass() == scBeBuilt); @@ -1393,7 +1393,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: unit == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return faction->isAlly(unit->getFaction()); @@ -1406,7 +1406,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return hp < type->getTotalMaxHp(&totalUpgrade); @@ -1419,7 +1419,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } switch (iut) { @@ -1456,7 +1456,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (this->currSkill == NULL) { char szBuf[8096] = ""; @@ -1464,7 +1464,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: this->currSkill == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (this->currSkill->getClass() == scMove && @@ -1570,7 +1570,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: getType() == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } setCurrSkill(getType()->getFirstStOfClass(sc)); @@ -1584,7 +1584,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: unit == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } //find a free pos in cellmap @@ -1600,7 +1600,7 @@ namespace Glest { if (threadAccessAllowed == false && Thread::isCurrentThreadMainThread() == false) { throw - megaglest_runtime_error + game_runtime_error ("Invalid access to unit random from outside main thread current id = " + intToStr(Thread::getCurrentThreadId()) + " main = " + intToStr(Thread::getMainThreadId())); @@ -1611,7 +1611,7 @@ namespace Glest { void Unit::setPos(const Vec2i & pos, bool clearPathFinder, bool threaded) { if (map->isInside(pos) == false || map->isInsideSurface(map->toSurfCoords(pos)) == false) { - throw megaglest_runtime_error("#3 Invalid path position = " + + throw game_runtime_error("#3 Invalid path position = " + pos.getString()); } @@ -1715,7 +1715,7 @@ namespace Glest { if (map->isInside(targetPos) == false || map->isInsideSurface(map->toSurfCoords(targetPos)) == false) { - throw megaglest_runtime_error("#4 Invalid path position = " + + throw game_runtime_error("#4 Invalid path position = " + targetPos.getString()); } @@ -1840,7 +1840,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } int currentModelIndexForCurrSkillType = lastModelIndexForCurrSkillType; @@ -1862,7 +1862,7 @@ namespace Glest { // if(currSkill == NULL) { // char szBuf[8096]=""; // snprintf(szBuf,8096,"In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,this->toString().c_str()); - // throw megaglest_runtime_error(szBuf); + // throw game_runtime_error(szBuf); // } // // int currentModelIndexForCurrSkillType = lastModelIndexForCurrSkillType; @@ -1917,7 +1917,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } Vec3f result = @@ -1936,7 +1936,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } Vec3f result = @@ -1956,7 +1956,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } Vec3f result = @@ -2096,7 +2096,7 @@ namespace Glest { bool tryQueue) { std::pair < CommandResult, string > result(crFailUndefined, ""); if (command == NULL) { - /*throw megaglest_runtime_error("command == NULL");*/ + /*throw game_runtime_error("command == NULL");*/ return result; } if (SystemFlags:: @@ -2114,7 +2114,7 @@ namespace Glest { chrono.start(); if (command->getCommandType() == NULL) { - throw megaglest_runtime_error("command->getCommandType() == NULL"); + throw game_runtime_error("command->getCommandType() == NULL"); } const int command_priority = command->getPriority(); @@ -2445,7 +2445,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } faction->addStore(type); @@ -2594,7 +2594,7 @@ namespace Glest { __LINE__); faction->removeUnit(this); - } catch (const megaglest_runtime_error & ex) { + } catch (const game_runtime_error & ex) { string sErrBuf = ""; if (ex.wantStackTrace() == true) { char szErrBuf[8096] = ""; @@ -2654,7 +2654,7 @@ namespace Glest { if (map->isInside(pos) == false || map->isInsideSurface(map->toSurfCoords(pos)) == false) { - throw megaglest_runtime_error("#6 Invalid path position = " + + throw game_runtime_error("#6 Invalid path position = " + pos.getString()); } @@ -2666,7 +2666,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } //printf("Line: %d Unit::computeCommandType pos [%s] targetUnit [%s]\n",__LINE__,pos.getString().c_str(),(targetUnit != NULL ? targetUnit->getType()->getName().c_str() : "(null)")); @@ -2759,7 +2759,7 @@ namespace Glest { extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, PROGRESS_SPEED_MULTIPLIER, progress); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (currSkill == NULL) { @@ -2768,7 +2768,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } int64 newProgress = progress; @@ -2792,10 +2792,10 @@ namespace Glest { //update progresses // const Game *game = Renderer::getInstance().getGame(); // if(game == NULL) { - // throw megaglest_runtime_error("game == NULL"); + // throw game_runtime_error("game == NULL"); // } // if(game->getWorld() == NULL) { - // throw megaglest_runtime_error("game->getWorld() == NULL"); + // throw game_runtime_error("game->getWorld() == NULL"); // } newProgress = getUpdatedProgress(progress, GameConstants::updateFps, @@ -2837,12 +2837,12 @@ namespace Glest { //if moving to an higher cell move slower else move faster Cell *unitCell = map->getCell(pos); if (unitCell == NULL) { - throw megaglest_runtime_error("unitCell == NULL"); + throw game_runtime_error("unitCell == NULL"); } Cell *targetCell = map->getCell(targetPos); if (targetCell == NULL) { - throw megaglest_runtime_error("targetCell == NULL"); + throw game_runtime_error("targetCell == NULL"); } int64 heightDiff = ((truncateDecimal < float >(unitCell->getHeight(), @@ -3296,7 +3296,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } //speed @@ -3642,7 +3642,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: boost == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } //printf("APPLYING ATTACK BOOST to unit [%s - %d] from unit [%s - %d]\n",this->getType()->getName().c_str(),this->getId(),source->getType()->getName().c_str(),source->getId()); @@ -3813,7 +3813,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: boost == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (SystemFlags::VERBOSE_MODE_ENABLED) @@ -3952,7 +3952,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } //if(this->getType()->getName() == "spearman") printf("Unit [%d - %s] start tick hp = %d\n",this->getId(),this->getType()->getName().c_str(),hp); @@ -4105,7 +4105,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: currSkill == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } //if not enough ep @@ -4130,7 +4130,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: getType() == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (this->ep > getType()->getTotalMaxEp(&totalUpgrade)) { @@ -4156,7 +4156,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } //increase hp @@ -4164,7 +4164,7 @@ namespace Glest { int original_hp = this->hp; if (type->getProductionTime() + 1 == 0) { throw - megaglest_runtime_error + game_runtime_error ("Detected divide by 0 condition: type->getProductionTime() + 1 == 0"); } this->hp += getType()->getMaxHp() / type->getProductionTime() + 1; @@ -4223,7 +4223,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: type == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } //startDamageParticles @@ -4400,7 +4400,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: upgradeType == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (upgradeType->isAffected(type)) { @@ -4501,7 +4501,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: mct == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } const UnitType *morphUnitType = mct->getMorphUnit(); @@ -4512,7 +4512,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: morphUnitType == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } Field morphUnitField = fLand; @@ -4537,7 +4537,7 @@ namespace Glest { game->getWorld()->findUnitById(effect-> getSource()->getId()); if (sourceUnit == NULL) { - throw megaglest_runtime_error("sourceUnit == NULL"); + throw game_runtime_error("sourceUnit == NULL"); } sourceUnit->morphAttackBoosts(this); } @@ -4603,7 +4603,7 @@ namespace Glest { || map->isInsideSurface(map->toSurfCoords(pos)) == false) { //printf("CRASHING FOR UNIT: %d [%s] alive = %d\n",this->getId(),this->getType()->getName().c_str(),this->isAlive()); //abort(); - throw megaglest_runtime_error("#7 Invalid path position = " + + throw game_runtime_error("#7 Invalid path position = " + pos.getString()); } @@ -4702,7 +4702,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: command == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - /*throw megaglest_runtime_error(szBuf);*/ + /*throw game_runtime_error(szBuf);*/ return result; } @@ -4761,7 +4761,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: command->getCommandType() == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } const ProducibleType *produced = @@ -4807,7 +4807,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: builtUnit == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (faction->reqsOk(builtUnit) == false) { @@ -4846,7 +4846,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: uct == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (faction-> @@ -4876,14 +4876,14 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: command == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } else if (command->getCommandType() == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s Line: %d] ERROR: command->getCommandType() == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } //check produced @@ -4910,7 +4910,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: uct == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } faction->startUpgrade(uct->getProducedUpgrade()); @@ -4925,14 +4925,14 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: command == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } else if (command->getCommandType() == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s Line: %d] ERROR: command->getCommandType() == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (getCurrCommand() == command @@ -4969,7 +4969,7 @@ namespace Glest { "In [%s::%s Line: %d] ERROR: uct == NULL, Unit = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->toString().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } faction->cancelUpgrade(uct->getProducedUpgrade()); @@ -5236,7 +5236,7 @@ namespace Glest { "Warning: Particle system is trying to find mesh '" + meshName + "', but just found:\n'" + meshesFound + "' in file:\n'" + model->getFileName() + "'\n"; - //throw megaglest_runtime_error(errorString); + //throw game_runtime_error(errorString); printf("%s", errorString.c_str()); } } @@ -5461,7 +5461,7 @@ namespace Glest { if (map->isInside(this->meetingPos) == false || map->isInsideSurface(map->toSurfCoords(this->meetingPos)) == false) { - throw megaglest_runtime_error("#8 Invalid path position = " + + throw game_runtime_error("#8 Invalid path position = " + this->meetingPos.getString()); } @@ -5494,9 +5494,9 @@ namespace Glest { int teamIndex = this->getTeam(); if (game == NULL) { - throw megaglest_runtime_error("game == NULL"); + throw game_runtime_error("game == NULL"); } else if (game->getWorld() == NULL) { - throw megaglest_runtime_error("game->getWorld() == NULL"); + throw game_runtime_error("game->getWorld() == NULL"); } // Try the local unit exploration cache @@ -6398,7 +6398,7 @@ namespace Glest { break; default: throw - megaglest_runtime_error("detected unsupported pathfinder type!"); + game_runtime_error("detected unsupported pathfinder type!"); } newpath->loadGame(unitNode); diff --git a/source/glest_game/type_instances/upgrade.cpp b/source/glest_game/type_instances/upgrade.cpp index b96f287a5..11bb2bdc8 100644 --- a/source/glest_game/type_instances/upgrade.cpp +++ b/source/glest_game/type_instances/upgrade.cpp @@ -139,7 +139,7 @@ namespace Glest { "Error canceling upgrade, iterFind->second >= upgrades.size() - [%d] : [%d]", iterFind->second, (int) upgrades.size()); throw - megaglest_runtime_error + game_runtime_error ("Error canceling upgrade, upgrade not found in upgrade manager"); } int eraseIndex = iterFind->second; @@ -158,7 +158,7 @@ namespace Glest { } } else { throw - megaglest_runtime_error + game_runtime_error ("Error canceling upgrade, upgrade not found in upgrade manager"); } @@ -175,7 +175,7 @@ namespace Glest { upgrades.erase(it); } else{ - throw megaglest_runtime_error("Error canceling upgrade, upgrade not found in upgrade manager"); + throw game_runtime_error("Error canceling upgrade, upgrade not found in upgrade manager"); } */ } @@ -187,7 +187,7 @@ namespace Glest { upgrades[iterFind->second]->setState(usUpgraded); } else { throw - megaglest_runtime_error + game_runtime_error ("Error finishing upgrade, upgrade not found in upgrade manager"); } @@ -205,7 +205,7 @@ namespace Glest { (*it)->setState(usUpgraded); } else{ - throw megaglest_runtime_error("Error finishing upgrade, upgrade not found in upgrade manager"); + throw game_runtime_error("Error finishing upgrade, upgrade not found in upgrade manager"); } */ } diff --git a/source/glest_game/type_instances/upgrade.h b/source/glest_game/type_instances/upgrade.h index 4bffc18be..68524e195 100644 --- a/source/glest_game/type_instances/upgrade.h +++ b/source/glest_game/type_instances/upgrade.h @@ -152,14 +152,14 @@ namespace Glest { /** * Cancels an upgrade before it is finished. The upgrade is removed from the UpgradeManager. * @param upgradeType The type of the upgrade to remove. - * @throws megaglest_runtime_error If there is no upgrade of the desired type in the UpgradeManager. + * @throws game_runtime_error If there is no upgrade of the desired type in the UpgradeManager. */ void cancelUpgrade(const UpgradeType * upgradeType); /** * Sets an Upgrade in the UpgradeManager as finished (ie, the state is UpgradeState::usUpgraded). * @param upgradeType The type of the upgrade to complete. - * @throws megaglest_runtime_error If there is no upgrade of the desired type in the UpgradeManager. + * @throws game_runtime_error If there is no upgrade of the desired type in the UpgradeManager. */ void finishUpgrade(const UpgradeType * upgradeType); diff --git a/source/glest_game/types/faction_type.cpp b/source/glest_game/types/faction_type.cpp index dec14092a..d0db58be9 100644 --- a/source/glest_game/types/faction_type.cpp +++ b/source/glest_game/types/faction_type.cpp @@ -223,7 +223,7 @@ namespace Glest { (double) unitTypes.size()) * 100.0 / techTree->getTypeCount())); SDL_PumpEvents(); - } catch (megaglest_runtime_error & ex) { + } catch (game_runtime_error & ex) { if (validationMode == false) { throw; } else { @@ -235,13 +235,13 @@ namespace Glest { } } } - } catch (megaglest_runtime_error & ex) { + } catch (game_runtime_error & ex) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__). c_str(), __FUNCTION__, __LINE__, ex.what()); - throw megaglest_runtime_error("Error loading units: " + + throw game_runtime_error("Error loading units: " + currentPath + "\nMessage: " + ex.what(), !ex.wantStackTrace()); } catch (const exception & e) { @@ -250,7 +250,7 @@ namespace Glest { extractFileFromDirectoryPath(__FILE__). c_str(), __FUNCTION__, __LINE__, e.what()); - throw megaglest_runtime_error("Error loading units: " + + throw game_runtime_error("Error loading units: " + currentPath + "\nMessage: " + e.what()); } @@ -265,7 +265,7 @@ namespace Glest { upgradeTypes[i].load(str, techTree, this, checksum, techtreeChecksum, loadedFileList, validationMode); - } catch (megaglest_runtime_error & ex) { + } catch (game_runtime_error & ex) { if (validationMode == false) { throw; } else { @@ -285,7 +285,7 @@ namespace Glest { extractFileFromDirectoryPath(__FILE__). c_str(), __FUNCTION__, __LINE__, e.what()); - throw megaglest_runtime_error("Error loading upgrades: " + + throw game_runtime_error("Error loading upgrades: " + currentPath + "\n" + e.what()); } @@ -324,7 +324,7 @@ namespace Glest { try { startingResources[i].init(techTree->getResourceType(name), amount); - } catch (megaglest_runtime_error & ex) { + } catch (game_runtime_error & ex) { if (validationMode == false) { throw; } else { @@ -406,7 +406,7 @@ namespace Glest { healthbarVisible = healthbarVisible | hbvOff; } else { throw - megaglest_runtime_error + game_runtime_error ("Unknown Healthbar Visible Option: " + current, true); } } @@ -734,7 +734,7 @@ namespace Glest { const BuildCommandType *build = dynamic_cast (cmdType); if (build == NULL) { - throw megaglest_runtime_error("build == NULL"); + throw game_runtime_error("build == NULL"); } for (int k = 0; k < build->getBuildingCount(); ++k) { const UnitType *buildUnit = build->getBuilding(k); @@ -782,7 +782,7 @@ namespace Glest { const RepairCommandType *repair = dynamic_cast (cmdType); if (repair == NULL) { - throw megaglest_runtime_error("repair == NULL"); + throw game_runtime_error("repair == NULL"); } for (int k = 0; k < repair->getRepairCount(); ++k) { const UnitType *repairUnit = repair->getRepair(k); @@ -916,7 +916,7 @@ namespace Glest { const BuildCommandType *build = dynamic_cast (cmdType); if (build == NULL) { - throw megaglest_runtime_error("build == NULL"); + throw game_runtime_error("build == NULL"); } for (int k = 0; k < build->getBuildingCount() && foundUnit == false; @@ -939,7 +939,7 @@ namespace Glest { const MorphCommandType *morph = dynamic_cast (cmdType); if (morph == NULL) { - throw megaglest_runtime_error("morph == NULL"); + throw game_runtime_error("morph == NULL"); } const UnitType *morphUnit = morph->getMorphUnit(); @@ -1105,7 +1105,7 @@ namespace Glest { const HarvestCommandType *harvest = dynamic_cast (cmdType); if (harvest == NULL) { - throw megaglest_runtime_error("harvest == NULL"); + throw game_runtime_error("harvest == NULL"); } for (int k = 0; k < harvest->getHarvestedResourceCount(); ++k) { const ResourceType *harvestResource = @@ -1229,7 +1229,7 @@ namespace Glest { unitTypes[i].getName(false).c_str()); } - throw megaglest_runtime_error("Unit type not found: [" + name + + throw game_runtime_error("Unit type not found: [" + name + "] in faction type [" + this->name + "]", true); } @@ -1251,7 +1251,7 @@ namespace Glest { // if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] scanning [%s] idx = %d [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,name.c_str(),i,unitTypes[i].getName(false).c_str()); // } // - // throw megaglest_runtime_error("Unit type not found: [" + intToStr(id) + "] in faction type [" + this->name + "]",true); + // throw game_runtime_error("Unit type not found: [" + intToStr(id) + "] in faction type [" + this->name + "]",true); //} const UpgradeType *FactionType::getUpgradeType(const string & name) const { @@ -1289,7 +1289,7 @@ namespace Glest { upgradeTypes[i].getName().c_str()); } - throw megaglest_runtime_error("Upgrade type not found: [" + name + + throw game_runtime_error("Upgrade type not found: [" + name + "] in faction type [" + this->name + "]", true); } diff --git a/source/glest_game/types/resource_type.cpp b/source/glest_game/types/resource_type.cpp index 493f4385a..97f64143c 100644 --- a/source/glest_game/types/resource_type.cpp +++ b/source/glest_game/types/resource_type.cpp @@ -241,13 +241,13 @@ namespace Glest { } else { displayInHud = true; } - } catch (megaglest_runtime_error & ex) { + } catch (game_runtime_error & ex) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__). c_str(), __FUNCTION__, __LINE__, ex.what()); - throw megaglest_runtime_error("Error loading resource type: " + + throw game_runtime_error("Error loading resource type: " + path + "\nMessage: " + ex.what(), !ex.wantStackTrace()); } catch (const exception & e) { @@ -255,7 +255,7 @@ namespace Glest { "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, e.what()); - throw megaglest_runtime_error("Error loading resource type: " + + throw game_runtime_error("Error loading resource type: " + path + "\n" + e.what()); } } @@ -276,7 +276,7 @@ namespace Glest { return rcConsumable; } throw - megaglest_runtime_error + game_runtime_error ("Error converting from string ro resourceClass, found: " + s); } diff --git a/source/glest_game/types/skill_type.cpp b/source/glest_game/types/skill_type.cpp index 5b04da21b..1a7603722 100644 --- a/source/glest_game/types/skill_type.cpp +++ b/source/glest_game/types/skill_type.cpp @@ -422,7 +422,7 @@ namespace Glest { snprintf(szBuf, 8096, "Unsupported target [%s] specified for attack boost for skill [%s] in [%s]", targetType.c_str(), name.c_str(), parentLoader.c_str()); - throw megaglest_runtime_error(szBuf, true); + throw game_runtime_error(szBuf, true); } // Load the regular targets @@ -577,14 +577,14 @@ namespace Glest { "In [%s::%s Line %d] ERROR CANNOT LOAD MODEL [%s] for parentLoader [%s]\n", __FILE__, __FUNCTION__, __LINE__, path.c_str(), parentLoader.c_str()); - throw megaglest_runtime_error("Error: cannot load model [" + + throw game_runtime_error("Error: cannot load model [" + path + "] for skill [" + name + "] ", true); } } if (animations.empty() == true) { throw - megaglest_runtime_error("Error no animations found for skill [" + + game_runtime_error("Error no animations found for skill [" + name + "] for parentLoader [" + parentLoader + "]", true); } @@ -1097,7 +1097,7 @@ namespace Glest { snprintf(szBuf, 8096, "The attack skill has an INVALID attack var value which is < 0 [%d] in file [%s]!", attackVar, dir.c_str()); - throw megaglest_runtime_error(szBuf, true); + throw game_runtime_error(szBuf, true); } attackRange = @@ -1138,7 +1138,7 @@ namespace Glest { } else if (fieldName == "air") { attackFields[fAir] = true; } else { - throw megaglest_runtime_error("Not a valid field: " + fieldName + + throw game_runtime_error("Not a valid field: " + fieldName + ": " + dir, true); } } @@ -1229,7 +1229,7 @@ namespace Glest { if (totalDamagePercentage != 100) { throw - megaglest_runtime_error + game_runtime_error ("Damages percentages of projectiles don't sum up to 100 %", true); } diff --git a/source/glest_game/types/tech_tree.cpp b/source/glest_game/types/tech_tree.cpp index 619984df7..60de7c30d 100644 --- a/source/glest_game/types/tech_tree.cpp +++ b/source/glest_game/types/tech_tree.cpp @@ -274,13 +274,13 @@ namespace Glest { for (int i = 0; i < (int) filenames.size(); ++i) { resourceTypes[i].deletePixels(); } - } catch (megaglest_runtime_error & ex) { + } catch (game_runtime_error & ex) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__). c_str(), __FUNCTION__, __LINE__, ex.what()); - throw megaglest_runtime_error("Error loading Resource Types in: " + + throw game_runtime_error("Error loading Resource Types in: " + currentPath + "\nMessage: " + ex.what(), !ex.wantStackTrace() || isValidationModeEnabled); @@ -290,7 +290,7 @@ namespace Glest { extractFileFromDirectoryPath(__FILE__). c_str(), __FUNCTION__, __LINE__, e.what()); - throw megaglest_runtime_error("Error loading Resource Types in: " + + throw game_runtime_error("Error loading Resource Types in: " + currentPath + "\nMessage: " + e.what(), isValidationModeEnabled); } @@ -382,13 +382,13 @@ namespace Glest { Window::handleEvent(); SDL_PumpEvents(); } - } catch (megaglest_runtime_error & ex) { + } catch (game_runtime_error & ex) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__). c_str(), __FUNCTION__, __LINE__, ex.what()); - throw megaglest_runtime_error("Error loading Tech Tree: " + + throw game_runtime_error("Error loading Tech Tree: " + currentPath + "\nMessage: " + ex.what(), !ex.wantStackTrace() || isValidationModeEnabled); @@ -398,7 +398,7 @@ namespace Glest { extractFileFromDirectoryPath(__FILE__). c_str(), __FUNCTION__, __LINE__, e.what()); - throw megaglest_runtime_error("Error loading Tech Tree: " + + throw game_runtime_error("Error loading Tech Tree: " + currentPath + "\nMessage: " + e.what(), isValidationModeEnabled); } @@ -440,13 +440,13 @@ namespace Glest { Window::handleEvent(); SDL_PumpEvents(); } - } catch (megaglest_runtime_error & ex) { + } catch (game_runtime_error & ex) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__). c_str(), __FUNCTION__, __LINE__, ex.what()); - throw megaglest_runtime_error("Error loading Faction Types: " + + throw game_runtime_error("Error loading Faction Types: " + currentPath + "\nMessage: " + ex.what(), !ex.wantStackTrace() || isValidationModeEnabled); @@ -456,7 +456,7 @@ namespace Glest { extractFileFromDirectoryPath(__FILE__). c_str(), __FUNCTION__, __LINE__, e.what()); - throw megaglest_runtime_error("Error loading Faction Types: " + + throw game_runtime_error("Error loading Faction Types: " + currentPath + "\nMessage: " + e.what(), isValidationModeEnabled); } @@ -567,7 +567,7 @@ namespace Glest { "In [%s::%s Line: %d]\n", extractFileFromDirectoryPath(__FILE__). c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error("Faction not found: " + name, true); + throw game_runtime_error("Faction not found: " + name, true); } const FactionType *TechTree::getType(const string & name) const { @@ -582,7 +582,7 @@ namespace Glest { "In [%s::%s Line: %d]\n", extractFileFromDirectoryPath(__FILE__). c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error("Faction not found: " + name, true); + throw game_runtime_error("Faction not found: " + name, true); } const ResourceType *TechTree::getTechResourceType(int i) const { @@ -590,7 +590,7 @@ namespace Glest { const ResourceType *rt = getResourceType(j); assert(rt != NULL); if (rt == NULL) { - throw megaglest_runtime_error("rt == NULL"); + throw game_runtime_error("rt == NULL"); } if (rt->getResourceNumber() == i && rt->getClass() == rcTech) return getResourceType(j); @@ -611,7 +611,7 @@ namespace Glest { snprintf(szBuf, 8096, "The referenced tech tree [%s] is either missing or has no resources defined but at least one resource is required.", this->name.c_str()); - throw megaglest_runtime_error(szBuf, true); + throw game_runtime_error(szBuf, true); } const ResourceType *TechTree::getResourceType(const string & name) const { @@ -622,7 +622,7 @@ namespace Glest { } } - throw megaglest_runtime_error("Resource Type not found: " + name, + throw game_runtime_error("Resource Type not found: " + name, true); } @@ -633,7 +633,7 @@ namespace Glest { } } - throw megaglest_runtime_error("Armor Type not found: " + name, true); + throw game_runtime_error("Armor Type not found: " + name, true); } const AttackType *TechTree::getAttackType(const string & name) const { @@ -643,7 +643,7 @@ namespace Glest { } } - throw megaglest_runtime_error("Attack Type not found: " + name, true); + throw game_runtime_error("Attack Type not found: " + name, true); } double TechTree::getDamageMultiplier(const AttackType * att, diff --git a/source/glest_game/types/unit_type.cpp b/source/glest_game/types/unit_type.cpp index 4c904164b..624dbb8a8 100644 --- a/source/glest_game/types/unit_type.cpp +++ b/source/glest_game/types/unit_type.cpp @@ -339,7 +339,7 @@ namespace Glest { if (parametersNode->getChild("max-hp")->hasAttribute("start-value") && parametersNode->getChild("max-hp")-> hasAttribute("start-percentage")) { - throw megaglest_runtime_error("Unit " + name + + throw game_runtime_error("Unit " + name + " has both start-value and start-percentage for HP", true); } @@ -379,7 +379,7 @@ namespace Glest { if (parametersNode->getChild("max-ep")->hasAttribute("start-value") && parametersNode->getChild("max-ep")-> hasAttribute("start-percentage")) { - throw megaglest_runtime_error("Unit " + name + + throw game_runtime_error("Unit " + name + " has both start-value and start-percentage for EP", true); } @@ -474,7 +474,7 @@ namespace Glest { rowNode->getAttribute("value")->getRestrictedValue(); if ((int) row.size() != size) { throw - megaglest_runtime_error + game_runtime_error ("Cellmap row has not the same length as unit size", true); } for (int j = 0; j < (int) row.size(); ++j) { @@ -505,7 +505,7 @@ namespace Glest { } else if (fieldName == "air") { fields[fAir] = true; } else { - throw megaglest_runtime_error("Not a valid field: " + fieldName + + throw game_runtime_error("Not a valid field: " + fieldName + ": " + path, true); } } @@ -515,7 +515,7 @@ namespace Glest { } else if (fields[fAir]) { field = fAir; } else { - throw megaglest_runtime_error("Unit has no field: " + path, true); + throw game_runtime_error("Unit has no field: " + path, true); } //properties @@ -535,7 +535,7 @@ namespace Glest { } } if (!found) { - throw megaglest_runtime_error("Unknown property: " + + throw game_runtime_error("Unknown property: " + propertyName, true); } } @@ -625,7 +625,7 @@ namespace Glest { healthbarVisible = healthbarVisible | hbvOff; } else { throw - megaglest_runtime_error + game_runtime_error ("Unknown Healthbar Visible Option: " + current, true); } } @@ -750,7 +750,7 @@ namespace Glest { costs[index].init(techTree->getResourceType(iterMap->first), iterMap->second); index++; - } catch (megaglest_runtime_error & ex) { + } catch (game_runtime_error & ex) { if (validationMode == false) { throw; } else { @@ -802,7 +802,7 @@ namespace Glest { getResourceType(iterMap->first), iterMap->second); index++; - } catch (megaglest_runtime_error & ex) { + } catch (game_runtime_error & ex) { if (validationMode == false) { throw; } else { @@ -1072,7 +1072,7 @@ namespace Glest { skillType->load(sn, attackBoostsNode, dir, techTree, factionType, loadedFileList, sourceXMLFile); skillTypes[i] = skillType; - } catch (megaglest_runtime_error & ex) { + } catch (game_runtime_error & ex) { if (validationMode == false) { throw; } else { @@ -1102,7 +1102,7 @@ namespace Glest { commandType->load(i, commandNode, dir, techTree, factionType, *this, loadedFileList, sourceXMLFile); commandTypes[i] = commandType; - } catch (megaglest_runtime_error & ex) { + } catch (game_runtime_error & ex) { if (validationMode == false) { throw; } else { @@ -1121,24 +1121,24 @@ namespace Glest { if (getFirstStOfClass(scStop) == NULL) { throw - megaglest_runtime_error + game_runtime_error ("Every unit must have at least one stop skill: " + path, true); } if (getFirstStOfClass(scDie) == NULL) { throw - megaglest_runtime_error + game_runtime_error ("Every unit must have at least one die skill: " + path, true); } } //Exception handling (conversions and so on); - catch (megaglest_runtime_error & ex) { + catch (game_runtime_error & ex) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__). c_str(), __FUNCTION__, __LINE__, ex.what()); - throw megaglest_runtime_error("Error loading UnitType: " + path + + throw game_runtime_error("Error loading UnitType: " + path + "\nMessage: " + ex.what(), !ex.wantStackTrace()); } catch (const exception & e) { @@ -1147,7 +1147,7 @@ namespace Glest { extractFileFromDirectoryPath(__FILE__). c_str(), __FUNCTION__, __LINE__, e.what()); - throw megaglest_runtime_error("Error loading UnitType: " + path + + throw game_runtime_error("Error loading UnitType: " + path + "\nMessage: " + e.what()); } @@ -1247,7 +1247,7 @@ namespace Glest { for (int i = 0; i < (int) commandTypes.size(); ++i) { if (commandTypes[i] == NULL) { - throw megaglest_runtime_error("commandTypes[i] == NULL"); + throw game_runtime_error("commandTypes[i] == NULL"); } //printf("$$$ Unit [%s] i = %d, commandTypes[i] [%s]\n",this->getName().c_str(),(int)i, commandTypes[i]->toString().c_str()); @@ -1271,7 +1271,7 @@ namespace Glest { for (int i = 0; i < (int) commandTypes.size(); ++i) { if (commandTypes[i] == NULL) { - throw megaglest_runtime_error("commandTypes[i] == NULL"); + throw game_runtime_error("commandTypes[i] == NULL"); } //printf("$$$ Unit [%s] i = %d, commandTypes[i] [%s]\n",this->getName().c_str(),(int)i, commandTypes[i]->toString().c_str()); @@ -1342,7 +1342,7 @@ namespace Glest { bool UnitType::getCellMapCell(int x, int y, CardinalDir facing) const { assert(cellMap); if (cellMap == NULL) { - throw megaglest_runtime_error("cellMap == NULL"); + throw game_runtime_error("cellMap == NULL"); } //checkItemInVault(&(this->size),this->size); @@ -1384,14 +1384,14 @@ namespace Glest { if (skillTypes[i]->getClass() == skillClass) { return skillTypes[i]; } else { - throw megaglest_runtime_error("Skill \"" + skillName + + throw game_runtime_error("Skill \"" + skillName + "\" is not of class \"" + SkillType:: skillClassToStr(skillClass)); } } } - throw megaglest_runtime_error("No skill named \"" + skillName + "\""); + throw game_runtime_error("No skill named \"" + skillName + "\""); } // ==================== totals ==================== @@ -1542,7 +1542,7 @@ namespace Glest { MG_SIZE_T_SPECIFIER "", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, i, commandTypes.size()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return commandTypes[i]; } diff --git a/source/glest_game/types/upgrade_type.cpp b/source/glest_game/types/upgrade_type.cpp index 255b04d5a..4fafdbd06 100644 --- a/source/glest_game/types/upgrade_type.cpp +++ b/source/glest_game/types/upgrade_type.cpp @@ -365,7 +365,7 @@ namespace Glest { } } else { throw - megaglest_runtime_error + game_runtime_error ("Unsupported skilltype in getProdSpeed!"); } @@ -1188,7 +1188,7 @@ namespace Glest { costs[index].init(techTree->getResourceType(iterMap->first), iterMap->second); index++; - } catch (megaglest_runtime_error & ex) { + } catch (game_runtime_error & ex) { if (validationMode == false) { throw; } else { @@ -1226,13 +1226,13 @@ namespace Glest { //values UpgradeTypeBase::load(upgradeNode, name); - } catch (megaglest_runtime_error & ex) { + } catch (game_runtime_error & ex) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__). c_str(), __FUNCTION__, __LINE__, ex.what()); - throw megaglest_runtime_error("Error loading UpgradeType: " + + throw game_runtime_error("Error loading UpgradeType: " + currentPath + "\nMessage: " + ex.what(), !ex.wantStackTrace()); } catch (const exception & e) { @@ -1240,7 +1240,7 @@ namespace Glest { "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, e.what()); - throw megaglest_runtime_error("Error loading UpgradeType: " + + throw game_runtime_error("Error loading UpgradeType: " + currentPath + "\n" + e.what()); } diff --git a/source/glest_game/world/map.cpp b/source/glest_game/world/map.cpp index 82b184d08..6ac14fa22 100644 --- a/source/glest_game/world/map.cpp +++ b/source/glest_game/world/map.cpp @@ -182,7 +182,7 @@ namespace Glest { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Invalid value for teamIndex [%d]", teamIndex); printf("%s\n", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } this->explored[teamIndex] = explored; @@ -194,7 +194,7 @@ namespace Glest { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Invalid value for teamIndex [%d]", teamIndex); printf("%s\n", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } this->visible[teamIndex] = visible; @@ -397,7 +397,7 @@ namespace Glest { char szBuf[8096] = ""; snprintf(szBuf, 8096, "locationIndex >= maxPlayers [%d] [%d]", locationIndex, maxPlayers); printf("%s\n", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); assert(locationIndex < GameConstants::maxPlayers); } } @@ -419,16 +419,16 @@ namespace Glest { MapFileHeader header; size_t readBytes = fread(&header, sizeof(MapFileHeader), 1, f); if (readBytes != 1) { - throw megaglest_runtime_error("Invalid map header detected for file: " + path); + throw game_runtime_error("Invalid map header detected for file: " + path); } fromEndianMapFileHeader(header); if (next2Power(header.width) != header.width) { - throw megaglest_runtime_error("Map width is not a power of 2"); + throw game_runtime_error("Map width is not a power of 2"); } if (next2Power(header.height) != header.height) { - throw megaglest_runtime_error("Map height is not a power of 2"); + throw game_runtime_error("Map height is not a power of 2"); } heightFactor = header.heightFactor; @@ -473,7 +473,7 @@ namespace Glest { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } x = ::Shared::PlatformByteOrder::fromCommonEndian(x); @@ -481,7 +481,7 @@ namespace Glest { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } y = ::Shared::PlatformByteOrder::fromCommonEndian(y); @@ -500,7 +500,7 @@ namespace Glest { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } alt = ::Shared::PlatformByteOrder::fromCommonEndian(alt); @@ -517,7 +517,7 @@ namespace Glest { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } surf = ::Shared::PlatformByteOrder::fromCommonEndian(surf); @@ -534,7 +534,7 @@ namespace Glest { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } objNumber = ::Shared::PlatformByteOrder::fromCommonEndian(objNumber); @@ -560,11 +560,11 @@ namespace Glest { } if (f) fclose(f); } else { - throw megaglest_runtime_error("Can't open file"); + throw game_runtime_error("Can't open file"); } } catch (const exception &e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, e.what()); - throw megaglest_runtime_error("Error loading map: " + path + "\n" + e.what()); + throw game_runtime_error("Error loading map: " + path + "\n" + e.what()); } return mapChecksum; @@ -1011,7 +1011,7 @@ namespace Glest { } if (unit == NULL) { - throw megaglest_runtime_error("unit == NULL"); + throw game_runtime_error("unit == NULL"); } int size = unit->getType()->getSize(); int teamIndex = unit->getTeam(); @@ -1158,12 +1158,12 @@ namespace Glest { Vec2i total = Vec2i(0); if (selection == NULL) { - throw megaglest_runtime_error("selection == NULL"); + throw game_runtime_error("selection == NULL"); } for (int i = 0; i < selection->getCount(); ++i) { if (selection->getUnit(i) == NULL) { - throw megaglest_runtime_error("selection == NULL || selection->getUnit(i) == NULL"); + throw game_runtime_error("selection == NULL || selection->getUnit(i) == NULL"); } total = total + selection->getUnit(i)->getPosNotThreadSafe(); } @@ -1192,7 +1192,7 @@ namespace Glest { //std::pair Map::getUnitDistanceToPos(const Unit *unit,Vec2i pos,const UnitType *ut) { // if(unit == NULL) { - // throw megaglest_runtime_error("unit == NULL"); + // throw game_runtime_error("unit == NULL"); // } // // std::pair result(-1,Vec2i(0)); @@ -1264,10 +1264,10 @@ namespace Glest { Vec2i Map::findBestBuildApproach(const Unit *unit, Vec2i originalBuildPos, const UnitType *ut) const { if (unit == NULL) { - throw megaglest_runtime_error("unit == NULL"); + throw game_runtime_error("unit == NULL"); } if (ut == NULL) { - throw megaglest_runtime_error("ut == NULL"); + throw game_runtime_error("ut == NULL"); } Vec2i unitBuilderPos = unit->getPosNotThreadSafe(); @@ -1324,7 +1324,7 @@ namespace Glest { const Vec2i &testPos) const { assert(ut != NULL); if (ut == NULL) { - throw megaglest_runtime_error("ut == NULL"); + throw game_runtime_error("ut == NULL"); } if (isInside(testPos) && isInsideSurface(toSurfCoords(testPos))) { @@ -1348,7 +1348,7 @@ namespace Glest { void Map::putUnitCells(Unit *unit, const Vec2i &pos, bool ignoreSkill, bool threaded) { assert(unit != NULL); if (unit == NULL) { - throw megaglest_runtime_error("ut == NULL"); + throw game_runtime_error("ut == NULL"); } putUnitCellsPrivate(unit, pos, unit->getType(), false, threaded); @@ -1368,7 +1368,7 @@ namespace Glest { void Map::putUnitCellsPrivate(Unit *unit, const Vec2i &pos, const UnitType *ut, bool isMorph, bool threaded) { assert(unit != NULL); if (unit == NULL) { - throw megaglest_runtime_error("ut == NULL"); + throw game_runtime_error("ut == NULL"); } bool canPutInCell = true; @@ -1378,7 +1378,7 @@ namespace Glest { Vec2i currPos = pos + Vec2i(i, j); assert(isInside(currPos)); if (isInside(currPos) == false) { - throw megaglest_runtime_error("isInside(currPos) == false"); + throw game_runtime_error("isInside(currPos) == false"); } if (ut->hasCellMap() == false || ut->getCellMapCell(i, j, unit->getModelFacing())) { @@ -1404,7 +1404,7 @@ namespace Glest { // // If the unit trying to move into the cell is not in the moving state // // it is likely being created or morphed so we will will log the error // canPutInCell = false; - // // throw megaglest_runtime_error("getCell(currPos)->getUnit(unit->getCurrField()) != NULL"); + // // throw game_runtime_error("getCell(currPos)->getUnit(unit->getCurrField()) != NULL"); // SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] ERROR [getCell(currPos)->getUnit(unit->getCurrField()) != NULL] currPos [%s] unit [%s] cell unit [%s]\n", // __FILE__,__FUNCTION__,__LINE__, // currPos.getString().c_str(), @@ -1427,7 +1427,7 @@ namespace Glest { } else if (canPutInCell == true) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Trying to move unit [%d - %s] into occupied cell [%s] and field = %d, unit already in cell [%d - %s] ", unit->getId(), unit->getType()->getName(false).c_str(), pos.getString().c_str(), field, getCell(currPos)->getUnit(field)->getId(), getCell(currPos)->getUnit(field)->getType()->getName(false).c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } else if (ut->hasCellMap() == true && ut->getAllowEmptyCellMap() == true && @@ -1450,7 +1450,7 @@ namespace Glest { void Map::clearUnitCells(Unit *unit, const Vec2i &pos, bool ignoreSkill) { assert(unit != NULL); if (unit == NULL) { - throw megaglest_runtime_error("unit == NULL"); + throw game_runtime_error("unit == NULL"); } const UnitType *ut = unit->getType(); @@ -1475,7 +1475,7 @@ namespace Glest { Vec2i currPos = pos + Vec2i(i, j); assert(isInside(currPos)); if (isInside(currPos) == false) { - throw megaglest_runtime_error("isInside(currPos) == false"); + throw game_runtime_error("isInside(currPos) == false"); } if (ut->hasCellMap() == false || ut->getCellMapCell(i, j, unit->getModelFacing())) { @@ -1484,7 +1484,7 @@ namespace Glest { //assert(getCell(currPos)->getUnit(unit->getCurrField()) == unit || getCell(currPos)->getUnit(unit->getCurrField()) == NULL); //if(getCell(currPos)->getUnit(unit->getCurrField()) != unit && getCell(currPos)->getUnit(unit->getCurrField()) != NULL) { - // throw megaglest_runtime_error("getCell(currPos)->getUnit(unit->getCurrField()) != unit"); + // throw game_runtime_error("getCell(currPos)->getUnit(unit->getCurrField()) != unit"); //SystemFlags::OutputDebug(SystemFlags::debugError,"In [%s::%s Line: %d] ERROR [getCell(currPos)->getUnit(unit->getCurrField()) != unit] currPos [%s] unit [%s] cell unit [%s]\n", // __FILE__,__FUNCTION__,__LINE__, // currPos.getString().c_str(), @@ -1919,7 +1919,7 @@ namespace Glest { // string value = tokensExploredValue[k]; // printf("k = %d [%s]\n",k,value.c_str()); // } - // throw megaglest_runtime_error("tokensExploredValue.size() [" + intToStr(tokensExploredValue.size()) + "] != GameConstants::maxPlayers"); + // throw game_runtime_error("tokensExploredValue.size() [" + intToStr(tokensExploredValue.size()) + "] != GameConstants::maxPlayers"); // } for (unsigned int k = 0; k < tokensExploredValue.size(); ++k) { string value = tokensExploredValue[k]; @@ -1945,7 +1945,7 @@ namespace Glest { Tokenize(valueList, tokensVisibleValue, "|"); // if(tokensVisibleValue.size() != GameConstants::maxPlayers) { - // throw megaglest_runtime_error("tokensVisibleValue.size() [" + intToStr(tokensVisibleValue.size()) + "] != GameConstants::maxPlayers"); + // throw game_runtime_error("tokensVisibleValue.size() [" + intToStr(tokensVisibleValue.size()) + "] != GameConstants::maxPlayers"); // } for (unsigned int k = 0; k < tokensVisibleValue.size(); ++k) { diff --git a/source/glest_game/world/map.h b/source/glest_game/world/map.h index 6bdc72089..e8edc4800 100644 --- a/source/glest_game/world/map.h +++ b/source/glest_game/world/map.h @@ -79,12 +79,12 @@ namespace Glest { //get inline Unit *getUnit(int field) const { if (field >= fieldCount) { - throw megaglest_runtime_error("Invalid field value" + intToStr(field)); + throw game_runtime_error("Invalid field value" + intToStr(field)); } return units[field]; } inline Unit *getUnitWithEmptyCellMap(int field) const { if (field >= fieldCount) { - throw megaglest_runtime_error("Invalid field value" + intToStr(field)); + throw game_runtime_error("Invalid field value" + intToStr(field)); } return unitsWithEmptyCellMap[field]; } inline float getHeight() const { @@ -93,12 +93,12 @@ namespace Glest { inline void setUnit(int field, Unit *unit) { if (field >= fieldCount) { - throw megaglest_runtime_error("Invalid field value" + intToStr(field)); + throw game_runtime_error("Invalid field value" + intToStr(field)); } units[field] = unit; } inline void setUnitWithEmptyCellMap(int field, Unit *unit) { if (field >= fieldCount) { - throw megaglest_runtime_error("Invalid field value" + intToStr(field)); + throw game_runtime_error("Invalid field value" + intToStr(field)); } unitsWithEmptyCellMap[field] = unit; } inline void setHeight(float height) { @@ -332,13 +332,13 @@ namespace Glest { return NULL; } //abort(); - throw megaglest_runtime_error("arrayIndex >= getCellArraySize(), arrayIndex = " + intToStr(arrayIndex) + " w = " + intToStr(w) + " h = " + intToStr(h)); + throw game_runtime_error("arrayIndex >= getCellArraySize(), arrayIndex = " + intToStr(arrayIndex) + " w = " + intToStr(w) + " h = " + intToStr(h)); } else if (cells == NULL) { if (errorOnInvalid == false) { return NULL; } - throw megaglest_runtime_error("cells == NULL"); + throw game_runtime_error("cells == NULL"); } return &cells[arrayIndex]; @@ -357,11 +357,11 @@ namespace Glest { inline SurfaceCell *getSurfaceCell(int sx, int sy) const { int arrayIndex = sy * surfaceW + sx; if (arrayIndex < 0 || arrayIndex >= getSurfaceCellArraySize()) { - throw megaglest_runtime_error("arrayIndex >= getSurfaceCellArraySize(), arrayIndex = " + intToStr(arrayIndex) + + throw game_runtime_error("arrayIndex >= getSurfaceCellArraySize(), arrayIndex = " + intToStr(arrayIndex) + " surfaceW = " + intToStr(surfaceW) + " surfaceH = " + intToStr(surfaceH) + " sx: " + intToStr(sx) + " sy: " + intToStr(sy)); } else if (surfaceCells == NULL) { - throw megaglest_runtime_error("surfaceCells == NULL"); + throw game_runtime_error("surfaceCells == NULL"); } return &surfaceCells[arrayIndex]; } @@ -520,7 +520,7 @@ namespace Glest { } if (unit == NULL) { - throw megaglest_runtime_error("unit == NULL"); + throw game_runtime_error("unit == NULL"); } int size = unit->getType()->getSize(); diff --git a/source/glest_game/world/scenario.cpp b/source/glest_game/world/scenario.cpp index 8ceaee345..8fae82576 100644 --- a/source/glest_game/world/scenario.cpp +++ b/source/glest_game/world/scenario.cpp @@ -112,7 +112,7 @@ namespace Glest { getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "%s", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return scenarioChecksum; diff --git a/source/glest_game/world/surface_atlas.cpp b/source/glest_game/world/surface_atlas.cpp index 7f9874d25..ea15b7c0e 100644 --- a/source/glest_game/world/surface_atlas.cpp +++ b/source/glest_game/world/surface_atlas.cpp @@ -77,7 +77,7 @@ namespace Glest { void SurfaceAtlas::addSurface(SurfaceInfo *si) { if (si == NULL) { - throw megaglest_runtime_error("Bad surface info (NULL)"); + throw game_runtime_error("Bad surface info (NULL)"); } //check dimensions @@ -97,7 +97,7 @@ namespace Glest { Texture2D *t = Renderer::getInstance().newTexture2D(rsGame); if (t) { //if(t == NULL) { - // throw megaglest_runtime_error("Could not create new texture (NULL)"); + // throw game_runtime_error("Could not create new texture (NULL)"); //} t->setWrapMode(Texture::wmClampToEdge); t->getPixmap()->init(surfaceSize, surfaceSize, 4); @@ -133,14 +133,14 @@ namespace Glest { } if (p == NULL) { - throw megaglest_runtime_error("Bad surface texture pixmap (NULL)"); + throw game_runtime_error("Bad surface texture pixmap (NULL)"); } else if (surfaceSize == -1) { surfaceSize = p->getW(); //printf("Setting surfaceSize = %d for pixmap [%s]\n",surfaceSize,p->getPath().c_str()); } else if (p->getW() != surfaceSize || p->getH() != surfaceSize) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Bad surface texture dimensions, expected surfaceSize = %d, texture w = %d, h = %d", surfaceSize, p->getW(), p->getH()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } diff --git a/source/glest_game/world/tileset.cpp b/source/glest_game/world/tileset.cpp index dbe10d473..f6547d9cd 100644 --- a/source/glest_game/world/tileset.cpp +++ b/source/glest_game/world/tileset.cpp @@ -144,7 +144,7 @@ namespace Glest { } } if (found == false) { - throw megaglest_runtime_error("Error could not find tileset [" + tilesetName + "]\n", true); + throw game_runtime_error("Error could not find tileset [" + tilesetName + "]\n", true); } return tilesetChecksum; @@ -255,9 +255,9 @@ namespace Glest { width = pixmap->getW(); height = pixmap->getW(); - } catch (megaglest_runtime_error& ex) { + } catch (game_runtime_error& ex) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, ex.what()); - throw megaglest_runtime_error("Error loading tileset: " + path + "\nMessage: " + ex.what(), !ex.wantStackTrace()); + throw game_runtime_error("Error loading tileset: " + path + "\nMessage: " + ex.what(), !ex.wantStackTrace()); } catch (const exception &ex) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); @@ -272,17 +272,17 @@ namespace Glest { } if (exceptionError != "") { - throw megaglest_runtime_error(exceptionError.c_str()); + throw game_runtime_error(exceptionError.c_str()); } if (width != height) { - throw megaglest_runtime_error("width != height"); + throw game_runtime_error("width != height"); } if (width % 64 != 0) { - throw megaglest_runtime_error("width % 64 != 0"); + throw game_runtime_error("width % 64 != 0"); } if (width % partsize != 0) { - throw megaglest_runtime_error("width % partsize != 0"); + throw game_runtime_error("width % partsize != 0"); } int parts = width / partsize; @@ -492,12 +492,12 @@ namespace Glest { } //Exception handling (conversions and so on); - catch (megaglest_runtime_error& ex) { + catch (game_runtime_error& ex) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, ex.what()); - throw megaglest_runtime_error("Error loading tileset: " + path + "\nMessage: " + ex.what(), !ex.wantStackTrace()); + throw game_runtime_error("Error loading tileset: " + path + "\nMessage: " + ex.what(), !ex.wantStackTrace()); } catch (const exception &e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, e.what()); - throw megaglest_runtime_error("Error: " + path + "\n" + e.what()); + throw game_runtime_error("Error: " + path + "\n" + e.what()); } Lang &lang = Lang::getInstance(); diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index 77a8f9f4a..db9c89572 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -86,7 +86,7 @@ namespace Glest { pathFinder->init(map); break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } } @@ -422,7 +422,7 @@ namespace Glest { newpath = new UnitPathBasic(); break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } Unit *spawned = new Unit(world->getNextUnitId(unit->getFaction()), newpath, @@ -510,12 +510,12 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] UNKNOWN error\n", __FILE__, __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -535,7 +535,7 @@ namespace Glest { Command *command = unit->getCurrCommand(); if (command == NULL) { - throw megaglest_runtime_error("command == NULL"); + throw game_runtime_error("command == NULL"); } const StopCommandType *sct = static_cast(command->getCommandType()); Unit *sighted = NULL; @@ -597,12 +597,12 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] UNKNOWN error\n", __FILE__, __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -615,7 +615,7 @@ namespace Glest { Command *command = unit->getCurrCommand(); if (command == NULL) { - throw megaglest_runtime_error("command == NULL"); + throw game_runtime_error("command == NULL"); } const MoveCommandType *mct = static_cast(command->getCommandType()); @@ -637,7 +637,7 @@ namespace Glest { tsValue = pathFinder->findPath(unit, pos, NULL, frameIndex); break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } if (SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance, "In [%s::%s Line: %d] took msecs: %lld\n", __FILE__, __FUNCTION__, __LINE__, chrono.getMillis()); @@ -677,12 +677,12 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] UNKNOWN error\n", __FILE__, __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -790,7 +790,7 @@ namespace Glest { tsValue = pathFinder->findPath(unit, pos, NULL, frameIndex); break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } //printf("In [%s::%s Line: %d] END pathfind for attacker [%d - %s]\n",__FILE__,__FUNCTION__,__LINE__,unit->getId(), unit->getType()->getName().c_str()); //fflush(stdout); @@ -893,12 +893,12 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Loc [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] UNKNOWN error\n", __FILE__, __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -925,7 +925,7 @@ namespace Glest { Command *command = unit->getCurrCommand(); if (command == NULL) { - throw megaglest_runtime_error("command == NULL"); + throw game_runtime_error("command == NULL"); } const AttackStoppedCommandType *asct = static_cast(command->getCommandType()); @@ -985,12 +985,12 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] UNKNOWN error\n", __FILE__, __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -1064,7 +1064,7 @@ namespace Glest { Command *command = unit->getCurrCommand(); if (command == NULL) { - throw megaglest_runtime_error("command == NULL"); + throw game_runtime_error("command == NULL"); } const BuildCommandType *bct = static_cast(command->getCommandType()); @@ -1101,7 +1101,7 @@ namespace Glest { } break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } if (SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands, "In [%s::%s Line: %d] tsValue = %d\n", __FILE__, __FUNCTION__, __LINE__, tsValue); @@ -1121,7 +1121,7 @@ namespace Glest { //if arrived destination assert(ut); if (ut == NULL) { - throw megaglest_runtime_error("ut == NULL"); + throw game_runtime_error("ut == NULL"); } bool canOccupyCell = false; @@ -1131,7 +1131,7 @@ namespace Glest { canOccupyCell = map->isFreeCells(command->getPos(), ut->getSize(), fLand, true); break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } if (SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands, "In [%s::%s Line: %d] canOccupyCell = %d\n", __FILE__, __FUNCTION__, __LINE__, canOccupyCell); @@ -1146,7 +1146,7 @@ namespace Glest { newpath = new UnitPathBasic(); break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } Vec2i buildPos = command->getPos(); @@ -1158,7 +1158,7 @@ namespace Glest { if (builtUnitType->hasSkillClass(scBeBuilt) == false) { printf("%s", (string("Unit [") + builtUnitType->getName(false) + "] has no be_built skill, producer was [" + intToStr(unit->getId()) + " - " + unit->getType()->getName(false) + "].").c_str()); - //throw megaglest_runtime_error("Unit [" + builtUnitType->getName(false) + "] has no be_built skill, producer was [" + intToStr(unit->getId()) + " - " + unit->getType()->getName(false) + "]."); + //throw game_runtime_error("Unit [" + builtUnitType->getName(false) + "] has no be_built skill, producer was [" + intToStr(unit->getId()) + " - " + unit->getType()->getName(false) + "]."); return; } @@ -1176,7 +1176,7 @@ namespace Glest { case pfBasic: break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } command->setUnit(builtUnit); @@ -1294,12 +1294,12 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] UNKNOWN error\n", __FILE__, __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -1385,12 +1385,12 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] UNKNOWN error\n", __FILE__, __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -1409,12 +1409,12 @@ namespace Glest { Command *command = unit->getCurrCommand(); if (command == NULL) { - throw megaglest_runtime_error("command == NULL"); + throw game_runtime_error("command == NULL"); } const HarvestCommandType *hct = dynamic_cast(command->getCommandType()); if (hct == NULL) { - throw megaglest_runtime_error("hct == NULL"); + throw game_runtime_error("hct == NULL"); } Vec2i targetPos(-1); @@ -1482,7 +1482,7 @@ namespace Glest { } break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } if (SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance, "In [%s::%s Line: %d] took msecs: %lld\n", __FILE__, __FUNCTION__, __LINE__, chrono.getMillis()); @@ -1519,7 +1519,7 @@ namespace Glest { unit->setLoadType(r->getType()); break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } if (SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) { @@ -1562,7 +1562,7 @@ namespace Glest { } break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } if (SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance, "In [%s::%s Line: %d] took msecs: %lld\n", __FILE__, __FUNCTION__, __LINE__, chrono.getMillis()); @@ -1582,7 +1582,7 @@ namespace Glest { } break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } if (canHarvestDestPos == true) { @@ -1609,7 +1609,7 @@ namespace Glest { unit->setLoadType(r->getType()); break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } } } @@ -1643,7 +1643,7 @@ namespace Glest { } break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } } @@ -1691,7 +1691,7 @@ namespace Glest { tsValue = pathFinder->findPath(unit, store->getCenteredPos(), NULL, frameIndex); break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } if (SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance, "In [%s::%s Line: %d] took msecs: %lld\n", __FILE__, __FUNCTION__, __LINE__, chrono.getMillis()); @@ -1808,7 +1808,7 @@ namespace Glest { case pfBasic: break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } //printf("\n\n#6\n\n"); @@ -1841,12 +1841,12 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] UNKNOWN error\n", __FILE__, __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -1991,7 +1991,7 @@ namespace Glest { //} Command *command = unit->getCurrCommand(); if (command == NULL) { - throw megaglest_runtime_error("command == NULL"); + throw game_runtime_error("command == NULL"); } const RepairCommandType *rct = static_cast(command->getCommandType()); @@ -2110,7 +2110,7 @@ namespace Glest { (nextToRepaired == false && peerUnitBuilder == NULL)) { if (command == NULL) { - throw megaglest_runtime_error("command == NULL"); + throw game_runtime_error("command == NULL"); } Vec2i repairPos = command->getPos(); bool startRepairing = (repaired != NULL && rct->isRepairableUnitType(repaired->getType()) && repaired->isDamaged()); @@ -2176,7 +2176,7 @@ namespace Glest { ts = pathFinder->findPath(unit, repairPos, NULL, frameIndex); break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } if (SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands, "In [%s::%s Line: %d] ts = %d\n", __FILE__, __FUNCTION__, __LINE__, ts); @@ -2265,12 +2265,12 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] UNKNOWN error\n", __FILE__, __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -2296,7 +2296,7 @@ namespace Glest { Command *command = unit->getCurrCommand(); if (command == NULL) { - throw megaglest_runtime_error("command == NULL"); + throw game_runtime_error("command == NULL"); } const ProduceCommandType *pct = static_cast(command->getCommandType()); @@ -2324,7 +2324,7 @@ namespace Glest { newpath = new UnitPathBasic(); break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } produced = new Unit(world->getNextUnitId(unit->getFaction()), newpath, Vec2i(0), pct->getProducedUnit(), unit->getFaction(), world->getMap(), CardinalDir(CardinalDir::NORTH)); @@ -2362,12 +2362,12 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] UNKNOWN\n", __FILE__, __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -2394,7 +2394,7 @@ namespace Glest { Command *command = unit->getCurrCommand(); if (command == NULL) { - throw megaglest_runtime_error("command == NULL"); + throw game_runtime_error("command == NULL"); } const UpgradeCommandType *uct = static_cast(command->getCommandType()); @@ -2420,12 +2420,12 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] UNKNOWN error\n", __FILE__, __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -2451,7 +2451,7 @@ namespace Glest { Command *command = unit->getCurrCommand(); if (command == NULL) { - throw megaglest_runtime_error("command == NULL"); + throw game_runtime_error("command == NULL"); } const MorphCommandType *mct = static_cast(command->getCommandType()); @@ -2478,7 +2478,7 @@ namespace Glest { case pfBasic: break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } //finish the command @@ -2491,7 +2491,7 @@ namespace Glest { case pfBasic: break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } scriptManager->onUnitCreated(unit); @@ -2514,12 +2514,12 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] UNKNOWN error\n", __FILE__, __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -2578,13 +2578,13 @@ namespace Glest { void UnitUpdater::damage(Unit *attacker, const AttackSkillType* ast, Unit *attacked, float distance, int damagePercent) { if (attacker == NULL) { - throw megaglest_runtime_error("attacker == NULL"); + throw game_runtime_error("attacker == NULL"); } if (ast == NULL) { - throw megaglest_runtime_error("ast == NULL"); + throw game_runtime_error("ast == NULL"); } if (attacked == NULL) { - throw megaglest_runtime_error("attacked == NULL"); + throw game_runtime_error("attacked == NULL"); } //get vars @@ -2656,7 +2656,7 @@ namespace Glest { case pfBasic: break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } attacked->setCauseOfDeath(ucodAttacked); @@ -2678,7 +2678,7 @@ namespace Glest { const AttackSkillType *ast = static_cast(unit->getCurrSkill()); if (ast == NULL) { - throw megaglest_runtime_error("Start attack particle ast == NULL!"); + throw game_runtime_error("Start attack particle ast == NULL!"); } ParticleSystemTypeSplash *pstSplash = ast->getSplashParticleType(); @@ -3082,12 +3082,12 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] UNKNOWN error\n", __FILE__, __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return result; @@ -3158,12 +3158,12 @@ namespace Glest { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } catch (...) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s %d] UNKNOWN error\n", __FILE__, __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return enemies; diff --git a/source/glest_game/world/world.cpp b/source/glest_game/world/world.cpp index b0e78ec85..d16ddb81a 100644 --- a/source/glest_game/world/world.cpp +++ b/source/glest_game/world/world.cpp @@ -372,7 +372,7 @@ namespace Glest { if (createUnits) { initUnits(); } - } catch (const megaglest_runtime_error &ex) { + } catch (const game_runtime_error &ex) { gotError = true; if (ex.wantStackTrace() == true) { char szErrBuf[8096] = ""; @@ -400,7 +400,7 @@ namespace Glest { SurfaceCell *sc = map.getSurfaceCell(i, j); if (sc == NULL) { - throw megaglest_runtime_error("sc == NULL"); + throw game_runtime_error("sc == NULL"); } for (int k = 0; k < GameConstants::maxPlayers; k++) { @@ -429,7 +429,7 @@ namespace Glest { } if (gotError == true) { - throw megaglest_runtime_error(sErrBuf, !skipStackTrace); + throw game_runtime_error(sErrBuf, !skipStackTrace); } if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); @@ -602,7 +602,7 @@ namespace Glest { // for(int i = 0; i < factionCount; ++i) { // Faction *faction = getFaction(i); // if(faction == NULL) { - // throw megaglest_runtime_error("faction == NULL"); + // throw game_runtime_error("faction == NULL"); // } // // // Sort units by command groups @@ -703,7 +703,7 @@ namespace Glest { for (int j = 0; j < unitCount; ++j) { Unit *unit = faction->getUnit(j); if (unit == NULL) { - throw megaglest_runtime_error("unit == NULL"); + throw game_runtime_error("unit == NULL"); } CommandClass unitCommandClass = ccCount; @@ -794,7 +794,7 @@ namespace Glest { Unit *unit = faction->getUnit(j); if (unit == NULL) { - throw megaglest_runtime_error("unit == NULL"); + throw game_runtime_error("unit == NULL"); } if (unit->getToBeUndertaken() == true) { @@ -821,7 +821,7 @@ namespace Glest { for (int j = 0; j < factionCount; ++j) { Faction *faction = getFaction(j); if (faction == NULL) { - throw megaglest_runtime_error("faction == NULL"); + throw game_runtime_error("faction == NULL"); } faction->applyCostsOnInterval(rt); @@ -1019,7 +1019,7 @@ namespace Glest { for (int unitIndex = 0; unitIndex < unitCount; ++unitIndex) { Unit *unit = faction->getUnit(unitIndex); if (unit == NULL) { - throw megaglest_runtime_error("unit == NULL"); + throw game_runtime_error("unit == NULL"); } unit->tick(); @@ -1103,7 +1103,7 @@ namespace Glest { const UnitType* World::findUnitTypeById(const FactionType* factionType, int id) { if (factionType == NULL) { - throw megaglest_runtime_error("factionType == NULL"); + throw game_runtime_error("factionType == NULL"); } for (int i = 0; i < factionType->getUnitTypeCount(); ++i) { const UnitType *unitType = factionType->getUnitType(i); @@ -1137,7 +1137,7 @@ namespace Glest { //looks for a place for a unit around a start location, returns true if succeded bool World::placeUnit(const Vec2i &startLoc, int radius, Unit *unit, bool spaciated, bool threaded) { if (unit == NULL) { - throw megaglest_runtime_error("unit == NULL"); + throw game_runtime_error("unit == NULL"); } bool freeSpace = false; @@ -1170,7 +1170,7 @@ namespace Glest { //clears a unit old position from map and places new position void World::moveUnitCells(Unit *unit, bool threaded) { if (unit == NULL) { - throw megaglest_runtime_error("unit == NULL"); + throw game_runtime_error("unit == NULL"); } Vec2i newPos = unit->getTargetPos(); @@ -1191,7 +1191,7 @@ namespace Glest { if (map.getSubmerged(map.getCell(unit->getLastPos()))) { if (Thread::isCurrentThreadMainThread() == false) { - throw megaglest_runtime_error("#1 Invalid access to World random from outside main thread current id = " + + throw game_runtime_error("#1 Invalid access to World random from outside main thread current id = " + intToStr(Thread::getCurrentThreadId()) + " main = " + intToStr(Thread::getMainThreadId())); } @@ -1217,7 +1217,7 @@ namespace Glest { Unit *currUnit = NULL; if (factionIndex >= getFactionCount()) { - throw megaglest_runtime_error("factionIndex >= getFactionCount()"); + throw game_runtime_error("factionIndex >= getFactionCount()"); } for (int i = 0; i < getFaction(factionIndex)->getUnitCount(); ++i) { @@ -1235,7 +1235,7 @@ namespace Glest { bool World::toRenderUnit(const Unit *unit, const Quad2i &visibleQuad) const { if (unit == NULL) { - throw megaglest_runtime_error("unit == NULL"); + throw game_runtime_error("unit == NULL"); } //a unit is rendered if it is in a visible cell or is attacking a unit in a visible cell @@ -1244,7 +1244,7 @@ namespace Glest { bool World::toRenderUnit(const Unit *unit) const { if (unit == NULL) { - throw megaglest_runtime_error("unit == NULL"); + throw game_runtime_error("unit == NULL"); } if (showWorldForPlayer(thisFactionIndex) == true) { @@ -1261,7 +1261,7 @@ namespace Glest { bool World::toRenderUnit(const UnitBuildInfo &pendingUnit) const { if (pendingUnit.unit == NULL) { - throw megaglest_runtime_error("unit == NULL"); + throw game_runtime_error("unit == NULL"); } if (showWorldForPlayer(thisFactionIndex) == true) { @@ -1299,7 +1299,7 @@ namespace Glest { if (SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); unit->setIgnoreCheckCommand(false); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } if (cr.first == crSuccess) { @@ -1326,7 +1326,7 @@ namespace Glest { Faction* faction = factions[factionIndex]; if (faction->getIndex() != factionIndex) { - throw megaglest_runtime_error("faction->getIndex() != factionIndex", true); + throw game_runtime_error("faction->getIndex() != factionIndex", true); } const FactionType* ft = faction->getType(); @@ -1338,7 +1338,7 @@ namespace Glest { newpath = new UnitPathBasic(); break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!", true); + throw game_runtime_error("detected unsupported pathfinder type!", true); } Unit* unit = new Unit(getNextUnitId(faction), newpath, pos, ut, faction, &map, CardinalDir(CardinalDir::NORTH)); @@ -1359,12 +1359,12 @@ namespace Glest { } else { delete unit; unit = NULL; - throw megaglest_runtime_error("Unit cant be placed", true); + throw game_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), true); + throw game_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__); @@ -1376,7 +1376,7 @@ namespace Glest { const ResourceType* rt = techTree->getResourceType(resourceName); faction->incResourceAmount(rt, amount); } else { - throw megaglest_runtime_error("Invalid faction index in giveResource: " + intToStr(factionIndex), true); + throw game_runtime_error("Invalid faction index in giveResource: " + intToStr(factionIndex), true); } } @@ -1405,7 +1405,7 @@ namespace Glest { vector units; if (factionIndex < 0 || factionIndex > getFactionCount()) { - throw megaglest_runtime_error("Invalid faction index in getUnitsForFaction: " + intToStr(factionIndex), true); + throw game_runtime_error("Invalid faction index in getUnitsForFaction: " + intToStr(factionIndex), true); } Faction *faction = getFaction(factionIndex); if (faction != NULL) { @@ -1454,17 +1454,17 @@ namespace Glest { } else if (commandName == "attack") { cc = ccAttack; } else { - throw megaglest_runtime_error("Invalid position command: " + commandName, true); + throw game_runtime_error("Invalid position command: " + commandName, true); } if (unit->getType()->getFirstCtOfClass(cc) == NULL) { - throw megaglest_runtime_error("Invalid command: [" + commandName + "] for unit: [" + unit->getType()->getName(false) + "] id [" + intToStr(unit->getId()) + "]", true); + throw game_runtime_error("Invalid command: [" + 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, true); + throw game_runtime_error("Invalid unitId index in givePositionCommand: " + intToStr(unitId) + " commandName = " + commandName, true); } } @@ -1478,10 +1478,10 @@ namespace Glest { 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), true); + throw game_runtime_error("Invalid ct in giveStopCommand: " + intToStr(unitId), true); } } else { - throw megaglest_runtime_error("Invalid unitId index in giveStopCommand: " + intToStr(unitId), true); + throw game_runtime_error("Invalid unitId index in giveStopCommand: " + intToStr(unitId), true); } } @@ -1545,13 +1545,13 @@ namespace Glest { unit->giveCommand(new Command(ct, targetUnit)); 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), true); + throw game_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), true); + throw game_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), true); + throw game_runtime_error("Invalid unitId index in giveAttackCommand: " + intToStr(unitId) + " unitToAttackId = " + intToStr(unitToAttackId), true); } } @@ -1586,7 +1586,7 @@ namespace Glest { } } } else { - throw megaglest_runtime_error("Invalid unitId index in giveProductionCommand: " + intToStr(unitId) + " producedName = " + producedName, true); + throw game_runtime_error("Invalid unitId index in giveProductionCommand: " + intToStr(unitId) + " producedName = " + producedName, true); } //printf("File: %s line: %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__); } @@ -1618,7 +1618,7 @@ namespace Glest { if (SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); unit->setIgnoreCheckCommand(false); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } @@ -1628,7 +1628,7 @@ namespace Glest { } } } else { - throw megaglest_runtime_error("Invalid unitId index in giveAttackStoppedCommand: " + intToStr(unitId) + " itemName = " + itemName, true); + throw game_runtime_error("Invalid unitId index in giveAttackStoppedCommand: " + intToStr(unitId) + " itemName = " + itemName, true); } } @@ -1701,7 +1701,7 @@ namespace Glest { 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 followUnit: " + intToStr(unitId), true); + throw game_runtime_error("Invalid unitId index in followUnit: " + intToStr(unitId), true); } } @@ -1775,7 +1775,7 @@ namespace Glest { } } } else { - throw megaglest_runtime_error("Invalid unitId index in giveUpgradeCommand: " + intToStr(unitId) + " upgradeName = " + upgradeName, true); + throw game_runtime_error("Invalid unitId index in giveUpgradeCommand: " + intToStr(unitId) + " upgradeName = " + upgradeName, true); } } @@ -1786,7 +1786,7 @@ namespace Glest { const ResourceType* rt = techTree->getResourceType(resourceName); return faction->getResource(rt)->getAmount(); } else { - throw megaglest_runtime_error("Invalid faction index in giveResource: " + intToStr(factionIndex) + " resourceName = " + resourceName, true); + throw game_runtime_error("Invalid faction index in giveResource: " + intToStr(factionIndex) + " resourceName = " + resourceName, true); } } @@ -1797,14 +1797,14 @@ namespace Glest { } 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()), true); + throw game_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), true); + throw game_runtime_error("Can not find unit to get position unitId = " + intToStr(unitId), true); } return unit->getPos(); } @@ -1812,7 +1812,7 @@ namespace Glest { 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), true); + throw game_runtime_error("Can not find unit to set position unitId = " + intToStr(unitId), true); } unit->setTargetPos(pos); this->moveUnitCells(unit, false); @@ -1827,7 +1827,7 @@ namespace Glest { Vec2i surfaceCellPos = map.toSurfCoords(pos); SurfaceCell *sc = map.getSurfaceCell(surfaceCellPos); if (sc == NULL) { - throw megaglest_runtime_error("sc == NULL", true); + throw game_runtime_error("sc == NULL", true); } Vec3f vertex = sc->getVertex(); Vec2i targetPos(vertex.x, vertex.z); @@ -1858,7 +1858,7 @@ namespace Glest { Vec2i surfaceCellPos = map.toSurfCoords(pos); SurfaceCell *sc = map.getSurfaceCell(surfaceCellPos); if (sc == NULL) { - throw megaglest_runtime_error("sc == NULL", true); + throw game_runtime_error("sc == NULL", true); } Vec3f vertex = sc->getVertex(); Vec2i targetPos(vertex.x, vertex.z); @@ -1875,7 +1875,7 @@ namespace Glest { 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), true); + throw game_runtime_error("Can not find unit to set highlight unitId = " + intToStr(unitId), true); } game->highlightUnit(unitId, radius, thickness, color); } @@ -1883,7 +1883,7 @@ namespace Glest { 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), true); + throw game_runtime_error("Can not find unit to set highlight unitId = " + intToStr(unitId), true); } game->unhighlightUnit(unitId); } @@ -1892,14 +1892,14 @@ namespace Glest { 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), true); + throw game_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), true); + throw game_runtime_error("Can not find Faction unit to get position unitId = " + intToStr(unitId), true); } return unit->getFullName(game->showTranslatedTechTree()); } @@ -1917,7 +1917,7 @@ namespace Glest { } return count; } else { - throw megaglest_runtime_error("Invalid faction index in getUnitCount: " + intToStr(factionIndex), true); + throw game_runtime_error("Invalid faction index in getUnitCount: " + intToStr(factionIndex), true); } } @@ -1934,7 +1934,7 @@ namespace Glest { } return count; } else { - throw megaglest_runtime_error("Invalid faction index in getUnitCountOfType: " + intToStr(factionIndex), true); + throw game_runtime_error("Invalid faction index in getUnitCountOfType: " + intToStr(factionIndex), true); } } @@ -1952,7 +1952,7 @@ namespace Glest { SurfaceCell *sc = map.getSurfaceCell(i, j); if (sc == NULL) { - throw megaglest_runtime_error("sc == NULL"); + throw game_runtime_error("sc == NULL"); } if (sc->getObject() != NULL) { sc->getObject()->initParticles(); @@ -1997,16 +1997,16 @@ namespace Glest { SurfaceCell *sc11 = map.getSurfaceCell(i + 1, j + 1); if (sc00 == NULL) { - throw megaglest_runtime_error("sc00 == NULL"); + throw game_runtime_error("sc00 == NULL"); } if (sc10 == NULL) { - throw megaglest_runtime_error("sc10 == NULL"); + throw game_runtime_error("sc10 == NULL"); } if (sc01 == NULL) { - throw megaglest_runtime_error("sc01 == NULL"); + throw game_runtime_error("sc01 == NULL"); } if (sc11 == NULL) { - throw megaglest_runtime_error("sc11 == NULL"); + throw game_runtime_error("sc11 == NULL"); } tileset.addSurfTex(sc00->getSurfaceType(), @@ -2027,7 +2027,7 @@ namespace Glest { Logger::getInstance().add(Lang::getInstance().getString("LogScreenGameLoadingFactionTypes", ""), true); if (gs == NULL) { - throw megaglest_runtime_error("gs == NULL"); + throw game_runtime_error("gs == NULL"); } // FIXME: This was commented out while working on issue 13 @@ -2036,7 +2036,7 @@ namespace Glest { // The check may not be needed or it may need to be re-written // if(gs->getFactionCount() > map.getMaxPlayers()) { - // throw megaglest_runtime_error("This map only supports "+intToStr(map.getMaxPlayers())+" players, factionCount is " + intToStr(gs->getFactionCount())); + // throw game_runtime_error("This map only supports "+intToStr(map.getMaxPlayers())+" players, factionCount is " + intToStr(gs->getFactionCount())); // } //create stats @@ -2066,7 +2066,7 @@ namespace Glest { for (int i = 0; i < (int) factions.size(); ++i) { FactionType *ft = techTree->getTypeByName(gs->getFactionTypeName(i)); if (ft == NULL) { - throw megaglest_runtime_error("ft == NULL"); + throw game_runtime_error("ft == NULL"); } factions[i]->init(ft, gs->getFactionControl(i), techTree, game, i, gs->getTeam(i), gs->getStartLocationIndex(i), i == thisFactionIndex, @@ -2198,7 +2198,7 @@ namespace Glest { string unitName = unit->getType()->getName(false); delete unit; unit = NULL; - throw megaglest_runtime_error("Unit: " + unitName + " can't be placed, this error is caused because there\nis not enough room to put all units near their start location.\nmake a better/larger map. Faction: #" + intToStr(i) + " name: " + ft->getName(false)); + throw game_runtime_error("Unit: " + unitName + " can't be placed, this error is caused because there\nis not enough room to put all units near their start location.\nmake a better/larger map. Faction: #" + intToStr(i) + " name: " + ft->getName(false)); } if (unit->getType()->hasSkillClass(scBeBuilt)) { @@ -2230,7 +2230,7 @@ namespace Glest { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Unit: [%s] can't be placed, this error is caused because there\nis not enough room to put all units near their start location.\nmake a better/larger map. Faction: #%d name: [%s]", unitName.c_str(), unitFactionIndex, unitFactionName.c_str()); - throw megaglest_runtime_error(szBuf, false); + throw game_runtime_error(szBuf, false); } if (unit->getType()->hasSkillClass(scBeBuilt)) { map.flatternTerrain(unit); @@ -2265,7 +2265,7 @@ namespace Glest { newpath = new UnitPathBasic(); break; default: - throw megaglest_runtime_error("detected unsupported pathfinder type!"); + throw game_runtime_error("detected unsupported pathfinder type!"); } Unit *unit = new Unit(getNextUnitId(f), newpath, Vec2i(0), ut, f, &map, CardinalDir(CardinalDir::NORTH)); @@ -2285,7 +2285,7 @@ namespace Glest { //printf("Load game setting unit pos\n"); refreshAllUnitExplorations(); } - } catch (const megaglest_runtime_error &ex) { + } catch (const game_runtime_error &ex) { gotError = true; if (ex.wantStackTrace() == true) { char szErrBuf[8096] = ""; @@ -2308,7 +2308,7 @@ namespace Glest { map.computeInterpolatedHeights(); if (gotError == true) { - throw megaglest_runtime_error(sErrBuf, !skipStackTrace); + throw game_runtime_error(sErrBuf, !skipStackTrace); } if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d]\n", __FILE__, __FUNCTION__, __LINE__); } @@ -2420,7 +2420,7 @@ namespace Glest { if (map.isInsideSurface(currPos) == true) { SurfaceCell *sc = map.getSurfaceCell(currPos); if (sc == NULL) { - throw megaglest_runtime_error("sc == NULL"); + throw game_runtime_error("sc == NULL"); } //explore diff --git a/source/glest_map_editor/main.cpp b/source/glest_map_editor/main.cpp index f55ad2fdb..0273a7f0b 100644 --- a/source/glest_map_editor/main.cpp +++ b/source/glest_map_editor/main.cpp @@ -1725,7 +1725,7 @@ wxT("Help")).ShowModal(); int App::MainLoop() { try { - //throw megaglest_runtime_error("test"); + //throw game_runtime_error("test"); return wxApp::MainLoop(); } catch (const exception &e) { MsgDialog(NULL, ToUnicode(e.what()), wxT("Exception")).ShowModal(); diff --git a/source/shared_lib/include/graphics/FileReader.h b/source/shared_lib/include/graphics/FileReader.h index c1156865a..1e23a1cf4 100644 --- a/source/shared_lib/include/graphics/FileReader.h +++ b/source/shared_lib/include/graphics/FileReader.h @@ -161,7 +161,7 @@ namespace Shared { ifstream file(filepath.c_str(), ios::in | ios::binary); #endif if (!file.is_open()) { - throw megaglest_runtime_error("[#1] Could not open file " + filepath); + throw game_runtime_error("[#1] Could not open file " + filepath); } for (typename vector const *>::const_iterator i = readers->begin(); i != readers->end(); ++i) { T* ret = NULL; @@ -171,9 +171,9 @@ namespace Shared { ret = reader->read(file, filepath); //It is guaranteed that at least the filepath matches ... } #if defined(WIN32) - catch (megaglest_runtime_error) { + catch (game_runtime_error) { #else - catch (megaglest_runtime_error &ex) { + catch (game_runtime_error &ex) { #endif throw; } catch (...) { @@ -209,9 +209,9 @@ namespace Shared { if (!file.is_open()) { #if defined(WIN32) && !defined(__MINGW32__) DWORD error = GetLastError(); - throw megaglest_runtime_error("[#2] Could not open file, result: " + intToStr(error) + " - " + intToStr(fileErrno) + " [" + filepath + "]"); + throw game_runtime_error("[#2] Could not open file, result: " + intToStr(error) + " - " + intToStr(fileErrno) + " [" + filepath + "]"); #else - throw megaglest_runtime_error("[#2] Could not open file [" + filepath + "]"); + throw game_runtime_error("[#2] Could not open file [" + filepath + "]"); #endif } for (typename vector const *>::const_iterator i = readers->begin(); i != readers->end(); ++i) { @@ -222,9 +222,9 @@ namespace Shared { ret = reader->read(file, filepath, object); //It is guaranteed that at least the filepath matches ... } #if defined(WIN32) - catch (megaglest_runtime_error) { + catch (game_runtime_error) { #else - catch (megaglest_runtime_error &ex) { + catch (game_runtime_error &ex) { #endif throw; } catch (...) { @@ -263,7 +263,7 @@ namespace Shared { T* ret = readFromFileReaders(&(getFileReaders()), filepath); //Try all other if (ret == NULL) { std::cerr << "ERROR #1 - Could not parse filepath: " << filepath << std::endl; - throw megaglest_runtime_error(string("Could not parse ") + filepath + " as object of type " + typeid(T).name()); + throw game_runtime_error(string("Could not parse ") + filepath + " as object of type " + typeid(T).name()); } return ret; } @@ -288,7 +288,7 @@ namespace Shared { std::cerr << "ERROR #2 - Could not parse filepath: " << filepath << std::endl; ret = readFromFileReaders(&(getLowPriorityFileReaders()), filepath); //Try to get dummy file if (ret == NULL) { - throw megaglest_runtime_error(string("Could not parse ") + filepath + " as object of type " + typeid(T).name()); + throw game_runtime_error(string("Could not parse ") + filepath + " as object of type " + typeid(T).name()); } } return ret; @@ -348,9 +348,9 @@ namespace Shared { return ret; } #if defined(WIN32) - catch (megaglest_runtime_error) { + catch (game_runtime_error) { #else - catch (megaglest_runtime_error &ex) { + catch (game_runtime_error &ex) { #endif throw; } catch (...) { @@ -372,7 +372,7 @@ namespace Shared { ifstream file(filepath.c_str(), ios::in | ios::binary); #endif if (!file.is_open()) { - throw megaglest_runtime_error("[#3] Could not open file " + filepath); + throw game_runtime_error("[#3] Could not open file " + filepath); } T* ret = read(file, filepath); file.close(); @@ -397,7 +397,7 @@ namespace Shared { ifstream file(filepath.c_str(), ios::in | ios::binary); #endif if (!file.is_open()) { - throw megaglest_runtime_error("[#4] Could not open file " + filepath); + throw game_runtime_error("[#4] Could not open file " + filepath); } T* ret = read(file, filepath, object); file.close(); diff --git a/source/shared_lib/include/graphics/gl/opengl.h b/source/shared_lib/include/graphics/gl/opengl.h index 7298548b1..c26ed3686 100644 --- a/source/shared_lib/include/graphics/gl/opengl.h +++ b/source/shared_lib/include/graphics/gl/opengl.h @@ -73,8 +73,8 @@ namespace Shared { const char *errorString = reinterpret_cast(gluErrorString(error)); char szBuf[8096] = ""; snprintf(szBuf, 8096, "OpenGL error #%d [0x%X] : [%s] at file: [%s], line: %d", error, error, errorString, file, line); - //throw megaglest_runtime_error("OpenGL error #" + intToStr(error) + " : " + string(errorString) + " at file: " + string(file) + ", line " + intToStr(line)); - throw megaglest_runtime_error(szBuf); + //throw game_runtime_error("OpenGL error #" + intToStr(error) + " : " + string(errorString) + " at file: " + string(file) + ", line " + intToStr(line)); + throw game_runtime_error(szBuf); //} } diff --git a/source/shared_lib/include/platform/common/cache_manager.h b/source/shared_lib/include/platform/common/cache_manager.h index cf72d0d5f..072c1752b 100644 --- a/source/shared_lib/include/platform/common/cache_manager.h +++ b/source/shared_lib/include/platform/common/cache_manager.h @@ -80,7 +80,7 @@ namespace Shared { } safeMutex.ReleaseLock(); } catch (const std::exception &ex) { - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } } @@ -91,7 +91,7 @@ namespace Shared { itemCache[cacheKey] = *value; safeMutex.ReleaseLock(); } catch (const std::exception &ex) { - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } } } diff --git a/source/shared_lib/include/platform/sdl/platform_main.h b/source/shared_lib/include/platform/sdl/platform_main.h index fdd894ef1..df3ca8c64 100644 --- a/source/shared_lib/include/platform/sdl/platform_main.h +++ b/source/shared_lib/include/platform/sdl/platform_main.h @@ -579,7 +579,7 @@ int mainSetup(int argc, char **argv) { if (knownArgCount != GAME_ARG_END) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Internal arg count mismatch knownArgCount = %d, GAME_ARG_END = %d", knownArgCount, GAME_ARG_END); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } SystemFlags::VERBOSE_MODE_ENABLED = false; @@ -649,7 +649,7 @@ int mainSetup(int argc, char **argv) { has_SSE4a == false) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error detected, your CPU does not seem to support SSE: [%d]\n", has_SSE); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } #elif defined (__GNUC__) && !defined(__APPLE__) @@ -670,7 +670,7 @@ int mainSetup(int argc, char **argv) { if (!CHECK_BIT(dx, 25) && !CHECK_BIT(dx, 26) && !CHECK_BIT(cx, 0)) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error detected, your CPU does not seem to support SSE: [%d]\n", CHECK_BIT(dx, 25)); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } #endif diff --git a/source/shared_lib/include/platform/sdl/platform_util.h b/source/shared_lib/include/platform/sdl/platform_util.h index 2b513cdd3..b46c342e4 100644 --- a/source/shared_lib/include/platform/sdl/platform_util.h +++ b/source/shared_lib/include/platform/sdl/platform_util.h @@ -37,11 +37,11 @@ using std::exception; namespace Shared { namespace Platform { -class megaglest_runtime_error : public runtime_error { +class game_runtime_error : public runtime_error { protected: bool noStackTrace; public: - megaglest_runtime_error(const string& __arg,bool noStackTrace=false); + game_runtime_error(const string& __arg,bool noStackTrace=false); bool wantStackTrace() const { return !noStackTrace; } }; diff --git a/source/shared_lib/include/util/factory.h b/source/shared_lib/include/util/factory.h index 46881ed87..b4b8abc9f 100644 --- a/source/shared_lib/include/util/factory.h +++ b/source/shared_lib/include/util/factory.h @@ -86,7 +86,7 @@ namespace Shared { T *newInstance(string classId) { Factories::iterator it = factories.find(classId); if (it == factories.end()) { - throw megaglest_runtime_error("Unknown class identifier: " + classId); + throw game_runtime_error("Unknown class identifier: " + classId); } return static_cast(it->second->newInstance()); } diff --git a/source/shared_lib/sources/compression/compression_utils.cpp b/source/shared_lib/sources/compression/compression_utils.cpp index 681d2230d..d00440f81 100644 --- a/source/shared_lib/sources/compression/compression_utils.cpp +++ b/source/shared_lib/sources/compression/compression_utils.cpp @@ -356,7 +356,7 @@ namespace Shared { int result = compress2(compressed_buffer, &compressed_buffer_len, decompressed_buffer, input_len, compressionLevel); if (result != Z_OK) { string msg = string("Invalid compress2 return value: ") + intToStr(result); - throw megaglest_runtime_error(msg.c_str()); + throw game_runtime_error(msg.c_str()); } //printf("compress2 returned: %d start size: %lu end size: %lu\n",result,input_len,compressed_buffer_len); @@ -380,7 +380,7 @@ namespace Shared { int result = uncompress(decompressed_buffer, &decompressed_buffer_len, compressed_buffer, input_len); if (result != Z_OK) { string msg = string("Invalid uncompress return value: ") + intToStr(result); - throw megaglest_runtime_error(msg.c_str()); + throw game_runtime_error(msg.c_str()); } //printf("uncompress returned: %d start size: %lu end size: %lu\n",result,input_len,decompressed_buffer_len); delete[] compressed_buffer; diff --git a/source/shared_lib/sources/graphics/BMPReader.cpp b/source/shared_lib/sources/graphics/BMPReader.cpp index b9567b8cf..5ed104e24 100644 --- a/source/shared_lib/sources/graphics/BMPReader.cpp +++ b/source/shared_lib/sources/graphics/BMPReader.cpp @@ -85,7 +85,7 @@ namespace Shared { *@return NULL if the Pixmap2D could not be read, else the pixmap*/ Pixmap2D* BMPReader::read(ifstream& in, const string& path, Pixmap2D* ret) const { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } //read file header @@ -102,7 +102,7 @@ namespace Shared { } if (fileHeader.type1 != 'B' || fileHeader.type2 != 'M') { - throw megaglest_runtime_error(path + " is not a bitmap", true); + throw game_runtime_error(path + " is not a bitmap", true); } //read info header @@ -123,7 +123,7 @@ namespace Shared { } if (infoHeader.bitCount != 24) { - throw megaglest_runtime_error(path + " is not a 24 bit bitmap", true); + throw game_runtime_error(path + " is not a 24 bit bitmap", true); } int h = infoHeader.height; diff --git a/source/shared_lib/sources/graphics/JPGReader.cpp b/source/shared_lib/sources/graphics/JPGReader.cpp index 286f8f1c2..a042378c2 100644 --- a/source/shared_lib/sources/graphics/JPGReader.cpp +++ b/source/shared_lib/sources/graphics/JPGReader.cpp @@ -81,7 +81,7 @@ namespace Shared { Pixmap2D* JPGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } //Read file @@ -98,7 +98,7 @@ namespace Shared { Shared::PlatformByteOrder::fromEndianTypeArray(buffer, (size_t) length); } if (length < 2) { - throw megaglest_runtime_error("length < 2", true); + throw game_runtime_error("length < 2", true); } //Check buffer (weak jpeg check) //if (buffer[0] != 0x46 || buffer[1] != 0xA0) { @@ -106,7 +106,7 @@ namespace Shared { if (buffer[0] != 0xFF || buffer[1] != 0xD8) { std::cout << "0 = [" << std::hex << (int) buffer[0] << "] 1 = [" << std::hex << (int) buffer[1] << "]" << std::endl; delete[] buffer; - throw megaglest_runtime_error(path + " is not a jpeg", true); + throw game_runtime_error(path + " is not a jpeg", true); } struct jpeg_decompress_struct cinfo; @@ -130,7 +130,7 @@ namespace Shared { if (row_pointer[0] != NULL) { delete[] row_pointer[0]; } - throw megaglest_runtime_error(path + " is a corrupt(1) jpeg", true); + throw game_runtime_error(path + " is a corrupt(1) jpeg", true); } source.init_source = init_source; @@ -143,7 +143,7 @@ namespace Shared { if (jpeg_read_header(&cinfo, TRUE) != JPEG_HEADER_OK) { delete[] buffer; jpeg_destroy_decompress(&cinfo); - throw megaglest_runtime_error(path + " is a corrupt(1) jpeg", true); + throw game_runtime_error(path + " is a corrupt(1) jpeg", true); } diff --git a/source/shared_lib/sources/graphics/PNGReader.cpp b/source/shared_lib/sources/graphics/PNGReader.cpp index 344ab89f0..ee3985dcd 100644 --- a/source/shared_lib/sources/graphics/PNGReader.cpp +++ b/source/shared_lib/sources/graphics/PNGReader.cpp @@ -74,7 +74,7 @@ namespace Shared { Pixmap2D* PNGReader::read(ifstream& is, const string& path, Pixmap2D* ret) const { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } //Read file @@ -91,25 +91,25 @@ namespace Shared { if (png_sig_cmp(buffer, 0, 8) != 0) { delete[] buffer; //This is not a PNG file - could be used for fast checking whether file is supported or not - throw megaglest_runtime_error(path + " is not a png", true); + throw game_runtime_error(path + " is not a png", true); } png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (!png_ptr) { delete[] buffer; - throw megaglest_runtime_error(path + " is a corrupt(1) png", true); + throw game_runtime_error(path + " is a corrupt(1) png", true); } png_infop info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { png_destroy_read_struct(&png_ptr, (png_infopp) NULL, (png_infopp) NULL); delete[] buffer; - throw megaglest_runtime_error(path + " is a corrupt(2) png", true); + throw game_runtime_error(path + " is a corrupt(2) png", true); } if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL); delete[] buffer; //Error during init_io - throw megaglest_runtime_error(path + " is a corrupt(3) png", true); + throw game_runtime_error(path + " is a corrupt(3) png", true); } png_set_read_fn(png_ptr, &is, user_read_data); png_set_sig_bytes(png_ptr, 8); @@ -141,7 +141,7 @@ namespace Shared { delete[] row_pointers; delete[] buffer; //error during read_image - throw megaglest_runtime_error(path + " is a corrupt(4) png", true); + throw game_runtime_error(path + " is a corrupt(4) png", true); } for (int y = 0; y < height; ++y) { row_pointers[y] = new png_byte[png_get_rowbytes(png_ptr, info_ptr)]; @@ -240,25 +240,25 @@ namespace Shared { if (png_sig_cmp(buffer, 0, 8) != 0) { delete[] buffer; //This is not a PNG file - could be used for fast checking whether file is supported or not - throw megaglest_runtime_error(path + " is not a png(2)", true); + throw game_runtime_error(path + " is not a png(2)", true); } png_structp png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); if (!png_ptr) { delete[] buffer; - throw megaglest_runtime_error(path + " is a corrupt(5) png", true); + throw game_runtime_error(path + " is a corrupt(5) png", true); } png_infop info_ptr = png_create_info_struct(png_ptr); if (!info_ptr) { png_destroy_read_struct(&png_ptr, (png_infopp) NULL, (png_infopp) NULL); delete[] buffer; - throw megaglest_runtime_error(path + " is a corrupt(6) png", true); + throw game_runtime_error(path + " is a corrupt(6) png", true); } if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_read_struct(&png_ptr, &info_ptr, (png_infopp) NULL); delete[] buffer; //Error during init_io - throw megaglest_runtime_error(path + " is a corrupt(7) png", true); + throw game_runtime_error(path + " is a corrupt(7) png", true); } png_set_read_fn(png_ptr, &is, user_read_data); png_set_sig_bytes(png_ptr, 8); @@ -289,7 +289,7 @@ namespace Shared { delete[] row_pointers; delete[] buffer; //error during read_image - throw megaglest_runtime_error(path + " is a corrupt(8) png", true); + throw game_runtime_error(path + " is a corrupt(8) png", true); } for (int y = 0; y < height; ++y) { row_pointers[y] = new png_byte[png_get_rowbytes(png_ptr, info_ptr)]; diff --git a/source/shared_lib/sources/graphics/TGAReader.cpp b/source/shared_lib/sources/graphics/TGAReader.cpp index db0ec72e6..7db2d2736 100644 --- a/source/shared_lib/sources/graphics/TGAReader.cpp +++ b/source/shared_lib/sources/graphics/TGAReader.cpp @@ -79,7 +79,7 @@ namespace Shared { //printf("In [%s] line: %d\n",__FILE__,__LINE__); // try { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } //read header @@ -100,21 +100,21 @@ namespace Shared { } if (!in.good()) { - throw megaglest_runtime_error(path + " could not be read", true); + throw game_runtime_error(path + " could not be read", true); } //check that we can load this tga file if (fileHeader.idLength != 0) { - throw megaglest_runtime_error(path + ": id field is not 0", true); + throw game_runtime_error(path + ": id field is not 0", true); } if (fileHeader.dataTypeCode != tgaUncompressedRgb && fileHeader.dataTypeCode != tgaUncompressedBw) { - throw megaglest_runtime_error(path + ": only uncompressed BW and RGB targa images are supported", true); + throw game_runtime_error(path + ": only uncompressed BW and RGB targa images are supported", true); } //check bits per pixel if (fileHeader.bitsPerPixel != 8 && fileHeader.bitsPerPixel != 24 && fileHeader.bitsPerPixel != 32) { - throw megaglest_runtime_error(path + ": only 8, 24 and 32 bit targa images are supported", true); + throw game_runtime_error(path + ": only 8, 24 and 32 bit targa images are supported", true); } const int h = fileHeader.height; @@ -212,7 +212,7 @@ namespace Shared { // catch(exception& ex) { // char szBuf[8096]=""; // snprintf(szBuf,8096,"Error in [%s] on line: %d msg: %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__,ex.what()); - // throw megaglest_runtime_error(szBuf); + // throw game_runtime_error(szBuf); // } return ret; @@ -243,21 +243,21 @@ namespace Shared { } if (!in.good()) { - throw megaglest_runtime_error(path + " could not be read", true); + throw game_runtime_error(path + " could not be read", true); } //check that we can load this tga file if (fileHeader.idLength != 0) { - throw megaglest_runtime_error(path + ": id field is not 0", true); + throw game_runtime_error(path + ": id field is not 0", true); } if (fileHeader.dataTypeCode != tgaUncompressedRgb && fileHeader.dataTypeCode != tgaUncompressedBw) { - throw megaglest_runtime_error(path + ": only uncompressed BW and RGB targa images are supported", true); + throw game_runtime_error(path + ": only uncompressed BW and RGB targa images are supported", true); } //check bits per pixel if (fileHeader.bitsPerPixel != 8 && fileHeader.bitsPerPixel != 24 && fileHeader.bitsPerPixel != 32) { - throw megaglest_runtime_error(path + ": only 8, 24 and 32 bit targa images are supported", true); + throw game_runtime_error(path + ": only 8, 24 and 32 bit targa images are supported", true); } const int h = fileHeader.height; @@ -372,7 +372,7 @@ namespace Shared { // //abort(); // char szBuf[8096]=""; // snprintf(szBuf,8096,"Error in [%s] on line: %d msg: %s\n",extractFileFromDirectoryPath(__FILE__).c_str(),__LINE__,ex.what()); - // throw megaglest_runtime_error(szBuf); + // throw game_runtime_error(szBuf); // } //printf("In [%s] line: %d\n",__FILE__,__LINE__); diff --git a/source/shared_lib/sources/graphics/font.cpp b/source/shared_lib/sources/graphics/font.cpp index 37e331b75..d89eefc42 100644 --- a/source/shared_lib/sources/graphics/font.cpp +++ b/source/shared_lib/sources/graphics/font.cpp @@ -156,7 +156,7 @@ namespace Shared { for (unsigned int i = 0; i < longestLine.size() && (int) i < Font::charCount; ++i) { if (longestLine[i] >= Font::charCount) { string sError = "str[i] >= Font::charCount, [" + longestLine + "] i = " + uIntToStr(i); - throw megaglest_runtime_error(sError); + throw game_runtime_error(sError); } //Treat 2 byte characters as spaces if (longestLine[i] < 0) { @@ -213,7 +213,7 @@ namespace Shared { Font::Font(FontTextHandlerType type) { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } inited = false; diff --git a/source/shared_lib/sources/graphics/font_manager.cpp b/source/shared_lib/sources/graphics/font_manager.cpp index bda16d470..59ac739ce 100644 --- a/source/shared_lib/sources/graphics/font_manager.cpp +++ b/source/shared_lib/sources/graphics/font_manager.cpp @@ -37,7 +37,7 @@ namespace Shared { // ===================================================== FontManager::FontManager() { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } fonts.clear(); } diff --git a/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp b/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp index a643c821c..bac1d4595 100644 --- a/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp +++ b/source/shared_lib/sources/graphics/gl/font_textFTGL.cpp @@ -46,7 +46,7 @@ namespace Shared { //==================================================================== TextFTGL::TextFTGL(FontTextHandlerType type) : Text(type) { - //throw megaglest_runtime_error("FTGL!"); + //throw game_runtime_error("FTGL!"); //setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/wqy/wqy-zenhei.ttc",0); //setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/arphic/uming.ttc",0); // Chinese //setenv("MEGAGLEST_FONT","/usr/share/fonts/truetype/arphic/ukai.ttc",0); // Chinese @@ -74,7 +74,7 @@ namespace Shared { ftFont = new FTGLTextureFont(fontFile); if (SystemFlags::VERBOSE_MODE_ENABLED) printf("3D font [%s]\n", fontFile); } else { - throw megaglest_runtime_error("font render type not set to a known value!"); + throw game_runtime_error("font render type not set to a known value!"); } if (ftFont->Error()) { @@ -83,7 +83,7 @@ namespace Shared { delete ftFont; ftFont = NULL; if (fontFile != NULL) free((void*) fontFile); fontFile = NULL; - throw megaglest_runtime_error(string("FTGL: error loading font: ") + fontFileName); + throw game_runtime_error(string("FTGL: error loading font: ") + fontFileName); } free((void*) fontFile); fontFile = NULL; @@ -100,19 +100,19 @@ namespace Shared { if (ftFont->Error()) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "FTGL: error setting face size, #%d", ftFont->Error()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } //ftFont->UseDisplayList(false); //ftFont->CharMap(ft_encoding_gb2312); //ftFont->CharMap(ft_encoding_big5); if (ftFont->CharMap(ft_encoding_unicode) == false) { - throw megaglest_runtime_error("FTGL: error setting encoding"); + throw game_runtime_error("FTGL: error setting encoding"); } if (ftFont->Error()) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "FTGL: error setting encoding, #%d", ftFont->Error()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -152,7 +152,7 @@ namespace Shared { //printf("3D font [%s]\n",fontFile); } else { - throw megaglest_runtime_error("font render type not set to a known value!"); + throw game_runtime_error("font render type not set to a known value!"); } if (ftFont->Error()) { @@ -162,7 +162,7 @@ namespace Shared { free((void*) fontFile); } fontFile = NULL; - throw megaglest_runtime_error("FTGL: error loading font"); + throw game_runtime_error("FTGL: error loading font"); } free((void*) fontFile); fontFile = NULL; @@ -181,19 +181,19 @@ namespace Shared { if (ftFont->Error()) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "FTGL: error setting face size, #%d", ftFont->Error()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } //ftFont->UseDisplayList(false); //ftFont->CharMap(ft_encoding_gb2312); //ftFont->CharMap(ft_encoding_big5); if (ftFont->CharMap(ft_encoding_unicode) == false) { - throw megaglest_runtime_error("FTGL: error setting encoding"); + throw game_runtime_error("FTGL: error setting encoding"); } if (ftFont->Error()) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "FTGL: error setting encoding, #%d", ftFont->Error()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } // Create a string containing common characters @@ -210,7 +210,7 @@ namespace Shared { if (ftFont->Error()) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "FTGL: error advancing(a), #%d", ftFont->Error()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -226,7 +226,7 @@ namespace Shared { if (ftFont->Error()) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "FTGL: error setting face size, #%d", ftFont->Error()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -256,7 +256,7 @@ namespace Shared { if (ftFont->Error()) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "FTGL: error trying to render, #%d", ftFont->Error()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } } @@ -273,7 +273,7 @@ namespace Shared { if (ftFont->Error()) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "FTGL: error trying to advance(b), #%d", ftFont->Error()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return result; @@ -358,7 +358,7 @@ namespace Shared { if (ftFont->Error()) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "FTGL: error trying to get lineheight, #%d", ftFont->Error()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return result; @@ -403,7 +403,7 @@ namespace Shared { if (ftFont->Error()) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "FTGL: error trying to get lineheight, #%d", ftFont->Error()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return result; @@ -420,7 +420,7 @@ namespace Shared { if (ftFont->Error()) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "FTGL: error trying to render, #%d", ftFont->Error()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } } @@ -430,7 +430,7 @@ namespace Shared { if (ftFont->Error()) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "FTGL: error trying to advance(c), #%d", ftFont->Error()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return result; diff --git a/source/shared_lib/sources/graphics/gl/model_renderer_gl.cpp b/source/shared_lib/sources/graphics/gl/model_renderer_gl.cpp index 51fb5b0fc..5504fdf2d 100644 --- a/source/shared_lib/sources/graphics/gl/model_renderer_gl.cpp +++ b/source/shared_lib/sources/graphics/gl/model_renderer_gl.cpp @@ -309,7 +309,7 @@ namespace Shared { if (texture != NULL && renderTextures) { if (lastTexture != texture->getHandle()) { //assert(glIsTexture(texture->getHandle())); - //throw megaglest_runtime_error("glIsTexture(texture->getHandle()) == false for texture: " + texture->getPath()); + //throw game_runtime_error("glIsTexture(texture->getHandle()) == false for texture: " + texture->getPath()); if (glIsTexture(texture->getHandle()) == GL_TRUE) { glBindTexture(GL_TEXTURE_2D, texture->getHandle()); lastTexture = texture->getHandle(); diff --git a/source/shared_lib/sources/graphics/gl/opengl.cpp b/source/shared_lib/sources/graphics/gl/opengl.cpp index eea573257..560bf732b 100644 --- a/source/shared_lib/sources/graphics/gl/opengl.cpp +++ b/source/shared_lib/sources/graphics/gl/opengl.cpp @@ -179,7 +179,7 @@ namespace Shared { //void checkGlExtension(const char *extensionName) { // if(!isGlExtensionSupported(extensionName)){ - // throw megaglest_runtime_error("OpenGL extension not supported: " + string(extensionName)); + // throw game_runtime_error("OpenGL extension not supported: " + string(extensionName)); // } //} diff --git a/source/shared_lib/sources/graphics/gl/shader_gl.cpp b/source/shared_lib/sources/graphics/gl/shader_gl.cpp index 6fd1ede83..01fd78fec 100644 --- a/source/shared_lib/sources/graphics/gl/shader_gl.cpp +++ b/source/shared_lib/sources/graphics/gl/shader_gl.cpp @@ -175,7 +175,7 @@ namespace Shared { GLint ShaderProgramGl::getLocation(const string &name) { GLint location = glGetUniformLocationARB(handle, name.c_str()); if (location == -1) { - throw megaglest_runtime_error("Can't locate uniform: " + name); + throw game_runtime_error("Can't locate uniform: " + name); } return location; } diff --git a/source/shared_lib/sources/graphics/gl/texture_gl.cpp b/source/shared_lib/sources/graphics/gl/texture_gl.cpp index d9000e9fb..516807b14 100644 --- a/source/shared_lib/sources/graphics/gl/texture_gl.cpp +++ b/source/shared_lib/sources/graphics/gl/texture_gl.cpp @@ -495,7 +495,7 @@ namespace Shared { void TextureGl::setup_FBO_RBO() { if (getTextureWidth() < 0 || getTextureHeight() < 0) { - throw megaglest_runtime_error("getTextureWidth() < 0 || getTextureHeight() < 0"); + throw game_runtime_error("getTextureWidth() < 0 || getTextureHeight() < 0"); } // Need some work to get extensions properly working in Windows (use Glew lib) @@ -698,11 +698,11 @@ namespace Shared { // if (error != 0) { - //throw megaglest_runtime_error("Error building texture 1D mipmaps"); + //throw game_runtime_error("Error building texture 1D mipmaps"); const char *errorString = reinterpret_cast(gluErrorString(error)); char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error building texture 1D mipmaps, returned: %d [%s] for [%s] w = %d, glCompressionFormat = %d", error, errorString, pixmap.getPath().c_str(), pixmap.getW(), glCompressionFormat); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } else { //build single texture @@ -730,11 +730,11 @@ namespace Shared { // if (error != GL_NO_ERROR) { - //throw megaglest_runtime_error("Error creating texture 1D"); + //throw game_runtime_error("Error creating texture 1D"); const char *errorString = reinterpret_cast(gluErrorString(error)); char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error creating texture 1D, returned: %d [%s] (%X) [%s] w = %d, glCompressionFormat = %d", error, errorString, error, pixmap.getPath().c_str(), pixmap.getW(), glCompressionFormat); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } inited = true; @@ -869,11 +869,11 @@ namespace Shared { // if (error != GL_NO_ERROR) { - //throw megaglest_runtime_error("Error building texture 2D mipmaps"); + //throw game_runtime_error("Error building texture 2D mipmaps"); const char *errorString = reinterpret_cast(gluErrorString(error)); char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error building texture 2D mipmaps [%s], returned: %d [%s] for [%s] w = %d, h = %d, glCompressionFormat = %d", this->path.c_str(), error, errorString, (pixmap.getPath() != "" ? pixmap.getPath().c_str() : this->path.c_str()), pixmap.getW(), pixmap.getH(), glCompressionFormat); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } else { //build single texture @@ -933,13 +933,13 @@ namespace Shared { // - //throw megaglest_runtime_error("TEST!"); + //throw game_runtime_error("TEST!"); if (error != GL_NO_ERROR) { const char *errorString = reinterpret_cast(gluErrorString(error)); char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error creating texture 2D path [%s], returned: %d [%s] (%X) [%s] w = %d, h = %d, glInternalFormat = %d, glFormat = %d, glCompressionFormat = %d", this->path.c_str(), error, errorString, error, pixmap.getPath().c_str(), pixmap.getW(), pixmap.getH(), glInternalFormat, glFormat, glCompressionFormat); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } inited = true; @@ -1045,11 +1045,11 @@ namespace Shared { // if (error != GL_NO_ERROR) { - //throw megaglest_runtime_error("Error creating texture 3D"); + //throw game_runtime_error("Error creating texture 3D"); const char *errorString = reinterpret_cast(gluErrorString(error)); char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error creating texture 3D, returned: %d [%s] (%X) [%s] w = %d, h = %d, d = %d, glCompressionFormat = %d", error, errorString, error, pixmap.getPath().c_str(), pixmap.getW(), pixmap.getH(), pixmap.getD(), glCompressionFormat); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } inited = true; @@ -1186,11 +1186,11 @@ namespace Shared { // if (error != GL_NO_ERROR) { - //throw megaglest_runtime_error("Error building texture cube mipmaps"); + //throw game_runtime_error("Error building texture cube mipmaps"); const char *errorString = reinterpret_cast(gluErrorString(error)); char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error building texture cube mipmaps, returned: %d [%s] for [%s] w = %d, h = %d, glCompressionFormat = %d", error, errorString, currentPixmap->getPath().c_str(), currentPixmap->getW(), currentPixmap->getH(), glCompressionFormat); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } else { @@ -1237,11 +1237,11 @@ namespace Shared { // if (error != GL_NO_ERROR) { - //throw megaglest_runtime_error("Error creating texture cube"); + //throw game_runtime_error("Error creating texture cube"); const char *errorString = reinterpret_cast(gluErrorString(error)); char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error creating texture cube, returned: %d [%s] (%X) [%s] w = %d, h = %d, glCompressionFormat = %d", error, errorString, error, currentPixmap->getPath().c_str(), currentPixmap->getW(), currentPixmap->getH(), glCompressionFormat); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } diff --git a/source/shared_lib/sources/graphics/interpolation.cpp b/source/shared_lib/sources/graphics/interpolation.cpp index 685ee908f..c49d8d142 100644 --- a/source/shared_lib/sources/graphics/interpolation.cpp +++ b/source/shared_lib/sources/graphics/interpolation.cpp @@ -43,7 +43,7 @@ namespace Shared { InterpolationData::InterpolationData(const Mesh *mesh) { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } vertices = NULL; @@ -81,7 +81,7 @@ namespace Shared { } //assert(t>=0.0f && t<=1.0f); if (t < 0.0f || t > 1.0f) { - throw megaglest_runtime_error("t < 0.0f || t > 1.0f t = [" + floatToStr(t, 16) + "]"); + throw game_runtime_error("t < 0.0f || t > 1.0f t = [" + floatToStr(t, 16) + "]"); assert(t >= 0.f && t <= 1.f); } diff --git a/source/shared_lib/sources/graphics/model.cpp b/source/shared_lib/sources/graphics/model.cpp index 444e4e23c..05bdb58e2 100644 --- a/source/shared_lib/sources/graphics/model.cpp +++ b/source/shared_lib/sources/graphics/model.cpp @@ -256,28 +256,28 @@ namespace Shared { } catch (bad_alloc& ba) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error on line: %d size: %d msg: %s\n", __LINE__, (frameCount*vertexCount), ba.what()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } try { normals = new Vec3f[frameCount*vertexCount]; } catch (bad_alloc& ba) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error on line: %d size: %d msg: %s\n", __LINE__, (frameCount*vertexCount), ba.what()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } try { texCoords = new Vec2f[vertexCount]; } catch (bad_alloc& ba) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error on line: %d size: %d msg: %s\n", __LINE__, vertexCount, ba.what()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } try { indices = new uint32[indexCount]; } catch (bad_alloc& ba) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error on line: %d size: %d msg: %s\n", __LINE__, indexCount, ba.what()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -422,20 +422,20 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } fromEndianMeshHeaderV2(meshHeader); if (meshHeader.normalFrameCount != meshHeader.vertexFrameCount) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Old v2 model: vertex frame count different from normal frame count [v = %d, n = %d] meshIndex = %d modelFile [%s]", meshHeader.vertexFrameCount, meshHeader.normalFrameCount, meshIndex, modelFile.c_str()); - throw megaglest_runtime_error(szBuf, true); + throw game_runtime_error(szBuf, true); } if (meshHeader.texCoordFrameCount != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Old v2 model: texture coord frame count is not 1 [t = %d] meshIndex = %d modelFile [%s]", meshHeader.texCoordFrameCount, meshIndex, modelFile.c_str()); - throw megaglest_runtime_error(szBuf, true); + throw game_runtime_error(szBuf, true); } //init @@ -502,7 +502,7 @@ namespace Shared { if (readBytes != 1 && (frameCount * vertexCount) != 0) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.", readBytes, frameCount, vertexCount, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } fromEndianVecArray(vertices, frameCount*vertexCount); @@ -510,7 +510,7 @@ namespace Shared { if (readBytes != 1 && (frameCount * vertexCount) != 0) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.", readBytes, frameCount, vertexCount, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } fromEndianVecArray(normals, frameCount*vertexCount); @@ -519,7 +519,7 @@ namespace Shared { if (readBytes != 1 && vertexCount != 0) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.", readBytes, frameCount, vertexCount, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } fromEndianVecArray(texCoords, vertexCount); } @@ -527,7 +527,7 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } fromEndianVecArray(&diffuseColor, 1); @@ -535,7 +535,7 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } opacity = Shared::PlatformByteOrder::fromCommonEndian(opacity); @@ -543,13 +543,13 @@ namespace Shared { if (seek_result != 0) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fseek returned failure = %d [%u] on line: %d.", seek_result, indexCount, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } readBytes = fread(indices, sizeof(uint32)*indexCount, 1, f); if (readBytes != 1 && indexCount != 0) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u] on line: %d.", readBytes, indexCount, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } Shared::PlatformByteOrder::fromEndianTypeArray(indices, indexCount); } @@ -566,14 +566,14 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } fromEndianMeshHeaderV3(meshHeader); if (meshHeader.normalFrameCount != meshHeader.vertexFrameCount) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Old v3 model: vertex frame count different from normal frame count [v = %d, n = %d] meshIndex = %d modelFile [%s]", meshHeader.vertexFrameCount, meshHeader.normalFrameCount, meshIndex, modelFile.c_str()); - throw megaglest_runtime_error(szBuf, true); + throw game_runtime_error(szBuf, true); } //init @@ -643,7 +643,7 @@ namespace Shared { if (readBytes != 1 && (frameCount * vertexCount) != 0) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.", readBytes, frameCount, vertexCount, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } fromEndianVecArray(vertices, frameCount*vertexCount); @@ -651,7 +651,7 @@ namespace Shared { if (readBytes != 1 && (frameCount * vertexCount) != 0) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.", readBytes, frameCount, vertexCount, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } fromEndianVecArray(normals, frameCount*vertexCount); @@ -661,7 +661,7 @@ namespace Shared { if (readBytes != 1 && vertexCount != 0) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.", readBytes, frameCount, vertexCount, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } fromEndianVecArray(texCoords, vertexCount); } @@ -670,7 +670,7 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } fromEndianVecArray(&diffuseColor, 1); @@ -678,7 +678,7 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } opacity = Shared::PlatformByteOrder::fromCommonEndian(opacity); @@ -686,14 +686,14 @@ namespace Shared { if (seek_result != 0) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fseek returned failure = %d [%u] on line: %d.", seek_result, indexCount, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } readBytes = fread(indices, sizeof(uint32)*indexCount, 1, f); if (readBytes != 1 && indexCount != 0) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u] on line: %d.", readBytes, indexCount, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } Shared::PlatformByteOrder::fromEndianTypeArray(indices, indexCount); } @@ -761,7 +761,7 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } fromEndianMeshHeader(meshHeader); @@ -808,7 +808,7 @@ namespace Shared { if (readBytes != 1 && mapPathSize != 0) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u] on line: %d.", readBytes, mapPathSize, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } Shared::PlatformByteOrder::fromEndianTypeArray(cMapPath, mapPathSize); @@ -837,7 +837,7 @@ namespace Shared { if (readBytes != 1 && (frameCount * vertexCount) != 0) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.", readBytes, frameCount, vertexCount, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } fromEndianVecArray(vertices, frameCount*vertexCount); @@ -845,7 +845,7 @@ namespace Shared { if (readBytes != 1 && (frameCount * vertexCount) != 0) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.", readBytes, frameCount, vertexCount, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } fromEndianVecArray(normals, frameCount*vertexCount); @@ -854,7 +854,7 @@ namespace Shared { if (readBytes != 1 && vertexCount != 0) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u][%u] on line: %d.", readBytes, frameCount, vertexCount, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } fromEndianVecArray(texCoords, vertexCount); } @@ -862,7 +862,7 @@ namespace Shared { if (readBytes != 1 && indexCount != 0) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u] on line: %d.", readBytes, indexCount, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } Shared::PlatformByteOrder::fromEndianTypeArray(indices, indexCount); @@ -972,7 +972,7 @@ namespace Shared { textureDeleteList[file] = textureDeleteList[file] + 1; } } else { - throw megaglest_runtime_error("Unsupported texture format: [" + convertTextureToFormat + "]"); + throw game_runtime_error("Unsupported texture format: [" + convertTextureToFormat + "]"); } //textureManager->endTexture(texture); @@ -992,9 +992,9 @@ namespace Shared { file = extractFileFromDirectoryPath(texture->getPath()); if (file.length() > mapPathSize) { - throw megaglest_runtime_error("file.length() > mapPathSize, file.length() = " + intToStr(file.length())); + throw game_runtime_error("file.length() > mapPathSize, file.length() = " + intToStr(file.length())); } else if (file.length() == 0) { - throw megaglest_runtime_error("file.length() == 0"); + throw game_runtime_error("file.length() == 0"); } if (SystemFlags::VERBOSE_MODE_ENABLED) printf("Save, new texture file [%s]\n", file.c_str()); @@ -1024,7 +1024,7 @@ namespace Shared { } catch (bad_alloc& ba) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error on line: %d size: %d msg: %s\n", __LINE__, vertexCount, ba.what()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } for (unsigned int i = 0; i < vertexCount; ++i) { @@ -1076,7 +1076,7 @@ namespace Shared { Model::Model() { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } meshCount = 0; @@ -1156,7 +1156,7 @@ namespace Shared { if (extension == "g3d") { loadG3d(path, deletePixMapAfterLoad, loadedFileList, this->sourceLoader); } else { - throw megaglest_runtime_error("#1 Unknown model format [" + extension + "] file [" + path + "]"); + throw game_runtime_error("#1 Unknown model format [" + extension + "] file [" + path + "]"); } } @@ -1166,7 +1166,7 @@ namespace Shared { if (toLower(extension) == "g3d") { saveG3d(path, convertTextureToFormat, keepsmallest); } else { - throw megaglest_runtime_error("#2 Unknown model format [" + extension + "] file [" + path + "]"); + throw game_runtime_error("#2 Unknown model format [" + extension + "] file [" + path + "]"); } } @@ -1183,7 +1183,7 @@ namespace Shared { #endif if (f == NULL) { printf("In [%s::%s] cannot load file = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, path.c_str()); - throw megaglest_runtime_error("Error opening g3d model file [" + path + "]", true); + throw game_runtime_error("Error opening g3d model file [" + path + "]", true); } if (loadedFileList) { @@ -1199,7 +1199,7 @@ namespace Shared { fclose(f); char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } fromEndianFileHeader(fileHeader); @@ -1211,7 +1211,7 @@ namespace Shared { fclose(f); f = NULL; printf("In [%s::%s] file = [%s] fileheader.id = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, path.c_str(), fileId); - throw megaglest_runtime_error("Not a valid G3D model", true); + throw game_runtime_error("Not a valid G3D model", true); } fileVersion = fileHeader.version; @@ -1225,7 +1225,7 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } fromEndianModelHeader(modelHeader); @@ -1234,7 +1234,7 @@ namespace Shared { if (SystemFlags::VERBOSE_MODE_ENABLED) printf("meshCount = %d\n", meshCount); if (modelHeader.type != mtMorphMesh) { - throw megaglest_runtime_error("Invalid model type"); + throw game_runtime_error("Invalid model type"); } //load meshes @@ -1243,7 +1243,7 @@ namespace Shared { } catch (bad_alloc& ba) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error on line: %d size: %d msg: %s\n", __LINE__, meshCount, ba.what()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } for (uint32 i = 0; i < meshCount; ++i) { @@ -1258,7 +1258,7 @@ namespace Shared { if (readBytes != 1 && meshCount != 0) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u] on line: %d.", readBytes, meshCount, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } meshCount = Shared::PlatformByteOrder::fromCommonEndian(meshCount); @@ -1269,7 +1269,7 @@ namespace Shared { } catch (bad_alloc& ba) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error on line: %d size: %d msg: %s\n", __LINE__, meshCount, ba.what()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } for (uint32 i = 0; i < meshCount; ++i) { @@ -1284,7 +1284,7 @@ namespace Shared { if (readBytes != 1 && meshCount != 0) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " [%u] on line: %d.", readBytes, meshCount, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } meshCount = Shared::PlatformByteOrder::fromCommonEndian(meshCount); @@ -1296,7 +1296,7 @@ namespace Shared { } catch (bad_alloc& ba) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error on line: %d size: %d msg: %s\n", __LINE__, meshCount, ba.what()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } for (uint32 i = 0; i < meshCount; ++i) { @@ -1305,21 +1305,21 @@ namespace Shared { meshes[i].buildInterpolationData(); } } else { - throw megaglest_runtime_error("Invalid model version: " + intToStr(fileHeader.version)); + throw game_runtime_error("Invalid model version: " + intToStr(fileHeader.version)); } fclose(f); autoJoinMeshFrames(); - } catch (megaglest_runtime_error& ex) { + } catch (game_runtime_error& ex) { //printf("1111111 ex.wantStackTrace() = %d\n",ex.wantStackTrace()); SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, ex.what()); //printf("2222222\n"); - throw megaglest_runtime_error("Exception caught loading 3d file: " + path + "\n" + ex.what(), !ex.wantStackTrace()); + throw game_runtime_error("Exception caught loading 3d file: " + path + "\n" + ex.what(), !ex.wantStackTrace()); } catch (exception &e) { //abort(); SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, e.what()); - throw megaglest_runtime_error("Exception caught loading 3d file: " + path + "\n" + e.what()); + throw game_runtime_error("Exception caught loading 3d file: " + path + "\n" + e.what()); } } @@ -1334,7 +1334,7 @@ namespace Shared { FILE *f = fopen(tempModelFilename.c_str(), "wb"); #endif if (f == NULL) { - throw megaglest_runtime_error("Cant open file for writing: [" + tempModelFilename + "]"); + throw game_runtime_error("Cant open file for writing: [" + tempModelFilename + "]"); } convertTextureToFormat = toLower(convertTextureToFormat); @@ -1373,7 +1373,7 @@ namespace Shared { } } } else { - throw megaglest_runtime_error("Invalid model version: " + intToStr(fileHeader.version)); + throw game_runtime_error("Invalid model version: " + intToStr(fileHeader.version)); } fclose(f); @@ -1788,7 +1788,7 @@ namespace Shared { if (index >= (int) pboIds.size()) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error / Warning in [%s::%s] on line: %d pixel buffer out of range, index: %d size: %d, attempting to expand buffer...\n", __FILE__, __FUNCTION__, __LINE__, index, (int) pboIds.size()); - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); SystemFlags::OutputDebug(SystemFlags::debugError, "%s", szBuf); if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] szBuf: %s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, szBuf); @@ -1852,15 +1852,15 @@ namespace Shared { glBindBufferARB(GL_PIXEL_PACK_BUFFER_ARB, 0); if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - } catch (megaglest_runtime_error& ex) { + } catch (game_runtime_error& ex) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] codeSection [%s] Error [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, codeSection.c_str(), ex.what()); - throw megaglest_runtime_error("Exception caught in getPixelBufferFor codeSection: " + codeSection + "\n" + ex.what(), !ex.wantStackTrace()); + throw game_runtime_error("Exception caught in getPixelBufferFor codeSection: " + codeSection + "\n" + ex.what(), !ex.wantStackTrace()); } catch (exception &e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] codeSection [%s] Error [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, codeSection.c_str(), e.what()); - throw megaglest_runtime_error("Exception caught in getPixelBufferFor codeSection: " + codeSection + "\n" + e.what()); + throw game_runtime_error("Exception caught in getPixelBufferFor codeSection: " + codeSection + "\n" + e.what()); } catch (...) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] codeSection [%s] UNKNOWN Error!", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, codeSection.c_str()); - throw megaglest_runtime_error("UNKNOWN Exception caught in getPixelBufferFor codeSection: " + codeSection + "\n"); + throw game_runtime_error("UNKNOWN Exception caught in getPixelBufferFor codeSection: " + codeSection + "\n"); } if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); } @@ -1931,7 +1931,7 @@ namespace Shared { bool BaseColorPickEntity::get_next_assign_color(unsigned char *assign_to) { if (assign_to == NULL) { - throw megaglest_runtime_error("assign_to == NULL"); + throw game_runtime_error("assign_to == NULL"); } if (BaseColorPickEntity::using_loop_method == true) { diff --git a/source/shared_lib/sources/graphics/model_manager.cpp b/source/shared_lib/sources/graphics/model_manager.cpp index 97c840a4b..9a0434412 100644 --- a/source/shared_lib/sources/graphics/model_manager.cpp +++ b/source/shared_lib/sources/graphics/model_manager.cpp @@ -39,7 +39,7 @@ namespace Shared { ModelManager::ModelManager() { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } textureManager = NULL; diff --git a/source/shared_lib/sources/graphics/particle.cpp b/source/shared_lib/sources/graphics/particle.cpp index 9417ce7d0..ced82d448 100644 --- a/source/shared_lib/sources/graphics/particle.cpp +++ b/source/shared_lib/sources/graphics/particle.cpp @@ -208,7 +208,7 @@ namespace Shared { //updates all living particles and creates new ones void ParticleSystem::update() { if (aliveParticleCount > (int) particles.size()) { - throw megaglest_runtime_error("aliveParticleCount >= particles.size()"); + throw game_runtime_error("aliveParticleCount >= particles.size()"); } if (particleSystemStartDelay > 0) { particleSystemStartDelay--; @@ -253,7 +253,7 @@ namespace Shared { } else if (str == "black") { return bmOneMinusAlpha; } else { - throw megaglest_runtime_error("Unknown particle mode: " + str); + throw game_runtime_error("Unknown particle mode: " + str); } } @@ -560,7 +560,7 @@ namespace Shared { if (state != sPlay) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "state != sPlay, state = [%d]\n", state); - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); //printf(szBuf); SystemFlags::OutputDebug(SystemFlags::debugError, "%s", szBuf); } @@ -810,7 +810,7 @@ namespace Shared { } else if (str == "line") { return pLine; } else { - throw megaglest_runtime_error("Unknown particle primitive: " + str); + throw game_runtime_error("Unknown particle primitive: " + str); } } @@ -1100,7 +1100,7 @@ namespace Shared { } else if (str == "linear") { return sLinear; } else { - throw megaglest_runtime_error("Unknown particle shape: " + str); + throw game_runtime_error("Unknown particle shape: " + str); } } @@ -1226,7 +1226,7 @@ namespace Shared { p->speed.z = truncateDecimal(p->speed.z, 6); } } break; - default: throw megaglest_runtime_error("bad shape"); + default: throw game_runtime_error("bad shape"); } //need to do that down here because we need p->speed for it. p->speedUpConstant = Vec3f(speedUpConstant)*p->speed; @@ -2054,7 +2054,7 @@ namespace Shared { } else if (str == "spiral") { return tSpiral; } else { - throw megaglest_runtime_error("Unknown particle system trajectory: " + str); + throw game_runtime_error("Unknown particle system trajectory: " + str); } } diff --git a/source/shared_lib/sources/graphics/pixmap.cpp b/source/shared_lib/sources/graphics/pixmap.cpp index c8ea20deb..f7b3259fe 100644 --- a/source/shared_lib/sources/graphics/pixmap.cpp +++ b/source/shared_lib/sources/graphics/pixmap.cpp @@ -125,7 +125,7 @@ namespace Shared { file = fopen(path.c_str(), "rb"); #endif if (file == NULL) { - throw megaglest_runtime_error("Can't open TGA file: " + path, true); + throw game_runtime_error("Can't open TGA file: " + path, true); } //read header @@ -134,7 +134,7 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } static bool bigEndianSystem = Shared::PlatformByteOrder::isBigEndian(); if (bigEndianSystem == true) { @@ -151,29 +151,29 @@ namespace Shared { } //check that we can load this tga file if (fileHeader.idLength != 0) { - throw megaglest_runtime_error(path + ": id field is not 0", true); + throw game_runtime_error(path + ": id field is not 0", true); } if (fileHeader.dataTypeCode != tgaUncompressedRgb && fileHeader.dataTypeCode != tgaUncompressedBw) { - throw megaglest_runtime_error(path + ": only uncompressed BW and RGB targa images are supported", true); + throw game_runtime_error(path + ": only uncompressed BW and RGB targa images are supported", true); } //check bits per pixel if (fileHeader.bitsPerPixel != 8 && fileHeader.bitsPerPixel != 24 && fileHeader.bitsPerPixel != 32) { - throw megaglest_runtime_error(path + ": only 8, 24 and 32 bit targa images are supported", true); + throw game_runtime_error(path + ": only 8, 24 and 32 bit targa images are supported", true); } h = fileHeader.height; w = fileHeader.width; components = fileHeader.bitsPerPixel / 8; - } catch (megaglest_runtime_error& ex) { + } catch (game_runtime_error& ex) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error in [%s] on line: %d msg: %s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __LINE__, ex.what()); - throw megaglest_runtime_error(szBuf, !ex.wantStackTrace()); + throw game_runtime_error(szBuf, !ex.wantStackTrace()); } catch (exception& ex) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error in [%s] on line: %d msg: %s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __LINE__, ex.what()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -193,7 +193,7 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (bigEndianSystem == true) { l = Shared::PlatformByteOrder::fromCommonEndian(l); @@ -207,7 +207,7 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (bigEndianSystem == true) { b = Shared::PlatformByteOrder::fromCommonEndian(b); @@ -217,7 +217,7 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (bigEndianSystem == true) { g = Shared::PlatformByteOrder::fromCommonEndian(g); @@ -227,7 +227,7 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (bigEndianSystem == true) { r = Shared::PlatformByteOrder::fromCommonEndian(r); @@ -238,7 +238,7 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (bigEndianSystem == true) { a = Shared::PlatformByteOrder::fromCommonEndian(a); @@ -267,14 +267,14 @@ namespace Shared { break; } } - } catch (megaglest_runtime_error& ex) { + } catch (game_runtime_error& ex) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error in [%s] on line: %d msg: %s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __LINE__, ex.what()); - throw megaglest_runtime_error(szBuf, !ex.wantStackTrace()); + throw game_runtime_error(szBuf, !ex.wantStackTrace()); } catch (exception& ex) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Error in [%s] on line: %d msg: %s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __LINE__, ex.what()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -289,7 +289,7 @@ namespace Shared { file = fopen(path.c_str(), "wb"); #endif if (file == NULL) { - throw megaglest_runtime_error("Can't open TGA file: " + path, true); + throw game_runtime_error("Can't open TGA file: " + path, true); } TargaFileHeader fileHeader; @@ -365,7 +365,7 @@ namespace Shared { file = fopen(path.c_str(), "rb"); #endif if (file == NULL) { - throw megaglest_runtime_error("Can't open BMP file: " + path, true); + throw game_runtime_error("Can't open BMP file: " + path, true); } //read file header @@ -374,7 +374,7 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } static bool bigEndianSystem = Shared::PlatformByteOrder::isBigEndian(); if (bigEndianSystem == true) { @@ -387,7 +387,7 @@ namespace Shared { } if (fileHeader.type1 != 'B' || fileHeader.type2 != 'M') { - throw megaglest_runtime_error(path + " is not a bitmap", true); + throw game_runtime_error(path + " is not a bitmap", true); } //read info header @@ -396,7 +396,7 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (bigEndianSystem == true) { infoHeader.bitCount = Shared::PlatformByteOrder::fromCommonEndian(infoHeader.bitCount); @@ -412,7 +412,7 @@ namespace Shared { infoHeader.yPelsPerMeter = Shared::PlatformByteOrder::fromCommonEndian(infoHeader.yPelsPerMeter); } if (infoHeader.bitCount != 24) { - throw megaglest_runtime_error(path + " is not a 24 bit bitmap", true); + throw game_runtime_error(path + " is not a 24 bit bitmap", true); } h = infoHeader.height; @@ -433,7 +433,7 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (bigEndianSystem == true) { b = Shared::PlatformByteOrder::fromCommonEndian(b); @@ -442,7 +442,7 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (bigEndianSystem == true) { g = Shared::PlatformByteOrder::fromCommonEndian(g); @@ -452,7 +452,7 @@ namespace Shared { if (readBytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", readBytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (bigEndianSystem == true) { r = Shared::PlatformByteOrder::fromCommonEndian(r); @@ -489,7 +489,7 @@ namespace Shared { file = fopen(path.c_str(), "wb"); #endif if (file == NULL) { - throw megaglest_runtime_error("Can't open BMP file for writing: " + path); + throw game_runtime_error("Can't open BMP file for writing: " + path); } BitmapFileHeader fileHeader; @@ -572,16 +572,16 @@ namespace Shared { } void PixmapIoPng::openRead(const string &path) { - throw megaglest_runtime_error("PixmapIoPng::openRead not implemented!"); + throw game_runtime_error("PixmapIoPng::openRead not implemented!"); } void PixmapIoPng::read(uint8 *pixels) { - throw megaglest_runtime_error("PixmapIoPng::read not implemented!"); + throw game_runtime_error("PixmapIoPng::read not implemented!"); } void PixmapIoPng::read(uint8 *pixels, int components) { - throw megaglest_runtime_error("PixmapIoPng::read #2 not implemented!"); + throw game_runtime_error("PixmapIoPng::read #2 not implemented!"); } void PixmapIoPng::openWrite(const string &path, int w, int h, int components) { @@ -596,7 +596,7 @@ namespace Shared { file = fopen(path.c_str(), "wb"); #endif if (file == NULL) { - throw megaglest_runtime_error("Can't open PNG file for writing: " + path); + throw game_runtime_error("Can't open PNG file for writing: " + path); } } @@ -644,16 +644,16 @@ namespace Shared { } void PixmapIoJpg::openRead(const string &path) { - throw megaglest_runtime_error("PixmapIoJpg::openRead not implemented!"); + throw game_runtime_error("PixmapIoJpg::openRead not implemented!"); } void PixmapIoJpg::read(uint8 *pixels) { - throw megaglest_runtime_error("PixmapIoJpg::read not implemented!"); + throw game_runtime_error("PixmapIoJpg::read not implemented!"); } void PixmapIoJpg::read(uint8 *pixels, int components) { - throw megaglest_runtime_error("PixmapIoJpg::read #2 not implemented!"); + throw game_runtime_error("PixmapIoJpg::read #2 not implemented!"); } void PixmapIoJpg::openWrite(const string &path, int w, int h, int components) { @@ -668,7 +668,7 @@ namespace Shared { file = fopen(path.c_str(), "wb"); #endif if (file == NULL) { - throw megaglest_runtime_error("Can't open JPG file for writing: " + path); + throw game_runtime_error("Can't open JPG file for writing: " + path); } } @@ -762,7 +762,7 @@ namespace Shared { Pixmap1D::Pixmap1D() { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } @@ -773,7 +773,7 @@ namespace Shared { Pixmap1D::Pixmap1D(int components) { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } @@ -782,7 +782,7 @@ namespace Shared { Pixmap1D::Pixmap1D(int w, int components) { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } @@ -823,7 +823,7 @@ namespace Shared { } else if (toLower(extension) == "tga") { loadTga(path); } else { - throw megaglest_runtime_error("Unknown pixmap extension [" + extension + "] file [" + path + "]"); + throw game_runtime_error("Unknown pixmap extension [" + extension + "] file [" + path + "]"); } this->path = path; CalculatePixelsCRC(pixels, getPixelByteCount(), crc); @@ -841,7 +841,7 @@ namespace Shared { } else if (plb.getW() == 1) { w = plb.getH(); } else { - throw megaglest_runtime_error("One of the texture dimensions must be 1"); + throw game_runtime_error("One of the texture dimensions must be 1"); } if (components == -1) { @@ -867,7 +867,7 @@ namespace Shared { } else if (plt.getW() == 1) { w = plt.getH(); } else { - throw megaglest_runtime_error("One of the texture dimensions must be 1"); + throw game_runtime_error("One of the texture dimensions must be 1"); } int fileComponents = plt.getComponents(); @@ -891,7 +891,7 @@ namespace Shared { Pixmap2D::Pixmap2D() { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } h = -1; @@ -902,7 +902,7 @@ namespace Shared { Pixmap2D::Pixmap2D(int components) { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } h = -1; @@ -915,7 +915,7 @@ namespace Shared { Pixmap2D::Pixmap2D(int w, int h, int components) { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } this->h = 0; @@ -944,7 +944,7 @@ namespace Shared { if (getPixelByteCount() <= 0 || (h <= 0 || w <= 0 || components <= 0)) { char szBuf[8096]; snprintf(szBuf, 8096, "Invalid pixmap dimensions for [%s], h = %d, w = %d, components = %d\n", path.c_str(), h, w, components); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } pixels = new uint8[getPixelByteCount()]; CalculatePixelsCRC(pixels, 0, crc); @@ -1022,7 +1022,7 @@ namespace Shared { } else if (toLower(extension) == "png") { savePng(path); } else { - throw megaglest_runtime_error("Unknown pixmap extension [" + extension + "] file [" + path + "]"); + throw game_runtime_error("Unknown pixmap extension [" + extension + "] file [" + path + "]"); } } @@ -1056,7 +1056,7 @@ namespace Shared { if (index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf, 8096, "Invalid pixmap index: " MG_SIZE_T_SPECIFIER " for [%s], h = %d, w = %d, components = %d x = %d y = %d\n", index, path.c_str(), h, w, components, x, y); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } value[i] = pixels[index]; @@ -1069,7 +1069,7 @@ namespace Shared { if (index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf, 8096, "Invalid pixmap index: " MG_SIZE_T_SPECIFIER " for [%s], h = %d, w = %d, components = %d x = %d y = %d\n", index, path.c_str(), h, w, components, x, y); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } value[i] = pixels[index] / 255.f; @@ -1081,7 +1081,7 @@ namespace Shared { if (index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf, 8096, "Invalid pixmap index: " MG_SIZE_T_SPECIFIER " for [%s], h = %d, w = %d, components = %d x = %d y = %d\n", index, path.c_str(), h, w, components, x, y); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } value = pixels[index]; @@ -1092,7 +1092,7 @@ namespace Shared { if (index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf, 8096, "Invalid pixmap index: " MG_SIZE_T_SPECIFIER " for [%s], h = %d, w = %d, components = %d x = %d y = %d\n", index, path.c_str(), h, w, components, x, y); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } value = pixels[index] / 255.f; @@ -1106,7 +1106,7 @@ namespace Shared { if (index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf, 8096, "Invalid pixmap index: " MG_SIZE_T_SPECIFIER " for [%s], h = %d, w = %d, components = %d x = %d y = %d\n", index, path.c_str(), h, w, components, x, y); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } v.ptr()[i] = pixels[index] / 255.f; @@ -1121,7 +1121,7 @@ namespace Shared { if (index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf, 8096, "Invalid pixmap index: " MG_SIZE_T_SPECIFIER " for [%s], h = %d, w = %d, components = %d x = %d y = %d\n", index, path.c_str(), h, w, components, x, y); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } v.ptr()[i] = pixels[index] / 255.f; @@ -1134,7 +1134,7 @@ namespace Shared { if (index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf, 8096, "Invalid pixmap index: " MG_SIZE_T_SPECIFIER " for [%s], h = %d, w = %d, components = %d x = %d y = %d\n", index, path.c_str(), h, w, components, x, y); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } float result = pixels[index] / 255.f; return truncateDecimal(result, 6); @@ -1150,14 +1150,14 @@ namespace Shared { if (arraySize > components) { char szBuf[8096]; snprintf(szBuf, 8096, "Invalid pixmap arraySize: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n", arraySize, path.c_str(), h, w, components, x, y); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } for (int i = 0; i < components; ++i) { std::size_t index = (w * y + x) * components + i; if (index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf, 8096, "Invalid pixmap index: " MG_SIZE_T_SPECIFIER " for [%s], h = %d, w = %d, components = %d x = %d y = %d\n", index, path.c_str(), h, w, components, x, y); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } pixels[index] = value[i]; @@ -1169,7 +1169,7 @@ namespace Shared { if (arraySize > components) { char szBuf[8096]; snprintf(szBuf, 8096, "Invalid pixmap arraySize: %d for [%s], h = %d, w = %d, components = %d x = %d y = %d\n", arraySize, path.c_str(), h, w, components, x, y); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } for (int i = 0; i < components; ++i) { @@ -1177,7 +1177,7 @@ namespace Shared { if (index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf, 8096, "Invalid pixmap index: " MG_SIZE_T_SPECIFIER " for [%s], h = %d, w = %d, components = %d x = %d y = %d\n", index, path.c_str(), h, w, components, x, y); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } pixels[index] = static_cast(value[i] * 255.f); } @@ -1189,7 +1189,7 @@ namespace Shared { if (index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf, 8096, "Invalid pixmap index: " MG_SIZE_T_SPECIFIER " for [%s], h = %d, w = %d, components = %d x = %d y = %d\n", index, path.c_str(), h, w, components, x, y); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } pixels[index] = value; @@ -1201,7 +1201,7 @@ namespace Shared { if (index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf, 8096, "Invalid pixmap index: " MG_SIZE_T_SPECIFIER " for [%s], h = %d, w = %d, components = %d x = %d y = %d\n", index, path.c_str(), h, w, components, x, y); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } pixels[index] = static_cast(value * 255.f); @@ -1215,7 +1215,7 @@ namespace Shared { if (index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf, 8096, "Invalid pixmap index: " MG_SIZE_T_SPECIFIER " for [%s], h = %d, w = %d, components = %d x = %d y = %d\n", index, path.c_str(), h, w, components, x, y); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } pixels[index] = static_cast(p.ptr()[i] * 255.f); } @@ -1228,7 +1228,7 @@ namespace Shared { if (index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf, 8096, "Invalid pixmap index: " MG_SIZE_T_SPECIFIER " for [%s], h = %d, w = %d, components = %d x = %d y = %d\n", index, path.c_str(), h, w, components, x, y); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } pixels[index] = static_cast(p.ptr()[i] * 255.f); } @@ -1240,7 +1240,7 @@ namespace Shared { if (index >= getPixelByteCount()) { char szBuf[8096]; snprintf(szBuf, 8096, "Invalid pixmap index: " MG_SIZE_T_SPECIFIER " for [%s], h = %d, w = %d, components = %d x = %d y = %d\n", index, path.c_str(), h, w, components, x, y); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } pixels[index] = static_cast(p * 255.f); @@ -1300,7 +1300,7 @@ namespace Shared { !doDimensionsAgree(rightUp) || !doDimensionsAgree(leftDown) || !doDimensionsAgree(rightDown)) { - throw megaglest_runtime_error("Pixmap2D::splat: pixmap dimensions don't agree"); + throw game_runtime_error("Pixmap2D::splat: pixmap dimensions don't agree"); } for (int i = 0; i < w; ++i) { @@ -1342,7 +1342,7 @@ namespace Shared { if ( !doDimensionsAgree(pixmap1) || !doDimensionsAgree(pixmap2)) { - throw megaglest_runtime_error("Pixmap2D::lerp: pixmap dimensions don't agree"); + throw game_runtime_error("Pixmap2D::lerp: pixmap dimensions don't agree"); } for (int i = 0; i < w; ++i) { @@ -1357,7 +1357,7 @@ namespace Shared { assert(components == sourcePixmap->getComponents()); if (w != sourcePixmap->getW() || h != sourcePixmap->getH()) { - throw megaglest_runtime_error("Pixmap2D::copy() dimensions must agree"); + throw game_runtime_error("Pixmap2D::copy() dimensions must agree"); } memcpy(pixels, sourcePixmap->getPixels(), w*h*sourcePixmap->getComponents()); this->path = sourcePixmap->path; @@ -1368,7 +1368,7 @@ namespace Shared { assert(components == sourcePixmap->getComponents()); if (w < sourcePixmap->getW() && h < sourcePixmap->getH()) { - throw megaglest_runtime_error("Pixmap2D::subCopy(), bad dimensions"); + throw game_runtime_error("Pixmap2D::subCopy(), bad dimensions"); } uint8 *pixel = new uint8[components]; @@ -1389,7 +1389,7 @@ namespace Shared { assert(components == sourcePixmap->getComponents()); if (x + w > sourcePixmap->getW() && y + h > sourcePixmap->getH()) { - throw megaglest_runtime_error("Pixmap2D::copyImagePart(), bad dimensions"); + throw game_runtime_error("Pixmap2D::copyImagePart(), bad dimensions"); } uint8 *pixel = new uint8[components]; @@ -1415,7 +1415,7 @@ namespace Shared { Pixmap3D::Pixmap3D() { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } @@ -1429,7 +1429,7 @@ namespace Shared { Pixmap3D::Pixmap3D(int w, int h, int d, int components) { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } pixels = NULL; @@ -1439,7 +1439,7 @@ namespace Shared { Pixmap3D::Pixmap3D(int d, int components) { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } pixels = NULL; @@ -1497,7 +1497,7 @@ namespace Shared { } else if (toLower(extension) == "tga") { loadSliceTga(path, slice); } else { - throw megaglest_runtime_error("Unknown pixmap extension [" + extension + "] file [" + path + "]"); + throw game_runtime_error("Unknown pixmap extension [" + extension + "] file [" + path + "]"); } this->path = path; CalculatePixelsCRC(pixels, getPixelByteCount(), crc); @@ -1545,7 +1545,7 @@ namespace Shared { // ===================================================== PixmapCube::PixmapCube() { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } } diff --git a/source/shared_lib/sources/graphics/shader.cpp b/source/shared_lib/sources/graphics/shader.cpp index 61d359ea7..2b07132af 100644 --- a/source/shared_lib/sources/graphics/shader.cpp +++ b/source/shared_lib/sources/graphics/shader.cpp @@ -39,7 +39,7 @@ namespace Shared { //open file ifstream ifs(path.c_str()); if (ifs.fail()) { - throw megaglest_runtime_error("Can't open shader file: " + path); + throw game_runtime_error("Can't open shader file: " + path); } //read source diff --git a/source/shared_lib/sources/graphics/shader_manager.cpp b/source/shared_lib/sources/graphics/shader_manager.cpp index b62282408..17f70231f 100644 --- a/source/shared_lib/sources/graphics/shader_manager.cpp +++ b/source/shared_lib/sources/graphics/shader_manager.cpp @@ -36,7 +36,7 @@ namespace Shared { ShaderManager::ShaderManager() { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } } @@ -48,13 +48,13 @@ namespace Shared { for (unsigned int i = 0; i < shaders.size(); ++i) { shaders[i]->init(); if (!shaders[i]->compile(logString)) { - throw megaglest_runtime_error("Can't compile shader\n"); + throw game_runtime_error("Can't compile shader\n"); } } for (unsigned int i = 0; i < shaderPrograms.size(); ++i) { shaderPrograms[i]->init(); if (!shaderPrograms[i]->link(logString)) { - throw megaglest_runtime_error("Can't link shader\n"); + throw game_runtime_error("Can't link shader\n"); } } } diff --git a/source/shared_lib/sources/graphics/texture.cpp b/source/shared_lib/sources/graphics/texture.cpp index a7f6a5f7b..4ecb3c612 100644 --- a/source/shared_lib/sources/graphics/texture.cpp +++ b/source/shared_lib/sources/graphics/texture.cpp @@ -51,7 +51,7 @@ namespace Shared { Texture::Texture() { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } @@ -122,7 +122,7 @@ namespace Shared { //int w = powerOfTwo(surface->w); //int h = powerOfTwo(surface->h); if (result.first == NULL) { - throw megaglest_runtime_error("result.first == NULL"); + throw game_runtime_error("result.first == NULL"); } int w = result.first->w; diff --git a/source/shared_lib/sources/graphics/texture_manager.cpp b/source/shared_lib/sources/graphics/texture_manager.cpp index efd5c5d04..5561d7806 100644 --- a/source/shared_lib/sources/graphics/texture_manager.cpp +++ b/source/shared_lib/sources/graphics/texture_manager.cpp @@ -41,7 +41,7 @@ namespace Shared { TextureManager::TextureManager() { if (GlobalStaticFlags::getIsNonGraphicalModeEnabled() == true) { - throw megaglest_runtime_error("Loading graphics in headless server mode not allowed!"); + throw game_runtime_error("Loading graphics in headless server mode not allowed!"); } diff --git a/source/shared_lib/sources/lua/lua_script.cpp b/source/shared_lib/sources/lua/lua_script.cpp index 1f681bab5..696e0738a 100644 --- a/source/shared_lib/sources/lua/lua_script.cpp +++ b/source/shared_lib/sources/lua/lua_script.cpp @@ -69,7 +69,7 @@ namespace Shared { luaL_openlibs(luaState); if (luaState == NULL) { - throw megaglest_runtime_error("Can not allocate lua state"); + throw game_runtime_error("Can not allocate lua state"); } argumentCount = -1; @@ -551,7 +551,7 @@ namespace Shared { printf("Function name [%s]\ncode:\n%s\n", name.c_str(), code.c_str()); printf("=========================================================\n"); - throw megaglest_runtime_error("Error loading lua code: " + errorToString(errorCode), true); + throw game_runtime_error("Error loading lua code: " + errorToString(errorCode), true); } if (SystemFlags::getSystemSettingType(SystemFlags::debugLUA).enabled) SystemFlags::OutputDebug(SystemFlags::debugLUA, "In [%s::%s Line: %d] name [%s], errorCode = %d\n", __FILE__, __FUNCTION__, __LINE__, name.c_str(), errorCode); @@ -563,7 +563,7 @@ namespace Shared { printf("Error calling lua pcall: %s\n", errorToString(errorCode).c_str()); printf("=========================================================\n"); - throw megaglest_runtime_error("Error initializing lua: " + errorToString(errorCode), true); + throw game_runtime_error("Error initializing lua: " + errorToString(errorCode), true); } //const char *errMsg = lua_tostring(luaState, -1); @@ -600,7 +600,7 @@ namespace Shared { // if(sandboxWrapperFunctionName != "" && sandboxCode != "") { // int errorCode= runCode(sandboxCode); // if(errorCode !=0 ) { - // throw megaglest_runtime_error("Error calling lua function [" + currentLuaFunction + "] error: " + errorToString(errorCode)); + // throw game_runtime_error("Error calling lua function [" + currentLuaFunction + "] error: " + errorToString(errorCode)); // } // //functionName = sandboxWrapperFunctionName; // } @@ -626,7 +626,7 @@ namespace Shared { printf("Trying to execute [%s]\n", safeWrapper.c_str()); int errorCode = runCode(safeWrapper); if (errorCode != 0) { - throw megaglest_runtime_error("Error calling lua function [" + currentLuaFunction + "] error: " + errorToString(errorCode), true); + throw game_runtime_error("Error calling lua function [" + currentLuaFunction + "] error: " + errorToString(errorCode), true); } //printf("Trying to execute [%s]\n",currentLuaFunction.c_str()); @@ -636,12 +636,12 @@ namespace Shared { // int errorCode= lua_pcall(luaState, argumentCount, 0, 0); // if(errorCode !=0 ) { - // throw megaglest_runtime_error("Error calling lua function [" + currentLuaFunction + "] error: " + errorToString(errorCode)); + // throw game_runtime_error("Error calling lua function [" + currentLuaFunction + "] error: " + errorToString(errorCode)); // } } else { int errorCode = lua_pcall(luaState, argumentCount, 0, 0); if (errorCode != 0) { - throw megaglest_runtime_error("Error calling lua function [" + currentLuaFunction + "] error: " + errorToString(errorCode), true); + throw game_runtime_error("Error calling lua function [" + currentLuaFunction + "] error: " + errorToString(errorCode), true); } } } else { @@ -1135,7 +1135,7 @@ namespace Shared { Lua_STREFLOP_Wrapper streflopWrapper; string stackString = getStackText(); - throw megaglest_runtime_error("Lua error: " + message + "\n\nLua Stack:\n" + stackString, true); + throw game_runtime_error("Lua error: " + message + "\n\nLua Stack:\n" + stackString, true); } } diff --git a/source/shared_lib/sources/map/map_preview.cpp b/source/shared_lib/sources/map/map_preview.cpp index d8577214a..09eccbbc5 100644 --- a/source/shared_lib/sources/map/map_preview.cpp +++ b/source/shared_lib/sources/map/map_preview.cpp @@ -519,26 +519,26 @@ namespace Shared { if (w < MIN_MAP_CELL_DIMENSION || h < MIN_MAP_CELL_DIMENSION) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Size of map must be at least %dx%d", MIN_MAP_CELL_DIMENSION, MIN_MAP_CELL_DIMENSION); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); //return; } if (w > MAX_MAP_CELL_DIMENSION || h > MAX_MAP_CELL_DIMENSION) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Size of map can be at most %dx%d", MAX_MAP_CELL_DIMENSION, MAX_MAP_CELL_DIMENSION); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (alt < MIN_MAP_CELL_HEIGHT || alt > MAX_MAP_CELL_HEIGHT) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Height must be in the range %d-%d", MIN_MAP_CELL_HEIGHT, MAX_MAP_CELL_HEIGHT); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (surf < st_Grass || surf > st_Ground) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Surface must be in the range %d-%d", st_Grass, st_Ground); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } //if (cells != NULL) { @@ -572,26 +572,26 @@ namespace Shared { if (w < MIN_MAP_CELL_DIMENSION || h < MIN_MAP_CELL_DIMENSION) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Size of map must be at least %dx%d", MIN_MAP_CELL_DIMENSION, MIN_MAP_CELL_DIMENSION); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); //return; } if (w > MAX_MAP_CELL_DIMENSION || h > MAX_MAP_CELL_DIMENSION) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Size of map can be at most %dx%d", MAX_MAP_CELL_DIMENSION, MAX_MAP_CELL_DIMENSION); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (alt < MIN_MAP_CELL_HEIGHT || alt > MAX_MAP_CELL_HEIGHT) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Height must be in the range %d-%d", MIN_MAP_CELL_HEIGHT, MAX_MAP_CELL_HEIGHT); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (surf < st_Grass || surf > st_Ground) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Surface must be in the range %d-%d", st_Grass, st_Ground); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } int oldW = this->w; @@ -649,7 +649,7 @@ namespace Shared { if (maxPlayers < MIN_MAP_FACTIONCOUNT || maxPlayers > MAX_MAP_FACTIONCOUNT) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "Max Players must be in the range %d-%d", MIN_MAP_FACTIONCOUNT, MAX_MAP_FACTIONCOUNT); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } //if (startLocations != NULL) { @@ -762,7 +762,7 @@ namespace Shared { } } } else { - throw megaglest_runtime_error("Incorrect surfaces"); + throw game_runtime_error("Incorrect surfaces"); } } @@ -815,7 +815,7 @@ namespace Shared { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", bytes, __LINE__); fclose(f1); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } fromEndianMapFileHeader(header); @@ -839,7 +839,7 @@ namespace Shared { if (bytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", bytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } startLocations[i].x = Shared::PlatformByteOrder::fromCommonEndian(startLocations[i].x); @@ -847,7 +847,7 @@ namespace Shared { if (bytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", bytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } startLocations[i].y = Shared::PlatformByteOrder::fromCommonEndian(startLocations[i].y); } @@ -860,7 +860,7 @@ namespace Shared { if (bytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", bytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } cells[i][j].height = Shared::PlatformByteOrder::fromCommonEndian(cells[i][j].height); } @@ -873,7 +873,7 @@ namespace Shared { if (bytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", bytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } cells[i][j].surface = Shared::PlatformByteOrder::fromCommonEndian(cells[i][j].surface); } @@ -887,7 +887,7 @@ namespace Shared { if (bytes != 1) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "fread returned wrong size = " MG_SIZE_T_SPECIFIER " on line: %d.", bytes, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } obj = Shared::PlatformByteOrder::fromCommonEndian(obj); @@ -910,7 +910,7 @@ namespace Shared { string strError = "[#5] Could not open file, result: " + intToStr(error) + " - " + intToStr(fileErrno) + " " + strerror(fileErrno) + " [" + path + "]"; throw strError; #else - throw megaglest_runtime_error("[#5] error opening map file: " + path); + throw game_runtime_error("[#5] error opening map file: " + path); #endif } } @@ -983,7 +983,7 @@ namespace Shared { hasChanged = false; } else { - throw megaglest_runtime_error("Error opening map file: " + path); + throw game_runtime_error("Error opening map file: " + path); } //void randomHeight(int x, int y, int height); @@ -1044,7 +1044,7 @@ namespace Shared { f = fopen(file.c_str(), "rb"); #endif if (f == NULL) { - throw megaglest_runtime_error("Can't open file"); + throw game_runtime_error("Can't open file"); } MapFileHeader header; @@ -1057,7 +1057,7 @@ namespace Shared { snprintf(szBuf, 8096, "In [%s::%s Line: %d]\nfile [%s]\nreadBytes != sizeof(MapFileHeader) [" MG_SIZE_T_SPECIFIER "] [" MG_SIZE_T_SPECIFIER "]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, file.c_str(), readBytes, sizeof(MapFileHeader)); SystemFlags::OutputDebug(SystemFlags::debugError, "%s", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } else { fromEndianMapFileHeader(header); @@ -1070,7 +1070,7 @@ namespace Shared { printf("In [%s::%s Line: %d]\file [%s]\nheader.version < mapver_1 || header.version >= mapver_MAX [%d] [%d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, file.c_str(), header.version, mapver_MAX); SystemFlags::OutputDebug(SystemFlags::debugError, "%s", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } else if (header.maxFactions <= 0 || header.maxFactions > MAX_MAP_FACTIONCOUNT) { validMap = false; @@ -1080,7 +1080,7 @@ namespace Shared { printf("In [%s::%s Line: %d]\file [%s]\nheader.maxFactions <= 0 || header.maxFactions > MAX_MAP_FACTIONCOUNT [%d] [%d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, file.c_str(), header.maxFactions, MAX_MAP_FACTIONCOUNT); SystemFlags::OutputDebug(SystemFlags::debugError, "%s", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } else { mapInfo->size.x = header.width; @@ -1104,7 +1104,7 @@ namespace Shared { //assert(0); SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s] loading map [%s]\n", __FILE__, __FUNCTION__, __LINE__, e.what(), file.c_str()); - throw megaglest_runtime_error("Error loading map file: [" + file + "] msg: " + e.what() + " errno [" + intToStr(errno) + "] [" + strerror(errno) + "]"); + throw game_runtime_error("Error loading map file: [" + file + "] msg: " + e.what() + " errno [" + intToStr(errno) + "] [" + strerror(errno) + "]"); } return validMap; @@ -1137,7 +1137,7 @@ namespace Shared { } if (errorOnNotFound == true) { - throw megaglest_runtime_error("Map [" + mapName + "] not found, scenarioDir [" + scenarioDir + "]"); + throw game_runtime_error("Map [" + mapName + "] not found, scenarioDir [" + scenarioDir + "]"); } return ""; diff --git a/source/shared_lib/sources/platform/common/base_thread.cpp b/source/shared_lib/sources/platform/common/base_thread.cpp index 96fc07c6b..369f0dc28 100644 --- a/source/shared_lib/sources/platform/common/base_thread.cpp +++ b/source/shared_lib/sources/platform/common/base_thread.cpp @@ -99,7 +99,7 @@ namespace Shared { if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d] uniqueID [%s] ret [%d] END\n", __FILE__, __FUNCTION__, __LINE__, uniqueID.c_str(), ret); printf("invalid thread delete for ptr: %p", this); - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); } if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d] uniqueID [%s] ret [%d] END\n", __FILE__, __FUNCTION__, __LINE__, uniqueID.c_str(), ret); diff --git a/source/shared_lib/sources/platform/common/platform_common.cpp b/source/shared_lib/sources/platform/common/platform_common.cpp index b343fbec0..4d786eb20 100644 --- a/source/shared_lib/sources/platform/common/platform_common.cpp +++ b/source/shared_lib/sources/platform/common/platform_common.cpp @@ -388,7 +388,7 @@ namespace Shared { if (errorOnNotFound) { std::stringstream msg; msg << "#1 Couldn't scan directory '" << mypath << "': " << strerror(errno); - throw megaglest_runtime_error(msg.str()); + throw game_runtime_error(msg.str()); } } else { for (int i = 0; i < (int) globbuf.gl_pathc; ++i) { @@ -409,7 +409,7 @@ namespace Shared { globfree(&globbuf); if (results.empty() == true && errorOnNotFound == true) { - throw megaglest_runtime_error("No files found in: " + mypath); + throw game_runtime_error("No files found in: " + mypath); } if (cutExtension) { @@ -1062,7 +1062,7 @@ namespace Shared { if (res < 0) { std::stringstream msg; msg << "#2 Couldn't scan directory '" << mypath << "': " << strerror(errno); - throw megaglest_runtime_error(msg.str()); + throw game_runtime_error(msg.str()); } #endif @@ -1101,7 +1101,7 @@ namespace Shared { if (res < 0) { std::stringstream msg; msg << "#3 Couldn't scan directory '" << mypath << "': " << strerror(errno); - throw megaglest_runtime_error(msg.str()); + throw game_runtime_error(msg.str()); } #endif @@ -1239,7 +1239,7 @@ namespace Shared { if (res < 0) { std::stringstream msg; msg << "#4 Couldn't scan directory '" << mypath << "': " << strerror(errno); - throw megaglest_runtime_error(msg.str()); + throw game_runtime_error(msg.str()); } #endif for (int i = 0; i < (int) globbuf.gl_pathc; ++i) { @@ -1278,7 +1278,7 @@ namespace Shared { if (res < 0) { std::stringstream msg; msg << "#5 Couldn't scan directory '" << mypath << "': " << strerror(errno); - throw megaglest_runtime_error(msg.str()); + throw game_runtime_error(msg.str()); } #endif @@ -1377,7 +1377,7 @@ namespace Shared { if (res < 0) { std::stringstream msg; msg << "#6 Couldn't scan directory '" << mypath << "': " << strerror(errno); - throw megaglest_runtime_error(msg.str()); + throw game_runtime_error(msg.str()); } #endif @@ -1414,7 +1414,7 @@ namespace Shared { if (res < 0) { std::stringstream msg; msg << "#7 Couldn't scan directory '" << mypath << "': " << strerror(errno); - throw megaglest_runtime_error(msg.str()); + throw game_runtime_error(msg.str()); } #endif @@ -2066,12 +2066,12 @@ namespace Shared { if (fp1 == NULL) { if (fp2) fclose(fp2); - throw megaglest_runtime_error("cannot open input file [" + fileName + "]"); + throw game_runtime_error("cannot open input file [" + fileName + "]"); } if (fp2 == NULL) { if (fp1) fclose(fp1); - throw megaglest_runtime_error("cannot open output file [" + tempfileName + "]"); + throw game_runtime_error("cannot open output file [" + tempfileName + "]"); } while (fgets(buffer, MAX_LEN_SINGLE_LINE + 2, fp1)) { @@ -2117,7 +2117,7 @@ namespace Shared { if (out.is_open()) { out << data; } else if (out.is_open() == false) { - throw megaglest_runtime_error("cannot open input file [" + filename + "]"); + throw game_runtime_error("cannot open input file [" + filename + "]"); } //Close file @@ -2147,9 +2147,9 @@ namespace Shared { out.put(in.get()); } } else if (in.is_open() == false) { - throw megaglest_runtime_error("cannot open input file [" + fromFileName + "]"); + throw game_runtime_error("cannot open input file [" + fromFileName + "]"); } else if (out.is_open() == false) { - throw megaglest_runtime_error("cannot open input file [" + toFileName + "]"); + throw game_runtime_error("cannot open input file [" + toFileName + "]"); } //Close both files @@ -2201,7 +2201,7 @@ namespace Shared { // ifstream xmlFile(path.c_str(),ios::binary); //#endif // if(xmlFile.is_open() == false) { - // throw megaglest_runtime_error("Can not open file: [" + path + "]"); + // throw game_runtime_error("Can not open file: [" + path + "]"); // } // // xmlFile.unsetf(ios::skipws); diff --git a/source/shared_lib/sources/platform/common/simple_threads.cpp b/source/shared_lib/sources/platform/common/simple_threads.cpp index 04b38d6d3..217195b82 100644 --- a/source/shared_lib/sources/platform/common/simple_threads.cpp +++ b/source/shared_lib/sources/platform/common/simple_threads.cpp @@ -439,7 +439,7 @@ namespace Shared { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, ex.what()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d] uniqueID [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->getUniqueID().c_str()); - //throw megaglest_runtime_error(ex.what()); + //throw game_runtime_error(ex.what()); //abort(); } //printf("~SimpleTaskThread LINE: %d this = %p\n",__LINE__,this); @@ -587,7 +587,7 @@ namespace Shared { if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d] uniqueID [%s] END\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, this->getUniqueID().c_str()); mustDeleteSelf = getDeleteSelfOnExecutionDone(); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } } } @@ -766,7 +766,7 @@ namespace Shared { if (logList.size() < logCount) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "logList.size() <= logCount [%lld][%lld]", (long long int)logList.size(), (long long int)logCount); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } logList.erase(logList.begin(), logList.begin() + logCount); } diff --git a/source/shared_lib/sources/platform/posix/socket.cpp b/source/shared_lib/sources/platform/posix/socket.cpp index 7955b34e6..7540e92a4 100644 --- a/source/shared_lib/sources/platform/posix/socket.cpp +++ b/source/shared_lib/sources/platform/posix/socket.cpp @@ -1505,7 +1505,7 @@ namespace Shared { if (additionalBytes > 0) { bytesReceived += additionalBytes; } else { - //throw megaglest_runtime_error("additionalBytes == " + intToStr(additionalBytes)); + //throw game_runtime_error("additionalBytes == " + intToStr(additionalBytes)); if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "In [%s::%s Line: %d] additionalBytes == %d\n", __FILE__, __FUNCTION__, __LINE__, additionalBytes); if (SystemFlags::VERBOSE_MODE_ENABLED) printf("\nIn [%s::%s Line: %d] additionalBytes == %d\n", __FILE__, __FUNCTION__, __LINE__, additionalBytes); if (SystemFlags::getSystemSettingType(SystemFlags::debugError).enabled) SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] additionalBytes == %d\n", __FILE__, __FUNCTION__, __LINE__, additionalBytes); @@ -1901,13 +1901,13 @@ namespace Shared { unsigned char* address; if (info == NULL) { - throw megaglest_runtime_error("Error getting host by name"); + throw game_runtime_error("Error getting host by name"); } address = reinterpret_cast(info->h_addr_list[0]); if (address == NULL) { - throw megaglest_runtime_error("Error getting host ip"); + throw game_runtime_error("Error getting host ip"); } return @@ -1919,7 +1919,7 @@ namespace Shared { void Socket::throwException(string str) { string msg = str + " " + getLastSocketErrorFormattedText(); - throw megaglest_runtime_error(msg); + throw game_runtime_error(msg); } // =============================================== @@ -2374,7 +2374,7 @@ namespace Shared { if (SystemFlags::getSystemSettingType(SystemFlags::debugNetwork).enabled) SystemFlags::OutputDebug(SystemFlags::debugNetwork, "%s", szBuf); snprintf(szBuf, 8096, "Error binding socket sock = " PLATFORM_SOCKET_FORMAT_TYPE ", address [%s] port = %d err = %d, error = %s\n", sock, this->bindSpecificAddress.c_str(), port, err, getLastSocketErrorFormattedText().c_str()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } portBound = true; @@ -2847,7 +2847,7 @@ namespace Shared { if (UPNPPortForwardList.size() % 2 != 0) { // We need groups of 2 ports.. one external and one internal for opening ports on UPNP router - throw megaglest_runtime_error("UPNPPortForwardList.size() MUST BE divisable by 2"); + throw game_runtime_error("UPNPPortForwardList.size() MUST BE divisable by 2"); } for (unsigned int clientIndex = 0; clientIndex < UPNPPortForwardList.size(); clientIndex += 2) { diff --git a/source/shared_lib/sources/platform/sdl/factory_repository.cpp b/source/shared_lib/sources/platform/sdl/factory_repository.cpp index e9b34e7ec..be6ad8cb8 100644 --- a/source/shared_lib/sources/platform/sdl/factory_repository.cpp +++ b/source/shared_lib/sources/platform/sdl/factory_repository.cpp @@ -37,7 +37,7 @@ GraphicsFactory *FactoryRepository::getGraphicsFactory(const string &name) { return &graphicsFactoryGl; } - throw megaglest_runtime_error("Unknown graphics factory: " + name); + throw game_runtime_error("Unknown graphics factory: " + name); } SoundFactory *FactoryRepository::getSoundFactory(const string &name) { @@ -48,7 +48,7 @@ SoundFactory *FactoryRepository::getSoundFactory(const string &name) { return &soundFactoryNone; } - throw megaglest_runtime_error("Unknown sound factory: " + name); + throw game_runtime_error("Unknown sound factory: " + name); } }}//end namespace diff --git a/source/shared_lib/sources/platform/sdl/platform_util.cpp b/source/shared_lib/sources/platform/sdl/platform_util.cpp index b71878d1d..5905e9f7a 100644 --- a/source/shared_lib/sources/platform/sdl/platform_util.cpp +++ b/source/shared_lib/sources/platform/sdl/platform_util.cpp @@ -361,7 +361,7 @@ string PlatformExceptionHandler::getStackTrace() { return errMsg; } -megaglest_runtime_error::megaglest_runtime_error(const string& __arg,bool noStackTrace) +game_runtime_error::game_runtime_error(const string& __arg,bool noStackTrace) : std::runtime_error(noStackTrace == false ? __arg + PlatformExceptionHandler::getStackTrace() : __arg), noStackTrace(noStackTrace) { } diff --git a/source/shared_lib/sources/platform/sdl/thread.cpp b/source/shared_lib/sources/platform/sdl/thread.cpp index 4f4fd311f..c4fea7bc2 100644 --- a/source/shared_lib/sources/platform/sdl/thread.cpp +++ b/source/shared_lib/sources/platform/sdl/thread.cpp @@ -127,7 +127,7 @@ namespace Shared { char szBuf[8096] = ""; snprintf(szBuf, 8095, "In [%s::%s Line: %d] cannot delete active thread: getRunningStatus(): %d getExecutingTask: %d\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, base_thread->getRunningStatus(), base_thread->getExecutingTask()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } @@ -174,7 +174,7 @@ namespace Shared { /*if (this != cleanupThread.get()) { char szBuf[8096] = ""; snprintf(szBuf, 8095, "In [%s::%s Line: %d] iterFind == Thread::threadList.end() Thread::threadList.size() = %ld", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, Thread::threadList.size()); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); }*/ } else { Thread::threadList.erase(iterFind); @@ -296,7 +296,7 @@ namespace Shared { char szBuf[8096] = ""; snprintf(szBuf, 8095, "In [%s::%s Line: %d] thread == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (Thread::getEnableVerboseMode()) printf("In Thread::execute Line: %d\n", __LINE__); @@ -319,7 +319,7 @@ namespace Shared { snprintf(szBuf, 8095, "In [%s::%s Line: %d] thread == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); printf("%s", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } MutexSafeWrapper safeMutex(thread->mutexthreadAccessor); @@ -499,7 +499,7 @@ namespace Shared { if (this->mutex == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8095, "In [%s::%s Line: %d] mutex == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } this->deleteownerId = ""; @@ -523,7 +523,7 @@ namespace Shared { std::vector::iterator iterFind = std::find(Mutex::mutexList.begin(), Mutex::mutexList.end(), this); if (iterFind == Mutex::mutexList.end()) { printf("In [%s::%s Line: %d] iterFind == Mutex::mutexList.end()", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); } Mutex::mutexList.erase(iterFind); safeMutexX.ReleaseLock(); @@ -532,11 +532,11 @@ namespace Shared { SDLMutexSafeWrapper safeMutex(&mutexAccessor, true); if (mutex == NULL) { printf("In [%s::%s Line: %d] mutex == NULL refCount = %d owner [%s] deleteownerId [%s]", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, refCount, ownerId.c_str(), deleteownerId.c_str()); - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); //printf("%s\n",szBuf); } else if (refCount >= 1) { printf("In [%s::%s Line: %d] about to destroy mutex refCount = %d owner [%s] deleteownerId [%s]", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, refCount, ownerId.c_str(), deleteownerId.c_str()); - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); } if (debugMutexLock == true) { @@ -561,7 +561,7 @@ namespace Shared { // string stack = PlatformExceptionHandler::getStackTrace(); // char szBuf[8096]=""; // snprintf(szBuf,8095,"In [%s::%s Line: %d] mutex == NULL refCount = %d owner [%s] deleteownerId [%s] stack: %s",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,refCount,ownerId.c_str(),deleteownerId.c_str(),stack.c_str()); - // throw megaglest_runtime_error(szBuf); + // throw game_runtime_error(szBuf); // } // std::auto_ptr chronoLockPerf; // if(debugMutexLock == true) { @@ -585,7 +585,7 @@ namespace Shared { // if(mutex == NULL) { // char szBuf[8096]=""; // snprintf(szBuf,8095,"In [%s::%s Line: %d] mutex == NULL refCount = %d owner [%s] deleteownerId [%s]",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,refCount,ownerId.c_str(),deleteownerId.c_str()); - // throw megaglest_runtime_error(szBuf); + // throw game_runtime_error(szBuf); // } refCount--; @@ -612,14 +612,14 @@ namespace Shared { if (semaphore == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8095, "In [%s::%s Line: %d] semaphore == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } } Semaphore::~Semaphore() { if (semaphore == NULL) { printf("In [%s::%s Line: %d] semaphore == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); } SDL_DestroySemaphore(semaphore); semaphore = NULL; @@ -629,7 +629,7 @@ namespace Shared { if (semaphore == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8095, "In [%s::%s Line: %d] semaphore == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } SDL_SemPost(semaphore); } @@ -638,7 +638,7 @@ namespace Shared { if (semaphore == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8095, "In [%s::%s Line: %d] semaphore == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } int semValue = 0; if (waitMilliseconds >= 0) { @@ -653,7 +653,7 @@ namespace Shared { if (semaphore == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8095, "In [%s::%s Line: %d] semaphore == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } int semValue = SDL_SemTryWait(semaphore); return (semValue == 0); @@ -663,7 +663,7 @@ namespace Shared { if (semaphore == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8095, "In [%s::%s Line: %d] semaphore == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return SDL_SemValue(semaphore); @@ -673,7 +673,7 @@ namespace Shared { if (semaphore == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8095, "In [%s::%s Line: %d] semaphore == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } uint32 currentValue = SDL_SemValue(semaphore); @@ -726,7 +726,7 @@ namespace Shared { if (this->trigger == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8095, "In [%s::%s Line: %d] trigger == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (debugMasterSlaveThreadController) printf("In [%s::%s Line: %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); @@ -737,7 +737,7 @@ namespace Shared { if (trigger == NULL) { printf("In [%s::%s Line: %d] trigger == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - //throw megaglest_runtime_error(szBuf); + //throw game_runtime_error(szBuf); } if (debugMasterSlaveThreadController) printf("In [%s::%s Line: %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); @@ -757,7 +757,7 @@ namespace Shared { if (trigger == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8095, "In [%s::%s Line: %d] trigger == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } //MutexSafeWrapper safeMutex(mutex); @@ -789,12 +789,12 @@ namespace Shared { if (trigger == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8095, "In [%s::%s Line: %d] trigger == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (mutex == NULL) { char szBuf[8096] = ""; snprintf(szBuf, 8095, "In [%s::%s Line: %d] mutex == NULL", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } if (debugMasterSlaveThreadController) printf("In [%s::%s Line: %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); diff --git a/source/shared_lib/sources/platform/sdl/window.cpp b/source/shared_lib/sources/platform/sdl/window.cpp index c88935a6b..9bbf0bda6 100644 --- a/source/shared_lib/sources/platform/sdl/window.cpp +++ b/source/shared_lib/sources/platform/sdl/window.cpp @@ -489,11 +489,11 @@ namespace Shared { } catch (const char *e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] (a1) Couldn't process event: [%s] codeLocation = %s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, e, codeLocation.c_str()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d] (a1) Couldn't process event: [%s] codeLocation = %s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, e, codeLocation.c_str()); - throw megaglest_runtime_error(e); + throw game_runtime_error(e); } catch (const std::runtime_error& e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] (a2) Couldn't process event: [%s] codeLocation = %s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, e.what(), codeLocation.c_str()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d] (a2) Couldn't process event: [%s] codeLocation = %s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, e.what(), codeLocation.c_str()); - throw megaglest_runtime_error(e.what()); + throw game_runtime_error(e.what()); } catch (const std::exception& e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] (b) Couldn't process event: [%s] codeLocation = %s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, e.what(), codeLocation.c_str()); if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d] (b) Couldn't process event: [%s] codeLocation = %s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, e.what(), codeLocation.c_str()); @@ -755,7 +755,7 @@ namespace Shared { } } else { string sError = "Unsupported key name: [" + value + "]"; - throw megaglest_runtime_error(sError.c_str()); + throw game_runtime_error(sError.c_str()); } // Because SDL is based on lower Ascii diff --git a/source/shared_lib/sources/platform/win32/win32_factory_repository.cpp b/source/shared_lib/sources/platform/win32/win32_factory_repository.cpp index 8acd22abe..dea5b613c 100644 --- a/source/shared_lib/sources/platform/win32/win32_factory_repository.cpp +++ b/source/shared_lib/sources/platform/win32/win32_factory_repository.cpp @@ -38,7 +38,7 @@ namespace Shared { return &graphicsFactoryGl; } - throw megaglest_runtime_error("Unknown graphics factory: [" + name + "]"); + throw game_runtime_error("Unknown graphics factory: [" + name + "]"); } SoundFactory *FactoryRepository::getSoundFactory(const string &name) { @@ -48,7 +48,7 @@ namespace Shared { return &soundFactoryNone; } - throw megaglest_runtime_error("Unknown sound factory: [" + name + "]"); + throw game_runtime_error("Unknown sound factory: [" + name + "]"); } } diff --git a/source/shared_lib/sources/platform/win32/win32_platform_util.cpp b/source/shared_lib/sources/platform/win32/win32_platform_util.cpp index 9df9d0757..fb42cf887 100644 --- a/source/shared_lib/sources/platform/win32/win32_platform_util.cpp +++ b/source/shared_lib/sources/platform/win32/win32_platform_util.cpp @@ -275,7 +275,7 @@ namespace Shared { return result; } - megaglest_runtime_error::megaglest_runtime_error(const string& __arg, bool noStackTrace) + game_runtime_error::game_runtime_error(const string& __arg, bool noStackTrace) : std::runtime_error(noStackTrace == false ? __arg + PlatformExceptionHandler::getStackTrace() : __arg), noStackTrace(noStackTrace) { } diff --git a/source/shared_lib/sources/sound/openal/sound_player_openal.cpp b/source/shared_lib/sources/sound/openal/sound_player_openal.cpp index c15f022bc..c0448c472 100644 --- a/source/shared_lib/sources/sound/openal/sound_player_openal.cpp +++ b/source/shared_lib/sources/sound/openal/sound_player_openal.cpp @@ -601,7 +601,7 @@ namespace Shared { if (SystemFlags::getSystemSettingType(SystemFlags::debugSound).enabled) SystemFlags::OutputDebug(SystemFlags::debugSound, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", __FILE__, __FUNCTION__, __LINE__, ex.what()); printOpenALInfo(); - throw megaglest_runtime_error(ex.what()); + throw game_runtime_error(ex.what()); } catch (...) { if (SystemFlags::getSystemSettingType(SystemFlags::debugSound).enabled) SystemFlags::OutputDebug(SystemFlags::debugSound, "In [%s::%s Line: %d] UNKNOWN Error\n", __FILE__, __FUNCTION__, __LINE__); SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] UNKNOWN Error\n", __FILE__, __FUNCTION__, __LINE__); diff --git a/source/shared_lib/sources/sound/sound.cpp b/source/shared_lib/sources/sound/sound.cpp index 81f4f4fef..57e526158 100644 --- a/source/shared_lib/sources/sound/sound.cpp +++ b/source/shared_lib/sources/sound/sound.cpp @@ -91,7 +91,7 @@ namespace Shared { soundFileLoader = SoundFileLoaderFactory::getInstance()->newInstance(ext); if (soundFileLoader == NULL) { - throw megaglest_runtime_error("soundFileLoader == NULL"); + throw game_runtime_error("soundFileLoader == NULL"); } soundFileLoader->open(path, &info); samples = new int8[info.getSize()]; diff --git a/source/shared_lib/sources/sound/sound_file_loader.cpp b/source/shared_lib/sources/sound/sound_file_loader.cpp index 8704bc224..c46f4d5a1 100644 --- a/source/shared_lib/sources/sound/sound_file_loader.cpp +++ b/source/shared_lib/sources/sound/sound_file_loader.cpp @@ -49,7 +49,7 @@ namespace Shared { f.open(path.c_str(), ios_base::in | ios_base::binary); if (!f.is_open()) { - throw megaglest_runtime_error("Error opening wav file: " + string(path), true); + throw game_runtime_error("Error opening wav file: " + string(path), true); } //RIFF chunk - Id @@ -62,7 +62,7 @@ namespace Shared { } if (strcmp(chunkId, "RIFF") != 0) { - throw megaglest_runtime_error("Not a valid wav file (first four bytes are not RIFF):" + path, true); + throw game_runtime_error("Not a valid wav file (first four bytes are not RIFF):" + path, true); } //RIFF chunk - Size @@ -80,7 +80,7 @@ namespace Shared { } if (strcmp(chunkId, "WAVE") != 0) { - throw megaglest_runtime_error("Not a valid wav file (wave data don't start by WAVE): " + path, true); + throw game_runtime_error("Not a valid wav file (wave data don't start by WAVE): " + path, true); } // === HEADER === @@ -94,7 +94,7 @@ namespace Shared { } if (strcmp(chunkId, "fmt ") != 0) { - throw megaglest_runtime_error("Not a valid wav file (first sub-chunk Id is not fmt): " + path, true); + throw game_runtime_error("Not a valid wav file (first sub-chunk Id is not fmt): " + path, true); } //first sub-chunk (header) - Size @@ -148,7 +148,7 @@ namespace Shared { soundInfo->setBitRate(soundInfo->getSamplesPerSecond() * soundInfo->getChannels() * soundInfo->getBitsPerSample() / 8); if (soundInfo->getBitsPerSample() != 8 && soundInfo->getBitsPerSample() != 16) { - throw megaglest_runtime_error("Bits per sample must be 8 or 16: " + path, true); + throw game_runtime_error("Bits per sample must be 8 or 16: " + path, true); } bytesPerSecond = soundInfo->getBitsPerSample() * 8 * soundInfo->getSamplesPerSecond()*soundInfo->getChannels(); @@ -180,7 +180,7 @@ namespace Shared { } while (strncmp(chunkId, "data", 4) != 0 && count < maxDataRetryCount); if (f.bad() || count == maxDataRetryCount) { - throw megaglest_runtime_error("Error reading samples: " + path, true); + throw game_runtime_error("Error reading samples: " + path, true); } dataOffset = (uint32) f.tellg(); @@ -223,19 +223,19 @@ namespace Shared { f = fopen(path.c_str(), "rb"); #endif if (f == NULL) { - throw megaglest_runtime_error("Can't open ogg file: " + path, true); + throw game_runtime_error("Can't open ogg file: " + path, true); } vf = new OggVorbis_File(); if (vf == NULL) { - throw megaglest_runtime_error("Can't create ogg object for file: " + path, true); + throw game_runtime_error("Can't create ogg object for file: " + path, true); } ov_open(f, vf, NULL, 0); vorbis_info *vi = ov_info(vf, -1); if (vi == NULL) { - throw megaglest_runtime_error("Can't read ogg header info for file: " + path, true); + throw game_runtime_error("Can't read ogg header info for file: " + path, true); } uint32 samples = static_cast(ov_pcm_total(vf, -1)); diff --git a/source/shared_lib/sources/util/checksum.cpp b/source/shared_lib/sources/util/checksum.cpp index b2d8a914a..281d5586e 100644 --- a/source/shared_lib/sources/util/checksum.cpp +++ b/source/shared_lib/sources/util/checksum.cpp @@ -201,7 +201,7 @@ namespace Shared { } else { - throw megaglest_runtime_error("Can not open file: " + path); + throw game_runtime_error("Can not open file: " + path); } fclose(file); */ @@ -216,15 +216,15 @@ namespace Shared { const char *infile = path.c_str(); if ((fd = open(infile,O_RDONLY)) < 0) - throw megaglest_runtime_error("Can not open file: " + path); + throw game_runtime_error("Can not open file: " + path); if ((data = (int8 *)malloc(bytes_expected)) == NULL) - throw megaglest_runtime_error("malloc failed, Can not open file: " + path); + throw game_runtime_error("malloc failed, Can not open file: " + path); bytes_read = read(fd, data, bytes_expected); //if (bytes_read != bytes_expected) - // throw megaglest_runtime_error("read failed, Can not open file: " + path); + // throw game_runtime_error("read failed, Can not open file: " + path); for(int i = 0; i < bytes_read; i++) { addByte(data[i]); @@ -286,7 +286,7 @@ namespace Shared { } } else { - throw megaglest_runtime_error("Can not open file: " + path); + throw game_runtime_error("Can not open file: " + path); } fclose(file); */ diff --git a/source/shared_lib/sources/util/conversion.cpp b/source/shared_lib/sources/util/conversion.cpp index 65cb4d499..47b10d816 100644 --- a/source/shared_lib/sources/util/conversion.cpp +++ b/source/shared_lib/sources/util/conversion.cpp @@ -44,7 +44,7 @@ namespace Shared { if (s == "1" || s == "true") { return true; } - throw megaglest_runtime_error("Error converting string to bool, expected 0 or 1, found: [" + s + "]"); + throw game_runtime_error("Error converting string to bool, expected 0 or 1, found: [" + s + "]"); } int strToInt(const string &s) { @@ -53,7 +53,7 @@ namespace Shared { int intValue = strtol(s.c_str(), &endChar, 10); if (*endChar != '\0') { - throw megaglest_runtime_error("Error converting from string to int, found: [" + s + "]"); + throw game_runtime_error("Error converting from string to int, found: [" + s + "]"); } return intValue; @@ -65,7 +65,7 @@ namespace Shared { uint32 intValue = strtoul(s.c_str(), &endChar, 10); if (*endChar != '\0') { - throw megaglest_runtime_error("Error converting from string to uint, found: [" + s + "]"); + throw game_runtime_error("Error converting from string to uint, found: [" + s + "]"); } return intValue; @@ -79,7 +79,7 @@ namespace Shared { float floatValue = static_cast(strtod(s.c_str(), &endChar)); if (*endChar != '\0') { - throw megaglest_runtime_error("Error converting from string to float, found: [" + s + "]"); + throw game_runtime_error("Error converting from string to float, found: [" + s + "]"); } return floatValue; diff --git a/source/shared_lib/sources/util/profiler.cpp b/source/shared_lib/sources/util/profiler.cpp index 4ff797ba5..81c9a9a36 100644 --- a/source/shared_lib/sources/util/profiler.cpp +++ b/source/shared_lib/sources/util/profiler.cpp @@ -97,7 +97,7 @@ namespace Shared { FILE *f = fopen(profileLog.c_str(), "w"); #endif if (f == NULL) - throw megaglest_runtime_error("Can not open file: " + profileLog); + throw game_runtime_error("Can not open file: " + profileLog); fprintf(f, "Profiler Results\n\n"); @@ -127,7 +127,7 @@ namespace Shared { currSection->stop(); currSection = currSection->getParent(); } else { - throw megaglest_runtime_error("Profile: Leaving section is not current section: " + name); + throw game_runtime_error("Profile: Leaving section is not current section: " + name); } } diff --git a/source/shared_lib/sources/util/properties.cpp b/source/shared_lib/sources/util/properties.cpp index a8da6e4bc..613074692 100644 --- a/source/shared_lib/sources/util/properties.cpp +++ b/source/shared_lib/sources/util/properties.cpp @@ -83,7 +83,7 @@ namespace Shared { if (fileStream.is_open() == false) { if (SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem, "In [%s::%s Line: %d] path = [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, path.c_str()); - throw megaglest_runtime_error("File NOT FOUND, can't open file: [" + path + "]"); + throw game_runtime_error("File NOT FOUND, can't open file: [" + path + "]"); } if (clearCurrentProperties == true) { @@ -471,7 +471,7 @@ namespace Shared { return strToBool(getString(key, defaultValueIfNotFound)); } catch (exception &e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, e.what()); - //throw megaglest_runtime_error("Error accessing value: " + key + " in: " + path+"\n[" + e.what() + "]"); + //throw game_runtime_error("Error accessing value: " + key + " in: " + path+"\n[" + e.what() + "]"); throw runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]"); } return false; @@ -482,7 +482,7 @@ namespace Shared { return strToInt(getString(key, defaultValueIfNotFound)); } catch (exception &e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, e.what()); - //throw megaglest_runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]"); + //throw game_runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]"); throw runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]"); } return 0; @@ -491,7 +491,7 @@ namespace Shared { int Properties::getInt(const string &key, int min, int max, const char *defaultValueIfNotFound) const { int i = getInt(key, defaultValueIfNotFound); if (imax) { - throw megaglest_runtime_error("Value out of range: " + key + ", min: " + intToStr(min) + ", max: " + intToStr(max)); + throw game_runtime_error("Value out of range: " + key + ", min: " + intToStr(min) + ", max: " + intToStr(max)); } return i; } @@ -502,7 +502,7 @@ namespace Shared { result = strToFloat(getString(key, defaultValueIfNotFound)); } catch (exception &e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, e.what()); - //throw megaglest_runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]"); + //throw game_runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]"); throw runtime_error("Error accessing value: " + key + " in: " + path + "\n[" + e.what() + "]"); } return result; @@ -511,7 +511,7 @@ namespace Shared { float Properties::getFloat(const string &key, float min, float max, const char *defaultValueIfNotFound) const { float f = getFloat(key, defaultValueIfNotFound); if (fmax) { - throw megaglest_runtime_error("Value out of range: " + key + ", min: " + floatToStr(min, 16) + ", max: " + floatToStr(max, 16)); + throw game_runtime_error("Value out of range: " + key + ", min: " + floatToStr(min, 16) + ", max: " + floatToStr(max, 16)); } return f; } @@ -591,7 +591,7 @@ namespace Shared { return strToBool(getString(key, defaultValueIfNotFound)); } catch (exception &e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, e.what()); - //throw megaglest_runtime_error("Error accessing value: " + string(key) + " in: " + path+"\n[" + e.what() + "]"); + //throw game_runtime_error("Error accessing value: " + string(key) + " in: " + path+"\n[" + e.what() + "]"); throw runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]"); } return false; @@ -602,7 +602,7 @@ namespace Shared { return strToInt(getString(key, defaultValueIfNotFound)); } catch (exception &e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, e.what()); - //throw megaglest_runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]"); + //throw game_runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]"); throw runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]"); } return 0; @@ -614,7 +614,7 @@ namespace Shared { result = strToFloat(getString(key, defaultValueIfNotFound)); } catch (exception &e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error [%s]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, e.what()); - //throw megaglest_runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]"); + //throw game_runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]"); throw runtime_error("Error accessing value: " + string(key) + " in: " + path + "\n[" + e.what() + "]"); } return result; diff --git a/source/shared_lib/sources/util/randomgen.cpp b/source/shared_lib/sources/util/randomgen.cpp index f1898ebff..3d3f60b1d 100644 --- a/source/shared_lib/sources/util/randomgen.cpp +++ b/source/shared_lib/sources/util/randomgen.cpp @@ -81,7 +81,7 @@ namespace Shared { if (min > max) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s Line: %d] min > max, min = %d, max = %d", __FILE__, __FUNCTION__, __LINE__, min, max); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } int diff = max - min; @@ -90,7 +90,7 @@ namespace Shared { if (res < min || res > max) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s Line: %d] res < min || res > max, min = %d, max = %d, res = %d", __FILE__, __FUNCTION__, __LINE__, min, max, res); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return res; } @@ -99,7 +99,7 @@ namespace Shared { if (min > max) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s Line: %d] min > max, min = %f, max = %f", __FILE__, __FUNCTION__, __LINE__, min, max); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } float rand01 = static_cast(this->rand(lastCaller)) / (m - 1); @@ -109,7 +109,7 @@ namespace Shared { if (res < min || res > max) { char szBuf[8096] = ""; snprintf(szBuf, 8096, "In [%s::%s Line: %d] res < min || res > max, min = %f, max = %f, res = %f", __FILE__, __FUNCTION__, __LINE__, min, max, res); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return res; } diff --git a/source/shared_lib/sources/util/util.cpp b/source/shared_lib/sources/util/util.cpp index 7a6c8224c..3859636dc 100644 --- a/source/shared_lib/sources/util/util.cpp +++ b/source/shared_lib/sources/util/util.cpp @@ -235,7 +235,7 @@ namespace Shared { if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); if (threadLogger == NULL && SystemFlags::SHUTDOWN_PROGRAM_MODE == true) { - //throw megaglest_runtime_error("threadLogger == NULL && SystemFlags::SHUTDOWN_PROGRAM_MODE == true"); + //throw game_runtime_error("threadLogger == NULL && SystemFlags::SHUTDOWN_PROGRAM_MODE == true"); if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ERROR threadLogger == NULL && SystemFlags::SHUTDOWN_PROGRAM_MODE == true\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); //static SystemFlagsType *result = new SystemFlagsType(); static SystemFlags::SystemFlagsType result; @@ -253,7 +253,7 @@ namespace Shared { if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); if (threadLogger == NULL && SystemFlags::SHUTDOWN_PROGRAM_MODE == true) { - //throw megaglest_runtime_error("threadLogger == NULL && SystemFlags::SHUTDOWN_PROGRAM_MODE == true"); + //throw game_runtime_error("threadLogger == NULL && SystemFlags::SHUTDOWN_PROGRAM_MODE == true"); if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ERROR threadLogger == NULL && SystemFlags::SHUTDOWN_PROGRAM_MODE == true\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); return; } @@ -411,7 +411,7 @@ namespace Shared { if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d]\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); if (threadLogger == NULL && SystemFlags::SHUTDOWN_PROGRAM_MODE == true) { - //throw megaglest_runtime_error("threadLogger == NULL && SystemFlags::SHUTDOWN_PROGRAM_MODE == true"); + //throw game_runtime_error("threadLogger == NULL && SystemFlags::SHUTDOWN_PROGRAM_MODE == true"); if (SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] ERROR threadLogger == NULL && SystemFlags::SHUTDOWN_PROGRAM_MODE == true\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__); //return; } @@ -630,7 +630,7 @@ namespace Shared { } if (pos == string::npos) { - throw megaglest_runtime_error(string(extractFileFromDirectoryPath(__FILE__).c_str()) + " line: " + intToStr(__LINE__) + " pos == string::npos for [" + s + "]"); + throw game_runtime_error(string(extractFileFromDirectoryPath(__FILE__).c_str()) + " line: " + intToStr(__LINE__) + " pos == string::npos for [" + s + "]"); } if (pos + 1 == s.length() && s.length() > 0 && @@ -665,7 +665,7 @@ namespace Shared { } if (pos != string::npos) { - //throw megaglest_runtime_error(string(extractFileFromDirectoryPath(__FILE__).c_str()) + " line: " + intToStr(__LINE__) + " pos == string::npos for [" + s + "]"); + //throw game_runtime_error(string(extractFileFromDirectoryPath(__FILE__).c_str()) + " line: " + intToStr(__LINE__) + " pos == string::npos for [" + s + "]"); //} return (s.substr(0, pos)); @@ -676,7 +676,7 @@ namespace Shared { string cutLastExt(const string &s) { size_t i = s.find_last_of('.'); if (i != string::npos) { - //throw megaglest_runtime_error(string(extractFileFromDirectoryPath(__FILE__).c_str()) + " line: " + intToStr(__LINE__) + " i==string::npos for [" + s + "]"); + //throw game_runtime_error(string(extractFileFromDirectoryPath(__FILE__).c_str()) + " line: " + intToStr(__LINE__) + " i==string::npos for [" + s + "]"); //} return (s.substr(0, i)); @@ -690,7 +690,7 @@ namespace Shared { i = s.find_last_of('.') + 1; if (i != string::npos) { - //throw megaglest_runtime_error(string(extractFileFromDirectoryPath(__FILE__).c_str()) + " line: " + intToStr(__LINE__) + " i==string::npos for [" + s + "]"); + //throw game_runtime_error(string(extractFileFromDirectoryPath(__FILE__).c_str()) + " line: " + intToStr(__LINE__) + " i==string::npos for [" + s + "]"); //} return (s.substr(i, s.size() - i)); } diff --git a/source/shared_lib/sources/xml/xml_parser.cpp b/source/shared_lib/sources/xml/xml_parser.cpp index 725e9931f..c515225f1 100644 --- a/source/shared_lib/sources/xml/xml_parser.cpp +++ b/source/shared_lib/sources/xml/xml_parser.cpp @@ -79,7 +79,7 @@ namespace Shared { XMLString::transcode(domError.getMessage(), msgStr, strSize - 1); XMLString::transcode(domError.getLocation()->getURI(), fileStr, strSize - 1); Shared::Platform::uint64 lineNumber = domError.getLocation()->getLineNumber(); - throw megaglest_runtime_error("Error parsing XML, file: " + string(fileStr) + ", line: " + intToStr(lineNumber) + ": " + string(msgStr)); + throw game_runtime_error("Error parsing XML, file: " + string(fileStr) + ", line: " + intToStr(lineNumber) + ": " + string(msgStr)); } return true; } @@ -105,7 +105,7 @@ namespace Shared { XmlIo::initialized = true; } catch (const XMLException &e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error initializing XML system, msg %s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, e.getMessage()); - throw megaglest_runtime_error("Error initializing XML system"); + throw game_runtime_error("Error initializing XML system"); } try { @@ -115,7 +115,7 @@ namespace Shared { implementation = DOMImplementationRegistry::getDOMImplementation(str); } catch (const DOMException &ex) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Exception while creating XML parser, msg: %s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, ex.getMessage()); - throw megaglest_runtime_error("Exception while creating XML parser"); + throw game_runtime_error("Exception while creating XML parser"); } } @@ -209,7 +209,7 @@ namespace Shared { } #endif if (document == NULL) { - throw megaglest_runtime_error("Can not parse URL: " + path); + throw game_runtime_error("Can not parse URL: " + path); } DOMNode *rootNode = document->getDocumentElement(); @@ -219,7 +219,7 @@ namespace Shared { snprintf(szBuf, 8096, "In [%s::%s Line: %d] Exception while loading: [%s], msg:\n%s", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, path.c_str(), XMLString::transcode(ex.msg)); SystemFlags::OutputDebug(SystemFlags::debugError, "%s\n", szBuf); - throw megaglest_runtime_error(szBuf); + throw game_runtime_error(szBuf); } return NULL; } @@ -244,7 +244,7 @@ namespace Shared { } SystemFlags::OutputDebug(SystemFlags::debugError, "%s\n", szBuf); - throw megaglest_runtime_error(szBuf, skipStackTrace); + throw game_runtime_error(szBuf, skipStackTrace); } return NULL; } @@ -254,7 +254,7 @@ namespace Shared { try { if (node == NULL) { - throw megaglest_runtime_error("node == NULL during save!"); + throw game_runtime_error("node == NULL during save!"); } XMLCh str[strSize]; XMLString::transcode(node->getName().c_str(), str, strSize - 1); @@ -294,7 +294,7 @@ namespace Shared { document->release(); } catch (const DOMException &e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Exception while saving: [%s], %s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, path.c_str(), XMLString::transcode(e.msg)); - throw megaglest_runtime_error("Exception while saving: " + path + ": " + XMLString::transcode(e.msg)); + throw game_runtime_error("Exception while saving: " + path + ": " + XMLString::transcode(e.msg)); } } @@ -312,7 +312,7 @@ namespace Shared { XmlIoRapid::initialized = true; } catch (const exception &e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Error initializing XML system, msg %s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, e.what()); - throw megaglest_runtime_error("Error initializing XML system"); + throw game_runtime_error("Error initializing XML system"); } } @@ -351,7 +351,7 @@ namespace Shared { try { if (folderExists(path) == true) { - throw megaglest_runtime_error("Can not open file: [" + path + "] as it is a folder!", true); + throw game_runtime_error("Can not open file: [" + path + "] as it is a folder!", true); } #if defined(WIN32) && !defined(__MINGW32__) @@ -361,7 +361,7 @@ namespace Shared { ifstream xmlFile(path.c_str(), ios::binary); #endif if (xmlFile.is_open() == false) { - throw megaglest_runtime_error("Can not open file: [" + path + "]", true); + throw game_runtime_error("Can not open file: [" + path + "]", true); } if (showPerfStats) printf("In [%s::%s Line: %d] took msecs: " MG_I64_SPECIFIER "\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, chrono.getMillis()); @@ -383,7 +383,7 @@ namespace Shared { if (showPerfStats) printf("In [%s::%s Line: %d] took msecs: " MG_I64_SPECIFIER "\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, chrono.getMillis()); if (file_size <= 0) { - throw megaglest_runtime_error("Invalid file size for file: [" + path + "] size = " + intToStr(file_size)); + throw game_runtime_error("Invalid file size for file: [" + path + "] size = " + intToStr(file_size)); } //printf("File size is: " MG_I64_SPECIFIER " for [%s]\n",file_size,path.c_str()); @@ -418,9 +418,9 @@ namespace Shared { } catch (parse_error& ex) { // char szBuf[8096]=""; // snprintf(szBuf,8096,"%s",ex.where()); - throw megaglest_runtime_error("Error loading XML: " + path + "\nMessage: " + ex.what(), true); - } catch (megaglest_runtime_error& ex) { - throw megaglest_runtime_error("Error loading XML: " + path + "\nMessage: " + ex.what(), !ex.wantStackTrace()); + throw game_runtime_error("Error loading XML: " + path + "\nMessage: " + ex.what(), true); + } catch (game_runtime_error& ex) { + throw game_runtime_error("Error loading XML: " + path + "\nMessage: " + ex.what(), !ex.wantStackTrace()); } catch (const exception &ex) { char szBuf[8096] = ""; @@ -431,7 +431,7 @@ namespace Shared { } SystemFlags::OutputDebug(SystemFlags::debugError, "%s\n", szBuf); - throw megaglest_runtime_error(szBuf, skipStackTrace); + throw game_runtime_error(szBuf, skipStackTrace); } //if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] took msecs: %ld for file [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,chrono.getMillis(),path.c_str()); @@ -443,7 +443,7 @@ namespace Shared { void XmlIoRapid::save(const string &path, const XmlNode *node) { try { if (node == NULL) { - throw megaglest_runtime_error("node == NULL during save!"); + throw game_runtime_error("node == NULL during save!"); } xml_document<> doc; @@ -488,7 +488,7 @@ namespace Shared { ofstream xmlFile(path.c_str(), ios::binary); #endif if (xmlFile.is_open() == false) { - throw megaglest_runtime_error("Can not open file: [" + path + "]"); + throw game_runtime_error("Can not open file: [" + path + "]"); } //xmlFile << xml_no_indent; @@ -502,7 +502,7 @@ namespace Shared { #endif } catch (const exception &e) { SystemFlags::OutputDebug(SystemFlags::debugError, "In [%s::%s Line: %d] Exception while saving: [%s], %s\n", extractFileFromDirectoryPath(__FILE__).c_str(), __FUNCTION__, __LINE__, path.c_str(), e.what()); - throw megaglest_runtime_error("Exception while saving [" + path + "] msg: " + e.what()); + throw game_runtime_error("Exception while saving [" + path + "] msg: " + e.what()); } } @@ -521,7 +521,7 @@ namespace Shared { break; default: - throw megaglest_runtime_error("Invalid XML parser engine: " + intToStr((int) engine_type)); + throw game_runtime_error("Invalid XML parser engine: " + intToStr((int) engine_type)); } this->engine_type = engine_type; @@ -558,7 +558,7 @@ namespace Shared { for (LoadStack::iterator it = loadStack.begin(); it != loadStack.end(); ++it) { if ((*it)->loadPath == path) { - throw megaglest_runtime_error(path + " recursively included"); + throw game_runtime_error(path + " recursively included"); } } loadStack.push_back(this); @@ -621,7 +621,7 @@ namespace Shared { XmlNode::XmlNode(DOMNode *node, const std::map &mapTagReplacementValues) : superNode(NULL) { if (node == NULL || node->getNodeName() == NULL) { - throw megaglest_runtime_error("XML structure seems to be corrupt!", true); + throw game_runtime_error("XML structure seems to be corrupt!", true); } //get name @@ -671,7 +671,7 @@ namespace Shared { XmlNode::XmlNode(xml_node<> *node, const std::map &mapTagReplacementValues, bool skipUpdatePathClimbingParts) : superNode(NULL) { if (node == NULL || node->name() == NULL) { - throw megaglest_runtime_error("XML structure seems to be corrupt!", true); + throw game_runtime_error("XML structure seems to be corrupt!", true); } //get name @@ -736,7 +736,7 @@ namespace Shared { XmlAttribute *XmlNode::getAttribute(unsigned int i) const { if (i >= attributes.size()) { - throw megaglest_runtime_error(getName() + " node doesn't have " + uIntToStr(i) + " attributes", true); + throw game_runtime_error(getName() + " node doesn't have " + uIntToStr(i) + " attributes", true); } return attributes[i]; } @@ -748,7 +748,7 @@ namespace Shared { } } if (mustExist == true) { - throw megaglest_runtime_error("\"" + getName() + "\" node doesn't have a attribute named \"" + name + "\"", true); + throw game_runtime_error("\"" + getName() + "\" node doesn't have a attribute named \"" + name + "\"", true); } return NULL; @@ -780,7 +780,7 @@ namespace Shared { XmlNode *XmlNode::getChild(unsigned int i) const { assert(!superNode); if (i >= children.size()) { - throw megaglest_runtime_error("\"" + getName() + "\" node doesn't have " + uIntToStr(i + 1) + " children", true); + throw game_runtime_error("\"" + getName() + "\" node doesn't have " + uIntToStr(i + 1) + " children", true); } return children[i]; } @@ -801,7 +801,7 @@ namespace Shared { return superNode->getChild(childName, i); } if (i >= children.size()) { - throw megaglest_runtime_error("\"" + name + "\" node doesn't have " + uIntToStr(i + 1) + " children named \"" + childName + "\"\n\nTree: " + getTreeString(), true); + throw game_runtime_error("\"" + name + "\" node doesn't have " + uIntToStr(i + 1) + " children named \"" + childName + "\"\n\nTree: " + getTreeString(), true); } unsigned int count = 0; @@ -814,7 +814,7 @@ namespace Shared { } } - throw megaglest_runtime_error("Node \"" + getName() + "\" doesn't have " + uIntToStr(i + 1) + " children named \"" + childName + "\"\n\nTree: " + getTreeString(), true); + throw game_runtime_error("Node \"" + getName() + "\" doesn't have " + uIntToStr(i + 1) + " children named \"" + childName + "\"\n\nTree: " + getTreeString(), true); } bool XmlNode::hasChildNoSuper(const string &childName) const { @@ -833,7 +833,7 @@ namespace Shared { return superNode->getChild(childName, childIndex); } if (childIndex >= children.size()) { - throw megaglest_runtime_error("\"" + name + "\" node doesn't have " + intToStr(childIndex + 1) + " children named \"" + childName + "\"\n\nTree: " + getTreeString(), true); + throw game_runtime_error("\"" + name + "\" node doesn't have " + intToStr(childIndex + 1) + " children named \"" + childName + "\"\n\nTree: " + getTreeString(), true); } unsigned int count = 0; @@ -847,7 +847,7 @@ namespace Shared { } } - throw megaglest_runtime_error("Node \"" + getName() + "\" doesn't have " + intToStr(childIndex + 1) + " children named \"" + (childNameList.empty() ? "?" : childNameList[0]) + "\"\n\nTree: " + getTreeString(), true); + throw game_runtime_error("Node \"" + getName() + "\" doesn't have " + intToStr(childIndex + 1) + " children named \"" + (childNameList.empty() ? "?" : childNameList[0]) + "\"\n\nTree: " + getTreeString(), true); } bool XmlNode::hasChildAtIndex(const string &childName, int i) const { @@ -966,7 +966,7 @@ namespace Shared { XmlAttribute::XmlAttribute(DOMNode *attribute, const std::map &mapTagReplacementValues) { if (attribute == NULL || attribute->getNodeName() == NULL) { - throw megaglest_runtime_error("XML attribute seems to be corrupt!"); + throw game_runtime_error("XML attribute seems to be corrupt!"); } skipRestrictionCheck = false; @@ -987,7 +987,7 @@ namespace Shared { XmlAttribute::XmlAttribute(xml_attribute<> *attribute, const std::map &mapTagReplacementValues) { if (attribute == NULL || attribute->name() == NULL) { - throw megaglest_runtime_error("XML attribute seems to be corrupt!"); + throw game_runtime_error("XML attribute seems to be corrupt!"); } skipRestrictionCheck = false; @@ -1025,7 +1025,7 @@ namespace Shared { } else if (value == "false") { return false; } else { - throw megaglest_runtime_error("Not a valid bool value (true or false): " + getName() + ": " + value, true); + throw game_runtime_error("Not a valid bool value (true or false): " + getName() + ": " + value, true); } } @@ -1040,7 +1040,7 @@ namespace Shared { int XmlAttribute::getIntValue(int min, int max) const { int i = strToInt(value); if (imax) { - throw megaglest_runtime_error("Xml Attribute int out of range: " + getName() + ": " + value, true); + throw game_runtime_error("Xml Attribute int out of range: " + getName() + ": " + value, true); } return i; } @@ -1053,7 +1053,7 @@ namespace Shared { float f = strToFloat(value); //printf("getFloatValue f = %.10f [%s]\n",f,value.c_str()); if (fmax) { - throw megaglest_runtime_error("Xml attribute float out of range: " + getName() + ": " + value, true); + throw game_runtime_error("Xml attribute float out of range: " + getName() + ": " + value, true); } return f; } @@ -1075,7 +1075,7 @@ namespace Shared { for (unsigned int i = 0; i < value.size(); ++i) { if (allowedCharacters.find(value[i]) == string::npos) { - throw megaglest_runtime_error( + throw game_runtime_error( string("The string \"" + value + "\" contains a character that is not allowed: \"") + value[i] + "\"\nFor portability reasons the only allowed characters in this field are: " + allowedCharacters, true); }