MCPcopy Create free account
hub / github.com/EasyRPG/Player / Remove

Function Remove

src/state.cpp:63–86  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

61}
62
63bool Remove(int state_id, StateVec& states, const PermanentStates& ps) {
64 const lcf::rpg::State* state = lcf::ReaderUtil::GetElement(lcf::Data::states, state_id);
65 if (!state) {
66 Output::Warning("State::Remove: Can't remove state with invalid ID {}", state_id);
67 return false;
68 }
69
70 if (state_id - 1 >= static_cast<int>(states.size())) {
71 return false;
72 }
73
74 auto& st = states[state_id - 1];
75
76 if (!st) {
77 return false;
78 }
79
80 if (ps.Has(state_id)) {
81 return false;
82 }
83
84 st = 0;
85 return true;
86}
87
88bool RemoveAllBattle(StateVec& states, const PermanentStates& ps) {
89 bool any_removed = false;

Callers 6

RemoveAllBattleFunction · 0.85
RemoveAllFunction · 0.85
RemoveStateMethod · 0.85
vExecuteMethod · 0.85
~DrawableMethod · 0.85

Calls 2

sizeMethod · 0.45
HasMethod · 0.45

Tested by

no test coverage detected