From 81ce54685bce8305f2a4015754203b6bfa1c6e35 Mon Sep 17 00:00:00 2001 From: aleos89 Date: Thu, 3 Oct 2019 11:01:07 -0400 Subject: [PATCH] Adjusted script command isequipped * Fixes #4366. * Script command isequipped will no longer store the hashed card search onto the player. Thanks to @sader1992! --- src/map/pc.hpp | 1 - src/map/script.cpp | 14 ++++---------- 2 files changed, 4 insertions(+), 11 deletions(-) diff --git a/src/map/pc.hpp b/src/map/pc.hpp index bd1408cfea..d59e7a7e5f 100644 --- a/src/map/pc.hpp +++ b/src/map/pc.hpp @@ -497,7 +497,6 @@ struct map_session_data { int speed_rate, speed_add_rate, aspd_add; int itemhealrate2; // [Epoque] Increase heal rate of all healing items. int shieldmdef;//royal guard's - unsigned int setitem_hash, setitem_hash2; //Split in 2 because shift operations only work on int ranges. [Skotlex] short splash_range, splash_add_range; short add_steal_rate; diff --git a/src/map/script.cpp b/src/map/script.cpp index f251477a98..b28a854b0f 100644 --- a/src/map/script.cpp +++ b/src/map/script.cpp @@ -15427,7 +15427,6 @@ BUILDIN_FUNC(isequipped) TBL_PC *sd; int i, id = 1; int ret = -1; - //Original hash to reverse it when full check fails. unsigned int setitem_hash = 0, setitem_hash2 = 0; if (!script_rid2sd(sd)) { //If the player is not attached it is a script error anyway... but better prevent the map server from crashing... @@ -15435,8 +15434,6 @@ BUILDIN_FUNC(isequipped) return SCRIPT_CMD_SUCCESS; } - setitem_hash = sd->bonus.setitem_hash; - setitem_hash2 = sd->bonus.setitem_hash2; for (i=0; id!=0; i++) { int flag = 0; short j; @@ -15472,16 +15469,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->bonus.setitem_hash : sd->bonus.setitem_hash2 ) & hash) + if ( ( j < 5 ? setitem_hash : 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->bonus.setitem_hash |= hash; + setitem_hash |= hash; else - sd->bonus.setitem_hash2 |= hash; + setitem_hash2 |= hash; break; } } @@ -15493,10 +15490,7 @@ BUILDIN_FUNC(isequipped) ret &= flag; if (!ret) break; } - 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 SCRIPT_CMD_SUCCESS; }