Codechange: migrate size related functions to Map structure
This commit is contained in:
@@ -20,17 +20,17 @@
|
||||
|
||||
/* static */ TileIndex ScriptMap::GetMapSize()
|
||||
{
|
||||
return ::MapSize();
|
||||
return ::Map::Size();
|
||||
}
|
||||
|
||||
/* static */ uint32 ScriptMap::GetMapSizeX()
|
||||
{
|
||||
return ::MapSizeX();
|
||||
return ::Map::SizeX();
|
||||
}
|
||||
|
||||
/* static */ uint32 ScriptMap::GetMapSizeY()
|
||||
{
|
||||
return ::MapSizeY();
|
||||
return ::Map::SizeY();
|
||||
}
|
||||
|
||||
/* static */ int32 ScriptMap::GetTileX(TileIndex t)
|
||||
|
@@ -348,7 +348,7 @@ bool ScriptObject::ScriptDoCommandHelper<Tcmd, Tret(*)(DoCommandFlag, Targs...)>
|
||||
}
|
||||
|
||||
/* Do not even think about executing out-of-bounds tile-commands. */
|
||||
if (tile != 0 && (tile >= MapSize() || (!IsValidTile(tile) && (GetCommandFlags<Tcmd>() & CMD_ALL_TILES) == 0))) return false;
|
||||
if (tile != 0 && (tile >= Map::Size() || (!IsValidTile(tile) && (GetCommandFlags<Tcmd>() & CMD_ALL_TILES) == 0))) return false;
|
||||
|
||||
/* Only set ClientID parameters when the command does not come from the network. */
|
||||
if constexpr ((::GetCommandFlags<Tcmd>() & CMD_CLIENT_ID) != 0) ScriptObjectInternal::SetClientIds(args, std::index_sequence_for<Targs...>{});
|
||||
|
@@ -61,9 +61,9 @@ static void FillIndustryCatchment(const Industry *i, int radius, BitmapTileArea
|
||||
int tx = TileX(cur_tile);
|
||||
int ty = TileY(cur_tile);
|
||||
for (int y = -radius; y <= radius; y++) {
|
||||
if (ty + y < 0 || ty + y > (int)MapMaxY()) continue;
|
||||
if (ty + y < 0 || ty + y > (int)Map::MaxY()) continue;
|
||||
for (int x = -radius; x <= radius; x++) {
|
||||
if (tx + x < 0 || tx + x > (int)MapMaxX()) continue;
|
||||
if (tx + x < 0 || tx + x > (int)Map::MaxX()) continue;
|
||||
TileIndex tile = TileXY(tx + x, ty + y);
|
||||
if (!IsValidTile(tile)) continue;
|
||||
if (::IsTileType(tile, MP_INDUSTRY) && ::GetIndustryIndex(tile) == i->index) continue;
|
||||
|
Reference in New Issue
Block a user