[11385] Add support for static vehicle spawns

Signed-off-by: zergtmn <zerg@myisp.com>
This commit is contained in:
zergtmn 2011-04-20 23:23:47 +06:00
parent 75e1e7c3a3
commit 2835aa5f20
32 changed files with 115 additions and 331 deletions

View file

@ -19,7 +19,6 @@
#include "Map.h"
#include "MapManager.h"
#include "Player.h"
#include "Vehicle.h"
#include "GridNotifiers.h"
#include "Log.h"
#include "GridStates.h"
@ -138,7 +137,7 @@ template<>
void Map::AddToGrid(Creature* obj, NGridType *grid, Cell const& cell)
{
// add to world object registry in grid
if(obj->IsPet() || obj->IsVehicle())
if (obj->IsPet())
{
(*grid)(cell.CellX(), cell.CellY()).AddWorldObject<Creature>(obj);
obj->SetCurrentCell(cell);
@ -182,7 +181,7 @@ template<>
void Map::RemoveFromGrid(Creature* obj, NGridType *grid, Cell const& cell)
{
// remove from world object registry in grid
if(obj->IsPet() || obj->IsVehicle())
if (obj->IsPet())
{
(*grid)(cell.CellX(), cell.CellY()).RemoveWorldObject<Creature>(obj);
}
@ -1687,14 +1686,12 @@ void Map::ScriptsProcess()
break;
}
case HIGHGUID_UNIT:
case HIGHGUID_VEHICLE:
source = GetCreature(step.sourceGuid);
break;
case HIGHGUID_PET:
source = GetPet(step.sourceGuid);
break;
case HIGHGUID_VEHICLE:
source = GetVehicle(step.sourceGuid);
break;
case HIGHGUID_PLAYER:
source = HashMapHolder<Player>::Find(step.sourceGuid);
break;
@ -1720,14 +1717,12 @@ void Map::ScriptsProcess()
switch(step.targetGuid.GetHigh())
{
case HIGHGUID_UNIT:
case HIGHGUID_VEHICLE:
target = GetCreature(step.targetGuid);
break;
case HIGHGUID_PET:
target = GetPet(step.targetGuid);
break;
case HIGHGUID_VEHICLE:
target = GetVehicle(step.targetGuid);
break;
case HIGHGUID_PLAYER:
target = HashMapHolder<Player>::Find(step.targetGuid);
break;
@ -2901,25 +2896,15 @@ Player* Map::GetPlayer(ObjectGuid guid)
}
/**
* Function return creature (non-pet and then most summoned by spell creatures, and not vehicle) that in world at CURRENT map
* Function return creature (non-pet and then most summoned by spell creatures) that in world at CURRENT map
*
* @param guid must be creature guid (HIGHGUID_UNIT)
* @param guid must be creature or vehicle guid (HIGHGUID_UNIT HIGHGUID_VEHICLE)
*/
Creature* Map::GetCreature(ObjectGuid guid)
{
return m_objectsStore.find<Creature>(guid.GetRawValue(), (Creature*)NULL);
}
/**
* Function return vehicle that in world at CURRENT map
*
* @param guid must be vehicle guid (HIGHGUID_VEHICLE)
*/
Vehicle* Map::GetVehicle(ObjectGuid guid)
{
return m_objectsStore.find<Vehicle>(guid.GetRawValue(), (Vehicle*)NULL);
}
/**
* Function return pet that in world at CURRENT map
*
@ -2952,9 +2937,9 @@ Creature* Map::GetAnyTypeCreature(ObjectGuid guid)
{
switch(guid.GetHigh())
{
case HIGHGUID_UNIT: return GetCreature(guid);
case HIGHGUID_UNIT:
case HIGHGUID_VEHICLE: return GetCreature(guid);
case HIGHGUID_PET: return GetPet(guid);
case HIGHGUID_VEHICLE: return GetVehicle(guid);
default: break;
}
@ -3006,9 +2991,9 @@ WorldObject* Map::GetWorldObject(ObjectGuid guid)
{
case HIGHGUID_PLAYER: return GetPlayer(guid);
case HIGHGUID_GAMEOBJECT: return GetGameObject(guid);
case HIGHGUID_UNIT: return GetCreature(guid);
case HIGHGUID_UNIT:
case HIGHGUID_VEHICLE: return GetCreature(guid);
case HIGHGUID_PET: return GetPet(guid);
case HIGHGUID_VEHICLE: return GetVehicle(guid);
case HIGHGUID_DYNAMICOBJECT:return GetDynamicObject(guid);
case HIGHGUID_CORPSE:
{