Files
OpenRCT2-Web/src/openrct2/entity/EntityRegistry.cpp
T

628 lines
16 KiB
C++
Raw Normal View History

/*****************************************************************************
2024-12-31 20:30:04 +01:00
* Copyright (c) 2014-2025 OpenRCT2 developers
2014-05-25 19:47:11 +01:00
*
2018-06-15 14:07:34 +02:00
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
2014-05-25 19:47:11 +01:00
*
2018-06-15 14:07:34 +02:00
* OpenRCT2 is licensed under the GNU General Public License version 3.
2014-05-25 19:47:11 +01:00
*****************************************************************************/
2021-11-24 16:58:01 +02:00
#include "EntityRegistry.h"
2018-06-22 23:17:03 +02:00
2024-07-09 16:23:31 +02:00
#include "../Diagnostic.h"
2018-06-22 23:17:03 +02:00
#include "../Game.h"
#include "../GameState.h"
2022-03-08 19:49:43 +00:00
#include "../core/Algorithm.hpp"
2021-05-09 19:12:44 +01:00
#include "../core/ChecksumStream.h"
2018-05-23 20:27:00 +01:00
#include "../core/Crypt.h"
2021-05-09 19:12:44 +01:00
#include "../core/DataSerialiser.h"
2018-03-13 13:14:02 +01:00
#include "../core/Guard.hpp"
2021-05-09 19:12:44 +01:00
#include "../core/MemoryStream.h"
#include "../core/String.hpp"
#include "../entity/EntityList.h"
2021-11-25 23:47:24 +02:00
#include "../entity/Peep.h"
#include "../entity/Staff.h"
2018-01-05 23:45:53 +00:00
#include "../interface/Viewport.h"
#include "../peep/RideUseSystem.h"
2022-01-18 10:21:20 -08:00
#include "../profiling/Profiling.h"
2021-05-29 06:01:32 +01:00
#include "../ride/Vehicle.h"
#include "Balloon.h"
#include "Duck.h"
2021-05-29 07:47:49 +01:00
#include "EntityTweener.h"
2017-03-23 17:56:39 +00:00
#include "Fountain.h"
2021-05-29 06:01:32 +01:00
#include "MoneyEffect.h"
#include "Particle.h"
2018-06-22 23:17:03 +02:00
2024-07-09 16:43:03 +02:00
#include <cassert>
2018-06-22 23:17:03 +02:00
#include <cmath>
2018-11-21 23:16:04 +01:00
#include <iterator>
#include <numeric>
2021-01-23 07:36:46 +00:00
#include <vector>
2014-05-25 19:47:11 +01:00
using namespace OpenRCT2;
using namespace OpenRCT2::Core;
2021-11-24 15:58:16 +02:00
2022-02-12 23:31:06 +02:00
static std::array<std::list<EntityId>, EnumValue(EntityType::Count)> gEntityLists;
static std::vector<EntityId> _freeIdList;
2025-01-19 16:59:45 +01:00
static bool _entityFlashingList[kMaxEntities];
2024-09-27 11:43:02 +03:00
static constexpr const uint32_t kSpatialIndexSize = (kMaximumMapSizeTechnical * kMaximumMapSizeTechnical) + 1;
static constexpr uint32_t kSpatialIndexNullBucket = kSpatialIndexSize - 1;
static constexpr uint32_t kInvalidSpatialIndex = 0xFFFFFFFFu;
static constexpr uint32_t kSpatialIndexDirtyMask = 1u << 31;
2021-05-29 06:01:32 +01:00
2024-09-27 11:43:02 +03:00
static std::array<std::vector<EntityId>, kSpatialIndexSize> gEntitySpatialIndex;
2016-05-09 00:08:03 +01:00
2021-09-12 18:29:37 +02:00
static void FreeEntity(EntityBase& entity);
static constexpr uint32_t ComputeSpatialIndex(const CoordsXY& loc)
2021-01-23 07:36:46 +00:00
{
2021-09-29 09:19:47 -07:00
if (loc.IsNull())
2024-09-27 11:43:02 +03:00
return kSpatialIndexNullBucket;
2021-01-23 07:36:46 +00:00
2021-09-29 09:19:47 -07:00
// NOTE: The input coordinate is rotated and can have negative components.
2024-07-26 18:23:25 +10:00
const auto tileX = std::abs(loc.x) / kCoordsXYStep;
const auto tileY = std::abs(loc.y) / kCoordsXYStep;
2021-01-23 07:36:46 +00:00
if (tileX >= kMaximumMapSizeTechnical || tileY >= kMaximumMapSizeTechnical)
2024-09-27 11:43:02 +03:00
return kSpatialIndexNullBucket;
return tileX * kMaximumMapSizeTechnical + tileY;
2021-01-23 07:36:46 +00:00
}
static constexpr uint32_t GetSpatialIndex(EntityBase& entity)
{
return entity.SpatialIndex & ~kSpatialIndexDirtyMask;
}
constexpr bool EntityTypeIsMiscEntity(const EntityType type)
2021-01-10 15:14:34 +00:00
{
switch (type)
{
case EntityType::SteamParticle:
case EntityType::MoneyEffect:
case EntityType::CrashedVehicleParticle:
case EntityType::ExplosionCloud:
case EntityType::CrashSplash:
case EntityType::ExplosionFlare:
case EntityType::JumpingFountain:
case EntityType::Balloon:
case EntityType::Duck:
return true;
default:
return false;
}
2021-01-10 15:14:34 +00:00
}
2021-03-16 11:18:06 +00:00
uint16_t GetEntityListCount(EntityType type)
{
2021-03-16 11:18:06 +00:00
return static_cast<uint16_t>(gEntityLists[EnumValue(type)].size());
}
uint16_t GetNumFreeEntities()
{
return static_cast<uint16_t>(_freeIdList.size());
}
2021-11-24 15:37:47 +02:00
std::string EntitiesChecksum::ToString() const
{
2024-02-25 09:42:25 -03:00
return String::StringFromHex(raw);
}
2022-02-12 23:31:06 +02:00
EntityBase* TryGetEntity(EntityId entityIndex)
2017-03-10 17:26:08 +00:00
{
auto& gameState = getGameState();
2022-02-12 23:31:06 +02:00
const auto idx = entityIndex.ToUnderlying();
return idx >= kMaxEntities ? nullptr : &gameState.entities[idx].base;
2017-03-10 17:26:08 +00:00
}
2022-02-12 23:31:06 +02:00
EntityBase* GetEntity(EntityId entityIndex)
2016-07-17 22:14:44 +02:00
{
2022-02-12 23:31:06 +02:00
if (entityIndex.IsNull())
{
return nullptr;
}
2025-01-19 16:59:45 +01:00
Guard::Assert(entityIndex.ToUnderlying() < kMaxEntities, "Tried getting entity %u", entityIndex.ToUnderlying());
2021-11-24 15:37:47 +02:00
return TryGetEntity(entityIndex);
2016-07-17 22:14:44 +02:00
}
2022-02-12 23:31:06 +02:00
const std::vector<EntityId>& GetEntityTileList(const CoordsXY& spritePos)
2015-09-05 13:59:12 +01:00
{
return gEntitySpatialIndex[ComputeSpatialIndex(spritePos)];
2015-09-05 13:59:12 +01:00
}
static void ResetEntityLists()
2021-01-21 18:36:34 +00:00
{
for (auto& list : gEntityLists)
{
list.clear();
}
}
2021-01-21 18:36:34 +00:00
static void ResetFreeIds()
{
_freeIdList.clear();
2025-01-19 16:59:45 +01:00
_freeIdList.resize(kMaxEntities);
2022-02-12 23:31:06 +02:00
// List needs to be back to front to simplify removing
2022-02-12 23:31:06 +02:00
auto nextId = 0;
std::for_each(std::rbegin(_freeIdList), std::rend(_freeIdList), [&](auto& elem) {
elem = EntityId::FromUnderlying(nextId);
nextId++;
});
2021-01-21 18:36:34 +00:00
}
2022-02-12 23:31:06 +02:00
const std::list<EntityId>& GetEntityList(const EntityType id)
2021-01-21 18:36:34 +00:00
{
return gEntityLists[EnumValue(id)];
}
2015-03-25 23:57:09 +00:00
2015-12-11 09:38:37 -06:00
/**
*
2015-12-11 09:38:37 -06:00
* rct2: 0x0069EB13
*/
2021-11-24 15:27:48 +02:00
void ResetAllEntities()
2016-05-09 00:08:03 +01:00
{
// Free all associated Entity pointers prior to zeroing memory
2025-01-19 16:59:45 +01:00
for (int32_t i = 0; i < kMaxEntities; ++i)
{
2022-02-12 23:31:06 +02:00
auto* spr = GetEntity(EntityId::FromUnderlying(i));
if (spr == nullptr)
{
continue;
}
FreeEntity(*spr);
}
auto& gameState = getGameState();
std::fill(std::begin(gameState.entities), std::end(gameState.entities), Entity_t());
OpenRCT2::RideUse::GetHistory().Clear();
OpenRCT2::RideUse::GetTypeHistory().Clear();
2025-01-19 16:59:45 +01:00
for (int32_t i = 0; i < kMaxEntities; ++i)
2018-06-22 23:17:03 +02:00
{
2022-02-12 23:31:06 +02:00
auto* spr = GetEntity(EntityId::FromUnderlying(i));
2020-07-06 22:02:25 +01:00
if (spr == nullptr)
{
continue;
}
spr->Type = EntityType::Null;
2023-01-27 19:18:44 +02:00
spr->Id = EntityId::FromUnderlying(i);
2021-11-24 15:37:47 +02:00
_entityFlashingList[i] = false;
2017-06-06 23:24:18 +02:00
}
ResetEntityLists();
ResetFreeIds();
2021-11-24 15:37:47 +02:00
ResetEntitySpatialIndices();
2014-06-21 13:31:28 +01:00
}
static void EntitySpatialInsert(EntityBase& entity, const CoordsXY& newLoc);
2021-01-23 07:36:46 +00:00
/**
2015-12-11 09:38:37 -06:00
*
* rct2: 0x0069EBE4
2014-06-21 13:31:28 +01:00
* This function looks as though it sets some sort of order for sprites.
2017-04-29 23:39:24 -05:00
* Sprites can share their position if this is the case.
2014-06-21 13:31:28 +01:00
*/
2021-11-24 15:37:47 +02:00
void ResetEntitySpatialIndices()
2016-05-09 00:08:03 +01:00
{
2021-11-24 15:27:48 +02:00
for (auto& vec : gEntitySpatialIndex)
2021-01-23 07:36:46 +00:00
{
vec.clear();
}
2025-01-19 16:59:45 +01:00
for (EntityId::UnderlyingType i = 0; i < kMaxEntities; i++)
2018-06-22 23:17:03 +02:00
{
auto* entity = GetEntity(EntityId::FromUnderlying(i));
if (entity != nullptr && entity->Type != EntityType::Null)
2018-06-22 23:17:03 +02:00
{
EntitySpatialInsert(*entity, { entity->x, entity->y });
2017-06-06 23:24:18 +02:00
}
}
}
#ifndef DISABLE_NETWORK
template<typename T>
void NetworkSerialseEntityType(DataSerialiser& ds)
2021-03-27 09:36:41 +00:00
{
for (auto* ent : EntityList<T>())
{
2021-05-09 19:12:44 +01:00
ent->Serialise(ds);
2021-03-27 09:36:41 +00:00
}
}
template<typename... T>
void NetworkSerialiseEntityTypes(DataSerialiser& ds)
2021-03-27 09:36:41 +00:00
{
2021-05-09 19:12:44 +01:00
(NetworkSerialseEntityType<T>(ds), ...);
2021-03-27 09:36:41 +00:00
}
2021-11-24 15:37:47 +02:00
EntitiesChecksum GetAllEntitiesChecksum()
{
2021-11-24 15:37:47 +02:00
EntitiesChecksum checksum{};
2021-05-09 19:12:44 +01:00
OpenRCT2::ChecksumStream ms(checksum.raw);
DataSerialiser ds(true, ms);
NetworkSerialiseEntityTypes<Guest, Staff, Vehicle, Litter>(ds);
return checksum;
}
#else
2021-11-24 15:37:47 +02:00
EntitiesChecksum GetAllEntitiesChecksum()
{
2021-11-24 15:37:47 +02:00
return EntitiesChecksum{};
}
#endif // DISABLE_NETWORK
static void EntityReset(EntityBase& entity)
2016-07-23 13:32:58 +02:00
{
2017-06-06 23:24:18 +02:00
// Need to retain how the sprite is linked in lists
auto entityIndex = entity.Id;
2022-02-12 23:31:06 +02:00
_entityFlashingList[entityIndex.ToUnderlying()] = false;
2016-07-23 13:32:58 +02:00
Entity_t* tempEntity = reinterpret_cast<Entity_t*>(&entity);
*tempEntity = Entity_t();
2016-07-23 13:32:58 +02:00
entity.Id = entityIndex;
entity.Type = EntityType::Null;
2016-07-23 13:32:58 +02:00
}
2025-01-19 16:59:45 +01:00
static constexpr uint16_t kMaxMiscEntities = 1600;
2024-01-19 12:40:14 +02:00
static void AddToEntityList(EntityBase& entity)
2021-01-21 18:36:34 +00:00
{
auto& list = gEntityLists[EnumValue(entity.Type)];
// Entity list is sorted by Id to prevent desyncs.
Algorithm::sortedInsert(list, entity.Id);
2021-01-21 18:36:34 +00:00
}
2022-02-12 23:31:06 +02:00
static void 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);
}
static void RemoveFromEntityList(EntityBase& entity)
2021-01-21 18:36:34 +00:00
{
auto& list = gEntityLists[EnumValue(entity.Type)];
auto ptr = Algorithm::binaryFind(std::begin(list), std::end(list), entity.Id);
2022-03-08 19:49:43 +00:00
if (ptr != std::end(list))
2021-01-21 18:36:34 +00:00
{
list.erase(ptr);
}
}
2021-03-16 11:18:06 +00:00
uint16_t 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);
}
return count;
}
static void 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.
2021-11-24 15:37:47 +02:00
EntityReset(base);
base.Type = type;
AddToEntityList(base);
base.x = kLocationNull;
base.y = kLocationNull;
base.z = 0;
base.SpriteData.Width = 0x10;
base.SpriteData.HeightMin = 0x14;
base.SpriteData.HeightMax = 0x8;
base.SpriteData.SpriteRect = {};
base.SpatialIndex = kInvalidSpatialIndex;
2024-07-26 18:23:25 +10:00
EntitySpatialInsert(base, { kLocationNull, 0 });
}
2021-08-25 17:42:09 +03:00
EntityBase* CreateEntity(EntityType type)
{
if (_freeIdList.size() == 0)
2018-06-22 23:17:03 +02:00
{
// No free sprites.
return nullptr;
}
if (EntityTypeIsMiscEntity(type))
{
// Misc sprites are commonly used for effects, give other entity types higher priority.
2025-01-19 16:59:45 +01:00
if (GetMiscEntityCount() >= kMaxMiscEntities)
{
return nullptr;
}
2025-01-19 16:59:45 +01:00
// If there are less than kMaxMiscEntities free slots, ensure other entities can be created.
if (_freeIdList.size() < kMaxMiscEntities)
2018-06-22 23:17:03 +02:00
{
2018-01-29 17:06:01 +01:00
return nullptr;
2017-06-06 23:24:18 +02:00
}
}
auto* entity = GetEntity(_freeIdList.back());
if (entity == nullptr)
2020-07-06 22:02:25 +01:00
{
return nullptr;
}
_freeIdList.pop_back();
PrepareNewEntity(*entity, type);
return entity;
}
2022-02-12 23:31:06 +02:00
EntityBase* CreateEntityAt(const EntityId index, const EntityType type)
{
auto id = Algorithm::binaryFind(std::rbegin(_freeIdList), std::rend(_freeIdList), index);
2022-03-08 19:49:43 +00:00
if (id == std::rend(_freeIdList))
{
return nullptr;
}
auto* entity = GetEntity(index);
if (entity == nullptr)
{
return nullptr;
}
_freeIdList.erase(std::next(id).base());
PrepareNewEntity(*entity, type);
return entity;
}
2015-06-29 17:22:01 +01:00
template<typename T>
void MiscUpdateAllType()
{
2021-03-16 11:18:06 +00:00
for (auto misc : EntityList<T>())
2018-06-22 23:17:03 +02:00
{
misc->Update();
2017-06-06 23:24:18 +02:00
}
}
template<typename... T>
void MiscUpdateAllTypes()
{
(MiscUpdateAllType<T>(), ...);
}
2014-10-09 20:31:58 +01:00
/**
*
2015-12-11 09:38:37 -06:00
* rct2: 0x00672AA4
2014-10-09 20:31:58 +01:00
*/
2021-11-24 15:37:47 +02:00
void UpdateAllMiscEntities()
2014-10-09 20:31:58 +01:00
{
2022-01-18 10:21:20 -08:00
PROFILED_FUNCTION();
MiscUpdateAllTypes<
SteamParticle, MoneyEffect, VehicleCrashParticle, ExplosionCloud, CrashSplashParticle, ExplosionFlare, JumpingFountain,
Balloon, Duck>();
2014-09-20 16:18:02 +01:00
}
void UpdateMoneyEffect()
{
MiscUpdateAllTypes<MoneyEffect>();
}
// Performs a search to ensure that insert keeps next_in_quadrant in sprite_index order
static void EntitySpatialInsert(EntityBase& entity, const CoordsXY& newLoc)
{
const auto newIndex = ComputeSpatialIndex(newLoc);
2021-11-24 15:27:48 +02:00
auto& spatialVector = gEntitySpatialIndex[newIndex];
Algorithm::sortedInsert(spatialVector, entity.Id);
entity.SpatialIndex = newIndex;
}
static void EntitySpatialRemove(EntityBase& entity)
{
const auto currentIndex = GetSpatialIndex(entity);
2021-11-24 15:27:48 +02:00
auto& spatialVector = gEntitySpatialIndex[currentIndex];
auto index = Algorithm::binaryFind(std::begin(spatialVector), std::end(spatialVector), entity.Id);
2022-03-08 19:49:43 +00:00
if (index != std::end(spatialVector))
2021-01-23 07:36:46 +00:00
{
spatialVector.erase(index, index + 1);
}
else
{
LOG_WARNING("Bad sprite spatial index. Rebuilding the spatial index...");
2021-11-24 15:37:47 +02:00
ResetEntitySpatialIndices();
}
entity.SpatialIndex = kInvalidSpatialIndex;
}
static void UpdateEntitySpatialIndex(EntityBase& entity)
{
if (entity.SpatialIndex & kSpatialIndexDirtyMask)
{
if (entity.SpatialIndex != kInvalidSpatialIndex)
{
EntitySpatialRemove(entity);
}
EntitySpatialInsert(entity, { entity.x, entity.y });
}
}
void UpdateEntitiesSpatialIndex()
{
2024-09-27 11:40:18 +03:00
for (auto& entityList : gEntityLists)
{
2024-09-27 11:40:18 +03:00
for (auto& entityId : entityList)
{
2025-03-21 01:21:00 +02:00
auto* entity = TryGetEntity(entityId);
if (entity != nullptr && entity->Type != EntityType::Null)
{
UpdateEntitySpatialIndex(*entity);
}
}
}
}
CoordsXYZ EntityBase::GetLocation() const
{
return { x, y, z };
}
void EntityBase::SetLocation(const CoordsXYZ& newLocation)
{
2025-03-21 01:21:00 +02:00
if (GetLocation() == newLocation)
{
// No change, this can happen quite often when the entity is interpolated.
return;
}
x = newLocation.x;
y = newLocation.y;
z = newLocation.z;
2025-03-21 01:21:00 +02:00
if (SpatialIndex & kSpatialIndexDirtyMask)
{
// Already marked as dirty.
return;
}
const auto newSpatialIndex = ComputeSpatialIndex({ x, y });
if (newSpatialIndex == GetSpatialIndex(*this))
2025-03-21 01:21:00 +02:00
{
// Avoid marking it dirty when we don't leave the current tile.
return;
}
SpatialIndex |= kSpatialIndexDirtyMask;
}
2024-11-17 19:49:47 +02:00
static void EntitySetCoordinates(const CoordsXYZ& entityPos, EntityBase* entity)
{
auto screenCoords = Translate3DTo2DWithZ(GetCurrentRotation(), entityPos);
entity->SpriteData.SpriteRect = ScreenRect(
screenCoords - ScreenCoordsXY{ entity->SpriteData.Width, entity->SpriteData.HeightMin },
screenCoords + ScreenCoordsXY{ entity->SpriteData.Width, entity->SpriteData.HeightMax });
entity->SetLocation(entityPos);
}
2021-08-25 17:42:09 +03:00
void EntityBase::MoveTo(const CoordsXYZ& newLocation)
{
2024-07-26 18:23:25 +10:00
if (x != kLocationNull)
{
// Invalidate old position.
Invalidate();
}
2020-05-11 12:36:45 +02:00
auto loc = newLocation;
2022-10-12 06:35:20 +01:00
if (!MapIsLocationValid(loc))
2018-06-22 23:17:03 +02:00
{
2024-07-26 18:23:25 +10:00
loc.x = kLocationNull;
2017-06-06 23:24:18 +02:00
}
2014-09-20 16:18:02 +01:00
2024-07-26 18:23:25 +10:00
if (loc.x == kLocationNull)
2018-06-22 23:17:03 +02:00
{
SetLocation(loc);
2018-06-22 23:17:03 +02:00
}
else
{
2021-11-24 15:37:47 +02:00
EntitySetCoordinates(loc, this);
Invalidate(); // Invalidate new position.
2017-06-06 23:24:18 +02:00
}
2016-08-06 10:21:08 -06:00
}
void EntityBase::MoveToAndUpdateSpatialIndex(const CoordsXYZ& newLocation)
{
MoveTo(newLocation);
UpdateEntitySpatialIndex(*this);
}
/**
* Frees any dynamically attached memory to the entity, such as peep name.
*/
2021-09-12 18:29:37 +02:00
static void FreeEntity(EntityBase& entity)
{
2021-09-12 18:29:37 +02:00
auto* guest = entity.As<Guest>();
auto* staff = entity.As<Staff>();
if (staff != nullptr)
{
staff->SetName({});
2021-10-27 21:19:10 +01:00
staff->ClearPatrolArea();
}
else if (guest != nullptr)
{
guest->SetName({});
guest->GuestNextInQueue = EntityId::GetNull();
2023-01-27 19:18:44 +02:00
OpenRCT2::RideUse::GetHistory().RemoveHandle(guest->Id);
OpenRCT2::RideUse::GetTypeHistory().RemoveHandle(guest->Id);
}
}
/**
*
* rct2: 0x0069EDB6
*/
2021-11-24 15:37:47 +02:00
void EntityRemove(EntityBase* entity)
{
2021-11-24 15:37:47 +02:00
FreeEntity(*entity);
2021-11-24 15:37:47 +02:00
EntityTweener::Get().RemoveEntity(entity);
RemoveFromEntityList(*entity); // remove from existing list
2023-01-27 19:18:44 +02:00
AddToFreeList(entity->Id);
EntitySpatialRemove(*entity);
EntityReset(*entity);
}
/**
2021-11-24 15:37:47 +02:00
* Loops through all floating entities and removes them.
* Returns the amount of removed objects as feedback.
*/
2021-11-24 15:37:47 +02:00
uint16_t RemoveFloatingEntities()
{
uint16_t removed = 0;
2021-03-16 11:18:06 +00:00
for (auto* balloon : EntityList<Balloon>())
{
2021-11-24 15:37:47 +02:00
EntityRemove(balloon);
removed++;
}
2021-03-16 11:18:06 +00:00
for (auto* duck : EntityList<Duck>())
{
if (duck->IsFlying())
{
2021-11-24 15:37:47 +02:00
EntityRemove(duck);
removed++;
}
}
2021-03-16 11:18:06 +00:00
for (auto* money : EntityList<MoneyEffect>())
{
2021-11-24 15:37:47 +02:00
EntityRemove(money);
removed++;
}
return removed;
}
2021-11-24 15:37:47 +02:00
void EntitySetFlashing(EntityBase* entity, bool flashing)
{
2025-01-19 16:59:45 +01:00
assert(entity->Id.ToUnderlying() < kMaxEntities);
2023-01-27 19:18:44 +02:00
_entityFlashingList[entity->Id.ToUnderlying()] = flashing;
}
2021-11-24 15:37:47 +02:00
bool EntityGetFlashing(EntityBase* entity)
{
2025-01-19 16:59:45 +01:00
assert(entity->Id.ToUnderlying() < kMaxEntities);
2023-01-27 19:18:44 +02:00
return _entityFlashingList[entity->Id.ToUnderlying()];
}