1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-24 15:24:30 +01:00
Files
OpenRCT2/src/openrct2/entity/EntityRegistry.h
James103 1d8dc111f1 Replace 2023 with 2024 in copyright headers (#21139)
Replace all instances of the year 2023 with 2024 in all copyright headers
2024-01-01 12:52:28 +01:00

70 lines
1.9 KiB
C++

/*****************************************************************************
* Copyright (c) 2014-2024 OpenRCT2 developers
*
* For a complete list of all authors, please refer to contributors.md
* Interested in contributing? Visit https://github.com/OpenRCT2/OpenRCT2
*
* OpenRCT2 is licensed under the GNU General Public License version 3.
*****************************************************************************/
#pragma once
#include "../common.h"
#include "EntityBase.h"
#include <array>
constexpr uint16_t MAX_ENTITIES = 65535;
EntityBase* GetEntity(EntityId sprite_idx);
template<typename T> T* GetEntity(EntityId sprite_idx)
{
auto spr = GetEntity(sprite_idx);
return spr != nullptr ? spr->As<T>() : nullptr;
}
EntityBase* TryGetEntity(EntityId spriteIndex);
template<typename T> T* TryGetEntity(EntityId sprite_idx)
{
auto spr = TryGetEntity(sprite_idx);
return spr != nullptr ? spr->As<T>() : nullptr;
}
EntityBase* CreateEntity(EntityType type);
template<typename T> T* CreateEntity()
{
return static_cast<T*>(CreateEntity(T::cEntityType));
}
// Use only with imports that must happen at a specified index
EntityBase* CreateEntityAt(const EntityId index, const EntityType type);
// Use only with imports that must happen at a specified index
template<typename T> T* CreateEntityAt(const EntityId index)
{
return static_cast<T*>(CreateEntityAt(index, T::cEntityType));
}
void ResetAllEntities();
void ResetEntitySpatialIndices();
void UpdateAllMiscEntities();
void UpdateMoneyEffect();
void EntitySetCoordinates(const CoordsXYZ& entityPos, EntityBase* entity);
void EntityRemove(EntityBase* entity);
uint16_t RemoveFloatingEntities();
#pragma pack(push, 1)
struct EntitiesChecksum
{
std::array<std::byte, 20> raw;
std::string ToString() const;
};
#pragma pack(pop)
EntitiesChecksum GetAllEntitiesChecksum();
void EntitySetFlashing(EntityBase* entity, bool flashing);
bool EntityGetFlashing(EntityBase* entity);