MCPcopy Create free account
hub / github.com/DFHack/dfhack / isValidLabor

Method isValidLabor

library/modules/Units.cpp:1379–1386  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1377}
1378
1379bool Units::isValidLabor(df::unit *unit, df::unit_labor labor) {
1380 CHECK_NULL_POINTER(unit);
1381 if (!is_valid_enum_item(labor) || labor == unit_labor::NONE)
1382 return false;
1383
1384 auto entity = df::historical_entity::find(unit->civ_id);
1385 return !entity || !entity->entity_raw || entity->entity_raw->jobs.permitted_labor[labor];
1386}
1387
1388bool Units::setLaborValidity(df::unit_labor labor, bool isValid) {
1389 if (!is_valid_enum_item(labor) || labor == unit_labor::NONE)

Callers

nothing calls this directly

Calls 2

is_valid_enum_itemFunction · 0.85
findFunction · 0.50

Tested by

no test coverage detected