Added MachinePool::Update
MachinePool::Update allows a user update the states of a single machine
This commit is contained in:
parent
7f441153ab
commit
c42b0aa5bf
@ -30,6 +30,12 @@ class StateMachinePool {
|
||||
|
||||
void UpdateAll() {
|
||||
for (const auto &[id, machine] : machines) {
|
||||
Update(id);
|
||||
}
|
||||
}
|
||||
|
||||
void Update(const std::string &id) {
|
||||
auto &machine = machines.find(id);
|
||||
auto &owner = machine->GetOwner();
|
||||
const std::string ¤t = machine->GetCurrentStateId();
|
||||
|
||||
@ -42,7 +48,6 @@ class StateMachinePool {
|
||||
}
|
||||
machine->Update();
|
||||
}
|
||||
}
|
||||
|
||||
void ChangeState(const std::string &id, const std::string &stateId) {
|
||||
auto it = machines.find(id);
|
||||
|
||||
@ -43,6 +43,11 @@ class StateSystem {
|
||||
GetPool<T>().UpdateAll();
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
void Update(const std::string &id) {
|
||||
GetPool<T>().Update(id);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
json Serialize() const {
|
||||
StateMachinePool<T> &pool = GetPool<T>();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user