summaryrefslogtreecommitdiff
path: root/src/strgen
diff options
context:
space:
mode:
authoryexo <yexo@openttd.org>2010-11-28 19:40:35 +0000
committeryexo <yexo@openttd.org>2010-11-28 19:40:35 +0000
commitd81d42bfc3d18cbf44739a441387f1a6ed11aa3e (patch)
tree965e1f6c8c0bc77c65c3ac1c73847795b139c07b /src/strgen
parent35af4630460a87765ac36145e24e890a5901bce5 (diff)
downloadopenttd-d81d42bfc3d18cbf44739a441387f1a6ed11aa3e.tar.xz
(svn r21347) -Cleanup: remove an unused feature from strgen and remove some ifs where we already know the result
Diffstat (limited to 'src/strgen')
-rw-r--r--src/strgen/strgen.cpp57
1 files changed, 25 insertions, 32 deletions
diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp
index 23f9ed56f..85dfbdd02 100644
--- a/src/strgen/strgen.cpp
+++ b/src/strgen/strgen.cpp
@@ -742,21 +742,19 @@ static void HandleString(char *str, bool master)
return;
}
- if (ent == NULL) {
- if (_strings[_next_string_id]) {
- strgen_error("String ID 0x%X for '%s' already in use by '%s'", _next_string_id, str, _strings[_next_string_id]->name);
- return;
- }
+ if (_strings[_next_string_id]) {
+ strgen_error("String ID 0x%X for '%s' already in use by '%s'", _next_string_id, str, _strings[_next_string_id]->name);
+ return;
+ }
- /* Allocate a new LangString */
- ent = CallocT<LangString>(1);
- _strings[_next_string_id] = ent;
- ent->index = _next_string_id++;
- ent->name = strdup(str);
- ent->line = _cur_line;
+ /* Allocate a new LangString */
+ ent = CallocT<LangString>(1);
+ _strings[_next_string_id] = ent;
+ ent->index = _next_string_id++;
+ ent->name = strdup(str);
+ ent->line = _cur_line;
- HashAdd(str, ent);
- }
+ HashAdd(str, ent);
ent->english = strdup(s);
} else {
@@ -770,27 +768,22 @@ static void HandleString(char *str, bool master)
return;
}
- if (s[0] == ':' && s[1] == '\0' && casep == NULL) {
- /* Special syntax :: means we should just inherit the master string */
- ent->translated = strdup(ent->english);
- } else {
- /* make sure that the commands match */
- if (!CheckCommandsMatch(s, ent->english, str)) return;
+ /* make sure that the commands match */
+ if (!CheckCommandsMatch(s, ent->english, str)) return;
- if (casep != NULL) {
- Case *c = MallocT<Case>(1);
+ if (casep != NULL) {
+ Case *c = MallocT<Case>(1);
- c->caseidx = ResolveCaseName(casep, strlen(casep));
- c->string = strdup(s);
- c->next = ent->translated_case;
- ent->translated_case = c;
- } else {
- ent->translated = strdup(s);
- /* If the string was translated, use the line from the
- * translated language so errors in the translated file
- * are properly referenced to. */
- ent->line = _cur_line;
- }
+ c->caseidx = ResolveCaseName(casep, strlen(casep));
+ c->string = strdup(s);
+ c->next = ent->translated_case;
+ ent->translated_case = c;
+ } else {
+ ent->translated = strdup(s);
+ /* If the string was translated, use the line from the
+ * translated language so errors in the translated file
+ * are properly referenced to. */
+ ent->line = _cur_line;
}
}
}