File diff r2951:a52cbb930051 → r2952:e97f823d2dbe
economy.c
Show inline comments
 
@@ -502,13 +502,13 @@ void DrawNewsBankrupcy(Window *w)
 

	
 
	SetDParam(0, p->president_name_1);
 
	SetDParam(1, p->president_name_2);
 

	
 
	DrawStringMultiCenter(49, 148, STR_7058_PRESIDENT, 94);
 

	
 
	switch(WP(w,news_d).ni->string_id >> 4) {
 
	switch (WP(w,news_d).ni->string_id >> 4) {
 
	case 1:
 
		DrawStringCentered(w->width>>1, 1, STR_7056_TRANSPORT_COMPANY_IN_TROUBLE, 0);
 

	
 
		SetDParam(0, p->name_1);
 
		SetDParam(1, p->name_2);
 

	
 
@@ -803,13 +803,13 @@ void SetPriceBaseMultiplier(uint price, 
 
void StartupEconomy(void)
 
{
 
	int i;
 

	
 
	assert(sizeof(_price) == NUM_PRICES * sizeof(int32));
 

	
 
	for(i=0; i!=NUM_PRICES; i++) {
 
	for (i = 0; i != NUM_PRICES; i++) {
 
		int32 price = _price_base[i];
 
		if (_price_category[i] != 0) {
 
			uint mod = _price_category[i] == 1 ? _opt.diff.vehicle_costs : _opt.diff.construction_cost;
 
			if (mod < 1) {
 
				price = price * 3 >> 2;
 
			} else if (mod > 1) {
 
@@ -880,13 +880,13 @@ Pair SetupSubsidyDecodeParam(const Subsi
 
}
 

	
 
void DeleteSubsidyWithIndustry(uint16 index)
 
{
 
	Subsidy *s;
 

	
 
	for(s=_subsidies; s != endof(_subsidies); s++) {
 
	for (s = _subsidies; s != endof(_subsidies); s++) {
 
		if (s->cargo_type != CT_INVALID && s->age < 12 &&
 
				s->cargo_type != CT_PASSENGERS && s->cargo_type != CT_MAIL &&
 
				(index == s->from || (s->cargo_type!=CT_GOODS && s->cargo_type!=CT_FOOD && index==s->to))) {
 
			s->cargo_type = CT_INVALID;
 
		}
 
	}
 
@@ -894,13 +894,13 @@ void DeleteSubsidyWithIndustry(uint16 in
 

	
 
void DeleteSubsidyWithStation(uint16 index)
 
{
 
	Subsidy *s;
 
	bool dirty = false;
 

	
 
	for(s=_subsidies; s != endof(_subsidies); s++) {
 
	for (s = _subsidies; s != endof(_subsidies); s++) {
 
		if (s->cargo_type != CT_INVALID && s->age >= 12 &&
 
				(s->from == index || s->to == index)) {
 
			s->cargo_type = CT_INVALID;
 
			dirty = true;
 
		}
 
	}
 
@@ -1011,15 +1011,14 @@ static void SubsidyMonthlyHandler(void)
 
	Pair pair;
 
	Station *st;
 
	uint n;
 
	FoundRoute fr;
 
	bool modified = false;
 

	
 
	for(s=_subsidies; s != endof(_subsidies); s++) {
 
		if (s->cargo_type == CT_INVALID)
 
			continue;
 
	for (s = _subsidies; s != endof(_subsidies); s++) {
 
		if (s->cargo_type == CT_INVALID) continue;
 

	
 
		if (s->age == 12-1) {
 
			pair = SetupSubsidyDecodeParam(s, 1);
 
			AddNewsItem(STR_202E_OFFER_OF_SUBSIDY_EXPIRED, NEWS_FLAGS(NM_NORMAL, NF_TILE, NT_SUBSIDIES, 0), pair.a, pair.b);
 
			s->cargo_type = CT_INVALID;
 
			modified = true;
 
@@ -1087,13 +1086,13 @@ static const SaveLoad _subsidies_desc[] 
 

	
 
static void Save_SUBS(void)
 
{
 
	int i;
 
	Subsidy *s;
 

	
 
	for(i=0; i!=lengthof(_subsidies); i++) {
 
	for (i = 0; i != lengthof(_subsidies); i++) {
 
		s = &_subsidies[i];
 
		if (s->cargo_type != CT_INVALID) {
 
			SlSetArrayIndex(i);
 
			SlObject(s, _subsidies_desc);
 
		}
 
	}
 
@@ -1534,13 +1533,13 @@ static void DoAcquireCompany(Player *p)
 
	if (p->bankrupt_value == 0) {
 
		owner = GetPlayer(_current_player);
 
		owner->current_loan += p->current_loan;
 
	}
 

	
 
	value = CalculateCompanyValue(p) >> 2;
 
	for(i=0; i!=4; i++) {
 
	for (i = 0; i != 4; i++) {
 
		if (p->share_owners[i] != OWNER_SPECTATOR) {
 
			owner = GetPlayer(p->share_owners[i]);
 
			owner->money64 += value;
 
			owner->yearly_expenses[0][EXPENSES_OTHER] += value;
 
			UpdatePlayerMoney32(owner);
 
		}