mirror of
https://github.com/mangosfour/server.git
synced 2025-12-15 01: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()
|
||||
{
|
||||
UnloadAll(true);
|
||||
|
||||
if(!m_scriptSchedule.empty())
|
||||
sWorld.DecreaseScheduledScriptCount(m_scriptSchedule.size());
|
||||
}
|
||||
|
||||
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.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)
|
||||
immedScript = true;
|
||||
|
||||
|
|
@ -2678,7 +2681,7 @@ void Map::ScriptCommandStart(ScriptInfo const& script, uint32 delay, Object* sou
|
|||
sa.ownerGUID = ownerGUID;
|
||||
|
||||
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();
|
||||
|
||||
|
|
|
|||
|
|
@ -485,7 +485,8 @@ class World
|
|||
|
||||
uint32 IncreaseScheduledScriptsCount() { 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
|
||||
static float GetMaxVisibleDistanceForCreature() { return m_MaxVisibleDistanceForCreature; }
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "8255"
|
||||
#define REVISION_NR "8256"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue