From 8774e65cc503318005f34c133cbaee21b18fc144 Mon Sep 17 00:00:00 2001 From: Stijn Buys Date: Mon, 29 Nov 2010 16:04:03 +0000 Subject: Parse command line options after engine initialization. --- src/client/client.cc | 26 ++++++++++++++++++++++---- 1 file changed, 22 insertions(+), 4 deletions(-) (limited to 'src/client/client.cc') diff --git a/src/client/client.cc b/src/client/client.cc index ec2d002..97cfc91 100644 --- a/src/client/client.cc +++ b/src/client/client.cc @@ -113,12 +113,12 @@ void Client::init(int count, char **arguments) quit(1); } - // initialize input - input::init(); - // initialize audio audio::init(); + // initialize input + input::init(); + // add engine functions core::Func *func = 0; @@ -224,7 +224,7 @@ void Client::frame(unsigned long timestamp) core::Application::frame(timestamp); if (!connected()) { - std::string module_label(core::Loader::label()); + const std::string module_label(core::Loader::label()); // load the intro if nothing is running if (load("intro")) { @@ -589,6 +589,24 @@ void Client::func_menu(std::string const &args) void Client::func_testmodel(std::string const &args) { + // if testmodel is called from the command line, no module has been loaded yet + if (!client()->connected()) { + const std::string module_label(core::Loader::label()); + + // load the intro if nothing is running + if (client()->load("intro")) { + client()->connect(""); + if (module_label.size()) + client()->load(module_label); + } + } + + if (!client()->connected()) { + client()->client_testmodelview->hide(); + ui::console()->show(); + return; + } + std::string modelname(args); aux::trim(modelname); -- cgit v1.2.3