From 7c8e7c6b6e16d4a26259a676db32d8776b99817e Mon Sep 17 00:00:00 2001 From: Henry Wilson Date: Wed, 10 Apr 2019 22:07:06 +0100 Subject: Codechange: Use null pointer literal instead of the NULL macro --- src/order_base.h | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/order_base.h') diff --git a/src/order_base.h b/src/order_base.h index b11c20d8e..5164a4d6e 100644 --- a/src/order_base.h +++ b/src/order_base.h @@ -48,7 +48,7 @@ private: uint16 max_speed; ///< How fast the vehicle may go on the way to the destination. public: - Order *next; ///< Pointer to next order. If NULL, end of list + Order *next; ///< Pointer to next order. If nullptr, end of list Order() : flags(0), refit_cargo(CT_NO_REFIT), max_speed(UINT16_MAX) {} ~Order(); @@ -268,7 +268,7 @@ private: public: /** Default constructor producing an invalid order list. */ OrderList(VehicleOrderID num_orders = INVALID_VEH_ORDER_ID) - : first(NULL), num_orders(num_orders), num_manual_orders(0), num_vehicles(0), first_shared(NULL), + : first(nullptr), num_orders(num_orders), num_manual_orders(0), num_vehicles(0), first_shared(nullptr), timetable_duration(0), total_duration(0) { } /** @@ -303,7 +303,7 @@ public: * @param curr Order to find the next one for. * @return Next order. */ - inline const Order *GetNext(const Order *curr) const { return (curr->next == NULL) ? this->GetFirstOrder() : curr->next; } + inline const Order *GetNext(const Order *curr) const { return (curr->next == nullptr) ? this->GetFirstOrder() : curr->next; } /** * Get number of orders in the order list. @@ -317,7 +317,7 @@ public: */ inline VehicleOrderID GetNumManualOrders() const { return this->num_manual_orders; } - StationIDStack GetNextStoppingStation(const Vehicle *v, const Order *first = NULL, uint hops = 0) const; + StationIDStack GetNextStoppingStation(const Vehicle *v, const Order *first = nullptr, uint hops = 0) const; const Order *GetNextDecisionNode(const Order *next, uint hops) const; void InsertOrderAt(Order *new_order, int index); @@ -396,7 +396,7 @@ public: #define FOR_ALL_ORDERS(var) FOR_ALL_ORDERS_FROM(var, 0) -#define FOR_VEHICLE_ORDERS(v, order) for (order = (v->orders.list == NULL) ? NULL : v->orders.list->GetFirstOrder(); order != NULL; order = order->next) +#define FOR_VEHICLE_ORDERS(v, order) for (order = (v->orders.list == nullptr) ? nullptr : v->orders.list->GetFirstOrder(); order != nullptr; order = order->next) #define FOR_ALL_ORDER_LISTS_FROM(var, start) FOR_ALL_ITEMS_FROM(OrderList, orderlist_index, var, start) -- cgit v1.2.3-54-g00ecf