diff options
author | rubidium <rubidium@openttd.org> | 2010-02-20 23:02:03 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2010-02-20 23:02:03 +0000 |
commit | 44f2ef179d98837c415bf91c131418e655f59ed6 (patch) | |
tree | 549da76df0fa162609a2e2dfc302f0eeba5a7b47 /src/strgen/strgen.cpp | |
parent | 7e96d309d34e42e5267d7f881990db6c65f2f7aa (diff) | |
download | openttd-44f2ef179d98837c415bf91c131418e655f59ed6.tar.xz |
(svn r19179) -Codechange: make strgen do some checking on whether genders are valid for a command (e.g. we don't have genders for numbers)
Diffstat (limited to 'src/strgen/strgen.cpp')
-rw-r--r-- | src/strgen/strgen.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp index b6eb880b9..126fcdebc 100644 --- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -140,7 +140,7 @@ static LangString *HashFind(const char *s) #ifdef _MSC_VER # define LINE_NUM_FMT(s) "%s (%d): warning: %s (" s ")\n" #else -# define LINE_NUM_FMT(s) "%s: :%d: " s ": %s\n" +# define LINE_NUM_FMT(s) "%s:%d: " s ": %s\n" #endif static void CDECL strgen_warning(const char *s, ...) WARN_FORMAT(1, 2); @@ -397,6 +397,11 @@ static void EmitGender(char *buf, int value) * If no relative number exists, default to +0 */ if (!ParseRelNum(&buf, &argidx, &offset)) {} + const CmdStruct *cmd = _cur_pcs.cmd[argidx]; + if ((cmd->flags & C_GENDER) == 0) { + error("Command '%s' can't have a gender", cmd->cmd); + } + for (nw = 0; nw < MAX_NUM_GENDER; nw++) { words[nw] = ParseWord(&buf); if (words[nw] == NULL) break; |