Closed kygov closed 2 months ago
This doesn't work either as expected, I'd suggest to do it the safe way with 2 loops
std::vector<std::string> invalid; for (auto& event : creatureEvents) { if (event.second.getScriptId() == 0) { invalid.push_back(event.first); } } for (auto& toRemove : invalid) { creatureEvents.erase(toRemove); } invalid.clear();
What's not working as expected?
What's not working as expected?
tried it on different online debuggers, the first one I tried gave weird outcomes, others work just fine sorry my mistake
could be std::erase_if
Pull Request Prelude
Changes Proposed
Fixed broken iteration.
Issues addressed: Crash because removing element from map and iterating.