Codefix: follow coding style

This commit is contained in:
Rubidium 2024-03-22 21:30:44 +01:00 committed by rubidium42
parent 7457f8d0ff
commit e904122441
3 changed files with 10 additions and 10 deletions

View File

@ -269,7 +269,7 @@ std::string TranslateTTDPatchCodes(uint32_t grfid, uint8_t language_id, bool all
continue; continue;
} }
} else { } else {
c = (uint8_t)*src++; c = static_cast<uint8_t>(*src++);
} }
if (c == '\0') break; 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; if (src[0] == '\0' || src[1] == '\0') goto string_end;
StringID string; StringID string;
string = ((uint8_t)* src++); string = static_cast<uint8_t>(*src++);
string |= ((uint8_t)* src++) << 8; string |= static_cast<uint8_t>(*src++) << 8;
Utf8Encode(d, SCC_NEWGRF_STRINL); Utf8Encode(d, SCC_NEWGRF_STRINL);
Utf8Encode(d, MapGRFStringID(grfid, string)); Utf8Encode(d, MapGRFStringID(grfid, string));
break; break;
@ -350,8 +350,8 @@ std::string TranslateTTDPatchCodes(uint32_t grfid, uint8_t language_id, bool all
case 0x03: case 0x03:
{ {
if (src[0] == '\0' || src[1] == '\0') goto string_end; if (src[0] == '\0' || src[1] == '\0') goto string_end;
uint16_t tmp = ((uint8_t)* src++); uint16_t tmp = static_cast<uint8_t>(*src++);
tmp |= ((uint8_t)* src++) << 8; tmp |= static_cast<uint8_t>(*src++) << 8;
Utf8Encode(d, SCC_NEWGRF_PUSH_WORD); Utf8Encode(d, SCC_NEWGRF_PUSH_WORD);
Utf8Encode(d, tmp); Utf8Encode(d, tmp);
break; break;

View File

@ -94,7 +94,7 @@ void FindStationsAroundSelection()
/* If the current tile is already a station, then it must be the nearest station. */ /* 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) { 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) { if (st != nullptr) {
SetViewportCatchmentSpecializedStation<T>(st, true); SetViewportCatchmentSpecializedStation<T>(st, true);
return; return;

View File

@ -244,12 +244,12 @@ inline TropicZone GetTropicZone(Tile tile)
/** /**
* Get the current animation frame * Get the current animation frame
* @param t the tile * @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 * @return frame number
*/ */
inline uint8_t GetAnimationFrame(Tile t) 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(); return t.m7();
} }
@ -257,11 +257,11 @@ inline uint8_t GetAnimationFrame(Tile t)
* Set a new animation frame * Set a new animation frame
* @param t the tile * @param t the tile
* @param frame the new frame number * @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) 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; t.m7() = frame;
} }