From e904122441430b704439164d45f5ead198dcb119 Mon Sep 17 00:00:00 2001 From: Rubidium Date: Fri, 22 Mar 2024 21:30:44 +0100 Subject: [PATCH] Codefix: follow coding style --- src/newgrf_text.cpp | 10 +++++----- src/station_gui.cpp | 2 +- src/tile_map.h | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/newgrf_text.cpp b/src/newgrf_text.cpp index 40ef28c9a2..967af68196 100644 --- a/src/newgrf_text.cpp +++ b/src/newgrf_text.cpp @@ -269,7 +269,7 @@ std::string TranslateTTDPatchCodes(uint32_t grfid, uint8_t language_id, bool all continue; } } else { - c = (uint8_t)*src++; + c = static_cast(*src++); } if (c == '\0') break; @@ -305,8 +305,8 @@ std::string TranslateTTDPatchCodes(uint32_t grfid, uint8_t language_id, bool all { if (src[0] == '\0' || src[1] == '\0') goto string_end; StringID string; - string = ((uint8_t)* src++); - string |= ((uint8_t)* src++) << 8; + string = static_cast(*src++); + string |= static_cast(*src++) << 8; Utf8Encode(d, SCC_NEWGRF_STRINL); Utf8Encode(d, MapGRFStringID(grfid, string)); break; @@ -350,8 +350,8 @@ std::string TranslateTTDPatchCodes(uint32_t grfid, uint8_t language_id, bool all case 0x03: { if (src[0] == '\0' || src[1] == '\0') goto string_end; - uint16_t tmp = ((uint8_t)* src++); - tmp |= ((uint8_t)* src++) << 8; + uint16_t tmp = static_cast(*src++); + tmp |= static_cast(*src++) << 8; Utf8Encode(d, SCC_NEWGRF_PUSH_WORD); Utf8Encode(d, tmp); break; diff --git a/src/station_gui.cpp b/src/station_gui.cpp index 414b48a466..098be7a228 100644 --- a/src/station_gui.cpp +++ b/src/station_gui.cpp @@ -94,7 +94,7 @@ void FindStationsAroundSelection() /* If the current tile is already a station, then it must be the nearest station. */ if (IsTileType(location.tile, MP_STATION) && GetTileOwner(location.tile) == _local_company) { - T* st = T::GetByTile(location.tile); + T *st = T::GetByTile(location.tile); if (st != nullptr) { SetViewportCatchmentSpecializedStation(st, true); return; diff --git a/src/tile_map.h b/src/tile_map.h index 687963270b..6fbb3a53fa 100644 --- a/src/tile_map.h +++ b/src/tile_map.h @@ -244,12 +244,12 @@ inline TropicZone GetTropicZone(Tile tile) /** * Get the current animation frame * @param t the tile - * @pre IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) ||IsTileType(t, MP_STATION) + * @pre IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_STATION) * @return frame number */ inline uint8_t GetAnimationFrame(Tile t) { - assert(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) ||IsTileType(t, MP_STATION)); + assert(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_STATION)); return t.m7(); } @@ -257,11 +257,11 @@ inline uint8_t GetAnimationFrame(Tile t) * Set a new animation frame * @param t the tile * @param frame the new frame number - * @pre IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) ||IsTileType(t, MP_STATION) + * @pre IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_STATION) */ inline void SetAnimationFrame(Tile t, uint8_t frame) { - assert(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) ||IsTileType(t, MP_STATION)); + assert(IsTileType(t, MP_HOUSE) || IsTileType(t, MP_OBJECT) || IsTileType(t, MP_INDUSTRY) || IsTileType(t, MP_STATION)); t.m7() = frame; }