summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/godabil.cc
diff options
context:
space:
mode:
authorCharles Otto <ottochar@gmail.com>2010-01-10 14:08:42 -0500
committerCharles Otto <ottochar@gmail.com>2010-01-10 14:13:45 -0500
commitb1ff610c3ab9951b28f60747c70d81bcb21a6229 (patch)
treedb7a34335fad38e7b20419788a659f6e559724e7 /crawl-ref/source/godabil.cc
parent09782b43af4ed11c1dd87d557d58e4894d81505c (diff)
downloadcrawl-ref-b1ff610c3ab9951b28f60747c70d81bcb21a6229.tar.gz
crawl-ref-b1ff610c3ab9951b28f60747c70d81bcb21a6229.zip
Don't prompt the user in growth if they can't use the ability
Don't prompt the user to specify the amount of plants to create if they can't create any due to having no fruit or no empty adjacent squares to put plants on.
Diffstat (limited to 'crawl-ref/source/godabil.cc')
-rw-r--r--crawl-ref/source/godabil.cc21
1 files changed, 13 insertions, 8 deletions
diff --git a/crawl-ref/source/godabil.cc b/crawl-ref/source/godabil.cc
index dce5c197d1..0755e70e81 100644
--- a/crawl-ref/source/godabil.cc
+++ b/crawl-ref/source/godabil.cc
@@ -345,7 +345,7 @@ bool fedhas_shoot_through(const bolt & beam, const monsters * victim)
{
monsters * temp = dynamic_cast<monsters *> (originator);
if (!temp)
- return false;
+ return (false);
origin_worships_fedhas = temp->god == GOD_FEDHAS;
origin_attitude = temp->attitude;
}
@@ -684,7 +684,7 @@ bool sunlight()
template<typename T>
bool less_second(const T & left, const T & right)
{
- return left.second < right.second;
+ return (left.second < right.second);
}
typedef std::pair<coord_def, int> point_distance;
@@ -904,19 +904,19 @@ bool _prompt_amount(int max, int & selected)
// Default is max
if (keyin == '\n' || keyin == '\r')
- return true;
+ return (true);
// Otherwise they should enter a digit
if (isdigit(keyin))
{
selected = keyin - '0';
if (selected > 0 && selected <= max)
- return true;
+ return (true);
}
// else they entered some garbage?
}
- return max;
+ return (max);
}
@@ -934,12 +934,12 @@ int _collect_fruit(std::vector<std::pair<int,int> > & available_fruit)
}
}
- return total;
+ return (total);
}
bool _less_first(const std::pair<int, int> & left, const std::pair<int, int> & right)
{
- return left.first < right.first;
+ return (left.first < right.first);
}
void _decrease_amount(std::vector<std::pair<int, int> > & available, int amount)
{
@@ -979,11 +979,16 @@ bool plant_ring_from_fruit()
int max_use = std::min(total_fruit, int(adjacent.size()) );
+ // Don't prompt if we can't do anything (due to having no fruit or
+ // no squares to place plants on).
+ if (max_use == 0)
+ return (false);
+
// And how many plants does the user want to create?
int target_count;
if (!_prompt_amount(max_use, target_count))
{
- return false;
+ return (false);
}
if ((int)adjacent.size() > target_count)