Do not re-create window when switching staff

This commit is contained in:
Ted John 2022-03-13 14:26:17 +00:00
parent f8224150d5
commit 5334b8f5c8
1 changed files with 12 additions and 14 deletions

View File

@ -237,14 +237,22 @@ private:
void EnableTool()
{
show_gridlines();
if (!tool_set(this, 0, Tool::WalkDown))
if (PatrolAreaToolIsActive())
{
input_set_flag(INPUT_FLAG_6, true);
show_gridlines();
SetPatrolAreaToRender(_staffId);
gfx_invalidate_screen();
}
else
{
show_gridlines();
if (!tool_set(this, 0, Tool::WalkDown))
{
input_set_flag(INPUT_FLAG_6, true);
show_gridlines();
SetPatrolAreaToRender(_staffId);
gfx_invalidate_screen();
}
}
}
void InputSize()
@ -280,16 +288,6 @@ private:
rct_window* WindowPatrolAreaOpen(EntityId staffId)
{
auto current = reinterpret_cast<PatrolAreaWindow*>(window_find_by_class(WC_PATROL_AREA));
if (current != nullptr)
{
if (current->GetStaffId() == staffId)
{
return window_bring_to_front(current);
}
current->Close();
}
auto w = WindowFocusOrCreate<PatrolAreaWindow>(WC_PATROL_AREA, ScreenCoordsXY(context_get_width() - WW, 29), WW, WH, 0);
if (w != nullptr)
{