diff --git a/source/glest_game/ai/path_finder.cpp b/source/glest_game/ai/path_finder.cpp index dac13a9c..ed0d9b4e 100644 --- a/source/glest_game/ai/path_finder.cpp +++ b/source/glest_game/ai/path_finder.cpp @@ -198,7 +198,7 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu string commandDesc = "none"; Command *command= unit->getCurrCommand(); if(command != NULL && command->getCommandType() != NULL) { - commandDesc = command->getCommandType()->toString(); + commandDesc = command->getCommandType()->toString(false); } char szBuf[8096]=""; snprintf(szBuf,8096,"State: arrived#1 at pos: %s, command [%s]",finalPos.getString().c_str(),commandDesc.c_str()); @@ -1071,7 +1071,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout string commandDesc = "none"; Command *command= unit->getCurrCommand(); if(command != NULL && command->getCommandType() != NULL) { - commandDesc = command->getCommandType()->toString(); + commandDesc = command->getCommandType()->toString(false); } char szBuf[8096]=""; @@ -1136,7 +1136,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout string commandDesc = "none"; Command *command= unit->getCurrCommand(); if(command != NULL && command->getCommandType() != NULL) { - commandDesc = command->getCommandType()->toString(); + commandDesc = command->getCommandType()->toString(false); } char szBuf[8096]=""; @@ -1371,7 +1371,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout string commandDesc = "none"; Command *command= unit->getCurrCommand(); if(command != NULL && command->getCommandType() != NULL) { - commandDesc = command->getCommandType()->toString(); + commandDesc = command->getCommandType()->toString(false); } std::pair lastHarvest = unit->getLastHarvestResourceTarget(); @@ -1485,7 +1485,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout string commandDesc = "none"; Command *command= unit->getCurrCommand(); if(command != NULL && command->getCommandType() != NULL) { - commandDesc = command->getCommandType()->toString(); + commandDesc = command->getCommandType()->toString(false); } char szBuf[8096]=""; diff --git a/source/glest_game/gui/gui.cpp b/source/glest_game/gui/gui.cpp index b082f0ad..c124c156 100644 --- a/source/glest_game/gui/gui.cpp +++ b/source/glest_game/gui/gui.cpp @@ -770,7 +770,7 @@ void Gui::computeInfoString(int posDisplay){ const UnitType *ut= selection.getFrontUnit()->getType(); CommandClass cc= display.getCommandClass(posDisplay); if(cc!=ccNull){ - display.setInfoText(lang.get("CommonCommand") + ": " + ut->getFirstCtOfClass(cc)->toString()); + display.setInfoText(lang.get("CommonCommand") + ": " + ut->getFirstCtOfClass(cc)->toString(true)); } } } diff --git a/source/glest_game/type_instances/command.cpp b/source/glest_game/type_instances/command.cpp index 2cfe4fde..027b99be 100644 --- a/source/glest_game/type_instances/command.cpp +++ b/source/glest_game/type_instances/command.cpp @@ -104,12 +104,12 @@ void Command::setUnit(Unit *unit){ this->unitRef= unit; } -std::string Command::toString() const { +std::string Command::toString(bool translatedValue) const { //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__, __LINE__); std::string result = ""; if(commandType != NULL) { - result = "commandType id = " + intToStr(commandType->getId()) + ", desc = " + commandType->toString(); + result = "commandType id = " + intToStr(commandType->getId()) + ", desc = " + commandType->toString(translatedValue); } else { result = "commandType = NULL"; @@ -134,7 +134,7 @@ std::string Command::toString() const { if(unitType != NULL) { result += ", unitTypeId = " + intToStr(unitType->getId()); - result += ", unitTypeDesc = " + unitType->getReqDesc(false); + result += ", unitTypeDesc = " + unitType->getReqDesc(translatedValue); } //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__, __LINE__); diff --git a/source/glest_game/type_instances/command.h b/source/glest_game/type_instances/command.h index 08b8ebdd..e86b94f1 100644 --- a/source/glest_game/type_instances/command.h +++ b/source/glest_game/type_instances/command.h @@ -91,7 +91,7 @@ public: inline void setUnitCommandGroupId(int value) { unitCommandGroupId = value; } inline int getUnitCommandGroupId() const { return unitCommandGroupId; } - std::string toString() const; + std::string toString(bool translatedValue) const; void saveGame(XmlNode *rootNode, Faction *faction); static Command * loadGame(const XmlNode *rootNode,const UnitType *ut,World *world); diff --git a/source/glest_game/type_instances/unit.cpp b/source/glest_game/type_instances/unit.cpp index 517201c9..12e77769 100644 --- a/source/glest_game/type_instances/unit.cpp +++ b/source/glest_game/type_instances/unit.cpp @@ -1494,7 +1494,7 @@ int Unit::getCountOfProducedUnits(const UnitType *ut) const{ //give one command (clear, and push back) std::pair Unit::giveCommand(Command *command, bool tryQueue) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"\n======================\nUnit Command tryQueue = %d\nUnit Info:\n%s\nCommand Info:\n%s\n",tryQueue,this->toString().c_str(),command->toString().c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"\n======================\nUnit Command tryQueue = %d\nUnit Info:\n%s\nCommand Info:\n%s\n",tryQueue,this->toString().c_str(),command->toString(false).c_str()); std::pair result(crFailUndefined,""); changedActiveCommand = false; @@ -1527,7 +1527,7 @@ std::pair Unit::giveCommand(Command *command, bool tryQueu for(list::iterator i= commands.begin(); i != commands.end();){ if((*i)->getPriority() < command_priority){ if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) - SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] Deleting lower priority command [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(*i)->toString().c_str()); + SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] Deleting lower priority command [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,(*i)->toString(false).c_str()); static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__); MutexSafeWrapper safeMutex(mutexCommands,mutexOwnerId); @@ -1547,7 +1547,7 @@ std::pair Unit::giveCommand(Command *command, bool tryQueu //cancel current command if it is not queuable if(commands.empty() == false && commands.back()->getCommandType()->isQueueAppendable() == false) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] Cancel command because last one is NOT queable [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,commands.back()->toString().c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] Cancel command because last one is NOT queable [%s]\n",extractFileFromDirectoryPath(__FILE__).c_str(),__FUNCTION__,__LINE__,commands.back()->toString(false).c_str()); cancelCommand(); } @@ -4159,7 +4159,7 @@ std::string Unit::toString(bool crcMode) const { result += " index = " + intToStr(cmdIdx) + " "; const Command *cmd = *iterList; if(cmd != NULL) { - result += cmd->toString() + "\n"; + result += cmd->toString(false) + "\n"; } cmdIdx++; } diff --git a/source/glest_game/types/command_type.cpp b/source/glest_game/types/command_type.cpp index 152e0d56..e459af12 100644 --- a/source/glest_game/types/command_type.cpp +++ b/source/glest_game/types/command_type.cpp @@ -122,16 +122,19 @@ string StopCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool translate Lang &lang= Lang::getInstance(); str= getName(translatedValue)+"\n"; - str+= lang.get("ReactionSpeed")+": "+ intToStr(stopSkillType->getSpeed())+"\n"; - if(stopSkillType->getEpCost()!=0) - str+= lang.get("EpCost")+": "+intToStr(stopSkillType->getEpCost())+"\n"; - if(stopSkillType->getHpCost()!=0) - str+= lang.get("HpCost")+": "+intToStr(stopSkillType->getHpCost())+"\n"; + str+= lang.get("ReactionSpeed",(translatedValue == true ? "" : "english")) + ": " + intToStr(stopSkillType->getSpeed())+"\n"; + if(stopSkillType->getEpCost() != 0) + str += lang.get("EpCost",(translatedValue == true ? "" : "english")) + ": " + intToStr(stopSkillType->getEpCost())+"\n"; + if(stopSkillType->getHpCost() != 0) + str+= lang.get("HpCost",(translatedValue == true ? "" : "english")) + ": " + intToStr(stopSkillType->getHpCost())+"\n"; str+=stopSkillType->getBoostDesc(translatedValue); return str; } -string StopCommandType::toString() const{ +string StopCommandType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Stop"; + } Lang &lang= Lang::getInstance(); return lang.get("Stop"); } @@ -178,22 +181,25 @@ string MoveCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool translate Lang &lang= Lang::getInstance(); str=getName(translatedValue)+"\n"; - str+= lang.get("WalkSpeed")+": "+ intToStr(moveSkillType->getSpeed()); + str+= lang.get("WalkSpeed",(translatedValue == true ? "" : "english"))+": "+ intToStr(moveSkillType->getSpeed()); if(totalUpgrade->getMoveSpeed(moveSkillType) != 0) { str+= "+" + intToStr(totalUpgrade->getMoveSpeed(moveSkillType)); } str+="\n"; if(moveSkillType->getEpCost()!=0){ - str+= lang.get("EpCost")+": "+intToStr(moveSkillType->getEpCost())+"\n"; + str+= lang.get("EpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(moveSkillType->getEpCost())+"\n"; } - if(moveSkillType->getHpCost()!=0){ - str+= lang.get("HpCost")+": "+intToStr(moveSkillType->getHpCost())+"\n"; + if(moveSkillType->getHpCost()!=0) { + str+= lang.get("HpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(moveSkillType->getHpCost())+"\n"; } str+=moveSkillType->getBoostDesc(translatedValue); return str; } -string MoveCommandType::toString() const{ +string MoveCommandType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Move"; + } Lang &lang= Lang::getInstance(); return lang.get("Move"); } @@ -235,14 +241,14 @@ string AttackCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transla str=getName(translatedValue)+"\n"; if(attackSkillType->getEpCost()!=0){ - str+= lang.get("EpCost") + ": " + intToStr(attackSkillType->getEpCost()) + "\n"; + str+= lang.get("EpCost",(translatedValue == true ? "" : "english")) + ": " + intToStr(attackSkillType->getEpCost()) + "\n"; } - if(attackSkillType->getHpCost()!=0){ - str+= lang.get("HpCost") + ": " + intToStr(attackSkillType->getHpCost()) + "\n"; + if(attackSkillType->getHpCost()!=0){ + str+= lang.get("HpCost",(translatedValue == true ? "" : "english")) + ": " + intToStr(attackSkillType->getHpCost()) + "\n"; } //attack strength - str+= lang.get("AttackStrenght")+": "; + str+= lang.get("AttackStrenght",(translatedValue == true ? "" : "english"))+": "; str+= intToStr(attackSkillType->getAttackStrength()-attackSkillType->getAttackVar()); str+= "..."; str+= intToStr(attackSkillType->getAttackStrength()+attackSkillType->getAttackVar()); @@ -254,11 +260,11 @@ string AttackCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transla //splash radius if(attackSkillType->getSplashRadius()!=0){ - str+= lang.get("SplashRadius")+": "+intToStr(attackSkillType->getSplashRadius())+"\n"; + str+= lang.get("SplashRadius",(translatedValue == true ? "" : "english"))+": "+intToStr(attackSkillType->getSplashRadius())+"\n"; } //attack distance - str+= lang.get("AttackDistance")+": "+intToStr(attackSkillType->getAttackRange()); + str+= lang.get("AttackDistance",(translatedValue == true ? "" : "english"))+": "+intToStr(attackSkillType->getAttackRange()); if(totalUpgrade->getAttackRange(attackSkillType) != 0) { str+= "+"+intToStr(totalUpgrade->getAttackRange(attackSkillType) != 0); } @@ -276,18 +282,21 @@ string AttackCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transla str+="\n"; //movement speed - str+= lang.get("WalkSpeed")+": "+ intToStr(moveSkillType->getSpeed()) ; + str+= lang.get("WalkSpeed",(translatedValue == true ? "" : "english"))+": "+ intToStr(moveSkillType->getSpeed()) ; if(totalUpgrade->getMoveSpeed(moveSkillType) != 0) { str+= "+"+intToStr(totalUpgrade->getMoveSpeed(moveSkillType)); } str+="\n"; - str+= lang.get("AttackSpeed")+": "+ intToStr(attackSkillType->getSpeed()) +"\n"; + str+= lang.get("AttackSpeed",(translatedValue == true ? "" : "english"))+": "+ intToStr(attackSkillType->getSpeed()) +"\n"; str+=attackSkillType->getBoostDesc(translatedValue); return str; } -string AttackCommandType::toString() const{ +string AttackCommandType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Attack"; + } Lang &lang= Lang::getInstance(); return lang.get("Attack"); } @@ -329,14 +338,14 @@ string AttackStoppedCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool str=getName(translatedValue)+"\n"; if(attackSkillType->getEpCost()!=0){ - str+= lang.get("EpCost")+": "+intToStr(attackSkillType->getEpCost())+"\n"; + str+= lang.get("EpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(attackSkillType->getEpCost())+"\n"; } - if(attackSkillType->getHpCost()!=0){ - str+= lang.get("HpCost")+": "+intToStr(attackSkillType->getHpCost())+"\n"; + if(attackSkillType->getHpCost()!=0){ + str+= lang.get("HpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(attackSkillType->getHpCost())+"\n"; } //attack strength - str+= lang.get("AttackStrenght")+": "; + str+= lang.get("AttackStrenght",(translatedValue == true ? "" : "english"))+": "; str+= intToStr(attackSkillType->getAttackStrength()-attackSkillType->getAttackVar()); str+="..."; str+= intToStr(attackSkillType->getAttackStrength()+attackSkillType->getAttackVar()); @@ -347,18 +356,18 @@ string AttackStoppedCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool //splash radius if(attackSkillType->getSplashRadius()!=0){ - str+= lang.get("SplashRadius")+": "+intToStr(attackSkillType->getSplashRadius())+"\n"; + str+= lang.get("SplashRadius",(translatedValue == true ? "" : "english"))+": "+intToStr(attackSkillType->getSplashRadius())+"\n"; } //attack distance - str+= lang.get("AttackDistance")+": "+intToStr(attackSkillType->getAttackRange()); + str+= lang.get("AttackDistance",(translatedValue == true ? "" : "english"))+": "+intToStr(attackSkillType->getAttackRange()); if(totalUpgrade->getAttackRange(attackSkillType) != 0) { str+= "+"+intToStr(totalUpgrade->getAttackRange(attackSkillType) != 0); } str+="\n"; //attack fields - str+= lang.get("Fields") + ": "; + str+= lang.get("Fields",(translatedValue == true ? "" : "english")) + ": "; for(int i= 0; i < fieldCount; i++){ Field field = static_cast(i); if( attackSkillType->getAttackField(field) ) @@ -371,7 +380,10 @@ string AttackStoppedCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool return str; } -string AttackStoppedCommandType::toString() const { +string AttackStoppedCommandType::toString(bool translatedValue) const { + if(translatedValue == false) { + return "AttackStopped"; + } Lang &lang= Lang::getInstance(); return lang.get("AttackStopped"); } @@ -463,18 +475,21 @@ string BuildCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool translat Lang &lang= Lang::getInstance(); str=getName(translatedValue)+"\n"; - str+= lang.get("BuildSpeed")+": "+ intToStr(buildSkillType->getSpeed())+"\n"; + str+= lang.get("BuildSpeed",(translatedValue == true ? "" : "english"))+": "+ intToStr(buildSkillType->getSpeed())+"\n"; if(buildSkillType->getEpCost()!=0){ - str+= lang.get("EpCost")+": "+intToStr(buildSkillType->getEpCost())+"\n"; + str+= lang.get("EpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(buildSkillType->getEpCost())+"\n"; } - if(buildSkillType->getHpCost()!=0){ - str+= lang.get("HpCost")+": "+intToStr(buildSkillType->getHpCost())+"\n"; + if(buildSkillType->getHpCost()!=0){ + str+= lang.get("HpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(buildSkillType->getHpCost())+"\n"; } str+=buildSkillType->getBoostDesc(translatedValue); return str; } -string BuildCommandType::toString() const{ +string BuildCommandType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Build"; + } Lang &lang= Lang::getInstance(); return lang.get("Build"); } @@ -537,16 +552,16 @@ string HarvestCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transl string str; str=getName(translatedValue)+"\n"; - str+= lang.get("HarvestSpeed")+": "+ intToStr(harvestSkillType->getSpeed()/hitsPerUnit)+"\n"; - str+= lang.get("MaxLoad")+": "+ intToStr(maxLoad)+"\n"; - str+= lang.get("LoadedSpeed")+": "+ intToStr(moveLoadedSkillType->getSpeed())+"\n"; + str+= lang.get("HarvestSpeed",(translatedValue == true ? "" : "english"))+": "+ intToStr(harvestSkillType->getSpeed()/hitsPerUnit)+"\n"; + str+= lang.get("MaxLoad",(translatedValue == true ? "" : "english"))+": "+ intToStr(maxLoad)+"\n"; + str+= lang.get("LoadedSpeed",(translatedValue == true ? "" : "english"))+": "+ intToStr(moveLoadedSkillType->getSpeed())+"\n"; if(harvestSkillType->getEpCost()!=0){ - str+= lang.get("EpCost")+": "+intToStr(harvestSkillType->getEpCost())+"\n"; + str+= lang.get("EpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(harvestSkillType->getEpCost())+"\n"; } if(harvestSkillType->getHpCost()!=0){ - str+= lang.get("HpCost")+": "+intToStr(harvestSkillType->getHpCost())+"\n"; + str+= lang.get("HpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(harvestSkillType->getHpCost())+"\n"; } - str+=lang.get("Resources")+":\n"; + str+=lang.get("Resources",(translatedValue == true ? "" : "english"))+":\n"; for(int i=0; igetName(translatedValue)+"\n"; } @@ -554,7 +569,10 @@ string HarvestCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transl return str; } -string HarvestCommandType::toString() const{ +string HarvestCommandType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Harvest"; + } Lang &lang= Lang::getInstance(); return lang.get("Harvest"); } @@ -591,7 +609,10 @@ string HarvestEmergencyReturnCommandType::getDesc(const TotalUpgrade *totalUpgra return str; } -string HarvestEmergencyReturnCommandType::toString() const{ +string HarvestEmergencyReturnCommandType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "HarvestEmergencyReturn"; + } Lang &lang= Lang::getInstance(); return lang.get("Harvest"); } @@ -646,14 +667,14 @@ string RepairCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transla string str; str=getName(translatedValue)+"\n"; - str+= lang.get("RepairSpeed")+": "+ intToStr(repairSkillType->getSpeed())+"\n"; + str+= lang.get("RepairSpeed",(translatedValue == true ? "" : "english"))+": "+ intToStr(repairSkillType->getSpeed())+"\n"; if(repairSkillType->getEpCost()!=0){ - str+= lang.get("EpCost")+": "+intToStr(repairSkillType->getEpCost())+"\n"; + str+= lang.get("EpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(repairSkillType->getEpCost())+"\n"; } if(repairSkillType->getHpCost()!=0){ - str+= lang.get("HpCost")+": "+intToStr(repairSkillType->getHpCost())+"\n"; + str+= lang.get("HpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(repairSkillType->getHpCost())+"\n"; } - str+="\n"+lang.get("CanRepair")+":\n"; + str+="\n"+lang.get("CanRepair",(translatedValue == true ? "" : "english"))+":\n"; for(int i=0; i(repairableUnits[i]))->getName(translatedValue)+"\n"; } @@ -661,7 +682,10 @@ string RepairCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transla return str; } -string RepairCommandType::toString() const{ +string RepairCommandType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Repair"; + } Lang &lang= Lang::getInstance(); return lang.get("Repair"); } @@ -714,7 +738,7 @@ string ProduceCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transl Lang &lang= Lang::getInstance(); //prod speed - str+= lang.get("ProductionSpeed")+": "+ intToStr(produceSkillType->getSpeed()); + str+= lang.get("ProductionSpeed",(translatedValue == true ? "" : "english"))+": "+ intToStr(produceSkillType->getSpeed()); if(totalUpgrade->getProdSpeed(produceSkillType)!=0){ str+="+" + intToStr(totalUpgrade->getProdSpeed(produceSkillType)); } @@ -722,17 +746,20 @@ string ProduceCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transl //mpcost if(produceSkillType->getEpCost()!=0){ - str+= lang.get("EpCost")+": "+intToStr(produceSkillType->getEpCost())+"\n"; + str+= lang.get("EpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(produceSkillType->getEpCost())+"\n"; } if(produceSkillType->getHpCost()!=0){ - str+= lang.get("hpCost")+": "+intToStr(produceSkillType->getHpCost())+"\n"; + str+= lang.get("hpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(produceSkillType->getHpCost())+"\n"; } str+= "\n" + getProducedUnit()->getReqDesc(translatedValue); str+=produceSkillType->getBoostDesc(translatedValue); return str; } -string ProduceCommandType::toString() const{ +string ProduceCommandType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Produce"; + } Lang &lang= Lang::getInstance(); return lang.get("Produce"); } @@ -781,17 +808,20 @@ string UpgradeCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transl Lang &lang= Lang::getInstance(); str=getName(translatedValue)+"\n"; - str+= lang.get("UpgradeSpeed")+": "+ intToStr(upgradeSkillType->getSpeed())+"\n"; + str+= lang.get("UpgradeSpeed",(translatedValue == true ? "" : "english"))+": "+ intToStr(upgradeSkillType->getSpeed())+"\n"; if(upgradeSkillType->getEpCost()!=0) - str+= lang.get("EpCost")+": "+intToStr(upgradeSkillType->getEpCost())+"\n"; -if(upgradeSkillType->getHpCost()!=0) - str+= lang.get("HpCost")+": "+intToStr(upgradeSkillType->getHpCost())+"\n"; + str+= lang.get("EpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(upgradeSkillType->getEpCost())+"\n"; + if(upgradeSkillType->getHpCost()!=0) + str+= lang.get("HpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(upgradeSkillType->getHpCost())+"\n"; str+= "\n"+getProducedUpgrade()->getReqDesc(translatedValue); str+=upgradeSkillType->getBoostDesc(translatedValue); return str; } -string UpgradeCommandType::toString() const{ +string UpgradeCommandType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Upgrade"; + } Lang &lang= Lang::getInstance(); return lang.get("Upgrade"); } @@ -853,19 +883,19 @@ string MorphCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool translat Lang &lang= Lang::getInstance(); //prod speed - str+= lang.get("MorphSpeed")+": "+ intToStr(morphSkillType->getSpeed())+"\n"; + str+= lang.get("MorphSpeed",(translatedValue == true ? "" : "english"))+": "+ intToStr(morphSkillType->getSpeed())+"\n"; //mpcost if(morphSkillType->getEpCost()!=0){ - str+= lang.get("EpCost")+": "+intToStr(morphSkillType->getEpCost())+"\n"; + str+= lang.get("EpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(morphSkillType->getEpCost())+"\n"; } if(morphSkillType->getHpCost()!=0){ - str+= lang.get("HpCost")+": "+intToStr(morphSkillType->getHpCost())+"\n"; + str+= lang.get("HpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(morphSkillType->getHpCost())+"\n"; } //discount if(discount!=0){ - str+= lang.get("Discount")+": "+intToStr(discount)+"%\n"; + str+= lang.get("Discount",(translatedValue == true ? "" : "english"))+": "+intToStr(discount)+"%\n"; } str+= "\n"+getProduced()->getReqDesc(ignoreResourceRequirements,translatedValue); @@ -874,7 +904,10 @@ string MorphCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool translat return str; } -string MorphCommandType::toString() const{ +string MorphCommandType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Morph"; + } Lang &lang= Lang::getInstance(); return lang.get("Morph"); } @@ -918,7 +951,10 @@ string SwitchTeamCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool tra return str; } -string SwitchTeamCommandType::toString() const{ +string SwitchTeamCommandType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "SwitchTeam"; + } Lang &lang= Lang::getInstance(); return lang.get("SwitchTeam"); } diff --git a/source/glest_game/types/command_type.h b/source/glest_game/types/command_type.h index bc5e9660..4335050d 100644 --- a/source/glest_game/types/command_type.h +++ b/source/glest_game/types/command_type.h @@ -97,7 +97,7 @@ public: const TechTree *tt, const FactionType *ft, const UnitType &ut, std::map > > &loadedFileList, string parentLoader); virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const= 0; - virtual string toString() const= 0; + virtual string toString(bool translatedValue) const= 0; virtual const ProducibleType *getProduced() const {return NULL;} virtual Queueability isQueuable() const {return qOnRequest;} bool isQueuable(bool tryQueue) const { @@ -137,7 +137,7 @@ public: const FactionType *ft, const UnitType &ut, std::map > > &loadedFileList, string parentLoader); virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; - virtual string toString() const; + virtual string toString(bool translatedValue) const; virtual Queueability isQueuable() const {return qNever;} virtual int getTypePriority() const {return 100000;} //get @@ -162,7 +162,7 @@ public: const TechTree *tt, const FactionType *ft, const UnitType &ut, std::map > > &loadedFileList, string parentLoader); virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; - virtual string toString() const; + virtual string toString(bool translatedValue) const; //get const MoveSkillType *getMoveSkillType() const {return moveSkillType;}; @@ -187,7 +187,7 @@ public: const TechTree *tt, const FactionType *ft, const UnitType &ut, std::map > > &loadedFileList, string parentLoader); virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; - virtual string toString() const; + virtual string toString(bool translatedValue) const; //get @@ -213,7 +213,7 @@ public: const TechTree *tt, const FactionType *ft, const UnitType &ut, std::map > > &loadedFileList, string parentLoader); virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; - virtual string toString() const; + virtual string toString(bool translatedValue) const; //get const StopSkillType * getStopSkillType() const {return stopSkillType;} @@ -243,7 +243,7 @@ public: const TechTree *tt, const FactionType *ft, const UnitType &ut, std::map > > &loadedFileList, string parentLoader); virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; - virtual string toString() const; + virtual string toString(bool translatedValue) const; //get const MoveSkillType *getMoveSkillType() const {return moveSkillType;} @@ -278,7 +278,7 @@ public: const TechTree *tt, const FactionType *ft, const UnitType &ut, std::map > > &loadedFileList, string parentLoader); virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; - virtual string toString() const; + virtual string toString(bool translatedValue) const; virtual Queueability isQueuable() const {return qOnRequest;} //get @@ -309,7 +309,7 @@ public: const TechTree *tt, const FactionType *ft, const UnitType &ut, std::map > > &loadedFileList, string parentLoader); virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; - virtual string toString() const; + virtual string toString(bool translatedValue) const; virtual Queueability isQueuable() const {return qOnRequest;} //get @@ -335,7 +335,7 @@ public: const TechTree *tt, const FactionType *ft, const UnitType &ut, std::map > > &loadedFileList, string parentLoader); virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; - virtual string toString() const; + virtual string toString(bool translatedValue) const; //get const MoveSkillType *getMoveSkillType() const {return moveSkillType;}; @@ -366,7 +366,7 @@ public: std::map > > &loadedFileList, string parentLoader); virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; virtual string getReqDesc(bool translatedValue) const; - virtual string toString() const; + virtual string toString(bool translatedValue) const; virtual const ProducibleType *getProduced() const; virtual Queueability isQueuable() const {return qAlways;} virtual int getTypePriority() const {return 15;} @@ -395,7 +395,7 @@ public: const TechTree *tt, const FactionType *ft, const UnitType &ut, std::map > > &loadedFileList, string parentLoader); virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; - virtual string toString() const; + virtual string toString(bool translatedValue) const; virtual string getReqDesc(bool translatedValue) const; virtual const ProducibleType *getProduced() const; virtual Queueability isQueuable() const {return qAlways;} @@ -426,7 +426,7 @@ public: const TechTree *tt, const FactionType *ft, const UnitType &ut, std::map > > &loadedFileList, string parentLoader); virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; - virtual string toString() const; + virtual string toString(bool translatedValue) const; virtual string getReqDesc(bool translatedValue) const; virtual const ProducibleType *getProduced() const; Queueability isQueuable() const {return qOnlyLast;} //After morph anything can happen @@ -455,7 +455,7 @@ public: const TechTree *tt, const FactionType *ft, const UnitType &ut, std::map > > &loadedFileList, string parentLoader); virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; - virtual string toString() const; + virtual string toString(bool translatedValue) const; virtual bool usesPathfinder() const { return false; } }; diff --git a/source/glest_game/types/element_type.cpp b/source/glest_game/types/element_type.cpp index fa09c556..0907621d 100644 --- a/source/glest_game/types/element_type.cpp +++ b/source/glest_game/types/element_type.cpp @@ -78,7 +78,7 @@ string RequirableType::getReqDesc(bool translatedValue) const{ string str= getName(translatedValue); if(anyReqs){ - return str + " " + Lang::getInstance().get("Reqs") + ":\n" + reqString; + return str + " " + Lang::getInstance().get("Reqs",(translatedValue == true ? "" : "english")) + ":\n" + reqString; } else{ return str; @@ -176,7 +176,7 @@ string ProducibleType::getUnitAndUpgradeReqDesc(bool lineBreaks, bool translated } string ProducibleType::getReqDesc(bool ignoreResourceRequirements, bool translatedValue) const { - string str= getName(translatedValue) + " " + Lang::getInstance().get("Reqs") + ":\n"; + string str= getName(translatedValue) + " " + Lang::getInstance().get("Reqs",(translatedValue == true ? "" : "english")) + ":\n"; if(ignoreResourceRequirements == false) { str+= getResourceReqDesc(true,translatedValue); } diff --git a/source/glest_game/types/skill_type.cpp b/source/glest_game/types/skill_type.cpp index 125bfac7..fa86f420 100644 --- a/source/glest_game/types/skill_type.cpp +++ b/source/glest_game/types/skill_type.cpp @@ -686,7 +686,10 @@ StopSkillType::StopSkillType(){ skillClass= scStop; } -string StopSkillType::toString() const{ +string StopSkillType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Stop"; + } return Lang::getInstance().get("Stop"); } @@ -698,7 +701,11 @@ MoveSkillType::MoveSkillType(){ skillClass= scMove; } -string MoveSkillType::toString() const{ +string MoveSkillType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Move"; + } + return Lang::getInstance().get("Move"); } @@ -847,7 +854,11 @@ void AttackSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, } } -string AttackSkillType::toString() const{ +string AttackSkillType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Attack"; + } + return Lang::getInstance().get("Attack"); } @@ -918,7 +929,11 @@ BuildSkillType::BuildSkillType(){ skillClass= scBuild; } -string BuildSkillType::toString() const{ +string BuildSkillType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Build"; + } + return Lang::getInstance().get("Build"); } @@ -930,7 +945,11 @@ HarvestSkillType::HarvestSkillType(){ skillClass= scHarvest; } -string HarvestSkillType::toString() const{ +string HarvestSkillType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Harvest"; + } + return Lang::getInstance().get("Harvest"); } @@ -942,7 +961,11 @@ RepairSkillType::RepairSkillType(){ skillClass= scRepair; } -string RepairSkillType::toString() const{ +string RepairSkillType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Repair"; + } + return Lang::getInstance().get("Repair"); } @@ -970,7 +993,11 @@ void ProduceSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, } -string ProduceSkillType::toString() const{ +string ProduceSkillType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Produce"; + } + return Lang::getInstance().get("Produce"); } @@ -1010,7 +1037,11 @@ void UpgradeSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, } } -string UpgradeSkillType::toString() const{ +string UpgradeSkillType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Upgrade"; + } + return Lang::getInstance().get("Upgrade"); } @@ -1055,7 +1086,11 @@ void BeBuiltSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, } -string BeBuiltSkillType::toString() const{ +string BeBuiltSkillType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Be built"; + } + return "Be built"; } @@ -1090,7 +1125,11 @@ void MorphSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, } } -string MorphSkillType::toString() const{ +string MorphSkillType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Morph"; + } + return "Morph"; } @@ -1126,7 +1165,11 @@ void DieSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, fade= sn->getChild("fade")->getAttribute("value")->getBoolValue(); } -string DieSkillType::toString() const{ +string DieSkillType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "Die"; + } + return "Die"; } @@ -1162,7 +1205,11 @@ void FogOfWarSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode, durationTime = sn->getChild("duration")->getAttribute("value")->getFloatValue(); } -string FogOfWarSkillType::toString() const{ +string FogOfWarSkillType::toString(bool translatedValue) const{ + if(translatedValue == false) { + return "FogOfWar"; + } + return "FogOfWar"; } diff --git a/source/glest_game/types/skill_type.h b/source/glest_game/types/skill_type.h index 5766d6be..e9e71ea5 100644 --- a/source/glest_game/types/skill_type.h +++ b/source/glest_game/types/skill_type.h @@ -184,7 +184,7 @@ public: //virtual string getDesc(const TotalUpgrade *totalUpgrade) const= 0; //other - virtual string toString() const= 0; + virtual string toString(bool translatedValue) const= 0; virtual int getTotalSpeed(const TotalUpgrade *) const {return speed;} static string skillClassToStr(SkillClass skillClass); static string fieldToStr(Field field); @@ -200,7 +200,7 @@ public: class StopSkillType: public SkillType{ public: StopSkillType(); - virtual string toString() const; + virtual string toString(bool translatedValue) const; }; // =============================== @@ -210,7 +210,7 @@ public: class MoveSkillType: public SkillType{ public: MoveSkillType(); - virtual string toString() const; + virtual string toString(bool translatedValue) const; virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const; }; @@ -245,7 +245,7 @@ public: virtual void load(const XmlNode *sn, const XmlNode *attackBoostsNode, const string &dir, const TechTree *tt, const FactionType *ft, std::map > > &loadedFileList, string parentLoader); - virtual string toString() const; + virtual string toString(bool translatedValue) const; //get inline int getAttackStrength() const {return attackStrength;} @@ -283,7 +283,7 @@ public: class BuildSkillType: public SkillType{ public: BuildSkillType(); - virtual string toString() const; + virtual string toString(bool translatedValue) const; }; // =============================== @@ -293,7 +293,7 @@ public: class HarvestSkillType: public SkillType{ public: HarvestSkillType(); - virtual string toString() const; + virtual string toString(bool translatedValue) const; }; // =============================== @@ -303,7 +303,7 @@ public: class RepairSkillType: public SkillType{ public: RepairSkillType(); - virtual string toString() const; + virtual string toString(bool translatedValue) const; }; // =============================== @@ -320,7 +320,7 @@ public: const FactionType *ft, std::map > > &loadedFileList, string parentLoader); - virtual string toString() const; + virtual string toString(bool translatedValue) const; virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const; @@ -341,7 +341,7 @@ public: const FactionType *ft, std::map > > &loadedFileList, string parentLoader); - virtual string toString() const; + virtual string toString(bool translatedValue) const; virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const; @@ -364,7 +364,7 @@ public: virtual void load(const XmlNode *sn, const XmlNode *attackBoostsNode, const string &dir, const TechTree *tt, const FactionType *ft, std::map > > &loadedFileList, string parentLoader); - virtual string toString() const; + virtual string toString(bool translatedValue) const; virtual void saveGame(XmlNode *rootNode); }; @@ -385,7 +385,7 @@ public: const FactionType *ft, std::map > > &loadedFileList, string parentLoader); - virtual string toString() const; + virtual string toString(bool translatedValue) const; virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const; virtual void saveGame(XmlNode *rootNode); @@ -406,7 +406,7 @@ public: virtual void load(const XmlNode *sn, const XmlNode *attackBoostsNode, const string &dir, const TechTree *tt, const FactionType *ft, std::map > > &loadedFileList, string parentLoader); - virtual string toString() const; + virtual string toString(bool translatedValue) const; virtual void saveGame(XmlNode *rootNode); }; @@ -430,7 +430,7 @@ public: virtual void load(const XmlNode *sn, const XmlNode *attackBoostsNode, const string &dir, const TechTree *tt, const FactionType *ft, std::map > > &loadedFileList, string parentLoader); - virtual string toString() const; + virtual string toString(bool translatedValue) const; virtual void saveGame(XmlNode *rootNode); }; diff --git a/source/glest_game/types/unit_type.cpp b/source/glest_game/types/unit_type.cpp index 76d68e37..0c29c031 100644 --- a/source/glest_game/types/unit_type.cpp +++ b/source/glest_game/types/unit_type.cpp @@ -1024,7 +1024,7 @@ string UnitType::getCommandTypeListDesc() const { string desc = "Commands: "; for(int i=0; igetId()); + " toString: " + commandType->toString(); + desc += " id = " + intToStr(commandType->getId()); + " toString: " + commandType->toString(false); } return desc; @@ -1094,12 +1094,12 @@ std::string UnitType::toString() const { result += " skillTypes: [" + intToStr(skillTypes.size()) + "]"; for(int i = 0; i < skillTypes.size(); ++i) { - result += " i = " + intToStr(i) + " " + skillTypes[i]->toString(); + result += " i = " + intToStr(i) + " " + skillTypes[i]->toString(false); } result += " commandTypes: [" + intToStr(commandTypes.size()) + "]"; for(int i = 0; i < commandTypes.size(); ++i) { - result += " i = " + intToStr(i) + " " + commandTypes[i]->toString(); + result += " i = " + intToStr(i) + " " + commandTypes[i]->toString(false); } result += " storedResources: [" + intToStr(storedResources.size()) + "]"; diff --git a/source/glest_game/types/upgrade_type.cpp b/source/glest_game/types/upgrade_type.cpp index 9503f885..4ce72ad8 100644 --- a/source/glest_game/types/upgrade_type.cpp +++ b/source/glest_game/types/upgrade_type.cpp @@ -246,10 +246,10 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{ if(maxHp != 0) { if(maxHpIsMultiplier) { - str += indent+lang.get("Hp") + " *" + intToStr(maxHp); + str += indent+lang.get("Hp",(translatedValue == true ? "" : "english")) + " *" + intToStr(maxHp); } else { - str += indent+lang.get("Hp") + " +" + intToStr(maxHp); + str += indent+lang.get("Hp",(translatedValue == true ? "" : "english")) + " +" + intToStr(maxHp); } if(maxHpRegeneration != 0) { @@ -262,10 +262,10 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{ str += "\n"; } if(sightIsMultiplier) { - str+= indent+lang.get("Sight") + " *" + intToStr(sight); + str+= indent+lang.get("Sight",(translatedValue == true ? "" : "english")) + " *" + intToStr(sight); } else { - str+= indent+lang.get("Sight") + " +" + intToStr(sight); + str+= indent+lang.get("Sight",(translatedValue == true ? "" : "english")) + " +" + intToStr(sight); } } if(maxEp != 0) { @@ -274,10 +274,10 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{ } if(maxEpIsMultiplier) { - str+= indent+lang.get("Ep") + " *" + intToStr(maxEp); + str+= indent+lang.get("Ep",(translatedValue == true ? "" : "english")) + " *" + intToStr(maxEp); } else { - str+= indent+lang.get("Ep") + " +" + intToStr(maxEp); + str+= indent+lang.get("Ep",(translatedValue == true ? "" : "english")) + " +" + intToStr(maxEp); } if(maxEpRegeneration != 0) { str += " [" + intToStr(maxEpRegeneration) + "]"; @@ -289,10 +289,10 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{ } if(attackStrengthIsMultiplier) { - str+= indent+lang.get("AttackStrenght") + " *" + intToStr(attackStrength); + str+= indent+lang.get("AttackStrenght",(translatedValue == true ? "" : "english")) + " *" + intToStr(attackStrength); } else { - str+= indent+lang.get("AttackStrenght") + " +" + intToStr(attackStrength); + str+= indent+lang.get("AttackStrenght",(translatedValue == true ? "" : "english")) + " +" + intToStr(attackStrength); } } if(attackRange != 0) { @@ -301,10 +301,10 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{ } if(attackRangeIsMultiplier) { - str+= indent+lang.get("AttackDistance") + " *" + intToStr(attackRange); + str+= indent+lang.get("AttackDistance",(translatedValue == true ? "" : "english")) + " *" + intToStr(attackRange); } else { - str+= indent+lang.get("AttackDistance") + " +" + intToStr(attackRange); + str+= indent+lang.get("AttackDistance",(translatedValue == true ? "" : "english")) + " +" + intToStr(attackRange); } } if(armor != 0) { @@ -313,10 +313,10 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{ } if(armorIsMultiplier) { - str+= indent+lang.get("Armor") + " *" + intToStr(armor); + str+= indent+lang.get("Armor",(translatedValue == true ? "" : "english")) + " *" + intToStr(armor); } else { - str+= indent+lang.get("Armor") + " +" + intToStr(armor); + str+= indent+lang.get("Armor",(translatedValue == true ? "" : "english")) + " +" + intToStr(armor); } } if(moveSpeed != 0) { @@ -325,10 +325,10 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{ } if(moveSpeedIsMultiplier) { - str+= indent+lang.get("WalkSpeed") + " *" + intToStr(moveSpeed); + str+= indent+lang.get("WalkSpeed",(translatedValue == true ? "" : "english")) + " *" + intToStr(moveSpeed); } else { - str+= indent+lang.get("WalkSpeed") + " +" + intToStr(moveSpeed); + str+= indent+lang.get("WalkSpeed",(translatedValue == true ? "" : "english")) + " +" + intToStr(moveSpeed); } } if(prodSpeed != 0) { @@ -337,10 +337,10 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{ } if(prodSpeedIsMultiplier) { - str+= indent+lang.get("ProductionSpeed") + " *" + intToStr(prodSpeed); + str+= indent+lang.get("ProductionSpeed",(translatedValue == true ? "" : "english")) + " *" + intToStr(prodSpeed); } else { - str+= indent+lang.get("ProductionSpeed") + " +" + intToStr(prodSpeed); + str+= indent+lang.get("ProductionSpeed",(translatedValue == true ? "" : "english")) + " +" + intToStr(prodSpeed); } } if(str != "") { @@ -563,11 +563,11 @@ string UpgradeType::getReqDesc(bool translatedValue) const{ string str= ProducibleType::getReqDesc(translatedValue); string indent=" "; if(getEffectCount()>0){ - str+= "\n"+ lang.get("Upgrades")+"\n"; + str+= "\n"+ lang.get("Upgrades",(translatedValue == true ? "" : "english"))+"\n"; } str+=UpgradeTypeBase::getDesc(translatedValue); if(getEffectCount()>0){ - str+= lang.get("AffectedUnits")+"\n"; + str+= lang.get("AffectedUnits",(translatedValue == true ? "" : "english"))+"\n"; for(int i=0; igetName(translatedValue)+"\n"; } diff --git a/source/glest_game/world/unit_updater.cpp b/source/glest_game/world/unit_updater.cpp index 7c4e81f3..fc7701bb 100644 --- a/source/glest_game/world/unit_updater.cpp +++ b/source/glest_game/world/unit_updater.cpp @@ -306,7 +306,7 @@ void UnitUpdater::updateUnitCommand(Unit *unit, int frameIndex) { if(minorDebugPerformance && frameIndex > 0) elapsed1 = chrono.getMillis(); if(hasCommand == true) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] unit [%s] has command [%s]\n",__FILE__,__FUNCTION__,__LINE__,unit->toString().c_str(), unit->getCurrCommand()->toString().c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] unit [%s] has command [%s]\n",__FILE__,__FUNCTION__,__LINE__,unit->toString(false).c_str(), unit->getCurrCommand()->toString(false).c_str()); bool commandUsesPathFinder = (frameIndex < 0); if(frameIndex > 0) { @@ -327,7 +327,7 @@ void UnitUpdater::updateUnitCommand(Unit *unit, int frameIndex) { if((minorDebugPerformance && frameIndex > 0) && (chrono.getMillis() - elapsed1) >= 1) { //CommandClass cc = unit->getCurrCommand()->getCommandType()->commandTypeClass; - printf("UnitUpdate [%d - %s] #2-unit threaded updates on frame: %d commandUsesPathFinder = %d took [%lld] msecs\nCommand: %s\n",unit->getId(),unit->getType()->getName(false).c_str(),frameIndex,commandUsesPathFinder,(long long int)chrono.getMillis() - elapsed1,unit->getCurrCommand()->toString().c_str()); + printf("UnitUpdate [%d - %s] #2-unit threaded updates on frame: %d commandUsesPathFinder = %d took [%lld] msecs\nCommand: %s\n",unit->getId(),unit->getType()->getName(false).c_str(),frameIndex,commandUsesPathFinder,(long long int)chrono.getMillis() - elapsed1,unit->getCurrCommand()->toString(false).c_str()); } } @@ -428,7 +428,7 @@ void UnitUpdater::updateMove(Unit *unit, int frameIndex) { if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) { char szBuf[8096]=""; - snprintf(szBuf,8096,"[updateMove] pos [%s] unit [%d - %s] cmd [%s]",pos.getString().c_str(),unit->getId(),unit->getFullName(false).c_str(),command->toString().c_str()); + snprintf(szBuf,8096,"[updateMove] pos [%s] unit [%d - %s] cmd [%s]",pos.getString().c_str(),unit->getId(),unit->getFullName(false).c_str(),command->toString(false).c_str()); unit->logSynchData(__FILE__,__LINE__,szBuf); } @@ -804,7 +804,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) { Chrono chrono; if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled) chrono.start(); - if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] unit [%s] will build using command [%s]\n",__FILE__,__FUNCTION__,__LINE__,unit->toString().c_str(), unit->getCurrCommand()->toString().c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] unit [%s] will build using command [%s]\n",__FILE__,__FUNCTION__,__LINE__,unit->toString(false).c_str(), unit->getCurrCommand()->toString(false).c_str()); Command *command= unit->getCurrCommand(); const BuildCommandType *bct= static_cast(command->getCommandType()); @@ -926,7 +926,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) { gameCamera->getPos()); } - if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] unit created for unit [%s]\n",__FILE__,__FUNCTION__,__LINE__,builtUnit->toString().c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] unit created for unit [%s]\n",__FILE__,__FUNCTION__,__LINE__,builtUnit->toString(false).c_str()); } else { //if there are no free cells @@ -954,7 +954,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) { if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s Line: %d] took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis()); } else { - if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] tsArrived unit = %s\n",__FILE__,__FUNCTION__,__LINE__,unit->toString().c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] tsArrived unit = %s\n",__FILE__,__FUNCTION__,__LINE__,unit->toString(false).c_str()); if(frameIndex < 0) { //if building @@ -964,7 +964,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) { } if(builtUnit != NULL) { - if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] builtUnit = %s\n",__FILE__,__FUNCTION__,__LINE__,builtUnit->toString().c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] builtUnit = %s\n",__FILE__,__FUNCTION__,__LINE__,builtUnit->toString(false).c_str()); } if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] builtUnit = [%p]\n",__FILE__,__FUNCTION__,__LINE__,builtUnit); @@ -1633,7 +1633,7 @@ Unit * UnitUpdater::findPeerUnitBuilder(Unit *unit) { } } else { - if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] **peer NOT building**, peerUnit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,peerUnit->toString().c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] **peer NOT building**, peerUnit = [%s]\n",__FILE__,__FUNCTION__,__LINE__,peerUnit->toString(false).c_str()); if(firstLinkedPeerRepairer == NULL) { const RepairCommandType *prct = dynamic_cast(peerCommand->getCommandType()); @@ -1659,7 +1659,7 @@ Unit * UnitUpdater::findPeerUnitBuilder(Unit *unit) { } } - if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] returning foundUnitBuilder = [%s]\n",__FILE__,__FUNCTION__,__LINE__,(foundUnitBuilder != NULL ? foundUnitBuilder->toString().c_str() : "null")); + if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] returning foundUnitBuilder = [%s]\n",__FILE__,__FUNCTION__,__LINE__,(foundUnitBuilder != NULL ? foundUnitBuilder->toString(false).c_str() : "null")); return foundUnitBuilder; } @@ -2029,7 +2029,7 @@ void UnitUpdater::updateProduce(Unit *unit, int frameIndex) { produced= new Unit(world->getNextUnitId(unit->getFaction()), newpath, Vec2i(0), pct->getProducedUnit(), unit->getFaction(), world->getMap(), CardinalDir::NORTH); - if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] about to place unit for unit [%s]\n",__FILE__,__FUNCTION__,__LINE__,produced->toString().c_str()); + if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) SystemFlags::OutputDebug(SystemFlags::debugUnitCommands,"In [%s::%s Line: %d] about to place unit for unit [%s]\n",__FILE__,__FUNCTION__,__LINE__,produced->toString(false).c_str()); if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled && chrono.getMillis() > 0) SystemFlags::OutputDebug(SystemFlags::debugPerformance,"In [%s::%s] Line: %d took msecs: %lld\n",__FILE__,__FUNCTION__,__LINE__,chrono.getMillis()); diff --git a/source/shared_lib/sources/util/randomgen.cpp b/source/shared_lib/sources/util/randomgen.cpp index ad44c9c8..04204a37 100644 --- a/source/shared_lib/sources/util/randomgen.cpp +++ b/source/shared_lib/sources/util/randomgen.cpp @@ -74,7 +74,7 @@ int RandomGen::randRange(int min, int max){ // int res = streflop::Random(min, max); // streflop //#else int diff= max-min; - int res= min + static_cast(truncateDecimal(static_cast(diff+1))*RandomGen::rand() / m); + int res= min + static_cast(truncateDecimal(static_cast(diff+1),2)*RandomGen::rand() / m); //#endif assert(res>=min && res<=max); if(res < min || res > max) {