diff --git a/src/build_vehicle_gui.cpp b/src/build_vehicle_gui.cpp index af2cccec3b..0dd06a3edb 100644 --- a/src/build_vehicle_gui.cpp +++ b/src/build_vehicle_gui.cpp @@ -125,9 +125,9 @@ static bool EngineNumberSorter(const GUIEngineListItem &a, const GUIEngineListIt */ static bool EngineIntroDateSorter(const GUIEngineListItem &a, const GUIEngineListItem &b) { - const int va = Engine::Get(a.engine_id)->intro_date; - const int vb = Engine::Get(b.engine_id)->intro_date; - const int r = va - vb; + const auto va = Engine::Get(a.engine_id)->intro_date; + const auto vb = Engine::Get(b.engine_id)->intro_date; + const auto r = va - vb; /* Use EngineID to sort instead since we want consistent sorting */ if (r == 0) return EngineNumberSorter(a, b); diff --git a/src/network/network_gui.cpp b/src/network/network_gui.cpp index 01fba02ef1..0f6c5e2dca 100644 --- a/src/network/network_gui.cpp +++ b/src/network/network_gui.cpp @@ -324,14 +324,14 @@ protected: /** Sort servers by current date */ static bool NGameDateSorter(NetworkGameList * const &a, NetworkGameList * const &b) { - int r = a->info.game_date - b->info.game_date; + auto r = a->info.game_date - b->info.game_date; return (r != 0) ? r < 0 : NGameClientSorter(a, b); } /** Sort servers by the number of days the game is running */ static bool NGameYearsSorter(NetworkGameList * const &a, NetworkGameList * const &b) { - int r = a->info.game_date - a->info.start_date - b->info.game_date + b->info.start_date; + auto r = a->info.game_date - a->info.start_date - b->info.game_date + b->info.start_date; return (r != 0) ? r < 0: NGameDateSorter(a, b); } diff --git a/src/vehicle_gui.cpp b/src/vehicle_gui.cpp index 7f5f1d9da4..607140f31b 100644 --- a/src/vehicle_gui.cpp +++ b/src/vehicle_gui.cpp @@ -1360,7 +1360,7 @@ static bool VehicleNameSorter(const Vehicle * const &a, const Vehicle * const &b /** Sort vehicles by their age */ static bool VehicleAgeSorter(const Vehicle * const &a, const Vehicle * const &b) { - int r = a->age - b->age; + auto r = a->age - b->age; return (r != 0) ? r < 0 : VehicleNumberSorter(a, b); }