- more cppcheck cleanup, AND some new inernal steam commandline parameters to reset stats and enable debugging
This commit is contained in:
parent
865a665bf0
commit
588ec21d8a
|
@ -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);
|
||||
|
|
|
@ -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<GraphicComponent *> &gcs) {
|
||||
if(getElementCount()!=0 ) {
|
||||
|
|
|
@ -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;}
|
||||
|
|
|
@ -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 != "") {
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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())
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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 == "") {
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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());
|
||||
|
|
|
@ -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<string,string> getDiscoveredLanguageList(bool searchKeyIsLangName=false);
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -963,9 +963,9 @@ void Program::startSoundSystem() {
|
|||
}
|
||||
}
|
||||
|
||||
void Program::resetSoundSystem() {
|
||||
startSoundSystem();
|
||||
}
|
||||
//void Program::resetSoundSystem() {
|
||||
// startSoundSystem();
|
||||
//}
|
||||
|
||||
//void Program::reInitGl() {
|
||||
// if(window != NULL) {
|
||||
|
|
|
@ -223,7 +223,7 @@ public:
|
|||
bool isInSpecialKeyCaptureEvent() { return programState->isInSpecialKeyCaptureEvent(); }
|
||||
|
||||
//void reInitGl();
|
||||
void resetSoundSystem();
|
||||
//void resetSoundSystem();
|
||||
void stopSoundSystem();
|
||||
void startSoundSystem();
|
||||
|
||||
|
|
|
@ -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__);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -261,7 +261,7 @@ public:
|
|||
|
||||
virtual void saveGame(XmlNode *rootNode) {};
|
||||
|
||||
void resetJoinGameInProgressFlags();
|
||||
//void resetJoinGameInProgressFlags();
|
||||
void setJoinGameInProgressFlags();
|
||||
|
||||
protected:
|
||||
|
|
|
@ -55,6 +55,7 @@ static std::string steamToIsoLang(const char *steamLang) {
|
|||
|
||||
// SteamPrivate
|
||||
struct SteamPrivate {
|
||||
static bool debugEnabled;
|
||||
std::map<std::string, bool> achievements;
|
||||
std::map<std::string, double> 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
|
||||
|
|
|
@ -71,6 +71,7 @@ public:
|
|||
void setStatAsDouble(const char *name, double value);
|
||||
|
||||
void requestRefreshStats();
|
||||
static void setDebugEnabled(bool value);
|
||||
|
||||
Steam();
|
||||
~Steam();
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -448,104 +448,104 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{
|
|||
return str;
|
||||
}
|
||||
|
||||
void UpgradeTypeBase::saveGameBoost(XmlNode *rootNode) const {
|
||||
std::map<string,string> 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<string,string> 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<string,int> attackStrengthMultiplierValueList;
|
||||
for(std::map<string,int>::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<string,int> attackRangeMultiplierValueList;
|
||||
for(std::map<string,int>::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<string,int> moveSpeedIsMultiplierValueList;
|
||||
for(std::map<string,int>::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<string,int> prodSpeedProduceIsMultiplierValueList;
|
||||
for(std::map<string,int>::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<string,int> prodSpeedUpgradeIsMultiplierValueList;
|
||||
for(std::map<string,int>::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<string,int> prodSpeedMorphIsMultiplierValueList;
|
||||
for(std::map<string,int>::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<string,int> attackStrengthMultiplierValueList;
|
||||
// for(std::map<string,int>::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<string,int> attackRangeMultiplierValueList;
|
||||
// for(std::map<string,int>::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<string,int> moveSpeedIsMultiplierValueList;
|
||||
// for(std::map<string,int>::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<string,int> prodSpeedProduceIsMultiplierValueList;
|
||||
// for(std::map<string,int>::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<string,int> prodSpeedUpgradeIsMultiplierValueList;
|
||||
// for(std::map<string,int>::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<string,int> prodSpeedMorphIsMultiplierValueList;
|
||||
// for(std::map<string,int>::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<string,string> 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<string,int> attackStrengthMultiplierValueList;
|
||||
vector<XmlNode *> 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<string,int> attackRangeMultiplierValueList;
|
||||
vector<XmlNode *> 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<string,int> moveSpeedIsMultiplierValueList;
|
||||
vector<XmlNode *> 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<string,int> prodSpeedProduceIsMultiplierValueList;
|
||||
vector<XmlNode *> 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<string,int> prodSpeedUpgradeIsMultiplierValueList;
|
||||
vector<XmlNode *> 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<string,int> prodSpeedMorphIsMultiplierValueList;
|
||||
vector<XmlNode *> 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<string,int> attackStrengthMultiplierValueList;
|
||||
// vector<XmlNode *> 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<string,int> attackRangeMultiplierValueList;
|
||||
// vector<XmlNode *> 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<string,int> moveSpeedIsMultiplierValueList;
|
||||
// vector<XmlNode *> 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<string,int> prodSpeedProduceIsMultiplierValueList;
|
||||
// vector<XmlNode *> 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<string,int> prodSpeedUpgradeIsMultiplierValueList;
|
||||
// vector<XmlNode *> 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<string,int> prodSpeedMorphIsMultiplierValueList;
|
||||
// vector<XmlNode *> 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");
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -215,7 +215,7 @@ private:
|
|||
string appPath;
|
||||
|
||||
public:
|
||||
MainWindow(string appPath);
|
||||
explicit MainWindow(string appPath);
|
||||
~MainWindow();
|
||||
|
||||
void refreshMapRender();
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -193,8 +193,8 @@ void findAll(const vector<string> &paths, const string &fileFilter, vector<strin
|
|||
void findAll(const string &path, vector<string> &results, bool cutExtension=false, bool errorOnNotFound=true);
|
||||
vector<string> getFolderTreeContentsListRecursively(const string &path, const string &filterFileExt, bool includeFolders=false, vector<string> *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);
|
||||
|
||||
|
|
|
@ -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,
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -238,9 +238,9 @@ bool isKeyPressed(SDL_Keycode compareKey, SDL_KeyboardEvent input, vector<int> 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<int> extractKeyPressedUnicodeLength(string text);
|
||||
bool isAllowedInputTextKey(wchar_t &key);
|
||||
|
||||
|
|
|
@ -230,18 +230,18 @@ string ext(const string &s);
|
|||
string replaceBy(const string &s, char c1, char c2);
|
||||
vector<string> 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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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_) {
|
||||
|
||||
|
|
|
@ -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()) {
|
||||
|
|
|
@ -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<char> buffer;
|
||||
buffer.resize((unsigned int)size + 1);
|
||||
xmlFile.read(&buffer.front(), static_cast<streamsize>(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<char> buffer;
|
||||
// buffer.resize((unsigned int)size + 1);
|
||||
// xmlFile.read(&buffer.front(), static_cast<streamsize>(size));
|
||||
// buffer[(unsigned int)size] = 0;
|
||||
//
|
||||
// return &buffer.front();
|
||||
//}
|
||||
|
||||
// =====================================
|
||||
// ModeInfo
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -1006,43 +1006,43 @@ bool isKeyPressed(SDL_Keycode compareKey, SDL_KeyboardEvent input,vector<int> 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<int> extractKeyPressedUnicodeLength(string text) {
|
||||
vector<int> 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);
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<min){
|
||||
|
@ -792,12 +792,12 @@ float clamp(float value, float min, float max) {
|
|||
return value;
|
||||
}
|
||||
|
||||
int round(float f){
|
||||
return (int) f;
|
||||
}
|
||||
//int round(float f){
|
||||
// return (int) f;
|
||||
//}
|
||||
|
||||
// ==================== misc ====================
|
||||
int compareMajorMinorVersion(string versionA,string versionB) {
|
||||
int compareMajorMinorVersion(const string &versionA, const string &versionB) {
|
||||
int majorA = getMajor(versionA);
|
||||
int minorA = getMinor(versionA);
|
||||
int majorB = getMajor(versionB);
|
||||
|
|
|
@ -297,7 +297,7 @@ static SteamBridge *GSteamBridge = NULL;
|
|||
class SteamBridge
|
||||
{
|
||||
public:
|
||||
SteamBridge(PipeType _fd);
|
||||
explicit SteamBridge(PipeType _fd);
|
||||
STEAM_CALLBACK(SteamBridge, OnUserStatsReceived, UserStatsReceived_t, m_CallbackUserStatsReceived);
|
||||
STEAM_CALLBACK(SteamBridge, OnUserStatsStored, UserStatsStored_t, m_CallbackUserStatsStored);
|
||||
|
||||
|
|
Loading…
Reference in New Issue