Don't remove vehicles when removing all guests, name some interaction fields

This commit is contained in:
Michael Steenbeek 2017-01-30 23:51:01 +01:00 committed by GitHub
parent 2008f4add4
commit 94d38b9f7a
5 changed files with 44 additions and 21 deletions

View File

@ -1,5 +1,6 @@
0.0.7 (in development)
------------------------------------------------------------------------
- Improved: [#5137]: Removing all guests no longer closes the rides and removes the vehicles.
0.0.6 (2017-01-29)
------------------------------------------------------------------------

View File

@ -24,6 +24,7 @@
#include "world/climate.h"
#include "world/footpath.h"
#include "world/scenery.h"
#include "world/sprite.h"
bool gCheatsSandboxMode = false;
bool gCheatsDisableClearanceChecks = false;
@ -360,6 +361,7 @@ static void cheat_give_all_guests(sint32 object)
static void cheat_remove_all_guests()
{
rct_peep *peep;
rct_vehicle *vehicle;
uint16 spriteIndex, nextSpriteIndex;
for (spriteIndex = gSpriteListHead[SPRITE_LIST_PEEP]; spriteIndex != SPRITE_INDEX_NULL; spriteIndex = nextSpriteIndex) {
@ -370,19 +372,39 @@ static void cheat_remove_all_guests()
}
}
sint32 i;
sint32 rideIndex;
rct_ride *ride;
FOR_ALL_RIDES(i, ride)
FOR_ALL_RIDES(rideIndex, ride)
{
ride_clear_for_construction(i);
ride_set_status(i, RIDE_STATUS_CLOSED);
ride->num_riders = 0;
for (size_t j = 0; j < 4; j++) {
ride->queue_length[j] = 0;
ride->last_peep_in_queue[j] = SPRITE_INDEX_NULL;
for (size_t stationIndex = 0; stationIndex < RCT12_MAX_STATIONS_PER_RIDE; stationIndex++)
{
ride->queue_length[stationIndex] = 0;
ride->last_peep_in_queue[stationIndex] = SPRITE_INDEX_NULL;
}
for (size_t trainIndex = 0; trainIndex < 32; trainIndex++)
{
spriteIndex = ride->vehicles[trainIndex];
while (spriteIndex != SPRITE_INDEX_NULL)
{
vehicle = GET_VEHICLE(spriteIndex);
vehicle->num_peeps = 0;
vehicle->next_free_seat = 0;
for (size_t peepInTrainIndex = 0; peepInTrainIndex < 32; peepInTrainIndex++)
{
vehicle->peep[peepInTrainIndex] = SPRITE_INDEX_NULL;
}
spriteIndex = vehicle->next_vehicle_on_train;
}
}
}
window_invalidate_by_class(WC_RIDE);
gfx_invalidate_screen();
}

View File

@ -296,9 +296,9 @@ void lightfx_prepare_light_list()
// log_warning("[%i, %i]", dpi->x, dpi->y);
mapCoord.x = _unk9AC14C + tileOffsetX;
mapCoord.y = _unk9AC14E + tileOffsetY;
interactionType = _unk9AC148;
mapCoord.x = _interactionMapX + tileOffsetX;
mapCoord.y = _interactionMapY + tileOffsetY;
interactionType = _interactionSpriteType;
mapElement = RCT2_GLOBAL(0x9AC150, rct_map_element*);
#endif //LIGHTFX_UNKNOWN_PART_1

View File

@ -62,10 +62,10 @@ uint32 gUnkEDF81C;
static rct_drawpixelinfo _viewportDpi1;
static rct_drawpixelinfo _viewportDpi2;
static uint8 _unk9AC148;
static uint8 _interactionSpriteType;
static uint8 _unk9AC149;
static sint16 _unk9AC14C;
static sint16 _unk9AC14E;
static sint16 _interactionMapX;
static sint16 _interactionMapY;
static uint16 _unk9AC154;
static sint16 _unk9ABDAE;
@ -1014,10 +1014,10 @@ static void store_interaction_info(paint_struct *ps)
mask = 1 << (ps->sprite_type - 1);
if (!(_unk9AC154 & mask)) {
_unk9AC148 = ps->sprite_type;
_interactionSpriteType = ps->sprite_type;
_unk9AC149 = ps->var_29;
_unk9AC14C = ps->map_x;
_unk9AC14E = ps->map_y;
_interactionMapX = ps->map_x;
_interactionMapY = ps->map_y;
_interaction_element = ps->mapElement;
}
}
@ -1355,7 +1355,7 @@ static void sub_68862C(rct_drawpixelinfo * dpi, paint_struct * ps)
void get_map_coordinates_from_pos(sint32 screenX, sint32 screenY, sint32 flags, sint16 *x, sint16 *y, sint32 *interactionType, rct_map_element **mapElement, rct_viewport **viewport)
{
_unk9AC154 = flags & 0xFFFF;
_unk9AC148 = 0;
_interactionSpriteType = 0;
rct_window* window = window_find_from_point(screenX, screenY);
if (window != NULL && window->viewport != NULL)
{
@ -1386,9 +1386,9 @@ void get_map_coordinates_from_pos(sint32 screenX, sint32 screenY, sint32 flags,
}
if (viewport != NULL) *viewport = myviewport;
}
if (interactionType != NULL) *interactionType = _unk9AC148;
if (x != NULL) *x = _unk9AC14C;
if (y != NULL) *y = _unk9AC14E;
if (interactionType != NULL) *interactionType = _interactionSpriteType;
if (x != NULL) *x = _interactionMapX;
if (y != NULL) *y = _interactionMapY;
if (mapElement != NULL) *mapElement = _interaction_element;
}

View File

@ -54,7 +54,7 @@ extern "C" {
// This define specifies which version of network stream current build uses.
// It is used for making sure only compatible builds get connected, even within
// single OpenRCT2 version.
#define NETWORK_STREAM_VERSION "0"
#define NETWORK_STREAM_VERSION "1"
#define NETWORK_STREAM_ID OPENRCT2_VERSION "-" NETWORK_STREAM_VERSION
#ifdef __cplusplus