summaryrefslogtreecommitdiff
path: root/src/train_cmd.cpp
diff options
context:
space:
mode:
authorrubidium <rubidium@openttd.org>2007-08-03 19:36:00 +0000
committerrubidium <rubidium@openttd.org>2007-08-03 19:36:00 +0000
commit836105864c840469cbaea7776fe376a2008d72fc (patch)
treeea92676733322e0fc10f54254112dd92b294ebfb /src/train_cmd.cpp
parentaa9869e2de9117bbe0203aa1485ae6b5acac6f03 (diff)
downloadopenttd-836105864c840469cbaea7776fe376a2008d72fc.tar.xz
(svn r10770) -Codechange: use the pool item class as super class for the vehicle struct.
-Codechange: do not force "special" vehicles to be allocated in the low 1024 vehicle slots and non "special" vehicles in the rest of the slots.
Diffstat (limited to 'src/train_cmd.cpp')
-rw-r--r--src/train_cmd.cpp17
1 files changed, 8 insertions, 9 deletions
diff --git a/src/train_cmd.cpp b/src/train_cmd.cpp
index 047725269..eab077ad6 100644
--- a/src/train_cmd.cpp
+++ b/src/train_cmd.cpp
@@ -518,7 +518,7 @@ static CommandCost CmdBuildRailWagon(EngineID engine, TileIndex tile, uint32 fla
memset(&vl, 0, sizeof(vl));
- if (!AllocateVehicles(vl, num_vehicles))
+ if (!Vehicle::AllocateList(vl, num_vehicles))
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
if (flags & DC_EXEC) {
@@ -686,7 +686,7 @@ CommandCost CmdBuildRailVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32
memset(&vl, 0, sizeof(vl));
- if (!AllocateVehicles(vl, num_vehicles))
+ if (!Vehicle::AllocateList(vl, num_vehicles))
return_cmd_error(STR_00E1_TOO_MANY_VEHICLES_IN_GAME);
Vehicle *v = vl[0];
@@ -1253,7 +1253,7 @@ CommandCost CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
UnlinkWagon(rear, first);
DeleteDepotHighlightOfVehicle(rear);
- DeleteVehicle(rear);
+ delete rear;
}
}
@@ -1308,7 +1308,7 @@ CommandCost CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
first = UnlinkWagon(v, first);
DeleteDepotHighlightOfVehicle(v);
- DeleteVehicle(v);
+ delete v;
/* 4 If the second wagon was an engine, update it to front_engine
* which UnlinkWagon() has changed to TS_Free_Car */
@@ -1367,7 +1367,7 @@ CommandCost CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
first = UnlinkWagon(rear, first);
DeleteDepotHighlightOfVehicle(rear);
- DeleteVehicle(rear);
+ delete rear;
}
}
} else if (v->u.rail.other_multiheaded_part != NULL) {
@@ -1380,7 +1380,7 @@ CommandCost CmdSellRailWagon(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (flags & DC_EXEC) {
first = UnlinkWagon(v, first);
DeleteDepotHighlightOfVehicle(v);
- DeleteVehicle(v);
+ delete v;
RemoveVehicleFromGroup(v);
}
}
@@ -3039,7 +3039,7 @@ static void DeleteLastWagon(Vehicle *v)
BeginVehicleMove(v);
EndVehicleMove(v);
- DeleteVehicle(v);
+ delete v;
if (v->u.rail.track != TRACK_BIT_DEPOT && v->u.rail.track != TRACK_BIT_WORMHOLE)
SetSignalsOnBothDir(v->tile, FIND_FIRST_BIT(v->u.rail.track));
@@ -3329,8 +3329,7 @@ void Train::Tick()
TrainLocoHandler(this, true);
} else if (IsFreeWagon(this) && HASBITS(this->vehstatus, VS_CRASHED)) {
/* Delete flooded standalone wagon */
- if (++this->u.rail.crash_anim_pos >= 4400)
- DeleteVehicle(this);
+ if (++this->u.rail.crash_anim_pos >= 4400) delete this;
}
}