diff options
Diffstat (limited to 'src/map/unit.c')
-rw-r--r-- | src/map/unit.c | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/src/map/unit.c b/src/map/unit.c index ddc590396..5621eedc2 100644 --- a/src/map/unit.c +++ b/src/map/unit.c @@ -31,8 +31,8 @@ #include <string.h> -const int dirx[8]={0,-1,-1,-1,0,1,1,1}; -const int diry[8]={1,1,0,-1,-1,-1,0,1}; +const short dirx[8]={0,-1,-1,-1,0,1,1,1}; +const short diry[8]={1,1,0,-1,-1,-1,0,1}; struct unit_data* unit_bl2ud(struct block_list *bl) { @@ -103,7 +103,8 @@ int unit_walktoxy_sub(struct block_list *bl) static int unit_walktoxy_timer(int tid,unsigned int tick,int id,int data) { int i; - int x,y,dx,dy,dir; + int x,y,dx,dy; + uint8 dir; struct block_list *bl; struct map_session_data *sd = NULL; struct mob_data *md = NULL; @@ -272,7 +273,7 @@ static int unit_delay_walktoxy_timer(int tid, unsigned int tick, int id, int dat //&1 -> 1/0 = easy/hard //&2 -> force walking //&4 -> Delay walking if the reason you can't walk is the canwalk delay -int unit_walktoxy( struct block_list *bl, int x, int y, int flag) +int unit_walktoxy( struct block_list *bl, short x, short y, int flag) { struct unit_data* ud = NULL; struct status_change* sc = NULL; @@ -401,7 +402,8 @@ int unit_walktobl(struct block_list *bl, struct block_list *tbl, int range, int int unit_run(struct block_list *bl) { struct status_change *sc = status_get_sc(bl); - int i,to_x,to_y,dir_x,dir_y; + short to_x,to_y,dir_x,dir_y; + int i; if (!sc || !sc->count || sc->data[SC_RUN].timer == -1) return 0; @@ -454,7 +456,7 @@ int unit_run(struct block_list *bl) } //Makes bl attempt to run dist cells away from target. Uses hard-paths. -int unit_escape(struct block_list *bl, struct block_list *target, int dist) +int unit_escape(struct block_list *bl, struct block_list *target, short dist) { int dir = map_calc_dir(target, bl->x, bl->y); while( dist > 0 && map_getcell(bl->m, bl->x + dist*dirx[dir], bl->y + dist*diry[dir], CELL_CHKNOREACH) ) @@ -463,9 +465,10 @@ int unit_escape(struct block_list *bl, struct block_list *target, int dist) } //Instant warp function. -int unit_movepos(struct block_list *bl,int dst_x,int dst_y, int easy, int checkpath) +int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool checkpath) { - int dx,dy,dir; + short dx,dy; + uint8 dir; struct unit_data *ud = NULL; struct map_session_data *sd = NULL; struct walkpath_data wpd; @@ -535,7 +538,7 @@ int unit_setdir(struct block_list *bl,unsigned char dir) return 0; } -int unit_getdir(struct block_list *bl) +uint8 unit_getdir(struct block_list *bl) { struct unit_data *ud; nullpo_retr( 0, bl ); @@ -547,7 +550,7 @@ int unit_getdir(struct block_list *bl) //Warps a unit/ud to a given map/position. //In the case of players, pc_setpos is used. //it respects the no warp flags, so it is safe to call this without doing nowarpto/nowarp checks. -int unit_warp(struct block_list *bl,int m,short x,short y,int type) +int unit_warp(struct block_list *bl,short m,short x,short y,uint8 type) { struct unit_data *ud; nullpo_retr(0, bl); @@ -666,7 +669,7 @@ int unit_stop_walking(struct block_list *bl,int type) return 1; } -int unit_skilluse_id(struct block_list *src, int target_id, int skill_num, int skill_lv) +int unit_skilluse_id(struct block_list *src, int target_id, short skill_num, short skill_lv) { if(skill_num < 0) return 0; @@ -780,7 +783,7 @@ int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int return 1; } -int unit_skilluse_id2(struct block_list *src, int target_id, int skill_num, int skill_lv, int casttime, int castcancel) +int unit_skilluse_id2(struct block_list *src, int target_id, short skill_num, short skill_lv, int casttime, int castcancel) { struct unit_data *ud; struct status_data *tstatus; @@ -1053,7 +1056,7 @@ int unit_skilluse_id2(struct block_list *src, int target_id, int skill_num, int return 1; } -int unit_skilluse_pos(struct block_list *src, int skill_x, int skill_y, int skill_num, int skill_lv) +int unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, short skill_num, short skill_lv) { if(skill_num < 0) return 0; @@ -1064,7 +1067,7 @@ int unit_skilluse_pos(struct block_list *src, int skill_x, int skill_y, int skil ); } -int unit_skilluse_pos2( struct block_list *src, int skill_x, int skill_y, int skill_num, int skill_lv, int casttime, int castcancel) +int unit_skilluse_pos2( struct block_list *src, short skill_x, short skill_y, short skill_num, short skill_lv, int casttime, int castcancel) { struct map_session_data *sd = NULL; struct unit_data *ud = NULL; @@ -1602,7 +1605,7 @@ int unit_changeviewsize(struct block_list *bl,short size) * Otherwise it is assumed bl is being warped. * On-Kill specific stuff is not performed here, look at status_damage for that. *------------------------------------------*/ -int unit_remove_map(struct block_list *bl, int clrtype) +int unit_remove_map(struct block_list *bl, uint8 clrtype) { struct unit_data *ud = unit_bl2ud(bl); struct status_change *sc = status_get_sc(bl); @@ -1750,7 +1753,7 @@ int unit_remove_map(struct block_list *bl, int clrtype) * If clrtype is <0, no saving is performed. This is only for non-authed * objects that shouldn't be on a map yet. *------------------------------------------*/ -int unit_free(struct block_list *bl, int clrtype) +int unit_free(struct block_list *bl, uint8 clrtype) { struct unit_data *ud = unit_bl2ud( bl ); nullpo_retr(0, ud); |