Skip to content

Pressing p or SPACE doesn't pause the replay #23

Description

@shedatc

The is_paused variable in the update() method of ui_functions seems to be ignored.

I tried to add bool is_paused to the replay_state struct in the hope of being able to toggle it from update() and use it to from replay_functions::next_frame() to just skip frames but with no luck :/

In ui.h:

void update() {
    …
    if (e.sym == SDLK_SPACE || e.sym == SDLK_p) {
	is_paused = !is_paused;
	replay_st.is_paused = !replay_st.is_paused;
    …
}

In replay.h:

struct replay_state {
    …
    bool is_paused = false;
};

struct replay_functions: action_functions {
    …
    void next_frame() {
	if (replay_st.is_paused) return;
	…
    }
    …

The debugger confirms that two different replay_state structures seems to be allocated, i.e., current_replay_state's address doesn't match replay_st's one.

I'm only starting to try to grok this piece of code so any hint would be very much appreciated :D

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions