Changed MythicPlus and MpDataStore to pure singletons and updated current

calling scripts to not get the instance just call via defined macro
This commit is contained in:
2024-08-31 23:17:52 -04:00
parent 87d748cef6
commit 2c8b67ef07
6 changed files with 163 additions and 62 deletions

View File

@@ -2,6 +2,7 @@
#include "Log.h"
#include "MapMgr.h"
#include "MpLogger.h"
#include "MpDataStore.h"
#include "MythicPlus.h"
#include "Player.h"
#include "ScriptMgr.h"
@@ -15,10 +16,9 @@ public:
void OnCreateMap(Map* map)
{
static MythicPlus* mp = MythicPlus::getInstance();
MpLogger::debug("AllMapScript::OnCreateMap(): {}", map->GetMapName());
if (!mp->IsMapEligible(map)) {
if (!sMythicPlus->IsMapEligible(map)) {
return;
}
@@ -27,10 +27,9 @@ public:
void OnPlayerEnterAll(Map* map, Player* player)
{
static MythicPlus* mp = MythicPlus::getInstance();
MpLogger::debug("AllMapScript::OnPlayerEnterAll(): {}", map->GetMapName());
if (!mp->IsMapEligible(map)) {
if (!sMythicPlus->IsMapEligible(map)) {
return;
}
@@ -38,10 +37,9 @@ public:
void OnPlayerLeaveAll(Map* map, Player* player)
{
static MythicPlus* mp = MythicPlus::getInstance();
MpLogger::debug("AllMapScript::OnPlayerLeaveAll(): {}", map->GetMapName());
if (!mp->IsMapEligible(map)) {
if (!sMythicPlus->IsMapEligible(map)) {
return;
}
@@ -53,4 +51,4 @@ void Add_MP_AllMapScripts()
{
MpLogger::debug("Add_MP_AllMapScripts()");
new MythicPlus_AllMapScript();
}
}