From c50100fcdb06b8e214ceb775739927104d4e695d Mon Sep 17 00:00:00 2001 From: Akkadius Date: Mon, 12 Feb 2024 21:41:52 -0600 Subject: [PATCH] [Hotfix] Fix issues where we're using the wrong database pointers --- CHANGELOG.md | 6 ++++++ common/guild_base.h | 14 ++++++++++++-- common/version.h | 2 +- package.json | 2 +- world/wguild_mgr.cpp | 4 ++-- world/world_boot.cpp | 2 +- zone/main.cpp | 2 +- zone/spawn2.cpp | 4 ++-- 8 files changed, 26 insertions(+), 10 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d3fc3ea5e..024505c7b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## [22.44.5] - 2/12/2024 + +### Fixes + +* [Hotfix] Fix issues where we're using the wrong database pointers @Akkadius + ## [22.44.4] - 2/12/2024 ### Fixes diff --git a/common/guild_base.h b/common/guild_base.h index c9e95e484..f7bb50d16 100644 --- a/common/guild_base.h +++ b/common/guild_base.h @@ -75,9 +75,18 @@ class BaseGuildManager virtual ~BaseGuildManager(); //this must be called before doing anything else with this object - void SetDatabase(Database *db) + BaseGuildManager * SetDatabase(Database *db) { m_db = db; + + return this; + } + + BaseGuildManager * SetContentDatabase(Database *db) + { + m_content_db = db; + + return this; } bool LoadGuilds(); @@ -194,7 +203,8 @@ class BaseGuildManager std::map m_guilds; //we own the pointers in this map void ClearGuilds(); //clears internal structure - Database *m_db; //we do not own this + Database *m_db; + Database *m_content_db; bool _StoreGuildDB(uint32 guild_id); GuildInfo* _CreateGuild(uint32 guild_id, std::string guild_name, uint32 leader_char_id, uint8 minstatus, std::string guild_motd, std::string motd_setter, std::string Channel, std::string URL, uint32 favour); diff --git a/common/version.h b/common/version.h index 829a139ce..9130b7042 100644 --- a/common/version.h +++ b/common/version.h @@ -25,7 +25,7 @@ // Build variables // these get injected during the build pipeline -#define CURRENT_VERSION "22.44.4-dev" // always append -dev to the current version for custom-builds +#define CURRENT_VERSION "22.44.5-dev" // always append -dev to the current version for custom-builds #define LOGIN_VERSION "0.8.0" #define COMPILE_DATE __DATE__ #define COMPILE_TIME __TIME__ diff --git a/package.json b/package.json index 87d9e3bcb..9d7caa530 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "eqemu-server", - "version": "22.44.4", + "version": "22.44.5", "repository": { "type": "git", "url": "https://github.com/EQEmu/Server.git" diff --git a/world/wguild_mgr.cpp b/world/wguild_mgr.cpp index 7ac10012f..adfa1243a 100644 --- a/world/wguild_mgr.cpp +++ b/world/wguild_mgr.cpp @@ -325,7 +325,7 @@ bool WorldGuildManager::LoadTributes() tribute_list.clear(); - auto tributes = TributesRepository::All(*m_db); + auto tributes = TributesRepository::All(*m_content_db); for (auto const& t : tributes) { td.name = t.name; td.description = t.descr; @@ -336,7 +336,7 @@ bool WorldGuildManager::LoadTributes() LogInfo("Loaded [{}] tributes", Strings::Commify(tributes.size())); - auto tribute_levels = TributeLevelsRepository::GetWhere(*m_db, "TRUE ORDER BY tribute_id, level"); + auto tribute_levels = TributeLevelsRepository::GetWhere(*m_content_db, "TRUE ORDER BY tribute_id, level"); for (auto const& t : tribute_levels) { uint32 id = t.tribute_id; diff --git a/world/world_boot.cpp b/world/world_boot.cpp index 761aeedda..b05e3abc7 100644 --- a/world/world_boot.cpp +++ b/world/world_boot.cpp @@ -264,7 +264,7 @@ bool WorldBoot::DatabaseLoadRoutines(int argc, char **argv) } } - guild_mgr.SetDatabase(&database); + guild_mgr.SetDatabase(&database)->SetContentDatabase(&content_db); LogInfo("Purging expired data buckets"); database.PurgeAllDeletedDataBuckets(); diff --git a/zone/main.cpp b/zone/main.cpp index c3f303137..88ba232a9 100644 --- a/zone/main.cpp +++ b/zone/main.cpp @@ -318,7 +318,7 @@ int main(int argc, char **argv) } /* Guilds */ - guild_mgr.SetDatabase(&database); + guild_mgr.SetDatabase(&database)->SetContentDatabase(&content_db); GuildBanks = nullptr; #ifdef _EQDEBUG diff --git a/zone/spawn2.cpp b/zone/spawn2.cpp index 82a94ca53..80c5471d3 100644 --- a/zone/spawn2.cpp +++ b/zone/spawn2.cpp @@ -440,14 +440,14 @@ bool ZoneDatabase::PopulateZoneSpawnList(uint32 zoneid, LinkedList &spa std::unordered_map spawn_times; - timeval tv; + timeval tv{}; gettimeofday(&tv, nullptr); /* Bulk Load NPC Types Data into the cache */ content_db.LoadNPCTypesData(0, true); const auto& l = RespawnTimesRepository::GetWhere( - *this, + database, fmt::format( "`instance_id` = {}", zone->GetInstanceID()