summaryrefslogtreecommitdiff
path: root/src/ai
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-04-06 07:22:26 +0000
committerrubidium <rubidium@openttd.org>2008-04-06 07:22:26 +0000
commit8cd1795fe32fc2afaa75f48b8b62ff992bf8f618 (patch)
tree94d7efcddd239260e27551baae6bc2aebe3a5f14 /src/ai
parente68b2088ce090c1eaf182e120195d8453f4f02c2 (diff)
downloadopenttd-8cd1795fe32fc2afaa75f48b8b62ff992bf8f618.tar.xz
(svn r12587) -Codechange: unduplicate some code in the Unpack*Order functions and move the 'normal' case Pack/Unpack to Order.
Diffstat (limited to 'src/ai')
-rw-r--r--src/ai/default/default.cpp8
-rw-r--r--src/ai/trolly/trolly.cpp6
2 files changed, 7 insertions, 7 deletions
diff --git a/src/ai/default/default.cpp b/src/ai/default/default.cpp
index dd8002d49..9436fd6ae 100644
--- a/src/ai/default/default.cpp
+++ b/src/ai/default/default.cpp
@@ -318,7 +318,7 @@ static void AiRestoreVehicleOrders(Vehicle *v, BackuppedOrders *bak)
if (bak->order == NULL) return;
for (uint i = 0; !bak->order[i].IsType(OT_NOTHING); i++) {
- if (!DoCommandP(0, v->index + (i << 16), PackOrder(&bak->order[i]), NULL, CMD_INSERT_ORDER | CMD_NO_TEST_IF_IN_NETWORK))
+ if (!DoCommandP(0, v->index + (i << 16), bak->order[i].Pack(), NULL, CMD_INSERT_ORDER | CMD_NO_TEST_IF_IN_NETWORK))
break;
}
}
@@ -2558,7 +2558,7 @@ handle_nocash:
if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
order.flags |= OFB_FULL_LOAD;
- DoCommand(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
+ DoCommand(0, loco_id + (i << 16), order.Pack(), DC_EXEC, CMD_INSERT_ORDER);
}
DoCommand(0, loco_id, 0, DC_EXEC, CMD_START_STOP_TRAIN);
@@ -3293,7 +3293,7 @@ static void AiStateBuildRoadVehicles(Player *p)
if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
order.flags |= OFB_FULL_LOAD;
- DoCommand(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
+ DoCommand(0, loco_id + (i << 16), order.Pack(), DC_EXEC, CMD_INSERT_ORDER);
}
DoCommand(0, loco_id, 0, DC_EXEC, CMD_START_STOP_ROADVEH);
@@ -3572,7 +3572,7 @@ static void AiStateBuildAircraftVehicles(Player *p)
if (_players_ai[p->index].num_want_fullload != 0 && (is_pass || i == 0))
order.flags |= OFB_FULL_LOAD;
- DoCommand(0, loco_id + (i << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
+ DoCommand(0, loco_id + (i << 16), order.Pack(), DC_EXEC, CMD_INSERT_ORDER);
}
DoCommand(0, loco_id, 0, DC_EXEC, CMD_START_STOP_AIRCRAFT);
diff --git a/src/ai/trolly/trolly.cpp b/src/ai/trolly/trolly.cpp
index 30714aed0..2876d240e 100644
--- a/src/ai/trolly/trolly.cpp
+++ b/src/ai/trolly/trolly.cpp
@@ -1185,20 +1185,20 @@ static void AiNew_State_GiveOrders(Player *p)
if (_patches.gotodepot) {
idx = 0;
order.MakeGoToDepot(GetDepotByTile(_players_ainew[p->index].depot_tile)->index, true);
- AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), PackOrder(&order), DC_EXEC, CMD_INSERT_ORDER);
+ AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), order.Pack(), DC_EXEC, CMD_INSERT_ORDER);
}
idx = 0;
order.MakeGoToStation(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);
+ AI_DoCommand(0, _players_ainew[p->index].veh_id + (idx << 16), order.Pack(), DC_EXEC, CMD_INSERT_ORDER);
idx = 0;
order.MakeGoToStation(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);
+ 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;