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
master
Guangcong Luo 2009-04-25 03:23:56 +00:00 committed by Git SVN Gateway
parent b095418a42
commit 8c06496525
1 changed files with 4 additions and 2 deletions

View File

@ -434,13 +434,15 @@ int requestPowerFor(int player, float amount, int points)
{ {
int pointsConsidered = randomRound(points * asPower[player].economyThrottle); int pointsConsidered = randomRound(points * asPower[player].economyThrottle);
// only what it needs for the n amount of points we consider giving // 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; return points;
} }
amountConsidered = amount * (float) pointsConsidered / points;
// keep track on how much energy we could possibly spend // keep track on how much energy we could possibly spend
asPower[player].powerRequested += amount; asPower[player].powerRequested += amount;
ASSERT(asPower[player].powerRequested < 1000, "you are asking too much"); ASSERT(asPower[player].powerRequested < 1000, "you are asking too much");