From 9cf756c11d39101b139ed585e4d5891768a20a45 Mon Sep 17 00:00:00 2001 From: shennetsind Date: Tue, 12 Jun 2012 01:08:05 +0000 Subject: 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 --- src/map/script.c | 23 ++++++++++------------- 1 file changed, 10 insertions(+), 13 deletions(-) (limited to 'src/map/script.c') 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; jequip_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; -- cgit v1.2.3-70-g09d2