* added new var in ScriptConfig.conf: OnGUIClose=0

-> set to 1 to close PseuWoW when the GUI is closed
This commit is contained in:
False.Genesis 2007-12-08 14:26:56 +00:00
parent fb1e696551
commit 1bd487445a
3 changed files with 17 additions and 0 deletions

View File

@ -15,6 +15,9 @@ cmdchar=.
// MaNGOS does also accept ! as cmd identifier. put here all identifiers that can trigger a server command! // MaNGOS does also accept ! as cmd identifier. put here all identifiers that can trigger a server command!
other_cmd_chars=.! other_cmd_chars=.!
// Set to 1 if PseuWoW should exit after the GUI is closed (if there is a GUI)
ExitOnGUIClose=0
[#normal] [#normal]

View File

@ -103,6 +103,16 @@ LOG * Assigning permissions for internal functions...
setscriptpermission,emote 0 setscriptpermission,emote 0
// ... set more permissions here ... // ... set more permissions here ...
//-------------------------------------------------
#script=register_onguiclose_exit
//-------------------------------------------------
if ?{not ?{ScriptHasLine,_onguiclose #tag:hook:${@myname}}}
appenddef,_onguiclose #tag:hook:${@myname}
appenddef,_onguiclose if ?\{GetVar #EXITONGUICLOSE\}
appenddef,_onguiclose exit
appenddef,_onguiclose endif
endif
// this dummy script does nothing actually but since its loaded last in this file it causes the config // this dummy script does nothing actually but since its loaded last in this file it causes the config
// script to be run before all .def files are loaded // script to be run before all .def files are loaded
@ -114,5 +124,6 @@ setscriptpermission,emote 0
if ?{not ${#config::DONE}} if ?{not ${#config::DONE}}
config config
endif endif
register_onguiclose_exit
#/onload #/onload

View File

@ -371,7 +371,10 @@ void PseuInstance::Sleep(uint32 msecs)
void PseuInstance::DeleteGUI(void) void PseuInstance::DeleteGUI(void)
{ {
_gui = NULL; _gui = NULL;
delete _guithread; // since it was allocated with new
_guithread = NULL; _guithread = NULL;
if(GetScripts()->ScriptExists("_onguiclose"))
AddCliCommand("_onguiclose"); // since this func is called from another thread, use threadsafe variant via CLI
} }
PseuInstanceConf::PseuInstanceConf() PseuInstanceConf::PseuInstanceConf()