From 8e804a4b6c694c75e6dca6d529332541776c73cb Mon Sep 17 00:00:00 2001 From: rubidium Date: Wed, 1 Jul 2009 09:45:30 +0000 Subject: (svn r16706) -Fix (r16694): acquiring a subsidy resulted in an assertion. --- src/economy.cpp | 2 +- src/subsidy.cpp | 4 ++-- src/subsidy_func.h | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/economy.cpp b/src/economy.cpp index d4647fd9c..b313c89a6 100644 --- a/src/economy.cpp +++ b/src/economy.cpp @@ -1085,7 +1085,7 @@ static Money DeliverGoods(int num_pieces, CargoID cargo_type, StationID source, const Station *s_from = Station::Get(source); /* Check if a subsidy applies. */ - subsidised = CheckSubsidised(s_from, s_to, cargo_type); + subsidised = CheckSubsidised(s_from, s_to, cargo_type, company->index); } /* Increase town's counter for some special goods types */ diff --git a/src/subsidy.cpp b/src/subsidy.cpp index fbc8c01c6..d444c4d43 100644 --- a/src/subsidy.cpp +++ b/src/subsidy.cpp @@ -284,7 +284,7 @@ no_add:; InvalidateWindow(WC_SUBSIDIES_LIST, 0); } -bool CheckSubsidised(const Station *from, const Station *to, CargoID cargo_type) +bool CheckSubsidised(const Station *from, const Station *to, CargoID cargo_type, CompanyID company) { Subsidy *s; TileIndex xy; @@ -336,7 +336,7 @@ bool CheckSubsidised(const Station *from, const Station *to, CargoID cargo_type) InjectDParam(1); char *company_name = MallocT(MAX_LENGTH_COMPANY_NAME_BYTES); - SetDParam(0, _current_company); + SetDParam(0, company); GetString(company_name, STR_COMPANY_NAME, company_name + MAX_LENGTH_COMPANY_NAME_BYTES - 1); SetDParamStr(0, company_name); diff --git a/src/subsidy_func.h b/src/subsidy_func.h index 063c59233..fc5a4b155 100644 --- a/src/subsidy_func.h +++ b/src/subsidy_func.h @@ -16,7 +16,7 @@ Pair SetupSubsidyDecodeParam(const Subsidy *s, bool mode); void DeleteSubsidyWithTown(TownID index); void DeleteSubsidyWithIndustry(IndustryID index); void DeleteSubsidyWithStation(StationID index); -bool CheckSubsidised(const Station *from, const Station *to, CargoID cargo_type); +bool CheckSubsidised(const Station *from, const Station *to, CargoID cargo_type, CompanyID company); void SubsidyMonthlyHandler(); #endif /* SUBSIDY_FUNC_H */ -- cgit v1.2.3-70-g09d2