Skip to content

Commit

Permalink
Fix unit speeds.
Browse files Browse the repository at this point in the history
Units now actually move at the speeds given in the design menu, which in the case of
VTOLs is up to 2.5 times faster, and which in the case of land units up to 1.2 times
faster on one particular terrain type, instead of moving at a maximum of
DROID::baseSpeed, which is the speed before terrain modifiers.

Introduced in 4b08dd0.

Fixes ticket:3140.
  • Loading branch information
Cyp committed Feb 12, 2012
1 parent 65e7c82 commit 5a39253
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions src/move.cpp
Expand Up @@ -1478,8 +1478,7 @@ static void moveUpdateDroidDirection(DROID *psDroid, SDWORD *pSpeed, uint16_t di

int diff = angleDelta(direction - *pDroidDir);
// Turn while moving - slow down speed depending on target angle so that we can turn faster
int maxSpeed = std::max<int>(psDroid->baseSpeed * (iSpinAngle - abs(diff)) / iSpinAngle, 0);
*pSpeed = std::min(*pSpeed, maxSpeed);
*pSpeed = std::max<int>(*pSpeed * (iSpinAngle - abs(diff)) / iSpinAngle, 0);

// iTurnSpeed is turn speed at max velocity, increase turn speed up to iSpinSpeed when slowing down
int turnSpeed = std::min<int>(iTurnSpeed + int64_t(iSpinSpeed - iTurnSpeed) * abs(diff) / iSpinAngle, iSpinSpeed);
Expand Down

0 comments on commit 5a39253

Please sign in to comment.