Core/Vehicles: Remove Vehicle.h dependency from other header files

This commit is contained in:
Spp
2011-08-03 12:28:42 +02:00
parent e7327e7e94
commit 7e53a73059
20 changed files with 135 additions and 101 deletions
@@ -31,6 +31,7 @@
#include "SmartScript.h"
#include "SmartAI.h"
#include "Group.h"
#include "Vehicle.h"
SmartScript::SmartScript()
{
+25
View File
@@ -411,4 +411,29 @@ enum SummonPropFlags
SUMMON_PROP_FLAG_UNK16 = 0x00008000, // Light/Dark Bullet, Soul/Fiery Consumption, Twisted Visage, Twilight Whelp. Phase related?
};
enum VehicleSeatFlags
{
VEHICLE_SEAT_FLAG_HIDE_PASSENGER = 0x00000200, // Passenger is hidden
VEHICLE_SEAT_FLAG_UNK11 = 0x00000400, // needed for CGCamera__SyncFreeLookFacing
VEHICLE_SEAT_FLAG_CAN_CONTROL = 0x00000800, // Lua_UnitInVehicleControlSeat
VEHICLE_SEAT_FLAG_CAN_CAST_MOUNT_SPELL = 0x00001000, // Can cast spells with SPELL_AURA_MOUNTED from seat (possibly 4.x only, 0 seats on 3.3.5a)
VEHICLE_SEAT_FLAG_UNCONTROLLED = 0x00002000, // can override !& VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT
VEHICLE_SEAT_FLAG_CAN_ATTACK = 0x00004000, // Can attack, cast spells and use items from vehicle
VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT = 0x02000000, // Lua_CanExitVehicle - can enter and exit at free will
VEHICLE_SEAT_FLAG_CAN_SWITCH = 0x04000000, // Lua_CanSwitchVehicleSeats
VEHICLE_SEAT_FLAG_CAN_CAST = 0x20000000, // Lua_UnitHasVehicleUI
};
enum VehicleSeatFlagsB
{
VEHICLE_SEAT_FLAG_B_NONE = 0x00000000,
VEHICLE_SEAT_FLAG_B_USABLE_FORCED = 0x00000002,
VEHICLE_SEAT_FLAG_B_TARGETS_IN_RAIDUI = 0x00000008, // Lua_UnitTargetsVehicleInRaidUI
VEHICLE_SEAT_FLAG_B_EJECTABLE = 0x00000020, // ejectable
VEHICLE_SEAT_FLAG_B_USABLE_FORCED_2 = 0x00000040,
VEHICLE_SEAT_FLAG_B_USABLE_FORCED_3 = 0x00000100,
VEHICLE_SEAT_FLAG_B_CANSWITCH = 0x04000000, // can switch seats
VEHICLE_SEAT_FLAG_B_VEHICLE_PLAYERFRAME_UI = 0x80000000, // Lua_UnitHasVehiclePlayerFrameUI - actually checked for flagsb &~ 0x80000000
};
#endif
@@ -24,7 +24,6 @@
#include "Define.h"
#include "Path.h"
#include "Util.h"
#include "Vehicle.h"
#include <map>
#include <set>
+1 -82
View File
@@ -20,92 +20,13 @@
#define __TRINITY_VEHICLE_H
#include "ObjectDefines.h"
#include "VehicleDefines.h"
struct VehicleEntry;
struct VehicleSeatEntry;
class Unit;
enum PowerType
{
POWER_STEAM = 61,
POWER_PYRITE = 41,
POWER_HEAT = 101,
POWER_OOZE = 121,
POWER_BLOOD = 141,
POWER_WRATH = 142
};
enum VehicleFlags
{
VEHICLE_FLAG_NO_STRAFE = 0x00000001, // Sets MOVEFLAG2_NO_STRAFE
VEHICLE_FLAG_NO_JUMPING = 0x00000002, // Sets MOVEFLAG2_NO_JUMPING
VEHICLE_FLAG_FULLSPEEDTURNING = 0x00000004, // Sets MOVEFLAG2_FULLSPEEDTURNING
VEHICLE_FLAG_ALLOW_PITCHING = 0x00000010, // Sets MOVEFLAG2_ALLOW_PITCHING
VEHICLE_FLAG_FULLSPEEDPITCHING = 0x00000020, // Sets MOVEFLAG2_FULLSPEEDPITCHING
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
};
enum VehicleSeatFlags
{
VEHICLE_SEAT_FLAG_HIDE_PASSENGER = 0x00000200, // Passenger is hidden
VEHICLE_SEAT_FLAG_UNK11 = 0x00000400, // needed for CGCamera__SyncFreeLookFacing
VEHICLE_SEAT_FLAG_CAN_CONTROL = 0x00000800, // Lua_UnitInVehicleControlSeat
VEHICLE_SEAT_FLAG_CAN_CAST_MOUNT_SPELL = 0x00001000, // Can cast spells with SPELL_AURA_MOUNTED from seat (possibly 4.x only, 0 seats on 3.3.5a)
VEHICLE_SEAT_FLAG_UNCONTROLLED = 0x00002000, // can override !& VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT
VEHICLE_SEAT_FLAG_CAN_ATTACK = 0x00004000, // Can attack, cast spells and use items from vehicle
VEHICLE_SEAT_FLAG_CAN_ENTER_OR_EXIT = 0x02000000, // Lua_CanExitVehicle - can enter and exit at free will
VEHICLE_SEAT_FLAG_CAN_SWITCH = 0x04000000, // Lua_CanSwitchVehicleSeats
VEHICLE_SEAT_FLAG_CAN_CAST = 0x20000000, // Lua_UnitHasVehicleUI
};
enum VehicleSeatFlagsB
{
VEHICLE_SEAT_FLAG_B_NONE = 0x00000000,
VEHICLE_SEAT_FLAG_B_USABLE_FORCED = 0x00000002,
VEHICLE_SEAT_FLAG_B_TARGETS_IN_RAIDUI = 0x00000008, // Lua_UnitTargetsVehicleInRaidUI
VEHICLE_SEAT_FLAG_B_EJECTABLE = 0x00000020, // ejectable
VEHICLE_SEAT_FLAG_B_USABLE_FORCED_2 = 0x00000040,
VEHICLE_SEAT_FLAG_B_USABLE_FORCED_3 = 0x00000100,
VEHICLE_SEAT_FLAG_B_CANSWITCH = 0x04000000, // can switch seats
VEHICLE_SEAT_FLAG_B_VEHICLE_PLAYERFRAME_UI = 0x80000000, // Lua_UnitHasVehiclePlayerFrameUI - actually checked for flagsb &~ 0x80000000
};
enum VehicleSpells
{
VEHICLE_SPELL_RIDE_HARDCODED = 46598,
VEHICLE_SPELL_PARACHUTE = 45472
};
struct VehicleSeat
{
explicit VehicleSeat(VehicleSeatEntry const *seatInfo) : SeatInfo(seatInfo), Passenger(0) {}
VehicleSeatEntry const *SeatInfo;
uint64 Passenger;
};
struct VehicleAccessory
{
VehicleAccessory(uint32 entry, int8 seatId, bool isMinion, uint8 summonType, uint32 summonTime) :
AccessoryEntry(entry), SeatId(seatId), IsMinion(isMinion), SummonedType(summonType), SummonTime(summonTime) {}
uint32 AccessoryEntry;
int8 SeatId;
uint32 IsMinion;
uint8 SummonedType;
uint32 SummonTime;
};
typedef std::vector<VehicleAccessory> VehicleAccessoryList;
typedef std::map<uint32, VehicleAccessoryList> VehicleAccessoryMap;
typedef std::map<int8, VehicleSeat> SeatMap;
class Vehicle
{
friend class Unit;
friend class WorldSession;
friend class Spell;
public:
explicit Vehicle(Unit* unit, VehicleEntry const* vehInfo, uint32 creatureEntry);
virtual ~Vehicle();
@@ -135,8 +56,6 @@ class Vehicle
SeatMap Seats;
protected:
uint16 GetExtraMovementFlagsForBase() const;
VehicleSeatEntry const* GetSeatForPassenger(Unit* passenger);
private:
@@ -0,0 +1,75 @@
/*
* Copyright (C) 2008-2011 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
* Free Software Foundation; either version 2 of the License, or (at your
* option) any later version.
*
* This program is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
* more details.
*
* You should have received a copy of the GNU General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef __TRINITY_VEHICLEDEFINES_H
#define __TRINITY_VEHICLEDEFINES_H
#include "Define.h"
struct VehicleSeatEntry;
enum PowerType
{
POWER_STEAM = 61,
POWER_PYRITE = 41,
POWER_HEAT = 101,
POWER_OOZE = 121,
POWER_BLOOD = 141,
POWER_WRATH = 142
};
enum VehicleFlags
{
VEHICLE_FLAG_NO_STRAFE = 0x00000001, // Sets MOVEFLAG2_NO_STRAFE
VEHICLE_FLAG_NO_JUMPING = 0x00000002, // Sets MOVEFLAG2_NO_JUMPING
VEHICLE_FLAG_FULLSPEEDTURNING = 0x00000004, // Sets MOVEFLAG2_FULLSPEEDTURNING
VEHICLE_FLAG_ALLOW_PITCHING = 0x00000010, // Sets MOVEFLAG2_ALLOW_PITCHING
VEHICLE_FLAG_FULLSPEEDPITCHING = 0x00000020, // Sets MOVEFLAG2_FULLSPEEDPITCHING
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
};
enum VehicleSpells
{
VEHICLE_SPELL_RIDE_HARDCODED = 46598,
VEHICLE_SPELL_PARACHUTE = 45472
};
struct VehicleSeat
{
explicit VehicleSeat(VehicleSeatEntry const *seatInfo) : SeatInfo(seatInfo), Passenger(0) {}
VehicleSeatEntry const *SeatInfo;
uint64 Passenger;
};
struct VehicleAccessory
{
VehicleAccessory(uint32 entry, int8 seatId, bool isMinion, uint8 summonType, uint32 summonTime) :
AccessoryEntry(entry), SeatId(seatId), IsMinion(isMinion), SummonedType(summonType), SummonTime(summonTime) {}
uint32 AccessoryEntry;
int8 SeatId;
uint32 IsMinion;
uint8 SummonedType;
uint32 SummonTime;
};
typedef std::vector<VehicleAccessory> VehicleAccessoryList;
typedef std::map<uint32, VehicleAccessoryList> VehicleAccessoryMap;
typedef std::map<int8, VehicleSeat> SeatMap;
#endif
+17
View File
@@ -8993,3 +8993,20 @@ CreatureTemplate const* ObjectMgr::GetCreatureTemplate(uint32 entry)
return NULL;
}
VehicleAccessoryList const* ObjectMgr::GetVehicleAccessoryList(Vehicle* veh) const
{
if (Creature* cre = veh->GetBase()->ToCreature())
{
// Give preference to GUID-based accessories
VehicleAccessoryMap::const_iterator itr = m_VehicleAccessoryMap.find(cre->GetDBTableGUIDLow());
if (itr != m_VehicleAccessoryMap.end())
return &itr->second;
}
// Otherwise return entry-based
VehicleAccessoryMap::const_iterator itr = m_VehicleTemplateAccessoryMap.find(veh->GetCreatureEntry());
if (itr != m_VehicleTemplateAccessoryMap.end())
return &itr->second;
return NULL;
}
+2 -17
View File
@@ -36,7 +36,7 @@
#include "ObjectAccessor.h"
#include "ObjectDefines.h"
#include <ace/Singleton.h>
#include "Vehicle.h"
#include "VehicleDefines.h"
#include <string>
#include <map>
#include <limits>
@@ -772,22 +772,7 @@ class ObjectMgr
return NULL;
}
VehicleAccessoryList const* GetVehicleAccessoryList(Vehicle* veh) const
{
if (Creature* cre = veh->GetBase()->ToCreature())
{
// Give preference to GUID-based accessories
VehicleAccessoryMap::const_iterator itr = m_VehicleAccessoryMap.find(cre->GetDBTableGUIDLow());
if (itr != m_VehicleAccessoryMap.end())
return &itr->second;
}
// Otherwise return entry-based
VehicleAccessoryMap::const_iterator itr = m_VehicleTemplateAccessoryMap.find(veh->GetCreatureEntry());
if (itr != m_VehicleTemplateAccessoryMap.end())
return &itr->second;
return NULL;
}
VehicleAccessoryList const* GetVehicleAccessoryList(Vehicle* veh) const;
DungeonEncounterList const* GetDungeonEncounterList(uint32 mapId, Difficulty difficulty)
{
+1
View File
@@ -26,6 +26,7 @@
#include "ScriptLoader.h"
#include "ScriptSystem.h"
#include "Transport.h"
#include "Vehicle.h"
// This is the global static registry of scripts.
template<class TScript>
@@ -35,6 +35,7 @@
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
#include "ScriptMgr.h"
#include "Vehicle.h"
class Aura;
//
@@ -34,6 +34,7 @@
#include "CellImpl.h"
#include "ScriptMgr.h"
#include "SpellScript.h"
#include "Vehicle.h"
AuraApplication::AuraApplication(Unit* target, Unit* caster, Aura * aura, uint8 effMask):
m_target(target), m_base(aura), m_slot(MAX_AURAS), m_flags(AFLAG_NONE),