[DiscordArchive] do you have an example?
[DiscordArchive] do you have an example?
Archived author: whatwere • Posted: 2022-06-22T21:16:49.450000+00:00
Original source
So it copies the list and then checks each ones existence? It's too expensive for something running every movementpacket
Archived author: <o> • Posted: 2022-06-22T21:17:35.464000+00:00
Original source
what rev of ac?
Archived author: <o> • Posted: 2022-06-22T21:18:29.925000+00:00
Original source
at least the latest one doesn't even do that, so i'll guess it's two collections too: <https://github.com/azerothcore/azerothcore-wotlk/blob/92aec9fc3e8fc363db856faab480a8edb32606fd/src/server/game/Entities/Unit/Unit.cpp#L16185>
Archived author: whatwere • Posted: 2022-06-22T21:19:06.535000+00:00
Original source
36f0a7757bde9573262f298aa1eaf6765af8295e
Archived author: whatwere • Posted: 2022-06-22T21:19:58.926000+00:00
Original source
I could probably return a true/false bool if the aura still exists and only iterate if it does.
Archived author: <o> • Posted: 2022-06-22T21:21:53.509000+00:00
Original source
you have this function:
```c++
void Unit::RemoveAura(AuraApplicationMap::iterator& i, AuraRemoveMode mode)
```
it takes an iterator to an aura application map, that's to update it if it's being removed, follow calls to this function and you can probably figure out how you're supposed to iterate that map
Archived author: <o> • Posted: 2022-06-22T21:22:53.878000+00:00
Original source
you should not try to update the collections yourself manually, they're very sensitive to that
Archived author: whatwere • Posted: 2022-06-22T21:23:19.030000+00:00
Original source
Damn you're fast
Archived author: <o> • Posted: 2022-06-22T21:25:32.561000+00:00
Original source
then you just do the typical thing when iterating with erases:
```c++
for (auto it = m_appliedAuras.begin(); it != m_appliedAuras.end(); ) {
if (it->second)
{
bool erased = it->second->GetBase()->CallScriptOnMovementPacket(it); // by ref
if (erased)
continue;
}
++it;
}
```
(my first example was obviously wrong)