mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-18 00:18:43 +01:00
Core/Vehicle: Some code-style cleanup.
--HG-- branch : trunk
This commit is contained in:
@@ -188,9 +188,9 @@ void Vehicle::RemoveAllPassengers()
|
||||
if (itr->second.passenger)
|
||||
{
|
||||
sLog.outCrash("Vehicle %u cannot remove passenger %u. %u is still on vehicle.", me->GetEntry(), passenger->GetEntry(), itr->second.passenger->GetEntry());
|
||||
//ASSERT(!itr->second.passenger);
|
||||
itr->second.passenger = NULL;
|
||||
}
|
||||
|
||||
// creature passengers mounted on player mounts should be despawned at dismount
|
||||
if (GetBase()->GetTypeId() == TYPEID_PLAYER && passenger->ToCreature())
|
||||
passenger->ToCreature()->ForcedDespawn();
|
||||
@@ -200,14 +200,16 @@ void Vehicle::RemoveAllPassengers()
|
||||
bool Vehicle::HasEmptySeat(int8 seatId) const
|
||||
{
|
||||
SeatMap::const_iterator seat = m_Seats.find(seatId);
|
||||
if (seat == m_Seats.end()) return false;
|
||||
if (seat == m_Seats.end())
|
||||
return false;
|
||||
return !seat->second.passenger;
|
||||
}
|
||||
|
||||
Unit *Vehicle::GetPassenger(int8 seatId) const
|
||||
{
|
||||
SeatMap::const_iterator seat = m_Seats.find(seatId);
|
||||
if (seat == m_Seats.end()) return NULL;
|
||||
if (seat == m_Seats.end())
|
||||
return NULL;
|
||||
return seat->second.passenger;
|
||||
}
|
||||
|
||||
@@ -229,6 +231,7 @@ int8 Vehicle::GetNextEmptySeat(int8 seatId, bool next) const
|
||||
seat = m_Seats.end();
|
||||
--seat;
|
||||
}
|
||||
|
||||
if (seat->first == seatId)
|
||||
return -1; // no available seat
|
||||
}
|
||||
@@ -250,11 +253,11 @@ void Vehicle::InstallAccessory(uint32 entry, int8 seatId, bool minion)
|
||||
passenger->ExitVehicle(); // this should not happen
|
||||
}
|
||||
|
||||
//TODO: accessory should be minion
|
||||
if (Creature *accessory = me->SummonCreature(entry, *me, TEMPSUMMON_CORPSE_TIMED_DESPAWN, 30000))
|
||||
{
|
||||
if (minion)
|
||||
accessory->AddUnitTypeMask(UNIT_MASK_ACCESSORY);
|
||||
|
||||
accessory->EnterVehicle(this, seatId);
|
||||
// This is not good, we have to send update twice
|
||||
accessory->SendMovementFlagUpdate();
|
||||
@@ -391,8 +394,6 @@ void Vehicle::RemovePassenger(Unit *unit)
|
||||
|
||||
unit->clearUnitState(UNIT_STAT_ONVEHICLE);
|
||||
|
||||
//SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_SPELLCLICK);
|
||||
|
||||
if (me->GetTypeId() == TYPEID_UNIT
|
||||
&& unit->GetTypeId() == TYPEID_PLAYER
|
||||
&& seat->first == 0 && seat->second.seatInfo->m_flags & VEHICLE_SEAT_FLAG_CAN_CONTROL)
|
||||
@@ -412,7 +413,7 @@ void Vehicle::RemovePassenger(Unit *unit)
|
||||
|
||||
// only for flyable vehicles
|
||||
if (unit->HasUnitMovementFlag(MOVEMENTFLAG_FLYING))
|
||||
me->CastSpell(unit, 45472, true); // Parachute
|
||||
me->CastSpell(unit, VEHICLE_SPELL_PARACHUTE, true);
|
||||
|
||||
if (GetBase()->GetTypeId() == TYPEID_UNIT)
|
||||
sScriptMgr.OnRemovePassenger(this, unit);
|
||||
|
||||
@@ -27,30 +27,35 @@ class Unit;
|
||||
|
||||
enum PowerType
|
||||
{
|
||||
POWER_STEAM = 61,
|
||||
POWER_PYRITE = 41,
|
||||
POWER_HEAT = 101,
|
||||
POWER_OOZE = 121,
|
||||
POWER_BLOOD = 141,
|
||||
POWER_WRATH = 142
|
||||
POWER_STEAM = 61,
|
||||
POWER_PYRITE = 41,
|
||||
POWER_HEAT = 101,
|
||||
POWER_OOZE = 121,
|
||||
POWER_BLOOD = 141,
|
||||
POWER_WRATH = 142
|
||||
};
|
||||
|
||||
enum VehicleFlags
|
||||
{
|
||||
VEHICLE_FLAG_ADJUST_AIM_ANGLE = 0x00000400, // Lua_IsVehicleAimAngleAdjustable
|
||||
VEHICLE_FLAG_ADJUST_AIM_POWER = 0x00000800, // Lua_IsVehicleAimPowerAdjustable
|
||||
VEHICLE_FLAG_CUSTOM_PITCH = 0x00000040, // If set use pitchMin and pitchMax from DBC, otherwise pitchMin = -pi/2, pitchMax = pi/2
|
||||
VEHICLE_FLAG_ADJUST_AIM_ANGLE = 0x00000400, // Lua_IsVehicleAimAngleAdjustable
|
||||
VEHICLE_FLAG_ADJUST_AIM_POWER = 0x00000800, // Lua_IsVehicleAimPowerAdjustable
|
||||
VEHICLE_FLAG_CUSTOM_PITCH = 0x00000040, // If set use pitchMin and pitchMax from DBC, otherwise pitchMin = -pi/2, pitchMax = pi/2
|
||||
};
|
||||
|
||||
enum VehicleSeatFlags
|
||||
{
|
||||
VEHICLE_SEAT_FLAG_HIDE_PASSENGER = 0x00000200, // Passenger is hidden
|
||||
VEHICLE_SEAT_FLAG_UNK11 = 0x00000400,
|
||||
VEHICLE_SEAT_FLAG_CAN_CONTROL = 0x00000800, // Lua_UnitInVehicleControlSeat
|
||||
VEHICLE_SEAT_FLAG_CAN_ATTACK = 0x00004000, // Can attack, cast spells and use items from vehicle?
|
||||
VEHICLE_SEAT_FLAG_USABLE = 0x02000000, // Lua_CanExitVehicle
|
||||
VEHICLE_SEAT_FLAG_CAN_SWITCH = 0x04000000, // Lua_CanSwitchVehicleSeats
|
||||
VEHICLE_SEAT_FLAG_CAN_CAST = 0x20000000, // Lua_UnitHasVehicleUI
|
||||
VEHICLE_SEAT_FLAG_HIDE_PASSENGER = 0x00000200, // Passenger is hidden
|
||||
VEHICLE_SEAT_FLAG_UNK11 = 0x00000400,
|
||||
VEHICLE_SEAT_FLAG_CAN_CONTROL = 0x00000800, // Lua_UnitInVehicleControlSeat
|
||||
VEHICLE_SEAT_FLAG_CAN_ATTACK = 0x00004000, // Can attack, cast spells and use items from vehicle?
|
||||
VEHICLE_SEAT_FLAG_USABLE = 0x02000000, // Lua_CanExitVehicle
|
||||
VEHICLE_SEAT_FLAG_CAN_SWITCH = 0x04000000, // Lua_CanSwitchVehicleSeats
|
||||
VEHICLE_SEAT_FLAG_CAN_CAST = 0x20000000, // Lua_UnitHasVehicleUI
|
||||
};
|
||||
|
||||
enum VehicleSpells
|
||||
{
|
||||
VEHICLE_SPELL_PARACHUTE = 45472
|
||||
};
|
||||
|
||||
|
||||
@@ -79,7 +84,6 @@ struct VehicleScalingInfo
|
||||
typedef std::vector<VehicleAccessory> VehicleAccessoryList;
|
||||
typedef std::map<uint32, VehicleAccessoryList> VehicleAccessoryMap;
|
||||
typedef std::map<uint32, VehicleScalingInfo> VehicleScalingMap;
|
||||
|
||||
typedef std::map<int8, VehicleSeat> SeatMap;
|
||||
|
||||
class Vehicle
|
||||
|
||||
Reference in New Issue
Block a user