Skip to content

Commit 12f2a1e

Browse files
authored
Merge pull request #3353 from enewey/enewey/maniacs-popline
StringVar: address popLine edge case behavior to match maniacs
2 parents 4493b1a + f92e6c4 commit 12f2a1e

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/game_strings.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,8 +282,12 @@ StringView Game_Strings::PopLine(Str_Params params, int offset, int string_out_i
282282

283283
Set(params, ss.str().substr(str.length() - offset));
284284

285-
params.string_id = string_out_id;
286-
Set(params, result);
285+
// the maniacs implementation is to always preserve the mutated base string
286+
// so in the case where the out_id matches the base string id, the popped line is discarded.
287+
if (string_out_id != params.string_id) {
288+
params.string_id = string_out_id;
289+
Set(params, result);
290+
}
287291
return Get(params.string_id);
288292
}
289293

0 commit comments

Comments
 (0)