Skip to content

Commit

Permalink
Merge branch 'develop' into remove-old-trackstop
Browse files Browse the repository at this point in the history
  • Loading branch information
myk002 authored Nov 7, 2023
2 parents 248a592 + 8a24166 commit 3c5bc26
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 2 deletions.
2 changes: 2 additions & 0 deletions docs/changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +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)
- ``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

Expand Down
1 change: 1 addition & 0 deletions library/LuaApi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 }
};

Expand Down
5 changes: 5 additions & 0 deletions library/include/modules/Buildings.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
12 changes: 12 additions & 0 deletions library/modules/Buildings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
7 changes: 6 additions & 1 deletion library/modules/Gui.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,13 @@ DEFINE_GET_FOCUS_STRING_HANDLER(dwarfmode)
case df::view_sheet_type::BUILDING:
if (game->main_interface.view_sheets.linking_lever)
newFocusString = baseFocus + "/LinkingLever";
else if (auto bld = df::building::find(game->main_interface.view_sheets.viewing_bldid))
else if (auto bld = df::building::find(game->main_interface.view_sheets.viewing_bldid)) {
newFocusString += '/' + enum_item_key(bld->getType());
if (bld->getType() == df::enums::building_type::Trap) {
df::building_trapst* trap = strict_virtual_cast<df::building_trapst>(bld);
newFocusString += '/' + enum_item_key(trap->trap_type);
}
}
break;
default:
break;
Expand Down
2 changes: 1 addition & 1 deletion scripts

0 comments on commit 3c5bc26

Please sign in to comment.