From 381c729e777b50771626703e60b422aafc791513 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 29 Sep 2008 18:01:35 +0000 Subject: adds introduction screen to the client --- src/core/application.cc | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) (limited to 'src/core/application.cc') diff --git a/src/core/application.cc b/src/core/application.cc index 2b3f41f..c02db9b 100644 --- a/src/core/application.cc +++ b/src/core/application.cc @@ -98,15 +98,9 @@ void func_load(std::string const &args) return; } - if (game()) { - con_warn << "Connected. Disconnect first.\n"; - return; - } - std::string name(args); aux::to_label(name); - - Module::load(name.c_str()); + application()->load(name); } // --------------- signal_handler ----------------------------------- @@ -156,6 +150,8 @@ Application::Application() application_time = 0; application_game = 0; + module_interactive = 0; + #ifndef _WIN32 sys::signal(SIGHUP, signal_handler); sys::signal(SIGINT, signal_handler); @@ -312,11 +308,33 @@ void Application::quit(int status) } +Module *Application::load(std::string const &module_name) +{ + if (game()) { + con_warn << "Connected. Disconnect first.\n"; + return 0; + } + + if (Module::current() && Module::current()->interactive()) { + module_interactive = Module::current(); + } + return Module::load(module_name.c_str()); +} + void Application::connect(std::string const &host) { if (connected()) { - con_warn << "Connected. Disconnect first.\n"; - return; + if (!Module::current()->interactive() && module_interactive) { + /* if the current running module is non-interactive, + disconnect, and load the last interactive module_interactive + */ + disconnect(); + Module::load(module_interactive->label().c_str()); + + } else { + con_warn << "Connected. Disconnect first.\n"; + return; + } } if (application_game) { @@ -350,6 +368,7 @@ void Application::disconnect() notify_disconnect(); delete application_game; application_game = 0; + notify_zoneclear(0); con_print << "^BDisconnected.\n"; } } -- cgit v1.2.3