[10857] Complete set Byte/ShortFlag value functions and use it for PLAYER_FIELD_BYTES proper access.

Not expected any changes in work.
This commit is contained in:
VladimirMangos 2010-12-11 13:55:47 +03:00
parent a0e0630c81
commit a2e74f182f
5 changed files with 53 additions and 17 deletions

View file

@ -222,15 +222,20 @@ class MANGOS_DLL_SPEC Object
return (m_uint32Values[ index ] & flag) != 0;
}
void ApplyModFlag( uint16 index, uint32 flag, bool apply)
{
if (apply)
SetFlag(index, flag);
else
RemoveFlag(index, flag);
}
void SetByteFlag( uint16 index, uint8 offset, uint8 newFlag );
void RemoveByteFlag( uint16 index, uint8 offset, uint8 newFlag );
void SetShortFlag(uint16 index, bool highpart, uint16 newFlag);
void RemoveShortFlag(uint16 index, bool highpart, uint16 oldFlag);
void ToggleFlag( uint16 index, uint8 offset, uint8 flag )
void ToggleByteFlag( uint16 index, uint8 offset, uint8 flag )
{
if(HasByteFlag(index, offset, flag))
if (HasByteFlag(index, offset, flag))
RemoveByteFlag(index, offset, flag);
else
SetByteFlag(index, offset, flag);
@ -243,9 +248,37 @@ class MANGOS_DLL_SPEC Object
return (((uint8*)&m_uint32Values[index])[offset] & flag) != 0;
}
void ApplyModFlag( uint16 index, uint32 flag, bool apply)
void ApplyModByteFlag( uint16 index, uint8 offset, uint32 flag, bool apply)
{
if(apply) SetFlag(index,flag); else RemoveFlag(index,flag);
if (apply)
SetByteFlag(index, offset, flag);
else
RemoveByteFlag(index, offset, flag);
}
void SetShortFlag(uint16 index, bool highpart, uint16 newFlag);
void RemoveShortFlag(uint16 index, bool highpart, uint16 oldFlag);
void ToggleShortFlag( uint16 index, bool highpart, uint8 flag )
{
if (HasShortFlag(index, highpart, flag))
RemoveShortFlag(index, highpart, flag);
else
SetShortFlag(index, highpart, flag);
}
bool HasShortFlag( uint16 index, bool highpart, uint8 flag ) const
{
MANGOS_ASSERT( index < m_valuesCount || PrintIndexError( index , false ) );
return (((uint16*)&m_uint32Values[index])[highpart ? 1 : 0] & flag) != 0;
}
void ApplyModShortFlag( uint16 index, bool highpart, uint32 flag, bool apply)
{
if (apply)
SetShortFlag(index, highpart, flag);
else
RemoveShortFlag(index, highpart, flag);
}
void SetFlag64( uint16 index, uint64 newFlag )
@ -264,7 +297,7 @@ class MANGOS_DLL_SPEC Object
void ToggleFlag64( uint16 index, uint64 flag)
{
if(HasFlag64(index, flag))
if (HasFlag64(index, flag))
RemoveFlag64(index, flag);
else
SetFlag64(index, flag);
@ -278,7 +311,10 @@ class MANGOS_DLL_SPEC Object
void ApplyModFlag64( uint16 index, uint64 flag, bool apply)
{
if(apply) SetFlag64(index,flag); else RemoveFlag64(index, flag);
if (apply)
SetFlag64(index, flag);
else
RemoveFlag64(index, flag);
}
void ClearUpdateMask(bool remove);

View file

@ -4543,7 +4543,7 @@ void Player::KillPlayer()
//SetFlag( UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_IN_PVP );
SetFlag(UNIT_DYNAMIC_FLAGS, 0x00);
ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_RELEASE_TIMER, !sMapStore.LookupEntry(GetMapId())->Instanceable());
ApplyModByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER, !sMapStore.LookupEntry(GetMapId())->Instanceable());
// 6 minutes until repop at graveyard
m_deathTimer = 6*MINUTE*IN_MILLISECONDS;
@ -15904,7 +15904,7 @@ void Player::LoadCorpse()
{
if(Corpse *corpse = GetCorpse())
{
ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_RELEASE_TIMER, corpse && !sMapStore.LookupEntry(corpse->GetMapId())->Instanceable() );
ApplyModByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_RELEASE_TIMER, corpse && !sMapStore.LookupEntry(corpse->GetMapId())->Instanceable() );
}
else
{

View file

@ -570,12 +570,12 @@ enum PlayerFlags
#define KNOWN_TITLES_SIZE 3
#define MAX_TITLE_INDEX (KNOWN_TITLES_SIZE*64) // 3 uint64 fields
// used in PLAYER_FIELD_BYTES values
// used in (PLAYER_FIELD_BYTES, 0) byte values
enum PlayerFieldByteFlags
{
PLAYER_FIELD_BYTE_TRACK_STEALTHED = 0x00000002,
PLAYER_FIELD_BYTE_RELEASE_TIMER = 0x00000008, // Display time till auto release spirit
PLAYER_FIELD_BYTE_NO_RELEASE_WINDOW = 0x00000010 // Display no "release spirit" window at all
PLAYER_FIELD_BYTE_TRACK_STEALTHED = 0x02,
PLAYER_FIELD_BYTE_RELEASE_TIMER = 0x08, // Display time till auto release spirit
PLAYER_FIELD_BYTE_NO_RELEASE_WINDOW = 0x10 // Display no "release spirit" window at all
};
// used in byte (PLAYER_FIELD_BYTES2,3) values

View file

@ -3438,7 +3438,7 @@ void Aura::HandleAuraTrackStealthed(bool apply, bool /*Real*/)
if(apply)
GetTarget()->RemoveNoStackAurasDueToAuraHolder(GetHolder());
GetTarget()->ApplyModFlag(PLAYER_FIELD_BYTES, PLAYER_FIELD_BYTE_TRACK_STEALTHED, apply);
GetTarget()->ApplyModByteFlag(PLAYER_FIELD_BYTES, 0, PLAYER_FIELD_BYTE_TRACK_STEALTHED, apply);
}
void Aura::HandleAuraModScale(bool apply, bool /*Real*/)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__
#define __REVISION_NR_H__
#define REVISION_NR "10856"
#define REVISION_NR "10857"
#endif // __REVISION_NR_H__