[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [glob2-devel] questions about code
From: |
Leo Wandersleb |
Subject: |
Re: [glob2-devel] questions about code |
Date: |
Tue, 21 Oct 2008 02:46:17 +0200 |
User-agent: |
Mozilla-Thunderbird 2.0.0.16 (X11/20080724) |
Quinn Yee Qin Teh wrote:
/**
* @param res The resource type
* @return count of resources needed of type res
*/
> int Building::neededRessource(int r)
> {
count of needed resources is max stock - actual stock + (weired computation
taking into account that some resources a carried 10 at once. wonder why a
stock of 10/50 oranges should request 50-10+1-10=31 workers but guess this
is not workers but resources needed thus the +1 makes it round up to one
worker when 10 res are needed)
> int need = type->maxRessource[r] - ressources[r] + 1 -
> type->multiplierRessource[r];
return max(need,0);
> }
> 2. If I simply want the exact number of resource r that the building can
> still hold, will it be accurate for me to just use the expression
> "/type->maxRessource[r] - ressources[r]/"?
yes