| 96 | } |
| 97 | |
| 98 | static void Unit_MovementTick(Unit *unit) |
| 99 | { |
| 100 | uint16 speed; |
| 101 | |
| 102 | if (unit->speed == 0) return; |
| 103 | |
| 104 | speed = unit->speedRemainder; |
| 105 | |
| 106 | /* Units in the air don't feel the effect of gameSpeed */ |
| 107 | if (g_table_unitInfo[unit->o.type].movementType != MOVEMENT_WINGER) { |
| 108 | speed += Tools_AdjustToGameSpeed(unit->speedPerTick, 1, 255, false); |
| 109 | } else { |
| 110 | speed += unit->speedPerTick; |
| 111 | } |
| 112 | |
| 113 | if ((speed & 0xFF00) != 0) { |
| 114 | Unit_Move(unit, min(unit->speed * 16, Tile_GetDistance(unit->o.position, unit->currentDestination) + 16)); |
| 115 | } |
| 116 | |
| 117 | unit->speedRemainder = speed & 0xFF; |
| 118 | } |
| 119 | |
| 120 | /** |
| 121 | * Loop over all units, performing various of tasks. |
no test coverage detected