Implement taxi/transport event scripts support. Author: Vladimir

--HG--
branch : trunk
This commit is contained in:
Machiavelli
2010-06-23 01:59:32 +02:00
parent ffaffe3fd7
commit 968c27f55f
8 changed files with 72 additions and 28 deletions
@@ -278,10 +278,14 @@ bool FlightPathMovementGenerator::Update(Player &player, const uint32 &diff)
i_destinationHolder.ResetUpdate(FLIGHT_TRAVEL_UPDATE);
if (i_destinationHolder.HasArrived())
{
DoEventIfAny(player,(*i_path)[i_currentNode], false);
uint32 curMap = (*i_path)[i_currentNode].mapid;
++i_currentNode;
if (MovementInProgress())
{
DoEventIfAny(player,(*i_path)[i_currentNode], true);
DEBUG_LOG("loading node %u for player %s", i_currentNode, player.GetName());
if ((*i_path)[i_currentNode].mapid == curMap)
{
@@ -351,6 +355,17 @@ void FlightPathMovementGenerator::PreloadEndGrid()
sLog.outDetail("Unable to determine map to preload flightmaster grid");
}
void FlightPathMovementGenerator::DoEventIfAny(Player& player, TaxiPathNodeEntry const& node, bool departure)
{
if (uint32 eventid = departure ? node.departureEventID : node.arrivalEventID)
{
sLog.outDebug("Taxi %s event %u of node %u of path %u for player %s", departure ? "departure" : "arrival", eventid, node.index, node.path, player.GetName());
player.GetMap()->ScriptsStart(sEventScripts, eventid, &player, &player);
}
}
//
// Unique1's ASTAR Pathfinding Code... For future use & reference...
//
@@ -115,6 +115,8 @@ public PathMovementBase<Player,TaxiPathNodeList const*>
bool HasArrived() const { return (i_currentNode >= i_path->size()); }
void SetCurrentNodeAfterTeleport();
void SkipCurrentNode() { ++i_currentNode; }
void DoEventIfAny(Player& player, TaxiPathNodeEntry const& node, bool departure);
bool GetDestination(float& x, float& y, float& z) const { return PathMovementBase<Player,TaxiPathNodeList const*>::GetDestination(x,y,z); }
void PreloadEndGrid();