tresinformal / drakkar

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

A game is over when the time limit is reached #682

Closed TheoPannetier closed 1 year ago

TheoPannetier commented 1 year ago

Depends

Context

The game needs to be able to check itself for when it is time to finish. The game should terminate when the game hits the time limit.

Test

//#define FIX_ISSUE_682
    #ifdef FIX_ISSUE_682
    // (682) A game is over when the time limit is exceeded
    {
      const int time_limit = 10;
      const game_options g_options{3,
                            false,
                            get_random_kam(),
                            get_random_kam(),
                            get_random_kam(),
                            environment_type(),
                            time_limit
                           };
      game g{g_options};
      for (int i = 0; i < time_limit; i++)
        {
          assert(!g.is_over());
          g.tick();
        }
      assert(g.is_over());
    }
    #endif // FIX_ISSUE_682
EvoLandEco commented 1 year ago

fixed by #689