client: Allow specifying menu extension name via command line option -m
This commit is contained in:
parent
21a413c8fd
commit
976e3982a2
@ -5,9 +5,6 @@ Buildat TODO
|
|||||||
- Modules should be run in threads.
|
- Modules should be run in threads.
|
||||||
- Implement module depencencies in test/testmodules/__loader
|
- Implement module depencencies in test/testmodules/__loader
|
||||||
- There should probably be a builtin/loader that __loader usually wants to call
|
- There should probably be a builtin/loader that __loader usually wants to call
|
||||||
- __menu extension support (load when no server address is provided)
|
|
||||||
- Add a parameter to the client for choosing a boot-up extension, which
|
|
||||||
implements a boot() function that will be called
|
|
||||||
- Ask hmmmm/kwolekr for permission to use MT's noise under the Apache 2.0
|
- Ask hmmmm/kwolekr for permission to use MT's noise under the Apache 2.0
|
||||||
license and if allowed, include it in interfaces
|
license and if allowed, include it in interfaces
|
||||||
- Design how to manage scenes in a future-proof way
|
- Design how to manage scenes in a future-proof way
|
||||||
@ -29,5 +26,3 @@ Buildat TODO
|
|||||||
- Voxel world with arbitrary chunk size and offset, with pluggable loader
|
- Voxel world with arbitrary chunk size and offset, with pluggable loader
|
||||||
modules. Main world has worldspace_id=1. Try Polyvox.
|
modules. Main world has worldspace_id=1. Try Polyvox.
|
||||||
- Support Cereal's shared pointer serialization in Lua
|
- Support Cereal's shared pointer serialization in Lua
|
||||||
- An extension that provides configuration options that both the main menu and
|
|
||||||
games can open
|
|
||||||
|
@ -253,14 +253,15 @@ struct CApp: public App, public magic::Application
|
|||||||
}
|
}
|
||||||
|
|
||||||
if(g_client_config.boot_to_menu){
|
if(g_client_config.boot_to_menu){
|
||||||
ss_ script =
|
ss_ extname = g_client_config.menu_extension_name;
|
||||||
"local m = require('buildat/extension/__menu')\n"
|
ss_ script = ss_()+
|
||||||
|
"local m = require('buildat/extension/"+extname+"')\n"
|
||||||
"if type(m) ~= 'table' then\n"
|
"if type(m) ~= 'table' then\n"
|
||||||
" error('Failed to load extension __menu')\n"
|
" error('Failed to load extension "+extname+"')\n"
|
||||||
"end\n"
|
"end\n"
|
||||||
"m.boot()\n";
|
"m.boot()\n";
|
||||||
if(!run_script_no_sandbox(script)){
|
if(!run_script_no_sandbox(script)){
|
||||||
throw AppStartupError("Failed to load and run extension __menu");
|
throw AppStartupError(ss_()+"Failed to load and run extension "+extname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ namespace client
|
|||||||
ss_ cache_path = "../cache";
|
ss_ cache_path = "../cache";
|
||||||
ss_ urho3d_path = "../../Urho3D";
|
ss_ urho3d_path = "../../Urho3D";
|
||||||
bool boot_to_menu = false;
|
bool boot_to_menu = false;
|
||||||
|
ss_ menu_extension_name = "__menu";
|
||||||
|
|
||||||
bool check_paths();
|
bool check_paths();
|
||||||
};
|
};
|
||||||
|
@ -50,7 +50,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
client::Config &config = g_client_config;
|
client::Config &config = g_client_config;
|
||||||
|
|
||||||
const char opts[100] = "hs:P:C:U:l:";
|
const char opts[100] = "hs:P:C:U:l:m:";
|
||||||
const char usagefmt[1000] =
|
const char usagefmt[1000] =
|
||||||
"Usage: %s [OPTION]...\n"
|
"Usage: %s [OPTION]...\n"
|
||||||
" -h Show this help\n"
|
" -h Show this help\n"
|
||||||
@ -59,6 +59,7 @@ int main(int argc, char *argv[])
|
|||||||
" -C [cache_path] Specify cache/ path\n"
|
" -C [cache_path] Specify cache/ path\n"
|
||||||
" -U [urho3d_path] Specify Urho3D path\n"
|
" -U [urho3d_path] Specify Urho3D path\n"
|
||||||
" -l [integer] Set maximum log level (0...5)\n"
|
" -l [integer] Set maximum log level (0...5)\n"
|
||||||
|
" -m [name] Choose menu extension name\n"
|
||||||
;
|
;
|
||||||
|
|
||||||
int c;
|
int c;
|
||||||
@ -88,6 +89,10 @@ int main(int argc, char *argv[])
|
|||||||
case 'l':
|
case 'l':
|
||||||
log_set_max_level(atoi(c55_optarg));
|
log_set_max_level(atoi(c55_optarg));
|
||||||
break;
|
break;
|
||||||
|
case 'm':
|
||||||
|
fprintf(stderr, "INFO: config.menu_extension_name: %s\n", c55_optarg);
|
||||||
|
config.menu_extension_name = c55_optarg;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
fprintf(stderr, "ERROR: Invalid command-line argument\n");
|
fprintf(stderr, "ERROR: Invalid command-line argument\n");
|
||||||
fprintf(stderr, usagefmt, argv[0]);
|
fprintf(stderr, usagefmt, argv[0]);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user