[10374] Fixes for EFLAG_RANDOM_ACTION

* Field limited to uint8 so use proper flag mask (0x20 now)
* Search of selected action code also fixed.
This commit is contained in:
VladimirMangos 2010-08-19 00:06:58 +04:00
parent a15b0916b6
commit 80cef02190
4 changed files with 18 additions and 14 deletions

View file

@ -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.

View file

@ -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);
}

View file

@ -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)
};

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10373"
#define REVISION_NR "10374"
#endif // __REVISION_NR_H__