tresinformal / drakkar

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

`game::get_game_options` is a pleonasm #472

Closed richelbilderbeek closed 2 years ago

richelbilderbeek commented 2 years ago

Currently, one can write:

const game g;
const game_options options = g.get_game_options();

The problem is that game::get_game_options is a pleonasm; i.e. it says the same thing twice. This is un-English and needlessly verbose.

Better would be to be able to write:

const game g;
const game_options options = g.get_options();

There is a test for this:

//#define FIX_ISSUE_472
#ifdef FIX_ISSUE_472
  {
    const game g;
    // Only check if this compiles, we do not care about the RNG seed
    assert(g.get_options().get_rng_seed() == 0
      || g.get_options().get_rng_seed() != 0);
  }
#endif

Make the test work.

This is very simple if you know this trick: do right-mouse button, click on 'Refactor' and then 'Rename symbol under cursor'. This will allow you to also fix the other calls to game::get_game_options:

Screenshot from 2022-01-26 16-55-43

Of course, if some calls to get_game_options remain (including in tests), fix these.