summaryrefslogtreecommitdiff
path: root/src/order_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2008-04-06 07:07:21 +0000
committerrubidium <rubidium@openttd.org>2008-04-06 07:07:21 +0000
commit3edb967ecf7dbf17a4d7e98975cd99345ce5a3f9 (patch)
tree914d1e0005bd1676636f2860ef07b9137d189d14 /src/order_cmd.cpp
parent84e3fa75e1977375aafbd56219ac34a26f9f6d73 (diff)
downloadopenttd-3edb967ecf7dbf17a4d7e98975cd99345ce5a3f9.tar.xz
(svn r12586) -Codechange: do not access an order's refit variables directly.
Diffstat (limited to 'src/order_cmd.cpp')
-rw-r--r--src/order_cmd.cpp17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/order_cmd.cpp b/src/order_cmd.cpp
index e4ebd0590..70482d453 100644
--- a/src/order_cmd.cpp
+++ b/src/order_cmd.cpp
@@ -55,13 +55,12 @@ void Order::MakeGoToStation(StationID destination)
this->dest = destination;
}
-void Order::MakeGoToDepot(DepotID destination, bool order)
+void Order::MakeGoToDepot(DepotID destination, bool order, CargoID cargo, byte subtype)
{
this->type = OT_GOTO_DEPOT;
this->flags = order ? OFB_PART_OF_ORDERS : OFB_NON_STOP;
this->dest = destination;
- this->refit_cargo = CT_NO_REFIT;
- this->refit_subtype = 0;
+ this->SetRefit(cargo, subtype);
}
void Order::MakeGoToWaypoint(WaypointID destination)
@@ -88,6 +87,12 @@ void Order::MakeDummy()
this->flags = 0;
}
+void Order::SetRefit(CargoID cargo, byte subtype)
+{
+ this->refit_cargo = cargo;
+ this->refit_subtype = subtype;
+}
+
void Order::FreeChain()
{
if (next != NULL) next->FreeChain();
@@ -1002,8 +1007,7 @@ CommandCost CmdOrderRefit(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
Vehicle *u;
- order->refit_cargo = cargo;
- order->refit_subtype = subtype;
+ order->SetRefit(cargo, subtype);
u = GetFirstVehicleFromSharedList(v);
for (; u != NULL; u = u->next_shared) {
@@ -1012,8 +1016,7 @@ CommandCost CmdOrderRefit(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
/* If the vehicle already got the current depot set as current order, then update current order as well */
if (u->cur_order_index == order_number && HasBit(u->current_order.flags, OF_PART_OF_ORDERS)) {
- u->current_order.refit_cargo = cargo;
- u->current_order.refit_subtype = subtype;
+ u->current_order.SetRefit(cargo, subtype);
}
}
}