mirror of
https://github.com/mangosfour/server.git
synced 2025-12-19 22:37:05 +00:00
[11585] Add countof macro
It can be used to calculate number of elements in static array. Do not use with pointers!
This commit is contained in:
parent
3788348b46
commit
4c81559800
3 changed files with 9 additions and 5 deletions
|
|
@ -769,14 +769,14 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura
|
|||
case CLASS_DRUID: // 39511,40997,40998,40999,41002,41005,41009,41011,41409
|
||||
{
|
||||
uint32 RandomSpell[]={39511,40997,40998,40999,41002,41005,41009,41011,41409};
|
||||
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
|
||||
triggered_spell_id = RandomSpell[urand(0, countof(RandomSpell)-1)];
|
||||
break;
|
||||
}
|
||||
case CLASS_ROGUE: // 39511,40997,40998,41002,41005,41011
|
||||
case CLASS_WARRIOR: // 39511,40997,40998,41002,41005,41011
|
||||
{
|
||||
uint32 RandomSpell[]={39511,40997,40998,41002,41005,41011};
|
||||
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
|
||||
triggered_spell_id = RandomSpell[urand(0, countof(RandomSpell)-1)];
|
||||
break;
|
||||
}
|
||||
case CLASS_PRIEST: // 40999,41002,41005,41009,41011,41406,41409
|
||||
|
|
@ -785,13 +785,13 @@ SpellAuraProcResult Unit::HandleDummyAuraProc(Unit *pVictim, uint32 damage, Aura
|
|||
case CLASS_WARLOCK: // 40999,41002,41005,41009,41011,41406,41409
|
||||
{
|
||||
uint32 RandomSpell[]={40999,41002,41005,41009,41011,41406,41409};
|
||||
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
|
||||
triggered_spell_id = RandomSpell[urand(0, countof(RandomSpell)-1)];
|
||||
break;
|
||||
}
|
||||
case CLASS_HUNTER: // 40997,40999,41002,41005,41009,41011,41406,41409
|
||||
{
|
||||
uint32 RandomSpell[]={40997,40999,41002,41005,41009,41011,41406,41409};
|
||||
triggered_spell_id = RandomSpell[ irand(0, sizeof(RandomSpell)/sizeof(uint32) - 1) ];
|
||||
triggered_spell_id = RandomSpell[urand(0, countof(RandomSpell)-1)];
|
||||
break;
|
||||
}
|
||||
default:
|
||||
|
|
|
|||
|
|
@ -250,4 +250,8 @@ inline char * mangos_strdup(const char * source)
|
|||
# define M_PI_F float(M_PI)
|
||||
#endif
|
||||
|
||||
#ifndef countof
|
||||
#define countof(array) (sizeof(array) / sizeof((array)[0]))
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
#ifndef __REVISION_NR_H__
|
||||
#define __REVISION_NR_H__
|
||||
#define REVISION_NR "11584"
|
||||
#define REVISION_NR "11585"
|
||||
#endif // __REVISION_NR_H__
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue