GithubHelp home page GithubHelp logo

Comments (6)

Brockengespenst avatar Brockengespenst commented on June 3, 2024

This seems to be related to the amount of update steps that are done between drawing a frame. I played around with the steps variable in void ScreenManager::loop_iter(). If hardcoded set to 1, I was not able to reproduce the crash. Another test with step = 16; it crashed on the first try.

from supertux.

tobbi avatar tobbi commented on June 3, 2024

Potentially having get_sector() return a pointer to a sector instead of a reference could fix this issue but then we'd have to add null checks to every function calling that.

Does anyone have a better idea?

from supertux.

Vankata453 avatar Vankata453 commented on June 3, 2024

I think we should just make sure a sector is always available, since initialization. It's not supposed to not have a current sector set.

from supertux.

Brockengespenst avatar Brockengespenst commented on June 3, 2024

Maybe I found a solution. The worldmap camera is a member of WorldMapSector, so it belongs to a specific worldmap sector. When WorldMapSector::update() invokes m_camera->update(), Camera::update() calls Camera::get_camera_pos_for_tux() which uses WorldMapSector::current() that refers to the newly created WorldMap with m_sector being nullptr. Instead we could pass the WorldMapSector as argument to Camera's constructor, store it as member (reference) and replace the calls to WorldMapSector::current() with the member.
A first quick and dirty test seems to work.

But in general I agree to @Vankata453 , that having always a valid current sector would be preferrable.

from supertux.

Vankata453 avatar Vankata453 commented on June 3, 2024

@Brockengespenst Thanks for checking this out! Would you like to create a PR for this?

from supertux.

Brockengespenst avatar Brockengespenst commented on June 3, 2024

Sure, no problem. Please check #2921.

from supertux.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.