NSMBW-Decomp
A decompilation of New Super Mario Bros. Wii
Loading...
Searching...
No Matches
s_StateID.cpp
1#include <types.h>
2#include <game/sLib/s_StateID.hpp>
3
6
7sStateID_c::sStateID_c(const char *name) {
8 mpName = name;
9 mNumber = (name != nullptr) ? sm_numberMemo.get() : 0;
10}
11
12sStateID_c::~sStateID_c() {}
13
14bool sStateID_c::isNull() const {
15 return mNumber == 0;
16}
17
18bool sStateID_c::isEqual(const sStateIDIf_c &other) const {
19 return number() == other.number();
20}
21
22bool sStateID_c::operator==(const sStateIDIf_c &other) const {
23 return isEqual(other);
24}
25
26bool sStateID_c::operator!=(const sStateIDIf_c &other) const {
27 return !isEqual(other);
28}
29
30bool sStateID_c::isSameName(const char *name) const {
31 // Just return false, the full implementation is in sFStateID_c
32 return false;
33}
34
35const char *sStateID_c::name() const {
36 return mpName;
37}
38
39unsigned int sStateID_c::number() const {
40 return mNumber;
41}
The interface for state IDs.
virtual unsigned int number() const =0
Returns the number of this state ID.
A generic implementation of a state ID.
Definition s_StateID.hpp:7
virtual bool isSameName(const char *name) const
Returns whether this state ID is called name.
Definition s_StateID.cpp:30
unsigned int mNumber
The number of this state ID.
Definition s_StateID.hpp:34
const char * mpName
The name of this state ID.
Definition s_StateID.hpp:33
static NumberMemo_c sm_numberMemo
Used to give each state a unique number.
Definition s_StateID.hpp:36
virtual const char * name() const
Returns the name of this state ID.
Definition s_StateID.cpp:35
virtual bool isNull() const
Returns whether this is a null state.
Definition s_StateID.cpp:14
virtual bool isEqual(const sStateIDIf_c &other) const
Returns whether both states have the same number.
Definition s_StateID.cpp:18
virtual bool operator==(const sStateIDIf_c &other) const
Overloaded equality operator, using isEqual.
Definition s_StateID.cpp:22
virtual unsigned int number() const
Returns the number of this state ID.
Definition s_StateID.cpp:39
virtual bool operator!=(const sStateIDIf_c &other) const
Overloaded inequality operator, using isEqual.
Definition s_StateID.cpp:26
sStateID_c null