From 05734c8e0abcb6a8c90b9eb0c5f3b8cf70f550e5 Mon Sep 17 00:00:00 2001 From: VladimirMangos Date: Thu, 19 Aug 2010 00:06:58 +0400 Subject: [PATCH] [10374] Fixes for EFLAG_RANDOM_ACTION * Field limited to uint8 so use proper flag mask (0x20 now) * Search of selected action code also fixed. --- doc/EventAI.txt | 3 +-- src/game/CreatureEventAI.cpp | 8 +++++++- src/game/CreatureEventAI.h | 19 +++++++++---------- src/shared/revision_nr.h | 2 +- 4 files changed, 18 insertions(+), 14 deletions(-) diff --git a/doc/EventAI.txt b/doc/EventAI.txt index 227e907875e..fd33bf39128 100644 --- a/doc/EventAI.txt +++ b/doc/EventAI.txt @@ -830,10 +830,9 @@ Below is the list of current Event Flags that EventAI can handle. Event flags ar 2 4 EFLAG_DIFFICULTY_1 Event occurs in instance difficulty 1 (will not occur if not set) 3 8 EFLAG_DIFFICULTY_2 Event occurs in instance difficulty 2 (will not occur if not set) 4 16 EFLAG_DIFFICULTY_3 Event occurs in instance difficulty 3 (will not occur if not set) -5 32 +8 32 EFLAG_RANDOM_ACTION At event occur execute one random action from event actions instead all actions. 6 64 7 128 EFLAG_DEBUG_ONLY Prevents events from occuring on Release builds. Useful for testing new features. -8 256 EFLAG_RANDOM_ACTION At event occur execute one random action from event actions instead all actions. NOTE: You can add the numbers in the decimal column to combine flags. diff --git a/src/game/CreatureEventAI.cpp b/src/game/CreatureEventAI.cpp index 4e29c309481..79b779c55bb 100644 --- a/src/game/CreatureEventAI.cpp +++ b/src/game/CreatureEventAI.cpp @@ -372,9 +372,15 @@ bool CreatureEventAI::ProcessEvent(CreatureEventAIHolder& pHolder, Unit* pAction // find selected action, skipping not used uint32 j = 0; - for (; idx; ++j) + for (; ; ++j) + { if (pHolder.Event.action[j].type != ACTION_T_NONE) + { + if (!idx) + break; --idx; + } + } ProcessAction(pHolder.Event.action[j], rnd, pHolder.Event.event_id, pActionInvoker); } diff --git a/src/game/CreatureEventAI.h b/src/game/CreatureEventAI.h index 7fe4a564263..0ebe53408d0 100644 --- a/src/game/CreatureEventAI.h +++ b/src/game/CreatureEventAI.h @@ -142,16 +142,15 @@ enum Target enum EventFlags { - EFLAG_REPEATABLE = 0x0001, //Event repeats - EFLAG_DIFFICULTY_0 = 0x0002, //Event only occurs in instance difficulty 0 - EFLAG_DIFFICULTY_1 = 0x0004, //Event only occurs in instance difficulty 1 - EFLAG_DIFFICULTY_2 = 0x0008, //Event only occurs in instance difficulty 2 - EFLAG_DIFFICULTY_3 = 0x0010, //Event only occurs in instance difficulty 3 - EFLAG_RESERVED_5 = 0x0020, - EFLAG_RESERVED_6 = 0x0040, - EFLAG_DEBUG_ONLY = 0x0080, //Event only occurs in debug build - EFLAG_RANDOM_ACTION = 0x0100, //Event only execute one from existed actions instead each action. - + EFLAG_REPEATABLE = 0x01, //Event repeats + EFLAG_DIFFICULTY_0 = 0x02, //Event only occurs in instance difficulty 0 + EFLAG_DIFFICULTY_1 = 0x04, //Event only occurs in instance difficulty 1 + EFLAG_DIFFICULTY_2 = 0x08, //Event only occurs in instance difficulty 2 + EFLAG_DIFFICULTY_3 = 0x10, //Event only occurs in instance difficulty 3 + EFLAG_RANDOM_ACTION = 0x20, //Event only execute one from existed actions instead each action. + EFLAG_RESERVED_6 = 0x40, + EFLAG_DEBUG_ONLY = 0x80, //Event only occurs in debug build + // no free bits, uint8 field EFLAG_DIFFICULTY_ALL = (EFLAG_DIFFICULTY_0|EFLAG_DIFFICULTY_1|EFLAG_DIFFICULTY_2|EFLAG_DIFFICULTY_3) }; diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 93699351be9..6edd7542c61 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "10373" + #define REVISION_NR "10374" #endif // __REVISION_NR_H__