From e88ba16ffa7862548381dcd8614b2ef0b8d3aa8c Mon Sep 17 00:00:00 2001 From: mateuszb Date: Wed, 22 Apr 2009 07:46:27 +0000 Subject: [PATCH] * ubuntux's patch (vcmi_fix_res2) --- server/CGameHandler.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/server/CGameHandler.cpp b/server/CGameHandler.cpp index 8908f1b5a..69953522b 100644 --- a/server/CGameHandler.cpp +++ b/server/CGameHandler.cpp @@ -2502,11 +2502,13 @@ void CGameHandler::handleTimeEvents() { if(ev->resources[i]) //if resource is changed, we add it to the dialog { + // If removing too much ressources, adjust the + // amount so the total doesn't become negative. + if (sr.res[i] + ev->resources[i] < 0) + ev->resources[i] = -sr.res[i]; + iw.components.push_back(Component(Component::RESOURCE,i,ev->resources[i],0)); sr.res[i] += ev->resources[i]; - // Don't let resources becoming negative - if (sr.res[i] < 0) - sr.res[i] = 0; } } if (iw.components.size())