HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

FoodPool()

11-18-2005, 01:12 AM#1
TaintedReality
I've been looking at this function, as it is used in a lot of the AI things, but I just can't figure out what it does =. It's in the common.ai btw, and seems to be called a lot when figuring out whether to build units or not, but like I said, I dunno what it's actually doing. Here's the code:
Collapse JASS:
function FoodPool takes integer food, boolean weak, integer id1, integer use1, boolean strong, integer id2, integer use2 returns nothing
    if strong then
        call SetBuildUnit( (food - use1 * TownCount(id1)) / use2, id2 )
    elseif weak then
        call SetBuildUnit( (food - use2 * TownCount(id2)) / use1, id1 )
    endif
endfunction
11-18-2005, 03:45 AM#2
Zandose
No clue but I can guess. It check how much food there is left to use and either build the building or more food depending. This is just a guess though lol.
11-18-2005, 08:28 PM#3
TaintedReality
Well, I think it does about that, but I want to know what exactly the strong and weak booleans mean, and what that math is giving you.