Codechange: use std::unique_ptr over CallocT for tiles

This commit is contained in:
Rubidium
2025-01-13 21:39:10 +01:00
committed by rubidium42
parent 3541ba4d0c
commit 3a7cfafe51
2 changed files with 16 additions and 19 deletions

View File

@@ -30,13 +30,13 @@ private:
* Look at docs/landscape.html for the exact meaning of the members.
*/
struct TileBase {
uint8_t type; ///< The type (bits 4..7), bridges (2..3), rainforest/desert (0..1)
uint8_t height; ///< The height of the northern corner.
uint16_t m2; ///< Primarily used for indices to towns, industries and stations
uint8_t m1; ///< Primarily used for ownership information
uint8_t m3; ///< General purpose
uint8_t m4; ///< General purpose
uint8_t m5; ///< General purpose
uint8_t type = 0; ///< The type (bits 4..7), bridges (2..3), rainforest/desert (0..1)
uint8_t height = 0; ///< The height of the northern corner.
uint16_t m2 = 0; ///< Primarily used for indices to towns, industries and stations
uint8_t m1 = 0; ///< Primarily used for ownership information
uint8_t m3 = 0; ///< General purpose
uint8_t m4 = 0; ///< General purpose
uint8_t m5 = 0; ///< General purpose
};
static_assert(sizeof(TileBase) == 8);
@@ -46,13 +46,13 @@ private:
* Look at docs/landscape.html for the exact meaning of the members.
*/
struct TileExtended {
uint8_t m6; ///< General purpose
uint8_t m7; ///< Primarily used for newgrf support
uint16_t m8; ///< General purpose
uint8_t m6 = 0; ///< General purpose
uint8_t m7 = 0; ///< Primarily used for newgrf support
uint16_t m8 = 0; ///< General purpose
};
static TileBase *base_tiles; ///< Pointer to the tile-array.
static TileExtended *extended_tiles; ///< Pointer to the extended tile-array.
static std::unique_ptr<TileBase[]> base_tiles; ///< Pointer to the tile-array.
static std::unique_ptr<TileExtended[]> extended_tiles; ///< Pointer to the extended tile-array.
TileIndex tile; ///< The tile to access the map data for.