1
0
mirror of https://github.com/blupi-games/planetblupi synced 2024-12-30 10:15:36 +01:00

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.
This commit is contained in:
Mathieu Schroeter 2017-08-06 21:28:40 +02:00
parent 3e0bce333e
commit 90b9126d26
3 changed files with 8 additions and 1 deletions

View File

@ -1864,6 +1864,9 @@ Errors CDecor::CelOkForAction (
error = Errors::MISC; // pas assez fort error = Errors::MISC; // pas assez fort
} }
if (m_blupi[rank].energy <= MAXENERGY / 2)
error = Errors::ENERGY; // not enough energy
GetObject (cel, channel, icon); GetObject (cel, channel, icon);
if (channel != CHOBJECT || icon != 44) // pierres ? if (channel != CHOBJECT || icon != 44) // pierres ?
{ {
@ -1916,6 +1919,9 @@ Errors CDecor::CelOkForAction (
error = Errors::MISC; // pas assez fort error = Errors::MISC; // pas assez fort
} }
if (m_blupi[rank].energy <= MAXENERGY / 2)
error = Errors::ENERGY; // not enough energy
GetObject (cel, channel, icon); GetObject (cel, channel, icon);
if (channel != CHOBJECT || icon != 44) // pierres ? if (channel != CHOBJECT || icon != 44) // pierres ?
{ {

View File

@ -367,6 +367,7 @@ enum Errors {
TOURISOL = 6, TOURISOL = 6,
TOUREAU = 7, TOUREAU = 7,
TELE2 = 8, TELE2 = 8,
ENERGY = 9,
REPEAT = 500, REPEAT = 500,
}; };

View File

@ -125,7 +125,7 @@ static const char * GetErr (Sint32 rank)
translate ("Occupied ground"), translate ("Opposite bank no good"), translate ("Occupied ground"), translate ("Opposite bank no good"),
translate ("Bridge finished"), translate ("(isolated tower)"), translate ("Bridge finished"), translate ("(isolated tower)"),
translate ("Too close to water"), translate ("Already two teleporters"), translate ("Too close to water"), translate ("Already two teleporters"),
}; translate ("Not enough energy")};
return gettext (list[rank]); return gettext (list[rank]);
} }