Fixes skill database reloading (#4669)
* Fixes #4660. * Resolves an issue with skill database reloading not clearing the previous data first. * While clearing the YAML cache it will also resize the cache to the previous capacity. Thanks to @teededung!
This commit is contained in:
parent
5c35ec7d69
commit
496f362ec9
@ -147,7 +147,11 @@ public:
|
|||||||
void clear() override{
|
void clear() override{
|
||||||
TypesafeYamlDatabase<keytype, datatype>::clear();
|
TypesafeYamlDatabase<keytype, datatype>::clear();
|
||||||
|
|
||||||
|
// Restore size after clearing
|
||||||
|
size_t cap = cache.capacity();
|
||||||
|
|
||||||
cache.clear();
|
cache.clear();
|
||||||
|
cache.resize(cap, nullptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<datatype> find( keytype key ) override{
|
std::shared_ptr<datatype> find( keytype key ) override{
|
||||||
|
@ -21943,7 +21943,7 @@ uint64 SkillDatabase::parseBodyNode(const YAML::Node &node) {
|
|||||||
void SkillDatabase::clear() {
|
void SkillDatabase::clear() {
|
||||||
TypesafeCachedYamlDatabase::clear();
|
TypesafeCachedYamlDatabase::clear();
|
||||||
memset(skilldb_id2idx, 0, sizeof(skilldb_id2idx));
|
memset(skilldb_id2idx, 0, sizeof(skilldb_id2idx));
|
||||||
skill_num = 0;
|
skill_num = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
SkillDatabase skill_db;
|
SkillDatabase skill_db;
|
||||||
@ -22485,15 +22485,14 @@ static void skill_readdb(void)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void skill_reload (void) {
|
void skill_reload (void) {
|
||||||
struct s_mapiterator *iter;
|
skill_db.clear();
|
||||||
struct map_session_data *sd;
|
|
||||||
|
|
||||||
skill_readdb();
|
skill_readdb();
|
||||||
initChangeTables(); // Re-init Status Change tables
|
initChangeTables(); // Re-init Status Change tables
|
||||||
|
|
||||||
/* lets update all players skill tree : so that if any skill modes were changed they're properly updated */
|
/* lets update all players skill tree : so that if any skill modes were changed they're properly updated */
|
||||||
iter = mapit_getallusers();
|
s_mapiterator *iter = mapit_getallusers();
|
||||||
for( sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) ) {
|
|
||||||
|
for( map_session_data *sd = (TBL_PC*)mapit_first(iter); mapit_exists(iter); sd = (TBL_PC*)mapit_next(iter) ) {
|
||||||
pc_validate_skill(sd);
|
pc_validate_skill(sd);
|
||||||
clif_skillinfoblock(sd);
|
clif_skillinfoblock(sd);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user