mirror of
https://github.com/openmoh/openmohaa.git
synced 2025-04-28 21:57:57 +03:00
Reset delegates on restart
This commit is contained in:
parent
147678b0f0
commit
58e12e0141
3 changed files with 22 additions and 0 deletions
|
@ -169,3 +169,17 @@ ScriptDelegate *ScriptDelegate::GetScriptDelegate(const char *name)
|
|||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void ScriptDelegate::Reset()
|
||||
{
|
||||
list_script.FreeObjectList();
|
||||
list_code.FreeObjectList();
|
||||
list_codeMember.FreeObjectList();
|
||||
}
|
||||
|
||||
void ScriptDelegate::ResetAllDelegates()
|
||||
{
|
||||
for (ScriptDelegate* delegate = root; delegate; delegate = delegate->next) {
|
||||
delegate->Reset();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -156,12 +156,18 @@ public:
|
|||
*/
|
||||
void Trigger(const Event& ev) const;
|
||||
|
||||
/**
|
||||
* Reset the delegate, unregister callbacks.
|
||||
*/
|
||||
void Reset();
|
||||
|
||||
/**
|
||||
* Search and return the specified script delegate by name.
|
||||
*
|
||||
* @param name The name to search for
|
||||
*/
|
||||
static ScriptDelegate *GetScriptDelegate(const char *name);
|
||||
static void ResetAllDelegates();
|
||||
|
||||
// non-movable and non-copyable
|
||||
ScriptDelegate(ScriptDelegate&& other) = delete;
|
||||
|
|
|
@ -766,6 +766,8 @@ void ScriptMaster::Reset(qboolean samemap)
|
|||
StringDict.clear();
|
||||
InitConstStrings();
|
||||
}
|
||||
|
||||
ScriptDelegate::ResetAllDelegates();
|
||||
}
|
||||
|
||||
void ScriptMaster::ExecuteRunning(void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue