* Get a random tile around the Unit. * * Stack: 1 - An encoded index of a tile, completely ignored, as long as it is a tile. * * @param script The script engine to operate on. * @return An encoded tile, or 0. */
| 1724 | * @return An encoded tile, or 0. |
| 1725 | */ |
| 1726 | uint16 Script_Unit_GetRandomTile(ScriptEngine *script) |
| 1727 | { |
| 1728 | Unit *u; |
| 1729 | tile32 tile; |
| 1730 | |
| 1731 | u = g_scriptCurrentUnit; |
| 1732 | |
| 1733 | if (Tools_Index_GetType(STACK_PEEK(1)) != IT_TILE) return 0; |
| 1734 | |
| 1735 | tile = Tile_MoveByRandom(u->o.position, 80, true); |
| 1736 | |
| 1737 | return Tools_Index_Encode(Tile_PackTile(tile), IT_TILE); |
| 1738 | } |
| 1739 | |
| 1740 | /** |
| 1741 | * Perform a random action when we are sitting idle, like rotating around. |
nothing calls this directly
no test coverage detected