|
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);
}
GeneralsGameCode/Core/GameEngine/Source/Common/INI/INI.cpp
Lines 1731 to 1751 in c8c809c
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.