diff options
author | Robert Vollmert <rvollmert@gmx.net> | 2009-10-23 19:35:20 +0200 |
---|---|---|
committer | Robert Vollmert <rvollmert@gmx.net> | 2009-10-23 20:30:14 +0200 |
commit | 8cc7f8f9a7940798f851d0e6b06195858589159d (patch) | |
tree | 58036c94b8c0c71ae8300ca8eaa1be0299e6ba92 /crawl-ref/source | |
parent | 4c378295ed83f92f9b7fcbd71f1d2c1a0ad48744 (diff) | |
download | crawl-ref-8cc7f8f9a7940798f851d0e6b06195858589159d.tar.gz crawl-ref-8cc7f8f9a7940798f851d0e6b06195858589159d.zip |
Renumber species_type starting from 0.
It now behaves like the other enums (e.g. job_type). I hope I
got all places where SP_HUMAN == 1 was assumed.
Diffstat (limited to 'crawl-ref/source')
-rw-r--r-- | crawl-ref/source/acr.cc | 9 | ||||
-rw-r--r-- | crawl-ref/source/debug.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/enum.h | 2 | ||||
-rw-r--r-- | crawl-ref/source/ghost.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/newgame.cc | 2 | ||||
-rw-r--r-- | crawl-ref/source/skills2.cc | 4 | ||||
-rw-r--r-- | crawl-ref/source/species.cc | 10 |
7 files changed, 16 insertions, 15 deletions
diff --git a/crawl-ref/source/acr.cc b/crawl-ref/source/acr.cc index 507d840c85..3349f7f0fe 100644 --- a/crawl-ref/source/acr.cc +++ b/crawl-ref/source/acr.cc @@ -4283,21 +4283,22 @@ static void _compile_time_asserts() // disturbed accidentally. COMPILE_CHECK(SK_UNARMED_COMBAT == 19 , c1); COMPILE_CHECK(SK_EVOCATIONS == 39 , c2); - COMPILE_CHECK(SP_VAMPIRE == 31 , c3); + COMPILE_CHECK(SP_VAMPIRE == 30 , c3); COMPILE_CHECK(SPELL_DEBUGGING_RAY == 103 , c4); COMPILE_CHECK(SPELL_PETRIFY == 156 , c5); COMPILE_CHECK(NUM_SPELLS == 201 , c6); //jmf: NEW ASSERTS: we ought to do a *lot* of these - COMPILE_CHECK(NUM_JOBS < JOB_UNKNOWN , c7); + COMPILE_CHECK(NUM_SPECIES < SP_UNKNOWN , c7); + COMPILE_CHECK(NUM_JOBS < JOB_UNKNOWN , c8); // Make sure there's enough room in you.unique_items to hold all // the unrandarts. - COMPILE_CHECK(NO_UNRANDARTS < MAX_UNRANDARTS, c8); + COMPILE_CHECK(NO_UNRANDARTS < MAX_UNRANDARTS, c9); // Non-artefact brands and unrandart indexes both go into // item.special, so make sure they don't overlap. - COMPILE_CHECK((int) NUM_SPECIAL_WEAPONS < (int) UNRAND_START, c9); + COMPILE_CHECK((int) NUM_SPECIAL_WEAPONS < (int) UNRAND_START, c10); // Also some runtime stuff; I don't know if the order of branches[] // needs to match the enum, but it currently does. diff --git a/crawl-ref/source/debug.cc b/crawl-ref/source/debug.cc index f2bf672f85..3b3c269f29 100644 --- a/crawl-ref/source/debug.cc +++ b/crawl-ref/source/debug.cc @@ -240,7 +240,7 @@ void wizard_change_species( void ) species_type sp = SP_UNKNOWN; - for (i = SP_HUMAN; i < NUM_SPECIES; ++i) + for (i = 0; i < NUM_SPECIES; ++i) { const species_type si = static_cast<species_type>(i); const std::string sp_name = diff --git a/crawl-ref/source/enum.h b/crawl-ref/source/enum.h index a32613eb8e..25f8840f68 100644 --- a/crawl-ref/source/enum.h +++ b/crawl-ref/source/enum.h @@ -2664,7 +2664,7 @@ enum speed_type enum species_type { - SP_HUMAN = 1, + SP_HUMAN, SP_HIGH_ELF, SP_DEEP_ELF, SP_SLUDGE_ELF, diff --git a/crawl-ref/source/ghost.cc b/crawl-ref/source/ghost.cc index cbca0a09f1..bc7a741bf3 100644 --- a/crawl-ref/source/ghost.cc +++ b/crawl-ref/source/ghost.cc @@ -870,7 +870,7 @@ bool debug_check_ghosts() return (false); if (ghost.brand < SPWPN_NORMAL || ghost.brand > MAX_PAN_LORD_BRANDS) return (false); - if (ghost.species < SP_HUMAN || ghost.species >= NUM_SPECIES) + if (ghost.species < 0 || ghost.species >= NUM_SPECIES) return (false); if (ghost.job < JOB_FIGHTER || ghost.job >= NUM_JOBS) return (false); diff --git a/crawl-ref/source/newgame.cc b/crawl-ref/source/newgame.cc index 464fb3e58e..b69c5468e5 100644 --- a/crawl-ref/source/newgame.cc +++ b/crawl-ref/source/newgame.cc @@ -248,7 +248,7 @@ static void _pick_random_species_and_class( bool unrestricted_only ) job_type job = JOB_UNKNOWN; // For each valid (species, class) choose one randomly. - for (int sp = SP_HUMAN; sp < NUM_SPECIES; sp++) + for (int sp = 0; sp < NUM_SPECIES; sp++) { // We only want draconians counted once in this loop... // We'll add the variety lower down -- bwr diff --git a/crawl-ref/source/skills2.cc b/crawl-ref/source/skills2.cc index f701458b28..30f0c2dbc6 100644 --- a/crawl-ref/source/skills2.cc +++ b/crawl-ref/source/skills2.cc @@ -146,7 +146,7 @@ const char *martial_arts_titles[6] = // Traditionally, Spellcasting and In/Evocations formed the exceptions here: // Spellcasting skill was more expensive with about 130%, the other two got // a discount with about 75%. -const int spec_skills[ NUM_SPECIES ][40] = +const int spec_skills[NUM_SPECIES][40] = { { // SP_HUMAN 100, // SK_FIGHTING @@ -2145,7 +2145,7 @@ unsigned int skill_exp_needed(int lev) int species_skills(int skill, species_type species) { - return spec_skills[species - 1][skill]; + return spec_skills[species][skill]; } void wield_warning(bool newWeapon) diff --git a/crawl-ref/source/species.cc b/crawl-ref/source/species.cc index f5ceb28751..02cc3f4c38 100644 --- a/crawl-ref/source/species.cc +++ b/crawl-ref/source/species.cc @@ -69,7 +69,7 @@ species_type get_species(const int index) } static const char * Species_Abbrev_List[NUM_SPECIES] = - { "XX", "Hu", "HE", "DE", "SE", "MD", "Ha", + { "Hu", "HE", "DE", "SE", "MD", "Ha", "HO", "Ko", "Mu", "Na", "Og", "Tr", // the draconians "Dr", "Dr", "Dr", "Dr", "Dr", "Dr", "Dr", "Dr", "Dr", "Dr", @@ -129,7 +129,7 @@ int get_species_index_by_name( const char *name ) const char *get_species_abbrev(species_type which_species) { - ASSERT(which_species > 0 && which_species < NUM_SPECIES); + ASSERT(which_species >= 0 && which_species < NUM_SPECIES); return (Species_Abbrev_List[which_species]); } @@ -139,7 +139,7 @@ species_type get_species_by_abbrev(const char *abbrev) { int i; COMPILE_CHECK(ARRAYSZ(Species_Abbrev_List) == NUM_SPECIES, c1); - for (i = SP_HUMAN; i < NUM_SPECIES; i++) + for (i = 0; i < NUM_SPECIES; i++) { if (tolower(abbrev[0]) == tolower(Species_Abbrev_List[i][0]) && tolower(abbrev[1]) == tolower(Species_Abbrev_List[i][1])) @@ -168,7 +168,7 @@ species_type str_to_species(const std::string &species) return SP_UNKNOWN; // first look for full name (e.g. Green Draconian) - for (int i = SP_HUMAN; i < NUM_SPECIES; ++i) + for (int i = 0; i < NUM_SPECIES; ++i) { sp = static_cast<species_type>(i); if (species == species_name(sp, 10)) @@ -176,7 +176,7 @@ species_type str_to_species(const std::string &species) } // nothing found, try again with plain name - for (int i = SP_HUMAN; i < NUM_SPECIES; ++i) + for (int i = 0; i < NUM_SPECIES; ++i) { sp = static_cast<species_type>(i); if (species == species_name(sp, 1)) |