Repository navigation
Workers crossing a neighbouring room keep working in their own - #40
Merged
Merged
Conversation
… own A worker walking between spots in its room sometimes crosses a slab of another room: a bridge through the middle of a training room, the training room beside the workshop. get_room_creature_works_on() looked only at the room under the creature, so the job check saw a BRIDGE and the worker quit: "training: Room BRIDGE index 65 is not valid ROOM_ROLE_TRAIN_EXP" about a hundred times in a stable 5660 log, most of them imps the player had dropped in to train, plus workshop workers stepping onto the training room. A probe on the player's own save showed every one of them with its moveto position inside the room it was enrolled in, one slab from it. The room it works in (work_room_id) now wins while the creature is heading for a spot in it. Otherwise nothing changes: a creature carried or teleported elsewhere, or with no work room (a full room turns workers away), is judged by the room under it as before. The training partner checks use the same lookup, so a partner crossing the bridge is not "pretending to be in room" or taken to have left, and the training-post and workshop-post searches take the room the worker works in instead of looking it up under the creature: with the worker now allowed to stand on the bridge they would otherwise search the bridge. The temple's per-turn check is the same case. Measured on copies of the player's map30117 saves, a 5660 build against 5660 with this change (and 1863914, which it builds on), 40000 turns each with 12 imps put into the training room every 2500 turns: 9 and 37 such quits on 5660, none with the change. A staged U-shaped training room around a bridge on keeporig level 1 (alpha, 240 s, 8 trainees): 8 quits, every trainee gone within 30 s at level 1; with the change none, all 8 reached level 2.
creature_going_to_safety_for_toking() logged an ERRORLOG whenever a hurt imp had no lair and no route to its heart, 16 times in a stable 5660 log. The imp then rests where it stands, which is the right thing to do; the combat flee path already logs the same situation at SYNCDBG(8). Now this one does too.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A worker walking between spots in its room sometimes crosses a slab of another room. On the map in the stable 5660 log from 2026-10-19 (map30117) a bridge runs through the middle of the training room, and the workshop touches the training room. The job check looked only at the room under the creature, so it saw a BRIDGE and the worker quit its job:
training: Room BRIDGE index 65 is not valid ROOM_ROLE_TRAIN_EXPandmanufacturing: Room TRAINING index 16 ..., about a hundred times in that log. Most were imps the player had dropped in to train, who then wandered off. Upstream has the same check. The fix in 1863914 covered stepping off onto bare floor only.What was happening: a probe build of 5660 logged each quit on a copy of the player's save. Every one had its moveto position inside the room it was enrolled in, one slab away: a trainee walking from one side of the bridge to the other.
The change:
get_room_creature_works_on()returns the room the creature works in (work_room_id) while the creature is heading for a spot in it.work_room_idcan be 0), is judged by the room under it as before.A second commit turns
creature_going_to_safety_for_toking's "Couldn't get a flee position" ERRORLOG (16 in the same log) into SYNCDBG(8), as the combat flee path already logs it. The imp rests where it stands, as before.Measured:
qa-harness/stepoff_stage_1019.py), 8 trainees, 240 s.tests/run.shpasses, and the save format is unchanged (sizeof(struct Game) 53384602).Not tested: prisons, torture rooms, guard posts, libraries and lairs next to another room. They use the same lookup but no log showed them. Multiplayer was not tested either; the change uses only game state, so both sides compute the same thing.