Code style (game + scripts only):

"( " --> "("
" )" --> ")"

--HG--
branch : trunk
This commit is contained in:
Spp
2010-04-07 22:59:46 +02:00
parent d19e127080
commit 49d05ba9aa
176 changed files with 4789 additions and 4789 deletions
+65 -65
View File
@@ -121,7 +121,7 @@ typedef UNORDERED_MAP<Player*, UpdateData> UpdateDataMapType;
class Object
{
public:
virtual ~Object ( );
virtual ~Object ();
const bool IsInWorld() const { return m_inWorld; }
virtual void AddToWorld()
@@ -158,83 +158,83 @@ class Object
TypeID GetTypeId() const { return m_objectTypeId; }
bool isType(uint16 mask) const { return (mask & m_objectType); }
virtual void BuildCreateUpdateBlockForPlayer( UpdateData *data, Player *target ) const;
virtual void BuildCreateUpdateBlockForPlayer(UpdateData *data, Player *target) const;
void SendUpdateToPlayer(Player* player);
void BuildValuesUpdateBlockForPlayer( UpdateData *data, Player *target ) const;
void BuildOutOfRangeUpdateBlock( UpdateData *data ) const;
void BuildMovementUpdateBlock( UpdateData * data, uint32 flags = 0 ) const;
void BuildValuesUpdateBlockForPlayer(UpdateData *data, Player *target) const;
void BuildOutOfRangeUpdateBlock(UpdateData *data) const;
void BuildMovementUpdateBlock(UpdateData * data, uint32 flags = 0) const;
virtual void DestroyForPlayer( Player *target, bool anim = false ) const;
virtual void DestroyForPlayer(Player *target, bool anim = false) const;
const int32& GetInt32Value( uint16 index ) const
const int32& GetInt32Value(uint16 index) const
{
ASSERT( index < m_valuesCount || PrintIndexError( index , false) );
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
return m_int32Values[ index ];
}
const uint32& GetUInt32Value( uint16 index ) const
const uint32& GetUInt32Value(uint16 index) const
{
ASSERT( index < m_valuesCount || PrintIndexError( index , false) );
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
return m_uint32Values[ index ];
}
const uint64& GetUInt64Value( uint16 index ) const
const uint64& GetUInt64Value(uint16 index) const
{
ASSERT( index + 1 < m_valuesCount || PrintIndexError( index , false) );
ASSERT(index + 1 < m_valuesCount || PrintIndexError(index , false));
return *((uint64*)&(m_uint32Values[ index ]));
}
const float& GetFloatValue( uint16 index ) const
const float& GetFloatValue(uint16 index) const
{
ASSERT( index < m_valuesCount || PrintIndexError( index , false ) );
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
return m_floatValues[ index ];
}
uint8 GetByteValue( uint16 index, uint8 offset) const
uint8 GetByteValue(uint16 index, uint8 offset) const
{
ASSERT( index < m_valuesCount || PrintIndexError( index , false) );
ASSERT( offset < 4 );
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
ASSERT(offset < 4);
return *(((uint8*)&m_uint32Values[ index ])+offset);
}
uint16 GetUInt16Value( uint16 index, uint8 offset) const
uint16 GetUInt16Value(uint16 index, uint8 offset) const
{
ASSERT( index < m_valuesCount || PrintIndexError( index , false) );
ASSERT( offset < 2 );
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
ASSERT(offset < 2);
return *(((uint16*)&m_uint32Values[ index ])+offset);
}
void SetInt32Value( uint16 index, int32 value );
void SetUInt32Value( uint16 index, uint32 value );
void UpdateUInt32Value( uint16 index, uint32 value );
void SetUInt64Value( uint16 index, const uint64 &value );
void SetFloatValue( uint16 index, float value );
void SetByteValue( uint16 index, uint8 offset, uint8 value );
void SetUInt16Value( uint16 index, uint8 offset, uint16 value );
void SetInt16Value( uint16 index, uint8 offset, int16 value ) { SetUInt16Value(index,offset,(uint16)value); }
void SetStatFloatValue( uint16 index, float value);
void SetStatInt32Value( uint16 index, int32 value);
void SetInt32Value(uint16 index, int32 value);
void SetUInt32Value(uint16 index, uint32 value);
void UpdateUInt32Value(uint16 index, uint32 value);
void SetUInt64Value(uint16 index, const uint64 &value);
void SetFloatValue(uint16 index, float value);
void SetByteValue(uint16 index, uint8 offset, uint8 value);
void SetUInt16Value(uint16 index, uint8 offset, uint16 value);
void SetInt16Value(uint16 index, uint8 offset, int16 value) { SetUInt16Value(index,offset,(uint16)value); }
void SetStatFloatValue(uint16 index, float value);
void SetStatInt32Value(uint16 index, int32 value);
bool AddUInt64Value( uint16 index, const uint64 &value );
bool RemoveUInt64Value( uint16 index, const uint64 &value );
bool AddUInt64Value(uint16 index, const uint64 &value);
bool RemoveUInt64Value(uint16 index, const uint64 &value);
void ApplyModUInt32Value(uint16 index, int32 val, bool apply);
void ApplyModInt32Value(uint16 index, int32 val, bool apply);
void ApplyModUInt64Value(uint16 index, int32 val, bool apply);
void ApplyModPositiveFloatValue( uint16 index, float val, bool apply);
void ApplyModSignedFloatValue( uint16 index, float val, bool apply);
void ApplyModPositiveFloatValue(uint16 index, float val, bool apply);
void ApplyModSignedFloatValue(uint16 index, float val, bool apply);
void ApplyPercentModFloatValue(uint16 index, float val, bool apply)
{
val = val != -100.0f ? val : -99.9f ;
SetFloatValue(index, GetFloatValue(index) * (apply?(100.0f+val)/100.0f : 100.0f / (100.0f+val)) );
SetFloatValue(index, GetFloatValue(index) * (apply?(100.0f+val)/100.0f : 100.0f / (100.0f+val)));
}
void SetFlag( uint16 index, uint32 newFlag );
void RemoveFlag( uint16 index, uint32 oldFlag );
void SetFlag(uint16 index, uint32 newFlag);
void RemoveFlag(uint16 index, uint32 oldFlag);
void ToggleFlag( uint16 index, uint32 flag)
void ToggleFlag(uint16 index, uint32 flag)
{
if (HasFlag(index, flag))
RemoveFlag(index, flag);
@@ -242,16 +242,16 @@ class Object
SetFlag(index, flag);
}
bool HasFlag( uint16 index, uint32 flag ) const
bool HasFlag(uint16 index, uint32 flag) const
{
if ( index >= m_valuesCount && !PrintIndexError( index , false ) ) return false;
if (index >= m_valuesCount && !PrintIndexError(index , false)) return false;
return (m_uint32Values[ index ] & flag) != 0;
}
void SetByteFlag( uint16 index, uint8 offset, uint8 newFlag );
void RemoveByteFlag( uint16 index, uint8 offset, uint8 newFlag );
void SetByteFlag(uint16 index, uint8 offset, uint8 newFlag);
void RemoveByteFlag(uint16 index, uint8 offset, uint8 newFlag);
void ToggleFlag( uint16 index, uint8 offset, uint8 flag )
void ToggleFlag(uint16 index, uint8 offset, uint8 flag)
{
if (HasByteFlag(index, offset, flag))
RemoveByteFlag(index, offset, flag);
@@ -259,33 +259,33 @@ class Object
SetByteFlag(index, offset, flag);
}
bool HasByteFlag( uint16 index, uint8 offset, uint8 flag ) const
bool HasByteFlag(uint16 index, uint8 offset, uint8 flag) const
{
ASSERT( index < m_valuesCount || PrintIndexError( index , false ) );
ASSERT( offset < 4 );
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
ASSERT(offset < 4);
return (((uint8*)&m_uint32Values[index])[offset] & flag) != 0;
}
void ApplyModFlag( uint16 index, uint32 flag, bool apply)
void ApplyModFlag(uint16 index, uint32 flag, bool apply)
{
if (apply) SetFlag(index,flag); else RemoveFlag(index,flag);
}
void SetFlag64( uint16 index, uint64 newFlag )
void SetFlag64(uint16 index, uint64 newFlag)
{
uint64 oldval = GetUInt64Value(index);
uint64 newval = oldval | newFlag;
SetUInt64Value(index,newval);
}
void RemoveFlag64( uint16 index, uint64 oldFlag )
void RemoveFlag64(uint16 index, uint64 oldFlag)
{
uint64 oldval = GetUInt64Value(index);
uint64 newval = oldval & ~oldFlag;
SetUInt64Value(index,newval);
}
void ToggleFlag64( uint16 index, uint64 flag)
void ToggleFlag64(uint16 index, uint64 flag)
{
if (HasFlag64(index, flag))
RemoveFlag64(index, flag);
@@ -293,13 +293,13 @@ class Object
SetFlag64(index, flag);
}
bool HasFlag64( uint16 index, uint64 flag ) const
bool HasFlag64(uint16 index, uint64 flag) const
{
ASSERT( index < m_valuesCount || PrintIndexError( index , false ) );
return (GetUInt64Value( index ) & flag) != 0;
ASSERT(index < m_valuesCount || PrintIndexError(index , false));
return (GetUInt64Value(index) & flag) != 0;
}
void ApplyModFlag64( uint16 index, uint64 flag, bool apply)
void ApplyModFlag64(uint16 index, uint64 flag, bool apply)
{
if (apply) SetFlag64(index,flag); else RemoveFlag64(index,flag);
}
@@ -312,7 +312,7 @@ class Object
virtual bool hasQuest(uint32 /* quest_id */) const { return false; }
virtual bool hasInvolvedQuest(uint32 /* quest_id */) const { return false; }
virtual void BuildUpdate(UpdateDataMapType& ) {}
virtual void BuildUpdate(UpdateDataMapType&) {}
void BuildFieldsUpdate(Player *, UpdateDataMapType &) const;
// FG: some hacky helpers
@@ -325,7 +325,7 @@ class Object
protected:
Object ( );
Object ();
void _InitValues();
void _Create (uint32 guidlow, uint32 entry, HighGuid guidhigh);
@@ -334,7 +334,7 @@ class Object
virtual void _SetCreateBits(UpdateMask *updateMask, Player *target) const;
void _BuildMovementUpdate(ByteBuffer * data, uint16 flags) const;
void _BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, UpdateMask *updateMask, Player *target ) const;
void _BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, UpdateMask *updateMask, Player *target) const;
uint16 m_objectType;
@@ -470,12 +470,12 @@ class WorldObject : public Object, public WorldLocation
public:
virtual ~WorldObject();
virtual void Update ( uint32 /*time_diff*/ ) { }
virtual void Update (uint32 /*time_diff*/) { }
void _Create( uint32 guidlow, HighGuid guidhigh, uint32 phaseMask);
void _Create(uint32 guidlow, HighGuid guidhigh, uint32 phaseMask);
void GetNearPoint2D( float &x, float &y, float distance, float absAngle) const;
void GetNearPoint( WorldObject const* searcher, float &x, float &y, float &z, float searcher_size, float distance2d,float absAngle) const;
void GetNearPoint2D(float &x, float &y, float distance, float absAngle) const;
void GetNearPoint(WorldObject const* searcher, float &x, float &y, float &z, float searcher_size, float distance2d,float absAngle) const;
void GetClosePoint(float &x, float &y, float &z, float size, float distance2d = 0, float angle = 0) const
{
// angle calculated from current orientation
@@ -493,15 +493,15 @@ class WorldObject : public Object, public WorldLocation
MovePosition(pos, radius * rand_norm(), rand_norm() * 2 * M_PI);
}
void GetContactPoint( const WorldObject* obj, float &x, float &y, float &z, float distance2d = CONTACT_DISTANCE) const
void GetContactPoint(const WorldObject* obj, float &x, float &y, float &z, float distance2d = CONTACT_DISTANCE) const
{
// angle to face `obj` to `this` using distance includes size of `obj`
GetNearPoint(obj,x,y,z,obj->GetObjectSize(),distance2d,GetAngle( obj ));
GetNearPoint(obj,x,y,z,obj->GetObjectSize(),distance2d,GetAngle(obj));
}
float GetObjectSize() const
{
return ( m_valuesCount > UNIT_FIELD_COMBATREACH ) ? m_floatValues[UNIT_FIELD_COMBATREACH] : DEFAULT_WORLD_OBJECT_SIZE;
return (m_valuesCount > UNIT_FIELD_COMBATREACH) ? m_floatValues[UNIT_FIELD_COMBATREACH] : DEFAULT_WORLD_OBJECT_SIZE;
}
void UpdateGroundPositionZ(float x, float y, float &z) const;
@@ -662,7 +662,7 @@ class WorldObject : public Object, public WorldLocation
void DestroyForNearbyPlayers();
virtual void UpdateObjectVisibility(bool forced = true);
void BuildUpdate(UpdateDataMapType& );
void BuildUpdate(UpdateDataMapType&);
//relocation and visibility system functions
void AddToNotify(uint16 f) { m_notifyflags |= f;}