Skip to content

Commit eed5353

Browse files
committed
lcftrans: ShowStringPic - Handle mode escapes in the string correctly when they are not \x01
This was figured out in the Player when string variables were implemented.
1 parent 1eb6fbd commit eed5353

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

lcftrans/src/translation.cpp

+14-4
Original file line numberDiff line numberDiff line change
@@ -316,11 +316,21 @@ struct ParseEvent {
316316
case Cmd::Maniac_ShowStringPicture: {
317317
// Show String Picture
318318
add_evt_entry();
319-
auto tokens = Utils::Split(lcf::ToString(estring), '\x01');
320-
if (tokens.size() >= 4) {
319+
320+
if (!estring.empty() && estring[0] == '\x01') {
321+
std::string term = "";
322+
323+
for (size_t i = 1; i < estring.size(); ++i) {
324+
char c = estring[i];
325+
if (c == '\x01' || c == '\x02' || c == '\x03') {
326+
break;
327+
}
328+
term += c;
329+
}
330+
321331
info.push_back(make_info(ctx));
322332
info.push_back("Show String Picture");
323-
for (auto& line: Utils::Split(tokens[1], '\n')) {
333+
for (auto& line: Utils::Split(term, '\n')) {
324334
lines.push_back(Utils::RemoveControlChars(line));
325335
}
326336
context = "strpic";
@@ -537,7 +547,7 @@ Translation Translation::fromPO(const std::string& filename) {
537547
continue;
538548
}
539549
std::cerr << "Parse error (Line " << line_number << "): Expected \", got " << c << ": " << line << "\n";
540-
return "";
550+
return "";
541551
}
542552

543553
if (!slash && c == '\\') {

0 commit comments

Comments
 (0)