Skip to content

Fix incorrect low and high values for GameClientRandomVariable #2481

@Caball009

Description

@Caball009

void INI::parseGameClientRandomVariable( INI* ini, void * /*instance*/, void *store, const void* /*userData*/ )
{
GameClientRandomVariable *var = static_cast<GameClientRandomVariable *>(store);
const char* token;
token = ini->getNextToken();
Real low = INI::scanReal(token);
token = ini->getNextToken();
Real high = INI::scanReal(token);
// if omitted, assume uniform
GameClientRandomVariable::DistributionType type = GameClientRandomVariable::UNIFORM;
token = ini->getNextTokenOrNull();
if (token)
type = (GameClientRandomVariable::DistributionType)INI::scanIndexList(token, GameClientRandomVariable::DistributionTypeNames);
// set the range of the random variable
var->setRange( low, high, type );
}

Perhaps it would be good if we checked that high is greater than low. There are many such mistakes in the particle system data files.

if (low > high)
{
	std::swap(low, high);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    FixIs fixing something, but is not user facingMinorSeverity: Minor < Major < Critical < Blocker

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions