summaryrefslogtreecommitdiff
path: root/src/map/script.c
diff options
context:
space:
mode:
authorshennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-06-12 01:08:05 +0000
committershennetsind <shennetsind@54d463be-8e91-2dee-dedb-b68131a5f0ec>2012-06-12 01:08:05 +0000
commit9cf756c11d39101b139ed585e4d5891768a20a45 (patch)
tree2814272466940688dd18245a689fe4a9c7438eae /src/map/script.c
parent49586af4b75b96010380576fe9ce0a9b67a83ac2 (diff)
downloadhercules-9cf756c11d39101b139ed585e4d5891768a20a45.tar.gz
hercules-9cf756c11d39101b139ed585e4d5891768a20a45.tar.bz2
hercules-9cf756c11d39101b139ed585e4d5891768a20a45.tar.xz
hercules-9cf756c11d39101b139ed585e4d5891768a20a45.zip
Improved bonus-adding processes by no longer having to add it to the zero'd memset bullshit, replaced it by moving the first set of bonus into its own struct and simply zeroing the struct prior to recalc.
git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@16272 54d463be-8e91-2dee-dedb-b68131a5f0ec
Diffstat (limited to 'src/map/script.c')
-rw-r--r--src/map/script.c23
1 files changed, 10 insertions, 13 deletions
diff --git a/src/map/script.c b/src/map/script.c
index 7c7250617..5bd55e106 100644
--- a/src/map/script.c
+++ b/src/map/script.c
@@ -12611,16 +12611,14 @@ BUILDIN_FUNC(isequipped)
return 0;
}
- setitem_hash = sd->setitem_hash;
- setitem_hash2 = sd->setitem_hash2;
- for (i=0; id!=0; i++)
- {
+ setitem_hash = sd->bonus.setitem_hash;
+ setitem_hash2 = sd->bonus.setitem_hash2;
+ for (i=0; id!=0; i++) {
FETCH (i+2, id) else id = 0;
if (id <= 0)
continue;
flag = 0;
- for (j=0; j<EQI_MAX; j++)
- {
+ for (j=0; j<EQI_MAX; j++) {
index = sd->equip_index[j];
if(index < 0) continue;
if(j == EQI_HAND_R && sd->equip_index[EQI_HAND_L] == index) continue;
@@ -12648,16 +12646,16 @@ BUILDIN_FUNC(isequipped)
hash = 1<<((j<5?j:j-5)*4 + k);
// check if card is already used by another set
- if ((j<5?sd->setitem_hash:sd->setitem_hash2) & hash)
+ if ( ( j < 5 ? sd->bonus.setitem_hash : sd->bonus.setitem_hash2 ) & hash)
continue;
// We have found a match
flag = 1;
// Set hash so this card cannot be used by another
if (j<5)
- sd->setitem_hash |= hash;
+ sd->bonus.setitem_hash |= hash;
else
- sd->setitem_hash2 |= hash;
+ sd->bonus.setitem_hash2 |= hash;
break;
}
}
@@ -12669,10 +12667,9 @@ BUILDIN_FUNC(isequipped)
ret &= flag;
if (!ret) break;
}
- if (!ret)
- { //When check fails, restore original hash values. [Skotlex]
- sd->setitem_hash = setitem_hash;
- sd->setitem_hash2 = setitem_hash2;
+ if (!ret) {//When check fails, restore original hash values. [Skotlex]
+ sd->bonus.setitem_hash = setitem_hash;
+ sd->bonus.setitem_hash2 = setitem_hash2;
}
script_pushint(st,ret);
return 0;