diff options
Diffstat (limited to 'src/map/map.c')
-rw-r--r-- | src/map/map.c | 117 |
1 files changed, 43 insertions, 74 deletions
diff --git a/src/map/map.c b/src/map/map.c index dc935079a..a7b171ddf 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -69,6 +69,9 @@ struct map_interface map_s; struct mapit_interface mapit_s; +struct map_interface *map; +struct mapit_interface *mapit; + /*========================================== * server player count (of all mapservers) *------------------------------------------*/ @@ -1799,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); @@ -3538,12 +3541,12 @@ int map_config_read(char *cfgName) { *ptr = '\0'; if(strcmpi(w1,"timestamp_format")==0) - safestrncpy(timestamp_format, w2, 20); + safestrncpy(showmsg->timestamp_format, w2, 20); else if(strcmpi(w1,"stdout_with_ansisequence")==0) - stdout_with_ansisequence = config_switch(w2); + showmsg->stdout_with_ansisequence = config_switch(w2) ? true : false; else if(strcmpi(w1,"console_silent")==0) { - msg_silent = atoi(w2); - if( msg_silent ) // only bother if its actually enabled + showmsg->silent = atoi(w2); + if (showmsg->silent) // only bother if its actually enabled ShowInfo("Console Silent Setting: %d\n", atoi(w2)); } else if (strcmpi(w1, "userid")==0) chrif->setuserid(w2); @@ -3593,7 +3596,7 @@ int map_config_read(char *cfgName) { else if (strcmpi(w1, "use_grf") == 0) map->enable_grf = config_switch(w2); else if (strcmpi(w1, "console_msg_log") == 0) - console_msg_log = atoi(w2);//[Ind] + showmsg->console_log = atoi(w2);//[Ind] else if (strcmpi(w1, "default_language") == 0) safestrncpy(map->default_lang_str, w2, sizeof(map->default_lang_str)); else if (strcmpi(w1, "import") == 0) @@ -3730,8 +3733,6 @@ int inter_config_read(char *cfgName) { safestrncpy(map->mob_skill_db_db, w2, sizeof(map->mob_skill_db_db)); else if(strcmpi(w1,"mob_skill_db2_db")==0) safestrncpy(map->mob_skill_db2_db, w2, sizeof(map->mob_skill_db2_db)); - else if(strcmpi(w1,"interreg_db")==0) - safestrncpy(map->interreg_db, w2, sizeof(map->interreg_db)); /* map sql stuff */ else if(strcmpi(w1,"map_server_ip")==0) safestrncpy(map->server_ip, w2, sizeof(map->server_ip)); @@ -3748,14 +3749,38 @@ int inter_config_read(char *cfgName) { else if(strcmpi(w1,"use_sql_item_db")==0) { map->db_use_sql_item_db = config_switch(w2); ShowStatus ("Using item database as SQL: '%s'\n", w2); + if (map->db_use_sql_item_db) { + // Deprecated 2015-08-09 [Haru] + ShowWarning("Support for the SQL item database is deprecated and it will removed in future versions. " + "Please upgrade to the non-sql version as soon as possible. " + "Bug reports or pull requests concerning the SQL item database are no longer accepted.\n"); + ShowInfo("Resuming in 10 seconds...\n"); + HSleep(10); + } } else if(strcmpi(w1,"use_sql_mob_db")==0) { map->db_use_sql_mob_db = config_switch(w2); ShowStatus ("Using monster database as SQL: '%s'\n", w2); + if (map->db_use_sql_mob_db) { + // Deprecated 2015-08-09 [Haru] + ShowWarning("Support for the SQL monster database is deprecated and it will removed in future versions. " + "Please upgrade to the non-sql version as soon as possible. " + "Bug reports or pull requests concerning the SQL monster database are no longer accepted.\n"); + ShowInfo("Resuming in 10 seconds...\n"); + HSleep(10); + } } else if(strcmpi(w1,"use_sql_mob_skill_db")==0) { map->db_use_sql_mob_skill_db = config_switch(w2); ShowStatus ("Using monster skill database as SQL: '%s'\n", w2); + if (map->db_use_sql_mob_skill_db) { + // Deprecated 2015-08-09 [Haru] + ShowWarning("Support for the SQL monster skill database is deprecated and it will removed in future versions. " + "Please upgrade to the non-sql version as soon as possible. " + "Bug reports or pull requests concerning the SQL monster skill database are no longer accepted.\n"); + ShowInfo("Resuming in 10 seconds...\n"); + HSleep(10); + } } else if(strcmpi(w1,"autotrade_merchants_db")==0) safestrncpy(map->autotrade_merchants_db, w2, sizeof(map->autotrade_merchants_db)); @@ -5520,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; @@ -5530,7 +5555,7 @@ void do_shutdown(void) for( sd = (TBL_PC*)mapit->first(iter); mapit->exists(iter); sd = (TBL_PC*)mapit->next(iter) ) clif->GM_kick(NULL, sd); mapit->free(iter); - flush_fifos(); + sockt->flush_fifos(); } chrif->check_shutdown(); } @@ -5590,60 +5615,6 @@ void map_cp_defaults(void) { console->input->addCommand("gm:use",CPCMD_A(gm_use)); #endif } -/* Hercules Plugin Mananger */ -void map_hp_symbols(void) { - /* full interfaces */ - HPM->share(atcommand,"atcommand"); - HPM->share(battle,"battle"); - HPM->share(bg,"battlegrounds"); - HPM->share(buyingstore,"buyingstore"); - HPM->share(channel,"channel"); - HPM->share(clif,"clif"); - HPM->share(chrif,"chrif"); - HPM->share(guild,"guild"); - HPM->share(gstorage,"gstorage"); - HPM->share(homun,"homun"); - HPM->share(map,"map"); - HPM->share(ircbot,"ircbot"); - HPM->share(itemdb,"itemdb"); - HPM->share(logs,"logs"); - HPM->share(mail,"mail"); - HPM->share(instance,"instance"); - HPM->share(script,"script"); - HPM->share(searchstore,"searchstore"); - HPM->share(skill,"skill"); - HPM->share(vending,"vending"); - HPM->share(pc,"pc"); - HPM->share(pcg,"pc_groups"); - HPM->share(party,"party"); - HPM->share(storage,"storage"); - HPM->share(trade,"trade"); - HPM->share(status,"status"); - HPM->share(chat, "chat"); - HPM->share(duel,"duel"); - HPM->share(elemental,"elemental"); - HPM->share(intif,"intif"); - HPM->share(mercenary,"mercenary"); - HPM->share(mob,"mob"); - HPM->share(unit,"unit"); - HPM->share(npc,"npc"); - HPM->share(mapreg,"mapreg"); - HPM->share(pet,"pet"); - HPM->share(path,"path"); - HPM->share(quest,"quest"); -#ifdef PCRE_SUPPORT - HPM->share(npc_chat,"npc_chat"); - HPM->share(libpcre,"libpcre"); -#endif - HPM->share(mapit,"mapit"); - HPM->share(mapindex,"mapindex"); - /* sql link */ - HPM->share(map->mysql_handle,"sql_handle"); - /* specific */ - HPM->share(atcommand->create,"addCommand"); - HPM->share(script->addScript,"addScript"); - HPM->share(HPM_map_add_group_permission,"addGroupPermission"); -} void map_load_defaults(void) { mapindex_defaults(); @@ -5698,7 +5669,7 @@ void map_load_defaults(void) { */ static CMDLINEARG(runonce) { - runflag = CORE_ST_STOP; + core->runflag = CORE_ST_STOP; return true; } /** @@ -5806,7 +5777,7 @@ static CMDLINEARG(logconfig) static CMDLINEARG(scriptcheck) { map->minimal = true; - runflag = CORE_ST_STOP; + core->runflag = CORE_ST_STOP; map->scriptcheck = true; return true; } @@ -5836,7 +5807,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; } @@ -5880,7 +5851,6 @@ int do_init(int argc, char *argv[]) map->GRF_PATH_FILENAME = aStrdup("conf/grf-files.txt"); HPM_map_do_init(); - HPM->symbol_defaults_sub = map_hp_symbols; cmdline->exec(argc, argv, CMDLINE_OPT_PREINIT); HPM->config_read(); @@ -5901,7 +5871,7 @@ int do_init(int argc, char *argv[]) if (!map->ip_set || !map->char_ip_set) { char ip_str[16]; - ip2str(sockt->addr_[0], ip_str); + sockt->ip2str(sockt->addr_[0], ip_str); ShowWarning("Not all IP addresses in /conf/map-server.conf configured, auto-detecting...\n"); @@ -6035,9 +6005,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(); @@ -6089,7 +6059,6 @@ void map_defaults(void) { sprintf(map->mob_db2_db, "mob_db2"); sprintf(map->mob_skill_db_db, "mob_skill_db"); sprintf(map->mob_skill_db2_db, "mob_skill_db2"); - sprintf(map->interreg_db, "interreg"); map->INTER_CONF_NAME="conf/inter-server.conf"; map->LOG_CONF_NAME="conf/logs.conf"; |