From 857e4fb58b26ea088c0ad92ec5b1ac9423ec1e65 Mon Sep 17 00:00:00 2001 From: Haru Date: Wed, 17 Jul 2013 05:29:19 +0200 Subject: Added missing initialization of some functions in the homunculus interface - Fixes issue #7536 (thanks to jTynne for the report) http://hercules.ws/board/tracker/issue-7536-map-crash-july-15th/ - Minor corrections to the other interfaces as well (reordered initialization to follow the definitions, removed duplicate entry in the skill interface initialization, commented out some unused entries) Signed-off-by: Haru --- src/map/atcommand.c | 2 +- src/map/battle.c | 16 ++++++++-------- src/map/chrif.h | 2 +- src/map/clif.c | 46 +++++++++++++++++++++++----------------------- src/map/clif.h | 5 +++-- src/map/homunculus.c | 2 ++ src/map/itemdb.c | 2 +- src/map/log.c | 5 +++-- src/map/map.c | 34 +++++++++++++++++----------------- src/map/map.h | 2 +- src/map/pc.h | 2 +- src/map/script.c | 5 ++--- src/map/skill.c | 7 +++---- src/map/storage.c | 2 +- 14 files changed, 67 insertions(+), 65 deletions(-) (limited to 'src/map') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index 950961b29..29bd43d16 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -10260,9 +10260,9 @@ void atcommand_defaults(void) { atcommand->final = do_final_atcommand; atcommand->parse = is_atcommand; + atcommand->create = atcommand_hp_add; atcommand->can_use = atcommand_can_use; atcommand->can_use2 = atcommand_can_use2; - atcommand->create = atcommand_hp_add; atcommand->load_groups = atcommand_db_load_groups; atcommand->exists = atcommand_exists; atcommand->msg_read = msg_config_read; diff --git a/src/map/battle.c b/src/map/battle.c index 2016efa3b..bded771e7 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -6784,18 +6784,11 @@ void battle_defaults(void) { battle->calc_damage = battle_calc_damage; battle->calc_gvg_damage = battle_calc_gvg_damage; battle->calc_bg_damage = battle_calc_bg_damage; - battle->calc_base_damage = battle_calc_base_damage; - battle->calc_misc_attack = battle_calc_misc_attack; - battle->calc_magic_attack = battle_calc_magic_attack; battle->weapon_attack = battle_weapon_attack; + battle->calc_weapon_attack = battle_calc_weapon_attack; battle->delay_damage = battle_delay_damage; battle->drain = battle_drain; battle->calc_return_damage = battle_calc_return_damage; - battle->calc_weapon_attack = battle_calc_weapon_attack; -#ifdef RENEWAL - battle->calc_weapon_damage = battle_calc_weapon_damage; -#endif - battle->calc_defense = battle_calc_defense; battle->attr_ratio = battle_attr_ratio; battle->attr_fix = battle_attr_fix; battle->calc_cardfix = battle_calc_cardfix; @@ -6803,6 +6796,10 @@ void battle_defaults(void) { battle->calc_masteryfix = battle_calc_masteryfix; battle->calc_skillratio = battle_calc_skillratio; battle->calc_sizefix = battle_calc_sizefix; +#ifdef RENEWAL + battle->calc_weapon_damage = battle_calc_weapon_damage; +#endif + battle->calc_defense = battle_calc_defense; battle->get_master = battle_get_master; battle->get_targeted = battle_gettargeted; battle->get_enemy = battle_getenemy; @@ -6818,6 +6815,9 @@ void battle_defaults(void) { battle->delay_damage_sub = battle_delay_damage_sub; battle->blewcount_bonus = battle_blewcount_bonus; battle->range_type = battle_range_type; + battle->calc_base_damage = battle_calc_base_damage; + battle->calc_misc_attack = battle_calc_misc_attack; + battle->calc_magic_attack = battle_calc_magic_attack; battle->adjust_skill_damage = battle_adjust_skill_damage; battle->add_mastery = battle_addmastery; battle->calc_drain = battle_calc_drain; diff --git a/src/map/chrif.h b/src/map/chrif.h index a6a5fc6bf..b6883d855 100644 --- a/src/map/chrif.h +++ b/src/map/chrif.h @@ -68,7 +68,7 @@ struct chrif_interface { int (*send_users_tochar) (void); int (*char_online) (struct map_session_data *sd); int (*changesex) (struct map_session_data *sd); - int (*chardisconnect) (struct map_session_data *sd); + //int (*chardisconnect) (struct map_session_data *sd); // FIXME: Commented out in clif.c, function does not exist int (*divorce) (int partner_id1, int partner_id2); int (*removefriend) (int char_id, int friend_id); diff --git a/src/map/clif.c b/src/map/clif.c index 2f7360da9..c19c9f7f6 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -17934,6 +17934,8 @@ void clif_defaults(void) { clif->item_sub = clif_item_sub; clif->getareachar_item = clif_getareachar_item; clif->cart_additem_ack = clif_cart_additem_ack; + clif->cashshop_load = clif_cashshop_db; + clif->package_announce = clif_package_item_announce; /* unit-related */ clif->clearunit_single = clif_clearunit_single; clif->clearunit_area = clif_clearunit_area; @@ -18334,19 +18336,6 @@ void clif_defaults(void) { /* elemental-related */ clif->elemental_info = clif_elemental_info; clif->elemental_updatestatus = clif_elemental_updatestatus; - /* Hercules Channel System */ - clif->chsys_create = clif_hercules_chsys_create; - clif->chsys_msg = clif_hercules_chsys_msg; - clif->chsys_msg2 = clif_hercules_chsys_msg2; - clif->chsys_send = clif_hercules_chsys_send; - clif->chsys_join = clif_hercules_chsys_join; - clif->chsys_left = clif_hercules_chsys_left; - clif->chsys_delete = clif_hercules_chsys_delete; - clif->chsys_mjoin = clif_hercules_chsys_mjoin; - clif->chsys_quit = clif_hercules_chsys_quit; - clif->chsys_quitg = clif_hercules_chsys_quitg; - clif->chsys_gjoin = clif_hercules_chsys_gjoin; - clif->chsys_gleave = clif_hercules_chsys_gleave; /* bgqueue */ clif->bgqueue_ack = clif_bgqueue_ack; clif->bgqueue_notice_delete = clif_bgqueue_notice_delete; @@ -18361,10 +18350,21 @@ void clif_defaults(void) { clif->notify_time = clif_notify_time; clif->user_count = clif_user_count; clif->noask_sub = clif_noask_sub; - clif->cashshop_load = clif_cashshop_db; - clif->package_announce = clif_package_item_announce; clif->bc_ready = clif_bc_ready; clif->undisguise_timer = clif_undisguise_timer; + /* Hercules Channel System */ + clif->chsys_create = clif_hercules_chsys_create; + clif->chsys_msg = clif_hercules_chsys_msg; + clif->chsys_msg2 = clif_hercules_chsys_msg2; + clif->chsys_send = clif_hercules_chsys_send; + clif->chsys_join = clif_hercules_chsys_join; + clif->chsys_left = clif_hercules_chsys_left; + clif->chsys_delete = clif_hercules_chsys_delete; + clif->chsys_mjoin = clif_hercules_chsys_mjoin; + clif->chsys_quit = clif_hercules_chsys_quit; + clif->chsys_quitg = clif_hercules_chsys_quitg; + clif->chsys_gjoin = clif_hercules_chsys_gjoin; + clif->chsys_gleave = clif_hercules_chsys_gleave; /*------------------------ *- Parse Incoming Packet *------------------------*/ @@ -18402,6 +18402,7 @@ void clif_defaults(void) { clif->pKickFromChat = clif_parse_KickFromChat; clif->pChatLeave = clif_parse_ChatLeave; clif->pTradeRequest = clif_parse_TradeRequest; + clif->chann_config_read = read_channels_config; clif->pTradeAck = clif_parse_TradeAck; clif->pTradeAddItem = clif_parse_TradeAddItem; clif->pTradeOk = clif_parse_TradeOk; @@ -18456,7 +18457,6 @@ void clif_defaults(void) { clif->pLeaveParty = clif_parse_LeaveParty; clif->pRemovePartyMember = clif_parse_RemovePartyMember; clif->pPartyChangeOption = clif_parse_PartyChangeOption; - clif->chann_config_read = read_channels_config; clif->pPartyMessage = clif_parse_PartyMessage; clif->pPartyChangeLeader = clif_parse_PartyChangeLeader; clif->pPartyBookingRegisterReq = clif_parse_PartyBookingRegisterReq; @@ -18561,17 +18561,19 @@ void clif_defaults(void) { clif->pDebug = clif_parse_debug; clif->pSkillSelectMenu = clif_parse_SkillSelectMenu; clif->pMoveItem = clif_parse_MoveItem; + /* dull */ + clif->pDull = clif_parse_dull; + /* BGQueue */ + clif->pBGQueueRegister = clif_parse_bgqueue_register; + clif->pBGQueueCheckState = clif_parse_bgqueue_checkstate; + clif->pBGQueueRevokeReq = clif_parse_bgqueue_revoke_req; + clif->pBGQueueBattleBeginAck = clif_parse_bgqueue_battlebegin_ack; /* RagExe Cash Shop [Ind/Hercules] */ clif->pCashShopOpen = clif_parse_CashShopOpen; clif->pCashShopClose = clif_parse_CashShopClose; clif->pCashShopReqTab = clif_parse_CashShopReqTab; clif->pCashShopSchedule = clif_parse_CashShopSchedule; clif->pCashShopBuy = clif_parse_CashShopBuy; - /* BGQueue */ - clif->pBGQueueRegister = clif_parse_bgqueue_register; - clif->pBGQueueCheckState = clif_parse_bgqueue_checkstate; - clif->pBGQueueRevokeReq = clif_parse_bgqueue_revoke_req; - clif->pBGQueueBattleBeginAck = clif_parse_bgqueue_battlebegin_ack; /* */ clif->pPartyTick = clif_parse_PartyTick; clif->pGuildInvite2 = clif_parse_GuildInvite2; @@ -18583,6 +18585,4 @@ void clif_defaults(void) { clif->pPartyBookingRefuseVolunteer = clif_parse_PartyBookingRefuseVolunteer; clif->pPartyBookingCancelVolunteer = clif_parse_PartyBookingCancelVolunteer; #endif - /* dull */ - clif->pDull = clif_parse_dull; } diff --git a/src/map/clif.h b/src/map/clif.h index e1744b4e8..2cf193965 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -918,6 +918,9 @@ struct clif_interface { void (*notify_time) (struct map_session_data* sd, unsigned long time); void (*user_count) (struct map_session_data* sd, int count); void (*noask_sub) (struct map_session_data *src, struct map_session_data *target, int type); + void (*bc_ready) (void); + int (*undisguise_timer) (int tid, unsigned int tick, int id, intptr_t data); + /* Hercules Channel System */ void (*chsys_create) (struct hChSysCh *channel, char *name, char *pass, unsigned char color); void (*chsys_msg) (struct hChSysCh *channel, struct map_session_data *sd, char *msg); void (*chsys_msg2) (struct hChSysCh *channel, char *msg); @@ -930,8 +933,6 @@ struct clif_interface { void (*chsys_quitg) (struct map_session_data *sd); void (*chsys_gjoin) (struct guild *g1,struct guild *g2); void (*chsys_gleave) (struct guild *g1,struct guild *g2); - void (*bc_ready) (void); - int (*undisguise_timer) (int tid, unsigned int tick, int id, intptr_t data); /*------------------------ *- Parse Incoming Packet *------------------------*/ diff --git a/src/map/homunculus.c b/src/map/homunculus.c index 9bf752ef7..5a9d7ac28 100644 --- a/src/map/homunculus.c +++ b/src/map/homunculus.c @@ -1295,4 +1295,6 @@ void homunculus_defaults(void) { homun->read_skill_db_sub = homunculus_read_skill_db_sub; homun->skill_db_read = homunculus_skill_db_read; homun->exp_db_read = homunculus_exp_db_read; + homun->addspiritball = homunculus_addspiritball; + homun->delspiritball = homunculus_delspiritball; } diff --git a/src/map/itemdb.c b/src/map/itemdb.c index 036075e57..3c77c4b14 100644 --- a/src/map/itemdb.c +++ b/src/map/itemdb.c @@ -2187,13 +2187,13 @@ void itemdb_defaults(void) { itemdb->write_cached_packages = itemdb_write_cached_packages; itemdb->read_cached_packages = itemdb_read_cached_packages; /* */ + itemdb->name2id = itemdb_name2id; itemdb->search_name = itemdb_searchname; itemdb->search_name_array = itemdb_searchname_array; itemdb->load = itemdb_load; itemdb->search = itemdb_search; itemdb->parse_dbrow = itemdb_parse_dbrow; itemdb->exists = itemdb_exists;//incomplete - itemdb->name2id = itemdb_name2id; itemdb->in_group = itemdb_in_group; itemdb->group_item = itemdb_searchrandomid; itemdb->chain_item = itemdb_chain_item; diff --git a/src/map/log.c b/src/map/log.c index 79e3b87e6..daf96b930 100644 --- a/src/map/log.c +++ b/src/map/log.c @@ -513,8 +513,6 @@ void log_defaults(void) { logs->atcommand = log_atcommand; logs->branch = log_branch; logs->mvpdrop = log_mvpdrop; - logs->config_read = log_config_read; - logs->config_done = log_config_complete; /* will be modified in a few seconds once loading is complete. */ logs->pick_sub = log_pick_sub_txt; @@ -525,4 +523,7 @@ void log_defaults(void) { logs->branch_sub = log_branch_sub_txt; logs->mvpdrop_sub = log_mvpdrop_sub_txt; + logs->config_read = log_config_read; + logs->config_done = log_config_complete; + } diff --git a/src/map/map.c b/src/map/map.c index 05ba2edc2..db3bcf001 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -5583,6 +5583,23 @@ void map_defaults(void) { iMap->charid2nick = map_charid2nick; iMap->charid2sd = map_charid2sd; + iMap->map_foreachpc = map_map_foreachpc; + iMap->map_foreachmob = map_map_foreachmob; + iMap->map_foreachnpc = map_map_foreachnpc; + iMap->map_foreachregen = map_map_foreachregen; + iMap->map_foreachiddb = map_map_foreachiddb; + + iMap->foreachinrange = map_foreachinrange; + iMap->foreachinshootrange = map_foreachinshootrange; + iMap->foreachinarea = map_foreachinarea; + iMap->forcountinrange = map_forcountinrange; + iMap->forcountinarea = map_forcountinarea; + iMap->foreachinmovearea = map_foreachinmovearea; + iMap->foreachincell = map_foreachincell; + iMap->foreachinpath = map_foreachinpath; + iMap->foreachinmap = map_foreachinmap; + iMap->foreachininstance = map_foreachininstance; + iMap->id2sd = map_id2sd; iMap->id2md = map_id2md; iMap->id2nd = map_id2nd; @@ -5628,23 +5645,6 @@ void map_defaults(void) { iMap->do_shutdown = do_shutdown; - iMap->map_foreachpc = map_map_foreachpc; - iMap->map_foreachmob = map_map_foreachmob; - iMap->map_foreachnpc = map_map_foreachnpc; - iMap->map_foreachregen = map_map_foreachregen; - iMap->map_foreachiddb = map_map_foreachiddb; - - iMap->foreachinrange = map_foreachinrange; - iMap->foreachinshootrange = map_foreachinshootrange; - iMap->foreachinarea=map_foreachinarea; - iMap->forcountinrange=map_forcountinrange; - iMap->forcountinarea=map_forcountinarea; - iMap->foreachinmovearea = map_foreachinmovearea; - iMap->foreachincell=map_foreachincell; - iMap->foreachinpath=map_foreachinpath; - iMap->foreachinmap=map_foreachinmap; - iMap->foreachininstance=map_foreachininstance; - /* temporary until the map.c "Hercules Renewal Phase One" design is complete. [Ind] */ mapit = &mapit_s; diff --git a/src/map/map.h b/src/map/map.h index ec5921509..7826e00b3 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -902,7 +902,7 @@ struct map_interface { int (*addmobtolist) (unsigned short m, struct spawn_data *spawn); // [Wizputer] void (*spawnmobs) (int16 m); // [Wizputer] void (*removemobs) (int16 m); // [Wizputer] - void (*do_reconnect_map) (void); //Invoked on map-char reconnection [Skotlex] Note used but still keeping it, just in case + //void (*do_reconnect_map) (void); //Invoked on map-char reconnection [Skotlex] Note used but still keeping it, just in case void (*addmap2db) (struct map_data *m); void (*removemapdb) (struct map_data *m); void (*clean) (int i); diff --git a/src/map/pc.h b/src/map/pc.h index 58dd85083..c21258dd7 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -752,7 +752,7 @@ struct pc_interface { int (*class2idx) (int class_); int (*get_group_level) (struct map_session_data *sd); - int (*getrefinebonus) (int lv,int type); + //int (*getrefinebonus) (int lv,int type); FIXME: This function does not exist, nor it is ever called bool (*can_give_items) (struct map_session_data *sd); bool (*can_use_command) (struct map_session_data *sd, const char *command); diff --git a/src/map/script.c b/src/map/script.c index c48610d3c..4a457bd28 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -18139,8 +18139,8 @@ void script_defaults(void) { script->hqs = script->hqis = 0; memset(&script->hqe, 0, sizeof(script->hqe)); - script->buildin_count = 0; script->buildin = NULL; + script->buildin_count = 0; script->str_data = NULL; script->str_data_size = 0; @@ -18176,6 +18176,7 @@ void script_defaults(void) { script->set_constant = script_set_constant; script->set_constant2 = script_set_constant2; script->get_constant = script_get_constant; + script->label_add = script_label_add; script->queue = script_hqueue_get; script->queue_add = script_hqueue_add; @@ -18183,6 +18184,4 @@ void script_defaults(void) { script->queue_remove = script_hqueue_remove; script->queue_create = script_hqueue_create; script->queue_clear = script_hqueue_clear; - - script->label_add = script_label_add; } diff --git a/src/map/skill.c b/src/map/skill.c index 1b350f74c..0b39ff620 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -18140,6 +18140,7 @@ void skill_defaults(void) { skill->get_mhp = skill_get_mhp; skill->get_sp = skill_get_sp; skill->get_state = skill_get_state; + skill->get_spiritball = skill_get_spiritball; skill->get_zeny = skill_get_zeny; skill->get_num = skill_get_num; skill->get_cast = skill_get_cast; @@ -18162,7 +18163,6 @@ void skill_defaults(void) { skill->get_unit_target = skill_get_unit_target; skill->get_unit_interval = skill_get_unit_interval; skill->get_unit_bl_target = skill_get_unit_bl_target; - skill->get_spiritball = skill_get_spiritball; skill->get_unit_layout_type = skill_get_unit_layout_type; skill->get_unit_range = skill_get_unit_range; skill->get_cooldown = skill_get_cooldown; @@ -18202,14 +18202,13 @@ void skill_defaults(void) { skill->delay_fix = skill_delay_fix; skill->check_condition_castbegin = skill_check_condition_castbegin; skill->check_condition_castend = skill_check_condition_castend; - skill->check_condition_char_sub = skill_check_condition_char_sub; + skill->consume_requirement = skill_consume_requirement; skill->get_requirement = skill_get_requirement; skill->check_pc_partner = skill_check_pc_partner; - skill->consume_requirement = skill_consume_requirement; skill->unit_move = skill_unit_move; - skill->unit_move_unit_group = skill_unit_move_unit_group; skill->unit_onleft = skill_unit_onleft; skill->unit_onout = skill_unit_onout; + skill->unit_move_unit_group = skill_unit_move_unit_group; skill->guildaura_sub = skill_guildaura_sub; skill->sit = skill_sit; skill->brandishspear = skill_brandishspear; diff --git a/src/map/storage.c b/src/map/storage.c index e0b751863..5ebbb0dde 100644 --- a/src/map/storage.c +++ b/src/map/storage.c @@ -745,8 +745,8 @@ void storage_defaults(void) { storage->delitem = storage_delitem; storage->open = storage_storageopen; storage->add = storage_storageadd; - storage->additem = storage_additem; storage->get = storage_storageget; + storage->additem = storage_additem; storage->addfromcart = storage_storageaddfromcart; storage->gettocart = storage_storagegettocart; storage->close = storage_storageclose; -- cgit v1.2.3-60-g2f50