NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
s_StateMgr.hpp
1#pragma once
2#include <dol/sLib/s_StateInterfaces.hpp>
3
13template <class T, class Method, template <class> class Factory, class Check>
15public:
16 sStateMgr_c(T &owner, const sStateIDIf_c &initialState) :
17 mFactory(owner),
18 mMethod(mCheck, mFactory, initialState) {}
19
20 virtual void initializeState() { mMethod.initializeStateMethod(); }
21 virtual void executeState() { mMethod.executeStateMethod(); }
22 virtual void finalizeState() { mMethod.finalizeStateMethod(); }
23
24 virtual void changeState(const sStateIDIf_c &newState) { mMethod.changeStateMethod(newState); }
25
26 virtual void refreshState() { mMethod.refreshStateMethod(); }
27
28 virtual sStateIf_c *getState() const { return mMethod.getState(); }
29 virtual const sStateIDIf_c *getNewStateID() const { return mMethod.getNewStateID(); }
30 virtual const sStateIDIf_c *getStateID() const { return mMethod.getStateID(); }
31 virtual const sStateIDIf_c *getOldStateID() const { return mMethod.getOldStateID(); }
32
33private:
34 Check mCheck;
35 Factory<T> mFactory;
36 Method mMethod;
37};
The interface for state IDs.
The interface for a state holder.
The interface for state managers.
An implementation of sStateMgrIf_c.
virtual void executeState()
Executes the current state.
virtual void refreshState()
Marks the current state to be executed again.
virtual const sStateIDIf_c * getOldStateID() const
Gets the previous state ID.
virtual void finalizeState()
Prepares the current state for termination.
virtual const sStateIDIf_c * getStateID() const
Gets the current state ID.
virtual const sStateIDIf_c * getNewStateID() const
Gets the next state ID.
virtual sStateIf_c * getState() const
Gets the state holder.
virtual void changeState(const sStateIDIf_c &newState)
Transitions to a new state ID.
virtual void initializeState()
Initializes the current state.