equal
deleted
inserted
replaced
906 InvalidateWindow(WC_SUBSIDIES_LIST, 0); |
906 InvalidateWindow(WC_SUBSIDIES_LIST, 0); |
907 } |
907 } |
908 |
908 |
909 typedef struct FoundRoute { |
909 typedef struct FoundRoute { |
910 uint distance; |
910 uint distance; |
911 byte cargo; |
911 CargoID cargo; |
912 void *from; |
912 void *from; |
913 void *to; |
913 void *to; |
914 } FoundRoute; |
914 } FoundRoute; |
915 |
915 |
916 static void FindSubsidyPassengerRoute(FoundRoute *fr) |
916 static void FindSubsidyPassengerRoute(FoundRoute *fr) |
932 |
932 |
933 static void FindSubsidyCargoRoute(FoundRoute *fr) |
933 static void FindSubsidyCargoRoute(FoundRoute *fr) |
934 { |
934 { |
935 Industry *i; |
935 Industry *i; |
936 int trans, total; |
936 int trans, total; |
937 byte cargo; |
937 CargoID cargo; |
938 |
938 |
939 fr->distance = (uint)-1; |
939 fr->distance = (uint)-1; |
940 |
940 |
941 fr->from = i = GetIndustry(RandomRange(_total_industries)); |
941 fr->from = i = GetIndustry(RandomRange(_total_industries)); |
942 if (i->xy == 0) |
942 if (i->xy == 0) |
1100 int index; |
1100 int index; |
1101 while ((index = SlIterateArray()) != -1) |
1101 while ((index = SlIterateArray()) != -1) |
1102 SlObject(&_subsidies[index], _subsidies_desc); |
1102 SlObject(&_subsidies[index], _subsidies_desc); |
1103 } |
1103 } |
1104 |
1104 |
1105 int32 GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, byte cargo_type) |
1105 int32 GetTransportedGoodsIncome(uint num_pieces, uint dist, byte transit_days, CargoID cargo_type) |
1106 { |
1106 { |
1107 int cargo = cargo_type; |
1107 CargoID cargo = cargo_type; |
1108 byte f; |
1108 byte f; |
1109 |
1109 |
1110 /* zero the distance if it's the bank and very short transport. */ |
1110 /* zero the distance if it's the bank and very short transport. */ |
1111 if (_opt.landscape == LT_NORMAL && cargo == CT_VALUABLES && dist < 10) |
1111 if (_opt.landscape == LT_NORMAL && cargo == CT_VALUABLES && dist < 10) |
1112 dist = 0; |
1112 dist = 0; |
1129 if (f < 31) f = 31; |
1129 if (f < 31) f = 31; |
1130 |
1130 |
1131 return BIGMULSS(dist * f * num_pieces, _cargo_payment_rates[cargo], 21); |
1131 return BIGMULSS(dist * f * num_pieces, _cargo_payment_rates[cargo], 21); |
1132 } |
1132 } |
1133 |
1133 |
1134 static void DeliverGoodsToIndustry(TileIndex xy, byte cargo_type, int num_pieces) |
1134 static void DeliverGoodsToIndustry(TileIndex xy, CargoID cargo_type, int num_pieces) |
1135 { |
1135 { |
1136 Industry* best = NULL; |
1136 Industry* best = NULL; |
1137 Industry* ind; |
1137 Industry* ind; |
1138 uint u; |
1138 uint u; |
1139 |
1139 |
1160 best->was_cargo_delivered = true; |
1160 best->was_cargo_delivered = true; |
1161 best->cargo_waiting[0] = min(best->cargo_waiting[0] + num_pieces, 0xFFFF); |
1161 best->cargo_waiting[0] = min(best->cargo_waiting[0] + num_pieces, 0xFFFF); |
1162 } |
1162 } |
1163 } |
1163 } |
1164 |
1164 |
1165 static bool CheckSubsidised(Station *from, Station *to, byte cargo_type) |
1165 static bool CheckSubsidised(Station *from, Station *to, CargoID cargo_type) |
1166 { |
1166 { |
1167 Subsidy *s; |
1167 Subsidy *s; |
1168 TileIndex xy; |
1168 TileIndex xy; |
1169 Pair pair; |
1169 Pair pair; |
1170 Player *p; |
1170 Player *p; |
1228 } |
1228 } |
1229 } |
1229 } |
1230 return false; |
1230 return false; |
1231 } |
1231 } |
1232 |
1232 |
1233 static int32 DeliverGoods(int num_pieces, byte cargo_type, uint16 source, uint16 dest, byte days_in_transit) |
1233 static int32 DeliverGoods(int num_pieces, CargoID cargo_type, uint16 source, uint16 dest, byte days_in_transit) |
1234 { |
1234 { |
1235 bool subsidised; |
1235 bool subsidised; |
1236 Station *s_from, *s_to; |
1236 Station *s_from, *s_to; |
1237 int32 profit; |
1237 int32 profit; |
1238 |
1238 |