Skip to content

Commit

Permalink
StringVar: address popLine edge case behavior to match maniacs
Browse files Browse the repository at this point in the history
  • Loading branch information
enewey committed Feb 20, 2025
1 parent 6260f41 commit f92e6c4
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/game_strings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -282,8 +282,12 @@ StringView Game_Strings::PopLine(Str_Params params, int offset, int string_out_i

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

params.string_id = string_out_id;
Set(params, result);
// the maniacs implementation is to always preserve the mutated base string
// so in the case where the out_id matches the base string id, the popped line is discarded.
if (string_out_id != params.string_id) {
params.string_id = string_out_id;
Set(params, result);
}
return Get(params.string_id);
}

Expand Down

0 comments on commit f92e6c4

Please sign in to comment.