summaryrefslogtreecommitdiff
path: root/src/map/map.c
diff options
context:
space:
mode:
authorHaru <haru@dotalux.com>2014-03-11 04:19:59 +0100
committerHaru <haru@dotalux.com>2014-03-16 23:20:10 +0100
commitab878900afdb9c9caa58b7f84f0a12b6283edf2b (patch)
treea9670a60087de3f4a2f7f2356cb3bc4413e6db3e /src/map/map.c
parent8ed83b91c0984b251740d0cb62870bf4ca889853 (diff)
downloadhercules-ab878900afdb9c9caa58b7f84f0a12b6283edf2b.tar.gz
hercules-ab878900afdb9c9caa58b7f84f0a12b6283edf2b.tar.bz2
hercules-ab878900afdb9c9caa58b7f84f0a12b6283edf2b.tar.xz
hercules-ab878900afdb9c9caa58b7f84f0a12b6283edf2b.zip
Added --load-plugin commandline argument
Signed-off-by: Haru <haru@dotalux.com>
Diffstat (limited to 'src/map/map.c')
-rw-r--r--src/map/map.c23
1 files changed, 21 insertions, 2 deletions
diff --git a/src/map/map.c b/src/map/map.c
index a7e83cae3..b2d50292e 100644
--- a/src/map/map.c
+++ b/src/map/map.c
@@ -5356,6 +5356,7 @@ void map_helpscreen(bool do_exit)
ShowInfo(" --inter-config <file> Alternative inter-server configuration.\n");
ShowInfo(" --log-config <file> Alternative logging configuration.\n");
ShowInfo(" --script-check <file> Tests a script for errors, without running the server.\n");
+ ShowInfo(" --load-plugin <name> Loads an additional plugin (can be repeated).\n");
HPM->arg_help();/* display help for commands implemented thru HPM */
if( do_exit )
exit(EXIT_SUCCESS);
@@ -5566,7 +5567,8 @@ int do_init(int argc, char *argv[])
{
bool minimal = false;
char *scriptcheck = NULL;
- int i;
+ int i, extra_plugins_count = 0;
+ const char **extra_plugins = NULL;
#ifdef GCOLLECT
GC_enable_incremental();
@@ -5579,7 +5581,21 @@ int do_init(int argc, char *argv[])
HPM->load_sub = HPM_map_plugin_load_sub;
HPM->symbol_defaults_sub = map_hp_symbols;
HPM->grabHPDataSub = HPM_map_grabHPData;
- HPM->config_read();
+ for( i = 1; i < argc; i++ ) {
+ const char* arg = argv[i];
+ if( strcmp(arg, "--load-plugin") == 0 ) {
+ if( map->arg_next_value(arg, i, argc, true) ) {
+ RECREATE(extra_plugins, const char *, ++extra_plugins_count);
+ extra_plugins[extra_plugins_count-1] = argv[++i];
+ }
+ }
+ }
+ HPM->config_read(extra_plugins, extra_plugins_count);
+ if (extra_plugins) {
+ aFree(extra_plugins);
+ extra_plugins = NULL;
+ extra_plugins_count = 0;
+ }
HPM->event(HPET_PRE_INIT);
@@ -5629,6 +5645,9 @@ int do_init(int argc, char *argv[])
runflag = CORE_ST_STOP;
if( map->arg_next_value(arg, i, argc, true) )
scriptcheck = argv[++i];
+ } else if( strcmp(arg, "load-plugin") == 0 ) {
+ if( map->arg_next_value(arg, i, argc, true) )
+ i++;
} else {
ShowError("Unknown option '%s'.\n", argv[i]);
exit(EXIT_FAILURE);