Fix annoying aura crash that has been around for a year and a half, add aura logging, utilize close lists

This commit is contained in:
Akkadius 2020-01-19 21:57:28 -06:00
parent 6c91786cfb
commit 6f73278cf8
7 changed files with 471 additions and 244 deletions

View File

@ -113,6 +113,7 @@ namespace Logs {
AoeCast,
EntityManagement,
Flee,
Aura,
MaxCategoryID /* Don't Remove this */
};
@ -185,6 +186,7 @@ namespace Logs {
"AOE Cast",
"Entity Management",
"Flee",
"Aura",
};
}

View File

@ -551,6 +551,16 @@
OutF(LogSys, Logs::Detail, Logs::Flee, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogAura(message, ...) do {\
if (LogSys.log_settings[Logs::Aura].is_category_enabled == 1)\
OutF(LogSys, Logs::General, Logs::Aura, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define LogAuraDetail(message, ...) do {\
if (LogSys.log_settings[Logs::Aura].is_category_enabled == 1)\
OutF(LogSys, Logs::Detail, Logs::Aura, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
} while (0)
#define Log(debug_level, log_category, message, ...) do {\
if (LogSys.log_settings[log_category].is_category_enabled == 1)\
LogSys.Out(debug_level, log_category, __FILE__, __func__, __LINE__, message, ##__VA_ARGS__);\
@ -878,6 +888,12 @@
#define LogFleeDetail(message, ...) do {\
} while (0)
#define LogAura(message, ...) do {\
} while (0)
#define LogAuraDetail(message, ...) do {\
} while (0)
#define Log(debug_level, log_category, message, ...) do {\
} while (0)

File diff suppressed because it is too large Load Diff

View File

@ -73,7 +73,7 @@ private:
int m_owner;
int aura_id; // spell ID of the aura spell -1 if aura isn't from a casted spell
int spell_id; // spell we cast
int distance; // distance we remove
float distance; // distance we remove
Timer remove_timer; // when we depop
Timer process_timer; // rate limit process calls
Timer cast_timer; // some auras pulse

View File

@ -2624,6 +2624,24 @@ bool EntityList::RemoveMobFromCloseLists(Mob *mob)
return false;
}
/**
* @param mob
* @return
*/
void EntityList::RemoveAuraFromMobs(Mob *aura)
{
LogEntityManagement(
"Attempting to remove aura [{}] from mobs entity_id ({})",
aura->GetCleanName(),
aura->GetID()
);
for (auto &it : mob_list) {
auto mob = it.second;
mob->RemoveAura(aura->GetID());
}
}
/**
* @param close_mobs
* @param scanning_mob

View File

@ -293,6 +293,7 @@ public:
bool RemoveObject(uint16 delete_id);
bool RemoveProximity(uint16 delete_npc_id);
bool RemoveMobFromCloseLists(Mob *mob);
void RemoveAuraFromMobs(Mob *aura);
void RemoveAllMobs();
void RemoveAllClients();
void RemoveAllNPCs();
@ -584,7 +585,6 @@ private:
private:
std::list<Bot*> bot_list;
#endif
};
class BulkZoneSpawnPacket {

View File

@ -503,6 +503,8 @@ Mob::~Mob()
UninitializeBuffSlots();
entity_list.RemoveMobFromCloseLists(this);
entity_list.RemoveAuraFromMobs(this);
close_mobs.clear();
#ifdef BOTS