Cleaned up addition parsing works in general language file loader, only the language file for deck description now can control where a line ends by using '@' ('@' is translated into '\n' in the memory).

This commit is contained in:
linshier
2010-09-02 07:49:41 +00:00
parent 7d61e0693e
commit c7fc2b934d
4 changed files with 10 additions and 7 deletions
+7 -1
View File
@@ -97,7 +97,13 @@ void GameStateDuel::Start()
if(deckmenu){
if (decksneeded){
deckmenu->Add(-1,_("Create your Deck!").c_str(),"Highly recommended to get\nthe full Wagic experience!");
//translate deck creating desc
Translator * t = Translator::GetInstance();
map<string,string>::iterator it = t->deckValues.find("Create your Deck!");
if (it != t->deckValues.end())
deckmenu->Add(-1,_("Create your Deck!").c_str(), it->second);
else
deckmenu->Add(-1,_("Create your Deck!").c_str(),"Highly recommended to get\nthe full Wagic experience!");
premadeDeck = true;
fillDeckMenu(deckmenu,RESPATH"/player/premade");
}
+1 -4
View File
@@ -69,10 +69,6 @@ void Translator::load(string filename, map<string,string> * dictionary) {
while(std::getline(file,s)){
if (!s.size()) continue;
if (s[s.size()-1] == '\r') s.erase(s.size()-1); //Handle DOS files
//Translate '@' to '\n'
char * sp = (char *)s.c_str();
for (int i = 0; sp[i]; i++)
if (sp[i] == '@') sp[i] = '\n';
size_t found = s.find('=');
if (found == string::npos) continue;
string s1 = s.substr(0,found);
@@ -122,6 +118,7 @@ void Translator::initDecks(){
if (!s.size()) continue;
if (s[s.size()-1] == '\r') s.erase(s.size()-1); //Handle DOS files
// Translate '@' to '\n'
// Note: general language files don't include any line-break infomation
char * sp = (char *)s.c_str();
for (int i = 0; sp[i]; i++)
if (sp[i] == '@') sp[i] = '\n';