diff --git a/source/g3d_viewer/main.cpp b/source/g3d_viewer/main.cpp index 7dea4c187..bd321fd45 100644 --- a/source/g3d_viewer/main.cpp +++ b/source/g3d_viewer/main.cpp @@ -69,7 +69,7 @@ string fileFormat = "png"; namespace Glest { namespace Game { -string getGameReadWritePath(string lookupKey) { +string getGameReadWritePath(const string &lookupKey) { string path = ""; if(path == "" && getenv("GLESTHOME") != NULL) { path = safeCharPtrCopy(getenv("GLESTHOME"),8096); diff --git a/source/glest_game/facilities/components.cpp b/source/glest_game/facilities/components.cpp index 77ca6521c..fe581fa74 100644 --- a/source/glest_game/facilities/components.cpp +++ b/source/glest_game/facilities/components.cpp @@ -1018,9 +1018,9 @@ int GraphicScrollBar::getLength() const { return horizontal?getW():getH(); } -int GraphicScrollBar::getThickness() const { - return horizontal?getH():getW(); -} +//int GraphicScrollBar::getThickness() const { +// return horizontal?getH():getW(); +//} void GraphicScrollBar::arrangeComponents(vector &gcs) { if(getElementCount()!=0 ) { diff --git a/source/glest_game/facilities/components.h b/source/glest_game/facilities/components.h index f883512fb..f100ed4ee 100644 --- a/source/glest_game/facilities/components.h +++ b/source/glest_game/facilities/components.h @@ -414,7 +414,7 @@ public: bool getHorizontal() const {return horizontal;} int getLength() const; void setLength(int length) {horizontal?setW(length):setH(length);} - int getThickness() const; + //int getThickness() const; bool getLighted() const {return lighted;} diff --git a/source/glest_game/facilities/game_util.cpp b/source/glest_game/facilities/game_util.cpp index 8cb3d71f4..3c8b9063e 100644 --- a/source/glest_game/facilities/game_util.cpp +++ b/source/glest_game/facilities/game_util.cpp @@ -330,7 +330,7 @@ string getGameCustomCoreDataPath(string originalBasePath, string uniqueFilePath) return result; } -string getGameReadWritePath(string lookupKey) { +string getGameReadWritePath(const string &lookupKey) { string path = ""; if(lookupKey != "") { diff --git a/source/glest_game/facilities/game_util.h b/source/glest_game/facilities/game_util.h index aab72efc2..80a6391c5 100644 --- a/source/glest_game/facilities/game_util.h +++ b/source/glest_game/facilities/game_util.h @@ -51,7 +51,7 @@ string getCompileDateTime(); string formatString(string str); -string getGameReadWritePath(string lookupKey=""); +string getGameReadWritePath(const string &lookupKey=""); string getGameCustomCoreDataPath(string originalBasePath, string uniqueFilePath); bool upgradeFilesInTemp(); diff --git a/source/glest_game/game/console.cpp b/source/glest_game/game/console.cpp index 878d220d6..ac26f74d2 100644 --- a/source/glest_game/game/console.cpp +++ b/source/glest_game/game/console.cpp @@ -240,17 +240,17 @@ bool Console::isEmpty() { return lines.empty(); } -string Console::getLine(int i) const { - if(i < 0 || i >= (int)lines.size()) - throw megaglest_runtime_error("i >= Lines.size()"); - return lines[i].text; -} +//string Console::getLine(int i) const { +// if(i < 0 || i >= (int)lines.size()) +// throw megaglest_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()"); - return storedLines[i].text; -} +//string Console::getStoredLine(int i) const { +// if(i < 0 || i >= (int)storedLines.size()) +// throw megaglest_runtime_error("i >= storedLines.size()"); +// return storedLines[i].text; +//} ConsoleLineInfo Console::getLineItem(int i) const { if(i < 0 || i >= (int)lines.size()) diff --git a/source/glest_game/game/console.h b/source/glest_game/game/console.h index af8b7d3ff..cb9f7919d 100644 --- a/source/glest_game/game/console.h +++ b/source/glest_game/game/console.h @@ -117,8 +117,8 @@ public: void resetFonts(); - string getLine(int i) const; - string getStoredLine(int i) const; + //string getLine(int i) const; + //string getStoredLine(int i) const; ConsoleLineInfo getLineItem(int i) const; ConsoleLineInfo getStoredLineItem(int i) const; diff --git a/source/glest_game/global/core_data.cpp b/source/glest_game/global/core_data.cpp index d32655f06..72716e978 100644 --- a/source/glest_game/global/core_data.cpp +++ b/source/glest_game/global/core_data.cpp @@ -1143,16 +1143,16 @@ bool CoreData::hasMainMenuVideoFilename() const { return result; } -bool CoreData::hasBattleEndVideoFilename(bool won) const { - bool result = false; - if(won == true) { - result =(battleEndWinVideoFilename != ""); - } - else { - result =(battleEndLoseVideoFilename != ""); - } - return result; -} +//bool CoreData::hasBattleEndVideoFilename(bool won) const { +// bool result = false; +// if(won == true) { +// result =(battleEndWinVideoFilename != ""); +// } +// else { +// result =(battleEndLoseVideoFilename != ""); +// } +// return result; +//} void CoreData::registerFontChangedCallback(std::string entityName, FontChangedCallbackInterface *cb) { if(entityName == "") { diff --git a/source/glest_game/global/core_data.h b/source/glest_game/global/core_data.h index ab3d80f90..601dff7b9 100644 --- a/source/glest_game/global/core_data.h +++ b/source/glest_game/global/core_data.h @@ -227,7 +227,7 @@ public: bool hasIntroVideoFilenameFallback() const; string getBattleEndVideoFilename(bool won) const { return won == true ? battleEndWinVideoFilename : battleEndLoseVideoFilename; } - bool hasBattleEndVideoFilename(bool won) const; + //bool hasBattleEndVideoFilename(bool won) const; string getBattleEndVideoFilenameFallback(bool won) const { return won == true ? battleEndWinVideoFilenameFallback : battleEndLoseVideoFilenameFallback; } bool hasBattleEndVideoFilenameFallback(bool won) const; diff --git a/source/glest_game/global/lang.cpp b/source/glest_game/global/lang.cpp index 02bd588b7..3ef82adcf 100644 --- a/source/glest_game/global/lang.cpp +++ b/source/glest_game/global/lang.cpp @@ -210,9 +210,9 @@ void Lang::loadGameStringProperties(string uselanguage, Properties &properties, properties.load(languageFile); } -bool Lang::isUTF8Language() const { - return is_utf8_language; -} +//bool Lang::isUTF8Language() const { +// return is_utf8_language; +//} void Lang::loadScenarioStrings(string scenarioDir, string scenarioName, bool isTutorial) { if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] scenarioDir = [%s] scenarioName = [%s]\n",__FILE__,__FUNCTION__,__LINE__,scenarioDir.c_str(),scenarioName.c_str()); diff --git a/source/glest_game/global/lang.h b/source/glest_game/global/lang.h index e530cd02e..3b153ea2a 100644 --- a/source/glest_game/global/lang.h +++ b/source/glest_game/global/lang.h @@ -77,7 +77,7 @@ public: string getLanguage() const { return language; } bool isLanguageLocal(string compareLanguage) const; - bool isUTF8Language() const; + //bool isUTF8Language() const; string getDefaultLanguage() const; map getDiscoveredLanguageList(bool searchKeyIsLangName=false); diff --git a/source/glest_game/main/main.cpp b/source/glest_game/main/main.cpp index 5f9e8ade5..2b2cf46b7 100644 --- a/source/glest_game/main/main.cpp +++ b/source/glest_game/main/main.cpp @@ -3306,15 +3306,24 @@ Steam & initSteamInstance() { return *steamInstance; } -void setupSteamSettings(bool steamEnabled) { +void setupSteamSettings(bool steamEnabled, bool steamResetStats, bool debugEnabled) { Config &config = Config::getInstance(); config.setBool("SteamEnabled",steamEnabled,true); if(steamEnabled) { printf("*NOTE: Steam Integration Enabled.\n"); + + if(debugEnabled) { + printf("*NOTE: Steam Debugging Enabled.\n"); + } + Steam::setDebugEnabled(debugEnabled); + Steam &steam = initSteamInstance(); // For Debugging purposes: - //steam.resetStats(false); + if(steamResetStats) { + printf("*WARNING: Steam Stats / Achievements are being RESET by request!\n"); + steam.resetStats(true); + } string steamPlayerName = steam.userName(); string steamLang = steam.lang(); @@ -4560,7 +4569,9 @@ int glestMain(int argc, char** argv) { Config &config = Config::getInstance(); setupGameItemPaths(argc, argv, &config); - setupSteamSettings(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_STEAM])); + setupSteamSettings(hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_STEAM]), + hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_STEAM_RESET_STATS]), + hasCommandArgument(argc, argv,GAME_ARGS[GAME_ARG_STEAM_DEBUG])); if(config.getString("PlayerId","") == "") { char uuid_str[38]; diff --git a/source/glest_game/main/program.cpp b/source/glest_game/main/program.cpp index a26188639..8b54e60f3 100644 --- a/source/glest_game/main/program.cpp +++ b/source/glest_game/main/program.cpp @@ -963,9 +963,9 @@ void Program::startSoundSystem() { } } -void Program::resetSoundSystem() { - startSoundSystem(); -} +//void Program::resetSoundSystem() { +// startSoundSystem(); +//} //void Program::reInitGl() { // if(window != NULL) { diff --git a/source/glest_game/main/program.h b/source/glest_game/main/program.h index 954d5716d..6f2720c17 100644 --- a/source/glest_game/main/program.h +++ b/source/glest_game/main/program.h @@ -223,7 +223,7 @@ public: bool isInSpecialKeyCaptureEvent() { return programState->isInSpecialKeyCaptureEvent(); } //void reInitGl(); - void resetSoundSystem(); + //void resetSoundSystem(); void stopSoundSystem(); void startSoundSystem(); diff --git a/source/glest_game/menu/menu_state_masterserver.cpp b/source/glest_game/menu/menu_state_masterserver.cpp index b5d984639..39f371b15 100644 --- a/source/glest_game/menu/menu_state_masterserver.cpp +++ b/source/glest_game/menu/menu_state_masterserver.cpp @@ -614,7 +614,7 @@ void MenuStateMasterserver::mouseClick(int x, int y, MouseButton mouseButton){ else { MutexSafeWrapper safeMutex((updateFromMasterserverThread != NULL ? updateFromMasterserverThread->getMutexThreadObjectAccessor() : NULL),string(extractFileFromDirectoryPath(__FILE__).c_str()) + "_" + intToStr(__LINE__)); bool clicked=false; - if(!clicked && serverScrollBar.getElementCount()!=0){ + if(serverScrollBar.getElementCount() != 0) { for(int i = serverScrollBar.getVisibleStart(); i <= serverScrollBar.getVisibleEnd(); ++i) { if(serverLines[i]->buttonMouseClick(x, y)) { if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__); diff --git a/source/glest_game/network/connection_slot.cpp b/source/glest_game/network/connection_slot.cpp index 6242a4c8a..6dc7ad346 100644 --- a/source/glest_game/network/connection_slot.cpp +++ b/source/glest_game/network/connection_slot.cpp @@ -1460,12 +1460,12 @@ void ConnectionSlot::validateConnection() { } } -void ConnectionSlot::resetJoinGameInProgressFlags() { - this->gotIntro = false; - this->skipLagCheck = false; - this->joinGameInProgress = false; - this->ready = false; -} +//void ConnectionSlot::resetJoinGameInProgressFlags() { +// this->gotIntro = false; +// this->skipLagCheck = false; +// this->joinGameInProgress = false; +// this->ready = false; +//} void ConnectionSlot::setJoinGameInProgressFlags() { this->gotIntro = true; diff --git a/source/glest_game/network/connection_slot.h b/source/glest_game/network/connection_slot.h index 2f6cd6a09..e4168da6e 100644 --- a/source/glest_game/network/connection_slot.h +++ b/source/glest_game/network/connection_slot.h @@ -261,7 +261,7 @@ public: virtual void saveGame(XmlNode *rootNode) {}; - void resetJoinGameInProgressFlags(); + //void resetJoinGameInProgressFlags(); void setJoinGameInProgressFlags(); protected: diff --git a/source/glest_game/steam/steam.cpp b/source/glest_game/steam/steam.cpp index 4b874fd45..01371dc16 100644 --- a/source/glest_game/steam/steam.cpp +++ b/source/glest_game/steam/steam.cpp @@ -55,6 +55,7 @@ static std::string steamToIsoLang(const char *steamLang) { // SteamPrivate struct SteamPrivate { + static bool debugEnabled; std::map achievements; std::map stats; @@ -62,8 +63,7 @@ struct SteamPrivate { std::string lang; SteamPrivate() { - //printf("\ncreating private steam state container\n"); - + if(debugEnabled) printf("\nCreating private steam state container\n"); STEAMSHIM_getPersonaName(); STEAMSHIM_getCurrentGameLanguage(); STEAMSHIM_requestStats(); @@ -78,6 +78,10 @@ struct SteamPrivate { refreshAllStats(); } + static void setDebugEnabled(bool value) { + debugEnabled = value; + } + void refreshAllStats() { achievements.clear(); stats.clear(); @@ -162,52 +166,48 @@ struct SteamPrivate { switch (e->type) { case SHIMEVENT_GETACHIEVEMENT: - //printf("\nGot Shim event SHIMEVENT_GETACHIEVEMENT name [%s] value [%d] isOk = %d\n",e->name,e->ivalue,e->okay); + if(debugEnabled) printf("\nGot Shim event SHIMEVENT_GETACHIEVEMENT name [%s] value [%d] isOk = %d\n",e->name,e->ivalue,e->okay); if(e->okay) { updateAchievement(e->name, e->ivalue); } break; case SHIMEVENT_SETACHIEVEMENT: - //printf("\nGot Shim event SHIMEVENT_SETACHIEVEMENT for name [%s] value [%d] isOk = %d\n",e->name,e->ivalue,e->okay); + if(debugEnabled) printf("\nGot Shim event SHIMEVENT_SETACHIEVEMENT for name [%s] value [%d] isOk = %d\n",e->name,e->ivalue,e->okay); break; - case SHIMEVENT_GETPERSONANAME: - //printf("\nGot Shim event SHIMEVENT_GETPERSONANAME isOk = %d\n",e->okay); + if(debugEnabled) printf("\nGot Shim event SHIMEVENT_GETPERSONANAME isOk = %d value [%s]\n",e->okay,e->name); userName = e->name; break; case SHIMEVENT_GETCURRENTGAMELANGUAGE: - //printf("\nGot Shim event SHIMEVENT_GETCURRENTGAMELANGUAGE isOk = %d\n",e->okay); + if(debugEnabled) printf("\nGot Shim event SHIMEVENT_GETCURRENTGAMELANGUAGE isOk = %d value [%s]\n",e->okay,e->name); lang = steamToIsoLang(e->name); break; case SHIMEVENT_STATSRECEIVED: - //printf("\nGot Shim event SHIMEVENT_STATSRECEIVED isOk = %d\n",e->okay); + if(debugEnabled) printf("\nGot Shim event SHIMEVENT_STATSRECEIVED isOk = %d\n",e->okay); break; case SHIMEVENT_STATSSTORED: - //printf("\nGot Shim event SHIMEVENT_STATSSTORED isOk = %d\n",e->okay); + if(debugEnabled) printf("\nGot Shim event SHIMEVENT_STATSSTORED isOk = %d\n",e->okay); break; - case SHIMEVENT_GETSTATI: - //printf("\nGot Shim event SHIMEVENT_GETSTATI for stat [%s] value [%d] isOk = %d\n",e->name,e->ivalue,e->okay); + if(debugEnabled) printf("\nGot Shim event SHIMEVENT_GETSTATI for stat [%s] value [%d] isOk = %d\n",e->name,e->ivalue,e->okay); if(e->okay) { updateStat(e->name, e->ivalue); } break; case SHIMEVENT_GETSTATF: - //printf("\nGot Shim event SHIMEVENT_GETSTATF for stat [%s] value [%f] isOk = %d\n",e->name,e->fvalue,e->okay); + if(debugEnabled) printf("\nGot Shim event SHIMEVENT_GETSTATF for stat [%s] value [%f] isOk = %d\n",e->name,e->fvalue,e->okay); if(e->okay) { updateStat(e->name, e->fvalue); } break; - case SHIMEVENT_SETSTATI: - //printf("\nGot Shim event SHIMEVENT_SETSTATI for stat [%s] value [%d] isOk = %d\n",e->name,e->ivalue,e->okay); + if(debugEnabled) printf("\nGot Shim event SHIMEVENT_SETSTATI for stat [%s] value [%d] isOk = %d\n",e->name,e->ivalue,e->okay); break; case SHIMEVENT_SETSTATF: - //printf("\nGot Shim event SHIMEVENT_SETSTATF for stat [%s] value [%f] isOk = %d\n",e->name,e->fvalue,e->okay); + if(debugEnabled) printf("\nGot Shim event SHIMEVENT_SETSTATF for stat [%s] value [%f] isOk = %d\n",e->name,e->fvalue,e->okay); break; - default: - //printf("\nGot Shim event [%d] isOk = %d\n",e->type,e->okay); + if(debugEnabled) printf("\nGot Shim event [%d] isOk = %d\n",e->type,e->okay); break; } if(waitForEvent != NULL && *waitForEvent == e->type) { @@ -225,6 +225,8 @@ struct SteamPrivate { } }; +bool SteamPrivate::debugEnabled = false; + /* Steam */ Steam::Steam() : p(new SteamPrivate()) { } @@ -303,5 +305,8 @@ bool Steam::isUnlocked(const char *name) { return p->isAchievementSet(name); } +void Steam::setDebugEnabled(bool value) { + SteamPrivate::setDebugEnabled(value); +} }}//end namespace diff --git a/source/glest_game/steam/steam.h b/source/glest_game/steam/steam.h index b6eecb344..10b867719 100644 --- a/source/glest_game/steam/steam.h +++ b/source/glest_game/steam/steam.h @@ -71,6 +71,7 @@ public: void setStatAsDouble(const char *name, double value); void requestRefreshStats(); + static void setDebugEnabled(bool value); Steam(); ~Steam(); diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 9ac35861f..e36d2b8f9 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -1595,23 +1595,23 @@ Model *Unit::getCurrentModelPtr() { return result; } -const Model *Unit::getCurrentModel() { - 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); - } - - int currentModelIndexForCurrSkillType = lastModelIndexForCurrSkillType; - const Model *result = currSkill->getAnimation(getAnimProgressAsFloat(),this,&lastModelIndexForCurrSkillType, &animationRandomCycleCount); - if(currentModelIndexForCurrSkillType != lastModelIndexForCurrSkillType) { - animationRandomCycleCount++; - if(currSkill != NULL && animationRandomCycleCount >= currSkill->getAnimationCount()) { - animationRandomCycleCount = 0; - } - } - return result; -} +//const Model *Unit::getCurrentModel() { +// 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); +// } +// +// int currentModelIndexForCurrSkillType = lastModelIndexForCurrSkillType; +// const Model *result = currSkill->getAnimation(getAnimProgressAsFloat(),this,&lastModelIndexForCurrSkillType, &animationRandomCycleCount); +// if(currentModelIndexForCurrSkillType != lastModelIndexForCurrSkillType) { +// animationRandomCycleCount++; +// if(currSkill != NULL && animationRandomCycleCount >= currSkill->getAnimationCount()) { +// animationRandomCycleCount = 0; +// } +// } +// return result; +//} bool Unit::checkModelStateInfoForNewHpValue() { bool result = false; diff --git a/source/glest_game/type_instances/unit.h b/source/glest_game/type_instances/unit.h index 458a69df5..b854839ad 100644 --- a/source/glest_game/type_instances/unit.h +++ b/source/glest_game/type_instances/unit.h @@ -636,7 +636,7 @@ public: inline bool getVisible() const { return visible; } //render related - const Model *getCurrentModel(); + //const Model *getCurrentModel(); Model *getCurrentModelPtr(); Vec3f getCurrMidHeightVector() const; Vec3f getCurrVectorForParticlesystems() const; diff --git a/source/glest_game/types/upgrade_type.cpp b/source/glest_game/types/upgrade_type.cpp index 1a1f3b6b4..6b96c7874 100644 --- a/source/glest_game/types/upgrade_type.cpp +++ b/source/glest_game/types/upgrade_type.cpp @@ -448,104 +448,104 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{ return str; } -void UpgradeTypeBase::saveGameBoost(XmlNode *rootNode) const { - std::map mapTagReplacements; - XmlNode *upgradeTypeBaseNode = rootNode->addChild("UpgradeTypeBaseBoost"); - - upgradeTypeBaseNode->addAttribute("upgradename",upgradename, mapTagReplacements); - -// int maxHp; - upgradeTypeBaseNode->addAttribute("maxHp",intToStr(maxHp), mapTagReplacements); -// bool maxHpIsMultiplier; - upgradeTypeBaseNode->addAttribute("maxHpIsMultiplier",intToStr(maxHpIsMultiplier), mapTagReplacements); -// int maxHpRegeneration; - upgradeTypeBaseNode->addAttribute("maxHpRegeneration",intToStr(maxHpRegeneration), mapTagReplacements); -// //bool maxHpRegenerationIsMultiplier; +//void UpgradeTypeBase::saveGameBoost(XmlNode *rootNode) const { +// std::map mapTagReplacements; +// XmlNode *upgradeTypeBaseNode = rootNode->addChild("UpgradeTypeBaseBoost"); // -// int sight; - upgradeTypeBaseNode->addAttribute("sight",intToStr(sight), mapTagReplacements); -// bool sightIsMultiplier; - upgradeTypeBaseNode->addAttribute("sightIsMultiplier",intToStr(sightIsMultiplier), mapTagReplacements); -// int maxEp; - upgradeTypeBaseNode->addAttribute("maxEp",intToStr(maxEp), mapTagReplacements); -// bool maxEpIsMultiplier; - upgradeTypeBaseNode->addAttribute("maxEpIsMultiplier",intToStr(maxEpIsMultiplier), mapTagReplacements); -// int maxEpRegeneration; - upgradeTypeBaseNode->addAttribute("maxEpRegeneration",intToStr(maxEpRegeneration), mapTagReplacements); -// //bool maxEpRegenerationIsMultiplier; -// int armor; - upgradeTypeBaseNode->addAttribute("armor",intToStr(armor), mapTagReplacements); -// bool armorIsMultiplier; - upgradeTypeBaseNode->addAttribute("armorIsMultiplier",intToStr(armorIsMultiplier), mapTagReplacements); -// int attackStrength; - upgradeTypeBaseNode->addAttribute("attackStrength",intToStr(attackStrength), mapTagReplacements); -// bool attackStrengthIsMultiplier; - upgradeTypeBaseNode->addAttribute("attackStrengthIsMultiplier",intToStr(attackStrengthIsMultiplier), mapTagReplacements); -// std::map attackStrengthMultiplierValueList; - for(std::map::const_iterator iterMap = attackStrengthMultiplierValueList.begin(); - iterMap != attackStrengthMultiplierValueList.end(); ++iterMap) { - XmlNode *attackStrengthMultiplierValueListNode = upgradeTypeBaseNode->addChild("attackStrengthMultiplierValueList"); - - attackStrengthMultiplierValueListNode->addAttribute("key",iterMap->first, mapTagReplacements); - attackStrengthMultiplierValueListNode->addAttribute("value",intToStr(iterMap->second), mapTagReplacements); - } -// int attackRange; - upgradeTypeBaseNode->addAttribute("attackRange",intToStr(attackRange), mapTagReplacements); -// bool attackRangeIsMultiplier; - upgradeTypeBaseNode->addAttribute("attackRangeIsMultiplier",intToStr(attackRangeIsMultiplier), mapTagReplacements); -// std::map attackRangeMultiplierValueList; - for(std::map::const_iterator iterMap = attackRangeMultiplierValueList.begin(); - iterMap != attackRangeMultiplierValueList.end(); ++iterMap) { - XmlNode *attackRangeMultiplierValueListNode = upgradeTypeBaseNode->addChild("attackRangeMultiplierValueList"); - - attackRangeMultiplierValueListNode->addAttribute("key",iterMap->first, mapTagReplacements); - attackRangeMultiplierValueListNode->addAttribute("value",intToStr(iterMap->second), mapTagReplacements); - } - -// int moveSpeed; - upgradeTypeBaseNode->addAttribute("moveSpeed",intToStr(moveSpeed), mapTagReplacements); -// bool moveSpeedIsMultiplier; - upgradeTypeBaseNode->addAttribute("moveSpeedIsMultiplier",intToStr(moveSpeedIsMultiplier), mapTagReplacements); -// std::map moveSpeedIsMultiplierValueList; - for(std::map::const_iterator iterMap = moveSpeedIsMultiplierValueList.begin(); - iterMap != moveSpeedIsMultiplierValueList.end(); ++iterMap) { - XmlNode *moveSpeedIsMultiplierValueListNode = upgradeTypeBaseNode->addChild("moveSpeedIsMultiplierValueList"); - - moveSpeedIsMultiplierValueListNode->addAttribute("key",iterMap->first, mapTagReplacements); - moveSpeedIsMultiplierValueListNode->addAttribute("value",intToStr(iterMap->second), mapTagReplacements); - } - -// int prodSpeed; - upgradeTypeBaseNode->addAttribute("prodSpeed",intToStr(prodSpeed), mapTagReplacements); -// bool prodSpeedIsMultiplier; - upgradeTypeBaseNode->addAttribute("prodSpeedIsMultiplier",intToStr(prodSpeedIsMultiplier), mapTagReplacements); -// std::map prodSpeedProduceIsMultiplierValueList; - for(std::map::const_iterator iterMap = prodSpeedProduceIsMultiplierValueList.begin(); - iterMap != prodSpeedProduceIsMultiplierValueList.end(); ++iterMap) { - XmlNode *prodSpeedProduceIsMultiplierValueListNode = upgradeTypeBaseNode->addChild("prodSpeedProduceIsMultiplierValueList"); - - prodSpeedProduceIsMultiplierValueListNode->addAttribute("key",iterMap->first, mapTagReplacements); - prodSpeedProduceIsMultiplierValueListNode->addAttribute("value",intToStr(iterMap->second), mapTagReplacements); - } - -// std::map prodSpeedUpgradeIsMultiplierValueList; - for(std::map::const_iterator iterMap = prodSpeedUpgradeIsMultiplierValueList.begin(); - iterMap != prodSpeedUpgradeIsMultiplierValueList.end(); ++iterMap) { - XmlNode *prodSpeedUpgradeIsMultiplierValueListNode = upgradeTypeBaseNode->addChild("prodSpeedUpgradeIsMultiplierValueList"); - - prodSpeedUpgradeIsMultiplierValueListNode->addAttribute("key",iterMap->first, mapTagReplacements); - prodSpeedUpgradeIsMultiplierValueListNode->addAttribute("value",intToStr(iterMap->second), mapTagReplacements); - } - -// std::map prodSpeedMorphIsMultiplierValueList; - for(std::map::const_iterator iterMap = prodSpeedMorphIsMultiplierValueList.begin(); - iterMap != prodSpeedMorphIsMultiplierValueList.end(); ++iterMap) { - XmlNode *prodSpeedMorphIsMultiplierValueListNode = upgradeTypeBaseNode->addChild("prodSpeedMorphIsMultiplierValueList"); - - prodSpeedMorphIsMultiplierValueListNode->addAttribute("key",iterMap->first, mapTagReplacements); - prodSpeedMorphIsMultiplierValueListNode->addAttribute("value",intToStr(iterMap->second), mapTagReplacements); - } -} +// upgradeTypeBaseNode->addAttribute("upgradename",upgradename, mapTagReplacements); +// +//// int maxHp; +// upgradeTypeBaseNode->addAttribute("maxHp",intToStr(maxHp), mapTagReplacements); +//// bool maxHpIsMultiplier; +// upgradeTypeBaseNode->addAttribute("maxHpIsMultiplier",intToStr(maxHpIsMultiplier), mapTagReplacements); +//// int maxHpRegeneration; +// upgradeTypeBaseNode->addAttribute("maxHpRegeneration",intToStr(maxHpRegeneration), mapTagReplacements); +//// //bool maxHpRegenerationIsMultiplier; +//// +//// int sight; +// upgradeTypeBaseNode->addAttribute("sight",intToStr(sight), mapTagReplacements); +//// bool sightIsMultiplier; +// upgradeTypeBaseNode->addAttribute("sightIsMultiplier",intToStr(sightIsMultiplier), mapTagReplacements); +//// int maxEp; +// upgradeTypeBaseNode->addAttribute("maxEp",intToStr(maxEp), mapTagReplacements); +//// bool maxEpIsMultiplier; +// upgradeTypeBaseNode->addAttribute("maxEpIsMultiplier",intToStr(maxEpIsMultiplier), mapTagReplacements); +//// int maxEpRegeneration; +// upgradeTypeBaseNode->addAttribute("maxEpRegeneration",intToStr(maxEpRegeneration), mapTagReplacements); +//// //bool maxEpRegenerationIsMultiplier; +//// int armor; +// upgradeTypeBaseNode->addAttribute("armor",intToStr(armor), mapTagReplacements); +//// bool armorIsMultiplier; +// upgradeTypeBaseNode->addAttribute("armorIsMultiplier",intToStr(armorIsMultiplier), mapTagReplacements); +//// int attackStrength; +// upgradeTypeBaseNode->addAttribute("attackStrength",intToStr(attackStrength), mapTagReplacements); +//// bool attackStrengthIsMultiplier; +// upgradeTypeBaseNode->addAttribute("attackStrengthIsMultiplier",intToStr(attackStrengthIsMultiplier), mapTagReplacements); +//// std::map attackStrengthMultiplierValueList; +// for(std::map::const_iterator iterMap = attackStrengthMultiplierValueList.begin(); +// iterMap != attackStrengthMultiplierValueList.end(); ++iterMap) { +// XmlNode *attackStrengthMultiplierValueListNode = upgradeTypeBaseNode->addChild("attackStrengthMultiplierValueList"); +// +// attackStrengthMultiplierValueListNode->addAttribute("key",iterMap->first, mapTagReplacements); +// attackStrengthMultiplierValueListNode->addAttribute("value",intToStr(iterMap->second), mapTagReplacements); +// } +//// int attackRange; +// upgradeTypeBaseNode->addAttribute("attackRange",intToStr(attackRange), mapTagReplacements); +//// bool attackRangeIsMultiplier; +// upgradeTypeBaseNode->addAttribute("attackRangeIsMultiplier",intToStr(attackRangeIsMultiplier), mapTagReplacements); +//// std::map attackRangeMultiplierValueList; +// for(std::map::const_iterator iterMap = attackRangeMultiplierValueList.begin(); +// iterMap != attackRangeMultiplierValueList.end(); ++iterMap) { +// XmlNode *attackRangeMultiplierValueListNode = upgradeTypeBaseNode->addChild("attackRangeMultiplierValueList"); +// +// attackRangeMultiplierValueListNode->addAttribute("key",iterMap->first, mapTagReplacements); +// attackRangeMultiplierValueListNode->addAttribute("value",intToStr(iterMap->second), mapTagReplacements); +// } +// +//// int moveSpeed; +// upgradeTypeBaseNode->addAttribute("moveSpeed",intToStr(moveSpeed), mapTagReplacements); +//// bool moveSpeedIsMultiplier; +// upgradeTypeBaseNode->addAttribute("moveSpeedIsMultiplier",intToStr(moveSpeedIsMultiplier), mapTagReplacements); +//// std::map moveSpeedIsMultiplierValueList; +// for(std::map::const_iterator iterMap = moveSpeedIsMultiplierValueList.begin(); +// iterMap != moveSpeedIsMultiplierValueList.end(); ++iterMap) { +// XmlNode *moveSpeedIsMultiplierValueListNode = upgradeTypeBaseNode->addChild("moveSpeedIsMultiplierValueList"); +// +// moveSpeedIsMultiplierValueListNode->addAttribute("key",iterMap->first, mapTagReplacements); +// moveSpeedIsMultiplierValueListNode->addAttribute("value",intToStr(iterMap->second), mapTagReplacements); +// } +// +//// int prodSpeed; +// upgradeTypeBaseNode->addAttribute("prodSpeed",intToStr(prodSpeed), mapTagReplacements); +//// bool prodSpeedIsMultiplier; +// upgradeTypeBaseNode->addAttribute("prodSpeedIsMultiplier",intToStr(prodSpeedIsMultiplier), mapTagReplacements); +//// std::map prodSpeedProduceIsMultiplierValueList; +// for(std::map::const_iterator iterMap = prodSpeedProduceIsMultiplierValueList.begin(); +// iterMap != prodSpeedProduceIsMultiplierValueList.end(); ++iterMap) { +// XmlNode *prodSpeedProduceIsMultiplierValueListNode = upgradeTypeBaseNode->addChild("prodSpeedProduceIsMultiplierValueList"); +// +// prodSpeedProduceIsMultiplierValueListNode->addAttribute("key",iterMap->first, mapTagReplacements); +// prodSpeedProduceIsMultiplierValueListNode->addAttribute("value",intToStr(iterMap->second), mapTagReplacements); +// } +// +//// std::map prodSpeedUpgradeIsMultiplierValueList; +// for(std::map::const_iterator iterMap = prodSpeedUpgradeIsMultiplierValueList.begin(); +// iterMap != prodSpeedUpgradeIsMultiplierValueList.end(); ++iterMap) { +// XmlNode *prodSpeedUpgradeIsMultiplierValueListNode = upgradeTypeBaseNode->addChild("prodSpeedUpgradeIsMultiplierValueList"); +// +// prodSpeedUpgradeIsMultiplierValueListNode->addAttribute("key",iterMap->first, mapTagReplacements); +// prodSpeedUpgradeIsMultiplierValueListNode->addAttribute("value",intToStr(iterMap->second), mapTagReplacements); +// } +// +//// std::map prodSpeedMorphIsMultiplierValueList; +// for(std::map::const_iterator iterMap = prodSpeedMorphIsMultiplierValueList.begin(); +// iterMap != prodSpeedMorphIsMultiplierValueList.end(); ++iterMap) { +// XmlNode *prodSpeedMorphIsMultiplierValueListNode = upgradeTypeBaseNode->addChild("prodSpeedMorphIsMultiplierValueList"); +// +// prodSpeedMorphIsMultiplierValueListNode->addAttribute("key",iterMap->first, mapTagReplacements); +// prodSpeedMorphIsMultiplierValueListNode->addAttribute("value",intToStr(iterMap->second), mapTagReplacements); +// } +//} void UpgradeTypeBase::saveGame(XmlNode *rootNode) const { std::map mapTagReplacements; @@ -646,105 +646,105 @@ void UpgradeTypeBase::saveGame(XmlNode *rootNode) const { // } } -void UpgradeTypeBase::loadGameBoost(const XmlNode *rootNode) { - const XmlNode *upgradeTypeBaseNode = rootNode->getChild("UpgradeTypeBaseBoost"); - - //description = upgradeTypeBaseNode->getAttribute("description")->getValue(); - - upgradename = upgradeTypeBaseNode->getAttribute("upgradename")->getValue(); - - // int maxHp; - maxHp = upgradeTypeBaseNode->getAttribute("maxHp")->getIntValue(); - // bool maxHpIsMultiplier; - maxHpIsMultiplier = (upgradeTypeBaseNode->getAttribute("maxHpIsMultiplier")->getIntValue() != 0); - // int maxHpRegeneration; - maxHpRegeneration = upgradeTypeBaseNode->getAttribute("maxHpRegeneration")->getIntValue(); - // //bool maxHpRegenerationIsMultiplier; - // - // int sight; - sight = upgradeTypeBaseNode->getAttribute("sight")->getIntValue(); - // bool sightIsMultiplier; - sightIsMultiplier = (upgradeTypeBaseNode->getAttribute("sightIsMultiplier")->getIntValue() != 0); - // int maxEp; - maxEp = upgradeTypeBaseNode->getAttribute("maxEp")->getIntValue(); - // bool maxEpIsMultiplier; - maxEpIsMultiplier = (upgradeTypeBaseNode->getAttribute("maxEpIsMultiplier")->getIntValue() != 0); - // int maxEpRegeneration; - maxEpRegeneration = upgradeTypeBaseNode->getAttribute("maxEpRegeneration")->getIntValue(); - // //bool maxEpRegenerationIsMultiplier; - // int armor; - armor = upgradeTypeBaseNode->getAttribute("armor")->getIntValue(); - // bool armorIsMultiplier; - armorIsMultiplier = (upgradeTypeBaseNode->getAttribute("armorIsMultiplier")->getIntValue() != 0); - // int attackStrength; - attackStrength = upgradeTypeBaseNode->getAttribute("attackStrength")->getIntValue(); - // bool attackStrengthIsMultiplier; - attackStrengthIsMultiplier = (upgradeTypeBaseNode->getAttribute("attackStrengthIsMultiplier")->getIntValue() != 0); - // std::map attackStrengthMultiplierValueList; - vector attackStrengthMultiplierValueNodeList = upgradeTypeBaseNode->getChildList("attackStrengthMultiplierValueList"); - for(unsigned int i = 0; i < attackStrengthMultiplierValueNodeList.size(); ++i) { - XmlNode *node = attackStrengthMultiplierValueNodeList[i]; - - attackStrengthMultiplierValueList[node->getAttribute("key")->getValue()] = - node->getAttribute("value")->getIntValue(); - } - // int attackRange; - attackRange = upgradeTypeBaseNode->getAttribute("attackRange")->getIntValue(); - // bool attackRangeIsMultiplier; - attackRangeIsMultiplier = (upgradeTypeBaseNode->getAttribute("attackRangeIsMultiplier")->getIntValue() != 0); - // std::map attackRangeMultiplierValueList; - vector attackRangeMultiplierValueNodeList = upgradeTypeBaseNode->getChildList("attackRangeMultiplierValueList"); - for(unsigned int i = 0; i < attackRangeMultiplierValueNodeList.size(); ++i) { - XmlNode *node = attackRangeMultiplierValueNodeList[i]; - - attackRangeMultiplierValueList[node->getAttribute("key")->getValue()] = - node->getAttribute("value")->getIntValue(); - } - - // int moveSpeed; - moveSpeed = upgradeTypeBaseNode->getAttribute("moveSpeed")->getIntValue(); - // bool moveSpeedIsMultiplier; - moveSpeedIsMultiplier = (upgradeTypeBaseNode->getAttribute("moveSpeedIsMultiplier")->getIntValue() != 0); - // std::map moveSpeedIsMultiplierValueList; - vector moveSpeedIsMultiplierValueNodeList = upgradeTypeBaseNode->getChildList("moveSpeedIsMultiplierValueList"); - for(unsigned int i = 0; i < moveSpeedIsMultiplierValueNodeList.size(); ++i) { - XmlNode *node = moveSpeedIsMultiplierValueNodeList[i]; - - moveSpeedIsMultiplierValueList[node->getAttribute("key")->getValue()] = - node->getAttribute("value")->getIntValue(); - } - - // int prodSpeed; - prodSpeed = upgradeTypeBaseNode->getAttribute("prodSpeed")->getIntValue(); - // bool prodSpeedIsMultiplier; - prodSpeedIsMultiplier = (upgradeTypeBaseNode->getAttribute("prodSpeedIsMultiplier")->getIntValue() != 0); - // std::map prodSpeedProduceIsMultiplierValueList; - vector prodSpeedProduceIsMultiplierValueNodeList = upgradeTypeBaseNode->getChildList("prodSpeedProduceIsMultiplierValueList"); - for(unsigned int i = 0; i < prodSpeedProduceIsMultiplierValueNodeList.size(); ++i) { - XmlNode *node = prodSpeedProduceIsMultiplierValueNodeList[i]; - - prodSpeedProduceIsMultiplierValueList[node->getAttribute("key")->getValue()] = - node->getAttribute("value")->getIntValue(); - } - - // std::map prodSpeedUpgradeIsMultiplierValueList; - vector prodSpeedUpgradeIsMultiplierValueNodeList = upgradeTypeBaseNode->getChildList("prodSpeedUpgradeIsMultiplierValueList"); - for(unsigned int i = 0; i < prodSpeedUpgradeIsMultiplierValueNodeList.size(); ++i) { - XmlNode *node = prodSpeedUpgradeIsMultiplierValueNodeList[i]; - - prodSpeedUpgradeIsMultiplierValueList[node->getAttribute("key")->getValue()] = - node->getAttribute("value")->getIntValue(); - } - - // std::map prodSpeedMorphIsMultiplierValueList; - vector prodSpeedMorphIsMultiplierValueNodeList = upgradeTypeBaseNode->getChildList("prodSpeedMorphIsMultiplierValueList"); - for(unsigned int i = 0; i < prodSpeedMorphIsMultiplierValueNodeList.size(); ++i) { - XmlNode *node = prodSpeedMorphIsMultiplierValueNodeList[i]; - - prodSpeedMorphIsMultiplierValueList[node->getAttribute("key")->getValue()] = - node->getAttribute("value")->getIntValue(); - } -} +//void UpgradeTypeBase::loadGameBoost(const XmlNode *rootNode) { +// const XmlNode *upgradeTypeBaseNode = rootNode->getChild("UpgradeTypeBaseBoost"); +// +// //description = upgradeTypeBaseNode->getAttribute("description")->getValue(); +// +// upgradename = upgradeTypeBaseNode->getAttribute("upgradename")->getValue(); +// +// // int maxHp; +// maxHp = upgradeTypeBaseNode->getAttribute("maxHp")->getIntValue(); +// // bool maxHpIsMultiplier; +// maxHpIsMultiplier = (upgradeTypeBaseNode->getAttribute("maxHpIsMultiplier")->getIntValue() != 0); +// // int maxHpRegeneration; +// maxHpRegeneration = upgradeTypeBaseNode->getAttribute("maxHpRegeneration")->getIntValue(); +// // //bool maxHpRegenerationIsMultiplier; +// // +// // int sight; +// sight = upgradeTypeBaseNode->getAttribute("sight")->getIntValue(); +// // bool sightIsMultiplier; +// sightIsMultiplier = (upgradeTypeBaseNode->getAttribute("sightIsMultiplier")->getIntValue() != 0); +// // int maxEp; +// maxEp = upgradeTypeBaseNode->getAttribute("maxEp")->getIntValue(); +// // bool maxEpIsMultiplier; +// maxEpIsMultiplier = (upgradeTypeBaseNode->getAttribute("maxEpIsMultiplier")->getIntValue() != 0); +// // int maxEpRegeneration; +// maxEpRegeneration = upgradeTypeBaseNode->getAttribute("maxEpRegeneration")->getIntValue(); +// // //bool maxEpRegenerationIsMultiplier; +// // int armor; +// armor = upgradeTypeBaseNode->getAttribute("armor")->getIntValue(); +// // bool armorIsMultiplier; +// armorIsMultiplier = (upgradeTypeBaseNode->getAttribute("armorIsMultiplier")->getIntValue() != 0); +// // int attackStrength; +// attackStrength = upgradeTypeBaseNode->getAttribute("attackStrength")->getIntValue(); +// // bool attackStrengthIsMultiplier; +// attackStrengthIsMultiplier = (upgradeTypeBaseNode->getAttribute("attackStrengthIsMultiplier")->getIntValue() != 0); +// // std::map attackStrengthMultiplierValueList; +// vector attackStrengthMultiplierValueNodeList = upgradeTypeBaseNode->getChildList("attackStrengthMultiplierValueList"); +// for(unsigned int i = 0; i < attackStrengthMultiplierValueNodeList.size(); ++i) { +// XmlNode *node = attackStrengthMultiplierValueNodeList[i]; +// +// attackStrengthMultiplierValueList[node->getAttribute("key")->getValue()] = +// node->getAttribute("value")->getIntValue(); +// } +// // int attackRange; +// attackRange = upgradeTypeBaseNode->getAttribute("attackRange")->getIntValue(); +// // bool attackRangeIsMultiplier; +// attackRangeIsMultiplier = (upgradeTypeBaseNode->getAttribute("attackRangeIsMultiplier")->getIntValue() != 0); +// // std::map attackRangeMultiplierValueList; +// vector attackRangeMultiplierValueNodeList = upgradeTypeBaseNode->getChildList("attackRangeMultiplierValueList"); +// for(unsigned int i = 0; i < attackRangeMultiplierValueNodeList.size(); ++i) { +// XmlNode *node = attackRangeMultiplierValueNodeList[i]; +// +// attackRangeMultiplierValueList[node->getAttribute("key")->getValue()] = +// node->getAttribute("value")->getIntValue(); +// } +// +// // int moveSpeed; +// moveSpeed = upgradeTypeBaseNode->getAttribute("moveSpeed")->getIntValue(); +// // bool moveSpeedIsMultiplier; +// moveSpeedIsMultiplier = (upgradeTypeBaseNode->getAttribute("moveSpeedIsMultiplier")->getIntValue() != 0); +// // std::map moveSpeedIsMultiplierValueList; +// vector moveSpeedIsMultiplierValueNodeList = upgradeTypeBaseNode->getChildList("moveSpeedIsMultiplierValueList"); +// for(unsigned int i = 0; i < moveSpeedIsMultiplierValueNodeList.size(); ++i) { +// XmlNode *node = moveSpeedIsMultiplierValueNodeList[i]; +// +// moveSpeedIsMultiplierValueList[node->getAttribute("key")->getValue()] = +// node->getAttribute("value")->getIntValue(); +// } +// +// // int prodSpeed; +// prodSpeed = upgradeTypeBaseNode->getAttribute("prodSpeed")->getIntValue(); +// // bool prodSpeedIsMultiplier; +// prodSpeedIsMultiplier = (upgradeTypeBaseNode->getAttribute("prodSpeedIsMultiplier")->getIntValue() != 0); +// // std::map prodSpeedProduceIsMultiplierValueList; +// vector prodSpeedProduceIsMultiplierValueNodeList = upgradeTypeBaseNode->getChildList("prodSpeedProduceIsMultiplierValueList"); +// for(unsigned int i = 0; i < prodSpeedProduceIsMultiplierValueNodeList.size(); ++i) { +// XmlNode *node = prodSpeedProduceIsMultiplierValueNodeList[i]; +// +// prodSpeedProduceIsMultiplierValueList[node->getAttribute("key")->getValue()] = +// node->getAttribute("value")->getIntValue(); +// } +// +// // std::map prodSpeedUpgradeIsMultiplierValueList; +// vector prodSpeedUpgradeIsMultiplierValueNodeList = upgradeTypeBaseNode->getChildList("prodSpeedUpgradeIsMultiplierValueList"); +// for(unsigned int i = 0; i < prodSpeedUpgradeIsMultiplierValueNodeList.size(); ++i) { +// XmlNode *node = prodSpeedUpgradeIsMultiplierValueNodeList[i]; +// +// prodSpeedUpgradeIsMultiplierValueList[node->getAttribute("key")->getValue()] = +// node->getAttribute("value")->getIntValue(); +// } +// +// // std::map prodSpeedMorphIsMultiplierValueList; +// vector prodSpeedMorphIsMultiplierValueNodeList = upgradeTypeBaseNode->getChildList("prodSpeedMorphIsMultiplierValueList"); +// for(unsigned int i = 0; i < prodSpeedMorphIsMultiplierValueNodeList.size(); ++i) { +// XmlNode *node = prodSpeedMorphIsMultiplierValueNodeList[i]; +// +// prodSpeedMorphIsMultiplierValueList[node->getAttribute("key")->getValue()] = +// node->getAttribute("value")->getIntValue(); +// } +//} const UpgradeType * UpgradeTypeBase::loadGame(const XmlNode *rootNode, Faction *faction) { const XmlNode *upgradeTypeBaseNode = rootNode->getChild("UpgradeTypeBase"); diff --git a/source/glest_game/types/upgrade_type.h b/source/glest_game/types/upgrade_type.h index c55a51103..303faf44a 100644 --- a/source/glest_game/types/upgrade_type.h +++ b/source/glest_game/types/upgrade_type.h @@ -225,9 +225,9 @@ public: // TODO: It's not clear if these save game methods are being used, currently. I think // attack boosts might use the few lines that aren't commented out. virtual void saveGame(XmlNode *rootNode) const; - virtual void saveGameBoost(XmlNode *rootNode) const; + //virtual void saveGameBoost(XmlNode *rootNode) const; static const UpgradeType * loadGame(const XmlNode *rootNode, Faction *faction); - void loadGameBoost(const XmlNode *rootNode); + //void loadGameBoost(const XmlNode *rootNode); /** * Generates a checksum value for the upgrade. diff --git a/source/glest_map_editor/main.cpp b/source/glest_map_editor/main.cpp index 2e3ffe7c3..6ca1560a1 100644 --- a/source/glest_map_editor/main.cpp +++ b/source/glest_map_editor/main.cpp @@ -30,7 +30,7 @@ using namespace Glest::Game; using namespace std; namespace Glest { namespace Game { -string getGameReadWritePath(string lookupKey) { +string getGameReadWritePath(const string &lookupKey) { string path = ""; if(path == "" && getenv("GLESTHOME") != NULL) { path = getenv("GLESTHOME"); diff --git a/source/glest_map_editor/main.h b/source/glest_map_editor/main.h index 0ba5f27be..639900c1f 100644 --- a/source/glest_map_editor/main.h +++ b/source/glest_map_editor/main.h @@ -215,7 +215,7 @@ private: string appPath; public: - MainWindow(string appPath); + explicit MainWindow(string appPath); ~MainWindow(); void refreshMapRender(); diff --git a/source/shared_lib/include/graphics/gl/opengl.h b/source/shared_lib/include/graphics/gl/opengl.h index 7ca2f8969..5ae75cb16 100644 --- a/source/shared_lib/include/graphics/gl/opengl.h +++ b/source/shared_lib/include/graphics/gl/opengl.h @@ -35,7 +35,7 @@ using Util::intToStr; bool getVBOSupported(); void setVBOSupported(bool value); -void overrideGlExtensionSupport(const char *extensionName,bool value); +//void overrideGlExtensionSupport(const char *extensionName,bool value); bool isGlExtensionSupported(const char *extensionName); //bool isGlVersionSupported(int major, int minor, int release); const char *getGlVersion(); diff --git a/source/shared_lib/include/platform/common/platform_common.h b/source/shared_lib/include/platform/common/platform_common.h index d715d1db6..ec4637c2f 100644 --- a/source/shared_lib/include/platform/common/platform_common.h +++ b/source/shared_lib/include/platform/common/platform_common.h @@ -193,8 +193,8 @@ void findAll(const vector &paths, const string &fileFilter, vector &results, bool cutExtension=false, bool errorOnNotFound=true); vector getFolderTreeContentsListRecursively(const string &path, const string &filterFileExt, bool includeFolders=false, vector *recursiveMap=NULL); -string getGameVersion(); -string getGameGITVersion(); +//string getGameVersion(); +//string getGameGITVersion(); void setGameVersion(const string &version); void setGameGITVersion(const string &git); @@ -297,19 +297,19 @@ inline string trim (const string & s, const string & t = SPACES) { return trim_left (trim_right (d, t), t) ; } // end of trim -string getFullFileArchiveExtractCommand(string fileArchiveExtractCommand, - string fileArchiveExtractCommandParameters, string outputpath, string archivename); -string getFullFileArchiveCompressCommand(string fileArchiveCompressCommand, - string fileArchiveCompressCommandParameters, string archivename, string archivefiles); +string getFullFileArchiveExtractCommand(const string &fileArchiveExtractCommand, + string fileArchiveExtractCommandParameters, const string &outputpath, const string &archivename); +string getFullFileArchiveCompressCommand(const string &fileArchiveCompressCommand, + string fileArchiveCompressCommandParameters, const string &archivename, const string &archivefiles); bool executeShellCommand(string cmd,int expectedResult=IGNORE_CMD_RESULT_VALUE,ShellCommandOutputCallbackInterface *cb=NULL); string executable_path(const string &exeName,bool includeExeNameInPath=false); -void saveDataToFile(string filename, string data); +void saveDataToFile(string filename, const string &data); bool valid_utf8_file(const char* file_name); -string getFileTextContents(string path); +//string getFileTextContents(string path); string safeCharPtrCopy(const char *ptr, int maxLength=-1); diff --git a/source/shared_lib/include/platform/sdl/platform_main.h b/source/shared_lib/include/platform/sdl/platform_main.h index ca920efc8..5125bdb0d 100644 --- a/source/shared_lib/include/platform/sdl/platform_main.h +++ b/source/shared_lib/include/platform/sdl/platform_main.h @@ -99,6 +99,8 @@ const char *GAME_ARGS[] = { "--create-data-archives", "--steam", + "--steam-debug", + "--steam-reset-stats", "--verbose" @@ -184,6 +186,8 @@ enum GAME_ARG_TYPE { GAME_ARG_CREATE_DATA_ARCHIVES, GAME_ARG_STEAM, + GAME_ARG_STEAM_DEBUG, + GAME_ARG_STEAM_RESET_STATS, GAME_ARG_VERBOSE_MODE, diff --git a/source/shared_lib/include/platform/sdl/platform_util.h b/source/shared_lib/include/platform/sdl/platform_util.h index 9b7a41ca6..106c2ba29 100644 --- a/source/shared_lib/include/platform/sdl/platform_util.h +++ b/source/shared_lib/include/platform/sdl/platform_util.h @@ -59,7 +59,7 @@ public: // ===================================================== // Misc // ===================================================== -void message(string message,bool isNonGraphicalModeEnabled, string writepath); +void message(const string &message,bool isNonGraphicalModeEnabled, const string &writepath); void exceptionMessage(const exception &excp); string getCommandLine(); diff --git a/source/shared_lib/include/platform/sdl/window.h b/source/shared_lib/include/platform/sdl/window.h index 82acb2e8c..0945616d6 100644 --- a/source/shared_lib/include/platform/sdl/window.h +++ b/source/shared_lib/include/platform/sdl/window.h @@ -238,9 +238,9 @@ bool isKeyPressed(SDL_Keycode compareKey, SDL_KeyboardEvent input, vector m bool isKeyPressed(SDL_Keycode compareKey, SDL_KeyboardEvent input, bool modifiersAllowed=true); SDL_Keycode extractKeyPressed(SDL_KeyboardEvent input); -bool isAllowedInputTextKey(SDL_Keycode key); +//bool isAllowedInputTextKey(SDL_Keycode key); -wchar_t extractKeyPressedUnicode(SDL_KeyboardEvent input); +//wchar_t extractKeyPressedUnicode(SDL_KeyboardEvent input); vector extractKeyPressedUnicodeLength(string text); bool isAllowedInputTextKey(wchar_t &key); diff --git a/source/shared_lib/include/util/util.h b/source/shared_lib/include/util/util.h index c1127890c..327246cbc 100644 --- a/source/shared_lib/include/util/util.h +++ b/source/shared_lib/include/util/util.h @@ -230,18 +230,18 @@ string ext(const string &s); string replaceBy(const string &s, char c1, char c2); vector split(string s,string d); string toLower(const string &s); -bool compareNonCaseSensitive(const string a, const string b); +bool compareNonCaseSensitive(const string &a, const string &b); //void copyStringToBuffer(char *buffer, int bufferSize, const string& s); //numeric fcs int clamp(int value, int min, int max); float clamp(float value, float min, float max); int64 clamp(int64 value, int64 min, int64 max); -float saturate(float value); -int round(float f); +//float saturate(float value); +//int round(float f); //misc -int compareMajorMinorVersion(string versionA,string versionB); +int compareMajorMinorVersion(const string &versionA, const string &versionB); int getMajor(string version); int getMinor(string version); bool checkVersionComptability(string clientVersionString, string serverVersionString); diff --git a/source/shared_lib/sources/compression/compression_utils.cpp b/source/shared_lib/sources/compression/compression_utils.cpp index cc72d103d..167bc7c0e 100644 --- a/source/shared_lib/sources/compression/compression_utils.cpp +++ b/source/shared_lib/sources/compression/compression_utils.cpp @@ -167,7 +167,7 @@ int zipfile_tool(int argc, const char *argv[]) { if (fread(s_inbuf, 1, n, pInfile) != n) { if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Failed reading from input file!\n"); - if(pInfile) fclose(pInfile); + fclose(pInfile); if(pOutfile) fclose(pOutfile); return EXIT_FAILURE; } @@ -188,7 +188,7 @@ int zipfile_tool(int argc, const char *argv[]) { if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Failed writing to output file!\n"); if(pInfile) fclose(pInfile); - if(pOutfile) fclose(pOutfile); + fclose(pOutfile); return EXIT_FAILURE; } stream.next_out = s_outbuf; @@ -236,7 +236,7 @@ int zipfile_tool(int argc, const char *argv[]) { if (fread(s_inbuf, 1, n, pInfile) != n) { if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Failed reading from input file!\n"); - if(pInfile) fclose(pInfile); + fclose(pInfile); if(pOutfile) fclose(pOutfile); return EXIT_FAILURE; } @@ -256,7 +256,7 @@ int zipfile_tool(int argc, const char *argv[]) { if(SystemFlags::VERBOSE_MODE_ENABLED) printf("Failed writing to output file!\n"); if(pInfile) fclose(pInfile); - if(pOutfile) fclose(pOutfile); + fclose(pOutfile); return EXIT_FAILURE; } stream.next_out = s_outbuf; diff --git a/source/shared_lib/sources/feathery_ftp/ftpCmds.c b/source/shared_lib/sources/feathery_ftp/ftpCmds.c index 6e49aff3c..f1657cf05 100644 --- a/source/shared_lib/sources/feathery_ftp/ftpCmds.c +++ b/source/shared_lib/sources/feathery_ftp/ftpCmds.c @@ -754,7 +754,7 @@ LOCAL int ftpCmdPasv(int sessionId, const char* args, int len) remoteFTPServerIp = ftpFindExternalFTPServerIp(ftpGetSession(sessionId)->remoteIp); - snprintf(str, 50,"%s (%d,%d,%d,%d,%d,%d)", + snprintf(str, 50,"%s (%d,%d,%d,%u,%d,%d)", ftpMsg029, (remoteFTPServerIp >> 24) & 0xFF, (remoteFTPServerIp >> 16) & 0xFF, @@ -768,7 +768,7 @@ LOCAL int ftpCmdPasv(int sessionId, const char* args, int len) } else { - snprintf(str, 50,"%s (%d,%d,%d,%d,%d,%d)", + snprintf(str, 50,"%s (%d,%d,%d,%u,%d,%d)", ftpMsg029, (ip >> 24) & 0xFF, (ip >> 16) & 0xFF, diff --git a/source/shared_lib/sources/graphics/font.cpp b/source/shared_lib/sources/graphics/font.cpp index abb93659b..ec77c4914 100644 --- a/source/shared_lib/sources/graphics/font.cpp +++ b/source/shared_lib/sources/graphics/font.cpp @@ -307,9 +307,9 @@ void Font::setSize(int size) { bool is_non_ASCII(const int &c) { return (c < 0) || (c >= 128); } -bool is_ASCII(const int &c) { - return !is_non_ASCII(c); -} +//bool is_ASCII(const int &c) { +// return !is_non_ASCII(c); +//} void Font::bidi_cvt(string &str_) { diff --git a/source/shared_lib/sources/graphics/gl/opengl.cpp b/source/shared_lib/sources/graphics/gl/opengl.cpp index 10d1e685d..f76327c6d 100644 --- a/source/shared_lib/sources/graphics/gl/opengl.cpp +++ b/source/shared_lib/sources/graphics/gl/opengl.cpp @@ -44,10 +44,10 @@ void setVBOSupported(bool value) { vboEnabled = (value == true ? 1 : -1); }; -void overrideGlExtensionSupport(const char *extensionName,bool value) { - cacheExtensionCheckList[extensionName]=value; - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("OpenGL Extension [%s] supported status FORCED TO = %d\n",extensionName,cacheExtensionCheckList[extensionName]); -} +//void overrideGlExtensionSupport(const char *extensionName,bool value) { +// cacheExtensionCheckList[extensionName]=value; +// if(SystemFlags::VERBOSE_MODE_ENABLED) printf("OpenGL Extension [%s] supported status FORCED TO = %d\n",extensionName,cacheExtensionCheckList[extensionName]); +//} bool isGlExtensionSupported(const char *extensionName) { if(cacheExtensionCheckList.find(extensionName) != cacheExtensionCheckList.end()) { diff --git a/source/shared_lib/sources/platform/common/platform_common.cpp b/source/shared_lib/sources/platform/common/platform_common.cpp index 642d25fb4..e3026d5e2 100644 --- a/source/shared_lib/sources/platform/common/platform_common.cpp +++ b/source/shared_lib/sources/platform/common/platform_common.cpp @@ -691,12 +691,12 @@ void setCRCCacheFilePath(const string &path) { crcCachePath = path; } -string getGameVersion() { - return gameVersion; -} -string getGameGITVersion() { - return gameGITVersion; -} +//string getGameVersion() { +// return gameVersion; +//} +//string getGameGITVersion() { +// return gameGITVersion; +//} void setGameVersion(const string &version) { gameVersion = version; } @@ -1879,8 +1879,8 @@ string replaceAllBetweenTokens(string& context, const string &startToken, return context; } -string getFullFileArchiveExtractCommand(string fileArchiveExtractCommand, - string fileArchiveExtractCommandParameters, string outputpath, string archivename) { +string getFullFileArchiveExtractCommand(const string &fileArchiveExtractCommand, + string fileArchiveExtractCommandParameters, const string &outputpath, const string &archivename) { string parsedOutputpath = outputpath; string parsedArchivename = archivename; @@ -1901,9 +1901,9 @@ string getFullFileArchiveExtractCommand(string fileArchiveExtractCommand, return result; } -string getFullFileArchiveCompressCommand(string fileArchiveCompressCommand, +string getFullFileArchiveCompressCommand(const string &fileArchiveCompressCommand, string fileArchiveCompressCommandParameters, - string archivename, string archivefiles) { + const string &archivename, const string &archivefiles) { string parsedArchivename = archivename; string parsedArchivefiles = archivefiles; @@ -2144,7 +2144,7 @@ bool searchAndReplaceTextInFile(string fileName, string findText, string replace return replacedText; } -void saveDataToFile(string filename, string data) { +void saveDataToFile(string filename, const string &data) { //Open an input and output stream in binary mode #if defined(WIN32) && !defined(__MINGW32__) FILE *fp2 = _wfopen(utf8_decode(filename).c_str(), L"wb"); @@ -2235,32 +2235,32 @@ bool valid_utf8_file(const char* file_name) { return result; } -string getFileTextContents(string path) { -#if defined(WIN32) && !defined(__MINGW32__) - FILE *fp = _wfopen(utf8_decode(path).c_str(), L"rb"); - ifstream xmlFile(fp); -#else - ifstream xmlFile(path.c_str(),ios::binary); -#endif - if(xmlFile.is_open() == false) { - throw megaglest_runtime_error("Can not open file: [" + path + "]"); - } - - xmlFile.unsetf(ios::skipws); - - // Determine stream size - xmlFile.seekg(0, ios::end); - streampos size = xmlFile.tellg(); - xmlFile.seekg(0); - - // Load data and add terminating 0 - vector buffer; - buffer.resize((unsigned int)size + 1); - xmlFile.read(&buffer.front(), static_cast(size)); - buffer[(unsigned int)size] = 0; - - return &buffer.front(); -} +//string getFileTextContents(string path) { +//#if defined(WIN32) && !defined(__MINGW32__) +// FILE *fp = _wfopen(utf8_decode(path).c_str(), L"rb"); +// ifstream xmlFile(fp); +//#else +// ifstream xmlFile(path.c_str(),ios::binary); +//#endif +// if(xmlFile.is_open() == false) { +// throw megaglest_runtime_error("Can not open file: [" + path + "]"); +// } +// +// xmlFile.unsetf(ios::skipws); +// +// // Determine stream size +// xmlFile.seekg(0, ios::end); +// streampos size = xmlFile.tellg(); +// xmlFile.seekg(0); +// +// // Load data and add terminating 0 +// vector buffer; +// buffer.resize((unsigned int)size + 1); +// xmlFile.read(&buffer.front(), static_cast(size)); +// buffer[(unsigned int)size] = 0; +// +// return &buffer.front(); +//} // ===================================== // ModeInfo diff --git a/source/shared_lib/sources/platform/common/simple_threads.cpp b/source/shared_lib/sources/platform/common/simple_threads.cpp index fd9f3eb7b..c9290448f 100644 --- a/source/shared_lib/sources/platform/common/simple_threads.cpp +++ b/source/shared_lib/sources/platform/common/simple_threads.cpp @@ -154,7 +154,7 @@ void FileCRCPreCacheThread::execute() { string techName = techPaths[idx]; workerTechList.push_back(techName); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] Spawning CRC thread for Tech [%s] [%d of %d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,techName.c_str(),idx+1,(int)techPaths.size()); + if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] Spawning CRC thread for Tech [%s] [%u of %lu]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,techName.c_str(),idx+1,techPaths.size()); } if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] workerIdx = %u, currentWorkerMax = %u, endConsumerIndex = %u\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,workerIdx,currentWorkerMax,endConsumerIndex); diff --git a/source/shared_lib/sources/platform/sdl/platform_util.cpp b/source/shared_lib/sources/platform/sdl/platform_util.cpp index 3f34e1a18..b8b3a769b 100644 --- a/source/shared_lib/sources/platform/sdl/platform_util.cpp +++ b/source/shared_lib/sources/platform/sdl/platform_util.cpp @@ -97,7 +97,7 @@ const char * getDialogCommand() { return NULL; } -bool showMessage(std::string warning,string writepath) { +bool showMessage(std::string warning,const string &writepath) { bool guiMessage = false; const char * dialogCommand = getDialogCommand(); if (dialogCommand) { @@ -137,7 +137,7 @@ bool showMessage(std::string warning,string writepath) { return guiMessage; } -void message(string message, bool isNonGraphicalModeEnabled,string writepath) { +void message(const string &message, bool isNonGraphicalModeEnabled,const string &writepath) { std::cerr << "\n\n\n"; std::cerr << "******************************************************\n"; std::cerr << " " << message << "\n"; diff --git a/source/shared_lib/sources/platform/sdl/thread.cpp b/source/shared_lib/sources/platform/sdl/thread.cpp index c40db480c..c56507993 100644 --- a/source/shared_lib/sources/platform/sdl/thread.cpp +++ b/source/shared_lib/sources/platform/sdl/thread.cpp @@ -936,7 +936,7 @@ bool MasterSlaveThreadController::waitTillSlavesTrigger(int waitMilliseconds) { result = false; } - else if(slaveResult == 0) { + else { if(debugMasterSlaveThreadController) printf("In [%s::%s Line: %d] slaveTriggerCounter = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,slaveTriggerCounter); result = true; diff --git a/source/shared_lib/sources/platform/sdl/window.cpp b/source/shared_lib/sources/platform/sdl/window.cpp index b4a3e591f..a1061d354 100644 --- a/source/shared_lib/sources/platform/sdl/window.cpp +++ b/source/shared_lib/sources/platform/sdl/window.cpp @@ -1006,43 +1006,43 @@ bool isKeyPressed(SDL_Keycode compareKey, SDL_KeyboardEvent input,vector mo return result; } -wchar_t extractKeyPressedUnicode(SDL_KeyboardEvent input) { - wchar_t c = SDLK_UNKNOWN; - //if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) { - if(input.keysym.sym > 0) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.sym = %d input.keysym.mod = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.sym,input.keysym.mod); - - c = input.keysym.sym; -// if(c <= SDLK_UNKNOWN || c >= SDLK_LAST) { -// c = SDLKey(c & 0xFF); -// } - - //c = toupper(c); - - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] #1 (c & 0xFF) [%d] c = [%lc]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF),c); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] #1 (c & 0xFF) [%d] c = [%lc]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF),c); - } - if(c == SDLK_UNKNOWN) { - c = input.keysym.sym; - } - - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %u] c = [%d][%lc]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c); - - //c = (SDLKey)(c & 0xFF); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c); - - string pressKeyName = SDL_GetKeyName((SDL_Keycode)c); - //string inputKeyName = SDL_GetKeyName(input.keysym.sym); - - //printf ("PRESS pressed key [%d - %s] input.keysym.sym [%d] input.keysym.unicode [%d] mod = %d\n", - // c,pressKeyName.c_str(),input.keysym.sym,input.keysym.unicode,input.keysym.mod); - - if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] pressed key [%d - %s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c,pressKeyName.c_str()); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c,pressKeyName.c_str()); - - return c; -} +//wchar_t extractKeyPressedUnicode(SDL_KeyboardEvent input) { +// wchar_t c = SDLK_UNKNOWN; +// //if(input.keysym.unicode > 0 && input.keysym.unicode < 0x80) { +// if(input.keysym.sym > 0) { +// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] input.keysym.sym = %d input.keysym.mod = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,input.keysym.sym,input.keysym.mod); +// +// c = input.keysym.sym; +//// if(c <= SDLK_UNKNOWN || c >= SDLK_LAST) { +//// c = SDLKey(c & 0xFF); +//// } +// +// //c = toupper(c); +// +// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] #1 (c & 0xFF) [%d] c = [%lc]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF),c); +// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] #1 (c & 0xFF) [%d] c = [%lc]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(c & 0xFF),c); +// } +// if(c == SDLK_UNKNOWN) { +// c = input.keysym.sym; +// } +// +// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %u] c = [%d][%lc]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c); +// +// //c = (SDLKey)(c & 0xFF); +// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c); +// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] returning key [%d]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c); +// +// string pressKeyName = SDL_GetKeyName((SDL_Keycode)c); +// //string inputKeyName = SDL_GetKeyName(input.keysym.sym); +// +// //printf ("PRESS pressed key [%d - %s] input.keysym.sym [%d] input.keysym.unicode [%d] mod = %d\n", +// // c,pressKeyName.c_str(),input.keysym.sym,input.keysym.unicode,input.keysym.mod); +// +// if(SystemFlags::VERBOSE_MODE_ENABLED) printf ("In [%s::%s Line: %d] pressed key [%d - %s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c,pressKeyName.c_str()); +// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,c,pressKeyName.c_str()); +// +// return c; +//} vector extractKeyPressedUnicodeLength(string text) { vector result; @@ -1110,67 +1110,67 @@ SDL_Keycode extractKeyPressed(SDL_KeyboardEvent input) { return c; } -bool isAllowedInputTextKey(wchar_t &key) { - if(Window::isAllowedKey(key) == true) { - return true; - } - - bool result = ( - key != SDLK_DELETE && - key != SDLK_BACKSPACE && - key != SDLK_TAB && - key != SDLK_CLEAR && - key != SDLK_RETURN && - key != SDLK_PAUSE && - key != SDLK_UP && - key != SDLK_DOWN && - key != SDLK_RIGHT && - key != SDLK_LEFT && - key != SDLK_INSERT && - key != SDLK_HOME && - key != SDLK_END && - key != SDLK_PAGEUP && - key != SDLK_PAGEDOWN && - key != SDLK_F1 && - key != SDLK_F2 && - key != SDLK_F3 && - key != SDLK_F4 && - key != SDLK_F5 && - key != SDLK_F6 && - key != SDLK_F7 && - key != SDLK_F8 && - key != SDLK_F9 && - key != SDLK_F10 && - key != SDLK_F11 && - key != SDLK_F12 && - key != SDLK_F13 && - key != SDLK_F14 && - key != SDLK_F15 && - key != SDLK_NUMLOCKCLEAR && - key != SDLK_CAPSLOCK && - key != SDLK_SCROLLLOCK && - key != SDLK_RSHIFT && - key != SDLK_LSHIFT && - key != SDLK_RCTRL && - key != SDLK_LCTRL && - key != SDLK_RALT && - key != SDLK_LALT && - key != SDLK_RGUI && - key != SDLK_LGUI && - key != SDLK_MODE && - key != SDLK_HELP && - key != SDLK_PRINTSCREEN && - key != SDLK_SYSREQ && - key != SDLK_PAUSE && - key != SDLK_MENU && - key != SDLK_POWER); - - string inputKeyName = SDL_GetKeyName((SDL_Keycode)key); - if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result); - if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result); - - return result; -} +//bool isAllowedInputTextKey(wchar_t &key) { +// if(Window::isAllowedKey(key) == true) { +// return true; +// } +// +// bool result = ( +// key != SDLK_DELETE && +// key != SDLK_BACKSPACE && +// key != SDLK_TAB && +// key != SDLK_CLEAR && +// key != SDLK_RETURN && +// key != SDLK_PAUSE && +// key != SDLK_UP && +// key != SDLK_DOWN && +// key != SDLK_RIGHT && +// key != SDLK_LEFT && +// key != SDLK_INSERT && +// key != SDLK_HOME && +// key != SDLK_END && +// key != SDLK_PAGEUP && +// key != SDLK_PAGEDOWN && +// key != SDLK_F1 && +// key != SDLK_F2 && +// key != SDLK_F3 && +// key != SDLK_F4 && +// key != SDLK_F5 && +// key != SDLK_F6 && +// key != SDLK_F7 && +// key != SDLK_F8 && +// key != SDLK_F9 && +// key != SDLK_F10 && +// key != SDLK_F11 && +// key != SDLK_F12 && +// key != SDLK_F13 && +// key != SDLK_F14 && +// key != SDLK_F15 && +// key != SDLK_NUMLOCKCLEAR && +// key != SDLK_CAPSLOCK && +// key != SDLK_SCROLLLOCK && +// key != SDLK_RSHIFT && +// key != SDLK_LSHIFT && +// key != SDLK_RCTRL && +// key != SDLK_LCTRL && +// key != SDLK_RALT && +// key != SDLK_LALT && +// key != SDLK_RGUI && +// key != SDLK_LGUI && +// key != SDLK_MODE && +// key != SDLK_HELP && +// key != SDLK_PRINTSCREEN && +// key != SDLK_SYSREQ && +// key != SDLK_PAUSE && +// key != SDLK_MENU && +// key != SDLK_POWER); +// +// string inputKeyName = SDL_GetKeyName((SDL_Keycode)key); +// if(SystemFlags::VERBOSE_MODE_ENABLED) printf("In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result); +// if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d] pressed key [%d - %s] result = %d\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,key,inputKeyName.c_str(),result); +// +// return result; +//} bool isAllowedInputTextKey(SDL_Keycode key) { if(Window::isAllowedKey(key) == true) { @@ -1223,7 +1223,6 @@ bool isAllowedInputTextKey(SDL_Keycode key) { key != SDLK_HELP && key != SDLK_PRINTSCREEN && key != SDLK_SYSREQ && - key != SDLK_PAUSE && key != SDLK_MENU && key != SDLK_POWER); diff --git a/source/shared_lib/sources/util/string_utils.cpp b/source/shared_lib/sources/util/string_utils.cpp index 820cd86db..e0bc8d60f 100644 --- a/source/shared_lib/sources/util/string_utils.cpp +++ b/source/shared_lib/sources/util/string_utils.cpp @@ -105,7 +105,7 @@ namespace Shared { namespace Util { int outc; int inpos = 0; int outpos = 0; - while (inpos < len || len == -1) { + while (inpos < len) { if (in[inpos]<0x80) { out[outpos++] = in[inpos]; if (in[inpos] == 0 && len == -1) diff --git a/source/shared_lib/sources/util/util.cpp b/source/shared_lib/sources/util/util.cpp index 62bf2790d..4ae66cca2 100644 --- a/source/shared_lib/sources/util/util.cpp +++ b/source/shared_lib/sources/util/util.cpp @@ -741,7 +741,7 @@ string toLower(const string &s){ return rs; } -bool compareNonCaseSensitive(const string a, const string b) { +bool compareNonCaseSensitive(const string &a, const string &b) { return (toLower(a) < toLower(b)); } @@ -752,15 +752,15 @@ bool compareNonCaseSensitive(const string a, const string b) { // ==================== numeric fcs ==================== -float saturate(float value) { - if (value < 0.f){ - return 0.f; - } - if (value > 1.f){ - return 1.f; - } - return value; -} +//float saturate(float value) { +// if (value < 0.f){ +// return 0.f; +// } +// if (value > 1.f){ +// return 1.f; +// } +// return value; +//} int clamp(int value, int min, int max){ if (value