(svn r27295) -Add: [strgen] Default plural subparameter positions for CARGO_xxx string control codes.
This commit is contained in:
@@ -388,7 +388,7 @@ static void EmitWordList(Buffer *buffer, const char * const *words, uint nw)
|
||||
void EmitPlural(Buffer *buffer, char *buf, int value)
|
||||
{
|
||||
int argidx = _cur_argidx;
|
||||
int offset = 0;
|
||||
int offset = -1;
|
||||
int expected = _plural_forms[_lang.plural_form].plural_count;
|
||||
const char **words = AllocaM(const char *, max(expected, MAX_PLURALS));
|
||||
int nw = 0;
|
||||
@@ -396,6 +396,15 @@ void EmitPlural(Buffer *buffer, char *buf, int value)
|
||||
/* Parse out the number, if one exists. Otherwise default to prev arg. */
|
||||
if (!ParseRelNum(&buf, &argidx, &offset)) argidx--;
|
||||
|
||||
const CmdStruct *cmd = _cur_pcs.cmd[argidx];
|
||||
if (offset == -1) {
|
||||
/* Use default offset */
|
||||
if (cmd == NULL || cmd->default_plural_offset < 0) {
|
||||
strgen_fatal("Command '%s' has no (default) plural position", cmd == NULL ? "<empty>" : cmd->cmd);
|
||||
}
|
||||
offset = cmd->default_plural_offset;
|
||||
}
|
||||
|
||||
/* Parse each string */
|
||||
for (nw = 0; nw < MAX_PLURALS; nw++) {
|
||||
words[nw] = ParseWord(&buf);
|
||||
|
Reference in New Issue
Block a user