NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
s_FStateVirtualID.hpp
1#pragma once
2#include <game/sLib/s_FStateID.hpp>
3#include <game/sLib/s_StateID.hpp>
4
5template <typename T>
6class sFStateVirtualID_c : public sFStateID_c<T> {
7public:
8 typedef void (T::*stateFunc)();
9
10 sFStateVirtualID_c(
11 const sStateIDIf_c &superState, const char *name,
12 stateFunc initialize, stateFunc execute, stateFunc finalize
13 ) :
14 sFStateID_c<T>(name, initialize, execute, finalize),
15 mSuperState(superState) {}
16
17 virtual unsigned int number() const {
18 return superID()->numberBase();
19 }
20
21 const sFStateVirtualID_c<T> *superID() const {
22 if (!mSuperState.isNull()) {
23 return ((const sFStateVirtualID_c<T> &) mSuperState).superID();
24 }
25 return this;
26 }
27
28 unsigned int numberBase() const {
29 return sStateID_c::number();
30 }
31
32private:
33 const sStateIDIf_c &mSuperState;
34};
sFStateID_c(const char *name, stateFunc initialize, stateFunc execute, stateFunc finalize)
Constructs a new sFStateID_c instance.
virtual unsigned int number() const
Returns the number of this state ID.
The interface for state IDs.
virtual bool isNull() const =0
Returns whether this is a null state.
virtual const char * name() const
Returns the name of this state ID.
Definition s_StateID.cpp:35
virtual unsigned int number() const
Returns the number of this state ID.
Definition s_StateID.cpp:39