summaryrefslogtreecommitdiff
path: root/src/game
diff options
context:
space:
mode:
authorHenry Wilson <m3henry@googlemail.com>2019-02-18 22:39:06 +0000
committerPeterN <peter@fuzzle.org>2019-03-26 20:15:57 +0000
commita0f36a50e6324f570985f5010eb0543ec0673aeb (patch)
tree09f9c9abd097acc244f80366da42cb8702c7ed19 /src/game
parentca2f33c6d025c0c45fb4bc472493290445312de5 (diff)
downloadopenttd-a0f36a50e6324f570985f5010eb0543ec0673aeb.tar.xz
Codechange: Replaced SmallVector::Append() with std::vector::[push|emplace]_back()
Diffstat (limited to 'src/game')
-rw-r--r--src/game/game_text.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/game/game_text.cpp b/src/game/game_text.cpp
index 781d0daba..4d67b6955 100644
--- a/src/game/game_text.cpp
+++ b/src/game/game_text.cpp
@@ -115,7 +115,7 @@ LanguageStrings *ReadRawLanguageStrings(const char *file)
while (i > 0 && (buffer[i - 1] == '\r' || buffer[i - 1] == '\n' || buffer[i - 1] == ' ')) i--;
buffer[i] = '\0';
- *ret->lines.Append() = stredup(buffer, buffer + to_read - 1);
+ ret->lines.push_back(stredup(buffer, buffer + to_read - 1));
if (len > to_read) {
to_read = 0;
@@ -194,7 +194,7 @@ struct TranslationWriter : LanguageWriter {
char *dest = MallocT<char>(length + 1);
memcpy(dest, buffer, length);
dest[length] = '\0';
- *this->strings->Append() = dest;
+ this->strings->push_back(dest);
}
};
@@ -212,7 +212,7 @@ struct StringNameWriter : HeaderWriter {
void WriteStringID(const char *name, int stringid)
{
- if (stringid == (int)this->strings->size()) *this->strings->Append() = stredup(name);
+ if (stringid == (int)this->strings->size()) this->strings->push_back(stredup(name));
}
void Finalise(const StringData &data)
@@ -246,7 +246,7 @@ public:
{
if (strcmp(filename, exclude) == 0) return true;
- *gs->raw_strings.Append() = ReadRawLanguageStrings(filename);
+ gs->raw_strings.push_back(ReadRawLanguageStrings(filename));
return true;
}
};
@@ -269,7 +269,7 @@ GameStrings *LoadTranslations()
GameStrings *gs = new GameStrings();
try {
- *gs->raw_strings.Append() = ReadRawLanguageStrings(filename);
+ gs->raw_strings.push_back(ReadRawLanguageStrings(filename));
/* Scan for other language files */
LanguageScanner scanner(gs, filename);
@@ -324,8 +324,8 @@ void GameStrings::Compile()
translation_reader.ParseFile();
if (_errors != 0) throw std::exception();
- LanguageStrings *compiled = *this->compiled_strings.Append() = new LanguageStrings((*p)->language);
- TranslationWriter writer(&compiled->lines);
+ this->compiled_strings.push_back(new LanguageStrings((*p)->language));
+ TranslationWriter writer(&this->compiled_strings.back()->lines);
writer.WriteLang(data);
}
}