(svn r16418) -Fix: Resolve the company name for 'subsidy awarded'-news when the news are triggered, so it stays valid when the company bankrupts or is taken over.

This commit is contained in:
frosch
2009-05-24 17:23:24 +00:00
parent 6d74fb3553
commit 80e19b12c3
47 changed files with 190 additions and 185 deletions

View File

@@ -335,11 +335,16 @@ bool CheckSubsidised(const Station *from, const Station *to, CargoID cargo_type)
Pair reftype = SetupSubsidyDecodeParam(s, 0);
InjectDParam(1);
char *company_name = MallocT<char>(MAX_LENGTH_COMPANY_NAME_BYTES);
SetDParam(0, _current_company);
GetString(company_name, STR_COMPANY_NAME, company_name + MAX_LENGTH_COMPANY_NAME_BYTES - 1);
SetDParamStr(0, company_name);
AddNewsItem(
STR_NEWS_SERVICE_SUBSIDY_AWARDED_HALF + _settings_game.difficulty.subsidy_multiplier,
NS_SUBSIDIES,
(NewsReferenceType)reftype.a, s->from, (NewsReferenceType)reftype.b, s->to
(NewsReferenceType)reftype.a, s->from, (NewsReferenceType)reftype.b, s->to,
company_name
);
AI::BroadcastNewEvent(new AIEventSubsidyAwarded(s - _subsidies));