From 0a99d6cc7fe924f914cae016986ebdf222972dd0 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Sun, 7 Apr 2024 22:38:36 +0200 Subject: [PATCH] Codechange: replace C-style array-pointer methods with the appropriate C++ methods --- src/newgrf_airport.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/newgrf_airport.h b/src/newgrf_airport.h index 7099e42e47..95256d2924 100644 --- a/src/newgrf_airport.h +++ b/src/newgrf_airport.h @@ -130,8 +130,8 @@ struct AirportSpec { /** Get the index of this spec. */ uint8_t GetIndex() const { - assert(this >= specs && this < endof(specs)); - return (uint8_t)(this - specs); + assert(this >= std::begin(specs) && this < std::end(specs)); + return static_cast(std::distance(std::cbegin(specs), this)); } static const AirportSpec dummy; ///< The dummy airport.