refactor(Core/Game): restyle game lib with astyle (#3466)

This commit is contained in:
Kargatum
2020-10-12 15:08:15 +07:00
committed by GitHub
parent e99b526e17
commit a2b26272d2
338 changed files with 52196 additions and 50944 deletions

View File

@@ -22,7 +22,7 @@
#include "BattlefieldWG.h"
Vehicle::Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry) :
_me(unit), _vehicleInfo(vehInfo), _usableSeatNum(0), _creatureEntry(creatureEntry), _status(STATUS_NONE)
_me(unit), _vehicleInfo(vehInfo), _usableSeatNum(0), _creatureEntry(creatureEntry), _status(STATUS_NONE)
{
for (uint32 i = 0; i < MAX_VEHICLE_SEATS; ++i)
{
@@ -58,7 +58,7 @@ Vehicle::~Vehicle()
else
sLog->outString("ZOMG! ~Vehicle(), unknown guid!");
}
//ASSERT(!itr->second.IsEmpty());
//ASSERT(!itr->second.IsEmpty());
}
void Vehicle::Install()
@@ -96,7 +96,7 @@ void Vehicle::Uninstall()
if (_status == STATUS_UNINSTALLING && !GetBase()->HasUnitTypeMask(UNIT_MASK_MINION))
{
sLog->outError("Vehicle GuidLow: %u, Entry: %u attempts to uninstall, but already has STATUS_UNINSTALLING! "
"Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(), _me->GetEntry());
"Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(), _me->GetEntry());
return;
}
_status = STATUS_UNINSTALLING;
@@ -264,7 +264,7 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 typ
if (_status == STATUS_UNINSTALLING)
{
sLog->outError("Vehicle GuidLow: %u, Entry: %u attempts to install accessory Entry: %u on seat %d with STATUS_UNINSTALLING! "
"Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(), _me->GetEntry(), entry, (int32)seatId);
"Check Uninstall/PassengerBoarded script hooks for errors.", _me->GetGUIDLow(), _me->GetEntry(), entry, (int32)seatId);
return;
}
@@ -351,7 +351,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
seat->second.Passenger.Guid = unit->GetGUID();
seat->second.Passenger.IsUnselectable = unit->HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
if (seat->second.SeatInfo->CanEnterOrExit())
{
ASSERT(_usableSeatNum);
@@ -384,13 +384,13 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
// xinef: removed retarded seat->first == 0 check...
if (_me->GetTypeId() == TYPEID_UNIT
&& unit->GetTypeId() == TYPEID_PLAYER
&& seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
&& unit->GetTypeId() == TYPEID_PLAYER
&& seat->second.SeatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
{
try
{
if (!_me->SetCharmedBy(unit, CHARM_TYPE_VEHICLE))
ABORT();
if (!_me->SetCharmedBy(unit, CHARM_TYPE_VEHICLE))
ABORT();
}
catch (...)
{
@@ -411,7 +411,7 @@ bool Vehicle::AddPassenger(Unit* unit, int8 seatId)
{
unit->SendClearTarget(); // SMSG_BREAK_TARGET
unit->SetControlled(true, UNIT_STATE_ROOT); // SMSG_FORCE_ROOT - In some cases we send SMSG_SPLINE_MOVE_ROOT here (for creatures)
// also adds MOVEMENTFLAG_ROOT
// also adds MOVEMENTFLAG_ROOT
Movement::MoveSplineInit init(unit);
init.DisableTransportPathTransformations();
init.MoveTo(veSeat->m_attachmentOffsetX, veSeat->m_attachmentOffsetY, veSeat->m_attachmentOffsetZ);
@@ -549,7 +549,7 @@ void Vehicle::TeleportVehicle(float x, float y, float z, float ang)
{
_me->GetMap()->LoadGrid(x, y);
_me->NearTeleportTo(x, y, z, ang, true);
for (SeatMap::const_iterator itr = Seats.begin(); itr != Seats.end(); ++itr)
if (Unit* passenger = ObjectAccessor::GetUnit(*GetBase(), itr->second.Passenger.Guid))
{

View File

@@ -17,74 +17,74 @@ class Unit;
class Vehicle : public TransportBase
{
public:
void Install();
void Uninstall();
void Reset(bool evading = false);
void InstallAllAccessories(bool evading);
void ApplyAllImmunities();
void InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 type, uint32 summonTime); //! May be called from scripts
public:
void Install();
void Uninstall();
void Reset(bool evading = false);
void InstallAllAccessories(bool evading);
void ApplyAllImmunities();
void InstallAccessory(uint32 entry, int8 seatId, bool minion, uint8 type, uint32 summonTime); //! May be called from scripts
Unit* GetBase() const { return _me; }
VehicleEntry const* GetVehicleInfo() const { return _vehicleInfo; }
uint32 GetCreatureEntry() const { return _creatureEntry; }
Unit* GetBase() const { return _me; }
VehicleEntry const* GetVehicleInfo() const { return _vehicleInfo; }
uint32 GetCreatureEntry() const { return _creatureEntry; }
bool HasEmptySeat(int8 seatId) const;
Unit* GetPassenger(int8 seatId) const;
int8 GetNextEmptySeat(int8 seatId, bool next) const;
uint8 GetAvailableSeatCount() const;
bool HasEmptySeat(int8 seatId) const;
Unit* GetPassenger(int8 seatId) const;
int8 GetNextEmptySeat(int8 seatId, bool next) const;
uint8 GetAvailableSeatCount() const;
bool AddPassenger(Unit* passenger, int8 seatId = -1);
void EjectPassenger(Unit* passenger, Unit* controller);
void RemovePassenger(Unit* passenger);
void RelocatePassengers();
void RemoveAllPassengers();
void Dismiss();
bool IsVehicleInUse();
void TeleportVehicle(float x, float y, float z, float ang);
bool AddPassenger(Unit* passenger, int8 seatId = -1);
void EjectPassenger(Unit* passenger, Unit* controller);
void RemovePassenger(Unit* passenger);
void RelocatePassengers();
void RemoveAllPassengers();
void Dismiss();
bool IsVehicleInUse();
void TeleportVehicle(float x, float y, float z, float ang);
SeatMap Seats;
SeatMap Seats;
VehicleSeatEntry const* GetSeatForPassenger(Unit const* passenger);
SeatMap::iterator GetSeatIteratorForPassenger(Unit* passenger);
VehicleSeatEntry const* GetSeatForPassenger(Unit const* passenger);
SeatMap::iterator GetSeatIteratorForPassenger(Unit* passenger);
protected:
friend bool Unit::CreateVehicleKit(uint32 id, uint32 creatureEntry);
Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry);
friend void Unit::RemoveVehicleKit();
~Vehicle();
protected:
friend bool Unit::CreateVehicleKit(uint32 id, uint32 creatureEntry);
Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry);
friend void Unit::RemoveVehicleKit();
~Vehicle();
private:
enum Status
{
STATUS_NONE,
STATUS_INSTALLED,
STATUS_UNINSTALLING,
};
private:
enum Status
{
STATUS_NONE,
STATUS_INSTALLED,
STATUS_UNINSTALLING,
};
void InitMovementInfoForBase();
void InitMovementInfoForBase();
/// This method transforms supplied transport offsets into global coordinates
void CalculatePassengerPosition(float& x, float& y, float& z, float* o /*= NULL*/) const
{
TransportBase::CalculatePassengerPosition(x, y, z, o,
/// This method transforms supplied transport offsets into global coordinates
void CalculatePassengerPosition(float& x, float& y, float& z, float* o /*= NULL*/) const
{
TransportBase::CalculatePassengerPosition(x, y, z, o,
GetBase()->GetPositionX(), GetBase()->GetPositionY(),
GetBase()->GetPositionZ(), GetBase()->GetOrientation());
}
}
/// This method transforms supplied global coordinates into local offsets
void CalculatePassengerOffset(float& x, float& y, float& z, float* o /*= NULL*/) const
{
TransportBase::CalculatePassengerOffset(x, y, z, o,
GetBase()->GetPositionX(), GetBase()->GetPositionY(),
GetBase()->GetPositionZ(), GetBase()->GetOrientation());
}
/// This method transforms supplied global coordinates into local offsets
void CalculatePassengerOffset(float& x, float& y, float& z, float* o /*= NULL*/) const
{
TransportBase::CalculatePassengerOffset(x, y, z, o,
GetBase()->GetPositionX(), GetBase()->GetPositionY(),
GetBase()->GetPositionZ(), GetBase()->GetOrientation());
}
Unit* _me;
VehicleEntry const* _vehicleInfo;
uint32 _usableSeatNum; // Number of seats that match VehicleSeatEntry::UsableByPlayer, used for proper display flags
uint32 _creatureEntry; // Can be different than me->GetBase()->GetEntry() in case of players
Status _status;
Unit* _me;
VehicleEntry const* _vehicleInfo;
uint32 _usableSeatNum; // Number of seats that match VehicleSeatEntry::UsableByPlayer, used for proper display flags
uint32 _creatureEntry; // Can be different than me->GetBase()->GetEntry() in case of players
Status _status;
};
#endif