Skip to content

Commit

Permalink
[10374] Fixes for EFLAG_RANDOM_ACTION
Browse files Browse the repository at this point in the history
* Field limited to uint8 so use proper flag mask (0x20 now)
* Search of selected action code also fixed.
  • Loading branch information
VladimirMangos committed Aug 18, 2010
1 parent 93b39c3 commit 05734c8
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 14 deletions.
3 changes: 1 addition & 2 deletions doc/EventAI.txt
Expand Up @@ -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.

Expand Down
8 changes: 7 additions & 1 deletion src/game/CreatureEventAI.cpp
Expand Up @@ -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);
}
Expand Down
19 changes: 9 additions & 10 deletions src/game/CreatureEventAI.h
Expand Up @@ -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)
};

Expand Down
2 changes: 1 addition & 1 deletion 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__

0 comments on commit 05734c8

Please sign in to comment.