* Set the current destination of a Unit, bypassing any pathfinding. * It is wise to only use this function on Carry-Alls. * * Stack: 1 - An encoded tile, the destination. * * @param script The script engine to operate on. * @return The value 0. Always. */
| 916 | * @return The value 0. Always. |
| 917 | */ |
| 918 | uint16 Script_Unit_SetDestinationDirect(ScriptEngine *script) |
| 919 | { |
| 920 | Unit *u; |
| 921 | uint16 encoded; |
| 922 | |
| 923 | encoded = STACK_PEEK(1); |
| 924 | |
| 925 | if (!Tools_Index_IsValid(encoded)) return 0; |
| 926 | |
| 927 | u = g_scriptCurrentUnit; |
| 928 | |
| 929 | if ((u->currentDestination.x == 0 && u->currentDestination.y == 0) || g_table_unitInfo[u->o.type].flags.isNormalUnit) { |
| 930 | u->currentDestination = Tools_Index_GetTile(encoded); |
| 931 | } |
| 932 | |
| 933 | Unit_SetOrientation(u, Tile_GetDirection(u->o.position, u->currentDestination), false, 0); |
| 934 | |
| 935 | return 0; |
| 936 | } |
| 937 | |
| 938 | /** |
| 939 | * Get information about the unit, like hitpoints, current target, etc. |
nothing calls this directly
no test coverage detected