2017-06-01 21:55:10 +02:00
|
|
|
#pragma region Copyright (c) 2014-2017 OpenRCT2 Developers
|
2014-10-07 21:57:02 +02:00
|
|
|
/*****************************************************************************
|
2016-05-04 19:24:41 +02:00
|
|
|
* OpenRCT2, an open source clone of Roller Coaster Tycoon 2.
|
|
|
|
*
|
|
|
|
* OpenRCT2 is the work of many authors, a full list can be found in contributors.md
|
|
|
|
* For more information, visit https://github.com/OpenRCT2/OpenRCT2
|
|
|
|
*
|
|
|
|
* OpenRCT2 is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* A full copy of the GNU General Public License can be found in licence.txt
|
|
|
|
*****************************************************************************/
|
|
|
|
#pragma endregion
|
2014-10-07 21:57:02 +02:00
|
|
|
|
2017-09-12 21:27:54 +02:00
|
|
|
#include <openrct2-ui/windows/Window.h>
|
2017-11-30 18:17:06 +01:00
|
|
|
#include <openrct2/Game.h>
|
2018-01-06 00:56:37 +01:00
|
|
|
#include <openrct2/interface/Widget.h>
|
2018-01-06 18:32:25 +01:00
|
|
|
#include <openrct2/localisation/Localisation.h>
|
2014-10-07 21:57:02 +02:00
|
|
|
|
|
|
|
#define WW 200
|
|
|
|
#define WH 100
|
|
|
|
|
|
|
|
enum WINDOW_STAFF_FIRE_WIDGET_IDX {
|
2017-06-06 23:24:18 +02:00
|
|
|
WIDX_BACKGROUND,
|
|
|
|
WIDX_TITLE,
|
|
|
|
WIDX_CLOSE,
|
|
|
|
WIDX_YES,
|
|
|
|
WIDX_CANCEL
|
2014-10-07 21:57:02 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
// 0x9AFB4C
|
|
|
|
static rct_widget window_staff_fire_widgets[] = {
|
2017-06-06 23:24:18 +02:00
|
|
|
{ WWT_FRAME, 0, 0, WW - 1, 0, WH - 1, STR_NONE, STR_NONE },
|
|
|
|
{ WWT_CAPTION, 0, 1, WW - 2, 1, 14, STR_SACK_STAFF, STR_WINDOW_TITLE_TIP },
|
2017-12-01 16:20:49 +01:00
|
|
|
{ WWT_CLOSEBOX, 0, WW-13, WW - 3, 2, 13, STR_CLOSE_X_WHITE, STR_CLOSE_WINDOW_TIP },
|
2018-01-03 20:30:58 +01:00
|
|
|
{ WWT_BUTTON, 0, 10, 94, WH - 20, WH - 9, STR_YES, STR_NONE },
|
|
|
|
{ WWT_BUTTON, 0, WW - 95, WW - 11, WH - 20, WH - 9, STR_SAVE_PROMPT_CANCEL, STR_NONE },
|
2017-06-06 23:24:18 +02:00
|
|
|
{ WIDGETS_END }
|
2014-10-07 21:57:02 +02:00
|
|
|
};
|
|
|
|
|
2017-05-01 15:41:45 +02:00
|
|
|
static void window_staff_fire_mouseup(rct_window *w, rct_widgetindex widgetIndex);
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_staff_fire_paint(rct_window *w, rct_drawpixelinfo *dpi);
|
2014-10-07 21:57:02 +02:00
|
|
|
|
|
|
|
//0x9A3F7C
|
2015-07-10 02:39:16 +02:00
|
|
|
static rct_window_event_list window_staff_fire_events = {
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_fire_mouseup,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
|
|
|
nullptr,
|
2017-06-06 23:24:18 +02:00
|
|
|
window_staff_fire_paint,
|
2017-08-15 10:07:44 +02:00
|
|
|
nullptr
|
2014-10-07 21:57:02 +02:00
|
|
|
};
|
|
|
|
/** Based off of rct2: 0x6C0A77 */
|
2017-09-10 11:02:16 +02:00
|
|
|
rct_window* window_staff_fire_prompt_open(rct_peep* peep)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-09-10 11:02:16 +02:00
|
|
|
rct_window * w;
|
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
// Check if the confirm window already exists.
|
2017-09-10 11:02:16 +02:00
|
|
|
w = window_bring_to_front_by_number(WC_FIRE_PROMPT, peep->sprite_index);
|
|
|
|
if (w != nullptr) {
|
|
|
|
return w;
|
2017-06-06 23:24:18 +02:00
|
|
|
}
|
2014-10-07 21:57:02 +02:00
|
|
|
|
2017-09-10 11:02:16 +02:00
|
|
|
w = window_create_centred(WW, WH, &window_staff_fire_events, WC_FIRE_PROMPT, WF_TRANSPARENT);
|
2017-06-06 23:24:18 +02:00
|
|
|
w->widgets = window_staff_fire_widgets;
|
|
|
|
w->enabled_widgets |= (1 << WIDX_CLOSE) | (1 << WIDX_YES) | (1 << WIDX_CANCEL);
|
2014-10-07 21:57:02 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
window_init_scroll_widgets(w);
|
2014-10-07 21:57:02 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
w->number = peep->sprite_index;
|
2017-09-10 11:02:16 +02:00
|
|
|
|
|
|
|
return w;
|
2014-10-07 21:57:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006C0B40
|
|
|
|
*/
|
2017-05-01 15:41:45 +02:00
|
|
|
static void window_staff_fire_mouseup(rct_window *w, rct_widgetindex widgetIndex)
|
2015-07-10 02:39:16 +02:00
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_peep* peep = &get_sprite(w->number)->peep;
|
|
|
|
|
|
|
|
switch (widgetIndex){
|
|
|
|
case WIDX_YES:
|
|
|
|
game_do_command(peep->x, 1, peep->y, w->number, GAME_COMMAND_FIRE_STAFF_MEMBER, 0, 0);
|
|
|
|
break;
|
|
|
|
case WIDX_CANCEL:
|
|
|
|
case WIDX_CLOSE:
|
|
|
|
window_close(w);
|
|
|
|
}
|
2014-10-07 21:57:02 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* rct2: 0x006C0AF2
|
|
|
|
*/
|
2015-07-10 02:39:16 +02:00
|
|
|
static void window_staff_fire_paint(rct_window *w, rct_drawpixelinfo *dpi)
|
|
|
|
{
|
2017-06-06 23:24:18 +02:00
|
|
|
window_draw_widgets(w, dpi);
|
2014-10-07 21:57:02 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
rct_peep* peep = &get_sprite(w->number)->peep;
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
set_format_arg(0, rct_string_id, peep->name_string_idx);
|
|
|
|
set_format_arg(2, uint32, peep->id);
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
sint32 x = w->x + WW / 2;
|
|
|
|
sint32 y = w->y + (WH / 2) - 3;
|
2015-10-20 20:16:30 +02:00
|
|
|
|
2017-06-06 23:24:18 +02:00
|
|
|
gfx_draw_string_centred_wrapped(dpi, gCommonFormatArgs, x, y, WW - 4, STR_FIRE_STAFF_ID, COLOUR_BLACK);
|
2014-10-08 13:39:50 +02:00
|
|
|
}
|