diff options
Diffstat (limited to 'src/vehicle_base.h')
-rw-r--r-- | src/vehicle_base.h | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/vehicle_base.h b/src/vehicle_base.h index d02d33e2c..523f1c263 100644 --- a/src/vehicle_base.h +++ b/src/vehicle_base.h @@ -459,7 +459,7 @@ public: */ inline void InvalidateNewGRFCacheOfChain() { - for (Vehicle *u = this; u != NULL; u = u->Next()) { + for (Vehicle *u = this; u != nullptr; u = u->Next()) { u->InvalidateNewGRFCache(); } } @@ -576,14 +576,14 @@ public: /** * Get the next vehicle of this vehicle. * @note articulated parts are also counted as vehicles. - * @return the next vehicle or NULL when there isn't a next vehicle. + * @return the next vehicle or nullptr when there isn't a next vehicle. */ inline Vehicle *Next() const { return this->next; } /** * Get the previous vehicle of this vehicle. * @note articulated parts are also counted as vehicles. - * @return the previous vehicle or NULL when there isn't a previous vehicle. + * @return the previous vehicle or nullptr when there isn't a previous vehicle. */ inline Vehicle *Previous() const { return this->previous; } @@ -600,7 +600,7 @@ public: inline Vehicle *Last() { Vehicle *v = this; - while (v->Next() != NULL) v = v->Next(); + while (v->Next() != nullptr) v = v->Next(); return v; } @@ -611,22 +611,22 @@ public: inline const Vehicle *Last() const { const Vehicle *v = this; - while (v->Next() != NULL) v = v->Next(); + while (v->Next() != nullptr) v = v->Next(); return v; } /** * Get the vehicle at offset \a n of this vehicle chain. * @param n Offset from the current vehicle. - * @return The new vehicle or NULL if the offset is out-of-bounds. + * @return The new vehicle or nullptr if the offset is out-of-bounds. */ inline Vehicle *Move(int n) { Vehicle *v = this; if (n < 0) { - for (int i = 0; i != n && v != NULL; i--) v = v->Previous(); + for (int i = 0; i != n && v != nullptr; i--) v = v->Previous(); } else { - for (int i = 0; i != n && v != NULL; i++) v = v->Next(); + for (int i = 0; i != n && v != nullptr; i++) v = v->Next(); } return v; } @@ -634,15 +634,15 @@ public: /** * Get the vehicle at offset \a n of this vehicle chain. * @param n Offset from the current vehicle. - * @return The new vehicle or NULL if the offset is out-of-bounds. + * @return The new vehicle or nullptr if the offset is out-of-bounds. */ inline const Vehicle *Move(int n) const { const Vehicle *v = this; if (n < 0) { - for (int i = 0; i != n && v != NULL; i--) v = v->Previous(); + for (int i = 0; i != n && v != nullptr; i--) v = v->Previous(); } else { - for (int i = 0; i != n && v != NULL; i++) v = v->Next(); + for (int i = 0; i != n && v != nullptr; i++) v = v->Next(); } return v; } @@ -651,20 +651,20 @@ public: * Get the first order of the vehicles order list. * @return first order of order list. */ - inline Order *GetFirstOrder() const { return (this->orders.list == NULL) ? NULL : this->orders.list->GetFirstOrder(); } + inline Order *GetFirstOrder() const { return (this->orders.list == nullptr) ? nullptr : this->orders.list->GetFirstOrder(); } void AddToShared(Vehicle *shared_chain); void RemoveFromShared(); /** * Get the next vehicle of the shared vehicle chain. - * @return the next shared vehicle or NULL when there isn't a next vehicle. + * @return the next shared vehicle or nullptr when there isn't a next vehicle. */ inline Vehicle *NextShared() const { return this->next_shared; } /** * Get the previous vehicle of the shared vehicle chain - * @return the previous shared vehicle or NULL when there isn't a previous vehicle. + * @return the previous shared vehicle or nullptr when there isn't a previous vehicle. */ inline Vehicle *PreviousShared() const { return this->previous_shared; } @@ -672,25 +672,25 @@ public: * Get the first vehicle of this vehicle chain. * @return the first vehicle of the chain. */ - inline Vehicle *FirstShared() const { return (this->orders.list == NULL) ? this->First() : this->orders.list->GetFirstSharedVehicle(); } + inline Vehicle *FirstShared() const { return (this->orders.list == nullptr) ? this->First() : this->orders.list->GetFirstSharedVehicle(); } /** * Check if we share our orders with another vehicle. * @return true if there are other vehicles sharing the same order */ - inline bool IsOrderListShared() const { return this->orders.list != NULL && this->orders.list->IsShared(); } + inline bool IsOrderListShared() const { return this->orders.list != nullptr && this->orders.list->IsShared(); } /** * Get the number of orders this vehicle has. * @return the number of orders this vehicle has. */ - inline VehicleOrderID GetNumOrders() const { return (this->orders.list == NULL) ? 0 : this->orders.list->GetNumOrders(); } + inline VehicleOrderID GetNumOrders() const { return (this->orders.list == nullptr) ? 0 : this->orders.list->GetNumOrders(); } /** * Get the number of manually added orders this vehicle has. * @return the number of manually added orders this vehicle has. */ - inline VehicleOrderID GetNumManualOrders() const { return (this->orders.list == NULL) ? 0 : this->orders.list->GetNumManualOrders(); } + inline VehicleOrderID GetNumManualOrders() const { return (this->orders.list == nullptr) ? 0 : this->orders.list->GetNumManualOrders(); } /** * Get the next station the vehicle will stop at. @@ -698,7 +698,7 @@ public: */ inline StationIDStack GetNextStoppingStation() const { - return (this->orders.list == NULL) ? INVALID_STATION : this->orders.list->GetNextStoppingStation(this); + return (this->orders.list == nullptr) ? INVALID_STATION : this->orders.list->GetNextStoppingStation(this); } void ResetRefitCaps(); @@ -853,22 +853,22 @@ public: } /** - * Returns order 'index' of a vehicle or NULL when it doesn't exists + * Returns order 'index' of a vehicle or nullptr when it doesn't exists * @param index the order to fetch * @return the found (or not) order */ inline Order *GetOrder(int index) const { - return (this->orders.list == NULL) ? NULL : this->orders.list->GetOrderAt(index); + return (this->orders.list == nullptr) ? nullptr : this->orders.list->GetOrderAt(index); } /** - * Returns the last order of a vehicle, or NULL if it doesn't exists + * Returns the last order of a vehicle, or nullptr if it doesn't exists * @return last order of a vehicle, if available */ inline Order *GetLastOrder() const { - return (this->orders.list == NULL) ? NULL : this->orders.list->GetLastOrder(); + return (this->orders.list == nullptr) ? nullptr : this->orders.list->GetLastOrder(); } bool IsEngineCountable() const; @@ -900,7 +900,7 @@ public: */ inline bool HasArticulatedPart() const { - return this->Next() != NULL && this->Next()->IsArticulatedPart(); + return this->Next() != nullptr && this->Next()->IsArticulatedPart(); } /** @@ -967,7 +967,7 @@ public: inline Vehicle *GetPrevVehicle() const { Vehicle *v = this->Previous(); - while (v != NULL && v->IsArticulatedPart()) v = v->Previous(); + while (v != nullptr && v->IsArticulatedPart()) v = v->Previous(); return v; } @@ -1103,7 +1103,7 @@ struct SpecializedVehicle : public Vehicle { */ static inline T *GetIfValid(size_t index) { - return IsValidID(index) ? Get(index) : NULL; + return IsValidID(index) ? Get(index) : nullptr; } /** |