Permalink
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...
1 parent a519e27 commit 701cb008ec5bf273161c172492c174d138d5643b @fizzet fizzet committed Jul 3, 2013
Showing with 5 additions and 3 deletions.
  1. +3 −2 gemrb/core/Scriptable/Actor.cpp
  2. +1 −0 gemrb/core/Scriptable/Actor.h
  3. +1 −1 gemrb/plugins/GUIScript/GUIScript.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);
@@ -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
@@ -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;

0 comments on commit 701cb00

Please sign in to comment.