summaryrefslogtreecommitdiff
path: root/src/strings.cpp
diff options
context:
space:
mode:
authorfrosch <frosch@openttd.org>2014-01-12 17:59:43 +0000
committerfrosch <frosch@openttd.org>2014-01-12 17:59:43 +0000
commit5ab39cc65176bc150625995a6a639625a7b1f579 (patch)
treed6cafd199e6c10aa6e3f75dd610c00d6f2173be3 /src/strings.cpp
parentbc86bf9b12ba513e33aeab8a5ff7203009ba2d87 (diff)
downloadopenttd-5ab39cc65176bc150625995a6a639625a7b1f579.tar.xz
(svn r26238) -Codechange: Use StringParameters::GetDataLeft to check for left space in the param array.
Diffstat (limited to 'src/strings.cpp')
-rw-r--r--src/strings.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/strings.cpp b/src/strings.cpp
index d29381cdb..97398194a 100644
--- a/src/strings.cpp
+++ b/src/strings.cpp
@@ -1022,7 +1022,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
/* WARNING. It's prohibited for the included string to consume any arguments.
* For included strings that consume argument, you should use STRING1, STRING2 etc.
* To debug stuff you can set argv to NULL and it will tell you */
- StringParameters tmp_params(args->GetDataPointer(), args->num_param - args->offset, NULL);
+ StringParameters tmp_params(args->GetDataPointer(), args->GetDataLeft(), NULL);
buff = GetStringWithArgs(buff, str, &tmp_params, last, next_substr_case_index, game_script);
next_substr_case_index = 0;
break;
@@ -1039,7 +1039,7 @@ static char *FormatString(char *buff, const char *str_arg, StringParameters *arg
StringID str = args->GetInt32(b);
if (game_script && GB(str, TAB_COUNT_OFFSET, TAB_COUNT_BITS) != GAME_TEXT_TAB) break;
uint size = b - SCC_STRING1 + 1;
- if (game_script && size > args->num_param - args->offset) {
+ if (game_script && size > args->GetDataLeft()) {
buff = strecat(buff, "(too many parameters)", last);
} else {
StringParameters sub_args(*args, size);