buildings: make windows masterable like other demandable furnishings - #5926
Alistair-Afton wants to merge 1 commit into
Conversation
|
I'm holding this one until I'm convinced that this is the correct approach. This basically bypasses the DF I'm concerned that this is papering over a defect elsewhere, either in DF or DFHack, and I want to understand what is going on before committing to this fix |
52177b1 to
72fe370
Compare
|
Did some in-game verification of what vanilla actually does, on top of what chdoc already confirmed in #5693: What vanilla does (confirmed empirically):
Why So bypassing |
|
So after looking into this a bit more, the issue appears to me to be that there's a vanilla bug here, in that whether certain building types can be added to a room varies depending on whether the room or the building was placed first. On one code path, @quietust did recently point out on Discord that windows are the only building that a noble can demand added to their room which is not masterable. This suggests to me that the implementation of the @Putnam3145, any thoughts here? |
|
Let me add that if our conclusion is that windows should be masterable, we should resolve this by using |
72fe370 to
d404edf
Compare
|
Reworked per your suggestion — the fix is now a vmethod interpose instead of a bypass in the zoning gate. Changes in d404edf:
Verified live on 53.16: a planned |
Gem and glass windows are the only buildings nobles can demand in their rooms whose masterablebuilding vmethod returns false. The game is itself inconsistent: placing a building inside an existing room links it unconditionally, while designating a room over an existing building is gated by the vmethod, so window-in-room linking was order-dependent and DFHack-placed windows were never linked at all. Interpose canMakeRoom on the two concrete window subclasses to return true, fixing all call paths (vanilla and DFHack) uniformly. Covers both link directions with fortress tests. Fixes DFHack#5693.
d404edf to
2e58a0b
Compare
|
Because our conclusion that this is a DF bug may be at least somewhat contentious, this should be a toggleable tweak. It can default to on via the control panel, but player should have the option to turn it off if they want the vanilla behavior. |
For what it's worth, I believe that description is incorrect - we originally named the vmethod "canMakeRoom", but Toady's name "masterablebuilding" makes it more clear that it's actually "can this building become subordinate to another building" (i.e. can it become part of a room). Background: in 0.47 and earlier, rooms were designated from specific buildings (e.g. bedrooms from a bed, dining rooms from a table, offices from a chair), but 50.01 got rid of that and made civzones the "parent" building in all cases. |
Summary
building_windowst::masterablebuildingreturns false even though windows are the only noble-demandable room furnishing that is not masterablecanMakeRoomonbuilding_window_gemstandbuilding_window_glassst(the abstract base's vtable cannot be hooked), so windows can be made part of a room on all code pathsFixes #5693.
Testing
test -d C:/Users/Alistair Afton/source/repos/dfhack/test -t 'window'— 4/4 passcanMakeRoom() == trueand is linked in both directions (bld.relations+zone.contained_buildings)