tresinformal / drakkar

The tresinformal video game called 'Drakkar'
GNU General Public License v3.0
11 stars 4 forks source link

The game stops ticking and actions are not processed when game is over #716

Open TheoPannetier opened 1 year ago

TheoPannetier commented 1 year ago

Depends

Context

Once the game has reached the time limit, it should not be able to tick any further, and further input actions should no longer be processed. For example, players should not move forward despite being given the instructions to do so.

Test

// The game is already ticked until over
    // (716) Game no longer ticks after game is over
    const int n_ticks = g.get_n_ticks();
    g.tick();
    assert(g.get_n_ticks() == n_ticks);

    // and as a result, no further actions are processed
    // for example, players are not moved
    player& p = g.get_player(0); // ref to player one
    const coordinate initial_position = p.get_position();

    add_action(p, action_type::accelerate_forward);
    g.tick();
    assert(p.get_position() == initial_position);