/** * @brief AsyncServer框架要求实现的接口之一。 * */ extern "C" int init_service(int isparent) { if (!isparent) { setup_timer(); init_all_timer_type(); init_funcs(); const char *udp_ip = get_server_ip(); uint16_t udp_port = get_server_port(); bind_udp_socket(udp_ip, udp_port); g_dirty_word = new Cdirty_word(); if (!g_dirty_word->is_inited) return -1; regist_timers(); if (load_xmlconf("../conf/GameSvr.xml", load_game_svr_config) == -1) return -1; max_msg_count = config_get_intval("max_msg_count", 1024); /* if(g_seg_mgr.init("../data/")) { BOOT_LOG(-1,"online udp listen:%s:%d %u",udp_ip, udp_port, max_msg_count); } */ BOOT_LOG(0,"online udp listen:%s:%d %u",udp_ip, udp_port, max_msg_count); } return 0; }
int reload_global_data() { /*unregister all timer callbacks*/ unregister_timers_callback(); init_funcs(); init_attck_proc_func(); init_attck_proc_pet_func(); if (load_lua_script() != 0){ ERROR_LOG("load ai script failed"); return -1; } init_attck_check_func(); if ((load_xmlconf("../conf/skills_price.xml", load_skill_use_mp) == -1) || (load_xmlconf("../conf/BattleActionList.xml", load_skill_attr) == -1) || (load_xmlconf("../conf/BattleMonsterTalk.xml", load_beast_topic) == -1) || init_all_timer_type(0) == -1 ){ return -1; } init_cli_handle_funs(); refresh_timers_callback(); return 0; }
/** * @brief AsyncServer框架要求实现的接口之一。 * */ int init_service(int isparent) { if (!isparent) { setup_timer(); init_communicator(); init_funcs(); } return 0; }
/** * @brief AsyncServer框架要求实现的接口之一。 * */ extern "C" int init_service(int isparent) { if (!isparent) { setup_timer(); Online::init(); init_funcs(); } return 0; }
BOOL WINAPI DllMain(HINSTANCE hdll, DWORD reason, LPVOID reserved) { switch (reason) { case DLL_WINE_PREATTACH: return FALSE; /* prefer native version */ case DLL_PROCESS_ATTACH: DisableThreadLibraryCalls(hdll); if(!init_funcs()) return FALSE; } return TRUE; }
int gettimeofday(struct timeval *tv, struct timezone *tz) { init_shared_memory_if_needed(); if (!(current_sim) && !real_gettimeofday) init_funcs(); if (!(current_sim)) { return real_gettimeofday(tv, tz); } else { tv->tv_sec = *(current_sim); *(current_micro) = *(current_micro) + 100; tv->tv_usec = *(current_micro); } return 0; }
time_t time(time_t *t) { init_shared_memory_if_needed(); /* If the current_sim pointer is NULL that means that there is no * shared memory segment, at least not yet, therefore use real function * for now. * Note, here we are examing the location of to where the pointer points * and not the value itself. */ if (!(current_sim) && !real_time) init_funcs(); if (!(current_sim)) { return real_time(t); } else { if(t) { *t = *(current_sim);} return *(current_sim); } }
int init_service(int isparent) { if (!isparent) { DEBUG_LOG("==INIT_SERVICE BEGIN== "); DEBUG_LOG("INIT_SERVICE"); const char *ip= get_ip_ex(0x01); if ( strncmp( ip,"10.",3 )==0 ) { g_is_test_env=true; DEBUG_LOG("=============TEST ENV TRUE ============="); }else{ g_is_test_env=false; DEBUG_LOG("=============TEST ENV FALSE ============="); } g_log_send_buf_hex_flag=g_is_test_env?1:0; setup_timer(); if (init_battles() != 0){ ERROR_LOG("init battserv failed"); return -1; } init_funcs(); init_attck_proc_func(); init_attck_proc_pet_func(); if (load_lua_script() != 0){ ERROR_LOG("load ai script failed"); return -1; } init_attck_check_func(); if ((load_xmlconf("../conf/skills_price.xml", load_skill_use_mp) == -1) || (load_xmlconf("../conf/BattleActionList.xml", load_skill_attr) == -1) || (load_xmlconf("../conf/BattleMonsterTalk.xml", load_beast_topic) == -1) || init_all_timer_type(0) == -1 ){ return -1; } init_cli_handle_funs(); DEBUG_LOG("==INIT_SERVICE END== "); } return 0; }
/** * @brief AsyncServer框架要求实现的接口之一。 * */ extern "C" int init_service(int isparent) { if (!isparent) { setup_timer(); init_all_timer_type(); init_funcs(); const char *udp_ip = get_server_ip(); uint16_t udp_port = get_server_port(); bind_udp_socket(udp_ip, udp_port); regist_timers(); if (load_xmlconf("../conf/GameSvr.xml", load_game_svr_config) == -1) return -1; max_msg_count = config_get_intval("max_msg_count", 1024); BOOT_LOG(0,"online udp listen:%s:%d %u",udp_ip, udp_port, max_msg_count); } return 0; }