From 22bd368e5d4d8d61a7189d03f52c3afd90c0729e Mon Sep 17 00:00:00 2001 From: Haru Date: Tue, 11 Aug 2015 01:47:15 +0200 Subject: Added core HPM interface Signed-off-by: Haru --- src/map/atcommand.c | 4 ++-- src/map/chrif.c | 6 +++--- src/map/clif.c | 2 +- src/map/elemental.c | 2 +- src/map/map.c | 18 +++++++++--------- src/map/skill.c | 4 ++-- src/map/status.c | 2 +- 7 files changed, 19 insertions(+), 19 deletions(-) (limited to 'src/map') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 1fec0af5b..95db0c2e6 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -10200,7 +10200,7 @@ bool atcommand_can_use2(struct map_session_data *sd, const char *command, AtComm bool atcommand_hp_add(char *name, AtCommandFunc func) { /* if commands are added after group permissions are thrown in, they end up with no permissions */ /* so we restrict commands to be linked in during boot */ - if( runflag == MAPSERVER_ST_RUNNING ) { + if( core->runflag == MAPSERVER_ST_RUNNING ) { ShowDebug("atcommand_hp_add: Commands can't be added after server is ready, skipping '%s'...\n",name); return false; } @@ -10232,7 +10232,7 @@ void atcommand_db_clear(void) { } void atcommand_doload(void) { - if( runflag >= MAPSERVER_ST_RUNNING ) + if( core->runflag >= MAPSERVER_ST_RUNNING ) atcommand->cmd_db_clear(); if( atcommand->db == NULL ) atcommand->db = stridb_alloc(DB_OPT_DUP_KEY|DB_OPT_RELEASE_DATA, ATCOMMAND_LENGTH); diff --git a/src/map/chrif.c b/src/map/chrif.c index ac96e1d84..65c042533 100644 --- a/src/map/chrif.c +++ b/src/map/chrif.c @@ -103,11 +103,11 @@ void chrif_reset(void) { /// Releases the cookie when all characters are saved. /// If all the conditions are met, it stops the core loop. void chrif_check_shutdown(void) { - if( runflag != MAPSERVER_ST_SHUTDOWN ) + if( core->runflag != MAPSERVER_ST_SHUTDOWN ) return; if( db_size(chrif->auth_db) > 0 ) return; - runflag = CORE_ST_STOP; + core->runflag = CORE_ST_STOP; } struct auth_node* chrif_search(int account_id) { @@ -608,7 +608,7 @@ void chrif_authok(int fd) { sd = node->sd; - if( runflag == MAPSERVER_ST_RUNNING && + if( core->runflag == MAPSERVER_ST_RUNNING && node->account_id == account_id && node->char_id == char_id && node->login_id1 == login_id1 ) diff --git a/src/map/clif.c b/src/map/clif.c index 296fd5cb3..ded028974 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -8945,7 +8945,7 @@ void clif_parse_WantToConnection(int fd, struct map_session_data* sd) { client_tick = RFIFOL(fd, packet_db[cmd].pos[3]); sex = RFIFOB(fd, packet_db[cmd].pos[4]); - if( runflag != MAPSERVER_ST_RUNNING ) { // not allowed + if( core->runflag != MAPSERVER_ST_RUNNING ) { // not allowed clif->authfail_fd(fd,1);// server closed return; } diff --git a/src/map/elemental.c b/src/map/elemental.c index d74e7a199..435dffaf4 100644 --- a/src/map/elemental.c +++ b/src/map/elemental.c @@ -786,7 +786,7 @@ int read_elementaldb(void) { sprintf(line, "%s/%s", map->db_path, "elemental_db.txt"); - if( runflag == MAPSERVER_ST_RUNNING ) //only necessary after we're up + if( core->runflag == MAPSERVER_ST_RUNNING ) //only necessary after we're up memset(elemental->db,0,sizeof(elemental->db)); fp = fopen(line, "r"); diff --git a/src/map/map.c b/src/map/map.c index 5766563c7..115ad510d 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -1802,7 +1802,7 @@ int map_quit(struct map_session_data *sd) { if( sd->bg_id && !sd->bg_queue.arena ) /* TODO: dump this chunk after bg_queue is fully enabled */ bg->team_leave(sd,BGTL_QUIT); - if (sd->state.autotrade && runflag != MAPSERVER_ST_SHUTDOWN && !channel->config->closing) + if (sd->state.autotrade && core->runflag != MAPSERVER_ST_SHUTDOWN && !channel->config->closing) pc->autotrade_update(sd,PAUC_REMOVE); skill->cooldown_save(sd); @@ -5545,9 +5545,9 @@ void set_server_type(void) { /// Called when a terminate signal is received. void do_shutdown(void) { - if( runflag != MAPSERVER_ST_SHUTDOWN ) + if( core->runflag != MAPSERVER_ST_SHUTDOWN ) { - runflag = MAPSERVER_ST_SHUTDOWN; + core->runflag = MAPSERVER_ST_SHUTDOWN; ShowStatus("Shutting down...\n"); { struct map_session_data* sd; @@ -5723,7 +5723,7 @@ void map_load_defaults(void) { */ static CMDLINEARG(runonce) { - runflag = CORE_ST_STOP; + core->runflag = CORE_ST_STOP; return true; } /** @@ -5831,7 +5831,7 @@ static CMDLINEARG(logconfig) static CMDLINEARG(scriptcheck) { map->minimal = true; - runflag = CORE_ST_STOP; + core->runflag = CORE_ST_STOP; map->scriptcheck = true; return true; } @@ -5861,7 +5861,7 @@ static CMDLINEARG(generatetranslations) { ShowError("export-dialog: failed to open '%s' for writing\n",script->lang_export_file); } - runflag = CORE_ST_STOP; + core->runflag = CORE_ST_STOP; return true; } @@ -6060,9 +6060,9 @@ int do_init(int argc, char *argv[]) ShowStatus("Server is '"CL_GREEN"ready"CL_RESET"' and listening on port '"CL_WHITE"%d"CL_RESET"'.\n\n", map->port); - if( runflag != CORE_ST_STOP ) { - shutdown_callback = map->do_shutdown; - runflag = MAPSERVER_ST_RUNNING; + if( core->runflag != CORE_ST_STOP ) { + core->shutdown_callback = map->do_shutdown; + core->runflag = MAPSERVER_ST_RUNNING; } map_cp_defaults(); diff --git a/src/map/skill.c b/src/map/skill.c index 00babb4f6..c647cc325 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -18091,7 +18091,7 @@ void skill_init_unit_layout (void) int i,j,pos = 0; //when != it was already cleared during skill_defaults() no need to repeat - if( runflag == MAPSERVER_ST_RUNNING ) + if( core->runflag == MAPSERVER_ST_RUNNING ) memset(skill->dbs->unit_layout, 0, sizeof(skill->dbs->unit_layout)); // standard square layouts go first @@ -18976,7 +18976,7 @@ void skill_readdb(bool minimal) { db_clear(skill->name2id_db); /* when != it was called during init and this procedure was already performed by skill_defaults() */ - if( runflag == MAPSERVER_ST_RUNNING ) { + if( core->runflag == MAPSERVER_ST_RUNNING ) { memset(ZEROED_BLOCK_POS(skill->dbs), 0, ZEROED_BLOCK_SIZE(skill->dbs)); } diff --git a/src/map/status.c b/src/map/status.c index dc99c1f95..4fc975268 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -12302,7 +12302,7 @@ int status_readdb(void) // initialize databases to default // - if( runflag == MAPSERVER_ST_RUNNING ) {//not necessary during boot + if( core->runflag == MAPSERVER_ST_RUNNING ) {//not necessary during boot // reset job_db.conf data memset(status->dbs->max_weight_base, 0, sizeof(status->dbs->max_weight_base)); memset(status->dbs->HP_table, 0, sizeof(status->dbs->HP_table)); -- cgit v1.2.3-60-g2f50