1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-06 06:32:56 +01:00

Make _lastMainViewport use ScreenCoordsXY

This commit is contained in:
Tulio Leao
2020-03-01 10:34:58 -03:00
parent 09fad0ef7f
commit 8b36cce37c
3 changed files with 14 additions and 4 deletions

View File

@@ -242,10 +242,9 @@ void InGameConsole::Update()
rct_viewport* mainViewport = window_get_viewport(mainWindow);
if (mainViewport != nullptr)
{
if (_lastMainViewportX != mainViewport->viewPos.x || _lastMainViewportY != mainViewport->viewPos.y)
if (_lastMainViewport != mainViewport->viewPos)
{
_lastMainViewportX = mainViewport->viewPos.x;
_lastMainViewportY = mainViewport->viewPos.y;
_lastMainViewport = mainViewport->viewPos;
gfx_invalidate_screen();
}

View File

@@ -10,6 +10,7 @@
#pragma once
#include <openrct2/interface/InteractiveConsole.h>
#include <openrct2/world/Location.hpp>
namespace OpenRCT2::Ui
{
@@ -25,7 +26,7 @@ namespace OpenRCT2::Ui
bool _isOpen = false;
int32_t _consoleLeft, _consoleTop, _consoleRight, _consoleBottom;
int32_t _lastMainViewportX, _lastMainViewportY;
ScreenCoordsXY _lastMainViewport;
std::deque<std::string> _consoleLines;
utf8 _consoleCurrentLine[CONSOLE_INPUT_SIZE] = {};
int32_t _consoleCaretTicks;

View File

@@ -72,6 +72,16 @@ struct ScreenCoordsXY
{
return { x + rhs.x, y + rhs.y };
}
bool operator==(const ScreenCoordsXY& other) const
{
return x == other.x && y == other.y;
}
bool operator!=(const ScreenCoordsXY& other) const
{
return !(*this == other);
}
};
/**