MCPcopy Create free account
hub / github.com/OpenDUNE/OpenDUNE / Unit_IsTypeOnMap

Function Unit_IsTypeOnMap

src/unit.c:474–489  ·  view source on GitHub ↗

* 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. */

Source from the content-addressed store, hash-verified

472 * @return Returns true if and only if a Unit with the given attributes is on the map.
473 */
474bool 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.

Callers 2

Unit_CreateWrapperFunction · 0.85

Calls 1

Unit_GetHouseIDFunction · 0.85

Tested by

no test coverage detected