mirror of
https://github.com/EQEmu/Server.git
synced 2026-06-11 03:31:08 +00:00
Compiler option for playing with npctype_cache as was requested for a feature. Not entirely tested may need some work. Currently defaults to old behavior on #repop.
This commit is contained in:
@@ -1518,16 +1518,40 @@ bool Zone::Depop(bool StartSpawnTimer) {
|
||||
std::map<uint32,NPCType *>::iterator itr;
|
||||
entity_list.Depop(StartSpawnTimer);
|
||||
|
||||
#ifdef DEPOP_INVALIDATES_NPC_TYPES_CACHE
|
||||
// Refresh npctable, getting current info from database.
|
||||
while(npctable.size()) {
|
||||
itr=npctable.begin();
|
||||
delete itr->second;
|
||||
npctable.erase(itr);
|
||||
}
|
||||
#endif
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void Zone::ClearNPCTypeCache(int id) {
|
||||
if (id <= 0) {
|
||||
auto iter = npctable.begin();
|
||||
while (iter != npctable.end()) {
|
||||
delete iter->second;
|
||||
++iter;
|
||||
}
|
||||
npctable.clear();
|
||||
}
|
||||
else {
|
||||
auto iter = npctable.begin();
|
||||
while (iter != npctable.end()) {
|
||||
if (iter->first == (uint32)id) {
|
||||
delete iter->second;
|
||||
npctable.erase(iter);
|
||||
return;
|
||||
}
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Zone::Repop(uint32 delay) {
|
||||
|
||||
if(!Depop())
|
||||
|
||||
Reference in New Issue
Block a user