Add missing Unit::isDiplomat

Fixes #1324
develop
Pauli 2018-06-29 16:13:56 +03:00
parent 3c2bfb6f47
commit c39a882b57
4 changed files with 12 additions and 0 deletions

@ -37,6 +37,9 @@ changelog.txt uses a syntax similar to RST, with a few special sequences:
================================================================================ ================================================================================
# Future # Future
## Fixes
- `fix/dead-units`: Fixed script trying to use missing isDiplomat function
# 0.44.11-alpha1 # 0.44.11-alpha1
## Structures ## Structures

@ -1626,6 +1626,7 @@ static const LuaWrapper::FunctionReg dfhack_units_module[] = {
WRAPM(Units, isMale), WRAPM(Units, isMale),
WRAPM(Units, isFemale), WRAPM(Units, isFemale),
WRAPM(Units, isMerchant), WRAPM(Units, isMerchant),
WRAPM(Units, isDiplomat),
WRAPM(Units, isForest), WRAPM(Units, isForest),
WRAPM(Units, isMarkedForSlaughter), WRAPM(Units, isMarkedForSlaughter),
WRAPM(Units, isTame), WRAPM(Units, isTame),

@ -139,6 +139,7 @@ DFHACK_EXPORT bool isTamable(df::unit* unit);
DFHACK_EXPORT bool isMale(df::unit* unit); DFHACK_EXPORT bool isMale(df::unit* unit);
DFHACK_EXPORT bool isFemale(df::unit* unit); DFHACK_EXPORT bool isFemale(df::unit* unit);
DFHACK_EXPORT bool isMerchant(df::unit* unit); DFHACK_EXPORT bool isMerchant(df::unit* unit);
DFHACK_EXPORT bool isDiplomat(df::unit* unit);
DFHACK_EXPORT bool isForest(df::unit* unit); DFHACK_EXPORT bool isForest(df::unit* unit);
DFHACK_EXPORT bool isMarkedForSlaughter(df::unit* unit); DFHACK_EXPORT bool isMarkedForSlaughter(df::unit* unit);
DFHACK_EXPORT bool isTame(df::unit* unit); DFHACK_EXPORT bool isTame(df::unit* unit);

@ -1476,6 +1476,13 @@ bool Units::isMerchant(df::unit* unit)
return unit->flags1.bits.merchant == 1; return unit->flags1.bits.merchant == 1;
} }
bool Units::isDiplomat(df::unit* unit)
{
CHECK_NULL_POINTER(unit);
return unit->flags1.bits.diplomat == 1;
}
bool Units::isForest(df::unit* unit) bool Units::isForest(df::unit* unit)
{ {
CHECK_NULL_POINTER(unit); CHECK_NULL_POINTER(unit);