mirror of https://github.com/OpenRCT2/OpenRCT2.git
Refactor sprite_index to Id
This commit is contained in:
parent
17ce2d759f
commit
2f8e208a9d
|
@ -464,7 +464,7 @@ public:
|
|||
if (ride == nullptr || viewVehicleIndex < 0 || viewVehicleIndex >= ride->NumTrains)
|
||||
return;
|
||||
|
||||
if (vehicle->sprite_index != ride->vehicles[viewVehicleIndex])
|
||||
if (vehicle->Id != ride->vehicles[viewVehicleIndex])
|
||||
return;
|
||||
|
||||
w->Invalidate();
|
||||
|
|
|
@ -206,7 +206,7 @@ bool ViewportInteractionLeftClick(const ScreenCoordsXY& screenCoords)
|
|||
{
|
||||
if (GameIsNotPaused())
|
||||
{
|
||||
auto balloonPress = BalloonPressAction(entity->sprite_index);
|
||||
auto balloonPress = BalloonPressAction(entity->Id);
|
||||
GameActions::Execute(&balloonPress);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -194,7 +194,7 @@ namespace OpenRCT2::Scripting
|
|||
|
||||
if (info.SpriteType == ViewportInteractionItem::Entity && info.Entity != nullptr)
|
||||
{
|
||||
obj.Set("entityId", info.Entity->sprite_index.ToUnderlying());
|
||||
obj.Set("entityId", info.Entity->Id.ToUnderlying());
|
||||
}
|
||||
else if (info.Element != nullptr)
|
||||
{
|
||||
|
|
|
@ -1834,7 +1834,7 @@ private:
|
|||
+ ScreenCoordsXY{ widgets[WIDX_PAGE_BACKGROUND].left + 4, widgets[WIDX_PAGE_BACKGROUND].top + 4 };
|
||||
{
|
||||
auto ft = Formatter();
|
||||
ft.Add<uint32_t>(peep->sprite_index);
|
||||
ft.Add<uint32_t>(peep->Id);
|
||||
DrawTextBasic(&dpi, screenCoords, STR_PEEP_DEBUG_SPRITE_INDEX, ft);
|
||||
}
|
||||
screenCoords.y += LIST_ROW_HEIGHT;
|
||||
|
@ -1919,7 +1919,7 @@ WindowBase* WindowGuestOpen(Peep* peep)
|
|||
return WindowStaffOpen(peep);
|
||||
}
|
||||
|
||||
auto* window = static_cast<GuestWindow*>(WindowBringToFrontByNumber(WindowClass::Peep, peep->sprite_index.ToUnderlying()));
|
||||
auto* window = static_cast<GuestWindow*>(WindowBringToFrontByNumber(WindowClass::Peep, peep->Id.ToUnderlying()));
|
||||
if (window == nullptr)
|
||||
{
|
||||
int32_t windowWidth = 192;
|
||||
|
@ -1933,7 +1933,7 @@ WindowBase* WindowGuestOpen(Peep* peep)
|
|||
}
|
||||
}
|
||||
|
||||
window->Init(peep->sprite_index);
|
||||
window->Init(peep->Id);
|
||||
|
||||
return window;
|
||||
}
|
||||
|
|
|
@ -627,7 +627,7 @@ public:
|
|||
continue;
|
||||
|
||||
auto& item = _guestList.emplace_back();
|
||||
item.Id = peep->sprite_index;
|
||||
item.Id = peep->Id;
|
||||
|
||||
Formatter ft;
|
||||
peep->FormatNameTo(ft);
|
||||
|
|
|
@ -1323,7 +1323,7 @@ WindowBase* WindowRideOpenVehicle(Vehicle* vehicle)
|
|||
if (headVehicle == nullptr)
|
||||
return nullptr;
|
||||
|
||||
EntityId headVehicleSpriteIndex = headVehicle->sprite_index;
|
||||
EntityId headVehicleSpriteIndex = headVehicle->Id;
|
||||
auto ride = headVehicle->GetRide();
|
||||
if (ride == nullptr)
|
||||
return nullptr;
|
||||
|
@ -1997,7 +1997,7 @@ static void WindowRideMainFollowRide(WindowBase* w)
|
|||
Vehicle* vehicle = GetEntity<Vehicle>(ride->vehicles[w->ride.view - 1]);
|
||||
if (vehicle != nullptr)
|
||||
{
|
||||
auto headVehicleSpriteIndex = vehicle->sprite_index;
|
||||
auto headVehicleSpriteIndex = vehicle->Id;
|
||||
WindowBase* w_main = WindowGetMain();
|
||||
WindowFollowSprite(*w_main, headVehicleSpriteIndex);
|
||||
}
|
||||
|
|
|
@ -460,8 +460,7 @@ private:
|
|||
|
||||
WindowCloseByClass(WindowClass::PatrolArea);
|
||||
|
||||
auto staffSetPatrolAreaAction = StaffSetPatrolAreaAction(
|
||||
staff->sprite_index, {}, StaffSetPatrolAreaMode::ClearAll);
|
||||
auto staffSetPatrolAreaAction = StaffSetPatrolAreaAction(staff->Id, {}, StaffSetPatrolAreaMode::ClearAll);
|
||||
GameActions::Execute(&staffSetPatrolAreaAction);
|
||||
}
|
||||
else
|
||||
|
@ -499,7 +498,7 @@ private:
|
|||
widgets[WIDX_PICKUP].left = width - 25;
|
||||
widgets[WIDX_PICKUP].right = width - 2;
|
||||
|
||||
SetWidgetPressed(WIDX_PATROL, WindowPatrolAreaGetCurrentStaffId() == staff->sprite_index);
|
||||
SetWidgetPressed(WIDX_PATROL, WindowPatrolAreaGetCurrentStaffId() == staff->Id);
|
||||
|
||||
widgets[WIDX_PATROL].left = width - 25;
|
||||
widgets[WIDX_PATROL].right = width - 2;
|
||||
|
@ -1132,7 +1131,7 @@ private:
|
|||
std::optional<Focus> tempFocus;
|
||||
if (staff->State != PeepState::Picked)
|
||||
{
|
||||
tempFocus = Focus(staff->sprite_index);
|
||||
tempFocus = Focus(staff->Id);
|
||||
}
|
||||
|
||||
uint16_t viewport_flags;
|
||||
|
@ -1235,7 +1234,7 @@ private:
|
|||
|
||||
WindowBase* WindowStaffOpen(Peep* peep)
|
||||
{
|
||||
auto w = static_cast<StaffWindow*>(WindowBringToFrontByNumber(WindowClass::Peep, peep->sprite_index.ToUnderlying()));
|
||||
auto w = static_cast<StaffWindow*>(WindowBringToFrontByNumber(WindowClass::Peep, peep->Id.ToUnderlying()));
|
||||
|
||||
if (w != nullptr)
|
||||
return w;
|
||||
|
@ -1246,7 +1245,7 @@ WindowBase* WindowStaffOpen(Peep* peep)
|
|||
return nullptr;
|
||||
|
||||
if (w != nullptr)
|
||||
w->Initialise(peep->sprite_index);
|
||||
w->Initialise(peep->Id);
|
||||
|
||||
return w;
|
||||
}
|
||||
|
|
|
@ -90,6 +90,6 @@ WindowBase* WindowStaffFirePromptOpen(Peep* peep)
|
|||
// Check if the confirm window already exists
|
||||
auto* window = WindowFocusOrCreate<StaffFirePromptWindow>(
|
||||
WindowClass::FirePrompt, WW, WH, WF_CENTRE_SCREEN | WF_TRANSPARENT);
|
||||
window->SetWindowNumber(peep->sprite_index.ToUnderlying());
|
||||
window->SetWindowNumber(peep->Id.ToUnderlying());
|
||||
return window;
|
||||
}
|
||||
|
|
|
@ -487,7 +487,7 @@ public:
|
|||
if (peep->AssignedStaffType == GetSelectedStaffType())
|
||||
{
|
||||
EntitySetFlashing(peep, true);
|
||||
_staffList.push_back(peep->sprite_index);
|
||||
_staffList.push_back(peep->Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -536,8 +536,7 @@ private:
|
|||
CoordsXYZ nullLoc{};
|
||||
nullLoc.SetNull();
|
||||
|
||||
PeepPickupAction pickupAction{ PeepPickupType::Pickup, staff->sprite_index, nullLoc,
|
||||
NetworkGetCurrentPlayerId() };
|
||||
PeepPickupAction pickupAction{ PeepPickupType::Pickup, staff->Id, nullLoc, NetworkGetCurrentPlayerId() };
|
||||
pickupAction.SetCallback([&staff](const GameAction* ga, const GameActions::Result* result) {
|
||||
if (result->Error != GameActions::Status::Ok)
|
||||
return;
|
||||
|
|
|
@ -374,18 +374,18 @@ void GameFixSaveVars()
|
|||
Ride* ride = GetRide(rideIdx);
|
||||
if (ride == nullptr)
|
||||
{
|
||||
LOG_WARNING("Couldn't find ride %u, resetting ride on peep %u", rideIdx, peep->sprite_index);
|
||||
LOG_WARNING("Couldn't find ride %u, resetting ride on peep %u", rideIdx, peep->Id);
|
||||
peep->CurrentRide = RideId::GetNull();
|
||||
continue;
|
||||
}
|
||||
auto curName = peep->GetName();
|
||||
LOG_WARNING(
|
||||
"Peep %u (%s) has invalid ride station = %u for ride %u.", peep->sprite_index, curName.c_str(),
|
||||
srcStation.ToUnderlying(), rideIdx);
|
||||
"Peep %u (%s) has invalid ride station = %u for ride %u.", peep->Id, curName.c_str(), srcStation.ToUnderlying(),
|
||||
rideIdx);
|
||||
auto station = RideGetFirstValidStationExit(*ride);
|
||||
if (station.IsNull())
|
||||
{
|
||||
LOG_WARNING("Couldn't find station, removing peep %u", peep->sprite_index);
|
||||
LOG_WARNING("Couldn't find station, removing peep %u", peep->Id);
|
||||
peepsToRemove.push_back(peep);
|
||||
}
|
||||
else
|
||||
|
|
|
@ -240,7 +240,7 @@ struct GameStateSnapshots final : public IGameStateSnapshots
|
|||
const EntityBase& spriteBase, const EntityBase& spriteCmp, GameStateSpriteChange& changeData) const
|
||||
{
|
||||
COMPARE_FIELD(EntityBase, Type);
|
||||
COMPARE_FIELD(EntityBase, sprite_index);
|
||||
COMPARE_FIELD(EntityBase, Id);
|
||||
COMPARE_FIELD(EntityBase, x);
|
||||
COMPARE_FIELD(EntityBase, y);
|
||||
COMPARE_FIELD(EntityBase, z);
|
||||
|
|
|
@ -79,7 +79,7 @@ GameActions::Result PeepPickupAction::Query() const
|
|||
{
|
||||
// already picking up a peep
|
||||
PeepPickupAction existingPickupAction{
|
||||
PeepPickupType::Cancel, existing->sprite_index, { NetworkGetPickupPeepOldX(_owner), 0, 0 }, _owner
|
||||
PeepPickupType::Cancel, existing->Id, { NetworkGetPickupPeepOldX(_owner), 0, 0 }, _owner
|
||||
};
|
||||
auto result = GameActions::QueryNested(&existingPickupAction);
|
||||
|
||||
|
@ -134,7 +134,7 @@ GameActions::Result PeepPickupAction::Execute() const
|
|||
{
|
||||
// already picking up a peep
|
||||
PeepPickupAction existingPickupAction{
|
||||
PeepPickupType::Cancel, existing->sprite_index, { NetworkGetPickupPeepOldX(_owner), 0, 0 }, _owner
|
||||
PeepPickupType::Cancel, existing->Id, { NetworkGetPickupPeepOldX(_owner), 0, 0 }, _owner
|
||||
};
|
||||
auto result = GameActions::ExecuteNested(&existingPickupAction);
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@ GameActions::Result StaffHireNewAction::QueryExecute(bool execute) const
|
|||
|
||||
newPeep->PatrolInfo = nullptr;
|
||||
|
||||
res.SetData(StaffHireNewActionResult{ newPeep->sprite_index });
|
||||
res.SetData(StaffHireNewActionResult{ newPeep->Id });
|
||||
}
|
||||
|
||||
return res;
|
||||
|
|
|
@ -678,7 +678,7 @@ static void LightFXAdd3DLight(const CoordsXYZ& loc, const LightType lightType)
|
|||
|
||||
void LightFXAdd3DLight(const EntityBase& entity, const uint8_t id, const CoordsXYZ& loc, const LightType lightType)
|
||||
{
|
||||
LightFXAdd3DLight(entity.sprite_index.ToUnderlying(), LightFXQualifier::Entity, id, loc, lightType);
|
||||
LightFXAdd3DLight(entity.Id.ToUnderlying(), LightFXQualifier::Entity, id, loc, lightType);
|
||||
}
|
||||
|
||||
void LightFXAdd3DLightMagicFromDrawingTile(
|
||||
|
|
|
@ -65,7 +65,7 @@ void Balloon::Press()
|
|||
// There is a random chance that pressing the balloon will not pop it
|
||||
// and instead shift it slightly
|
||||
uint32_t random = ScenarioRand();
|
||||
if ((sprite_index.ToUnderlying() & 7) || (random & 0xFFFF) < 0x2000)
|
||||
if ((Id.ToUnderlying() & 7) || (random & 0xFFFF) < 0x2000)
|
||||
{
|
||||
Pop();
|
||||
}
|
||||
|
|
|
@ -150,7 +150,7 @@ void Duck::UpdateFlyToWater()
|
|||
|
||||
void Duck::UpdateSwim()
|
||||
{
|
||||
if (((gCurrentTicks + sprite_index.ToUnderlying()) & 3) != 0)
|
||||
if (((gCurrentTicks + Id.ToUnderlying()) & 3) != 0)
|
||||
return;
|
||||
|
||||
uint32_t randomNumber = ScenarioRand();
|
||||
|
|
|
@ -70,7 +70,7 @@ void EntityBase::Invalidate()
|
|||
void EntityBase::Serialise(DataSerialiser& stream)
|
||||
{
|
||||
stream << Type;
|
||||
stream << sprite_index;
|
||||
stream << Id;
|
||||
stream << x;
|
||||
stream << y;
|
||||
stream << z;
|
||||
|
|
|
@ -26,7 +26,7 @@ enum class EntityType : uint8_t
|
|||
struct EntityBase
|
||||
{
|
||||
EntityType Type;
|
||||
EntityId sprite_index;
|
||||
EntityId Id;
|
||||
int32_t x;
|
||||
int32_t y;
|
||||
int32_t z;
|
||||
|
|
|
@ -195,7 +195,7 @@ void ResetAllEntities()
|
|||
continue;
|
||||
}
|
||||
spr->Type = EntityType::Null;
|
||||
spr->sprite_index = EntityId::FromUnderlying(i);
|
||||
spr->Id = EntityId::FromUnderlying(i);
|
||||
|
||||
_entityFlashingList[i] = false;
|
||||
}
|
||||
|
@ -265,13 +265,13 @@ EntitiesChecksum GetAllEntitiesChecksum()
|
|||
static void EntityReset(EntityBase* entity)
|
||||
{
|
||||
// Need to retain how the sprite is linked in lists
|
||||
auto entityIndex = entity->sprite_index;
|
||||
auto entityIndex = entity->Id;
|
||||
_entityFlashingList[entityIndex.ToUnderlying()] = false;
|
||||
|
||||
Entity* spr = reinterpret_cast<Entity*>(entity);
|
||||
*spr = Entity();
|
||||
|
||||
entity->sprite_index = entityIndex;
|
||||
entity->Id = entityIndex;
|
||||
entity->Type = EntityType::Null;
|
||||
}
|
||||
|
||||
|
@ -280,7 +280,7 @@ static void AddToEntityList(EntityBase* entity)
|
|||
{
|
||||
auto& list = gEntityLists[EnumValue(entity->Type)];
|
||||
// Entity list must be in sprite_index order to prevent desync issues
|
||||
list.insert(std::lower_bound(std::begin(list), std::end(list), entity->sprite_index), entity->sprite_index);
|
||||
list.insert(std::lower_bound(std::begin(list), std::end(list), entity->Id), entity->Id);
|
||||
}
|
||||
|
||||
static void AddToFreeList(EntityId index)
|
||||
|
@ -292,7 +292,7 @@ static void AddToFreeList(EntityId index)
|
|||
static void RemoveFromEntityList(EntityBase* entity)
|
||||
{
|
||||
auto& list = gEntityLists[EnumValue(entity->Type)];
|
||||
auto ptr = BinaryFind(std::begin(list), std::end(list), entity->sprite_index);
|
||||
auto ptr = BinaryFind(std::begin(list), std::end(list), entity->Id);
|
||||
if (ptr != std::end(list))
|
||||
{
|
||||
list.erase(ptr);
|
||||
|
@ -414,15 +414,15 @@ static void EntitySpatialInsert(EntityBase* entity, const CoordsXY& newLoc)
|
|||
{
|
||||
size_t newIndex = GetSpatialIndexOffset(newLoc);
|
||||
auto& spatialVector = gEntitySpatialIndex[newIndex];
|
||||
auto index = std::lower_bound(std::begin(spatialVector), std::end(spatialVector), entity->sprite_index);
|
||||
spatialVector.insert(index, entity->sprite_index);
|
||||
auto index = std::lower_bound(std::begin(spatialVector), std::end(spatialVector), entity->Id);
|
||||
spatialVector.insert(index, entity->Id);
|
||||
}
|
||||
|
||||
static void EntitySpatialRemove(EntityBase* entity)
|
||||
{
|
||||
size_t currentIndex = GetSpatialIndexOffset({ entity->x, entity->y });
|
||||
auto& spatialVector = gEntitySpatialIndex[currentIndex];
|
||||
auto index = BinaryFind(std::begin(spatialVector), std::end(spatialVector), entity->sprite_index);
|
||||
auto index = BinaryFind(std::begin(spatialVector), std::end(spatialVector), entity->Id);
|
||||
if (index != std::end(spatialVector))
|
||||
{
|
||||
spatialVector.erase(index, index + 1);
|
||||
|
@ -499,8 +499,8 @@ static void FreeEntity(EntityBase& entity)
|
|||
else if (guest != nullptr)
|
||||
{
|
||||
guest->SetName({});
|
||||
OpenRCT2::RideUse::GetHistory().RemoveHandle(guest->sprite_index);
|
||||
OpenRCT2::RideUse::GetTypeHistory().RemoveHandle(guest->sprite_index);
|
||||
OpenRCT2::RideUse::GetHistory().RemoveHandle(guest->Id);
|
||||
OpenRCT2::RideUse::GetTypeHistory().RemoveHandle(guest->Id);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -514,7 +514,7 @@ void EntityRemove(EntityBase* entity)
|
|||
|
||||
EntityTweener::Get().RemoveEntity(entity);
|
||||
RemoveFromEntityList(entity); // remove from existing list
|
||||
AddToFreeList(entity->sprite_index);
|
||||
AddToFreeList(entity->Id);
|
||||
|
||||
EntitySpatialRemove(entity);
|
||||
EntityReset(entity);
|
||||
|
@ -550,12 +550,12 @@ uint16_t RemoveFloatingEntities()
|
|||
|
||||
void EntitySetFlashing(EntityBase* entity, bool flashing)
|
||||
{
|
||||
assert(entity->sprite_index.ToUnderlying() < MAX_ENTITIES);
|
||||
_entityFlashingList[entity->sprite_index.ToUnderlying()] = flashing;
|
||||
assert(entity->Id.ToUnderlying() < MAX_ENTITIES);
|
||||
_entityFlashingList[entity->Id.ToUnderlying()] = flashing;
|
||||
}
|
||||
|
||||
bool EntityGetFlashing(EntityBase* entity)
|
||||
{
|
||||
assert(entity->sprite_index.ToUnderlying() < MAX_ENTITIES);
|
||||
return _entityFlashingList[entity->sprite_index.ToUnderlying()];
|
||||
assert(entity->Id.ToUnderlying() < MAX_ENTITIES);
|
||||
return _entityFlashingList[entity->Id.ToUnderlying()];
|
||||
}
|
||||
|
|
|
@ -1423,14 +1423,14 @@ void Guest::CheckCantFindRide()
|
|||
return;
|
||||
|
||||
GuestHeadingToRideId = RideId::GetNull();
|
||||
WindowBase* w = WindowFindByNumber(WindowClass::Peep, sprite_index);
|
||||
WindowBase* w = WindowFindByNumber(WindowClass::Peep, Id);
|
||||
|
||||
if (w != nullptr)
|
||||
{
|
||||
WindowEventInvalidateCall(w);
|
||||
}
|
||||
|
||||
WindowInvalidateByNumber(WindowClass::Peep, sprite_index);
|
||||
WindowInvalidateByNumber(WindowClass::Peep, Id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1658,7 +1658,7 @@ bool Guest::DecideAndBuyItem(Ride& ride, ShopItem shopItem, money32 price)
|
|||
ft.Add<StringId>(GetShopItemDescriptor(shopItem).Naming.Indefinite);
|
||||
if (gConfigNotifications.GuestBoughtItem)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, STR_PEEP_TRACKING_NOTIFICATION_BOUGHT_X, sprite_index, ft);
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, STR_PEEP_TRACKING_NOTIFICATION_BOUGHT_X, Id, ft);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2297,7 +2297,7 @@ void Guest::SpendMoney(money16& peep_expend_type, money32 amount, ExpenditureTyp
|
|||
|
||||
peep_expend_type += static_cast<money16>(amount);
|
||||
|
||||
WindowInvalidateByNumber(WindowClass::Peep, sprite_index);
|
||||
WindowInvalidateByNumber(WindowClass::Peep, Id);
|
||||
|
||||
FinancePayment(-amount, expenditure);
|
||||
|
||||
|
@ -2316,24 +2316,24 @@ void Guest::SpendMoney(money16& peep_expend_type, money32 amount, ExpenditureTyp
|
|||
|
||||
void Guest::SetHasRidden(const Ride& ride)
|
||||
{
|
||||
OpenRCT2::RideUse::GetHistory().Add(sprite_index, ride.id);
|
||||
OpenRCT2::RideUse::GetHistory().Add(Id, ride.id);
|
||||
|
||||
SetHasRiddenRideType(ride.type);
|
||||
}
|
||||
|
||||
bool Guest::HasRidden(const Ride& ride) const
|
||||
{
|
||||
return OpenRCT2::RideUse::GetHistory().Contains(sprite_index, ride.id);
|
||||
return OpenRCT2::RideUse::GetHistory().Contains(Id, ride.id);
|
||||
}
|
||||
|
||||
void Guest::SetHasRiddenRideType(int32_t rideType)
|
||||
{
|
||||
OpenRCT2::RideUse::GetTypeHistory().Add(sprite_index, rideType);
|
||||
OpenRCT2::RideUse::GetTypeHistory().Add(Id, rideType);
|
||||
}
|
||||
|
||||
bool Guest::HasRiddenRideType(int32_t rideType) const
|
||||
{
|
||||
return OpenRCT2::RideUse::GetTypeHistory().Contains(sprite_index, rideType);
|
||||
return OpenRCT2::RideUse::GetTypeHistory().Contains(Id, rideType);
|
||||
}
|
||||
|
||||
void Guest::SetParkEntryTime(int32_t entryTime)
|
||||
|
@ -2481,7 +2481,7 @@ static void PeepChooseSeatFromCar(Peep* peep, const Ride& ride, Vehicle* vehicle
|
|||
peep->CurrentSeat = chosen_seat;
|
||||
vehicle->next_free_seat++;
|
||||
|
||||
vehicle->peep[peep->CurrentSeat] = peep->sprite_index;
|
||||
vehicle->peep[peep->CurrentSeat] = peep->Id;
|
||||
vehicle->peep_tshirt_colours[peep->CurrentSeat] = peep->TshirtColour;
|
||||
}
|
||||
|
||||
|
@ -3113,10 +3113,10 @@ static void PeepLeavePark(Guest* peep)
|
|||
|
||||
peep->InsertNewThought(PeepThoughtType::GoHome);
|
||||
|
||||
WindowBase* w = WindowFindByNumber(WindowClass::Peep, peep->sprite_index);
|
||||
WindowBase* w = WindowFindByNumber(WindowClass::Peep, peep->Id);
|
||||
if (w != nullptr)
|
||||
WindowEventInvalidateCall(w);
|
||||
WindowInvalidateByNumber(WindowClass::Peep, peep->sprite_index);
|
||||
WindowInvalidateByNumber(WindowClass::Peep, peep->Id);
|
||||
}
|
||||
|
||||
template<typename T> static void PeepHeadForNearestRide(Guest* peep, bool considerOnlyCloseRides, T predicate)
|
||||
|
@ -3348,7 +3348,7 @@ void Guest::UpdateBuying()
|
|||
{
|
||||
CashInPocket += 50.00_GBP;
|
||||
}
|
||||
WindowInvalidateByNumber(WindowClass::Peep, sprite_index);
|
||||
WindowInvalidateByNumber(WindowClass::Peep, Id);
|
||||
}
|
||||
sprite_direction ^= 0x10;
|
||||
|
||||
|
@ -3860,7 +3860,7 @@ void Guest::UpdateRideFreeVehicleEnterRide(Ride& ride)
|
|||
|
||||
if (gConfigNotifications.GuestOnRide)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, msg_string, sprite_index, ft);
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, msg_string, Id, ft);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4685,7 +4685,7 @@ void Guest::UpdateRideOnSpiralSlide()
|
|||
return;
|
||||
|
||||
ride->slide_in_use++;
|
||||
ride->slide_peep = sprite_index;
|
||||
ride->slide_peep = Id;
|
||||
ride->slide_peep_t_shirt_colour = TshirtColour;
|
||||
ride->spiral_slide_progress = 0;
|
||||
destination.x++;
|
||||
|
@ -4974,7 +4974,7 @@ void Guest::UpdateRideLeaveExit()
|
|||
|
||||
if (gConfigNotifications.GuestLeftRide)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, STR_PEEP_TRACKING_LEFT_RIDE_X, sprite_index, ft);
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, STR_PEEP_TRACKING_LEFT_RIDE_X, Id, ft);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -5283,7 +5283,7 @@ void Guest::UpdateWalking()
|
|||
}
|
||||
else if (HasEmptyContainer())
|
||||
{
|
||||
if ((!GetNextIsSurface()) && (static_cast<uint32_t>(sprite_index.ToUnderlying() & 0x1FF) == (gCurrentTicks & 0x1FF))
|
||||
if ((!GetNextIsSurface()) && (static_cast<uint32_t>(Id.ToUnderlying() & 0x1FF) == (gCurrentTicks & 0x1FF))
|
||||
&& ((0xFFFF & ScenarioRand()) <= 4096))
|
||||
{
|
||||
int32_t container = UtilBitScanForward(GetEmptyContainerFlags());
|
||||
|
@ -7180,7 +7180,7 @@ Guest* Guest::Generate(const CoordsXYZ& coords)
|
|||
|
||||
// Create event args object
|
||||
auto obj = OpenRCT2::Scripting::DukObject(ctx);
|
||||
obj.Set("id", peep->sprite_index.ToUnderlying());
|
||||
obj.Set("id", peep->Id.ToUnderlying());
|
||||
|
||||
// Call the subscriptions
|
||||
auto e = obj.Take();
|
||||
|
@ -7386,7 +7386,7 @@ void Guest::RemoveFromQueue()
|
|||
station.QueueLength--;
|
||||
}
|
||||
|
||||
if (sprite_index == station.LastPeepInQueue)
|
||||
if (Id == station.LastPeepInQueue)
|
||||
{
|
||||
station.LastPeepInQueue = GuestNextInQueue;
|
||||
return;
|
||||
|
@ -7400,7 +7400,7 @@ void Guest::RemoveFromQueue()
|
|||
}
|
||||
for (; otherGuest != nullptr; otherGuest = GetEntity<Guest>(otherGuest->GuestNextInQueue))
|
||||
{
|
||||
if (sprite_index == otherGuest->GuestNextInQueue)
|
||||
if (Id == otherGuest->GuestNextInQueue)
|
||||
{
|
||||
otherGuest->GuestNextInQueue = GuestNextInQueue;
|
||||
return;
|
||||
|
|
|
@ -287,7 +287,7 @@ bool Peep::CheckForPath()
|
|||
PROFILED_FUNCTION();
|
||||
|
||||
PathCheckOptimisation++;
|
||||
if ((PathCheckOptimisation & 0xF) != (sprite_index.ToUnderlying() & 0xF))
|
||||
if ((PathCheckOptimisation & 0xF) != (Id.ToUnderlying() & 0xF))
|
||||
{
|
||||
// This condition makes the check happen less often
|
||||
// As a side effect peeps hover for a short,
|
||||
|
@ -526,8 +526,7 @@ std::optional<CoordsXY> Peep::UpdateAction(int16_t& xy_distance)
|
|||
WindowInvalidateFlags |= PEEP_INVALIDATE_PEEP_2;
|
||||
|
||||
const auto curLoc = GetLocation();
|
||||
Litter::Create(
|
||||
{ curLoc, sprite_direction }, (sprite_index.ToUnderlying() & 1) ? Litter::Type::VomitAlt : Litter::Type::Vomit);
|
||||
Litter::Create({ curLoc, sprite_direction }, (Id.ToUnderlying() & 1) ? Litter::Type::VomitAlt : Litter::Type::Vomit);
|
||||
|
||||
static constexpr OpenRCT2::Audio::SoundId coughs[4] = {
|
||||
OpenRCT2::Audio::SoundId::Cough1,
|
||||
|
@ -565,7 +564,7 @@ void PeepDecrementNumRiders(Peep* peep)
|
|||
*/
|
||||
void PeepWindowStateUpdate(Peep* peep)
|
||||
{
|
||||
WindowBase* w = WindowFindByNumber(WindowClass::Peep, peep->sprite_index.ToUnderlying());
|
||||
WindowBase* w = WindowFindByNumber(WindowClass::Peep, peep->Id.ToUnderlying());
|
||||
if (w != nullptr)
|
||||
WindowEventInvalidateCall(w);
|
||||
|
||||
|
@ -581,12 +580,12 @@ void PeepWindowStateUpdate(Peep* peep)
|
|||
}
|
||||
}
|
||||
|
||||
WindowInvalidateByNumber(WindowClass::Peep, peep->sprite_index);
|
||||
WindowInvalidateByNumber(WindowClass::Peep, peep->Id);
|
||||
WindowInvalidateByClass(WindowClass::GuestList);
|
||||
}
|
||||
else
|
||||
{
|
||||
WindowInvalidateByNumber(WindowClass::Peep, peep->sprite_index);
|
||||
WindowInvalidateByNumber(WindowClass::Peep, peep->Id);
|
||||
WindowInvalidateByClass(WindowClass::StaffList);
|
||||
}
|
||||
}
|
||||
|
@ -693,7 +692,7 @@ void PeepEntityRemove(Peep* peep)
|
|||
}
|
||||
peep->Invalidate();
|
||||
|
||||
WindowCloseByNumber(WindowClass::Peep, peep->sprite_index);
|
||||
WindowCloseByNumber(WindowClass::Peep, peep->Id);
|
||||
|
||||
WindowCloseByNumber(WindowClass::FirePrompt, EnumValue(peep->Type));
|
||||
|
||||
|
@ -702,14 +701,14 @@ void PeepEntityRemove(Peep* peep)
|
|||
bool wasGuest = staff == nullptr;
|
||||
if (wasGuest)
|
||||
{
|
||||
News::DisableNewsItems(News::ItemType::PeepOnRide, peep->sprite_index.ToUnderlying());
|
||||
News::DisableNewsItems(News::ItemType::PeepOnRide, peep->Id.ToUnderlying());
|
||||
}
|
||||
else
|
||||
{
|
||||
staff->ClearPatrolArea();
|
||||
UpdateConsolidatedPatrolAreas();
|
||||
|
||||
News::DisableNewsItems(News::ItemType::Peep, staff->sprite_index.ToUnderlying());
|
||||
News::DisableNewsItems(News::ItemType::Peep, staff->Id.ToUnderlying());
|
||||
}
|
||||
EntityRemove(peep);
|
||||
|
||||
|
@ -1785,7 +1784,7 @@ static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_
|
|||
|
||||
auto& station = ride->GetStation(stationNum);
|
||||
auto previous_last = station.LastPeepInQueue;
|
||||
station.LastPeepInQueue = guest->sprite_index;
|
||||
station.LastPeepInQueue = guest->Id;
|
||||
guest->GuestNextInQueue = previous_last;
|
||||
station.QueueLength++;
|
||||
|
||||
|
@ -1802,8 +1801,7 @@ static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_
|
|||
ride->FormatNameTo(ft);
|
||||
if (gConfigNotifications.GuestQueuingForRide)
|
||||
{
|
||||
News::AddItemToQueue(
|
||||
News::ItemType::PeepOnRide, STR_PEEP_TRACKING_PEEP_JOINED_QUEUE_FOR_X, guest->sprite_index, ft);
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, STR_PEEP_TRACKING_PEEP_JOINED_QUEUE_FOR_X, guest->Id, ft);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1863,7 +1861,7 @@ static bool PeepInteractWithEntrance(Peep* peep, const CoordsXYE& coords, uint8_
|
|||
guest->FormatNameTo(ft);
|
||||
if (gConfigNotifications.GuestLeftPark)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, STR_PEEP_TRACKING_LEFT_PARK, guest->sprite_index, ft);
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, STR_PEEP_TRACKING_LEFT_PARK, guest->Id, ft);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
|
@ -2211,7 +2209,7 @@ static void PeepInteractWithPath(Peep* peep, const CoordsXYE& coords)
|
|||
// Add the peep to the ride queue.
|
||||
auto& station = ride->GetStation(stationNum);
|
||||
auto old_last_peep = station.LastPeepInQueue;
|
||||
station.LastPeepInQueue = guest->sprite_index;
|
||||
station.LastPeepInQueue = guest->Id;
|
||||
guest->GuestNextInQueue = old_last_peep;
|
||||
station.QueueLength++;
|
||||
|
||||
|
@ -2233,7 +2231,7 @@ static void PeepInteractWithPath(Peep* peep, const CoordsXYE& coords)
|
|||
if (gConfigNotifications.GuestQueuingForRide)
|
||||
{
|
||||
News::AddItemToQueue(
|
||||
News::ItemType::PeepOnRide, STR_PEEP_TRACKING_PEEP_JOINED_QUEUE_FOR_X, guest->sprite_index, ft);
|
||||
News::ItemType::PeepOnRide, STR_PEEP_TRACKING_PEEP_JOINED_QUEUE_FOR_X, guest->Id, ft);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2352,7 +2350,7 @@ static bool PeepInteractWithShop(Peep* peep, const CoordsXYE& coords)
|
|||
: STR_PEEP_TRACKING_PEEP_IS_ON_X;
|
||||
if (gConfigNotifications.GuestUsedFacility)
|
||||
{
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, string_id, guest->sprite_index, ft);
|
||||
News::AddItemToQueue(News::ItemType::PeepOnRide, string_id, guest->Id, ft);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -486,7 +486,7 @@ bool Staff::DoHandymanPathFinding()
|
|||
Direction litterDirection = INVALID_DIRECTION;
|
||||
uint8_t validDirections = GetValidPatrolDirections(NextLoc);
|
||||
|
||||
if ((StaffOrders & STAFF_ORDERS_SWEEPING) && ((gCurrentTicks + sprite_index.ToUnderlying()) & 0xFFF) > 110)
|
||||
if ((StaffOrders & STAFF_ORDERS_SWEEPING) && ((gCurrentTicks + Id.ToUnderlying()) & 0xFFF) > 110)
|
||||
{
|
||||
litterDirection = HandymanDirectionToNearestLitter();
|
||||
}
|
||||
|
|
|
@ -463,7 +463,7 @@ static int32_t ConsoleCommandStaff(InteractiveConsole& console, const arguments_
|
|||
{
|
||||
auto name = peep->GetName();
|
||||
console.WriteFormatLine(
|
||||
"staff id %03d type: %02u energy %03u name %s", peep->sprite_index, peep->AssignedStaffType, peep->Energy,
|
||||
"staff id %03d type: %02u energy %03u name %s", peep->Id, peep->AssignedStaffType, peep->Energy,
|
||||
name.c_str());
|
||||
}
|
||||
}
|
||||
|
|
|
@ -728,8 +728,8 @@ void ViewportUpdateSmartFollowEntity(WindowBase* window)
|
|||
|
||||
void ViewportUpdateSmartFollowGuest(WindowBase* window, const Guest* peep)
|
||||
{
|
||||
Focus focus = Focus(peep->sprite_index);
|
||||
window->viewport_target_sprite = peep->sprite_index;
|
||||
Focus focus = Focus(peep->Id);
|
||||
window->viewport_target_sprite = peep->Id;
|
||||
|
||||
if (peep->State == PeepState::Picked)
|
||||
{
|
||||
|
@ -752,9 +752,9 @@ void ViewportUpdateSmartFollowGuest(WindowBase* window, const Guest* peep)
|
|||
const auto car = train->GetCar(peep->CurrentCar);
|
||||
if (car != nullptr)
|
||||
{
|
||||
focus = Focus(car->sprite_index);
|
||||
focus = Focus(car->Id);
|
||||
overallFocus = false;
|
||||
window->viewport_target_sprite = car->sprite_index;
|
||||
window->viewport_target_sprite = car->Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1983,7 +1983,7 @@ void NetworkBase::ServerClientDisconnected(std::unique_ptr<NetworkConnection>& c
|
|||
if (pickup_peep != nullptr)
|
||||
{
|
||||
PeepPickupAction pickupAction{ PeepPickupType::Cancel,
|
||||
pickup_peep->sprite_index,
|
||||
pickup_peep->Id,
|
||||
{ NetworkGetPickupPeepOldX(connection_player->Id), 0, 0 },
|
||||
NetworkGetCurrentPlayerId() };
|
||||
auto res = GameActions::Execute(&pickupAction);
|
||||
|
|
|
@ -1436,7 +1436,7 @@ namespace OpenRCT2
|
|||
|
||||
static void ReadWriteEntityCommon(OrcaStream::ChunkStream& cs, EntityBase& entity)
|
||||
{
|
||||
cs.ReadWrite(entity.sprite_index);
|
||||
cs.ReadWrite(entity.Id);
|
||||
cs.ReadWrite(entity.sprite_height_negative);
|
||||
cs.ReadWrite(entity.x);
|
||||
cs.ReadWrite(entity.y);
|
||||
|
@ -1602,7 +1602,7 @@ namespace OpenRCT2
|
|||
cs.ReadWrite(rideType);
|
||||
return true;
|
||||
});
|
||||
OpenRCT2::RideUse::GetTypeHistory().Set(guest->sprite_index, LegacyGetRideTypesBeenOn(rideTypeBeenOn));
|
||||
OpenRCT2::RideUse::GetTypeHistory().Set(guest->Id, LegacyGetRideTypesBeenOn(rideTypeBeenOn));
|
||||
cs.ReadWrite(guest->ItemFlags);
|
||||
cs.ReadWrite(guest->Photo2RideRef);
|
||||
cs.ReadWrite(guest->Photo3RideRef);
|
||||
|
@ -1661,7 +1661,7 @@ namespace OpenRCT2
|
|||
cs.ReadWrite(rideType);
|
||||
return true;
|
||||
});
|
||||
OpenRCT2::RideUse::GetHistory().Set(guest->sprite_index, LegacyGetRidesBeenOn(ridesBeenOn));
|
||||
OpenRCT2::RideUse::GetHistory().Set(guest->Id, LegacyGetRidesBeenOn(ridesBeenOn));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1980,7 +1980,7 @@ namespace OpenRCT2
|
|||
cs.ReadWrite(rideType);
|
||||
return true;
|
||||
});
|
||||
OpenRCT2::RideUse::GetTypeHistory().Set(guest.sprite_index, LegacyGetRideTypesBeenOn(rideTypeBeenOn));
|
||||
OpenRCT2::RideUse::GetTypeHistory().Set(guest.Id, LegacyGetRideTypesBeenOn(rideTypeBeenOn));
|
||||
}
|
||||
|
||||
cs.ReadWrite(guest.TimeInQueue);
|
||||
|
@ -1991,7 +1991,7 @@ namespace OpenRCT2
|
|||
cs.ReadWrite(rideType);
|
||||
return true;
|
||||
});
|
||||
OpenRCT2::RideUse::GetHistory().Set(guest.sprite_index, LegacyGetRidesBeenOn(ridesBeenOn));
|
||||
OpenRCT2::RideUse::GetHistory().Set(guest.Id, LegacyGetRidesBeenOn(ridesBeenOn));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1999,14 +1999,14 @@ namespace OpenRCT2
|
|||
{
|
||||
std::vector<RideId> rideUse;
|
||||
cs.ReadWriteVector(rideUse, [&cs](RideId& rideId) { cs.ReadWrite(rideId); });
|
||||
OpenRCT2::RideUse::GetHistory().Set(guest.sprite_index, std::move(rideUse));
|
||||
OpenRCT2::RideUse::GetHistory().Set(guest.Id, std::move(rideUse));
|
||||
std::vector<ObjectEntryIndex> rideTypeUse;
|
||||
cs.ReadWriteVector(rideTypeUse, [&cs](ObjectEntryIndex& rideType) { cs.ReadWrite(rideType); });
|
||||
OpenRCT2::RideUse::GetTypeHistory().Set(guest.sprite_index, std::move(rideTypeUse));
|
||||
OpenRCT2::RideUse::GetTypeHistory().Set(guest.Id, std::move(rideTypeUse));
|
||||
}
|
||||
else
|
||||
{
|
||||
auto* rideUse = OpenRCT2::RideUse::GetHistory().GetAll(guest.sprite_index);
|
||||
auto* rideUse = OpenRCT2::RideUse::GetHistory().GetAll(guest.Id);
|
||||
if (rideUse == nullptr)
|
||||
{
|
||||
std::vector<RideId> empty;
|
||||
|
@ -2016,7 +2016,7 @@ namespace OpenRCT2
|
|||
{
|
||||
cs.ReadWriteVector(*rideUse, [&cs](RideId& rideId) { cs.ReadWrite(rideId); });
|
||||
}
|
||||
auto* rideTypeUse = OpenRCT2::RideUse::GetTypeHistory().GetAll(guest.sprite_index);
|
||||
auto* rideTypeUse = OpenRCT2::RideUse::GetTypeHistory().GetAll(guest.Id);
|
||||
if (rideTypeUse == nullptr)
|
||||
{
|
||||
std::vector<ObjectEntryIndex> empty;
|
||||
|
@ -2217,7 +2217,7 @@ namespace OpenRCT2
|
|||
cs.Write(count);
|
||||
for (auto* ent : EntityList<T>())
|
||||
{
|
||||
cs.Write(ent->sprite_index);
|
||||
cs.Write(ent->Id);
|
||||
ReadWriteEntity(os, cs, *ent);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -2870,8 +2870,8 @@ namespace RCT1
|
|||
dst->Angriness = src->Angriness;
|
||||
dst->TimeLost = src->TimeLost;
|
||||
|
||||
OpenRCT2::RideUse::GetHistory().Set(dst->sprite_index, RCT12GetRidesBeenOn(src));
|
||||
OpenRCT2::RideUse::GetTypeHistory().Set(dst->sprite_index, RCT12GetRideTypesBeenOn(src));
|
||||
OpenRCT2::RideUse::GetHistory().Set(dst->Id, RCT12GetRidesBeenOn(src));
|
||||
OpenRCT2::RideUse::GetTypeHistory().Set(dst->Id, RCT12GetRideTypesBeenOn(src));
|
||||
|
||||
dst->Photo1RideRef = RCT12RideIdToOpenRCT2RideId(src->Photo1RideRef);
|
||||
|
||||
|
|
|
@ -1816,7 +1816,7 @@ namespace RCT2
|
|||
{
|
||||
dst->Type = GetEntityTypeFromRCT2Sprite(src);
|
||||
dst->sprite_height_negative = src->SpriteHeightNegative;
|
||||
dst->sprite_index = EntityId::FromUnderlying(src->EntityIndex);
|
||||
dst->Id = EntityId::FromUnderlying(src->EntityIndex);
|
||||
dst->x = src->x;
|
||||
dst->y = src->y;
|
||||
dst->z = src->z;
|
||||
|
@ -2076,8 +2076,8 @@ namespace RCT2
|
|||
dst->NauseaTolerance = static_cast<PeepNauseaTolerance>(src->NauseaTolerance);
|
||||
dst->PaidOnDrink = src->PaidOnDrink;
|
||||
|
||||
OpenRCT2::RideUse::GetHistory().Set(dst->sprite_index, RCT12GetRidesBeenOn(src));
|
||||
OpenRCT2::RideUse::GetTypeHistory().Set(dst->sprite_index, RCT12GetRideTypesBeenOn(src));
|
||||
OpenRCT2::RideUse::GetHistory().Set(dst->Id, RCT12GetRidesBeenOn(src));
|
||||
OpenRCT2::RideUse::GetTypeHistory().Set(dst->Id, RCT12GetRideTypesBeenOn(src));
|
||||
|
||||
dst->SetItemFlags(src->GetItemFlags());
|
||||
dst->Photo1RideRef = RCT12RideIdToOpenRCT2RideId(src->Photo1RideRef);
|
||||
|
|
|
@ -29,7 +29,7 @@ Vehicle* CableLiftSegmentCreate(
|
|||
current->ride_subtype = OBJECT_ENTRY_INDEX_NULL;
|
||||
if (head)
|
||||
{
|
||||
ride.cable_lift = current->sprite_index;
|
||||
ride.cable_lift = current->Id;
|
||||
}
|
||||
current->SubType = head ? Vehicle::Type::Head : Vehicle::Type::Tail;
|
||||
current->var_44 = var_44;
|
||||
|
@ -441,7 +441,7 @@ int32_t Vehicle::CableLiftUpdateTrackMotion()
|
|||
uint16_t massTotal = 0;
|
||||
int32_t accelerationTotal = 0;
|
||||
|
||||
for (Vehicle* vehicle = GetEntity<Vehicle>(sprite_index); vehicle != nullptr;
|
||||
for (Vehicle* vehicle = GetEntity<Vehicle>(Id); vehicle != nullptr;
|
||||
vehicle = GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
vehicleCount++;
|
||||
|
|
|
@ -328,11 +328,11 @@ void Ride::QueueInsertGuestAtFront(StationIndex stationIndex, Guest* peep)
|
|||
auto* queueHeadGuest = GetQueueHeadGuest(peep->CurrentRideStation);
|
||||
if (queueHeadGuest == nullptr)
|
||||
{
|
||||
GetStation(peep->CurrentRideStation).LastPeepInQueue = peep->sprite_index;
|
||||
GetStation(peep->CurrentRideStation).LastPeepInQueue = peep->Id;
|
||||
}
|
||||
else
|
||||
{
|
||||
queueHeadGuest->GuestNextInQueue = peep->sprite_index;
|
||||
queueHeadGuest->GuestNextInQueue = peep->Id;
|
||||
}
|
||||
UpdateQueueLength(peep->CurrentRideStation);
|
||||
}
|
||||
|
@ -1685,7 +1685,7 @@ static void ride_call_mechanic(Ride& ride, Peep* mechanic, int32_t forInspection
|
|||
mechanic->SubState = 0;
|
||||
ride.mechanic_status = RIDE_MECHANIC_STATUS_HEADING;
|
||||
ride.window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAINTENANCE;
|
||||
ride.mechanic = mechanic->sprite_index;
|
||||
ride.mechanic = mechanic->Id;
|
||||
mechanic->CurrentRide = ride.id;
|
||||
mechanic->CurrentRideStation = ride.inspection_station;
|
||||
}
|
||||
|
@ -3315,9 +3315,9 @@ static TrainReference vehicle_create_train(
|
|||
else
|
||||
{
|
||||
// Link the previous car with this car
|
||||
train.tail->next_vehicle_on_train = car->sprite_index;
|
||||
train.tail->next_vehicle_on_ride = car->sprite_index;
|
||||
car->prev_vehicle_on_ride = train.tail->sprite_index;
|
||||
train.tail->next_vehicle_on_train = car->Id;
|
||||
train.tail->next_vehicle_on_ride = car->Id;
|
||||
car->prev_vehicle_on_ride = train.tail->Id;
|
||||
}
|
||||
train.tail = car;
|
||||
}
|
||||
|
@ -3356,8 +3356,8 @@ static bool vehicle_create_trains(RideId rideIndex, const CoordsXYZ& trainsPos,
|
|||
else
|
||||
{
|
||||
// Link the end of the previous train with the front of this train
|
||||
lastTrain.tail->next_vehicle_on_ride = train.head->sprite_index;
|
||||
train.head->prev_vehicle_on_ride = lastTrain.tail->sprite_index;
|
||||
lastTrain.tail->next_vehicle_on_ride = train.head->Id;
|
||||
train.head->prev_vehicle_on_ride = lastTrain.tail->Id;
|
||||
}
|
||||
lastTrain = train;
|
||||
|
||||
|
@ -3365,7 +3365,7 @@ static bool vehicle_create_trains(RideId rideIndex, const CoordsXYZ& trainsPos,
|
|||
{
|
||||
if (ride->vehicles[i].IsNull())
|
||||
{
|
||||
ride->vehicles[i] = train.head->sprite_index;
|
||||
ride->vehicles[i] = train.head->Id;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -3373,9 +3373,9 @@ static bool vehicle_create_trains(RideId rideIndex, const CoordsXYZ& trainsPos,
|
|||
|
||||
// Link the first train and last train together. Nullptr checks are there to keep Clang happy.
|
||||
if (lastTrain.tail != nullptr)
|
||||
firstTrain.head->prev_vehicle_on_ride = lastTrain.tail->sprite_index;
|
||||
firstTrain.head->prev_vehicle_on_ride = lastTrain.tail->Id;
|
||||
if (firstTrain.head != nullptr)
|
||||
lastTrain.tail->next_vehicle_on_ride = firstTrain.head->sprite_index;
|
||||
lastTrain.tail->next_vehicle_on_ride = firstTrain.head->Id;
|
||||
|
||||
return allTrainsCreated;
|
||||
}
|
||||
|
@ -3760,14 +3760,14 @@ static ResultWithMessage ride_create_cable_lift(RideId rideIndex, bool isApplyin
|
|||
}
|
||||
else
|
||||
{
|
||||
tail->next_vehicle_on_train = current->sprite_index;
|
||||
tail->next_vehicle_on_ride = current->sprite_index;
|
||||
current->prev_vehicle_on_ride = tail->sprite_index;
|
||||
tail->next_vehicle_on_train = current->Id;
|
||||
tail->next_vehicle_on_ride = current->Id;
|
||||
current->prev_vehicle_on_ride = tail->Id;
|
||||
}
|
||||
tail = current;
|
||||
}
|
||||
head->prev_vehicle_on_ride = tail->sprite_index;
|
||||
tail->next_vehicle_on_ride = head->sprite_index;
|
||||
head->prev_vehicle_on_ride = tail->Id;
|
||||
tail->next_vehicle_on_ride = head->Id;
|
||||
|
||||
ride->lifecycle_flags |= RIDE_LIFECYCLE_CABLE_LIFT;
|
||||
head->CableLiftUpdateTrackMotion();
|
||||
|
|
|
@ -213,7 +213,7 @@ static void ride_update_station_race(Ride& ride, StationIndex stationIndex)
|
|||
auto* peep = GetEntity<Guest>(vehicle->peep[0]);
|
||||
if (peep != nullptr)
|
||||
{
|
||||
ride.race_winner = peep->sprite_index;
|
||||
ride.race_winner = peep->Id;
|
||||
ride.window_invalidate_flags |= RIDE_INVALIDATE_RIDE_MAIN | RIDE_INVALIDATE_RIDE_LIST;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -773,7 +773,7 @@ uint16_t Vehicle::GetSoundPriority() const
|
|||
|
||||
for (const auto& vehicleSound : OpenRCT2::Audio::gVehicleSoundList)
|
||||
{
|
||||
if (vehicleSound.id == sprite_index.ToUnderlying())
|
||||
if (vehicleSound.id == Id.ToUnderlying())
|
||||
{
|
||||
// Vehicle sounds will get higher priority if they are already playing
|
||||
return result + 300;
|
||||
|
@ -828,7 +828,7 @@ OpenRCT2::Audio::VehicleSoundParams Vehicle::CreateSoundParam(uint16_t priority)
|
|||
frequency += 11025;
|
||||
frequency += 16 * sound_vector_factor;
|
||||
param.frequency = static_cast<uint16_t>(frequency);
|
||||
param.id = sprite_index.ToUnderlying();
|
||||
param.id = Id.ToUnderlying();
|
||||
param.volume = 0;
|
||||
|
||||
if (x != LOCATION_NULL)
|
||||
|
@ -1256,7 +1256,7 @@ bool Vehicle::CloseRestraints()
|
|||
return true;
|
||||
|
||||
bool restraintsClosed = true;
|
||||
for (Vehicle* vehicle = GetEntity<Vehicle>(sprite_index); vehicle != nullptr;
|
||||
for (Vehicle* vehicle = GetEntity<Vehicle>(Id); vehicle != nullptr;
|
||||
vehicle = GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
if (vehicle->HasUpdateFlag(VEHICLE_UPDATE_FLAG_BROKEN_CAR) && vehicle->restraints_position != 0
|
||||
|
@ -1305,7 +1305,7 @@ bool Vehicle::CloseRestraints()
|
|||
bool Vehicle::OpenRestraints()
|
||||
{
|
||||
int32_t restraintsOpen = true;
|
||||
for (Vehicle* vehicle = GetEntity<Vehicle>(sprite_index); vehicle != nullptr;
|
||||
for (Vehicle* vehicle = GetEntity<Vehicle>(Id); vehicle != nullptr;
|
||||
vehicle = GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
vehicle->SwingPosition = 0;
|
||||
|
@ -2176,7 +2176,7 @@ void Vehicle::UpdateWaitingForPassengers()
|
|||
return;
|
||||
}
|
||||
|
||||
auto trainIndex = ride_get_train_index_from_vehicle(*curRide, sprite_index);
|
||||
auto trainIndex = ride_get_train_index_from_vehicle(*curRide, Id);
|
||||
if (!trainIndex.has_value())
|
||||
{
|
||||
return;
|
||||
|
@ -2202,7 +2202,7 @@ 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 = GetEntity<Vehicle>(sprite_index); trainCar != nullptr;
|
||||
for (const Vehicle* trainCar = GetEntity<Vehicle>(Id); trainCar != nullptr;
|
||||
trainCar = GetEntity<Vehicle>(trainCar->next_vehicle_on_train))
|
||||
{
|
||||
num_peeps_on_train += trainCar->num_peeps;
|
||||
|
@ -2254,7 +2254,7 @@ void Vehicle::UpdateWaitingForPassengers()
|
|||
{
|
||||
for (auto train_id : curRide->vehicles)
|
||||
{
|
||||
if (train_id == sprite_index)
|
||||
if (train_id == Id)
|
||||
continue;
|
||||
|
||||
Vehicle* train = GetEntity<Vehicle>(train_id);
|
||||
|
@ -2416,7 +2416,7 @@ void Vehicle::UpdateWaitingToDepart()
|
|||
}
|
||||
else
|
||||
{
|
||||
for (const Vehicle* trainCar = GetEntity<Vehicle>(sprite_index); trainCar != nullptr;
|
||||
for (const Vehicle* trainCar = GetEntity<Vehicle>(Id); trainCar != nullptr;
|
||||
trainCar = GetEntity<Vehicle>(trainCar->next_vehicle_on_train))
|
||||
{
|
||||
if (trainCar->num_peeps != 0)
|
||||
|
@ -2685,7 +2685,7 @@ static bool try_add_synchronised_station(const CoordsXYZ& coords)
|
|||
continue;
|
||||
}
|
||||
|
||||
sv->vehicle_id = vehicle->sprite_index;
|
||||
sv->vehicle_id = vehicle->Id;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -2907,7 +2907,7 @@ bool Vehicle::CanDepartSynchronised() const
|
|||
*/
|
||||
void Vehicle::PeepEasterEggHereWeAre() const
|
||||
{
|
||||
for (Vehicle* vehicle = GetEntity<Vehicle>(sprite_index); vehicle != nullptr;
|
||||
for (Vehicle* vehicle = GetEntity<Vehicle>(Id); vehicle != nullptr;
|
||||
vehicle = GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
for (int32_t i = 0; i < vehicle->num_peeps; ++i)
|
||||
|
@ -3409,7 +3409,7 @@ void Vehicle::CheckIfMissing()
|
|||
|
||||
uint8_t vehicleIndex = 0;
|
||||
for (; vehicleIndex < curRide->NumTrains; ++vehicleIndex)
|
||||
if (curRide->vehicles[vehicleIndex] == sprite_index)
|
||||
if (curRide->vehicles[vehicleIndex] == Id)
|
||||
break;
|
||||
|
||||
vehicleIndex++;
|
||||
|
@ -3453,7 +3453,7 @@ void Vehicle::UpdateCollisionSetup()
|
|||
if (!(curRide->lifecycle_flags & RIDE_LIFECYCLE_CRASHED))
|
||||
{
|
||||
auto frontVehicle = GetHead();
|
||||
auto trainIndex = ride_get_train_index_from_vehicle(*curRide, frontVehicle->sprite_index);
|
||||
auto trainIndex = ride_get_train_index_from_vehicle(*curRide, frontVehicle->Id);
|
||||
if (!trainIndex.has_value())
|
||||
{
|
||||
return;
|
||||
|
@ -3474,15 +3474,14 @@ void Vehicle::UpdateCollisionSetup()
|
|||
KillAllPassengersInTrain();
|
||||
|
||||
Vehicle* lastVehicle = this;
|
||||
for (Vehicle* train = GetEntity<Vehicle>(sprite_index); train != nullptr;
|
||||
train = GetEntity<Vehicle>(train->next_vehicle_on_train))
|
||||
for (Vehicle* train = GetEntity<Vehicle>(Id); train != nullptr; train = GetEntity<Vehicle>(train->next_vehicle_on_train))
|
||||
{
|
||||
lastVehicle = train;
|
||||
|
||||
train->sub_state = 2;
|
||||
|
||||
#ifdef ENABLE_SCRIPTING
|
||||
InvokeVehicleCrashHook(train->sprite_index, "another_vehicle");
|
||||
InvokeVehicleCrashHook(train->Id, "another_vehicle");
|
||||
#endif
|
||||
const auto trainLoc = train->GetLocation();
|
||||
|
||||
|
@ -3552,7 +3551,7 @@ void Vehicle::UpdateCrashSetup()
|
|||
int32_t edx = velocity >> 10;
|
||||
|
||||
Vehicle* lastVehicle = this;
|
||||
auto spriteId = sprite_index;
|
||||
auto spriteId = Id;
|
||||
for (Vehicle* trainVehicle; !spriteId.IsNull(); spriteId = trainVehicle->next_vehicle_on_train)
|
||||
{
|
||||
trainVehicle = GetEntity<Vehicle>(spriteId);
|
||||
|
@ -4063,7 +4062,7 @@ void Vehicle::UpdateUnloadingPassengers()
|
|||
return;
|
||||
}
|
||||
|
||||
for (Vehicle* train = GetEntity<Vehicle>(sprite_index); train != nullptr;
|
||||
for (Vehicle* train = GetEntity<Vehicle>(Id); train != nullptr;
|
||||
train = GetEntity<Vehicle>(train->next_vehicle_on_train))
|
||||
{
|
||||
if (train->restraints_position != 255)
|
||||
|
@ -4088,8 +4087,7 @@ void Vehicle::UpdateUnloadingPassengers()
|
|||
if (sub_state != 1)
|
||||
return;
|
||||
|
||||
for (Vehicle* train = GetEntity<Vehicle>(sprite_index); train != nullptr;
|
||||
train = GetEntity<Vehicle>(train->next_vehicle_on_train))
|
||||
for (Vehicle* train = GetEntity<Vehicle>(Id); train != nullptr; train = GetEntity<Vehicle>(train->next_vehicle_on_train))
|
||||
{
|
||||
if (train->num_peeps != train->next_free_seat)
|
||||
return;
|
||||
|
@ -4121,7 +4119,7 @@ void Vehicle::UpdateWaitingForCableLift()
|
|||
return;
|
||||
|
||||
cableLift->SetState(Vehicle::Status::WaitingToDepart, sub_state);
|
||||
cableLift->cable_lift_target = sprite_index;
|
||||
cableLift->cable_lift_target = Id;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -5187,7 +5185,7 @@ void Vehicle::KillAllPassengersInTrain()
|
|||
|
||||
ride_train_crash(*curRide, NumPeepsUntilTrainTail());
|
||||
|
||||
for (Vehicle* trainCar = GetEntity<Vehicle>(sprite_index); trainCar != nullptr;
|
||||
for (Vehicle* trainCar = GetEntity<Vehicle>(Id); trainCar != nullptr;
|
||||
trainCar = GetEntity<Vehicle>(trainCar->next_vehicle_on_train))
|
||||
{
|
||||
trainCar->KillPassengers(*curRide);
|
||||
|
@ -5235,13 +5233,13 @@ void Vehicle::CrashOnLand()
|
|||
SetState(Vehicle::Status::Crashed, sub_state);
|
||||
|
||||
#ifdef ENABLE_SCRIPTING
|
||||
InvokeVehicleCrashHook(sprite_index, "land");
|
||||
InvokeVehicleCrashHook(Id, "land");
|
||||
#endif
|
||||
|
||||
if (!(curRide->lifecycle_flags & RIDE_LIFECYCLE_CRASHED))
|
||||
{
|
||||
auto frontVehicle = GetHead();
|
||||
auto trainIndex = ride_get_train_index_from_vehicle(*curRide, frontVehicle->sprite_index);
|
||||
auto trainIndex = ride_get_train_index_from_vehicle(*curRide, frontVehicle->Id);
|
||||
if (!trainIndex.has_value())
|
||||
{
|
||||
return;
|
||||
|
@ -5303,13 +5301,13 @@ void Vehicle::CrashOnWater()
|
|||
SetState(Vehicle::Status::Crashed, sub_state);
|
||||
|
||||
#ifdef ENABLE_SCRIPTING
|
||||
InvokeVehicleCrashHook(sprite_index, "water");
|
||||
InvokeVehicleCrashHook(Id, "water");
|
||||
#endif
|
||||
|
||||
if (!(curRide->lifecycle_flags & RIDE_LIFECYCLE_CRASHED))
|
||||
{
|
||||
auto frontVehicle = GetHead();
|
||||
auto trainIndex = ride_get_train_index_from_vehicle(*curRide, frontVehicle->sprite_index);
|
||||
auto trainIndex = ride_get_train_index_from_vehicle(*curRide, frontVehicle->Id);
|
||||
if (!trainIndex.has_value())
|
||||
{
|
||||
return;
|
||||
|
@ -5364,7 +5362,7 @@ void Vehicle::CrashOnWater()
|
|||
*/
|
||||
void Vehicle::UpdateCrash()
|
||||
{
|
||||
for (Vehicle* curVehicle = GetEntity<Vehicle>(sprite_index); curVehicle != nullptr;
|
||||
for (Vehicle* curVehicle = GetEntity<Vehicle>(Id); curVehicle != nullptr;
|
||||
curVehicle = GetEntity<Vehicle>(curVehicle->next_vehicle_on_train))
|
||||
{
|
||||
CoordsXYZ curPos = curVehicle->GetLocation();
|
||||
|
@ -5574,7 +5572,7 @@ OpenRCT2::Audio::SoundId Vehicle::UpdateScreamSound()
|
|||
if (velocity > -0x2C000)
|
||||
return OpenRCT2::Audio::SoundId::Null;
|
||||
|
||||
for (Vehicle* vehicle2 = GetEntity<Vehicle>(sprite_index); vehicle2 != nullptr;
|
||||
for (Vehicle* vehicle2 = GetEntity<Vehicle>(Id); vehicle2 != nullptr;
|
||||
vehicle2 = GetEntity<Vehicle>(vehicle2->next_vehicle_on_train))
|
||||
{
|
||||
if (vehicle2->Pitch < 1)
|
||||
|
@ -5592,7 +5590,7 @@ OpenRCT2::Audio::SoundId Vehicle::UpdateScreamSound()
|
|||
if (velocity < 0x2C000)
|
||||
return OpenRCT2::Audio::SoundId::Null;
|
||||
|
||||
for (Vehicle* vehicle2 = GetEntity<Vehicle>(sprite_index); vehicle2 != nullptr;
|
||||
for (Vehicle* vehicle2 = GetEntity<Vehicle>(Id); vehicle2 != nullptr;
|
||||
vehicle2 = GetEntity<Vehicle>(vehicle2->next_vehicle_on_train))
|
||||
{
|
||||
if (vehicle2->Pitch < 5)
|
||||
|
@ -5686,7 +5684,7 @@ void Vehicle::SetMapToolbar() const
|
|||
|
||||
size_t vehicleIndex;
|
||||
for (vehicleIndex = 0; vehicleIndex < std::size(curRide->vehicles); vehicleIndex++)
|
||||
if (curRide->vehicles[vehicleIndex] == vehicle->sprite_index)
|
||||
if (curRide->vehicles[vehicleIndex] == vehicle->Id)
|
||||
break;
|
||||
|
||||
auto ft = Formatter();
|
||||
|
@ -5970,7 +5968,7 @@ std::optional<EntityId> Vehicle::DodgemsCarWouldCollideAt(const CoordsXY& coords
|
|||
ecx >>= 8;
|
||||
if (std::max(distX, distY) < ecx)
|
||||
{
|
||||
return vehicle2->sprite_index;
|
||||
return vehicle2->Id;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -6526,7 +6524,7 @@ void Vehicle::UpdateSpinningCar()
|
|||
spinningInertia += 6;
|
||||
spinSpeed = dword_F64E08 >> spinningInertia;
|
||||
// Alternate the spin direction (roughly). Perhaps in future save a value to the track
|
||||
if (sprite_index.ToUnderlying() & 1)
|
||||
if (Id.ToUnderlying() & 1)
|
||||
{
|
||||
spin_speed -= spinSpeed;
|
||||
}
|
||||
|
@ -7222,7 +7220,7 @@ bool Vehicle::UpdateMotionCollisionDetection(const CoordsXYZ& loc, EntityId* oth
|
|||
{
|
||||
SetUpdateFlag(VEHICLE_UPDATE_FLAG_6);
|
||||
if (otherVehicleIndex != nullptr)
|
||||
*otherVehicleIndex = collideVehicle->sprite_index;
|
||||
*otherVehicleIndex = collideVehicle->Id;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -7268,7 +7266,7 @@ bool Vehicle::UpdateMotionCollisionDetection(const CoordsXYZ& loc, EntityId* oth
|
|||
|
||||
SetUpdateFlag(VEHICLE_UPDATE_FLAG_6);
|
||||
if (otherVehicleIndex != nullptr)
|
||||
*otherVehicleIndex = collideVehicle->sprite_index;
|
||||
*otherVehicleIndex = collideVehicle->Id;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -8936,7 +8934,7 @@ int32_t Vehicle::UpdateTrackMotion(int32_t* outStation)
|
|||
// backwards.
|
||||
_vehicleFrontVehicle = vehicle;
|
||||
|
||||
auto spriteId = vehicle->sprite_index;
|
||||
auto spriteId = vehicle->Id;
|
||||
while (!spriteId.IsNull())
|
||||
{
|
||||
Vehicle* car = GetEntity<Vehicle>(spriteId);
|
||||
|
@ -9143,7 +9141,7 @@ Ride* Vehicle::GetRide() const
|
|||
int32_t Vehicle::NumPeepsUntilTrainTail() const
|
||||
{
|
||||
int32_t numPeeps = 0;
|
||||
for (const Vehicle* vehicle = GetEntity<Vehicle>(sprite_index); vehicle != nullptr;
|
||||
for (const Vehicle* vehicle = GetEntity<Vehicle>(Id); vehicle != nullptr;
|
||||
vehicle = GetEntity<Vehicle>(vehicle->next_vehicle_on_train))
|
||||
{
|
||||
numPeeps += vehicle->num_peeps;
|
||||
|
|
|
@ -46,7 +46,7 @@ namespace OpenRCT2::Scripting
|
|||
if (entity == nullptr)
|
||||
return ToDuk(ctx, nullptr);
|
||||
|
||||
return ToDuk(ctx, entity->sprite_index.ToUnderlying());
|
||||
return ToDuk(ctx, entity->Id.ToUnderlying());
|
||||
}
|
||||
|
||||
std::string type_get() const
|
||||
|
|
|
@ -106,14 +106,14 @@ namespace OpenRCT2::Scripting
|
|||
{
|
||||
for (auto sprite : EntityList<Balloon>())
|
||||
{
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScEntity>(sprite->sprite_index)));
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScEntity>(sprite->Id)));
|
||||
}
|
||||
}
|
||||
else if (type == "car")
|
||||
{
|
||||
for (auto trainHead : TrainManager::View())
|
||||
{
|
||||
for (auto carId = trainHead->sprite_index; !carId.IsNull();)
|
||||
for (auto carId = trainHead->Id; !carId.IsNull();)
|
||||
{
|
||||
auto car = GetEntity<Vehicle>(carId);
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScVehicle>(carId)));
|
||||
|
@ -125,39 +125,39 @@ namespace OpenRCT2::Scripting
|
|||
{
|
||||
for (auto sprite : EntityList<Litter>())
|
||||
{
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScLitter>(sprite->sprite_index)));
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScLitter>(sprite->Id)));
|
||||
}
|
||||
}
|
||||
else if (type == "duck")
|
||||
{
|
||||
for (auto sprite : EntityList<Duck>())
|
||||
{
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScEntity>(sprite->sprite_index)));
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScEntity>(sprite->Id)));
|
||||
}
|
||||
}
|
||||
else if (type == "peep")
|
||||
{
|
||||
for (auto sprite : EntityList<Guest>())
|
||||
{
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScGuest>(sprite->sprite_index)));
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScGuest>(sprite->Id)));
|
||||
}
|
||||
for (auto sprite : EntityList<Staff>())
|
||||
{
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScStaff>(sprite->sprite_index)));
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScStaff>(sprite->Id)));
|
||||
}
|
||||
}
|
||||
else if (type == "guest")
|
||||
{
|
||||
for (auto sprite : EntityList<Guest>())
|
||||
{
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScGuest>(sprite->sprite_index)));
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScGuest>(sprite->Id)));
|
||||
}
|
||||
}
|
||||
else if (type == "staff")
|
||||
{
|
||||
for (auto sprite : EntityList<Staff>())
|
||||
{
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScStaff>(sprite->sprite_index)));
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScStaff>(sprite->Id)));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -182,42 +182,42 @@ namespace OpenRCT2::Scripting
|
|||
{
|
||||
for (auto sprite : EntityTileList<Balloon>(pos))
|
||||
{
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScEntity>(sprite->sprite_index)));
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScEntity>(sprite->Id)));
|
||||
}
|
||||
}
|
||||
else if (type == "car")
|
||||
{
|
||||
for (auto sprite : EntityTileList<Vehicle>(pos))
|
||||
{
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScVehicle>(sprite->sprite_index)));
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScVehicle>(sprite->Id)));
|
||||
}
|
||||
}
|
||||
else if (type == "litter")
|
||||
{
|
||||
for (auto sprite : EntityTileList<Litter>(pos))
|
||||
{
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScLitter>(sprite->sprite_index)));
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScLitter>(sprite->Id)));
|
||||
}
|
||||
}
|
||||
else if (type == "duck")
|
||||
{
|
||||
for (auto sprite : EntityTileList<Duck>(pos))
|
||||
{
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScEntity>(sprite->sprite_index)));
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScEntity>(sprite->Id)));
|
||||
}
|
||||
}
|
||||
else if (type == "guest")
|
||||
{
|
||||
for (auto sprite : EntityTileList<Guest>(pos))
|
||||
{
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScGuest>(sprite->sprite_index)));
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScGuest>(sprite->Id)));
|
||||
}
|
||||
}
|
||||
else if (type == "staff")
|
||||
{
|
||||
for (auto sprite : EntityTileList<Staff>(pos))
|
||||
{
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScStaff>(sprite->sprite_index)));
|
||||
result.push_back(GetObjectAsDukValue(_context, std::make_shared<ScStaff>(sprite->Id)));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -238,7 +238,7 @@ namespace OpenRCT2::Scripting
|
|||
AsOrDefault(initializer["z"], 0) };
|
||||
entity->MoveTo(entityPos);
|
||||
|
||||
return GetObjectAsDukValue(ctx, std::make_shared<TScriptType>(entity->sprite_index));
|
||||
return GetObjectAsDukValue(ctx, std::make_shared<TScriptType>(entity->Id));
|
||||
}
|
||||
|
||||
DukValue ScMap::createEntity(const std::string& type, const DukValue& initializer)
|
||||
|
@ -331,7 +331,7 @@ namespace OpenRCT2::Scripting
|
|||
|
||||
DukValue ScMap::GetEntityAsDukValue(const EntityBase* sprite) const
|
||||
{
|
||||
auto spriteId = sprite->sprite_index;
|
||||
auto spriteId = sprite->Id;
|
||||
switch (sprite->Type)
|
||||
{
|
||||
case EntityType::Vehicle:
|
||||
|
|
Loading…
Reference in New Issue