forked from rosebudai/OpenRCT2-Web
Decrease dependency of world on windows
This commit is contained in:
1 parent
d91fd1364d
commit
7efaf3dd80
14 files changed
+92
-41
No files matched your search
@@ -376,6 +376,37 @@ public:
|
||||
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
case INTENT_ACTION_UPDATE_CLIMATE:
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE;
|
||||
window_invalidate_by_class(WC_GUEST_LIST);
|
||||
break;
|
||||
|
||||
case INTENT_ACTION_UPDATE_PARK_RATING:
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PARK_RATING;
|
||||
window_invalidate_by_class(WC_PARK_INFORMATION);
|
||||
break;
|
||||
|
||||
case INTENT_ACTION_UPDATE_DATE:
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_DATE;
|
||||
break;
|
||||
|
||||
case INTENT_ACTION_UPDATE_CASH:
|
||||
window_invalidate_by_class(WC_FINANCES);
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_MONEY;
|
||||
break;
|
||||
|
||||
case INTENT_ACTION_UPDATE_BANNER:
|
||||
{
|
||||
uint8 bannerIndex = static_cast<uint8>(intent.GetUIntExtra(INTENT_EXTRA_BANNER_INDEX));
|
||||
|
||||
rct_window * w = window_find_by_number(WC_BANNER, bannerIndex);
|
||||
if (w != nullptr)
|
||||
{
|
||||
window_invalidate(w);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -68,6 +68,8 @@ static rct_widget window_game_bottom_toolbar_widgets[] =
|
||||
{ WIDGETS_END },
|
||||
};
|
||||
|
||||
uint8 gToolbarDirtyFlags;
|
||||
|
||||
static void window_game_bottom_toolbar_mouseup(rct_window *w, rct_widgetindex widgetIndex);
|
||||
static void window_game_bottom_toolbar_tooltip(rct_window* w, rct_widgetindex widgetIndex, rct_string_id *stringId);
|
||||
static void window_game_bottom_toolbar_invalidate(rct_window *w);
|
||||
|
||||
@@ -150,6 +150,7 @@ void window_scenery_set_default_placement_configuration();
|
||||
void window_scenery_init();
|
||||
void window_scenery_reset_selected_scenery_items();
|
||||
|
||||
extern uint8 gToolbarDirtyFlags;
|
||||
rct_window * window_game_bottom_toolbar_open();
|
||||
void window_game_bottom_toolbar_invalidate_news_item();
|
||||
|
||||
|
||||
@@ -62,7 +62,6 @@ bool gUsingWidgetTextBox = false;
|
||||
TextInputSession * gTextInput;
|
||||
|
||||
uint16 gWindowUpdateTicks;
|
||||
uint8 gToolbarDirtyFlags;
|
||||
uint16 gWindowMapFlashingFlags;
|
||||
|
||||
colour_t gCurrentWindowColours[4];
|
||||
|
||||
@@ -554,7 +554,6 @@ extern rct_window * gWindowNextSlot;
|
||||
extern rct_window * gWindowAudioExclusive;
|
||||
|
||||
extern uint16 gWindowUpdateTicks;
|
||||
extern uint8 gToolbarDirtyFlags;
|
||||
extern uint16 gWindowMapFlashingFlags;
|
||||
|
||||
extern colour_t gCurrentWindowColours[4];
|
||||
|
||||
@@ -25,6 +25,8 @@
|
||||
#include "../world/Park.h"
|
||||
#include "../world/Sprite.h"
|
||||
#include "Finance.h"
|
||||
#include "../Context.h"
|
||||
#include "../windows/Intent.h"
|
||||
|
||||
/**
|
||||
* Monthly staff wages
|
||||
@@ -85,9 +87,8 @@ void finance_payment(money32 amount, rct_expenditure_type type)
|
||||
gCurrentExpenditure -= amount;
|
||||
}
|
||||
|
||||
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_MONEY;
|
||||
window_invalidate_by_class(WC_FINANCES);
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_CASH);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -346,8 +347,8 @@ void game_command_set_current_loan(sint32 * eax, sint32 * ebx, sint32 * ecx, sin
|
||||
gBankLoan = newLoan;
|
||||
gInitialCash = gCash;
|
||||
|
||||
window_invalidate_by_class(WC_FINANCES);
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_MONEY;
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_CASH);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
|
||||
*ebx = 0;
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "../world/Sprite.h"
|
||||
#include "Peep.h"
|
||||
#include "Staff.h"
|
||||
#include "../windows/Intent.h"
|
||||
|
||||
#if defined(DEBUG_LEVEL_1) && DEBUG_LEVEL_1
|
||||
bool gPathFindDebug = false;
|
||||
@@ -2247,7 +2248,8 @@ void peep_remove(rct_peep * peep)
|
||||
if (peep->outside_of_park == 0)
|
||||
{
|
||||
decrement_guests_in_park();
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
if (peep->state == PEEP_STATE_ENTERING_PARK)
|
||||
{
|
||||
@@ -5739,7 +5741,8 @@ static void peep_update_leaving_park(rct_peep * peep)
|
||||
peep->outside_of_park = 1;
|
||||
peep->destination_tolerance = 5;
|
||||
decrement_guests_in_park();
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT);
|
||||
context_broadcast_intent(&intent);
|
||||
peep->var_37 = 1;
|
||||
|
||||
window_invalidate_by_class(WC_GUEST_LIST);
|
||||
@@ -5883,8 +5886,8 @@ static void peep_update_entering_park(rct_peep * peep)
|
||||
peep->time_in_park = gScenarioTicks;
|
||||
increment_guests_in_park();
|
||||
decrement_guests_heading_for_park();
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
|
||||
window_invalidate_by_class(WC_GUEST_LIST);
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -5266,7 +5266,8 @@ static void vehicle_kill_all_passengers(rct_vehicle * vehicle)
|
||||
if (peep->outside_of_park == 0)
|
||||
{
|
||||
decrement_guests_in_park();
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
ride->num_riders--;
|
||||
peep_sprite_remove(peep);
|
||||
|
||||
@@ -49,6 +49,7 @@
|
||||
#include "Scenario.h"
|
||||
#include "../Context.h"
|
||||
#include "../ride/Track.h"
|
||||
#include "../windows/Intent.h"
|
||||
|
||||
extern "C"
|
||||
{
|
||||
@@ -318,7 +319,8 @@ static void scenario_day_update()
|
||||
uint16 casualtyPenaltyModifier = (gParkFlags & PARK_FLAGS_NO_MONEY) ? 40 : 7;
|
||||
gParkRatingCasualtyPenalty = std::max(0, gParkRatingCasualtyPenalty - casualtyPenaltyModifier);
|
||||
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_DATE;
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_DATE);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
|
||||
static void scenario_week_update()
|
||||
|
||||
@@ -69,6 +69,7 @@ extern "C" {
|
||||
INTENT_EXTRA_LIST,
|
||||
INTENT_EXTRA_LIST_COUNT,
|
||||
INTENT_EXTRA_PAGE,
|
||||
INTENT_EXTRA_BANNER_INDEX,
|
||||
};
|
||||
|
||||
enum {
|
||||
@@ -89,6 +90,12 @@ extern "C" {
|
||||
INTENT_ACTION_SET_TILE_INSPECTOR_BUTTONS,
|
||||
INTENT_ACTION_REFRESH_STAFF_LIST,
|
||||
INTENT_ACTION_INVALIDATE_VEHICLE_WINDOW,
|
||||
INTENT_ACTION_UPDATE_CLIMATE,
|
||||
INTENT_ACTION_UPDATE_GUEST_COUNT,
|
||||
INTENT_ACTION_UPDATE_PARK_RATING,
|
||||
INTENT_ACTION_UPDATE_DATE,
|
||||
INTENT_ACTION_UPDATE_CASH,
|
||||
INTENT_ACTION_UPDATE_BANNER,
|
||||
};
|
||||
|
||||
Intent *intent_create(rct_windowclass clss);
|
||||
|
||||
@@ -31,6 +31,8 @@
|
||||
#include "../localisation/Localisation.h"
|
||||
#include "../ride/Ride.h"
|
||||
#include "../ride/Track.h"
|
||||
#include "../windows/Intent.h"
|
||||
#include "../Context.h"
|
||||
|
||||
rct_banner gBanners[MAX_BANNERS];
|
||||
|
||||
@@ -159,11 +161,10 @@ static money32 BannerSetColour(sint16 x, sint16 y, uint8 baseHeight, uint8 direc
|
||||
return MONEY32_UNDEFINED;
|
||||
}
|
||||
|
||||
rct_window* window = window_find_by_number(WC_BANNER, tileElement->properties.banner.index);
|
||||
if (window != nullptr)
|
||||
{
|
||||
window_invalidate(window);
|
||||
}
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_BANNER);
|
||||
intent.putExtra(INTENT_EXTRA_BANNER_INDEX, tileElement->properties.banner.index);
|
||||
context_broadcast_intent(&intent);
|
||||
|
||||
gBanners[tileElement->properties.banner.index].colour = colour;
|
||||
map_invalidate_tile_zoom1(x, y, z, z + 32);
|
||||
}
|
||||
@@ -331,11 +332,10 @@ static money32 BannerSetName(uint8 bannerIndex,
|
||||
rct_string_id prevStringId = banner->string_idx;
|
||||
banner->string_idx = stringId;
|
||||
user_string_free(prevStringId);
|
||||
rct_window* w = window_bring_to_front_by_number(WC_BANNER, bannerIndex);
|
||||
if (w != nullptr)
|
||||
{
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_BANNER);
|
||||
intent.putExtra(INTENT_EXTRA_BANNER_INDEX, bannerIndex);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -398,11 +398,10 @@ static money32 BannerSetStyle(uint8 bannerIndex, uint8 colour, uint8 textColour,
|
||||
rct_string_id prevStringId = banner->string_idx;
|
||||
banner->string_idx = stringId;
|
||||
user_string_free(prevStringId);
|
||||
rct_window* w = window_bring_to_front_by_number(WC_BANNER, bannerIndex);
|
||||
if (w != nullptr)
|
||||
{
|
||||
window_invalidate(w);
|
||||
}
|
||||
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_BANNER);
|
||||
intent.putExtra(INTENT_EXTRA_BANNER_INDEX, bannerIndex);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -29,6 +29,8 @@
|
||||
#include "../sprites.h"
|
||||
#include "../util/Util.h"
|
||||
#include "Climate.h"
|
||||
#include "../windows/Intent.h"
|
||||
#include "../Context.h"
|
||||
|
||||
constexpr sint32 MAX_THUNDER_INSTANCES = 2;
|
||||
|
||||
@@ -124,7 +126,8 @@ extern "C"
|
||||
{
|
||||
if (gClimateUpdateTimer == 960)
|
||||
{
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE;
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_CLIMATE);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
gClimateUpdateTimer--;
|
||||
}
|
||||
@@ -142,7 +145,8 @@ extern "C"
|
||||
{
|
||||
gClimateCurrent.Weather = gClimateNext.Weather;
|
||||
climate_determine_future_weather(scenario_rand());
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE;
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_CLIMATE);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
else if (gClimateNext.RainLevel <= RAIN_LEVEL_HEAVY)
|
||||
{
|
||||
@@ -158,7 +162,8 @@ extern "C"
|
||||
else
|
||||
{
|
||||
gClimateCurrent.Temperature = climate_step_weather_level(gClimateCurrent.Temperature, gClimateNext.Temperature);
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_CLIMATE;
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_CLIMATE);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -4352,10 +4352,9 @@ void game_command_set_sign_style(sint32* eax, sint32* ebx, sint32* ecx, sint32*
|
||||
}
|
||||
}
|
||||
|
||||
rct_window* w = window_bring_to_front_by_number(WC_BANNER, *ecx);
|
||||
if (w) {
|
||||
window_invalidate(w);
|
||||
}
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_BANNER);
|
||||
intent.putExtra(INTENT_EXTRA_BANNER_INDEX, *ecx);
|
||||
context_broadcast_intent(&intent);
|
||||
|
||||
*ebx = 0;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,8 @@
|
||||
#include "Map.h"
|
||||
#include "Park.h"
|
||||
#include "Sprite.h"
|
||||
|
||||
#include "../windows/Intent.h"
|
||||
#include "../Context.h"
|
||||
|
||||
rct_string_id gParkName;
|
||||
uint32 gParkNameArgs;
|
||||
@@ -550,8 +551,8 @@ void park_update()
|
||||
gCompanyValue = calculate_company_value();
|
||||
window_invalidate_by_class(WC_FINANCES);
|
||||
_guestGenerationProbability = park_calculate_guest_generation_probability();
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PARK_RATING;
|
||||
window_invalidate_by_class(WC_PARK_INFORMATION);
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_PARK_RATING);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
|
||||
// Generate new guests
|
||||
@@ -591,7 +592,8 @@ void park_update_histories()
|
||||
sint32 guestsInPark = gNumGuestsInPark;
|
||||
sint32 lastGuestsInPark = gNumGuestsInParkLastWeek;
|
||||
gNumGuestsInParkLastWeek = guestsInPark;
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PEEP_COUNT;
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_GUEST_COUNT);
|
||||
context_broadcast_intent(&intent);
|
||||
|
||||
sint32 changeInGuestsInPark = guestsInPark - lastGuestsInPark;
|
||||
sint32 guestChangeModifier = 1;
|
||||
@@ -1050,8 +1052,8 @@ void set_forced_park_rating(sint32 rating)
|
||||
{
|
||||
_forcedParkRating = rating;
|
||||
gParkRating = calculate_park_rating();
|
||||
gToolbarDirtyFlags |= BTM_TB_DIRTY_FLAG_PARK_RATING;
|
||||
window_invalidate_by_class(WC_PARK_INFORMATION);
|
||||
auto intent = Intent(INTENT_ACTION_UPDATE_PARK_RATING);
|
||||
context_broadcast_intent(&intent);
|
||||
}
|
||||
|
||||
sint32 get_forced_park_rating()
|
||||
|
||||
Reference in new issue
Block a user