mirror of
https://github.com/mangosfour/server.git
synced 2025-12-16 13:37:00 +00:00
[8256] Restore DB script loading broken after [8252].
Also propetly decrease scheduled DB script actions at map unloading. Some code style restore.
This commit is contained in:
parent
c3d26f6fa2
commit
c547a27dad
3 changed files with 148 additions and 144 deletions
|
|
@ -55,6 +55,9 @@ struct ScriptAction
|
||||||
Map::~Map()
|
Map::~Map()
|
||||||
{
|
{
|
||||||
UnloadAll(true);
|
UnloadAll(true);
|
||||||
|
|
||||||
|
if(!m_scriptSchedule.empty())
|
||||||
|
sWorld.DecreaseScheduledScriptCount(m_scriptSchedule.size());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Map::ExistMap(uint32 mapid,int gx,int gy)
|
bool Map::ExistMap(uint32 mapid,int gx,int gy)
|
||||||
|
|
@ -2652,7 +2655,7 @@ void Map::ScriptsStart(ScriptMapMap const& scripts, uint32 id, Object* source, O
|
||||||
sa.ownerGUID = ownerGUID;
|
sa.ownerGUID = ownerGUID;
|
||||||
|
|
||||||
sa.script = &iter->second;
|
sa.script = &iter->second;
|
||||||
m_scriptSchedule.insert(std::pair<time_t, ScriptAction>(sWorld.GetGameTime() + iter->first, sa));
|
m_scriptSchedule.insert(std::pair<time_t, ScriptAction>(time_t(sWorld.GetGameTime() + iter->first), sa));
|
||||||
if (iter->first == 0)
|
if (iter->first == 0)
|
||||||
immedScript = true;
|
immedScript = true;
|
||||||
|
|
||||||
|
|
@ -2678,7 +2681,7 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou
|
||||||
sa.ownerGUID = ownerGUID;
|
sa.ownerGUID = ownerGUID;
|
||||||
|
|
||||||
sa.script = &script;
|
sa.script = &script;
|
||||||
m_scriptSchedule.insert(std::pair<time_t, ScriptAction>(sWorld.GetGameTime() + delay, sa));
|
m_scriptSchedule.insert(std::pair<time_t, ScriptAction>(time_t(sWorld.GetGameTime() + delay), sa));
|
||||||
|
|
||||||
sWorld.IncreaseScheduledScriptsCount();
|
sWorld.IncreaseScheduledScriptsCount();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -485,7 +485,8 @@ class World
|
||||||
|
|
||||||
uint32 IncreaseScheduledScriptsCount() { return (uint32)++m_scheduledScripts; }
|
uint32 IncreaseScheduledScriptsCount() { return (uint32)++m_scheduledScripts; }
|
||||||
uint32 DecreaseScheduledScriptCount() { return (uint32)--m_scheduledScripts; }
|
uint32 DecreaseScheduledScriptCount() { return (uint32)--m_scheduledScripts; }
|
||||||
bool IsScriptScheduled() const { return m_scheduledScripts == 0; }
|
uint32 DecreaseScheduledScriptCount(size_t count) { return (uint32)(m_scheduledScripts -= count); }
|
||||||
|
bool IsScriptScheduled() const { return m_scheduledScripts > 0; }
|
||||||
|
|
||||||
// for max speed access
|
// for max speed access
|
||||||
static float GetMaxVisibleDistanceForCreature() { return m_MaxVisibleDistanceForCreature; }
|
static float GetMaxVisibleDistanceForCreature() { return m_MaxVisibleDistanceForCreature; }
|
||||||
|
|
|
||||||
|
|
@ -1,4 +1,4 @@
|
||||||
#ifndef __REVISION_NR_H__
|
#ifndef __REVISION_NR_H__
|
||||||
#define __REVISION_NR_H__
|
#define __REVISION_NR_H__
|
||||||
#define REVISION_NR "8255"
|
#define REVISION_NR "8256"
|
||||||
#endif // __REVISION_NR_H__
|
#endif // __REVISION_NR_H__
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue