diff options
author | elliptic <hyperelliptical@gmail.com> | 2013-10-14 10:25:06 -0400 |
---|---|---|
committer | elliptic <hyperelliptical@gmail.com> | 2013-10-14 10:25:06 -0400 |
commit | c3caa5d9d42e23213a92ac0b8ca4fcb876f485e3 (patch) | |
tree | e5c42d2a235f66b4be8bf445d2470b92cc518cf8 /crawl-ref/source/newgame.cc | |
parent | c56989d61875c69422fb5ccd0aedbe26cf5e38c8 (diff) | |
download | crawl-ref-c3caa5d9d42e23213a92ac0b8ca4fcb876f485e3.tar.gz crawl-ref-c3caa5d9d42e23213a92ac0b8ca4fcb876f485e3.zip |
Clean up checks for disabled species/jobs when starting a new game.
It was possible to get around these checks in various ways. Hopefully this
stops all of those ways and will make it easier to maintain this code in the
future, since only is_species_valid_choice and is_job_valid_choice need
to be modified now.
Diffstat (limited to 'crawl-ref/source/newgame.cc')
-rw-r--r-- | crawl-ref/source/newgame.cc | 22 |
1 files changed, 4 insertions, 18 deletions
diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index 5f6ca5be65..b2b676b05f 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -152,20 +152,6 @@ static void _print_character_info(const newgame_def* ng) cprintf("%s\n", _welcome(ng).c_str()); } -// Determines if a species is a valid choice for a new game. -static bool _is_species_valid_choice(species_type species) -{ - if ((species == SP_LAVA_ORC || species == SP_DJINNI) - && Version::ReleaseType != VER_ALPHA) - { - return false; - } - - // Non-base draconians cannot be selected either. - return is_valid_species(species) - && !(species >= SP_RED_DRACONIAN && species < SP_BASE_DRACONIAN); -} - #ifdef ASSERTS static bool _species_is_undead(const species_type speci) { @@ -230,7 +216,7 @@ static void _resolve_species(newgame_def* ng, const newgame_def* ng_choice) // any valid species will do do ng->species = get_species(random2(ng_num_species())); - while (!_is_species_valid_choice(ng->species)); + while (!is_species_valid_choice(ng->species)); } else { @@ -334,7 +320,7 @@ static string _highlight_pattern(const newgame_def* ng) for (int i = 0; i < ng_num_species(); ++i) { const species_type species = get_species(i); - if (!_is_species_valid_choice(species)) + if (!is_species_valid_choice(species)) continue; if (is_good_combination(species, ng->job, true)) @@ -564,7 +550,7 @@ static void _construct_species_menu(const newgame_def* ng, ASSERT(menu != NULL); int items_in_column = 0; for (int i = 0; i < NUM_SPECIES; ++i) - if (_is_species_valid_choice((species_type)i)) + if (is_species_valid_choice((species_type)i)) items_in_column++; items_in_column = (items_in_column + 2) / 3; // Construct the menu, 3 columns @@ -576,7 +562,7 @@ static void _construct_species_menu(const newgame_def* ng, for (int i = 0, pos = 0; i < ng_num_species(); ++i, ++pos) { const species_type species = get_species(i); - if (!_is_species_valid_choice(species)) + if (!is_species_valid_choice(species)) { --pos; continue; |