- translatable techtrees, currently supported resource names, unit names and upgrade names. For each techtree created a lang folder in the techtree main folder. Now create language specific files <techtree>_language.lng as we do for scenarios. In the file add:

ResourceTypeName_<name>=My new resource name
UnitTypeName_<name>=<name>=my new unit name
UpgradeTypeName_<name>=my new upgrade name
This commit is contained in:
Mark Vejvoda
2012-05-02 21:00:57 +00:00
parent 897346d1f5
commit b84c69a93b
4 changed files with 19 additions and 0 deletions

View File

@@ -982,6 +982,13 @@ string UnitType::getReqDesc() const{
return ProducibleType::getReqDesc()+"\nLimits: "+resultTxt; return ProducibleType::getReqDesc()+"\nLimits: "+resultTxt;
} }
string UnitType::getName(bool translatedValue) const {
if(translatedValue == false) return name;
Lang &lang = Lang::getInstance();
return lang.getTechTreeString("UnitTypeName_" + name,name.c_str());
}
std::string UnitType::toString() const { std::string UnitType::toString() const {
std::string result = ""; std::string result = "";

View File

@@ -157,6 +157,8 @@ public:
const FactionType *factionType, Checksum* checksum, const FactionType *factionType, Checksum* checksum,
Checksum* techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList); Checksum* techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList);
virtual string getName(bool translatedValue=false) const;
//get //get
inline int getId() const {return id;} inline int getId() const {return id;}
inline int getMaxHp() const {return maxHp;} inline int getMaxHp() const {return maxHp;}

View File

@@ -476,6 +476,13 @@ const UpgradeType * UpgradeTypeBase::loadGame(const XmlNode *rootNode, Faction *
// ==================== misc ==================== // ==================== misc ====================
string UpgradeType::getName(bool translatedValue) const {
if(translatedValue == false) return name;
Lang &lang = Lang::getInstance();
return lang.getTechTreeString("UpgradeTypeName_" + name,name.c_str());
}
string UpgradeType::getReqDesc() const{ string UpgradeType::getReqDesc() const{
Lang &lang= Lang::getInstance(); Lang &lang= Lang::getInstance();
string str= ProducibleType::getReqDesc(); string str= ProducibleType::getReqDesc();

View File

@@ -81,6 +81,7 @@ protected:
std::map<string,int> prodSpeedMorphIsMultiplierValueList; std::map<string,int> prodSpeedMorphIsMultiplierValueList;
public: public:
int getMaxHp() const {return maxHp;} int getMaxHp() const {return maxHp;}
bool getMaxHpIsMultiplier() const {return maxHpIsMultiplier;} bool getMaxHpIsMultiplier() const {return maxHpIsMultiplier;}
int getMaxHpRegeneration() const {return maxHpRegeneration;} int getMaxHpRegeneration() const {return maxHpRegeneration;}
@@ -158,6 +159,8 @@ public:
const FactionType *factionType, Checksum* checksum, const FactionType *factionType, Checksum* checksum,
Checksum* techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList); Checksum* techtreeChecksum, std::map<string,vector<pair<string, string> > > &loadedFileList);
virtual string getName(bool translatedValue=false) const;
//get all //get all
int getEffectCount() const {return effects.size();} int getEffectCount() const {return effects.size();}
const UnitType * getEffect(int i) const {return effects[i];} const UnitType * getEffect(int i) const {return effects[i];}