File tree Expand file tree Collapse file tree 1 file changed +13
-3
lines changed
Expand file tree Collapse file tree 1 file changed +13
-3
lines changed Original file line number Diff line number Diff line change @@ -445,9 +445,19 @@ namespace RTE {
445445 // / @param m_MovePath.push_back(newCoordinate The new coordinate to add to the end of the MovePath.
446446 void AddToMovePathEnd (Vector newCoordinate) { m_MovePath.push_back (newCoordinate); }
447447
448- // / Gets the last position in this Actor's move path.
449- // / @return The last position in this Actor's move path.
450- Vector GetMovePathEnd () const { return m_MovePath.back (); }
448+ // / Gets the last position in this Actor's move path, or otherwise the current move target.
449+ // / @return The last position in this Actor's move path, or otherwise the current move target.
450+ Vector GetMovePathEnd () const {
451+ if (!m_MovePath.empty ()) {
452+ return m_MovePath.back ();
453+ }
454+ // In case move path is empty, check our own path request.
455+ if (m_PathRequest) {
456+ return const_cast <Vector&>(m_PathRequest->targetPos );
457+ }
458+ // In case *that* is empty, just return the move target.
459+ return m_MoveTarget;
460+ }
451461
452462 // / Removes a coordinate from the beginning of the MovePath, meaning the
453463 // / one closest to this Actor.
You can’t perform that action at this time.
0 commit comments