dfhack icon indicating copy to clipboard operation
dfhack copied to clipboard

Creating gem windows using the planner don't add value to rooms

Open LoXyO-lab opened this issue 11 months ago • 7 comments

As the title says. Creating gem windows using the DFHack planner interface won't add any value to the room it is built in, both when letting the program choose or using the filter. Whereas using the vanilla interface to use lastest materials, closest materials or manually select the gems will properly add value.

To replicate :

  • Create two small guildhalls and assign a legendary broker to see the exact value
  • Dig/create gems and cut them if needed
  • Build gem windows in one using the DFHack planner and the vanilla interface in the other
  • Read the values of both rooms

LoXyO-lab avatar Jan 02 '26 11:01 LoXyO-lab

It sounds like the Buildings module is failing to place new buildings "under mastery" (i.e. making them parts of rooms).

quietust avatar Jan 02 '26 20:01 quietust

If that is indeed the issue, then I suppose this also warrants a fixup tool/routine. After all, this will probably mean that lots of forts that have been using DFHack for a while will have a lot of furniture that is not part of the respective rooms/zones, right?

chdoc avatar Jan 17 '26 09:01 chdoc

I managed to reproduce the problem, and I can confirm that for gem windows constructed using the planner overlay neither the building_window_gemst.relations entry nor the building_civzonest.contained_buildings entry in the zone are present. When the gem window is constructed using the vanilla interface, these point to the respective other. The same happens for other furniture, even if it is constructed using planneroverlay.

The root cause seems to be the following check in Buildings.cpp:

static bool is_suitable_building_for_zoning(df::building* bld)
{
    return bld->canMakeRoom();
}

because canMakeRoom() returns true for things like chairs but returns false for gem windows.

chdoc avatar Feb 22 '26 19:02 chdoc

Based on the logic I see in version 52.05 (which I'm currently analyzing in depth), I suspect this is a bug in DF itself whereby the order matters - if you designate a room and then add a window to it, it will probably contribute to its value, but if you place the window and then designate the room around it, it probably won't.

quietust avatar Feb 22 '26 19:02 quietust

Based on the logic I see in version 52.05 (which I'm currently analyzing in depth), I suspect this is a bug in DF itself whereby the order matters - if you designate a room and then add a window to it, it will probably contribute to its value, but if you place the window and then designate the room around it, it probably won't.

I have tried this with guild halls, and I can confirm that this is exactly what happens

chdoc avatar Feb 24 '26 18:02 chdoc

I've also noticed similar behavior with bedrooms and with tombs.

ab9rf avatar Feb 24 '26 21:02 ab9rf

@LoXyO-lab Fixed in #5926. Planned gem and glass windows are now linked in both directions with existing rooms and zones. The PR includes in engine coverage for both window types.

Alistair-Afton avatar Sep 16 '26 15:09 Alistair-Afton