Merge pull request #3900 from ab9rf/completebuild

implement `Buildings::completebuild` function export from DF
develop
Myk 2023-11-06 22:51:20 -08:00 committed by GitHub
commit 221f5eb610
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 1 deletions

@ -83,13 +83,14 @@ Template for new versions:
- ``Units::getReadableName``: now returns the *untranslated* name
- ``Burrows::setAssignedUnit``: now properly handles inactive burrows
- ``Gui::getMousePos``: now takes an optional ``allow_out_of_bounds`` parameter so coordinates can be returned for mouse positions outside of the game map (i.e. in the blank space around the map)
- Gui focus strings will now include the trap type for traps (e.g. dwarfmode/ViewSheets/BUILDING/Trap/StoneFallTrap)
- ``Buildings::completebuild``: used to link a newly created building into the world
## Lua
- ``dfhack.gui.revealInDwarfmodeMap``: gained ``highlight`` parameter to control setting the tile highlight on the zoom target
- ``dfhack.maps.getWalkableGroup``: get the walkability group of a tile
- ``dfhack.gui.getMousePos``: support new optional ``allow_out_of_bounds`` parameter
- ``gui.FRAME_THIN``: a panel frame suitable for floating tooltips
- ``dfhack.buildings.completebuild``: expose new module API
## Removed

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

@ -289,5 +289,10 @@ DFHACK_EXPORT df::building* findPenPitAt(df::coord coord);
* Returns the units currently in the given cage
*/
DFHACK_EXPORT bool getCageOccupants(df::building_cagest *cage, std::vector<df::unit*> &units);
/**
* Finalizes a new building into the world
*/
DFHACK_EXPORT void completebuild(df::building* bld, char in_play);
}
}

@ -1707,3 +1707,15 @@ bool Buildings::getCageOccupants(df::building_cagest *cage, vector<df::unit*> &u
return true;
}
void Buildings::completebuild(df::building* bld, char in_play)
{
CHECK_NULL_POINTER(bld);
auto fp = df::global::buildingst_completebuild;
CHECK_NULL_POINTER(fp);
using FT = std::function<void(df::building* bld, char)>;
auto f = reinterpret_cast<FT*>(fp);
(*f)(bld, in_play);
}