Use array unique_ptr for water regions
This commit is contained in:
@@ -20,6 +20,7 @@
|
|||||||
#include "ship.h"
|
#include "ship.h"
|
||||||
|
|
||||||
#include <array>
|
#include <array>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
using TWaterRegionTraversabilityBits = uint16_t;
|
using TWaterRegionTraversabilityBits = uint16_t;
|
||||||
constexpr TWaterRegionPatchLabel FIRST_REGION_LABEL = 1;
|
constexpr TWaterRegionPatchLabel FIRST_REGION_LABEL = 1;
|
||||||
@@ -273,7 +274,7 @@ public:
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
std::vector<WaterRegion> _water_regions;
|
std::unique_ptr<WaterRegion[]> _water_regions;
|
||||||
|
|
||||||
TileIndex GetTileIndexFromLocalCoordinate(uint32_t region_x, uint32_t region_y, uint32_t local_x, uint32_t local_y)
|
TileIndex GetTileIndexFromLocalCoordinate(uint32_t region_x, uint32_t region_y, uint32_t local_x, uint32_t local_y)
|
||||||
{
|
{
|
||||||
@@ -442,8 +443,7 @@ void VisitWaterRegionPatchNeighbors(const WaterRegionPatchDesc &water_region_pat
|
|||||||
*/
|
*/
|
||||||
void InitializeWaterRegions()
|
void InitializeWaterRegions()
|
||||||
{
|
{
|
||||||
_water_regions.clear();
|
_water_regions.reset(new WaterRegion[GetWaterRegionMapSizeX() * GetWaterRegionMapSizeY()]);
|
||||||
_water_regions.resize(static_cast<size_t>(GetWaterRegionMapSizeX()) * GetWaterRegionMapSizeY());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint GetWaterRegionTileDebugColourIndex(TileIndex tile)
|
uint GetWaterRegionTileDebugColourIndex(TileIndex tile)
|
||||||
|
@@ -13,7 +13,6 @@
|
|||||||
#include "tile_type.h"
|
#include "tile_type.h"
|
||||||
#include "map_func.h"
|
#include "map_func.h"
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
#include <functional>
|
#include <functional>
|
||||||
|
|
||||||
using TWaterRegionPatchLabel = uint8_t;
|
using TWaterRegionPatchLabel = uint8_t;
|
||||||
|
Reference in New Issue
Block a user