* Gets the Unit corresponding to the given encoded index. * * @param id The encoded index to get the Unit of. * @return The Unit. */
| 183 | * @return The Unit. |
| 184 | */ |
| 185 | Unit *Tools_Index_GetUnit(uint16 encoded) |
| 186 | { |
| 187 | uint16 index; |
| 188 | |
| 189 | if (Tools_Index_GetType(encoded) != IT_UNIT) return NULL; |
| 190 | |
| 191 | index = Tools_Index_Decode(encoded); |
| 192 | return (index < UNIT_INDEX_MAX) ? Unit_Get_ByIndex(index) : NULL; |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * Gets the Structure corresponding to the given encoded index. |
no test coverage detected