--- a/src/ai/trolly/trolly.cpp Mon Apr 14 20:32:36 2008 +0000
+++ b/src/ai/trolly/trolly.cpp Tue Apr 15 00:47:19 2008 +0000
@@ -26,15 +26,14 @@
#include "trolly.h"
#include "../../town.h"
#include "../../industry.h"
-#include "../../station.h"
-#include "../../engine.h"
+#include "../../station_base.h"
+#include "../../engine_func.h"
#include "../../gui.h"
#include "../../depot.h"
#include "../../vehicle_base.h"
#include "../../vehicle_func.h"
#include "../../date_func.h"
#include "../ai.h"
-#include "../../order.h"
#include "../../player_base.h"
#include "../../player_func.h"
@@ -554,7 +553,7 @@
const Order *order;
FOR_VEHICLE_ORDERS(v, order) {
- if (order->type == OT_GOTO_STATION && GetStation(order->dest) == st) {
+ if (order->IsType(OT_GOTO_STATION) && GetStation(order->GetDestination()) == st) {
// This vehicle has this city in its list
count++;
}
@@ -1185,27 +1184,19 @@
// Very handy for AI, goto depot.. but yeah, it needs to be activated ;)
if (_patches.gotodepot) {
idx = 0;
- order.type = OT_GOTO_DEPOT;
- order.flags = OFB_UNLOAD;
- order.dest = GetDepotByTile(_players_ainew[p->index].depot_tile)->index;
- AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
+ order.MakeGoToDepot(GetDepotByTile(_players_ainew[p->index].depot_tile)->index, ODTFB_PART_OF_ORDERS);
+ AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), order.Pack(), DC_EXEC, CMD_INSERT_ORDER);
}
idx = 0;
- order.type = OT_GOTO_STATION;
- order.flags = 0;
- order.dest = GetStationIndex(_players_ainew[p->index].to_tile);
- if (_players_ainew[p->index].tbt == AI_TRUCK && _players_ainew[p->index].to_deliver)
- order.flags |= OFB_FULL_LOAD;
- AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
+ order.MakeGoToStation(GetStationIndex(_players_ainew[p->index].to_tile));
+ if (_players_ainew[p->index].tbt == AI_TRUCK && _players_ainew[p->index].to_deliver) order.SetLoadType(OLFB_FULL_LOAD);
+ AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), order.Pack(), DC_EXEC, CMD_INSERT_ORDER);
idx = 0;
- order.type = OT_GOTO_STATION;
- order.flags = 0;
- order.dest = GetStationIndex(_players_ainew[p->index].from_tile);
- if (_players_ainew[p->index].tbt == AI_TRUCK && _players_ainew[p->index].from_deliver)
- order.flags |= OFB_FULL_LOAD;
- AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
+ order.MakeGoToStation(GetStationIndex(_players_ainew[p->index].from_tile));
+ if (_players_ainew[p->index].tbt == AI_TRUCK && _players_ainew[p->index].from_deliver) order.SetLoadType(OLFB_FULL_LOAD);
+ AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), order.Pack(), DC_EXEC, CMD_INSERT_ORDER);
// Start the engines!
_players_ainew[p->index].state = AI_STATE_START_VEHICLE;