Closed RedPine91 closed 5 months ago
hi, thanks for the bug report.
I no longer have the save file for this issue, but I found a similar (if not the same) issue in my latest save. I can see about getting a that save file uploaded. See #4257.
Was able to reproduce this bug and done some code investigation. This probably happens due to deep water having flag "GOES_DOWN" so it is considered as viable target for search for stairs leading back down. I'm not very into C++, so maybe somebody can validate and fix: in src/game.cpp:
// We did not find stairs directly above or below, so search the map for them
if( !stairs.has_value() ) {
for( const tripoint &dest : m.points_in_rectangle( omtile_align_start, omtile_align_end ) ) {
if( rl_dist( u.pos(), dest ) <= best &&
( ( going_down_1 && mp.has_flag( TFLAG_GOES_UP, dest ) ) ||
( going_up_1 && ( mp.has_flag( TFLAG_GOES_DOWN, dest ) ||
mp.ter( dest ) == t_manhole_cover ) ) ||
( ( movez == 2 || movez == -2 ) && mp.ter( dest ) == t_elevator ) ) ) {
stairs.emplace( dest );
best = rl_dist( u.pos(), dest );
}
}
}
We can see, any tile with "TFLAG_GOES_DOWN" considered as proper destination point.
Possible Solution:
To exclude tiles with tag "DEEP_WATER" from search with addition of check for absence of this tag; And/or To add additional check like existing one:
if( movez > 0 ) {
if( !mp.has_flag( "GOES_DOWN", *stairs ) ) {
if( !query_yn( _( "You may be unable to return back down these stairs. Continue up?" ) ) ) {
return std::nullopt;
}
}
but with check for deep water.
@VasinPA thank you for the investigation! would you also be interested in opening a PR?
@scarf005, Done: https://github.com/cataclysmbnteam/Cataclysm-BN/pull/4739 I have tested my solution, bug seems to be fixed
Describe the bug
Going downstairs worked as normal. After going down, using the upstairs sent me to a pool of deep water, instead of the downstairs I used to get down in the first place. This occurred in a Lab.
Steps To Reproduce
Go downstairs. Go upstairs. You are not on the downstairs you went down at.
This might not be reproducible on all maps. It is consistent on my save, and is likely the result of how this specific tile generated.
Screenshots
![Uploading DDABN01092004 downstairs notbugged.jpg…]() ![Uploading DDABN01092004 upstairs bug.jpg…]()
Versions and configuration
Additional context
No response