Owner-authorized source migration: 31 helper-only translation units were merged into their callers or existing inline headers; both build manifests updated. Includes the preserved source payload, Lua configuration matching wowdecomp, and exact malloca expansion without diagnostic pragmas. 449 native units compiled locally and 449 staged units compiled by the pinned server toolchain. No previously byte-matched function regressed. Compiler mapping diagnostics remain recorded as needs_cleanup, not accepted or peer-confirmed. Existing independent review records are preserved. README.md is intentionally unchanged.
131 lines
2.9 KiB
C++
131 lines
2.9 KiB
C++
#include "Contents/Effects/EffectLists.h"
|
|
#include "Contents/Effects/EffectTypes.h"
|
|
|
|
// OFFSET: 0x00B25750
|
|
// FUNCTION: fn_18783
|
|
CEffect* EffectLists::Find(int actor, int id) const {
|
|
const auto found = this->active.find(actor);
|
|
|
|
if (found != this->active.end()) {
|
|
for (CEffect* effect : found->second) {
|
|
if (effect->id == id) {
|
|
return effect;
|
|
}
|
|
}
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
// OFFSET: 0x00B257C0
|
|
// FUNCTION: fn_18784
|
|
CEffect* EffectLists::Find(int actor, int instance, int id) const {
|
|
const auto found = this->active.find(actor);
|
|
|
|
if (found != this->active.end()) {
|
|
for (CEffect* effect : found->second) {
|
|
if (effect->id == id && effect->unknown_00C4 == instance) {
|
|
return effect;
|
|
}
|
|
}
|
|
}
|
|
|
|
return nullptr;
|
|
}
|
|
|
|
// INLINED
|
|
void EffectLists::RemoveActive(CEffect* effect) {
|
|
const auto found = this->active.find(static_cast<int>(effect->actor));
|
|
|
|
if (found != this->active.end()) {
|
|
found->second.remove(effect);
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00B253A0
|
|
// FUNCTION: fn_18779
|
|
void EffectLists::Retire(CEffect* effect, unsigned char removeActive) {
|
|
if (effect) {
|
|
this->retirement.effects.push_back(effect);
|
|
|
|
if (removeActive == 1) {
|
|
this->RemoveActive(effect);
|
|
}
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00B25120
|
|
// FUNCTION: fn_18777
|
|
void EffectLists::Retire(int actor, int id) {
|
|
if (CEffect* effect = this->Find(actor, id)) {
|
|
this->retirement.effects.push_back(effect);
|
|
this->RemoveActive(effect);
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00B25240
|
|
// FUNCTION: fn_18778
|
|
void EffectLists::Retire(int actor, int instance, int id) {
|
|
if (actor > 0 && instance > 0) {
|
|
if (CEffect* effect = this->Find(actor, instance, id)) {
|
|
this->retirement.effects.push_back(effect);
|
|
this->RemoveActive(effect);
|
|
}
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00B24320
|
|
// FUNCTION: fn_18772
|
|
void EffectLists::RetireActor(int actor) {
|
|
const auto found = this->active.find(actor);
|
|
|
|
if (found != this->active.end()) {
|
|
for (CEffect* effect : found->second) {
|
|
this->retirement.effects.push_back(effect);
|
|
}
|
|
|
|
found->second.clear();
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00B25830
|
|
// FUNCTION: fn_18785
|
|
CEffect* EffectLists::At(int id, unsigned index) const {
|
|
const auto found = this->indexed.find(id);
|
|
|
|
if (found == this->indexed.end() || index >= found->second.size()) {
|
|
return nullptr;
|
|
}
|
|
|
|
return found->second[index];
|
|
}
|
|
|
|
// OFFSET: 0x00B24190
|
|
// FUNCTION: fn_18771
|
|
void EffectLists::Add(int actor, CEffect* effect) {
|
|
this->active[actor].push_back(effect);
|
|
|
|
switch (effect->id) {
|
|
case EF_EMITTER:
|
|
case EF_MAGIC_FLOOR:
|
|
case EF_EVILS_PAW:
|
|
case EF_ANIMATED_EMITTER:
|
|
case EF_NEW_RANGEDATTACK:
|
|
case 2343:
|
|
this->indexed[effect->id].push_back(effect);
|
|
break;
|
|
}
|
|
}
|
|
|
|
// OFFSET: 0x00B254C0
|
|
// FUNCTION: fn_18780
|
|
void EffectLists::Clear() {
|
|
for (auto& [actor, effects] : this->active) {
|
|
this->RetireActor(actor);
|
|
}
|
|
|
|
this->active.clear();
|
|
this->RetireActor(0);
|
|
this->indexed.clear();
|
|
this->retirement.Clear();
|
|
}
|