diff options
-rw-r--r-- | src/strgen/strgen.cpp | 1 | ||||
-rw-r--r-- | src/strings.cpp | 45 |
2 files changed, 22 insertions, 24 deletions
diff --git a/src/strgen/strgen.cpp b/src/strgen/strgen.cpp index 21f3683bb..61f731cb0 100644 --- a/src/strgen/strgen.cpp +++ b/src/strgen/strgen.cpp @@ -398,7 +398,6 @@ static void EmitGender(char *buf, int value) assert(IsInsideBS(cmd->value, SCC_CONTROL_START, UINT8_MAX)); PutUtf8(SCC_GENDER_LIST); - PutByte(cmd->value - SCC_CONTROL_START); PutByte(TranslateArgumentIdx(argidx, offset)); EmitWordList(words, nw); } diff --git a/src/strings.cpp b/src/strings.cpp index 35e266d01..5e66b5a59 100644 --- a/src/strings.cpp +++ b/src/strings.cpp @@ -792,32 +792,31 @@ static char *FormatString(char *buff, const char *str, int64 *argv, const int64 case SCC_GENDER_LIST: { // {G 0 Der Die Das} /* First read the meta data from the language file. */ - WChar fmt = SCC_CONTROL_START + (byte)*str++; byte offset = (byte)*str++; assert(argv_orig + offset < argve); - assert(dry_run || argt == NULL || argt_orig[offset] == fmt); - - /* Now we need to figure out what text to resolve, i.e. - * what do we need to draw? So get the actual raw string - * first using the control code to get said string. */ - char input[4 + 1]; - char *p = input + Utf8Encode(input, fmt); - *p = '\0'; - - /* Now do the string formatting. */ - char buf[256]; - bool old_kgd = _keep_gender_data; - _keep_gender_data = true; - p = FormatString(buf, input, argv_orig + offset, argve, 0, lastof(buf)); - _keep_gender_data = old_kgd; - *p = '\0'; - - /* And determine the string. */ int gender = 0; - const char *s = buf; - WChar c = Utf8Consume(&s); - /* Does this string have a gender, if so, set it */ - if (c == SCC_GENDER_INDEX) gender = (byte)s[0]; + if (!dry_run && argt != NULL && argt_orig[offset] != 0) { + /* Now we need to figure out what text to resolve, i.e. + * what do we need to draw? So get the actual raw string + * first using the control code to get said string. */ + char input[4 + 1]; + char *p = input + Utf8Encode(input, argt_orig[offset]); + *p = '\0'; + + /* Now do the string formatting. */ + char buf[256]; + bool old_kgd = _keep_gender_data; + _keep_gender_data = true; + p = FormatString(buf, input, argv_orig + offset, argve, 0, lastof(buf)); + _keep_gender_data = old_kgd; + *p = '\0'; + + /* And determine the string. */ + const char *s = buf; + WChar c = Utf8Consume(&s); + /* Does this string have a gender, if so, set it */ + if (c == SCC_GENDER_INDEX) gender = (byte)s[0]; + } str = ParseStringChoice(str, gender, &buff, last); break; } |