mirror of
https://github.com/OpenRCT2/OpenRCT2.git
synced 2025-01-22 02:11:57 -05:00
Merge branch 'develop' into develop
This commit is contained in:
commit
0310084c04
324 changed files with 3886 additions and 3489 deletions
|
@ -2169,7 +2169,6 @@ STR_3136 :Averto: Ĉi tiu desegnaĵo estos konstruita per alternativa tipo de
|
|||
STR_3137 :Elekti Proksiman Pejzaĝon
|
||||
STR_3138 :Vakigi Elektaĵon
|
||||
STR_3139 :Kablolifto ne funkciiĝas kun ĉi tiu reĝimo de funkciado
|
||||
STR_3140 :Kablolifto-monteto devas komenci tuj post stacio
|
||||
STR_3141 :Reĝimo de multaj cirkvitoj ne eblas kun kablolifto-monteto
|
||||
STR_3142 :{WINDOW_COLOUR_2}Kapacito: {BLACK}{STRINGID}
|
||||
STR_3143 :Montri homojn sur mapo
|
||||
|
@ -2201,7 +2200,7 @@ STR_3188 :Trotuaro-Surskribaĵoj
|
|||
STR_3189 :Heredaĵaj trotuaroj
|
||||
STR_3190 :Trotuaro-Diversaĵoj
|
||||
STR_3191 :Pejzaĝo-Grupoj
|
||||
STR_3192 :Parkeniro
|
||||
STR_3192 :Parkeniroj
|
||||
STR_3193 :Akvo
|
||||
STR_3195 :Listo da Inventaĵoj
|
||||
STR_3196 :{WINDOW_COLOUR_2}Inventaĵo-Kategorio: {BLACK}{STRINGID}
|
||||
|
@ -2606,7 +2605,7 @@ STR_5368 :Restarigi staton de akcidentoj
|
|||
STR_5371 :Elektado de objektoj
|
||||
STR_5372 :Inversigi trenadon per dekstra musobutono
|
||||
STR_5373 :Nomo {STRINGID}
|
||||
STR_5374 :Dato {STRINGID}
|
||||
STR_5374 :Dato modifita {STRINGID}
|
||||
STR_5375 :▲
|
||||
STR_5376 :▼
|
||||
STR_5404 :Nomo jam ekzistas
|
||||
|
@ -3736,8 +3735,8 @@ STR_6671 :Montri ‘faktajn’ nomojn de dungitaro
|
|||
STR_6672 :Baskuligi inter montrado de ‘faktaj’ dungitonomoj kaj dungitonumeroj
|
||||
STR_6673 :Travidebla
|
||||
STR_6674 :{MONTH}, Jaro {COMMA16}
|
||||
STR_6675 :Nomoj de Gastoj
|
||||
STR_6676 :Almenaŭ unu objecto de gastonomo elektendas
|
||||
STR_6675 :Nomoj de Hometoj
|
||||
STR_6676 :Almenaŭ unu objecto de hometonomo elektendas
|
||||
STR_6677 :Aldoni strandojn ĉirkaŭ amasoj de akvo
|
||||
STR_6678 :Fonto de altmapo:
|
||||
STR_6679 :Ebenaĵo
|
||||
|
@ -3774,3 +3773,20 @@ STR_6709 :Entajpu glatan fortecon inter {COMMA16} kaj {COMMA16}
|
|||
STR_6710 :Stabila ordigo
|
||||
STR_6711 :Dosiernomo:
|
||||
STR_6712 :Konservi
|
||||
STR_6713 :{COMMA32} {STRINGID}
|
||||
STR_6714 :Dosiernomo
|
||||
STR_6715 :Dato modifita
|
||||
STR_6716 :Dosiergrando
|
||||
STR_6717 :Dosiergrando {STRINGID}
|
||||
STR_6718 :Animacioj de Hometoj
|
||||
STR_6719 :Almenaŭ unu animacio-objekto de gasto elektendas
|
||||
STR_6720 :Almenaŭ unu animacio-objekto de faktoto elektendas
|
||||
STR_6721 :Almenaŭ unu animacio-objekto de mekanikisto elektendas
|
||||
STR_6722 :Almenaŭ unu animacio-objekto de gardisto elektendas
|
||||
STR_6723 :Almenaŭ unu animacio-objekto de amuzisto elektendas
|
||||
STR_6724 :Scenaro-Tekstoj
|
||||
STR_6725 :X:
|
||||
STR_6726 :Y:
|
||||
STR_6727 :Plonĝlopo (maldekstre)
|
||||
STR_6728 :Plonĝlopo (dekstre)
|
||||
STR_6729 :Kablolifto-monteto devas komenci tuj post stacio aŭ bremso de blokparto
|
||||
|
|
|
@ -2173,7 +2173,6 @@ STR_3136 :경고: 다른 차량 종류로 대체되어 지어질 것이며
|
|||
STR_3137 :근처 조형물 선택
|
||||
STR_3138 :선택 초기화
|
||||
STR_3139 :이 운행 모드에서는 케이블 리프트 힐을 작동할 수 없습니다
|
||||
STR_3140 :케이블 리프트 힐은 탑승장 바로 다음에 건설해야 합니다
|
||||
STR_3141 :케이블 리프트 힐을 사용하면 2바퀴 이상 차량을 운용할 수 없습니다
|
||||
STR_3142 :{WINDOW_COLOUR_2}수용량: {BLACK}{STRINGID}
|
||||
STR_3143 :손님을 지도에 표시합니다
|
||||
|
@ -3791,3 +3790,6 @@ STR_6723 :최소 하나 이상의 엔터테이너 애니메이션 오브젝
|
|||
STR_6724 :시나리오 텍스트
|
||||
STR_6725 :X:
|
||||
STR_6726 :Y:
|
||||
STR_6727 :다이브 루프 (왼쪽)
|
||||
STR_6728 :다이브 루프 (오른쪽)
|
||||
STR_6729 :케이블 리프트 힐은 탑승장이나 블록 브레이크 바로 다음에 건설해야 합니다
|
||||
|
|
|
@ -2169,7 +2169,6 @@ STR_3136 :Uwaga: Ten projekt trasy będzie wybudowany z alternatywnymi wagona
|
|||
STR_3137 :Wybierz najbliższą scenerię
|
||||
STR_3138 :Zresetuj wybór
|
||||
STR_3139 :Wyciągarka nie może działać w tym trybie
|
||||
STR_3140 :Wyciągarka musi znajdować się na początku trasy
|
||||
STR_3141 :Wielokrotne pętle nie są dostępne w parze z wyciągarką
|
||||
STR_3142 :{WINDOW_COLOUR_2}Pojemność: {BLACK}{STRINGID}
|
||||
STR_3143 :Pokaż ludzi
|
||||
|
@ -3788,3 +3787,6 @@ STR_6723 :Należy wybrać co najmniej jeden obiekt animacji komika
|
|||
STR_6724 :Teksty scenariuszy
|
||||
STR_6725 :X:
|
||||
STR_6726 :Y:
|
||||
STR_6727 :Pętla nurkująca (w lewo)
|
||||
STR_6728 :Pętla nurkująca (w prawo)
|
||||
STR_6729 :Wyciągarka linowa musi znajdować się bezpośrednio po stacji lub hamulcu blokowym
|
||||
|
|
|
@ -2169,7 +2169,6 @@ STR_3136 :Aviso: Este projeto será construído com um tipo alternativo de ve
|
|||
STR_3137 :Selecionar Cenários Próximos
|
||||
STR_3138 :Reiniciar Seleção
|
||||
STR_3139 :Cabo de elevação não funciona neste modo de operação
|
||||
STR_3140 :Cabo de elevação deve estar imediatamente após a estação
|
||||
STR_3141 :Várias voltas por ingresso não são possíveis com o cabo de elevação
|
||||
STR_3142 :{WINDOW_COLOUR_2}Capacidade: {BLACK}{STRINGID}
|
||||
STR_3143 :Mostrar pessoas no mapa
|
||||
|
@ -3788,3 +3787,6 @@ STR_6723 :Ao menos um objeto de animação de pessoinha de animador deve ser
|
|||
STR_6724 :Textos dos Cenários
|
||||
STR_6725 :X:
|
||||
STR_6726 :Y:
|
||||
STR_6727 :Loop em mergulho (esquerda)
|
||||
STR_6728 :Loop em mergulho (direita)
|
||||
STR_6729 :Cabo de elevação deve estar imediatamente após a estação ou freio bloqueador
|
||||
|
|
|
@ -3776,3 +3776,5 @@ STR_6724 :Тексты сценариев
|
|||
STR_6725 :X:
|
||||
STR_6726 :Y:
|
||||
STR_6729 :Кабельный лифт должен начинаться сразу после станции или блок-тормоза
|
||||
STR_6727 :Петля со спуском (левая)
|
||||
STR_6728 :Петля со спуском (правая)
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
|
||||
namespace OpenRCT2::Ui
|
||||
{
|
||||
constexpr char rawTransparent = ' ';
|
||||
constexpr char rawWhite = '.';
|
||||
constexpr char rawBlack = 'X';
|
||||
constexpr char kRawTransparent = ' ';
|
||||
constexpr char kRawWhite = '.';
|
||||
constexpr char kRawBlack = 'X';
|
||||
|
||||
constexpr static CursorData cursorFromBitMap(int x, int y, std::string_view bitmap)
|
||||
{
|
||||
|
@ -35,15 +35,15 @@ namespace OpenRCT2::Ui
|
|||
uint8_t dataBit{}, maskBit{};
|
||||
switch (rawPixel)
|
||||
{
|
||||
case rawBlack:
|
||||
case kRawBlack:
|
||||
dataBit = 1;
|
||||
maskBit = 1;
|
||||
break;
|
||||
case rawWhite:
|
||||
case kRawWhite:
|
||||
dataBit = 0;
|
||||
maskBit = 1;
|
||||
break;
|
||||
case rawTransparent:
|
||||
case kRawTransparent:
|
||||
dataBit = 0;
|
||||
maskBit = 0;
|
||||
break;
|
||||
|
@ -947,7 +947,7 @@ namespace OpenRCT2::Ui
|
|||
" X.X "
|
||||
" X ");
|
||||
|
||||
static constexpr const CursorData* RawCursorData[] = {
|
||||
static constexpr const CursorData* kRawCursorData[] = {
|
||||
nullptr, // CursorID::Arrow
|
||||
&kBlankCursorData, // CursorID::Blank
|
||||
&kUpArrowCursorData, // CursorID::UpArrow
|
||||
|
@ -983,7 +983,7 @@ namespace OpenRCT2::Ui
|
|||
const CursorData* result = nullptr;
|
||||
if (cursorId != CursorID::Undefined && cursorId != CursorID::Count)
|
||||
{
|
||||
result = RawCursorData[EnumValue(cursorId)];
|
||||
result = kRawCursorData[EnumValue(cursorId)];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include "ProvisionalElements.h"
|
||||
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/interface/Window.h>
|
||||
#include <openrct2/interface/WindowClasses.h>
|
||||
|
@ -30,7 +30,7 @@ namespace OpenRCT2::Ui
|
|||
|
||||
FootpathRemoveProvisionalTemporarily();
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByClass(WindowClass::RideConstruction) != nullptr)
|
||||
{
|
||||
RideRemoveProvisionalTrackPiece();
|
||||
|
@ -50,7 +50,7 @@ namespace OpenRCT2::Ui
|
|||
|
||||
FootpathRestoreProvisional();
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByClass(WindowClass::RideConstruction) != nullptr)
|
||||
{
|
||||
RideRestoreProvisionalTrackPiece();
|
||||
|
|
|
@ -12,9 +12,10 @@
|
|||
#include "UiContext.h"
|
||||
#include "UiStringIds.h"
|
||||
#include "interface/InGameConsole.h"
|
||||
#include "interface/Window.h"
|
||||
|
||||
#include <SDL.h>
|
||||
#include <openrct2-ui/interface/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/core/Memory.hpp>
|
||||
#include <openrct2/core/String.hpp>
|
||||
#include <openrct2/core/UTF8.h>
|
||||
|
@ -171,7 +172,7 @@ void TextComposition::HandleMessage(const SDL_Event* e)
|
|||
if ((modifier & KEYBOARD_PRIMARY_MODIFIER) && _session.Length)
|
||||
{
|
||||
OpenRCT2::GetContext()->GetUiContext()->SetClipboardText(_session.Buffer->c_str());
|
||||
ContextShowError(STR_COPY_INPUT_TO_CLIPBOARD, STR_NONE, {});
|
||||
ContextShowError(STR_COPY_INPUT_TO_CLIPBOARD, kStringIdNone, {});
|
||||
}
|
||||
break;
|
||||
case SDLK_v:
|
||||
|
|
|
@ -68,7 +68,7 @@ using namespace OpenRCT2::Ui;
|
|||
class UiContext final : public IUiContext
|
||||
{
|
||||
private:
|
||||
constexpr static uint32_t TOUCH_DOUBLE_TIMEOUT = 300;
|
||||
constexpr static uint32_t kTouchDoubleTimeout = 300;
|
||||
|
||||
const std::unique_ptr<IPlatformUiContext> _platformUiContext;
|
||||
const std::unique_ptr<IWindowManager> _windowManager;
|
||||
|
@ -181,12 +181,12 @@ public:
|
|||
|
||||
void SetFullscreenMode(FULLSCREEN_MODE mode) override
|
||||
{
|
||||
static constexpr int32_t _sdlFullscreenFlags[] = {
|
||||
static constexpr int32_t kSDLFullscreenFlags[] = {
|
||||
0,
|
||||
SDL_WINDOW_FULLSCREEN,
|
||||
SDL_WINDOW_FULLSCREEN_DESKTOP,
|
||||
};
|
||||
uint32_t windowFlags = _sdlFullscreenFlags[EnumValue(mode)];
|
||||
uint32_t windowFlags = kSDLFullscreenFlags[EnumValue(mode)];
|
||||
|
||||
// HACK Changing window size when in fullscreen usually has no effect
|
||||
if (mode == FULLSCREEN_MODE::FULLSCREEN)
|
||||
|
@ -480,7 +480,7 @@ public:
|
|||
|
||||
_cursorState.touchIsDouble
|
||||
= (!_cursorState.touchIsDouble
|
||||
&& e.tfinger.timestamp - _cursorState.touchDownTimestamp < TOUCH_DOUBLE_TIMEOUT);
|
||||
&& e.tfinger.timestamp - _cursorState.touchDownTimestamp < kTouchDoubleTimeout);
|
||||
|
||||
if (_cursorState.touchIsDouble)
|
||||
{
|
||||
|
|
|
@ -10,16 +10,20 @@
|
|||
#include "WindowManager.h"
|
||||
|
||||
#include "interface/Theme.h"
|
||||
#include "interface/Window.h"
|
||||
#include "ride/VehicleSounds.h"
|
||||
#include "windows/Window.h"
|
||||
#include "windows/Windows.h"
|
||||
|
||||
#include <openrct2-ui/ProvisionalElements.h>
|
||||
#include <openrct2-ui/UiContext.h>
|
||||
#include <openrct2-ui/input/InputManager.h>
|
||||
#include <openrct2-ui/input/MouseInput.h>
|
||||
#include <openrct2-ui/input/ShortcutManager.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/Input.h>
|
||||
#include <openrct2/OpenRCT2.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/core/Console.hpp>
|
||||
#include <openrct2/core/Guard.hpp>
|
||||
|
@ -30,12 +34,19 @@
|
|||
#include <openrct2/ride/Ride.h>
|
||||
#include <openrct2/ride/RideConstruction.h>
|
||||
#include <openrct2/ride/Vehicle.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
using namespace OpenRCT2;
|
||||
using namespace OpenRCT2::Ui;
|
||||
using namespace OpenRCT2::Ui::Windows;
|
||||
|
||||
namespace WindowCloseFlags
|
||||
{
|
||||
static constexpr uint32_t None = 0;
|
||||
static constexpr uint32_t CloseSingle = (1 << 0);
|
||||
} // namespace WindowCloseFlags
|
||||
|
||||
class WindowManager final : public IWindowManager
|
||||
{
|
||||
public:
|
||||
|
@ -323,7 +334,7 @@ public:
|
|||
case INTENT_ACTION_NEW_SCENERY:
|
||||
{
|
||||
// Check if window is already open
|
||||
auto* window = WindowBringToFrontByClass(WindowClass::Scenery);
|
||||
auto* window = BringToFrontByClass(WindowClass::Scenery);
|
||||
if (window == nullptr)
|
||||
ToggleSceneryWindow();
|
||||
|
||||
|
@ -422,7 +433,7 @@ public:
|
|||
auto w = FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr || w->number != static_cast<int16_t>(rideIndex))
|
||||
{
|
||||
WindowCloseConstructionWindows();
|
||||
CloseConstructionWindows();
|
||||
_currentRideIndex = RideId::FromUnderlying(rideIndex);
|
||||
OpenWindow(WindowClass::RideConstruction);
|
||||
}
|
||||
|
@ -647,6 +658,437 @@ public:
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
static bool WindowFitsBetweenOthers(const ScreenCoordsXY& loc, int32_t width, int32_t height)
|
||||
{
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
if (w->flags & WF_STICK_TO_BACK)
|
||||
continue;
|
||||
|
||||
if (loc.x + width <= w->windowPos.x)
|
||||
continue;
|
||||
if (loc.x >= w->windowPos.x + w->width)
|
||||
continue;
|
||||
if (loc.y + height <= w->windowPos.y)
|
||||
continue;
|
||||
if (loc.y >= w->windowPos.y + w->height)
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool WindowFitsWithinSpace(const ScreenCoordsXY& loc, int32_t width, int32_t height)
|
||||
{
|
||||
if (loc.x < 0)
|
||||
return false;
|
||||
if (loc.y <= kTopToolbarHeight && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
||||
return false;
|
||||
if (loc.x + width > ContextGetWidth())
|
||||
return false;
|
||||
if (loc.y + height > ContextGetHeight())
|
||||
return false;
|
||||
return WindowFitsBetweenOthers(loc, width, height);
|
||||
}
|
||||
|
||||
static bool WindowFitsOnScreen(const ScreenCoordsXY& loc, int32_t width, int32_t height)
|
||||
{
|
||||
uint16_t screenWidth = ContextGetWidth();
|
||||
uint16_t screenHeight = ContextGetHeight();
|
||||
int32_t unk;
|
||||
|
||||
unk = -(width / 4);
|
||||
if (loc.x < unk)
|
||||
return false;
|
||||
unk = screenWidth + (unk * 2);
|
||||
if (loc.x > unk)
|
||||
return false;
|
||||
if (loc.y <= kTopToolbarHeight && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
||||
return false;
|
||||
unk = screenHeight - (height / 4);
|
||||
if (loc.y > unk)
|
||||
return false;
|
||||
return WindowFitsBetweenOthers(loc, width, height);
|
||||
}
|
||||
|
||||
static ScreenCoordsXY ClampWindowToScreen(
|
||||
const ScreenCoordsXY& pos, const int32_t screenWidth, const int32_t screenHeight, const int32_t width,
|
||||
const int32_t height)
|
||||
{
|
||||
auto screenPos = pos;
|
||||
if (width > screenWidth || screenPos.x < 0)
|
||||
screenPos.x = 0;
|
||||
else if (screenPos.x + width > screenWidth)
|
||||
screenPos.x = screenWidth - width;
|
||||
|
||||
auto toolbarAllowance = (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) ? 0 : (kTopToolbarHeight + 1);
|
||||
if (height - toolbarAllowance > screenHeight || screenPos.y < toolbarAllowance)
|
||||
screenPos.y = toolbarAllowance;
|
||||
else if (screenPos.y + height - toolbarAllowance > screenHeight)
|
||||
screenPos.y = screenHeight + toolbarAllowance - height;
|
||||
|
||||
return screenPos;
|
||||
}
|
||||
|
||||
static ScreenCoordsXY GetAutoPositionForNewWindow(int32_t width, int32_t height)
|
||||
{
|
||||
auto uiContext = GetContext()->GetUiContext();
|
||||
auto screenWidth = uiContext->GetWidth();
|
||||
auto screenHeight = uiContext->GetHeight();
|
||||
|
||||
// Place window in an empty corner of the screen
|
||||
const ScreenCoordsXY cornerPositions[] = {
|
||||
{ 0, 30 }, // topLeft
|
||||
{ screenWidth - width, 30 }, // topRight
|
||||
{ 0, screenHeight - 34 - height }, // bottomLeft
|
||||
{ screenWidth - width, screenHeight - 34 - height }, // bottomRight
|
||||
};
|
||||
|
||||
for (const auto& cornerPos : cornerPositions)
|
||||
{
|
||||
if (WindowFitsWithinSpace(cornerPos, width, height))
|
||||
{
|
||||
return ClampWindowToScreen(cornerPos, screenWidth, screenHeight, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
// Place window next to another
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
if (w->flags & WF_STICK_TO_BACK)
|
||||
continue;
|
||||
|
||||
const ScreenCoordsXY offsets[] = {
|
||||
{ w->width + 2, 0 },
|
||||
{ -w->width - 2, 0 },
|
||||
{ 0, w->height + 2 },
|
||||
{ 0, -w->height - 2 },
|
||||
{ w->width + 2, -w->height - 2 },
|
||||
{ -w->width - 2, -w->height - 2 },
|
||||
{ w->width + 2, w->height + 2 },
|
||||
{ -w->width - 2, w->height + 2 },
|
||||
};
|
||||
|
||||
for (const auto& offset : offsets)
|
||||
{
|
||||
auto screenPos = w->windowPos + offset;
|
||||
if (WindowFitsWithinSpace(screenPos, width, height))
|
||||
{
|
||||
return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Overlap
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
if (w->flags & WF_STICK_TO_BACK)
|
||||
continue;
|
||||
|
||||
const ScreenCoordsXY offsets[] = {
|
||||
{ w->width + 2, 0 },
|
||||
{ -w->width - 2, 0 },
|
||||
{ 0, w->height + 2 },
|
||||
{ 0, -w->height - 2 },
|
||||
};
|
||||
|
||||
for (const auto& offset : offsets)
|
||||
{
|
||||
auto screenPos = w->windowPos + offset;
|
||||
if (WindowFitsOnScreen(screenPos, width, height))
|
||||
{
|
||||
return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cascade
|
||||
auto screenPos = ScreenCoordsXY{ 0, 30 };
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (screenPos == w->windowPos)
|
||||
{
|
||||
screenPos.x += 5;
|
||||
screenPos.y += 5;
|
||||
}
|
||||
}
|
||||
|
||||
return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
|
||||
}
|
||||
|
||||
static ScreenCoordsXY GetCentrePositionForNewWindow(int32_t width, int32_t height)
|
||||
{
|
||||
auto uiContext = GetContext()->GetUiContext();
|
||||
auto screenWidth = uiContext->GetWidth();
|
||||
auto screenHeight = uiContext->GetHeight();
|
||||
return ScreenCoordsXY{ (screenWidth - width) / 2, std::max(kTopToolbarHeight + 1, (screenHeight - height) / 2) };
|
||||
}
|
||||
|
||||
WindowBase* Create(
|
||||
std::unique_ptr<WindowBase>&& wp, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height,
|
||||
uint32_t flags) override
|
||||
{
|
||||
if (flags & WF_AUTO_POSITION)
|
||||
{
|
||||
if (flags & WF_CENTRE_SCREEN)
|
||||
{
|
||||
pos = GetCentrePositionForNewWindow(width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = GetAutoPositionForNewWindow(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if there are any window slots left
|
||||
// include kWindowLimitReserved for items such as the main viewport and toolbars to not appear to be counted.
|
||||
if (g_window_list.size() >= static_cast<size_t>(Config::Get().general.WindowLimit + kWindowLimitReserved))
|
||||
{
|
||||
// Close least recently used window
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT | WF_NO_AUTO_CLOSE)))
|
||||
{
|
||||
Close(*w.get());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find right position to insert new window
|
||||
auto itDestPos = g_window_list.end();
|
||||
if (flags & WF_STICK_TO_BACK)
|
||||
{
|
||||
for (auto it = g_window_list.begin(); it != g_window_list.end(); it++)
|
||||
{
|
||||
if ((*it)->flags & WF_DEAD)
|
||||
continue;
|
||||
if (!((*it)->flags & WF_STICK_TO_BACK))
|
||||
{
|
||||
itDestPos = it;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!(flags & WF_STICK_TO_FRONT))
|
||||
{
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
|
||||
{
|
||||
if ((*it)->flags & WF_DEAD)
|
||||
continue;
|
||||
if (!((*it)->flags & WF_STICK_TO_FRONT))
|
||||
{
|
||||
itDestPos = it.base();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto itNew = g_window_list.insert(itDestPos, std::move(wp));
|
||||
auto w = itNew->get();
|
||||
|
||||
// Setup window
|
||||
w->classification = cls;
|
||||
w->flags = flags;
|
||||
|
||||
// Play sounds and flash the window
|
||||
if (!(flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)))
|
||||
{
|
||||
w->flags |= WF_WHITE_BORDER_MASK;
|
||||
OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::WindowOpen, 0, pos.x + (width / 2));
|
||||
}
|
||||
|
||||
w->windowPos = pos;
|
||||
w->width = width;
|
||||
w->height = height;
|
||||
w->min_width = width;
|
||||
w->max_width = width;
|
||||
w->min_height = height;
|
||||
w->max_height = height;
|
||||
|
||||
w->focus = std::nullopt;
|
||||
|
||||
ColourSchemeUpdate(w);
|
||||
w->Invalidate();
|
||||
w->OnOpen();
|
||||
return w;
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the specified window.
|
||||
* rct2: 0x006ECD4C
|
||||
*
|
||||
* @param window The window to close (esi).
|
||||
*/
|
||||
void Close(WindowBase& w) override
|
||||
{
|
||||
w.OnClose();
|
||||
|
||||
// Remove viewport
|
||||
w.RemoveViewport();
|
||||
|
||||
// Invalidate the window (area)
|
||||
w.Invalidate();
|
||||
|
||||
w.flags |= WF_DEAD;
|
||||
}
|
||||
|
||||
void CloseSurplus(int32_t cap, WindowClass avoid_classification) override
|
||||
{
|
||||
// find the amount of windows that are currently open
|
||||
auto count = static_cast<int32_t>(g_window_list.size());
|
||||
// difference between amount open and cap = amount to close
|
||||
auto diff = count - kWindowLimitReserved - cap;
|
||||
for (auto i = 0; i < diff; i++)
|
||||
{
|
||||
// iterates through the list until it finds the newest window, or a window that can be closed
|
||||
WindowBase* foundW{};
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT | WF_NO_AUTO_CLOSE)))
|
||||
{
|
||||
foundW = w.get();
|
||||
break;
|
||||
}
|
||||
}
|
||||
// skip window if window matches specified WindowClass (as user may be modifying via options)
|
||||
if (avoid_classification != WindowClass::Null && foundW != nullptr
|
||||
&& foundW->classification == avoid_classification)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
Close(*foundW);
|
||||
}
|
||||
}
|
||||
|
||||
template<typename TPred>
|
||||
void CloseByCondition(TPred pred, uint32_t flags = WindowCloseFlags::None)
|
||||
{
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); ++it)
|
||||
{
|
||||
auto& wnd = *(*it);
|
||||
if (wnd.flags & WF_DEAD)
|
||||
continue;
|
||||
|
||||
if (pred(&wnd))
|
||||
{
|
||||
Close(wnd);
|
||||
if (flags & WindowCloseFlags::CloseSingle)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes all windows with the specified window class.
|
||||
* rct2: 0x006ECCF4
|
||||
* @param cls (cl) with bit 15 set
|
||||
*/
|
||||
void CloseByClass(WindowClass cls) override
|
||||
{
|
||||
CloseByCondition([&](WindowBase* w) -> bool { return w->classification == cls; });
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes all windows with specified window class and number.
|
||||
* rct2: 0x006ECCF4
|
||||
* @param cls (cl) without bit 15 set
|
||||
* @param number (dx)
|
||||
*/
|
||||
void CloseByNumber(WindowClass cls, rct_windownumber number) override
|
||||
{
|
||||
CloseByCondition([cls, number](WindowBase* w) -> bool { return w->classification == cls && w->number == number; });
|
||||
}
|
||||
|
||||
// TODO: Refactor this to use variant once the new window class is done.
|
||||
void CloseByNumber(WindowClass cls, EntityId number) override
|
||||
{
|
||||
CloseByNumber(cls, static_cast<rct_windownumber>(number.ToUnderlying()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes the top-most window
|
||||
*
|
||||
* rct2: 0x006E403C
|
||||
*/
|
||||
void CloseTop() override
|
||||
{
|
||||
CloseByClass(WindowClass::Dropdown);
|
||||
|
||||
if (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR)
|
||||
{
|
||||
if (GetGameState().EditorStep != EditorStep::LandscapeEditor)
|
||||
return;
|
||||
}
|
||||
|
||||
auto pred = [](WindowBase* w) -> bool { return !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)); };
|
||||
CloseByCondition(pred, WindowCloseFlags::CloseSingle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes all open windows
|
||||
*
|
||||
* rct2: 0x006EE927
|
||||
*/
|
||||
void CloseAll() override
|
||||
{
|
||||
CloseByClass(WindowClass::Dropdown);
|
||||
CloseByCondition([](WindowBase* w) -> bool { return !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)); });
|
||||
}
|
||||
|
||||
void CloseAllExceptClass(WindowClass cls) override
|
||||
{
|
||||
CloseByClass(WindowClass::Dropdown);
|
||||
CloseByCondition([cls](WindowBase* w) -> bool {
|
||||
return w->classification != cls && !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes all windows, save for those having any of the passed flags.
|
||||
*/
|
||||
void CloseAllExceptFlags(uint16_t flags) override
|
||||
{
|
||||
CloseByCondition([flags](WindowBase* w) -> bool { return !(w->flags & flags); });
|
||||
}
|
||||
|
||||
/**
|
||||
* Closes all windows except the specified window number and class.
|
||||
* @param number (dx)
|
||||
* @param cls (cl) without bit 15 set
|
||||
*/
|
||||
void CloseAllExceptNumberAndClass(rct_windownumber number, WindowClass cls) override
|
||||
{
|
||||
CloseByClass(WindowClass::Dropdown);
|
||||
CloseByCondition([cls, number](WindowBase* w) -> bool {
|
||||
return (!(w->number == number && w->classification == cls) && !(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)));
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006CBCC3
|
||||
*/
|
||||
void CloseConstructionWindows() override
|
||||
{
|
||||
CloseByClass(WindowClass::RideConstruction);
|
||||
CloseByClass(WindowClass::Footpath);
|
||||
CloseByClass(WindowClass::TrackDesignList);
|
||||
CloseByClass(WindowClass::TrackDesignPlace);
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the first window with the specified window class.
|
||||
* rct2: 0x006EA8A0
|
||||
|
@ -762,6 +1204,82 @@ public:
|
|||
// Return the widget index
|
||||
return widget_index;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006ECDA4
|
||||
*/
|
||||
WindowBase* BringToFront(WindowBase& w) override
|
||||
{
|
||||
if (!(w.flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)))
|
||||
{
|
||||
auto itSourcePos = WindowGetIterator(&w);
|
||||
if (itSourcePos != g_window_list.end())
|
||||
{
|
||||
// Insert in front of the first non-stick-to-front window
|
||||
auto itDestPos = g_window_list.begin();
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
|
||||
{
|
||||
auto& w2 = *it;
|
||||
if (!(w2->flags & WF_STICK_TO_FRONT))
|
||||
{
|
||||
itDestPos = it.base();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
g_window_list.splice(itDestPos, g_window_list, itSourcePos);
|
||||
w.Invalidate();
|
||||
|
||||
if (w.windowPos.x + w.width < 20)
|
||||
{
|
||||
int32_t i = 20 - w.windowPos.x;
|
||||
w.windowPos.x += i;
|
||||
if (w.viewport != nullptr)
|
||||
w.viewport->pos.x += i;
|
||||
w.Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
return &w;
|
||||
}
|
||||
|
||||
WindowBase* BringToFrontByClassWithFlags(WindowClass cls, uint16_t flags) override
|
||||
{
|
||||
WindowBase* w = FindByClass(cls);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->flags |= flags;
|
||||
w->Invalidate();
|
||||
w = BringToFront(*w);
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
|
||||
WindowBase* BringToFrontByClass(WindowClass cls) override
|
||||
{
|
||||
return BringToFrontByClassWithFlags(cls, WF_WHITE_BORDER_MASK);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* rct2: 0x006ED78A
|
||||
* cls (cl)
|
||||
* number (dx)
|
||||
*/
|
||||
WindowBase* BringToFrontByNumber(WindowClass cls, rct_windownumber number) override
|
||||
{
|
||||
WindowBase* w = FindByNumber(cls, number);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->flags |= WF_WHITE_BORDER_MASK;
|
||||
w->Invalidate();
|
||||
w = BringToFront(*w);
|
||||
}
|
||||
|
||||
return w;
|
||||
}
|
||||
};
|
||||
|
||||
std::unique_ptr<IWindowManager> OpenRCT2::Ui::CreateWindowManager()
|
||||
|
|
|
@ -25,7 +25,7 @@ namespace OpenRCT2::Audio
|
|||
class AudioContext final : public IAudioContext
|
||||
{
|
||||
private:
|
||||
static constexpr size_t STREAM_MIN_SIZE = 2 * 1024 * 1024; // 2 MiB
|
||||
static constexpr size_t kStreamMinSize = 2 * 1024 * 1024; // 2 MiB
|
||||
|
||||
std::unique_ptr<AudioMixer> _audioMixer;
|
||||
|
||||
|
@ -110,7 +110,7 @@ namespace OpenRCT2::Audio
|
|||
|
||||
// Load whole stream into memory if small enough
|
||||
auto dataLength = source->GetLength();
|
||||
if (dataLength < STREAM_MIN_SIZE)
|
||||
if (dataLength < kStreamMinSize)
|
||||
{
|
||||
auto& targetFormat = _audioMixer->GetFormat();
|
||||
source = source->ToMemory(targetFormat);
|
||||
|
|
|
@ -80,20 +80,20 @@ std::unique_ptr<SDLAudioSource> SDLAudioSource::ToMemory(const AudioFormat& targ
|
|||
|
||||
static AudioCodecKind GetAudioCodec(SDL_RWops* rw)
|
||||
{
|
||||
constexpr uint32_t MAGIC_FLAC = 0x43614C66;
|
||||
constexpr uint32_t MAGIC_OGG = 0x5367674F;
|
||||
constexpr uint32_t MAGIC_RIFF = 0x46464952;
|
||||
constexpr uint32_t kMagicFLAC = 0x43614C66;
|
||||
constexpr uint32_t kMagicOGG = 0x5367674F;
|
||||
constexpr uint32_t kMagicRIFF = 0x46464952;
|
||||
|
||||
auto originalPosition = SDL_RWtell(rw);
|
||||
auto magic = SDL_ReadLE32(rw);
|
||||
SDL_RWseek(rw, originalPosition, RW_SEEK_SET);
|
||||
switch (magic)
|
||||
{
|
||||
case MAGIC_FLAC:
|
||||
case kMagicFLAC:
|
||||
return AudioCodecKind::Flac;
|
||||
case MAGIC_OGG:
|
||||
case kMagicOGG:
|
||||
return AudioCodecKind::Ogg;
|
||||
case MAGIC_RIFF:
|
||||
case kMagicRIFF:
|
||||
return AudioCodecKind::Wav;
|
||||
default:
|
||||
return AudioCodecKind::Unknown;
|
||||
|
|
|
@ -20,11 +20,11 @@ namespace OpenRCT2::Audio
|
|||
class WavAudioSource final : public SDLAudioSource
|
||||
{
|
||||
private:
|
||||
static constexpr uint32_t DATA = 0x61746164;
|
||||
static constexpr uint32_t FMT = 0x20746D66;
|
||||
static constexpr uint32_t RIFF = 0x46464952;
|
||||
static constexpr uint32_t WAVE = 0x45564157;
|
||||
static constexpr uint16_t pcmformat = 0x0001;
|
||||
static constexpr uint32_t kChunkIdDATA = 0x61746164;
|
||||
static constexpr uint32_t kChunkIdFMT = 0x20746D66;
|
||||
static constexpr uint32_t kChunkIdRIFF = 0x46464952;
|
||||
static constexpr uint32_t kChunkIdWAVE = 0x45564157;
|
||||
static constexpr uint16_t kPCMFormat = 0x0001;
|
||||
|
||||
SDL_RWops* _rw{};
|
||||
AudioFormat _format = {};
|
||||
|
@ -36,7 +36,7 @@ namespace OpenRCT2::Audio
|
|||
: _rw(rw)
|
||||
{
|
||||
auto chunkId = SDL_ReadLE32(rw);
|
||||
if (chunkId != RIFF)
|
||||
if (chunkId != kChunkIdRIFF)
|
||||
{
|
||||
SDL_RWclose(rw);
|
||||
throw std::runtime_error("Not a WAV file");
|
||||
|
@ -45,13 +45,13 @@ namespace OpenRCT2::Audio
|
|||
// Read and discard chunk size
|
||||
SDL_ReadLE32(rw);
|
||||
auto chunkFormat = SDL_ReadLE32(rw);
|
||||
if (chunkFormat != WAVE)
|
||||
if (chunkFormat != kChunkIdWAVE)
|
||||
{
|
||||
SDL_RWclose(rw);
|
||||
throw std::runtime_error("Not in WAVE format");
|
||||
}
|
||||
|
||||
auto fmtChunkSize = FindChunk(rw, FMT);
|
||||
auto fmtChunkSize = FindChunk(rw, kChunkIdFMT);
|
||||
if (!fmtChunkSize)
|
||||
{
|
||||
SDL_RWclose(rw);
|
||||
|
@ -61,7 +61,7 @@ namespace OpenRCT2::Audio
|
|||
auto chunkStart = SDL_RWtell(rw);
|
||||
|
||||
auto encoding = SDL_ReadLE16(rw);
|
||||
if (encoding != pcmformat)
|
||||
if (encoding != kPCMFormat)
|
||||
{
|
||||
SDL_RWclose(rw);
|
||||
throw std::runtime_error("Not in PCM format");
|
||||
|
@ -87,7 +87,7 @@ namespace OpenRCT2::Audio
|
|||
|
||||
SDL_RWseek(rw, chunkStart + fmtChunkSize, RW_SEEK_SET);
|
||||
|
||||
auto dataChunkSize = FindChunk(rw, DATA);
|
||||
auto dataChunkSize = FindChunk(rw, kChunkIdDATA);
|
||||
if (dataChunkSize == 0)
|
||||
{
|
||||
SDL_RWclose(rw);
|
||||
|
@ -155,11 +155,12 @@ namespace OpenRCT2::Audio
|
|||
{
|
||||
return subchunkSize;
|
||||
}
|
||||
constexpr uint32_t FACT = 0x74636166;
|
||||
constexpr uint32_t LIST = 0x5453494c;
|
||||
constexpr uint32_t BEXT = 0x74786562;
|
||||
constexpr uint32_t JUNK = 0x4B4E554A;
|
||||
while (subchunkId == FACT || subchunkId == LIST || subchunkId == BEXT || subchunkId == JUNK)
|
||||
constexpr uint32_t kChunkIdFACT = 0x74636166;
|
||||
constexpr uint32_t kChunkIdLIST = 0x5453494c;
|
||||
constexpr uint32_t kChunkIdBEXT = 0x74786562;
|
||||
constexpr uint32_t kChunkIdJUNK = 0x4B4E554A;
|
||||
while (subchunkId == kChunkIdFACT || subchunkId == kChunkIdLIST || subchunkId == kChunkIdBEXT
|
||||
|| subchunkId == kChunkIdJUNK)
|
||||
{
|
||||
SDL_RWseek(rw, subchunkSize, RW_SEEK_CUR);
|
||||
subchunkId = SDL_ReadLE32(rw);
|
||||
|
|
|
@ -30,7 +30,7 @@ using namespace OpenRCT2::Ui;
|
|||
class HardwareDisplayDrawingEngine final : public X8DrawingEngine
|
||||
{
|
||||
private:
|
||||
constexpr static uint32_t DIRTY_VISUAL_TIME = 32;
|
||||
constexpr static uint32_t kDirtyVisualTime = 32;
|
||||
|
||||
std::shared_ptr<IUiContext> const _uiContext;
|
||||
SDL_Window* _window = nullptr;
|
||||
|
@ -223,7 +223,7 @@ protected:
|
|||
{
|
||||
for (uint32_t y = top; y < bottom; y++)
|
||||
{
|
||||
SetDirtyVisualTime(x, y, DIRTY_VISUAL_TIME);
|
||||
SetDirtyVisualTime(x, y, kDirtyVisualTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace
|
|||
};
|
||||
} // namespace
|
||||
|
||||
constexpr VDStruct VertexData[4] = {
|
||||
constexpr VDStruct kVertexData[4] = {
|
||||
{ -1.0f, -1.0f, 0.0f, 0.0f },
|
||||
{ 1.0f, -1.0f, 1.0f, 0.0f },
|
||||
{ -1.0f, 1.0f, 0.0f, 1.0f },
|
||||
|
@ -38,7 +38,7 @@ ApplyPaletteShader::ApplyPaletteShader()
|
|||
glGenVertexArrays(1, &_vao);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(VertexData), VertexData, GL_STATIC_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(kVertexData), kVertexData, GL_STATIC_DRAW);
|
||||
|
||||
glBindVertexArray(_vao);
|
||||
glVertexAttribPointer(
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace
|
|||
};
|
||||
} // namespace
|
||||
|
||||
constexpr VDStruct VertexData[4] = {
|
||||
constexpr VDStruct kVertexData[4] = {
|
||||
{ -1.0f, -1.0f, 0.0f, 0.0f },
|
||||
{ 1.0f, -1.0f, 1.0f, 0.0f },
|
||||
{ -1.0f, 1.0f, 0.0f, 1.0f },
|
||||
|
@ -38,7 +38,7 @@ ApplyTransparencyShader::ApplyTransparencyShader()
|
|||
glGenVertexArrays(1, &_vao);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(VertexData), VertexData, GL_STATIC_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(kVertexData), kVertexData, GL_STATIC_DRAW);
|
||||
|
||||
glBindVertexArray(_vao);
|
||||
glVertexAttribPointer(
|
||||
|
|
|
@ -23,7 +23,7 @@ namespace
|
|||
};
|
||||
} // namespace
|
||||
|
||||
constexpr VDStruct VertexData[2] = {
|
||||
constexpr VDStruct kVertexData[2] = {
|
||||
{ 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f },
|
||||
};
|
||||
|
@ -38,7 +38,7 @@ DrawLineShader::DrawLineShader()
|
|||
glGenVertexArrays(1, &_vao);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(VertexData), VertexData, GL_STATIC_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(kVertexData), kVertexData, GL_STATIC_DRAW);
|
||||
|
||||
glBindVertexArray(_vao);
|
||||
glVertexAttribPointer(
|
||||
|
|
|
@ -22,7 +22,7 @@ namespace
|
|||
};
|
||||
} // namespace
|
||||
|
||||
constexpr VDStruct VertexData[4] = {
|
||||
constexpr VDStruct kVertexData[4] = {
|
||||
{ 1.0f, 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f },
|
||||
{ 0.0f, 0.0f, 0.0f, 1.0f, 1.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f },
|
||||
{ 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f, 0.0f, 1.0f },
|
||||
|
@ -42,7 +42,7 @@ DrawRectShader::DrawRectShader()
|
|||
glGenVertexArrays(1, &_vao);
|
||||
|
||||
glBindBuffer(GL_ARRAY_BUFFER, _vbo);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(VertexData), VertexData, GL_STATIC_DRAW);
|
||||
glBufferData(GL_ARRAY_BUFFER, sizeof(kVertexData), kVertexData, GL_STATIC_DRAW);
|
||||
|
||||
glBindVertexArray(_vao);
|
||||
|
||||
|
|
|
@ -47,7 +47,7 @@ struct OpenGLVersion
|
|||
GLint Minor;
|
||||
};
|
||||
|
||||
constexpr OpenGLVersion OPENGL_MINIMUM_REQUIRED_VERSION = { 3, 3 };
|
||||
constexpr OpenGLVersion kOpenGLMinimumRequiredVersion = { 3, 3 };
|
||||
|
||||
constexpr uint8_t kCSInside = 0b0000;
|
||||
constexpr uint8_t kCSLeft = 0b0001;
|
||||
|
@ -218,7 +218,7 @@ public:
|
|||
|
||||
void Initialise() override
|
||||
{
|
||||
OpenGLVersion requiredVersion = OPENGL_MINIMUM_REQUIRED_VERSION;
|
||||
OpenGLVersion requiredVersion = kOpenGLMinimumRequiredVersion;
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, requiredVersion.Major);
|
||||
SDL_GL_SetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, requiredVersion.Minor);
|
||||
|
|
|
@ -18,11 +18,11 @@
|
|||
|
||||
using namespace OpenRCT2::Ui;
|
||||
|
||||
constexpr GLuint BACKBUFFER_ID = 0;
|
||||
constexpr GLuint kBackBufferID = 0;
|
||||
|
||||
OpenGLFramebuffer::OpenGLFramebuffer(SDL_Window* window)
|
||||
{
|
||||
_id = BACKBUFFER_ID;
|
||||
_id = kBackBufferID;
|
||||
_texture = 0;
|
||||
_depth = 0;
|
||||
SDL_GL_GetDrawableSize(window, &_width, &_height);
|
||||
|
@ -65,7 +65,7 @@ OpenGLFramebuffer::OpenGLFramebuffer(int32_t width, int32_t height, bool depth,
|
|||
|
||||
OpenGLFramebuffer::~OpenGLFramebuffer()
|
||||
{
|
||||
if (_id != BACKBUFFER_ID)
|
||||
if (_id != kBackBufferID)
|
||||
{
|
||||
glDeleteTextures(1, &_texture);
|
||||
glDeleteTextures(1, &_depth);
|
||||
|
|
|
@ -77,7 +77,7 @@ std::string OpenGLShader::ReadSourceCode(const std::string& path)
|
|||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
|
||||
uint64_t fileLength = fs.GetLength();
|
||||
if (fileLength > MaxSourceSize)
|
||||
if (fileLength > kMaxSourceSize)
|
||||
{
|
||||
throw IOException("Shader source too large.");
|
||||
}
|
||||
|
|
|
@ -18,7 +18,7 @@ namespace OpenRCT2::Ui
|
|||
class OpenGLShader final
|
||||
{
|
||||
private:
|
||||
static constexpr uint64_t MaxSourceSize = 8 * 1024 * 1024; // 8 MiB
|
||||
static constexpr uint64_t kMaxSourceSize = 8 * 1024 * 1024; // 8 MiB
|
||||
|
||||
GLenum _type;
|
||||
GLuint _id = 0;
|
||||
|
|
|
@ -15,9 +15,9 @@
|
|||
|
||||
using namespace OpenRCT2::Ui;
|
||||
|
||||
constexpr GLfloat depthValue[1] = { 1.0f };
|
||||
constexpr GLfloat depthValueTransparent[1] = { 0.0f };
|
||||
constexpr GLuint indexValue[4] = { 0, 0, 0, 0 };
|
||||
constexpr GLfloat kDepthValue[1] = { 1.0f };
|
||||
constexpr GLfloat kDepthValueTransparent[1] = { 0.0f };
|
||||
constexpr GLuint kIndexValue[4] = { 0, 0, 0, 0 };
|
||||
|
||||
SwapFramebuffer::SwapFramebuffer(int32_t width, int32_t height)
|
||||
: _opaqueFramebuffer(width, height)
|
||||
|
@ -26,7 +26,7 @@ SwapFramebuffer::SwapFramebuffer(int32_t width, int32_t height)
|
|||
, _backDepth(OpenGLFramebuffer::CreateDepthTexture(width, height))
|
||||
{
|
||||
_transparentFramebuffer.Bind();
|
||||
glClearBufferfv(GL_DEPTH, 0, depthValueTransparent);
|
||||
glClearBufferfv(GL_DEPTH, 0, kDepthValueTransparent);
|
||||
}
|
||||
|
||||
SwapFramebuffer::~SwapFramebuffer()
|
||||
|
@ -48,8 +48,8 @@ void SwapFramebuffer::ApplyTransparency(ApplyTransparencyShader& shader, GLuint
|
|||
|
||||
// Clear transparency buffers
|
||||
_transparentFramebuffer.Bind();
|
||||
glClearBufferuiv(GL_COLOR, 0, indexValue);
|
||||
glClearBufferfv(GL_DEPTH, 0, depthValueTransparent);
|
||||
glClearBufferuiv(GL_COLOR, 0, kIndexValue);
|
||||
glClearBufferfv(GL_DEPTH, 0, kDepthValueTransparent);
|
||||
|
||||
_opaqueFramebuffer.SwapColourBuffer(_mixFramebuffer);
|
||||
// Change binding to guarantee no undefined behavior
|
||||
|
@ -59,7 +59,7 @@ void SwapFramebuffer::ApplyTransparency(ApplyTransparencyShader& shader, GLuint
|
|||
void SwapFramebuffer::Clear()
|
||||
{
|
||||
_opaqueFramebuffer.Bind();
|
||||
glClearBufferfv(GL_DEPTH, 0, depthValue);
|
||||
glClearBufferfv(GL_DEPTH, 0, kDepthValue);
|
||||
}
|
||||
|
||||
#endif /* DISABLE_OPENGL */
|
||||
|
|
|
@ -175,9 +175,9 @@ void TextureCache::CreateTextures()
|
|||
{
|
||||
// Determine width and height to use for texture atlases
|
||||
glGetIntegerv(GL_MAX_TEXTURE_SIZE, &_atlasesTextureDimensions);
|
||||
if (_atlasesTextureDimensions > TEXTURE_CACHE_MAX_ATLAS_SIZE)
|
||||
if (_atlasesTextureDimensions > kTextureCacheMaxAtlasSize)
|
||||
{
|
||||
_atlasesTextureDimensions = TEXTURE_CACHE_MAX_ATLAS_SIZE;
|
||||
_atlasesTextureDimensions = kTextureCacheMaxAtlasSize;
|
||||
}
|
||||
|
||||
// Determine maximum number of atlases (minimum of size and array limit)
|
||||
|
|
|
@ -54,11 +54,11 @@ namespace OpenRCT2::Ui
|
|||
|
||||
// This is the maximum width and height of each atlas, basically the
|
||||
// granularity at which new atlases are allocated (2048 -> 4 MB of VRAM)
|
||||
constexpr int32_t TEXTURE_CACHE_MAX_ATLAS_SIZE = 2048;
|
||||
constexpr int32_t kTextureCacheMaxAtlasSize = 2048;
|
||||
|
||||
// Pixel dimensions of smallest supported slots in texture atlases
|
||||
// Must be a power of 2!
|
||||
constexpr int32_t TEXTURE_CACHE_SMALLEST_SLOT = 32;
|
||||
constexpr int32_t kTextureCacheSmallestSlot = 32;
|
||||
|
||||
struct BasicTextureInfo
|
||||
{
|
||||
|
@ -155,9 +155,9 @@ namespace OpenRCT2::Ui
|
|||
{
|
||||
int32_t actualSize = std::max(actualWidth, actualHeight);
|
||||
|
||||
if (actualSize < TEXTURE_CACHE_SMALLEST_SLOT)
|
||||
if (actualSize < kTextureCacheSmallestSlot)
|
||||
{
|
||||
actualSize = TEXTURE_CACHE_SMALLEST_SLOT;
|
||||
actualSize = kTextureCacheSmallestSlot;
|
||||
}
|
||||
|
||||
return static_cast<int32_t>(ceil(log2f(static_cast<float>(actualSize))));
|
||||
|
|
|
@ -16,7 +16,8 @@
|
|||
#include <openrct2-ui/input/MouseInput.h>
|
||||
#include <openrct2-ui/input/ShortcutManager.h>
|
||||
#include <openrct2-ui/interface/InGameConsole.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/interface/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Input.h>
|
||||
#include <openrct2/OpenRCT2.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
|
@ -80,10 +81,10 @@ void InputManager::QueueInputEvent(InputEvent&& e)
|
|||
|
||||
void InputManager::CheckJoysticks()
|
||||
{
|
||||
constexpr uint32_t CHECK_INTERVAL_MS = 5000;
|
||||
constexpr uint32_t kCheckInternalMs = 5000;
|
||||
|
||||
auto tick = SDL_GetTicks();
|
||||
if (tick > _lastJoystickCheck + CHECK_INTERVAL_MS)
|
||||
if (tick > _lastJoystickCheck + kCheckInternalMs)
|
||||
{
|
||||
_lastJoystickCheck = tick;
|
||||
|
||||
|
@ -210,7 +211,7 @@ void InputManager::Process(const InputEvent& e)
|
|||
|
||||
if (e.DeviceKind == InputDeviceKind::Keyboard)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
// TODO: replace with event
|
||||
auto w = windowMgr->FindByClass(WindowClass::Textinput);
|
||||
|
@ -424,7 +425,7 @@ bool InputManager::HasTextInputFocus() const
|
|||
if (OpenRCT2::Ui::Windows::IsUsingWidgetTextBox() || gChatOpen)
|
||||
return true;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = windowMgr->FindByClass(WindowClass::Textinput);
|
||||
if (w != nullptr)
|
||||
return true;
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include <openrct2-ui/interface/ViewportInteraction.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/interface/Window.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/Input.h>
|
||||
|
@ -246,7 +246,7 @@ namespace OpenRCT2
|
|||
*/
|
||||
static void InputScrollRight(const ScreenCoordsXY& screenCoords, MouseState state)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
|
||||
if (w == nullptr)
|
||||
{
|
||||
|
@ -286,7 +286,7 @@ namespace OpenRCT2
|
|||
Widget* widget;
|
||||
WidgetIndex widgetIndex;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
// Get window and widget under cursor position
|
||||
w = windowMgr->FindFromPoint(screenCoords);
|
||||
|
@ -308,11 +308,11 @@ namespace OpenRCT2
|
|||
InputWidgetLeft(screenCoords, w, widgetIndex);
|
||||
break;
|
||||
case MouseState::RightPress:
|
||||
WindowCloseByClass(WindowClass::Tooltip);
|
||||
windowMgr->CloseByClass(WindowClass::Tooltip);
|
||||
|
||||
if (w != nullptr)
|
||||
{
|
||||
w = WindowBringToFront(*w);
|
||||
w = windowMgr->BringToFront(*w);
|
||||
}
|
||||
|
||||
if (widgetIndex != kWidgetIndexNull)
|
||||
|
@ -566,7 +566,7 @@ namespace OpenRCT2
|
|||
if (differentialCoords.x == 0 && differentialCoords.y == 0)
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
w = windowMgr->FindByNumber(_dragWidget.window_classification, _dragWidget.window_number);
|
||||
|
||||
// #3294: Window can be closed during a drag session, so just finish
|
||||
|
@ -780,7 +780,7 @@ namespace OpenRCT2
|
|||
const auto& widget = w.widgets[widgetIndex];
|
||||
auto& scroll = w.scrolls[scroll_id];
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
|
||||
{
|
||||
int32_t newLeft;
|
||||
|
@ -820,7 +820,7 @@ namespace OpenRCT2
|
|||
const auto& widget = w.widgets[widgetIndex];
|
||||
auto& scroll = w.scrolls[scroll_id];
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
|
||||
{
|
||||
int32_t newTop;
|
||||
|
@ -857,7 +857,7 @@ namespace OpenRCT2
|
|||
*/
|
||||
static void InputScrollPartUpdateHLeft(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
|
||||
{
|
||||
auto& scroll = w.scrolls[scroll_id];
|
||||
|
@ -877,7 +877,7 @@ namespace OpenRCT2
|
|||
{
|
||||
const auto& widget = w.widgets[widgetIndex];
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
|
||||
{
|
||||
auto& scroll = w.scrolls[scroll_id];
|
||||
|
@ -903,7 +903,7 @@ namespace OpenRCT2
|
|||
*/
|
||||
static void InputScrollPartUpdateVTop(WindowBase& w, WidgetIndex widgetIndex, int32_t scroll_id)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
|
||||
{
|
||||
auto& scroll = w.scrolls[scroll_id];
|
||||
|
@ -923,7 +923,7 @@ namespace OpenRCT2
|
|||
{
|
||||
const auto& widget = w.widgets[widgetIndex];
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByNumber(w.classification, w.number) != nullptr)
|
||||
{
|
||||
auto& scroll = w.scrolls[scroll_id];
|
||||
|
@ -1020,7 +1020,7 @@ namespace OpenRCT2
|
|||
*/
|
||||
static void InputWidgetOverFlatbuttonInvalidate()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByNumber(gHoverWidget.window_classification, gHoverWidget.window_number);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -1048,16 +1048,16 @@ namespace OpenRCT2
|
|||
windowNumber = w->number;
|
||||
}
|
||||
|
||||
WindowCloseByClass(WindowClass::Error);
|
||||
WindowCloseByClass(WindowClass::Tooltip);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::Error);
|
||||
windowMgr->CloseByClass(WindowClass::Tooltip);
|
||||
|
||||
// Window might have changed position in the list, therefore find it again
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
w = windowMgr->FindByNumber(windowClass, windowNumber);
|
||||
if (w == nullptr)
|
||||
return;
|
||||
|
||||
w = WindowBringToFront(*w);
|
||||
w = windowMgr->BringToFront(*w);
|
||||
if (widgetIndex == kWidgetIndexNull)
|
||||
return;
|
||||
|
||||
|
@ -1146,10 +1146,10 @@ namespace OpenRCT2
|
|||
{
|
||||
CursorID cursorId = CursorID::Arrow;
|
||||
auto ft = Formatter();
|
||||
ft.Add<StringId>(STR_NONE);
|
||||
ft.Add<StringId>(kStringIdNone);
|
||||
SetMapTooltip(ft);
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindFromPoint(screenCoords);
|
||||
|
||||
if (window != nullptr)
|
||||
|
@ -1227,7 +1227,7 @@ namespace OpenRCT2
|
|||
{
|
||||
if (_inputFlags & INPUT_FLAG_TOOL_ACTIVE)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByNumber(gCurrentToolWidget.window_classification, gCurrentToolWidget.window_number);
|
||||
|
||||
if (w == nullptr)
|
||||
|
@ -1309,7 +1309,7 @@ namespace OpenRCT2
|
|||
cursor_w_number = gPressedWidget.window_number;
|
||||
WidgetIndex cursor_widgetIndex = gPressedWidget.widget_index;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* cursor_w = windowMgr->FindByNumber(cursor_w_class, cursor_w_number);
|
||||
if (cursor_w == nullptr)
|
||||
{
|
||||
|
@ -1352,16 +1352,16 @@ namespace OpenRCT2
|
|||
if (_clickRepeatTicks.has_value())
|
||||
{
|
||||
// The initial amount of time in ticks to wait until the first click repeat.
|
||||
constexpr auto ticksUntilRepeats = 16U;
|
||||
constexpr auto kTicksUntilRepeats = 16u;
|
||||
|
||||
// The amount of ticks between each click repeat.
|
||||
constexpr auto eventDelayInTicks = 3U;
|
||||
constexpr auto kEventDelayInTicks = 3u;
|
||||
|
||||
// The amount of ticks since the last click repeat.
|
||||
const auto clickRepeatsDelta = gCurrentRealTimeTicks - _clickRepeatTicks.value();
|
||||
|
||||
// Handle click repeat, only start this when at least 16 ticks elapsed.
|
||||
if (clickRepeatsDelta >= ticksUntilRepeats && (clickRepeatsDelta & eventDelayInTicks) == 0)
|
||||
if (clickRepeatsDelta >= kTicksUntilRepeats && (clickRepeatsDelta & kEventDelayInTicks) == 0)
|
||||
{
|
||||
if (WidgetIsHoldable(*w, widgetIndex))
|
||||
{
|
||||
|
@ -1369,7 +1369,7 @@ namespace OpenRCT2
|
|||
}
|
||||
|
||||
// Subtract initial delay from here on we want the event each third tick.
|
||||
_clickRepeatTicks = gCurrentRealTimeTicks - ticksUntilRepeats;
|
||||
_clickRepeatTicks = gCurrentRealTimeTicks - kTicksUntilRepeats;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1401,7 +1401,7 @@ namespace OpenRCT2
|
|||
{
|
||||
dropdown_index = DropdownIndexFromPoint(screenCoords, w);
|
||||
dropdownCleanup = dropdown_index == -1
|
||||
|| (dropdown_index < Dropdown::ItemsMaxSize && Dropdown::IsDisabled(dropdown_index))
|
||||
|| (dropdown_index < Dropdown::kItemsMaxSize && Dropdown::IsDisabled(dropdown_index))
|
||||
|| gDropdownItems[dropdown_index].IsSeparator();
|
||||
w = nullptr; // To be closed right next
|
||||
}
|
||||
|
@ -1426,7 +1426,7 @@ namespace OpenRCT2
|
|||
}
|
||||
}
|
||||
|
||||
WindowCloseByClass(WindowClass::Dropdown);
|
||||
windowMgr->CloseByClass(WindowClass::Dropdown);
|
||||
|
||||
if (dropdownCleanup)
|
||||
{
|
||||
|
@ -1535,7 +1535,7 @@ namespace OpenRCT2
|
|||
OpenRCT2String{ kColourToTip.at(ColourDropDownIndexToColour(dropdown_index)), {} }, screenCoords);
|
||||
}
|
||||
|
||||
if (dropdown_index < Dropdown::ItemsMaxSize && Dropdown::IsDisabled(dropdown_index))
|
||||
if (dropdown_index < Dropdown::kItemsMaxSize && Dropdown::IsDisabled(dropdown_index))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -1589,7 +1589,8 @@ namespace OpenRCT2
|
|||
|
||||
if (gCurrentRealTimeTicks >= gTooltipCloseTimeout)
|
||||
{
|
||||
WindowCloseByClass(WindowClass::Tooltip);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::Tooltip);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1616,7 +1617,7 @@ namespace OpenRCT2
|
|||
*/
|
||||
void InvalidateScroll()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByNumber(gPressedWidget.window_classification, gPressedWidget.window_number);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
using namespace OpenRCT2;
|
||||
using namespace OpenRCT2::Ui;
|
||||
|
||||
constexpr uint32_t UsefulModifiers = KMOD_SHIFT | KMOD_CTRL | KMOD_ALT | KMOD_GUI;
|
||||
constexpr uint32_t kUsefulModifiers = KMOD_SHIFT | KMOD_CTRL | KMOD_ALT | KMOD_GUI;
|
||||
|
||||
static uint32_t ParseModifier(std::string_view text)
|
||||
{
|
||||
|
@ -202,7 +202,7 @@ std::string_view ShortcutInput::GetModifierName(uint32_t key, bool localised)
|
|||
auto r = _keys.find(key);
|
||||
if (r != _keys.end())
|
||||
{
|
||||
if (localised && r->second.second != STR_NONE)
|
||||
if (localised && r->second.second != kStringIdNone)
|
||||
{
|
||||
return LanguageGetString(r->second.second);
|
||||
}
|
||||
|
@ -379,7 +379,7 @@ static bool HasModifier(uint32_t shortcut, uint32_t actual, uint32_t left, uint3
|
|||
|
||||
static bool CompareModifiers(uint32_t shortcut, uint32_t actual)
|
||||
{
|
||||
shortcut &= UsefulModifiers;
|
||||
shortcut &= kUsefulModifiers;
|
||||
return HasModifier(shortcut, actual, KMOD_LCTRL, KMOD_RCTRL) && HasModifier(shortcut, actual, KMOD_LSHIFT, KMOD_RSHIFT)
|
||||
&& HasModifier(shortcut, actual, KMOD_LALT, KMOD_RALT) && HasModifier(shortcut, actual, KMOD_LGUI, KMOD_RGUI);
|
||||
}
|
||||
|
@ -399,7 +399,7 @@ bool ShortcutInput::Matches(const InputEvent& e) const
|
|||
std::optional<ShortcutInput> ShortcutInput::FromInputEvent(const InputEvent& e)
|
||||
{
|
||||
// Assume any side modifier (more specific configurations can be done by manually editing config file)
|
||||
auto modifiers = e.Modifiers & UsefulModifiers;
|
||||
auto modifiers = e.Modifiers & kUsefulModifiers;
|
||||
for (auto mod : { KMOD_CTRL, KMOD_SHIFT, KMOD_ALT, KMOD_GUI })
|
||||
{
|
||||
if (modifiers & mod)
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#include <openrct2/core/FileSystem.hpp>
|
||||
#include <openrct2/core/Json.hpp>
|
||||
#include <openrct2/core/String.hpp>
|
||||
#include <openrct2/interface/Window.h>
|
||||
#include <openrct2/localisation/Language.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
using namespace OpenRCT2::Ui;
|
||||
|
||||
|
@ -174,7 +174,9 @@ void ShortcutManager::ProcessEvent(const InputEvent& e)
|
|||
shortcut->Current.push_back(std::move(shortcutInput.value()));
|
||||
}
|
||||
_pendingShortcutChange.clear();
|
||||
WindowCloseByClass(WindowClass::ChangeKeyboardShortcut);
|
||||
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::ChangeKeyboardShortcut);
|
||||
SaveUserBindings();
|
||||
}
|
||||
}
|
||||
|
@ -227,26 +229,26 @@ void ShortcutManager::LoadUserBindings()
|
|||
|
||||
std::optional<ShortcutInput> ShortcutManager::ConvertLegacyBinding(uint16_t binding)
|
||||
{
|
||||
constexpr uint16_t nullBinding = 0xFFFF;
|
||||
constexpr uint16_t shift = 0x100;
|
||||
constexpr uint16_t ctrl = 0x200;
|
||||
constexpr uint16_t alt = 0x400;
|
||||
constexpr uint16_t cmd = 0x800;
|
||||
constexpr uint16_t kNullBinding = 0xFFFF;
|
||||
constexpr uint16_t kShift = 0x100;
|
||||
constexpr uint16_t kCtrl = 0x200;
|
||||
constexpr uint16_t kAlt = 0x400;
|
||||
constexpr uint16_t kCmd = 0x800;
|
||||
|
||||
if (binding == nullBinding)
|
||||
if (binding == kNullBinding)
|
||||
{
|
||||
return std::nullopt;
|
||||
}
|
||||
|
||||
ShortcutInput result;
|
||||
result.Kind = InputDeviceKind::Keyboard;
|
||||
if (binding & shift)
|
||||
if (binding & kShift)
|
||||
result.Modifiers |= KMOD_SHIFT;
|
||||
if (binding & ctrl)
|
||||
if (binding & kCtrl)
|
||||
result.Modifiers |= KMOD_CTRL;
|
||||
if (binding & alt)
|
||||
if (binding & kAlt)
|
||||
result.Modifiers |= KMOD_ALT;
|
||||
if (binding & cmd)
|
||||
if (binding & kCmd)
|
||||
result.Modifiers |= KMOD_GUI;
|
||||
result.Button = SDL_GetKeyFromScancode(static_cast<SDL_Scancode>(binding & 0xFF));
|
||||
return result;
|
||||
|
@ -254,14 +256,14 @@ std::optional<ShortcutInput> ShortcutManager::ConvertLegacyBinding(uint16_t bind
|
|||
|
||||
void ShortcutManager::LoadLegacyBindings(const fs::path& path)
|
||||
{
|
||||
constexpr int32_t SUPPORTED_FILE_VERSION = 1;
|
||||
constexpr int32_t MAX_LEGACY_SHORTCUTS = 85;
|
||||
constexpr int32_t kSupportedFileVersion = 1;
|
||||
constexpr int32_t kMaxLegacyShortcuts = 85;
|
||||
|
||||
auto fs = FileStream(path, FILE_MODE_OPEN);
|
||||
auto version = fs.ReadValue<uint16_t>();
|
||||
if (version == SUPPORTED_FILE_VERSION)
|
||||
if (version == kSupportedFileVersion)
|
||||
{
|
||||
for (size_t i = 0; i < MAX_LEGACY_SHORTCUTS; i++)
|
||||
for (size_t i = 0; i < kMaxLegacyShortcuts; i++)
|
||||
{
|
||||
auto value = fs.ReadValue<uint16_t>();
|
||||
auto shortcutId = GetLegacyShortcutId(i);
|
||||
|
|
|
@ -57,7 +57,7 @@ namespace OpenRCT2::Ui
|
|||
{
|
||||
public:
|
||||
std::string Id;
|
||||
StringId LocalisedName = STR_NONE;
|
||||
StringId LocalisedName = kStringIdNone;
|
||||
std::string CustomName;
|
||||
std::vector<ShortcutInput> Default;
|
||||
std::vector<ShortcutInput> Current;
|
||||
|
|
|
@ -16,8 +16,7 @@
|
|||
#include <openrct2-ui/interface/InGameConsole.h>
|
||||
#include <openrct2-ui/interface/Viewport.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/interface/Window.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Editor.h>
|
||||
#include <openrct2/Game.h>
|
||||
|
@ -89,7 +88,7 @@ static void ShortcutRotateConstructionObject()
|
|||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
// Rotate scenery
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::Scenery);
|
||||
|
@ -152,17 +151,17 @@ static void ShortcutRotateConstructionObject()
|
|||
|
||||
static void ShortcutRemoveTopBottomToolbarToggle()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
{
|
||||
if (windowMgr->FindByClass(WindowClass::TitleLogo) != nullptr)
|
||||
{
|
||||
WindowCloseByClass(WindowClass::TitleLogo);
|
||||
WindowCloseByClass(WindowClass::TitleOptions);
|
||||
WindowCloseByClass(WindowClass::TitleMenu);
|
||||
WindowCloseByClass(WindowClass::TitleExit);
|
||||
WindowCloseByClass(WindowClass::TitleVersion);
|
||||
windowMgr->CloseByClass(WindowClass::TitleLogo);
|
||||
windowMgr->CloseByClass(WindowClass::TitleOptions);
|
||||
windowMgr->CloseByClass(WindowClass::TitleMenu);
|
||||
windowMgr->CloseByClass(WindowClass::TitleExit);
|
||||
windowMgr->CloseByClass(WindowClass::TitleVersion);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -173,9 +172,9 @@ static void ShortcutRemoveTopBottomToolbarToggle()
|
|||
{
|
||||
if (windowMgr->FindByClass(WindowClass::TopToolbar) != nullptr)
|
||||
{
|
||||
WindowCloseByClass(WindowClass::Dropdown);
|
||||
WindowCloseByClass(WindowClass::TopToolbar);
|
||||
WindowCloseByClass(WindowClass::BottomToolbar);
|
||||
windowMgr->CloseByClass(WindowClass::Dropdown);
|
||||
windowMgr->CloseByClass(WindowClass::TopToolbar);
|
||||
windowMgr->CloseByClass(WindowClass::BottomToolbar);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -372,11 +371,11 @@ static void ShortcutOpenCheatWindow()
|
|||
return;
|
||||
|
||||
// Check if window is already open
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindByClass(WindowClass::Cheats);
|
||||
if (window != nullptr)
|
||||
{
|
||||
WindowClose(*window);
|
||||
windowMgr->Close(*window);
|
||||
return;
|
||||
}
|
||||
ContextOpenWindow(WindowClass::Cheats);
|
||||
|
@ -441,7 +440,7 @@ static void ShortcutOpenSceneryPicker()
|
|||
|| (gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR && GetGameState().EditorStep != EditorStep::LandscapeEditor))
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window_scenery = windowMgr->FindByClass(WindowClass::Scenery);
|
||||
if (window_scenery == nullptr)
|
||||
ToggleSceneryWindow();
|
||||
|
@ -477,7 +476,7 @@ static void ShortcutScaleDown()
|
|||
// Tile inspector shortcuts
|
||||
static void TileInspectorMouseUp(WidgetIndex widgetIndex)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = windowMgr->FindByClass(WindowClass::TileInspector);
|
||||
if (w != nullptr && !WidgetIsDisabled(*w, widgetIndex) && w->widgets[widgetIndex].type != WindowWidgetType::Empty)
|
||||
{
|
||||
|
@ -487,7 +486,7 @@ static void TileInspectorMouseUp(WidgetIndex widgetIndex)
|
|||
|
||||
static void TileInspectorMouseDown(WidgetIndex widgetIndex)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = windowMgr->FindByClass(WindowClass::TileInspector);
|
||||
if (w != nullptr && !WidgetIsDisabled(*w, widgetIndex) && w->widgets[widgetIndex].type != WindowWidgetType::Empty)
|
||||
{
|
||||
|
@ -497,7 +496,7 @@ static void TileInspectorMouseDown(WidgetIndex widgetIndex)
|
|||
|
||||
static void ShortcutToggleWallSlope()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindByClass(WindowClass::TileInspector);
|
||||
if (window == nullptr)
|
||||
{
|
||||
|
@ -529,7 +528,7 @@ static void ShortcutToggleWallSlope()
|
|||
|
||||
static void ShortcutIncreaseElementHeight()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::TileInspector);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -569,7 +568,7 @@ static void ShortcutIncreaseElementHeight()
|
|||
|
||||
static void ShortcutDecreaseElementHeight()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::TileInspector);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -633,7 +632,7 @@ static void ShortcutConstructionTurnLeft()
|
|||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (window != nullptr)
|
||||
{
|
||||
|
@ -650,7 +649,7 @@ static void ShortcutConstructionTurnRight()
|
|||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (window != nullptr)
|
||||
{
|
||||
|
@ -667,7 +666,7 @@ static void ShortcutConstructionSlopeUp()
|
|||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (window != nullptr)
|
||||
{
|
||||
|
@ -684,7 +683,7 @@ static void ShortcutConstructionBuildCurrent()
|
|||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (window != nullptr)
|
||||
{
|
||||
|
@ -701,7 +700,7 @@ static void ShortcutConstructionSlopeDown()
|
|||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (window != nullptr)
|
||||
{
|
||||
|
@ -718,7 +717,7 @@ static void ShortcutConstructionDemolishCurrent()
|
|||
if (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO)
|
||||
return;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (window != nullptr)
|
||||
{
|
||||
|
@ -748,26 +747,30 @@ void ShortcutManager::RegisterDefaultShortcuts()
|
|||
{
|
||||
// clang-format off
|
||||
// Interface
|
||||
RegisterShortcut(ShortcutId::kInterfaceCloseTop, STR_SHORTCUT_CLOSE_TOP_MOST_WINDOW, "BACKSPACE", WindowCloseTop);
|
||||
RegisterShortcut(ShortcutId::kInterfaceCloseTop, STR_SHORTCUT_CLOSE_TOP_MOST_WINDOW, "BACKSPACE", []() {
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseTop();
|
||||
});
|
||||
RegisterShortcut(ShortcutId::kInterfaceCloseAll, STR_SHORTCUT_CLOSE_ALL_FLOATING_WINDOWS, "SHIFT+BACKSPACE", []() {
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_SCENARIO_EDITOR))
|
||||
{
|
||||
WindowCloseAll();
|
||||
windowMgr->CloseAll();
|
||||
}
|
||||
else if (GetGameState().EditorStep == EditorStep::LandscapeEditor)
|
||||
{
|
||||
WindowCloseTop();
|
||||
windowMgr->CloseTop();
|
||||
}
|
||||
});
|
||||
RegisterShortcut(ShortcutId::kInterfaceRotateConstruction, STR_SHORTCUT_ROTATE_CONSTRUCTION_OBJECT, "Z", ShortcutRotateConstructionObject);
|
||||
RegisterShortcut(ShortcutId::kInterfaceCancelConstruction, STR_SHORTCUT_CANCEL_CONSTRUCTION_MODE, "ESCAPE", []() {
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto window = windowMgr->FindByClass(WindowClass::Error);
|
||||
if (window != nullptr)
|
||||
{
|
||||
WindowClose(*window);
|
||||
windowMgr->Close(*window);
|
||||
}
|
||||
else if (InputTestFlag(INPUT_FLAG_TOOL_ACTIVE))
|
||||
{
|
||||
|
@ -900,11 +903,11 @@ void ShortcutManager::RegisterDefaultShortcuts()
|
|||
RegisterShortcut(ShortcutId::kDebugTogglePaintDebugWindow, STR_SHORTCUT_DEBUG_PAINT_TOGGLE, []() {
|
||||
if (!(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto window = windowMgr->FindByClass(WindowClass::DebugPaint);
|
||||
if (window != nullptr)
|
||||
{
|
||||
WindowClose(*window);
|
||||
windowMgr->Close(*window);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -18,10 +18,10 @@ namespace OpenRCT2::Dropdown
|
|||
{
|
||||
struct Item;
|
||||
|
||||
constexpr StringId SeparatorString = 0;
|
||||
constexpr StringId FormatColourPicker = 0xFFFE;
|
||||
constexpr StringId FormatLandPicker = 0xFFFF;
|
||||
constexpr int32_t ItemsMaxSize = 512;
|
||||
constexpr StringId kSeparatorString = 0;
|
||||
constexpr StringId kFormatColourPicker = 0xFFFE;
|
||||
constexpr StringId kFormatLandPicker = 0xFFFF;
|
||||
constexpr int32_t kItemsMaxSize = 512;
|
||||
|
||||
enum Flag
|
||||
{
|
||||
|
@ -39,7 +39,7 @@ namespace OpenRCT2::Dropdown
|
|||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
extern int32_t gDropdownNumItems;
|
||||
extern Dropdown::Item gDropdownItems[Dropdown::ItemsMaxSize];
|
||||
extern Dropdown::Item gDropdownItems[Dropdown::kItemsMaxSize];
|
||||
extern bool gDropdownIsColour;
|
||||
extern int32_t gDropdownLastColourHover;
|
||||
extern int32_t gDropdownHighlightedIndex;
|
||||
|
@ -81,7 +81,7 @@ namespace OpenRCT2::Dropdown
|
|||
|
||||
constexpr bool IsSeparator() const
|
||||
{
|
||||
return Format == SeparatorString;
|
||||
return Format == kSeparatorString;
|
||||
}
|
||||
|
||||
constexpr bool IsDisabled() const
|
||||
|
@ -116,7 +116,7 @@ namespace OpenRCT2::Dropdown
|
|||
|
||||
constexpr ItemExt Separator()
|
||||
{
|
||||
return ItemExt(-1, Dropdown::SeparatorString, STR_EMPTY);
|
||||
return ItemExt(-1, Dropdown::kSeparatorString, kStringIdEmpty);
|
||||
}
|
||||
|
||||
template<int N>
|
||||
|
|
|
@ -41,7 +41,7 @@ static int32_t InGameConsoleGetLineHeight()
|
|||
|
||||
void InGameConsole::WriteInitial()
|
||||
{
|
||||
InteractiveConsole::WriteLine(OPENRCT2_NAME " " OPENRCT2_VERSION);
|
||||
InteractiveConsole::WriteLine(OPENRCT2_NAME " " kOpenRCT2Version);
|
||||
InteractiveConsole::WriteLine(LanguageGetString(STR_CONSOLE_HELPER_TEXT));
|
||||
InteractiveConsole::WriteLine("");
|
||||
WritePrompt();
|
||||
|
@ -135,13 +135,13 @@ void InGameConsole::ClearInput()
|
|||
_consoleCurrentLine.clear();
|
||||
if (_isOpen)
|
||||
{
|
||||
_consoleTextInputSession = ContextStartTextInput(_consoleCurrentLine, CONSOLE_INPUT_SIZE);
|
||||
_consoleTextInputSession = ContextStartTextInput(_consoleCurrentLine, kConsoleInputSize);
|
||||
}
|
||||
}
|
||||
|
||||
void InGameConsole::HistoryAdd(const u8string& src)
|
||||
{
|
||||
if (_consoleHistory.size() >= CONSOLE_HISTORY_SIZE)
|
||||
if (_consoleHistory.size() >= kConsoleHistorySize)
|
||||
{
|
||||
_consoleHistory.pop_front();
|
||||
}
|
||||
|
@ -201,7 +201,7 @@ void InGameConsole::Open()
|
|||
_isOpen = true;
|
||||
ScrollToEnd();
|
||||
RefreshCaret();
|
||||
_consoleTextInputSession = ContextStartTextInput(_consoleCurrentLine, CONSOLE_INPUT_SIZE);
|
||||
_consoleTextInputSession = ContextStartTextInput(_consoleCurrentLine, kConsoleInputSize);
|
||||
}
|
||||
|
||||
void InGameConsole::Close()
|
||||
|
@ -242,9 +242,9 @@ void InGameConsole::WriteLine(const std::string& input, FormatToken colourFormat
|
|||
stringOffset = splitPos + 1;
|
||||
}
|
||||
|
||||
if (_consoleLines.size() > CONSOLE_MAX_LINES)
|
||||
if (_consoleLines.size() > kConsoleMaxLines)
|
||||
{
|
||||
const std::size_t linesToErase = _consoleLines.size() - CONSOLE_MAX_LINES;
|
||||
const std::size_t linesToErase = _consoleLines.size() - kConsoleMaxLines;
|
||||
_consoleLines.erase(_consoleLines.begin(), _consoleLines.begin() + linesToErase);
|
||||
}
|
||||
}
|
||||
|
@ -323,7 +323,7 @@ void InGameConsole::Draw(DrawPixelInfo& dpi) const
|
|||
INSET_RECT_FLAG_BORDER_INSET);
|
||||
|
||||
std::string lineBuffer;
|
||||
auto screenCoords = _consoleTopLeft + ScreenCoordsXY{ CONSOLE_EDGE_PADDING, CONSOLE_EDGE_PADDING };
|
||||
auto screenCoords = _consoleTopLeft + ScreenCoordsXY{ kConsoleEdgePadding, kConsoleEdgePadding };
|
||||
|
||||
// Draw text inside console
|
||||
for (std::size_t i = 0; i < _consoleLines.size() && i < static_cast<size_t>(maxLines); i++)
|
||||
|
@ -353,7 +353,7 @@ void InGameConsole::Draw(DrawPixelInfo& dpi) const
|
|||
screenCoords.y += lineHeight;
|
||||
}
|
||||
|
||||
screenCoords.y = _consoleBottomRight.y - lineHeight - CONSOLE_EDGE_PADDING - 1;
|
||||
screenCoords.y = _consoleBottomRight.y - lineHeight - kConsoleEdgePadding - 1;
|
||||
|
||||
// Draw current line
|
||||
if (textColour.colour == COLOUR_BLACK)
|
||||
|
@ -367,11 +367,11 @@ void InGameConsole::Draw(DrawPixelInfo& dpi) const
|
|||
}
|
||||
|
||||
// Draw caret
|
||||
if (_consoleCaretTicks < CONSOLE_CARET_FLASH_THRESHOLD)
|
||||
if (_consoleCaretTicks < kConsoleCaretFlashThreshold)
|
||||
{
|
||||
auto caret = screenCoords + ScreenCoordsXY{ _caretScreenPosX, lineHeight };
|
||||
uint8_t caretColour = ColourMapA[textColour.colour].lightest;
|
||||
GfxFillRect(dpi, { caret, caret + ScreenCoordsXY{ CONSOLE_CARET_WIDTH, 1 } }, caretColour);
|
||||
GfxFillRect(dpi, { caret, caret + ScreenCoordsXY{ kConsoleCaretWidth, 1 } }, caretColour);
|
||||
}
|
||||
|
||||
// What about border colours?
|
||||
|
|
|
@ -21,12 +21,12 @@ namespace OpenRCT2::Ui
|
|||
class InGameConsole final : public InteractiveConsole
|
||||
{
|
||||
private:
|
||||
static constexpr int32_t CONSOLE_MAX_LINES = 300;
|
||||
static constexpr int32_t CONSOLE_HISTORY_SIZE = 64;
|
||||
static constexpr int32_t CONSOLE_INPUT_SIZE = 256;
|
||||
static constexpr int32_t CONSOLE_CARET_FLASH_THRESHOLD = 15;
|
||||
static constexpr int32_t CONSOLE_EDGE_PADDING = 4;
|
||||
static constexpr int32_t CONSOLE_CARET_WIDTH = 6;
|
||||
static constexpr int32_t kConsoleMaxLines = 300;
|
||||
static constexpr int32_t kConsoleHistorySize = 64;
|
||||
static constexpr int32_t kConsoleInputSize = 256;
|
||||
static constexpr int32_t kConsoleCaretFlashThreshold = 15;
|
||||
static constexpr int32_t kConsoleEdgePadding = 4;
|
||||
static constexpr int32_t kConsoleCaretWidth = 6;
|
||||
|
||||
bool _isInitialised = false;
|
||||
bool _isOpen = false;
|
||||
|
|
|
@ -68,7 +68,7 @@ void LandTool::ShowSurfaceStyleDropdown(WindowBase* w, Widget* widget, ObjectEnt
|
|||
if (surfaceObj->Colour != TerrainSurfaceObject::kNoValue)
|
||||
imageId = imageId.WithPrimary(surfaceObj->Colour);
|
||||
|
||||
gDropdownItems[itemIndex].Format = Dropdown::FormatLandPicker;
|
||||
gDropdownItems[itemIndex].Format = Dropdown::kFormatLandPicker;
|
||||
Dropdown::SetImage(itemIndex, imageId);
|
||||
if (i == currentSurfaceType)
|
||||
{
|
||||
|
@ -118,7 +118,7 @@ void LandTool::ShowEdgeStyleDropdown(WindowBase* w, Widget* widget, ObjectEntryI
|
|||
// If fallback images are loaded, the RCT1 styles will just look like copies of already existing styles, so hide them.
|
||||
if (edgeObj != nullptr && !edgeObj->UsesFallbackImages())
|
||||
{
|
||||
gDropdownItems[itemIndex].Format = Dropdown::FormatLandPicker;
|
||||
gDropdownItems[itemIndex].Format = Dropdown::kFormatLandPicker;
|
||||
Dropdown::SetImage(itemIndex, ImageId(edgeObj->IconImageId));
|
||||
if (i == currentEdgeType)
|
||||
{
|
||||
|
|
|
@ -37,7 +37,7 @@ namespace OpenRCT2::Ui
|
|||
{
|
||||
if (objective.Type == OBJECTIVE_BUILD_THE_BEST)
|
||||
{
|
||||
StringId rideTypeString = STR_NONE;
|
||||
StringId rideTypeString = kStringIdNone;
|
||||
auto rideTypeId = objective.RideId;
|
||||
if (rideTypeId != RIDE_TYPE_NULL && rideTypeId < RIDE_TYPE_COUNT)
|
||||
{
|
||||
|
|
|
@ -896,7 +896,7 @@ static constexpr UIThemeWindowEntry PredefinedThemeRCT1_Entries[] =
|
|||
const WindowThemeDesc* desc = GetWindowThemeDescriptor(wc);
|
||||
if (desc == nullptr)
|
||||
{
|
||||
return STR_EMPTY;
|
||||
return kStringIdEmpty;
|
||||
}
|
||||
return desc->WindowName;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include "../ProvisionalElements.h"
|
||||
#include "../UiStringIds.h"
|
||||
#include "../windows/Window.h"
|
||||
#include "../windows/Windows.h"
|
||||
#include "Viewport.h"
|
||||
#include "Window.h"
|
||||
|
||||
|
@ -469,7 +469,7 @@ namespace OpenRCT2::Ui
|
|||
|
||||
if (!(InputTestFlag(INPUT_FLAG_6)) || !(InputTestFlag(INPUT_FLAG_TOOL_ACTIVE)))
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByClass(WindowClass::RideConstruction) == nullptr
|
||||
&& windowMgr->FindByClass(WindowClass::Footpath) == nullptr)
|
||||
{
|
||||
|
@ -506,7 +506,7 @@ namespace OpenRCT2::Ui
|
|||
{
|
||||
ft.Add<StringId>(STR_BROKEN);
|
||||
}
|
||||
ft.Add<StringId>(pathAddEntry != nullptr ? pathAddEntry->name : STR_NONE);
|
||||
ft.Add<StringId>(pathAddEntry != nullptr ? pathAddEntry->name : kStringIdNone);
|
||||
SetMapTooltip(ft);
|
||||
return info;
|
||||
}
|
||||
|
@ -637,7 +637,7 @@ namespace OpenRCT2::Ui
|
|||
*/
|
||||
static void ViewportInteractionRemoveFootpath(const PathElement& pathElement, const CoordsXY& mapCoords)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (w != nullptr)
|
||||
FootpathUpdateProvisional();
|
||||
|
@ -765,7 +765,7 @@ namespace OpenRCT2::Ui
|
|||
|
||||
static Peep* ViewportInteractionGetClosestPeep(ScreenCoordsXY screenCoords, int32_t maxDistance)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->FindFromPoint(screenCoords);
|
||||
if (w == nullptr)
|
||||
return nullptr;
|
||||
|
@ -790,7 +790,7 @@ namespace OpenRCT2::Ui
|
|||
*/
|
||||
CoordsXY ViewportInteractionGetTileStartAtCursor(const ScreenCoordsXY& screenCoords)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindFromPoint(screenCoords);
|
||||
if (window == nullptr || window->viewport == nullptr)
|
||||
{
|
||||
|
|
|
@ -39,7 +39,7 @@ namespace OpenRCT2::Ui
|
|||
*/
|
||||
CoordsXY FootpathGetCoordinatesFromPos(const ScreenCoordsXY& screenCoords, int32_t* direction, TileElement** tileElement)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindFromPoint(screenCoords);
|
||||
if (window == nullptr || window->viewport == nullptr)
|
||||
{
|
||||
|
@ -138,7 +138,7 @@ namespace OpenRCT2::Ui
|
|||
CoordsXY FootpathBridgeGetInfoFromPos(const ScreenCoordsXY& screenCoords, int32_t* direction, TileElement** tileElement)
|
||||
{
|
||||
// First check if we point at an entrance or exit. In that case, we would want the path coming from the entrance/exit.
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* window = windowMgr->FindFromPoint(screenCoords);
|
||||
if (window == nullptr || window->viewport == nullptr)
|
||||
{
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <openrct2-ui/UiStringIds.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Diagnostic.h>
|
||||
#include <openrct2/Game.h>
|
||||
|
@ -226,7 +227,7 @@ namespace OpenRCT2::Ui
|
|||
// Get the widget
|
||||
auto& widget = w.widgets[widgetIndex];
|
||||
|
||||
if (widget.type != WindowWidgetType::Tab && widget.image.GetIndex() == ImageIndexUndefined)
|
||||
if (widget.type != WindowWidgetType::Tab && widget.image.GetIndex() == kImageIndexUndefined)
|
||||
return;
|
||||
|
||||
if (widget.type == WindowWidgetType::Tab)
|
||||
|
@ -234,7 +235,7 @@ namespace OpenRCT2::Ui
|
|||
if (WidgetIsDisabled(w, widgetIndex))
|
||||
return;
|
||||
|
||||
if (widget.image.GetIndex() == ImageIndexUndefined)
|
||||
if (widget.image.GetIndex() == kImageIndexUndefined)
|
||||
{
|
||||
// Set standard tab sprite to use.
|
||||
widget.image = ImageId(SPR_TAB, FilterPaletteID::PaletteNull);
|
||||
|
@ -345,7 +346,7 @@ namespace OpenRCT2::Ui
|
|||
// Get the widget
|
||||
const auto& widget = w.widgets[widgetIndex];
|
||||
|
||||
if (widget.text == STR_NONE)
|
||||
if (widget.text == kStringIdNone)
|
||||
return;
|
||||
|
||||
auto colour = w.colours[widget.colour];
|
||||
|
@ -390,7 +391,7 @@ namespace OpenRCT2::Ui
|
|||
// Get the widget
|
||||
const auto& widget = w.widgets[widgetIndex];
|
||||
|
||||
if (widget.text == STR_NONE || widget.content == kWidgetContentEmpty)
|
||||
if (widget.text == kStringIdNone || widget.content == kWidgetContentEmpty)
|
||||
return;
|
||||
|
||||
auto colour = w.colours[widget.colour];
|
||||
|
@ -456,7 +457,7 @@ namespace OpenRCT2::Ui
|
|||
{
|
||||
if (widget.string == nullptr || widget.string[0] == '\0')
|
||||
{
|
||||
stringId = STR_NONE;
|
||||
stringId = kStringIdNone;
|
||||
formatArgs = nullptr;
|
||||
}
|
||||
else
|
||||
|
@ -484,7 +485,7 @@ namespace OpenRCT2::Ui
|
|||
|
||||
// Text
|
||||
auto [stringId, formatArgs] = WidgetGetStringidAndArgs(widget);
|
||||
if (stringId != STR_NONE)
|
||||
if (stringId != kStringIdNone)
|
||||
{
|
||||
auto colour = w.colours[widget.colour].withFlag(ColourFlag::translucent, false);
|
||||
if (WidgetIsDisabled(w, widgetIndex))
|
||||
|
@ -560,7 +561,7 @@ namespace OpenRCT2::Ui
|
|||
FilterPaletteID::PaletteDarken3);
|
||||
|
||||
// Draw text
|
||||
if (widget->text == STR_NONE)
|
||||
if (widget->text == kStringIdNone)
|
||||
return;
|
||||
|
||||
topLeft = w.windowPos + ScreenCoordsXY{ widget->left + 2, widget->top + 1 };
|
||||
|
@ -605,7 +606,7 @@ namespace OpenRCT2::Ui
|
|||
// Draw the button
|
||||
GfxFillRectInset(dpi, { topLeft, bottomRight }, colour, press);
|
||||
|
||||
if (widget.text == STR_NONE)
|
||||
if (widget.text == kStringIdNone)
|
||||
return;
|
||||
|
||||
topLeft = w.windowPos + ScreenCoordsXY{ widget.midX() - 1, std::max<int32_t>(widget.top, widget.midY() - 5) };
|
||||
|
@ -651,7 +652,7 @@ namespace OpenRCT2::Ui
|
|||
}
|
||||
|
||||
// draw the text
|
||||
if (widget.text == STR_NONE)
|
||||
if (widget.text == kStringIdNone)
|
||||
return;
|
||||
|
||||
auto [stringId, formatArgs] = WidgetGetStringidAndArgs(widget);
|
||||
|
|
|
@ -19,7 +19,7 @@ namespace OpenRCT2::Ui
|
|||
{
|
||||
// clang-format off
|
||||
#define WINDOW_SHIM_RAW(TITLE, WIDTH, HEIGHT, CLOSE_STR) \
|
||||
{ WindowWidgetType::Frame, 0, 0, WIDTH - 1, 0, HEIGHT - 1, 0xFFFFFFFF, STR_NONE }, \
|
||||
{ WindowWidgetType::Frame, 0, 0, WIDTH - 1, 0, HEIGHT - 1, 0xFFFFFFFF, kStringIdNone }, \
|
||||
{ WindowWidgetType::Caption, 0, 1, WIDTH - 2, 1, 14, TITLE, STR_WINDOW_TITLE_TIP }, \
|
||||
{ WindowWidgetType::CloseBox, 0, WIDTH - 13, WIDTH - 3, 2, 13, CLOSE_STR, STR_CLOSE_WINDOW_TIP }
|
||||
|
||||
|
@ -52,7 +52,7 @@ namespace OpenRCT2::Ui
|
|||
|
||||
constexpr Widget MakeWidget(
|
||||
const ScreenCoordsXY& origin, const ScreenSize& size, WindowWidgetType type, WindowColour colour,
|
||||
uint32_t content = kWidgetContentEmpty, StringId tooltip = STR_NONE)
|
||||
uint32_t content = kWidgetContentEmpty, StringId tooltip = kStringIdNone)
|
||||
{
|
||||
Widget out = {};
|
||||
out.left = origin.x;
|
||||
|
@ -69,7 +69,7 @@ namespace OpenRCT2::Ui
|
|||
|
||||
constexpr Widget MakeWidget(
|
||||
const ScreenCoordsXY& origin, const ScreenSize& size, WindowWidgetType type, WindowColour colour, ImageId image,
|
||||
StringId tooltip = STR_NONE)
|
||||
StringId tooltip = kStringIdNone)
|
||||
{
|
||||
Widget out = {};
|
||||
out.left = origin.x;
|
||||
|
@ -86,17 +86,17 @@ namespace OpenRCT2::Ui
|
|||
|
||||
constexpr Widget MakeRemapWidget(
|
||||
const ScreenCoordsXY& origin, const ScreenSize& size, WindowWidgetType type, WindowColour colour, ImageIndex content,
|
||||
StringId tooltip = STR_NONE)
|
||||
StringId tooltip = kStringIdNone)
|
||||
{
|
||||
return MakeWidget(origin, size, type, colour, ImageId(content, FilterPaletteID::PaletteNull), tooltip);
|
||||
}
|
||||
|
||||
constexpr Widget MakeTab(const ScreenCoordsXY& origin, StringId tooltip = STR_NONE)
|
||||
constexpr Widget MakeTab(const ScreenCoordsXY& origin, StringId tooltip = kStringIdNone)
|
||||
{
|
||||
const ScreenSize size = kTabSize;
|
||||
const WindowWidgetType type = WindowWidgetType::Tab;
|
||||
const WindowColour colour = WindowColour::Secondary;
|
||||
const auto content = ImageId(ImageIndexUndefined);
|
||||
const auto content = ImageId(kImageIndexUndefined);
|
||||
|
||||
return MakeWidget(origin, size, type, colour, content, tooltip);
|
||||
}
|
||||
|
@ -113,7 +113,7 @@ namespace OpenRCT2::Ui
|
|||
out.type = WindowWidgetType::ProgressBar;
|
||||
out.colour = colour;
|
||||
out.content = 0 | (lowerBlinkBound << 8) | (upperBlinkBound << 16);
|
||||
out.tooltip = STR_NONE;
|
||||
out.tooltip = kStringIdNone;
|
||||
|
||||
return out;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ namespace OpenRCT2::Ui
|
|||
|
||||
constexpr Widget MakeSpinnerDecreaseWidget(
|
||||
const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour,
|
||||
[[maybe_unused]] uint32_t content = kWidgetContentEmpty, StringId tooltip = STR_NONE)
|
||||
[[maybe_unused]] uint32_t content = kWidgetContentEmpty, StringId tooltip = kStringIdNone)
|
||||
{
|
||||
const int16_t xPos = origin.x + size.width - 26;
|
||||
const int16_t yPos = origin.y + 1;
|
||||
|
@ -137,7 +137,7 @@ namespace OpenRCT2::Ui
|
|||
|
||||
constexpr Widget MakeSpinnerIncreaseWidget(
|
||||
const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour,
|
||||
[[maybe_unused]] uint32_t content = kWidgetContentEmpty, StringId tooltip = STR_NONE)
|
||||
[[maybe_unused]] uint32_t content = kWidgetContentEmpty, StringId tooltip = kStringIdNone)
|
||||
{
|
||||
const int16_t xPos = origin.x + size.width - 13;
|
||||
const int16_t yPos = origin.y + 1;
|
||||
|
@ -152,14 +152,14 @@ namespace OpenRCT2::Ui
|
|||
|
||||
constexpr Widget MakeDropdownBoxWidget(
|
||||
const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour,
|
||||
[[maybe_unused]] uint32_t content = kWidgetContentEmpty, StringId tooltip = STR_NONE)
|
||||
[[maybe_unused]] uint32_t content = kWidgetContentEmpty, StringId tooltip = kStringIdNone)
|
||||
{
|
||||
return MakeWidget(origin, size, type, colour, content);
|
||||
}
|
||||
|
||||
constexpr Widget MakeDropdownButtonWidget(
|
||||
const ScreenCoordsXY& origin, const ScreenSize& size, [[maybe_unused]] WindowWidgetType type, WindowColour colour,
|
||||
[[maybe_unused]] uint32_t content = kWidgetContentEmpty, StringId tooltip = STR_NONE)
|
||||
[[maybe_unused]] uint32_t content = kWidgetContentEmpty, StringId tooltip = kStringIdNone)
|
||||
{
|
||||
const int16_t xPos = origin.x + size.width - 11;
|
||||
const int16_t yPos = origin.y + 1;
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include <SDL.h>
|
||||
#include <algorithm>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/Input.h>
|
||||
|
@ -37,183 +37,10 @@ namespace OpenRCT2
|
|||
using namespace OpenRCT2::Ui;
|
||||
|
||||
// The amount of pixels to scroll per wheel click
|
||||
constexpr int32_t WindowScrollPixels = 17;
|
||||
constexpr int32_t kWindowScrollPixels = 17;
|
||||
|
||||
static int32_t _previousAbsoluteWheel = 0;
|
||||
|
||||
static bool WindowFitsBetweenOthers(const ScreenCoordsXY& loc, int32_t width, int32_t height)
|
||||
{
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
if (w->flags & WF_STICK_TO_BACK)
|
||||
continue;
|
||||
|
||||
if (loc.x + width <= w->windowPos.x)
|
||||
continue;
|
||||
if (loc.x >= w->windowPos.x + w->width)
|
||||
continue;
|
||||
if (loc.y + height <= w->windowPos.y)
|
||||
continue;
|
||||
if (loc.y >= w->windowPos.y + w->height)
|
||||
continue;
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool WindowFitsWithinSpace(const ScreenCoordsXY& loc, int32_t width, int32_t height)
|
||||
{
|
||||
if (loc.x < 0)
|
||||
return false;
|
||||
if (loc.y <= kTopToolbarHeight && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
||||
return false;
|
||||
if (loc.x + width > ContextGetWidth())
|
||||
return false;
|
||||
if (loc.y + height > ContextGetHeight())
|
||||
return false;
|
||||
return WindowFitsBetweenOthers(loc, width, height);
|
||||
}
|
||||
|
||||
static bool WindowFitsOnScreen(const ScreenCoordsXY& loc, int32_t width, int32_t height)
|
||||
{
|
||||
uint16_t screenWidth = ContextGetWidth();
|
||||
uint16_t screenHeight = ContextGetHeight();
|
||||
int32_t unk;
|
||||
|
||||
unk = -(width / 4);
|
||||
if (loc.x < unk)
|
||||
return false;
|
||||
unk = screenWidth + (unk * 2);
|
||||
if (loc.x > unk)
|
||||
return false;
|
||||
if (loc.y <= kTopToolbarHeight && !(gScreenFlags & SCREEN_FLAGS_TITLE_DEMO))
|
||||
return false;
|
||||
unk = screenHeight - (height / 4);
|
||||
if (loc.y > unk)
|
||||
return false;
|
||||
return WindowFitsBetweenOthers(loc, width, height);
|
||||
}
|
||||
|
||||
static ScreenCoordsXY ClampWindowToScreen(
|
||||
const ScreenCoordsXY& pos, const int32_t screenWidth, const int32_t screenHeight, const int32_t width,
|
||||
const int32_t height)
|
||||
{
|
||||
auto screenPos = pos;
|
||||
if (width > screenWidth || screenPos.x < 0)
|
||||
screenPos.x = 0;
|
||||
else if (screenPos.x + width > screenWidth)
|
||||
screenPos.x = screenWidth - width;
|
||||
|
||||
auto toolbarAllowance = (gScreenFlags & SCREEN_FLAGS_TITLE_DEMO) ? 0 : (kTopToolbarHeight + 1);
|
||||
if (height - toolbarAllowance > screenHeight || screenPos.y < toolbarAllowance)
|
||||
screenPos.y = toolbarAllowance;
|
||||
else if (screenPos.y + height - toolbarAllowance > screenHeight)
|
||||
screenPos.y = screenHeight + toolbarAllowance - height;
|
||||
|
||||
return screenPos;
|
||||
}
|
||||
|
||||
static ScreenCoordsXY GetAutoPositionForNewWindow(int32_t width, int32_t height)
|
||||
{
|
||||
auto uiContext = GetContext()->GetUiContext();
|
||||
auto screenWidth = uiContext->GetWidth();
|
||||
auto screenHeight = uiContext->GetHeight();
|
||||
|
||||
// Place window in an empty corner of the screen
|
||||
const ScreenCoordsXY cornerPositions[] = {
|
||||
{ 0, 30 }, // topLeft
|
||||
{ screenWidth - width, 30 }, // topRight
|
||||
{ 0, screenHeight - 34 - height }, // bottomLeft
|
||||
{ screenWidth - width, screenHeight - 34 - height }, // bottomRight
|
||||
};
|
||||
|
||||
for (const auto& cornerPos : cornerPositions)
|
||||
{
|
||||
if (WindowFitsWithinSpace(cornerPos, width, height))
|
||||
{
|
||||
return ClampWindowToScreen(cornerPos, screenWidth, screenHeight, width, height);
|
||||
}
|
||||
}
|
||||
|
||||
// Place window next to another
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
if (w->flags & WF_STICK_TO_BACK)
|
||||
continue;
|
||||
|
||||
const ScreenCoordsXY offsets[] = {
|
||||
{ w->width + 2, 0 },
|
||||
{ -w->width - 2, 0 },
|
||||
{ 0, w->height + 2 },
|
||||
{ 0, -w->height - 2 },
|
||||
{ w->width + 2, -w->height - 2 },
|
||||
{ -w->width - 2, -w->height - 2 },
|
||||
{ w->width + 2, w->height + 2 },
|
||||
{ -w->width - 2, w->height + 2 },
|
||||
};
|
||||
|
||||
for (const auto& offset : offsets)
|
||||
{
|
||||
auto screenPos = w->windowPos + offset;
|
||||
if (WindowFitsWithinSpace(screenPos, width, height))
|
||||
{
|
||||
return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Overlap
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
if (w->flags & WF_STICK_TO_BACK)
|
||||
continue;
|
||||
|
||||
const ScreenCoordsXY offsets[] = {
|
||||
{ w->width + 2, 0 },
|
||||
{ -w->width - 2, 0 },
|
||||
{ 0, w->height + 2 },
|
||||
{ 0, -w->height - 2 },
|
||||
};
|
||||
|
||||
for (const auto& offset : offsets)
|
||||
{
|
||||
auto screenPos = w->windowPos + offset;
|
||||
if (WindowFitsOnScreen(screenPos, width, height))
|
||||
{
|
||||
return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Cascade
|
||||
auto screenPos = ScreenCoordsXY{ 0, 30 };
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (screenPos == w->windowPos)
|
||||
{
|
||||
screenPos.x += 5;
|
||||
screenPos.y += 5;
|
||||
}
|
||||
}
|
||||
|
||||
return ClampWindowToScreen(screenPos, screenWidth, screenHeight, width, height);
|
||||
}
|
||||
|
||||
static ScreenCoordsXY GetCentrePositionForNewWindow(int32_t width, int32_t height)
|
||||
{
|
||||
auto uiContext = GetContext()->GetUiContext();
|
||||
auto screenWidth = uiContext->GetWidth();
|
||||
auto screenHeight = uiContext->GetHeight();
|
||||
return ScreenCoordsXY{ (screenWidth - width) / 2, std::max(kTopToolbarHeight + 1, (screenHeight - height) / 2) };
|
||||
}
|
||||
|
||||
static int32_t WindowGetWidgetIndex(const WindowBase& w, Widget* widget)
|
||||
{
|
||||
const auto it = std::find_if(
|
||||
|
@ -432,7 +259,7 @@ namespace OpenRCT2
|
|||
auto cursorState = ContextGetCursorState();
|
||||
int32_t absolute_wheel = cursorState->wheel;
|
||||
int32_t relative_wheel = absolute_wheel - _previousAbsoluteWheel;
|
||||
int32_t pixel_scroll = relative_wheel * WindowScrollPixels;
|
||||
int32_t pixel_scroll = relative_wheel * kWindowScrollPixels;
|
||||
_previousAbsoluteWheel = absolute_wheel;
|
||||
|
||||
if (relative_wheel == 0)
|
||||
|
@ -441,7 +268,7 @@ namespace OpenRCT2
|
|||
// Check window cursor is over
|
||||
if (!(InputTestFlag(INPUT_FLAG_5)))
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindFromPoint(cursorState->position);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -596,18 +423,21 @@ namespace OpenRCT2
|
|||
}
|
||||
else
|
||||
{
|
||||
WindowClose(*this);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->Close(*this);
|
||||
}
|
||||
}
|
||||
|
||||
void Window::CloseOthers()
|
||||
{
|
||||
WindowCloseAllExceptNumberAndClass(number, classification);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseAllExceptNumberAndClass(number, classification);
|
||||
}
|
||||
|
||||
void Window::CloseOthersOfThisClass()
|
||||
{
|
||||
WindowCloseByClass(classification);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(classification);
|
||||
}
|
||||
|
||||
CloseWindowModifier Window::GetCloseModifier()
|
||||
|
@ -734,96 +564,6 @@ namespace OpenRCT2::Ui::Windows
|
|||
static TextInputSession* _textInput;
|
||||
static WidgetIdentifier _currentTextBox = { { WindowClass::Null, 0 }, 0 };
|
||||
|
||||
WindowBase* WindowCreate(
|
||||
std::unique_ptr<WindowBase>&& wp, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height, uint32_t flags)
|
||||
{
|
||||
if (flags & WF_AUTO_POSITION)
|
||||
{
|
||||
if (flags & WF_CENTRE_SCREEN)
|
||||
{
|
||||
pos = GetCentrePositionForNewWindow(width, height);
|
||||
}
|
||||
else
|
||||
{
|
||||
pos = GetAutoPositionForNewWindow(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
// Check if there are any window slots left
|
||||
// include kWindowLimitReserved for items such as the main viewport and toolbars to not appear to be counted.
|
||||
if (g_window_list.size() >= static_cast<size_t>(Config::Get().general.WindowLimit + kWindowLimitReserved))
|
||||
{
|
||||
// Close least recently used window
|
||||
for (auto& w : g_window_list)
|
||||
{
|
||||
if (w->flags & WF_DEAD)
|
||||
continue;
|
||||
if (!(w->flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT | WF_NO_AUTO_CLOSE)))
|
||||
{
|
||||
WindowClose(*w.get());
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Find right position to insert new window
|
||||
auto itDestPos = g_window_list.end();
|
||||
if (flags & WF_STICK_TO_BACK)
|
||||
{
|
||||
for (auto it = g_window_list.begin(); it != g_window_list.end(); it++)
|
||||
{
|
||||
if ((*it)->flags & WF_DEAD)
|
||||
continue;
|
||||
if (!((*it)->flags & WF_STICK_TO_BACK))
|
||||
{
|
||||
itDestPos = it;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (!(flags & WF_STICK_TO_FRONT))
|
||||
{
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
|
||||
{
|
||||
if ((*it)->flags & WF_DEAD)
|
||||
continue;
|
||||
if (!((*it)->flags & WF_STICK_TO_FRONT))
|
||||
{
|
||||
itDestPos = it.base();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto itNew = g_window_list.insert(itDestPos, std::move(wp));
|
||||
auto w = itNew->get();
|
||||
|
||||
// Setup window
|
||||
w->classification = cls;
|
||||
w->flags = flags;
|
||||
|
||||
// Play sounds and flash the window
|
||||
if (!(flags & (WF_STICK_TO_BACK | WF_STICK_TO_FRONT)))
|
||||
{
|
||||
w->flags |= WF_WHITE_BORDER_MASK;
|
||||
OpenRCT2::Audio::Play(OpenRCT2::Audio::SoundId::WindowOpen, 0, pos.x + (width / 2));
|
||||
}
|
||||
|
||||
w->windowPos = pos;
|
||||
w->width = width;
|
||||
w->height = height;
|
||||
w->min_width = width;
|
||||
w->max_width = width;
|
||||
w->min_height = height;
|
||||
w->max_height = height;
|
||||
|
||||
w->focus = std::nullopt;
|
||||
|
||||
ColourSchemeUpdate(w);
|
||||
w->Invalidate();
|
||||
w->OnOpen();
|
||||
return w;
|
||||
}
|
||||
|
||||
WindowBase* WindowGetListening()
|
||||
{
|
||||
for (auto it = g_window_list.rbegin(); it != g_window_list.rend(); it++)
|
||||
|
@ -860,7 +600,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
_currentTextBox.widget_index = callWidget;
|
||||
_textBoxFrameNo = 0;
|
||||
|
||||
WindowCloseByClass(WindowClass::Textinput);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::Textinput);
|
||||
|
||||
_textBoxInput = existingText;
|
||||
|
||||
|
@ -871,7 +612,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
if (_usingWidgetTextBox)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByNumber(_currentTextBox.window.classification, _currentTextBox.window.number);
|
||||
_currentTextBox.window.classification = WindowClass::Null;
|
||||
_currentTextBox.window.number = 0;
|
||||
|
@ -897,7 +638,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (_usingWidgetTextBox)
|
||||
{
|
||||
_textBoxFrameNo = 0;
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByNumber(_currentTextBox.window.classification, _currentTextBox.window.number);
|
||||
WidgetInvalidate(*w, _currentTextBox.widget_index);
|
||||
w->OnTextInput(_currentTextBox.widget_index, _textBoxInput);
|
||||
|
|
|
@ -55,68 +55,6 @@ namespace OpenRCT2
|
|||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
WindowBase* WindowCreate(
|
||||
std::unique_ptr<WindowBase>&& w, WindowClass cls, ScreenCoordsXY pos, int32_t width, int32_t height, uint32_t flags);
|
||||
template<typename T, typename... TArgs, typename std::enable_if<std::is_base_of<WindowBase, T>::value>::type* = nullptr>
|
||||
T* WindowCreate(
|
||||
WindowClass cls, const ScreenCoordsXY& pos = {}, int32_t width = 0, int32_t height = 0, uint32_t flags = 0,
|
||||
TArgs&&... args)
|
||||
{
|
||||
return static_cast<T*>(WindowCreate(std::make_unique<T>(std::forward<TArgs>(args)...), cls, pos, width, height, flags));
|
||||
}
|
||||
template<typename T, typename... TArgs, typename std::enable_if<std::is_base_of<WindowBase, T>::value>::type* = nullptr>
|
||||
T* WindowCreate(WindowClass cls, int32_t width, int32_t height, uint32_t flags, TArgs&&... args)
|
||||
{
|
||||
return static_cast<T*>(
|
||||
WindowCreate(std::make_unique<T>(std::forward<TArgs>(args)...), cls, {}, width, height, flags | WF_AUTO_POSITION));
|
||||
}
|
||||
template<typename T, typename std::enable_if<std::is_base_of<WindowBase, T>::value>::type* = nullptr>
|
||||
T* WindowFocusOrCreate(WindowClass cls, const ScreenCoordsXY& pos, int32_t width, int32_t height, uint32_t flags = 0)
|
||||
{
|
||||
auto* w = WindowBringToFrontByClass(cls);
|
||||
if (w == nullptr)
|
||||
{
|
||||
w = WindowCreate<T>(cls, pos, width, height, flags);
|
||||
}
|
||||
return static_cast<T*>(w);
|
||||
}
|
||||
template<typename T, typename std::enable_if<std::is_base_of<WindowBase, T>::value>::type* = nullptr>
|
||||
T* WindowFocusOrCreate(WindowClass cls, int32_t width, int32_t height, uint32_t flags = 0)
|
||||
{
|
||||
auto* w = WindowBringToFrontByClass(cls);
|
||||
if (w == nullptr)
|
||||
{
|
||||
w = WindowCreate<T>(cls, width, height, flags);
|
||||
}
|
||||
return static_cast<T*>(w);
|
||||
}
|
||||
|
||||
void RideConstructionToolupdateEntranceExit(const ScreenCoordsXY& screenCoords);
|
||||
void RideConstructionToolupdateConstruct(const ScreenCoordsXY& screenCoords);
|
||||
void RideConstructionTooldownConstruct(const ScreenCoordsXY& screenCoords);
|
||||
void UpdateGhostTrackAndArrow();
|
||||
void WindowRideConstructionKeyboardShortcutTurnLeft();
|
||||
void WindowRideConstructionKeyboardShortcutTurnRight();
|
||||
void WindowRideConstructionKeyboardShortcutUseTrackDefault();
|
||||
void WindowRideConstructionKeyboardShortcutSlopeDown();
|
||||
void WindowRideConstructionKeyboardShortcutSlopeUp();
|
||||
void WindowRideConstructionKeyboardShortcutChainLiftToggle();
|
||||
void WindowRideConstructionKeyboardShortcutBankLeft();
|
||||
void WindowRideConstructionKeyboardShortcutBankRight();
|
||||
void WindowRideConstructionKeyboardShortcutPreviousTrack();
|
||||
void WindowRideConstructionKeyboardShortcutNextTrack();
|
||||
void WindowRideConstructionKeyboardShortcutBuildCurrent();
|
||||
void WindowRideConstructionKeyboardShortcutDemolishCurrent();
|
||||
|
||||
void WindowFootpathKeyboardShortcutTurnLeft();
|
||||
void WindowFootpathKeyboardShortcutTurnRight();
|
||||
void WindowFootpathKeyboardShortcutSlopeDown();
|
||||
void WindowFootpathKeyboardShortcutSlopeUp();
|
||||
void WindowFootpathKeyboardShortcutBuildCurrent();
|
||||
void WindowFootpathKeyboardShortcutDemolishCurrent();
|
||||
|
||||
void WindowTileInspectorKeyboardShortcutToggleInvisibility();
|
||||
|
||||
extern const StringId ColourSchemeNames[4];
|
||||
|
||||
WindowBase* WindowGetListening();
|
||||
|
|
|
@ -101,7 +101,7 @@
|
|||
<ClInclude Include="UiContext.h" />
|
||||
<ClInclude Include="UiStringIds.h" />
|
||||
<ClInclude Include="WindowManager.h" />
|
||||
<ClInclude Include="windows\Window.h" />
|
||||
<ClInclude Include="windows\Windows.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="audio\AudioChannel.cpp" />
|
||||
|
|
|
@ -145,7 +145,7 @@ namespace OpenRCT2
|
|||
TrackElemType::RightFlyerLargeHalfLoopInvertedUp,
|
||||
TrackElemType::RightFlyerLargeHalfLoopUninvertedDown,
|
||||
};
|
||||
constexpr size_t DropdownLength = DropdownOrder.size();
|
||||
constexpr size_t kDropdownLength = DropdownOrder.size();
|
||||
|
||||
// Update the magic number with the current number of track elements to silence
|
||||
static_assert(EnumValue(TrackElemType::Count) == 349, "Reminder to add new track element to special dropdown list");
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "../interface/Viewport.h"
|
||||
#include "../interface/Window.h"
|
||||
#include "../windows/Windows.h"
|
||||
|
||||
#include <cassert>
|
||||
#include <numeric>
|
||||
|
|
|
@ -83,7 +83,7 @@ namespace OpenRCT2::Scripting
|
|||
images.resize(count);
|
||||
|
||||
auto base = GfxObjectAllocateImages(images.data(), count);
|
||||
if (base == ImageIndexUndefined)
|
||||
if (base == kImageIndexUndefined)
|
||||
{
|
||||
return {};
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
#include "../interface/Viewport.h"
|
||||
#include "../interface/Widget.h"
|
||||
#include "../interface/Window.h"
|
||||
#include "../windows/Windows.h"
|
||||
|
||||
#include <numeric>
|
||||
#include <openrct2/Context.h>
|
||||
|
@ -26,7 +26,7 @@ using namespace OpenRCT2::Ui::Windows;
|
|||
|
||||
namespace OpenRCT2::Scripting
|
||||
{
|
||||
constexpr size_t COLUMN_HEADER_HEIGHT = kListRowHeight + 1;
|
||||
constexpr size_t kColumnHeaderHeight = kListRowHeight + 1;
|
||||
|
||||
template<>
|
||||
ColumnSortOrder FromDuk(const DukValue& d)
|
||||
|
@ -431,7 +431,7 @@ ScreenSize CustomListView::GetSize()
|
|||
result.height = static_cast<int32_t>(Items.size() * kListRowHeight);
|
||||
if (ShowColumnHeaders)
|
||||
{
|
||||
result.height += COLUMN_HEADER_HEIGHT;
|
||||
result.height += kColumnHeaderHeight;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -472,7 +472,7 @@ void CustomListView::MouseOver(const ScreenCoordsXY& pos, bool isMouseDown)
|
|||
HighlightedCell = hitResult;
|
||||
if (HighlightedCell != LastHighlightedCell)
|
||||
{
|
||||
if (hitResult->Row != HEADER_ROW && OnHighlight.context() != nullptr && OnHighlight.is_function())
|
||||
if (hitResult->Row != kHeaderRow && OnHighlight.context() != nullptr && OnHighlight.is_function())
|
||||
{
|
||||
auto ctx = OnHighlight.context();
|
||||
duk_push_int(ctx, static_cast<int32_t>(HighlightedCell->Row));
|
||||
|
@ -489,7 +489,7 @@ void CustomListView::MouseOver(const ScreenCoordsXY& pos, bool isMouseDown)
|
|||
// Update the header currently held down
|
||||
if (isMouseDown)
|
||||
{
|
||||
if (hitResult && hitResult->Row == HEADER_ROW)
|
||||
if (hitResult && hitResult->Row == kHeaderRow)
|
||||
{
|
||||
ColumnHeaderPressedCurrentState = (hitResult->Column == ColumnHeaderPressed);
|
||||
Invalidate();
|
||||
|
@ -511,7 +511,7 @@ void CustomListView::MouseDown(const ScreenCoordsXY& pos)
|
|||
auto hitResult = GetItemIndexAt(pos);
|
||||
if (hitResult)
|
||||
{
|
||||
if (hitResult->Row != HEADER_ROW)
|
||||
if (hitResult->Row != kHeaderRow)
|
||||
{
|
||||
if (CanSelect)
|
||||
{
|
||||
|
@ -531,7 +531,7 @@ void CustomListView::MouseDown(const ScreenCoordsXY& pos)
|
|||
}
|
||||
}
|
||||
}
|
||||
if (hitResult && hitResult->Row == HEADER_ROW)
|
||||
if (hitResult && hitResult->Row == kHeaderRow)
|
||||
{
|
||||
if (Columns[hitResult->Column].CanSort)
|
||||
{
|
||||
|
@ -546,7 +546,7 @@ void CustomListView::MouseDown(const ScreenCoordsXY& pos)
|
|||
void CustomListView::MouseUp(const ScreenCoordsXY& pos)
|
||||
{
|
||||
auto hitResult = GetItemIndexAt(pos);
|
||||
if (hitResult && hitResult->Row == HEADER_ROW)
|
||||
if (hitResult && hitResult->Row == kHeaderRow)
|
||||
{
|
||||
if (hitResult->Column == ColumnHeaderPressed)
|
||||
{
|
||||
|
@ -566,7 +566,7 @@ void CustomListView::Paint(WindowBase* w, DrawPixelInfo& dpi, const ScrollArea*
|
|||
auto paletteIndex = ColourMapA[w->colours[1].colour].mid_light;
|
||||
GfxFillRect(dpi, { { dpi.x, dpi.y }, { dpi.x + dpi.width, dpi.y + dpi.height } }, paletteIndex);
|
||||
|
||||
int32_t y = ShowColumnHeaders ? COLUMN_HEADER_HEIGHT : 0;
|
||||
int32_t y = ShowColumnHeaders ? kColumnHeaderHeight : 0;
|
||||
for (size_t i = 0; i < Items.size(); i++)
|
||||
{
|
||||
if (y > dpi.y + dpi.height)
|
||||
|
@ -787,12 +787,12 @@ std::optional<RowColumn> CustomListView::GetItemIndexAt(const ScreenCoordsXY& po
|
|||
if (ShowColumnHeaders && absoluteY >= 0 && absoluteY < kListRowHeight)
|
||||
{
|
||||
result = RowColumn();
|
||||
result->Row = HEADER_ROW;
|
||||
result->Row = kHeaderRow;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Check what row we pressed
|
||||
int32_t firstY = ShowColumnHeaders ? COLUMN_HEADER_HEIGHT : 0;
|
||||
int32_t firstY = ShowColumnHeaders ? kColumnHeaderHeight : 0;
|
||||
int32_t row = (pos.y - firstY) / kListRowHeight;
|
||||
if (row >= 0 && row < static_cast<int32_t>(Items.size()))
|
||||
{
|
||||
|
|
|
@ -94,7 +94,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
class CustomListView
|
||||
{
|
||||
private:
|
||||
static constexpr int32_t HEADER_ROW = -1;
|
||||
static constexpr int32_t kHeaderRow = -1;
|
||||
|
||||
WindowBase* ParentWindow{};
|
||||
size_t ScrollIndex{};
|
||||
|
|
|
@ -259,7 +259,7 @@ namespace OpenRCT2::Scripting
|
|||
}
|
||||
else
|
||||
{
|
||||
customTool.Filter = ViewportInteractionItemAll;
|
||||
customTool.Filter = kViewportInteractionItemAll;
|
||||
}
|
||||
|
||||
customTool.onStart = dukValue["onStart"];
|
||||
|
@ -268,7 +268,7 @@ namespace OpenRCT2::Scripting
|
|||
customTool.onUp = dukValue["onUp"];
|
||||
customTool.onFinish = dukValue["onFinish"];
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto toolbarWindow = windowMgr->FindByClass(WindowClass::TopToolbar);
|
||||
if (toolbarWindow != nullptr)
|
||||
{
|
||||
|
|
|
@ -15,7 +15,7 @@
|
|||
#include "../interface/Widget.h"
|
||||
#include "../scripting/ScGraphicsContext.hpp"
|
||||
#include "../scripting/ScWidget.hpp"
|
||||
#include "../windows/Window.h"
|
||||
#include "../windows/Windows.h"
|
||||
#include "CustomListView.h"
|
||||
#include "ScUi.hpp"
|
||||
#include "ScWindow.hpp"
|
||||
|
@ -580,8 +580,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_CLOSE:
|
||||
WindowClose(*this);
|
||||
{
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->Close(*this);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
{
|
||||
if (widgetIndex >= WIDX_TAB_0
|
||||
|
@ -641,7 +644,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
widget--;
|
||||
auto selectedIndex = widgetDesc->SelectedIndex;
|
||||
const auto& items = widgetDesc->Items;
|
||||
const auto numItems = std::min<size_t>(items.size(), Dropdown::ItemsMaxSize);
|
||||
const auto numItems = std::min<size_t>(items.size(), Dropdown::kItemsMaxSize);
|
||||
for (size_t i = 0; i < numItems; i++)
|
||||
{
|
||||
gDropdownItems[i].Format = STR_OPTIONS_DROPDOWN_ITEM;
|
||||
|
@ -901,7 +904,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
widget.top = 17;
|
||||
widget.bottom = 43;
|
||||
widget.image = ImageId(SPR_TAB, FilterPaletteID::PaletteNull);
|
||||
widget.tooltip = STR_NONE;
|
||||
widget.tooltip = kStringIdNone;
|
||||
widgetList.push_back(widget);
|
||||
_info.WidgetIndexMap.push_back(std::numeric_limits<size_t>::max());
|
||||
}
|
||||
|
@ -958,7 +961,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
widget.right = desc.X + desc.Width - 1;
|
||||
widget.bottom = desc.Y + desc.Height - 1;
|
||||
widget.content = std::numeric_limits<uint32_t>::max();
|
||||
widget.tooltip = STR_NONE;
|
||||
widget.tooltip = kStringIdNone;
|
||||
widget.sztooltip = const_cast<utf8*>(desc.Tooltip.c_str());
|
||||
widget.flags |= WIDGET_FLAGS::TOOLTIP_IS_STRING;
|
||||
if (desc.IsDisabled)
|
||||
|
@ -1030,7 +1033,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
widget.top = desc.Y + 1;
|
||||
widget.bottom = desc.Y + desc.Height - 2;
|
||||
widget.text = STR_DROPDOWN_GLYPH;
|
||||
widget.tooltip = STR_NONE;
|
||||
widget.tooltip = kStringIdNone;
|
||||
if (desc.IsDisabled)
|
||||
widget.flags |= WIDGET_FLAGS::IS_DISABLED;
|
||||
widgetList.push_back(widget);
|
||||
|
@ -1081,7 +1084,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
widget.top = desc.Y + 1;
|
||||
widget.bottom = desc.Y + desc.Height - 2;
|
||||
widget.text = STR_NUMERIC_UP;
|
||||
widget.tooltip = STR_NONE;
|
||||
widget.tooltip = kStringIdNone;
|
||||
if (desc.IsDisabled)
|
||||
widget.flags |= WIDGET_FLAGS::IS_DISABLED;
|
||||
widget.flags |= WIDGET_FLAGS::IS_HOLDABLE;
|
||||
|
@ -1103,7 +1106,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
else if (desc.Type == "viewport")
|
||||
{
|
||||
widget.type = WindowWidgetType::Viewport;
|
||||
widget.text = STR_NONE;
|
||||
widget.text = kStringIdNone;
|
||||
widgetList.push_back(widget);
|
||||
}
|
||||
}
|
||||
|
@ -1111,7 +1114,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
static rct_windownumber GetNewWindowNumber()
|
||||
{
|
||||
auto result = _nextWindowNumber++;
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
while (windowMgr->FindByNumber(WindowClass::Custom, result) != nullptr)
|
||||
{
|
||||
result++;
|
||||
|
@ -1126,15 +1129,17 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
auto desc = CustomWindowDesc::FromDukValue(dukDesc);
|
||||
uint16_t windowFlags = WF_RESIZABLE | WF_TRANSPARENT;
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
CustomWindow* window{};
|
||||
if (desc.X && desc.Y)
|
||||
{
|
||||
window = WindowCreate<CustomWindow>(
|
||||
window = windowMgr->Create<CustomWindow>(
|
||||
WindowClass::Custom, { *desc.X, *desc.Y }, desc.Width, desc.Height, windowFlags, owner, desc);
|
||||
}
|
||||
else
|
||||
{
|
||||
window = WindowCreate<CustomWindow>(WindowClass::Custom, desc.Width, desc.Height, windowFlags, owner, desc);
|
||||
window = windowMgr->Create<CustomWindow>(WindowClass::Custom, desc.Width, desc.Height, windowFlags, owner, desc);
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
@ -1483,7 +1488,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
for (auto& window : customWindows)
|
||||
{
|
||||
WindowClose(*window.get());
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->Close(*window.get());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#ifdef ENABLE_SCRIPTING
|
||||
|
||||
#include "../windows/Window.h"
|
||||
#include "../windows/Windows.h"
|
||||
#include "CustomMenu.h"
|
||||
#include "ScImageManager.hpp"
|
||||
#include "ScTileSelection.hpp"
|
||||
|
@ -183,23 +183,25 @@ namespace OpenRCT2::Scripting
|
|||
|
||||
void closeWindows(std::string classification, DukValue id)
|
||||
{
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
auto cls = GetClassification(classification);
|
||||
if (cls != WindowClass::Null)
|
||||
{
|
||||
if (id.type() == DukValue::Type::NUMBER)
|
||||
{
|
||||
WindowCloseByNumber(cls, id.as_uint());
|
||||
windowMgr->CloseByNumber(cls, id.as_uint());
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowCloseByClass(cls);
|
||||
windowMgr->CloseByClass(cls);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void closeAllWindows()
|
||||
{
|
||||
WindowCloseAll();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseAll();
|
||||
}
|
||||
|
||||
std::shared_ptr<ScWindow> getWindow(DukValue a) const
|
||||
|
@ -238,15 +240,15 @@ namespace OpenRCT2::Scripting
|
|||
{
|
||||
try
|
||||
{
|
||||
constexpr int32_t MaxLengthAllowed = 4096;
|
||||
constexpr int32_t kMaxLengthAllowed = 4096;
|
||||
auto plugin = _scriptEngine.GetExecInfo().GetCurrentPlugin();
|
||||
auto title = desc["title"].as_string();
|
||||
auto description = desc["description"].as_string();
|
||||
auto initialValue = AsOrDefault(desc["initialValue"], "");
|
||||
auto maxLength = AsOrDefault(desc["maxLength"], MaxLengthAllowed);
|
||||
auto maxLength = AsOrDefault(desc["maxLength"], kMaxLengthAllowed);
|
||||
auto callback = desc["callback"];
|
||||
WindowTextInputOpen(
|
||||
title, description, initialValue, std::clamp(maxLength, 0, MaxLengthAllowed),
|
||||
title, description, initialValue, std::clamp(maxLength, 0, kMaxLengthAllowed),
|
||||
[this, plugin, callback](std::string_view value) {
|
||||
auto dukValue = ToDuk(_scriptEngine.GetContext(), value);
|
||||
_scriptEngine.ExecutePluginCall(plugin, callback, { dukValue }, false);
|
||||
|
|
|
@ -253,7 +253,7 @@ namespace OpenRCT2::Scripting
|
|||
if (_class == WindowClass::MainWindow)
|
||||
return WindowGetMain();
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
return windowMgr->FindByNumber(_class, _number);
|
||||
}
|
||||
|
||||
|
|
|
@ -393,7 +393,7 @@ namespace OpenRCT2::Scripting
|
|||
if (_class == WindowClass::MainWindow)
|
||||
return WindowGetMain();
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
return windowMgr->FindByNumber(_class, _number);
|
||||
}
|
||||
|
||||
|
@ -506,7 +506,7 @@ namespace OpenRCT2::Scripting
|
|||
auto widget = GetWidget();
|
||||
if (widget != nullptr && (widget->type == WindowWidgetType::FlatBtn || widget->type == WindowWidgetType::ImgBtn))
|
||||
{
|
||||
if (GetTargetAPIVersion() <= API_VERSION_63_G2_REORDER)
|
||||
if (GetTargetAPIVersion() <= kApiVersionG2Reorder)
|
||||
{
|
||||
return LegacyIconIndex(widget->image.GetIndex());
|
||||
}
|
||||
|
|
|
@ -305,7 +305,8 @@ namespace OpenRCT2::Scripting
|
|||
auto w = GetWindow();
|
||||
if (w != nullptr)
|
||||
{
|
||||
WindowClose(*w);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->Close(*w);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -326,10 +327,11 @@ namespace OpenRCT2::Scripting
|
|||
|
||||
void bringToFront()
|
||||
{
|
||||
auto w = GetWindow();
|
||||
auto* w = GetWindow();
|
||||
if (w != nullptr)
|
||||
{
|
||||
WindowBringToFront(*w);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
w = windowMgr->BringToFront(*w);
|
||||
w->flags |= WF_WHITE_BORDER_MASK;
|
||||
}
|
||||
}
|
||||
|
@ -360,7 +362,7 @@ namespace OpenRCT2::Scripting
|
|||
private:
|
||||
WindowBase* GetWindow() const
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
return windowMgr->FindByNumber(_class, _number);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include "../interface/Window.h"
|
||||
|
||||
#include <memory>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Diagnostic.h>
|
||||
#include <openrct2/Game.h>
|
||||
|
@ -406,31 +406,32 @@ namespace OpenRCT2::Title
|
|||
|
||||
void CloseParkSpecificWindows()
|
||||
{
|
||||
WindowCloseByClass(WindowClass::ConstructRide);
|
||||
WindowCloseByClass(WindowClass::DemolishRidePrompt);
|
||||
WindowCloseByClass(WindowClass::EditorInventionListDrag);
|
||||
WindowCloseByClass(WindowClass::EditorInventionList);
|
||||
WindowCloseByClass(WindowClass::EditorObjectSelection);
|
||||
WindowCloseByClass(WindowClass::EditorObjectiveOptions);
|
||||
WindowCloseByClass(WindowClass::EditorScenarioOptions);
|
||||
WindowCloseByClass(WindowClass::Finances);
|
||||
WindowCloseByClass(WindowClass::FirePrompt);
|
||||
WindowCloseByClass(WindowClass::GuestList);
|
||||
WindowCloseByClass(WindowClass::InstallTrack);
|
||||
WindowCloseByClass(WindowClass::Peep);
|
||||
WindowCloseByClass(WindowClass::Ride);
|
||||
WindowCloseByClass(WindowClass::RideConstruction);
|
||||
WindowCloseByClass(WindowClass::RideList);
|
||||
WindowCloseByClass(WindowClass::Scenery);
|
||||
WindowCloseByClass(WindowClass::Staff);
|
||||
WindowCloseByClass(WindowClass::TrackDeletePrompt);
|
||||
WindowCloseByClass(WindowClass::TrackDesignList);
|
||||
WindowCloseByClass(WindowClass::TrackDesignPlace);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::ConstructRide);
|
||||
windowMgr->CloseByClass(WindowClass::DemolishRidePrompt);
|
||||
windowMgr->CloseByClass(WindowClass::EditorInventionListDrag);
|
||||
windowMgr->CloseByClass(WindowClass::EditorInventionList);
|
||||
windowMgr->CloseByClass(WindowClass::EditorObjectSelection);
|
||||
windowMgr->CloseByClass(WindowClass::EditorObjectiveOptions);
|
||||
windowMgr->CloseByClass(WindowClass::EditorScenarioOptions);
|
||||
windowMgr->CloseByClass(WindowClass::Finances);
|
||||
windowMgr->CloseByClass(WindowClass::FirePrompt);
|
||||
windowMgr->CloseByClass(WindowClass::GuestList);
|
||||
windowMgr->CloseByClass(WindowClass::InstallTrack);
|
||||
windowMgr->CloseByClass(WindowClass::Peep);
|
||||
windowMgr->CloseByClass(WindowClass::Ride);
|
||||
windowMgr->CloseByClass(WindowClass::RideConstruction);
|
||||
windowMgr->CloseByClass(WindowClass::RideList);
|
||||
windowMgr->CloseByClass(WindowClass::Scenery);
|
||||
windowMgr->CloseByClass(WindowClass::Staff);
|
||||
windowMgr->CloseByClass(WindowClass::TrackDeletePrompt);
|
||||
windowMgr->CloseByClass(WindowClass::TrackDesignList);
|
||||
windowMgr->CloseByClass(WindowClass::TrackDesignPlace);
|
||||
}
|
||||
|
||||
void PrepareParkForPlayback()
|
||||
{
|
||||
auto windowManager = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto windowManager = Ui::GetWindowManager();
|
||||
auto& gameState = GetGameState();
|
||||
windowManager->SetMainView(gameState.SavedView, gameState.SavedViewZoom, gameState.SavedViewRotation);
|
||||
ResetEntitySpatialIndices();
|
||||
|
|
|
@ -11,8 +11,7 @@
|
|||
|
||||
#include <SDL_clipboard.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/OpenRCT2.h>
|
||||
#include <openrct2/Version.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
|
@ -20,6 +19,7 @@
|
|||
#include <openrct2/localisation/StringIds.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -66,8 +66,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
static constexpr Widget _windowAboutOpenRCT2Widgets[] = {
|
||||
WIDGETS_MAIN,
|
||||
MakeWidget({10, 60}, {WW - 20, 20}, WindowWidgetType::LabelCentred, WindowColour::Secondary, STR_ABOUT_OPENRCT2_DESCRIPTION), // Introduction
|
||||
MakeWidget({30, 90}, {128, 128}, WindowWidgetType::Placeholder, WindowColour::Secondary, STR_NONE), // OpenRCT2 Logo
|
||||
MakeWidget({168, 100}, {173, 24}, WindowWidgetType::Placeholder, WindowColour::Secondary, STR_NONE), // Build version
|
||||
MakeWidget({30, 90}, {128, 128}, WindowWidgetType::Placeholder, WindowColour::Secondary, kStringIdNone), // OpenRCT2 Logo
|
||||
MakeWidget({168, 100}, {173, 24}, WindowWidgetType::Placeholder, WindowColour::Secondary, kStringIdNone), // Build version
|
||||
MakeWidget({344, 100 }, {24, 24}, WindowWidgetType::ImgBtn, WindowColour::Secondary, ImageId(SPR_G2_COPY), STR_COPY_BUILD_HASH ), // "Copy build info" button
|
||||
MakeWidget({168, 115 + 20}, {200, 14}, WindowWidgetType::Placeholder, WindowColour::Secondary, STR_UPDATE_AVAILABLE ), // "new version" button
|
||||
MakeWidget({168, 115 + 40}, {200, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_CHANGELOG_ELLIPSIS), // changelog button
|
||||
|
@ -280,6 +280,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* AboutOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<AboutWindow>(WindowClass::About, WW, WH, WF_CENTRE_SCREEN);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<AboutWindow>(WindowClass::About, WW, WH, WF_CENTRE_SCREEN);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "../UiStringIds.h"
|
||||
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/AssetPack.h>
|
||||
#include <openrct2/AssetPackManager.h>
|
||||
#include <openrct2/Context.h>
|
||||
|
@ -19,6 +19,7 @@
|
|||
#include <openrct2/localisation/StringIds.h>
|
||||
#include <openrct2/object/ObjectManager.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -343,7 +344,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* AssetPacksOpen()
|
||||
{
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto flags = WF_AUTO_POSITION | WF_CENTRE_SCREEN;
|
||||
return WindowFocusOrCreate<AssetPacksWindow>(WindowClass::AssetPacks, WW, WH, flags);
|
||||
|
||||
return windowMgr->FocusOrCreate<AssetPacksWindow>(WindowClass::AssetPacks, WW, WH, flags);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/Viewport.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/actions/BannerRemoveAction.h>
|
||||
#include <openrct2/actions/BannerSetNameAction.h>
|
||||
|
@ -21,6 +21,7 @@
|
|||
#include <openrct2/object/BannerSceneryEntry.h>
|
||||
#include <openrct2/object/ObjectEntryManager.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Banner.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
#include <openrct2/world/tile_element/BannerElement.h>
|
||||
|
@ -312,12 +313,13 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* BannerOpen(rct_windownumber number)
|
||||
{
|
||||
auto w = static_cast<BannerWindow*>(WindowBringToFrontByNumber(WindowClass::Banner, number));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = static_cast<BannerWindow*>(windowMgr->BringToFrontByNumber(WindowClass::Banner, number));
|
||||
|
||||
if (w != nullptr)
|
||||
return w;
|
||||
|
||||
w = WindowCreate<BannerWindow>(WindowClass::Banner, WW, WH, 0);
|
||||
w = windowMgr->Create<BannerWindow>(WindowClass::Banner, WW, WH, 0);
|
||||
|
||||
if (w != nullptr)
|
||||
w->Initialise(number);
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
|
||||
#include <fstream>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Diagnostic.h>
|
||||
#include <openrct2/OpenRCT2.h>
|
||||
#include <openrct2/PlatformEnvironment.h>
|
||||
|
@ -21,6 +20,7 @@
|
|||
#include <openrct2/localisation/Formatting.h>
|
||||
#include <openrct2/platform/Platform.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <vector>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -318,7 +318,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* ChangelogOpen(int personality)
|
||||
{
|
||||
auto* window = WindowBringToFrontByClass(WindowClass::Changelog);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::Changelog);
|
||||
if (window == nullptr)
|
||||
{
|
||||
// Create a new centred window
|
||||
|
@ -328,7 +329,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
int32_t height = (screenHeight * 4) / 5;
|
||||
|
||||
auto pos = ChangelogWindow::GetCentrePositionForNewWindow(width, height);
|
||||
auto* newWindow = WindowCreate<ChangelogWindow>(WindowClass::Changelog, pos, width, height, WF_RESIZABLE);
|
||||
auto* newWindow = windowMgr->Create<ChangelogWindow>(WindowClass::Changelog, pos, width, height, WF_RESIZABLE);
|
||||
newWindow->SetPersonality(personality);
|
||||
return newWindow;
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <iterator>
|
||||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/GameState.h>
|
||||
|
@ -25,6 +25,7 @@
|
|||
#include <openrct2/localisation/Localisation.Date.h>
|
||||
#include <openrct2/network/network.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/util/Util.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <openrct2/world/tile_element/SurfaceElement.h>
|
||||
|
@ -347,7 +348,7 @@ static constexpr Widget window_cheats_weather_widgets[] =
|
|||
{
|
||||
MAIN_CHEATS_WIDGETS,
|
||||
MakeWidget ({ 5, 48}, {238, 50}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_CHEAT_WEATHER_GROUP ), // Weather group
|
||||
MakeWidget ({126, 62}, {111, 14}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_NONE, STR_CHANGE_WEATHER_TOOLTIP ), // Force weather
|
||||
MakeWidget ({126, 62}, {111, 14}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, kStringIdNone, STR_CHANGE_WEATHER_TOOLTIP ), // Force weather
|
||||
MakeWidget ({225, 63}, { 11, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_CHANGE_WEATHER_TOOLTIP ), // Force weather
|
||||
MakeWidget ({ 11, 80}, CHEAT_CHECK, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_CHEAT_FREEZE_WEATHER, STR_CHEAT_FREEZE_WEATHER_TIP), // Freeze weather
|
||||
MakeWidget ({ 5, 102}, {238, 37}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_FAUNA ), // Fauna group
|
||||
|
@ -1345,10 +1346,11 @@ static StringId window_cheats_page_titles[] = {
|
|||
|
||||
WindowBase* CheatsOpen()
|
||||
{
|
||||
auto* window = WindowBringToFrontByClass(WindowClass::Cheats);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::Cheats);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = WindowCreate<CheatsWindow>(WindowClass::Cheats, ScreenCoordsXY(32, 32), WW, WH);
|
||||
window = windowMgr->Create<CheatsWindow>(WindowClass::Cheats, ScreenCoordsXY(32, 32), WW, WH);
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
|
|
@ -11,14 +11,13 @@
|
|||
|
||||
#include <openrct2-ui/interface/LandTool.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/Input.h>
|
||||
#include <openrct2/actions/ClearAction.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
|
@ -48,7 +47,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget(
|
||||
{ 27, 17 }, { 44, 32 }, WindowWidgetType::ImgBtn, WindowColour::Primary, SPR_LAND_TOOL_SIZE_0,
|
||||
STR_NONE), // preview box
|
||||
kStringIdNone), // preview box
|
||||
MakeRemapWidget(
|
||||
{ 28, 18 }, { 16, 16 }, WindowWidgetType::TrnBtn, WindowColour::Secondary, SPR_LAND_TOOL_DECREASE,
|
||||
STR_ADJUST_SMALLER_LAND_TIP), // decrement size
|
||||
|
@ -105,7 +104,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
Formatter ft;
|
||||
ft.Add<uint16_t>(kLandToolMinimumSize);
|
||||
ft.Add<uint16_t>(kLandToolMaximumSize);
|
||||
TextInputOpen(WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, 3);
|
||||
TextInputOpen(
|
||||
WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, kStringIdNone, kStringIdNone, 3);
|
||||
break;
|
||||
}
|
||||
case WIDX_SMALL_SCENERY:
|
||||
|
@ -343,7 +343,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
case WIDX_BACKGROUND:
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByClass(WindowClass::Error) == nullptr && (gMapSelectFlags & MAP_SELECT_FLAG_ENABLE))
|
||||
{
|
||||
auto action = GetClearAction();
|
||||
|
@ -380,7 +380,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* ClearSceneryOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<CleanSceneryWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<CleanSceneryWindow>(
|
||||
WindowClass::ClearScenery, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <openrct2-ui/UiStringIds.h>
|
||||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/core/EnumUtils.hpp>
|
||||
#include <openrct2/core/String.hpp>
|
||||
|
@ -18,6 +18,7 @@
|
|||
#include <openrct2/interface/Colour.h>
|
||||
#include <openrct2/localisation/Currency.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -42,7 +43,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
static Widget window_custom_currency_widgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeSpinnerWidgets({100, 30}, {101, 11}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_CURRENCY_FORMAT), // NB: 3 widgets
|
||||
MakeWidget ({120, 50}, { 81, 11}, WindowWidgetType::Button, WindowColour::Secondary, STR_EMPTY ),
|
||||
MakeWidget ({120, 50}, { 81, 11}, WindowWidgetType::Button, WindowColour::Secondary, kStringIdEmpty ),
|
||||
MakeWidget ({220, 50}, {131, 11}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ),
|
||||
MakeWidget ({339, 51}, { 11, 9}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH ),
|
||||
};
|
||||
|
@ -227,6 +228,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* CustomCurrencyOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<CustomCurrencyWindow>(WindowClass::CustomCurrencyConfig, WW, WH, WF_CENTRE_SCREEN);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<CustomCurrencyWindow>(WindowClass::CustomCurrencyConfig, WW, WH, WF_CENTRE_SCREEN);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/core/Guard.hpp>
|
||||
#include <openrct2/localisation/Language.h>
|
||||
|
@ -16,6 +16,7 @@
|
|||
#include <openrct2/paint/Paint.h>
|
||||
#include <openrct2/paint/tile_element/Paint.TileElement.h>
|
||||
#include <openrct2/ride/TrackPaint.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -153,7 +154,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* DebugPaintOpen()
|
||||
{
|
||||
auto* window = WindowFocusOrCreate<DebugPaintWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<DebugPaintWindow>(
|
||||
WindowClass::DebugPaint, { 16, ContextGetHeight() - 16 - 33 - WINDOW_HEIGHT }, WINDOW_WIDTH, WINDOW_HEIGHT,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT);
|
||||
|
||||
|
|
|
@ -8,14 +8,12 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/actions/RideDemolishAction.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
@ -103,21 +101,21 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* RideDemolishPromptOpen(const Ride& ride)
|
||||
{
|
||||
WindowBase* w;
|
||||
DemolishRidePromptWindow* newWindow;
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->FindByClass(WindowClass::DemolishRidePrompt);
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
w = windowMgr->FindByClass(WindowClass::DemolishRidePrompt);
|
||||
DemolishRidePromptWindow* newWindow;
|
||||
if (w != nullptr)
|
||||
{
|
||||
auto windowPos = w->windowPos;
|
||||
WindowClose(*w);
|
||||
newWindow = WindowCreate<DemolishRidePromptWindow>(
|
||||
windowMgr->Close(*w);
|
||||
|
||||
newWindow = windowMgr->Create<DemolishRidePromptWindow>(
|
||||
WindowClass::DemolishRidePrompt, windowPos, WW, WH, WF_TRANSPARENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
newWindow = WindowCreate<DemolishRidePromptWindow>(
|
||||
newWindow = windowMgr->Create<DemolishRidePromptWindow>(
|
||||
WindowClass::DemolishRidePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT);
|
||||
}
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/localisation/Formatting.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -46,8 +47,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
};
|
||||
|
||||
int32_t gDropdownNumItems;
|
||||
Dropdown::Item gDropdownItems[Dropdown::ItemsMaxSize];
|
||||
static ImageId _dropdownItemsImages[Dropdown::ItemsMaxSize];
|
||||
Dropdown::Item gDropdownItems[Dropdown::kItemsMaxSize];
|
||||
static ImageId _dropdownItemsImages[Dropdown::kItemsMaxSize];
|
||||
bool gDropdownIsColour;
|
||||
int32_t gDropdownLastColourHover;
|
||||
int32_t gDropdownHighlightedIndex;
|
||||
|
@ -140,26 +141,26 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
|
||||
StringId item = gDropdownItems[i].Format;
|
||||
if (item == Dropdown::FormatLandPicker || item == Dropdown::FormatColourPicker)
|
||||
if (item == Dropdown::kFormatLandPicker || item == Dropdown::kFormatColourPicker)
|
||||
{
|
||||
// Image item
|
||||
auto image = UseImages ? _dropdownItemsImages[i]
|
||||
: ImageId(static_cast<uint32_t>(gDropdownItems[i].Args));
|
||||
if (item == Dropdown::FormatColourPicker && highlightedIndex == i)
|
||||
if (item == Dropdown::kFormatColourPicker && highlightedIndex == i)
|
||||
image = image.WithIndexOffset(1);
|
||||
GfxDrawSprite(dpi, image, screenCoords);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Text item
|
||||
if (i < Dropdown::ItemsMaxSize && Dropdown::IsChecked(i))
|
||||
if (i < Dropdown::kItemsMaxSize && Dropdown::IsChecked(i))
|
||||
item++;
|
||||
|
||||
// Calculate colour
|
||||
ColourWithFlags colour = { colours[0].colour };
|
||||
if (i == highlightedIndex)
|
||||
colour.colour = COLOUR_WHITE;
|
||||
if (i < Dropdown::ItemsMaxSize && Dropdown::IsDisabled(i))
|
||||
if (i < Dropdown::kItemsMaxSize && Dropdown::IsDisabled(i))
|
||||
colour = { colours[0].colour, EnumToFlag(ColourFlag::inset) };
|
||||
|
||||
// Draw item string
|
||||
|
@ -357,7 +358,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowDropdownClose();
|
||||
|
||||
// Create the window (width/height position are set later)
|
||||
auto* w = WindowCreate<DropdownWindow>(WindowClass::Dropdown, width, custom_height, WF_STICK_TO_FRONT);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->Create<DropdownWindow>(WindowClass::Dropdown, width, custom_height, WF_STICK_TO_FRONT);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->SetTextItems(screenPos, extray, colour, custom_height, flags, num_items, width);
|
||||
|
@ -390,7 +392,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowDropdownClose();
|
||||
|
||||
// Create the window (width/height position are set later)
|
||||
auto* w = WindowCreate<DropdownWindow>(WindowClass::Dropdown, itemWidth, itemHeight, WF_STICK_TO_FRONT);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->Create<DropdownWindow>(WindowClass::Dropdown, itemWidth, itemHeight, WF_STICK_TO_FRONT);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->SetImageItems({ x, y }, extray, colour, numItems, itemWidth, itemHeight, numColumns);
|
||||
|
@ -399,7 +402,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowDropdownClose()
|
||||
{
|
||||
WindowCloseByClass(WindowClass::Dropdown);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::Dropdown);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -510,7 +514,7 @@ static constexpr colour_t kColoursDropdownOrder[] = {
|
|||
auto imageId = (orderedColour == COLOUR_INVISIBLE) ? ImageId(SPR_G2_ICON_PALETTE_INVISIBLE, COLOUR_WHITE)
|
||||
: ImageId(SPR_PALETTE_BTN, orderedColour);
|
||||
|
||||
gDropdownItems[i].Format = Dropdown::FormatColourPicker;
|
||||
gDropdownItems[i].Format = Dropdown::kFormatColourPicker;
|
||||
Dropdown::SetImage(i, imageId);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "../interface/Theme.h"
|
||||
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Editor.h>
|
||||
#include <openrct2/EditorObjectSelectionSession.h>
|
||||
|
@ -22,6 +22,7 @@
|
|||
#include <openrct2/management/Research.h>
|
||||
#include <openrct2/scenario/Scenario.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
|
@ -104,7 +105,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else if (!(gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER))
|
||||
{
|
||||
if (GetNumFreeEntities() != MAX_ENTITIES || GetGameState().Park.Flags & PARK_FLAGS_SPRITES_INITIALISED)
|
||||
if (GetNumFreeEntities() != kMaxEntities || GetGameState().Park.Flags & PARK_FLAGS_SPRITES_INITIALISED)
|
||||
{
|
||||
HidePreviousStepButton();
|
||||
}
|
||||
|
@ -140,7 +141,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (widgetIndex == WIDX_PREVIOUS_STEP_BUTTON)
|
||||
{
|
||||
if ((gScreenFlags & SCREEN_FLAGS_TRACK_DESIGNER)
|
||||
|| (GetNumFreeEntities() == MAX_ENTITIES && !(gameState.Park.Flags & PARK_FLAGS_SPRITES_INITIALISED)))
|
||||
|| (GetNumFreeEntities() == kMaxEntities && !(gameState.Park.Flags & PARK_FLAGS_SPRITES_INITIALISED)))
|
||||
{
|
||||
((this)->*(_previousButtonMouseUp[EnumValue(gameState.EditorStep)]))();
|
||||
}
|
||||
|
@ -154,14 +155,18 @@ namespace OpenRCT2::Ui::Windows
|
|||
private:
|
||||
void JumpBackToObjectSelection() const
|
||||
{
|
||||
WindowCloseAll();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseAll();
|
||||
|
||||
GetGameState().EditorStep = EditorStep::ObjectSelection;
|
||||
GfxInvalidateScreen();
|
||||
}
|
||||
|
||||
void JumpBackToLandscapeEditor() const
|
||||
{
|
||||
WindowCloseAll();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseAll();
|
||||
|
||||
SetAllSceneryItemsInvented();
|
||||
WindowScenerySetDefaultPlacementConfiguration();
|
||||
GetGameState().EditorStep = EditorStep::LandscapeEditor;
|
||||
|
@ -171,7 +176,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void JumpBackToInventionListSetUp() const
|
||||
{
|
||||
WindowCloseAll();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseAll();
|
||||
|
||||
ContextOpenWindow(WindowClass::EditorInventionList);
|
||||
GetGameState().EditorStep = EditorStep::InventionsListSetUp;
|
||||
GfxInvalidateScreen();
|
||||
|
@ -179,7 +186,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void JumpBackToOptionsSelection() const
|
||||
{
|
||||
WindowCloseAll();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseAll();
|
||||
|
||||
ContextOpenWindow(WindowClass::EditorScenarioOptions);
|
||||
GetGameState().EditorStep = EditorStep::OptionsSelection;
|
||||
GfxInvalidateScreen();
|
||||
|
@ -207,7 +216,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
auto [checksPassed, errorString] = Editor::CheckPark();
|
||||
if (checksPassed)
|
||||
{
|
||||
WindowCloseAll();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseAll();
|
||||
ContextOpenWindow(WindowClass::EditorInventionList);
|
||||
GetGameState().EditorStep = EditorStep::InventionsListSetUp;
|
||||
}
|
||||
|
@ -221,7 +231,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void JumpForwardToOptionsSelection() const
|
||||
{
|
||||
WindowCloseAll();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseAll();
|
||||
|
||||
ContextOpenWindow(WindowClass::EditorScenarioOptions);
|
||||
GetGameState().EditorStep = EditorStep::OptionsSelection;
|
||||
GfxInvalidateScreen();
|
||||
|
@ -229,7 +241,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void JumpForwardToObjectiveSelection() const
|
||||
{
|
||||
WindowCloseAll();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseAll();
|
||||
|
||||
ContextOpenWindow(WindowClass::EditorObjectiveOptions);
|
||||
GetGameState().EditorStep = EditorStep::ObjectiveSelection;
|
||||
GfxInvalidateScreen();
|
||||
|
@ -246,7 +260,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
return;
|
||||
}
|
||||
|
||||
WindowCloseAll();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseAll();
|
||||
auto intent = Intent(WindowClass::Loadsave);
|
||||
intent.PutExtra(INTENT_EXTRA_LOADSAVE_TYPE, LOADSAVETYPE_SAVE | LOADSAVETYPE_SCENARIO);
|
||||
intent.PutExtra(INTENT_EXTRA_PATH, gameState.ScenarioName);
|
||||
|
@ -381,7 +396,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* EditorBottomToolbarOpen()
|
||||
{
|
||||
auto* window = WindowCreate<EditorBottomToolbarWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->Create<EditorBottomToolbarWindow>(
|
||||
WindowClass::BottomToolbar, ScreenCoordsXY(0, ContextGetHeight() - 32), ContextGetWidth(), 32,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#include <iterator>
|
||||
#include <openrct2-ui/input/MouseInput.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Editor.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/Input.h>
|
||||
|
@ -26,7 +25,6 @@
|
|||
#include <openrct2/ride/RideData.h>
|
||||
#include <openrct2/ride/RideManager.hpp>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
|
||||
|
@ -490,7 +488,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (windowPos.x <= screenCoords.x && windowPos.y < screenCoords.y && windowPos.x + width > screenCoords.x
|
||||
&& windowPos.y + height > screenCoords.y)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WidgetIndex widgetIndex = windowMgr->FindWidgetFromPoint(*this, screenCoords);
|
||||
|
||||
auto& widget = widgets[widgetIndex];
|
||||
|
@ -595,7 +593,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* EditorInventionsListOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<InventionListWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<InventionListWindow>(
|
||||
WindowClass::EditorInventionList, WW, WH, WF_NO_SCROLLING | WF_RESIZABLE | WF_CENTRE_SCREEN);
|
||||
}
|
||||
#pragma endregion
|
||||
|
@ -615,7 +614,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
CursorID OnCursor(const WidgetIndex widx, const ScreenCoordsXY& screenCoords, const CursorID defaultCursor) override
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* inventionListWindow = static_cast<InventionListWindow*>(
|
||||
windowMgr->FindByClass(WindowClass::EditorInventionList));
|
||||
if (inventionListWindow != nullptr)
|
||||
|
@ -634,7 +633,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void OnMoved(const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* inventionListWindow = static_cast<InventionListWindow*>(
|
||||
windowMgr->FindByClass(WindowClass::EditorInventionList));
|
||||
if (inventionListWindow == nullptr)
|
||||
|
@ -691,8 +690,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
static void WindowEditorInventionsListDragOpen(
|
||||
ResearchItem* researchItem, const ScreenCoordsXY& editorPos, int objectSelectionScrollWidth)
|
||||
{
|
||||
WindowCloseByClass(WindowClass::EditorInventionListDrag);
|
||||
auto* wnd = WindowCreate<InventionDragWindow>(
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::EditorInventionListDrag);
|
||||
auto* wnd = windowMgr->Create<InventionDragWindow>(
|
||||
WindowClass::EditorInventionListDrag, 10, 14, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_SNAPPING);
|
||||
if (wnd != nullptr)
|
||||
{
|
||||
|
@ -702,7 +702,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
static const ResearchItem* WindowEditorInventionsListDragGetItem()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* wnd = static_cast<InventionDragWindow*>(windowMgr->FindByClass(WindowClass::EditorInventionListDrag));
|
||||
if (wnd == nullptr)
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <cctype>
|
||||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Diagnostic.h>
|
||||
#include <openrct2/Editor.h>
|
||||
|
@ -39,7 +39,6 @@
|
|||
#include <openrct2/scenario/Scenario.h>
|
||||
#include <openrct2/scenes/title/TitleScene.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <span>
|
||||
|
@ -524,7 +523,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
gDropdownItems[DDIX_FILTER_SEPARATOR].Format = 0;
|
||||
gDropdownItems[DDIX_FILTER_SELECTED].Format = STR_TOGGLE_OPTION;
|
||||
gDropdownItems[DDIX_FILTER_NONSELECTED].Format = STR_TOGGLE_OPTION;
|
||||
gDropdownItems[DDIX_FILTER_SEPARATOR].Args = STR_NONE;
|
||||
gDropdownItems[DDIX_FILTER_SEPARATOR].Args = kStringIdNone;
|
||||
gDropdownItems[DDIX_FILTER_SELECTED].Args = STR_SELECTED_ONLY;
|
||||
gDropdownItems[DDIX_FILTER_NONSELECTED].Args = STR_NON_SELECTED_ONLY;
|
||||
}
|
||||
|
@ -603,7 +602,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
// Used for in-game object selection cheat to prevent crashing the game
|
||||
// when windows attempt to draw objects that don't exist any more
|
||||
WindowCloseAllExceptClass(WindowClass::EditorObjectSelection);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseAllExceptClass(WindowClass::EditorObjectSelection);
|
||||
|
||||
int32_t selected_object = GetObjectFromObjectSelection(GetSelectedObjectType(), screenCoords.y);
|
||||
if (selected_object == -1)
|
||||
|
@ -961,7 +961,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
const auto numSubTabs = static_cast<int8_t>(currentPage.subTabs.size());
|
||||
for (int8_t i = 0; i <= 6; i++)
|
||||
{
|
||||
widgets[WIDX_SUB_TAB_0 + i].tooltip = i < numSubTabs ? currentPage.subTabs[i].tooltip : STR_NONE;
|
||||
widgets[WIDX_SUB_TAB_0 + i].tooltip = i < numSubTabs ? currentPage.subTabs[i].tooltip : kStringIdNone;
|
||||
widgets[WIDX_SUB_TAB_0 + i].type = i < numSubTabs ? WindowWidgetType::Tab : WindowWidgetType::Empty;
|
||||
pressed_widgets &= ~(1uLL << (WIDX_SUB_TAB_0 + i));
|
||||
}
|
||||
|
@ -1086,7 +1086,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
auto ft = Formatter();
|
||||
auto stringId = _listSortType == RIDE_SORT_TYPE ? static_cast<StringId>(_listSortDescending ? STR_DOWN : STR_UP)
|
||||
: STR_NONE;
|
||||
: kStringIdNone;
|
||||
ft.Add<StringId>(stringId);
|
||||
auto screenPos = windowPos + ScreenCoordsXY{ listSortTypeWidget.left + 1, listSortTypeWidget.top + 1 };
|
||||
DrawTextEllipsised(dpi, screenPos, listSortTypeWidget.width(), STR_OBJECTS_SORT_TYPE, ft, { colours[1] });
|
||||
|
@ -1096,7 +1096,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
auto ft = Formatter();
|
||||
auto stringId = _listSortType == RIDE_SORT_RIDE ? static_cast<StringId>(_listSortDescending ? STR_DOWN : STR_UP)
|
||||
: STR_NONE;
|
||||
: kStringIdNone;
|
||||
ft.Add<StringId>(stringId);
|
||||
auto screenPos = windowPos + ScreenCoordsXY{ listSortRideWidget.left + 1, listSortRideWidget.top + 1 };
|
||||
DrawTextEllipsised(dpi, screenPos, listSortRideWidget.width(), STR_OBJECTS_SORT_RIDE, ft, { colours[1] });
|
||||
|
@ -1529,7 +1529,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (item->Type == ObjectType::Ride)
|
||||
{
|
||||
ride_type_t rideType = 0;
|
||||
for (int32_t i = 0; i < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; i++)
|
||||
for (int32_t i = 0; i < RCT2::ObjectLimits::kMaxRideTypesPerRideEntry; i++)
|
||||
{
|
||||
if (item->RideInfo.RideType[i] != RIDE_TYPE_NULL)
|
||||
{
|
||||
|
@ -1644,7 +1644,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* EditorObjectSelectionOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<EditorObjectSelectionWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<EditorObjectSelectionWindow>(
|
||||
WindowClass::EditorObjectSelection, 755, 400, WF_10 | WF_RESIZABLE | WF_CENTRE_SCREEN);
|
||||
}
|
||||
|
||||
|
@ -1665,8 +1666,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
static StringId GetRideTypeStringId(const ObjectRepositoryItem* item)
|
||||
{
|
||||
StringId result = STR_NONE;
|
||||
for (int32_t i = 0; i < RCT2::ObjectLimits::MaxRideTypesPerRideEntry; i++)
|
||||
StringId result = kStringIdNone;
|
||||
for (int32_t i = 0; i < RCT2::ObjectLimits::kMaxRideTypesPerRideEntry; i++)
|
||||
{
|
||||
auto rideType = item->RideInfo.RideType[i];
|
||||
if (rideType != RIDE_TYPE_NULL)
|
||||
|
@ -1732,21 +1733,22 @@ namespace OpenRCT2::Ui::Windows
|
|||
LoadPalette();
|
||||
}
|
||||
if (showFallbackWarning)
|
||||
ContextShowError(STR_OBJECT_SELECTION_FALLBACK_IMAGES_WARNING, STR_EMPTY, Formatter::Common());
|
||||
ContextShowError(STR_OBJECT_SELECTION_FALLBACK_IMAGES_WARNING, kStringIdEmpty, Formatter::Common());
|
||||
}
|
||||
|
||||
bool EditorObjectSelectionWindowCheck()
|
||||
{
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
|
||||
auto [missingObjectType, errorString] = Editor::CheckObjectSelection();
|
||||
if (missingObjectType == ObjectType::None)
|
||||
{
|
||||
WindowCloseByClass(WindowClass::EditorObjectSelection);
|
||||
windowMgr->CloseByClass(WindowClass::EditorObjectSelection);
|
||||
return true;
|
||||
}
|
||||
|
||||
ContextShowError(STR_INVALID_SELECTION_OF_OBJECTS, errorString, {});
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::EditorObjectSelection);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "../interface/Dropdown.h"
|
||||
#include "../interface/Widget.h"
|
||||
#include "../interface/Window.h"
|
||||
#include "Window.h"
|
||||
#include "Windows.h"
|
||||
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/GameState.h>
|
||||
|
@ -27,6 +27,7 @@
|
|||
#include <openrct2/ride/RideManager.hpp>
|
||||
#include <openrct2/scenario/Scenario.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -119,13 +120,13 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
static constexpr Widget window_editor_objective_options_main_widgets[] = {
|
||||
MAIN_OBJECTIVE_OPTIONS_WIDGETS,
|
||||
MakeWidget ({ 98, 48}, {344, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_NONE, STR_SELECT_OBJECTIVE_FOR_THIS_SCENARIO_TIP ),
|
||||
MakeWidget ({ 98, 48}, {344, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, kStringIdNone, STR_SELECT_OBJECTIVE_FOR_THIS_SCENARIO_TIP ),
|
||||
MakeWidget ({430, 49}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_OBJECTIVE_FOR_THIS_SCENARIO_TIP ),
|
||||
MakeSpinnerWidgets({158, 65}, {120, 12}, WindowWidgetType::Button, WindowColour::Secondary ), // NB: 3 widgets
|
||||
MakeSpinnerWidgets({158, 82}, {120, 12}, WindowWidgetType::Button, WindowColour::Secondary ), // NB: 3 widgets
|
||||
MakeWidget ({370, 99}, { 75, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_CHANGE, STR_CHANGE_NAME_OF_PARK_TIP ),
|
||||
MakeWidget ({370, 116}, { 75, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_CHANGE, STR_CHANGE_NAME_OF_SCENARIO_TIP ),
|
||||
MakeWidget ({ 98, 133}, {180, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_NONE, STR_SELECT_WHICH_GROUP_THIS_SCENARIO_APPEARS_IN),
|
||||
MakeWidget ({ 98, 133}, {180, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, kStringIdNone, STR_SELECT_WHICH_GROUP_THIS_SCENARIO_APPEARS_IN),
|
||||
MakeWidget ({266, 134}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_WHICH_GROUP_THIS_SCENARIO_APPEARS_IN),
|
||||
MakeWidget ({370, 150}, { 75, 12}, WindowWidgetType::Button, WindowColour::Secondary, STR_CHANGE, STR_CHANGE_DETAIL_NOTES_ABOUT_PARK_SCENARIO_TIP),
|
||||
};
|
||||
|
@ -492,7 +493,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE:
|
||||
if (gameState.ScenarioObjective.Currency >= ObjectiveCurrencyLoanAndValueMax)
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -503,7 +504,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
case OBJECTIVE_MONTHLY_FOOD_INCOME:
|
||||
if (gameState.ScenarioObjective.Currency >= ObjectiveCurrencyFoodMax)
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -514,7 +515,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
case OBJECTIVE_10_ROLLERCOASTERS_LENGTH:
|
||||
if (gameState.ScenarioObjective.MinimumLength >= ObjectiveLengthMax)
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -525,7 +526,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
case OBJECTIVE_FINISH_5_ROLLERCOASTERS:
|
||||
if (gameState.ScenarioObjective.MinimumExcitement >= ObjectiveExcitementMax)
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -536,7 +537,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
default:
|
||||
if (gameState.ScenarioObjective.NumGuests >= ObjectiveGuestsMax)
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -557,7 +558,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
case OBJECTIVE_REPAY_LOAN_AND_PARK_VALUE:
|
||||
if (gameState.ScenarioObjective.Currency <= ObjectiveCurrencyLoanAndValueMin)
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -568,7 +569,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
case OBJECTIVE_MONTHLY_FOOD_INCOME:
|
||||
if (gameState.ScenarioObjective.Currency <= ObjectiveCurrencyFoodMin)
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -579,7 +580,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
case OBJECTIVE_10_ROLLERCOASTERS_LENGTH:
|
||||
if (gameState.ScenarioObjective.MinimumLength <= ObjectiveLengthMin)
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -590,7 +591,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
case OBJECTIVE_FINISH_5_ROLLERCOASTERS:
|
||||
if (gameState.ScenarioObjective.MinimumExcitement <= ObjectiveExcitementMin)
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -601,7 +602,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
default:
|
||||
if (gameState.ScenarioObjective.NumGuests <= ObjectiveGuestsMin)
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -617,7 +618,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
auto& gameState = GetGameState();
|
||||
if (gameState.ScenarioObjective.Year >= ObjectiveYearMax)
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -631,7 +632,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
auto& gameState = GetGameState();
|
||||
if (gameState.ScenarioObjective.Year <= ObjectiveYearMin)
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1169,11 +1170,12 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* EditorObjectiveOptionsOpen()
|
||||
{
|
||||
auto window = WindowBringToFrontByClass(WindowClass::EditorObjectiveOptions);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::EditorObjectiveOptions);
|
||||
if (window != nullptr)
|
||||
return window;
|
||||
|
||||
window = WindowCreate<EditorObjectiveOptionsWindow>(
|
||||
window = windowMgr->Create<EditorObjectiveOptionsWindow>(
|
||||
WindowClass::EditorObjectiveOptions, 450, 225, WF_10 | WF_CENTRE_SCREEN);
|
||||
|
||||
return window;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <openrct2-ui/interface/Viewport.h>
|
||||
#include <openrct2-ui/interface/ViewportInteraction.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Input.h>
|
||||
#include <openrct2/actions/ParkEntrancePlaceAction.h>
|
||||
|
@ -19,6 +19,7 @@
|
|||
#include <openrct2/object/ObjectLimits.h>
|
||||
#include <openrct2/object/ObjectManager.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/tile_element/EntranceElement.h>
|
||||
#include <openrct2/world/tile_element/PathElement.h>
|
||||
#include <openrct2/world/tile_element/Slope.h>
|
||||
|
@ -39,7 +40,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
struct EntranceSelection
|
||||
{
|
||||
ObjectEntryIndex entryIndex = OBJECT_ENTRY_INDEX_NULL;
|
||||
StringId stringId = STR_NONE;
|
||||
StringId stringId = kStringIdNone;
|
||||
ImageIndex imageId = kSpriteIdNull;
|
||||
};
|
||||
|
||||
|
@ -60,7 +61,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
static Widget _widgets[] = {
|
||||
WINDOW_SHIM(kWindowTitle, kWindowWidth, kWindowHeight),
|
||||
MakeWidget ({ 0, 43 }, { kWindowWidth, kWindowHeight - 43 }, WindowWidgetType::Resize, WindowColour::Secondary ),
|
||||
MakeTab ({ 3, 17 }, STR_NONE ),
|
||||
MakeTab ({ 3, 17 }, kStringIdNone ),
|
||||
MakeWidget ({ 2, 45 }, { kScrollWidth, kScrollHeight }, WindowWidgetType::Scroll, WindowColour::Secondary, SCROLL_VERTICAL ),
|
||||
MakeWidget ({ kWindowWidth - 26, 59 }, { 24, 24 }, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_ROTATE_ARROW), STR_ROTATE_OBJECTS_90 ),
|
||||
};
|
||||
|
@ -391,14 +392,13 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* EditorParkEntranceOpen()
|
||||
{
|
||||
WindowBase* window;
|
||||
|
||||
// Check if window is already open
|
||||
window = WindowBringToFrontByClass(WindowClass::EditorParkEntrance);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::EditorParkEntrance);
|
||||
if (window != nullptr)
|
||||
return window;
|
||||
|
||||
window = WindowCreate<EditorParkEntrance>(
|
||||
window = windowMgr->Create<EditorParkEntrance>(
|
||||
WindowClass::EditorParkEntrance, kWindowWidth, kWindowHeight, WF_10 | WF_RESIZABLE);
|
||||
|
||||
return window;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include "../interface/Dropdown.h"
|
||||
#include "../interface/Widget.h"
|
||||
#include "../interface/Window.h"
|
||||
#include "Window.h"
|
||||
#include "Windows.h"
|
||||
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Editor.h>
|
||||
|
@ -26,6 +26,7 @@
|
|||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/management/Finance.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Climate.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
|
@ -50,7 +51,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
WINDOW_EDITOR_SCENARIO_OPTIONS_PAGE_COUNT
|
||||
};
|
||||
|
||||
static constexpr StringId ClimateNames[] = {
|
||||
static constexpr StringId kClimateNames[] = {
|
||||
STR_CLIMATE_COOL_AND_WET,
|
||||
STR_CLIMATE_WARM,
|
||||
STR_CLIMATE_HOT_AND_DRY,
|
||||
|
@ -160,10 +161,10 @@ namespace OpenRCT2::Ui::Windows
|
|||
MakeRemapWidget ({ 65, 17}, { 31, 27}, WindowWidgetType::Tab, WindowColour::Secondary, SPR_TAB, STR_SCENARIO_OPTIONS_PARK_TIP ),
|
||||
MakeSpinnerWidgets({188, 48}, { 70, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // NB: 3 widgets
|
||||
MakeSpinnerWidgets({188, 65}, { 70, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // NB: 3 widgets
|
||||
MakeWidget ({ 8, 82}, { 210, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_NONE, STR_PAY_FOR_PARK_PAY_FOR_RIDES_TIP),
|
||||
MakeWidget ({ 8, 82}, { 210, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, kStringIdNone, STR_PAY_FOR_PARK_PAY_FOR_RIDES_TIP),
|
||||
MakeWidget ({206, 83}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_PAY_FOR_PARK_PAY_FOR_RIDES_TIP),
|
||||
MakeSpinnerWidgets({328, 82}, { 67, 12}, WindowWidgetType::Spinner, WindowColour::Secondary ), // NB: 3 widgets
|
||||
MakeWidget ({188, 99}, { 207, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_NONE, STR_SELECT_CLIMATE_TIP ),
|
||||
MakeWidget ({188, 99}, { 207, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, kStringIdNone, STR_SELECT_CLIMATE_TIP ),
|
||||
MakeWidget ({383, 100}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_SELECT_CLIMATE_TIP ),
|
||||
MakeWidget ({ 8, 116}, {WW_PARK - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_FORBID_TREE_REMOVAL, STR_FORBID_TREE_REMOVAL_TIP ),
|
||||
MakeWidget ({ 8, 133}, {WW_PARK - 16, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_FORBID_LANDSCAPE_CHANGES, STR_FORBID_LANDSCAPE_CHANGES_TIP ),
|
||||
|
@ -367,7 +368,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_CLOSE:
|
||||
WindowClose(*this);
|
||||
Close();
|
||||
break;
|
||||
case WIDX_TAB_1:
|
||||
case WIDX_TAB_2:
|
||||
|
@ -416,7 +417,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
for (i = 0; i < static_cast<uint8_t>(ClimateType::Count); i++)
|
||||
{
|
||||
gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItems[i].Args = ClimateNames[i];
|
||||
gDropdownItems[i].Args = kClimateNames[i];
|
||||
}
|
||||
WindowDropdownShowTextCustomWidth(
|
||||
{ windowPos.x + dropdownWidget.left, windowPos.y + dropdownWidget.top }, dropdownWidget.height() + 1,
|
||||
|
@ -438,7 +439,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_CASH, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_INCREASE_CASH, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -451,7 +452,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_CASH, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_REDUCE_CASH, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -464,7 +465,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_INIT_LOAN, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_INCREASE_INIT_LOAN, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -477,7 +478,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_INIT_LOAN, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_REDUCE_INIT_LOAN, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -490,7 +491,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_MAX_LOAN, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_INCREASE_MAX_LOAN, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -503,7 +504,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_MAX_LOAN, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_REDUCE_MAX_LOAN, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -516,7 +517,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_INTEREST_RATE, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_INCREASE_INTEREST_RATE, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -529,7 +530,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_INTEREST_RATE, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_REDUCE_INTEREST_RATE, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -669,7 +670,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_CLOSE:
|
||||
WindowClose(*this);
|
||||
Close();
|
||||
break;
|
||||
case WIDX_TAB_1:
|
||||
case WIDX_TAB_2:
|
||||
|
@ -717,7 +718,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -730,7 +731,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -743,7 +744,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -756,7 +757,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -769,7 +770,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -782,7 +783,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -795,7 +796,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -808,7 +809,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -915,7 +916,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_CLOSE:
|
||||
WindowClose(*this);
|
||||
Close();
|
||||
break;
|
||||
case WIDX_TAB_1:
|
||||
case WIDX_TAB_2:
|
||||
|
@ -991,7 +992,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -1004,7 +1005,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -1017,7 +1018,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -1030,7 +1031,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -1043,7 +1044,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_INCREASE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -1056,7 +1057,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_REDUCE_FURTHER, kStringIdNone, {});
|
||||
}
|
||||
Invalidate();
|
||||
break;
|
||||
|
@ -1245,7 +1246,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
// Climate value
|
||||
screenCoords = windowPos + ScreenCoordsXY{ climateWidget.left + 1, climateWidget.top };
|
||||
auto ft = Formatter();
|
||||
ft.Add<StringId>(ClimateNames[EnumValue(gameState.Climate)]);
|
||||
ft.Add<StringId>(kClimateNames[EnumValue(gameState.Climate)]);
|
||||
DrawTextBasic(dpi, screenCoords, STR_WINDOW_COLOUR_2_STRINGID, ft);
|
||||
}
|
||||
|
||||
|
@ -1254,6 +1255,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* EditorScenarioOptionsOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<EditorScenarioOptionsWindow>(WindowClass::EditorScenarioOptions, 280, 148, WF_NO_SCROLLING);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<EditorScenarioOptionsWindow>(
|
||||
WindowClass::EditorScenarioOptions, 280, 148, WF_NO_SCROLLING);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Diagnostic.h>
|
||||
#include <openrct2/OpenRCT2.h>
|
||||
|
@ -18,6 +18,7 @@
|
|||
#include <openrct2/drawing/Font.h>
|
||||
#include <openrct2/interface/Screenshot.h>
|
||||
#include <openrct2/localisation/Formatting.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -120,7 +121,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
|
||||
// Close any existing error windows if they exist.
|
||||
WindowCloseByClass(WindowClass::Error);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::Error);
|
||||
|
||||
// How wide is the error string?
|
||||
int32_t width = GfxGetStringWidthNewLined(buffer.data(), FontStyle::Medium);
|
||||
|
@ -138,7 +140,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
windowPosition.y = std::clamp(windowPosition.y, 22, ContextGetHeight() - height - 40);
|
||||
|
||||
auto errorWindow = std::make_unique<ErrorWindow>(std::move(buffer), numLines, autoClose);
|
||||
return WindowCreate(
|
||||
|
||||
return windowMgr->Create(
|
||||
std::move(errorWindow), WindowClass::Error, windowPosition, width, height, WF_STICK_TO_FRONT | WF_TRANSPARENT);
|
||||
}
|
||||
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/Graph.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/actions/ParkSetLoanAction.h>
|
||||
#include <openrct2/actions/ParkSetResearchFundingAction.h>
|
||||
|
@ -23,6 +22,7 @@
|
|||
#include <openrct2/ride/ShopItem.h>
|
||||
#include <openrct2/scenario/Scenario.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -722,7 +722,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ft.Add<StringId>(STR_NONE);
|
||||
ft.Add<StringId>(kStringIdNone);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -879,7 +879,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
static FinancesWindow* FinancesWindowOpen(uint8_t page)
|
||||
{
|
||||
auto* window = WindowFocusOrCreate<FinancesWindow>(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<FinancesWindow>(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10);
|
||||
|
||||
if (window != nullptr && page != WINDOW_FINANCES_PAGE_SUMMARY)
|
||||
window->SetPage(page);
|
||||
|
@ -889,7 +890,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* FinancesOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<FinancesWindow>(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<FinancesWindow>(WindowClass::Finances, WW_OTHER_TABS, WH_SUMMARY, WF_10);
|
||||
}
|
||||
|
||||
WindowBase* FinancesResearchOpen()
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
#include <openrct2-ui/interface/ViewportInteraction.h>
|
||||
#include <openrct2-ui/interface/ViewportQuery.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Cheats.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
|
@ -36,7 +36,6 @@
|
|||
#include <openrct2/paint/VirtualFloor.h>
|
||||
#include <openrct2/platform/Platform.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/ConstructionClearance.h>
|
||||
#include <openrct2/world/Footpath.h>
|
||||
|
@ -706,7 +705,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
defaultIndex = numPathTypes;
|
||||
}
|
||||
|
||||
gDropdownItems[numPathTypes].Format = STR_NONE;
|
||||
gDropdownItems[numPathTypes].Format = kStringIdNone;
|
||||
Dropdown::SetImage(numPathTypes, ImageId(pathType->PreviewImageId));
|
||||
_dropdownEntries.push_back({ ObjectType::FootpathSurface, i });
|
||||
numPathTypes++;
|
||||
|
@ -731,7 +730,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
defaultIndex = numPathTypes;
|
||||
}
|
||||
|
||||
gDropdownItems[numPathTypes].Format = STR_NONE;
|
||||
gDropdownItems[numPathTypes].Format = kStringIdNone;
|
||||
Dropdown::SetImage(
|
||||
numPathTypes, ImageId(showQueues ? pathEntry->GetQueuePreviewImage() : pathEntry->GetPreviewImage()));
|
||||
_dropdownEntries.push_back({ ObjectType::Paths, i });
|
||||
|
@ -765,7 +764,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
defaultIndex = numRailingsTypes;
|
||||
}
|
||||
|
||||
gDropdownItems[numRailingsTypes].Format = STR_NONE;
|
||||
gDropdownItems[numRailingsTypes].Format = kStringIdNone;
|
||||
Dropdown::SetImage(numRailingsTypes, ImageId(railingsEntry->PreviewImageId));
|
||||
_dropdownEntries.push_back({ ObjectType::FootpathRailings, i });
|
||||
numRailingsTypes++;
|
||||
|
@ -1236,7 +1235,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
Audio::Play3D(OpenRCT2::Audio::SoundId::PlaceItem, result->Position);
|
||||
}
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* self = static_cast<FootpathWindow*>(windowMgr->FindByClass(WindowClass::Footpath));
|
||||
if (self == nullptr)
|
||||
{
|
||||
|
@ -1627,7 +1626,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
return WindowFocusOrCreate<FootpathWindow>(WindowClass::Footpath, WW_WINDOW, WH_WINDOW, 0);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<FootpathWindow>(WindowClass::Footpath, WW_WINDOW, WH_WINDOW, 0);
|
||||
}
|
||||
|
||||
void WindowFootpathResetSelectedPath()
|
||||
|
@ -1637,7 +1637,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowFootpathKeyboardShortcutTurnLeft()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -1651,7 +1651,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowFootpathKeyboardShortcutTurnRight()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -1665,7 +1665,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowFootpathKeyboardShortcutSlopeDown()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -1679,7 +1679,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowFootpathKeyboardShortcutSlopeUp()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -1693,7 +1693,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowFootpathKeyboardShortcutDemolishCurrent()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -1707,7 +1707,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowFootpathKeyboardShortcutBuildCurrent()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::Footpath);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -1725,7 +1725,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
void ToggleFootpathWindow()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (windowMgr->FindByClass(WindowClass::Footpath) == nullptr)
|
||||
{
|
||||
ContextOpenWindow(WindowClass::Footpath);
|
||||
|
@ -1733,7 +1733,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
else
|
||||
{
|
||||
ToolCancel();
|
||||
WindowCloseByClass(WindowClass::Footpath);
|
||||
windowMgr->CloseByClass(WindowClass::Footpath);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include "../interface/Theme.h"
|
||||
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/GameState.h>
|
||||
|
@ -29,6 +29,7 @@
|
|||
#include <openrct2/object/PeepAnimationsObject.h>
|
||||
#include <openrct2/peep/PeepSpriteIds.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -351,7 +352,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
StringId stringId;
|
||||
auto ft = GetMapTooltip();
|
||||
std::memcpy(&stringId, ft.Data(), sizeof(StringId));
|
||||
if (stringId == STR_NONE)
|
||||
if (stringId == kStringIdNone)
|
||||
{
|
||||
// TODO: this string probably shouldn't be reused for this
|
||||
DrawTextWrapped(
|
||||
|
@ -677,7 +678,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
uint32_t line_height = FontGetLineHeight(FontStyle::Medium);
|
||||
uint32_t toolbar_height = line_height * 2 + 12;
|
||||
|
||||
GameBottomToolbar* window = WindowCreate<GameBottomToolbar>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->Create<GameBottomToolbar>(
|
||||
WindowClass::BottomToolbar, ScreenCoordsXY(0, screenHeight - toolbar_height), screenWidth, toolbar_height,
|
||||
WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/Viewport.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/GameState.h>
|
||||
|
@ -38,7 +38,6 @@
|
|||
#include <openrct2/ride/ShopItem.h>
|
||||
#include <openrct2/scenario/Scenario.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/util/Util.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
|
@ -639,7 +638,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
pickupAction.SetCallback([peepnum = number](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
return;
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* wind = windowMgr->FindByNumber(WindowClass::Peep, peepnum);
|
||||
if (wind != nullptr)
|
||||
{
|
||||
|
@ -951,7 +950,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
gPickupPeepImage = ImageId();
|
||||
|
||||
auto info = GetMapCoordinatesFromPos(screenCoords, ViewportInteractionItemAll);
|
||||
auto info = GetMapCoordinatesFromPos(screenCoords, kViewportInteractionItemAll);
|
||||
if (info.interactionType == ViewportInteractionItem::None)
|
||||
return;
|
||||
|
||||
|
@ -1911,14 +1910,15 @@ namespace OpenRCT2::Ui::Windows
|
|||
return StaffOpen(peep);
|
||||
}
|
||||
|
||||
auto* window = static_cast<GuestWindow*>(WindowBringToFrontByNumber(WindowClass::Peep, peep->Id.ToUnderlying()));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = static_cast<GuestWindow*>(windowMgr->BringToFrontByNumber(WindowClass::Peep, peep->Id.ToUnderlying()));
|
||||
if (window == nullptr)
|
||||
{
|
||||
int32_t windowWidth = 192;
|
||||
if (Config::Get().general.DebuggingTools)
|
||||
windowWidth += TabWidth;
|
||||
|
||||
window = WindowCreate<GuestWindow>(WindowClass::Peep, windowWidth, 157, WF_RESIZABLE);
|
||||
window = windowMgr->Create<GuestWindow>(WindowClass::Peep, windowWidth, 157, WF_RESIZABLE);
|
||||
if (window == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <cmath>
|
||||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/GameState.h>
|
||||
|
@ -26,7 +26,6 @@
|
|||
#include <openrct2/ride/RideData.h>
|
||||
#include <openrct2/scenario/Scenario.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <vector>
|
||||
|
@ -224,7 +223,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
auto guestRide = GetRide(RideId::FromUnderlying(index));
|
||||
if (guestRide != nullptr)
|
||||
{
|
||||
ft.Add<StringId>(STR_NONE);
|
||||
ft.Add<StringId>(kStringIdNone);
|
||||
guestRide->FormatNameTo(ft);
|
||||
|
||||
_selectedFilter = GuestFilterType::GuestsThinking;
|
||||
|
@ -460,7 +459,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
if (_selectedFilter)
|
||||
{
|
||||
if (_filterArguments.GetFirstStringId() != STR_NONE)
|
||||
if (_filterArguments.GetFirstStringId() != kStringIdNone)
|
||||
{
|
||||
format = GetFilterString(*_selectedFilter);
|
||||
}
|
||||
|
@ -809,9 +808,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
auto guestViewType = _selectedFilter == GuestFilterType::Guests ? GuestViewType::Actions : GuestViewType::Thoughts;
|
||||
auto peepArgs = GetArgumentsFromPeep(peep, guestViewType);
|
||||
if (_filterArguments.GetFirstStringId() == STR_NONE && _selectedFilter == GuestFilterType::GuestsThinking)
|
||||
if (_filterArguments.GetFirstStringId() == kStringIdNone && _selectedFilter == GuestFilterType::GuestsThinking)
|
||||
{
|
||||
Formatter(peepArgs.args).Add<StringId>(STR_NONE);
|
||||
Formatter(peepArgs.args).Add<StringId>(kStringIdNone);
|
||||
}
|
||||
return _filterArguments == peepArgs;
|
||||
}
|
||||
|
@ -866,7 +865,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
// Remove empty group (basically guests with no thoughts)
|
||||
auto foundGroup = std::find_if(std::begin(_groups), std::end(_groups), [](GuestGroup& group) {
|
||||
return group.Arguments.GetFirstStringId() == STR_EMPTY;
|
||||
return group.Arguments.GetFirstStringId() == kStringIdEmpty;
|
||||
});
|
||||
if (foundGroup != std::end(_groups))
|
||||
{
|
||||
|
@ -971,10 +970,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* GuestListOpen()
|
||||
{
|
||||
auto* window = WindowBringToFrontByClass(WindowClass::GuestList);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::GuestList);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = WindowCreate<GuestListWindow>(WindowClass::GuestList, 350, 330, WF_10 | WF_RESIZABLE);
|
||||
window = windowMgr->Create<GuestListWindow>(WindowClass::GuestList, 350, 330, WF_10 | WF_RESIZABLE);
|
||||
}
|
||||
return window;
|
||||
}
|
||||
|
@ -994,7 +994,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowGuestListRefreshList()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->FindByClass(WindowClass::GuestList);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include <memory>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Diagnostic.h>
|
||||
#include <openrct2/PlatformEnvironment.h>
|
||||
|
@ -26,6 +26,7 @@
|
|||
#include <openrct2/ride/TrackDesign.h>
|
||||
#include <openrct2/ride/TrackDesignRepository.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
|
@ -371,7 +372,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (!Path::CreateDirectory(destPath))
|
||||
{
|
||||
LOG_ERROR("Unable to create directory '%s'", destPath.c_str());
|
||||
ContextShowError(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_SAVE_TRACK_DESIGN, kStringIdNone, {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -380,7 +381,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (File::Exists(destPath))
|
||||
{
|
||||
LOG_INFO("%s already exists, prompting user for a different track design name", destPath.c_str());
|
||||
ContextShowError(STR_UNABLE_TO_INSTALL_THIS_TRACK_DESIGN, STR_NONE, {});
|
||||
ContextShowError(STR_UNABLE_TO_INSTALL_THIS_TRACK_DESIGN, kStringIdNone, {});
|
||||
WindowTextInputRawOpen(
|
||||
this, WIDX_INSTALL, STR_SELECT_NEW_NAME_FOR_TRACK_DESIGN,
|
||||
STR_AN_EXISTING_TRACK_DESIGN_ALREADY_HAS_THIS_NAME, {}, _trackName.c_str(), 255);
|
||||
|
@ -393,7 +394,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_CANT_SAVE_TRACK_DESIGN, STR_NONE, {});
|
||||
ContextShowError(STR_CANT_SAVE_TRACK_DESIGN, kStringIdNone, {});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -404,7 +405,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
auto trackDesign = TrackDesignImport(path);
|
||||
if (trackDesign == nullptr)
|
||||
{
|
||||
ContextShowError(STR_UNABLE_TO_LOAD_FILE, STR_NONE, {});
|
||||
ContextShowError(STR_UNABLE_TO_LOAD_FILE, kStringIdNone, {});
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
@ -420,8 +421,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
WindowCloseByClass(WindowClass::EditorObjectSelection);
|
||||
WindowCloseConstructionWindows();
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::EditorObjectSelection);
|
||||
windowMgr->CloseConstructionWindows();
|
||||
|
||||
gTrackDesignSceneryToggle = false;
|
||||
_currentTrackPieceDirection = 2;
|
||||
|
@ -430,7 +432,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
int32_t screenHeight = ContextGetHeight();
|
||||
auto screenPos = ScreenCoordsXY{ screenWidth / 2 - 201, std::max(kTopToolbarHeight + 1, screenHeight / 2 - 200) };
|
||||
|
||||
auto* window = WindowFocusOrCreate<InstallTrackWindow>(WindowClass::InstallTrack, screenPos, WW, WH, 0);
|
||||
auto* window = windowMgr->FocusOrCreate<InstallTrackWindow>(WindowClass::InstallTrack, screenPos, WW, WH, 0);
|
||||
window->SetupTrack(path, std::move(trackDesign));
|
||||
|
||||
return window;
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
#include <openrct2-ui/interface/LandTool.h>
|
||||
#include <openrct2-ui/interface/Viewport.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/Input.h>
|
||||
|
@ -28,7 +28,6 @@
|
|||
#include <openrct2/object/TerrainEdgeObject.h>
|
||||
#include <openrct2/object/TerrainSurfaceObject.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
|
@ -57,7 +56,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget ({19, 19}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_RIDE_CONSTRUCTION_SLOPE_UP), STR_ENABLE_MOUNTAIN_TOOL_TIP), // mountain mode
|
||||
MakeWidget ({55, 19}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, ImageId(SPR_PAINTBRUSH), STR_DISABLE_ELEVATION), // paint mode
|
||||
MakeWidget ({27, 48}, {44, 32}, WindowWidgetType::ImgBtn, WindowColour::Primary , ImageId(SPR_LAND_TOOL_SIZE_0), STR_NONE), // preview box
|
||||
MakeWidget ({27, 48}, {44, 32}, WindowWidgetType::ImgBtn, WindowColour::Primary , ImageId(SPR_LAND_TOOL_SIZE_0), kStringIdNone), // preview box
|
||||
MakeRemapWidget({28, 49}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Secondary, SPR_LAND_TOOL_DECREASE, STR_ADJUST_SMALLER_LAND_TIP), // decrement size
|
||||
MakeRemapWidget({54, 63}, {16, 16}, WindowWidgetType::TrnBtn, WindowColour::Secondary, SPR_LAND_TOOL_INCREASE, STR_ADJUST_LARGER_LAND_TIP), // increment size
|
||||
MakeWidget ({ 2, 106}, {47, 36}, WindowWidgetType::FlatBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_CHANGE_BASE_LAND_TIP), // floor texture
|
||||
|
@ -83,7 +82,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
Formatter ft;
|
||||
ft.Add<uint16_t>(kLandToolMinimumSize);
|
||||
ft.Add<uint16_t>(kLandToolMaximumSize);
|
||||
WindowTextInputOpen(this, WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, 3);
|
||||
WindowTextInputOpen(
|
||||
this, WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, kStringIdNone, kStringIdNone, 3);
|
||||
}
|
||||
|
||||
public:
|
||||
|
@ -400,7 +400,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
void LandToolDrag(const ScreenCoordsXY& screenPos)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FindFromPoint(screenPos);
|
||||
if (window == nullptr)
|
||||
return;
|
||||
|
@ -873,7 +873,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* LandOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<LandWindow>(WindowClass::Land, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<LandWindow>(WindowClass::Land, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <openrct2-ui/interface/Theme.h>
|
||||
#include <openrct2-ui/interface/Viewport.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/GameState.h>
|
||||
|
@ -23,6 +23,7 @@
|
|||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <openrct2/world/tile_element/SurfaceElement.h>
|
||||
|
||||
|
@ -579,13 +580,15 @@ namespace OpenRCT2::Ui::Windows
|
|||
Formatter ft;
|
||||
ft.Add<uint16_t>(kLandToolMinimumSize);
|
||||
ft.Add<uint16_t>(kLandToolMaximumSize);
|
||||
WindowTextInputOpen(this, WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, 3);
|
||||
WindowTextInputOpen(
|
||||
this, WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, kStringIdNone, kStringIdNone, 3);
|
||||
}
|
||||
};
|
||||
|
||||
WindowBase* LandRightsOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<LandRightsWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<LandRightsWindow>(
|
||||
WindowClass::LandRights, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -13,8 +13,7 @@
|
|||
#include <memory>
|
||||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Editor.h>
|
||||
#include <openrct2/FileClassifier.h>
|
||||
#include <openrct2/Game.h>
|
||||
|
@ -38,6 +37,7 @@
|
|||
#include <openrct2/scenes/title/TitleScene.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
#include <string>
|
||||
|
@ -82,7 +82,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
// clang-format off
|
||||
static constexpr Widget window_loadsave_widgets[] =
|
||||
{
|
||||
WINDOW_SHIM(STR_NONE, WW, WH),
|
||||
WINDOW_SHIM(kStringIdNone, WW, WH),
|
||||
MakeWidget({ 0, 15 }, { WW, WH - 15 }, WindowWidgetType::Resize, WindowColour::Secondary ), // WIDX_RESIZE
|
||||
MakeWidget({ 4, 36 }, { 84, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_LOADSAVE_DEFAULT, STR_LOADSAVE_DEFAULT_TIP), // WIDX_DEFAULT
|
||||
MakeWidget({ 88, 36 }, { 84, 14 }, WindowWidgetType::Button, WindowColour::Primary, STR_FILEBROWSER_ACTION_UP ), // WIDX_UP
|
||||
|
@ -284,7 +284,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
if (!IsValidPath(path))
|
||||
{
|
||||
ContextShowError(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {});
|
||||
ContextShowError(STR_ERROR_INVALID_CHARACTERS, kStringIdNone, {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -293,8 +293,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
// Closing this will cause a Ride window to pop up, so we have to do this to ensure that
|
||||
// no windows are open (besides the toolbars and LoadSave window).
|
||||
WindowCloseByClass(WindowClass::RideConstruction);
|
||||
WindowCloseAllExceptClass(WindowClass::Loadsave);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::RideConstruction);
|
||||
windowMgr->CloseAllExceptClass(WindowClass::Loadsave);
|
||||
|
||||
auto& gameState = GetGameState();
|
||||
|
||||
|
@ -305,7 +306,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (OpenRCT2::GetContext()->LoadParkFromFile(pathBuffer))
|
||||
{
|
||||
InvokeCallback(MODAL_RESULT_OK, pathBuffer);
|
||||
WindowCloseByClass(WindowClass::Loadsave);
|
||||
windowMgr->CloseByClass(WindowClass::Loadsave);
|
||||
GfxInvalidateScreen();
|
||||
}
|
||||
else
|
||||
|
@ -325,7 +326,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
gIsAutosaveLoaded = false;
|
||||
gFirstTimeSaving = false;
|
||||
|
||||
WindowCloseByClass(WindowClass::Loadsave);
|
||||
windowMgr->CloseByClass(WindowClass::Loadsave);
|
||||
GfxInvalidateScreen();
|
||||
|
||||
InvokeCallback(MODAL_RESULT_OK, pathBuffer);
|
||||
|
@ -359,7 +360,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (ScenarioSave(gameState, pathBuffer, Config::Get().general.SavePluginData ? 3 : 2))
|
||||
{
|
||||
gCurrentLoadedPath = pathBuffer;
|
||||
WindowCloseByClass(WindowClass::Loadsave);
|
||||
windowMgr->CloseByClass(WindowClass::Loadsave);
|
||||
GfxInvalidateScreen();
|
||||
InvokeCallback(MODAL_RESULT_OK, pathBuffer);
|
||||
}
|
||||
|
@ -382,7 +383,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
if (success)
|
||||
{
|
||||
WindowCloseByClass(WindowClass::Loadsave);
|
||||
windowMgr->CloseByClass(WindowClass::Loadsave);
|
||||
InvokeCallback(MODAL_RESULT_OK, pathBuffer);
|
||||
|
||||
auto* context = OpenRCT2::GetContext();
|
||||
|
@ -403,7 +404,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
auto intent = Intent(WindowClass::InstallTrack);
|
||||
intent.PutExtra(INTENT_EXTRA_PATH, std::string{ pathBuffer });
|
||||
ContextOpenIntent(&intent);
|
||||
WindowCloseByClass(WindowClass::Loadsave);
|
||||
windowMgr->CloseByClass(WindowClass::Loadsave);
|
||||
InvokeCallback(MODAL_RESULT_OK, pathBuffer);
|
||||
break;
|
||||
}
|
||||
|
@ -421,7 +422,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
if (success)
|
||||
{
|
||||
WindowCloseByClass(WindowClass::Loadsave);
|
||||
windowMgr->CloseByClass(WindowClass::Loadsave);
|
||||
WindowRideMeasurementsDesignCancel();
|
||||
InvokeCallback(MODAL_RESULT_OK, path);
|
||||
}
|
||||
|
@ -434,7 +435,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
|
||||
case (LOADSAVETYPE_LOAD | LOADSAVETYPE_HEIGHTMAP):
|
||||
WindowCloseByClass(WindowClass::Loadsave);
|
||||
windowMgr->CloseByClass(WindowClass::Loadsave);
|
||||
InvokeCallback(MODAL_RESULT_OK, pathBuffer);
|
||||
break;
|
||||
}
|
||||
|
@ -444,7 +445,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
OpenRCT2::Ui::FileDialogDesc desc = {};
|
||||
u8string extension;
|
||||
StringId title = STR_NONE;
|
||||
StringId title = kStringIdNone;
|
||||
switch (_type & 0x0E)
|
||||
{
|
||||
case LOADSAVETYPE_GAME:
|
||||
|
@ -769,7 +770,10 @@ namespace OpenRCT2::Ui::Windows
|
|||
void OnClose() override
|
||||
{
|
||||
_listItems.clear();
|
||||
WindowCloseByClass(WindowClass::LoadsaveOverwritePrompt);
|
||||
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::LoadsaveOverwritePrompt);
|
||||
|
||||
Config::Save();
|
||||
|
||||
// Unpause the game if not on title scene, nor in network play.
|
||||
|
@ -923,7 +927,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
const auto drawButtonCaption = [dpi, this](
|
||||
Widget& widget, StringId strId, FileBrowserSort ascSort,
|
||||
FileBrowserSort descSort) {
|
||||
StringId indicatorId = STR_NONE;
|
||||
StringId indicatorId = kStringIdNone;
|
||||
if (Config::Get().general.LoadSaveSort == ascSort)
|
||||
indicatorId = STR_UP;
|
||||
else if (Config::Get().general.LoadSaveSort == descSort)
|
||||
|
@ -974,12 +978,13 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
case WIDX_NEW_FILE:
|
||||
WindowTextInputOpen(
|
||||
this, WIDX_NEW_FILE, STR_NONE, STR_FILEBROWSER_FILE_NAME_PROMPT, {}, STR_STRING,
|
||||
this, WIDX_NEW_FILE, kStringIdNone, STR_FILEBROWSER_FILE_NAME_PROMPT, {}, STR_STRING,
|
||||
reinterpret_cast<uintptr_t>(_defaultPath.c_str()), 64);
|
||||
break;
|
||||
|
||||
case WIDX_NEW_FOLDER:
|
||||
WindowTextInputRawOpen(this, WIDX_NEW_FOLDER, STR_NONE, STR_FILEBROWSER_FOLDER_NAME_PROMPT, {}, "", 64);
|
||||
WindowTextInputRawOpen(
|
||||
this, WIDX_NEW_FOLDER, kStringIdNone, STR_FILEBROWSER_FOLDER_NAME_PROMPT, {}, "", 64);
|
||||
break;
|
||||
|
||||
case WIDX_BROWSE:
|
||||
|
@ -1121,7 +1126,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
if (!Platform::IsFilenameValid(text))
|
||||
{
|
||||
ContextShowError(STR_ERROR_INVALID_CHARACTERS, STR_NONE, {});
|
||||
ContextShowError(STR_ERROR_INVALID_CHARACTERS, kStringIdNone, {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1132,7 +1137,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
const u8string path = Path::Combine(_directory, text);
|
||||
if (!Path::CreateDirectory(path))
|
||||
{
|
||||
ContextShowError(STR_UNABLE_TO_CREATE_FOLDER, STR_NONE, {});
|
||||
ContextShowError(STR_UNABLE_TO_CREATE_FOLDER, kStringIdNone, {});
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -1335,7 +1340,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
const u8string path = GetDir(type);
|
||||
|
||||
auto* w = static_cast<LoadSaveWindow*>(WindowBringToFrontByClass(WindowClass::Loadsave));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = static_cast<LoadSaveWindow*>(windowMgr->BringToFrontByClass(WindowClass::Loadsave));
|
||||
if (w == nullptr)
|
||||
{
|
||||
if (config.FileBrowserWidth < kWindowSizeMin.width || config.FileBrowserHeight < kWindowSizeMin.height
|
||||
|
@ -1349,7 +1355,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
auto width = config.FileBrowserWidth;
|
||||
auto height = config.FileBrowserHeight;
|
||||
|
||||
w = WindowCreate<LoadSaveWindow>(
|
||||
w = windowMgr->Create<LoadSaveWindow>(
|
||||
WindowClass::Loadsave, width, height, WF_STICK_TO_FRONT | WF_RESIZABLE | WF_AUTO_POSITION | WF_CENTRE_SCREEN,
|
||||
type);
|
||||
}
|
||||
|
@ -1455,7 +1461,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
// As the LoadSaveWindow::Select function can change the order of the
|
||||
// windows we can't use WindowClose(w).
|
||||
WindowCloseByClass(WindowClass::LoadsaveOverwritePrompt);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::LoadsaveOverwritePrompt);
|
||||
break;
|
||||
}
|
||||
|
||||
|
@ -1481,9 +1488,10 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
static WindowBase* WindowOverwritePromptOpen(const std::string_view name, const std::string_view path)
|
||||
{
|
||||
WindowCloseByClass(WindowClass::LoadsaveOverwritePrompt);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::LoadsaveOverwritePrompt);
|
||||
|
||||
return WindowCreate<OverwritePromptWindow>(
|
||||
return windowMgr->Create<OverwritePromptWindow>(
|
||||
WindowClass::LoadsaveOverwritePrompt, OVERWRITE_WW, OVERWRITE_WH,
|
||||
WF_TRANSPARENT | WF_STICK_TO_FRONT | WF_CENTRE_SCREEN, name, path);
|
||||
}
|
||||
|
|
|
@ -11,9 +11,10 @@
|
|||
|
||||
#include <openrct2-ui/interface/Viewport.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Footpath.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -75,7 +76,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* MainOpen()
|
||||
{
|
||||
return WindowCreate<MainWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->Create<MainWindow>(
|
||||
WindowClass::MainWindow, { 0, 0 }, ContextGetWidth(), ContextGetHeight(), WF_STICK_TO_BACK);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <openrct2-ui/interface/ViewportInteraction.h>
|
||||
#include <openrct2-ui/interface/ViewportQuery.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Cheats.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
|
@ -31,7 +31,6 @@
|
|||
#include <openrct2/ride/TrainManager.h>
|
||||
#include <openrct2/ride/Vehicle.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Footpath.h>
|
||||
#include <openrct2/world/Scenery.h>
|
||||
|
@ -276,7 +275,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void OnMouseUp(WidgetIndex widgetIndex) override
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_CLOSE:
|
||||
|
@ -287,7 +286,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (!windowMgr->FindByClass(WindowClass::LandRights))
|
||||
ContextOpenWindow(WindowClass::LandRights);
|
||||
else
|
||||
WindowCloseByClass(WindowClass::LandRights);
|
||||
windowMgr->CloseByClass(WindowClass::LandRights);
|
||||
break;
|
||||
}
|
||||
case WIDX_BUILD_PARK_ENTRANCE:
|
||||
|
@ -295,7 +294,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (!windowMgr->FindByClass(WindowClass::EditorParkEntrance))
|
||||
ContextOpenWindow(WindowClass::EditorParkEntrance);
|
||||
else
|
||||
WindowCloseByClass(WindowClass::EditorParkEntrance);
|
||||
windowMgr->CloseByClass(WindowClass::EditorParkEntrance);
|
||||
break;
|
||||
}
|
||||
case WIDX_PEOPLE_STARTING_POSITION:
|
||||
|
@ -356,7 +355,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void OnUpdate() override
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
// the flickering frequency is reduced by 4, compared to the original
|
||||
// it was done due to inability to reproduce original frequency
|
||||
|
@ -600,7 +599,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void OnPrepareDraw() override
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
// Set the pressed widgets
|
||||
pressed_widgets = 0;
|
||||
|
@ -1130,7 +1129,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
Formatter ft;
|
||||
ft.Add<int16_t>(kMinimumMapSizePractical);
|
||||
ft.Add<int16_t>(kMaximumMapSizePractical);
|
||||
TextInputOpen(callingWidget, STR_MAP_SIZE_2, STR_ENTER_MAP_SIZE, ft, STR_NONE, STR_NONE, 4);
|
||||
TextInputOpen(callingWidget, STR_MAP_SIZE_2, STR_ENTER_MAP_SIZE, ft, kStringIdNone, kStringIdNone, 4);
|
||||
}
|
||||
|
||||
CoordsXY ScreenToMap(ScreenCoordsXY screenCoords)
|
||||
|
@ -1253,7 +1252,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
try
|
||||
{
|
||||
WindowBase* w = WindowFocusOrCreate<MapWindow>(WindowClass::Map, 245, 259, WF_10);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->FocusOrCreate<MapWindow>(WindowClass::Map, 245, 259, WF_10);
|
||||
w->selected_tab = 0;
|
||||
w->list_information_type = 0;
|
||||
return w;
|
||||
|
@ -1266,10 +1266,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowMapReset()
|
||||
{
|
||||
WindowBase* w;
|
||||
|
||||
// Check if window is even opened
|
||||
w = WindowBringToFrontByClass(WindowClass::Map);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->BringToFrontByClass(WindowClass::Map);
|
||||
if (w == nullptr)
|
||||
{
|
||||
return;
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/LandTool.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Input.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
|
@ -23,6 +23,7 @@
|
|||
#include <openrct2/object/TerrainEdgeObject.h>
|
||||
#include <openrct2/object/TerrainSurfaceObject.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/Map.h>
|
||||
#include <openrct2/world/map_generator/MapGen.h>
|
||||
|
@ -1529,7 +1530,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* MapgenOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<MapGenWindow>(WindowClass::Mapgen, WW, WH, WF_10 | WF_AUTO_POSITION | WF_CENTRE_SCREEN);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<MapGenWindow>(WindowClass::Mapgen, WW, WH, WF_10 | WF_AUTO_POSITION | WF_CENTRE_SCREEN);
|
||||
}
|
||||
|
||||
static void HeightmapLoadsaveCallback(int32_t result, const utf8* path)
|
||||
|
|
|
@ -11,12 +11,11 @@
|
|||
#include <openrct2-ui/input/InputManager.h>
|
||||
#include <openrct2-ui/interface/Theme.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Input.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -51,7 +50,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
StringId stringId;
|
||||
std::memcpy(&stringId, _mapTooltipArgs.Data(), sizeof(StringId));
|
||||
if (stringId == STR_NONE)
|
||||
if (stringId == kStringIdNone)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
@ -97,11 +96,12 @@ namespace OpenRCT2::Ui::Windows
|
|||
std::memcpy(&stringId, _mapTooltipArgs.Data(), sizeof(StringId));
|
||||
|
||||
auto& im = GetInputManager();
|
||||
auto* wm = GetContext()->GetUiContext()->GetWindowManager();
|
||||
if (_cursorHoldDuration < 25 || stringId == STR_NONE || im.IsModifierKeyPressed(ModifierKey::ctrl)
|
||||
auto* wm = GetWindowManager();
|
||||
if (_cursorHoldDuration < 25 || stringId == kStringIdNone || im.IsModifierKeyPressed(ModifierKey::ctrl)
|
||||
|| im.IsModifierKeyPressed(ModifierKey::shift) || wm->FindByClass(WindowClass::Error) != nullptr)
|
||||
{
|
||||
WindowCloseByClass(WindowClass::MapTooltip);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::MapTooltip);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -116,7 +116,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
const CursorState* state = ContextGetCursorState();
|
||||
auto pos = state->position + ScreenCoordsXY{ -width / 2, 15 };
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
if (auto w = windowMgr->FindByClass(WindowClass::MapTooltip))
|
||||
{
|
||||
w->Invalidate();
|
||||
|
@ -126,7 +126,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
else
|
||||
{
|
||||
w = WindowCreate<MapTooltip>(
|
||||
w = windowMgr->Create<MapTooltip>(
|
||||
WindowClass::MapTooltip, pos, width, height, WF_STICK_TO_FRONT | WF_TRANSPARENT | WF_NO_BACKGROUND);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include <openrct2-ui/interface/Viewport.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/Input.h>
|
||||
|
@ -25,7 +25,6 @@
|
|||
#include <openrct2/ride/RideData.h>
|
||||
#include <openrct2/ride/Track.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/tile_element/EntranceElement.h>
|
||||
|
@ -296,7 +295,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
else
|
||||
{
|
||||
ft.Increment(4);
|
||||
ft.Add<StringId>(STR_NONE);
|
||||
ft.Add<StringId>(kStringIdNone);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -371,7 +370,10 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
ToolCancel();
|
||||
if (!currentRide->GetRideTypeDescriptor().HasFlag(RtdFlag::hasTrack))
|
||||
WindowCloseByClass(WindowClass::RideConstruction);
|
||||
{
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::RideConstruction);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -437,13 +439,14 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* MazeConstructionOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<MazeConstructionWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<MazeConstructionWindow>(
|
||||
WindowClass::RideConstruction, ScreenCoordsXY(0, 29), WW, WH, WF_NO_AUTO_CLOSE);
|
||||
}
|
||||
|
||||
void WindowMazeConstructionUpdatePressedWidgets()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::RideConstruction);
|
||||
if (w == nullptr)
|
||||
return;
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
#include <cassert>
|
||||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/actions/NetworkModifyGroupAction.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
|
@ -18,6 +18,7 @@
|
|||
#include <openrct2/drawing/Text.h>
|
||||
#include <openrct2/network/network.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -64,7 +65,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
#define MAIN_MULTIPLAYER_WIDGETS \
|
||||
MakeWidget({ 0, 0}, {340, 240}, WindowWidgetType::Frame, WindowColour::Primary ), /* panel / background */ \
|
||||
MakeWidget({ 1, 1}, {338, 14}, WindowWidgetType::Caption, WindowColour::Primary, STR_NONE, STR_WINDOW_TITLE_TIP ), /* title bar */ \
|
||||
MakeWidget({ 1, 1}, {338, 14}, WindowWidgetType::Caption, WindowColour::Primary, kStringIdNone, STR_WINDOW_TITLE_TIP ), /* title bar */ \
|
||||
MakeWidget({327, 2}, { 11, 12}, WindowWidgetType::CloseBox, WindowColour::Primary, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP ), /* close x button */ \
|
||||
MakeWidget({ 0, 43}, {340, 197}, WindowWidgetType::Resize, WindowColour::Secondary ), /* content panel */ \
|
||||
MakeTab ({ 3, 17}, STR_SHOW_SERVER_INFO_TIP), /* tab */ \
|
||||
|
@ -184,10 +185,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowBase* MultiplayerOpen()
|
||||
{
|
||||
// Check if window is already open
|
||||
WindowBase* window = WindowBringToFrontByClass(WindowClass::Multiplayer);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::Multiplayer);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = WindowCreate<MultiplayerWindow>(
|
||||
window = windowMgr->Create<MultiplayerWindow>(
|
||||
WindowClass::Multiplayer, 320, 144, WF_10 | WF_RESIZABLE | WF_AUTO_POSITION);
|
||||
}
|
||||
|
||||
|
|
|
@ -8,11 +8,10 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/drawing/Text.h>
|
||||
#include <openrct2/network/network.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -28,7 +27,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
// clang-format off
|
||||
static constexpr Widget window_network_status_widgets[] = {
|
||||
MakeWidget({ 0, 0}, {400, 91}, WindowWidgetType::Frame, WindowColour::Primary ), // panel / background
|
||||
MakeWidget({ 1, 1}, {397, 14}, WindowWidgetType::Caption, WindowColour::Primary, STR_NONE, STR_WINDOW_TITLE_TIP), // title bar
|
||||
MakeWidget({ 1, 1}, {397, 14}, WindowWidgetType::Caption, WindowColour::Primary, kStringIdNone, STR_WINDOW_TITLE_TIP), // title bar
|
||||
MakeWidget({388, 2}, { 11, 12}, WindowWidgetType::CloseBox, WindowColour::Primary, STR_CLOSE_X, STR_CLOSE_WINDOW_TIP), // close x button
|
||||
};
|
||||
// clang-format on
|
||||
|
@ -136,16 +135,16 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
ContextForceCloseWindowByClass(WindowClass::ProgressWindow);
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
NetworkStatusWindow* window;
|
||||
if ((window = static_cast<NetworkStatusWindow*>(windowMgr->FindByClass(WindowClass::NetworkStatus))) != nullptr)
|
||||
{
|
||||
WindowBringToFront(*window);
|
||||
windowMgr->BringToFront(*window);
|
||||
}
|
||||
else
|
||||
{
|
||||
window = WindowCreate<NetworkStatusWindow>(
|
||||
window = windowMgr->Create<NetworkStatusWindow>(
|
||||
WindowClass::NetworkStatus, 400, 90, WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
}
|
||||
|
||||
|
@ -157,7 +156,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
// force close
|
||||
void WindowNetworkStatusClose()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto window = windowMgr->FindByClass(WindowClass::NetworkStatus);
|
||||
if (window == nullptr)
|
||||
{
|
||||
|
@ -172,8 +171,10 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
ContextForceCloseWindowByClass(WindowClass::ProgressWindow);
|
||||
|
||||
auto window = WindowFocusOrCreate<NetworkStatusWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = windowMgr->FocusOrCreate<NetworkStatusWindow>(
|
||||
WindowClass::NetworkStatus, 400, 90, WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN);
|
||||
|
||||
char password[33]{};
|
||||
WindowTextInputRawOpen(window, WIDX_PASSWORD, STR_PASSWORD_REQUIRED, STR_PASSWORD_REQUIRED_DESC, {}, password, 32);
|
||||
window->SetPassword(password);
|
||||
|
|
|
@ -10,8 +10,7 @@
|
|||
#include <algorithm>
|
||||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/actions/ParkMarketingAction.h>
|
||||
#include <openrct2/core/BitSet.hpp>
|
||||
|
@ -23,12 +22,11 @@
|
|||
#include <openrct2/ride/RideData.h>
|
||||
#include <openrct2/ride/RideManager.hpp>
|
||||
#include <openrct2/ride/ShopItem.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
static constexpr StringId WINDOW_TITLE = STR_NONE;
|
||||
static constexpr StringId WINDOW_TITLE = kStringIdNone;
|
||||
static constexpr int32_t WH = 109;
|
||||
static constexpr int32_t WW = 350;
|
||||
|
||||
|
@ -52,11 +50,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
// clang-format off
|
||||
static constexpr Widget window_new_campaign_widgets[] = {
|
||||
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
||||
MakeWidget ({ 14, 24}, {126, 12}, WindowWidgetType::Label, WindowColour::Primary, STR_EMPTY ), // ride label
|
||||
MakeWidget ({100, 24}, {242, 12}, WindowWidgetType::DropdownMenu, WindowColour::Primary, STR_EMPTY ), // ride dropdown
|
||||
MakeWidget ({ 14, 24}, {126, 12}, WindowWidgetType::Label, WindowColour::Primary, kStringIdEmpty ), // ride label
|
||||
MakeWidget ({100, 24}, {242, 12}, WindowWidgetType::DropdownMenu, WindowColour::Primary, kStringIdEmpty ), // ride dropdown
|
||||
MakeWidget ({330, 25}, { 11, 10}, WindowWidgetType::Button, WindowColour::Primary, STR_DROPDOWN_GLYPH ), // ride dropdown button
|
||||
MakeWidget ({ 14, 41}, {126, 14}, WindowWidgetType::Label, WindowColour::Primary, STR_LENGTH_OF_TIME ), // weeks label
|
||||
MakeSpinnerWidgets({120, 41}, {100, 14}, WindowWidgetType::Spinner, WindowColour::Primary, STR_EMPTY ), // weeks (3 widgets)
|
||||
MakeSpinnerWidgets({120, 41}, {100, 14}, WindowWidgetType::Spinner, WindowColour::Primary, kStringIdEmpty ), // weeks (3 widgets)
|
||||
MakeWidget ({ 14, 89}, {322, 14}, WindowWidgetType::Button, WindowColour::Primary, STR_MARKETING_START_THIS_MARKETING_CAMPAIGN), // start button
|
||||
};
|
||||
// clang-format on
|
||||
|
@ -162,10 +160,10 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
}
|
||||
|
||||
if (RideList.size() > Dropdown::ItemsMaxSize)
|
||||
if (RideList.size() > Dropdown::kItemsMaxSize)
|
||||
{
|
||||
std::sort(RideList.begin(), RideList.end(), RideValueCompare);
|
||||
RideList.resize(Dropdown::ItemsMaxSize);
|
||||
RideList.resize(Dropdown::kItemsMaxSize);
|
||||
}
|
||||
|
||||
// Sort rides by name
|
||||
|
@ -211,7 +209,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (!ShopItems.empty())
|
||||
{
|
||||
int32_t numItems = 0;
|
||||
int32_t maxSize = std::min(Dropdown::ItemsMaxSize, static_cast<int32_t>(ShopItems.size()));
|
||||
int32_t maxSize = std::min(Dropdown::kItemsMaxSize, static_cast<int32_t>(ShopItems.size()));
|
||||
for (int32_t i = 0; i < maxSize; i++)
|
||||
{
|
||||
gDropdownItems[i].Format = STR_DROPDOWN_MENU_LABEL;
|
||||
|
@ -281,7 +279,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
gameAction.SetCallback([](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error == GameActions::Status::Ok)
|
||||
{
|
||||
WindowCloseByClass(WindowClass::NewCampaign);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::NewCampaign);
|
||||
}
|
||||
});
|
||||
GameActions::Execute(&gameAction);
|
||||
|
@ -355,7 +354,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
|
||||
// Set current number of weeks spinner (moved to paint due to required parameter)
|
||||
widgets[WIDX_WEEKS_SPINNER].text = STR_NONE;
|
||||
widgets[WIDX_WEEKS_SPINNER].text = kStringIdNone;
|
||||
|
||||
// Enable / disable start button based on ride dropdown
|
||||
WidgetSetDisabled(*this, WIDX_START_BUTTON, false);
|
||||
|
@ -404,16 +403,17 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* NewCampaignOpen(int16_t campaignType)
|
||||
{
|
||||
auto w = static_cast<NewCampaignWindow*>(WindowBringToFrontByClass(WindowClass::NewCampaign));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = static_cast<NewCampaignWindow*>(windowMgr->BringToFrontByClass(WindowClass::NewCampaign));
|
||||
if (w != nullptr)
|
||||
{
|
||||
if (w->GetCampaignType() == campaignType)
|
||||
return w;
|
||||
|
||||
WindowClose(*w);
|
||||
w->Close();
|
||||
}
|
||||
|
||||
w = WindowCreate<NewCampaignWindow>(WindowClass::NewCampaign, WW, WH, 0);
|
||||
w = windowMgr->Create<NewCampaignWindow>(WindowClass::NewCampaign, WW, WH, 0);
|
||||
if (w != nullptr)
|
||||
{
|
||||
w->SetCampaign(campaignType);
|
||||
|
@ -423,7 +423,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void WindowCampaignRefreshRides()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = static_cast<NewCampaignWindow*>(windowMgr->FindByClass(WindowClass::NewCampaign));
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <limits>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/ride/Construction.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/GameState.h>
|
||||
|
@ -34,7 +34,6 @@
|
|||
#include <openrct2/ride/TrackData.h>
|
||||
#include <openrct2/ride/TrackDesignRepository.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
@ -43,7 +42,7 @@ using namespace OpenRCT2::TrackMetaData;
|
|||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
static constexpr StringId WindowTitle = STR_NONE;
|
||||
static constexpr StringId WindowTitle = kStringIdNone;
|
||||
static constexpr int32_t WindowHeight = 382;
|
||||
static constexpr int32_t WindowWidth = 601;
|
||||
static constexpr int32_t RideListItemsMax = 384;
|
||||
|
@ -563,7 +562,9 @@ namespace OpenRCT2::Ui::Windows
|
|||
}
|
||||
|
||||
Close();
|
||||
WindowCloseConstructionWindows();
|
||||
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseConstructionWindows();
|
||||
|
||||
auto count = GetNumTrackDesigns(item);
|
||||
if (count > 0)
|
||||
|
@ -641,7 +642,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
auto& objMgr = OpenRCT2::GetContext()->GetObjectManager();
|
||||
auto obj = objMgr.GetLoadedObject<RideObject>(rideSelection.EntryIndex);
|
||||
return obj == nullptr ? ImageIndexUndefined : obj->GetPreviewImage(rideSelection.Type);
|
||||
return obj == nullptr ? kImageIndexUndefined : obj->GetPreviewImage(rideSelection.Type);
|
||||
}
|
||||
|
||||
void PopulateRideList()
|
||||
|
@ -1071,18 +1072,18 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* NewRideOpen()
|
||||
{
|
||||
WindowBase* window;
|
||||
|
||||
window = WindowBringToFrontByClass(WindowClass::ConstructRide);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::ConstructRide);
|
||||
if (window)
|
||||
{
|
||||
return window;
|
||||
}
|
||||
|
||||
WindowCloseByClass(WindowClass::TrackDesignList);
|
||||
WindowCloseByClass(WindowClass::TrackDesignPlace);
|
||||
windowMgr->CloseByClass(WindowClass::TrackDesignList);
|
||||
windowMgr->CloseByClass(WindowClass::TrackDesignPlace);
|
||||
|
||||
window = WindowCreate<NewRideWindow>(WindowClass::ConstructRide, WindowWidth, WindowHeight, WF_10 | WF_AUTO_POSITION);
|
||||
window = windowMgr->Create<NewRideWindow>(
|
||||
WindowClass::ConstructRide, WindowWidth, WindowHeight, WF_10 | WF_AUTO_POSITION);
|
||||
return window;
|
||||
}
|
||||
|
||||
|
@ -1099,7 +1100,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
void WindowNewRideFocus(RideSelection rideItem)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto w = static_cast<NewRideWindow*>(windowMgr->FindByClass(WindowClass::ConstructRide));
|
||||
if (!w)
|
||||
{
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/audio/audio.h>
|
||||
|
@ -22,6 +22,7 @@
|
|||
#include <openrct2/object/ObjectManager.h>
|
||||
#include <openrct2/object/PeepAnimationsObject.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -323,6 +324,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* NewsOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<NewsWindow>(WindowClass::RecentNews, WW, WH, 0);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<NewsWindow>(WindowClass::RecentNews, WW, WH, 0);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -9,10 +9,11 @@
|
|||
|
||||
#include <cstddef>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/config/Config.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
|
@ -282,6 +283,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* NewsOptionsOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<NewsOptionsWindow>(WindowClass::NotificationOptions, WW, WH, WF_CENTRE_SCREEN);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<NewsOptionsWindow>(WindowClass::NotificationOptions, WW, WH, WF_CENTRE_SCREEN);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -9,8 +9,7 @@
|
|||
|
||||
#include <mutex>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Diagnostic.h>
|
||||
#include <openrct2/core/Console.hpp>
|
||||
#include <openrct2/core/Http.h>
|
||||
|
@ -25,6 +24,7 @@
|
|||
#include <openrct2/object/ObjectRepository.h>
|
||||
#include <openrct2/platform/Platform.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
|
@ -415,7 +415,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_CLOSE:
|
||||
WindowClose(*this);
|
||||
Close();
|
||||
return;
|
||||
case WIDX_COPY_CURRENT:
|
||||
if (selected_list_item > -1 && selected_list_item < no_list_items)
|
||||
|
@ -576,10 +576,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
WindowBase* ObjectLoadErrorOpen(utf8* path, size_t numMissingObjects, const ObjectEntryDescriptor* missingObjects)
|
||||
{
|
||||
// Check if window is already open
|
||||
auto* window = WindowBringToFrontByClass(WindowClass::ObjectLoadError);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
auto* window = windowMgr->BringToFrontByClass(WindowClass::ObjectLoadError);
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = WindowCreate<ObjectLoadErrorWindow>(WindowClass::ObjectLoadError, WW, WH, 0);
|
||||
window = windowMgr->Create<ObjectLoadErrorWindow>(WindowClass::ObjectLoadError, WW, WH, 0);
|
||||
}
|
||||
|
||||
static_cast<ObjectLoadErrorWindow*>(window)->Initialise(path, numMissingObjects, missingObjects);
|
||||
|
|
|
@ -12,14 +12,12 @@
|
|||
* the window has been changed to a tab interface similar to the options window seen in Locomotion.
|
||||
*/
|
||||
|
||||
#include "../interface/Theme.h"
|
||||
|
||||
#include <cmath>
|
||||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/Theme.h>
|
||||
#include <openrct2-ui/interface/Viewport.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Diagnostic.h>
|
||||
#include <openrct2/PlatformEnvironment.h>
|
||||
#include <openrct2/actions/ScenarioSetSettingAction.h>
|
||||
|
@ -45,6 +43,7 @@
|
|||
#include <openrct2/scenes/title/TitleSequenceManager.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
|
||||
#ifdef __EMSCRIPTEN__
|
||||
#include <emscripten.h>
|
||||
|
@ -258,7 +257,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
MakeWidget ({155, 83}, {145, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_ARG_16_RESOLUTION_X_BY_Y ),
|
||||
MakeWidget ({288, 84}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_DISPLAY_RESOLUTION_TIP ),
|
||||
MakeWidget ({ 10, 98}, {145, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_UI_SCALING_DESC, STR_WINDOW_SCALE_TIP ), // Scale
|
||||
MakeSpinnerWidgets({155, 98}, {145, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_NONE, STR_WINDOW_SCALE_TIP ), // Scale spinner (3 widgets)
|
||||
MakeSpinnerWidgets({155, 98}, {145, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, kStringIdNone, STR_WINDOW_SCALE_TIP ), // Scale spinner (3 widgets)
|
||||
MakeWidget ({ 10, 113}, {145, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_DRAWING_ENGINE, STR_DRAWING_ENGINE_TIP ), // Drawing engine
|
||||
MakeWidget ({155, 113}, {145, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Drawing engine
|
||||
MakeWidget ({288, 114}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_DRAWING_ENGINE_TIP ),
|
||||
|
@ -283,7 +282,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
MakeWidget({ 10, kFrameRenderingStart + 60}, {281, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_SHOW_GUEST_PURCHASES, STR_SHOW_GUEST_PURCHASES_TIP ), // Guest purchases
|
||||
MakeWidget({ 10, kFrameRenderingStart + 75}, {281, 12}, WindowWidgetType::Checkbox, WindowColour::Secondary, STR_TRANSPARENT_SCREENSHOT, STR_TRANSPARENT_SCREENSHOT_TIP), // Transparent screenshot
|
||||
MakeWidget({ 10, kFrameRenderingStart + 90}, {281, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_VIRTUAL_FLOOR_STYLE, STR_VIRTUAL_FLOOR_STYLE_TIP ), // Virtual floor
|
||||
MakeWidget({155, kFrameRenderingStart + 90}, {145, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, STR_NONE, STR_VIRTUAL_FLOOR_STYLE_TIP ), // Virtual floor dropdown
|
||||
MakeWidget({155, kFrameRenderingStart + 90}, {145, 12}, WindowWidgetType::DropdownMenu, WindowColour::Secondary, kStringIdNone, STR_VIRTUAL_FLOOR_STYLE_TIP ), // Virtual floor dropdown
|
||||
MakeWidget({288, kFrameRenderingStart + 91}, { 11, 10}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_VIRTUAL_FLOOR_STYLE_TIP ), // Virtual floor dropdown
|
||||
|
||||
MakeWidget({ 5, kFrameEffectStart + 0}, {300, 94}, WindowWidgetType::Groupbox, WindowColour::Secondary, STR_EFFECTS_GROUP ), // Rendering group
|
||||
|
@ -405,14 +404,14 @@ namespace OpenRCT2::Ui::Windows
|
|||
MakeWidget ({165, 113}, {135, 13}, WindowWidgetType::DropdownMenu, WindowColour::Secondary ), // Autosave dropdown
|
||||
MakeWidget ({288, 114}, { 11, 11}, WindowWidgetType::Button, WindowColour::Secondary, STR_DROPDOWN_GLYPH, STR_AUTOSAVE_FREQUENCY_TIP ), // Autosave dropdown button
|
||||
MakeWidget ({ 23, 130}, {135, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_AUTOSAVE_AMOUNT, STR_AUTOSAVE_AMOUNT_TIP ),
|
||||
MakeSpinnerWidgets({165, 130}, {135, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, STR_NONE, STR_AUTOSAVE_AMOUNT_TIP ), // Autosave amount spinner
|
||||
MakeSpinnerWidgets({165, 130}, {135, 12}, WindowWidgetType::Spinner, WindowColour::Secondary, kStringIdNone, STR_AUTOSAVE_AMOUNT_TIP ), // Autosave amount spinner
|
||||
MakeWidget ({ 23, 145}, {276, 12}, WindowWidgetType::Label, WindowColour::Secondary, STR_PATH_TO_RCT1, STR_PATH_TO_RCT1_TIP ), // RCT 1 path text
|
||||
MakeWidget ({ 24, 160}, {266, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_NONE, STR_STRING_TOOLTIP ), // RCT 1 path button
|
||||
MakeWidget ({ 24, 160}, {266, 14}, WindowWidgetType::Button, WindowColour::Secondary, kStringIdNone, STR_STRING_TOOLTIP ), // RCT 1 path button
|
||||
MakeWidget ({289, 160}, { 11, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_CLOSE_X, STR_PATH_TO_RCT1_CLEAR_TIP ), // RCT 1 path clear button
|
||||
MakeWidget ({150, 176}, {150, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_EDIT_ASSET_PACKS_BUTTON, STR_NONE ), // Asset packs
|
||||
MakeWidget ({150, 176}, {150, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_EDIT_ASSET_PACKS_BUTTON, kStringIdNone ), // Asset packs
|
||||
#ifdef __EMSCRIPTEN__
|
||||
MakeWidget ({150, 192}, {150, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_EXPORT_EMSCRIPTEN, STR_NONE ), // Emscripten data export
|
||||
MakeWidget ({150, 208}, {150, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_IMPORT_EMSCRIPTEN, STR_NONE ), // Emscripten data import
|
||||
MakeWidget ({150, 192}, {150, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_EXPORT_EMSCRIPTEN, STR_NONE ), // Emscripten data export
|
||||
MakeWidget ({150, 208}, {150, 14}, WindowWidgetType::Button, WindowColour::Secondary, STR_IMPORT_EMSCRIPTEN, STR_NONE ), // Emscripten data import
|
||||
#endif
|
||||
};
|
||||
|
||||
|
@ -637,7 +636,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
switch (widgetIndex)
|
||||
{
|
||||
case WIDX_CLOSE:
|
||||
WindowClose(*this);
|
||||
Close();
|
||||
break;
|
||||
case WIDX_TAB_DISPLAY:
|
||||
case WIDX_TAB_RENDERING:
|
||||
|
@ -1127,7 +1126,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
gDropdownItems[i].Args = CurrencyDescriptors[i].stringId;
|
||||
}
|
||||
|
||||
gDropdownItems[numOrdinaryCurrencies].Format = Dropdown::SeparatorString;
|
||||
gDropdownItems[numOrdinaryCurrencies].Format = Dropdown::kSeparatorString;
|
||||
|
||||
gDropdownItems[numOrdinaryCurrencies + 1].Format = STR_DROPDOWN_MENU_LABEL;
|
||||
gDropdownItems[numOrdinaryCurrencies + 1].Args = CurrencyDescriptors[EnumValue(CurrencyType::Custom)]
|
||||
|
@ -1241,7 +1240,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (LanguageOpen(fallbackLanguage))
|
||||
{
|
||||
// It worked, so we can say it with error message in-game
|
||||
ContextShowError(STR_LANGUAGE_LOAD_FAILED, STR_NONE, {});
|
||||
ContextShowError(STR_LANGUAGE_LOAD_FAILED, kStringIdNone, {});
|
||||
}
|
||||
// report error to console regardless
|
||||
LOG_ERROR("Failed to open language file.");
|
||||
|
@ -1277,7 +1276,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
// Distance: metric / imperial / si
|
||||
{
|
||||
StringId stringId = STR_NONE;
|
||||
StringId stringId = kStringIdNone;
|
||||
switch (Config::Get().general.MeasurementFormat)
|
||||
{
|
||||
case MeasurementFormat::Imperial:
|
||||
|
@ -1715,10 +1714,13 @@ namespace OpenRCT2::Ui::Windows
|
|||
Invalidate();
|
||||
break;
|
||||
case WIDX_SCENARIO_UNLOCKING:
|
||||
{
|
||||
Config::Get().general.ScenarioUnlockingEnabled ^= 1;
|
||||
Config::Save();
|
||||
WindowCloseByClass(WindowClass::ScenarioSelect);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::ScenarioSelect);
|
||||
break;
|
||||
}
|
||||
case WIDX_AUTO_OPEN_SHOPS:
|
||||
Config::Get().general.AutoOpenShops = !Config::Get().general.AutoOpenShops;
|
||||
Config::Save();
|
||||
|
@ -1837,7 +1839,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
Config::Get().interface.ScenarioselectLastTab = 0;
|
||||
Config::Save();
|
||||
Invalidate();
|
||||
WindowCloseByClass(WindowClass::ScenarioSelect);
|
||||
auto* windowMgr = Ui::GetWindowManager();
|
||||
windowMgr->CloseByClass(WindowClass::ScenarioSelect);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1944,21 +1947,21 @@ namespace OpenRCT2::Ui::Windows
|
|||
Config::Get().general.RCT1Path = std::move(rct1path);
|
||||
Config::Get().interface.ScenarioselectLastTab = 0;
|
||||
Config::Save();
|
||||
ContextShowError(STR_RESTART_REQUIRED, STR_NONE, {});
|
||||
ContextShowError(STR_RESTART_REQUIRED, kStringIdNone, {});
|
||||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_PATH_TO_RCT1_IS_WRONG_VERSION, STR_NONE, {});
|
||||
ContextShowError(STR_PATH_TO_RCT1_IS_WRONG_VERSION, kStringIdNone, {});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_PATH_TO_RCT1_DOES_NOT_CONTAIN_CSG1I_DAT, STR_NONE, {});
|
||||
ContextShowError(STR_PATH_TO_RCT1_DOES_NOT_CONTAIN_CSG1I_DAT, kStringIdNone, {});
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
ContextShowError(STR_PATH_TO_RCT1_WRONG_ERROR, STR_NONE, {});
|
||||
ContextShowError(STR_PATH_TO_RCT1_WRONG_ERROR, kStringIdNone, {});
|
||||
}
|
||||
}
|
||||
Invalidate();
|
||||
|
@ -2076,7 +2079,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
if (Config::Get().general.RCT1Path.empty())
|
||||
{
|
||||
// No tooltip if the path is empty
|
||||
return { STR_NONE, {} };
|
||||
return { kStringIdNone, {} };
|
||||
}
|
||||
|
||||
auto ft = Formatter();
|
||||
|
@ -2240,6 +2243,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
*/
|
||||
WindowBase* OptionsOpen()
|
||||
{
|
||||
return WindowFocusOrCreate<OptionsWindow>(WindowClass::Options, WW, WH, WF_CENTRE_SCREEN);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
return windowMgr->FocusOrCreate<OptionsWindow>(WindowClass::Options, WW, WH, WF_CENTRE_SCREEN);
|
||||
}
|
||||
} // namespace OpenRCT2::Ui::Windows
|
||||
|
|
|
@ -7,17 +7,15 @@
|
|||
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
||||
*****************************************************************************/
|
||||
|
||||
#include "../interface/Theme.h"
|
||||
|
||||
#include <array>
|
||||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/Graph.h>
|
||||
#include <openrct2-ui/interface/LandTool.h>
|
||||
#include <openrct2-ui/interface/Objective.h>
|
||||
#include <openrct2-ui/interface/Theme.h>
|
||||
#include <openrct2-ui/interface/Viewport.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/Input.h>
|
||||
|
@ -32,6 +30,7 @@
|
|||
#include <openrct2/ride/RideData.h>
|
||||
#include <openrct2/scenario/Scenario.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -870,8 +869,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
PrepareWindowTitleText();
|
||||
|
||||
// Show a tooltip if the park is pay per ride.
|
||||
widgets[WIDX_PRICE_LABEL].tooltip = STR_NONE;
|
||||
widgets[WIDX_PRICE].tooltip = STR_NONE;
|
||||
widgets[WIDX_PRICE_LABEL].tooltip = kStringIdNone;
|
||||
widgets[WIDX_PRICE].tooltip = kStringIdNone;
|
||||
|
||||
if (!Park::EntranceFeeUnlocked())
|
||||
{
|
||||
|
@ -1298,7 +1297,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
static ParkWindow* ParkWindowOpen(uint8_t page)
|
||||
{
|
||||
auto* wnd = WindowFocusOrCreate<ParkWindow>(WindowClass::ParkInformation, 230, 174 + 9, WF_10);
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* wnd = windowMgr->FocusOrCreate<ParkWindow>(WindowClass::ParkInformation, 230, 174 + 9, WF_10);
|
||||
if (wnd != nullptr && page != WINDOW_PARK_PAGE_ENTRANCE)
|
||||
{
|
||||
wnd->OnMouseUp(WIDX_TAB_1 + page);
|
||||
|
|
|
@ -12,7 +12,7 @@
|
|||
#include <openrct2-ui/interface/LandTool.h>
|
||||
#include <openrct2-ui/interface/Viewport.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/Input.h>
|
||||
|
@ -24,7 +24,6 @@
|
|||
#include <openrct2/entity/Staff.h>
|
||||
#include <openrct2/localisation/Formatter.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
||||
|
@ -264,7 +263,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
Formatter ft;
|
||||
ft.Add<uint16_t>(kLandToolMinimumSize);
|
||||
ft.Add<uint16_t>(kLandToolMaximumSize);
|
||||
WindowTextInputOpen(this, WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, STR_NONE, STR_NONE, 3);
|
||||
WindowTextInputOpen(
|
||||
this, WIDX_PREVIEW, STR_SELECTION_SIZE, STR_ENTER_SELECTION_SIZE, ft, kStringIdNone, kStringIdNone, 3);
|
||||
}
|
||||
|
||||
bool PatrolAreaToolIsActive()
|
||||
|
@ -275,7 +275,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
bool IsStaffWindowOpen()
|
||||
{
|
||||
// If staff window for this patrol area was closed, tool is no longer active
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto staffWindow = windowMgr->FindByNumber(WindowClass::Peep, _staffId);
|
||||
return staffWindow != nullptr;
|
||||
}
|
||||
|
@ -294,7 +294,8 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* PatrolAreaOpen(EntityId staffId)
|
||||
{
|
||||
auto w = WindowFocusOrCreate<PatrolAreaWindow>(
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* w = windowMgr->FocusOrCreate<PatrolAreaWindow>(
|
||||
WindowClass::PatrolArea, ScreenCoordsXY(ContextGetWidth() - WW, 29), WW, WH, 0);
|
||||
if (w != nullptr)
|
||||
{
|
||||
|
@ -305,7 +306,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
EntityId WindowPatrolAreaGetCurrentStaffId()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto current = reinterpret_cast<PatrolAreaWindow*>(windowMgr->FindByClass(WindowClass::PatrolArea));
|
||||
return current != nullptr ? current->GetStaffId() : EntityId::GetNull();
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
#include <openrct2-ui/interface/Dropdown.h>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Input.h>
|
||||
#include <openrct2/actions/PlayerKickAction.h>
|
||||
#include <openrct2/actions/PlayerSetGroupAction.h>
|
||||
|
@ -20,6 +20,7 @@
|
|||
#include <openrct2/network/NetworkAction.h>
|
||||
#include <openrct2/network/network.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <utility>
|
||||
|
||||
namespace OpenRCT2::Ui::Windows
|
||||
|
@ -624,10 +625,11 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
WindowBase* PlayerOpen(uint8_t id)
|
||||
{
|
||||
auto* window = static_cast<PlayerWindow*>(WindowBringToFrontByNumber(WindowClass::Player, id));
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto* window = static_cast<PlayerWindow*>(windowMgr->BringToFrontByNumber(WindowClass::Player, id));
|
||||
if (window == nullptr)
|
||||
{
|
||||
window = WindowCreate<PlayerWindow>(WindowClass::Player, 240, 170, WF_RESIZABLE);
|
||||
window = windowMgr->Create<PlayerWindow>(WindowClass::Player, 240, 170, WF_RESIZABLE);
|
||||
}
|
||||
|
||||
window->Init(id);
|
||||
|
|
|
@ -9,14 +9,13 @@
|
|||
|
||||
#include <array>
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/drawing/Text.h>
|
||||
#include <openrct2/localisation/Formatting.h>
|
||||
#include <openrct2/localisation/StringIds.h>
|
||||
#include <openrct2/sprites.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <random>
|
||||
#include <sstream>
|
||||
|
@ -221,7 +220,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void SetProgress(uint32_t currentProgress, uint32_t totalCount, StringId format)
|
||||
{
|
||||
if (format == STR_NONE)
|
||||
if (format == kStringIdNone)
|
||||
_progressFormat = STR_STRING_M_OF_N;
|
||||
else
|
||||
_progressFormat = format;
|
||||
|
@ -236,16 +235,16 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
ContextForceCloseWindowByClass(WindowClass::NetworkStatus);
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
|
||||
ProgressWindow* window;
|
||||
if ((window = static_cast<ProgressWindow*>(windowMgr->FindByClass(WindowClass::ProgressWindow))) != nullptr)
|
||||
{
|
||||
WindowBringToFront(*window);
|
||||
windowMgr->BringToFront(*window);
|
||||
}
|
||||
else
|
||||
{
|
||||
window = WindowCreate<ProgressWindow>(
|
||||
window = windowMgr->Create<ProgressWindow>(
|
||||
WindowClass::ProgressWindow, kWindowWidth, kWindowHeight,
|
||||
WF_10 | WF_TRANSPARENT | WF_CENTRE_SCREEN | WF_STICK_TO_FRONT);
|
||||
}
|
||||
|
@ -257,7 +256,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
|
||||
void ProgressWindowSet(uint32_t currentProgress, uint32_t totalCount, StringId format)
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto window = windowMgr->FindByClass(WindowClass::ProgressWindow);
|
||||
if (window == nullptr)
|
||||
{
|
||||
|
@ -270,7 +269,7 @@ namespace OpenRCT2::Ui::Windows
|
|||
// Closes the window, deliberately *without* executing the callback.
|
||||
void ProgressWindowClose()
|
||||
{
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
auto window = windowMgr->FindByClass(WindowClass::ProgressWindow);
|
||||
if (window == nullptr)
|
||||
{
|
||||
|
|
|
@ -8,13 +8,11 @@
|
|||
*****************************************************************************/
|
||||
|
||||
#include <openrct2-ui/interface/Widget.h>
|
||||
#include <openrct2-ui/windows/Window.h>
|
||||
#include <openrct2/Context.h>
|
||||
#include <openrct2-ui/windows/Windows.h>
|
||||
#include <openrct2/Game.h>
|
||||
#include <openrct2/GameState.h>
|
||||
#include <openrct2/actions/RideDemolishAction.h>
|
||||
#include <openrct2/drawing/Drawing.h>
|
||||
#include <openrct2/ui/UiContext.h>
|
||||
#include <openrct2/ui/WindowManager.h>
|
||||
#include <openrct2/windows/Intent.h>
|
||||
#include <openrct2/world/Park.h>
|
||||
|
@ -104,18 +102,19 @@ namespace OpenRCT2::Ui::Windows
|
|||
{
|
||||
RefurbishRidePromptWindow* newWindow;
|
||||
|
||||
auto* windowMgr = GetContext()->GetUiContext()->GetWindowManager();
|
||||
auto* windowMgr = GetWindowManager();
|
||||
WindowBase* w = windowMgr->FindByClass(WindowClass::DemolishRidePrompt);
|
||||
if (w != nullptr)
|
||||
{
|
||||
auto windowPos = w->windowPos;
|
||||
WindowClose(*w);
|
||||
newWindow = WindowCreate<RefurbishRidePromptWindow>(
|
||||
windowMgr->Close(*w);
|
||||
|
||||
newWindow = windowMgr->Create<RefurbishRidePromptWindow>(
|
||||
WindowClass::DemolishRidePrompt, windowPos, WW, WH, WF_TRANSPARENT);
|
||||
}
|
||||
else
|
||||
{
|
||||
newWindow = WindowCreate<RefurbishRidePromptWindow>(
|
||||
newWindow = windowMgr->Create<RefurbishRidePromptWindow>(
|
||||
WindowClass::DemolishRidePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT);
|
||||
}
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue