From 619733ba05105e5ba9b6652aed7683215e65fd4d Mon Sep 17 00:00:00 2001 From: Marijn van der Werf Date: Tue, 12 Sep 2017 21:07:44 +0200 Subject: [PATCH] Move track design windows --- .../windows/TrackDesignManage.cpp} | 0 .../windows/TrackDesignPlace.cpp} | 38 ++++++++----------- src/openrct2/windows/Intent.cpp | 35 +++++++++-------- src/openrct2/windows/Intent.h | 12 +++--- src/openrct2/windows/TrackList.cpp | 8 +++- 5 files changed, 45 insertions(+), 48 deletions(-) rename src/{openrct2/windows/TrackManage.cpp => openrct2-ui/windows/TrackDesignManage.cpp} (100%) rename src/{openrct2/windows/TrackPlace.cpp => openrct2-ui/windows/TrackDesignPlace.cpp} (97%) diff --git a/src/openrct2/windows/TrackManage.cpp b/src/openrct2-ui/windows/TrackDesignManage.cpp similarity index 100% rename from src/openrct2/windows/TrackManage.cpp rename to src/openrct2-ui/windows/TrackDesignManage.cpp diff --git a/src/openrct2/windows/TrackPlace.cpp b/src/openrct2-ui/windows/TrackDesignPlace.cpp similarity index 97% rename from src/openrct2/windows/TrackPlace.cpp rename to src/openrct2-ui/windows/TrackDesignPlace.cpp index 003b85cfad..a669fc5deb 100644 --- a/src/openrct2/windows/TrackPlace.cpp +++ b/src/openrct2-ui/windows/TrackDesignPlace.cpp @@ -14,20 +14,21 @@ *****************************************************************************/ #pragma endregion -#include "../ride/TrackDesignRepository.h" -#include "../core/Memory.hpp" -#include "../core/Math.hpp" +#include +#include +#include +#include -#include "../audio/audio.h" -#include "../cheats.h" -#include "../game.h" -#include "../input.h" -#include "../interface/viewport.h" -#include "../interface/widget.h" -#include "../localisation/localisation.h" -#include "../ride/track.h" -#include "../ride/track_data.h" -#include "../sprites.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include #define TRACK_MINI_PREVIEW_WIDTH 168 #define TRACK_MINI_PREVIEW_HEIGHT 78 @@ -141,7 +142,7 @@ static void window_track_place_clear_mini_preview() * * rct2: 0x006CFCA0 */ -static void _window_track_place_open(const track_design_file_ref *tdFileRef) +void window_track_place_open(const track_design_file_ref *tdFileRef) { rct_track_td6 *td6 = track_design_open(tdFileRef->path); if (td6 == nullptr) { @@ -617,12 +618,3 @@ static uint8 *draw_mini_preview_get_pixel_ptr(rct_xy16 pixel) { return &_window_track_place_mini_preview[pixel.y * TRACK_MINI_PREVIEW_WIDTH + pixel.x]; } - - -extern "C" -{ - void window_track_place_open(const track_design_file_ref *tdFileRef) - { - _window_track_place_open(tdFileRef); - } -} diff --git a/src/openrct2/windows/Intent.cpp b/src/openrct2/windows/Intent.cpp index 50eb8c5102..4c01f5b449 100644 --- a/src/openrct2/windows/Intent.cpp +++ b/src/openrct2/windows/Intent.cpp @@ -5,56 +5,55 @@ Intent::Intent(rct_windowclass windowclass) this->_Class = windowclass; } -Intent * -Intent::putExtra(uint32 key, uint32 value) +Intent * Intent::putExtra(uint32 key, uint32 value) { _UInts.insert(std::make_pair(key, value)); return this; } -Intent * -Intent::putExtra(uint32 key, void * value) + +Intent * Intent::putExtra(uint32 key, void * value) { _Pointers.insert(std::make_pair(key, (uintptr_t) value)); return this; } -Intent * -Intent::putExtra(uint32 key, sint32 value) + +Intent * Intent::putExtra(uint32 key, sint32 value) { _Pointers.insert(std::make_pair(key, value)); return this; } -Intent * -Intent::putExtra(uint32 key, utf8string value) + +Intent * Intent::putExtra(uint32 key, utf8string value) { _Strings.insert(std::make_pair(key, value)); return this; } -rct_windowclass -Intent::GetWindowClass() + +rct_windowclass Intent::GetWindowClass() { return this->_Class; } -void * -Intent::GetPointerExtra(uint32 key) + +void * Intent::GetPointerExtra(uint32 key) { return (void *) _Pointers.at(key); } -uint32 -Intent::GetUIntExtra(uint32 key) + +uint32 Intent::GetUIntExtra(uint32 key) { return _UInts.at(key); } -sint32 -Intent::GetSIntExtra(uint32 key) + +sint32 Intent::GetSIntExtra(uint32 key) { return _SInts.at(key); } -utf8string -Intent::GetStringExtra(uint32 key) + +utf8string Intent::GetStringExtra(uint32 key) { return _Strings.at(key); } diff --git a/src/openrct2/windows/Intent.h b/src/openrct2/windows/Intent.h index f7c70d52e2..f4700e3086 100644 --- a/src/openrct2/windows/Intent.h +++ b/src/openrct2/windows/Intent.h @@ -46,18 +46,20 @@ extern "C" { enum { - INTENT_EXTRA_0, + INTENT_EXTRA_0, // WC_GUEST_LIST INTENT_EXTRA_1, - INTENT_EXTRA_2, + INTENT_EXTRA_2, // WC_INSTALL_TRACK - INTENT_EXTRA_3, + INTENT_EXTRA_3, // WC_FIRE_PROMPT - INTENT_EXTRA_4, + INTENT_EXTRA_4, // WC_LOADSAVE INTENT_EXTRA_5, INTENT_EXTRA_6, - INTENT_EXTRA_7, + INTENT_EXTRA_7, // WC_SCENARIO_SELECT + + INTENT_EXTRA_8, // WC_TRACK_DESIGN_PLACE, WC_MANAGE_TRACK_DESIGN }; Intent *intent_create(rct_windowclass clss); diff --git a/src/openrct2/windows/TrackList.cpp b/src/openrct2/windows/TrackList.cpp index c28de8749f..12c297b845 100644 --- a/src/openrct2/windows/TrackList.cpp +++ b/src/openrct2/windows/TrackList.cpp @@ -216,13 +216,17 @@ static void window_track_list_select(rct_window *w, sint32 index) track_design_file_ref *tdRef = &_trackDesigns[index]; if (gScreenFlags & SCREEN_FLAGS_TRACK_MANAGER) { - window_track_manage_open(tdRef); + auto intent = Intent(WC_MANAGE_TRACK_DESIGN); + intent.putExtra(INTENT_EXTRA_8, tdRef); + context_open_intent(&intent); } else { if (_loadedTrackDesignIndex != TRACK_DESIGN_INDEX_UNLOADED && (_loadedTrackDesign->track_flags & TRACK_DESIGN_FLAG_VEHICLE_UNAVAILABLE)) { context_show_error(STR_THIS_DESIGN_WILL_BE_BUILT_WITH_AN_ALTERNATIVE_VEHICLE_TYPE, STR_NONE); } - window_track_place_open(tdRef); + auto intent = Intent(WC_TRACK_DESIGN_PLACE); + intent.putExtra(INTENT_EXTRA_8, tdRef); + context_open_intent(&intent); } }