tresinformal / drakkar

The tresinformal video game called 'Drakkar'

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

A game is over when the time limit is reached

TheoPannetier opened this issue · comments

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

  • Test is ready and on develop
//#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

fixed by #689