Index: src/script/api/script_text.cpp
===================================================================
--- src/script/api/script_text.cpp (revision 26763)
+++ src/script/api/script_text.cpp (working copy)
@@ -12,8 +12,10 @@
#include "../../stdafx.h"
#include "../../string_func.h"
#include "../../strings_func.h"
+#include "script_log.hpp"
#include "script_text.hpp"
#include "../../table/control_codes.h"
+#include "../../game/game_text.hpp"
#include "table/strings.h"
@@ -184,7 +186,21 @@
static char buf[1024];
int param_count = 0;
this->_GetEncodedText(buf, lastof(buf), param_count);
- return (param_count > SCRIPT_TEXT_MAX_PARAMETERS) ? NULL : buf;
+
+ if (param_count > SCRIPT_TEXT_MAX_PARAMETERS) {
+ const char *string_name = "unknown";
+
+ extern GameStrings *_current_data;
+ if (_current_data != NULL && this->string < _current_data->string_names.Length()) {
+ string_name = _current_data->string_names[this->string];
+ }
+
+ char log_message[1024];
+ seprintf(log_message, lastof(log_message), "String '%s' uses too many (%u) parameters", string_name, param_count);
+ ScriptLog::Error(log_message);
+ return NULL;
+ }
+ return buf;
}
char *ScriptText::_GetEncodedText(char *p, char *lastofp, int ¶m_count)
@@ -199,6 +215,7 @@
}
if (this->paramt[i] != NULL) {
p += seprintf(p, lastofp, ":");
+ param_count++;
p = this->paramt[i]->_GetEncodedText(p, lastofp, param_count);
continue;
}