It's been known for a while that the magic roof adding functionality doesn't create everything it should create (e.g. #71909).
Attach save file
See #71909
Steps to reproduce
See #71909
Expected behavior
Treetops and roofs should be generated when they should be present.
Screenshots
No response
Versions and configuration
OS: Windows
OS Version: 10.0.19045.4291 (22H2)
Game Version: 0.G-9224-gadd3cfaf25-dirty [64-bit]
Graphics Version: Tiles
Game Language: System language []
Mods loaded: [
Dark Days Ahead [dda],
Disable NPC Needs [no_npc_food],
Portal Storms Ignore NPCs [personal_portal_storms],
Slowdown Fungal Growth [no_fungal_growth]
]
"Dirty" because of my "fix" hack.
Additional context
I've been trying to figure out how this magic is (and isn't) invoked for quite some time.
I think I've finally found one reason, namely that the logic used most of the time never invokes it because most of the map loading in normal play is performed by map::shift (shift the reality bubble one submap at a time), and that operation calls the loadn operation that takes a tripoint parameter, not the one that takes a point, and it's the point parameter loadn which calls add_roofs...
I made a hack to replace the calls to the 3D version to the 2D one and then loaded a save and moved (on the map, not teleporting) to a nearby forest, and lo and behold, the trees now got their treetops generated (I tested the same thing before the hack, and the treetops were missing).
I also tried to the failing chicken coop livestock expansion construction, and the roof was now generated when climbing the roof of the evac shelter (I assume a submap boundary was crossed somewhere in the process, at least when climbing the roof: I don't expect the coop roof to appear without such a trigger).
The reason I'm writing a (new) bug report rather than submitting my hack as a PR is that I'm not sure the hack is the correct solution to the problem. It might well be that other parts of 'shift' should be adjusted, and it might be that some of the additional things the 2D loadn operation does shouldn't be performed in this context. And, of course, hacks never have unexpected side effects or performance implications...
Describe the bug
It's been known for a while that the magic roof adding functionality doesn't create everything it should create (e.g. #71909).
Attach save file
See #71909
Steps to reproduce
See #71909
Expected behavior
Treetops and roofs should be generated when they should be present.
Screenshots
No response
Versions and configuration
Additional context
I've been trying to figure out how this magic is (and isn't) invoked for quite some time.
I think I've finally found one reason, namely that the logic used most of the time never invokes it because most of the map loading in normal play is performed by map::shift (shift the reality bubble one submap at a time), and that operation calls the loadn operation that takes a tripoint parameter, not the one that takes a point, and it's the point parameter loadn which calls add_roofs...
I made a hack to replace the calls to the 3D version to the 2D one and then loaded a save and moved (on the map, not teleporting) to a nearby forest, and lo and behold, the trees now got their treetops generated (I tested the same thing before the hack, and the treetops were missing). I also tried to the failing chicken coop livestock expansion construction, and the roof was now generated when climbing the roof of the evac shelter (I assume a submap boundary was crossed somewhere in the process, at least when climbing the roof: I don't expect the coop roof to appear without such a trigger).
The reason I'm writing a (new) bug report rather than submitting my hack as a PR is that I'm not sure the hack is the correct solution to the problem. It might well be that other parts of 'shift' should be adjusted, and it might be that some of the additional things the 2D loadn operation does shouldn't be performed in this context. And, of course, hacks never have unexpected side effects or performance implications...