mirror of https://github.com/OpenTTD/OpenTTD
(svn r21943) -Codechange: document and unmagicify some bits of road vehicle overtaking
parent
54161949d1
commit
8118f74575
|
@ -52,6 +52,8 @@ enum RoadVehicleStates {
|
||||||
RVSB_IN_DT_ROAD_STOP = 1 << RVS_IN_DT_ROAD_STOP, ///< The vehicle is in a drive-through road stop
|
RVSB_IN_DT_ROAD_STOP = 1 << RVS_IN_DT_ROAD_STOP, ///< The vehicle is in a drive-through road stop
|
||||||
RVSB_IN_DT_ROAD_STOP_END = RVSB_IN_DT_ROAD_STOP + TRACKDIR_END,
|
RVSB_IN_DT_ROAD_STOP_END = RVSB_IN_DT_ROAD_STOP + TRACKDIR_END,
|
||||||
|
|
||||||
|
RVSB_DRIVE_SIDE = 1 << RVS_DRIVE_SIDE, ///< The vehicle is at the opposite side of the road
|
||||||
|
|
||||||
RVSB_TRACKDIR_MASK = 0x0F, ///< The mask used to extract track dirs
|
RVSB_TRACKDIR_MASK = 0x0F, ///< The mask used to extract track dirs
|
||||||
RVSB_ROAD_STOP_TRACKDIR_MASK = 0x09 ///< Only bits 0 and 3 are used to encode the trackdir for road stops
|
RVSB_ROAD_STOP_TRACKDIR_MASK = 0x09 ///< Only bits 0 and 3 are used to encode the trackdir for road stops
|
||||||
};
|
};
|
||||||
|
@ -83,8 +85,8 @@ struct RoadVehicle : public GroundVehicle<RoadVehicle, VEH_ROAD> {
|
||||||
byte state; ///< @see RoadVehicleStates
|
byte state; ///< @see RoadVehicleStates
|
||||||
byte frame;
|
byte frame;
|
||||||
uint16 blocked_ctr;
|
uint16 blocked_ctr;
|
||||||
byte overtaking;
|
byte overtaking; ///< Set to #RVSB_DRIVE_SIDE when overtaking, otherwise 0.
|
||||||
byte overtaking_ctr;
|
byte overtaking_ctr; ///< The length of the current overtake attempt.
|
||||||
uint16 crashed_ctr;
|
uint16 crashed_ctr;
|
||||||
byte reverse_ctr;
|
byte reverse_ctr;
|
||||||
|
|
||||||
|
|
|
@ -775,11 +775,10 @@ static void RoadVehCheckOvertake(RoadVehicle *v, RoadVehicle *u)
|
||||||
|
|
||||||
if (od.u->cur_speed == 0 || (od.u->vehstatus & VS_STOPPED)) {
|
if (od.u->cur_speed == 0 || (od.u->vehstatus & VS_STOPPED)) {
|
||||||
v->overtaking_ctr = 0x11;
|
v->overtaking_ctr = 0x11;
|
||||||
v->overtaking = 0x10;
|
v->overtaking = RVSB_DRIVE_SIDE;
|
||||||
} else {
|
} else {
|
||||||
// if (CheckRoadBlockedForOvertaking(&od)) return;
|
|
||||||
v->overtaking_ctr = 0;
|
v->overtaking_ctr = 0;
|
||||||
v->overtaking = 0x10;
|
v->overtaking = RVSB_DRIVE_SIDE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue