diff options
author | rubidium <rubidium@openttd.org> | 2009-07-02 09:06:15 +0000 |
---|---|---|
committer | rubidium <rubidium@openttd.org> | 2009-07-02 09:06:15 +0000 |
commit | 4d14c1b534947ed38780995af4d68bd67b4ae095 (patch) | |
tree | 5afca0f6bf0a5a885285f85755c0cdfa42c7d70f | |
parent | 61e735ba4c62e578ca16f708ac1fdc872ff6416d (diff) | |
download | openttd-4d14c1b534947ed38780995af4d68bd67b4ae095.tar.xz |
(svn r16722) -Codechange: unify the naming of the Is/Set/HasArticulatedPart functions
-rw-r--r-- | src/ai/api/ai_vehicle.cpp | 4 | ||||
-rw-r--r-- | src/articulated_vehicles.cpp | 8 | ||||
-rw-r--r-- | src/depot_gui.cpp | 2 | ||||
-rw-r--r-- | src/roadstop.cpp | 2 | ||||
-rw-r--r-- | src/roadveh.h | 2 | ||||
-rw-r--r-- | src/roadveh_cmd.cpp | 4 | ||||
-rw-r--r-- | src/roadveh_gui.cpp | 4 | ||||
-rw-r--r-- | src/saveload/afterload.cpp | 2 | ||||
-rw-r--r-- | src/station.cpp | 2 | ||||
-rw-r--r-- | src/station_cmd.cpp | 2 | ||||
-rw-r--r-- | src/train.h | 10 | ||||
-rw-r--r-- | src/vehicle_cmd.cpp | 8 | ||||
-rw-r--r-- | src/vehicle_gui.cpp | 2 |
13 files changed, 26 insertions, 26 deletions
diff --git a/src/ai/api/ai_vehicle.cpp b/src/ai/api/ai_vehicle.cpp index a43b8aa6b..e98dc2ebc 100644 --- a/src/ai/api/ai_vehicle.cpp +++ b/src/ai/api/ai_vehicle.cpp @@ -412,8 +412,8 @@ const Vehicle *v = ::Vehicle::Get(vehicle_id); switch (v->type) { - case VEH_ROAD: return ::RoadVehicle::From(v)->RoadVehHasArticPart(); - case VEH_TRAIN: return ::Train::From(v)->EngineHasArticPart(); + case VEH_ROAD: return ::RoadVehicle::From(v)->HasArticulatedPart(); + case VEH_TRAIN: return ::Train::From(v)->HasArticulatedPart(); default: NOT_REACHED(); } } diff --git a/src/articulated_vehicles.cpp b/src/articulated_vehicles.cpp index 8dcb5182f..04a563541 100644 --- a/src/articulated_vehicles.cpp +++ b/src/articulated_vehicles.cpp @@ -207,11 +207,11 @@ bool IsArticulatedVehicleCarryingDifferentCargos(const Vehicle *v, CargoID *carg switch (v->type) { case VEH_TRAIN: - v = Train::From(v)->EngineHasArticPart() ? GetNextArticPart(Train::From(v)) : NULL; + v = Train::From(v)->HasArticulatedPart() ? GetNextArticPart(Train::From(v)) : NULL; break; case VEH_ROAD: - v = RoadVehicle::From(v)->RoadVehHasArticPart() ? v->Next() : NULL; + v = RoadVehicle::From(v)->HasArticulatedPart() ? v->Next() : NULL; break; default: @@ -254,11 +254,11 @@ void CheckConsistencyOfArticulatedVehicle(const Vehicle *v) switch (v->type) { case VEH_TRAIN: - v = Train::From(v)->EngineHasArticPart() ? GetNextArticPart(Train::From(v)) : NULL; + v = Train::From(v)->HasArticulatedPart() ? GetNextArticPart(Train::From(v)) : NULL; break; case VEH_ROAD: - v = RoadVehicle::From(v)->RoadVehHasArticPart() ? v->Next() : NULL; + v = RoadVehicle::From(v)->HasArticulatedPart() ? v->Next() : NULL; break; default: diff --git a/src/depot_gui.cpp b/src/depot_gui.cpp index e1710c8ed..1e88a4855 100644 --- a/src/depot_gui.cpp +++ b/src/depot_gui.cpp @@ -860,7 +860,7 @@ struct DepotWindow : Window { loaded [w->cargo_type] += w->cargo.Count(); } - if (w->type == VEH_TRAIN && !Train::From(w)->EngineHasArticPart()) { + if (w->type == VEH_TRAIN && !Train::From(w)->HasArticulatedPart()) { num++; if (!whole_chain) break; } diff --git a/src/roadstop.cpp b/src/roadstop.cpp index 2baba198b..e1a44f9c3 100644 --- a/src/roadstop.cpp +++ b/src/roadstop.cpp @@ -40,7 +40,7 @@ RoadStop *RoadStop::GetNextRoadStop(const RoadVehicle *v) const /* The vehicle cannot go to this roadstop (different roadtype) */ if ((GetRoadTypes(rs->xy) & v->compatible_roadtypes) == ROADTYPES_NONE) continue; /* The vehicle is articulated and can therefor not go the a standard road stop */ - if (IsStandardRoadStopTile(rs->xy) && v->RoadVehHasArticPart()) continue; + if (IsStandardRoadStopTile(rs->xy) && v->HasArticulatedPart()) continue; /* The vehicle can actually go to this road stop. So, return it! */ return rs; diff --git a/src/roadveh.h b/src/roadveh.h index 708fedb5c..9945635aa 100644 --- a/src/roadveh.h +++ b/src/roadveh.h @@ -151,7 +151,7 @@ struct RoadVehicle : public SpecializedVehicle<RoadVehicle, VEH_ROAD> { * Check if an engine has an articulated part. * @return True if the engine has an articulated part. */ - FORCEINLINE bool RoadVehHasArticPart() const { return this->Next() != NULL && this->Next()->IsArticulatedPart(); } + FORCEINLINE bool HasArticulatedPart() const { return this->Next() != NULL && this->Next()->IsArticulatedPart(); } }; #define FOR_ALL_ROADVEHICLES(var) FOR_ALL_VEHICLES_OF_TYPE(RoadVehicle, var) diff --git a/src/roadveh_cmd.cpp b/src/roadveh_cmd.cpp index 7861f0842..50a7d4e95 100644 --- a/src/roadveh_cmd.cpp +++ b/src/roadveh_cmd.cpp @@ -916,7 +916,7 @@ static void RoadVehCheckOvertake(RoadVehicle *v, RoadVehicle *u) if (IsTileType(v->tile, MP_STATION)) return; /* For now, articulated road vehicles can't overtake anything. */ - if (v->RoadVehHasArticPart()) return; + if (v->HasArticulatedPart()) return; /* Vehicles are not driving in same direction || direction is not a diagonal direction */ if (v->direction != u->direction || !(v->direction & 1)) return; @@ -1027,7 +1027,7 @@ static Trackdir RoadFindPathToDest(RoadVehicle *v, TileIndex tile, DiagDirection } else if (IsTileType(tile, MP_STATION) && IsStandardRoadStopTile(tile)) { /* Standard road stop (drive-through stops are treated as normal road) */ - if (!IsTileOwner(tile, v->owner) || GetRoadStopDir(tile) == enterdir || v->RoadVehHasArticPart()) { + if (!IsTileOwner(tile, v->owner) || GetRoadStopDir(tile) == enterdir || v->HasArticulatedPart()) { /* different station owner or wrong orientation or the vehicle has articulated parts */ trackdirs = TRACKDIR_BIT_NONE; } else { diff --git a/src/roadveh_gui.cpp b/src/roadveh_gui.cpp index e53a3028c..11e8f3eca 100644 --- a/src/roadveh_gui.cpp +++ b/src/roadveh_gui.cpp @@ -26,7 +26,7 @@ void DrawRoadVehDetails(const Vehicle *v, int left, int right, int y) { const RoadVehicle *rv = RoadVehicle::From(v); - uint y_offset = rv->RoadVehHasArticPart() ? 15 : 0; + uint y_offset = rv->HasArticulatedPart() ? 15 : 0; StringID str; Money feeder_share = 0; @@ -35,7 +35,7 @@ void DrawRoadVehDetails(const Vehicle *v, int left, int right, int y) SetDParam(2, v->value); DrawString(left, right, y + y_offset, STR_VEHICLE_INFO_BUILT_VALUE); - if (rv->RoadVehHasArticPart()) { + if (rv->HasArticulatedPart()) { CargoArray max_cargo; StringID subtype_text[NUM_CARGO]; char capacity[512]; diff --git a/src/saveload/afterload.cpp b/src/saveload/afterload.cpp index e33e234a1..c529a77ae 100644 --- a/src/saveload/afterload.cpp +++ b/src/saveload/afterload.cpp @@ -1870,7 +1870,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 || !IsRoadVehFront(u)) { + if (u == NULL || u->type != VEH_ROAD || !RoadVehicle::From(u)->IsRoadVehFront()) { delete v; } } diff --git a/src/station.cpp b/src/station.cpp index 6a0cc3c31..b5126c79b 100644 --- a/src/station.cpp +++ b/src/station.cpp @@ -121,7 +121,7 @@ RoadStop *Station::GetPrimaryRoadStop(const RoadVehicle *v) const /* The vehicle cannot go to this roadstop (different roadtype) */ if ((GetRoadTypes(rs->xy) & v->compatible_roadtypes) == ROADTYPES_NONE) continue; /* The vehicle is articulated and can therefor not go the a standard road stop */ - if (IsStandardRoadStopTile(rs->xy) && v->RoadVehHasArticPart()) continue; + if (IsStandardRoadStopTile(rs->xy) && v->HasArticulatedPart()) continue; /* The vehicle can actually go to this road stop. So, return it! */ break; diff --git a/src/station_cmd.cpp b/src/station_cmd.cpp index dc7cdb4c5..52bed3648 100644 --- a/src/station_cmd.cpp +++ b/src/station_cmd.cpp @@ -2570,7 +2570,7 @@ static VehicleEnterTileStatus VehicleEnter_Station(Vehicle *v, TileIndex tile, i /* For normal (non drive-through) road stops * Check if station is busy or if there are no free bays or whether it is a articulated vehicle. */ - if (rs->IsEntranceBusy() || !rs->HasFreeBay() || rv->RoadVehHasArticPart()) return VETSB_CANNOT_ENTER; + if (rs->IsEntranceBusy() || !rs->HasFreeBay() || rv->HasArticulatedPart()) return VETSB_CANNOT_ENTER; SetBit(rv->state, RVS_IN_ROAD_STOP); diff --git a/src/train.h b/src/train.h index 4476bb7ff..df717dd0c 100644 --- a/src/train.h +++ b/src/train.h @@ -259,7 +259,7 @@ struct Train : public SpecializedVehicle<Train, VEH_TRAIN> { * Check if an engine has an articulated part. * @return True if the engine has an articulated part. */ - FORCEINLINE bool EngineHasArticPart() const { return this->Next() != NULL && this->Next()->IsArticulatedPart(); } + FORCEINLINE bool HasArticulatedPart() const { return this->Next() != NULL && this->Next()->IsArticulatedPart(); } }; @@ -267,12 +267,12 @@ struct Train : public SpecializedVehicle<Train, VEH_TRAIN> { /** * Get the next part of a multi-part engine. - * Will only work on a multi-part engine (v->EngineHasArticPart() == true), + * Will only work on a multi-part engine (v->HasArticulatedPart() == true), * Result is undefined for normal engine. */ static inline Train *GetNextArticPart(const Train *v) { - assert(v->EngineHasArticPart()); + assert(v->HasArticulatedPart()); return v->Next(); } @@ -282,7 +282,7 @@ static inline Train *GetNextArticPart(const Train *v) */ static inline Train *GetLastEnginePart(Train *v) { - while (v->EngineHasArticPart()) v = GetNextArticPart(v); + while (v->HasArticulatedPart()) v = GetNextArticPart(v); return v; } @@ -292,7 +292,7 @@ static inline Train *GetLastEnginePart(Train *v) */ static inline Train *GetNextVehicle(const Train *v) { - while (v->EngineHasArticPart()) v = GetNextArticPart(v); + while (v->HasArticulatedPart()) v = GetNextArticPart(v); /* v now contains the last artic part in the engine */ return v->Next(); diff --git a/src/vehicle_cmd.cpp b/src/vehicle_cmd.cpp index e09347e4f..80d59f4db 100644 --- a/src/vehicle_cmd.cpp +++ b/src/vehicle_cmd.cpp @@ -437,9 +437,9 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint if (CmdSucceeded(cost)) total_cost.AddCost(cost); } - if (w->type == VEH_TRAIN && Train::From(w)->EngineHasArticPart()) { + if (w->type == VEH_TRAIN && Train::From(w)->HasArticulatedPart()) { w = GetNextArticPart(Train::From(w)); - } else if (w->type == VEH_ROAD && RoadVehicle::From(w)->RoadVehHasArticPart()) { + } else if (w->type == VEH_ROAD && RoadVehicle::From(w)->HasArticulatedPart()) { w = w->Next(); } else { break; @@ -453,9 +453,9 @@ CommandCost CmdCloneVehicle(TileIndex tile, DoCommandFlag flags, uint32 p1, uint } } - if (v->type == VEH_TRAIN && Train::From(v)->EngineHasArticPart()) { + if (v->type == VEH_TRAIN && Train::From(v)->HasArticulatedPart()) { v = GetNextArticPart(Train::From(v)); - } else if (v->type == VEH_ROAD && RoadVehicle::From(v)->RoadVehHasArticPart()) { + } else if (v->type == VEH_ROAD && RoadVehicle::From(v)->HasArticulatedPart()) { v = v->Next(); } else { break; diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index a407b3993..757f85a27 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1355,7 +1355,7 @@ struct VehicleDetailsWindow : Window { case VEH_ROAD: { this->widget[VLD_WIDGET_RENAME_VEHICLE].tooltips = STR_QUERY_RENAME_ROAD_CAPTION; - if (!RoadVehicle::From(v)->RoadVehHasArticPart()) break; + if (!RoadVehicle::From(v)->HasArticulatedPart()) break; /* Draw the text under the vehicle instead of next to it, minus the * height already allocated for the cargo of the first vehicle. */ |