Files
ss/src/s/s_StateMethodUsr_FI.cpp
T
Elijah Thomas 26af4db82d update from dtk-template - clangd :) (#66)
* update from dtk-template and start work towards using clangd

* include <a> -> "a"

* Update build.yml

* remove/add non-trivial class in union warning
2024-10-16 15:36:02 -04:00

32 lines
1.1 KiB
C++

#include "s/s_StateMethodUsr_FI.hpp"
#include "common.h"
// Note: Ported from https://github.com/NSMBW-Community/NSMBW-Decomp/tree/master/include/dol/sLib
// See include/s/README.txt for changes made
sStateMethodUsr_FI_c::sStateMethodUsr_FI_c(sStateIDChkIf_c &check, sStateFctIf_c &factory, const sStateIDIf_c &state)
: sStateMethod_c(check, factory, state) {}
int sStateMethodUsr_FI_c::initializeStateLocalMethod() {
mpState = mpStateFct.build(*getNewStateID()); // Create new state holder with the next state ID
mpState->initialize();
return 1;
}
void sStateMethodUsr_FI_c::executeStateLocalMethod() {
initializeStateMethod(); // Ensure we are in a valid state (this only actually initializes the state if !mIsValid)
mpState->execute();
}
void sStateMethodUsr_FI_c::finalizeStateLocalMethod() {
mpState->finalize();
mpStateFct.dispose(mpState);
}
void sStateMethodUsr_FI_c::changeStateLocalMethod(const sStateIDIf_c &newID) {
finalizeStateMethod(); // Terminate the current state
initializeStateMethod(); // Initialize the new state
}