Changeset - r12643:391d5f6795de
[Not reviewed]
master
0 1 0
frosch - 15 years ago 2009-08-08 08:48:39
frosch@openttd.org
(svn r17108) -Fix (r17107): ST_INDUSTRY and ST_TOWN got swapped when setting up cargo subsidy.
1 file changed with 3 insertions and 3 deletions:
0 comments (0 inline, 0 general)
src/subsidy.cpp
Show inline comments
 
@@ -276,53 +276,53 @@ void SubsidyMonthlyLoop()
 
	if (Chance16(1, 4)) {
 
		/*  Find a free slot*/
 
		s = Subsidy::AllocateItem();
 
		if (s == NULL) goto no_add;
 

	
 
		uint n = 1000;
 
		do {
 
			FoundRoute fr;
 
			FindSubsidyPassengerRoute(&fr);
 
			if (fr.distance <= 70) {
 
				s->cargo_type = CT_PASSENGERS;
 
				s->src_type = s->dst_type = ST_TOWN;
 
				s->src = ((Town *)fr.from)->index;
 
				s->dst = ((Town *)fr.to)->index;
 
				goto add_subsidy;
 
			}
 
			FindSubsidyCargoRoute(&fr);
 
			if (fr.distance <= 70) {
 
				s->cargo_type = fr.cargo;
 
				s->src_type = ST_INDUSTRY;
 
				s->src = ((Industry *)fr.from)->index;
 
				{
 
					const CargoSpec *cs = CargoSpec::Get(fr.cargo);
 
					if (cs->town_effect == TE_GOODS || cs->town_effect == TE_FOOD) {
 
						s->dst_type = ST_TOWN;
 
						s->dst = ((Town *)fr.to)->index;
 
					} else {
 
						s->dst_type = ST_INDUSTRY;
 
						s->dst = ((Industry *)fr.to)->index;
 
					} else {
 
						s->dst_type = ST_TOWN;
 
						s->dst = ((Town *)fr.to)->index;
 
					}
 
				}
 
	add_subsidy:
 
				if (!CheckSubsidyDuplicate(s)) {
 
					s->age = 0;
 
					Pair reftype = SetupSubsidyDecodeParam(s, 0);
 
					AddNewsItem(STR_NEWS_SERVICE_SUBSIDY_OFFERED, NS_SUBSIDIES, (NewsReferenceType)reftype.a, s->src, (NewsReferenceType)reftype.b, s->dst);
 
					AI::BroadcastNewEvent(new AIEventSubsidyOffer(s->Index()));
 
					modified = true;
 
					break;
 
				}
 
			}
 
		} while (n--);
 
	}
 
no_add:;
 
	if (modified)
 
		InvalidateWindow(WC_SUBSIDIES_LIST, 0);
 
}
 

	
 
bool CheckSubsidised(const Station *from, const Station *to, CargoID cargo_type, CompanyID company)
 
{
 
	Subsidy *s;
 
	TileIndex xy;
 

	
0 comments (0 inline, 0 general)