mirror of
https://github.com/mangosfour/server.git
synced 2025-12-25 22:37:04 +00:00
Merge branch 'master' into 310
Conflicts: src/game/Unit.cpp
This commit is contained in:
commit
17d86309fa
22 changed files with 373 additions and 190 deletions
|
|
@ -85,8 +85,6 @@ void MapManager::LoadTransports()
|
|||
continue;
|
||||
}
|
||||
|
||||
t->m_name = goinfo->name;
|
||||
|
||||
float x, y, z, o;
|
||||
uint32 mapid;
|
||||
x = t->m_WayPoints[0].x; y = t->m_WayPoints[0].y; z = t->m_WayPoints[0].z; mapid = t->m_WayPoints[0].mapid; o = 1;
|
||||
|
|
@ -181,6 +179,8 @@ bool Transport::Create(uint32 guidlow, uint32 mapid, float x, float y, float z,
|
|||
if(dynflags)
|
||||
SetUInt32Value(GAMEOBJECT_DYNAMIC, MAKE_PAIR32(0, dynflags));
|
||||
|
||||
SetName(goinfo->name);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -432,11 +432,9 @@ Transport::WayPointMap::iterator Transport::GetNextWayPoint()
|
|||
|
||||
void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
|
||||
{
|
||||
//GetMap()->Remove((GameObject *)this, false);
|
||||
Map const* oldMap = GetMap();
|
||||
SetMapId(newMapid);
|
||||
//MapManager::Instance().LoadGrid(newMapid,x,y,true);
|
||||
Relocate(x, y, z);
|
||||
//GetMap()->Add<GameObject>((GameObject *)this);
|
||||
|
||||
for(PlayerSet::iterator itr = m_passengers.begin(); itr != m_passengers.end();)
|
||||
{
|
||||
|
|
@ -460,13 +458,21 @@ void Transport::TeleportTransport(uint32 newMapid, float x, float y, float z)
|
|||
//data << uint32(0);
|
||||
//plr->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
Map const* newMap = GetMap();
|
||||
|
||||
if(oldMap != newMap)
|
||||
{
|
||||
UpdateForMap(oldMap);
|
||||
UpdateForMap(newMap);
|
||||
}
|
||||
}
|
||||
|
||||
bool Transport::AddPassenger(Player* passenger)
|
||||
{
|
||||
if (m_passengers.find(passenger) == m_passengers.end())
|
||||
{
|
||||
sLog.outDetail("Player %s boarded transport %s.", passenger->GetName(), m_name.c_str());
|
||||
sLog.outDetail("Player %s boarded transport %s.", passenger->GetName(), GetName());
|
||||
m_passengers.insert(passenger);
|
||||
}
|
||||
return true;
|
||||
|
|
@ -475,7 +481,7 @@ bool Transport::AddPassenger(Player* passenger)
|
|||
bool Transport::RemovePassenger(Player* passenger)
|
||||
{
|
||||
if (m_passengers.erase(passenger))
|
||||
sLog.outDetail("Player %s removed from transport %s.", passenger->GetName(), m_name.c_str());
|
||||
sLog.outDetail("Player %s removed from transport %s.", passenger->GetName(), GetName());
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -497,7 +503,6 @@ void Transport::Update(uint32 /*p_time*/)
|
|||
}
|
||||
else
|
||||
{
|
||||
//MapManager::Instance().GetMap(m_curr->second.mapid)->GameobjectRelocation((GameObject *)this, m_curr->second.x, m_curr->second.y, m_curr->second.z, m_orientation);
|
||||
Relocate(m_curr->second.x, m_curr->second.y, m_curr->second.z);
|
||||
}
|
||||
|
||||
|
|
@ -513,13 +518,42 @@ void Transport::Update(uint32 /*p_time*/)
|
|||
m_nextNodeTime = m_curr->first;
|
||||
|
||||
if (m_curr == m_WayPoints.begin() && (sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES)==0)
|
||||
sLog.outDetail(" ************ BEGIN ************** %s", m_name.c_str());
|
||||
|
||||
// MapManager::Instance().GetMap(m_curr->second.mapid)->Add(&this); // -> // ->Add(t);
|
||||
//MapManager::Instance().GetMap(m_curr->second.mapid)->Remove((GameObject *)this, false); // -> // ->Add(t);
|
||||
//MapManager::Instance().GetMap(m_curr->second.mapid)->Add((GameObject *)this); // -> // ->Add(t);
|
||||
sLog.outDetail(" ************ BEGIN ************** %s", GetName());
|
||||
|
||||
if ((sLog.getLogFilter() & LOG_FILTER_TRANSPORT_MOVES)==0)
|
||||
sLog.outDetail("%s moved to %f %f %f %d", m_name.c_str(), m_curr->second.x, m_curr->second.y, m_curr->second.z, m_curr->second.mapid);
|
||||
sLog.outDetail("%s moved to %f %f %f %d", GetName(), m_curr->second.x, m_curr->second.y, m_curr->second.z, m_curr->second.mapid);
|
||||
}
|
||||
}
|
||||
|
||||
void Transport::UpdateForMap(Map const* targetMap)
|
||||
{
|
||||
Map::PlayerList const& pl = targetMap->GetPlayers();
|
||||
if(pl.isEmpty())
|
||||
return;
|
||||
|
||||
if(GetMapId()==targetMap->GetId())
|
||||
{
|
||||
for(Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
|
||||
{
|
||||
if(this != itr->getSource()->GetTransport())
|
||||
{
|
||||
UpdateData transData;
|
||||
BuildCreateUpdateBlockForPlayer(&transData, itr->getSource());
|
||||
WorldPacket packet;
|
||||
transData.BuildPacket(&packet, true);
|
||||
itr->getSource()->SendDirectMessage(&packet);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
UpdateData transData;
|
||||
BuildOutOfRangeUpdateBlock(&transData);
|
||||
WorldPacket out_packet;
|
||||
transData.BuildPacket(&out_packet, true);
|
||||
|
||||
for(Map::PlayerList::const_iterator itr = pl.begin(); itr != pl.end(); ++itr)
|
||||
if(this != itr->getSource()->GetTransport())
|
||||
itr->getSource()->SendDirectMessage(&out_packet);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue