MCPcopy Create free account
hub / github.com/OpenXcom/OpenXcom / setDestination

Method setDestination

src/Savegame/MovingTarget.cpp:96–117  ·  view source on GitHub ↗

* Changes the destination the moving target is heading to. * @param dest Pointer to destination. */

Source from the content-addressed store, hash-verified

94 * @param dest Pointer to destination.
95 */
96void MovingTarget::setDestination(Target *dest)
97{
98 // Remove moving target from old destination's followers
99 if (_dest != 0)
100 {
101 for (std::vector<Target*>::iterator i = _dest->getFollowers()->begin(); i != _dest->getFollowers()->end(); ++i)
102 {
103 if ((*i) == this)
104 {
105 _dest->getFollowers()->erase(i);
106 break;
107 }
108 }
109 }
110 _dest = dest;
111 // Add moving target to new destination's followers
112 if (_dest != 0)
113 {
114 _dest->getFollowers()->push_back(this);
115 }
116 calculateSpeed();
117}
118
119/**
120 * Returns the speed of the moving target.

Callers

nothing calls this directly

Calls 1

getFollowersMethod · 0.80

Tested by

no test coverage detected