Fix ground/tree tile vegetation changes not updating map mode viewports
(In vegetation mode)
This commit is contained in:
@@ -338,7 +338,7 @@ static void TileLoop_Clear(TileIndex tile)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE_NON_VEG);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenerateClearTile()
|
void GenerateClearTile()
|
||||||
|
@@ -473,11 +473,11 @@ uint PlaceTreeGroupAroundTile(TileIndex tile, TreeType treetype, uint radius, ui
|
|||||||
if (IsTileType(tile_to_plant, MP_TREES) && GetTreeCount(tile_to_plant) < 4) {
|
if (IsTileType(tile_to_plant, MP_TREES) && GetTreeCount(tile_to_plant) < 4) {
|
||||||
AddTreeCount(tile_to_plant, 1);
|
AddTreeCount(tile_to_plant, 1);
|
||||||
SetTreeGrowth(tile_to_plant, 0);
|
SetTreeGrowth(tile_to_plant, 0);
|
||||||
MarkTileDirtyByTile(tile_to_plant, VMDF_NOT_MAP_MODE);
|
MarkTileDirtyByTile(tile_to_plant, VMDF_NOT_MAP_MODE_NON_VEG);
|
||||||
planted++;
|
planted++;
|
||||||
} else if (CanPlantTreesOnTile(tile_to_plant, allow_desert)) {
|
} else if (CanPlantTreesOnTile(tile_to_plant, allow_desert)) {
|
||||||
PlantTreesOnTile(tile_to_plant, treetype, 0, 3);
|
PlantTreesOnTile(tile_to_plant, treetype, 0, 3);
|
||||||
MarkTileDirtyByTile(tile_to_plant, VMDF_NOT_MAP_MODE);
|
MarkTileDirtyByTile(tile_to_plant, VMDF_NOT_MAP_MODE_NON_VEG);
|
||||||
planted++;
|
planted++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -588,7 +588,7 @@ CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
|||||||
} else {
|
} else {
|
||||||
AddTreeCount(tile, 1);
|
AddTreeCount(tile, 1);
|
||||||
}
|
}
|
||||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE_NON_VEG);
|
||||||
if (c != nullptr) c->tree_limit -= 1 << 16;
|
if (c != nullptr) c->tree_limit -= 1 << 16;
|
||||||
}
|
}
|
||||||
/* 2x as expensive to add more trees to an existing tile */
|
/* 2x as expensive to add more trees to an existing tile */
|
||||||
@@ -666,7 +666,7 @@ CommandCost CmdPlantTree(TileIndex tile, DoCommandFlag flags, uint32 p1, uint32
|
|||||||
|
|
||||||
/* Plant full grown trees in scenario editor */
|
/* Plant full grown trees in scenario editor */
|
||||||
PlantTreesOnTile(tile, treetype, 0, _game_mode == GM_EDITOR ? 3 : 0);
|
PlantTreesOnTile(tile, treetype, 0, _game_mode == GM_EDITOR ? 3 : 0);
|
||||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE_NON_VEG);
|
||||||
if (c != nullptr) c->tree_limit -= 1 << 16;
|
if (c != nullptr) c->tree_limit -= 1 << 16;
|
||||||
|
|
||||||
/* When planting rainforest-trees, set tropiczone to rainforest in editor. */
|
/* When planting rainforest-trees, set tropiczone to rainforest in editor. */
|
||||||
@@ -830,7 +830,7 @@ static void TileLoopTreesDesert(TileIndex tile)
|
|||||||
case TROPICZONE_DESERT:
|
case TROPICZONE_DESERT:
|
||||||
if (GetTreeGround(tile) != TREE_GROUND_SNOW_DESERT) {
|
if (GetTreeGround(tile) != TREE_GROUND_SNOW_DESERT) {
|
||||||
SetTreeGroundDensity(tile, TREE_GROUND_SNOW_DESERT, 3);
|
SetTreeGroundDensity(tile, TREE_GROUND_SNOW_DESERT, 3);
|
||||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE_NON_VEG);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -885,7 +885,7 @@ static void TileLoopTreesAlps(TileIndex tile)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE_NON_VEG);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool CanPlantExtraTrees(TileIndex tile)
|
static bool CanPlantExtraTrees(TileIndex tile)
|
||||||
@@ -915,7 +915,7 @@ static void TileLoop_Trees(TileIndex tile)
|
|||||||
uint density = GetTreeDensity(tile);
|
uint density = GetTreeDensity(tile);
|
||||||
if (density < 3) {
|
if (density < 3) {
|
||||||
SetTreeGroundDensity(tile, TREE_GROUND_GRASS, density + 1);
|
SetTreeGroundDensity(tile, TREE_GROUND_GRASS, density + 1);
|
||||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE_NON_VEG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1033,7 +1033,7 @@ static void TileLoop_Trees(TileIndex tile)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE);
|
MarkTileDirtyByTile(tile, VMDF_NOT_MAP_MODE_NON_VEG);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@@ -3640,6 +3640,7 @@ void MarkAllViewportsDirty(int left, int top, int right, int bottom, ViewportMar
|
|||||||
{
|
{
|
||||||
for (uint i = 0; i < _viewport_window_cache.size(); i++) {
|
for (uint i = 0; i < _viewport_window_cache.size(); i++) {
|
||||||
if (flags & VMDF_NOT_MAP_MODE && _viewport_window_cache[i]->zoom >= ZOOM_LVL_DRAW_MAP) continue;
|
if (flags & VMDF_NOT_MAP_MODE && _viewport_window_cache[i]->zoom >= ZOOM_LVL_DRAW_MAP) continue;
|
||||||
|
if (flags & VMDF_NOT_MAP_MODE_NON_VEG && _viewport_window_cache[i]->zoom >= ZOOM_LVL_DRAW_MAP && _viewport_window_cache[i]->map_type != VPMT_VEGETATION) continue;
|
||||||
const Rect &r = _viewport_coverage_rects[i];
|
const Rect &r = _viewport_coverage_rects[i];
|
||||||
if (left >= r.right ||
|
if (left >= r.right ||
|
||||||
right <= r.left ||
|
right <= r.left ||
|
||||||
|
@@ -222,7 +222,8 @@ enum FoundationPart {
|
|||||||
enum ViewportMarkDirtyFlags : byte {
|
enum ViewportMarkDirtyFlags : byte {
|
||||||
VMDF_NONE = 0,
|
VMDF_NONE = 0,
|
||||||
VMDF_NOT_MAP_MODE = 0x1,
|
VMDF_NOT_MAP_MODE = 0x1,
|
||||||
VMDF_NOT_LANDSCAPE = 0x2,
|
VMDF_NOT_MAP_MODE_NON_VEG = 0x2,
|
||||||
|
VMDF_NOT_LANDSCAPE = 0x4,
|
||||||
};
|
};
|
||||||
DECLARE_ENUM_AS_BIT_SET(ViewportMarkDirtyFlags)
|
DECLARE_ENUM_AS_BIT_SET(ViewportMarkDirtyFlags)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user