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:
KimLS
2014-01-31 20:38:32 -08:00
parent 1ab19920f4
commit 6e0a214bcc
6 changed files with 60 additions and 1 deletions
+24
View File
@@ -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())