summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorterkhen <terkhen@openttd.org>2011-01-19 18:44:13 +0000
committerterkhen <terkhen@openttd.org>2011-01-19 18:44:13 +0000
commitb5468e7a80670a45305b1af63d8f39d8034fa366 (patch)
treee66da9154edf22820edfc56573eded8bda90b73f
parent613743538d3946888660a5dd413e463f2052d6a9 (diff)
downloadopenttd-b5468e7a80670a45305b1af63d8f39d8034fa366.tar.xz
(svn r21860) -Codechange: Rename road vehicle subtype functions to match the train names.
-rw-r--r--src/disaster_cmd.cpp4
-rw-r--r--src/roadveh.h6
-rw-r--r--src/roadveh_cmd.cpp34
-rw-r--r--src/saveload/afterload.cpp2
-rw-r--r--src/saveload/vehicle_sl.cpp2
-rw-r--r--src/settings.cpp4
-rw-r--r--src/station_cmd.cpp2
-rw-r--r--src/vehicle.cpp4
8 files changed, 29 insertions, 29 deletions
diff --git a/src/disaster_cmd.cpp b/src/disaster_cmd.cpp
index e86448c5f..50c96f005 100644
--- a/src/disaster_cmd.cpp
+++ b/src/disaster_cmd.cpp
@@ -307,7 +307,7 @@ static bool DisasterTick_Ufo(DisasterVehicle *v)
RoadVehicle *u;
FOR_ALL_ROADVEHICLES(u) {
- if (u->IsRoadVehFront()) {
+ if (u->IsFrontEngine()) {
v->dest_tile = u->index;
v->age = 0;
return true;
@@ -319,7 +319,7 @@ static bool DisasterTick_Ufo(DisasterVehicle *v)
} else {
/* Target a vehicle */
RoadVehicle *u = RoadVehicle::Get(v->dest_tile);
- assert(u != NULL && u->type == VEH_ROAD && u->IsRoadVehFront());
+ assert(u != NULL && u->type == VEH_ROAD && u->IsFrontEngine());
uint dist = Delta(v->x_pos, u->x_pos) + Delta(v->y_pos, u->y_pos);
diff --git a/src/roadveh.h b/src/roadveh.h
index 72c789fd1..2cb920c61 100644
--- a/src/roadveh.h
+++ b/src/roadveh.h
@@ -109,7 +109,7 @@ struct RoadVehicle : public GroundVehicle<RoadVehicle, VEH_ROAD> {
void MarkDirty();
void UpdateDeltaXY(Direction direction);
ExpensesType GetExpenseType(bool income) const { return income ? EXPENSES_ROADVEH_INC : EXPENSES_ROADVEH_RUN; }
- bool IsPrimaryVehicle() const { return this->IsRoadVehFront(); }
+ bool IsPrimaryVehicle() const { return this->IsFrontEngine(); }
SpriteID GetImage(Direction direction) const;
int GetDisplaySpeed() const { return this->cur_speed / 2; }
int GetDisplayMaxSpeed() const { return this->vcache.cached_max_speed / 2; }
@@ -132,12 +132,12 @@ struct RoadVehicle : public GroundVehicle<RoadVehicle, VEH_ROAD> {
* Check if vehicle is a front engine
* @return Returns true if vehicle is a front engine
*/
- FORCEINLINE bool IsRoadVehFront() const { return this->subtype == RVST_FRONT; }
+ FORCEINLINE bool IsFrontEngine() const { return this->subtype == RVST_FRONT; }
/**
* Set front engine state
*/
- FORCEINLINE void SetRoadVehFront() { this->subtype = RVST_FRONT; }
+ FORCEINLINE void SetFrontEngine() { this->subtype = RVST_FRONT; }
/**
* Check if vehicl is an articulated part of an engine
diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp
index 422086e83..d084d37a8 100644
--- a/src/roadveh_cmd.cpp
+++ b/src/roadveh_cmd.cpp
@@ -85,7 +85,7 @@ static const Trackdir _roadveh_depot_exit_trackdir[DIAGDIR_END] = {
*/
bool RoadVehicle::IsBus() const
{
- assert(this->IsRoadVehFront());
+ assert(this->IsFrontEngine());
return IsCargoInClass(this->cargo_type, CC_PASSENGERS);
}
@@ -171,7 +171,7 @@ static uint GetRoadVehLength(const RoadVehicle *v)
void RoadVehUpdateCache(RoadVehicle *v)
{
assert(v->type == VEH_ROAD);
- assert(v->IsRoadVehFront());
+ assert(v->IsFrontEngine());
v->InvalidateNewGRFCacheOfChain();
@@ -250,7 +250,7 @@ CommandCost CmdBuildRoadVehicle(TileIndex tile, DoCommandFlag flags, const Engin
v->cur_image = SPR_IMG_QUERY;
v->random_bits = VehicleRandomBits();
- v->SetRoadVehFront();
+ v->SetFrontEngine();
v->roadtype = HasBit(e->info.misc_flags, EF_ROAD_TRAM) ? ROADTYPE_TRAM : ROADTYPE_ROAD;
v->compatible_roadtypes = RoadTypeToRoadTypes(v->roadtype);
@@ -284,7 +284,7 @@ bool RoadVehicle::IsStoppedInDepot() const
TileIndex tile = this->tile;
if (!IsRoadDepotTile(tile)) return false;
- if (this->IsRoadVehFront() && !(this->vehstatus & VS_STOPPED)) return false;
+ if (this->IsFrontEngine() && !(this->vehstatus & VS_STOPPED)) return false;
for (const RoadVehicle *v = this; v != NULL; v = v->Next()) {
if (v->state != RVSB_IN_DEPOT || v->tile != tile) return false;
@@ -461,7 +461,7 @@ static Vehicle *EnumCheckRoadVehCrashTrain(Vehicle *v, void *data)
uint RoadVehicle::Crash(bool flooded)
{
uint pass = Vehicle::Crash(flooded);
- if (this->IsRoadVehFront()) {
+ if (this->IsFrontEngine()) {
pass += 1; // driver
/* If we're in a drive through road stop we ought to leave it */
@@ -1080,7 +1080,7 @@ static bool IndividualRoadVehicleController(RoadVehicle *v, const RoadVehicle *p
/* Vehicle is entering a depot or is on a bridge or in a tunnel */
GetNewVehiclePosResult gp = GetNewVehiclePos(v);
- if (v->IsRoadVehFront()) {
+ if (v->IsFrontEngine()) {
const Vehicle *u = RoadVehFindCloseTo(v, gp.x, gp.y, v->direction);
if (u != NULL) {
v->cur_speed = u->First()->cur_speed;
@@ -1113,7 +1113,7 @@ static bool IndividualRoadVehicleController(RoadVehicle *v, const RoadVehicle *p
TileIndex tile = v->tile + TileOffsByDiagDir((DiagDirection)(rd.x & 3));
Trackdir dir;
- if (v->IsRoadVehFront()) {
+ if (v->IsFrontEngine()) {
/* If this is the front engine, look for the right path. */
dir = RoadFindPathToDest(v, tile, (DiagDirection)(rd.x & 3));
} else {
@@ -1121,7 +1121,7 @@ static bool IndividualRoadVehicleController(RoadVehicle *v, const RoadVehicle *p
}
if (dir == INVALID_TRACKDIR) {
- if (!v->IsRoadVehFront()) error("Disconnecting road vehicle.");
+ if (!v->IsFrontEngine()) error("Disconnecting road vehicle.");
v->cur_speed = 0;
return false;
}
@@ -1142,7 +1142,7 @@ again:
case TRACKDIR_RVREV_NW: needed = ROAD_SE; break;
}
if ((v->Previous() != NULL && v->Previous()->tile == tile) ||
- (v->IsRoadVehFront() && IsNormalRoadTile(tile) && !HasRoadWorks(tile) &&
+ (v->IsFrontEngine() && IsNormalRoadTile(tile) && !HasRoadWorks(tile) &&
(needed & GetRoadBits(tile, ROADTYPE_TRAM)) != ROAD_NONE)) {
/*
* Taking the 'big' corner for trams only happens when:
@@ -1154,7 +1154,7 @@ again:
* going to cause the tram to split up.
* - Or the front of the tram can drive over the next tile.
*/
- } else if (!v->IsRoadVehFront() || !CanBuildTramTrackOnTile(v->owner, tile, needed) || ((~needed & GetAnyRoadBits(v->tile, ROADTYPE_TRAM, false)) == ROAD_NONE)) {
+ } else if (!v->IsFrontEngine() || !CanBuildTramTrackOnTile(v->owner, tile, needed) || ((~needed & GetAnyRoadBits(v->tile, ROADTYPE_TRAM, false)) == ROAD_NONE)) {
/*
* Taking the 'small' corner for trams only happens when:
* - We are not the from vehicle of an articulated tram.
@@ -1188,7 +1188,7 @@ again:
int y = TileY(tile) * TILE_SIZE + rdp[start_frame].y;
Direction new_dir = RoadVehGetSlidingDirection(v, x, y);
- if (v->IsRoadVehFront()) {
+ if (v->IsFrontEngine()) {
Vehicle *u = RoadVehFindCloseTo(v, x, y, new_dir);
if (u != NULL) {
v->cur_speed = u->First()->cur_speed;
@@ -1272,7 +1272,7 @@ again:
case DIAGDIR_SW: dir = TRACKDIR_RVREV_NE; break;
}
} else {
- if (v->IsRoadVehFront()) {
+ if (v->IsFrontEngine()) {
/* If this is the front engine, look for the right path. */
dir = RoadFindPathToDest(v, v->tile, (DiagDirection)(rd.x & 3));
} else {
@@ -1291,7 +1291,7 @@ again:
int y = TileY(v->tile) * TILE_SIZE + rdp[turn_around_start_frame].y;
Direction new_dir = RoadVehGetSlidingDirection(v, x, y);
- if (v->IsRoadVehFront() && RoadVehFindCloseTo(v, x, y, new_dir) != NULL) return false;
+ if (v->IsFrontEngine() && RoadVehFindCloseTo(v, x, y, new_dir) != NULL) return false;
uint32 r = VehicleEnterTile(v, v->tile, x, y);
if (HasBit(r, VETS_CANNOT_ENTER)) {
@@ -1328,7 +1328,7 @@ again:
Direction new_dir = RoadVehGetSlidingDirection(v, x, y);
- if (v->IsRoadVehFront() && !IsInsideMM(v->state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END)) {
+ if (v->IsFrontEngine() && !IsInsideMM(v->state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END)) {
/* Vehicle is not in a road stop.
* Check for another vehicle to overtake */
RoadVehicle *u = RoadVehFindCloseTo(v, x, y, new_dir);
@@ -1372,7 +1372,7 @@ again:
* and it's the correct type of stop (bus or truck) and the frame equals the stop frame...
* (the station test and stop type test ensure that other vehicles, using the road stop as
* a through route, do not stop) */
- if (v->IsRoadVehFront() && ((IsInsideMM(v->state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END) &&
+ if (v->IsFrontEngine() && ((IsInsideMM(v->state, RVSB_IN_ROAD_STOP, RVSB_IN_ROAD_STOP_END) &&
_road_stop_stop_frame[v->state - RVSB_IN_ROAD_STOP + (_settings_game.vehicle.road_side << RVS_DRIVE_SIDE)] == v->frame) ||
(IsInsideMM(v->state, RVSB_IN_DT_ROAD_STOP, RVSB_IN_DT_ROAD_STOP_END) &&
v->current_order.ShouldStopAtStation(v, GetStationIndex(v->tile)) &&
@@ -1525,7 +1525,7 @@ Money RoadVehicle::GetRunningCost() const
bool RoadVehicle::Tick()
{
- if (this->IsRoadVehFront()) {
+ if (this->IsFrontEngine()) {
if (!(this->vehstatus & VS_STOPPED)) this->running_ticks++;
return RoadVehController(this);
}
@@ -1577,7 +1577,7 @@ static void CheckIfRoadVehNeedsService(RoadVehicle *v)
void RoadVehicle::OnNewDay()
{
- if (!this->IsRoadVehFront()) return;
+ if (!this->IsFrontEngine()) return;
if ((++this->day_counter & 7) == 0) DecreaseVehicleValue(this);
if (this->blocked_ctr == 0) CheckVehicleBreakdown(this);
diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp
index b56a33215..da7db48d9 100644
--- a/src/saveload/afterload.cpp
+++ b/src/saveload/afterload.cpp
@@ -1966,7 +1966,7 @@ bool AfterLoadGame()
FOR_ALL_DISASTERVEHICLES(v) {
if (v->subtype == 2/*ST_SMALL_UFO*/ && v->current_order.GetDestination() != 0) {
const Vehicle *u = Vehicle::GetIfValid(v->dest_tile);
- if (u == NULL || u->type != VEH_ROAD || !RoadVehicle::From(u)->IsRoadVehFront()) {
+ if (u == NULL || u->type != VEH_ROAD || !RoadVehicle::From(u)->IsFrontEngine()) {
delete v;
}
}
diff --git a/src/saveload/vehicle_sl.cpp b/src/saveload/vehicle_sl.cpp
index 4d65a12b1..398f74e2f 100644
--- a/src/saveload/vehicle_sl.cpp
+++ b/src/saveload/vehicle_sl.cpp
@@ -325,7 +325,7 @@ void AfterLoadVehicles(bool part_of_load)
case VEH_ROAD: {
RoadVehicle *rv = RoadVehicle::From(v);
- if (rv->IsRoadVehFront()) {
+ if (rv->IsFrontEngine()) {
RoadVehUpdateCache(rv);
if (_settings_game.vehicle.roadveh_acceleration_model != AM_ORIGINAL) {
rv->CargoChanged();
diff --git a/src/settings.cpp b/src/settings.cpp
index fde955990..f3ea76cc0 100644
--- a/src/settings.cpp
+++ b/src/settings.cpp
@@ -843,7 +843,7 @@ static bool RoadVehAccelerationModelChanged(int32 p1)
if (_settings_game.vehicle.roadveh_acceleration_model != AM_ORIGINAL) {
RoadVehicle *rv;
FOR_ALL_ROADVEHICLES(rv) {
- if (rv->IsRoadVehFront()) {
+ if (rv->IsFrontEngine()) {
rv->CargoChanged();
}
}
@@ -866,7 +866,7 @@ static bool RoadVehSlopeSteepnessChanged(int32 p1)
{
RoadVehicle *rv;
FOR_ALL_ROADVEHICLES(rv) {
- if (rv->IsRoadVehFront()) rv->CargoChanged();
+ if (rv->IsFrontEngine()) rv->CargoChanged();
}
return true;
diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp
index fc6faffe8..68f5c14ef 100644
--- a/src/station_cmd.cpp
+++ b/src/station_cmd.cpp
@@ -2987,7 +2987,7 @@ static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, i
} else if (v->type == VEH_ROAD) {
RoadVehicle *rv = RoadVehicle::From(v);
if (rv->state < RVSB_IN_ROAD_STOP && !IsReversingRoadTrackdir((Trackdir)rv->state) && rv->frame == 0) {
- if (IsRoadStop(tile) && rv->IsRoadVehFront()) {
+ if (IsRoadStop(tile) && rv->IsFrontEngine()) {
/* Attempt to allocate a parking bay in a road stop */
return RoadStop::GetByTile(tile, GetRoadStopType(tile))->Enter(rv) ? VETSB_CONTINUE : VETSB_CANNOT_ENTER;
}
diff --git a/src/vehicle.cpp b/src/vehicle.cpp
index 2222c0bc9..94428ee1e 100644
--- a/src/vehicle.cpp
+++ b/src/vehicle.cpp
@@ -629,7 +629,7 @@ bool Vehicle::IsEngineCountable() const
case VEH_TRAIN:
return !Train::From(this)->IsArticulatedPart() && // tenders and other articulated parts
!Train::From(this)->IsRearDualheaded(); // rear parts of multiheaded engines
- case VEH_ROAD: return RoadVehicle::From(this)->IsRoadVehFront();
+ case VEH_ROAD: return RoadVehicle::From(this)->IsFrontEngine();
case VEH_SHIP: return true;
default: return false; // Only count company buildable vehicles
}
@@ -830,7 +830,7 @@ void CallVehicleTicks()
if (v->type == VEH_TRAIN && Train::From(v)->IsWagon()) continue;
if (v->type == VEH_AIRCRAFT && v->subtype != AIR_HELICOPTER) continue;
- if (v->type == VEH_ROAD && !RoadVehicle::From(v)->IsRoadVehFront()) continue;
+ if (v->type == VEH_ROAD && !RoadVehicle::From(v)->IsFrontEngine()) continue;
v->motion_counter += v->cur_speed;
/* Play a running sound if the motion counter passes 256 (Do we not skip sounds?) */