diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/common/mapindex.c | 2 | ||||
-rw-r--r-- | src/common/mmo.h | 1 | ||||
-rw-r--r-- | src/map/atcommand.c | 7 | ||||
-rw-r--r-- | src/map/battle.c | 39 | ||||
-rw-r--r-- | src/map/battle.h | 7 | ||||
-rw-r--r-- | src/map/clif.c | 35 | ||||
-rw-r--r-- | src/map/clif.h | 2 | ||||
-rw-r--r-- | src/map/map.c | 4 | ||||
-rw-r--r-- | src/map/map.h | 14 | ||||
-rw-r--r-- | src/map/mob.h | 2 | ||||
-rw-r--r-- | src/map/npc.c | 4 | ||||
-rw-r--r-- | src/map/pc.c | 10 | ||||
-rw-r--r-- | src/map/pc.h | 2 | ||||
-rw-r--r-- | src/map/script.c | 7 | ||||
-rw-r--r-- | src/map/skill.c | 21 | ||||
-rw-r--r-- | src/map/skill.h | 10 | ||||
-rw-r--r-- | src/map/status.c | 46 | ||||
-rw-r--r-- | src/map/trade.c | 5 | ||||
-rw-r--r-- | src/map/trade.h | 2 | ||||
-rw-r--r-- | src/map/unit.c | 35 | ||||
-rw-r--r-- | src/map/unit.h | 26 | ||||
-rw-r--r-- | src/map/vending.c | 14 |
22 files changed, 146 insertions, 149 deletions
diff --git a/src/common/mapindex.c b/src/common/mapindex.c index 0c275c41a..b76a838be 100644 --- a/src/common/mapindex.c +++ b/src/common/mapindex.c @@ -17,7 +17,7 @@ struct _indexes { char name[MAP_NAME_LENGTH]; //Stores map name } indexes[MAX_MAPINDEX]; -static unsigned short max_index = 0; +int max_index = 0; char mapindex_cfgfile[80] = "db/map_index.txt"; diff --git a/src/common/mmo.h b/src/common/mmo.h index 18b724e56..ff74b1272 100644 --- a/src/common/mmo.h +++ b/src/common/mmo.h @@ -25,6 +25,7 @@ //Number of slots carded equipment can have. Never set to less than 4 as they are also used to keep the data of forged items/equipment. [Skotlex] //Note: The client seems unable to receive data for more than 4 slots due to all related packets having a fixed size. #define MAX_SLOTS 4 +//Max amount of a single stacked item #define MAX_AMOUNT 30000 #define MAX_ZENY 1000000000 #define MAX_FAME 1000000000 diff --git a/src/map/atcommand.c b/src/map/atcommand.c index dd022b9c8..5bcd80590 100644 --- a/src/map/atcommand.c +++ b/src/map/atcommand.c @@ -2781,12 +2781,13 @@ static int atcommand_stopattack(struct block_list *bl,va_list ap) /*========================================== * *------------------------------------------*/ -static int atcommand_pvpoff_sub(struct block_list *bl,va_list ap) { +static int atcommand_pvpoff_sub(struct block_list *bl,va_list ap) +{ TBL_PC* sd = (TBL_PC*)bl; clif_pvpset(sd, 0, 0, 2); - if (sd->pvp_timer != UINT_MAX) { + if (sd->pvp_timer != -1) { delete_timer(sd->pvp_timer, pc_calc_pvprank_timer); - sd->pvp_timer = UINT_MAX; + sd->pvp_timer = -1; } return 0; } diff --git a/src/map/battle.c b/src/map/battle.c index a6e6d64ab..16f33ea0a 100644 --- a/src/map/battle.c +++ b/src/map/battle.c @@ -144,7 +144,7 @@ struct delay_damage { unsigned short distance; unsigned short skill_lv; unsigned short skill_id; - unsigned short dmg_lv; + enum damage_lv dmg_lv; unsigned short attack_type; }; @@ -168,7 +168,7 @@ int battle_delay_damage_sub (int tid, unsigned int tick, int id, int data) return 0; } -int battle_delay_damage (unsigned int tick, struct block_list *src, struct block_list *target, int attack_type, int skill_id, int skill_lv, int damage, int dmg_lv, int ddelay) +int battle_delay_damage (unsigned int tick, struct block_list *src, struct block_list *target, int attack_type, int skill_id, int skill_lv, int damage, enum damage_lv dmg_lv, int ddelay) { struct delay_damage *dat; nullpo_retr(0, src); @@ -836,10 +836,10 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list * static struct Damage battle_calc_weapon_attack( struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int wflag) { - unsigned short skillratio = 100; //Skill dmg modifiers. + unsigned int skillratio = 100; //Skill dmg modifiers. short skill=0; short s_ele, s_ele_, t_class; - short i, nk; + int i, nk; struct map_session_data *sd, *tsd; struct Damage wd; @@ -1838,8 +1838,8 @@ static struct Damage battle_calc_weapon_attack( //Card Fix, sd side if ((wd.damage || wd.damage2) && !(nk&NK_NO_CARDFIX_ATK)) { - short cardfix = 1000, cardfix_ = 1000; - short t_race2 = status_get_race2(target); + int cardfix = 1000, cardfix_ = 1000; + int t_race2 = status_get_race2(target); if(sd->state.arrow_atk) { cardfix=cardfix*(100+sd->right_weapon.addrace[tstatus->race]+sd->arrow_addrace[tstatus->race])/100; @@ -2097,12 +2097,11 @@ static struct Damage battle_calc_weapon_attack( /*========================================== * battle_calc_magic_attack [DracoRPG] *------------------------------------------*/ -struct Damage battle_calc_magic_attack( - struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag) - { - short i, nk; +struct Damage battle_calc_magic_attack(struct block_list *src,struct block_list *target,int skill_num,int skill_lv,int mflag) +{ + int i, nk; short s_ele; - unsigned short skillratio = 100; //Skill dmg modifiers. + unsigned int skillratio = 100; //Skill dmg modifiers. struct map_session_data *sd, *tsd; struct Damage ad; @@ -2392,7 +2391,7 @@ struct Damage battle_calc_magic_attack( { //Target cards. short s_race2=status_get_race2(src); short s_class= status_get_class(src); - short cardfix=1000; + int cardfix=1000; if (!(nk&NK_NO_ELEFIX)) cardfix=cardfix*(100-tsd->subele[s_ele])/100; @@ -2598,11 +2597,7 @@ struct Damage battle_calc_misc_attack(struct block_list *src,struct block_list } hitrate+= sstatus->hit - flee; - - if (hitrate > battle_config.max_hitrate) - hitrate = battle_config.max_hitrate; - else if (hitrate < battle_config.min_hitrate) - hitrate = battle_config.min_hitrate; + hitrate = cap_value(hitrate, battle_config.min_hitrate, battle_config.max_hitrate); if(rand()%100 < hitrate) i = 1; @@ -2733,15 +2728,11 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int rdamage, int ldamage, hp = wd->hp_drain[type].value; if (wd->hp_drain[type].rate) - hp += battle_calc_drain(*damage, - wd->hp_drain[type].rate, - wd->hp_drain[type].per); + hp += battle_calc_drain(*damage, wd->hp_drain[type].rate, wd->hp_drain[type].per); sp = wd->sp_drain[type].value; if (wd->sp_drain[type].rate) - sp += battle_calc_drain(*damage, - wd->sp_drain[type].rate, - wd->sp_drain[type].per); + sp += battle_calc_drain(*damage, wd->sp_drain[type].rate, wd->sp_drain[type].per); if (hp) { if (wd->hp_drain[type].type) @@ -2768,7 +2759,7 @@ void battle_drain(TBL_PC *sd, struct block_list *tbl, int rdamage, int ldamage, /*========================================== * ’Ê?í?UŒ‚?ˆ—?‚Ü‚Æ‚ß *------------------------------------------*/ -int battle_weapon_attack(struct block_list* src, struct block_list* target, unsigned int tick, int flag) +enum damage_lv battle_weapon_attack(struct block_list* src, struct block_list* target, unsigned int tick, int flag) { struct map_session_data *sd = NULL, *tsd = NULL; struct status_data *sstatus, *tstatus; diff --git a/src/map/battle.h b/src/map/battle.h index abd877785..e7d385b3c 100644 --- a/src/map/battle.h +++ b/src/map/battle.h @@ -11,7 +11,7 @@ struct Damage { int amotion,dmotion; int blewcount; int flag; - int dmg_lv; //ATK_LUCKY,ATK_FLEE,ATK_DEF + enum damage_lv dmg_lv; //ATK_LUCKY,ATK_FLEE,ATK_DEF }; // ‘®«•\i“Ç‚Ýž‚Ý‚Ípc.cAbattle_attr_fix‚ÅŽg—pj @@ -48,11 +48,10 @@ enum { // ÅIŒvŽZ‚̃tƒ‰ƒO BF_SKILLMASK= 0x0f00, }; -int battle_delay_damage (unsigned int tick, struct block_list *src, struct block_list *target, int attack_type, int skill_id, int skill_lv, int damage, int dmg_lv, int ddelay); +int battle_delay_damage (unsigned int tick, struct block_list *src, struct block_list *target, int attack_type, int skill_id, int skill_lv, int damage, enum damage_lv dmg_lv, int ddelay); // ’ÊíUŒ‚ˆ—‚Ü‚Æ‚ß -int battle_weapon_attack( struct block_list *bl,struct block_list *target, - unsigned int tick,int flag); +enum damage_lv battle_weapon_attack( struct block_list *bl,struct block_list *target,unsigned int tick,int flag); // ŠeŽíƒpƒ‰ƒ[ƒ^‚𓾂é struct block_list* battle_get_master(struct block_list *src); diff --git a/src/map/clif.c b/src/map/clif.c index 0ace107aa..b67e2cd87 100644 --- a/src/map/clif.c +++ b/src/map/clif.c @@ -3925,7 +3925,7 @@ static void clif_getareachar_skillunit(struct map_session_data *sd, struct skill WFIFOB(fd,14)=unit->group->unit_id; WFIFOB(fd,15)=1; WFIFOB(fd,16)=1; - safestrncpy(WFIFOP(fd,17),unit->group->valstr,MESSAGE_SIZE); + safestrncpy((char*)WFIFOP(fd,17),unit->group->valstr,MESSAGE_SIZE); WFIFOSET(fd,packet_len(0x1c9)); return; } @@ -4559,7 +4559,7 @@ void clif_skill_setunit(struct skill_unit *unit) /*========================================== * ƒ[ƒvꊑI‘ð *------------------------------------------*/ -void clif_skill_warppoint(struct map_session_data* sd, int skill_num, int skill_lv, int map1, int map2, int map3, int map4) +void clif_skill_warppoint(struct map_session_data* sd, short skill_num, short skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4) { int fd; nullpo_retv(sd); @@ -5017,7 +5017,7 @@ int clif_solved_charname(int fd, int charid, const char* name) WFIFOHEAD(fd,packet_len(0x194)); WFIFOW(fd,0)=0x194; WFIFOL(fd,2)=charid; - safestrncpy(WFIFOP(fd,6), name, NAME_LENGTH); + safestrncpy((char*)WFIFOP(fd,6), name, NAME_LENGTH); WFIFOSET(fd,packet_len(0x194)); return 0; } @@ -8145,7 +8145,7 @@ void clif_parse_Hotkey(int fd, struct map_session_data *sd) { *------------------------------------------*/ void clif_parse_WalkToXY(int fd, struct map_session_data *sd) { - int x, y; + short x, y; int cmd; if (pc_isdead(sd)) { @@ -9112,13 +9112,13 @@ void clif_parse_TradeAck(int fd,struct map_session_data *sd) *------------------------------------------*/ void clif_parse_TradeAddItem(int fd,struct map_session_data *sd) { - int index = RFIFOW(fd,2); + short index = RFIFOW(fd,2); int amount = RFIFOL(fd,4); if( index == 0 ) trade_tradeaddzeny(sd, amount); else - trade_tradeadditem(sd, index, amount); + trade_tradeadditem(sd, index, (short)amount); } /*========================================== @@ -9218,7 +9218,7 @@ void clif_parse_SkillUp(int fd,struct map_session_data *sd) pc_skillup(sd,RFIFOW(fd,2)); } -static void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, int skillnum, int skilllv, int target_id) +static void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_session_data *sd, unsigned int tick, short skillnum, short skilllv, int target_id) { int lv; @@ -9251,14 +9251,16 @@ static void clif_parse_UseSkillToId_homun(struct homun_data *hd, struct map_sess *------------------------------------------*/ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) { - int skillnum, skilllv, tmp, target_id; + short skillnum, skilllv; + int tmp, target_id; unsigned int tick = gettick(); skilllv = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[0]); - if (skilllv < 1) skilllv = 1; //No clue, I have seen the client do this with guild skills :/ [Skotlex] skillnum = RFIFOW(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[1]); target_id = RFIFOL(fd,packet_db[sd->packet_ver][RFIFOW(fd,0)].pos[2]); + if (skilllv < 1) skilllv = 1; //No clue, I have seen the client do this with guild skills :/ [Skotlex] + //Whether skill fails or not is irrelevant, the char ain't idle. [Skotlex] sd->idletime = last_tick; @@ -9364,7 +9366,7 @@ void clif_parse_UseSkillToId(int fd, struct map_session_data *sd) /*========================================== * ƒXƒLƒ‹Žg—piꊎw’èj *------------------------------------------*/ -void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, int skilllv, int skillnum, int x, int y, int skillmoreinfo) +void clif_parse_UseSkillToPosSub(int fd, struct map_session_data *sd, short skilllv, short skillnum, short x, short y, int skillmoreinfo) { int lv; unsigned int tick = gettick(); @@ -9460,7 +9462,7 @@ void clif_parse_UseSkillToPosMoreInfo(int fd, struct map_session_data *sd) *------------------------------------------*/ void clif_parse_UseSkillMap(int fd, struct map_session_data* sd) { - int skill_num = RFIFOW(fd,2); + short skill_num = RFIFOW(fd,2); char map_name[MAP_NAME_LENGTH]; mapindex_getmapname((char*)RFIFOP(fd,4), map_name); @@ -9858,7 +9860,7 @@ void clif_parse_PartyInvite(int fd, struct map_session_data *sd) void clif_parse_PartyInvite2(int fd, struct map_session_data *sd) { struct map_session_data *t_sd; - char *name = RFIFOP(fd,2); + char *name = (char*)RFIFOP(fd,2); name[NAME_LENGTH]='\0'; if(map[sd->bl.m].flag.partylock) @@ -11239,7 +11241,7 @@ void clif_parse_HomMoveToMaster(int fd, struct map_session_data *sd) void clif_parse_HomMoveTo(int fd,struct map_session_data *sd) { //[orn] - int x,y,cmd; + short x,y,cmd; nullpo_retv(sd); if(!merc_is_hom_active(sd->hd)) @@ -11487,7 +11489,7 @@ static int packetdb_readdb(void) FILE *fp; char line[1024]; int ln=0; - int cmd,i,j,k,packet_ver; + int cmd,i,j,packet_ver; int max_cmd=-1; int skip_ver = 0; int warned = 0; @@ -11792,8 +11794,8 @@ static int packetdb_readdb(void) ShowError("packet_db: packet len error\n"); continue; } - k = atoi(str[1]); - packet_db[packet_ver][cmd].len = k; + + packet_db[packet_ver][cmd].len = (short)atoi(str[1]); if(str[2]==NULL){ packet_db[packet_ver][cmd].func = NULL; @@ -11826,6 +11828,7 @@ static int packetdb_readdb(void) exit(EXIT_FAILURE); } for(j=0,p2=str[3];p2;j++){ + short k; str2[j]=p2; p2=strchr(p2,':'); if(p2) *p2++=0; diff --git a/src/map/clif.h b/src/map/clif.h index 0b1ffe52c..3310769a8 100644 --- a/src/map/clif.h +++ b/src/map/clif.h @@ -203,7 +203,7 @@ int clif_skill_damage(struct block_list *src,struct block_list *dst,unsigned int int clif_skill_nodamage(struct block_list *src,struct block_list *dst,int skill_id,int heal,int fail); int clif_skill_poseffect(struct block_list *src,int skill_id,int val,int x,int y,int tick); int clif_skill_estimation(struct map_session_data *sd,struct block_list *dst); -void clif_skill_warppoint(struct map_session_data* sd, int skill_num, int skill_lv, int map1, int map2, int map3, int map4); +void clif_skill_warppoint(struct map_session_data* sd, int skill_num, int skill_lv, unsigned short map1, unsigned short map2, unsigned short map3, unsigned short map4); int clif_skill_memo(struct map_session_data *sd,int flag); int clif_skill_teleportmessage(struct map_session_data *sd,int flag); int clif_skill_produce_mix_list(struct map_session_data *sd, int trigger); diff --git a/src/map/map.c b/src/map/map.c index 3263a6ed8..db4f7d077 100644 --- a/src/map/map.c +++ b/src/map/map.c @@ -2153,9 +2153,9 @@ int map_check_dir(int s_dir,int t_dir) /*========================================== * Returns the direction of the given cell, relative to 'src' *------------------------------------------*/ -int map_calc_dir(struct block_list* src, int x, int y) +uint8 map_calc_dir(struct block_list* src, int x, int y) { - int dir = 0; + unsigned char dir = 0; int dx, dy; nullpo_retr(0, src); diff --git a/src/map/map.h b/src/map/map.h index 5cef74b07..a5f4a6357 100644 --- a/src/map/map.h +++ b/src/map/map.h @@ -290,7 +290,7 @@ struct skill_unit_group { unsigned int tick; int limit,interval; - int skill_id,skill_lv; + short skill_id,skill_lv; int val1,val2,val3; char *valstr; int unit_id; @@ -327,7 +327,7 @@ struct unit_data { unsigned int attackabletime; unsigned int canact_tick; unsigned int canmove_tick; - unsigned char dir; + uint8 dir; unsigned char walk_count; struct { unsigned change_walk_target : 1 ; @@ -397,7 +397,7 @@ struct status_change { struct s_vending { short index; - unsigned short amount; + short amount; unsigned int value; }; @@ -753,7 +753,7 @@ struct map_session_data { int trade_partner; struct { struct { - int index, amount; + short index, amount; } item[10]; int zeny, weight; } deal; @@ -780,7 +780,7 @@ struct map_session_data { }feel_map[3];// 0 - Sun; 1 - Moon; 2 - Stars short hate_mob[3]; - unsigned int pvp_timer; + int pvp_timer; short pvp_point; unsigned short pvp_rank, pvp_lastusers; unsigned short pvp_won, pvp_lost; @@ -1024,7 +1024,7 @@ struct pet_data { }; // state of a single attack attempt; used in flee/def penalty calculations when mobbed -enum { +enum damage_lv { ATK_LUCKY=1, // attack was lucky-dodged ATK_FLEE, // attack was dodged ATK_DEF // attack connected @@ -1346,7 +1346,7 @@ struct map_session_data * map_nick2sd(const char*); // ‚»‚Ì‘¼ int map_check_dir(int s_dir,int t_dir); -int map_calc_dir( struct block_list *src,int x,int y); +unsigned char map_calc_dir( struct block_list *src,int x,int y); int map_random_dir(struct block_list *bl, short *x, short *y); // [Skotlex] // path.c‚æ‚è diff --git a/src/map/mob.h b/src/map/mob.h index 367640e07..5d2296d47 100644 --- a/src/map/mob.h +++ b/src/map/mob.h @@ -66,7 +66,7 @@ struct mob_db { char sprite[NAME_LENGTH],name[NAME_LENGTH],jname[NAME_LENGTH]; unsigned int base_exp,job_exp; unsigned int mexp,mexpper; - int range2,range3; + short range2,range3; short race2; // celest unsigned short lv; struct { int nameid,p; } dropitem[MAX_MOB_DROP]; diff --git a/src/map/npc.c b/src/map/npc.c index 622d67ec1..0c04cfb73 100644 --- a/src/map/npc.c +++ b/src/map/npc.c @@ -532,7 +532,7 @@ int npc_timerevent_stop(struct npc_data* nd) return 0; td = get_timer(*tid); if (td && td->data) - ers_free(timer_event_ers, (struct event_timer_data*)td->data); + ers_free(timer_event_ers, (void*)td->data); delete_timer(*tid,npc_timerevent); *tid = -1; //Set the timer tick to the time that has passed since the beginning of the timers and now. @@ -1316,7 +1316,7 @@ int npc_unload(struct npc_data* nd) struct TimerData *td = NULL; td = get_timer(nd->u.scr.timerid); if (td && td->data) - ers_free(timer_event_ers, (struct event_timer_data*)td->data); + ers_free(timer_event_ers, (void*)td->data); delete_timer(nd->u.scr.timerid, npc_timerevent); } if (nd->u.scr.timer_event) diff --git a/src/map/pc.c b/src/map/pc.c index d259bc6e0..f039f8318 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -3398,7 +3398,7 @@ int pc_steal_coin(struct map_session_data *sd,struct block_list *target) * 2 - Map not in this map-server, and failed to locate alternate map-server. * 3 - Failed to warp player because it was in transition between maps. *------------------------------------------*/ -int pc_setpos(struct map_session_data *sd,unsigned short mapindex,int x,int y,int clrtype) +int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, uint8 clrtype) { int m; @@ -6688,11 +6688,9 @@ int pc_calc_pvprank_timer(int tid,unsigned int tick,int id,int data) sd=map_id2sd(id); if(sd==NULL) return 0; - sd->pvp_timer=UINT_MAX; - if( pc_calc_pvprank(sd)>0 ) - sd->pvp_timer=add_timer( - gettick()+PVP_CALCRANK_INTERVAL, - pc_calc_pvprank_timer,id,data); + sd->pvp_timer = -1; + if( pc_calc_pvprank(sd) > 0 ) + sd->pvp_timer = add_timer(gettick()+PVP_CALCRANK_INTERVAL,pc_calc_pvprank_timer,id,data); return 0; } diff --git a/src/map/pc.h b/src/map/pc.h index b8169e954..0d3b4d8d4 100644 --- a/src/map/pc.h +++ b/src/map/pc.h @@ -142,7 +142,7 @@ int pc_clean_skilltree(struct map_session_data *sd); #define pc_checkoverhp(sd) (sd->battle_status.hp == sd->battle_status.max_hp) #define pc_checkoversp(sd) (sd->battle_status.sp == sd->battle_status.max_sp) -int pc_setpos(struct map_session_data*,unsigned short,int,int,int); +int pc_setpos(struct map_session_data* sd, unsigned short mapindex, int x, int y, uint8 clrtype); int pc_setsavepoint(struct map_session_data*,short,int,int); int pc_randomwarp(struct map_session_data *sd,int type); int pc_memo(struct map_session_data *sd,int i); diff --git a/src/map/script.c b/src/map/script.c index 0d2d04650..458f57fb3 100644 --- a/src/map/script.c +++ b/src/map/script.c @@ -9417,12 +9417,13 @@ BUILDIN_FUNC(pvpon) return 0; } -static int buildin_pvpoff_sub(struct block_list *bl,va_list ap) { +static int buildin_pvpoff_sub(struct block_list *bl,va_list ap) +{ TBL_PC* sd = (TBL_PC*)bl; clif_pvpset(sd, 0, 0, 2); - if (sd->pvp_timer != UINT_MAX) { + if (sd->pvp_timer != -1) { delete_timer(sd->pvp_timer, pc_calc_pvprank_timer); - sd->pvp_timer = UINT_MAX; + sd->pvp_timer = -1; } return 0; } diff --git a/src/map/skill.c b/src/map/skill.c index 1b5797742..a1f5c8b05 100644 --- a/src/map/skill.c +++ b/src/map/skill.c @@ -6481,7 +6481,7 @@ int skill_castend_pos2(struct block_list* src, int x, int y, int skillid, int sk /*========================================== * *------------------------------------------*/ -int skill_castend_map (struct map_session_data *sd, int skill_num, const char *map) +int skill_castend_map (struct map_session_data *sd, short skill_num, const char *map) { nullpo_retr(0, sd); @@ -6708,7 +6708,7 @@ static bool skill_dance_switch(struct skill_unit* unit, int flag) * flag&1 is used to determine when the skill 'morphs' (Warp portal becomes active, or Fire Pillar becomes active) * flag&2 is used to determine if this skill was casted with Magic Power active. *------------------------------------------*/ -struct skill_unit_group *skill_unitsetting (struct block_list *src, int skillid, int skilllv, int x, int y, int flag) +struct skill_unit_group* skill_unitsetting (struct block_list *src, short skillid, short skilllv, short x, short y, int flag) { struct skill_unit_group *group; int i,limit,val1=0,val2=0,val3=0; @@ -6975,7 +6975,8 @@ struct skill_unit_group *skill_unitsetting (struct block_list *src, int skillid, for(i=0;i<layout->count;i++) { struct skill_unit *unit; - int ux,uy,alive=1; + short ux,uy; + int alive=1; ux = x + layout->dx[i]; uy = y + layout->dy[i]; @@ -7942,13 +7943,13 @@ static int skill_check_condition_char_sub (struct block_list *bl, va_list ap) } break; } - return 0; + //return 0; } /*========================================== * Checks and stores partners for ensemble skills [Skotlex] *------------------------------------------*/ -int skill_check_pc_partner (struct map_session_data *sd, int skill_id, int* skill_lv, int range, int cast_flag) +int skill_check_pc_partner (struct map_session_data *sd, short skill_id, short* skill_lv, int range, int cast_flag) { static int c=0; static int p_sd[2] = { 0, 0 }; @@ -8039,7 +8040,7 @@ int skill_isammotype (struct map_session_data *sd, int skill) * &1: finished casting the skill (invoke hp/sp/item consumption) * &2: picked menu entry (Warp Portal, Teleport and other menu based skills) *------------------------------------------*/ -int skill_check_condition(struct map_session_data* sd, int skill, int lv, int type) +int skill_check_condition(struct map_session_data* sd, short skill, short lv, int type) { struct status_data *status; struct status_change *sc; @@ -9322,11 +9323,9 @@ int skill_sit (struct map_session_data *sd, int type) if(type) { if (map_foreachinrange(skill_sit_count,&sd->bl, range, BL_PC, flag) > 1) map_foreachinrange(skill_sit_in,&sd->bl, range, BL_PC, flag); - return 0; } else { if (map_foreachinrange(skill_sit_count,&sd->bl, range, BL_PC, flag) < 2) map_foreachinrange(skill_sit_out,&sd->bl, range, BL_PC, flag); - return 0; } return 0; } @@ -9954,7 +9953,7 @@ int skill_delunit (struct skill_unit* unit) *------------------------------------------*/ static int skill_unit_group_newid = MAX_SKILL_DB; -struct skill_unit_group *skill_initunitgroup (struct block_list *src, int count, int skillid, int skilllv, int unit_id, int limit, int interval) +struct skill_unit_group* skill_initunitgroup (struct block_list* src, int count, short skillid, short skilllv, int unit_id, int limit, int interval) { struct unit_data* ud = unit_bl2ud( src ); struct skill_unit_group* group; @@ -10406,7 +10405,7 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap) { if( flag&1 ) { - unsigned int result = skill_unit_onplace(unit,target,tick); + int result = skill_unit_onplace(unit,target,tick); if( flag&2 && result ) { //Clear skill ids we have stored in onout. ARR_FIND( 0, ARRAYLENGTH(skill_unit_temp), i, skill_unit_temp[i] == result ); @@ -10416,7 +10415,7 @@ int skill_unit_move_sub (struct block_list* bl, va_list ap) } else { - unsigned int result = skill_unit_onout(unit,target,tick); + int result = skill_unit_onout(unit,target,tick); if( flag&2 && result ) { //Store this unit id. ARR_FIND( 0, ARRAYLENGTH(skill_unit_temp), i, skill_unit_temp[i] == 0 ); diff --git a/src/map/skill.h b/src/map/skill.h index 7c7cce429..7d0580945 100644 --- a/src/map/skill.h +++ b/src/map/skill.h @@ -191,7 +191,7 @@ const char* skill_get_desc( int id ); // [Skotlex] int skill_isammotype(struct map_session_data *sd, int skill); int skill_castend_id( int tid, unsigned int tick, int id,int data ); int skill_castend_pos( int tid, unsigned int tick, int id,int data ); -int skill_castend_map( struct map_session_data *sd,int skill_num, const char *map); +int skill_castend_map( struct map_session_data *sd,short skill_num, const char *map); int skill_cleartimerskill(struct block_list *src); int skill_addtimerskill(struct block_list *src,unsigned int tick,int target,int x,int y,int skill_id,int skill_lv,int type,int flag); @@ -203,10 +203,10 @@ int skill_blown(struct block_list* src, struct block_list* target, int count, in int skill_break_equip(struct block_list *bl, unsigned short where, int rate, int flag); int skill_strip_equip(struct block_list *bl, unsigned short where, int rate, int lv, int time); // ƒ†ƒjƒbƒgƒXƒLƒ‹ -struct skill_unit_group *skill_unitsetting( struct block_list *src, int skillid,int skilllv,int x,int y,int flag); +struct skill_unit_group *skill_unitsetting(struct block_list* src, short skillid, short skilllv, short x, short y, int flag); struct skill_unit *skill_initunit (struct skill_unit_group *group, int idx, int x, int y, int val1, int val2); int skill_delunit(struct skill_unit *unit); -struct skill_unit_group *skill_initunitgroup(struct block_list *src, int count,int skillid,int skilllv,int unit_id, int limit, int interval); +struct skill_unit_group *skill_initunitgroup(struct block_list* src, int count, short skillid, short skilllv, int unit_id, int limit, int interval); int skill_delunitgroup(struct block_list *src, struct skill_unit_group *group); int skill_clear_unitgroup(struct block_list *src); int skill_clear_group(struct block_list *bl, int flag); @@ -217,8 +217,8 @@ int skill_unit_ondamaged(struct skill_unit *src,struct block_list *bl, int skill_castfix( struct block_list *bl, int skill_id, int skill_lv); int skill_castfix_sc( struct block_list *bl, int time); int skill_delayfix( struct block_list *bl, int skill_id, int skill_lv); -int skill_check_condition( struct map_session_data *sd,int skill, int lv, int type); -int skill_check_pc_partner(struct map_session_data *sd, int skill_id, int* skill_lv, int range, int cast_flag); +int skill_check_condition( struct map_session_data *sd, short skill, short lv, int type); +int skill_check_pc_partner(struct map_session_data *sd, short skill_id, short* skill_lv, int range, int cast_flag); // -- moonsoul (added skill_check_unit_cell) int skill_check_unit_cell(int skillid,int m,int x,int y,int unit_id); int skill_unit_out_all( struct block_list *bl,unsigned int tick,int range); diff --git a/src/map/status.c b/src/map/status.c index c0d81950a..666ec386c 100644 --- a/src/map/status.c +++ b/src/map/status.c @@ -3173,7 +3173,7 @@ static unsigned short status_calc_str(struct block_list *bl, struct status_chang if(sc->data[SC_SPIRIT].timer!=-1 && sc->data[SC_SPIRIT].val2 == SL_HIGH && str < 50) str = 50; - return cap_value(str,0,USHRT_MAX); + return (unsigned short)cap_value(str,0,USHRT_MAX); } static unsigned short status_calc_agi(struct block_list *bl, struct status_change *sc, int agi) @@ -3212,7 +3212,7 @@ static unsigned short status_calc_agi(struct block_list *bl, struct status_chang if(sc->data[SC_SPIRIT].timer!=-1 && sc->data[SC_SPIRIT].val2 == SL_HIGH && agi < 50) agi = 50; - return cap_value(agi,0,USHRT_MAX); + return (unsigned short)cap_value(agi,0,USHRT_MAX); } static unsigned short status_calc_vit(struct block_list *bl, struct status_change *sc, int vit) @@ -3241,7 +3241,7 @@ static unsigned short status_calc_vit(struct block_list *bl, struct status_chang if(sc->data[SC_SPIRIT].timer!=-1 && sc->data[SC_SPIRIT].val2 == SL_HIGH && vit < 50) vit = 50; - return cap_value(vit,0,USHRT_MAX); + return (unsigned short)cap_value(vit,0,USHRT_MAX); } static unsigned short status_calc_int(struct block_list *bl, struct status_change *sc, int int_) @@ -3278,7 +3278,7 @@ static unsigned short status_calc_int(struct block_list *bl, struct status_chang if(sc->data[SC_SPIRIT].timer!=-1 && sc->data[SC_SPIRIT].val2 == SL_HIGH && int_ < 50) int_ = 50; - return cap_value(int_,0,USHRT_MAX); + return (unsigned short)cap_value(int_,0,USHRT_MAX); } static unsigned short status_calc_dex(struct block_list *bl, struct status_change *sc, int dex) @@ -3320,7 +3320,7 @@ static unsigned short status_calc_dex(struct block_list *bl, struct status_chang if(sc->data[SC_SPIRIT].timer!=-1 && sc->data[SC_SPIRIT].val2 == SL_HIGH && dex < 50) dex = 50; - return cap_value(dex,0,USHRT_MAX); + return (unsigned short)cap_value(dex,0,USHRT_MAX); } static unsigned short status_calc_luk(struct block_list *bl, struct status_change *sc, int luk) @@ -3347,7 +3347,7 @@ static unsigned short status_calc_luk(struct block_list *bl, struct status_chang if(sc->data[SC_SPIRIT].timer!=-1 && sc->data[SC_SPIRIT].val2 == SL_HIGH && luk < 50) luk = 50; - return cap_value(luk,0,USHRT_MAX); + return (unsigned short)cap_value(luk,0,USHRT_MAX); } static unsigned short status_calc_batk(struct block_list *bl, struct status_change *sc, int batk) @@ -3382,7 +3382,7 @@ static unsigned short status_calc_batk(struct block_list *bl, struct status_chan batk += sc->data[SC_GATLINGFEVER].val3; if(sc->data[SC_MADNESSCANCEL].timer!=-1) batk += 100; - return cap_value(batk,0,USHRT_MAX); + return (unsigned short)cap_value(batk,0,USHRT_MAX); } static unsigned short status_calc_watk(struct block_list *bl, struct status_change *sc, int watk) @@ -3425,7 +3425,7 @@ static unsigned short status_calc_watk(struct block_list *bl, struct status_chan if(sc->data[SC_STRIPWEAPON].timer!=-1) watk -= watk * sc->data[SC_STRIPWEAPON].val2/100; - return cap_value(watk,0,USHRT_MAX); + return (unsigned short)cap_value(watk,0,USHRT_MAX); } static unsigned short status_calc_matk(struct block_list *bl, struct status_change *sc, int matk) @@ -3444,7 +3444,7 @@ static unsigned short status_calc_matk(struct block_list *bl, struct status_chan if(sc->data[SC_INCMATKRATE].timer!=-1) matk += matk * sc->data[SC_INCMATKRATE].val1/100; - return cap_value(matk,0,USHRT_MAX); + return (unsigned short)cap_value(matk,0,USHRT_MAX); } static signed short status_calc_critical(struct block_list *bl, struct status_change *sc, int critical) @@ -3461,7 +3461,7 @@ static signed short status_calc_critical(struct block_list *bl, struct status_ch if(sc->data[SC_CLOAKING].timer!=-1) critical += critical; - return cap_value(critical,10,SHRT_MAX); + return (short)cap_value(critical,10,SHRT_MAX); } static signed short status_calc_hit(struct block_list *bl, struct status_change *sc, int hit) @@ -3489,7 +3489,7 @@ static signed short status_calc_hit(struct block_list *bl, struct status_change if(sc->data[SC_INCREASING].timer!=-1) hit += 20; // RockmanEXE; changed based on updated [Reddozen] - return cap_value(hit,1,SHRT_MAX); + return (short)cap_value(hit,1,SHRT_MAX); } static signed short status_calc_flee(struct block_list *bl, struct status_change *sc, int flee) @@ -3529,7 +3529,7 @@ static signed short status_calc_flee(struct block_list *bl, struct status_change if(sc->data[SC_SPEED].timer!=-1) flee += 10 + sc->data[SC_SPEED].val1 * 10 ; - return cap_value(flee,1,SHRT_MAX); + return (short)cap_value(flee,1,SHRT_MAX); } static signed short status_calc_flee2(struct block_list *bl, struct status_change *sc, int flee2) @@ -3540,7 +3540,7 @@ static signed short status_calc_flee2(struct block_list *bl, struct status_chang if(sc->data[SC_WHISTLE].timer!=-1) flee2 += sc->data[SC_WHISTLE].val3*10; - return cap_value(flee2,10,SHRT_MAX); + return (short)cap_value(flee2,10,SHRT_MAX); } static signed char status_calc_def(struct block_list *bl, struct status_change *sc, int def) @@ -3583,7 +3583,7 @@ static signed char status_calc_def(struct block_list *bl, struct status_change * if (sc->data[SC_FLING].timer!=-1) def -= def * (sc->data[SC_FLING].val2)/100; - return cap_value(def,0,CHAR_MAX); + return (char)cap_value(def,0,CHAR_MAX); } static signed short status_calc_def2(struct block_list *bl, struct status_change *sc, int def2) @@ -3617,7 +3617,7 @@ static signed short status_calc_def2(struct block_list *bl, struct status_change if(sc->data[SC_FLING].timer!=-1) def2 -= def2 * (sc->data[SC_FLING].val3)/100; - return cap_value(def2,1,SHRT_MAX); + return (short)cap_value(def2,1,SHRT_MAX); } static signed char status_calc_mdef(struct block_list *bl, struct status_change *sc, int mdef) @@ -3642,7 +3642,7 @@ static signed char status_calc_mdef(struct block_list *bl, struct status_change if(sc->data[SC_ENDURE].timer!=-1 && sc->data[SC_ENDURE].val4 == 0) mdef += sc->data[SC_ENDURE].val1; - return cap_value(mdef,0,CHAR_MAX); + return (char)cap_value(mdef,0,CHAR_MAX); } static signed short status_calc_mdef2(struct block_list *bl, struct status_change *sc, int mdef2) @@ -3655,7 +3655,7 @@ static signed short status_calc_mdef2(struct block_list *bl, struct status_chang if(sc->data[SC_MINDBREAKER].timer!=-1) mdef2 -= mdef2 * sc->data[SC_MINDBREAKER].val3/100; - return cap_value(mdef2,1,SHRT_MAX); + return (short)cap_value(mdef2,1,SHRT_MAX); } static unsigned short status_calc_speed(struct block_list *bl, struct status_change *sc, int speed) @@ -3731,7 +3731,7 @@ static unsigned short status_calc_speed(struct block_list *bl, struct status_cha if(sc->data[SC_SLOWDOWN].timer!=-1) speed = speed * 100/75; - return cap_value(speed,10,USHRT_MAX); + return (short)cap_value(speed,10,USHRT_MAX); } static short status_calc_aspd_rate(struct block_list *bl, struct status_change *sc, int aspd_rate) @@ -3830,7 +3830,7 @@ static short status_calc_aspd_rate(struct block_list *bl, struct status_change * aspd_rate += 100; } - return cap_value(aspd_rate,0,SHRT_MAX); + return (short)cap_value(aspd_rate,0,SHRT_MAX); } static unsigned short status_calc_dmotion(struct block_list *bl, struct status_change *sc, int dmotion) @@ -3845,7 +3845,7 @@ static unsigned short status_calc_dmotion(struct block_list *bl, struct status_c if(sc->data[SC_RUN].timer!=-1) return 0; - return cap_value(dmotion,0,USHRT_MAX); + return (unsigned short)cap_value(dmotion,0,USHRT_MAX); } static unsigned int status_calc_maxhp(struct block_list *bl, struct status_change *sc, unsigned int maxhp) @@ -3892,7 +3892,7 @@ static unsigned char status_calc_element(struct block_list *bl, struct status_ch return ELE_UNDEAD; if( sc->data[SC_ELEMENTALCHANGE].timer!=-1) return sc->data[SC_ELEMENTALCHANGE].val2; - return cap_value(element,0,UCHAR_MAX); + return (unsigned char)cap_value(element,0,UCHAR_MAX); } static unsigned char status_calc_element_lv(struct block_list *bl, struct status_change *sc, int lv) @@ -3909,7 +3909,7 @@ static unsigned char status_calc_element_lv(struct block_list *bl, struct status return 1; if(sc->data[SC_ELEMENTALCHANGE].timer!=-1) return sc->data[SC_ELEMENTALCHANGE].val1; - return cap_value(lv,1,4); + return (unsigned char)cap_value(lv,1,4); } @@ -3935,7 +3935,7 @@ unsigned char status_calc_attack_element(struct block_list *bl, struct status_ch return ELE_DARK; if( sc->data[SC_GHOSTWEAPON].timer!=-1) return ELE_GHOST; - return cap_value(element,0,UCHAR_MAX); + return (unsigned char)cap_value(element,0,UCHAR_MAX); } static unsigned short status_calc_mode(struct block_list *bl, struct status_change *sc, int mode) diff --git a/src/map/trade.c b/src/map/trade.c index 0bf7e4432..eadc115a7 100644 --- a/src/map/trade.c +++ b/src/map/trade.c @@ -228,7 +228,8 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd) struct item inventory[MAX_INVENTORY]; struct item inventory2[MAX_INVENTORY]; struct item_data *data; - int trade_i, i, amount, n; + int trade_i, i, n; + short amount; if(sd->state.finalsave || tsd->state.finalsave) return 0; //Item transferring fails @@ -312,7 +313,7 @@ int trade_check(struct map_session_data *sd, struct map_session_data *tsd) /*========================================== * Adds an item/qty to the trade window *------------------------------------------*/ -void trade_tradeadditem(struct map_session_data *sd, int index, int amount) +void trade_tradeadditem(struct map_session_data *sd, short index, short amount) { struct map_session_data *target_sd; struct item *item; diff --git a/src/map/trade.h b/src/map/trade.h index 724ed2253..6bb39936e 100644 --- a/src/map/trade.h +++ b/src/map/trade.h @@ -9,7 +9,7 @@ struct map_session_data; void trade_traderequest(struct map_session_data *sd, struct map_session_data *target_sd); void trade_tradeack(struct map_session_data *sd,int type); -void trade_tradeadditem(struct map_session_data *sd,int index,int amount); +void trade_tradeadditem(struct map_session_data *sd,short index,short amount); void trade_tradeaddzeny(struct map_session_data *sd,int amount); void trade_tradeok(struct map_session_data *sd); void trade_tradecancel(struct map_session_data *sd); 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); diff --git a/src/map/unit.h b/src/map/unit.h index 83858fb5d..1880b3b99 100644 --- a/src/map/unit.h +++ b/src/map/unit.h @@ -12,7 +12,7 @@ struct unit_data; // •àsŠJŽn // –ß‚è’l‚ÍA0 ( ¬Œ÷ ), 1 ( Ž¸”s ) -int unit_walktoxy( struct block_list *bl, int x, int y, int easy); +int unit_walktoxy( struct block_list *bl, short x, short y, int easy); int unit_walktobl( struct block_list *bl, struct block_list *target, int range, int easy); int unit_run(struct block_list *bl); @@ -26,12 +26,12 @@ int unit_can_move(struct block_list *bl); int unit_is_walking(struct block_list *bl); int unit_set_walkdelay(struct block_list *bl, unsigned int tick, int delay, int type); -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); // ˆÊ’u‚Ì‹§ˆÚ“®(‚«”ò‚΂µ‚È‚Ç) -int unit_movepos(struct block_list *bl,int dst_x,int dst_y, int easy, int checkpath); -int unit_warp(struct block_list *bl, int map, short x, short y, int type); +int unit_movepos(struct block_list *bl, short dst_x, short dst_y, int easy, bool checkpath); +int unit_warp(struct block_list *bl, short map, short x, short y, uint8 type); int unit_setdir(struct block_list *bl,unsigned char dir); -int unit_getdir(struct block_list *bl); +uint8 unit_getdir(struct block_list *bl); // ‚»‚±‚Ü‚Å•às‚Å‚½‚Ç‚è’…‚¯‚é‚©‚Ì”»’è int unit_can_reach_pos(struct block_list *bl,int x,int y,int easy); @@ -43,12 +43,12 @@ int unit_attack(struct block_list *src,int target_id,int continuous); int unit_cancel_combo(struct block_list *bl); // ƒXƒLƒ‹Žg—p -int unit_skilluse_id(struct block_list *src, int target_id, int skill_num, int skill_lv); -int unit_skilluse_pos(struct block_list *src, int skill_x, int skill_y, int skill_num, int skill_lv); +int unit_skilluse_id(struct block_list *src, int target_id, short skill_num, short skill_lv); +int unit_skilluse_pos(struct block_list *src, short skill_x, short skill_y, short skill_num, short skill_lv); // ƒXƒLƒ‹Žg—p( •â³Ï‚݃LƒƒƒXƒgŽžŠÔAƒLƒƒƒ“ƒZƒ‹•s‰ÂÝ’è•t‚« ) -int unit_skilluse_id2(struct block_list *src, int target_id, int skill_num, int skill_lv, int casttime, int castcancel); -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_id2(struct block_list *src, int target_id, short skill_num, short 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); // ‰r¥ƒLƒƒƒ“ƒZƒ‹ int unit_skillcastcancel(struct block_list *bl,int type); @@ -61,15 +61,15 @@ void unit_dataset(struct block_list *bl); int unit_fixdamage(struct block_list *src,struct block_list *target,unsigned int tick,int sdelay,int ddelay,int damage,int div,int type,int damage2); // ‚»‚Ì‘¼ struct unit_data* unit_bl2ud(struct block_list *bl); -int unit_remove_map(struct block_list *bl, int clrtype); -int unit_free(struct block_list *bl, int clrtype); +int unit_remove_map(struct block_list *bl, uint8 clrtype); +int unit_free(struct block_list *bl, uint8 clrtype); int unit_changeviewsize(struct block_list *bl,short size); // ‰Šú‰»ƒ‹[ƒ`ƒ“ int do_init_unit(void); int do_final_unit(void); -extern const int dirx[8]; -extern const int diry[8]; +extern const short dirx[8]; +extern const short diry[8]; #endif /* _UNIT_H_ */ diff --git a/src/map/vending.c b/src/map/vending.c index 9017eab96..7c0024eb3 100644 --- a/src/map/vending.c +++ b/src/map/vending.c @@ -81,8 +81,8 @@ void vending_purchasereq(struct map_session_data* sd, int id, const uint8* data, w = 0; // weight counter for( i = 0; i < count; i++ ) { - unsigned short amount = *(uint16*)(data + 4*i + 0); - short idx = *(uint16*)(data + 4*i + 2); + short amount = *(uint16*)(data + 4*i + 0); + short idx = *(uint16*)(data + 4*i + 2); idx -= 2; if( amount <= 0 ) @@ -150,8 +150,8 @@ void vending_purchasereq(struct map_session_data* sd, int id, const uint8* data, for( i = 0; i < count; i++ ) { - unsigned short amount = *(uint16*)(data + 4*i + 0); - short idx = *(uint16*)(data + 4*i + 2); + short amount = *(uint16*)(data + 4*i + 0); + short idx = *(uint16*)(data + 4*i + 2); idx -= 2; //Logs sold (V)ending items [Lupus] @@ -248,9 +248,9 @@ void vending_openvending(struct map_session_data* sd, const char* message, bool i = 0; for( j = 0; j < count; j++ ) { - int index = *(uint16*)(data + 8*j + 0); - unsigned int amount = *(uint16*)(data + 8*j + 2); - unsigned int value = *(uint32*)(data + 8*j + 4); + short index = *(uint16*)(data + 8*j + 0); + short amount = *(uint16*)(data + 8*j + 2); + unsigned int value = *(uint32*)(data + 8*j + 4); index -= 2; // offset adjustment (client says that the first cart position is 2) |