equal
deleted
inserted
replaced
239 } |
239 } |
240 |
240 |
241 return base; |
241 return base; |
242 } |
242 } |
243 |
243 |
244 #if 0 |
|
245 static EngineID AiChooseShipToBuild(byte cargo, Money money) |
|
246 { |
|
247 // XXX: not done |
|
248 return INVALID_ENGINE; |
|
249 } |
|
250 #endif |
|
251 |
|
252 static EngineID AiChooseRoadVehToReplaceWith(const Player* p, const Vehicle* v) |
244 static EngineID AiChooseRoadVehToReplaceWith(const Player* p, const Vehicle* v) |
253 { |
245 { |
254 Money avail_money = p->player_money + v->value; |
246 Money avail_money = p->player_money + v->value; |
255 return AiChooseRoadVehToBuild(v->cargo_type, avail_money, v->tile); |
247 return AiChooseRoadVehToBuild(v->cargo_type, avail_money, v->tile); |
256 } |
248 } |
277 return AiChooseTrainToBuild(v->u.rail.railtype, avail_money, 0, v->tile); |
269 return AiChooseTrainToBuild(v->u.rail.railtype, avail_money, 0, v->tile); |
278 } |
270 } |
279 |
271 |
280 static EngineID AiChooseShipToReplaceWith(const Player* p, const Vehicle* v) |
272 static EngineID AiChooseShipToReplaceWith(const Player* p, const Vehicle* v) |
281 { |
273 { |
282 error("!AiChooseShipToReplaceWith"); |
274 /* Ships are not implemented in this (broken) AI */ |
283 |
|
284 /* maybe useless, but avoids compiler warning this way */ |
|
285 return INVALID_ENGINE; |
275 return INVALID_ENGINE; |
286 } |
276 } |
287 |
277 |
288 static void AiHandleGotoDepot(Player *p, int cmd) |
278 static void AiHandleGotoDepot(Player *p, int cmd) |
289 { |
279 { |
400 } |
390 } |
401 } |
391 } |
402 |
392 |
403 static void AiHandleReplaceShip(Player *p) |
393 static void AiHandleReplaceShip(Player *p) |
404 { |
394 { |
405 error("!AiHandleReplaceShip"); |
395 /* Ships are not implemented in this (broken) AI */ |
406 } |
396 } |
407 |
397 |
408 typedef EngineID CheckReplaceProc(const Player* p, const Vehicle* v); |
398 typedef EngineID CheckReplaceProc(const Player* p, const Vehicle* v); |
409 |
399 |
410 static CheckReplaceProc* const _veh_check_replace_proc[] = { |
400 static CheckReplaceProc* const _veh_check_replace_proc[] = { |
1548 } else { |
1538 } else { |
1549 AiWantOilRigAircraftRoute(p); |
1539 AiWantOilRigAircraftRoute(p); |
1550 } |
1540 } |
1551 } |
1541 } |
1552 |
1542 |
1553 static void AiWantShipRoute(Player *p) |
|
1554 { |
|
1555 // XXX |
|
1556 // error("AiWaitShipRoute"); |
|
1557 } |
|
1558 |
|
1559 |
1543 |
1560 |
1544 |
1561 static void AiStateWantNewRoute(Player *p) |
1545 static void AiStateWantNewRoute(Player *p) |
1562 { |
1546 { |
1563 uint16 r; |
1547 uint16 r; |
1587 AiWantRoadRoute(p); |
1571 AiWantRoadRoute(p); |
1588 } else if (r < 0xD89B) { |
1572 } else if (r < 0xD89B) { |
1589 if (_patches.ai_disable_veh_aircraft) continue; |
1573 if (_patches.ai_disable_veh_aircraft) continue; |
1590 AiWantAircraftRoute(p); |
1574 AiWantAircraftRoute(p); |
1591 } else { |
1575 } else { |
1592 if (_patches.ai_disable_veh_ship) continue; |
1576 /* Ships are not implemented in this (broken) AI */ |
1593 AiWantShipRoute(p); |
|
1594 } |
1577 } |
1595 |
1578 |
1596 // got a route? |
1579 // got a route? |
1597 if (p->ai.state != AIS_WANT_NEW_ROUTE) break; |
1580 if (p->ai.state != AIS_WANT_NEW_ROUTE) break; |
1598 |
1581 |
3563 if (--p->ai.num_loco_to_build == 0) p->ai.state = AIS_0; |
3546 if (--p->ai.num_loco_to_build == 0) p->ai.state = AIS_0; |
3564 } |
3547 } |
3565 |
3548 |
3566 static void AiStateCheckShipStuff(Player *p) |
3549 static void AiStateCheckShipStuff(Player *p) |
3567 { |
3550 { |
3568 // XXX |
3551 /* Ships are not implemented in this (broken) AI */ |
3569 error("!AiStateCheckShipStuff"); |
|
3570 } |
3552 } |
3571 |
3553 |
3572 static void AiStateBuildDefaultShipBlocks(Player *p) |
3554 static void AiStateBuildDefaultShipBlocks(Player *p) |
3573 { |
3555 { |
3574 // XXX |
3556 /* Ships are not implemented in this (broken) AI */ |
3575 error("!AiStateBuildDefaultShipBlocks"); |
|
3576 } |
3557 } |
3577 |
3558 |
3578 static void AiStateDoShipStuff(Player *p) |
3559 static void AiStateDoShipStuff(Player *p) |
3579 { |
3560 { |
3580 // XXX |
3561 /* Ships are not implemented in this (broken) AI */ |
3581 error("!AiStateDoShipStuff"); |
|
3582 } |
3562 } |
3583 |
3563 |
3584 static void AiStateSellVeh(Player *p) |
3564 static void AiStateSellVeh(Player *p) |
3585 { |
3565 { |
3586 Vehicle *v = p->ai.cur_veh; |
3566 Vehicle *v = p->ai.cur_veh; |
3611 DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR); |
3591 DoCommand(0, v->index, 0, DC_EXEC, CMD_SEND_AIRCRAFT_TO_HANGAR); |
3612 goto going_to_depot; |
3592 goto going_to_depot; |
3613 } |
3593 } |
3614 |
3594 |
3615 DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_AIRCRAFT); |
3595 DoCommand(0, v->index, 0, DC_EXEC, CMD_SELL_AIRCRAFT); |
3616 } else if (v->type == VEH_SHIP) { |
3596 } else if (v->type == VEH_SHIP) { |
3617 // XXX: not implemented |
3597 /* Ships are not implemented in this (broken) AI */ |
3618 error("!v->type == VEH_SHIP"); |
|
3619 } |
3598 } |
3620 } |
3599 } |
3621 |
3600 |
3622 goto return_to_loop; |
3601 goto return_to_loop; |
3623 going_to_depot:; |
3602 going_to_depot:; |