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

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';