1
0
Fork 0

(svn r10983) -Codechange: use vehstatus & VS_CRASHED instead of some other "methods" custom to each vehicle to determine whether the vehicle is crashed.

release/0.6
rubidium 2007-08-26 20:16:02 +00:00
parent cf1d74b41e
commit a83ccad6bd
2 changed files with 5 additions and 5 deletions

View File

@ -534,7 +534,7 @@ CommandCost CmdTurnRoadVeh(TileIndex tile, uint32 flags, uint32 p1, uint32 p2)
if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR; if (v->type != VEH_ROAD || !CheckOwnership(v->owner)) return CMD_ERROR;
if (v->vehstatus & VS_STOPPED || if (v->vehstatus & VS_STOPPED ||
v->u.road.crashed_ctr != 0 || v->vehstatus & VS_CRASHED ||
v->breakdown_ctr != 0 || v->breakdown_ctr != 0 ||
v->u.road.overtaking != 0 || v->u.road.overtaking != 0 ||
v->u.road.state == RVSB_WORMHOLE || v->u.road.state == RVSB_WORMHOLE ||
@ -1794,7 +1794,7 @@ static void RoadVehController(Vehicle *v)
if (v->u.road.reverse_ctr != 0) v->u.road.reverse_ctr--; if (v->u.road.reverse_ctr != 0) v->u.road.reverse_ctr--;
/* handle crashed */ /* handle crashed */
if (v->u.road.crashed_ctr != 0) { if (v->vehstatus & VS_CRASHED) {
RoadVehIsCrashed(v); RoadVehIsCrashed(v);
return; return;
} }

View File

@ -1645,8 +1645,8 @@ CommandCost CmdReverseTrainDirection(TileIndex tile, uint32 flags, uint32 p1, ui
InvalidateWindow(WC_VEHICLE_DETAILS, v->index); InvalidateWindow(WC_VEHICLE_DETAILS, v->index);
} }
} else { } else {
/*turn the whole train around */ /* turn the whole train around */
if (v->u.rail.crash_anim_pos != 0 || v->breakdown_ctr != 0) return CMD_ERROR; if (v->vehstatus & VS_CRASHED || v->breakdown_ctr != 0) return CMD_ERROR;
if (flags & DC_EXEC) { if (flags & DC_EXEC) {
if (_patches.realistic_acceleration && v->cur_speed != 0) { if (_patches.realistic_acceleration && v->cur_speed != 0) {
@ -3255,7 +3255,7 @@ static bool TrainCheckIfLineEnds(Vehicle *v)
static void TrainLocoHandler(Vehicle *v, bool mode) static void TrainLocoHandler(Vehicle *v, bool mode)
{ {
/* train has crashed? */ /* train has crashed? */
if (v->u.rail.crash_anim_pos != 0) { if (v->vehstatus & VS_CRASHED) {
if (!mode) HandleCrashedTrain(v); if (!mode) HandleCrashedTrain(v);
return; return;
} }