Alter frandom's API such that it takes no parameters and returns a float ranging from 0.f to 1.f
git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@6608 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
f1ae7b9620
commit
516067dec0
|
@ -113,13 +113,11 @@ static inline WZ_DECL_CONST float hypotf(float x, float y)
|
|||
|
||||
/*!
|
||||
* Calculates a random floating point number in a certain range
|
||||
* \param x Lower bound
|
||||
* \param y Upper boundX
|
||||
* \return Random number between x and y
|
||||
* \return Random number between 0.f and 1.f
|
||||
*/
|
||||
static inline float frandom(float x, float y)
|
||||
static inline float frandom(void)
|
||||
{
|
||||
return x + (y-x)*rand()/(float)RAND_MAX;
|
||||
return (float)rand() / (float)RAND_MAX;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -396,7 +396,8 @@ BOOL proj_SendProjectile(WEAPON *psWeap, BASE_OBJECT *psAttacker, int player, Ve
|
|||
|
||||
if (psTarget)
|
||||
{
|
||||
unsigned int heightVariance = frandom(0, establishTargetHeight(psTarget));
|
||||
const float maxHeight = establishTargetHeight(psTarget);
|
||||
unsigned int heightVariance = frandom() * maxHeight;
|
||||
|
||||
scoreUpdateVar(WD_SHOTS_ON_TARGET);
|
||||
|
||||
|
|
Loading…
Reference in New Issue