(svn r24982) -Fix [FS#5465]: [Script] Crash when passing too many parameters

This commit is contained in:
rubidium
2013-02-08 20:34:27 +00:00
parent bb225ae39e
commit 4e61c1770d
13 changed files with 151 additions and 121 deletions

View File

@@ -20,12 +20,13 @@
CCountedPtr<Text> counter(text);
EnforcePrecondition(false, text != NULL);
EnforcePrecondition(false, !StrEmpty(text->GetEncodedText()));
const char *encoded = text->GetEncodedText();
EnforcePreconditionEncodedText(false, encoded);
EnforcePrecondition(false, type == NT_ECONOMY || type == NT_SUBSIDIES || type == NT_GENERAL);
EnforcePrecondition(false, company == ScriptCompany::COMPANY_INVALID || ScriptCompany::ResolveCompanyID(company) != ScriptCompany::COMPANY_INVALID);
uint8 c = company;
if (company == ScriptCompany::COMPANY_INVALID) c = INVALID_COMPANY;
return ScriptObject::DoCommand(0, type | (NR_NONE << 8) | (c << 16), 0, CMD_CUSTOM_NEWS_ITEM, text->GetEncodedText());
return ScriptObject::DoCommand(0, type | (NR_NONE << 8) | (c << 16), 0, CMD_CUSTOM_NEWS_ITEM, encoded);
}