So I added "#define RAND 21" (around line 66) after the rest of the defines, and around line 795, in the GetUnitVal member definition added the following:
Code: Select all
case RAND:
return ( ( CGlobalSyncedStuff::randInt() % (p2-p1+1) ) + p1 );
but I was wondeirng if this is the best place to put it. The GetUnitVal (and, I suspect, the rest of the class) deals with certain direct properties of units- STANDINGMOVEORDER, HEALTH, ARMORED, etc - are all variable properties of units specific to the units themselves. RAND(x,y), however, is not really a specific property of a unit, but rather, a sort of universal function that returns a certain value; its more like a ... well, something else entirely. It has no equivalent in TA scripting, not that I can think of.
So, I'm wondering: Is this the best place to put it? It somehow doesn't fit in with the current object tree. Or is there something i'm missing, or should I create a new class that is a part of the COB engine that includes this and other (future possible) "universal" functions?
Second thing I'm wondering is why in the GetUnitVal (and i believe the SetUnitVal) function some of the cases have breaks after them, and others do not. It's probably just some logic flow that I'm not understanding, but I just want to make sure.
Thanks
-Dragon45