forked from rosebudai/OpenRCT2-Web
Remove getGameState() calls in importer code
This commit is contained in:
3 files changed
+31
-32
No files matched your search
@@ -2801,7 +2801,7 @@ namespace OpenRCT2
|
||||
T placeholder{};
|
||||
|
||||
auto index = cs.read<EntityId>();
|
||||
auto* ent = getGameState().entities.createEntityAt<T>(index);
|
||||
auto* ent = gameState.entities.createEntityAt<T>(index);
|
||||
if (ent == nullptr)
|
||||
{
|
||||
// Unable to allocate entity
|
||||
@@ -2822,7 +2822,7 @@ namespace OpenRCT2
|
||||
os.readWriteChunk(ParkFileChunkType::entities, [this, &gameState, &os](OrcaStream::ChunkStream& cs) {
|
||||
if (cs.getMode() == OrcaStream::Mode::reading)
|
||||
{
|
||||
getGameState().entities.resetAllEntities();
|
||||
gameState.entities.resetAllEntities();
|
||||
}
|
||||
|
||||
std::vector<uint16_t> entityIndices;
|
||||
|
||||
@@ -2797,7 +2797,7 @@ namespace OpenRCT2::RCT1
|
||||
template<>
|
||||
void S4Importer::ImportEntity<::Vehicle>(GameState_t& gameState, const RCT12EntityBase& srcBase)
|
||||
{
|
||||
auto* dst = getGameState().entities.createEntityAt<::Vehicle>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* dst = gameState.entities.createEntityAt<::Vehicle>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const Vehicle*>(&srcBase);
|
||||
const auto* ride = GetRide(RideId::FromUnderlying(src->Ride));
|
||||
if (ride == nullptr)
|
||||
@@ -2920,7 +2920,7 @@ namespace OpenRCT2::RCT1
|
||||
template<>
|
||||
void S4Importer::ImportEntity<Guest>(GameState_t& gameState, const RCT12EntityBase& srcBase)
|
||||
{
|
||||
auto* dst = getGameState().entities.createEntityAt<Guest>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* dst = gameState.entities.createEntityAt<Guest>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const Peep*>(&srcBase);
|
||||
ImportPeep(dst, src);
|
||||
|
||||
@@ -3016,7 +3016,7 @@ namespace OpenRCT2::RCT1
|
||||
template<>
|
||||
void S4Importer::ImportEntity<Staff>(GameState_t& gameState, const RCT12EntityBase& srcBase)
|
||||
{
|
||||
auto* dst = getGameState().entities.createEntityAt<Staff>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* dst = gameState.entities.createEntityAt<Staff>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const Peep*>(&srcBase);
|
||||
ImportPeep(dst, src);
|
||||
dst->assignedStaffType = StaffType(src->StaffType);
|
||||
@@ -3035,7 +3035,7 @@ namespace OpenRCT2::RCT1
|
||||
template<>
|
||||
void S4Importer::ImportEntity<Litter>(GameState_t& gameState, const RCT12EntityBase& srcBase)
|
||||
{
|
||||
auto* dst = getGameState().entities.createEntityAt<Litter>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* dst = gameState.entities.createEntityAt<Litter>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityLitter*>(&srcBase);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
|
||||
@@ -3046,7 +3046,7 @@ namespace OpenRCT2::RCT1
|
||||
template<>
|
||||
void S4Importer::ImportEntity<SteamParticle>(GameState_t& gameState, const RCT12EntityBase& srcBase)
|
||||
{
|
||||
auto* dst = getGameState().entities.createEntityAt<SteamParticle>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* dst = gameState.entities.createEntityAt<SteamParticle>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntitySteamParticle*>(&srcBase);
|
||||
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
@@ -3057,7 +3057,7 @@ namespace OpenRCT2::RCT1
|
||||
template<>
|
||||
void S4Importer::ImportEntity<MoneyEffect>(GameState_t& gameState, const RCT12EntityBase& srcBase)
|
||||
{
|
||||
auto* dst = getGameState().entities.createEntityAt<MoneyEffect>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* dst = gameState.entities.createEntityAt<MoneyEffect>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityMoneyEffect*>(&srcBase);
|
||||
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
@@ -3072,7 +3072,7 @@ namespace OpenRCT2::RCT1
|
||||
template<>
|
||||
void S4Importer::ImportEntity<VehicleCrashParticle>(GameState_t& gameState, const RCT12EntityBase& srcBase)
|
||||
{
|
||||
auto* dst = getGameState().entities.createEntityAt<VehicleCrashParticle>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* dst = gameState.entities.createEntityAt<VehicleCrashParticle>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityCrashedVehicleParticle*>(&srcBase);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->frame = src->Frame;
|
||||
@@ -3091,7 +3091,7 @@ namespace OpenRCT2::RCT1
|
||||
template<>
|
||||
void S4Importer::ImportEntity<ExplosionCloud>(GameState_t& gameState, const RCT12EntityBase& srcBase)
|
||||
{
|
||||
auto* dst = getGameState().entities.createEntityAt<ExplosionCloud>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* dst = gameState.entities.createEntityAt<ExplosionCloud>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityParticle*>(&srcBase);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->frame = src->Frame;
|
||||
@@ -3100,7 +3100,7 @@ namespace OpenRCT2::RCT1
|
||||
template<>
|
||||
void S4Importer::ImportEntity<ExplosionFlare>(GameState_t& gameState, const RCT12EntityBase& srcBase)
|
||||
{
|
||||
auto* dst = getGameState().entities.createEntityAt<ExplosionFlare>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* dst = gameState.entities.createEntityAt<ExplosionFlare>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityParticle*>(&srcBase);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->frame = src->Frame;
|
||||
@@ -3109,7 +3109,7 @@ namespace OpenRCT2::RCT1
|
||||
template<>
|
||||
void S4Importer::ImportEntity<CrashSplashParticle>(GameState_t& gameState, const RCT12EntityBase& srcBase)
|
||||
{
|
||||
auto* dst = getGameState().entities.createEntityAt<CrashSplashParticle>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* dst = gameState.entities.createEntityAt<CrashSplashParticle>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityParticle*>(&srcBase);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->frame = src->Frame;
|
||||
@@ -3118,7 +3118,7 @@ namespace OpenRCT2::RCT1
|
||||
template<>
|
||||
void S4Importer::ImportEntity<JumpingFountain>(GameState_t& gameState, const RCT12EntityBase& srcBase)
|
||||
{
|
||||
auto* dst = getGameState().entities.createEntityAt<JumpingFountain>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* dst = gameState.entities.createEntityAt<JumpingFountain>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityJumpingFountain*>(&srcBase);
|
||||
|
||||
auto fountainType = JumpingFountainType::water;
|
||||
@@ -3138,7 +3138,7 @@ namespace OpenRCT2::RCT1
|
||||
template<>
|
||||
void S4Importer::ImportEntity<Balloon>(GameState_t& gameState, const RCT12EntityBase& srcBase)
|
||||
{
|
||||
auto* dst = getGameState().entities.createEntityAt<Balloon>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* dst = gameState.entities.createEntityAt<Balloon>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityBalloon*>(&srcBase);
|
||||
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
@@ -3159,7 +3159,7 @@ namespace OpenRCT2::RCT1
|
||||
template<>
|
||||
void S4Importer::ImportEntity<Duck>(GameState_t& gameState, const RCT12EntityBase& srcBase)
|
||||
{
|
||||
auto* dst = getGameState().entities.createEntityAt<Duck>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* dst = gameState.entities.createEntityAt<Duck>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityDuck*>(&srcBase);
|
||||
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
|
||||
@@ -565,7 +565,7 @@ namespace OpenRCT2::RCT2
|
||||
|
||||
ImportMapAnimations();
|
||||
|
||||
ImportRideRatingsCalcData();
|
||||
ImportRideRatingsCalcData(gameState);
|
||||
ImportRideMeasurements();
|
||||
gameState.nextGuestNumber = _s6.NextGuestIndex;
|
||||
gameState.grassSceneryTileLoopPosition = _s6.GrassAndSceneryTilepos;
|
||||
@@ -1054,12 +1054,12 @@ namespace OpenRCT2::RCT2
|
||||
}
|
||||
}
|
||||
|
||||
void ImportRideRatingsCalcData()
|
||||
void ImportRideRatingsCalcData(GameState_t& gameState)
|
||||
{
|
||||
const auto& src = _s6.RideRatingsCalcData;
|
||||
// S6 has only one state, ensure we reset all states before reading the first one.
|
||||
RideRating::ResetUpdateStates();
|
||||
auto& rideRatingStates = getGameState().rideRatingUpdateStates;
|
||||
auto& rideRatingStates = gameState.rideRatingUpdateStates;
|
||||
auto& dst = rideRatingStates[0];
|
||||
dst = {};
|
||||
dst.Proximity = { src.ProximityX, src.ProximityY, src.ProximityZ };
|
||||
@@ -1990,7 +1990,7 @@ namespace OpenRCT2::RCT2
|
||||
template<>
|
||||
void S6Importer::ImportEntity<::Vehicle>(GameState_t& gameState, const RCT12EntityBase& baseSrc)
|
||||
{
|
||||
auto dst = getGameState().entities.createEntityAt<::Vehicle>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto dst = gameState.entities.createEntityAt<::Vehicle>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const Vehicle*>(&baseSrc);
|
||||
const auto& ride = _s6.Rides[src->Ride];
|
||||
|
||||
@@ -2116,7 +2116,7 @@ namespace OpenRCT2::RCT2
|
||||
template<>
|
||||
void S6Importer::ImportEntity<::Guest>(GameState_t& gameState, const RCT12EntityBase& baseSrc)
|
||||
{
|
||||
auto dst = getGameState().entities.createEntityAt<::Guest>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto dst = gameState.entities.createEntityAt<::Guest>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const Peep*>(&baseSrc);
|
||||
ImportEntityPeep(dst, src);
|
||||
|
||||
@@ -2191,7 +2191,7 @@ namespace OpenRCT2::RCT2
|
||||
template<>
|
||||
void S6Importer::ImportEntity<::Staff>(GameState_t& gameState, const RCT12EntityBase& baseSrc)
|
||||
{
|
||||
auto dst = getGameState().entities.createEntityAt<::Staff>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto dst = gameState.entities.createEntityAt<::Staff>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const Peep*>(&baseSrc);
|
||||
ImportEntityPeep(dst, src);
|
||||
|
||||
@@ -2212,7 +2212,7 @@ namespace OpenRCT2::RCT2
|
||||
template<>
|
||||
void S6Importer::ImportEntity<::SteamParticle>(GameState_t& gameState, const RCT12EntityBase& baseSrc)
|
||||
{
|
||||
auto dst = getGameState().entities.createEntityAt<::SteamParticle>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto dst = gameState.entities.createEntityAt<::SteamParticle>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntitySteamParticle*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->timeToMove = src->TimeToMove;
|
||||
@@ -2222,7 +2222,7 @@ namespace OpenRCT2::RCT2
|
||||
template<>
|
||||
void S6Importer::ImportEntity<::MoneyEffect>(GameState_t& gameState, const RCT12EntityBase& baseSrc)
|
||||
{
|
||||
auto dst = getGameState().entities.createEntityAt<::MoneyEffect>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto dst = gameState.entities.createEntityAt<::MoneyEffect>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityMoneyEffect*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->moveDelay = src->MoveDelay;
|
||||
@@ -2236,8 +2236,7 @@ namespace OpenRCT2::RCT2
|
||||
template<>
|
||||
void S6Importer::ImportEntity<::VehicleCrashParticle>(GameState_t& gameState, const RCT12EntityBase& baseSrc)
|
||||
{
|
||||
auto dst = getGameState().entities.createEntityAt<::VehicleCrashParticle>(
|
||||
EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto dst = gameState.entities.createEntityAt<::VehicleCrashParticle>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityCrashedVehicleParticle*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->frame = src->Frame;
|
||||
@@ -2257,7 +2256,7 @@ namespace OpenRCT2::RCT2
|
||||
template<>
|
||||
void S6Importer::ImportEntity<::ExplosionCloud>(GameState_t& gameState, const RCT12EntityBase& baseSrc)
|
||||
{
|
||||
auto dst = getGameState().entities.createEntityAt<::ExplosionCloud>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto dst = gameState.entities.createEntityAt<::ExplosionCloud>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityParticle*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->frame = src->Frame;
|
||||
@@ -2266,7 +2265,7 @@ namespace OpenRCT2::RCT2
|
||||
template<>
|
||||
void S6Importer::ImportEntity<::ExplosionFlare>(GameState_t& gameState, const RCT12EntityBase& baseSrc)
|
||||
{
|
||||
auto dst = getGameState().entities.createEntityAt<::ExplosionFlare>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto dst = gameState.entities.createEntityAt<::ExplosionFlare>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityParticle*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->frame = src->Frame;
|
||||
@@ -2275,7 +2274,7 @@ namespace OpenRCT2::RCT2
|
||||
template<>
|
||||
void S6Importer::ImportEntity<::CrashSplashParticle>(GameState_t& gameState, const RCT12EntityBase& baseSrc)
|
||||
{
|
||||
auto dst = getGameState().entities.createEntityAt<::CrashSplashParticle>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto dst = gameState.entities.createEntityAt<::CrashSplashParticle>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityParticle*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->frame = src->Frame;
|
||||
@@ -2284,7 +2283,7 @@ namespace OpenRCT2::RCT2
|
||||
template<>
|
||||
void S6Importer::ImportEntity<::JumpingFountain>(GameState_t& gameState, const RCT12EntityBase& baseSrc)
|
||||
{
|
||||
auto dst = getGameState().entities.createEntityAt<::JumpingFountain>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto dst = gameState.entities.createEntityAt<::JumpingFountain>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityJumpingFountain*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->numTicksAlive = src->NumTicksAlive;
|
||||
@@ -2301,7 +2300,7 @@ namespace OpenRCT2::RCT2
|
||||
template<>
|
||||
void S6Importer::ImportEntity<::Balloon>(GameState_t& gameState, const RCT12EntityBase& baseSrc)
|
||||
{
|
||||
auto dst = getGameState().entities.createEntityAt<::Balloon>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto dst = gameState.entities.createEntityAt<::Balloon>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityBalloon*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->popped = src->Popped;
|
||||
@@ -2313,7 +2312,7 @@ namespace OpenRCT2::RCT2
|
||||
template<>
|
||||
void S6Importer::ImportEntity<::Duck>(GameState_t& gameState, const RCT12EntityBase& baseSrc)
|
||||
{
|
||||
auto dst = getGameState().entities.createEntityAt<::Duck>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto dst = gameState.entities.createEntityAt<::Duck>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityDuck*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->frame = src->Frame;
|
||||
@@ -2325,7 +2324,7 @@ namespace OpenRCT2::RCT2
|
||||
template<>
|
||||
void S6Importer::ImportEntity<::Litter>(GameState_t& gameState, const RCT12EntityBase& baseSrc)
|
||||
{
|
||||
auto dst = getGameState().entities.createEntityAt<::Litter>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto dst = gameState.entities.createEntityAt<::Litter>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityLitter*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->subType = ::Litter::Type(src->Type);
|
||||
|
||||
Reference in new issue
Block a user