summaryrefslogtreecommitdiff
path: root/src/map/pc.c
diff options
context:
space:
mode:
authorskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-23 02:37:13 +0000
committerskotlex <skotlex@54d463be-8e91-2dee-dedb-b68131a5f0ec>2006-03-23 02:37:13 +0000
commita27e8d773044fbf2eca905c8fbdb73673eb4062c (patch)
treee02d9372347fff85f52cfc9616c6db7b01c8b28d /src/map/pc.c
parent0ffe3b7569390da9b2dfa5493b70d363dce2439c (diff)
downloadhercules-a27e8d773044fbf2eca905c8fbdb73673eb4062c.tar.gz
hercules-a27e8d773044fbf2eca905c8fbdb73673eb4062c.tar.bz2
hercules-a27e8d773044fbf2eca905c8fbdb73673eb4062c.tar.xz
hercules-a27e8d773044fbf2eca905c8fbdb73673eb4062c.zip
- Some cleanup. Fixed function pc_isCardAllowedOn causing searches for non-existant item id 0.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@5709 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/pc.c')
-rw-r--r--src/map/pc.c29
1 files changed, 18 insertions, 11 deletions
diff --git a/src/map/pc.c b/src/map/pc.c
index 4a93dbea0..324b90c40 100644
--- a/src/map/pc.c
+++ b/src/map/pc.c
@@ -528,15 +528,22 @@ int pc_setequipindex(struct map_session_data *sd)
int pc_isAllowedCardOn(struct map_session_data *sd,int s,int eqindex,int flag) {
int i;
+ struct item *item = &sd->status.inventory[eqindex];
struct item_data *data;
- if (s>0) {
- for (i=0;i<s;i++) {
- if ((data = itemdb_search(sd->status.inventory[eqindex].card[i]))) {
- if (data->flag.no_equip&flag)
- return 0;
- }
- }
- }
+ if ( //Crafted/made/hatched items.
+ item->card[0]==0x00ff ||
+ item->card[0]==0x00fe ||
+ item->card[0]==(short)0xff00
+ )
+ return 1;
+
+ for (i=0;i<s;i++) {
+ if (item->card[i] &&
+ (data = itemdb_exists(item->card[i])) &&
+ data->flag.no_equip&flag
+ )
+ return 0;
+ }
return 1;
}
@@ -2931,7 +2938,7 @@ int pc_steal_item(struct map_session_data *sd,struct block_list *bl)
if(md->db->dropitem[i].p<=battle_config.rare_drop_announce) {
struct item_data *i_data;
char message[128];
- i_data = itemdb_exists(itemid);
+ i_data = itemdb_search(itemid);
sprintf (message, msg_txt(542), (sd->status.name != NULL)?sd->status.name :"GM", md->db->jname, i_data->jname, (float)md->db->dropitem[i].p/100);
//MSG: "'%s' stole %s's %s (chance: %%%0.02f)"
intif_GMmessage(message,strlen(message)+1,0);
@@ -6466,12 +6473,12 @@ int pc_checkitem(struct map_session_data *sd)
}
//?備制限チェック
if(sd->status.inventory[i].equip && (map[sd->bl.m].flag.pvp||map[sd->bl.m].flag.gvg) &&
- (it->flag.no_equip&1 || !pc_isAllowedCardOn(sd,it->slot,i,1)))
+ (it->flag.no_equip&1 || !pc_isAllowedCardOn(sd,it->slot,i,1)))
{ //PVP check for forbiden items. optimized by [Lupus]
sd->status.inventory[i].equip=0;
calc_flag = 1;
} else if(sd->status.inventory[i].equip && map_flag_gvg(sd->bl.m) &&
- (it->flag.no_equip&2 || !pc_isAllowedCardOn(sd,it->slot,i,2)))
+ (it->flag.no_equip&2 || !pc_isAllowedCardOn(sd,it->slot,i,2)))
{ //GvG optimized by [Lupus]
sd->status.inventory[i].equip=0;
calc_flag = 1;