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-28 21:34:53 +0000
committerStijn Buys <ingar@osirion.org>2008-09-28 21:34:53 +0000
commit9252bfb61fabea1f45afacb19d805eb5fdd01599 (patch)
tree13fdfb005ab0b690766d35572f0eeecca28f6009 /src/core/application.cc
parent6774f2b5d14c1957d163ef4b7914c2660b59fdfd (diff)
intro module
Diffstat (limited to 'src/core/application.cc')
-rw-r--r--src/core/application.cc33
1 files changed, 33 insertions, 0 deletions
diff --git a/src/core/application.cc b/src/core/application.cc
index f8b9a73..2b3f41f 100644
--- a/src/core/application.cc
+++ b/src/core/application.cc
@@ -12,6 +12,7 @@
#include <sstream>
#include <fstream>
+#include "auxiliary/functions.h"
#include "sys/sys.h"
#include "math/mathlib.h"
#include "filesystem/filesystem.h"
@@ -80,6 +81,34 @@ void func_msg(std::string const &args)
con_print << "Not connected." << std::endl;
}
}
+
+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;
+ }
+
+ if (game()) {
+ con_warn << "Connected. Disconnect first.\n";
+ return;
+ }
+
+ std::string name(args);
+ aux::to_label(name);
+
+ Module::load(name.c_str());
+}
+
// --------------- signal_handler -----------------------------------
#ifndef _WIN32
@@ -224,6 +253,9 @@ void Application::init(int count, char **arguments)
func = Func::add("quit", func_quit);
func->set_info("exit the application");
+ func = Func::add("load", func_load);
+ func->set_info("[str] load a game module");
+
func = Func::add("connect", func_connect);
func->set_info("[ip] without ip, create a game");
@@ -260,6 +292,7 @@ void Application::shutdown()
Func::remove("connect");
Func::remove("disconnect");
+ Func::remove("load");
#ifdef _WIN32
// shutdown win32 socket library