* Set the speed of a Unit. * * Stack: 1 - The new speed of the Unit. * * @param script The script engine to operate on. * @return The new speed; it might differ from the value given. */
| 379 | * @return The new speed; it might differ from the value given. |
| 380 | */ |
| 381 | uint16 Script_Unit_SetSpeed(ScriptEngine *script) |
| 382 | { |
| 383 | Unit *u; |
| 384 | uint16 speed; |
| 385 | |
| 386 | u = g_scriptCurrentUnit; |
| 387 | speed = clamp(STACK_PEEK(1), 0, 255); |
| 388 | |
| 389 | if (!u->o.flags.s.byScenario) speed = speed * 192 / 256; |
| 390 | |
| 391 | Unit_SetSpeed(u, speed); |
| 392 | |
| 393 | return u->speed; |
| 394 | } |
| 395 | |
| 396 | /** |
| 397 | * Change the sprite (offset) of the unit. |
nothing calls this directly
no test coverage detected