More cleanup

This commit is contained in:
jonschz 2025-07-13 09:58:33 +02:00
parent ebc9de60ff
commit 9f4439ef8f

View File

@ -187,48 +187,50 @@ void Act3List::RemoveByObjectIdOrFirst(MxU32 p_objectId)
// Removing it decreases the match percentage. // Removing it decreases the match percentage.
Act3List::iterator unused_iterator; Act3List::iterator unused_iterator;
if (!empty()) { if (empty()) {
if (!p_objectId) { return;
pop_front(); }
removed = TRUE;
} if (!p_objectId) {
else { pop_front();
for (it = begin(); it != end(); it++) { removed = TRUE;
Act3ListElement& current = *it; }
// No idea why `current` is used in one comparison but not the other, else {
// but this is what produces the best match. for (it = begin(); it != end(); it++) {
if (current.m_hasStarted && (*it).m_objectId == p_objectId) { Act3ListElement& current = *it;
erase(it); // No idea why `current` is used in one comparison but not the other,
removed = TRUE; // but this is what produces the best match.
break; if (current.m_hasStarted && (*it).m_objectId == p_objectId) {
} erase(it);
removed = TRUE;
break;
} }
} }
}
if (removed && size() > 0) { if (removed && size() > 0) {
it = begin(); it = begin();
unused_iterator = it; unused_iterator = it;
Act3ListElement& firstItem = front(); Act3ListElement& firstItem = front();
it++; it++;
while (it != end()) { while (it != end()) {
if ((*it).m_unk0x04 == 1) { if ((*it).m_unk0x04 == 1) {
for (Act3List::iterator it2 = begin(); it2 != it; erase(it2++)) { for (Act3List::iterator it2 = begin(); it2 != it; erase(it2++)) {
if ((*it2).m_hasStarted) { if ((*it2).m_hasStarted) {
DeleteActionWrapper(); DeleteActionWrapper();
return; return;
}
} }
} }
it++;
unused_iterator++;
} }
if (!firstItem.m_hasStarted) { it++;
firstItem.m_hasStarted = TRUE; unused_iterator++;
InvokeAction(Extra::e_start, *g_act3Script, firstItem.m_objectId, NULL); }
}
if (!firstItem.m_hasStarted) {
firstItem.m_hasStarted = TRUE;
InvokeAction(Extra::e_start, *g_act3Script, firstItem.m_objectId, NULL);
} }
} }
} }