From 8986fb0385a113ee2ca1c0a18a24a5dfc19678de 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 45b2244bd7..9fb5348c0a 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.