strgen: Allow inserting strings before as well as after

Use for viewport town label strings
This commit is contained in:
Jonathan G Rennison
2023-02-16 01:26:14 +00:00
parent ea589fca6e
commit 50a48b1264
8 changed files with 134 additions and 95 deletions

View File

@@ -244,6 +244,16 @@ void FileStringReader::HandlePragma(char *str)
LangString *ent = this->data.Find(str + 6);
if (ent != nullptr) {
this->data.insert_after = ent;
this->data.insert_before = nullptr;
} else {
error("Can't find string to insert after: '%s'", str + 6);
}
} else if (!memcmp(str, "before ", 7)) {
if (this->translation) error("Insert before is only allowed in the base translation.");
LangString *ent = this->data.Find(str + 7);
if (ent != nullptr) {
this->data.insert_after = nullptr;
this->data.insert_before = ent;
} else {
error("Can't find string to insert after: '%s'", str + 6);
}