loggging fixes for language specific info (use english always)

This commit is contained in:
Mark Vejvoda 2013-09-21 20:50:58 +00:00
parent 792ab1b7bc
commit 836e61d5d6
14 changed files with 230 additions and 147 deletions

View File

@ -198,7 +198,7 @@ TravelState PathFinder::findPath(Unit *unit, const Vec2i &finalPos, bool *wasStu
string commandDesc = "none"; string commandDesc = "none";
Command *command= unit->getCurrCommand(); Command *command= unit->getCurrCommand();
if(command != NULL && command->getCommandType() != NULL) { if(command != NULL && command->getCommandType() != NULL) {
commandDesc = command->getCommandType()->toString(); commandDesc = command->getCommandType()->toString(false);
} }
char szBuf[8096]=""; char szBuf[8096]="";
snprintf(szBuf,8096,"State: arrived#1 at pos: %s, command [%s]",finalPos.getString().c_str(),commandDesc.c_str()); 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"; string commandDesc = "none";
Command *command= unit->getCurrCommand(); Command *command= unit->getCurrCommand();
if(command != NULL && command->getCommandType() != NULL) { if(command != NULL && command->getCommandType() != NULL) {
commandDesc = command->getCommandType()->toString(); commandDesc = command->getCommandType()->toString(false);
} }
char szBuf[8096]=""; char szBuf[8096]="";
@ -1136,7 +1136,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
string commandDesc = "none"; string commandDesc = "none";
Command *command= unit->getCurrCommand(); Command *command= unit->getCurrCommand();
if(command != NULL && command->getCommandType() != NULL) { if(command != NULL && command->getCommandType() != NULL) {
commandDesc = command->getCommandType()->toString(); commandDesc = command->getCommandType()->toString(false);
} }
char szBuf[8096]=""; char szBuf[8096]="";
@ -1371,7 +1371,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
string commandDesc = "none"; string commandDesc = "none";
Command *command= unit->getCurrCommand(); Command *command= unit->getCurrCommand();
if(command != NULL && command->getCommandType() != NULL) { if(command != NULL && command->getCommandType() != NULL) {
commandDesc = command->getCommandType()->toString(); commandDesc = command->getCommandType()->toString(false);
} }
std::pair<Vec2i,int> lastHarvest = unit->getLastHarvestResourceTarget(); std::pair<Vec2i,int> lastHarvest = unit->getLastHarvestResourceTarget();
@ -1485,7 +1485,7 @@ TravelState PathFinder::aStar(Unit *unit, const Vec2i &targetPos, bool inBailout
string commandDesc = "none"; string commandDesc = "none";
Command *command= unit->getCurrCommand(); Command *command= unit->getCurrCommand();
if(command != NULL && command->getCommandType() != NULL) { if(command != NULL && command->getCommandType() != NULL) {
commandDesc = command->getCommandType()->toString(); commandDesc = command->getCommandType()->toString(false);
} }
char szBuf[8096]=""; char szBuf[8096]="";

View File

@ -770,7 +770,7 @@ void Gui::computeInfoString(int posDisplay){
const UnitType *ut= selection.getFrontUnit()->getType(); const UnitType *ut= selection.getFrontUnit()->getType();
CommandClass cc= display.getCommandClass(posDisplay); CommandClass cc= display.getCommandClass(posDisplay);
if(cc!=ccNull){ if(cc!=ccNull){
display.setInfoText(lang.get("CommonCommand") + ": " + ut->getFirstCtOfClass(cc)->toString()); display.setInfoText(lang.get("CommonCommand") + ": " + ut->getFirstCtOfClass(cc)->toString(true));
} }
} }
} }

View File

@ -104,12 +104,12 @@ void Command::setUnit(Unit *unit){
this->unitRef= 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__); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__, __LINE__);
std::string result = ""; std::string result = "";
if(commandType != NULL) { if(commandType != NULL) {
result = "commandType id = " + intToStr(commandType->getId()) + ", desc = " + commandType->toString(); result = "commandType id = " + intToStr(commandType->getId()) + ", desc = " + commandType->toString(translatedValue);
} }
else { else {
result = "commandType = NULL"; result = "commandType = NULL";
@ -134,7 +134,7 @@ std::string Command::toString() const {
if(unitType != NULL) { if(unitType != NULL) {
result += ", unitTypeId = " + intToStr(unitType->getId()); 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__); //SystemFlags::OutputDebug(SystemFlags::debugSystem,"In [%s::%s Line: %d]\n",__FILE__,__FUNCTION__, __LINE__);

View File

@ -91,7 +91,7 @@ public:
inline void setUnitCommandGroupId(int value) { unitCommandGroupId = value; } inline void setUnitCommandGroupId(int value) { unitCommandGroupId = value; }
inline int getUnitCommandGroupId() const { return unitCommandGroupId; } inline int getUnitCommandGroupId() const { return unitCommandGroupId; }
std::string toString() const; std::string toString(bool translatedValue) const;
void saveGame(XmlNode *rootNode, Faction *faction); void saveGame(XmlNode *rootNode, Faction *faction);
static Command * loadGame(const XmlNode *rootNode,const UnitType *ut,World *world); static Command * loadGame(const XmlNode *rootNode,const UnitType *ut,World *world);

View File

@ -1494,7 +1494,7 @@ int Unit::getCountOfProducedUnits(const UnitType *ut) const{
//give one command (clear, and push back) //give one command (clear, and push back)
std::pair<CommandResult,string> Unit::giveCommand(Command *command, bool tryQueue) { std::pair<CommandResult,string> 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<CommandResult,string> result(crFailUndefined,""); std::pair<CommandResult,string> result(crFailUndefined,"");
changedActiveCommand = false; changedActiveCommand = false;
@ -1527,7 +1527,7 @@ std::pair<CommandResult,string> Unit::giveCommand(Command *command, bool tryQueu
for(list<Command*>::iterator i= commands.begin(); i != commands.end();){ for(list<Command*>::iterator i= commands.begin(); i != commands.end();){
if((*i)->getPriority() < command_priority){ if((*i)->getPriority() < command_priority){
if(SystemFlags::getSystemSettingType(SystemFlags::debugUnitCommands).enabled) 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__); static string mutexOwnerId = string(__FILE__) + string("_") + intToStr(__LINE__);
MutexSafeWrapper safeMutex(mutexCommands,mutexOwnerId); MutexSafeWrapper safeMutex(mutexCommands,mutexOwnerId);
@ -1547,7 +1547,7 @@ std::pair<CommandResult,string> Unit::giveCommand(Command *command, bool tryQueu
//cancel current command if it is not queuable //cancel current command if it is not queuable
if(commands.empty() == false && if(commands.empty() == false &&
commands.back()->getCommandType()->isQueueAppendable() == 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(); cancelCommand();
} }
@ -4159,7 +4159,7 @@ std::string Unit::toString(bool crcMode) const {
result += " index = " + intToStr(cmdIdx) + " "; result += " index = " + intToStr(cmdIdx) + " ";
const Command *cmd = *iterList; const Command *cmd = *iterList;
if(cmd != NULL) { if(cmd != NULL) {
result += cmd->toString() + "\n"; result += cmd->toString(false) + "\n";
} }
cmdIdx++; cmdIdx++;
} }

View File

@ -122,16 +122,19 @@ string StopCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool translate
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
str= getName(translatedValue)+"\n"; str= getName(translatedValue)+"\n";
str+= lang.get("ReactionSpeed")+": "+ intToStr(stopSkillType->getSpeed())+"\n"; str+= lang.get("ReactionSpeed",(translatedValue == true ? "" : "english")) + ": " + intToStr(stopSkillType->getSpeed())+"\n";
if(stopSkillType->getEpCost()!=0) if(stopSkillType->getEpCost() != 0)
str+= lang.get("EpCost")+": "+intToStr(stopSkillType->getEpCost())+"\n"; str += lang.get("EpCost",(translatedValue == true ? "" : "english")) + ": " + intToStr(stopSkillType->getEpCost())+"\n";
if(stopSkillType->getHpCost()!=0) if(stopSkillType->getHpCost() != 0)
str+= lang.get("HpCost")+": "+intToStr(stopSkillType->getHpCost())+"\n"; str+= lang.get("HpCost",(translatedValue == true ? "" : "english")) + ": " + intToStr(stopSkillType->getHpCost())+"\n";
str+=stopSkillType->getBoostDesc(translatedValue); str+=stopSkillType->getBoostDesc(translatedValue);
return str; return str;
} }
string StopCommandType::toString() const{ string StopCommandType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "Stop";
}
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
return lang.get("Stop"); return lang.get("Stop");
} }
@ -178,22 +181,25 @@ string MoveCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool translate
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
str=getName(translatedValue)+"\n"; 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) { if(totalUpgrade->getMoveSpeed(moveSkillType) != 0) {
str+= "+" + intToStr(totalUpgrade->getMoveSpeed(moveSkillType)); str+= "+" + intToStr(totalUpgrade->getMoveSpeed(moveSkillType));
} }
str+="\n"; str+="\n";
if(moveSkillType->getEpCost()!=0){ 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){ if(moveSkillType->getHpCost()!=0) {
str+= lang.get("HpCost")+": "+intToStr(moveSkillType->getHpCost())+"\n"; str+= lang.get("HpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(moveSkillType->getHpCost())+"\n";
} }
str+=moveSkillType->getBoostDesc(translatedValue); str+=moveSkillType->getBoostDesc(translatedValue);
return str; return str;
} }
string MoveCommandType::toString() const{ string MoveCommandType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "Move";
}
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
return lang.get("Move"); return lang.get("Move");
} }
@ -235,14 +241,14 @@ string AttackCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transla
str=getName(translatedValue)+"\n"; str=getName(translatedValue)+"\n";
if(attackSkillType->getEpCost()!=0){ 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){ if(attackSkillType->getHpCost()!=0){
str+= lang.get("HpCost") + ": " + intToStr(attackSkillType->getHpCost()) + "\n"; str+= lang.get("HpCost",(translatedValue == true ? "" : "english")) + ": " + intToStr(attackSkillType->getHpCost()) + "\n";
} }
//attack strength //attack strength
str+= lang.get("AttackStrenght")+": "; str+= lang.get("AttackStrenght",(translatedValue == true ? "" : "english"))+": ";
str+= intToStr(attackSkillType->getAttackStrength()-attackSkillType->getAttackVar()); str+= intToStr(attackSkillType->getAttackStrength()-attackSkillType->getAttackVar());
str+= "..."; str+= "...";
str+= intToStr(attackSkillType->getAttackStrength()+attackSkillType->getAttackVar()); str+= intToStr(attackSkillType->getAttackStrength()+attackSkillType->getAttackVar());
@ -254,11 +260,11 @@ string AttackCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transla
//splash radius //splash radius
if(attackSkillType->getSplashRadius()!=0){ 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 //attack distance
str+= lang.get("AttackDistance")+": "+intToStr(attackSkillType->getAttackRange()); str+= lang.get("AttackDistance",(translatedValue == true ? "" : "english"))+": "+intToStr(attackSkillType->getAttackRange());
if(totalUpgrade->getAttackRange(attackSkillType) != 0) { if(totalUpgrade->getAttackRange(attackSkillType) != 0) {
str+= "+"+intToStr(totalUpgrade->getAttackRange(attackSkillType) != 0); str+= "+"+intToStr(totalUpgrade->getAttackRange(attackSkillType) != 0);
} }
@ -276,18 +282,21 @@ string AttackCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transla
str+="\n"; str+="\n";
//movement speed //movement speed
str+= lang.get("WalkSpeed")+": "+ intToStr(moveSkillType->getSpeed()) ; str+= lang.get("WalkSpeed",(translatedValue == true ? "" : "english"))+": "+ intToStr(moveSkillType->getSpeed()) ;
if(totalUpgrade->getMoveSpeed(moveSkillType) != 0) { if(totalUpgrade->getMoveSpeed(moveSkillType) != 0) {
str+= "+"+intToStr(totalUpgrade->getMoveSpeed(moveSkillType)); str+= "+"+intToStr(totalUpgrade->getMoveSpeed(moveSkillType));
} }
str+="\n"; 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); str+=attackSkillType->getBoostDesc(translatedValue);
return str; return str;
} }
string AttackCommandType::toString() const{ string AttackCommandType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "Attack";
}
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
return lang.get("Attack"); return lang.get("Attack");
} }
@ -329,14 +338,14 @@ string AttackStoppedCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool
str=getName(translatedValue)+"\n"; str=getName(translatedValue)+"\n";
if(attackSkillType->getEpCost()!=0){ 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){ if(attackSkillType->getHpCost()!=0){
str+= lang.get("HpCost")+": "+intToStr(attackSkillType->getHpCost())+"\n"; str+= lang.get("HpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(attackSkillType->getHpCost())+"\n";
} }
//attack strength //attack strength
str+= lang.get("AttackStrenght")+": "; str+= lang.get("AttackStrenght",(translatedValue == true ? "" : "english"))+": ";
str+= intToStr(attackSkillType->getAttackStrength()-attackSkillType->getAttackVar()); str+= intToStr(attackSkillType->getAttackStrength()-attackSkillType->getAttackVar());
str+="..."; str+="...";
str+= intToStr(attackSkillType->getAttackStrength()+attackSkillType->getAttackVar()); str+= intToStr(attackSkillType->getAttackStrength()+attackSkillType->getAttackVar());
@ -347,18 +356,18 @@ string AttackStoppedCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool
//splash radius //splash radius
if(attackSkillType->getSplashRadius()!=0){ 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 //attack distance
str+= lang.get("AttackDistance")+": "+intToStr(attackSkillType->getAttackRange()); str+= lang.get("AttackDistance",(translatedValue == true ? "" : "english"))+": "+intToStr(attackSkillType->getAttackRange());
if(totalUpgrade->getAttackRange(attackSkillType) != 0) { if(totalUpgrade->getAttackRange(attackSkillType) != 0) {
str+= "+"+intToStr(totalUpgrade->getAttackRange(attackSkillType) != 0); str+= "+"+intToStr(totalUpgrade->getAttackRange(attackSkillType) != 0);
} }
str+="\n"; str+="\n";
//attack fields //attack fields
str+= lang.get("Fields") + ": "; str+= lang.get("Fields",(translatedValue == true ? "" : "english")) + ": ";
for(int i= 0; i < fieldCount; i++){ for(int i= 0; i < fieldCount; i++){
Field field = static_cast<Field>(i); Field field = static_cast<Field>(i);
if( attackSkillType->getAttackField(field) ) if( attackSkillType->getAttackField(field) )
@ -371,7 +380,10 @@ string AttackStoppedCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool
return str; return str;
} }
string AttackStoppedCommandType::toString() const { string AttackStoppedCommandType::toString(bool translatedValue) const {
if(translatedValue == false) {
return "AttackStopped";
}
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
return lang.get("AttackStopped"); return lang.get("AttackStopped");
} }
@ -463,18 +475,21 @@ string BuildCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool translat
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
str=getName(translatedValue)+"\n"; 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){ 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){ if(buildSkillType->getHpCost()!=0){
str+= lang.get("HpCost")+": "+intToStr(buildSkillType->getHpCost())+"\n"; str+= lang.get("HpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(buildSkillType->getHpCost())+"\n";
} }
str+=buildSkillType->getBoostDesc(translatedValue); str+=buildSkillType->getBoostDesc(translatedValue);
return str; return str;
} }
string BuildCommandType::toString() const{ string BuildCommandType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "Build";
}
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
return lang.get("Build"); return lang.get("Build");
} }
@ -537,16 +552,16 @@ string HarvestCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transl
string str; string str;
str=getName(translatedValue)+"\n"; str=getName(translatedValue)+"\n";
str+= lang.get("HarvestSpeed")+": "+ intToStr(harvestSkillType->getSpeed()/hitsPerUnit)+"\n"; str+= lang.get("HarvestSpeed",(translatedValue == true ? "" : "english"))+": "+ intToStr(harvestSkillType->getSpeed()/hitsPerUnit)+"\n";
str+= lang.get("MaxLoad")+": "+ intToStr(maxLoad)+"\n"; str+= lang.get("MaxLoad",(translatedValue == true ? "" : "english"))+": "+ intToStr(maxLoad)+"\n";
str+= lang.get("LoadedSpeed")+": "+ intToStr(moveLoadedSkillType->getSpeed())+"\n"; str+= lang.get("LoadedSpeed",(translatedValue == true ? "" : "english"))+": "+ intToStr(moveLoadedSkillType->getSpeed())+"\n";
if(harvestSkillType->getEpCost()!=0){ 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){ 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; i<getHarvestedResourceCount(); ++i){ for(int i=0; i<getHarvestedResourceCount(); ++i){
str+= getHarvestedResource(i)->getName(translatedValue)+"\n"; str+= getHarvestedResource(i)->getName(translatedValue)+"\n";
} }
@ -554,7 +569,10 @@ string HarvestCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transl
return str; return str;
} }
string HarvestCommandType::toString() const{ string HarvestCommandType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "Harvest";
}
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
return lang.get("Harvest"); return lang.get("Harvest");
} }
@ -591,7 +609,10 @@ string HarvestEmergencyReturnCommandType::getDesc(const TotalUpgrade *totalUpgra
return str; return str;
} }
string HarvestEmergencyReturnCommandType::toString() const{ string HarvestEmergencyReturnCommandType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "HarvestEmergencyReturn";
}
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
return lang.get("Harvest"); return lang.get("Harvest");
} }
@ -646,14 +667,14 @@ string RepairCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transla
string str; string str;
str=getName(translatedValue)+"\n"; 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){ 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){ 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.size(); ++i){ for(int i=0; i<repairableUnits.size(); ++i){
str+= (static_cast<const UnitType*>(repairableUnits[i]))->getName(translatedValue)+"\n"; str+= (static_cast<const UnitType*>(repairableUnits[i]))->getName(translatedValue)+"\n";
} }
@ -661,7 +682,10 @@ string RepairCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transla
return str; return str;
} }
string RepairCommandType::toString() const{ string RepairCommandType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "Repair";
}
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
return lang.get("Repair"); return lang.get("Repair");
} }
@ -714,7 +738,7 @@ string ProduceCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transl
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
//prod speed //prod speed
str+= lang.get("ProductionSpeed")+": "+ intToStr(produceSkillType->getSpeed()); str+= lang.get("ProductionSpeed",(translatedValue == true ? "" : "english"))+": "+ intToStr(produceSkillType->getSpeed());
if(totalUpgrade->getProdSpeed(produceSkillType)!=0){ if(totalUpgrade->getProdSpeed(produceSkillType)!=0){
str+="+" + intToStr(totalUpgrade->getProdSpeed(produceSkillType)); str+="+" + intToStr(totalUpgrade->getProdSpeed(produceSkillType));
} }
@ -722,17 +746,20 @@ string ProduceCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transl
//mpcost //mpcost
if(produceSkillType->getEpCost()!=0){ 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){ 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+= "\n" + getProducedUnit()->getReqDesc(translatedValue);
str+=produceSkillType->getBoostDesc(translatedValue); str+=produceSkillType->getBoostDesc(translatedValue);
return str; return str;
} }
string ProduceCommandType::toString() const{ string ProduceCommandType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "Produce";
}
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
return lang.get("Produce"); return lang.get("Produce");
} }
@ -781,17 +808,20 @@ string UpgradeCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool transl
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
str=getName(translatedValue)+"\n"; 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) if(upgradeSkillType->getEpCost()!=0)
str+= lang.get("EpCost")+": "+intToStr(upgradeSkillType->getEpCost())+"\n"; str+= lang.get("EpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(upgradeSkillType->getEpCost())+"\n";
if(upgradeSkillType->getHpCost()!=0) if(upgradeSkillType->getHpCost()!=0)
str+= lang.get("HpCost")+": "+intToStr(upgradeSkillType->getHpCost())+"\n"; str+= lang.get("HpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(upgradeSkillType->getHpCost())+"\n";
str+= "\n"+getProducedUpgrade()->getReqDesc(translatedValue); str+= "\n"+getProducedUpgrade()->getReqDesc(translatedValue);
str+=upgradeSkillType->getBoostDesc(translatedValue); str+=upgradeSkillType->getBoostDesc(translatedValue);
return str; return str;
} }
string UpgradeCommandType::toString() const{ string UpgradeCommandType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "Upgrade";
}
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
return lang.get("Upgrade"); return lang.get("Upgrade");
} }
@ -853,19 +883,19 @@ string MorphCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool translat
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
//prod speed //prod speed
str+= lang.get("MorphSpeed")+": "+ intToStr(morphSkillType->getSpeed())+"\n"; str+= lang.get("MorphSpeed",(translatedValue == true ? "" : "english"))+": "+ intToStr(morphSkillType->getSpeed())+"\n";
//mpcost //mpcost
if(morphSkillType->getEpCost()!=0){ 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){ if(morphSkillType->getHpCost()!=0){
str+= lang.get("HpCost")+": "+intToStr(morphSkillType->getHpCost())+"\n"; str+= lang.get("HpCost",(translatedValue == true ? "" : "english"))+": "+intToStr(morphSkillType->getHpCost())+"\n";
} }
//discount //discount
if(discount!=0){ 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); str+= "\n"+getProduced()->getReqDesc(ignoreResourceRequirements,translatedValue);
@ -874,7 +904,10 @@ string MorphCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool translat
return str; return str;
} }
string MorphCommandType::toString() const{ string MorphCommandType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "Morph";
}
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
return lang.get("Morph"); return lang.get("Morph");
} }
@ -918,7 +951,10 @@ string SwitchTeamCommandType::getDesc(const TotalUpgrade *totalUpgrade, bool tra
return str; return str;
} }
string SwitchTeamCommandType::toString() const{ string SwitchTeamCommandType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "SwitchTeam";
}
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
return lang.get("SwitchTeam"); return lang.get("SwitchTeam");
} }

View File

@ -97,7 +97,7 @@ public:
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader); std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const= 0; 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 const ProducibleType *getProduced() const {return NULL;}
virtual Queueability isQueuable() const {return qOnRequest;} virtual Queueability isQueuable() const {return qOnRequest;}
bool isQueuable(bool tryQueue) const { bool isQueuable(bool tryQueue) const {
@ -137,7 +137,7 @@ public:
const FactionType *ft, const UnitType &ut, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, const UnitType &ut, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader); string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; 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 Queueability isQueuable() const {return qNever;}
virtual int getTypePriority() const {return 100000;} virtual int getTypePriority() const {return 100000;}
//get //get
@ -162,7 +162,7 @@ public:
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader); std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const;
virtual string toString() const; virtual string toString(bool translatedValue) const;
//get //get
const MoveSkillType *getMoveSkillType() const {return moveSkillType;}; const MoveSkillType *getMoveSkillType() const {return moveSkillType;};
@ -187,7 +187,7 @@ public:
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader); std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const;
virtual string toString() const; virtual string toString(bool translatedValue) const;
//get //get
@ -213,7 +213,7 @@ public:
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader); std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const;
virtual string toString() const; virtual string toString(bool translatedValue) const;
//get //get
const StopSkillType * getStopSkillType() const {return stopSkillType;} const StopSkillType * getStopSkillType() const {return stopSkillType;}
@ -243,7 +243,7 @@ public:
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader); std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const;
virtual string toString() const; virtual string toString(bool translatedValue) const;
//get //get
const MoveSkillType *getMoveSkillType() const {return moveSkillType;} const MoveSkillType *getMoveSkillType() const {return moveSkillType;}
@ -278,7 +278,7 @@ public:
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader); std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; 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;} virtual Queueability isQueuable() const {return qOnRequest;}
//get //get
@ -309,7 +309,7 @@ public:
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader); std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; 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;} virtual Queueability isQueuable() const {return qOnRequest;}
//get //get
@ -335,7 +335,7 @@ public:
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader); std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const;
virtual string toString() const; virtual string toString(bool translatedValue) const;
//get //get
const MoveSkillType *getMoveSkillType() const {return moveSkillType;}; const MoveSkillType *getMoveSkillType() const {return moveSkillType;};
@ -366,7 +366,7 @@ public:
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader); std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const;
virtual string getReqDesc(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 const ProducibleType *getProduced() const;
virtual Queueability isQueuable() const {return qAlways;} virtual Queueability isQueuable() const {return qAlways;}
virtual int getTypePriority() const {return 15;} virtual int getTypePriority() const {return 15;}
@ -395,7 +395,7 @@ public:
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader); std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; 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 string getReqDesc(bool translatedValue) const;
virtual const ProducibleType *getProduced() const; virtual const ProducibleType *getProduced() const;
virtual Queueability isQueuable() const {return qAlways;} virtual Queueability isQueuable() const {return qAlways;}
@ -426,7 +426,7 @@ public:
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader); std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; 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 string getReqDesc(bool translatedValue) const;
virtual const ProducibleType *getProduced() const; virtual const ProducibleType *getProduced() const;
Queueability isQueuable() const {return qOnlyLast;} //After morph anything can happen Queueability isQueuable() const {return qOnlyLast;} //After morph anything can happen
@ -455,7 +455,7 @@ public:
const TechTree *tt, const FactionType *ft, const UnitType &ut, const TechTree *tt, const FactionType *ft, const UnitType &ut,
std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader); std::map<string,vector<pair<string, string> > > &loadedFileList, string parentLoader);
virtual string getDesc(const TotalUpgrade *totalUpgrade, bool translatedValue) const; 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; } virtual bool usesPathfinder() const { return false; }
}; };

View File

@ -78,7 +78,7 @@ string RequirableType::getReqDesc(bool translatedValue) const{
string str= getName(translatedValue); string str= getName(translatedValue);
if(anyReqs){ if(anyReqs){
return str + " " + Lang::getInstance().get("Reqs") + ":\n" + reqString; return str + " " + Lang::getInstance().get("Reqs",(translatedValue == true ? "" : "english")) + ":\n" + reqString;
} }
else{ else{
return str; return str;
@ -176,7 +176,7 @@ string ProducibleType::getUnitAndUpgradeReqDesc(bool lineBreaks, bool translated
} }
string ProducibleType::getReqDesc(bool ignoreResourceRequirements, bool translatedValue) const { 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) { if(ignoreResourceRequirements == false) {
str+= getResourceReqDesc(true,translatedValue); str+= getResourceReqDesc(true,translatedValue);
} }

View File

@ -686,7 +686,10 @@ StopSkillType::StopSkillType(){
skillClass= scStop; skillClass= scStop;
} }
string StopSkillType::toString() const{ string StopSkillType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "Stop";
}
return Lang::getInstance().get("Stop"); return Lang::getInstance().get("Stop");
} }
@ -698,7 +701,11 @@ MoveSkillType::MoveSkillType(){
skillClass= scMove; skillClass= scMove;
} }
string MoveSkillType::toString() const{ string MoveSkillType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "Move";
}
return Lang::getInstance().get("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"); return Lang::getInstance().get("Attack");
} }
@ -918,7 +929,11 @@ BuildSkillType::BuildSkillType(){
skillClass= scBuild; skillClass= scBuild;
} }
string BuildSkillType::toString() const{ string BuildSkillType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "Build";
}
return Lang::getInstance().get("Build"); return Lang::getInstance().get("Build");
} }
@ -930,7 +945,11 @@ HarvestSkillType::HarvestSkillType(){
skillClass= scHarvest; skillClass= scHarvest;
} }
string HarvestSkillType::toString() const{ string HarvestSkillType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "Harvest";
}
return Lang::getInstance().get("Harvest"); return Lang::getInstance().get("Harvest");
} }
@ -942,7 +961,11 @@ RepairSkillType::RepairSkillType(){
skillClass= scRepair; skillClass= scRepair;
} }
string RepairSkillType::toString() const{ string RepairSkillType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "Repair";
}
return Lang::getInstance().get("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"); 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"); 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"; 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"; return "Morph";
} }
@ -1126,7 +1165,11 @@ void DieSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
fade= sn->getChild("fade")->getAttribute("value")->getBoolValue(); fade= sn->getChild("fade")->getAttribute("value")->getBoolValue();
} }
string DieSkillType::toString() const{ string DieSkillType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "Die";
}
return "Die"; return "Die";
} }
@ -1162,7 +1205,11 @@ void FogOfWarSkillType::load(const XmlNode *sn, const XmlNode *attackBoostsNode,
durationTime = sn->getChild("duration")->getAttribute("value")->getFloatValue(); durationTime = sn->getChild("duration")->getAttribute("value")->getFloatValue();
} }
string FogOfWarSkillType::toString() const{ string FogOfWarSkillType::toString(bool translatedValue) const{
if(translatedValue == false) {
return "FogOfWar";
}
return "FogOfWar"; return "FogOfWar";
} }

View File

@ -184,7 +184,7 @@ public:
//virtual string getDesc(const TotalUpgrade *totalUpgrade) const= 0; //virtual string getDesc(const TotalUpgrade *totalUpgrade) const= 0;
//other //other
virtual string toString() const= 0; virtual string toString(bool translatedValue) const= 0;
virtual int getTotalSpeed(const TotalUpgrade *) const {return speed;} virtual int getTotalSpeed(const TotalUpgrade *) const {return speed;}
static string skillClassToStr(SkillClass skillClass); static string skillClassToStr(SkillClass skillClass);
static string fieldToStr(Field field); static string fieldToStr(Field field);
@ -200,7 +200,7 @@ public:
class StopSkillType: public SkillType{ class StopSkillType: public SkillType{
public: public:
StopSkillType(); StopSkillType();
virtual string toString() const; virtual string toString(bool translatedValue) const;
}; };
// =============================== // ===============================
@ -210,7 +210,7 @@ public:
class MoveSkillType: public SkillType{ class MoveSkillType: public SkillType{
public: public:
MoveSkillType(); MoveSkillType();
virtual string toString() const; virtual string toString(bool translatedValue) const;
virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) 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, virtual void load(const XmlNode *sn, const XmlNode *attackBoostsNode, const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader); string parentLoader);
virtual string toString() const; virtual string toString(bool translatedValue) const;
//get //get
inline int getAttackStrength() const {return attackStrength;} inline int getAttackStrength() const {return attackStrength;}
@ -283,7 +283,7 @@ public:
class BuildSkillType: public SkillType{ class BuildSkillType: public SkillType{
public: public:
BuildSkillType(); BuildSkillType();
virtual string toString() const; virtual string toString(bool translatedValue) const;
}; };
// =============================== // ===============================
@ -293,7 +293,7 @@ public:
class HarvestSkillType: public SkillType{ class HarvestSkillType: public SkillType{
public: public:
HarvestSkillType(); HarvestSkillType();
virtual string toString() const; virtual string toString(bool translatedValue) const;
}; };
// =============================== // ===============================
@ -303,7 +303,7 @@ public:
class RepairSkillType: public SkillType{ class RepairSkillType: public SkillType{
public: public:
RepairSkillType(); RepairSkillType();
virtual string toString() const; virtual string toString(bool translatedValue) const;
}; };
// =============================== // ===============================
@ -320,7 +320,7 @@ public:
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader); string parentLoader);
virtual string toString() const; virtual string toString(bool translatedValue) const;
virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const; virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const;
@ -341,7 +341,7 @@ public:
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader); string parentLoader);
virtual string toString() const; virtual string toString(bool translatedValue) const;
virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) 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, virtual void load(const XmlNode *sn, const XmlNode *attackBoostsNode, const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader); string parentLoader);
virtual string toString() const; virtual string toString(bool translatedValue) const;
virtual void saveGame(XmlNode *rootNode); virtual void saveGame(XmlNode *rootNode);
}; };
@ -385,7 +385,7 @@ public:
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader); string parentLoader);
virtual string toString() const; virtual string toString(bool translatedValue) const;
virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const; virtual int getTotalSpeed(const TotalUpgrade *totalUpgrade) const;
virtual void saveGame(XmlNode *rootNode); 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, virtual void load(const XmlNode *sn, const XmlNode *attackBoostsNode, const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader); string parentLoader);
virtual string toString() const; virtual string toString(bool translatedValue) const;
virtual void saveGame(XmlNode *rootNode); 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, virtual void load(const XmlNode *sn, const XmlNode *attackBoostsNode, const string &dir, const TechTree *tt,
const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList, const FactionType *ft, std::map<string,vector<pair<string, string> > > &loadedFileList,
string parentLoader); string parentLoader);
virtual string toString() const; virtual string toString(bool translatedValue) const;
virtual void saveGame(XmlNode *rootNode); virtual void saveGame(XmlNode *rootNode);
}; };

View File

@ -1024,7 +1024,7 @@ string UnitType::getCommandTypeListDesc() const {
string desc = "Commands: "; string desc = "Commands: ";
for(int i=0; i<getCommandTypeCount(); ++i){ for(int i=0; i<getCommandTypeCount(); ++i){
const CommandType* commandType= getCommandType(i); const CommandType* commandType= getCommandType(i);
desc += " id = " + intToStr(commandType->getId()); + " toString: " + commandType->toString(); desc += " id = " + intToStr(commandType->getId()); + " toString: " + commandType->toString(false);
} }
return desc; return desc;
@ -1094,12 +1094,12 @@ std::string UnitType::toString() const {
result += " skillTypes: [" + intToStr(skillTypes.size()) + "]"; result += " skillTypes: [" + intToStr(skillTypes.size()) + "]";
for(int i = 0; i < skillTypes.size(); ++i) { 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()) + "]"; result += " commandTypes: [" + intToStr(commandTypes.size()) + "]";
for(int i = 0; i < commandTypes.size(); ++i) { 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()) + "]"; result += " storedResources: [" + intToStr(storedResources.size()) + "]";

View File

@ -246,10 +246,10 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{
if(maxHp != 0) { if(maxHp != 0) {
if(maxHpIsMultiplier) { if(maxHpIsMultiplier) {
str += indent+lang.get("Hp") + " *" + intToStr(maxHp); str += indent+lang.get("Hp",(translatedValue == true ? "" : "english")) + " *" + intToStr(maxHp);
} }
else { else {
str += indent+lang.get("Hp") + " +" + intToStr(maxHp); str += indent+lang.get("Hp",(translatedValue == true ? "" : "english")) + " +" + intToStr(maxHp);
} }
if(maxHpRegeneration != 0) { if(maxHpRegeneration != 0) {
@ -262,10 +262,10 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{
str += "\n"; str += "\n";
} }
if(sightIsMultiplier) { if(sightIsMultiplier) {
str+= indent+lang.get("Sight") + " *" + intToStr(sight); str+= indent+lang.get("Sight",(translatedValue == true ? "" : "english")) + " *" + intToStr(sight);
} }
else { else {
str+= indent+lang.get("Sight") + " +" + intToStr(sight); str+= indent+lang.get("Sight",(translatedValue == true ? "" : "english")) + " +" + intToStr(sight);
} }
} }
if(maxEp != 0) { if(maxEp != 0) {
@ -274,10 +274,10 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{
} }
if(maxEpIsMultiplier) { if(maxEpIsMultiplier) {
str+= indent+lang.get("Ep") + " *" + intToStr(maxEp); str+= indent+lang.get("Ep",(translatedValue == true ? "" : "english")) + " *" + intToStr(maxEp);
} }
else { else {
str+= indent+lang.get("Ep") + " +" + intToStr(maxEp); str+= indent+lang.get("Ep",(translatedValue == true ? "" : "english")) + " +" + intToStr(maxEp);
} }
if(maxEpRegeneration != 0) { if(maxEpRegeneration != 0) {
str += " [" + intToStr(maxEpRegeneration) + "]"; str += " [" + intToStr(maxEpRegeneration) + "]";
@ -289,10 +289,10 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{
} }
if(attackStrengthIsMultiplier) { if(attackStrengthIsMultiplier) {
str+= indent+lang.get("AttackStrenght") + " *" + intToStr(attackStrength); str+= indent+lang.get("AttackStrenght",(translatedValue == true ? "" : "english")) + " *" + intToStr(attackStrength);
} }
else { else {
str+= indent+lang.get("AttackStrenght") + " +" + intToStr(attackStrength); str+= indent+lang.get("AttackStrenght",(translatedValue == true ? "" : "english")) + " +" + intToStr(attackStrength);
} }
} }
if(attackRange != 0) { if(attackRange != 0) {
@ -301,10 +301,10 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{
} }
if(attackRangeIsMultiplier) { if(attackRangeIsMultiplier) {
str+= indent+lang.get("AttackDistance") + " *" + intToStr(attackRange); str+= indent+lang.get("AttackDistance",(translatedValue == true ? "" : "english")) + " *" + intToStr(attackRange);
} }
else { else {
str+= indent+lang.get("AttackDistance") + " +" + intToStr(attackRange); str+= indent+lang.get("AttackDistance",(translatedValue == true ? "" : "english")) + " +" + intToStr(attackRange);
} }
} }
if(armor != 0) { if(armor != 0) {
@ -313,10 +313,10 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{
} }
if(armorIsMultiplier) { if(armorIsMultiplier) {
str+= indent+lang.get("Armor") + " *" + intToStr(armor); str+= indent+lang.get("Armor",(translatedValue == true ? "" : "english")) + " *" + intToStr(armor);
} }
else { else {
str+= indent+lang.get("Armor") + " +" + intToStr(armor); str+= indent+lang.get("Armor",(translatedValue == true ? "" : "english")) + " +" + intToStr(armor);
} }
} }
if(moveSpeed != 0) { if(moveSpeed != 0) {
@ -325,10 +325,10 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{
} }
if(moveSpeedIsMultiplier) { if(moveSpeedIsMultiplier) {
str+= indent+lang.get("WalkSpeed") + " *" + intToStr(moveSpeed); str+= indent+lang.get("WalkSpeed",(translatedValue == true ? "" : "english")) + " *" + intToStr(moveSpeed);
} }
else { else {
str+= indent+lang.get("WalkSpeed") + " +" + intToStr(moveSpeed); str+= indent+lang.get("WalkSpeed",(translatedValue == true ? "" : "english")) + " +" + intToStr(moveSpeed);
} }
} }
if(prodSpeed != 0) { if(prodSpeed != 0) {
@ -337,10 +337,10 @@ string UpgradeTypeBase::getDesc(bool translatedValue) const{
} }
if(prodSpeedIsMultiplier) { if(prodSpeedIsMultiplier) {
str+= indent+lang.get("ProductionSpeed") + " *" + intToStr(prodSpeed); str+= indent+lang.get("ProductionSpeed",(translatedValue == true ? "" : "english")) + " *" + intToStr(prodSpeed);
} }
else { else {
str+= indent+lang.get("ProductionSpeed") + " +" + intToStr(prodSpeed); str+= indent+lang.get("ProductionSpeed",(translatedValue == true ? "" : "english")) + " +" + intToStr(prodSpeed);
} }
} }
if(str != "") { if(str != "") {
@ -563,11 +563,11 @@ string UpgradeType::getReqDesc(bool translatedValue) const{
string str= ProducibleType::getReqDesc(translatedValue); string str= ProducibleType::getReqDesc(translatedValue);
string indent=" "; string indent=" ";
if(getEffectCount()>0){ if(getEffectCount()>0){
str+= "\n"+ lang.get("Upgrades")+"\n"; str+= "\n"+ lang.get("Upgrades",(translatedValue == true ? "" : "english"))+"\n";
} }
str+=UpgradeTypeBase::getDesc(translatedValue); str+=UpgradeTypeBase::getDesc(translatedValue);
if(getEffectCount()>0){ if(getEffectCount()>0){
str+= lang.get("AffectedUnits")+"\n"; str+= lang.get("AffectedUnits",(translatedValue == true ? "" : "english"))+"\n";
for(int i=0; i<getEffectCount(); ++i){ for(int i=0; i<getEffectCount(); ++i){
str+= indent+getEffect(i)->getName(translatedValue)+"\n"; str+= indent+getEffect(i)->getName(translatedValue)+"\n";
} }

View File

@ -306,7 +306,7 @@ void UnitUpdater::updateUnitCommand(Unit *unit, int frameIndex) {
if(minorDebugPerformance && frameIndex > 0) elapsed1 = chrono.getMillis(); if(minorDebugPerformance && frameIndex > 0) elapsed1 = chrono.getMillis();
if(hasCommand == true) { 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); bool commandUsesPathFinder = (frameIndex < 0);
if(frameIndex > 0) { if(frameIndex > 0) {
@ -327,7 +327,7 @@ void UnitUpdater::updateUnitCommand(Unit *unit, int frameIndex) {
if((minorDebugPerformance && frameIndex > 0) && (chrono.getMillis() - elapsed1) >= 1) { if((minorDebugPerformance && frameIndex > 0) && (chrono.getMillis() - elapsed1) >= 1) {
//CommandClass cc = unit->getCurrCommand()->getCommandType()->commandTypeClass; //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) { if(SystemFlags::getSystemSettingType(SystemFlags::debugWorldSynch).enabled == true && frameIndex < 0) {
char szBuf[8096]=""; 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); unit->logSynchData(__FILE__,__LINE__,szBuf);
} }
@ -804,7 +804,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) {
Chrono chrono; Chrono chrono;
if(SystemFlags::getSystemSettingType(SystemFlags::debugPerformance).enabled) chrono.start(); 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(); Command *command= unit->getCurrCommand();
const BuildCommandType *bct= static_cast<const BuildCommandType*>(command->getCommandType()); const BuildCommandType *bct= static_cast<const BuildCommandType*>(command->getCommandType());
@ -926,7 +926,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) {
gameCamera->getPos()); 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 { else {
//if there are no free cells //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()); 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 { 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(frameIndex < 0) {
//if building //if building
@ -964,7 +964,7 @@ void UnitUpdater::updateBuild(Unit *unit, int frameIndex) {
} }
if(builtUnit != NULL) { 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); 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 { 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) { if(firstLinkedPeerRepairer == NULL) {
const RepairCommandType *prct = dynamic_cast<const RepairCommandType*>(peerCommand->getCommandType()); const RepairCommandType *prct = dynamic_cast<const RepairCommandType*>(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; 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); 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()); 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());

View File

@ -74,7 +74,7 @@ int RandomGen::randRange(int min, int max){
// int res = streflop::Random<true, false, float>(min, max); // streflop // int res = streflop::Random<true, false, float>(min, max); // streflop
//#else //#else
int diff= max-min; int diff= max-min;
int res= min + static_cast<int>(truncateDecimal<double>(static_cast<double>(diff+1))*RandomGen::rand() / m); int res= min + static_cast<int>(truncateDecimal<double>(static_cast<double>(diff+1),2)*RandomGen::rand() / m);
//#endif //#endif
assert(res>=min && res<=max); assert(res>=min && res<=max);
if(res < min || res > max) { if(res < min || res > max) {