* Checks if a Unit is on the map. * * @param houseID The House of the Unit. * @param typeID The type of the Unit. * @return Returns true if and only if a Unit with the given attributes is on the map. */
| 472 | * @return Returns true if and only if a Unit with the given attributes is on the map. |
| 473 | */ |
| 474 | bool Unit_IsTypeOnMap(uint8 houseID, uint8 typeID) |
| 475 | { |
| 476 | uint16 i; |
| 477 | |
| 478 | for (i = 0; i < g_unitFindCount; i++) { |
| 479 | Unit *u; |
| 480 | |
| 481 | u = g_unitFindArray[i]; |
| 482 | if (houseID != HOUSE_INVALID && Unit_GetHouseID(u) != houseID) continue; |
| 483 | if (typeID != UNIT_INVALID && u->o.type != typeID) continue; |
| 484 | if (g_validateStrictIfZero == 0 && u->o.flags.s.isNotOnMap) continue; |
| 485 | |
| 486 | return true; |
| 487 | } |
| 488 | return false; |
| 489 | } |
| 490 | |
| 491 | /** |
| 492 | * Sets the action the given unit will execute. |
no test coverage detected