Make npc_spells_cache a map fixes #705

Should probably add a way to clear the cache, but we didn't do that
before so I didn't bother.
This commit is contained in:
Michael Cook (mackal)
2018-01-29 23:36:05 -05:00
parent 5d9c8c8e27
commit 6716e580f3
3 changed files with 93 additions and 137 deletions
+5 -5
View File
@@ -1,6 +1,8 @@
#ifndef ZONEDB_H_
#define ZONEDB_H_
#include <unordered_set>
#include "../common/shareddb.h"
#include "../common/eq_packet_structs.h"
#include "position.h"
@@ -75,7 +77,6 @@ struct DBnpcspells_Struct {
int16 rproc_chance;
uint16 defensive_proc;
int16 dproc_chance;
uint32 numentries;
uint32 fail_recast;
uint32 engaged_no_sp_recast_min;
uint32 engaged_no_sp_recast_max;
@@ -88,7 +89,7 @@ struct DBnpcspells_Struct {
uint32 idle_no_sp_recast_min;
uint32 idle_no_sp_recast_max;
uint8 idle_beneficial_chance;
DBnpcspells_entries_Struct entries[0];
std::vector<DBnpcspells_entries_Struct> entries;
};
struct DBnpcspellseffects_Struct {
@@ -524,10 +525,9 @@ protected:
uint32 max_faction;
Faction** faction_array;
uint32 npc_spells_maxid;
uint32 npc_spellseffects_maxid;
DBnpcspells_Struct** npc_spells_cache;
bool* npc_spells_loadtried;
std::unordered_map<uint32, DBnpcspells_Struct> npc_spells_cache;
std::unordered_set<uint32> npc_spells_loadtried;
DBnpcspellseffects_Struct** npc_spellseffects_cache;
bool* npc_spellseffects_loadtried;
uint8 door_isopen_array[255];