diff options
author | bjarni <bjarni@openttd.org> | 2006-09-27 12:17:33 +0000 |
---|---|---|
committer | bjarni <bjarni@openttd.org> | 2006-09-27 12:17:33 +0000 |
commit | 5dbfb5c272ba058dc0204b63fecb6e312aefa6b8 (patch) | |
tree | 272876206354bfaac7ac0db771c7fee3c49a6f77 /vehicle.c | |
parent | f18405dfd028c362c9f18f8836a00f02f5e2eb56 (diff) | |
download | openttd-5dbfb5c272ba058dc0204b63fecb6e312aefa6b8.tar.xz |
(svn r6524) -Code cleanup r6515: cleaned up the command to start/stop all vehicles in a depot.
IsWholeTrainInDepot() is removed as CheckTrainInDepot() could be used instead
Cleaned up the check to see if a vehicle is valid for start/stop
Diffstat (limited to 'vehicle.c')
-rw-r--r-- | vehicle.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -1570,8 +1570,8 @@ int32 CmdMassStartStopVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2 int32 return_value = CMD_ERROR; uint i; uint stop_command; - byte vehicle_type = p1; - byte start_stop = p2; + byte vehicle_type = GB(p1, 0, 8); + bool start_stop = HASBIT(p2, 0); switch (vehicle_type) { case VEH_Train: stop_command = CMD_START_STOP_TRAIN; break; @@ -1589,8 +1589,12 @@ int32 CmdMassStartStopVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2 int32 ret; if (!!(v->vehstatus & VS_STOPPED) != start_stop) continue; - if (!(v->vehstatus & VS_HIDDEN)) continue; - if (p1 == VEH_Train && !IsWholeTrainInDepot(v)) continue; + if (vehicle_type == VEH_Train) { + if (CheckTrainInDepot(v, false) == -1) continue; + } else { + if (!(v->vehstatus & VS_HIDDEN)) continue; + } + ret = DoCommand(tile, v->index, 0, flags, stop_command); if (!CmdFailed(ret)) { @@ -1601,7 +1605,7 @@ int32 CmdMassStartStopVehicle(TileIndex tile, uint32 flags, uint32 p1, uint32 p2 } } - free((void*)vl); + free(vl); return return_value; } |