From cfd535c7f5b442ae3d96a192a2dbe8650cae99af Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Sun, 9 Nov 2014 15:26:00 +0300 Subject: Fix interfaces methods usage. In some places was used direct methods. --- src/map/atcommand.c | 6 +++--- src/map/buyingstore.c | 4 ++-- src/map/clif.c | 12 ++++++------ src/map/clif.h | 2 +- src/map/log.c | 2 +- src/map/mob.c | 4 ++-- src/map/pc.c | 4 ++-- src/map/script.c | 8 ++++---- src/map/skill.c | 12 ++++++------ src/map/status.c | 14 +++++++------- src/map/unit.c | 14 +++++++------- 11 files changed, 41 insertions(+), 41 deletions(-) (limited to 'src/map') diff --git a/src/map/atcommand.c b/src/map/atcommand.c index ef528c454..dac51d153 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -10020,7 +10020,7 @@ void atcommand_config_read(const char* config_filename) { if (config_setting_type(command) != CONFIG_TYPE_ARRAY) continue; commandname = config_setting_name(command); - if ( !( commandinfo = atcommand_exists(commandname) ) ) { + if ( !( commandinfo = atcommand->exists(commandname) ) ) { ShowConfigWarning(command, "atcommand_config_read: can not set alias for non-existent command %s", commandname); continue; } @@ -10055,7 +10055,7 @@ void atcommand_config_read(const char* config_filename) { command = libconfig->setting_get_elem(nolog, i); commandname = config_setting_name(command); - if ( !( commandinfo = atcommand_exists(commandname) ) ) { + if ( !( commandinfo = atcommand->exists(commandname) ) ) { ShowConfigWarning(command, "atcommand_config_read: can not disable logging for non-existent command %s", commandname); continue; } @@ -10077,7 +10077,7 @@ void atcommand_config_read(const char* config_filename) { command = libconfig->setting_get_elem(help, i); commandname = config_setting_name(command); - if ( !( commandinfo = atcommand_exists(commandname) ) ) + if ( !( commandinfo = atcommand->exists(commandname) ) ) ShowConfigWarning(command, "atcommand_config_read: command %s does not exist", commandname); else { if( commandinfo->help == NULL ) { diff --git a/src/map/buyingstore.c b/src/map/buyingstore.c index 626d102a3..84b917cfc 100644 --- a/src/map/buyingstore.c +++ b/src/map/buyingstore.c @@ -169,7 +169,7 @@ void buyingstore_create(struct map_session_data* sd, int zenylimit, unsigned cha // success sd->state.buyingstore = true; - sd->buyer_id = buyingstore_getuid(); + sd->buyer_id = buyingstore->getuid(); sd->buyingstore.zenylimit = zenylimit; sd->buyingstore.slots = i; // store actual amount of items safestrncpy(sd->message, storename, sizeof(sd->message)); @@ -384,7 +384,7 @@ void buyingstore_trade(struct map_session_data* sd, int account_id, unsigned int } // cannot continue buying - buyingstore_close(pl_sd); + buyingstore->close(pl_sd); // remove auto-trader if( pl_sd->state.autotrade ) { diff --git a/src/map/clif.c b/src/map/clif.c index a101c39eb..7ca37fa38 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -1313,7 +1313,7 @@ void clif_weather(int16 m) for( sd = (struct map_session_data*)mapit->first(iter); mapit->exists(iter); sd = (struct map_session_data*)mapit->next(iter) ) { if( sd->bl.m == m ) - clif_weather_check(sd); + clif->weather_check(sd); } mapit->free(iter); } @@ -5216,7 +5216,7 @@ int clif_skill_damage2(struct block_list *src, struct block_list *dst, int64 tic nullpo_ret(src); nullpo_ret(dst); - type = (type>0)?type:skill_get_hit(skill_id); + type = (type>0)?type:skill->get_hit(skill_id); type = clif_calc_delay(type,div,damage,ddelay); sc = status->get_sc(dst); @@ -5259,7 +5259,7 @@ int clif_skill_damage2(struct block_list *src, struct block_list *dst, int64 tic } //Because the damage delay must be synced with the client, here is where the can-walk tick must be updated. [Skotlex] - return clif_calc_walkdelay(dst,ddelay,type,damage,div); + return clif->calc_walkdelay(dst,ddelay,type,damage,div); } #endif // 0 @@ -5424,7 +5424,7 @@ void clif_skill_estimation(struct map_session_data *sd,struct block_list *dst) { for(i=0;i<9;i++) WBUFB(buf,20+i)= (unsigned char)battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv); // The following caps negative attributes to 0 since the client displays them as 255-fix. [Skotlex] -// WBUFB(buf,20+i)= (unsigned char)((fix=battle_attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv))<0?0:fix); +// WBUFB(buf,20+i)= (unsigned char)((fix=battle->attr_ratio(i+1,dstatus->def_ele, dstatus->ele_lv))<0?0:fix); clif->send(buf,packet_len(0x18c),&sd->bl,sd->status.party_id>0?PARTY_SAMEMAP:SELF); } @@ -9935,7 +9935,7 @@ void clif_parse_GlobalMessage(int fd, struct map_session_data* sd) sd->fontcolor_tid = timer->add(timer->gettick()+5000, clif->undisguise_timer, sd->bl.id, 0); pc->disguise(sd,sd->status.class_); if( pc_isdead(sd) ) - clif_clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); + clif->clearunit_single(-sd->bl.id, CLR_DEAD, sd->fd); if( unit->is_walking(&sd->bl) ) clif->move(&sd->ud); } else if ( sd->disguise == sd->status.class_ && sd->fontcolor_tid != INVALID_TIMER ) { @@ -10833,7 +10833,7 @@ void clif_parse_NpcClicked(int fd,struct map_session_data *sd) struct block_list *bl; if( pc_isdead(sd) ) { - clif_clearunit_area(&sd->bl,CLR_DEAD); + clif->clearunit_area(&sd->bl,CLR_DEAD); return; } if( sd->npc_id || sd->state.workinprogress&2 ){ diff --git a/src/map/clif.h b/src/map/clif.h index 17fda9a74..a56fbe458 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -46,7 +46,7 @@ struct skill_cd; #define P2PTR(fd) RFIFO2PTR(fd) #define clif_menuskill_clear(sd) ((sd)->menuskill_id = (sd)->menuskill_val = (sd)->menuskill_val2 = 0) #define clif_disp_onlyself(sd,mes,len) clif->disp_message( &(sd)->bl, (mes), (len), SELF ) -#define clif_viewequip_fail( sd ) clif_msg( (sd), 0x54d ); +#define clif_viewequip_fail( sd ) clif->msg( (sd), 0x54d ); #define HCHSYS_NAME_LENGTH 20 #define MAX_ROULETTE_LEVEL 7 /** client-defined value **/ #define MAX_ROULETTE_COLUMNS 9 /** client-defined value **/ diff --git a/src/map/log.c b/src/map/log.c index b5179e16b..3efcd09df 100644 --- a/src/map/log.c +++ b/src/map/log.c @@ -452,7 +452,7 @@ int log_config_read(const char* cfgName) { safestrncpy(logs->config.log_chat, w2, sizeof(logs->config.log_chat)); //support the import command, just like any other config else if( strcmpi(w1,"import") == 0 ) - log_config_read(w2); + logs->config_read(w2); else ShowWarning("Unknown setting '%s' in file %s\n", w1, cfgName); } diff --git a/src/map/mob.c b/src/map/mob.c index e2cf765ee..65c718fa1 100644 --- a/src/map/mob.c +++ b/src/map/mob.c @@ -1436,7 +1436,7 @@ bool mob_ai_sub_hard(struct mob_data *md, int64 tick) { if(md->ud.walktimer != INVALID_TIMER && (!can_move || md->ud.walkpath.path_pos <= battle_config.mob_chase_refresh) && (tbl || md->ud.walkpath.path_pos == 0)) return true; //Walk at least "mob_chase_refresh" cells before dropping the target unless target is non-existent - mob_unlocktarget(md, tick); //Unlock target + mob->unlocktarget(md, tick); //Unlock target tbl = NULL; } } @@ -1737,7 +1737,7 @@ int mob_ai_sub_lazy(struct mob_data *md, va_list args) { if( DIFF_TICK(md->next_walktime,tick) < 0 && (status_get_mode(&md->bl)&MD_CANMOVE) && unit->can_move(&md->bl) ) { if( rnd()%1000 < MOB_LAZYMOVEPERC(md) ) - mob_randomwalk(md, tick); + mob->randomwalk(md, tick); } else if( md->ud.walktimer == INVALID_TIMER ) { diff --git a/src/map/pc.c b/src/map/pc.c index 1dc032f7c..1e651b321 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -9326,7 +9326,7 @@ int pc_checkitem(struct map_session_data *sd) int j; for ( j = 0; j < map->list[sd->bl.m].zone->disabled_items_count; j++ ) { if ( map->list[sd->bl.m].zone->disabled_items[j] == sd->status.inventory[i].nameid ) { - pc_unequipitem( sd, i, 2 ); + pc->unequipitem( sd, i, 2 ); calc_flag = 1; } } @@ -9338,7 +9338,7 @@ int pc_checkitem(struct map_session_data *sd) for ( slot = 0; slot < MAX_SLOTS; slot++ ) { for ( j = 0; j < map->list[sd->bl.m].zone->disabled_items_count; j++ ) { if ( map->list[sd->bl.m].zone->disabled_items[j] == sd->status.inventory[i].card[slot] ) { - pc_unequipitem( sd, i, 2 ); + pc->unequipitem( sd, i, 2 ); calc_flag = 1; } } diff --git a/src/map/script.c b/src/map/script.c index 5e368e0ad..9ff1b20a7 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -140,7 +140,7 @@ static void script_dump_stack(struct script_state* st) for( i = 0; i < st->stack->sp; ++i ) { struct script_data* data = &st->stack->stack_data[i]; - ShowMessage("\t[%d] %s", i, script_op2name(data->type)); + ShowMessage("\t[%d] %s", i, script->op2name(data->type)); switch( data->type ) { case C_INT: @@ -2865,7 +2865,7 @@ int set_reg(struct script_state* st, TBL_PC* sd, int64 num, const char* name, co } } else { ShowError("script_set_reg: cannot write instance variable '%s', NPC not in a instance!\n", name); - script_reportsrc(st); + script->reportsrc(st); } return 1; default: @@ -2931,7 +2931,7 @@ int set_reg(struct script_state* st, TBL_PC* sd, int64 num, const char* name, co } } else { ShowError("script_set_reg: cannot write instance variable '%s', NPC not in a instance!\n", name); - script_reportsrc(st); + script->reportsrc(st); } return 1; default: @@ -10201,7 +10201,7 @@ BUILDIN(sc_start) { enum sc_type type; int tick, val1, val2, val3, val4=0, rate, flag; char start_type; - const char* command = script_getfuncname(st); + const char* command = script->getfuncname(st); if(strstr(command, "4")) start_type = 4; diff --git a/src/map/skill.c b/src/map/skill.c index d3c00a75b..c9e68531d 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -1010,7 +1010,7 @@ int skill_additional_effect(struct block_list* src, struct block_list *bl, uint1 case LK_SPIRALPIERCE: case ML_SPIRALPIERCE: if( dstsd || ( dstmd && !is_boss(bl) ) ) //Does not work on bosses - sc_start(src,bl,SC_STOP,100,0,skill_get_time2(skill_id,skill_lv)); + sc_start(src,bl,SC_STOP,100,0,skill->get_time2(skill_id,skill_lv)); break; case ST_REJECTSWORD: @@ -3928,7 +3928,7 @@ int skill_castend_damage_id(struct block_list* src, struct block_list *bl, uint1 // If target cell is a wall then break if(map->getcell(bl->m,tx,ty,CELL_CHKWALL)) break; - skill_blown(src,bl,1,dir,0); + skill->blown(src,bl,1,dir,0); // Splash around target cell, but only cells inside area; we first have to check the area is not negative if((max(min_x,tx-1) <= min(max_x,tx+1)) && (max(min_y,ty-1) <= min(max_y,ty+1)) && @@ -5151,7 +5151,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin if((p = party->search(sd->status.party_id)) == NULL) break; - range = skill_get_splash(skill_id,skill_lv); + range = skill->get_splash(skill_id,skill_lv); x0 = sd->bl.x - range; y0 = sd->bl.y - range; x1 = sd->bl.x + range; @@ -8255,7 +8255,7 @@ int skill_castend_nodamage_id(struct block_list *src, struct block_list *bl, uin if( sd == NULL || sd->status.party_id == 0 || flag&1 ) { if( sd && tstatus && !battle->check_undead(tstatus->race, tstatus->def_ele) && !tsc->data[SC_BERSERK] ) { int lv = pc->checkskill(sd, AL_HEAL); - int heal = skill_calc_heal(src, bl, AL_HEAL, lv, true); + int heal = skill->calc_heal(src, bl, AL_HEAL, lv, true); if( sd->status.party_id ) { int partycount = party->foreachsamemap(party->sub_count, sd, 0); @@ -10613,7 +10613,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, uint16 skill_id, ui int tmpx = x - area + rnd()%(area * 2 + 1); int tmpy = y - area + rnd()%(area * 2 + 1); - skill_addtimerskill(src,tick+r*250,0,tmpx,tmpy,GN_CRAZYWEED_ATK,skill_lv,-1,0); + skill->addtimerskill(src,tick+r*250,0,tmpx,tmpy,GN_CRAZYWEED_ATK,skill_lv,-1,0); } } break; @@ -15459,7 +15459,7 @@ bool skill_can_cloak(struct map_session_data *sd) { //Avoid cloaking with no wall and low skill level. [Skotlex] //Due to the cloaking card, we have to check the wall versus to known //skill level rather than the used one. [Skotlex] - //if (sd && val1 < 3 && skill_check_cloaking(bl,NULL)) + //if (sd && val1 < 3 && skill->check_cloaking(bl,NULL)) if (pc->checkskill(sd, AS_CLOAKING) < 3 && !skill->check_cloaking(&sd->bl,NULL)) return false; diff --git a/src/map/status.c b/src/map/status.c index 66f7db3fa..4b31b9486 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -6390,7 +6390,7 @@ int status_get_sc_def(struct block_list *src, struct block_list *bl, enum sc_typ sd = BL_CAST(BL_PC,bl); st = status->get_status_data(bl); - bst = status_get_base_status(bl); + bst = status->get_base_status(bl); sc = status->get_sc(bl); if( sc && !sc->count ) sc = NULL; @@ -10985,7 +10985,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) { case SC__REPRODUCE: if( --(sce->val4) >= 0 ) { - if( !status_charge(bl, 0, 9 - (1 + sce->val1) / 2) ) + if( !status->charge(bl, 0, 9 - (1 + sce->val1) / 2) ) break; sc_timer_next(1000 + tick, status->change_timer, bl->id, data); return 0; @@ -11056,10 +11056,10 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) { case SC_SIRCLEOFNATURE: if( --(sce->val4) >= 0 ) { - if( !status_charge(bl,0,sce->val3) ) + if( !status->charge(bl,0,sce->val3) ) break; status->heal(bl, sce->val2, 0, 1); - sc_timer_next(1000 + tick, status_change_timer, bl->id, data); + sc_timer_next(1000 + tick, status->change_timer, bl->id, data); return 0; } break; @@ -11075,7 +11075,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) { case SC_SATURDAY_NIGHT_FEVER: if( --(sce->val3) >= 0 ) { - if( !status_charge(bl, st->max_hp * 1 / 100, st->max_sp * 1 / 100) ) + if( !status->charge(bl, st->max_hp * 1 / 100, st->max_sp * 1 / 100) ) break; sc_timer_next(3000+tick, status->change_timer, bl->id, data); return 0; @@ -11084,7 +11084,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) { case SC_MELODYOFSINK: if( --(sce->val4) >= 0 ) { - status_charge(bl, 0, st->max_sp * ( 2 * sce->val1 + 2 * sce->val2 ) / 100); + status->charge(bl, 0, st->max_sp * ( 2 * sce->val1 + 2 * sce->val2 ) / 100); sc_timer_next(1000+tick, status->change_timer, bl->id, data); return 0; } @@ -11167,7 +11167,7 @@ int status_change_timer(int tid, int64 tick, int id, intptr_t data) { if( st->sp <= sp ) status_change_end(bl,SC_STEALTHFIELD_MASTER,INVALID_TIMER); - if( !status_charge(bl,0,sp) ) + if( !status->charge(bl,0,sp) ) break; if( !sc->data[SC_STEALTHFIELD_MASTER] ) diff --git a/src/map/unit.c b/src/map/unit.c index 044d7a43c..0eb6fdbd2 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -158,7 +158,7 @@ int unit_step_timer(int tid, int64 tick, int id, intptr_t data) if (!bl || bl->prev == NULL) return 0; - ud = unit_bl2ud(bl); + ud = unit->bl2ud(bl); if(!ud) return 0; @@ -444,7 +444,7 @@ int unit_walktoxy_timer(int tid, int64 tick, int id, intptr_t data) { //Walked on occupied cell, call unit_walktoxy again if(ud->steptimer != INVALID_TIMER) { //Execute step timer on next step instead - timer->delete(ud->steptimer, unit_step_timer); + timer->delete(ud->steptimer, unit->step_timer); ud->steptimer = INVALID_TIMER; } return unit->walktoxy(bl, x, y, 8); @@ -1761,11 +1761,11 @@ void unit_stop_attack(struct block_list *bl) { struct unit_data *ud; nullpo_retv(bl); - ud = unit_bl2ud(bl); + ud = unit->bl2ud(bl); nullpo_retv(ud); //Clear target - unit_set_target(ud, 0); + unit->set_target(ud, 0); if(ud->attacktimer == INVALID_TIMER) return; @@ -1783,7 +1783,7 @@ void unit_stop_stepaction(struct block_list *bl) { struct unit_data *ud; nullpo_retv(bl); - ud = unit_bl2ud(bl); + ud = unit->bl2ud(bl); nullpo_retv(ud); //Clear remembered step action @@ -2080,7 +2080,7 @@ int unit_attack_timer_sub(struct block_list* src, int tid, int64 tick) { sstatus = status->get_status_data(src); range = sstatus->rhw.range; - if( (unit_is_walking(target) || ud->state.step_attack) + if( (unit->is_walking(target) || ud->state.step_attack) && (target->type == BL_PC || !map->getcell(target->m,target->x,target->y,CELL_CHKICEWALL)) ) range++; // Extra range when chasing (does not apply to mobs locked in an icewall) @@ -2090,7 +2090,7 @@ int unit_attack_timer_sub(struct block_list* src, int tid, int64 tick) { return 1; } else if(md && !check_distance_bl(src,target,range)) { // Monster: Chase if required - unit_walktobl(src,target,ud->chaserange,ud->state.walk_easy|2); + unit->walktobl(src,target,ud->chaserange,ud->state.walk_easy|2); return 1; } if( !battle->check_range(src,target,range) ) { -- cgit v1.2.3-60-g2f50