diff --git a/src/openrct2/rct1/S4Importer.cpp b/src/openrct2/rct1/S4Importer.cpp index 8740cb3fba..6ec4b734b9 100644 --- a/src/openrct2/rct1/S4Importer.cpp +++ b/src/openrct2/rct1/S4Importer.cpp @@ -177,7 +177,7 @@ namespace RCT1 ImportRides(); ImportRideMeasurements(); - ImportSprites(); + ImportEntities(); ImportTileElements(); ImportPeepSpawns(); ImportFinance(gameState); @@ -190,6 +190,7 @@ namespace RCT1 ImportSavedView(); FixLandOwnership(); FixUrbanPark(); + FixNextGuestNumber(gameState); CountBlockSections(); SetDefaultNames(); DetermineRideEntranceAndExitLocations(); @@ -1199,7 +1200,7 @@ namespace RCT1 void ImportEntity(const RCT12EntityBase& src); template void ImportEntity(const RCT12EntityBase& src); - void ImportSprites() + void ImportEntities() { for (int i = 0; i < Limits::MaxEntities; i++) { @@ -2601,6 +2602,22 @@ namespace RCT1 } } + void FixNextGuestNumber(GameState_t& gameState) + { + // In RCT1, the next guest number is not saved, so we have to calculate it. + // This is done by finding the highest guest number in the park, and adding 1. + uint32_t nextGuestNumber = 0; + + // TODO: Entities are currently read from the global state, change this once entities are stored + // in the passed gameState. + for (auto peep : EntityList()) + { + nextGuestNumber = std::max(nextGuestNumber, peep->PeepId); + } + + gameState.NextGuestNumber = nextGuestNumber + 1; + } + /** * Counts the block sections. The reason this iterates over the map is to avoid getting into infinite loops, * which can happen with hacked parks.