diff options
-rw-r--r-- | src/game/DestinationHolder.h | 1 | ||||
-rw-r--r-- | src/game/WaypointMovementGenerator.cpp | 3 | ||||
-rw-r--r-- | src/game/WaypointMovementGenerator.h | 1 |
3 files changed, 4 insertions, 1 deletions
diff --git a/src/game/DestinationHolder.h b/src/game/DestinationHolder.h index 05cbfd0b1a1..e09a153615c 100644 --- a/src/game/DestinationHolder.h +++ b/src/game/DestinationHolder.h @@ -49,6 +49,7 @@ class DestinationHolder void ResetUpdate(uint32 t = TRAVELLER_UPDATE_INTERVAL) { i_tracker.Reset(t); } uint32 GetTotalTravelTime(void) const { return i_totalTravelTime; } void IncreaseTravelTime(uint32 increment) { i_totalTravelTime += increment; } + void ResetTravelTime() { i_totalTravelTime = 0; } bool HasDestination(void) const { return i_destSet; } float GetDestinationDiff(float x, float y, float z) const; bool HasArrived(void) const { return (i_totalTravelTime == 0 || i_timeElapsed >= i_totalTravelTime); } diff --git a/src/game/WaypointMovementGenerator.cpp b/src/game/WaypointMovementGenerator.cpp index d2e4c515a04..2a0c7c0253d 100644 --- a/src/game/WaypointMovementGenerator.cpp +++ b/src/game/WaypointMovementGenerator.cpp @@ -155,7 +155,7 @@ WaypointMovementGenerator<Creature>::Update(Creature &unit, const uint32 &diff) i_nextMoveTime.Update(diff); i_destinationHolder.UpdateTraveller(traveller, diff, true); - if (i_nextMoveTime.Passed()) + if (i_nextMoveTime.GetExpiry() < TIMEDIFF_NEXT_WP) { if (unit.IsStopped()) { @@ -202,6 +202,7 @@ WaypointMovementGenerator<Creature>::Update(Creature &unit, const uint32 &diff) if (node->event_id && urand(0,99) < node->event_chance) unit.GetMap()->ScriptsStart(sWaypointScripts, node->event_id, &unit, NULL/*, false*/); + i_destinationHolder.ResetTravelTime(); MovementInform(unit); unit.UpdateWaypointID(i_currentNode); unit.clearUnitState(UNIT_STAT_ROAMING); diff --git a/src/game/WaypointMovementGenerator.h b/src/game/WaypointMovementGenerator.h index 879fac48ff1..4b74e80e168 100644 --- a/src/game/WaypointMovementGenerator.h +++ b/src/game/WaypointMovementGenerator.h @@ -40,6 +40,7 @@ #define FLIGHT_TRAVEL_UPDATE 100 #define STOP_TIME_FOR_PLAYER 3 * MINUTE * IN_MILISECONDS // 3 Minutes +#define TIMEDIFF_NEXT_WP 250 template<class T, class P = Path> class PathMovementBase |