Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

special-case Identification items to not apply their effects

Because they're broken and the orignal engine hardcodes their use just
like we do.
  • Loading branch information...
commit 701cb008ec5bf273161c172492c174d138d5643b 1 parent a519e27
@fizzet fizzet authored
View
5 gemrb/core/Scriptable/Actor.cpp
@@ -8110,9 +8110,10 @@ bool Actor::UseItem(ieDword slot, ieDword header, Scriptable* target, ieDword fl
gamedata->FreeItem(itm,tmpresref, false);
ResetCommentTime();
if (pro) {
- //ieDword is unsigned!!
pro->SetCaster(GetGlobalID(), ITEM_CASTERLEVEL);
- if(((int)header < 0) && !(flags&UI_MISS)) { //using a weapon
+ if (flags & UI_FAKE) {
+ delete pro;
+ } else if (((int)header < 0) && !(flags&UI_MISS)) { //using a weapon
bool ranged = header == (ieDword)-2;
ITMExtHeader *which = itm->GetWeaponHeader(ranged);
Effect* AttackEffect = EffectQueue::CreateEffect(fx_damage_ref, damage, (weapon_damagetype[which->DamageType])<<16, FX_DURATION_INSTANT_LIMITED);
View
1  gemrb/core/Scriptable/Actor.h
@@ -170,6 +170,7 @@ namespace GemRB {
#define UI_SILENT 1 //no sound when used up
#define UI_MISS 2 //ranged miss (projectile has no effects)
#define UI_CRITICAL 4 //a critical hit happened
+#define UI_FAKE 8 //deplete the item but don't actually apply its effects
//used to mask off current profs
#define PROFS_MASK 0x07
View
2  gemrb/plugins/GUIScript/GUIScript.cpp
@@ -9746,7 +9746,7 @@ static PyObject* GemRB_HasSpecialItem(PyObject * /*self*/, PyObject* args)
if (useup) {
//use the found item's first usage
- useup = actor->UseItem((ieDword) slot, 0, actor, UI_SILENT);
+ useup = actor->UseItem((ieDword) slot, 0, actor, UI_SILENT|UI_FAKE);
} else {
CREItem *si = actor->inventory.GetSlotItem( slot );
if (si->Usages[0]) useup = 1;
Please sign in to comment.
Something went wrong with that request. Please try again.