summaryrefslogtreecommitdiff
path: root/src/s/s_StateID.cpp
blob: bc2bdcafeb7bfea27795883b432c821264c111d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
// clang-format off
#include "s/s_StateID.hpp"

#include "common.h"
#include "s/s_StateMethodUsr_FI.hpp"
#include "s/s_StateInterfaces.hpp"
#include "s/s_StateIDChk.hpp"
// clang-format on

// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made

sStateID_c::NumberMemo_c sStateID_c::sm_numberMemo;
const sStateID_c sStateID::null(nullptr);

sStateID_c::sStateID_c(const char *name) {
    mpName = name;
    mNumber = (name != nullptr) ? sm_numberMemo.get() : 0;
}

sStateID_c::~sStateID_c() {}

bool sStateID_c::isNull() const {
    return mNumber == 0;
}

bool sStateID_c::isEqual(const sStateIDIf_c &other) const {
    return number() == other.number();
}

BOOL sStateID_c::operator==(const sStateIDIf_c &other) const {
    return isEqual(other);
}

BOOL sStateID_c::operator!=(const sStateIDIf_c &other) const {
    return !isEqual(other);
}

bool sStateID_c::isSameName(const char *name) const {
    // Just return false, the full implementation is in sFStateID_c
    return false;
}

const char *sStateID_c::name() const {
    return mpName;
}

unsigned int sStateID_c::number() const {
    return mNumber;
}

sStateFctIf_c::~sStateFctIf_c() {}
sStateIDChkIf_c::~sStateIDChkIf_c() {}
sStateIDChk_c::~sStateIDChk_c() {}
sStateIDIf_c::~sStateIDIf_c() {}
sStateIf_c::~sStateIf_c() {}
sStateMethodIf_c::~sStateMethodIf_c() {}
sStateMethodUsr_FI_c::~sStateMethodUsr_FI_c() {}
sStateMgrIf_c::~sStateMgrIf_c() {}