|
@@ -984,69 +984,69 @@ void LanguageWriter::WriteLang(const Str
|
|
|
this->WriteLength(0);
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
_cur_ident = ls->name;
|
|
|
_cur_line = ls->line;
|
|
|
|
|
|
/* Produce a message if a string doesn't have a translation. */
|
|
|
if (_show_todo > 0 && ls->translated == NULL) {
|
|
|
if ((_show_todo & 2) != 0) {
|
|
|
strgen_warning("'%s' is untranslated", ls->name);
|
|
|
}
|
|
|
if ((_show_todo & 1) != 0) {
|
|
|
const char *s = "<TODO> ";
|
|
|
while (*s != '\0') buffer.AppendByte(*s++);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
/* Extract the strings and stuff from the english command string */
|
|
|
ExtractCommandString(&_cur_pcs, ls->english, false);
|
|
|
|
|
|
if (ls->translated_case != NULL || ls->translated != NULL) {
|
|
|
casep = ls->translated_case;
|
|
|
cmdp = ls->translated;
|
|
|
} else {
|
|
|
casep = NULL;
|
|
|
cmdp = ls->english;
|
|
|
}
|
|
|
|
|
|
_translated = cmdp != ls->english;
|
|
|
|
|
|
if (casep != NULL) {
|
|
|
const Case *c;
|
|
|
uint num;
|
|
|
|
|
|
/* Need to output a case-switch.
|
|
|
* It has this format
|
|
|
* <0x9E> <NUM CASES> <CASE1> <LEN1> <STRING1> <CASE2> <LEN2> <STRING2> <CASE3> <LEN3> <STRING3> <STRINGDEFAULT>
|
|
|
* Each LEN is printed using 2 bytes in big endian order. */
|
|
|
buffer.AppendUtf8(SCC_SWITCH_CASE);
|
|
|
/* Count the number of cases */
|
|
|
for (num = 0, c = casep; c; c = c->next) num++;
|
|
|
buffer.AppendByte(num);
|
|
|
|
|
|
/* Write each case */
|
|
|
for (c = casep; c != NULL; c = c->next) {
|
|
|
buffer.AppendByte(c->caseidx);
|
|
|
/* Make some space for the 16-bit length */
|
|
|
uint pos = buffer.Length();
|
|
|
uint pos = buffer.size();
|
|
|
buffer.AppendByte(0);
|
|
|
buffer.AppendByte(0);
|
|
|
/* Write string */
|
|
|
PutCommandString(&buffer, c->string);
|
|
|
buffer.AppendByte(0); // terminate with a zero
|
|
|
/* Fill in the length */
|
|
|
uint size = buffer.Length() - (pos + 2);
|
|
|
uint size = buffer.size() - (pos + 2);
|
|
|
buffer[pos + 0] = GB(size, 8, 8);
|
|
|
buffer[pos + 1] = GB(size, 0, 8);
|
|
|
}
|
|
|
}
|
|
|
|
|
|
if (cmdp != NULL) PutCommandString(&buffer, cmdp);
|
|
|
|
|
|
this->WriteLength(buffer.Length());
|
|
|
this->Write(buffer.Begin(), buffer.Length());
|
|
|
this->WriteLength(buffer.size());
|
|
|
this->Write(buffer.Begin(), buffer.size());
|
|
|
buffer.clear();
|
|
|
}
|
|
|
}
|
|
|
}
|