summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/player.cc
diff options
context:
space:
mode:
authordshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-08 20:40:24 +0000
committerdshaligram <dshaligram@c06c8d41-db1a-0410-9941-cceddc491573>2007-03-08 20:40:24 +0000
commitb31338b60aefb79b5d31e7bd1e3573c5965047e3 (patch)
tree2f406ecb6e20d62bcac6682636f15f9fd3744ecb /crawl-ref/source/player.cc
parenta1b5f79cc172bddee8b225cd5a6726f6a5451666 (diff)
downloadcrawl-ref-b31338b60aefb79b5d31e7bd1e3573c5965047e3.tar.gz
crawl-ref-b31338b60aefb79b5d31e7bd1e3573c5965047e3.zip
New key=value logfile format as proposed by Shawn Moore. This is more verbose
than the old format by about 2x, but is more maintainable and comprehensible. Removed support for parsing scorefiles/logfiles older than 4.0 beta 26. Added shim to make 0.1.7 logfiles compatible with 0.2 Using the -scorefile option alone (no -scores, -tscores, etc.) causes Crawl to read in the existing scorefile/logfile and write it out to stdout in the new format. Ghouls get claw damage messages in unarmed combat. Plain oozes lose acid damage attacks (added inadvertently). Prompt the user when trying to displace a friendly over water (the old fix was to simply say "The foo resists"). git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@994 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/player.cc')
-rw-r--r--crawl-ref/source/player.cc38
1 files changed, 32 insertions, 6 deletions
diff --git a/crawl-ref/source/player.cc b/crawl-ref/source/player.cc
index 983b8403f1..bb4cb683dc 100644
--- a/crawl-ref/source/player.cc
+++ b/crawl-ref/source/player.cc
@@ -327,7 +327,7 @@ bool is_grid_dangerous(int grid)
{
return (!player_is_levitating()
&& (grid == DNGN_LAVA
- || grid == DNGN_DEEP_WATER && !player_can_swim()));
+ || (grid == DNGN_DEEP_WATER && !player_can_swim())));
}
bool player_in_mappable_area( void )
@@ -3247,6 +3247,27 @@ void redraw_skill(const char your_name[kNameLen], const char class_name[80])
cprintf( "%s", print_it );
} // end redraw_skill()
+// Does a case-sensitive lookup of the species name supplied.
+int str_to_species(const std::string &species)
+{
+ if (species.empty())
+ return SP_HUMAN;
+
+ for (int i = SP_HUMAN; i < NUM_SPECIES; ++i)
+ {
+ if (species == species_name(i, 10))
+ return (i);
+ }
+
+ for (int i = SP_HUMAN; i < NUM_SPECIES; ++i)
+ {
+ if (species == species_name(i, 1))
+ return (i);
+ }
+
+ return (SP_HUMAN);
+}
+
// Note that this function only has the one static buffer, so if you
// want to use the results, you'll want to make a copy.
char *species_name( int speci, int level, bool genus, bool adj, bool cap )
@@ -4770,11 +4791,7 @@ int player::damage_type(int)
{
return (DVORP_SLICING);
}
- else if (equip[EQ_GLOVES] == -1 &&
- (attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON
- || mutation[MUT_CLAWS]
- || species == SP_TROLL
- || species == SP_GHOUL))
+ else if (has_usable_claws())
{
return (DVORP_CLAWING);
}
@@ -5162,3 +5179,12 @@ void player::slow_down(int str)
{
::slow_player( str );
}
+
+bool player::has_usable_claws() const
+{
+ return (equip[EQ_GLOVES] == -1 &&
+ (attribute[ATTR_TRANSFORMATION] == TRAN_DRAGON
+ || mutation[MUT_CLAWS]
+ || species == SP_TROLL
+ || species == SP_GHOUL));
+}