diff options
author | truebrain <truebrain@openttd.org> | 2011-12-19 21:06:06 +0000 |
---|---|---|
committer | truebrain <truebrain@openttd.org> | 2011-12-19 21:06:06 +0000 |
commit | 102f811d0277afefe5c90762c0c4cc11ab69713c (patch) | |
tree | 1c7343e8031eab2c764cff974bd9df9a814c3dd9 /src/script/api/script_news.cpp | |
parent | b0ac529a6ff4e087520a14d2a0169f445952e7e0 (diff) | |
download | openttd-102f811d0277afefe5c90762c0c4cc11ab69713c.tar.xz |
(svn r23636) -Add: introduce ScriptText in parameters where it can be used
Diffstat (limited to 'src/script/api/script_news.cpp')
-rw-r--r-- | src/script/api/script_news.cpp | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/src/script/api/script_news.cpp b/src/script/api/script_news.cpp index 36ebf9204..d2c5e9343 100644 --- a/src/script/api/script_news.cpp +++ b/src/script/api/script_news.cpp @@ -18,14 +18,17 @@ #include "../../string_func.h" #include "table/strings.h" -/* static */ bool ScriptNews::Create(NewsType type, const char *text, ScriptCompany::CompanyID company) +/* static */ bool ScriptNews::Create(NewsType type, Text *text, ScriptCompany::CompanyID company) { - EnforcePrecondition(false, !StrEmpty(text)); + CCountedPtr<Text> counter(text); + + EnforcePrecondition(false, text != NULL); + EnforcePrecondition(false, !StrEmpty(text->GetEncodedText())); EnforcePrecondition(false, type >= NT_ARRIVAL_COMPANY && 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); + return ScriptObject::DoCommand(0, type | (NR_NONE << 8) | (c << 16), 0, CMD_CUSTOM_NEWS_ITEM, text->GetEncodedText()); } |