From 44f2ef179d98837c415bf91c131418e655f59ed6 Mon Sep 17 00:00:00 2001 From: rubidium Date: Sat, 20 Feb 2010 23:02:03 +0000 Subject: (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) --- src/strgen/strgen.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/strgen') 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; -- cgit v1.2.3-54-g00ecf