Skip to content
Permalink
Browse files
full support for translated techtrees
  • Loading branch information
softcoder committed Jun 13, 2013
1 parent 1f96dae commit 0ead6a36dcae3b376c4cd204c64abdfcffc99b4c
Showing with 326 additions and 301 deletions.
  1. +6 −6 source/glest_game/ai/ai.cpp
  2. +4 −4 source/glest_game/ai/ai_interface.cpp
  3. +9 −9 source/glest_game/ai/ai_rule.cpp
  4. +15 −15 source/glest_game/ai/path_finder.cpp
  5. +4 −4 source/glest_game/game/commander.cpp
  6. +8 −1 source/glest_game/game/game.cpp
  7. +2 −0 source/glest_game/game/game.h
  8. +8 −8 source/glest_game/game/script_manager.cpp
  9. +3 −1 source/glest_game/global/lang.cpp
  10. +2 −2 source/glest_game/graphics/renderer.cpp
  11. +10 −10 source/glest_game/gui/gui.cpp
  12. +16 −3 source/glest_game/menu/menu_state_connected_game.cpp
  13. +1 −1 source/glest_game/type_instances/command.cpp
  14. +15 −15 source/glest_game/type_instances/faction.cpp
  15. +1 −1 source/glest_game/type_instances/object.cpp
  16. +2 −2 source/glest_game/type_instances/resource.cpp
  17. +1 −1 source/glest_game/type_instances/resource.h
  18. +37 −36 source/glest_game/type_instances/unit.cpp
  19. +4 −3 source/glest_game/type_instances/unit.h
  20. +1 −1 source/glest_game/type_instances/upgrade.cpp
  21. +47 −71 source/glest_game/types/command_type.cpp
  22. +16 −16 source/glest_game/types/command_type.h
  23. +15 −15 source/glest_game/types/element_type.cpp
  24. +5 −5 source/glest_game/types/element_type.h
  25. +10 −10 source/glest_game/types/faction_type.cpp
  26. +5 −5 source/glest_game/types/skill_type.cpp
  27. +2 −2 source/glest_game/types/skill_type.h
  28. +25 −6 source/glest_game/types/tech_tree.cpp
  29. +4 −1 source/glest_game/types/tech_tree.h
  30. +10 −10 source/glest_game/types/unit_type.cpp
  31. +1 −1 source/glest_game/types/unit_type.h
  32. +5 −5 source/glest_game/types/upgrade_type.cpp
  33. +3 −2 source/glest_game/types/upgrade_type.h
  34. +1 −1 source/glest_game/world/map.cpp
  35. +11 −11 source/glest_game/world/unit_updater.cpp
  36. +17 −17 source/glest_game/world/world.cpp
@@ -66,7 +66,7 @@ ProduceTask::ProduceTask(const ResourceType *resourceType) : Task() {
string ProduceTask::toString() const{
string str= "Produce ";
if(unitType!=NULL){
str+= unitType->getName(true);
str+= unitType->getName(false);
}
return str;
}
@@ -81,11 +81,11 @@ void ProduceTask::saveGame(XmlNode *rootNode) const {
produceTaskNode->addAttribute("unitClass",intToStr(unitClass), mapTagReplacements);
// const UnitType *unitType;
if(unitType != NULL) {
produceTaskNode->addAttribute("unitType",unitType->getName(), mapTagReplacements);
produceTaskNode->addAttribute("unitType",unitType->getName(false), mapTagReplacements);
}
// const ResourceType *resourceType;
if(resourceType != NULL) {
produceTaskNode->addAttribute("resourceType",resourceType->getName(), mapTagReplacements);
produceTaskNode->addAttribute("resourceType",resourceType->getName(false), mapTagReplacements);
}
}

@@ -144,7 +144,7 @@ BuildTask::BuildTask(const UnitType *unitType, const Vec2i &pos){
string BuildTask::toString() const{
string str= "Build ";
if(unitType!=NULL){
str+= unitType->getName(true);
str+= unitType->getName(false);
}
return str;
}
@@ -157,7 +157,7 @@ void BuildTask::saveGame(XmlNode *rootNode) const {

// const UnitType *unitType;
if(unitType != NULL) {
buildTaskNode->addAttribute("unitType",unitType->getName(), mapTagReplacements);
buildTaskNode->addAttribute("unitType",unitType->getName(false), mapTagReplacements);
}
// const ResourceType *resourceType;
if(resourceType != NULL) {
@@ -487,7 +487,7 @@ const ResourceType *Ai::getNeededResource(int unitIndex) {
}

char szBuf[8096]="";
snprintf(szBuf,8096,"Unit [%d - %s] looking for resources (not static or consumable)",unit->getId(),unit->getType()->getName().c_str());
snprintf(szBuf,8096,"Unit [%d - %s] looking for resources (not static or consumable)",unit->getId(),unit->getType()->getName(false).c_str());
aiInterface->printLog(3, szBuf);
snprintf(szBuf,8096,"[resource type count %d] Needed resource [%s].",tt->getResourceTypeCount(),(neededResource != NULL ? neededResource->getName().c_str() : "<none>"));
aiInterface->printLog(3, szBuf);
@@ -398,7 +398,7 @@ std::pair<CommandResult,string> AiInterface::giveCommand(const Unit *unit, const
char szBuf[8096]="";
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nCan not find AI command type for:\nunit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nGame out of synch.",
__FILE__,__FUNCTION__,__LINE__,
unit->getId(), unit->getFullName().c_str(),unit->getDesc().c_str(),
unit->getId(), unit->getFullName(false).c_str(),unit->getDesc(false).c_str(),
unit->getFaction()->getIndex());

if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s\n",szBuf);
@@ -448,7 +448,7 @@ std::pair<CommandResult,string> AiInterface::giveCommand(int unitIndex, const Co
char szBuf[8096]="";
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nCan not find AI command type for:\nunit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nGame out of synch.",
__FILE__,__FUNCTION__,__LINE__,
unit->getId(), unit->getFullName().c_str(),unit->getDesc().c_str(),
unit->getId(), unit->getFullName(false).c_str(),unit->getDesc(false).c_str(),
unit->getFaction()->getIndex());

if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s\n",szBuf);
@@ -496,7 +496,7 @@ std::pair<CommandResult,string> AiInterface::giveCommand(int unitIndex, const Co
char szBuf[8096]="";
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nCan not find AI command type for:\nunit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nGame out of synch.",
__FILE__,__FUNCTION__,__LINE__,
unit->getId(), unit->getFullName().c_str(),unit->getDesc().c_str(),
unit->getId(), unit->getFullName(false).c_str(),unit->getDesc(false).c_str(),
unit->getFaction()->getIndex());

if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s\n",szBuf);
@@ -544,7 +544,7 @@ std::pair<CommandResult,string> AiInterface::giveCommand(int unitIndex, const Co
char szBuf[8096]="";
snprintf(szBuf,8096,"In [%s::%s Line: %d]\nCan not find AI command type for:\nunit = %d\n[%s]\n[%s]\nactual local factionIndex = %d.\nGame out of synch.",
__FILE__,__FUNCTION__,__LINE__,
unit->getId(), unit->getFullName().c_str(),unit->getDesc().c_str(),
unit->getId(), unit->getFullName(false).c_str(),unit->getDesc(false).c_str(),
unit->getFaction()->getIndex());

if(SystemFlags::getSystemSettingType(SystemFlags::debugSystem).enabled) SystemFlags::OutputDebug(SystemFlags::debugSystem,"%s\n",szBuf);
@@ -667,10 +667,10 @@ void AiRuleProduce::execute() {
AiInterface *aiInterface= ai->getAiInterface();
if(produceTask!=NULL) {

if(ai->outputAIBehaviourToConsole()) printf("AiRuleProduce producing [%s]\n",(produceTask->getUnitType() != NULL ? produceTask->getUnitType()->getName().c_str() : "null"));
if(ai->outputAIBehaviourToConsole()) printf("AiRuleProduce producing [%s]\n",(produceTask->getUnitType() != NULL ? produceTask->getUnitType()->getName(false).c_str() : "null"));
if(aiInterface->isLogLevelEnabled(4) == true) {
char szBuf[8096]="";
snprintf(szBuf,8096,"AiRuleProduce producing [%s]",(produceTask->getUnitType() != NULL ? produceTask->getUnitType()->getName().c_str() : "null"));
snprintf(szBuf,8096,"AiRuleProduce producing [%s]",(produceTask->getUnitType() != NULL ? produceTask->getUnitType()->getName(false).c_str() : "null"));
aiInterface->printLog(4, szBuf);
}

@@ -761,7 +761,7 @@ void AiRuleProduce::produceGeneric(const ProduceTask *pt) {
const Resource *r= producedUnit->getCost(pt->getResourceType());

if(r != NULL) {
if(ai->outputAIBehaviourToConsole()) printf("produceGeneric r = [%s][%d] Testing AI RULE Name[%s]\n",r->getDescription().c_str(),r->getAmount(), this->getName().c_str());
if(ai->outputAIBehaviourToConsole()) printf("produceGeneric r = [%s][%d] Testing AI RULE Name[%s]\n",r->getDescription(false).c_str(),r->getAmount(), this->getName().c_str());
}

if(r != NULL && r->getAmount() < 0) {
@@ -1196,7 +1196,7 @@ bool AiRuleBuild::test(){

void AiRuleBuild::execute() {
if(buildTask!=NULL) {
if(ai->outputAIBehaviourToConsole()) printf("BUILD AiRuleBuild Unit Name[%s]\n",(buildTask->getUnitType() != NULL ? buildTask->getUnitType()->getName().c_str() : "null"));
if(ai->outputAIBehaviourToConsole()) printf("BUILD AiRuleBuild Unit Name[%s]\n",(buildTask->getUnitType() != NULL ? buildTask->getUnitType()->getName(false).c_str() : "null"));

//generic build task, build random building that can be built
if(buildTask->getUnitType() == NULL) {
@@ -1457,20 +1457,20 @@ void AiRuleBuild::buildSpecific(const BuildTask *bt) {
}

bool AiRuleBuild::isDefensive(const UnitType *building){
if(ai->outputAIBehaviourToConsole()) printf("BUILD isDefensive check for Unit Name[%s] result = %d\n",building->getName().c_str(),building->hasSkillClass(scAttack));
if(ai->outputAIBehaviourToConsole()) printf("BUILD isDefensive check for Unit Name[%s] result = %d\n",building->getName(false).c_str(),building->hasSkillClass(scAttack));

return building->hasSkillClass(scAttack);
}

bool AiRuleBuild::isResourceProducer(const UnitType *building){
for(int i= 0; i<building->getCostCount(); i++){
if(building->getCost(i)->getAmount()<0){
if(ai->outputAIBehaviourToConsole()) printf("BUILD isResourceProducer check for Unit Name[%s] result = true\n",building->getName().c_str());
if(ai->outputAIBehaviourToConsole()) printf("BUILD isResourceProducer check for Unit Name[%s] result = true\n",building->getName(false).c_str());

return true;
}
}
if(ai->outputAIBehaviourToConsole()) printf("BUILD isResourceProducer check for Unit Name[%s] result = false\n",building->getName().c_str());
if(ai->outputAIBehaviourToConsole()) printf("BUILD isResourceProducer check for Unit Name[%s] result = false\n",building->getName(false).c_str());

return false;
}
@@ -1482,13 +1482,13 @@ bool AiRuleBuild::isWarriorProducer(const UnitType *building){
const UnitType *ut= static_cast<const ProduceCommandType*>(ct)->getProducedUnit();

if(ut->isOfClass(ucWarrior)){
if(ai->outputAIBehaviourToConsole()) printf("BUILD isWarriorProducer check for Unit Name[%s] result = true\n",building->getName().c_str());
if(ai->outputAIBehaviourToConsole()) printf("BUILD isWarriorProducer check for Unit Name[%s] result = true\n",building->getName(false).c_str());

return true;
}
}
}
if(ai->outputAIBehaviourToConsole()) printf("BUILD isWarriorProducer check for Unit Name[%s] result = false\n",building->getName().c_str());
if(ai->outputAIBehaviourToConsole()) printf("BUILD isWarriorProducer check for Unit Name[%s] result = false\n",building->getName(false).c_str());

return false;
}

0 comments on commit 0ead6a3

Please sign in to comment.