2014-11-01 16:32:29 +01:00
|
|
|
/*****************************************************************************
|
2020-07-21 15:04:34 +02:00
|
|
|
* Copyright (c) 2014-2020 OpenRCT2 developers
|
2016-05-04 19:24:41 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* For a complete list of all authors, please refer to contributors.md
|
|
|
|
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
|
2016-05-04 19:24:41 +02:00
|
|
|
*
|
2018-06-15 14:07:34 +02:00
|
|
|
* OpenRCT2 is licensed under the GNU General Public License version 3.
|
2016-05-04 19:24:41 +02:00
|
|
|
*****************************************************************************/
|
2014-11-01 16:32:29 +01:00
|
|
|
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2-ui/interface/Dropdown.h>
|
|
|
|
#include <openrct2-ui/interface/Viewport.h>
|
|
|
|
#include <openrct2-ui/interface/Widget.h>
|
2017-09-06 15:09:18 +02:00
|
|
|
#include <openrct2-ui/windows/Window.h>
|
2017-11-30 18:17:06 +01:00
|
|
|
#include <openrct2/Game.h>
|
Split actions hpp files into separate h and cpp files (#13548)
* Split up SmallSceneryPlace/Remove
Added undo function for Remove Scenery
* Refactor: Balloon and Banner actions hpp=>h/cpp
* Refactor: rename all action *.hpp files to *.cpp
This is preparation for separation in later commits. Note that without
the complete set of commits in this branch, the code will not build.
* Refactor Clear, Climate, Custom, and Footpath actions hpp=>h/cpp
* VSCode: add src subdirectories to includePath
* Refactor Guest actions hpp=>h/cpp
* Refactor Land actions hpp=>h/cpp
* Refactor LargeScenery actions hpp=>h/cpp
* Refactor Load, Maze, Network actions hpp=>h/cpp
* Refactor Park actions hpp=>h/cpp
* Refactor/style: move private function declarations in actions *.h
Previous action .h files included private function declarations with
private member variables, before public function declarations. This
commit re-orders the header files to the following order:
- public member variables
- private member variables
- public functions
- private functions
* Refactor Pause action hpp=>h/cpp
* Refactor Peep, Place, Player actions hpp=>h/cpp
* Refactor Ride actions hpp=>h/cpp
* Refactor Scenario, Set*, Sign* actions hpp=>h/cpp
* Refactor SmallScenerySetColourAction hpp=>h/cpp
* Refactor Staff actions hpp=>h/cpp
* Refactor Surface, Tile, Track* actions hpp=>h/cpp
* Refactor Wall and Water actions hpp=>h/cpp
* Fix various includes and other compile errors
Update includes for tests.
Move static function declarations to .h files
Add explicit includes to various files that were previously implicit
(the required header was a nested include in an action hpp file, and the
action .h file does not include that header)
Move RideSetStatus string enum to the cpp file to avoid unused imports
* Xcode: modify project file for actions refactor
* Cleanup whitespace and end-of-file newlines
Co-authored-by: duncanspumpkin <duncans_pumpkin@hotmail.co.uk>
2020-12-10 07:39:10 +01:00
|
|
|
#include <openrct2/actions/LargeSceneryRemoveAction.h>
|
|
|
|
#include <openrct2/actions/SignSetNameAction.h>
|
|
|
|
#include <openrct2/actions/SignSetStyleAction.h>
|
|
|
|
#include <openrct2/actions/WallRemoveAction.h>
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2/config/Config.h>
|
2018-01-06 18:32:25 +01:00
|
|
|
#include <openrct2/localisation/Localisation.h>
|
|
|
|
#include <openrct2/localisation/StringIds.h>
|
2018-06-22 23:21:44 +02:00
|
|
|
#include <openrct2/sprites.h>
|
|
|
|
#include <openrct2/world/Banner.h>
|
2017-11-20 11:13:55 +01:00
|
|
|
#include <openrct2/world/LargeScenery.h>
|
2018-01-11 10:59:26 +01:00
|
|
|
#include <openrct2/world/Scenery.h>
|
2017-11-20 11:13:55 +01:00
|
|
|
#include <openrct2/world/Wall.h>
|
2014-11-01 16:32:29 +01:00
|
|
|
|
2020-05-05 22:26:14 +02:00
|
|
|
static constexpr const rct_string_id WINDOW_TITLE = STR_SIGN;
|
2020-05-09 17:05:01 +02:00
|
|
|
static constexpr const int32_t WW = 113;
|
|
|
|
static constexpr const int32_t WH = 96;
|
2014-11-01 16:32:29 +01:00
|
|
|
|
2018-05-16 20:41:29 +02:00
|
|
|
// clang-format off
|
2014-11-01 16:32:29 +01:00
|
|
|
enum WINDOW_SIGN_WIDGET_IDX {
|
2017-06-06 23:24:18 +02:00
|
|
|
WIDX_BACKGROUND,
|
|
|
|
WIDX_TITLE,
|
|
|
|
WIDX_CLOSE,
|
|
|
|
WIDX_VIEWPORT,
|
|
|
|
WIDX_SIGN_TEXT,
|
|
|
|
WIDX_SIGN_DEMOLISH,
|
|
|
|
WIDX_MAIN_COLOUR,
|
|
|
|
WIDX_TEXT_COLOUR
|
2014-11-01 16:32:29 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
// 0x9AEE00
|
2017-10-09 17:13:14 +02:00
|
|
|
static rct_widget window_sign_widgets[] = {
|
2020-07-30 22:39:09 +02:00
|
|
|
WINDOW_SHIM(WINDOW_TITLE, WW, WH),
|
2020-11-27 04:14:20 +01:00
|
|
|
MakeWidget({ 3, 17}, {85, 60}, WindowWidgetType::Viewport, WindowColour::Secondary, STR_VIEWPORT ), // Viewport
|
|
|
|
MakeWidget({WW - 25, 19}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_RENAME, STR_CHANGE_SIGN_TEXT_TIP ), // change sign button
|
|
|
|
MakeWidget({WW - 25, 67}, {24, 24}, WindowWidgetType::FlatBtn, WindowColour::Secondary, SPR_DEMOLISH, STR_DEMOLISH_SIGN_TIP ), // demolish button
|
|
|
|
MakeWidget({ 5, WH - 16}, {12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_MAIN_SIGN_COLOUR_TIP), // Main colour
|
|
|
|
MakeWidget({ 17, WH - 16}, {12, 12}, WindowWidgetType::ColourBtn, WindowColour::Secondary, 0xFFFFFFFF, STR_SELECT_TEXT_COLOUR_TIP ), // Text colour
|
2020-07-30 22:39:09 +02:00
|
|
|
{ WIDGETS_END },
|
2014-11-01 16:32:29 +01:00
|
|
|
};
|
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
// clang-format on
|
2014-11-01 16:32:29 +01:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
class SignWindow final : public Window
|
2020-09-28 20:36:15 +02:00
|
|
|
{
|
2021-04-12 13:53:58 +02:00
|
|
|
private:
|
|
|
|
bool _isSmall = false;
|
|
|
|
Banner* _banner = nullptr;
|
|
|
|
TileElement* _tileElement = nullptr;
|
2014-11-02 15:09:04 +01:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
void ShowTextInput()
|
|
|
|
{
|
|
|
|
if (_banner != nullptr)
|
|
|
|
{
|
|
|
|
auto bannerText = _banner->GetText();
|
|
|
|
window_text_input_raw_open(this, WIDX_SIGN_TEXT, STR_SIGN_TEXT_TITLE, STR_SIGN_TEXT_PROMPT, bannerText.c_str(), 32);
|
|
|
|
}
|
|
|
|
}
|
2019-07-21 02:28:33 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
public:
|
|
|
|
void OnOpen() override
|
|
|
|
{
|
|
|
|
widgets = window_sign_widgets;
|
|
|
|
enabled_widgets = (1 << WIDX_CLOSE) | (1 << WIDX_SIGN_TEXT) | (1 << WIDX_SIGN_DEMOLISH) | (1 << WIDX_MAIN_COLOUR)
|
|
|
|
| (1 << WIDX_TEXT_COLOUR);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
WindowInitScrollWidgets(this);
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
/*
|
|
|
|
* Initializes the window and sets it's number and if it's small
|
|
|
|
* @return true if successfull
|
|
|
|
*/
|
|
|
|
bool Initialize(rct_windownumber windowNumber, const bool isSmall)
|
|
|
|
{
|
|
|
|
number = windowNumber;
|
|
|
|
_isSmall = isSmall;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
_banner = GetBanner(number);
|
|
|
|
if (_banner == nullptr)
|
|
|
|
return false;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
auto signViewPosition = _banner->position.ToCoordsXY().ToTileCentre();
|
|
|
|
_tileElement = banner_get_tile_element(number);
|
|
|
|
if (_tileElement == nullptr)
|
|
|
|
return false;
|
2020-04-03 09:55:01 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
int32_t viewZ = _tileElement->GetBaseZ();
|
|
|
|
frame_no = viewZ;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
if (_isSmall)
|
2017-11-17 17:15:55 +01:00
|
|
|
{
|
2021-04-12 13:53:58 +02:00
|
|
|
list_information_type = _tileElement->AsWall()->GetPrimaryColour();
|
|
|
|
var_492 = _tileElement->AsWall()->GetSecondaryColour();
|
|
|
|
SceneryEntry = _tileElement->AsWall()->GetEntryIndex();
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2021-04-12 13:53:58 +02:00
|
|
|
else
|
2020-06-12 21:33:07 +02:00
|
|
|
{
|
2021-04-12 13:53:58 +02:00
|
|
|
list_information_type = _tileElement->AsLargeScenery()->GetPrimaryColour();
|
|
|
|
var_492 = _tileElement->AsLargeScenery()->GetSecondaryColour();
|
|
|
|
SceneryEntry = _tileElement->AsLargeScenery()->GetEntryIndex();
|
2020-06-12 21:33:07 +02:00
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
// Create viewport
|
|
|
|
rct_widget& viewportWidget = window_sign_widgets[WIDX_VIEWPORT];
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
viewport_create(
|
|
|
|
this, windowPos + ScreenCoordsXY{ viewportWidget.left + 1, viewportWidget.top + 1 }, viewportWidget.width() - 1,
|
|
|
|
viewportWidget.height() - 1, 0, { signViewPosition, viewZ }, 0, SPRITE_INDEX_NULL);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
viewport->flags = gConfigGeneral.always_show_gridlines ? VIEWPORT_FLAG_GRIDLINES : 0;
|
|
|
|
Invalidate();
|
2017-09-06 15:09:18 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
return true;
|
|
|
|
}
|
2014-11-01 16:32:29 +01:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
void OnMouseUp(rct_widgetindex widgetIndex) override
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2021-04-12 13:53:58 +02:00
|
|
|
switch (widgetIndex)
|
2018-12-22 19:46:59 +01:00
|
|
|
{
|
2021-04-12 13:53:58 +02:00
|
|
|
case WIDX_CLOSE:
|
|
|
|
Close();
|
|
|
|
break;
|
|
|
|
case WIDX_SIGN_DEMOLISH:
|
2017-11-17 17:15:55 +01:00
|
|
|
{
|
2021-04-12 13:53:58 +02:00
|
|
|
auto bannerCoords = _banner->position.ToCoordsXY();
|
|
|
|
|
|
|
|
if (_isSmall)
|
2017-11-01 15:24:04 +01:00
|
|
|
{
|
2021-04-12 13:53:58 +02:00
|
|
|
CoordsXYZD wallLocation = { bannerCoords, _tileElement->GetBaseZ(), _tileElement->GetDirection() };
|
|
|
|
auto wallRemoveAction = WallRemoveAction(wallLocation);
|
|
|
|
GameActions::Execute(&wallRemoveAction);
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2021-04-12 13:53:58 +02:00
|
|
|
else
|
2020-06-12 21:33:07 +02:00
|
|
|
{
|
2021-04-12 13:53:58 +02:00
|
|
|
auto sceneryRemoveAction = LargeSceneryRemoveAction(
|
|
|
|
{ bannerCoords, _tileElement->GetBaseZ(), _tileElement->GetDirection() },
|
|
|
|
_tileElement->AsLargeScenery()->GetSequenceIndex());
|
|
|
|
GameActions::Execute(&sceneryRemoveAction);
|
2020-06-12 21:33:07 +02:00
|
|
|
}
|
2021-04-12 13:53:58 +02:00
|
|
|
break;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2021-04-12 13:53:58 +02:00
|
|
|
case WIDX_SIGN_TEXT:
|
|
|
|
ShowTextInput();
|
|
|
|
break;
|
2018-12-22 19:46:59 +01:00
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-11-01 16:32:29 +01:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
void OnMouseDown(rct_widgetindex widgetIndex) override
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2021-04-12 13:53:58 +02:00
|
|
|
rct_widget* widget = &widgets[widgetIndex];
|
|
|
|
switch (widgetIndex)
|
|
|
|
{
|
|
|
|
case WIDX_MAIN_COLOUR:
|
|
|
|
WindowDropdownShowColour(this, widget, TRANSLUCENT(colours[1]), static_cast<uint8_t>(list_information_type));
|
|
|
|
break;
|
|
|
|
case WIDX_TEXT_COLOUR:
|
|
|
|
WindowDropdownShowColour(this, widget, TRANSLUCENT(colours[1]), static_cast<uint8_t>(var_492));
|
|
|
|
break;
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-11-01 16:32:29 +01:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
void OnDropdown(rct_widgetindex widgetIndex, int32_t dropdownIndex) override
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2021-04-12 13:53:58 +02:00
|
|
|
switch (widgetIndex)
|
2019-01-28 03:05:54 +01:00
|
|
|
{
|
2021-04-12 13:53:58 +02:00
|
|
|
case WIDX_MAIN_COLOUR:
|
|
|
|
{
|
|
|
|
if (dropdownIndex == -1)
|
|
|
|
return;
|
|
|
|
list_information_type = dropdownIndex;
|
|
|
|
auto signSetStyleAction = SignSetStyleAction(number, dropdownIndex, var_492, !_isSmall);
|
|
|
|
GameActions::Execute(&signSetStyleAction);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
case WIDX_TEXT_COLOUR:
|
|
|
|
{
|
|
|
|
if (dropdownIndex == -1)
|
|
|
|
return;
|
|
|
|
var_492 = dropdownIndex;
|
|
|
|
auto signSetStyleAction = SignSetStyleAction(number, list_information_type, dropdownIndex, !_isSmall);
|
|
|
|
GameActions::Execute(&signSetStyleAction);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
default:
|
2018-06-22 23:21:44 +02:00
|
|
|
return;
|
2019-01-28 03:05:54 +01:00
|
|
|
}
|
2021-04-12 13:53:58 +02:00
|
|
|
|
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
|
|
|
|
void OnTextInput(rct_widgetindex widgetIndex, std::string_view text) override
|
|
|
|
{
|
|
|
|
if (widgetIndex == WIDX_SIGN_TEXT && !text.empty())
|
2019-01-28 03:05:54 +01:00
|
|
|
{
|
2021-04-12 13:53:58 +02:00
|
|
|
auto signSetNameAction = SignSetNameAction(number, std::string(text));
|
|
|
|
GameActions::Execute(&signSetNameAction);
|
2019-01-28 03:05:54 +01:00
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
void OnPrepareDraw() override
|
2018-03-24 04:52:47 +01:00
|
|
|
{
|
2021-04-12 13:53:58 +02:00
|
|
|
rct_widget* main_colour_btn = &window_sign_widgets[WIDX_MAIN_COLOUR];
|
|
|
|
rct_widget* text_colour_btn = &window_sign_widgets[WIDX_TEXT_COLOUR];
|
2014-11-01 16:32:29 +01:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
if (_isSmall)
|
|
|
|
{
|
|
|
|
rct_scenery_entry* scenery_entry = get_wall_entry(SceneryEntry);
|
2014-11-01 16:32:29 +01:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
main_colour_btn->type = WindowWidgetType::Empty;
|
|
|
|
text_colour_btn->type = WindowWidgetType::Empty;
|
2014-11-01 16:32:29 +01:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
if (scenery_entry->wall.flags & WALL_SCENERY_HAS_PRIMARY_COLOUR)
|
|
|
|
{
|
|
|
|
main_colour_btn->type = WindowWidgetType::ColourBtn;
|
|
|
|
}
|
|
|
|
if (scenery_entry->wall.flags & WALL_SCENERY_HAS_SECONDARY_COLOUR)
|
|
|
|
{
|
|
|
|
text_colour_btn->type = WindowWidgetType::ColourBtn;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
rct_scenery_entry* scenery_entry = get_large_scenery_entry(SceneryEntry);
|
2014-11-01 16:32:29 +01:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
main_colour_btn->type = WindowWidgetType::Empty;
|
|
|
|
text_colour_btn->type = WindowWidgetType::Empty;
|
2014-11-01 16:32:29 +01:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
if (scenery_entry->large_scenery.flags & LARGE_SCENERY_FLAG_HAS_PRIMARY_COLOUR)
|
|
|
|
{
|
|
|
|
main_colour_btn->type = WindowWidgetType::ColourBtn;
|
|
|
|
}
|
|
|
|
if (scenery_entry->large_scenery.flags & LARGE_SCENERY_FLAG_HAS_SECONDARY_COLOUR)
|
|
|
|
{
|
|
|
|
text_colour_btn->type = WindowWidgetType::ColourBtn;
|
|
|
|
}
|
|
|
|
}
|
2014-11-01 16:32:29 +01:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
main_colour_btn->image = SPRITE_ID_PALETTE_COLOUR_1(list_information_type) | IMAGE_TYPE_TRANSPARENT | SPR_PALETTE_BTN;
|
|
|
|
text_colour_btn->image = SPRITE_ID_PALETTE_COLOUR_1(var_492) | IMAGE_TYPE_TRANSPARENT | SPR_PALETTE_BTN;
|
|
|
|
}
|
2014-11-01 16:32:29 +01:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
void OnDraw(rct_drawpixelinfo& dpi) override
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2021-04-12 13:53:58 +02:00
|
|
|
DrawWidgets(dpi);
|
|
|
|
|
|
|
|
if (viewport != nullptr)
|
|
|
|
{
|
|
|
|
window_draw_viewport(&dpi, this);
|
|
|
|
}
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-11-01 16:32:29 +01:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
void OnViewportRotate() override
|
|
|
|
{
|
|
|
|
RemoveViewport();
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
auto banner = GetBanner(number);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
auto signViewPos = CoordsXYZ{ banner->position.ToCoordsXY().ToTileCentre(), frame_no };
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
// Create viewport
|
|
|
|
rct_widget* viewportWidget = &window_sign_widgets[WIDX_VIEWPORT];
|
|
|
|
viewport_create(
|
|
|
|
this, windowPos + ScreenCoordsXY{ viewportWidget->left + 1, viewportWidget->top + 1 }, viewportWidget->width() - 1,
|
|
|
|
viewportWidget->height() - 1, 0, signViewPos, 0, SPRITE_INDEX_NULL);
|
|
|
|
if (viewport != nullptr)
|
|
|
|
viewport->flags = gConfigGeneral.always_show_gridlines ? VIEWPORT_FLAG_GRIDLINES : 0;
|
|
|
|
Invalidate();
|
|
|
|
}
|
|
|
|
};
|
2014-11-02 15:09:04 +01:00
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
2021-04-12 13:53:58 +02:00
|
|
|
* rct2: 0x006BA305
|
2015-12-11 16:38:37 +01:00
|
|
|
*/
|
2021-04-12 13:53:58 +02:00
|
|
|
rct_window* window_sign_open(rct_windownumber number)
|
2018-06-22 23:21:44 +02:00
|
|
|
{
|
2021-04-12 13:53:58 +02:00
|
|
|
auto* w = static_cast<SignWindow*>(window_bring_to_front_by_number(WC_BANNER, number));
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2017-08-15 10:07:44 +02:00
|
|
|
if (w != nullptr)
|
2017-09-06 15:09:18 +02:00
|
|
|
return w;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
w = WindowCreate<SignWindow>(WC_BANNER, WW, WH, 0);
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
if (w == nullptr)
|
2019-10-13 14:24:19 +02:00
|
|
|
return nullptr;
|
2017-06-06 23:24:18 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
bool result = w->Initialize(number, false);
|
|
|
|
if (result != true)
|
|
|
|
return nullptr;
|
2017-09-06 15:09:18 +02:00
|
|
|
|
|
|
|
return w;
|
2014-11-02 15:09:04 +01:00
|
|
|
}
|
|
|
|
|
2015-12-11 16:38:37 +01:00
|
|
|
/**
|
|
|
|
*
|
2021-04-12 13:53:58 +02:00
|
|
|
* rct2: 0x6E5F52
|
2015-12-11 16:38:37 +01:00
|
|
|
*/
|
2021-04-12 13:53:58 +02:00
|
|
|
rct_window* window_sign_small_open(rct_windownumber number)
|
2014-11-02 15:09:04 +01:00
|
|
|
{
|
2021-04-12 13:53:58 +02:00
|
|
|
auto* w = static_cast<SignWindow*>(window_bring_to_front_by_number(WC_BANNER, number));
|
2014-11-02 15:09:04 +01:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
if (w != nullptr)
|
|
|
|
return w;
|
2014-11-02 15:09:04 +01:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
w = WindowCreate<SignWindow>(WC_BANNER, WW, WH, 0);
|
2014-11-02 15:09:04 +01:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
if (w == nullptr)
|
|
|
|
return nullptr;
|
2014-11-02 15:09:04 +01:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
bool result = w->Initialize(number, true);
|
|
|
|
if (result != true)
|
|
|
|
return nullptr;
|
2019-07-21 02:28:33 +02:00
|
|
|
|
2021-04-12 13:53:58 +02:00
|
|
|
return w;
|
2019-07-21 02:28:33 +02:00
|
|
|
}
|