Skip to content

Commit

Permalink
Fix: Allow invalid game_script strings for compatibility.
Browse files Browse the repository at this point in the history
Now that StringParameters are properly bounds checked, some game scripts attempt to use invalidly formatted strings that no longer work.

In the interests of compatibility, we allow game script strings to consume more arguments than requested—StringParameters are still bounds check so this is safe.
  • Loading branch information
PeterN committed Jan 3, 2024
1 parent c18d53c commit f5abdb5
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/strings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1112,7 +1112,7 @@ static void FormatString(StringBuilder &builder, const char *str_arg, StringPara
StringID string_id = args.GetNextParameter<StringID>();
if (game_script && GetStringTab(string_id) != TEXT_TAB_GAMESCRIPT_START) break;
/* It's prohibited for the included string to consume any arguments. */
StringParameters tmp_params(args, 0);
StringParameters tmp_params(args, game_script ? args.GetDataLeft() : 0);
GetStringWithArgs(builder, string_id, tmp_params, next_substr_case_index, game_script);
next_substr_case_index = 0;
break;
Expand Down

0 comments on commit f5abdb5

Please sign in to comment.