Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ascending a staircase on z-level 9 crashes the game #63276

Closed
Qrox opened this issue Jan 25, 2023 · 2 comments · Fixed by #71306
Closed

Ascending a staircase on z-level 9 crashes the game #63276

Qrox opened this issue Jan 25, 2023 · 2 comments · Fixed by #71306
Labels
<Crash / Freeze> Fatal bug that results in hangs or crashes.

Comments

@Qrox
Copy link
Contributor

Qrox commented Jan 25, 2023

Describe the bug

I tried to build stairs to z-level 10 to utilize the higher wind speed for wind power generation. However, aftering building a staircase on z-level 9 and ascending it, the game crashed.

Steps to reproduce

  1. Build a staircase on z-level 9 leading to z-level 10
  2. Try to ascend the staircase
  3. Game crashes

Expected behavior

The game does not crash, and the player character either moves to z-level 10 or stays at z-level 9 (with a message stating 9 is the highest possible z-level).

Also, the code and comments here should be changed if the highest z-level is 9 rather than 10.

// Number of z-levels below 0 (not including 0).
static constexpr int OVERMAP_DEPTH = 10;
// Number of z-levels above 0 (not including 0).
static constexpr int OVERMAP_HEIGHT = 10;
// Total number of z-levels.
static constexpr int OVERMAP_LAYERS = 1 + OVERMAP_DEPTH + OVERMAP_HEIGHT;

#60705 fixed a similar crash related to ascending with helicoptor, but that didn't seem to consider non-vehicle movement.

Screenshots

No response

Versions and configuration

c033542

Additional context

crash.log

@Qrox Qrox added the (S1 - Need confirmation) Report waiting on confirmation of reproducibility label Jan 25, 2023
@PatrikLundell
Copy link
Contributor

The game also shouldn't allow you to build something that you'd reasonably would assume would allow you to access a level that's actually out of bounds. This naturally means stairs and fixed ladders, but I'd argue it should also mean anything that provides a roof. It probably should also block you from placing a step ladder at the top level (with an appropriate error message).

@NetSysFire
Copy link
Member

 DEBUG    : Tried to move outside allowed range of z-levels

 FUNCTION : void game::vertical_move(int, bool, bool)
 FILE     : src/game.cpp
 LINE     : 11278
 VERSION  : 0.F-13110-gb96b791cfec

When I try the easier version of going down on -10, deep in the earth.

I tried your version by placing stuff via the debug overmap editor and apparently pressed < one too many times and it crashed.

STACK TRACE:

    cataclysm-tiles(debug_write_backtrace(std::ostream&)+0x42) [0x55d07cbd0b79]
    cataclysm-tiles(+0xd02873) [0x55d07cbae873]
    cataclysm-tiles(+0xd02b04) [0x55d07cbaeb04]
    /usr/lib/libc.so.6(+0x38a00) [0x7f5f359b2a00]
    /usr/lib/libc.so.6(+0x8864c) [0x7f5f35a0264c]
    /usr/lib/libc.so.6(gsignal+0x18) [0x7f5f359b2958]
    /usr/lib/libc.so.6(abort+0xd7) [0x7f5f3599c53d]
    /usr/lib/libstdc++.so.6(+0xd2112) [0x7f5f35d3d112]
    cataclysm-tiles(map::get_cache(int) const+0xc5) [0x55d07ca22bb3]
    cataclysm-tiles(map::build_sunlight_cache(int)+0x63) [0x55d07cfff425]
    cataclysm-tiles(map::generate_lightmap(int)+0x197) [0x55d07d001f83]
    cataclysm-tiles(map::build_map_cache(int, bool)+0x631) [0x55d07d07ed0b]
    cataclysm-tiles(game::draw(ui_adaptor&)+0x8b) [0x55d07cd38d81]
    cataclysm-tiles(ui_adaptor::redraw_invalidated()+0x201) [0x55d07d6c96df]
    cataclysm-tiles(editmap::edit()+0xbdc) [0x55d07cc60070]
    cataclysm-tiles(game::look_debug()+0x3d) [0x55d07cd25bd1]
    cataclysm-tiles(debug_menu::debug()+0x1159) [0x55d07cc00dc6]
    cataclysm-tiles(game::do_regular_action(action_id&, avatar&, cata::optional<tripoint> const&)+0x3e4b) [0x55d07cdc87c7]
    cataclysm-tiles(game::handle_action()+0xb2f) [0x55d07cdca535]
    cataclysm-tiles(do_turn()+0x6de) [0x55d07cc46287]

    Attempting to repeat stack trace using debug symbols…
    debug_write_backtrace(std::ostream&)
    ??:?
    init_crash_handlers()
    ??:?
    init_crash_handlers()
    ??:?
    ??
    ??:0
    ??
    ??:0
    ??
    ??:0
    ??
    ??:0
    ??
    ??:0
    map::get_cache(int) const
    ??:?
    map::build_sunlight_cache(int)
    ??:?
    map::generate_lightmap(int)
    ??:?
    map::build_map_cache(int, bool)
    ??:?
    game::draw(ui_adaptor&)
    ??:?
    ui_adaptor::redraw_invalidated()
    ??:?
    editmap::edit()
    ??:?
    game::look_debug()
    ??:?
    debug_menu::debug()
    ??:?
    game::do_regular_action(action_id&, avatar&, cata::optional<tripoint> const&)
    ??:?
    game::handle_action()
    ??:?
    do_turn()
    ??:?

@NetSysFire NetSysFire added <Crash / Freeze> Fatal bug that results in hangs or crashes. and removed (S1 - Need confirmation) Report waiting on confirmation of reproducibility labels Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
<Crash / Freeze> Fatal bug that results in hangs or crashes.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants