From: Alyssa M. <fu...@us...> - 2011-04-24 19:19:54
|
gemrb: Infinity Engine emulator The branch master has been updated via f16e2a24ea9b4f5072c38767aa96b99857a666da (commit) Summary of changes: gemrb/core/EffectQueue.cpp | 67 ++++++++++++++++++++++++++++--------------- 1 files changed, 43 insertions(+), 24 deletions(-) from 895092e83bda9d0cea2bfd8f27a68c8332e98451 (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email; so we list those revisions in full, below. - Log ----------------------------------------------------------------- http://gemrb.git.sourceforge.net/git/gitweb.cgi?p=gemrb/gemrb;a=commitdiff;h=f16e2a24ea9b4f5072c38767aa96b99857a666da commit f16e2a24ea9b4f5072c38767aa96b99857a666da Author: Alyssa Milburn <fu...@fu...> Date: Sun Apr 24 21:17:24 2011 +0200 fix EffectQueue::AddEffect to apply only copies of effects effects applied to multiple actors (e.g. the party) were being reused, leading to issues like cumulatively higher rolls this probably needs more testing/work/rewriting diff --git a/gemrb/core/EffectQueue.cpp b/gemrb/core/EffectQueue.cpp index db14855..4d8467a 100644 --- a/gemrb/core/EffectQueue.cpp +++ b/gemrb/core/EffectQueue.cpp @@ -484,6 +484,7 @@ int EffectQueue::AddEffect(Effect* fx, Scriptable* self, Actor* pretarget, const int flg; ieDword spec = 0; Actor *st = (self && (self->Type==ST_ACTOR)) ?(Actor *) self:NULL; + Effect* new_fx; switch (fx->Target) { case FX_TARGET_ORIGINAL: @@ -508,6 +509,7 @@ int EffectQueue::AddEffect(Effect* fx, Scriptable* self, Actor* pretarget, const break; case FX_TARGET_ALL_BUT_SELF: + new_fx = new Effect; map=self->GetCurrentArea(); i= map->GetActorCount(true); while(i--) { @@ -516,13 +518,15 @@ int EffectQueue::AddEffect(Effect* fx, Scriptable* self, Actor* pretarget, const if( st==actor) { continue; } - fx->SetPosition(actor->Pos); + memcpy( new_fx, fx, sizeof( Effect ) ); + new_fx->SetPosition(actor->Pos); - flg = ApplyEffect( actor, fx, 1 ); - if( fx->TimingMode != FX_DURATION_JUST_EXPIRED) { - actor->fxqueue.AddEffect( fx, flg==FX_INSERT ); + flg = ApplyEffect( actor, new_fx, 1 ); + if( new_fx->TimingMode != FX_DURATION_JUST_EXPIRED) { + actor->fxqueue.AddEffect( new_fx, flg==FX_INSERT ); } } + delete new_fx; flg = FX_APPLIED; break; @@ -533,6 +537,7 @@ int EffectQueue::AddEffect(Effect* fx, Scriptable* self, Actor* pretarget, const map = self->GetCurrentArea(); spec = st->GetStat(IE_SPECIFIC); + new_fx = new Effect; //GetActorCount(false) returns all nonparty critters i = map->GetActorCount(false); while(i--) { @@ -540,13 +545,15 @@ int EffectQueue::AddEffect(Effect* fx, Scriptable* self, Actor* pretarget, const if( actor->GetStat(IE_SPECIFIC)!=spec) { continue; } - fx->SetPosition(actor->Pos); + memcpy( new_fx, fx, sizeof( Effect ) ); + new_fx->SetPosition(actor->Pos); - flg = ApplyEffect( actor, fx, 1 ); - if( fx->TimingMode != FX_DURATION_JUST_EXPIRED) { - actor->fxqueue.AddEffect( fx, flg==FX_INSERT ); + flg = ApplyEffect( actor, new_fx, 1 ); + if( new_fx->TimingMode != FX_DURATION_JUST_EXPIRED) { + actor->fxqueue.AddEffect( new_fx, flg==FX_INSERT ); } } + delete new_fx; flg = FX_APPLIED; break; case FX_TARGET_OTHER_SIDE: @@ -556,6 +563,7 @@ int EffectQueue::AddEffect(Effect* fx, Scriptable* self, Actor* pretarget, const map = self->GetCurrentArea(); spec = pretarget->GetStat(IE_SPECIFIC); + new_fx = new Effect; //GetActorCount(false) returns all nonparty critters i = map->GetActorCount(false); while(i--) { @@ -563,14 +571,16 @@ int EffectQueue::AddEffect(Effect* fx, Scriptable* self, Actor* pretarget, const if( actor->GetStat(IE_SPECIFIC)!=spec) { continue; } - fx->SetPosition(actor->Pos); + memcpy( new_fx, fx, sizeof( Effect ) ); + new_fx->SetPosition(actor->Pos); - flg = ApplyEffect( actor, fx, 1 ); + flg = ApplyEffect( actor, new_fx, 1 ); //GetActorCount can now return all nonparty critters - if( fx->TimingMode != FX_DURATION_JUST_EXPIRED) { - actor->fxqueue.AddEffect( fx, flg==FX_INSERT ); + if( new_fx->TimingMode != FX_DURATION_JUST_EXPIRED) { + actor->fxqueue.AddEffect( new_fx, flg==FX_INSERT ); } } + delete new_fx; flg = FX_APPLIED; break; case FX_TARGET_PRESET: @@ -586,48 +596,57 @@ int EffectQueue::AddEffect(Effect* fx, Scriptable* self, Actor* pretarget, const case FX_TARGET_PARTY: all_party: + new_fx = new Effect; game = core->GetGame(); i = game->GetPartySize(false); while(i--) { Actor* actor = game->GetPC( i, false ); - fx->SetPosition(actor->Pos); + memcpy( new_fx, fx, sizeof( Effect ) ); + new_fx->SetPosition(actor->Pos); - flg = ApplyEffect( actor, fx, 1 ); - if( fx->TimingMode != FX_DURATION_JUST_EXPIRED) { - actor->fxqueue.AddEffect( fx, flg==FX_INSERT ); + flg = ApplyEffect( actor, new_fx, 1 ); + if( new_fx->TimingMode != FX_DURATION_JUST_EXPIRED) { + actor->fxqueue.AddEffect( new_fx, flg==FX_INSERT ); } } + delete new_fx; flg = FX_APPLIED; break; case FX_TARGET_ALL: + new_fx = new Effect; map = self->GetCurrentArea(); i = map->GetActorCount(true); while(i--) { Actor* actor = map->GetActor( i, true ); - fx->SetPosition(actor->Pos); + memcpy( new_fx, fx, sizeof( Effect ) ); + new_fx->SetPosition(actor->Pos); - flg = ApplyEffect( actor, fx, 1 ); - if( fx->TimingMode != FX_DURATION_JUST_EXPIRED) { - actor->fxqueue.AddEffect( fx, flg==FX_INSERT ); + flg = ApplyEffect( actor, new_fx, 1 ); + if( new_fx->TimingMode != FX_DURATION_JUST_EXPIRED) { + actor->fxqueue.AddEffect( new_fx, flg==FX_INSERT ); } } + delete new_fx; flg = FX_APPLIED; break; case FX_TARGET_ALL_BUT_PARTY: + new_fx = new Effect; map = self->GetCurrentArea(); i = map->GetActorCount(false); while(i--) { Actor* actor = map->GetActor( i, false ); - fx->SetPosition(actor->Pos); + memcpy( new_fx, fx, sizeof( Effect ) ); + new_fx->SetPosition(actor->Pos); - flg = ApplyEffect( actor, fx, 1 ); + flg = ApplyEffect( actor, new_fx, 1 ); //GetActorCount can now return all nonparty critters - if( fx->TimingMode != FX_DURATION_JUST_EXPIRED) { - actor->fxqueue.AddEffect( fx, flg==FX_INSERT ); + if( new_fx->TimingMode != FX_DURATION_JUST_EXPIRED) { + actor->fxqueue.AddEffect( new_fx, flg==FX_INSERT ); } } + delete new_fx; flg = FX_APPLIED; break; ----------------------------------------------------------------------- This is an automated email from the git hooks/post-receive script. -- gemrb: Infinity Engine emulator |