From 8cc7f8f9a7940798f851d0e6b06195858589159d Mon Sep 17 00:00:00 2001 From: Robert Vollmert Date: Fri, 23 Oct 2009 19:35:20 +0200 Subject: 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. --- crawl-ref/source/species.cc | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'crawl-ref/source/species.cc') 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(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(i); if (species == species_name(sp, 1)) -- cgit v1.2.3-54-g00ecf