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-10-18 17:58:45 +0000
committerStijn Buys <ingar@osirion.org>2008-10-18 17:58:45 +0000
commit35613f0860a2d8cb643ca8de006de08503e48e53 (patch)
tree8a5436de643e818e68a82df2e5cb2df2145f5062 /src/core/application.cc
parentdb287e4a5133125bb6f25ba21ea97c47b19ac67f (diff)
example module
Diffstat (limited to 'src/core/application.cc')
-rw-r--r--src/core/application.cc55
1 files changed, 30 insertions, 25 deletions
diff --git a/src/core/application.cc b/src/core/application.cc
index 0d52b76..71d739f 100644
--- a/src/core/application.cc
+++ b/src/core/application.cc
@@ -84,20 +84,6 @@ void func_msg(std::string const &args)
void func_load(std::string const &args)
{
- if (!args.size()) {
- if (Module::current()) {
- con_print << " currently loaded: " << Module::current()->label() << " " << Module::current()->name() << std::endl;
- }
-
- std::string helpstr(" available modules:");
- for(Module::Registry::iterator it = Module::registry().begin(); it != Module::registry().end(); it++) {
- helpstr += ' ';
- helpstr += (*it).first;
- }
- con_print << helpstr << std::endl;
- return;
- }
-
std::string name(args);
aux::to_label(name);
application()->load(name);
@@ -311,13 +297,32 @@ void Application::quit(int status)
Module *Application::load(std::string const &module_label)
{
- if (game() && Module::current()->interactive()) {
+ if (!module_label.size()) {
+ if (Module::active()) {
+ con_print << " active module: " << Module::active()->label() << " " << Module::active()->name() << std::endl;
+ }
+ if (Module::loaded()) {
+ con_print << " loaded module: " << Module::loaded()->label() << " " << Module::loaded()->name() << std::endl;
+ }
+ if (module_interactive) {
+ con_print << " fallback module: " << module_interactive->label() << " " << module_interactive->name() << std::endl;
+ }
+ std::string helpstr(" available modules:");
+ for(Module::Registry::iterator it = Module::registry().begin(); it != Module::registry().end(); it++) {
+ helpstr += ' ';
+ helpstr += (*it).first;
+ }
+ con_print << helpstr << std::endl;
+ return 0;
+ }
+/*
+ if (Module::active() && Module::active()->interactive()) {
con_warn << "Connected. Disconnect first.\n";
return 0;
}
-
- if (Module::current() && Module::current()->interactive()) {
- module_interactive = Module::current();
+*/
+ if (Module::loaded() && Module::loaded()->interactive()) {
+ module_interactive = Module::loaded();
}
return Module::load(module_label.c_str());
}
@@ -325,13 +330,13 @@ Module *Application::load(std::string const &module_label)
void Application::connect(std::string const &host)
{
if (connected()) {
- 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());
-
+ if (!Module::active()->interactive()) {
+ if ((Module::loaded() == Module::active()) && (module_interactive)) {
+ disconnect();
+ Module::load(module_interactive->label().c_str());
+ } else {
+ disconnect();
+ }
} else {
con_warn << "Connected. Disconnect first.\n";
return;