mirror of
https://github.com/JGRennison/OpenTTD-patches.git
synced 2024-11-16 00:12:51 +00:00
(svn r16706) -Fix (r16694): acquiring a subsidy resulted in an assertion.
This commit is contained in:
parent
50827afb71
commit
e189037662
@ -1085,7 +1085,7 @@ static Money DeliverGoods(int num_pieces, CargoID cargo_type, StationID source,
|
|||||||
const Station *s_from = Station::Get(source);
|
const Station *s_from = Station::Get(source);
|
||||||
|
|
||||||
/* Check if a subsidy applies. */
|
/* 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 */
|
/* Increase town's counter for some special goods types */
|
||||||
|
@ -284,7 +284,7 @@ no_add:;
|
|||||||
InvalidateWindow(WC_SUBSIDIES_LIST, 0);
|
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;
|
Subsidy *s;
|
||||||
TileIndex xy;
|
TileIndex xy;
|
||||||
@ -336,7 +336,7 @@ bool CheckSubsidised(const Station *from, const Station *to, CargoID cargo_type)
|
|||||||
InjectDParam(1);
|
InjectDParam(1);
|
||||||
|
|
||||||
char *company_name = MallocT<char>(MAX_LENGTH_COMPANY_NAME_BYTES);
|
char *company_name = MallocT<char>(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);
|
GetString(company_name, STR_COMPANY_NAME, company_name + MAX_LENGTH_COMPANY_NAME_BYTES - 1);
|
||||||
|
|
||||||
SetDParamStr(0, company_name);
|
SetDParamStr(0, company_name);
|
||||||
|
@ -16,7 +16,7 @@ Pair SetupSubsidyDecodeParam(const Subsidy *s, bool mode);
|
|||||||
void DeleteSubsidyWithTown(TownID index);
|
void DeleteSubsidyWithTown(TownID index);
|
||||||
void DeleteSubsidyWithIndustry(IndustryID index);
|
void DeleteSubsidyWithIndustry(IndustryID index);
|
||||||
void DeleteSubsidyWithStation(StationID 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();
|
void SubsidyMonthlyHandler();
|
||||||
|
|
||||||
#endif /* SUBSIDY_FUNC_H */
|
#endif /* SUBSIDY_FUNC_H */
|
||||||
|
Loading…
Reference in New Issue
Block a user