From 3b42644eeb317f8e5d0dc3cae807ae2ed74b9172 Mon Sep 17 00:00:00 2001 From: Pauli Nieminen Date: Mon, 22 Sep 2008 16:00:36 +0000 Subject: [PATCH] Fix division by zero --- src/team.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/team.cpp b/src/team.cpp index 522501db526..21582e1d133 100644 --- a/src/team.cpp +++ b/src/team.cpp @@ -245,7 +245,7 @@ team::team_info::team_info(const config& cfg) : } if(village_val.empty()) { - village_value = 4.5; + village_value = 3.0; } else { village_value = atof(village_val.c_str()); } @@ -258,7 +258,7 @@ team::team_info::team_info(const config& cfg) : } if(aggression_val.empty()) { - aggression_ = 0.4; + aggression_ = 0.3; } else { aggression_ = atof(aggression_val.c_str()); } @@ -271,7 +271,7 @@ team::team_info::team_info(const config& cfg) : } if(caution_val.empty()) { - caution_ = 0.25; + caution_ = 0.4; } else { caution_ = atof(caution_val.c_str()); } @@ -524,7 +524,11 @@ namespace { count_average(size_t& a) : a_(a), sum_(0), count_(0) {} ~count_average() { - a_ = sum_/count_; + // If no recruits disable leader from moving to keep + if (count_ == 0) + a_ = 424242; + else + a_ = sum_/count_; } void operator()(const std::string& recruit) {