mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-23 19:02:04 -05:00
Move scenery_update_age to SmallScenery member function
This commit is contained in:
parent
425b05d011
commit
1b38289490
3 changed files with 11 additions and 14 deletions
|
@ -74,7 +74,7 @@ void scenery_update_tile(const CoordsXY& sceneryPos)
|
||||||
|
|
||||||
if (tileElement->GetType() == TILE_ELEMENT_TYPE_SMALL_SCENERY)
|
if (tileElement->GetType() == TILE_ELEMENT_TYPE_SMALL_SCENERY)
|
||||||
{
|
{
|
||||||
scenery_update_age(sceneryPos, tileElement);
|
tileElement->AsSmallScenery()->UpdateAge(sceneryPos);
|
||||||
}
|
}
|
||||||
else if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH)
|
else if (tileElement->GetType() == TILE_ELEMENT_TYPE_PATH)
|
||||||
{
|
{
|
||||||
|
@ -101,12 +101,9 @@ void scenery_update_tile(const CoordsXY& sceneryPos)
|
||||||
*
|
*
|
||||||
* rct2: 0x006E33D9
|
* rct2: 0x006E33D9
|
||||||
*/
|
*/
|
||||||
void scenery_update_age(const CoordsXY& sceneryPos, TileElement* tileElement)
|
void SmallSceneryElement::UpdateAge(const CoordsXY& sceneryPos)
|
||||||
{
|
{
|
||||||
TileElement* tileElementAbove;
|
auto* sceneryEntry = GetEntry();
|
||||||
rct_scenery_entry* sceneryEntry;
|
|
||||||
|
|
||||||
sceneryEntry = tileElement->AsSmallScenery()->GetEntry();
|
|
||||||
if (sceneryEntry == nullptr)
|
if (sceneryEntry == nullptr)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -118,14 +115,14 @@ void scenery_update_age(const CoordsXY& sceneryPos, TileElement* tileElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_CAN_BE_WATERED)
|
if (!scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_CAN_BE_WATERED)
|
||||||
|| (gClimateCurrent.Weather < WEATHER_RAIN) || (tileElement->AsSmallScenery()->GetAge() < 5))
|
|| (gClimateCurrent.Weather < WEATHER_RAIN) || GetAge() < 5)
|
||||||
{
|
{
|
||||||
tileElement->AsSmallScenery()->IncreaseAge(sceneryPos);
|
IncreaseAge(sceneryPos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check map elements above, presumably to see if map element is blocked from rain
|
// Check map elements above, presumably to see if map element is blocked from rain
|
||||||
tileElementAbove = tileElement;
|
TileElement* tileElementAbove = reinterpret_cast<TileElement*>(this);
|
||||||
// Change from original: RCT2 only checked for the first three quadrants, which was very likely to be a bug.
|
// Change from original: RCT2 only checked for the first three quadrants, which was very likely to be a bug.
|
||||||
while (!(tileElementAbove->GetOccupiedQuadrants()))
|
while (!(tileElementAbove->GetOccupiedQuadrants()))
|
||||||
{
|
{
|
||||||
|
@ -142,13 +139,13 @@ void scenery_update_age(const CoordsXY& sceneryPos, TileElement* tileElement)
|
||||||
case TILE_ELEMENT_TYPE_ENTRANCE:
|
case TILE_ELEMENT_TYPE_ENTRANCE:
|
||||||
case TILE_ELEMENT_TYPE_PATH:
|
case TILE_ELEMENT_TYPE_PATH:
|
||||||
map_invalidate_tile_zoom1({ sceneryPos, tileElementAbove->GetBaseZ(), tileElementAbove->GetClearanceZ() });
|
map_invalidate_tile_zoom1({ sceneryPos, tileElementAbove->GetBaseZ(), tileElementAbove->GetClearanceZ() });
|
||||||
tileElement->AsSmallScenery()->IncreaseAge(sceneryPos);
|
IncreaseAge(sceneryPos);
|
||||||
return;
|
return;
|
||||||
case TILE_ELEMENT_TYPE_SMALL_SCENERY:
|
case TILE_ELEMENT_TYPE_SMALL_SCENERY:
|
||||||
sceneryEntry = tileElementAbove->AsSmallScenery()->GetEntry();
|
sceneryEntry = tileElementAbove->AsSmallScenery()->GetEntry();
|
||||||
if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_VOFFSET_CENTRE))
|
if (scenery_small_entry_has_flag(sceneryEntry, SMALL_SCENERY_FLAG_VOFFSET_CENTRE))
|
||||||
{
|
{
|
||||||
tileElement->AsSmallScenery()->IncreaseAge(sceneryPos);
|
IncreaseAge(sceneryPos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -156,8 +153,8 @@ void scenery_update_age(const CoordsXY& sceneryPos, TileElement* tileElement)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Reset age / water plant
|
// Reset age / water plant
|
||||||
tileElement->AsSmallScenery()->SetAge(0);
|
SetAge(0);
|
||||||
map_invalidate_tile_zoom1({ sceneryPos, tileElement->GetBaseZ(), tileElement->GetClearanceZ() });
|
map_invalidate_tile_zoom1({ sceneryPos, GetBaseZ(), GetClearanceZ() });
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -278,7 +278,6 @@ extern money32 gClearSceneryCost;
|
||||||
|
|
||||||
void init_scenery();
|
void init_scenery();
|
||||||
void scenery_update_tile(const CoordsXY& sceneryPos);
|
void scenery_update_tile(const CoordsXY& sceneryPos);
|
||||||
void scenery_update_age(const CoordsXY& sceneryPos, TileElement* tileElement);
|
|
||||||
void scenery_set_default_placement_configuration();
|
void scenery_set_default_placement_configuration();
|
||||||
void scenery_remove_ghost_tool_placement();
|
void scenery_remove_ghost_tool_placement();
|
||||||
|
|
||||||
|
|
|
@ -383,6 +383,7 @@ public:
|
||||||
void SetSecondaryColour(colour_t colour);
|
void SetSecondaryColour(colour_t colour);
|
||||||
bool NeedsSupports() const;
|
bool NeedsSupports() const;
|
||||||
void SetNeedsSupports();
|
void SetNeedsSupports();
|
||||||
|
void UpdateAge(const CoordsXY& sceneryPos);
|
||||||
};
|
};
|
||||||
assert_struct_size(SmallSceneryElement, 16);
|
assert_struct_size(SmallSceneryElement, 16);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue