diff --git a/docs/dev/Lua API.rst b/docs/dev/Lua API.rst index 730ad009f..6863fc409 100644 --- a/docs/dev/Lua API.rst +++ b/docs/dev/Lua API.rst @@ -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 ~~~~~~~~~~ diff --git a/library/LuaApi.cpp b/library/LuaApi.cpp index 93291592d..361042c20 100644 --- a/library/LuaApi.cpp +++ b/library/LuaApi.cpp @@ -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 } }; diff --git a/library/include/modules/Buildings.h b/library/include/modules/Buildings.h index 6fbe0d6e1..837b5b00e 100644 --- a/library/include/modules/Buildings.h +++ b/library/include/modules/Buildings.h @@ -293,6 +293,6 @@ DFHACK_EXPORT bool getCageOccupants(df::building_cagest *cage, std::vector &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; auto f = reinterpret_cast(fp); (*f)(bld, in_play);