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

Function RemoveAllBattle

src/state.cpp:88–105  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

86}
87
88bool RemoveAllBattle(StateVec& states, const PermanentStates& ps) {
89 bool any_removed = false;
90 for (int i = 0; i < (int)states.size(); ++i) {
91 auto state_id = i + 1;
92 auto* state = lcf::ReaderUtil::GetElement(lcf::Data::states, state_id);
93 if (state == nullptr) {
94 Output::Warning("State::RemoveAllBattle: Can't remove state with invalid ID {}", state_id);
95 continue;
96 }
97 if (state->type == lcf::rpg::State::Persistence_persists) {
98 if (state->auto_release_prob == 0 || ps.Has(state_id)) {
99 continue;
100 }
101 }
102 any_removed |= Remove(state_id, states, {});
103 }
104 return any_removed;
105}
106
107bool RemoveAll(StateVec& states, const PermanentStates& ps) {
108 bool any_removed = false;

Callers 1

RemoveBattleStatesMethod · 0.85

Calls 3

RemoveFunction · 0.85
sizeMethod · 0.45
HasMethod · 0.45

Tested by

no test coverage detected