summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/tilereg.cc
diff options
context:
space:
mode:
authorj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-08-19 09:07:57 +0000
committerj-p-e-g <j-p-e-g@c06c8d41-db1a-0410-9941-cceddc491573>2009-08-19 09:07:57 +0000
commitbb06ee5d09ad01697c7c2fb492e0f6608cfda2fa (patch)
tree3f4c8ebf36cb190a5cc75028ce67e252f4d33e6f /crawl-ref/source/tilereg.cc
parent70f67f351c5d568a1d4cd3d831dfba372f60a7cf (diff)
downloadcrawl-ref-bb06ee5d09ad01697c7c2fb492e0f6608cfda2fa.tar.gz
crawl-ref-bb06ee5d09ad01697c7c2fb492e0f6608cfda2fa.zip
Disallow choice of "none" for species/base in the doll edit screen.
git-svn-id: https://crawl-ref.svn.sourceforge.net/svnroot/crawl-ref/trunk@10574 c06c8d41-db1a-0410-9941-cceddc491573
Diffstat (limited to 'crawl-ref/source/tilereg.cc')
-rw-r--r--crawl-ref/source/tilereg.cc24
1 files changed, 14 insertions, 10 deletions
diff --git a/crawl-ref/source/tilereg.cc b/crawl-ref/source/tilereg.cc
index 1201c946fe..70816def65 100644
--- a/crawl-ref/source/tilereg.cc
+++ b/crawl-ref/source/tilereg.cc
@@ -679,18 +679,22 @@ void pack_doll_buf(TileBuffer& buf, const dolls_data &doll, int x, int y)
}
// Special case bardings from being cut off.
- bool is_naga = (doll.parts[TILEP_PART_BASE] == TILEP_BASE_NAGA
- || doll.parts[TILEP_PART_BASE] == TILEP_BASE_NAGA + 1);
+ bool is_naga = (doll.parts[TILEP_PART_BASE] >= TILEP_BASE_NAGA
+ && doll.parts[TILEP_PART_BASE]
+ < tilep_species_to_base_tile(SP_NAGA + 1));
+
if (doll.parts[TILEP_PART_BOOTS] >= TILEP_BOOTS_NAGA_BARDING
&& doll.parts[TILEP_PART_BOOTS] <= TILEP_BOOTS_NAGA_BARDING_RED)
{
flags[TILEP_PART_BOOTS] = is_naga ? TILEP_FLAG_NORMAL : TILEP_FLAG_HIDE;
}
- bool is_cent = (doll.parts[TILEP_PART_BASE] == TILEP_BASE_CENTAUR
- || doll.parts[TILEP_PART_BASE] == TILEP_BASE_CENTAUR + 1);
+ bool is_cent = (doll.parts[TILEP_PART_BASE] >= TILEP_BASE_CENTAUR
+ && doll.parts[TILEP_PART_BASE]
+ < tilep_species_to_base_tile(SP_CENTAUR + 1));
+
if (doll.parts[TILEP_PART_BOOTS] >= TILEP_BOOTS_CENTAUR_BARDING
- && doll.parts[TILEP_PART_BOOTS] <= TILEP_BOOTS_CENTAUR_BARDING_RED)
+ && doll.parts[TILEP_PART_BOOTS] <= TILEP_BOOTS_CENTAUR_BARDING_RED)
{
flags[TILEP_PART_BOOTS] = is_cent ? TILEP_FLAG_NORMAL : TILEP_FLAG_HIDE;
}
@@ -3264,13 +3268,13 @@ static int _get_next_part(int cat, int part, int inc)
{
// Can't increment or decrement on show equip.
if (part == TILEP_SHOW_EQUIP)
- {
return part;
- }
// Increment max_part by 1 to include the special value of "none".
- int max_part = tile_player_part_count[cat] + 1;
- int offset = tile_player_part_start[cat];
+ // (Except for the base, for which "none" is disallowed.)
+ const int bonus = (cat == TILEP_PART_BASE ? 0 : 1);
+ const int max_part = tile_player_part_count[cat] + bonus;
+ const int offset = tile_player_part_start[cat];
ASSERT(inc > -max_part);
@@ -3284,7 +3288,7 @@ static int _get_next_part(int cat, int part, int inc)
// Valid part numbers are in the range [offset, offset + max_part - 1].
int ret = (part + max_part + inc - offset) % (max_part);
- if (ret == max_part - 1)
+ if (cat != TILEP_PART_BASE && ret == max_part - 1)
{
// "none" value.
return 0;