Project::OSiRiON - Git repositories
Project::OSiRiON
News . About . Screenshots . Downloads . Forum . Wiki . Tracker . Git
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStijn Buys <ingar@osirion.org>2008-09-29 18:01:35 +0000
committerStijn Buys <ingar@osirion.org>2008-09-29 18:01:35 +0000
commit381c729e777b50771626703e60b422aafc791513 (patch)
tree856b9467dda75daaa1d78f6dce9dfb746dc338ce /src/core/application.cc
parent5b64ecbd39307d17acd8815187f6cd211c384029 (diff)
adds introduction screen to the client
Diffstat (limited to 'src/core/application.cc')
-rw-r--r--src/core/application.cc37
1 files changed, 28 insertions, 9 deletions
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";
}
}