mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Core/Game: Rewrote the ScriptMgr to support script reloading.
* Finally this commit enables dynamic script hotswapping and finished the PR #15671. * Split the storage layout to use optimized storages for database bound and unbound scripts. * Add several unload workers to reload scripts correctly -> Requires further investigation. * Fixes memory leaks in ScriptMgr when dropping invalid scripts. * Fixes VehicleScripts * Makes OutdoorPvP scripts reloadable * Makes InstanceMapScripts reloadable * Makes CommandScripts reloadable
This commit is contained in:
@@ -29,6 +29,8 @@
|
||||
#include "Pet.h"
|
||||
#include "WorldSession.h"
|
||||
#include "Opcodes.h"
|
||||
#include "ScriptReloadMgr.h"
|
||||
#include "ScriptMgr.h"
|
||||
|
||||
BossBoundaryData::~BossBoundaryData()
|
||||
{
|
||||
@@ -36,6 +38,18 @@ BossBoundaryData::~BossBoundaryData()
|
||||
delete it->Boundary;
|
||||
}
|
||||
|
||||
InstanceScript::InstanceScript(Map* map) : instance(map), completedEncounters(0)
|
||||
{
|
||||
#ifdef TRINITY_API_USE_DYNAMIC_LINKING
|
||||
uint32 scriptId = sObjectMgr->GetInstanceTemplate(map->GetId())->ScriptId;
|
||||
auto const scriptname = sObjectMgr->GetScriptName(scriptId);
|
||||
ASSERT(!scriptname.empty());
|
||||
// Acquire a strong reference from the script module
|
||||
// to keep it loaded until this object is destroyed.
|
||||
module_reference = sScriptMgr->AcquireModuleReferenceOfScriptName(scriptname);
|
||||
#endif // #ifndef TRINITY_API_USE_DYNAMIC_LINKING
|
||||
}
|
||||
|
||||
void InstanceScript::SaveToDB()
|
||||
{
|
||||
std::string data = GetSaveData();
|
||||
|
||||
Reference in New Issue
Block a user