From 90b9126d260c98cd8d4db0dd192952c915262af8 Mon Sep 17 00:00:00 2001 From: Mathieu Schroeter Date: Sun, 6 Aug 2017 21:28:40 +0200 Subject: [PATCH] Enable build of wall and tower only if energy >= half It was a bug because when the energy is lower, Blupi dies immediatly but the wall is terminated with the death. It makes no sense because the wall and the tower needs a lot of energy and in all cases the death of Blupi. --- src/decor.cxx | 6 ++++++ src/def.h | 1 + src/menu.cxx | 2 +- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/decor.cxx b/src/decor.cxx index 9985376..b972a3f 100644 --- a/src/decor.cxx +++ b/src/decor.cxx @@ -1864,6 +1864,9 @@ Errors CDecor::CelOkForAction ( error = Errors::MISC; // pas assez fort } + if (m_blupi[rank].energy <= MAXENERGY / 2) + error = Errors::ENERGY; // not enough energy + GetObject (cel, channel, icon); if (channel != CHOBJECT || icon != 44) // pierres ? { @@ -1916,6 +1919,9 @@ Errors CDecor::CelOkForAction ( error = Errors::MISC; // pas assez fort } + if (m_blupi[rank].energy <= MAXENERGY / 2) + error = Errors::ENERGY; // not enough energy + GetObject (cel, channel, icon); if (channel != CHOBJECT || icon != 44) // pierres ? { diff --git a/src/def.h b/src/def.h index b0e5e57..6d8663b 100644 --- a/src/def.h +++ b/src/def.h @@ -367,6 +367,7 @@ enum Errors { TOURISOL = 6, TOUREAU = 7, TELE2 = 8, + ENERGY = 9, REPEAT = 500, }; diff --git a/src/menu.cxx b/src/menu.cxx index 90d7647..9ad7e5d 100644 --- a/src/menu.cxx +++ b/src/menu.cxx @@ -125,7 +125,7 @@ static const char * GetErr (Sint32 rank) translate ("Occupied ground"), translate ("Opposite bank no good"), translate ("Bridge finished"), translate ("(isolated tower)"), translate ("Too close to water"), translate ("Already two teleporters"), - }; + translate ("Not enough energy")}; return gettext (list[rank]); }