1
0
mirror of https://github.com/OpenRCT2/OpenRCT2 synced 2026-01-23 23:04:36 +01:00
Files
OpenRCT2/src/openrct2/entity/EntityRegistry.h
73 b9e677945d Replace 20XX with 2022 (#18158)
* Replace 2020 with 2022

Replace all 2020 headers with 2022

* replace other years with 2022

add missing years
2022-10-01 08:42:14 +01:00

69 lines
1.9 KiB
C++

/*****************************************************************************
* Copyright (c) 2014-2022 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 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);