equal
deleted
inserted
replaced
702 } |
702 } |
703 } |
703 } |
704 |
704 |
705 static void HandleEconomyFluctuations() |
705 static void HandleEconomyFluctuations() |
706 { |
706 { |
707 if (_opt.diff.economy == 0) return; |
707 if (_settings.difficulty.economy == 0) return; |
708 |
708 |
709 if (--_economy.fluct == 0) { |
709 if (--_economy.fluct == 0) { |
710 _economy.fluct = -(int)GB(Random(), 0, 2); |
710 _economy.fluct = -(int)GB(Random(), 0, 2); |
711 AddNewsItem(STR_7073_WORLD_RECESSION_FINANCIAL, NS_ECONOMY, 0, 0); |
711 AddNewsItem(STR_7073_WORLD_RECESSION_FINANCIAL, NS_ECONOMY, 0, 0); |
712 } else if (_economy.fluct == -12) { |
712 } else if (_economy.fluct == -12) { |
811 assert(sizeof(_price) == NUM_PRICES * sizeof(Money)); |
811 assert(sizeof(_price) == NUM_PRICES * sizeof(Money)); |
812 |
812 |
813 for (i = 0; i != NUM_PRICES; i++) { |
813 for (i = 0; i != NUM_PRICES; i++) { |
814 Money price = _price_base[i]; |
814 Money price = _price_base[i]; |
815 if (_price_category[i] != 0) { |
815 if (_price_category[i] != 0) { |
816 uint mod = _price_category[i] == 1 ? _opt.diff.vehicle_costs : _opt.diff.construction_cost; |
816 uint mod = _price_category[i] == 1 ? _settings.difficulty.vehicle_costs : _settings.difficulty.construction_cost; |
817 if (mod < 1) { |
817 if (mod < 1) { |
818 price = price * 3 >> 2; |
818 price = price * 3 >> 2; |
819 } else if (mod > 1) { |
819 } else if (mod > 1) { |
820 price = price * 9 >> 3; |
820 price = price * 9 >> 3; |
821 } |
821 } |
827 } |
827 } |
828 ((Money*)&_price)[i] = price; |
828 ((Money*)&_price)[i] = price; |
829 _price_frac[i] = 0; |
829 _price_frac[i] = 0; |
830 } |
830 } |
831 |
831 |
832 _economy.interest_rate = _opt.diff.initial_interest; |
832 _economy.interest_rate = _settings.difficulty.initial_interest; |
833 _economy.infl_amount = _opt.diff.initial_interest; |
833 _economy.infl_amount = _settings.difficulty.initial_interest; |
834 _economy.infl_amount_pr = max(0, _opt.diff.initial_interest - 1); |
834 _economy.infl_amount_pr = max(0, _settings.difficulty.initial_interest - 1); |
835 _economy.max_loan_unround = _economy.max_loan = _opt.diff.max_loan * 1000; |
835 _economy.max_loan_unround = _economy.max_loan = _settings.difficulty.max_loan * 1000; |
836 _economy.fluct = GB(Random(), 0, 8) + 168; |
836 _economy.fluct = GB(Random(), 0, 8) + 168; |
837 } |
837 } |
838 |
838 |
839 |
839 |
840 Money GetPriceByIndex(uint8 index) |
840 Money GetPriceByIndex(uint8 index) |
1160 return result * num_pieces * _cargo_payment_rates[cargo_type] / 8192; |
1160 return result * num_pieces * _cargo_payment_rates[cargo_type] / 8192; |
1161 } |
1161 } |
1162 } |
1162 } |
1163 |
1163 |
1164 /* zero the distance (thus income) if it's the bank and very short transport. */ |
1164 /* zero the distance (thus income) if it's the bank and very short transport. */ |
1165 if (_opt.landscape == LT_TEMPERATE && cs->label == 'VALU' && dist < 10) return 0; |
1165 if (_settings.game_creation.landscape == LT_TEMPERATE && cs->label == 'VALU' && dist < 10) return 0; |
1166 |
1166 |
1167 |
1167 |
1168 static const int MIN_TIME_FACTOR = 31; |
1168 static const int MIN_TIME_FACTOR = 31; |
1169 static const int MAX_TIME_FACTOR = 255; |
1169 static const int MAX_TIME_FACTOR = 255; |
1170 |
1170 |
1311 pair = SetupSubsidyDecodeParam(s, 0); |
1311 pair = SetupSubsidyDecodeParam(s, 0); |
1312 InjectDParam(1); |
1312 InjectDParam(1); |
1313 |
1313 |
1314 SetDParam(0, _current_player); |
1314 SetDParam(0, _current_player); |
1315 AddNewsItem( |
1315 AddNewsItem( |
1316 STR_2031_SERVICE_SUBSIDY_AWARDED + _opt.diff.subsidy_multiplier, |
1316 STR_2031_SERVICE_SUBSIDY_AWARDED + _settings.difficulty.subsidy_multiplier, |
1317 NS_SUBSIDIES, |
1317 NS_SUBSIDIES, |
1318 pair.a, pair.b |
1318 pair.a, pair.b |
1319 ); |
1319 ); |
1320 |
1320 |
1321 InvalidateWindow(WC_SUBSIDIES_LIST, 0); |
1321 InvalidateWindow(WC_SUBSIDIES_LIST, 0); |
1358 /* Determine profit */ |
1358 /* Determine profit */ |
1359 profit = GetTransportedGoodsIncome(num_pieces, DistanceManhattan(source_tile, s_to->xy), days_in_transit, cargo_type); |
1359 profit = GetTransportedGoodsIncome(num_pieces, DistanceManhattan(source_tile, s_to->xy), days_in_transit, cargo_type); |
1360 |
1360 |
1361 /* Modify profit if a subsidy is in effect */ |
1361 /* Modify profit if a subsidy is in effect */ |
1362 if (subsidised) { |
1362 if (subsidised) { |
1363 switch (_opt.diff.subsidy_multiplier) { |
1363 switch (_settings.difficulty.subsidy_multiplier) { |
1364 case 0: profit += profit >> 1; break; |
1364 case 0: profit += profit >> 1; break; |
1365 case 1: profit *= 2; break; |
1365 case 1: profit *= 2; break; |
1366 case 2: profit *= 3; break; |
1366 case 2: profit *= 3; break; |
1367 default: profit *= 4; break; |
1367 default: profit *= 4; break; |
1368 } |
1368 } |