forked from rosebudai/OpenRCT2-Web
Convert contents of EntityRegistry.h to camelCase (#27019)
This commit is contained in:
1 parent
b92dd1d78c
commit
0fb70602d3
99 files changed
+469
-469
No files matched your search
@@ -71,7 +71,7 @@ namespace OpenRCT2::Audio
|
||||
}
|
||||
iterator& operator++()
|
||||
{
|
||||
Current = getGameState().entities.GetEntity<Vehicle>(NextVehicleId);
|
||||
Current = getGameState().entities.getEntity<Vehicle>(NextVehicleId);
|
||||
if (Current != nullptr)
|
||||
{
|
||||
NextVehicleId = Current->next_vehicle_on_train;
|
||||
@@ -602,7 +602,7 @@ namespace OpenRCT2::Audio
|
||||
vehicleSound->volume = tempvolume;
|
||||
panVol = std::max(0, panVol - tempvolume);
|
||||
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(EntityId::FromUnderlying(vehicleSoundParams.id));
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(EntityId::FromUnderlying(vehicleSoundParams.id));
|
||||
if (vehicle != nullptr)
|
||||
{
|
||||
UpdateSound<SoundType::trackNoises>(
|
||||
|
||||
@@ -431,7 +431,7 @@ namespace OpenRCT2::Title
|
||||
auto windowManager = Ui::GetWindowManager();
|
||||
auto& gameState = getGameState();
|
||||
windowManager->SetMainView(gameState.savedView, gameState.savedViewZoom, gameState.savedViewRotation);
|
||||
gameState.entities.ResetEntitySpatialIndices();
|
||||
gameState.entities.resetEntitySpatialIndices();
|
||||
ResetAllSpriteQuadrantPlacements();
|
||||
|
||||
// Invalidate scrolling text cache to prevent stale text from previous park
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
bool GameHasEntities() const
|
||||
{
|
||||
auto& gameState = getGameState();
|
||||
return gameState.entities.GetNumFreeEntities() != kMaxEntities
|
||||
return gameState.entities.getNumFreeEntities() != kMaxEntities
|
||||
|| gameState.park.flags.has(ParkFlag::spritesInitialised);
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
break;
|
||||
}
|
||||
|
||||
auto peep = getGameState().entities.TryGetEntity<Peep>(EntityId::FromUnderlying(newsItem->assoc));
|
||||
auto peep = getGameState().entities.tryGetEntity<Peep>(EntityId::FromUnderlying(newsItem->assoc));
|
||||
if (peep == nullptr)
|
||||
return;
|
||||
|
||||
|
||||
@@ -433,7 +433,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
private:
|
||||
Guest* GetGuest()
|
||||
{
|
||||
auto guest = getGameState().entities.GetEntity<Guest>(EntityId::FromUnderlying(number));
|
||||
auto guest = getGameState().entities.getEntity<Guest>(EntityId::FromUnderlying(number));
|
||||
if (guest == nullptr)
|
||||
{
|
||||
close();
|
||||
|
||||
@@ -535,7 +535,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
if (i == 0)
|
||||
{
|
||||
auto guest = getGameState().entities.GetEntity<Guest>(guestItem.Id);
|
||||
auto guest = getGameState().entities.getEntity<Guest>(guestItem.Id);
|
||||
if (guest != nullptr)
|
||||
{
|
||||
GuestOpen(guest);
|
||||
@@ -595,14 +595,14 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
for (auto peep : EntityList<Guest>())
|
||||
{
|
||||
getGameState().entities.EntitySetFlashing(peep, false);
|
||||
getGameState().entities.entitySetFlashing(peep, false);
|
||||
if (peep->outsideOfPark)
|
||||
continue;
|
||||
if (_selectedFilter)
|
||||
{
|
||||
if (!IsPeepInFilter(*peep))
|
||||
continue;
|
||||
getGameState().entities.EntitySetFlashing(peep, true);
|
||||
getGameState().entities.entitySetFlashing(peep, true);
|
||||
}
|
||||
if (!GuestShouldBeVisible(*peep))
|
||||
continue;
|
||||
@@ -656,7 +656,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
|
||||
// Guest name
|
||||
auto peep = getGameState().entities.GetEntity<Guest>(guestItem.Id);
|
||||
auto peep = getGameState().entities.getEntity<Guest>(guestItem.Id);
|
||||
if (peep == nullptr)
|
||||
{
|
||||
continue;
|
||||
@@ -911,8 +911,8 @@ namespace OpenRCT2::Ui::Windows
|
||||
template<bool TRealNames>
|
||||
static bool CompareGuestItem(const GuestItem& a, const GuestItem& b)
|
||||
{
|
||||
const auto* peepA = getGameState().entities.GetEntity<Peep>(a.Id);
|
||||
const auto* peepB = getGameState().entities.GetEntity<Peep>(b.Id);
|
||||
const auto* peepA = getGameState().entities.getEntity<Peep>(a.Id);
|
||||
const auto* peepB = getGameState().entities.getEntity<Peep>(b.Id);
|
||||
if (peepA != nullptr && peepB != nullptr)
|
||||
{
|
||||
// Compare types
|
||||
|
||||
@@ -977,7 +977,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto leftTop = ScreenCoordsXY{ c.x, c.y } + offset;
|
||||
auto rightBottom = leftTop;
|
||||
auto colour = DefaultPeepMapColour;
|
||||
if (getGameState().entities.EntityGetFlashing(peep))
|
||||
if (getGameState().entities.entityGetFlashing(peep))
|
||||
{
|
||||
colour = flashColour;
|
||||
// If flashing then map peep pixel size is increased (by moving left top downwards)
|
||||
@@ -1019,7 +1019,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
for (auto train : TrainManager::View())
|
||||
{
|
||||
for (Vehicle* vehicle = train; vehicle != nullptr;
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
if (vehicle->x == kLocationNull)
|
||||
continue;
|
||||
|
||||
@@ -535,7 +535,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
break;
|
||||
}
|
||||
|
||||
auto peep = getGameState().entities.TryGetEntity<Peep>(EntityId::FromUnderlying(newsItem.assoc));
|
||||
auto peep = getGameState().entities.tryGetEntity<Peep>(EntityId::FromUnderlying(newsItem.assoc));
|
||||
if (peep == nullptr)
|
||||
{
|
||||
break;
|
||||
|
||||
@@ -199,7 +199,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
auto mapTile = GetBestCoordsFromPos(screenCoords);
|
||||
if (mapTile)
|
||||
{
|
||||
auto staff = getGameState().entities.GetEntity<Staff>(_staffId);
|
||||
auto staff = getGameState().entities.getEntity<Staff>(_staffId);
|
||||
if (staff != nullptr)
|
||||
{
|
||||
_mode = staff->isPatrolAreaSet(*mapTile) ? GameActions::StaffSetPatrolAreaMode::unset
|
||||
@@ -212,7 +212,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
void onToolDrag(WidgetIndex widgetIndex, const ScreenCoordsXY& screenCoords) override
|
||||
{
|
||||
auto staff = getGameState().entities.GetEntity<Staff>(_staffId);
|
||||
auto staff = getGameState().entities.getEntity<Staff>(_staffId);
|
||||
if (staff != nullptr)
|
||||
{
|
||||
MapRange range(gMapSelectPositionA, gMapSelectPositionB);
|
||||
|
||||
@@ -1539,7 +1539,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
const auto* rideEntry = ride->getRideEntry();
|
||||
if (rideEntry != nullptr && rideEntry->TabCar != 0)
|
||||
{
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(vehId);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(vehId);
|
||||
if (vehicle == nullptr)
|
||||
{
|
||||
vehId = EntityId::GetNull();
|
||||
@@ -2000,7 +2000,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
if (_viewIndex <= ride->numTrains)
|
||||
{
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(ride->vehicles[_viewIndex - 1]);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(ride->vehicles[_viewIndex - 1]);
|
||||
if (vehicle != nullptr)
|
||||
{
|
||||
auto headVehicleSpriteIndex = vehicle->id;
|
||||
@@ -2316,7 +2316,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
if (_viewIndex <= ride->numTrains)
|
||||
{
|
||||
Vehicle* vehicle = gameState.entities.GetEntity<Vehicle>(ride->vehicles[_viewIndex - 1]);
|
||||
Vehicle* vehicle = gameState.entities.getEntity<Vehicle>(ride->vehicles[_viewIndex - 1]);
|
||||
if (vehicle == nullptr
|
||||
|| (vehicle->status != Vehicle::Status::travelling
|
||||
&& vehicle->status != Vehicle::Status::travellingCableLift
|
||||
@@ -2485,7 +2485,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (ride == nullptr)
|
||||
return kStringIdEmpty;
|
||||
|
||||
auto vehicle = getGameState().entities.GetEntity<Vehicle>(ride->vehicles[_viewIndex - 1]);
|
||||
auto vehicle = getGameState().entities.getEntity<Vehicle>(ride->vehicles[_viewIndex - 1]);
|
||||
if (vehicle == nullptr)
|
||||
return kStringIdEmpty;
|
||||
|
||||
@@ -3997,9 +3997,9 @@ namespace OpenRCT2::Ui::Windows
|
||||
break;
|
||||
for (int32_t i = 0; i < ride->numTrains; ++i)
|
||||
{
|
||||
for (vehicle = getGameState().entities.GetEntity<Vehicle>(ride->vehicles[i]);
|
||||
for (vehicle = getGameState().entities.getEntity<Vehicle>(ride->vehicles[i]);
|
||||
vehicle != nullptr;
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
vehicle->flags.unset(
|
||||
VehicleFlag::carIsBroken, VehicleFlag::stoppedBySafetyCutout,
|
||||
@@ -4011,14 +4011,14 @@ namespace OpenRCT2::Ui::Windows
|
||||
case Breakdown::restraintsStuckOpen:
|
||||
case Breakdown::doorsStuckClosed:
|
||||
case Breakdown::doorsStuckOpen:
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(ride->vehicles[ride->brokenTrain]);
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(ride->vehicles[ride->brokenTrain]);
|
||||
if (vehicle != nullptr)
|
||||
{
|
||||
vehicle->flags.unset(VehicleFlag::carIsBroken);
|
||||
}
|
||||
break;
|
||||
case Breakdown::vehicleMalfunction:
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(ride->vehicles[ride->brokenTrain]);
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(ride->vehicles[ride->brokenTrain]);
|
||||
if (vehicle != nullptr)
|
||||
{
|
||||
vehicle->flags.unset(VehicleFlag::trainIsBroken);
|
||||
@@ -4222,7 +4222,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
else
|
||||
{
|
||||
auto staff = getGameState().entities.GetEntity<Staff>(ride->mechanic);
|
||||
auto staff = getGameState().entities.getEntity<Staff>(ride->mechanic);
|
||||
if (staff != nullptr && staff->isMechanic())
|
||||
{
|
||||
ft = Formatter();
|
||||
@@ -7371,7 +7371,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
int32_t numPeepsLeft = vehicle->num_peeps;
|
||||
for (int32_t i = 0; i < 32 && numPeepsLeft > 0; i++)
|
||||
{
|
||||
Peep* peep = getGameState().entities.GetEntity<Guest>(vehicle->peep[i]);
|
||||
Peep* peep = getGameState().entities.getEntity<Guest>(vehicle->peep[i]);
|
||||
if (peep == nullptr)
|
||||
continue;
|
||||
|
||||
|
||||
@@ -1214,7 +1214,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
Staff* GetStaff()
|
||||
{
|
||||
return getGameState().entities.GetEntity<Staff>(EntityId::FromUnderlying(number));
|
||||
return getGameState().entities.getEntity<Staff>(EntityId::FromUnderlying(number));
|
||||
}
|
||||
|
||||
static constexpr int32_t TabAnimationDivisor[] = {
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
drawWidgets(rt);
|
||||
|
||||
Peep* peep = getGameState().entities.GetEntity<Staff>(EntityId::FromUnderlying(number));
|
||||
Peep* peep = getGameState().entities.getEntity<Staff>(EntityId::FromUnderlying(number));
|
||||
// The staff member may have been fired in the meantime.
|
||||
if (peep == nullptr)
|
||||
{
|
||||
|
||||
@@ -186,10 +186,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
{
|
||||
for (auto peep : EntityList<Staff>())
|
||||
{
|
||||
getGameState().entities.EntitySetFlashing(peep, false);
|
||||
getGameState().entities.entitySetFlashing(peep, false);
|
||||
if (peep->assignedStaffType == GetSelectedStaffType())
|
||||
{
|
||||
getGameState().entities.EntitySetFlashing(peep, true);
|
||||
getGameState().entities.entitySetFlashing(peep, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -349,7 +349,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
}
|
||||
else
|
||||
{
|
||||
auto peep = gameState.entities.GetEntity<Staff>(entry.Id);
|
||||
auto peep = gameState.entities.getEntity<Staff>(entry.Id);
|
||||
if (peep != nullptr)
|
||||
{
|
||||
auto intent = Intent(WindowClass::peep);
|
||||
@@ -388,7 +388,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
if (y + 11 >= rt.y)
|
||||
{
|
||||
const auto* peep = getGameState().entities.GetEntity<Staff>(entry.Id);
|
||||
const auto* peep = getGameState().entities.getEntity<Staff>(entry.Id);
|
||||
if (peep == nullptr)
|
||||
{
|
||||
continue;
|
||||
@@ -487,10 +487,10 @@ namespace OpenRCT2::Ui::Windows
|
||||
|
||||
for (auto* peep : EntityList<Staff>())
|
||||
{
|
||||
getGameState().entities.EntitySetFlashing(peep, false);
|
||||
getGameState().entities.entitySetFlashing(peep, false);
|
||||
if (peep->assignedStaffType == GetSelectedStaffType())
|
||||
{
|
||||
getGameState().entities.EntitySetFlashing(peep, true);
|
||||
getGameState().entities.entitySetFlashing(peep, true);
|
||||
|
||||
StaffEntry entry;
|
||||
entry.Id = peep->id;
|
||||
@@ -547,7 +547,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
return;
|
||||
|
||||
auto actionResult = res->getData<GameActions::StaffHireNewActionResult>();
|
||||
auto* staff = getGameState().entities.GetEntity<Staff>(actionResult.StaffEntityId);
|
||||
auto* staff = getGameState().entities.getEntity<Staff>(actionResult.StaffEntityId);
|
||||
if (staff == nullptr)
|
||||
return;
|
||||
|
||||
@@ -564,7 +564,7 @@ namespace OpenRCT2::Ui::Windows
|
||||
if (result->error != GameActions::Status::ok)
|
||||
return;
|
||||
|
||||
auto* staff2 = getGameState().entities.GetEntity<Staff>(staffId);
|
||||
auto* staff2 = getGameState().entities.getEntity<Staff>(staffId);
|
||||
auto intent = Intent(WindowClass::peep);
|
||||
intent.PutExtra(INTENT_EXTRA_PEEP, staff2);
|
||||
auto* wind = ContextOpenIntent(&intent);
|
||||
|
||||
@@ -257,7 +257,7 @@ static void FixPeepsWithInvalidRideReference()
|
||||
if (!peepsToRemove.empty())
|
||||
{
|
||||
// Some broken saves have broken spatial indexes
|
||||
getGameState().entities.ResetEntitySpatialIndices();
|
||||
getGameState().entities.resetEntitySpatialIndices();
|
||||
}
|
||||
|
||||
for (auto ptr : peepsToRemove)
|
||||
@@ -368,7 +368,7 @@ void GameLoadInit()
|
||||
{
|
||||
GameActions::ClearQueue();
|
||||
}
|
||||
getGameState().entities.ResetEntitySpatialIndices();
|
||||
getGameState().entities.resetEntitySpatialIndices();
|
||||
ResetAllSpriteQuadrantPlacements();
|
||||
|
||||
gWindowUpdateTicks = 0;
|
||||
@@ -437,7 +437,7 @@ void ResetAllSpriteQuadrantPlacements()
|
||||
{
|
||||
for (EntityId::UnderlyingType i = 0; i < kMaxEntities; i++)
|
||||
{
|
||||
auto* spr = getGameState().entities.GetEntity(EntityId::FromUnderlying(i));
|
||||
auto* spr = getGameState().entities.getEntity(EntityId::FromUnderlying(i));
|
||||
if (spr != nullptr && spr->type != EntityType::null)
|
||||
{
|
||||
spr->moveTo(spr->getLocation());
|
||||
@@ -736,7 +736,7 @@ void GameLoadOrQuitNoSavePrompt()
|
||||
}
|
||||
default:
|
||||
GameUnloadScripts();
|
||||
getGameState().entities.ResetAllEntities();
|
||||
getGameState().entities.resetAllEntities();
|
||||
GetContext()->Finish();
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ namespace OpenRCT2
|
||||
FinanceInit();
|
||||
BannerInit(gameState);
|
||||
RideInitAll();
|
||||
gameState.entities.ResetAllEntities();
|
||||
gameState.entities.resetAllEntities();
|
||||
UpdateConsolidatedPatrolAreas();
|
||||
ResetDate();
|
||||
Weather::reset();
|
||||
@@ -173,14 +173,14 @@ namespace OpenRCT2
|
||||
|
||||
// Keep updating the money effect even when paused.
|
||||
auto& gameState = getGameState();
|
||||
gameState.entities.UpdateMoneyEffect();
|
||||
gameState.entities.updateMoneyEffect();
|
||||
|
||||
// Post-tick network update
|
||||
Network::PostTick();
|
||||
|
||||
// Post-tick game actions.
|
||||
GameActions::ProcessQueue(gameState);
|
||||
gameState.entities.UpdateEntitiesSpatialIndex();
|
||||
gameState.entities.updateEntitiesSpatialIndex();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -320,7 +320,7 @@ namespace OpenRCT2
|
||||
auto restoreProvisionalIntent = Intent(INTENT_ACTION_RESTORE_PROVISIONAL_ELEMENTS);
|
||||
ContextBroadcastIntent(&restoreProvisionalIntent);
|
||||
VehicleUpdateAll();
|
||||
gameState.entities.UpdateAllMiscEntities();
|
||||
gameState.entities.updateAllMiscEntities();
|
||||
Ride::updateAll();
|
||||
|
||||
if (!isInEditorMode())
|
||||
@@ -344,7 +344,7 @@ namespace OpenRCT2
|
||||
// Update windows
|
||||
// WindowDispatchUpdateAll();
|
||||
|
||||
gameState.entities.UpdateEntitiesSpatialIndex();
|
||||
gameState.entities.updateEntitiesSpatialIndex();
|
||||
|
||||
// Start autosave timer after update
|
||||
if (gLastAutoSaveUpdate == kAutosavePause)
|
||||
|
||||
@@ -189,7 +189,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots
|
||||
virtual void Capture(GameStateSnapshot_t& snapshot) override final
|
||||
{
|
||||
snapshot.SerialiseSprites(
|
||||
[](const EntityId index) { return reinterpret_cast<EntitySnapshot*>(getGameState().entities.GetEntity(index)); },
|
||||
[](const EntityId index) { return reinterpret_cast<EntitySnapshot*>(getGameState().entities.getEntity(index)); },
|
||||
kMaxEntities, true);
|
||||
|
||||
// LOG_INFO("Snapshot size: %u bytes", static_cast<uint32_t>(snapshot.storedSprites.GetLength()));
|
||||
|
||||
@@ -178,7 +178,7 @@ namespace OpenRCT2
|
||||
|
||||
if ((_mode == ReplayMode::recording || _mode == ReplayMode::normalisation) && currentTicks == _nextChecksumTick)
|
||||
{
|
||||
EntitiesChecksum checksum = getGameState().entities.GetAllEntitiesChecksum();
|
||||
EntitiesChecksum checksum = getGameState().entities.getAllEntitiesChecksum();
|
||||
AddChecksum(currentTicks, std::move(checksum));
|
||||
|
||||
_nextChecksumTick = currentTicks + ChecksumTicksDelta();
|
||||
@@ -308,7 +308,7 @@ namespace OpenRCT2
|
||||
_currentRecording->tickEnd = currentTicks;
|
||||
|
||||
{
|
||||
EntitiesChecksum checksum = getGameState().entities.GetAllEntitiesChecksum();
|
||||
EntitiesChecksum checksum = getGameState().entities.getAllEntitiesChecksum();
|
||||
AddChecksum(currentTicks, std::move(checksum));
|
||||
}
|
||||
|
||||
@@ -799,7 +799,7 @@ namespace OpenRCT2
|
||||
{
|
||||
_currentReplay->checksumIndex++;
|
||||
|
||||
EntitiesChecksum checksum = getGameState().entities.GetAllEntitiesChecksum();
|
||||
EntitiesChecksum checksum = getGameState().entities.getAllEntitiesChecksum();
|
||||
if (savedChecksum.second.raw != checksum.raw)
|
||||
{
|
||||
uint32_t replayTick = currentTicks - _currentReplay->tickStart;
|
||||
@@ -807,7 +807,7 @@ namespace OpenRCT2
|
||||
// Detected different game state.
|
||||
LOG_WARNING(
|
||||
"Different sprite checksum at tick %u (Replay Tick: %u) ; Saved: %s, Current: %s", currentTicks,
|
||||
replayTick, savedChecksum.second.ToString().c_str(), checksum.ToString().c_str());
|
||||
replayTick, savedChecksum.second.toString().c_str(), checksum.toString().c_str());
|
||||
|
||||
_faultyChecksumIndex = checksumIndex;
|
||||
}
|
||||
@@ -815,8 +815,8 @@ namespace OpenRCT2
|
||||
{
|
||||
// Good state.
|
||||
LOG_VERBOSE(
|
||||
"Good state at tick %u ; Saved: %s, Current: %s", currentTicks, savedChecksum.second.ToString().c_str(),
|
||||
checksum.ToString().c_str());
|
||||
"Good state at tick %u ; Saved: %s, Current: %s", currentTicks, savedChecksum.second.toString().c_str(),
|
||||
checksum.toString().c_str());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -499,7 +499,7 @@ namespace OpenRCT2::GameActions
|
||||
{
|
||||
for (auto litter : EntityList<Litter>())
|
||||
{
|
||||
gameState.entities.EntityRemove(litter);
|
||||
gameState.entities.entityRemove(litter);
|
||||
}
|
||||
|
||||
TileElementIterator it{};
|
||||
@@ -723,8 +723,8 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
for (auto trainIndex : ride.vehicles)
|
||||
{
|
||||
for (Vehicle* vehicle = gameState.entities.TryGetEntity<Vehicle>(trainIndex); vehicle != nullptr;
|
||||
vehicle = gameState.entities.TryGetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
for (Vehicle* vehicle = gameState.entities.tryGetEntity<Vehicle>(trainIndex); vehicle != nullptr;
|
||||
vehicle = gameState.entities.tryGetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
auto i = 0;
|
||||
for (auto& peepInTrainIndex : vehicle->peep)
|
||||
@@ -732,7 +732,7 @@ namespace OpenRCT2::GameActions
|
||||
if (i >= vehicle->num_peeps)
|
||||
break;
|
||||
|
||||
auto peep = gameState.entities.TryGetEntity<Guest>(peepInTrainIndex);
|
||||
auto peep = gameState.entities.tryGetEntity<Guest>(peepInTrainIndex);
|
||||
if (peep != nullptr && peep->currentRide == ride.id)
|
||||
{
|
||||
if ((peep->state == PeepState::onRide && peep->rideSubState == PeepRideSubState::onRide)
|
||||
|
||||
@@ -40,7 +40,7 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
Result BalloonPressAction::Query(GameState_t& gameState, Park::ParkData& park) const
|
||||
{
|
||||
auto balloon = gameState.entities.TryGetEntity<Balloon>(_spriteIndex);
|
||||
auto balloon = gameState.entities.tryGetEntity<Balloon>(_spriteIndex);
|
||||
if (balloon == nullptr)
|
||||
{
|
||||
LOG_ERROR("Balloon not found for spriteIndex %u", _spriteIndex);
|
||||
@@ -51,7 +51,7 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
Result BalloonPressAction::Execute(GameState_t& gameState, Park::ParkData& park) const
|
||||
{
|
||||
auto balloon = gameState.entities.TryGetEntity<Balloon>(_spriteIndex);
|
||||
auto balloon = gameState.entities.tryGetEntity<Balloon>(_spriteIndex);
|
||||
if (balloon == nullptr)
|
||||
{
|
||||
LOG_ERROR("Balloon not found for spriteIndex %u", _spriteIndex);
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
Result GuestSetFlagsAction::Query(GameState_t& gameState, Park::ParkData& park) const
|
||||
{
|
||||
auto* peep = gameState.entities.TryGetEntity<Guest>(_peepId);
|
||||
auto* peep = gameState.entities.tryGetEntity<Guest>(_peepId);
|
||||
if (peep == nullptr)
|
||||
{
|
||||
LOG_ERROR("Guest entity not found for peepID %u", _peepId.ToUnderlying());
|
||||
@@ -52,7 +52,7 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
Result GuestSetFlagsAction::Execute(GameState_t& gameState, Park::ParkData& park) const
|
||||
{
|
||||
auto* peep = gameState.entities.TryGetEntity<Guest>(_peepId);
|
||||
auto* peep = gameState.entities.tryGetEntity<Guest>(_peepId);
|
||||
if (peep == nullptr)
|
||||
{
|
||||
LOG_ERROR("Guest entity not found for peepID %u", _peepId.ToUnderlying());
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace OpenRCT2::GameActions
|
||||
return Result(Status::invalidParameters, STR_CANT_NAME_GUEST, STR_ERR_VALUE_OUT_OF_RANGE);
|
||||
}
|
||||
|
||||
auto guest = gameState.entities.TryGetEntity<Guest>(_spriteIndex);
|
||||
auto guest = gameState.entities.tryGetEntity<Guest>(_spriteIndex);
|
||||
if (guest == nullptr)
|
||||
{
|
||||
LOG_ERROR("Guest entity not found for spriteIndex %u", _spriteIndex);
|
||||
@@ -72,7 +72,7 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
Result GuestSetNameAction::Execute(GameState_t& gameState, Park::ParkData& park) const
|
||||
{
|
||||
auto guest = gameState.entities.TryGetEntity<Guest>(_spriteIndex);
|
||||
auto guest = gameState.entities.tryGetEntity<Guest>(_spriteIndex);
|
||||
if (guest == nullptr)
|
||||
{
|
||||
LOG_ERROR("Guest entity not found for spriteIndex %u", _spriteIndex);
|
||||
|
||||
@@ -61,7 +61,7 @@ namespace OpenRCT2::GameActions
|
||||
return Result(Status::invalidParameters, STR_ERR_CANT_PLACE_PERSON_HERE, kStringIdNone);
|
||||
}
|
||||
|
||||
auto* const peep = gameState.entities.TryGetEntity<Peep>(_entityId);
|
||||
auto* const peep = gameState.entities.tryGetEntity<Peep>(_entityId);
|
||||
if (peep == nullptr)
|
||||
{
|
||||
LOG_ERROR("Failed to pick up peep for sprite %d", _entityId);
|
||||
@@ -119,7 +119,7 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
Result PeepPickupAction::Execute(GameState_t& gameState, Park::ParkData& park) const
|
||||
{
|
||||
Peep* const peep = gameState.entities.TryGetEntity<Peep>(_entityId);
|
||||
Peep* const peep = gameState.entities.tryGetEntity<Peep>(_entityId);
|
||||
if (peep == nullptr)
|
||||
{
|
||||
LOG_ERROR("Failed to pick up peep for sprite %d", _entityId);
|
||||
|
||||
@@ -47,7 +47,7 @@ namespace OpenRCT2::GameActions
|
||||
return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
|
||||
}
|
||||
|
||||
auto staff = gameState.entities.TryGetEntity<Staff>(_spriteId);
|
||||
auto staff = gameState.entities.tryGetEntity<Staff>(_spriteId);
|
||||
if (staff == nullptr)
|
||||
{
|
||||
LOG_ERROR("Staff entity not found for spriteId %u", _spriteId);
|
||||
@@ -68,7 +68,7 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
Result StaffFireAction::Execute(GameState_t& gameState, Park::ParkData& park) const
|
||||
{
|
||||
auto staff = gameState.entities.TryGetEntity<Staff>(_spriteId);
|
||||
auto staff = gameState.entities.tryGetEntity<Staff>(_spriteId);
|
||||
if (staff == nullptr)
|
||||
{
|
||||
LOG_ERROR("Staff entity not found for spriteId %u", _spriteId);
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace OpenRCT2::GameActions
|
||||
return Result(Status::invalidParameters, STR_CANT_HIRE_NEW_STAFF, STR_ERR_VALUE_OUT_OF_RANGE);
|
||||
}
|
||||
|
||||
if (gameState.entities.GetNumFreeEntities() < 400)
|
||||
if (gameState.entities.getNumFreeEntities() < 400)
|
||||
{
|
||||
return Result(Status::noFreeElements, STR_CANT_HIRE_NEW_STAFF, STR_TOO_MANY_PEOPLE_IN_GAME);
|
||||
}
|
||||
@@ -92,7 +92,7 @@ namespace OpenRCT2::GameActions
|
||||
}
|
||||
}
|
||||
|
||||
Staff* newPeep = gameState.entities.CreateEntity<Staff>();
|
||||
Staff* newPeep = gameState.entities.createEntity<Staff>();
|
||||
if (newPeep == nullptr)
|
||||
{
|
||||
// Too many peeps exist already.
|
||||
@@ -102,7 +102,7 @@ namespace OpenRCT2::GameActions
|
||||
if (execute == false)
|
||||
{
|
||||
// In query we just want to see if we can obtain a sprite slot.
|
||||
gameState.entities.EntityRemove(newPeep);
|
||||
gameState.entities.entityRemove(newPeep);
|
||||
|
||||
res.setData(StaffHireNewActionResult{ EntityId::GetNull() });
|
||||
}
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenRCT2::GameActions
|
||||
return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
|
||||
}
|
||||
|
||||
auto* staff = gameState.entities.TryGetEntity<Staff>(_spriteIndex);
|
||||
auto* staff = gameState.entities.tryGetEntity<Staff>(_spriteIndex);
|
||||
if (staff == nullptr)
|
||||
{
|
||||
LOG_ERROR("Staff entity not found for spriteIndex %u", _spriteIndex);
|
||||
@@ -75,7 +75,7 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
Result StaffSetCostumeAction::Execute(GameState_t& gameState, Park::ParkData& park) const
|
||||
{
|
||||
auto* staff = gameState.entities.TryGetEntity<Staff>(_spriteIndex);
|
||||
auto* staff = gameState.entities.tryGetEntity<Staff>(_spriteIndex);
|
||||
if (staff == nullptr)
|
||||
{
|
||||
LOG_ERROR("Staff entity not found for spriteIndex %u", _spriteIndex);
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenRCT2::GameActions
|
||||
return Result(Status::invalidParameters, STR_STAFF_ERROR_CANT_NAME_STAFF_MEMBER, STR_ERR_VALUE_OUT_OF_RANGE);
|
||||
}
|
||||
|
||||
auto staff = gameState.entities.TryGetEntity<Staff>(_spriteIndex);
|
||||
auto staff = gameState.entities.tryGetEntity<Staff>(_spriteIndex);
|
||||
if (staff == nullptr)
|
||||
{
|
||||
LOG_ERROR("Staff entity not found for spriteIndex %u", _spriteIndex);
|
||||
@@ -64,7 +64,7 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
Result StaffSetNameAction::Execute(GameState_t& gameState, Park::ParkData& park) const
|
||||
{
|
||||
auto staff = gameState.entities.TryGetEntity<Staff>(_spriteIndex);
|
||||
auto staff = gameState.entities.tryGetEntity<Staff>(_spriteIndex);
|
||||
if (staff == nullptr)
|
||||
{
|
||||
LOG_ERROR("Staff entity not found for spriteIndex %u", _spriteIndex);
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenRCT2::GameActions
|
||||
return Result(Status::invalidParameters, STR_ERR_INVALID_PARAMETER, STR_ERR_VALUE_OUT_OF_RANGE);
|
||||
}
|
||||
|
||||
auto* staff = gameState.entities.TryGetEntity<Staff>(_spriteIndex);
|
||||
auto* staff = gameState.entities.tryGetEntity<Staff>(_spriteIndex);
|
||||
if (staff == nullptr
|
||||
|| (staff->assignedStaffType != StaffType::handyman && staff->assignedStaffType != StaffType::mechanic))
|
||||
{
|
||||
@@ -65,7 +65,7 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
Result StaffSetOrdersAction::Execute(GameState_t& gameState, Park::ParkData& park) const
|
||||
{
|
||||
auto* staff = gameState.entities.TryGetEntity<Staff>(_spriteIndex);
|
||||
auto* staff = gameState.entities.tryGetEntity<Staff>(_spriteIndex);
|
||||
if (staff == nullptr)
|
||||
{
|
||||
LOG_ERROR("Staff entity not found for spriteIndex %u", _spriteIndex);
|
||||
|
||||
@@ -62,7 +62,7 @@ namespace OpenRCT2::GameActions
|
||||
|
||||
Result StaffSetPatrolAreaAction::QueryExecute(GameState_t& gameState, bool executing) const
|
||||
{
|
||||
auto staff = gameState.entities.TryGetEntity<Staff>(_spriteId);
|
||||
auto staff = gameState.entities.tryGetEntity<Staff>(_spriteId);
|
||||
if (staff == nullptr)
|
||||
{
|
||||
LOG_ERROR("Staff entity not found for spriteID %u", _spriteId.ToUnderlying());
|
||||
|
||||
@@ -71,7 +71,7 @@ namespace OpenRCT2
|
||||
{
|
||||
gameStateUpdateLogic();
|
||||
}
|
||||
Console::WriteLine("Completed: %s", getGameState().entities.GetAllEntitiesChecksum().ToString().c_str());
|
||||
Console::WriteLine("Completed: %s", getGameState().entities.getAllEntitiesChecksum().toString().c_str());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@@ -724,7 +724,7 @@ namespace OpenRCT2::Drawing::LightFx
|
||||
void AddLightsMagicVehicle_BoatHire(const Vehicle* vehicle)
|
||||
{
|
||||
Vehicle* vehicle_draw = vehicle->TrainHead();
|
||||
auto* nextVeh = getGameState().entities.GetEntity<Vehicle>(vehicle_draw->next_vehicle_on_train);
|
||||
auto* nextVeh = getGameState().entities.getEntity<Vehicle>(vehicle_draw->next_vehicle_on_train);
|
||||
if (nextVeh != nullptr)
|
||||
{
|
||||
vehicle_draw = nextVeh;
|
||||
|
||||
@@ -34,7 +34,7 @@ namespace OpenRCT2
|
||||
frame++;
|
||||
if (frame >= 5)
|
||||
{
|
||||
getGameState().entities.EntityRemove(this);
|
||||
getGameState().entities.entityRemove(this);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -98,7 +98,7 @@ namespace OpenRCT2
|
||||
|
||||
void Balloon::create(const CoordsXYZ& balloonPos, Drawing::Colour colour, bool isPopped)
|
||||
{
|
||||
auto* balloon = getGameState().entities.CreateEntity<Balloon>();
|
||||
auto* balloon = getGameState().entities.createEntity<Balloon>();
|
||||
if (balloon == nullptr)
|
||||
return;
|
||||
|
||||
|
||||
@@ -84,7 +84,7 @@ static constexpr uint8_t kDuckAnimationFlyAway[] =
|
||||
void Duck::remove()
|
||||
{
|
||||
invalidate();
|
||||
getGameState().entities.EntityRemove(this);
|
||||
getGameState().entities.entityRemove(this);
|
||||
}
|
||||
|
||||
void Duck::updateFlyToWater()
|
||||
@@ -289,7 +289,7 @@ static constexpr uint8_t kDuckAnimationFlyAway[] =
|
||||
|
||||
void Duck::create(const CoordsXY& pos)
|
||||
{
|
||||
auto* duck = getGameState().entities.CreateEntity<Duck>();
|
||||
auto* duck = getGameState().entities.createEntity<Duck>();
|
||||
if (duck == nullptr)
|
||||
return;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ namespace OpenRCT2
|
||||
|
||||
while (iter != end && Entity == nullptr)
|
||||
{
|
||||
Entity = gameState.entities.TryGetEntity<T>(*iter++);
|
||||
Entity = gameState.entities.tryGetEntity<T>(*iter++);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -82,7 +82,7 @@ namespace OpenRCT2
|
||||
|
||||
public:
|
||||
EntityTileList(const CoordsXY& loc)
|
||||
: vec(getGameState().entities.GetEntityTileList(loc))
|
||||
: vec(getGameState().entities.getEntityTileList(loc))
|
||||
{
|
||||
}
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace OpenRCT2
|
||||
|
||||
while (iter != end && Entity == nullptr)
|
||||
{
|
||||
Entity = gameState.entities.TryGetEntity<T>(*iter++);
|
||||
Entity = gameState.entities.tryGetEntity<T>(*iter++);
|
||||
}
|
||||
return *this;
|
||||
}
|
||||
@@ -160,7 +160,7 @@ namespace OpenRCT2
|
||||
|
||||
public:
|
||||
EntityList()
|
||||
: vec(getGameState().entities.GetEntityList(T::kEntityType))
|
||||
: vec(getGameState().entities.getEntityList(T::kEntityType))
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
@@ -78,44 +78,44 @@ namespace OpenRCT2
|
||||
}
|
||||
|
||||
// TODO: make part of EntityList unit?
|
||||
uint16_t EntityRegistry::GetEntityListCount(EntityType type)
|
||||
uint16_t EntityRegistry::getEntityListCount(EntityType type)
|
||||
{
|
||||
return static_cast<uint16_t>(gEntityLists[EnumValue(type)].size());
|
||||
}
|
||||
|
||||
// TODO: make part of EntityList unit?
|
||||
uint16_t EntityRegistry::GetNumFreeEntities()
|
||||
uint16_t EntityRegistry::getNumFreeEntities()
|
||||
{
|
||||
return static_cast<uint16_t>(_freeIdList.size());
|
||||
}
|
||||
|
||||
std::string EntitiesChecksum::ToString() const
|
||||
std::string EntitiesChecksum::toString() const
|
||||
{
|
||||
return String::StringFromHex(raw);
|
||||
}
|
||||
|
||||
EntityBase* EntityRegistry::TryGetEntity(EntityId entityIndex)
|
||||
EntityBase* EntityRegistry::tryGetEntity(EntityId entityIndex)
|
||||
{
|
||||
const auto idx = entityIndex.ToUnderlying();
|
||||
return idx >= kMaxEntities ? nullptr : &entities[idx].base;
|
||||
}
|
||||
|
||||
EntityBase* EntityRegistry::GetEntity(EntityId entityIndex)
|
||||
EntityBase* EntityRegistry::getEntity(EntityId entityIndex)
|
||||
{
|
||||
if (entityIndex.IsNull())
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
Guard::Assert(entityIndex.ToUnderlying() < kMaxEntities, "Tried getting entity %u", entityIndex.ToUnderlying());
|
||||
return TryGetEntity(entityIndex);
|
||||
return tryGetEntity(entityIndex);
|
||||
}
|
||||
|
||||
const std::vector<EntityId>& EntityRegistry::GetEntityTileList(const CoordsXY& spritePos)
|
||||
const std::vector<EntityId>& EntityRegistry::getEntityTileList(const CoordsXY& spritePos)
|
||||
{
|
||||
return gEntitySpatialIndex[ComputeSpatialIndex(spritePos)];
|
||||
}
|
||||
|
||||
void EntityRegistry::ResetEntityLists()
|
||||
void EntityRegistry::resetEntityLists()
|
||||
{
|
||||
for (auto& list : gEntityLists)
|
||||
{
|
||||
@@ -123,7 +123,7 @@ namespace OpenRCT2
|
||||
}
|
||||
}
|
||||
|
||||
void EntityRegistry::ResetFreeIds()
|
||||
void EntityRegistry::resetFreeIds()
|
||||
{
|
||||
_freeIdList.clear();
|
||||
_freeIdList.resize(kMaxEntities);
|
||||
@@ -136,7 +136,7 @@ namespace OpenRCT2
|
||||
});
|
||||
}
|
||||
|
||||
const std::list<EntityId>& EntityRegistry::GetEntityList(const EntityType id)
|
||||
const std::list<EntityId>& EntityRegistry::getEntityList(const EntityType id)
|
||||
{
|
||||
return gEntityLists[EnumValue(id)];
|
||||
}
|
||||
@@ -145,17 +145,17 @@ namespace OpenRCT2
|
||||
*
|
||||
* rct2: 0x0069EB13
|
||||
*/
|
||||
void EntityRegistry::ResetAllEntities()
|
||||
void EntityRegistry::resetAllEntities()
|
||||
{
|
||||
// Free all associated Entity pointers prior to zeroing memory
|
||||
for (int32_t i = 0; i < kMaxEntities; ++i)
|
||||
{
|
||||
auto* spr = GetEntity(EntityId::FromUnderlying(i));
|
||||
auto* spr = getEntity(EntityId::FromUnderlying(i));
|
||||
if (spr == nullptr)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
FreeEntity(*spr);
|
||||
freeEntity(*spr);
|
||||
}
|
||||
|
||||
std::fill(std::begin(entities), std::end(entities), Entity_t());
|
||||
@@ -163,7 +163,7 @@ namespace OpenRCT2
|
||||
RideUse::GetTypeHistory().Clear();
|
||||
for (int32_t i = 0; i < kMaxEntities; ++i)
|
||||
{
|
||||
auto* spr = GetEntity(EntityId::FromUnderlying(i));
|
||||
auto* spr = getEntity(EntityId::FromUnderlying(i));
|
||||
if (spr == nullptr)
|
||||
{
|
||||
continue;
|
||||
@@ -173,9 +173,9 @@ namespace OpenRCT2
|
||||
|
||||
_entityFlashingList[i] = false;
|
||||
}
|
||||
ResetEntityLists();
|
||||
ResetFreeIds();
|
||||
ResetEntitySpatialIndices();
|
||||
resetEntityLists();
|
||||
resetFreeIds();
|
||||
resetEntitySpatialIndices();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -184,7 +184,7 @@ namespace OpenRCT2
|
||||
* This function looks as though it sets some sort of order for sprites.
|
||||
* Sprites can share their position if this is the case.
|
||||
*/
|
||||
void EntityRegistry::ResetEntitySpatialIndices()
|
||||
void EntityRegistry::resetEntitySpatialIndices()
|
||||
{
|
||||
for (auto& vec : gEntitySpatialIndex)
|
||||
{
|
||||
@@ -192,33 +192,33 @@ namespace OpenRCT2
|
||||
}
|
||||
for (EntityId::UnderlyingType i = 0; i < kMaxEntities; i++)
|
||||
{
|
||||
auto* entity = GetEntity(EntityId::FromUnderlying(i));
|
||||
auto* entity = getEntity(EntityId::FromUnderlying(i));
|
||||
if (entity != nullptr && entity->type != EntityType::null)
|
||||
{
|
||||
EntitySpatialInsert(*entity, { entity->x, entity->y });
|
||||
entitySpatialInsert(*entity, { entity->x, entity->y });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#ifndef DISABLE_NETWORK
|
||||
EntitiesChecksum EntityRegistry::GetAllEntitiesChecksum()
|
||||
EntitiesChecksum EntityRegistry::getAllEntitiesChecksum()
|
||||
{
|
||||
EntitiesChecksum checksum{};
|
||||
|
||||
ChecksumStream ms(checksum.raw);
|
||||
DataSerialiser ds(true, ms);
|
||||
NetworkSerialiseEntityTypes<Guest, Staff, Vehicle, Litter>(ds);
|
||||
networkSerialiseEntityTypes<Guest, Staff, Vehicle, Litter>(ds);
|
||||
|
||||
return checksum;
|
||||
}
|
||||
#else
|
||||
EntitiesChecksum EntityRegistry::GetAllEntitiesChecksum()
|
||||
EntitiesChecksum EntityRegistry::getAllEntitiesChecksum()
|
||||
{
|
||||
return EntitiesChecksum{};
|
||||
}
|
||||
#endif // DISABLE_NETWORK
|
||||
|
||||
void EntityRegistry::EntityReset(EntityBase& entity)
|
||||
void EntityRegistry::entityReset(EntityBase& entity)
|
||||
{
|
||||
// Need to retain how the sprite is linked in lists
|
||||
auto entityIndex = entity.id;
|
||||
@@ -231,7 +231,7 @@ namespace OpenRCT2
|
||||
entity.type = EntityType::null;
|
||||
}
|
||||
|
||||
void EntityRegistry::AddToEntityList(EntityBase& entity)
|
||||
void EntityRegistry::addToEntityList(EntityBase& entity)
|
||||
{
|
||||
auto& list = gEntityLists[EnumValue(entity.type)];
|
||||
|
||||
@@ -239,13 +239,13 @@ namespace OpenRCT2
|
||||
Algorithm::sortedInsert(list, entity.id);
|
||||
}
|
||||
|
||||
void EntityRegistry::AddToFreeList(EntityId index)
|
||||
void EntityRegistry::addToFreeList(EntityId index)
|
||||
{
|
||||
// Free list must be in reverse sprite_index order to prevent desync issues
|
||||
_freeIdList.insert(std::upper_bound(std::rbegin(_freeIdList), std::rend(_freeIdList), index).base(), index);
|
||||
}
|
||||
|
||||
void EntityRegistry::RemoveFromEntityList(EntityBase& entity)
|
||||
void EntityRegistry::removeFromEntityList(EntityBase& entity)
|
||||
{
|
||||
auto& list = gEntityLists[EnumValue(entity.type)];
|
||||
auto ptr = Algorithm::binaryFind(std::begin(list), std::end(list), entity.id);
|
||||
@@ -255,26 +255,26 @@ namespace OpenRCT2
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t EntityRegistry::GetMiscEntityCount()
|
||||
uint16_t EntityRegistry::getMiscEntityCount()
|
||||
{
|
||||
uint16_t count = 0;
|
||||
for (auto id : { EntityType::steamParticle, EntityType::moneyEffect, EntityType::crashedVehicleParticle,
|
||||
EntityType::explosionCloud, EntityType::crashSplash, EntityType::explosionFlare,
|
||||
EntityType::jumpingFountain, EntityType::balloon, EntityType::duck })
|
||||
{
|
||||
count += GetEntityListCount(id);
|
||||
count += getEntityListCount(id);
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
void EntityRegistry::PrepareNewEntity(EntityBase& base, const EntityType type)
|
||||
void EntityRegistry::prepareNewEntity(EntityBase& base, const EntityType type)
|
||||
{
|
||||
// Need to reset all sprite data, as the uninitialised values
|
||||
// may contain garbage and cause a desync later on.
|
||||
EntityReset(base);
|
||||
entityReset(base);
|
||||
|
||||
base.type = type;
|
||||
AddToEntityList(base);
|
||||
addToEntityList(base);
|
||||
|
||||
base.x = kLocationNull;
|
||||
base.y = kLocationNull;
|
||||
@@ -285,10 +285,10 @@ namespace OpenRCT2
|
||||
base.spriteData.spriteRect = {};
|
||||
base.spatialIndex = kInvalidSpatialIndex;
|
||||
|
||||
EntitySpatialInsert(base, { kLocationNull, 0 });
|
||||
entitySpatialInsert(base, { kLocationNull, 0 });
|
||||
}
|
||||
|
||||
EntityBase* EntityRegistry::CreateEntity(EntityType type)
|
||||
EntityBase* EntityRegistry::createEntity(EntityType type)
|
||||
{
|
||||
if (_freeIdList.empty())
|
||||
{
|
||||
@@ -299,7 +299,7 @@ namespace OpenRCT2
|
||||
if (EntityTypeIsMiscEntity(type))
|
||||
{
|
||||
// Misc sprites are commonly used for effects, give other entity types higher priority.
|
||||
if (GetMiscEntityCount() >= kMaxMiscEntities)
|
||||
if (getMiscEntityCount() >= kMaxMiscEntities)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
@@ -311,19 +311,19 @@ namespace OpenRCT2
|
||||
}
|
||||
}
|
||||
|
||||
auto* entity = GetEntity(_freeIdList.back());
|
||||
auto* entity = getEntity(_freeIdList.back());
|
||||
if (entity == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
_freeIdList.pop_back();
|
||||
|
||||
PrepareNewEntity(*entity, type);
|
||||
prepareNewEntity(*entity, type);
|
||||
|
||||
return entity;
|
||||
}
|
||||
|
||||
EntityBase* EntityRegistry::CreateEntityAt(const EntityId index, const EntityType type)
|
||||
EntityBase* EntityRegistry::createEntityAt(const EntityId index, const EntityType type)
|
||||
{
|
||||
auto id = Algorithm::binaryFind(std::rbegin(_freeIdList), std::rend(_freeIdList), index);
|
||||
if (id == std::rend(_freeIdList))
|
||||
@@ -331,7 +331,7 @@ namespace OpenRCT2
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
auto* entity = GetEntity(index);
|
||||
auto* entity = getEntity(index);
|
||||
if (entity == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
@@ -339,7 +339,7 @@ namespace OpenRCT2
|
||||
|
||||
_freeIdList.erase(std::next(id).base());
|
||||
|
||||
PrepareNewEntity(*entity, type);
|
||||
prepareNewEntity(*entity, type);
|
||||
return entity;
|
||||
}
|
||||
|
||||
@@ -347,22 +347,22 @@ namespace OpenRCT2
|
||||
*
|
||||
* rct2: 0x00672AA4
|
||||
*/
|
||||
void EntityRegistry::UpdateAllMiscEntities()
|
||||
void EntityRegistry::updateAllMiscEntities()
|
||||
{
|
||||
PROFILED_FUNCTION();
|
||||
|
||||
MiscUpdateAllTypes<
|
||||
miscUpdateAllTypes<
|
||||
SteamParticle, MoneyEffect, VehicleCrashParticle, ExplosionCloud, CrashSplashParticle, ExplosionFlare,
|
||||
JumpingFountain, Balloon, Duck>();
|
||||
}
|
||||
|
||||
void EntityRegistry::UpdateMoneyEffect()
|
||||
void EntityRegistry::updateMoneyEffect()
|
||||
{
|
||||
MiscUpdateAllTypes<MoneyEffect>();
|
||||
miscUpdateAllTypes<MoneyEffect>();
|
||||
}
|
||||
|
||||
// Performs a search to ensure that insert keeps next_in_quadrant in sprite_index order
|
||||
void EntityRegistry::EntitySpatialInsert(EntityBase& entity, const CoordsXY& newLoc)
|
||||
void EntityRegistry::entitySpatialInsert(EntityBase& entity, const CoordsXY& newLoc)
|
||||
{
|
||||
const auto newIndex = ComputeSpatialIndex(newLoc);
|
||||
|
||||
@@ -373,7 +373,7 @@ namespace OpenRCT2
|
||||
entity.spatialIndex = newIndex;
|
||||
}
|
||||
|
||||
void EntityRegistry::EntitySpatialRemove(EntityBase& entity)
|
||||
void EntityRegistry::entitySpatialRemove(EntityBase& entity)
|
||||
{
|
||||
const auto currentIndex = GetSpatialIndex(entity);
|
||||
|
||||
@@ -386,34 +386,34 @@ namespace OpenRCT2
|
||||
else
|
||||
{
|
||||
LOG_WARNING("Bad sprite spatial index. Rebuilding the spatial index...");
|
||||
ResetEntitySpatialIndices();
|
||||
resetEntitySpatialIndices();
|
||||
}
|
||||
|
||||
entity.spatialIndex = kInvalidSpatialIndex;
|
||||
}
|
||||
|
||||
void EntityRegistry::UpdateEntitySpatialIndex(EntityBase& entity)
|
||||
void EntityRegistry::updateEntitySpatialIndex(EntityBase& entity)
|
||||
{
|
||||
if (entity.spatialIndex & kSpatialIndexDirtyMask)
|
||||
{
|
||||
if (entity.spatialIndex != kInvalidSpatialIndex)
|
||||
{
|
||||
EntitySpatialRemove(entity);
|
||||
entitySpatialRemove(entity);
|
||||
}
|
||||
EntitySpatialInsert(entity, { entity.x, entity.y });
|
||||
entitySpatialInsert(entity, { entity.x, entity.y });
|
||||
}
|
||||
}
|
||||
|
||||
void EntityRegistry::UpdateEntitiesSpatialIndex()
|
||||
void EntityRegistry::updateEntitiesSpatialIndex()
|
||||
{
|
||||
for (auto& entityList : gEntityLists)
|
||||
{
|
||||
for (auto& entityId : entityList)
|
||||
{
|
||||
auto* entity = TryGetEntity(entityId);
|
||||
auto* entity = tryGetEntity(entityId);
|
||||
if (entity != nullptr && entity->type != EntityType::null)
|
||||
{
|
||||
UpdateEntitySpatialIndex(*entity);
|
||||
updateEntitySpatialIndex(*entity);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -422,7 +422,7 @@ namespace OpenRCT2
|
||||
/**
|
||||
* Frees any dynamically attached memory to the entity, such as peep name.
|
||||
*/
|
||||
void EntityRegistry::FreeEntity(EntityBase& entity)
|
||||
void EntityRegistry::freeEntity(EntityBase& entity)
|
||||
{
|
||||
auto* guest = entity.as<Guest>();
|
||||
auto* staff = entity.as<Staff>();
|
||||
@@ -445,53 +445,53 @@ namespace OpenRCT2
|
||||
*
|
||||
* rct2: 0x0069EDB6
|
||||
*/
|
||||
void EntityRegistry::EntityRemove(EntityBase* entity)
|
||||
void EntityRegistry::entityRemove(EntityBase* entity)
|
||||
{
|
||||
FreeEntity(*entity);
|
||||
freeEntity(*entity);
|
||||
|
||||
EntityTweener::Get().RemoveEntity(entity);
|
||||
RemoveFromEntityList(*entity); // remove from existing list
|
||||
AddToFreeList(entity->id);
|
||||
removeFromEntityList(*entity); // remove from existing list
|
||||
addToFreeList(entity->id);
|
||||
|
||||
EntitySpatialRemove(*entity);
|
||||
EntityReset(*entity);
|
||||
entitySpatialRemove(*entity);
|
||||
entityReset(*entity);
|
||||
}
|
||||
|
||||
/**
|
||||
* Loops through all floating entities and removes them.
|
||||
* Returns the amount of removed objects as feedback.
|
||||
*/
|
||||
uint16_t EntityRegistry::RemoveFloatingEntities()
|
||||
uint16_t EntityRegistry::removeFloatingEntities()
|
||||
{
|
||||
uint16_t removed = 0;
|
||||
for (auto* balloon : EntityList<Balloon>())
|
||||
{
|
||||
EntityRemove(balloon);
|
||||
entityRemove(balloon);
|
||||
removed++;
|
||||
}
|
||||
for (auto* duck : EntityList<Duck>())
|
||||
{
|
||||
if (duck->isFlying())
|
||||
{
|
||||
EntityRemove(duck);
|
||||
entityRemove(duck);
|
||||
removed++;
|
||||
}
|
||||
}
|
||||
for (auto* money : EntityList<MoneyEffect>())
|
||||
{
|
||||
EntityRemove(money);
|
||||
entityRemove(money);
|
||||
removed++;
|
||||
}
|
||||
return removed;
|
||||
}
|
||||
|
||||
void EntityRegistry::EntitySetFlashing(EntityBase* entity, bool flashing)
|
||||
void EntityRegistry::entitySetFlashing(EntityBase* entity, bool flashing)
|
||||
{
|
||||
assert(entity->id.ToUnderlying() < kMaxEntities);
|
||||
_entityFlashingList[entity->id.ToUnderlying()] = flashing;
|
||||
}
|
||||
|
||||
bool EntityRegistry::EntityGetFlashing(EntityBase* entity)
|
||||
bool EntityRegistry::entityGetFlashing(EntityBase* entity)
|
||||
{
|
||||
assert(entity->id.ToUnderlying() < kMaxEntities);
|
||||
return _entityFlashingList[entity->id.ToUnderlying()];
|
||||
@@ -575,5 +575,5 @@ void EntityBase::moveToAndUpdateSpatialIndex(const CoordsXYZ& newLocation)
|
||||
// TODO: pass as param instead of relying on global game state
|
||||
auto& gameState = getGameState();
|
||||
|
||||
gameState.entities.UpdateEntitySpatialIndex(*this);
|
||||
gameState.entities.updateEntitySpatialIndex(*this);
|
||||
}
|
||||
@@ -33,10 +33,10 @@ namespace OpenRCT2
|
||||
|
||||
union Entity_t
|
||||
{
|
||||
uint8_t Pad00[0x200];
|
||||
uint8_t pad00[0x200];
|
||||
EntityBase base;
|
||||
Entity_t()
|
||||
: Pad00()
|
||||
: pad00()
|
||||
{
|
||||
}
|
||||
};
|
||||
@@ -46,7 +46,7 @@ namespace OpenRCT2
|
||||
{
|
||||
std::array<std::byte, 20> raw;
|
||||
|
||||
std::string ToString() const;
|
||||
std::string toString() const;
|
||||
};
|
||||
#pragma pack(pop)
|
||||
|
||||
@@ -65,15 +65,15 @@ namespace OpenRCT2
|
||||
std::array<std::vector<EntityId>, kSpatialIndexSize> gEntitySpatialIndex;
|
||||
|
||||
public:
|
||||
uint16_t GetEntityListCount(EntityType type);
|
||||
uint16_t GetNumFreeEntities();
|
||||
uint16_t getEntityListCount(EntityType type);
|
||||
uint16_t getNumFreeEntities();
|
||||
|
||||
EntityBase* GetEntity(EntityId entityId);
|
||||
EntityBase* getEntity(EntityId entityId);
|
||||
|
||||
template<typename T>
|
||||
T* GetEntity(EntityId entityId)
|
||||
T* getEntity(EntityId entityId)
|
||||
{
|
||||
auto* ent = GetEntity(entityId);
|
||||
auto* ent = getEntity(entityId);
|
||||
if (ent == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
@@ -88,12 +88,12 @@ namespace OpenRCT2
|
||||
}
|
||||
}
|
||||
|
||||
EntityBase* TryGetEntity(EntityId spriteIndex);
|
||||
EntityBase* tryGetEntity(EntityId spriteIndex);
|
||||
|
||||
template<typename T>
|
||||
T* TryGetEntity(EntityId entityId)
|
||||
T* tryGetEntity(EntityId entityId)
|
||||
{
|
||||
auto* ent = TryGetEntity(entityId);
|
||||
auto* ent = tryGetEntity(entityId);
|
||||
if (ent == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
@@ -108,35 +108,35 @@ namespace OpenRCT2
|
||||
}
|
||||
}
|
||||
|
||||
const std::vector<EntityId>& GetEntityTileList(const CoordsXY& spritePos);
|
||||
const std::vector<EntityId>& getEntityTileList(const CoordsXY& spritePos);
|
||||
|
||||
EntityBase* CreateEntity(EntityType type);
|
||||
EntityBase* createEntity(EntityType type);
|
||||
|
||||
template<typename T>
|
||||
T* CreateEntity()
|
||||
T* createEntity()
|
||||
{
|
||||
return static_cast<T*>(CreateEntity(T::kEntityType));
|
||||
return static_cast<T*>(createEntity(T::kEntityType));
|
||||
}
|
||||
|
||||
// Use only with imports that must happen at a specified index
|
||||
EntityBase* CreateEntityAt(EntityId index, EntityType type);
|
||||
EntityBase* createEntityAt(EntityId index, EntityType type);
|
||||
// Use only with imports that must happen at a specified index
|
||||
template<typename T>
|
||||
T* CreateEntityAt(EntityId index)
|
||||
T* createEntityAt(EntityId index)
|
||||
{
|
||||
return static_cast<T*>(CreateEntityAt(index, T::kEntityType));
|
||||
return static_cast<T*>(createEntityAt(index, T::kEntityType));
|
||||
}
|
||||
|
||||
const std::list<EntityId>& GetEntityList(EntityType id);
|
||||
uint16_t GetMiscEntityCount();
|
||||
const std::list<EntityId>& getEntityList(EntityType id);
|
||||
uint16_t getMiscEntityCount();
|
||||
|
||||
void ResetAllEntities();
|
||||
void ResetEntitySpatialIndices();
|
||||
void resetAllEntities();
|
||||
void resetEntitySpatialIndices();
|
||||
|
||||
#ifndef DISABLE_NETWORK
|
||||
|
||||
template<typename T>
|
||||
void NetworkSerialseEntityType(DataSerialiser& ds)
|
||||
void networkSerialseEntityType(DataSerialiser& ds)
|
||||
{
|
||||
for (auto* ent : EntityList<T>())
|
||||
{
|
||||
@@ -145,17 +145,17 @@ namespace OpenRCT2
|
||||
}
|
||||
|
||||
template<typename... T>
|
||||
void NetworkSerialiseEntityTypes(DataSerialiser& ds)
|
||||
void networkSerialiseEntityTypes(DataSerialiser& ds)
|
||||
{
|
||||
(NetworkSerialseEntityType<T>(ds), ...);
|
||||
(networkSerialseEntityType<T>(ds), ...);
|
||||
}
|
||||
|
||||
#endif // DISABLE_NETWORK
|
||||
|
||||
EntitiesChecksum GetAllEntitiesChecksum();
|
||||
EntitiesChecksum getAllEntitiesChecksum();
|
||||
|
||||
template<typename T>
|
||||
void MiscUpdateAllType()
|
||||
void miscUpdateAllType()
|
||||
{
|
||||
for (auto misc : EntityList<T>())
|
||||
{
|
||||
@@ -164,32 +164,32 @@ namespace OpenRCT2
|
||||
}
|
||||
|
||||
template<typename... T>
|
||||
void MiscUpdateAllTypes()
|
||||
void miscUpdateAllTypes()
|
||||
{
|
||||
(MiscUpdateAllType<T>(), ...);
|
||||
(miscUpdateAllType<T>(), ...);
|
||||
}
|
||||
|
||||
void UpdateAllMiscEntities();
|
||||
void UpdateMoneyEffect();
|
||||
void EntityRemove(EntityBase* entity);
|
||||
uint16_t RemoveFloatingEntities();
|
||||
void UpdateEntitiesSpatialIndex();
|
||||
void UpdateEntitySpatialIndex(EntityBase& entity);
|
||||
void updateAllMiscEntities();
|
||||
void updateMoneyEffect();
|
||||
void entityRemove(EntityBase* entity);
|
||||
uint16_t removeFloatingEntities();
|
||||
void updateEntitiesSpatialIndex();
|
||||
void updateEntitySpatialIndex(EntityBase& entity);
|
||||
|
||||
void EntitySetFlashing(EntityBase* entity, bool flashing);
|
||||
bool EntityGetFlashing(EntityBase* entity);
|
||||
void entitySetFlashing(EntityBase* entity, bool flashing);
|
||||
bool entityGetFlashing(EntityBase* entity);
|
||||
|
||||
private:
|
||||
void ResetEntityLists();
|
||||
void ResetFreeIds();
|
||||
void EntityReset(EntityBase& entity);
|
||||
void AddToEntityList(EntityBase& entity);
|
||||
void AddToFreeList(EntityId index);
|
||||
void RemoveFromEntityList(EntityBase& entity);
|
||||
void PrepareNewEntity(EntityBase& base, EntityType type);
|
||||
void EntitySpatialInsert(EntityBase& entity, const CoordsXY& newLoc);
|
||||
void EntitySpatialRemove(EntityBase& entity);
|
||||
void FreeEntity(EntityBase& entity);
|
||||
void resetEntityLists();
|
||||
void resetFreeIds();
|
||||
void entityReset(EntityBase& entity);
|
||||
void addToEntityList(EntityBase& entity);
|
||||
void addToFreeList(EntityId index);
|
||||
void removeFromEntityList(EntityBase& entity);
|
||||
void prepareNewEntity(EntityBase& base, EntityType type);
|
||||
void entitySpatialInsert(EntityBase& entity, const CoordsXY& newLoc);
|
||||
void entitySpatialRemove(EntityBase& entity);
|
||||
void freeEntity(EntityBase& entity);
|
||||
};
|
||||
|
||||
} // namespace OpenRCT2
|
||||
@@ -1920,7 +1920,7 @@ namespace OpenRCT2
|
||||
else
|
||||
{
|
||||
// Check if there's room in the queue for the peep to enter.
|
||||
Guest* lastPeepInQueue = getGameState().entities.GetEntity<Guest>(station.LastPeepInQueue);
|
||||
Guest* lastPeepInQueue = getGameState().entities.getEntity<Guest>(station.LastPeepInQueue);
|
||||
if (lastPeepInQueue != nullptr && (abs(lastPeepInQueue->z - z) <= 6))
|
||||
{
|
||||
int32_t dx = abs(lastPeepInQueue->x - x);
|
||||
@@ -2409,7 +2409,7 @@ namespace OpenRCT2
|
||||
|
||||
guest.currentCar = carArray[chosen_car];
|
||||
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[guest.currentTrain]);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[guest.currentTrain]);
|
||||
if (vehicle == nullptr)
|
||||
{
|
||||
return nullptr;
|
||||
@@ -2500,7 +2500,7 @@ namespace OpenRCT2
|
||||
|
||||
for (int32_t i = 0; i < ride.numTrains; ++i)
|
||||
{
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[i]);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[i]);
|
||||
if (vehicle == nullptr)
|
||||
continue;
|
||||
|
||||
@@ -2527,8 +2527,8 @@ namespace OpenRCT2
|
||||
int32_t i = 0;
|
||||
|
||||
auto vehicle_id = ride.vehicles[chosen_train];
|
||||
for (Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle_id); vehicle != nullptr;
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_train), ++i)
|
||||
for (Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(vehicle_id); vehicle != nullptr;
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(vehicle->next_vehicle_on_train), ++i)
|
||||
{
|
||||
uint8_t num_seats = vehicle->num_seats;
|
||||
if (vehicle->IsUsedInPairs())
|
||||
@@ -3594,7 +3594,7 @@ namespace OpenRCT2
|
||||
|
||||
uint8_t direction_track = (tile_element == nullptr ? 0 : tile_element->getDirection());
|
||||
|
||||
auto vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[currentTrain]);
|
||||
auto vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[currentTrain]);
|
||||
if (vehicle == nullptr)
|
||||
{
|
||||
// TODO: Goto ride exit on failure.
|
||||
@@ -3684,7 +3684,7 @@ namespace OpenRCT2
|
||||
return;
|
||||
}
|
||||
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(ride->vehicles[currentTrain]);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(ride->vehicles[currentTrain]);
|
||||
if (vehicle == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -3920,7 +3920,7 @@ namespace OpenRCT2
|
||||
}
|
||||
|
||||
auto& gameState = getGameState();
|
||||
Vehicle* vehicle = gameState.entities.GetEntity<Vehicle>(ride->vehicles[currentTrain]);
|
||||
Vehicle* vehicle = gameState.entities.getEntity<Vehicle>(ride->vehicles[currentTrain]);
|
||||
if (vehicle == nullptr)
|
||||
{
|
||||
// TODO: Leave ride on failure goes for all returns on nullptr in this function
|
||||
@@ -3942,11 +3942,11 @@ namespace OpenRCT2
|
||||
|
||||
for (size_t i = 0; i < ride->numTrains; ++i)
|
||||
{
|
||||
Vehicle* train = gameState.entities.GetEntity<Vehicle>(ride->vehicles[i]);
|
||||
Vehicle* train = gameState.entities.getEntity<Vehicle>(ride->vehicles[i]);
|
||||
if (train == nullptr)
|
||||
continue;
|
||||
|
||||
Vehicle* second_vehicle = gameState.entities.GetEntity<Vehicle>(train->next_vehicle_on_train);
|
||||
Vehicle* second_vehicle = gameState.entities.getEntity<Vehicle>(train->next_vehicle_on_train);
|
||||
if (second_vehicle == nullptr)
|
||||
continue;
|
||||
|
||||
@@ -3984,7 +3984,7 @@ namespace OpenRCT2
|
||||
}
|
||||
}
|
||||
|
||||
Vehicle* currentTrainEntity = gameState.entities.GetEntity<Vehicle>(ride->vehicles[currentTrain]);
|
||||
Vehicle* currentTrainEntity = gameState.entities.getEntity<Vehicle>(ride->vehicles[currentTrain]);
|
||||
if (currentTrainEntity == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -4023,7 +4023,7 @@ namespace OpenRCT2
|
||||
auto* ride = GetRide(currentRide);
|
||||
if (ride != nullptr)
|
||||
{
|
||||
auto* vehicle = gameState.entities.GetEntity<Vehicle>(ride->vehicles[currentTrain]);
|
||||
auto* vehicle = gameState.entities.getEntity<Vehicle>(ride->vehicles[currentTrain]);
|
||||
if (vehicle != nullptr)
|
||||
{
|
||||
vehicle = vehicle->GetCar(currentCar);
|
||||
@@ -4040,7 +4040,7 @@ namespace OpenRCT2
|
||||
|
||||
if (vehicle->IsUsedInPairs())
|
||||
{
|
||||
auto* seatedGuest = gameState.entities.GetEntity<Guest>(vehicle->peep[currentSeat ^ 1]);
|
||||
auto* seatedGuest = gameState.entities.getEntity<Guest>(vehicle->peep[currentSeat ^ 1]);
|
||||
if (seatedGuest != nullptr)
|
||||
{
|
||||
if (seatedGuest->rideSubState != PeepRideSubState::enterVehicle)
|
||||
@@ -4086,7 +4086,7 @@ namespace OpenRCT2
|
||||
if (ride == nullptr)
|
||||
return;
|
||||
|
||||
Vehicle* vehicle = gameState.entities.GetEntity<Vehicle>(ride->vehicles[currentTrain]);
|
||||
Vehicle* vehicle = gameState.entities.getEntity<Vehicle>(ride->vehicles[currentTrain]);
|
||||
if (vehicle == nullptr)
|
||||
return;
|
||||
|
||||
@@ -4147,7 +4147,7 @@ namespace OpenRCT2
|
||||
if (!ride->getRideTypeDescriptor().flags.has(RtdFlag::vehicleIsIntegral))
|
||||
{
|
||||
for (; vehicle != nullptr && !vehicle->IsHead();
|
||||
vehicle = gameState.entities.GetEntity<Vehicle>(vehicle->prev_vehicle_on_ride))
|
||||
vehicle = gameState.entities.getEntity<Vehicle>(vehicle->prev_vehicle_on_ride))
|
||||
{
|
||||
auto trackType = vehicle->GetTrackType();
|
||||
if (trackType == TrackElemType::flat || trackType > TrackElemType::middleStation)
|
||||
@@ -4265,7 +4265,7 @@ namespace OpenRCT2
|
||||
|
||||
Direction station_direction = (trackElement == nullptr ? 0 : trackElement->getDirection());
|
||||
|
||||
vehicle = gameState.entities.GetEntity<Vehicle>(ride->vehicles[currentTrain]);
|
||||
vehicle = gameState.entities.getEntity<Vehicle>(ride->vehicles[currentTrain]);
|
||||
if (vehicle == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -4447,7 +4447,7 @@ namespace OpenRCT2
|
||||
// This is incrementing the actual peep waypoint
|
||||
var37++;
|
||||
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(ride->vehicles[currentTrain]);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(ride->vehicles[currentTrain]);
|
||||
if (vehicle == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -4544,7 +4544,7 @@ namespace OpenRCT2
|
||||
}
|
||||
|
||||
var37--;
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(ride->vehicles[currentTrain]);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(ride->vehicles[currentTrain]);
|
||||
if (vehicle == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -5647,7 +5647,7 @@ namespace OpenRCT2
|
||||
// first check if the next in queue is actually nearby
|
||||
// if they are not then it's safe to assume that this is
|
||||
// the front of the queue.
|
||||
Peep* nextGuest = getGameState().entities.GetEntity<Guest>(guestNextInQueue);
|
||||
Peep* nextGuest = getGameState().entities.getEntity<Guest>(guestNextInQueue);
|
||||
if (nextGuest != nullptr)
|
||||
{
|
||||
if (abs(nextGuest->x - x) < 32 && abs(nextGuest->y - y) < 32)
|
||||
@@ -7147,10 +7147,10 @@ namespace OpenRCT2
|
||||
Guest* Guest::generate(const CoordsXYZ& coords)
|
||||
{
|
||||
auto& gameState = getGameState();
|
||||
if (gameState.entities.GetNumFreeEntities() < 400)
|
||||
if (gameState.entities.getNumFreeEntities() < 400)
|
||||
return nullptr;
|
||||
|
||||
Guest* peep = gameState.entities.CreateEntity<Guest>();
|
||||
Guest* peep = gameState.entities.createEntity<Guest>();
|
||||
|
||||
peep->animationObjectIndex = findPeepAnimationsIndexForType(AnimationPeepType::guest);
|
||||
peep->animationGroup = PeepAnimationGroup::normal;
|
||||
@@ -7437,7 +7437,7 @@ namespace OpenRCT2
|
||||
{
|
||||
timeInQueue = AddClamp<uint16_t>(timeInQueue, 1);
|
||||
|
||||
auto* guestNext = getGameState().entities.GetEntity<Guest>(guestNextInQueue);
|
||||
auto* guestNext = getGameState().entities.getEntity<Guest>(guestNextInQueue);
|
||||
if (guestNext == nullptr)
|
||||
{
|
||||
return false;
|
||||
@@ -7528,13 +7528,13 @@ namespace OpenRCT2
|
||||
}
|
||||
|
||||
auto& gameState = getGameState();
|
||||
auto* otherGuest = gameState.entities.GetEntity<Guest>(station.LastPeepInQueue);
|
||||
auto* otherGuest = gameState.entities.getEntity<Guest>(station.LastPeepInQueue);
|
||||
if (otherGuest == nullptr)
|
||||
{
|
||||
LOG_ERROR("Invalid Guest Queue list!");
|
||||
return;
|
||||
}
|
||||
for (; otherGuest != nullptr; otherGuest = gameState.entities.GetEntity<Guest>(otherGuest->guestNextInQueue))
|
||||
for (; otherGuest != nullptr; otherGuest = gameState.entities.getEntity<Guest>(otherGuest->guestNextInQueue))
|
||||
{
|
||||
if (id == otherGuest->guestNextInQueue)
|
||||
{
|
||||
|
||||
@@ -140,7 +140,7 @@ namespace OpenRCT2
|
||||
const JumpingFountainType newType, const CoordsXYZ& newLoc, const int32_t direction, const FountainFlags newFlags,
|
||||
const int32_t iteration)
|
||||
{
|
||||
auto* jumpingFountain = getGameState().entities.CreateEntity<JumpingFountain>();
|
||||
auto* jumpingFountain = getGameState().entities.createEntity<JumpingFountain>();
|
||||
if (jumpingFountain != nullptr)
|
||||
{
|
||||
jumpingFountain->iteration = iteration;
|
||||
@@ -195,7 +195,7 @@ namespace OpenRCT2
|
||||
|
||||
if (frame == 16)
|
||||
{
|
||||
getGameState().entities.EntityRemove(this);
|
||||
getGameState().entities.entityRemove(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace OpenRCT2
|
||||
if (!IsLocationLitterable(offsetLitterPos))
|
||||
return;
|
||||
|
||||
if (gameState.entities.GetEntityListCount(EntityType::litter) >= 500)
|
||||
if (gameState.entities.getEntityListCount(EntityType::litter) >= 500)
|
||||
{
|
||||
Litter* newestLitter = nullptr;
|
||||
uint32_t newestLitterCreationTick = 0;
|
||||
@@ -76,11 +76,11 @@ namespace OpenRCT2
|
||||
if (newestLitter != nullptr)
|
||||
{
|
||||
newestLitter->invalidate();
|
||||
gameState.entities.EntityRemove(newestLitter);
|
||||
gameState.entities.entityRemove(newestLitter);
|
||||
}
|
||||
}
|
||||
|
||||
Litter* litter = gameState.entities.CreateEntity<Litter>();
|
||||
Litter* litter = gameState.entities.createEntity<Litter>();
|
||||
if (litter == nullptr)
|
||||
return;
|
||||
|
||||
@@ -115,7 +115,7 @@ namespace OpenRCT2
|
||||
for (auto* litter : removals)
|
||||
{
|
||||
litter->invalidate();
|
||||
getGameState().entities.EntityRemove(litter);
|
||||
getGameState().entities.entityRemove(litter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace OpenRCT2
|
||||
if (value == 0.00_GBP)
|
||||
return;
|
||||
|
||||
MoneyEffect* moneyEffect = getGameState().entities.CreateEntity<MoneyEffect>();
|
||||
MoneyEffect* moneyEffect = getGameState().entities.createEntity<MoneyEffect>();
|
||||
if (moneyEffect == nullptr)
|
||||
return;
|
||||
|
||||
@@ -150,7 +150,7 @@ namespace OpenRCT2
|
||||
return;
|
||||
}
|
||||
|
||||
getGameState().entities.EntityRemove(this);
|
||||
getGameState().entities.entityRemove(this);
|
||||
}
|
||||
|
||||
std::pair<StringId, money64> MoneyEffect::getStringId() const
|
||||
|
||||
@@ -75,7 +75,7 @@ namespace OpenRCT2
|
||||
*/
|
||||
void VehicleCrashParticle::create(VehicleColour& colours, const CoordsXYZ& vehiclePos)
|
||||
{
|
||||
VehicleCrashParticle* sprite = getGameState().entities.CreateEntity<VehicleCrashParticle>();
|
||||
VehicleCrashParticle* sprite = getGameState().entities.createEntity<VehicleCrashParticle>();
|
||||
if (sprite != nullptr)
|
||||
{
|
||||
sprite->moveTo(vehiclePos);
|
||||
@@ -96,7 +96,7 @@ namespace OpenRCT2
|
||||
timeToLive--;
|
||||
if (timeToLive == 0)
|
||||
{
|
||||
getGameState().entities.EntityRemove(this);
|
||||
getGameState().entities.entityRemove(this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -128,7 +128,7 @@ namespace OpenRCT2
|
||||
// Splash
|
||||
Audio::Play3D(Audio::SoundId::water2, { x, y, waterZ });
|
||||
CrashSplashParticle::create({ x, y, waterZ });
|
||||
getGameState().entities.EntityRemove(this);
|
||||
getGameState().entities.entityRemove(this);
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -168,7 +168,7 @@ namespace OpenRCT2
|
||||
*/
|
||||
void CrashSplashParticle::create(const CoordsXYZ& splashPos)
|
||||
{
|
||||
auto* sprite = getGameState().entities.CreateEntity<CrashSplashParticle>();
|
||||
auto* sprite = getGameState().entities.createEntity<CrashSplashParticle>();
|
||||
if (sprite != nullptr)
|
||||
{
|
||||
sprite->spriteData.width = 33;
|
||||
@@ -189,7 +189,7 @@ namespace OpenRCT2
|
||||
frame += 85;
|
||||
if (frame >= 7168)
|
||||
{
|
||||
getGameState().entities.EntityRemove(this);
|
||||
getGameState().entities.entityRemove(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -208,7 +208,7 @@ namespace OpenRCT2
|
||||
auto surfaceElement = MapGetSurfaceElementAt(coords);
|
||||
if (surfaceElement != nullptr && coords.z > surfaceElement->getBaseZ())
|
||||
{
|
||||
SteamParticle* steam = getGameState().entities.CreateEntity<SteamParticle>();
|
||||
SteamParticle* steam = getGameState().entities.createEntity<SteamParticle>();
|
||||
if (steam == nullptr)
|
||||
return;
|
||||
|
||||
@@ -238,7 +238,7 @@ namespace OpenRCT2
|
||||
frame += 64;
|
||||
if (frame >= (56 * 64))
|
||||
{
|
||||
getGameState().entities.EntityRemove(this);
|
||||
getGameState().entities.entityRemove(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ namespace OpenRCT2
|
||||
*/
|
||||
void ExplosionCloud::create(const CoordsXYZ& cloudPos)
|
||||
{
|
||||
auto* entity = getGameState().entities.CreateEntity<ExplosionCloud>();
|
||||
auto* entity = getGameState().entities.createEntity<ExplosionCloud>();
|
||||
if (entity != nullptr)
|
||||
{
|
||||
entity->spriteData.width = 44;
|
||||
@@ -276,7 +276,7 @@ namespace OpenRCT2
|
||||
frame += 128;
|
||||
if (frame >= (36 * 128))
|
||||
{
|
||||
getGameState().entities.EntityRemove(this);
|
||||
getGameState().entities.entityRemove(this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -292,7 +292,7 @@ namespace OpenRCT2
|
||||
*/
|
||||
void ExplosionFlare::create(const CoordsXYZ& flarePos)
|
||||
{
|
||||
auto* entity = getGameState().entities.CreateEntity<ExplosionFlare>();
|
||||
auto* entity = getGameState().entities.createEntity<ExplosionFlare>();
|
||||
if (entity != nullptr)
|
||||
{
|
||||
entity->spriteData.width = 25;
|
||||
@@ -313,7 +313,7 @@ namespace OpenRCT2
|
||||
frame += 64;
|
||||
if (frame >= (124 * 64))
|
||||
{
|
||||
getGameState().entities.EntityRemove(this);
|
||||
getGameState().entities.entityRemove(this);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace OpenRCT2
|
||||
|
||||
int32_t PeepGetStaffCount()
|
||||
{
|
||||
return getGameState().entities.GetEntityListCount(EntityType::staff);
|
||||
return getGameState().entities.getEntityListCount(EntityType::staff);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -738,7 +738,7 @@ namespace OpenRCT2
|
||||
|
||||
News::DisableNewsItems(News::ItemType::peep, staff->id.ToUnderlying());
|
||||
}
|
||||
getGameState().entities.EntityRemove(peep);
|
||||
getGameState().entities.entityRemove(peep);
|
||||
|
||||
auto intent = Intent(wasGuest ? INTENT_ACTION_REFRESH_GUEST_LIST : INTENT_ACTION_REFRESH_STAFF_LIST);
|
||||
ContextBroadcastIntent(&intent);
|
||||
@@ -2528,8 +2528,8 @@ namespace OpenRCT2
|
||||
|
||||
int32_t PeepCompare(const EntityId sprite_index_a, const EntityId sprite_index_b)
|
||||
{
|
||||
Peep const* peep_a = getGameState().entities.GetEntity<Peep>(sprite_index_a);
|
||||
Peep const* peep_b = getGameState().entities.GetEntity<Peep>(sprite_index_b);
|
||||
Peep const* peep_a = getGameState().entities.getEntity<Peep>(sprite_index_a);
|
||||
Peep const* peep_b = getGameState().entities.getEntity<Peep>(sprite_index_b);
|
||||
if (peep_a == nullptr || peep_b == nullptr)
|
||||
{
|
||||
return 0;
|
||||
|
||||
@@ -2144,7 +2144,7 @@ namespace OpenRCT2
|
||||
break;
|
||||
}
|
||||
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->prev_vehicle_on_ride);
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(vehicle->prev_vehicle_on_ride);
|
||||
if (vehicle == nullptr)
|
||||
{
|
||||
return true;
|
||||
|
||||
@@ -259,9 +259,9 @@ static void ConsoleCommandRides(InteractiveConsole& console, const arguments_t&
|
||||
{
|
||||
for (int32_t i = 0; i < ride->numTrains; ++i)
|
||||
{
|
||||
for (Vehicle* vehicle = gameState.entities.GetEntity<Vehicle>(ride->vehicles[i]);
|
||||
for (Vehicle* vehicle = gameState.entities.getEntity<Vehicle>(ride->vehicles[i]);
|
||||
vehicle != nullptr;
|
||||
vehicle = gameState.entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
vehicle = gameState.entities.getEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
vehicle->mass = mass;
|
||||
}
|
||||
@@ -481,7 +481,7 @@ static void ConsoleCommandStaff(InteractiveConsole& console, const arguments_t&
|
||||
|
||||
if (int_valid[0] && int_valid[1])
|
||||
{
|
||||
Peep* peep = gameState.entities.GetEntity<Peep>(EntityId::FromUnderlying(int_val[0]));
|
||||
Peep* peep = gameState.entities.getEntity<Peep>(EntityId::FromUnderlying(int_val[0]));
|
||||
if (peep != nullptr)
|
||||
{
|
||||
peep->energy = int_val[1];
|
||||
@@ -500,7 +500,7 @@ static void ConsoleCommandStaff(InteractiveConsole& console, const arguments_t&
|
||||
console.WriteLineError("Invalid staff ID");
|
||||
return;
|
||||
}
|
||||
auto staff = gameState.entities.GetEntity<Staff>(EntityId::FromUnderlying(int_val[0]));
|
||||
auto staff = gameState.entities.getEntity<Staff>(EntityId::FromUnderlying(int_val[0]));
|
||||
if (staff == nullptr)
|
||||
{
|
||||
console.WriteLineError("Invalid staff ID");
|
||||
@@ -1225,7 +1225,7 @@ static void ConsoleCommandRemoveUnusedObjects(InteractiveConsole& console, [[may
|
||||
|
||||
static void ConsoleCommandRemoveFloatingObjects(InteractiveConsole& console, const arguments_t& argv)
|
||||
{
|
||||
uint16_t result = getGameState().entities.RemoveFloatingEntities();
|
||||
uint16_t result = getGameState().entities.removeFloatingEntities();
|
||||
console.WriteFormatLine("Removed %d flying objects", result);
|
||||
}
|
||||
|
||||
@@ -1239,7 +1239,7 @@ static void ConsoleCommandShowLimits(InteractiveConsole& console, [[maybe_unused
|
||||
for (int32_t i = 0; i < static_cast<uint8_t>(EntityType::count); ++i)
|
||||
{
|
||||
auto& gameState = getGameState();
|
||||
spriteCount += gameState.entities.GetEntityListCount(EntityType(i));
|
||||
spriteCount += gameState.entities.getEntityListCount(EntityType(i));
|
||||
}
|
||||
|
||||
auto bannerCount = GetNumBanners();
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace OpenRCT2
|
||||
return arg;
|
||||
else if constexpr (std::is_same_v<T, EntityFocus>)
|
||||
{
|
||||
auto* centreEntity = getGameState().entities.GetEntity(arg);
|
||||
auto* centreEntity = getGameState().entities.getEntity(arg);
|
||||
if (centreEntity != nullptr)
|
||||
{
|
||||
return CoordsXYZ{ centreEntity->x, centreEntity->y, centreEntity->z };
|
||||
@@ -611,7 +611,7 @@ namespace OpenRCT2
|
||||
{
|
||||
if (!window->viewportTargetSprite.IsNull() && window->viewport != nullptr)
|
||||
{
|
||||
auto* sprite = getGameState().entities.GetEntity(window->viewportTargetSprite);
|
||||
auto* sprite = getGameState().entities.getEntity(window->viewportTargetSprite);
|
||||
if (sprite == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -635,7 +635,7 @@ namespace OpenRCT2
|
||||
|
||||
void ViewportUpdateSmartFollowEntity(WindowBase* window)
|
||||
{
|
||||
auto entity = getGameState().entities.TryGetEntity(window->viewportSmartFollowSprite);
|
||||
auto entity = getGameState().entities.tryGetEntity(window->viewportSmartFollowSprite);
|
||||
if (entity == nullptr || entity->type == EntityType::null)
|
||||
{
|
||||
window->viewportSmartFollowSprite = EntityId::GetNull();
|
||||
@@ -696,7 +696,7 @@ namespace OpenRCT2
|
||||
auto ride = GetRide(peep.currentRide);
|
||||
if (ride != nullptr && ride->flags.has(RideFlag::onTrack))
|
||||
{
|
||||
auto train = getGameState().entities.GetEntity<Vehicle>(ride->vehicles[peep.currentTrain]);
|
||||
auto train = getGameState().entities.getEntity<Vehicle>(ride->vehicles[peep.currentTrain]);
|
||||
if (train != nullptr)
|
||||
{
|
||||
const auto car = train->GetCar(peep.currentCar);
|
||||
|
||||
@@ -280,8 +280,8 @@ static bool AwardIsDeservedBestStaff(GameState_t& gameState, Park::ParkData& par
|
||||
if (activeAwardTypes & EnumToFlag(AwardType::mostUntidy))
|
||||
return false;
|
||||
|
||||
auto staffCount = gameState.entities.GetEntityListCount(EntityType::staff);
|
||||
auto peepCount = gameState.entities.GetEntityListCount(EntityType::guest);
|
||||
auto staffCount = gameState.entities.getEntityListCount(EntityType::staff);
|
||||
auto peepCount = gameState.entities.getEntityListCount(EntityType::guest);
|
||||
FlagHolder<uint8_t, StaffType> foundStaffTypes{};
|
||||
|
||||
for (auto* staff : EntityList<Staff>())
|
||||
|
||||
@@ -230,7 +230,7 @@ std::optional<CoordsXYZ> News::GetSubjectLocation(ItemType type, int32_t subject
|
||||
}
|
||||
case ItemType::peepOnRide:
|
||||
{
|
||||
auto peep = gameState.entities.TryGetEntity<Peep>(EntityId::FromUnderlying(subject));
|
||||
auto peep = gameState.entities.tryGetEntity<Peep>(EntityId::FromUnderlying(subject));
|
||||
if (peep == nullptr)
|
||||
break;
|
||||
|
||||
@@ -253,11 +253,11 @@ std::optional<CoordsXYZ> News::GetSubjectLocation(ItemType type, int32_t subject
|
||||
}
|
||||
|
||||
// Find the first car of the train peep is on
|
||||
auto sprite = gameState.entities.TryGetEntity<Vehicle>(ride->vehicles[peep->currentTrain]);
|
||||
auto sprite = gameState.entities.tryGetEntity<Vehicle>(ride->vehicles[peep->currentTrain]);
|
||||
// Find the actual car peep is on
|
||||
for (int32_t i = 0; i < peep->currentCar && sprite != nullptr; i++)
|
||||
{
|
||||
sprite = gameState.entities.TryGetEntity<Vehicle>(sprite->next_vehicle_on_train);
|
||||
sprite = gameState.entities.tryGetEntity<Vehicle>(sprite->next_vehicle_on_train);
|
||||
}
|
||||
if (sprite != nullptr)
|
||||
{
|
||||
@@ -267,7 +267,7 @@ std::optional<CoordsXYZ> News::GetSubjectLocation(ItemType type, int32_t subject
|
||||
}
|
||||
case ItemType::peep:
|
||||
{
|
||||
auto peep = gameState.entities.TryGetEntity<Peep>(EntityId::FromUnderlying(subject));
|
||||
auto peep = gameState.entities.tryGetEntity<Peep>(EntityId::FromUnderlying(subject));
|
||||
if (peep != nullptr)
|
||||
{
|
||||
subjectLoc = peep->getLocation();
|
||||
@@ -380,7 +380,7 @@ void News::OpenSubject(ItemType type, int32_t subject)
|
||||
case ItemType::peepOnRide:
|
||||
case ItemType::peep:
|
||||
{
|
||||
auto peep = getGameState().entities.TryGetEntity<Peep>(EntityId::FromUnderlying(subject));
|
||||
auto peep = getGameState().entities.tryGetEntity<Peep>(EntityId::FromUnderlying(subject));
|
||||
if (peep != nullptr)
|
||||
{
|
||||
auto intent = Intent(WindowClass::peep);
|
||||
|
||||
@@ -856,8 +856,8 @@ namespace OpenRCT2::Network
|
||||
|
||||
if (!storedTick.spriteHash.empty())
|
||||
{
|
||||
EntitiesChecksum checksum = getGameState().entities.GetAllEntitiesChecksum();
|
||||
std::string clientSpriteHash = checksum.ToString();
|
||||
EntitiesChecksum checksum = getGameState().entities.getAllEntitiesChecksum();
|
||||
std::string clientSpriteHash = checksum.toString();
|
||||
if (clientSpriteHash != storedTick.spriteHash)
|
||||
{
|
||||
LOG_INFO(
|
||||
@@ -1601,8 +1601,8 @@ namespace OpenRCT2::Network
|
||||
packet << flags;
|
||||
if (flags & TickFlags::kChecksums)
|
||||
{
|
||||
EntitiesChecksum checksum = getGameState().entities.GetAllEntitiesChecksum();
|
||||
packet.writeString(checksum.ToString());
|
||||
EntitiesChecksum checksum = getGameState().entities.getAllEntitiesChecksum();
|
||||
packet.writeString(checksum.toString());
|
||||
}
|
||||
|
||||
SendPacketToClients(packet);
|
||||
|
||||
@@ -821,7 +821,7 @@ std::optional<OpenRCT2::Drawing::Colour> GetPatrolAreaTileColour(const CoordsXY&
|
||||
else
|
||||
{
|
||||
auto& staffId = std::get<EntityId>(patrolAreaToRender);
|
||||
auto* staff = getGameState().entities.GetEntity<Staff>(staffId);
|
||||
auto* staff = getGameState().entities.getEntity<Staff>(staffId);
|
||||
if (staff != nullptr)
|
||||
{
|
||||
if (staff->isPatrolAreaSet(pos))
|
||||
|
||||
@@ -28,7 +28,7 @@ static void PaintCircusTent(
|
||||
if (rideEntry == nullptr)
|
||||
return;
|
||||
|
||||
auto vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[0]);
|
||||
auto vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[0]);
|
||||
if (ride.flags.has(RideFlag::onTrack) && vehicle != nullptr)
|
||||
{
|
||||
session.InteractionType = ViewportInteractionItem::entity;
|
||||
|
||||
@@ -68,7 +68,7 @@ static void PaintCrookedHouseStructure(
|
||||
|
||||
if (ride->flags.has(RideFlag::onTrack))
|
||||
{
|
||||
auto vehicle = getGameState().entities.GetEntity<Vehicle>(ride->vehicles[0]);
|
||||
auto vehicle = getGameState().entities.getEntity<Vehicle>(ride->vehicles[0]);
|
||||
if (vehicle != nullptr)
|
||||
{
|
||||
session.InteractionType = ViewportInteractionItem::entity;
|
||||
|
||||
@@ -50,7 +50,7 @@ static void PaintFerrisWheelRiders(
|
||||
{
|
||||
for (int32_t i = 0; i < 32; i += 2)
|
||||
{
|
||||
auto* peep = getGameState().entities.GetEntity<Guest>(vehicle.peep[i]);
|
||||
auto* peep = getGameState().entities.getEntity<Guest>(vehicle.peep[i]);
|
||||
if (peep == nullptr || peep->state != PeepState::onRide)
|
||||
continue;
|
||||
|
||||
@@ -68,7 +68,7 @@ static void PaintFerrisWheelStructure(
|
||||
if (rideEntry == nullptr)
|
||||
return;
|
||||
|
||||
auto vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[0]);
|
||||
auto vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[0]);
|
||||
if (ride.flags.has(RideFlag::onTrack) && vehicle != nullptr)
|
||||
{
|
||||
session.InteractionType = ViewportInteractionItem::entity;
|
||||
|
||||
@@ -36,7 +36,7 @@ static void PaintHauntedHouseStructure(
|
||||
if (rideEntry == nullptr)
|
||||
return;
|
||||
|
||||
auto vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[0]);
|
||||
auto vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[0]);
|
||||
if (ride.flags.has(RideFlag::onTrack) && vehicle != nullptr)
|
||||
{
|
||||
session.InteractionType = ViewportInteractionItem::entity;
|
||||
|
||||
@@ -63,7 +63,7 @@ static void PaintCarousel(
|
||||
if (rideEntry == nullptr)
|
||||
return;
|
||||
|
||||
auto vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[0]);
|
||||
auto vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[0]);
|
||||
if (ride.flags.has(RideFlag::onTrack) && vehicle != nullptr)
|
||||
{
|
||||
session.InteractionType = ViewportInteractionItem::entity;
|
||||
|
||||
@@ -50,7 +50,7 @@ static void PaintSpaceRingsStructure(
|
||||
|
||||
int32_t frameNum = direction;
|
||||
uint32_t baseImageId = rideEntry->Cars[0].baseImageId;
|
||||
auto vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[vehicleIndex]);
|
||||
auto vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[vehicleIndex]);
|
||||
if (ride.flags.has(RideFlag::onTrack) && vehicle != nullptr)
|
||||
{
|
||||
session.InteractionType = ViewportInteractionItem::entity;
|
||||
@@ -73,7 +73,7 @@ static void PaintSpaceRingsStructure(
|
||||
|
||||
if (vehicle != nullptr && vehicle->num_peeps > 0)
|
||||
{
|
||||
auto* rider = getGameState().entities.GetEntity<Guest>(vehicle->peep[0]);
|
||||
auto* rider = getGameState().entities.getEntity<Guest>(vehicle->peep[0]);
|
||||
if (rider != nullptr)
|
||||
{
|
||||
stationColour = ImageId(0, rider->tShirtColour, rider->trousersColour);
|
||||
|
||||
@@ -31,7 +31,7 @@ static void Paint3dCinemaDome(
|
||||
if (ride.flags.has(RideFlag::onTrack) && !ride.vehicles[0].IsNull())
|
||||
{
|
||||
session.InteractionType = ViewportInteractionItem::entity;
|
||||
session.CurrentlyDrawnEntity = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[0]);
|
||||
session.CurrentlyDrawnEntity = getGameState().entities.getEntity<Vehicle>(ride.vehicles[0]);
|
||||
}
|
||||
|
||||
auto imageTemplate = ImageId(0, ride.vehicleColours[0].Body, ride.vehicleColours[0].Trim);
|
||||
|
||||
@@ -56,7 +56,7 @@ static void PaintEnterpriseStructure(
|
||||
Vehicle* vehicle = nullptr;
|
||||
if (ride.flags.has(RideFlag::onTrack))
|
||||
{
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[0]);
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[0]);
|
||||
if (vehicle != nullptr)
|
||||
{
|
||||
session.InteractionType = ViewportInteractionItem::entity;
|
||||
|
||||
@@ -93,7 +93,7 @@ static Vehicle* GetFirstVehicle(const Ride& ride)
|
||||
{
|
||||
if (ride.flags.has(RideFlag::onTrack))
|
||||
{
|
||||
return getGameState().entities.GetEntity<Vehicle>(ride.vehicles[0]);
|
||||
return getGameState().entities.getEntity<Vehicle>(ride.vehicles[0]);
|
||||
}
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@ static void PaintMotionSimulatorVehicle(
|
||||
Vehicle* vehicle = nullptr;
|
||||
if (ride.flags.has(RideFlag::onTrack))
|
||||
{
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[0]);
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[0]);
|
||||
if (vehicle != nullptr)
|
||||
{
|
||||
session.InteractionType = ViewportInteractionItem::entity;
|
||||
|
||||
@@ -74,7 +74,7 @@ static void PaintSwingingInverterShipStructure(
|
||||
Vehicle* vehicle = nullptr;
|
||||
if (ride.flags.has(RideFlag::onTrack))
|
||||
{
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[0]);
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[0]);
|
||||
if (vehicle != nullptr)
|
||||
{
|
||||
session.InteractionType = ViewportInteractionItem::entity;
|
||||
|
||||
@@ -96,7 +96,7 @@ static void PaintSwingingShipStructure(
|
||||
Vehicle* vehicle = nullptr;
|
||||
if (ride.flags.has(RideFlag::onTrack) && !ride.vehicles[0].IsNull())
|
||||
{
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[0]);
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[0]);
|
||||
session.InteractionType = ViewportInteractionItem::entity;
|
||||
session.CurrentlyDrawnEntity = vehicle;
|
||||
}
|
||||
|
||||
@@ -125,7 +125,7 @@ static void PaintTopSpinVehicle(
|
||||
height += 3;
|
||||
uint8_t seatRotation = 0;
|
||||
uint8_t armRotation = 0;
|
||||
auto* vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[0]);
|
||||
auto* vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[0]);
|
||||
if (ride.flags.has(RideFlag::onTrack) && vehicle != nullptr)
|
||||
{
|
||||
session.InteractionType = ViewportInteractionItem::entity;
|
||||
|
||||
@@ -38,7 +38,7 @@ static void PaintTwistStructure(
|
||||
|
||||
if (ride.flags.has(RideFlag::onTrack) && !ride.vehicles[0].IsNull())
|
||||
{
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[0]);
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[0]);
|
||||
|
||||
session.InteractionType = ViewportInteractionItem::entity;
|
||||
session.CurrentlyDrawnEntity = vehicle;
|
||||
|
||||
@@ -117,7 +117,7 @@ namespace OpenRCT2
|
||||
if (rideEntry == nullptr)
|
||||
return;
|
||||
|
||||
auto* peep = getGameState().entities.GetEntity<Guest>(vehicle->peep[0]);
|
||||
auto* peep = getGameState().entities.getEntity<Guest>(vehicle->peep[0]);
|
||||
if (peep == nullptr)
|
||||
return;
|
||||
|
||||
|
||||
@@ -26,8 +26,8 @@ namespace OpenRCT2
|
||||
PaintSession& session, int32_t x, int32_t imageDirection, int32_t y, int32_t z, const Vehicle* vehicle,
|
||||
const CarEntry* carEntry)
|
||||
{
|
||||
Vehicle* v1 = getGameState().entities.GetEntity<Vehicle>(vehicle->prev_vehicle_on_ride);
|
||||
Vehicle* v2 = getGameState().entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_ride);
|
||||
Vehicle* v1 = getGameState().entities.getEntity<Vehicle>(vehicle->prev_vehicle_on_ride);
|
||||
Vehicle* v2 = getGameState().entities.getEntity<Vehicle>(vehicle->next_vehicle_on_ride);
|
||||
if (v1 == nullptr || v2 == nullptr)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -38,8 +38,8 @@ namespace OpenRCT2
|
||||
// TODO: pass as parameter?
|
||||
auto& entityRegistry = getGameState().entities;
|
||||
|
||||
auto* vehicleToPaint = vehicle->IsHead() ? entityRegistry.GetEntity<Vehicle>(vehicle->next_vehicle_on_ride)
|
||||
: entityRegistry.GetEntity<Vehicle>(vehicle->prev_vehicle_on_ride);
|
||||
auto* vehicleToPaint = vehicle->IsHead() ? entityRegistry.getEntity<Vehicle>(vehicle->next_vehicle_on_ride)
|
||||
: entityRegistry.getEntity<Vehicle>(vehicle->prev_vehicle_on_ride);
|
||||
if (vehicleToPaint == nullptr)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -4606,7 +4606,7 @@ static void vehicle_visual_splash3_effect(PaintSession& session, const int32_t z
|
||||
*/
|
||||
static void vehicle_visual_splash4_effect(PaintSession& session, const int32_t z, const Vehicle* vehicle)
|
||||
{
|
||||
Vehicle* vehicle2 = getGameState().entities.GetEntity<Vehicle>(vehicle->prev_vehicle_on_ride);
|
||||
Vehicle* vehicle2 = getGameState().entities.getEntity<Vehicle>(vehicle->prev_vehicle_on_ride);
|
||||
if (vehicle2 == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -4634,7 +4634,7 @@ static void vehicle_visual_splash4_effect(PaintSession& session, const int32_t z
|
||||
*/
|
||||
static void vehicle_visual_splash5_effect(PaintSession& session, const int32_t z, const Vehicle* vehicle)
|
||||
{
|
||||
Vehicle* vehicle2 = getGameState().entities.GetEntity<Vehicle>(vehicle->prev_vehicle_on_ride);
|
||||
Vehicle* vehicle2 = getGameState().entities.getEntity<Vehicle>(vehicle->prev_vehicle_on_ride);
|
||||
if (vehicle2 == nullptr)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -2660,7 +2660,7 @@ namespace OpenRCT2
|
||||
T placeholder{};
|
||||
|
||||
auto index = cs.read<EntityId>();
|
||||
auto* ent = getGameState().entities.CreateEntityAt<T>(index);
|
||||
auto* ent = getGameState().entities.createEntityAt<T>(index);
|
||||
if (ent == nullptr)
|
||||
{
|
||||
// Unable to allocate entity
|
||||
@@ -2681,7 +2681,7 @@ namespace OpenRCT2
|
||||
os.readWriteChunk(ParkFileChunkType::entities, [this, &gameState, &os](OrcaStream::ChunkStream& cs) {
|
||||
if (cs.getMode() == OrcaStream::Mode::reading)
|
||||
{
|
||||
getGameState().entities.ResetAllEntities();
|
||||
getGameState().entities.resetAllEntities();
|
||||
}
|
||||
|
||||
std::vector<uint16_t> entityIndices;
|
||||
|
||||
@@ -2793,7 +2793,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 = getGameState().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)
|
||||
@@ -2916,7 +2916,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 = getGameState().entities.createEntityAt<Guest>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const Peep*>(&srcBase);
|
||||
ImportPeep(dst, src);
|
||||
|
||||
@@ -3011,7 +3011,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 = getGameState().entities.createEntityAt<Staff>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const Peep*>(&srcBase);
|
||||
ImportPeep(dst, src);
|
||||
dst->assignedStaffType = StaffType(src->StaffType);
|
||||
@@ -3030,7 +3030,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 = getGameState().entities.createEntityAt<Litter>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityLitter*>(&srcBase);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
|
||||
@@ -3041,7 +3041,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 = getGameState().entities.createEntityAt<SteamParticle>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntitySteamParticle*>(&srcBase);
|
||||
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
@@ -3052,7 +3052,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 = getGameState().entities.createEntityAt<MoneyEffect>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityMoneyEffect*>(&srcBase);
|
||||
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
@@ -3067,7 +3067,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 = getGameState().entities.createEntityAt<VehicleCrashParticle>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityCrashedVehicleParticle*>(&srcBase);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->frame = src->Frame;
|
||||
@@ -3086,7 +3086,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 = getGameState().entities.createEntityAt<ExplosionCloud>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityParticle*>(&srcBase);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->frame = src->Frame;
|
||||
@@ -3095,7 +3095,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 = getGameState().entities.createEntityAt<ExplosionFlare>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityParticle*>(&srcBase);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->frame = src->Frame;
|
||||
@@ -3104,7 +3104,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 = getGameState().entities.createEntityAt<CrashSplashParticle>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityParticle*>(&srcBase);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->frame = src->Frame;
|
||||
@@ -3113,7 +3113,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 = getGameState().entities.createEntityAt<JumpingFountain>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityJumpingFountain*>(&srcBase);
|
||||
|
||||
auto fountainType = JumpingFountainType::water;
|
||||
@@ -3133,7 +3133,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 = getGameState().entities.createEntityAt<Balloon>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityBalloon*>(&srcBase);
|
||||
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
@@ -3154,7 +3154,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 = getGameState().entities.createEntityAt<Duck>(EntityId::FromUnderlying(srcBase.EntityIndex));
|
||||
auto* src = static_cast<const RCT12EntityDuck*>(&srcBase);
|
||||
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
|
||||
@@ -1978,7 +1978,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 = getGameState().entities.createEntityAt<::Vehicle>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const Vehicle*>(&baseSrc);
|
||||
const auto& ride = _s6.Rides[src->Ride];
|
||||
|
||||
@@ -2104,7 +2104,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 = getGameState().entities.createEntityAt<::Guest>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const Peep*>(&baseSrc);
|
||||
ImportEntityPeep(dst, src);
|
||||
|
||||
@@ -2179,7 +2179,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 = getGameState().entities.createEntityAt<::Staff>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const Peep*>(&baseSrc);
|
||||
ImportEntityPeep(dst, src);
|
||||
|
||||
@@ -2200,7 +2200,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 = getGameState().entities.createEntityAt<::SteamParticle>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntitySteamParticle*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->timeToMove = src->TimeToMove;
|
||||
@@ -2210,7 +2210,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 = getGameState().entities.createEntityAt<::MoneyEffect>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityMoneyEffect*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->moveDelay = src->MoveDelay;
|
||||
@@ -2224,7 +2224,7 @@ namespace OpenRCT2::RCT2
|
||||
template<>
|
||||
void S6Importer::ImportEntity<::VehicleCrashParticle>(GameState_t& gameState, const RCT12EntityBase& baseSrc)
|
||||
{
|
||||
auto dst = getGameState().entities.CreateEntityAt<::VehicleCrashParticle>(
|
||||
auto dst = getGameState().entities.createEntityAt<::VehicleCrashParticle>(
|
||||
EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityCrashedVehicleParticle*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
@@ -2245,7 +2245,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 = getGameState().entities.createEntityAt<::ExplosionCloud>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityParticle*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->frame = src->Frame;
|
||||
@@ -2254,7 +2254,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 = getGameState().entities.createEntityAt<::ExplosionFlare>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityParticle*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->frame = src->Frame;
|
||||
@@ -2263,7 +2263,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 = getGameState().entities.createEntityAt<::CrashSplashParticle>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityParticle*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->frame = src->Frame;
|
||||
@@ -2272,7 +2272,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 = getGameState().entities.createEntityAt<::JumpingFountain>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityJumpingFountain*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->numTicksAlive = src->NumTicksAlive;
|
||||
@@ -2289,7 +2289,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 = getGameState().entities.createEntityAt<::Balloon>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityBalloon*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->popped = src->Popped;
|
||||
@@ -2301,7 +2301,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 = getGameState().entities.createEntityAt<::Duck>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityDuck*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->frame = src->Frame;
|
||||
@@ -2313,7 +2313,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 = getGameState().entities.createEntityAt<::Litter>(EntityId::FromUnderlying(baseSrc.EntityIndex));
|
||||
auto src = static_cast<const RCT12EntityLitter*>(&baseSrc);
|
||||
ImportEntityCommonProperties(dst, src);
|
||||
dst->subType = ::Litter::Type(src->Type);
|
||||
|
||||
@@ -30,7 +30,7 @@ using namespace OpenRCT2::TrackMetadata;
|
||||
Vehicle* CableLiftSegmentCreate(
|
||||
Ride& ride, int32_t x, int32_t y, int32_t z, int32_t direction, uint16_t var_44, int32_t remaining_distance, bool head)
|
||||
{
|
||||
Vehicle* current = getGameState().entities.CreateEntity<Vehicle>();
|
||||
Vehicle* current = getGameState().entities.createEntity<Vehicle>();
|
||||
current->ride = ride.id;
|
||||
current->ride_subtype = kObjectEntryIndexNull;
|
||||
if (head)
|
||||
@@ -161,8 +161,8 @@ void Vehicle::CableLiftUpdateWaitingToDepart()
|
||||
// Next check to see if the second part of the cable lift
|
||||
// is at the front of the passenger vehicle to simulate the
|
||||
// cable being attached underneath the train.
|
||||
Vehicle* passengerVehicle = getGameState().entities.GetEntity<Vehicle>(cable_lift_target);
|
||||
Vehicle* cableLiftSecondPart = getGameState().entities.GetEntity<Vehicle>(prev_vehicle_on_ride);
|
||||
Vehicle* passengerVehicle = getGameState().entities.getEntity<Vehicle>(cable_lift_target);
|
||||
Vehicle* cableLiftSecondPart = getGameState().entities.getEntity<Vehicle>(prev_vehicle_on_ride);
|
||||
if (passengerVehicle == nullptr || cableLiftSecondPart == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -189,7 +189,7 @@ void Vehicle::CableLiftUpdateDeparting()
|
||||
if (sub_state < 16)
|
||||
return;
|
||||
|
||||
Vehicle* passengerVehicle = getGameState().entities.GetEntity<Vehicle>(cable_lift_target);
|
||||
Vehicle* passengerVehicle = getGameState().entities.getEntity<Vehicle>(cable_lift_target);
|
||||
if (passengerVehicle == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -204,7 +204,7 @@ void Vehicle::CableLiftUpdateDeparting()
|
||||
*/
|
||||
void Vehicle::CableLiftUpdateTravelling()
|
||||
{
|
||||
Vehicle* passengerVehicle = getGameState().entities.GetEntity<Vehicle>(cable_lift_target);
|
||||
Vehicle* passengerVehicle = getGameState().entities.getEntity<Vehicle>(cable_lift_target);
|
||||
if (passengerVehicle == nullptr)
|
||||
{
|
||||
return;
|
||||
@@ -421,13 +421,13 @@ int32_t Vehicle::CableLiftUpdateTrackMotion()
|
||||
vehicle->acceleration /= _vehicleSubpositionsMoved;
|
||||
if (_vehicleVelocity >= 0)
|
||||
{
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_train);
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(vehicle->next_vehicle_on_train);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (vehicle == this)
|
||||
break;
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->prev_vehicle_on_ride);
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(vehicle->prev_vehicle_on_ride);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -435,8 +435,8 @@ int32_t Vehicle::CableLiftUpdateTrackMotion()
|
||||
uint16_t massTotal = 0;
|
||||
int32_t accelerationTotal = 0;
|
||||
|
||||
for (Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(id); vehicle != nullptr;
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
for (Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(id); vehicle != nullptr;
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
vehicleCount++;
|
||||
|
||||
|
||||
+27
-27
@@ -356,7 +356,7 @@ namespace OpenRCT2
|
||||
Guest* peep;
|
||||
Guest* result = nullptr;
|
||||
auto spriteIndex = getStation(stationIndex).LastPeepInQueue;
|
||||
while ((peep = getGameState().entities.TryGetEntity<Guest>(spriteIndex)) != nullptr)
|
||||
while ((peep = getGameState().entities.tryGetEntity<Guest>(spriteIndex)) != nullptr)
|
||||
{
|
||||
spriteIndex = peep->guestNextInQueue;
|
||||
result = peep;
|
||||
@@ -370,7 +370,7 @@ namespace OpenRCT2
|
||||
Guest* peep;
|
||||
auto& station = getStation(stationIndex);
|
||||
auto spriteIndex = station.LastPeepInQueue;
|
||||
while ((peep = getGameState().entities.TryGetEntity<Guest>(spriteIndex)) != nullptr)
|
||||
while ((peep = getGameState().entities.tryGetEntity<Guest>(spriteIndex)) != nullptr)
|
||||
{
|
||||
spriteIndex = peep->guestNextInQueue;
|
||||
count++;
|
||||
@@ -565,7 +565,7 @@ namespace OpenRCT2
|
||||
}
|
||||
else if (mode == RideMode::race && !flags.has(RideFlag::passStationNoStopping) && !raceWinner.IsNull())
|
||||
{
|
||||
auto peep = getGameState().entities.GetEntity<Guest>(raceWinner);
|
||||
auto peep = getGameState().entities.getEntity<Guest>(raceWinner);
|
||||
if (peep != nullptr)
|
||||
{
|
||||
ft.Add<StringId>(STR_RACE_WON_BY);
|
||||
@@ -976,7 +976,7 @@ namespace OpenRCT2
|
||||
{
|
||||
ride.slideInUse = 0;
|
||||
|
||||
auto* peep = getGameState().entities.GetEntity<Guest>(ride.slidePeep);
|
||||
auto* peep = getGameState().entities.getEntity<Guest>(ride.slidePeep);
|
||||
if (peep != nullptr)
|
||||
{
|
||||
peep->spiralSlideSubstate = PeepSpiralSlideSubState::finishedSliding;
|
||||
@@ -1280,7 +1280,7 @@ namespace OpenRCT2
|
||||
ride.brokenCar = ScenarioRand() % ride.numCarsPerTrain;
|
||||
|
||||
// Set flag on broken car
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[ride.brokenTrain]);
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[ride.brokenTrain]);
|
||||
if (vehicle != nullptr)
|
||||
{
|
||||
vehicle = vehicle->GetCar(ride.brokenCar);
|
||||
@@ -1297,7 +1297,7 @@ namespace OpenRCT2
|
||||
ride.brokenCar = 0;
|
||||
|
||||
// Set flag on broken train, first car
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[ride.brokenTrain]);
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[ride.brokenTrain]);
|
||||
if (vehicle != nullptr)
|
||||
{
|
||||
vehicle->flags.set(VehicleFlag::trainIsBroken);
|
||||
@@ -1569,7 +1569,7 @@ namespace OpenRCT2
|
||||
|
||||
Staff* RideGetMechanic(const Ride& ride)
|
||||
{
|
||||
auto staff = getGameState().entities.GetEntity<Staff>(ride.mechanic);
|
||||
auto staff = getGameState().entities.getEntity<Staff>(ride.mechanic);
|
||||
if (staff != nullptr && staff->isMechanic())
|
||||
{
|
||||
return staff;
|
||||
@@ -1655,7 +1655,7 @@ namespace OpenRCT2
|
||||
*/
|
||||
void CircusMusicUpdate(Ride& ride)
|
||||
{
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[0]);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[0]);
|
||||
if (vehicle == nullptr || vehicle->status != Vehicle::Status::doingCircusShow)
|
||||
{
|
||||
ride.musicPosition = 0;
|
||||
@@ -1735,7 +1735,7 @@ namespace OpenRCT2
|
||||
if (measurement.vehicle_index >= std::size(ride.vehicles))
|
||||
return;
|
||||
|
||||
auto vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[measurement.vehicle_index]);
|
||||
auto vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[measurement.vehicle_index]);
|
||||
if (vehicle == nullptr)
|
||||
return;
|
||||
|
||||
@@ -1832,7 +1832,7 @@ namespace OpenRCT2
|
||||
for (int32_t j = 0; j < ride.numTrains; j++)
|
||||
{
|
||||
auto vehicleSpriteIdx = ride.vehicles[j];
|
||||
auto vehicle = gameState.entities.GetEntity<Vehicle>(vehicleSpriteIdx);
|
||||
auto vehicle = gameState.entities.getEntity<Vehicle>(vehicleSpriteIdx);
|
||||
if (vehicle != nullptr)
|
||||
{
|
||||
if (vehicle->status == Vehicle::Status::departing
|
||||
@@ -2935,8 +2935,8 @@ namespace OpenRCT2
|
||||
static int32_t count_free_misc_sprite_slots()
|
||||
{
|
||||
auto& gameState = getGameState();
|
||||
int32_t miscSpriteCount = gameState.entities.GetMiscEntityCount();
|
||||
int32_t remainingSpriteCount = gameState.entities.GetNumFreeEntities();
|
||||
int32_t miscSpriteCount = gameState.entities.getMiscEntityCount();
|
||||
int32_t remainingSpriteCount = gameState.entities.getNumFreeEntities();
|
||||
return std::max(0, miscSpriteCount + remainingSpriteCount - 300);
|
||||
}
|
||||
|
||||
@@ -2978,7 +2978,7 @@ namespace OpenRCT2
|
||||
|
||||
auto& carEntry = rideEntry->Cars[carEntryIndex];
|
||||
|
||||
auto* vehicle = getGameState().entities.CreateEntity<Vehicle>();
|
||||
auto* vehicle = getGameState().entities.createEntity<Vehicle>();
|
||||
if (vehicle == nullptr)
|
||||
return nullptr;
|
||||
|
||||
@@ -3263,7 +3263,7 @@ namespace OpenRCT2
|
||||
*/
|
||||
static void RidecreateVehiclesFindFirstBlock(const Ride& ride, CoordsXYE* outXYElement)
|
||||
{
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[0]);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[0]);
|
||||
if (vehicle == nullptr)
|
||||
return;
|
||||
|
||||
@@ -3403,7 +3403,7 @@ namespace OpenRCT2
|
||||
{
|
||||
for (int32_t i = 0; i < numTrains; i++)
|
||||
{
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(vehicles[i]);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(vehicles[i]);
|
||||
if (vehicle == nullptr)
|
||||
{
|
||||
continue;
|
||||
@@ -3447,7 +3447,7 @@ namespace OpenRCT2
|
||||
|
||||
for (int32_t i = 0; i < numTrains; i++)
|
||||
{
|
||||
auto train = getGameState().entities.GetEntity<Vehicle>(vehicles[i]);
|
||||
auto train = getGameState().entities.getEntity<Vehicle>(vehicles[i]);
|
||||
if (train == nullptr)
|
||||
continue;
|
||||
|
||||
@@ -3484,7 +3484,7 @@ namespace OpenRCT2
|
||||
}
|
||||
firstBlock.setBrakeClosed(true);
|
||||
for (Vehicle* car = train; car != nullptr;
|
||||
car = getGameState().entities.GetEntity<Vehicle>(car->next_vehicle_on_train))
|
||||
car = getGameState().entities.getEntity<Vehicle>(car->next_vehicle_on_train))
|
||||
{
|
||||
car->velocity = 0;
|
||||
car->acceleration = 0;
|
||||
@@ -3501,7 +3501,7 @@ namespace OpenRCT2
|
||||
BlockBrakeSetLinkedBrakesClosed(firstBlockPosition, firstBlock, true);
|
||||
}
|
||||
for (Vehicle* car = train; car != nullptr;
|
||||
car = getGameState().entities.GetEntity<Vehicle>(car->next_vehicle_on_train))
|
||||
car = getGameState().entities.getEntity<Vehicle>(car->next_vehicle_on_train))
|
||||
{
|
||||
car->flags.unset(VehicleFlag::collisionDisabled);
|
||||
car->SetState(Vehicle::Status::travelling, car->sub_state);
|
||||
@@ -4403,7 +4403,7 @@ namespace OpenRCT2
|
||||
{
|
||||
for (int32_t i = 0; i < ride.numTrains; i++)
|
||||
{
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[i]);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[i]);
|
||||
if (vehicle != nullptr)
|
||||
{
|
||||
vehicle->flags.unset(VehicleFlag::testing);
|
||||
@@ -4431,8 +4431,8 @@ namespace OpenRCT2
|
||||
{
|
||||
for (int32_t i = 0; i < ride.numTrains; i++)
|
||||
{
|
||||
for (Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[i]); vehicle != nullptr;
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
for (Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[i]); vehicle != nullptr;
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
vehicle->flags.unset(
|
||||
VehicleFlag::stoppedBySafetyCutout, VehicleFlag::carIsBroken, VehicleFlag::trainIsBroken);
|
||||
@@ -4460,8 +4460,8 @@ namespace OpenRCT2
|
||||
for (int32_t i = 0; i <= Limits::kMaxTrainsPerRide; i++)
|
||||
{
|
||||
int32_t carIndex = 0;
|
||||
for (Vehicle* vehicle = entities.GetEntity<Vehicle>(ride.vehicles[i]); vehicle != nullptr;
|
||||
vehicle = entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
for (Vehicle* vehicle = entities.getEntity<Vehicle>(ride.vehicles[i]); vehicle != nullptr;
|
||||
vehicle = entities.getEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
VehicleColour colours = {};
|
||||
switch (ride.vehicleColourSettings)
|
||||
@@ -5013,7 +5013,7 @@ namespace OpenRCT2
|
||||
*/
|
||||
void Ride::crash(uint8_t vehicleIndex)
|
||||
{
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(vehicles[vehicleIndex]);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(vehicles[vehicleIndex]);
|
||||
|
||||
if (gLegacyScene != LegacyScene::titleSequence && vehicle != nullptr)
|
||||
{
|
||||
@@ -5059,7 +5059,7 @@ namespace OpenRCT2
|
||||
Vehicle* RideGetBrokenVehicle(const Ride& ride)
|
||||
{
|
||||
auto vehicleIndex = ride.vehicles[ride.brokenTrain];
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(vehicleIndex);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(vehicleIndex);
|
||||
if (vehicle != nullptr)
|
||||
{
|
||||
return vehicle->GetCar(ride.brokenCar);
|
||||
@@ -5233,8 +5233,8 @@ namespace OpenRCT2
|
||||
{
|
||||
for (auto entityIndex : ride.vehicles)
|
||||
{
|
||||
for (Vehicle* vehicle = getGameState().entities.TryGetEntity<Vehicle>(entityIndex); vehicle != nullptr;
|
||||
vehicle = getGameState().entities.TryGetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
for (Vehicle* vehicle = getGameState().entities.tryGetEntity<Vehicle>(entityIndex); vehicle != nullptr;
|
||||
vehicle = getGameState().entities.tryGetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
auto carEntry = vehicle->Entry();
|
||||
if (carEntry == nullptr)
|
||||
|
||||
@@ -362,14 +362,14 @@ namespace OpenRCT2
|
||||
auto spriteIndex = ride.cableLift;
|
||||
do
|
||||
{
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(spriteIndex);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(spriteIndex);
|
||||
if (vehicle == nullptr)
|
||||
{
|
||||
return;
|
||||
}
|
||||
vehicle->invalidate();
|
||||
spriteIndex = vehicle->next_vehicle_on_train;
|
||||
getGameState().entities.EntityRemove(vehicle);
|
||||
getGameState().entities.entityRemove(vehicle);
|
||||
} while (!spriteIndex.IsNull());
|
||||
}
|
||||
}
|
||||
@@ -389,14 +389,14 @@ namespace OpenRCT2
|
||||
auto spriteIndex = vehicles[i];
|
||||
while (!spriteIndex.IsNull())
|
||||
{
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(spriteIndex);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(spriteIndex);
|
||||
if (vehicle == nullptr)
|
||||
{
|
||||
break;
|
||||
}
|
||||
vehicle->invalidate();
|
||||
spriteIndex = vehicle->next_vehicle_on_train;
|
||||
getGameState().entities.EntityRemove(vehicle);
|
||||
getGameState().entities.entityRemove(vehicle);
|
||||
}
|
||||
|
||||
vehicles[i] = EntityId::GetNull();
|
||||
@@ -411,7 +411,7 @@ namespace OpenRCT2
|
||||
if (vehicle->ride == id)
|
||||
{
|
||||
vehicle->invalidate();
|
||||
getGameState().entities.EntityRemove(vehicle);
|
||||
getGameState().entities.entityRemove(vehicle);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ namespace OpenRCT2
|
||||
int32_t dh = (dx >> 8) & 0xFF;
|
||||
for (size_t i = 0; i < ride.numTrains; i++)
|
||||
{
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[i]);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[i]);
|
||||
if (vehicle == nullptr)
|
||||
continue;
|
||||
|
||||
@@ -129,7 +129,7 @@ namespace OpenRCT2
|
||||
// Check if all vehicles are ready to go
|
||||
for (size_t i = 0; i < ride.numTrains; i++)
|
||||
{
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[i]);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[i]);
|
||||
if (vehicle == nullptr)
|
||||
continue;
|
||||
|
||||
@@ -206,7 +206,7 @@ namespace OpenRCT2
|
||||
|
||||
for (size_t i = 0; i < ride.numTrains; i++)
|
||||
{
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[i]);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[i]);
|
||||
if (vehicle == nullptr)
|
||||
continue;
|
||||
|
||||
@@ -215,7 +215,7 @@ namespace OpenRCT2
|
||||
// Found a winner
|
||||
if (vehicle->num_peeps != 0)
|
||||
{
|
||||
auto* peep = getGameState().entities.GetEntity<Guest>(vehicle->peep[0]);
|
||||
auto* peep = getGameState().entities.getEntity<Guest>(vehicle->peep[0]);
|
||||
if (peep != nullptr)
|
||||
{
|
||||
ride.raceWinner = peep->id;
|
||||
@@ -242,7 +242,7 @@ namespace OpenRCT2
|
||||
// Check if all vehicles are ready to go
|
||||
for (size_t i = 0; i < ride.numTrains; i++)
|
||||
{
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[i]);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[i]);
|
||||
if (vehicle == nullptr)
|
||||
continue;
|
||||
|
||||
@@ -279,7 +279,7 @@ namespace OpenRCT2
|
||||
{
|
||||
for (size_t i = 0; i < ride.numTrains; i++)
|
||||
{
|
||||
Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(ride.vehicles[i]);
|
||||
Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(ride.vehicles[i]);
|
||||
if (vehicle == nullptr)
|
||||
continue;
|
||||
|
||||
@@ -291,7 +291,7 @@ namespace OpenRCT2
|
||||
|
||||
if (vehicle->num_peeps != 0)
|
||||
{
|
||||
auto* guest = getGameState().entities.GetEntity<Guest>(vehicle->peep[0]);
|
||||
auto* guest = getGameState().entities.getEntity<Guest>(vehicle->peep[0]);
|
||||
|
||||
// Easter egg names should only work on guests
|
||||
if (guest != nullptr)
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace OpenRCT2::TrainManager
|
||||
|
||||
while (iter != end && Entity == nullptr)
|
||||
{
|
||||
Entity = getGameState().entities.GetEntity<Vehicle>(*iter++);
|
||||
Entity = getGameState().entities.getEntity<Vehicle>(*iter++);
|
||||
if (Entity != nullptr && !Entity->IsHead())
|
||||
{
|
||||
Entity = nullptr;
|
||||
@@ -32,6 +32,6 @@ namespace OpenRCT2::TrainManager
|
||||
|
||||
View::View()
|
||||
{
|
||||
vec = &getGameState().entities.GetEntityList(EntityType::vehicle);
|
||||
vec = &getGameState().entities.getEntityList(EntityType::vehicle);
|
||||
}
|
||||
} // namespace OpenRCT2::TrainManager
|
||||
@@ -68,7 +68,7 @@ bool Vehicle::UpdateMotionCollisionDetection(const CoordsXYZ& loc, EntityId* oth
|
||||
if (otherVehicleIndex == nullptr)
|
||||
return false;
|
||||
|
||||
Vehicle* collideVehicle = getGameState().entities.GetEntity<Vehicle>(*otherVehicleIndex);
|
||||
Vehicle* collideVehicle = getGameState().entities.getEntity<Vehicle>(*otherVehicleIndex);
|
||||
if (collideVehicle == nullptr)
|
||||
return false;
|
||||
|
||||
@@ -258,8 +258,8 @@ bool Vehicle::UpdateMotionCollisionDetection(const CoordsXYZ& loc, EntityId* oth
|
||||
*/
|
||||
void Vehicle::ReverseReverserCar()
|
||||
{
|
||||
Vehicle* previousVehicle = getGameState().entities.GetEntity<Vehicle>(prev_vehicle_on_ride);
|
||||
Vehicle* nextVehicle = getGameState().entities.GetEntity<Vehicle>(next_vehicle_on_ride);
|
||||
Vehicle* previousVehicle = getGameState().entities.getEntity<Vehicle>(prev_vehicle_on_ride);
|
||||
Vehicle* nextVehicle = getGameState().entities.getEntity<Vehicle>(next_vehicle_on_ride);
|
||||
if (previousVehicle == nullptr || nextVehicle == nullptr)
|
||||
{
|
||||
return;
|
||||
|
||||
@@ -112,8 +112,8 @@ void Vehicle::UpdateCollisionSetup()
|
||||
KillAllPassengersInTrain();
|
||||
|
||||
Vehicle* lastVehicle = this;
|
||||
for (Vehicle* train = getGameState().entities.GetEntity<Vehicle>(id); train != nullptr;
|
||||
train = getGameState().entities.GetEntity<Vehicle>(train->next_vehicle_on_train))
|
||||
for (Vehicle* train = getGameState().entities.getEntity<Vehicle>(id); train != nullptr;
|
||||
train = getGameState().entities.getEntity<Vehicle>(train->next_vehicle_on_train))
|
||||
{
|
||||
lastVehicle = train;
|
||||
|
||||
@@ -147,8 +147,8 @@ void Vehicle::UpdateCollisionSetup()
|
||||
}
|
||||
|
||||
// Remove the current train from the ride linked list of trains
|
||||
auto prevTrain = getGameState().entities.GetEntity<Vehicle>(prev_vehicle_on_ride);
|
||||
auto nextTrain = getGameState().entities.GetEntity<Vehicle>(lastVehicle->next_vehicle_on_ride);
|
||||
auto prevTrain = getGameState().entities.getEntity<Vehicle>(prev_vehicle_on_ride);
|
||||
auto nextTrain = getGameState().entities.getEntity<Vehicle>(lastVehicle->next_vehicle_on_ride);
|
||||
if (prevTrain == nullptr || nextTrain == nullptr)
|
||||
{
|
||||
LOG_ERROR("Corrupted vehicle list for ride!");
|
||||
@@ -187,7 +187,7 @@ void Vehicle::UpdateCrashSetup()
|
||||
auto spriteId = id;
|
||||
for (Vehicle* trainVehicle; !spriteId.IsNull(); spriteId = trainVehicle->next_vehicle_on_train)
|
||||
{
|
||||
trainVehicle = getGameState().entities.GetEntity<Vehicle>(spriteId);
|
||||
trainVehicle = getGameState().entities.getEntity<Vehicle>(spriteId);
|
||||
if (trainVehicle == nullptr)
|
||||
{
|
||||
break;
|
||||
@@ -225,8 +225,8 @@ void Vehicle::UpdateCrashSetup()
|
||||
}
|
||||
|
||||
// Remove the current train from the ride linked list of trains
|
||||
auto prevTrain = getGameState().entities.GetEntity<Vehicle>(prev_vehicle_on_ride);
|
||||
auto nextTrain = getGameState().entities.GetEntity<Vehicle>(lastVehicle->next_vehicle_on_ride);
|
||||
auto prevTrain = getGameState().entities.getEntity<Vehicle>(prev_vehicle_on_ride);
|
||||
auto nextTrain = getGameState().entities.getEntity<Vehicle>(lastVehicle->next_vehicle_on_ride);
|
||||
if (prevTrain == nullptr || nextTrain == nullptr)
|
||||
{
|
||||
LOG_ERROR("Corrupted vehicle list for ride!");
|
||||
@@ -321,8 +321,8 @@ void Vehicle::KillAllPassengersInTrain()
|
||||
|
||||
ride_train_crash(*curRide, NumPeepsUntilTrainTail());
|
||||
|
||||
for (Vehicle* trainCar = getGameState().entities.GetEntity<Vehicle>(id); trainCar != nullptr;
|
||||
trainCar = getGameState().entities.GetEntity<Vehicle>(trainCar->next_vehicle_on_train))
|
||||
for (Vehicle* trainCar = getGameState().entities.getEntity<Vehicle>(id); trainCar != nullptr;
|
||||
trainCar = getGameState().entities.getEntity<Vehicle>(trainCar->next_vehicle_on_train))
|
||||
{
|
||||
trainCar->KillPassengers(*curRide);
|
||||
}
|
||||
@@ -338,7 +338,7 @@ void Vehicle::KillPassengers(const Ride& curRide)
|
||||
|
||||
for (auto i = 0; i < num_peeps; i++)
|
||||
{
|
||||
auto* curPeep = getGameState().entities.GetEntity<Guest>(peep[i]);
|
||||
auto* curPeep = getGameState().entities.getEntity<Guest>(peep[i]);
|
||||
if (curPeep == nullptr)
|
||||
continue;
|
||||
|
||||
@@ -498,8 +498,8 @@ void Vehicle::CrashOnWater()
|
||||
*/
|
||||
void Vehicle::UpdateCrash()
|
||||
{
|
||||
for (Vehicle* curVehicle = getGameState().entities.GetEntity<Vehicle>(id); curVehicle != nullptr;
|
||||
curVehicle = getGameState().entities.GetEntity<Vehicle>(curVehicle->next_vehicle_on_train))
|
||||
for (Vehicle* curVehicle = getGameState().entities.getEntity<Vehicle>(id); curVehicle != nullptr;
|
||||
curVehicle = getGameState().entities.getEntity<Vehicle>(curVehicle->next_vehicle_on_train))
|
||||
{
|
||||
CoordsXYZ curPos = curVehicle->getLocation();
|
||||
|
||||
|
||||
@@ -217,7 +217,7 @@ int32_t Vehicle::UpdateMotionDodgems()
|
||||
velocity = 0;
|
||||
uint8_t direction = orientation | 1;
|
||||
|
||||
Vehicle* collideVehicle = getGameState().entities.GetEntity<Vehicle>(collideSprite.value());
|
||||
Vehicle* collideVehicle = getGameState().entities.getEntity<Vehicle>(collideSprite.value());
|
||||
if (collideVehicle != nullptr)
|
||||
{
|
||||
var_34 = (ScenarioRand() & 1) ? 1 : -1;
|
||||
|
||||
@@ -89,7 +89,7 @@ void OpenRCT2::RideUpdateMeasurementsSpecialElements_MiniGolf(Ride& ride, const
|
||||
if (miniGolfFlags.has(MiniGolfFlag::flag0))
|
||||
{
|
||||
auto vehicleIdx = IsHead() ? next_vehicle_on_ride : prev_vehicle_on_ride;
|
||||
Vehicle* vEDI = getGameState().entities.GetEntity<Vehicle>(vehicleIdx);
|
||||
Vehicle* vEDI = getGameState().entities.getEntity<Vehicle>(vehicleIdx);
|
||||
if (vEDI == nullptr)
|
||||
{
|
||||
return UpdateMiniGolfSubroutineStatus::stop;
|
||||
@@ -135,7 +135,7 @@ void OpenRCT2::RideUpdateMeasurementsSpecialElements_MiniGolf(Ride& ride, const
|
||||
if (miniGolfFlags.has(MiniGolfFlag::flag1))
|
||||
{
|
||||
auto vehicleIdx = IsHead() ? next_vehicle_on_ride : prev_vehicle_on_ride;
|
||||
Vehicle* vEDI = getGameState().entities.GetEntity<Vehicle>(vehicleIdx);
|
||||
Vehicle* vEDI = getGameState().entities.getEntity<Vehicle>(vehicleIdx);
|
||||
if (vEDI == nullptr)
|
||||
{
|
||||
return UpdateMiniGolfSubroutineStatus::stop;
|
||||
@@ -184,7 +184,7 @@ void OpenRCT2::RideUpdateMeasurementsSpecialElements_MiniGolf(Ride& ride, const
|
||||
|
||||
for (;;)
|
||||
{
|
||||
vEDI = getGameState().entities.GetEntity<Vehicle>(vEDI->prev_vehicle_on_ride);
|
||||
vEDI = getGameState().entities.getEntity<Vehicle>(vEDI->prev_vehicle_on_ride);
|
||||
if (vEDI == this || vEDI == nullptr)
|
||||
{
|
||||
break;
|
||||
@@ -271,7 +271,7 @@ void OpenRCT2::RideUpdateMeasurementsSpecialElements_MiniGolf(Ride& ride, const
|
||||
|
||||
if (!IsHead())
|
||||
{
|
||||
Vehicle* prevVehicle = getGameState().entities.GetEntity<Vehicle>(prev_vehicle_on_ride);
|
||||
Vehicle* prevVehicle = getGameState().entities.getEntity<Vehicle>(prev_vehicle_on_ride);
|
||||
if (prevVehicle != nullptr)
|
||||
{
|
||||
TrackSubposition = prevVehicle->TrackSubposition;
|
||||
@@ -353,7 +353,7 @@ void OpenRCT2::RideUpdateMeasurementsSpecialElements_MiniGolf(Ride& ride, const
|
||||
// When the ride is closed occasionally the peep is removed
|
||||
// but the vehicle is still on the track. This will prevent
|
||||
// it from crashing in that situation.
|
||||
auto* curPeep = getGameState().entities.TryGetEntity<Guest>(peep[0]);
|
||||
auto* curPeep = getGameState().entities.tryGetEntity<Guest>(peep[0]);
|
||||
if (curPeep != nullptr)
|
||||
{
|
||||
if (animation == MiniGolfAnimation::swingLeft)
|
||||
@@ -507,7 +507,7 @@ void OpenRCT2::RideUpdateMeasurementsSpecialElements_MiniGolf(Ride& ride, const
|
||||
_vehicleRemainingDistance -= remaining_distance - 0x368A;
|
||||
remaining_distance = 0x368A;
|
||||
{
|
||||
Vehicle* vEBP = getGameState().entities.GetEntity<Vehicle>(otherVehicleIndex);
|
||||
Vehicle* vEBP = getGameState().entities.getEntity<Vehicle>(otherVehicleIndex);
|
||||
if (vEBP == nullptr)
|
||||
{
|
||||
return UpdateMiniGolfSubroutineStatus::stop;
|
||||
@@ -644,7 +644,7 @@ int32_t Vehicle::UpdateTrackMotionMiniGolfCalculateAcceleration(const CarEntry&
|
||||
uint16_t totalMass = 0;
|
||||
|
||||
for (Vehicle* vehicle = this; vehicle != nullptr;
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
numVehicles++;
|
||||
totalMass += vehicle->mass;
|
||||
@@ -711,7 +711,7 @@ int32_t Vehicle::UpdateTrackMotionMiniGolf(int32_t* outStation)
|
||||
}
|
||||
if (_vehicleVelocity >= 0)
|
||||
{
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_train);
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(vehicle->next_vehicle_on_train);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -719,7 +719,7 @@ int32_t Vehicle::UpdateTrackMotionMiniGolf(int32_t* outStation)
|
||||
{
|
||||
break;
|
||||
}
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->prev_vehicle_on_ride);
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(vehicle->prev_vehicle_on_ride);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -212,8 +212,8 @@ namespace OpenRCT2
|
||||
if (velocity > -2.75_mph)
|
||||
return SoundId::null;
|
||||
|
||||
for (Vehicle* vehicle2 = getGameState().entities.GetEntity<Vehicle>(id); vehicle2 != nullptr;
|
||||
vehicle2 = getGameState().entities.GetEntity<Vehicle>(vehicle2->next_vehicle_on_train))
|
||||
for (Vehicle* vehicle2 = getGameState().entities.getEntity<Vehicle>(id); vehicle2 != nullptr;
|
||||
vehicle2 = getGameState().entities.getEntity<Vehicle>(vehicle2->next_vehicle_on_train))
|
||||
{
|
||||
if (vehicle2->pitch < VehiclePitch::up12)
|
||||
continue;
|
||||
@@ -234,8 +234,8 @@ namespace OpenRCT2
|
||||
if (velocity < 2.75_mph)
|
||||
return SoundId::null;
|
||||
|
||||
for (Vehicle* vehicle2 = getGameState().entities.GetEntity<Vehicle>(id); vehicle2 != nullptr;
|
||||
vehicle2 = getGameState().entities.GetEntity<Vehicle>(vehicle2->next_vehicle_on_train))
|
||||
for (Vehicle* vehicle2 = getGameState().entities.getEntity<Vehicle>(id); vehicle2 != nullptr;
|
||||
vehicle2 = getGameState().entities.getEntity<Vehicle>(vehicle2->next_vehicle_on_train))
|
||||
{
|
||||
if (vehicle2->pitch < VehiclePitch::down12)
|
||||
continue;
|
||||
|
||||
@@ -102,7 +102,7 @@ static bool try_add_synchronised_station(const CoordsXYZ& coords)
|
||||
// Look for a vehicle on this station waiting to depart.
|
||||
for (int32_t i = 0; i < ride->numTrains; i++)
|
||||
{
|
||||
auto* vehicle = getGameState().entities.GetEntity<Vehicle>(ride->vehicles[i]);
|
||||
auto* vehicle = getGameState().entities.getEntity<Vehicle>(ride->vehicles[i]);
|
||||
if (vehicle == nullptr)
|
||||
{
|
||||
continue;
|
||||
@@ -240,7 +240,7 @@ static bool ride_station_can_depart_synchronised(const Ride& ride, StationIndex
|
||||
{
|
||||
for (int32_t i = 0; i < curRide->numTrains; i++)
|
||||
{
|
||||
Vehicle* v = getGameState().entities.GetEntity<Vehicle>(curRide->vehicles[i]);
|
||||
Vehicle* v = getGameState().entities.getEntity<Vehicle>(curRide->vehicles[i]);
|
||||
if (v == nullptr)
|
||||
{
|
||||
continue;
|
||||
@@ -278,7 +278,7 @@ static bool ride_station_can_depart_synchronised(const Ride& ride, StationIndex
|
||||
auto currentStation = sv->stationIndex;
|
||||
for (int32_t i = 0; i < sv_ride->numTrains; i++)
|
||||
{
|
||||
auto* otherVehicle = getGameState().entities.GetEntity<Vehicle>(sv_ride->vehicles[i]);
|
||||
auto* otherVehicle = getGameState().entities.getEntity<Vehicle>(sv_ride->vehicles[i]);
|
||||
if (otherVehicle == nullptr)
|
||||
{
|
||||
continue;
|
||||
@@ -322,7 +322,7 @@ static bool ride_station_can_depart_synchronised(const Ride& ride, StationIndex
|
||||
// At this point all vehicles in _snychronisedVehicles can depart.
|
||||
for (SynchronisedVehicle* sv = _synchronisedVehicles; sv < _lastSynchronisedVehicle; sv++)
|
||||
{
|
||||
auto v = getGameState().entities.GetEntity<Vehicle>(sv->vehicle_id);
|
||||
auto v = getGameState().entities.getEntity<Vehicle>(sv->vehicle_id);
|
||||
if (v != nullptr)
|
||||
{
|
||||
v->flags.unset(VehicleFlag::waitingOnAdjacentStation);
|
||||
@@ -559,8 +559,8 @@ void Vehicle::UpdateWaitingForPassengers()
|
||||
// 0xF64E31, 0xF64E32, 0xF64E33
|
||||
uint8_t num_peeps_on_train = 0, num_used_seats_on_train = 0, num_seats_on_train = 0;
|
||||
|
||||
for (const Vehicle* trainCar = getGameState().entities.GetEntity<Vehicle>(id); trainCar != nullptr;
|
||||
trainCar = getGameState().entities.GetEntity<Vehicle>(trainCar->next_vehicle_on_train))
|
||||
for (const Vehicle* trainCar = getGameState().entities.getEntity<Vehicle>(id); trainCar != nullptr;
|
||||
trainCar = getGameState().entities.getEntity<Vehicle>(trainCar->next_vehicle_on_train))
|
||||
{
|
||||
num_peeps_on_train += trainCar->num_peeps;
|
||||
num_used_seats_on_train += trainCar->next_free_seat;
|
||||
@@ -614,7 +614,7 @@ void Vehicle::UpdateWaitingForPassengers()
|
||||
if (train_id == id)
|
||||
continue;
|
||||
|
||||
Vehicle* train = getGameState().entities.GetEntity<Vehicle>(train_id);
|
||||
Vehicle* train = getGameState().entities.getEntity<Vehicle>(train_id);
|
||||
if (train == nullptr)
|
||||
continue;
|
||||
|
||||
@@ -729,8 +729,8 @@ void Vehicle::UpdateWaitingToDepart()
|
||||
}
|
||||
else
|
||||
{
|
||||
for (const Vehicle* trainCar = getGameState().entities.GetEntity<Vehicle>(id); trainCar != nullptr;
|
||||
trainCar = getGameState().entities.GetEntity<Vehicle>(trainCar->next_vehicle_on_train))
|
||||
for (const Vehicle* trainCar = getGameState().entities.getEntity<Vehicle>(id); trainCar != nullptr;
|
||||
trainCar = getGameState().entities.getEntity<Vehicle>(trainCar->next_vehicle_on_train))
|
||||
{
|
||||
if (trainCar->num_peeps != 0)
|
||||
{
|
||||
@@ -929,7 +929,7 @@ void Vehicle::UpdateUnloadingPassengers()
|
||||
{
|
||||
next_free_seat -= 2;
|
||||
|
||||
auto firstGuest = getGameState().entities.GetEntity<Guest>(peep[seat * 2]);
|
||||
auto firstGuest = getGameState().entities.getEntity<Guest>(peep[seat * 2]);
|
||||
peep[seat * 2] = EntityId::GetNull();
|
||||
|
||||
if (firstGuest != nullptr)
|
||||
@@ -938,7 +938,7 @@ void Vehicle::UpdateUnloadingPassengers()
|
||||
firstGuest->rideSubState = PeepRideSubState::leaveVehicle;
|
||||
}
|
||||
|
||||
auto secondGuest = getGameState().entities.GetEntity<Guest>(peep[seat * 2 + 1]);
|
||||
auto secondGuest = getGameState().entities.getEntity<Guest>(peep[seat * 2 + 1]);
|
||||
peep[seat * 2 + 1] = EntityId::GetNull();
|
||||
|
||||
if (secondGuest != nullptr)
|
||||
@@ -964,8 +964,8 @@ void Vehicle::UpdateUnloadingPassengers()
|
||||
return;
|
||||
}
|
||||
|
||||
for (Vehicle* train = getGameState().entities.GetEntity<Vehicle>(id); train != nullptr;
|
||||
train = getGameState().entities.GetEntity<Vehicle>(train->next_vehicle_on_train))
|
||||
for (Vehicle* train = getGameState().entities.getEntity<Vehicle>(id); train != nullptr;
|
||||
train = getGameState().entities.getEntity<Vehicle>(train->next_vehicle_on_train))
|
||||
{
|
||||
if (train->restraints_position != 255)
|
||||
continue;
|
||||
@@ -976,7 +976,7 @@ void Vehicle::UpdateUnloadingPassengers()
|
||||
train->next_free_seat = 0;
|
||||
for (uint8_t peepIndex = 0; peepIndex < train->num_peeps; peepIndex++)
|
||||
{
|
||||
Peep* curPeep = getGameState().entities.GetEntity<Guest>(train->peep[peepIndex]);
|
||||
Peep* curPeep = getGameState().entities.getEntity<Guest>(train->peep[peepIndex]);
|
||||
if (curPeep != nullptr)
|
||||
{
|
||||
curPeep->setState(PeepState::leavingRide);
|
||||
@@ -989,8 +989,8 @@ void Vehicle::UpdateUnloadingPassengers()
|
||||
if (sub_state != 1)
|
||||
return;
|
||||
|
||||
for (Vehicle* train = getGameState().entities.GetEntity<Vehicle>(id); train != nullptr;
|
||||
train = getGameState().entities.GetEntity<Vehicle>(train->next_vehicle_on_train))
|
||||
for (Vehicle* train = getGameState().entities.getEntity<Vehicle>(id); train != nullptr;
|
||||
train = getGameState().entities.getEntity<Vehicle>(train->next_vehicle_on_train))
|
||||
{
|
||||
if (train->num_peeps != train->next_free_seat)
|
||||
return;
|
||||
|
||||
@@ -373,11 +373,11 @@ namespace OpenRCT2
|
||||
{
|
||||
if (IsOnCoveredTrack())
|
||||
{
|
||||
Vehicle* nextVehicle = getGameState().entities.GetEntity<Vehicle>(next_vehicle_on_ride);
|
||||
Vehicle* nextVehicle = getGameState().entities.getEntity<Vehicle>(next_vehicle_on_ride);
|
||||
if (nextVehicle == nullptr)
|
||||
return;
|
||||
|
||||
Vehicle* nextNextVehicle = getGameState().entities.GetEntity<Vehicle>(
|
||||
Vehicle* nextNextVehicle = getGameState().entities.getEntity<Vehicle>(
|
||||
nextVehicle->next_vehicle_on_ride);
|
||||
if (nextNextVehicle == nullptr)
|
||||
return;
|
||||
@@ -933,7 +933,7 @@ namespace OpenRCT2
|
||||
remaining_distance = -1;
|
||||
|
||||
// Might need to be bp rather than this, but hopefully not
|
||||
auto otherVeh = getGameState().entities.GetEntity<Vehicle>(otherVehicleIndex);
|
||||
auto otherVeh = getGameState().entities.getEntity<Vehicle>(otherVehicleIndex);
|
||||
if (otherVeh == nullptr)
|
||||
{
|
||||
// This can never happen as prev_vehicle_on_ride will always be set to a vehicle
|
||||
@@ -1229,7 +1229,7 @@ namespace OpenRCT2
|
||||
_vehicleRemainingDistance -= remaining_distance - 0x368A;
|
||||
remaining_distance = 0x368A;
|
||||
|
||||
Vehicle* v3 = getGameState().entities.GetEntity<Vehicle>(otherVehicleIndex);
|
||||
Vehicle* v3 = getGameState().entities.getEntity<Vehicle>(otherVehicleIndex);
|
||||
Vehicle* v4 = gCurrentVehicle;
|
||||
if (v3 == nullptr)
|
||||
{
|
||||
@@ -1494,7 +1494,7 @@ namespace OpenRCT2
|
||||
auto spriteId = vehicle->id;
|
||||
while (!spriteId.IsNull())
|
||||
{
|
||||
Vehicle* car = getGameState().entities.GetEntity<Vehicle>(spriteId);
|
||||
Vehicle* car = getGameState().entities.getEntity<Vehicle>(spriteId);
|
||||
if (car == nullptr)
|
||||
{
|
||||
break;
|
||||
@@ -1542,7 +1542,7 @@ namespace OpenRCT2
|
||||
// ebx
|
||||
int32_t numVehicles = 0;
|
||||
|
||||
for (; vehicle != nullptr; vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
for (; vehicle != nullptr; vehicle = getGameState().entities.getEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
numVehicles++;
|
||||
totalMass += vehicle->mass;
|
||||
|
||||
@@ -218,7 +218,7 @@ namespace OpenRCT2
|
||||
|
||||
Vehicle* TryGetVehicle(EntityId spriteIndex)
|
||||
{
|
||||
return getGameState().entities.TryGetEntity<Vehicle>(spriteIndex);
|
||||
return getGameState().entities.tryGetEntity<Vehicle>(spriteIndex);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -253,8 +253,8 @@ namespace OpenRCT2
|
||||
return true;
|
||||
|
||||
bool restraintsClosed = true;
|
||||
for (Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(id); vehicle != nullptr;
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
for (Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(id); vehicle != nullptr;
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
if (vehicle->flags.has(VehicleFlag::carIsBroken) && vehicle->restraints_position != 0
|
||||
&& (curRide->breakdownReasonPending == Breakdown::restraintsStuckOpen
|
||||
@@ -271,7 +271,7 @@ namespace OpenRCT2
|
||||
|
||||
curRide->mechanicStatus = MechanicStatus::calling;
|
||||
|
||||
Vehicle* broken_vehicle = getGameState().entities.GetEntity<Vehicle>(
|
||||
Vehicle* broken_vehicle = getGameState().entities.getEntity<Vehicle>(
|
||||
curRide->vehicles[curRide->brokenTrain]);
|
||||
if (broken_vehicle != nullptr)
|
||||
{
|
||||
@@ -303,8 +303,8 @@ namespace OpenRCT2
|
||||
bool Vehicle::OpenRestraints()
|
||||
{
|
||||
int32_t restraintsOpen = true;
|
||||
for (Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(id); vehicle != nullptr;
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
for (Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(id); vehicle != nullptr;
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
vehicle->SwingPosition = 0;
|
||||
vehicle->SwingSpeed = 0;
|
||||
@@ -389,7 +389,7 @@ namespace OpenRCT2
|
||||
|
||||
curRide->mechanicStatus = MechanicStatus::calling;
|
||||
|
||||
Vehicle* broken_vehicle = getGameState().entities.GetEntity<Vehicle>(
|
||||
Vehicle* broken_vehicle = getGameState().entities.getEntity<Vehicle>(
|
||||
curRide->vehicles[curRide->brokenTrain]);
|
||||
if (broken_vehicle != nullptr)
|
||||
{
|
||||
@@ -892,12 +892,12 @@ namespace OpenRCT2
|
||||
*/
|
||||
void Vehicle::PeepEasterEggHereWeAre() const
|
||||
{
|
||||
for (Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(id); vehicle != nullptr;
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
for (Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(id); vehicle != nullptr;
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
for (int32_t i = 0; i < vehicle->num_peeps; ++i)
|
||||
{
|
||||
auto* curPeep = getGameState().entities.GetEntity<Guest>(vehicle->peep[i]);
|
||||
auto* curPeep = getGameState().entities.getEntity<Guest>(vehicle->peep[i]);
|
||||
if (curPeep != nullptr && curPeep->peepFlags.has(PeepFlag::hereWeAre))
|
||||
{
|
||||
curPeep->insertNewThought(PeepThoughtType::hereWeAre, curPeep->currentRide);
|
||||
@@ -1048,7 +1048,7 @@ namespace OpenRCT2
|
||||
if (curRide == nullptr)
|
||||
return;
|
||||
|
||||
Vehicle* cableLift = getGameState().entities.GetEntity<Vehicle>(curRide->cableLift);
|
||||
Vehicle* cableLift = getGameState().entities.getEntity<Vehicle>(curRide->cableLift);
|
||||
if (cableLift == nullptr)
|
||||
return;
|
||||
|
||||
@@ -1217,7 +1217,7 @@ namespace OpenRCT2
|
||||
|
||||
for (;;)
|
||||
{
|
||||
prevVehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->prev_vehicle_on_ride);
|
||||
prevVehicle = getGameState().entities.getEntity<Vehicle>(vehicle->prev_vehicle_on_ride);
|
||||
if (prevVehicle == nullptr)
|
||||
return nullptr;
|
||||
if (prevVehicle->next_vehicle_on_train.IsNull())
|
||||
@@ -1236,7 +1236,7 @@ namespace OpenRCT2
|
||||
EntityId spriteIndex = vehicle->next_vehicle_on_train;
|
||||
while (!spriteIndex.IsNull())
|
||||
{
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(spriteIndex);
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(spriteIndex);
|
||||
if (vehicle == nullptr)
|
||||
{
|
||||
return const_cast<Vehicle*>(this);
|
||||
@@ -1280,8 +1280,8 @@ namespace OpenRCT2
|
||||
int32_t Vehicle::NumPeepsUntilTrainTail() const
|
||||
{
|
||||
int32_t numPeeps = 0;
|
||||
for (const Vehicle* vehicle = getGameState().entities.GetEntity<Vehicle>(id); vehicle != nullptr;
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
for (const Vehicle* vehicle = getGameState().entities.getEntity<Vehicle>(id); vehicle != nullptr;
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
numPeeps += vehicle->num_peeps;
|
||||
}
|
||||
@@ -1445,7 +1445,7 @@ namespace OpenRCT2
|
||||
auto v = this;
|
||||
while (v != nullptr && !v->IsHead())
|
||||
{
|
||||
v = getGameState().entities.GetEntity<Vehicle>(v->prev_vehicle_on_ride);
|
||||
v = getGameState().entities.getEntity<Vehicle>(v->prev_vehicle_on_ride);
|
||||
}
|
||||
return v;
|
||||
}
|
||||
@@ -1460,7 +1460,7 @@ namespace OpenRCT2
|
||||
auto car = const_cast<Vehicle*>(this);
|
||||
for (; carIndex != 0; carIndex--)
|
||||
{
|
||||
car = getGameState().entities.GetEntity<Vehicle>(car->next_vehicle_on_train);
|
||||
car = getGameState().entities.getEntity<Vehicle>(car->next_vehicle_on_train);
|
||||
if (car == nullptr)
|
||||
{
|
||||
LOG_ERROR("Tried to get non-existent car from index!");
|
||||
@@ -1487,7 +1487,7 @@ namespace OpenRCT2
|
||||
{
|
||||
assert(this->IsHead());
|
||||
for (auto vehicle = this; vehicle != nullptr;
|
||||
vehicle = getGameState().entities.GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
vehicle = getGameState().entities.getEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
vehicle->flags.unset(VehicleFlag::collisionDisabled);
|
||||
}
|
||||
|
||||
@@ -137,7 +137,7 @@ int32_t Vehicle::CalculateRiderBraking() const
|
||||
RiderControlSettings riderSettings = riderTable[peep[0].ToUnderlying() & 0xFF];
|
||||
|
||||
// Brake if close to the vehicle in front
|
||||
Vehicle* prevVehicle = getGameState().entities.GetEntity<Vehicle>(prev_vehicle_on_ride);
|
||||
Vehicle* prevVehicle = getGameState().entities.getEntity<Vehicle>(prev_vehicle_on_ride);
|
||||
if (prevVehicle != nullptr && this != prevVehicle && _vehicleVelocity > minFollowVelocity)
|
||||
{
|
||||
int32_t followDistance = std::max(minFollowDistance, (riderSettings.followDistance * _vehicleVelocity) >> 15);
|
||||
|
||||
@@ -186,7 +186,7 @@ void EditorScene::clearMapForEditing()
|
||||
}
|
||||
|
||||
auto& gameState = getGameState();
|
||||
gameState.entities.ResetAllEntities();
|
||||
gameState.entities.resetAllEntities();
|
||||
|
||||
UpdateConsolidatedPatrolAreas();
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRCT2::Scripting
|
||||
Balloon* ScBalloon::GetBalloon(JSValue thisVal)
|
||||
{
|
||||
auto id = GetEntityId(thisVal);
|
||||
return getGameState().entities.GetEntity<Balloon>(id);
|
||||
return getGameState().entities.getEntity<Balloon>(id);
|
||||
}
|
||||
|
||||
JSValue ScBalloon::colour_get(JSContext* ctx, JSValue thisVal)
|
||||
|
||||
@@ -172,7 +172,7 @@ namespace OpenRCT2::Scripting
|
||||
case EntityType::balloon:
|
||||
case EntityType::duck:
|
||||
case EntityType::litter:
|
||||
getGameState().entities.EntityRemove(entity);
|
||||
getGameState().entities.entityRemove(entity);
|
||||
break;
|
||||
case EntityType::null:
|
||||
break;
|
||||
@@ -191,7 +191,7 @@ namespace OpenRCT2::Scripting
|
||||
EntityBase* ScEntity::GetEntity(JSValue thisVal)
|
||||
{
|
||||
auto id = GetEntityId(thisVal);
|
||||
return OpenRCT2::getGameState().entities.GetEntity(id);
|
||||
return OpenRCT2::getGameState().entities.getEntity(id);
|
||||
}
|
||||
|
||||
JSValue ScEntity::NewInstance(JSContext* ctx, EntityId entityId)
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace OpenRCT2::Scripting
|
||||
Guest* ScGuest::GetGuest(JSValue thisVal)
|
||||
{
|
||||
auto id = GetEntityId(thisVal);
|
||||
return getGameState().entities.GetEntity<Guest>(id);
|
||||
return getGameState().entities.getEntity<Guest>(id);
|
||||
}
|
||||
|
||||
JSValue ScGuest::tshirtColour_get(JSContext* ctx, JSValue thisVal)
|
||||
|
||||
@@ -52,7 +52,7 @@ namespace OpenRCT2::Scripting
|
||||
Litter* ScLitter::GetLitter(JSValue thisVal)
|
||||
{
|
||||
auto id = GetEntityId(thisVal);
|
||||
return getGameState().entities.GetEntity<Litter>(id);
|
||||
return getGameState().entities.getEntity<Litter>(id);
|
||||
}
|
||||
|
||||
JSValue ScLitter::litterType_get(JSContext* ctx, JSValue thisVal)
|
||||
|
||||
@@ -33,7 +33,7 @@ namespace OpenRCT2::Scripting
|
||||
MoneyEffect* ScMoneyEffect::GetMoneyEffect(JSValue thisVal)
|
||||
{
|
||||
auto id = GetEntityId(thisVal);
|
||||
return getGameState().entities.GetEntity<MoneyEffect>(id);
|
||||
return getGameState().entities.getEntity<MoneyEffect>(id);
|
||||
}
|
||||
|
||||
JSValue ScMoneyEffect::value_get(JSContext* ctx, JSValue thisVal)
|
||||
|
||||
@@ -54,7 +54,7 @@ namespace OpenRCT2::Scripting
|
||||
VehicleCrashParticle* ScCrashedVehicleParticle::GetCrashedVehicleParticle(JSValue thisVal)
|
||||
{
|
||||
auto id = GetEntityId(thisVal);
|
||||
return getGameState().entities.GetEntity<VehicleCrashParticle>(id);
|
||||
return getGameState().entities.getEntity<VehicleCrashParticle>(id);
|
||||
}
|
||||
|
||||
JSValue ScCrashedVehicleParticle::frame_set(JSContext* ctx, JSValue thisVal, JSValue jsValue)
|
||||
|
||||
@@ -198,7 +198,7 @@ namespace OpenRCT2::Scripting
|
||||
static Peep* GetPeep(JSValue thisVal)
|
||||
{
|
||||
auto id = GetEntityId(thisVal);
|
||||
return getGameState().entities.GetEntity<Peep>(id);
|
||||
return getGameState().entities.getEntity<Peep>(id);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -51,7 +51,7 @@ namespace OpenRCT2::Scripting
|
||||
Staff* ScStaff::GetStaff(JSValue thisVal)
|
||||
{
|
||||
auto id = GetEntityId(thisVal);
|
||||
return getGameState().entities.GetEntity<Staff>(id);
|
||||
return getGameState().entities.getEntity<Staff>(id);
|
||||
}
|
||||
|
||||
JSValue ScStaff::staffType_get(JSContext* ctx, JSValue thisVal)
|
||||
@@ -606,7 +606,7 @@ namespace OpenRCT2::Scripting
|
||||
Staff* ScPatrolArea::GetStaff(JSValue thisVal)
|
||||
{
|
||||
OpaquePatrolAreaData* data = gScPatrolArea.GetOpaque<OpaquePatrolAreaData*>(thisVal);
|
||||
return getGameState().entities.GetEntity<Staff>(data->staffId);
|
||||
return getGameState().entities.getEntity<Staff>(data->staffId);
|
||||
}
|
||||
|
||||
void ScPatrolArea::ModifyArea(JSContext* ctx, JSValue thisVal, JSValue coordsOrRange, bool reset)
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace OpenRCT2::Scripting
|
||||
Vehicle* ScVehicle::GetVehicle(JSValue thisVal)
|
||||
{
|
||||
auto id = GetEntityId(thisVal);
|
||||
return getGameState().entities.GetEntity<Vehicle>(id);
|
||||
return getGameState().entities.getEntity<Vehicle>(id);
|
||||
}
|
||||
|
||||
JSValue ScVehicle::rideObject_get(JSContext* ctx, JSValue thisVal)
|
||||
|
||||
@@ -95,7 +95,7 @@ namespace OpenRCT2::Scripting
|
||||
if (id >= 0 && id < kMaxEntities)
|
||||
{
|
||||
auto spriteId = EntityId::FromUnderlying(id);
|
||||
auto sprite = getGameState().entities.GetEntity(spriteId);
|
||||
auto sprite = getGameState().entities.getEntity(spriteId);
|
||||
if (sprite != nullptr && sprite->type != EntityType::null)
|
||||
{
|
||||
return GetEntityAsDukValue(ctx, sprite);
|
||||
@@ -123,7 +123,7 @@ namespace OpenRCT2::Scripting
|
||||
{
|
||||
for (auto carId = trainHead->id; !carId.IsNull();)
|
||||
{
|
||||
auto car = getGameState().entities.GetEntity<Vehicle>(carId);
|
||||
auto car = getGameState().entities.getEntity<Vehicle>(carId);
|
||||
|
||||
if (car == nullptr)
|
||||
{
|
||||
@@ -186,7 +186,7 @@ namespace OpenRCT2::Scripting
|
||||
{
|
||||
for (auto sprite : EntityList<Staff>())
|
||||
{
|
||||
auto staff = getGameState().entities.GetEntity<Staff>(sprite->id);
|
||||
auto staff = getGameState().entities.getEntity<Staff>(sprite->id);
|
||||
if (staff != nullptr)
|
||||
{
|
||||
switch (staff->assignedStaffType)
|
||||
@@ -286,7 +286,7 @@ namespace OpenRCT2::Scripting
|
||||
{
|
||||
for (auto sprite : EntityTileList<Staff>(pos))
|
||||
{
|
||||
auto staff = getGameState().entities.GetEntity<Staff>(sprite->id);
|
||||
auto staff = getGameState().entities.getEntity<Staff>(sprite->id);
|
||||
if (staff != nullptr)
|
||||
{
|
||||
switch (staff->assignedStaffType)
|
||||
@@ -332,7 +332,7 @@ namespace OpenRCT2::Scripting
|
||||
template<typename TEntityType, typename TScriptType>
|
||||
JSValue createEntityType(JSContext* ctx, JSValue initializer)
|
||||
{
|
||||
TEntityType* entity = getGameState().entities.CreateEntity<TEntityType>();
|
||||
TEntityType* entity = getGameState().entities.createEntity<TEntityType>();
|
||||
if (entity == nullptr)
|
||||
{
|
||||
// Probably no more space for entities for this specified entity type.
|
||||
@@ -354,7 +354,7 @@ namespace OpenRCT2::Scripting
|
||||
JSValue res;
|
||||
if (type == "car")
|
||||
{
|
||||
Vehicle* entity = getGameState().entities.CreateEntity<Vehicle>();
|
||||
Vehicle* entity = getGameState().entities.createEntity<Vehicle>();
|
||||
if (entity == nullptr)
|
||||
{
|
||||
// Probably no more space for entities for this specified entity type.
|
||||
@@ -531,7 +531,7 @@ namespace OpenRCT2::Scripting
|
||||
return ScVehicle::New(ctx, spriteId);
|
||||
case EntityType::staff:
|
||||
{
|
||||
auto staff = getGameState().entities.GetEntity<Staff>(spriteId);
|
||||
auto staff = getGameState().entities.getEntity<Staff>(spriteId);
|
||||
if (staff != nullptr)
|
||||
{
|
||||
switch (staff->assignedStaffType)
|
||||
|
||||
@@ -144,7 +144,7 @@ namespace OpenRCT2
|
||||
for (auto* litter : removals)
|
||||
{
|
||||
litter->invalidate();
|
||||
getGameState().entities.EntityRemove(litter);
|
||||
getGameState().entities.entityRemove(litter);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2195,10 +2195,10 @@ namespace OpenRCT2
|
||||
for (auto i = 0; i < EnumValue(EntityType::count); i++)
|
||||
{
|
||||
auto entityType = static_cast<EntityType>(i);
|
||||
auto& list = getGameState().entities.GetEntityList(entityType);
|
||||
auto& list = getGameState().entities.getEntityList(entityType);
|
||||
for (const auto& entityId : list)
|
||||
{
|
||||
auto entity = getGameState().entities.GetEntity(entityId);
|
||||
auto entity = getGameState().entities.getEntity(entityId);
|
||||
|
||||
// Do not tween the entity
|
||||
entityTweener.RemoveEntity(entity);
|
||||
|
||||
@@ -48,15 +48,15 @@ protected:
|
||||
TEST_F(EntityImportTests, CreateEntityAtDuplicateIndexReturnsNull)
|
||||
{
|
||||
auto& gameState = getGameState();
|
||||
gameState.entities.ResetAllEntities();
|
||||
gameState.entities.resetAllEntities();
|
||||
|
||||
// Create an entity at index 100
|
||||
auto* entity1 = gameState.entities.CreateEntityAt<Guest>(EntityId::FromUnderlying(100));
|
||||
auto* entity1 = gameState.entities.createEntityAt<Guest>(EntityId::FromUnderlying(100));
|
||||
ASSERT_NE(entity1, nullptr);
|
||||
EXPECT_EQ(entity1->id.ToUnderlying(), 100u);
|
||||
|
||||
// Try to create another entity at the same index, which should return nullptr
|
||||
auto* entity2 = gameState.entities.CreateEntityAt<Guest>(EntityId::FromUnderlying(100));
|
||||
auto* entity2 = gameState.entities.createEntityAt<Guest>(EntityId::FromUnderlying(100));
|
||||
EXPECT_EQ(entity2, nullptr);
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ static std::unique_ptr<IContext> localStartGame(const std::string& parkPath)
|
||||
auto& gameState = getGameState();
|
||||
importer->Import(gameState);
|
||||
|
||||
gameState.entities.ResetEntitySpatialIndices();
|
||||
gameState.entities.resetEntitySpatialIndices();
|
||||
|
||||
ResetAllSpriteQuadrantPlacements();
|
||||
LoadPalette();
|
||||
|
||||
@@ -57,7 +57,7 @@ static void GameInit(bool retainSpatialIndices)
|
||||
{
|
||||
auto& gameState = getGameState();
|
||||
if (!retainSpatialIndices)
|
||||
gameState.entities.ResetEntitySpatialIndices();
|
||||
gameState.entities.resetEntitySpatialIndices();
|
||||
|
||||
ResetAllSpriteQuadrantPlacements();
|
||||
LoadPalette();
|
||||
|
||||
Reference in new issue
Block a user