Move track design windows

This commit is contained in:
Marijn van der Werf 2017-09-12 21:07:44 +02:00
parent d18e59ff17
commit 619733ba05
5 changed files with 45 additions and 48 deletions

View File

@ -14,20 +14,21 @@
*****************************************************************************/
#pragma endregion
#include "../ride/TrackDesignRepository.h"
#include "../core/Memory.hpp"
#include "../core/Math.hpp"
#include <openrct2/ride/TrackDesignRepository.h>
#include <openrct2/core/Memory.hpp>
#include <openrct2/core/Math.hpp>
#include <openrct2-ui/windows/Window.h>
#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 <openrct2/audio/audio.h>
#include <openrct2/cheats.h>
#include <openrct2/game.h>
#include <openrct2/input.h>
#include <openrct2/interface/viewport.h>
#include <openrct2/interface/widget.h>
#include <openrct2/localisation/localisation.h>
#include <openrct2/ride/track.h>
#include <openrct2/ride/track_data.h>
#include <openrct2/sprites.h>
#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);
}
}

View File

@ -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);
}

View File

@ -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);

View File

@ -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);
}
}