forked from rosebudai/OpenRCT2-Web
Remove manual map selection invalidation calls
This commit is contained in:
1 parent
83591cf94e
commit
f3cedcc1d9
22 files changed
-131
No files matched your search
@@ -51,7 +51,6 @@ namespace OpenRCT2::Scripting
|
||||
|
||||
void range_set(DukValue value)
|
||||
{
|
||||
MapInvalidateSelectionRect();
|
||||
if (value.type() == DukValue::Type::OBJECT)
|
||||
{
|
||||
auto range = GetMapRange(value);
|
||||
@@ -69,7 +68,6 @@ namespace OpenRCT2::Scripting
|
||||
{
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable);
|
||||
}
|
||||
MapInvalidateSelectionRect();
|
||||
}
|
||||
|
||||
DukValue tiles_get() const
|
||||
@@ -94,7 +92,6 @@ namespace OpenRCT2::Scripting
|
||||
|
||||
void tiles_set(DukValue value)
|
||||
{
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectionTiles.clear();
|
||||
if (value.is_array())
|
||||
{
|
||||
@@ -124,7 +121,6 @@ namespace OpenRCT2::Scripting
|
||||
{
|
||||
gMapSelectFlags.set(MapSelectFlag::enableConstruct);
|
||||
}
|
||||
MapInvalidateMapSelectionTiles();
|
||||
}
|
||||
|
||||
static void Register(duk_context* ctx)
|
||||
|
||||
@@ -218,7 +218,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
uint8_t state_changed = 0;
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable);
|
||||
|
||||
auto mapTile = ScreenGetMapXY(screenPos, nullptr);
|
||||
@@ -275,7 +274,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
state_changed++;
|
||||
}
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
return state_changed;
|
||||
}
|
||||
|
||||
@@ -347,7 +345,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_BACKGROUND:
|
||||
MapInvalidateSelectionRect();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable);
|
||||
gCurrentToolId = Tool::bulldozer;
|
||||
break;
|
||||
|
||||
@@ -166,8 +166,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void PlaceParkEntranceToolUpdate(const ScreenCoordsXY& screenCoords)
|
||||
{
|
||||
MapInvalidateSelectionRect();
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable, MapSelectFlag::enableArrow, MapSelectFlag::enableConstruct);
|
||||
CoordsXYZD parkEntrancePosition = PlaceParkEntranceGetMapPosition(screenCoords);
|
||||
if (parkEntrancePosition.IsNull())
|
||||
@@ -190,7 +188,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
gMapSelectArrowDirection = parkEntrancePosition.direction;
|
||||
|
||||
gMapSelectFlags.set(MapSelectFlag::enableConstruct, MapSelectFlag::enableArrow);
|
||||
MapInvalidateMapSelectionTiles();
|
||||
if (gParkEntranceGhostExists && parkEntrancePosition == gParkEntranceGhostPosition)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -254,7 +254,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
FootpathUpdateProvisional();
|
||||
ViewportSetVisibility(ViewportVisibility::standard);
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
|
||||
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
@@ -345,7 +344,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
_windowFootpathCost = kMoney64Undefined;
|
||||
ToolCancel();
|
||||
FootpathUpdateProvisional();
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
|
||||
_footpathConstructionMode = PathConstructionMode::dragArea;
|
||||
ToolSet(*this, WIDX_CONSTRUCT_DRAG_AREA, Tool::pathDown);
|
||||
@@ -370,7 +368,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
_windowFootpathCost = kMoney64Undefined;
|
||||
ToolCancel();
|
||||
FootpathUpdateProvisional();
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
|
||||
_footpathConstructionMode = PathConstructionMode::onLand;
|
||||
ToolSet(*this, WIDX_CONSTRUCT_ON_LAND, Tool::pathDown);
|
||||
@@ -395,7 +392,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
_windowFootpathCost = kMoney64Undefined;
|
||||
ToolCancel();
|
||||
FootpathUpdateProvisional();
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
|
||||
_footpathConstructionMode = PathConstructionMode::bridgeOrTunnelPick;
|
||||
ToolSet(*this, WIDX_CONSTRUCT_BRIDGE_OR_TUNNEL, Tool::crosshair);
|
||||
@@ -670,7 +666,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
|
||||
}
|
||||
MapInvalidateTileFull(footpathLoc);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1040,7 +1035,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
*/
|
||||
void WindowFootpathSetProvisionalPathAtPoint(const ScreenCoordsXY& screenCoords)
|
||||
{
|
||||
MapInvalidateSelectionRect();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
|
||||
|
||||
// Get current map pos and handle key modifier state
|
||||
@@ -1107,7 +1101,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void WindowFootpathSetProvisionalPathDragArea(MapRange range, int32_t baseZ)
|
||||
{
|
||||
MapInvalidateSelectionRect();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
|
||||
|
||||
// Check for change
|
||||
@@ -1146,7 +1139,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
int32_t direction;
|
||||
TileElement* tileElement;
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable, MapSelectFlag::enableArrow);
|
||||
|
||||
auto mapCoords = FootpathBridgeGetInfoFromPos(screenCoords, &direction, &tileElement);
|
||||
@@ -1174,8 +1166,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
gMapSelectArrowPosition = CoordsXYZ{ mapCoords, z };
|
||||
gMapSelectArrowDirection = direction;
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
}
|
||||
|
||||
FootpathPlacementResult WindowFootpathGetPlacementFromScreenCoords(const ScreenCoordsXY& screenCoords)
|
||||
@@ -1602,7 +1592,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
if (_footpathConstructionMode == PathConstructionMode::bridgeOrTunnel)
|
||||
{
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags.set(MapSelectFlag::enableConstruct, MapSelectFlag::green);
|
||||
|
||||
int32_t direction = _footpathConstructDirection;
|
||||
@@ -1610,7 +1599,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
gMapSelectionTiles.push_back(
|
||||
{ _footpathConstructFromPosition.x + CoordsDirectionDelta[direction].x,
|
||||
_footpathConstructFromPosition.y + CoordsDirectionDelta[direction].y });
|
||||
MapInvalidateMapSelectionTiles();
|
||||
}
|
||||
|
||||
uint64_t newPressedWidgets = pressedWidgets
|
||||
@@ -2036,7 +2024,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
_provisionalFootpath.flags.unset(ProvisionalPathFlag::showArrow);
|
||||
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
|
||||
MapInvalidateTileFull(_footpathConstructFromPosition);
|
||||
}
|
||||
FootpathRemoveProvisional();
|
||||
}
|
||||
|
||||
@@ -977,8 +977,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (widgetIndex != WIDX_PICKUP)
|
||||
return;
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable);
|
||||
|
||||
auto mapCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, nullptr);
|
||||
@@ -988,7 +986,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
gMapSelectType = MapSelectType::full;
|
||||
gMapSelectPositionA = mapCoords;
|
||||
gMapSelectPositionB = mapCoords;
|
||||
MapInvalidateSelectionRect();
|
||||
}
|
||||
|
||||
gPickupPeepImage = ImageId();
|
||||
|
||||
@@ -444,7 +444,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
uint8_t state_changed = 0;
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable);
|
||||
|
||||
auto mapTile = ScreenGetMapXY(screenPos, nullptr);
|
||||
@@ -501,7 +500,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
state_changed++;
|
||||
}
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
return state_changed;
|
||||
}
|
||||
|
||||
@@ -582,7 +580,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_BACKGROUND:
|
||||
MapInvalidateSelectionRect();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable);
|
||||
gCurrentToolId = Tool::digDown;
|
||||
break;
|
||||
@@ -609,8 +606,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
const bool mapCtrlPressed = GetInputManager().isModifierKeyPressed(ModifierKey::ctrl);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
|
||||
if (gCurrentToolId == Tool::upDownArrow)
|
||||
{
|
||||
if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
|
||||
@@ -700,7 +695,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
state_changed++;
|
||||
}
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
if (!state_changed)
|
||||
return;
|
||||
|
||||
@@ -827,7 +821,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
state_changed++;
|
||||
}
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
if (!state_changed)
|
||||
return;
|
||||
|
||||
|
||||
@@ -459,7 +459,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
MapInvalidateSelectionRect();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable);
|
||||
|
||||
auto info = GetMapCoordinatesFromPos(
|
||||
@@ -529,7 +528,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
state_changed++;
|
||||
}
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
if (!state_changed)
|
||||
return;
|
||||
|
||||
|
||||
@@ -449,7 +449,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
int32_t direction;
|
||||
TileElement* tileElement;
|
||||
MapInvalidateSelectionRect();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable, MapSelectFlag::enableArrow);
|
||||
auto mapCoords = FootpathBridgeGetInfoFromPos(screenCoords, &direction, &tileElement);
|
||||
if (mapCoords.IsNull())
|
||||
@@ -470,7 +469,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
gMapSelectPositionB = mapCoords;
|
||||
gMapSelectArrowPosition = CoordsXYZ{ mapCoords, mapZ };
|
||||
gMapSelectArrowDirection = DirectionReverse(direction);
|
||||
MapInvalidateSelectionRect();
|
||||
}
|
||||
|
||||
void SetPeepSpawnToolDown(const ScreenCoordsXY& screenCoords)
|
||||
|
||||
@@ -118,7 +118,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
RideConstructionInvalidateCurrentTrack();
|
||||
ViewportSetVisibility(ViewportVisibility::standard);
|
||||
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
|
||||
|
||||
@@ -344,8 +343,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
RideConstructionInvalidateCurrentTrack();
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable);
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
|
||||
|
||||
|
||||
@@ -181,15 +181,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
if (stateChanged)
|
||||
{
|
||||
// Invalidate previous area
|
||||
MapInvalidateSelectionRect();
|
||||
|
||||
// Update and invalidate new area
|
||||
gMapSelectFlags.set(MapSelectFlag::enable);
|
||||
gMapSelectType = MapSelectType::full;
|
||||
gMapSelectPositionA = posA;
|
||||
gMapSelectPositionB = posB;
|
||||
MapInvalidateSelectionRect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -286,7 +286,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
RideConstructionInvalidateCurrentTrack();
|
||||
ViewportSetVisibility(ViewportVisibility::standard);
|
||||
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
|
||||
|
||||
@@ -2242,7 +2241,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
int32_t trackDirection;
|
||||
CoordsXYZ trackPos{};
|
||||
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags.set(MapSelectFlag::enableConstruct);
|
||||
gMapSelectFlags.set(MapSelectFlag::green);
|
||||
|
||||
@@ -2274,7 +2272,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (GetRide(_currentRideIndex))
|
||||
{
|
||||
selectMapTiles(trackType, trackDirection, trackPos);
|
||||
MapInvalidateMapSelectionTiles();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2653,7 +2650,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
void ToolDownEntranceExit(const ScreenCoordsXY& screenCoords)
|
||||
{
|
||||
RideConstructionInvalidateCurrentTrack();
|
||||
MapInvalidateSelectionRect();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable);
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
|
||||
|
||||
@@ -3288,7 +3284,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
|
||||
if (_currentTrackSelectionFlags.has(TrackSelectionFlag::arrow))
|
||||
gMapSelectFlags.set(MapSelectFlag::enableArrow);
|
||||
MapInvalidateTileFull(_currentTrackBegin);
|
||||
break;
|
||||
}
|
||||
case RideConstructionState::Selected:
|
||||
@@ -3338,7 +3333,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
|
||||
if (_currentTrackSelectionFlags.has(TrackSelectionFlag::arrow))
|
||||
gMapSelectFlags.set(MapSelectFlag::enableArrow);
|
||||
MapInvalidateTileFull(trackPos);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
@@ -3354,7 +3348,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
int32_t z;
|
||||
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable);
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
|
||||
@@ -3362,7 +3355,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (!mapCoords)
|
||||
{
|
||||
RideConstructionInvalidateCurrentTrack();
|
||||
MapInvalidateMapSelectionTiles();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3386,7 +3378,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
&trackType, &trackDirection, &rideIndex, &liftHillAndAlternativeState, nullptr, nullptr))
|
||||
{
|
||||
RideConstructionInvalidateCurrentTrack();
|
||||
MapInvalidateMapSelectionTiles();
|
||||
return;
|
||||
}
|
||||
_currentTrackPieceType = trackType;
|
||||
@@ -3446,7 +3437,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
_currentTrackBegin.z = z;
|
||||
if (_currentTrackSelectionFlags.has(TrackSelectionFlag::track) && _currentTrackBegin == _previousTrackPiece)
|
||||
{
|
||||
MapInvalidateMapSelectionTiles();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3475,7 +3465,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_MAZE_CONSTRUCTION);
|
||||
ContextBroadcastIntent(&intent);
|
||||
MapInvalidateMapSelectionTiles();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3564,7 +3553,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
|
||||
WindowRideConstructionUpdateActiveElements();
|
||||
MapInvalidateMapSelectionTiles();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -3573,8 +3561,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
*/
|
||||
void RideConstructionToolupdateEntranceExit(const ScreenCoordsXY& screenCoords)
|
||||
{
|
||||
MapInvalidateSelectionRect();
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable);
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
|
||||
@@ -3591,7 +3577,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
gMapSelectPositionB = entranceOrExitCoords;
|
||||
gMapSelectArrowPosition = entranceOrExitCoords;
|
||||
gMapSelectArrowDirection = DirectionReverse(entranceOrExitCoords.direction);
|
||||
MapInvalidateSelectionRect();
|
||||
|
||||
entranceOrExitCoords.direction = DirectionReverse(gRideEntranceExitPlaceDirection);
|
||||
StationIndex stationNum = gRideEntranceExitPlaceStationIndex;
|
||||
@@ -3619,7 +3604,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
WindowBase* w;
|
||||
|
||||
MapInvalidateMapSelectionTiles();
|
||||
RideConstructionInvalidateCurrentTrack();
|
||||
|
||||
CoordsXYZ mapCoords{};
|
||||
|
||||
@@ -1761,8 +1761,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
gMapSelectType = getMapSelectQuarter((quadrant ^ 2));
|
||||
}
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
|
||||
// If no change in ghost placement
|
||||
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_0) && mapTile == gSceneryGhostPosition && quadrant == _unkF64F0E
|
||||
&& gSceneryPlaceZ == _unkF64F0A && gSceneryPlaceObject.SceneryType == SCENERY_TYPE_SMALL
|
||||
@@ -1817,8 +1815,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
gMapSelectPositionB.y = mapTile.y;
|
||||
gMapSelectType = MapSelectType::full;
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
|
||||
// If no change in ghost placement
|
||||
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_1) && mapTile == gSceneryGhostPosition && z == gSceneryGhostPosition.z)
|
||||
{
|
||||
@@ -1856,8 +1852,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
setMapSelectRange(mapTile);
|
||||
gMapSelectType = getMapSelectEdge(edge);
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
|
||||
// If no change in ghost placement
|
||||
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_2) && mapTile == gSceneryGhostPosition
|
||||
&& edge == gSceneryGhostWallRotation && gSceneryPlaceZ == _unkF64F0A)
|
||||
@@ -1919,7 +1913,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
|
||||
gMapSelectFlags.set(MapSelectFlag::enableConstruct);
|
||||
MapInvalidateMapSelectionTiles();
|
||||
|
||||
// If no change in ghost placement
|
||||
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_3) && mapTile == gSceneryGhostPosition && gSceneryPlaceZ == _unkF64F0A
|
||||
@@ -1977,8 +1970,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
gMapSelectPositionB.y = mapTile.y;
|
||||
gMapSelectType = MapSelectType::full;
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
|
||||
// If no change in ghost placement
|
||||
if ((gSceneryGhostType & SCENERY_GHOST_FLAG_4) && mapTile == gSceneryGhostPosition && z == gSceneryGhostPosition.z
|
||||
&& direction == gSceneryPlaceRotation)
|
||||
@@ -1999,9 +1990,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
*/
|
||||
void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenPos) override
|
||||
{
|
||||
MapInvalidateSelectionRect();
|
||||
MapInvalidateMapSelectionTiles();
|
||||
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable);
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
|
||||
|
||||
|
||||
@@ -668,8 +668,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (widgetIndex != WIDX_PICKUP)
|
||||
return;
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable);
|
||||
|
||||
auto mapCoords = FootpathGetCoordinatesFromPos({ screenCoords.x, screenCoords.y + 16 }, nullptr, nullptr);
|
||||
@@ -679,7 +677,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
gMapSelectType = MapSelectType::full;
|
||||
gMapSelectPositionA = mapCoords;
|
||||
gMapSelectPositionB = mapCoords;
|
||||
MapInvalidateSelectionRect();
|
||||
}
|
||||
|
||||
gPickupPeepImage = ImageId();
|
||||
|
||||
@@ -969,7 +969,6 @@ static uint64_t PageDisabledWidgets[] = {
|
||||
|
||||
void onToolUpdate(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
MapInvalidateSelectionRect();
|
||||
gMapSelectFlags.set(MapSelectFlag::enable);
|
||||
|
||||
CoordsXY mapCoords;
|
||||
@@ -999,7 +998,6 @@ static uint64_t PageDisabledWidgets[] = {
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable);
|
||||
|
||||
gMapSelectType = MapSelectType::full;
|
||||
MapInvalidateSelectionRect();
|
||||
}
|
||||
|
||||
void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override
|
||||
|
||||
@@ -121,7 +121,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
ClearProvisional();
|
||||
ViewportSetVisibility(ViewportVisibility::standard);
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
|
||||
HideGridlines();
|
||||
@@ -172,7 +171,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
TrackDesignState tds{};
|
||||
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable);
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
|
||||
@@ -256,7 +254,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
void onToolDown(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
ClearProvisional();
|
||||
MapInvalidateMapSelectionTiles();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable);
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableConstruct);
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
|
||||
|
||||
@@ -248,14 +248,12 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto mapCoords = ScreenPosToMapPos(screenCoords, &direction);
|
||||
if (mapCoords)
|
||||
{
|
||||
MapInvalidateSelectionRect();
|
||||
gMapSelectFlags.set(MapSelectFlag::enable);
|
||||
gMapSelectPositionA.x = std::min(_selectionStart.x, mapCoords->x);
|
||||
gMapSelectPositionB.x = std::max(_selectionStart.x, mapCoords->x);
|
||||
gMapSelectPositionA.y = std::min(_selectionStart.y, mapCoords->y);
|
||||
gMapSelectPositionB.y = std::max(_selectionStart.y, mapCoords->y);
|
||||
gMapSelectType = MapSelectType::full;
|
||||
MapInvalidateSelectionRect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -224,7 +224,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_BACKGROUND:
|
||||
MapInvalidateSelectionRect();
|
||||
gMapSelectFlags.unset(MapSelectFlag::enable);
|
||||
gCurrentToolId = Tool::waterDown;
|
||||
break;
|
||||
@@ -295,8 +294,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
*/
|
||||
void ToolUpdateWater(const ScreenCoordsXY& screenPos)
|
||||
{
|
||||
MapInvalidateSelectionRect();
|
||||
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
auto& gameState = getGameState();
|
||||
|
||||
@@ -392,7 +389,6 @@ namespace OpenRCT2::Ui::Windows
|
||||
state_changed++;
|
||||
}
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
if (!state_changed)
|
||||
return;
|
||||
|
||||
|
||||
@@ -696,9 +696,6 @@ static constexpr float kWindowScrollLocations[][2] = {
|
||||
{
|
||||
gInputFlags.unset(InputFlag::toolActive);
|
||||
|
||||
MapInvalidateSelectionRect();
|
||||
MapInvalidateMapSelectionTiles();
|
||||
|
||||
// Reset map selection
|
||||
gMapSelectFlags.clearAll();
|
||||
|
||||
|
||||
@@ -533,7 +533,6 @@ void RideConstructionInvalidateCurrentTrack()
|
||||
{
|
||||
_currentTrackSelectionFlags.unset(TrackSelectionFlag::arrow);
|
||||
gMapSelectFlags.unset(MapSelectFlag::enableArrow);
|
||||
MapInvalidateTileFull(_currentTrackBegin);
|
||||
}
|
||||
RideConstructionRemoveGhosts();
|
||||
break;
|
||||
|
||||
@@ -1816,7 +1816,6 @@ static GameActions::Result TrackDesignPlaceVirtual(
|
||||
gMapSelectFlags.set(MapSelectFlag::enableConstruct);
|
||||
gMapSelectFlags.set(MapSelectFlag::enableArrow);
|
||||
gMapSelectFlags.unset(MapSelectFlag::green);
|
||||
MapInvalidateMapSelectionTiles();
|
||||
}
|
||||
|
||||
auto res = GameActions::Result();
|
||||
|
||||
@@ -21,43 +21,6 @@ uint8_t gMapSelectArrowDirection;
|
||||
|
||||
std::vector<CoordsXY> gMapSelectionTiles;
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0068AB1B
|
||||
*/
|
||||
void MapInvalidateMapSelectionTiles()
|
||||
{
|
||||
if (!(gMapSelectFlags.has(MapSelectFlag::enableConstruct)))
|
||||
return;
|
||||
|
||||
for (const auto& position : gMapSelectionTiles)
|
||||
MapInvalidateTileFull(position);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x0068AAE1
|
||||
*/
|
||||
void MapInvalidateSelectionRect()
|
||||
{
|
||||
int32_t x0, y0, x1, y1, left, right, top, bottom;
|
||||
|
||||
if (!(gMapSelectFlags.has(MapSelectFlag::enable)))
|
||||
return;
|
||||
|
||||
x0 = gMapSelectPositionA.x + 16;
|
||||
y0 = gMapSelectPositionA.y + 16;
|
||||
x1 = gMapSelectPositionB.x + 16;
|
||||
y1 = gMapSelectPositionB.y + 16;
|
||||
MapGetBoundingBox({ x0, y0, x1, y1 }, &left, &top, &right, &bottom);
|
||||
left -= 32;
|
||||
right += 32;
|
||||
bottom += 32;
|
||||
top -= 32 + 2080;
|
||||
|
||||
OpenRCT2::ViewportsInvalidate({ { left, top }, { right, bottom } });
|
||||
}
|
||||
|
||||
MapRange getMapSelectRange()
|
||||
{
|
||||
return MapRange(gMapSelectPositionA, gMapSelectPositionB);
|
||||
|
||||
@@ -63,8 +63,6 @@ extern uint8_t gMapSelectArrowDirection;
|
||||
|
||||
extern std::vector<CoordsXY> gMapSelectionTiles;
|
||||
|
||||
void MapInvalidateMapSelectionTiles();
|
||||
void MapInvalidateSelectionRect();
|
||||
MapRange getMapSelectRange();
|
||||
void setMapSelectRange(const MapRange& range);
|
||||
void setMapSelectRange(const CoordsXY coords);
|
||||
Reference in new issue
Block a user