mirror of
https://github.com/mangosfour/server.git
synced 2025-12-28 22:37:04 +00:00
[12218] Add abstract Board/Unboard Passenger functions to TransportBase
Signed-off-by: Schmoozerd <schmoozerd@cmangos>
This commit is contained in:
parent
45d0e5babe
commit
6ceee0e4b7
3 changed files with 37 additions and 3 deletions
|
|
@ -24,7 +24,7 @@
|
|||
* This file contains the code needed for MaNGOS to provide abstract support for transported entities
|
||||
* Currently implemented
|
||||
* - Calculating between local and global coords
|
||||
*
|
||||
* - Abstract storage of passengers (added by BoardPassenger, UnboardPassenger)
|
||||
*/
|
||||
|
||||
#include "TransportSystem.h"
|
||||
|
|
@ -136,6 +136,34 @@ void TransportBase::CalculateGlobalPositionOf(float lx, float ly, float lz, floa
|
|||
go = NormalizeOrientation(lo + m_owner->GetOrientation());
|
||||
}
|
||||
|
||||
void TransportBase::BoardPassenger(WorldObject* passenger, float lx, float ly, float lz, float lo, uint8 seat)
|
||||
{
|
||||
TransportInfo* transportInfo = new TransportInfo(passenger, this, lx, ly, lz, lo, seat);
|
||||
|
||||
// Insert our new passenger
|
||||
m_passengers.insert(PassengerMap::value_type(passenger, transportInfo));
|
||||
|
||||
// The passenger needs fast access to transportInfo
|
||||
passenger->SetTransportInfo(transportInfo);
|
||||
}
|
||||
|
||||
void TransportBase::UnBoardPassenger(WorldObject* passenger)
|
||||
{
|
||||
PassengerMap::const_iterator itr = m_passengers.find(passenger);
|
||||
|
||||
if (itr == m_passengers.end())
|
||||
return;
|
||||
|
||||
// Set passengers transportInfo to NULL
|
||||
passenger->SetTransportInfo(NULL);
|
||||
|
||||
// Delete transportInfo
|
||||
delete itr->second;
|
||||
|
||||
// Unboard finally
|
||||
m_passengers.erase(itr);
|
||||
}
|
||||
|
||||
/* **************************************** TransportInfo ****************************************/
|
||||
|
||||
TransportInfo::TransportInfo(WorldObject* owner, TransportBase* transport, float lx, float ly, float lz, float lo, uint8 seat) :
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue