1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-30 10:15:36 +01:00

Fix #7223: 'Remove all guests' does not remove their mass

This commit is contained in:
deurklink
2018-03-07 10:52:22 +01:00
committed by Michael Steenbeek
parent 2c6804f334
commit 3648f288e5
3 changed files with 18 additions and 11 deletions

View File

@@ -103,6 +103,7 @@ The following people are not part of the project team, but have been contributin
* Tyler Ruckinger (TyPR124)
* Justin Gottula (jgottula)
* Seongsik Park (pss9205)
* (Deurklink)
## Toolchain
* (Balletie) - macOS

View File

@@ -110,6 +110,7 @@
- Fix: [#7003] Building sloped paths through flat paths with clearance checks off causes glitches.
- Fix: [#7011] Swinging and bobsleigh cars going backwards swing in the wrong direction (original bug).
- Fix: [#7125] No entry signs not correctly handled in pathfinding.
- Fix: [#7223] Vehicle mass not correctly recalculated when using remove all guests cheat.
- Fix: Infinite loop when removing scenery elements with >127 base height.
- Fix: Ghosting of transparent map elements when the viewport is moved in OpenGL mode.
- Fix: Clear IME buffer after committing composed text.

View File

@@ -355,15 +355,6 @@ 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) {
peep = &(get_sprite(spriteIndex)->peep);
nextSpriteIndex = peep->next;
if (peep->type == PEEP_TYPE_GUEST) {
peep_remove(peep);
}
}
sint32 rideIndex;
Ride *ride;
@@ -384,19 +375,33 @@ static void cheat_remove_all_guests()
{
vehicle = GET_VEHICLE(spriteIndex);
vehicle->num_peeps = 0;
vehicle->next_free_seat = 0;
for (size_t i = 0; i < vehicle->num_peeps; i++)
{
peep = GET_PEEP(vehicle->peep[i]);
vehicle->mass -= peep->mass;
}
for (auto &peepInTrainIndex : vehicle->peep)
{
peepInTrainIndex = SPRITE_INDEX_NULL;
}
vehicle->num_peeps = 0;
vehicle->next_free_seat = 0;
spriteIndex = vehicle->next_vehicle_on_train;
}
}
}
for (spriteIndex = gSpriteListHead[SPRITE_LIST_PEEP]; spriteIndex != SPRITE_INDEX_NULL; spriteIndex = nextSpriteIndex) {
peep = &(get_sprite(spriteIndex)->peep);
nextSpriteIndex = peep->next;
if (peep->type == PEEP_TYPE_GUEST) {
peep_remove(peep);
}
}
window_invalidate_by_class(WC_RIDE);
gfx_invalidate_screen();
}