From 5f1f85679a04638889e78b0b7f9f292f8a65a335 Mon Sep 17 00:00:00 2001 From: Gunter Labes Date: Sun, 1 Mar 2009 08:32:55 +0000 Subject: [PATCH] Fixed bug #13090: Make movement_costs < 1 behave like movement_costs = 1 --- changelog | 1 + src/unit.cpp | 7 +++++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/changelog b/changelog index 985a13be075..79020f14054 100644 --- a/changelog +++ b/changelog @@ -18,6 +18,7 @@ Version 1.5.11+svn: * WML Engine: * Fix incorrect or doubled "sighted" events when delaying shroud update * Fix sometimes doubled "select" events + * Fixed bug #13090: Make movement_costs < 1 behave like movement_costs = 1 * Miscellaneous and bug fixes: * Align all network buffers on 4 bytes diff --git a/src/unit.cpp b/src/unit.cpp index e9d82d7262f..88af79a345f 100644 --- a/src/unit.cpp +++ b/src/unit.cpp @@ -38,6 +38,7 @@ #define LOG_UT LOG_STREAM(info, engine) #define WRN_UT LOG_STREAM(warn, engine) #define ERR_UT LOG_STREAM(err, engine) +#define WRN_CONFIG LOG_STREAM(warn, config) #define ERR_CONFIG LOG_STREAM(err, config) namespace { @@ -2118,7 +2119,7 @@ int unit::movement_cost_internal(const t_translation::t_terrain terrain, const i int res = -1; if(movement_costs != NULL) { if(underlying.size() != 1) { - LOG_STREAM(err, config) << "terrain '" << terrain << "' has " + ERR_CONFIG << "terrain '" << terrain << "' has " << underlying.size() << " underlying names - 0 expected\n"; return impassable; } @@ -2130,7 +2131,9 @@ int unit::movement_cost_internal(const t_translation::t_terrain terrain, const i } if(res <= 0) { - res = impassable; + WRN_CONFIG << "Terrain '" << terrain << "' has a movement cost of '" + << res << "' which is '<= 0'; resetting to 1.\n"; + res = 1; } movement_costs_.insert(std::pair(terrain,res));