Changeset - r12279:1653fc3a5444
[Not reviewed]
master
0 3 0
rubidium - 15 years ago 2009-07-01 09:45:30
rubidium@openttd.org
(svn r16706) -Fix (r16694): acquiring a subsidy resulted in an assertion.
3 files changed with 4 insertions and 4 deletions:
0 comments (0 inline, 0 general)
src/economy.cpp
Show inline comments
 
@@ -1082,13 +1082,13 @@ static Money DeliverGoods(int num_pieces
 
	const Station *s_to = Station::Get(dest);
 

	
 
	if (source != INVALID_STATION) {
 
		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 */
 
	const CargoSpec *cs = GetCargo(cargo_type);
 
	if (cs->town_effect == TE_FOOD) s_to->town->new_act_food += num_pieces;
 
	if (cs->town_effect == TE_WATER) s_to->town->new_act_water += num_pieces;
src/subsidy.cpp
Show inline comments
 
@@ -281,13 +281,13 @@ void SubsidyMonthlyLoop()
 
	}
 
no_add:;
 
	if (modified)
 
		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;
 

	
 
	/* check if there is an already existing subsidy that applies to us */
 
	for (s = _subsidies; s != endof(_subsidies); s++) {
 
@@ -333,13 +333,13 @@ bool CheckSubsidised(const Station *from
 

	
 
			/* Add a news item */
 
			Pair reftype = SetupSubsidyDecodeParam(s, 0);
 
			InjectDParam(1);
 

	
 
			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);
 

	
 
			SetDParamStr(0, company_name);
 
			AddNewsItem(
 
				STR_NEWS_SERVICE_SUBSIDY_AWARDED_HALF + _settings_game.difficulty.subsidy_multiplier,
 
				NS_SUBSIDIES,
src/subsidy_func.h
Show inline comments
 
@@ -13,10 +13,10 @@
 
#include "subsidy_type.h"
 

	
 
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 */
0 comments (0 inline, 0 general)