97 v->type == VEH_ROAD || |
97 v->type == VEH_ROAD || |
98 (v->type == VEH_AIRCRAFT && IsNormalAircraft(v)) || |
98 (v->type == VEH_AIRCRAFT && IsNormalAircraft(v)) || |
99 v->type == VEH_SHIP) { |
99 v->type == VEH_SHIP) { |
100 /* replace engine? */ |
100 /* replace engine? */ |
101 if (v->type == VEH_TRAIN && v->engine_type < 3 && |
101 if (v->type == VEH_TRAIN && v->engine_type < 3 && |
102 (_price.build_railvehicle >> 3) < p->player_money) { |
102 (_eco->GetPrice(CEconomy::BUILD_RAILVEHICLE) >> 3) < p->player_money) { |
103 p->ai.state = AIS_VEH_CHECK_REPLACE_VEHICLE; |
103 p->ai.state = AIS_VEH_CHECK_REPLACE_VEHICLE; |
104 p->ai.cur_veh = v; |
104 p->ai.cur_veh = v; |
105 return; |
105 return; |
106 } |
106 } |
107 |
107 |
108 /* not profitable? */ |
108 /* not profitable? */ |
109 if (v->age >= 730 && |
109 if (v->age >= 730 && |
110 v->profit_last_year < _price.station_value * 5 && |
110 v->profit_last_year < _eco->GetPrice(CEconomy::STATION_VALUE) * 5 && |
111 v->profit_this_year < _price.station_value * 5) { |
111 v->profit_this_year < _eco->GetPrice(CEconomy::STATION_VALUE) * 5) { |
112 p->ai.state_counter = 0; |
112 p->ai.state_counter = 0; |
113 p->ai.state = AIS_SELL_VEHICLE; |
113 p->ai.state = AIS_SELL_VEHICLE; |
114 p->ai.cur_veh = v; |
114 p->ai.cur_veh = v; |
115 return; |
115 return; |
116 } |
116 } |
224 return best_veh_index; |
224 return best_veh_index; |
225 } |
225 } |
226 |
226 |
227 static int32 AiGetBasePrice(const Player* p) |
227 static int32 AiGetBasePrice(const Player* p) |
228 { |
228 { |
229 int32 base = _price.station_value; |
229 int32 base = _eco->GetPrice(CEconomy::STATION_VALUE); |
230 |
230 |
231 // adjust base price when more expensive vehicles are available |
231 // adjust base price when more expensive vehicles are available |
232 switch (p->ai.railtype_to_use) { |
232 switch (p->ai.railtype_to_use) { |
233 default: NOT_REACHED(); |
233 default: NOT_REACHED(); |
234 case RAILTYPE_RAIL: break; |
234 case RAILTYPE_RAIL: break; |
1626 j = 4 - j; |
1626 j = 4 - j; |
1627 do { |
1627 do { |
1628 ret = DoCommand(c, k, 0, flag, CMD_BUILD_SIGNALS); |
1628 ret = DoCommand(c, k, 0, flag, CMD_BUILD_SIGNALS); |
1629 } while (--j); |
1629 } while (--j); |
1630 } else { |
1630 } else { |
1631 ret = _price.build_signals; |
1631 ret = _eco->GetPrice(CEconomy::BUILD_SIGNALS); |
1632 } |
1632 } |
1633 if (CmdFailed(ret)) return CMD_ERROR; |
1633 if (CmdFailed(ret)) return CMD_ERROR; |
1634 total_cost += ret; |
1634 total_cost += ret; |
1635 } |
1635 } |
1636 } else if (p->mode == 3) { |
1636 } else if (p->mode == 3) { |
1637 //Clear stuff and then build single rail. |
1637 //Clear stuff and then build single rail. |
1638 if (GetTileSlope(c, NULL) != SLOPE_FLAT) return CMD_ERROR; |
1638 if (GetTileSlope(c, NULL) != SLOPE_FLAT) return CMD_ERROR; |
1639 ret = DoCommand(c, 0, 0, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_LANDSCAPE_CLEAR); |
1639 ret = DoCommand(c, 0, 0, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_LANDSCAPE_CLEAR); |
1640 if (CmdFailed(ret)) return CMD_ERROR; |
1640 if (CmdFailed(ret)) return CMD_ERROR; |
1641 total_cost += ret + _price.build_rail; |
1641 total_cost += ret + _eco->GetPrice(CEconomy::PRICE_RAIL_BUILD, c); |
1642 |
1642 |
1643 if (flag & DC_EXEC) { |
1643 if (flag & DC_EXEC) { |
1644 DoCommand(c, railtype, p->attr&1, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_SINGLE_RAIL); |
1644 DoCommand(c, railtype, p->attr&1, flag | DC_AUTO | DC_NO_WATER | DC_AI_BUILDING, CMD_BUILD_SINGLE_RAIL); |
1645 } |
1645 } |
1646 |
1646 |