Codechange: migrate size related functions to Map structure
This commit is contained in:
@@ -753,7 +753,7 @@ void SetupScreenshotViewport(ScreenshotType t, Viewport *vp, uint32 width, uint3
|
||||
vp->zoom = ZOOM_LVL_WORLD_SCREENSHOT;
|
||||
|
||||
TileIndex north_tile = _settings_game.construction.freeform_edges ? TileXY(1, 1) : TileXY(0, 0);
|
||||
TileIndex south_tile = MapSize() - 1;
|
||||
TileIndex south_tile = Map::Size() - 1;
|
||||
|
||||
/* We need to account for a hill or high building at tile 0,0. */
|
||||
int extra_height_top = TilePixelHeight(north_tile) + 150;
|
||||
@@ -829,8 +829,8 @@ static void HeightmapCallback(void *userdata, void *buffer, uint y, uint pitch,
|
||||
{
|
||||
byte *buf = (byte *)buffer;
|
||||
while (n > 0) {
|
||||
TileIndex ti = TileXY(MapMaxX(), y);
|
||||
for (uint x = MapMaxX(); true; x--) {
|
||||
TileIndex ti = TileXY(Map::MaxX(), y);
|
||||
for (uint x = Map::MaxX(); true; x--) {
|
||||
*buf = 256 * TileHeight(ti) / (1 + _heightmap_highest_peak);
|
||||
buf++;
|
||||
if (x == 0) break;
|
||||
@@ -856,13 +856,13 @@ bool MakeHeightmapScreenshot(const char *filename)
|
||||
}
|
||||
|
||||
_heightmap_highest_peak = 0;
|
||||
for (TileIndex tile = 0; tile < MapSize(); tile++) {
|
||||
for (TileIndex tile = 0; tile < Map::Size(); tile++) {
|
||||
uint h = TileHeight(tile);
|
||||
_heightmap_highest_peak = std::max(h, _heightmap_highest_peak);
|
||||
}
|
||||
|
||||
const ScreenshotFormat *sf = _screenshot_formats + _cur_screenshot_format;
|
||||
return sf->proc(filename, HeightmapCallback, nullptr, MapSizeX(), MapSizeY(), 8, palette);
|
||||
return sf->proc(filename, HeightmapCallback, nullptr, Map::SizeX(), Map::SizeY(), 8, palette);
|
||||
}
|
||||
|
||||
static ScreenshotType _confirmed_screenshot_type; ///< Screenshot type the current query is about to confirm.
|
||||
@@ -889,8 +889,8 @@ void MakeScreenshotWithConfirm(ScreenshotType t)
|
||||
SetupScreenshotViewport(t, &vp);
|
||||
|
||||
bool heightmap_or_minimap = t == SC_HEIGHTMAP || t == SC_MINIMAP;
|
||||
uint64_t width = (heightmap_or_minimap ? MapSizeX() : vp.width);
|
||||
uint64_t height = (heightmap_or_minimap ? MapSizeY() : vp.height);
|
||||
uint64_t width = (heightmap_or_minimap ? Map::SizeX() : vp.width);
|
||||
uint64_t height = (heightmap_or_minimap ? Map::SizeY() : vp.height);
|
||||
|
||||
if (width * height > 8192 * 8192) {
|
||||
/* Ask for confirmation */
|
||||
@@ -1010,7 +1010,7 @@ static void MinimapScreenCallback(void *userdata, void *buf, uint y, uint pitch,
|
||||
uint num = (pitch * n);
|
||||
for (uint i = 0; i < num; i++) {
|
||||
uint row = y + (int)(i / pitch);
|
||||
uint col = (MapSizeX() - 1) - (i % pitch);
|
||||
uint col = (Map::SizeX() - 1) - (i % pitch);
|
||||
|
||||
TileIndex tile = TileXY(col, row);
|
||||
byte val = GetSmallMapOwnerPixels(tile, GetTileType(tile), IncludeHeightmap::Never) & 0xFF;
|
||||
@@ -1031,5 +1031,5 @@ static void MinimapScreenCallback(void *userdata, void *buf, uint y, uint pitch,
|
||||
bool MakeMinimapWorldScreenshot()
|
||||
{
|
||||
const ScreenshotFormat *sf = _screenshot_formats + _cur_screenshot_format;
|
||||
return sf->proc(MakeScreenshotName(SCREENSHOT_NAME, sf->extension), MinimapScreenCallback, nullptr, MapSizeX(), MapSizeY(), 32, _cur_palette.palette);
|
||||
return sf->proc(MakeScreenshotName(SCREENSHOT_NAME, sf->extension), MinimapScreenCallback, nullptr, Map::SizeX(), Map::SizeY(), 32, _cur_palette.palette);
|
||||
}
|
||||
|
Reference in New Issue
Block a user