summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicholas Feinberg <pleasingfung@gmail.com>2014-07-16 17:39:50 -0700
committerNicholas Feinberg <pleasingfung@gmail.com>2014-07-16 20:24:22 -0700
commitf74bb73639c84ddaac5cee442cb169e6cc6eb89c (patch)
tree934f511beacff5178ec1230ff5ed3ef754528f8f
parent307182f3a50d96af8ead8e9b5135e2e5e232ebaf (diff)
downloadcrawl-ref-f74bb73639c84ddaac5cee442cb169e6cc6eb89c.tar.gz
crawl-ref-f74bb73639c84ddaac5cee442cb169e6cc6eb89c.zip
Pull some functions into species.cc
-rw-r--r--crawl-ref/source/hiscores.cc9
-rw-r--r--crawl-ref/source/ng-setup.cc5
-rw-r--r--crawl-ref/source/species.cc20
-rw-r--r--crawl-ref/source/species.h3
4 files changed, 24 insertions, 13 deletions
diff --git a/crawl-ref/source/hiscores.cc b/crawl-ref/source/hiscores.cc
index 9ce4f08ac7..6e503f95d4 100644
--- a/crawl-ref/source/hiscores.cc
+++ b/crawl-ref/source/hiscores.cc
@@ -1897,11 +1897,6 @@ string scorefile_entry::death_place(death_desc_verbosity verbosity) const
return place;
}
-static bool _species_is_undead(int sp)
-{
- return sp == SP_MUMMY || sp == SP_GHOUL || sp == SP_VAMPIRE;
-}
-
/**
* Describes the cause of the player's death.
*
@@ -2113,7 +2108,7 @@ string scorefile_entry::death_description(death_desc_verbosity verbosity) const
case KILLED_BY_STUPIDITY:
if (terse)
desc += "stupidity";
- else if (_species_is_undead(race) || race == SP_GREY_DRACONIAN || race == SP_GARGOYLE)
+ else if (species_is_unbreathing(race))
desc += "Forgot to exist";
else
desc += "Forgot to breathe";
@@ -2146,7 +2141,7 @@ string scorefile_entry::death_description(death_desc_verbosity verbosity) const
{
if (num_runes > 0)
desc += "Got out of the dungeon";
- else if (_species_is_undead(race))
+ else if (species_is_undead(race))
desc += "Safely got out of the dungeon";
else
desc += "Got out of the dungeon alive";
diff --git a/crawl-ref/source/ng-setup.cc b/crawl-ref/source/ng-setup.cc
index d4aa8c7cdd..d7f23f4a3b 100644
--- a/crawl-ref/source/ng-setup.cc
+++ b/crawl-ref/source/ng-setup.cc
@@ -259,7 +259,6 @@ void give_basic_mutations(species_type speci)
you.mutation[MUT_POISON_RESISTANCE] = 1;
you.mutation[MUT_COLD_RESISTANCE] = 1;
you.mutation[MUT_NEGATIVE_ENERGY_RESISTANCE] = 3;
- you.mutation[MUT_UNBREATHING] = 1;
break;
case SP_DEEP_DWARF:
you.mutation[MUT_SLOW_HEALING] = 3;
@@ -273,13 +272,11 @@ void give_basic_mutations(species_type speci)
you.mutation[MUT_SAPROVOROUS] = 3;
you.mutation[MUT_CARNIVOROUS] = 3;
you.mutation[MUT_SLOW_HEALING] = 1;
- you.mutation[MUT_UNBREATHING] = 1;
break;
case SP_GARGOYLE:
you.mutation[MUT_PETRIFICATION_RESISTANCE] = 1;
you.mutation[MUT_NEGATIVE_ENERGY_RESISTANCE] = 1;
you.mutation[MUT_SHOCK_RESISTANCE] = 1;
- you.mutation[MUT_UNBREATHING] = 1;
you.mutation[MUT_ROT_IMMUNITY] = 1;
break;
case SP_TENGU:
@@ -300,7 +297,6 @@ void give_basic_mutations(species_type speci)
case SP_VAMPIRE:
you.mutation[MUT_FANGS] = 3;
you.mutation[MUT_ACUTE_VISION] = 1;
- you.mutation[MUT_UNBREATHING] = 1;
break;
case SP_FELID:
you.mutation[MUT_FANGS] = 3;
@@ -338,6 +334,7 @@ void give_basic_mutations(species_type speci)
// Some mutations out-sourced because they're
// relevant during character choice.
you.mutation[MUT_CLAWS] = species_has_claws(speci, true);
+ you.mutation[MUT_UNBREATHING] = species_is_unbreathing(speci);
// Necessary mostly for wizmode race changing.
you.mutation[MUT_COLD_BLOODED] = species_genus(speci) == GENPC_DRACONIAN;
diff --git a/crawl-ref/source/species.cc b/crawl-ref/source/species.cc
index 7d94cef9b2..ffd49e48af 100644
--- a/crawl-ref/source/species.cc
+++ b/crawl-ref/source/species.cc
@@ -249,10 +249,26 @@ int species_has_claws(species_type species, bool mut_level)
return 0;
}
+bool species_is_undead(species_type species)
+{
+ return species == SP_MUMMY || species == SP_GHOUL
+ || species == SP_VAMPIRE;
+}
+
+bool species_is_unbreathing(species_type species)
+{
+ return species == SP_GREY_DRACONIAN || species == SP_GARGOYLE
+ || species_is_undead(species);
+}
+
+bool species_can_swim(species_type species)
+{
+ return species == SP_OCTOPODE || species == SP_MERFOLK;
+}
+
bool species_likes_water(species_type species)
{
- return species == SP_MERFOLK || species == SP_GREY_DRACONIAN
- || species == SP_OCTOPODE;
+ return species_can_swim(species) || species == SP_GREY_DRACONIAN;
}
bool species_likes_lava(species_type species)
diff --git a/crawl-ref/source/species.h b/crawl-ref/source/species.h
index 1c328bc7aa..a81c6e4ded 100644
--- a/crawl-ref/source/species.h
+++ b/crawl-ref/source/species.h
@@ -11,6 +11,9 @@ enum genus_type
genus_type species_genus(species_type species);
int species_has_claws(species_type species, bool mut_level = false);
+bool species_is_undead(species_type species);
+bool species_is_unbreathing(species_type species);
+bool species_can_swim(species_type species);
bool species_likes_water(species_type species);
bool species_likes_lava(species_type species);
bool species_can_throw_large_rocks(species_type species);