fixing small issues to save some resources
This commit is contained in:
parent
b714c6f82d
commit
5077c09d38
@ -7,7 +7,8 @@ template<typename StateOwnerType>
|
||||
class StateMachinePool {
|
||||
public:
|
||||
void RegisterEntity(const std::string &id, StateOwnerType &entity) {
|
||||
machines[id] = std::make_unique<StateMachine<StateOwnerType>>(entity, factory);
|
||||
auto machine = std::make_unique<StateMachine<StateOwnerType>>(entity, factory);
|
||||
machines[id] = std::move(machine);
|
||||
}
|
||||
|
||||
void UnregisterEntity(const std::string &id) {
|
||||
|
||||
@ -13,8 +13,6 @@ using json = nlohmann::json;
|
||||
|
||||
template<typename T>
|
||||
class StateMachine {
|
||||
using SharedState = std::shared_ptr<State<T>>;
|
||||
|
||||
public:
|
||||
StateMachine(T &owner, const StateFactory<T> &factory) : owner(owner), factory(factory) {};
|
||||
|
||||
|
||||
@ -48,18 +48,18 @@ class StateSystem {
|
||||
GetPool<T>().Deserialize(j, getEntity);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
void SetStrictTransitions(bool enabled) {
|
||||
GetPool<T>().SetStrictTransitions(enabled);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
void SetAutoTransitions(bool enabled) {
|
||||
GetPool<T>().SetAutoTransitions(enabled);
|
||||
}
|
||||
|
||||
private:
|
||||
template<typename T>
|
||||
template <typename T>
|
||||
StateMachinePool<T> &GetPool() const {
|
||||
static StateMachinePool<T> pool;
|
||||
return pool;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user