From 8c064965258c38ea1fe91ebc3b0c598170ce955e Mon Sep 17 00:00:00 2001 From: Guangcong Luo Date: Sat, 25 Apr 2009 03:23:56 +0000 Subject: [PATCH] Fix assert when attempting to research free topics. git-svn-id: https://warzone2100.svn.sourceforge.net/svnroot/warzone2100/trunk@7165 4a71c877-e1ca-e34f-864e-861f7616d084 --- src/power.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/power.c b/src/power.c index fcb030bc2..2d4ce10e7 100644 --- a/src/power.c +++ b/src/power.c @@ -434,13 +434,15 @@ int requestPowerFor(int player, float amount, int points) { int pointsConsidered = randomRound(points * asPower[player].economyThrottle); // only what it needs for the n amount of points we consider giving - float amountConsidered = amount * (float) pointsConsidered / points; + float amountConsidered; - if (amount < 0.01 || !powerCalculated) + if (points == 0 || amount < 0.01 || !powerCalculated) { return points; } + amountConsidered = amount * (float) pointsConsidered / points; + // keep track on how much energy we could possibly spend asPower[player].powerRequested += amount; ASSERT(asPower[player].powerRequested < 1000, "you are asking too much");