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])`` * ``dfhack.buildings.getRoomDescription(building[, unit])``
If the building is a room, returns a description including quality modifiers, e.g. "Royal Bedroom". If the building is a room, returns a description including quality modifiers,
Otherwise, returns an empty string. 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 High-level
~~~~~~~~~~ ~~~~~~~~~~

@ -2440,7 +2440,7 @@ static const LuaWrapper::FunctionReg dfhack_buildings_module[] = {
WRAPM(Buildings, isPenPasture), WRAPM(Buildings, isPenPasture),
WRAPM(Buildings, isPitPond), WRAPM(Buildings, isPitPond),
WRAPM(Buildings, isActive), WRAPM(Buildings, isActive),
WRAPM(Buildings, completebuild), WRAPM(Buildings, completeBuild),
{ NULL, NULL } { 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 * 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; return true;
} }
void Buildings::completebuild(df::building* bld, char in_play) void Buildings::completeBuild(df::building* bld)
{ {
CHECK_NULL_POINTER(bld); CHECK_NULL_POINTER(bld);
auto fp = df::global::buildingst_completebuild; auto fp = df::global::buildingst_completebuild;
CHECK_NULL_POINTER(fp); 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)>; using FT = std::function<void(df::building* bld, char)>;
auto f = reinterpret_cast<FT*>(fp); auto f = reinterpret_cast<FT*>(fp);
(*f)(bld, in_play); (*f)(bld, in_play);