| 156 | |
| 157 | } |
| 158 | const lcf::rpg::State* GetSignificantState(const StateVec& states) { |
| 159 | int priority = 0; |
| 160 | const lcf::rpg::State* sig_state = NULL; |
| 161 | |
| 162 | for (int i = 0; i < (int)states.size(); ++i) { |
| 163 | auto state_id = i + 1; |
| 164 | |
| 165 | if (!Has(state_id, states)) { |
| 166 | continue; |
| 167 | } |
| 168 | |
| 169 | auto* state = lcf::ReaderUtil::GetElement(lcf::Data::states, state_id); |
| 170 | if (state == nullptr) { |
| 171 | Output::Warning("State::GetSignificantState: Can't remove state with invalid ID {}", state_id); |
| 172 | continue; |
| 173 | } |
| 174 | |
| 175 | // Death has highest priority |
| 176 | if (state->ID == lcf::rpg::State::kDeathID) { |
| 177 | return state; |
| 178 | } |
| 179 | |
| 180 | if (state->priority >= priority) { |
| 181 | sig_state = state; |
| 182 | priority = state->priority; |
| 183 | } |
| 184 | }; |
| 185 | |
| 186 | return sig_state; |
| 187 | |
| 188 | } |
| 189 | |
| 190 | int GetStateRate(int state_id, int rate) { |
| 191 | const lcf::rpg::State* state = lcf::ReaderUtil::GetElement(lcf::Data::states, state_id); |
no test coverage detected