document native completeBuild function

and remove unneeded params
develop
Myk Taylor 2023-11-15 16:26:29 -08:00
parent afb47599c4
commit 648476e34d
No known key found for this signature in database
4 changed files with 15 additions and 6 deletions

@ -2178,10 +2178,16 @@ Low-level building creation functions:
* ``dfhack.buildings.getRoomDescription(building[, unit])``
If the building is a room, returns a description including quality modifiers, e.g. "Royal Bedroom".
Otherwise, returns an empty string.
If the building is a room, returns a description including quality modifiers,
e.g. "Royal Bedroom". Otherwise, returns an empty string.
The unit argument is passed through to DF and may modify the room's value depending on the unit given.
The unit argument is passed through to DF and may modify the room's value
depending on the unit given.
* ``dfhack.buildings.completeBuild(building)``
Complete an unconstructed or partially-constructed building and link it into
the world.
High-level
~~~~~~~~~~

@ -2440,7 +2440,7 @@ static const LuaWrapper::FunctionReg dfhack_buildings_module[] = {
WRAPM(Buildings, isPenPasture),
WRAPM(Buildings, isPitPond),
WRAPM(Buildings, isActive),
WRAPM(Buildings, completebuild),
WRAPM(Buildings, completeBuild),
{ NULL, NULL }
};

@ -293,6 +293,6 @@ DFHACK_EXPORT bool getCageOccupants(df::building_cagest *cage, std::vector<df::u
/**
* Finalizes a new building into the world
*/
DFHACK_EXPORT void completebuild(df::building* bld, char in_play);
DFHACK_EXPORT void completeBuild(df::building* bld);
}
}

@ -1708,13 +1708,16 @@ bool Buildings::getCageOccupants(df::building_cagest *cage, vector<df::unit*> &u
return true;
}
void Buildings::completebuild(df::building* bld, char in_play)
void Buildings::completeBuild(df::building* bld)
{
CHECK_NULL_POINTER(bld);
auto fp = df::global::buildingst_completebuild;
CHECK_NULL_POINTER(fp);
// whether to add to the IN_PLAY vector, which we always want to do
char in_play = 1;
using FT = std::function<void(df::building* bld, char)>;
auto f = reinterpret_cast<FT*>(fp);
(*f)(bld, in_play);