mirror of https://github.com/OpenTTD/OpenTTD
Codechange: Mark some water region functions static. (#12964)
These functions are not used elsewhere. This may affect how compilers generate code.pull/12978/head
parent
386dbb7c80
commit
ccced859f5
|
@ -222,14 +222,14 @@ public:
|
||||||
std::vector<WaterRegionData> _water_region_data;
|
std::vector<WaterRegionData> _water_region_data;
|
||||||
std::vector<bool> _is_water_region_valid;
|
std::vector<bool> _is_water_region_valid;
|
||||||
|
|
||||||
TileIndex GetTileIndexFromLocalCoordinate(int region_x, int region_y, int local_x, int local_y)
|
static TileIndex GetTileIndexFromLocalCoordinate(int region_x, int region_y, int local_x, int local_y)
|
||||||
{
|
{
|
||||||
assert(local_x >= 0 && local_x < WATER_REGION_EDGE_LENGTH);
|
assert(local_x >= 0 && local_x < WATER_REGION_EDGE_LENGTH);
|
||||||
assert(local_y >= 0 && local_y < WATER_REGION_EDGE_LENGTH);
|
assert(local_y >= 0 && local_y < WATER_REGION_EDGE_LENGTH);
|
||||||
return TileXY(WATER_REGION_EDGE_LENGTH * region_x + local_x, WATER_REGION_EDGE_LENGTH * region_y + local_y);
|
return TileXY(WATER_REGION_EDGE_LENGTH * region_x + local_x, WATER_REGION_EDGE_LENGTH * region_y + local_y);
|
||||||
}
|
}
|
||||||
|
|
||||||
TileIndex GetEdgeTileCoordinate(int region_x, int region_y, DiagDirection side, int x_or_y)
|
static TileIndex GetEdgeTileCoordinate(int region_x, int region_y, DiagDirection side, int x_or_y)
|
||||||
{
|
{
|
||||||
assert(x_or_y >= 0 && x_or_y < WATER_REGION_EDGE_LENGTH);
|
assert(x_or_y >= 0 && x_or_y < WATER_REGION_EDGE_LENGTH);
|
||||||
switch (side) {
|
switch (side) {
|
||||||
|
@ -241,7 +241,7 @@ TileIndex GetEdgeTileCoordinate(int region_x, int region_y, DiagDirection side,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
WaterRegion GetUpdatedWaterRegion(uint16_t region_x, uint16_t region_y)
|
static WaterRegion GetUpdatedWaterRegion(uint16_t region_x, uint16_t region_y)
|
||||||
{
|
{
|
||||||
const int index = GetWaterRegionIndex(region_x, region_y);
|
const int index = GetWaterRegionIndex(region_x, region_y);
|
||||||
WaterRegion water_region(region_x, region_y, _water_region_data[index]);
|
WaterRegion water_region(region_x, region_y, _water_region_data[index]);
|
||||||
|
@ -252,7 +252,7 @@ WaterRegion GetUpdatedWaterRegion(uint16_t region_x, uint16_t region_y)
|
||||||
return water_region;
|
return water_region;
|
||||||
}
|
}
|
||||||
|
|
||||||
WaterRegion GetUpdatedWaterRegion(TileIndex tile)
|
static WaterRegion GetUpdatedWaterRegion(TileIndex tile)
|
||||||
{
|
{
|
||||||
return GetUpdatedWaterRegion(GetWaterRegionX(tile), GetWaterRegionY(tile));
|
return GetUpdatedWaterRegion(GetWaterRegionX(tile), GetWaterRegionY(tile));
|
||||||
}
|
}
|
||||||
|
@ -261,7 +261,7 @@ WaterRegion GetUpdatedWaterRegion(TileIndex tile)
|
||||||
* Returns the index of the water region.
|
* Returns the index of the water region.
|
||||||
* @param water_region The water region to return the index for.
|
* @param water_region The water region to return the index for.
|
||||||
*/
|
*/
|
||||||
TWaterRegionIndex GetWaterRegionIndex(const WaterRegionDesc &water_region)
|
static TWaterRegionIndex GetWaterRegionIndex(const WaterRegionDesc &water_region)
|
||||||
{
|
{
|
||||||
return GetWaterRegionIndex(water_region.x, water_region.y);
|
return GetWaterRegionIndex(water_region.x, water_region.y);
|
||||||
}
|
}
|
||||||
|
|
|
@ -49,8 +49,6 @@ struct WaterRegionDesc
|
||||||
bool operator!=(const WaterRegionDesc &other) const { return !(*this == other); }
|
bool operator!=(const WaterRegionDesc &other) const { return !(*this == other); }
|
||||||
};
|
};
|
||||||
|
|
||||||
TWaterRegionIndex GetWaterRegionIndex(const WaterRegionDesc &water_region);
|
|
||||||
|
|
||||||
int CalculateWaterRegionPatchHash(const WaterRegionPatchDesc &water_region_patch);
|
int CalculateWaterRegionPatchHash(const WaterRegionPatchDesc &water_region_patch);
|
||||||
|
|
||||||
TileIndex GetWaterRegionCenterTile(const WaterRegionDesc &water_region);
|
TileIndex GetWaterRegionCenterTile(const WaterRegionDesc &water_region);
|
||||||
|
|
Loading…
Reference in New Issue