(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)

This commit is contained in:
rubidium
2010-02-20 23:02:03 +00:00
parent 78413c4ee8
commit 15395264af
2 changed files with 28 additions and 22 deletions

View File

@@ -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;