From ce08d6238d902590dbfb650f889a8ab8887356bf Mon Sep 17 00:00:00 2001 From: Haru Date: Sun, 9 Nov 2014 02:07:09 +0100 Subject: Command line arguments handling overhaul - login_server, char_server, map_server as well as the tools (mapcache) now have a common command line arguments handling mechanism. - All of them now accept `--help` (`-h`), `--version` (`-v`) and `--load-plugin`. - login_server now accepts `--login-config` and `--lan-config` instead of relying on positional arguments to override those files. The old syntax will no longer work, please update your custom startup scripts. - char_server now accepts `--char-config`, `--inter-config`, `--lan-config` instead of relying on positional arguments. The old syntax will no longer work, please update your custom startup scripts. - mapcache now accepts `--grf-list`, `--map-list`, `--map-cache`, `--rebuild` in place of, respectively, `-grf`, `-list`, `-cache`, `-rebuild`. - A new macro `CMDLINEARG()` is provided, to help defining new command line argument handlers (i.e. in plugins). the `addArg()` call is still required, but its syntax has changed. The `help` argument is now of type `const char *` rather than a function pointer, and it is supposed to contain the message to show in the `--help` screen. Pass `NULL` if no help message is desired. Signed-off-by: Haru --- src/plugins/db2sql.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/db2sql.c b/src/plugins/db2sql.c index eda61d026..62ed80255 100644 --- a/src/plugins/db2sql.c +++ b/src/plugins/db2sql.c @@ -348,8 +348,10 @@ void do_db2sql(void) { CPCMD(db2sql) { do_db2sql(); } -void db2sql_arg(char *param) { +CMDLINEARG(db2sql) +{ map->minimal = torun = true; + return true; } HPExport void server_preinit (void) { SQL = GET_SYMBOL("SQL"); @@ -360,7 +362,7 @@ HPExport void server_preinit (void) { libconfig = GET_SYMBOL("libconfig"); StrBuf = GET_SYMBOL("StrBuf"); - addArg("--db2sql",false,db2sql_arg,NULL); + addArg("--db2sql",false,db2sql,NULL); } HPExport void plugin_init (void) { addCPCommand("server:tools:db2sql",db2sql); -- cgit v1.2.3-70-g09d2 From d541a74021fd7715f1201b123714253dd602d2bf Mon Sep 17 00:00:00 2001 From: "Hercules.ws" Date: Sun, 18 Jan 2015 21:40:31 +0100 Subject: HPM Hooks Update Signed-off-by: HerculesWSAPI --- .../HPMHooking/HPMHooking_map.HPMHooksCore.inc | 12 --- .../HPMHooking/HPMHooking_map.HookingPoints.inc | 3 - src/plugins/HPMHooking/HPMHooking_map.Hooks.inc | 91 ++-------------------- 3 files changed, 6 insertions(+), 100 deletions(-) (limited to 'src/plugins') diff --git a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc index ec90fb1b6..c79d9db75 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HPMHooksCore.inc @@ -2907,12 +2907,6 @@ struct { struct HPMHookPoint *HP_map_cleanup_db_sub_post; struct HPMHookPoint *HP_map_abort_sub_pre; struct HPMHookPoint *HP_map_abort_sub_post; - struct HPMHookPoint *HP_map_helpscreen_pre; - struct HPMHookPoint *HP_map_helpscreen_post; - struct HPMHookPoint *HP_map_versionscreen_pre; - struct HPMHookPoint *HP_map_versionscreen_post; - struct HPMHookPoint *HP_map_arg_next_value_pre; - struct HPMHookPoint *HP_map_arg_next_value_post; struct HPMHookPoint *HP_map_update_cell_bl_pre; struct HPMHookPoint *HP_map_update_cell_bl_post; struct HPMHookPoint *HP_map_get_new_bonus_id_pre; @@ -8066,12 +8060,6 @@ struct { int HP_map_cleanup_db_sub_post; int HP_map_abort_sub_pre; int HP_map_abort_sub_post; - int HP_map_helpscreen_pre; - int HP_map_helpscreen_post; - int HP_map_versionscreen_pre; - int HP_map_versionscreen_post; - int HP_map_arg_next_value_pre; - int HP_map_arg_next_value_post; int HP_map_update_cell_bl_pre; int HP_map_update_cell_bl_post; int HP_map_get_new_bonus_id_pre; diff --git a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc index 9442e5b20..cab2f169c 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.HookingPoints.inc @@ -1475,9 +1475,6 @@ struct HookingPointData HookingPoints[] = { { HP_POP(map->nick_db_final, HP_map_nick_db_final) }, { HP_POP(map->cleanup_db_sub, HP_map_cleanup_db_sub) }, { HP_POP(map->abort_sub, HP_map_abort_sub) }, - { HP_POP(map->helpscreen, HP_map_helpscreen) }, - { HP_POP(map->versionscreen, HP_map_versionscreen) }, - { HP_POP(map->arg_next_value, HP_map_arg_next_value) }, { HP_POP(map->update_cell_bl, HP_map_update_cell_bl) }, { HP_POP(map->get_new_bonus_id, HP_map_get_new_bonus_id) }, { HP_POP(map->add_questinfo, HP_map_add_questinfo) }, diff --git a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc index 28108eea6..3feaa780a 100644 --- a/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc +++ b/src/plugins/HPMHooking/HPMHooking_map.Hooks.inc @@ -37147,14 +37147,14 @@ struct mob_data* HP_map_id2boss(int id) { } return retVal___; } -void HP_map_reloadnpc(bool clear, const char *const *extra_scripts, int extra_scripts_count) { +void HP_map_reloadnpc(bool clear) { int hIndex = 0; if( HPMHooks.count.HP_map_reloadnpc_pre ) { - void (*preHookFunc) (bool *clear, const char *const *extra_scripts, int *extra_scripts_count); + void (*preHookFunc) (bool *clear); *HPMforce_return = false; for(hIndex = 0; hIndex < HPMHooks.count.HP_map_reloadnpc_pre; hIndex++ ) { preHookFunc = HPMHooks.list.HP_map_reloadnpc_pre[hIndex].func; - preHookFunc(&clear, extra_scripts, &extra_scripts_count); + preHookFunc(&clear); } if( *HPMforce_return ) { *HPMforce_return = false; @@ -37162,13 +37162,13 @@ void HP_map_reloadnpc(bool clear, const char *const *extra_scripts, int extra_sc } } { - HPMHooks.source.map.reloadnpc(clear, extra_scripts, extra_scripts_count); + HPMHooks.source.map.reloadnpc(clear); } if( HPMHooks.count.HP_map_reloadnpc_post ) { - void (*postHookFunc) (bool *clear, const char *const *extra_scripts, int *extra_scripts_count); + void (*postHookFunc) (bool *clear); for(hIndex = 0; hIndex < HPMHooks.count.HP_map_reloadnpc_post; hIndex++ ) { postHookFunc = HPMHooks.list.HP_map_reloadnpc_post[hIndex].func; - postHookFunc(&clear, extra_scripts, &extra_scripts_count); + postHookFunc(&clear); } } return; @@ -38677,85 +38677,6 @@ int HP_map_abort_sub(struct map_session_data *sd, va_list ap) { } return retVal___; } -void HP_map_helpscreen(bool do_exit) { - int hIndex = 0; - if( HPMHooks.count.HP_map_helpscreen_pre ) { - void (*preHookFunc) (bool *do_exit); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_map_helpscreen_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_map_helpscreen_pre[hIndex].func; - preHookFunc(&do_exit); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.map.helpscreen(do_exit); - } - if( HPMHooks.count.HP_map_helpscreen_post ) { - void (*postHookFunc) (bool *do_exit); - for(hIndex = 0; hIndex < HPMHooks.count.HP_map_helpscreen_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_map_helpscreen_post[hIndex].func; - postHookFunc(&do_exit); - } - } - return; -} -void HP_map_versionscreen(bool do_exit) { - int hIndex = 0; - if( HPMHooks.count.HP_map_versionscreen_pre ) { - void (*preHookFunc) (bool *do_exit); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_map_versionscreen_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_map_versionscreen_pre[hIndex].func; - preHookFunc(&do_exit); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return; - } - } - { - HPMHooks.source.map.versionscreen(do_exit); - } - if( HPMHooks.count.HP_map_versionscreen_post ) { - void (*postHookFunc) (bool *do_exit); - for(hIndex = 0; hIndex < HPMHooks.count.HP_map_versionscreen_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_map_versionscreen_post[hIndex].func; - postHookFunc(&do_exit); - } - } - return; -} -bool HP_map_arg_next_value(const char *option, int i, int argc, bool must) { - int hIndex = 0; - bool retVal___ = false; - if( HPMHooks.count.HP_map_arg_next_value_pre ) { - bool (*preHookFunc) (const char *option, int *i, int *argc, bool *must); - *HPMforce_return = false; - for(hIndex = 0; hIndex < HPMHooks.count.HP_map_arg_next_value_pre; hIndex++ ) { - preHookFunc = HPMHooks.list.HP_map_arg_next_value_pre[hIndex].func; - retVal___ = preHookFunc(option, &i, &argc, &must); - } - if( *HPMforce_return ) { - *HPMforce_return = false; - return retVal___; - } - } - { - retVal___ = HPMHooks.source.map.arg_next_value(option, i, argc, must); - } - if( HPMHooks.count.HP_map_arg_next_value_post ) { - bool (*postHookFunc) (bool retVal___, const char *option, int *i, int *argc, bool *must); - for(hIndex = 0; hIndex < HPMHooks.count.HP_map_arg_next_value_post; hIndex++ ) { - postHookFunc = HPMHooks.list.HP_map_arg_next_value_post[hIndex].func; - retVal___ = postHookFunc(retVal___, option, &i, &argc, &must); - } - } - return retVal___; -} void HP_map_update_cell_bl(struct block_list *bl, bool increase) { int hIndex = 0; if( HPMHooks.count.HP_map_update_cell_bl_pre ) { -- cgit v1.2.3-70-g09d2