diff options
author | rubidium <rubidium@openttd.org> | 2009-04-23 13:32:13 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-04-23 13:32:13 +0000 |
commit | 85ca163be20f0e3eb41cdcd41234723c77ade723 (patch) | |
tree | df5a17ef938cbde9f398633c6748204a04ddc4cb | |
parent | 3dbcc66cb1b8df44d3b462fdfa46d38e7f0f7441 (diff) | |
download | openttd-85ca163be20f0e3eb41cdcd41234723c77ade723.tar.xz |
(svn r16122) -Change: add more misc information about the behaviour of commands to strgen's -export-commands.
-rw-r--r-- | src/strgen/strgen.cpp | 28 |
1 files changed, 26 insertions, 2 deletions
diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp index d1654fe02..4da6a078f 100644 --- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -1198,9 +1198,33 @@ int CDECL main(int argc, char *argv[]) } if (strcmp(argv[1], "-export-commands") == 0) { - printf("args\tcommand\treplacement\n"); + printf("args\tflags\tcommand\treplacement\n"); for (const CmdStruct *cs = _cmd_structs; cs < endof(_cmd_structs); cs++) { - printf("%i\t\"%s\"\t\"%s\"\n", cs->consumes, cs->cmd, strstr(cs->cmd, "STRING") ? "STRING" : cs->cmd); + char flags; + switch (cs->value) { + case 0x200E: case 0x200F: // Implicit BIDI controls + case 0x202A: case 0x202B: case 0x202C: case 0x202D: case 0x202E: // Explicit BIDI controls + case 0xA0: // Non breaking space + case '\n': // Newlines may be added too + case '{': // This special + /* This command may be in the translation when it is not in base */ + flags = 'i'; + break; + + default: + if (cs->proc == EmitSetX) { + flags = '1'; // Command needs one parameter + } else if (cs->proc == EmitSetXY) { + flags = '2'; // Command needs two parameters + } else if (cs->proc == EmitGender) { + flags = 'g'; // Command needs number of parameters defined by plural value + } else if (cs->proc == EmitPlural) { + flags = 'p'; // Command needs number of parameters defined by number of cases + } else { + flags = '0'; // Command needs no parameters + } + } + printf("%i\t%c\t\"%s\"\t\"%s\"\n", cs->consumes, flags, cs->cmd, strstr(cs->cmd, "STRING") ? "STRING" : cs->cmd); } return 0; } |