Helios Engine 0.1.0
A modular ECS based data-oriented C++23 game engine
 
Loading...
Searching...
No Matches
helios::ecs::details::TryDestroyEntityCmd Class Referencefinal

Command to try destroy a single entity. More...

#include <commands.hpp>

Inheritance diagram for helios::ecs::details::TryDestroyEntityCmd:
helios::ecs::Command

Public Member Functions

constexpr TryDestroyEntityCmd (Entity entity) noexcept
 Constructs try destroy entity command.
 
constexpr TryDestroyEntityCmd (const TryDestroyEntityCmd &) noexcept=default
 
constexpr TryDestroyEntityCmd (TryDestroyEntityCmd &&) noexcept=default
 
constexpr ~TryDestroyEntityCmd () noexcept override=default
 
constexpr TryDestroyEntityCmdoperator= (const TryDestroyEntityCmd &) noexcept=default
 
constexpr TryDestroyEntityCmdoperator= (TryDestroyEntityCmd &&) noexcept=default
 
void Execute (World &world) override
 Executes entity destruction if it exists.
 
- Public Member Functions inherited from helios::ecs::Command
virtual constexpr ~Command () noexcept=default
 

Detailed Description

Command to try destroy a single entity.

Will destroy the entity only if it exists in the world. Invalid entity handle still asserts.

Definition at line 146 of file commands.hpp.

Constructor & Destructor Documentation

◆ TryDestroyEntityCmd() [1/3]

constexpr helios::ecs::details::TryDestroyEntityCmd::TryDestroyEntityCmd ( Entity  entity)
explicitconstexprnoexcept

Constructs try destroy entity command.

Warning
Triggers assertion if entity is invalid.
Parameters
entityEntity to destroy

Definition at line 171 of file commands.hpp.

171 : entity_(entity) {
172 HELIOS_ASSERT(entity.Valid(), "Failed to construct try destroy entity command: Entity with index '{}' is invalid!",
173 entity.Index());
174}
#define HELIOS_ASSERT(condition,...)
Assertion macro that aborts execution in debug builds.
Definition assert.hpp:140

◆ TryDestroyEntityCmd() [2/3]

constexpr helios::ecs::details::TryDestroyEntityCmd::TryDestroyEntityCmd ( const TryDestroyEntityCmd )
constexprdefaultnoexcept

◆ TryDestroyEntityCmd() [3/3]

constexpr helios::ecs::details::TryDestroyEntityCmd::TryDestroyEntityCmd ( TryDestroyEntityCmd &&  )
constexprdefaultnoexcept

◆ ~TryDestroyEntityCmd()

constexpr helios::ecs::details::TryDestroyEntityCmd::~TryDestroyEntityCmd ( )
constexproverridedefaultnoexcept

Member Function Documentation

◆ Execute()

void helios::ecs::details::TryDestroyEntityCmd::Execute ( World world)
inlineoverridevirtual

Executes entity destruction if it exists.

Parameters
worldWorld to remove entity from

Implements helios::ecs::Command.

Definition at line 165 of file commands.hpp.

165{ world.TryDestroyEntity(entity_); }
BasicQuery< World, Allocator, Components... > Query
Type alias for query with mutable world access.
Definition query.hpp:2481

◆ operator=() [1/2]

constexpr TryDestroyEntityCmd & helios::ecs::details::TryDestroyEntityCmd::operator= ( const TryDestroyEntityCmd )
constexprdefaultnoexcept

◆ operator=() [2/2]

constexpr TryDestroyEntityCmd & helios::ecs::details::TryDestroyEntityCmd::operator= ( TryDestroyEntityCmd &&  )
constexprdefaultnoexcept