diff options
author | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-10-18 08:04:53 +0000 |
---|---|---|
committer | ultramage <ultramage@54d463be-8e91-2dee-dedb-b68131a5f0ec> | 2007-10-18 08:04:53 +0000 |
commit | e8d7a95f9416c67242db5e06fd1743c8f28b3b08 (patch) | |
tree | a31a379d1f2e3af7eede623407b4cc0a25b43383 /src/map/pc.c | |
parent | 5f6a6a2557a90573a504b541a3234f0dc566bf6a (diff) | |
download | hercules-e8d7a95f9416c67242db5e06fd1743c8f28b3b08.tar.gz hercules-e8d7a95f9416c67242db5e06fd1743c8f28b3b08.tar.bz2 hercules-e8d7a95f9416c67242db5e06fd1743c8f28b3b08.tar.xz hercules-e8d7a95f9416c67242db5e06fd1743c8f28b3b08.zip |
Some code cleaning...
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@11505 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r-- | src/map/pc.c | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/src/map/pc.c b/src/map/pc.c index 99cde53d5..d259bc6e0 100644 --- a/src/map/pc.c +++ b/src/map/pc.c @@ -2761,16 +2761,10 @@ int pc_getzeny(struct map_session_data *sd,int zeny) int pc_search_inventory(struct map_session_data *sd,int item_id) { int i; - nullpo_retr(-1, sd); - for(i=0;i<MAX_INVENTORY;i++) { - if(sd->status.inventory[i].nameid == item_id && - (sd->status.inventory[i].amount > 0 || item_id == 0)) - return i; - } - - return -1; + ARR_FIND( 0, MAX_INVENTORY, i, sd->status.inventory[i].nameid == item_id && (sd->status.inventory[i].amount > 0 || item_id == 0) ); + return ( i < MAX_INVENTORY ) ? i : -1; } /*========================================== @@ -3660,7 +3654,7 @@ int pc_checkallowskill(struct map_session_data *sd) if(!sd->sc.count) return 0; - for (i = 0; i < sizeof(scw_list)/sizeof(scw_list[0]); i++) + for (i = 0; i < ARRAYLENGTH(scw_list); i++) { // Skills requiring specific weapon types if(sd->sc.data[scw_list[i]].timer!=-1 && !pc_check_weapontype(sd,skill_get_weapontype(StatusSkillChangeTable[scw_list[i]]))) @@ -3672,7 +3666,7 @@ int pc_checkallowskill(struct map_session_data *sd) status_change_end(&sd->bl,SC_SPURT,-1); if(sd->status.shield <= 0) { // Skills requiring a shield - for (i = 0; i < sizeof(scs_list)/sizeof(scs_list[0]); i++) + for (i = 0; i < ARRAYLENGTH(scs_list); i++) if(sd->sc.data[scs_list[i]].timer!=-1) status_change_end(&sd->bl,scs_list[i],-1); } |