From adc79aca09a63e76e7bc3cc5838fadc057732edf Mon Sep 17 00:00:00 2001 From: SamuXarick <43006711+SamuXarick@users.noreply.github.com> Date: Tue, 4 Feb 2025 18:52:52 +0000 Subject: [PATCH] Codechange: Refactor AllocHeightMap to return void since it always returns true (#13379) --- src/tgp.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/src/tgp.cpp b/src/tgp.cpp index cfe88cfe09..b0f3351541 100644 --- a/src/tgp.cpp +++ b/src/tgp.cpp @@ -322,9 +322,8 @@ static inline bool IsValidXY(int x, int y) /** * Allocate array of (Map::SizeX() + 1) * (Map::SizeY() + 1) heights and init the _height_map structure members - * @return true on success */ -static inline bool AllocHeightMap() +static inline void AllocHeightMap() { assert(_height_map.h.empty()); @@ -335,8 +334,6 @@ static inline bool AllocHeightMap() size_t total_size = static_cast(_height_map.size_x + 1) * (_height_map.size_y + 1); _height_map.dim_x = _height_map.size_x + 1; _height_map.h.resize(total_size); - - return true; } /** Free height map */ @@ -983,7 +980,7 @@ static void TgenSetTileHeight(TileIndex tile, int height) */ void GenerateTerrainPerlin() { - if (!AllocHeightMap()) return; + AllocHeightMap(); GenerateWorldSetAbortCallback(FreeHeightMap); HeightMapGenerate();