![]() |
Oolite 1.91.0.7658-250404-b1488af
|
#include <stdio.h>
#include <math.h>
#include <stdint.h>
#include <stdbool.h>
#include <assert.h>
#include "legacy_random.h"
Go to the source code of this file.
Variables | |
const Random_Seed | kNilRandomSeed = {0} |
static RNG_Seed | rnd_seed |
static int32_t | checksum |
static RANROTSeed | sRANROT |
static bool | sReallyRandomInited = false |
static RANROTSeed | sReallyRandomSeed |
float bellf | ( | int | n | ) |
Definition at line 168 of file legacy_random.c.
References EXPECT_NOT, and Ranrot().
Referenced by ShipEntity::randomEjectaTemperatureWithMaxFactor:.
void clear_checksum | ( | void | ) |
Definition at line 42 of file legacy_random.c.
References checksum.
Referenced by PlayerEntity::commanderDataDictionary, PlayerEntity::setTrumbleValueFrom:, and PlayerEntity::trumbleValue.
double cunningFee | ( | double | value, |
double | precision ) |
Definition at line 62 of file legacy_random.c.
Referenced by PlayerEntity::renovationCosts, Universe::shipsForSaleForSystem:withTL:atTime:, and PlayerEntity(ContractsPrivate)::tradeInValue.
RNG_Seed currentRandomSeed | ( | void | ) |
Definition at line 213 of file legacy_random.c.
References rnd_seed.
Referenced by OOCharacter::basicSetUp, GlobalRandomName(), PlanetEntity(OOPrivate)::initAsAtmosphereForPlanet:dictionary:, PlanetEntity::initFromDictionary:withAtmosphere:andSeed:, and PlayerEntity::setGuiToSystemDataScreenRefreshBackground:.
int gen_rnd_number | ( | void | ) |
Definition at line 225 of file legacy_random.c.
Referenced by OOCharacter::basicSetUp, OOCharacter::castInRole:, Universe::getWitchspaceExitRotation, PlanetEntity(OOPrivate)::initAsAtmosphereForPlanet:dictionary:, PlanetEntity::initFromDictionary:withAtmosphere:andSeed:, PlanetEntity(OOPrivate)::initialiseBaseTerrainArray:, make_pseudo_random_seed(), OldRandomDigrams(), PlayerEntity(ScriptMethods)::systemPseudoRandom100, PlayerEntity(ScriptMethods)::systemPseudoRandom256, and PlayerEntity(ScriptMethods)::systemPseudoRandomFloat.
void make_pseudo_random_seed | ( | Random_Seed * | seed_ptr | ) |
Definition at line 309 of file legacy_random.c.
References Random_Seed::a, Random_Seed::b, Random_Seed::c, Random_Seed::d, Random_Seed::e, Random_Seed::f, and gen_rnd_number().
Referenced by GlobalRandomInhabitantsDescription(), and OOCharacter::initWithRole:andOriginalSystem:.
RANROTSeed MakeRanrotSeed | ( | uint32_t | seed | ) |
Definition at line 113 of file legacy_random.c.
References RanrotWithSeed().
Referenced by Universe::populateSystemFromDictionariesWithSun:andPlanet:, ranrot_srand(), and RanrotSeedFromRNGSeed().
Definition at line 48 of file legacy_random.c.
References checksum.
Referenced by PlayerEntity::commanderDataDictionary, PlayerEntity::mungChecksumWithNSString:, PlayerEntity::setTrumbleValueFrom:, and PlayerEntity::trumbleValue.
void OOInitReallyRandom | ( | uint64_t | seed | ) |
Definition at line 256 of file legacy_random.c.
References OOReallyRandom(), sReallyRandomInited, and sReallyRandomSeed.
Referenced by Universe::initWithGameView:.
uint32_t OOReallyRandom | ( | void | ) |
Definition at line 249 of file legacy_random.c.
References RanrotWithSeed(), sReallyRandomInited, and sReallyRandomSeed.
Referenced by OOInitReallyRandom(), OOSetReallyRandomRANROTSeed(), and OOSetReallyRandomRndSeed().
void OORestoreRandomState | ( | OORandomState | state | ) |
Definition at line 302 of file legacy_random.c.
References OORandomState::ranrot, OORandomState::rnd, rnd_seed, and sRANROT.
Referenced by OOExpandDescriptionString().
OORandomState OOSaveRandomState | ( | void | ) |
Definition at line 292 of file legacy_random.c.
References rnd_seed, and sRANROT.
Referenced by OOExpandDescriptionString().
void OOSetReallyRandomRANROTAndRndSeeds | ( | void | ) |
Definition at line 285 of file legacy_random.c.
References OOSetReallyRandomRANROTSeed(), and OOSetReallyRandomRndSeed().
Referenced by OOExpandDescriptionString().
void OOSetReallyRandomRANROTSeed | ( | void | ) |
Definition at line 267 of file legacy_random.c.
References OOReallyRandom(), sRANROT, sReallyRandomInited, and sReallyRandomSeed.
Referenced by OOSetReallyRandomRANROTAndRndSeeds().
void OOSetReallyRandomRndSeed | ( | void | ) |
Definition at line 275 of file legacy_random.c.
References OOReallyRandom(), and rnd_seed.
Referenced by OOSetReallyRandomRANROTAndRndSeeds().
float randf | ( | void | ) |
Definition at line 156 of file legacy_random.c.
References Ranrot().
Referenced by OOTrumble::actionBlink, OOTrumble::actionIdle, OOTrumble::actionPop, OOTrumble::actionProot, OOTrumble::actionShudder, OOTrumble::actionSleep, OOTrumble::actionSnarl, OOTrumble::actionSpawn, OOTrumble::actionStoned, Universe::addLaserHitEffectsAt:against:damage:color:, Universe::addShipAt:withRole:withinRadius:, Universe::addShips:withRole:atPosition:withCoordinateSystem:, Universe::addShips:withRole:intoBoundingBox:, Universe::addShipWithRole:launchPos:rfactor:, Universe::addWreckageFrom:withRole:at:scale:lifetime:, OOCommodities(OOPrivate)::adjustPrice:byRule:, OOCommodities(OOPrivate)::adjustQuantity:byRule:, OORoleSet::anyRole, ShipEntity::becomeExplosion, ShipEntity::behaviour_attack_fly_from_target:, ShipEntity::behaviour_attack_target:, ShipEntity::behaviour_flee_target:, ShipEntity(AI)::broadcastDistressMessageWithDumping:, Universe::cargoPodFromTemplate:, Universe::carryPlayerOn:inWormhole:, OOSunEntity::changeSunProperty:withDictionary:, PlayerEntity(Contracts)::checkPassengerContracts, PlayerEntity::clearRoleFromPlayer:, PlayerEntity::clearRolesFromPlayer:, ShipEntity::currentAimTolerance, WormholeEntity::disgorgeShips, ShipEntity::drawImmediate:translucent:, WormholeEntity::DrawWormholeCorona, ShipEntity::dumpItem:, PlayerEntity::enterWitchspace, PlayerEntity::enterWormhole:, ShipEntity(PureAI)::fightOrFleeHostiles, fillRanNoiseBuffer(), ShipEntity::fireDirectLaserShot:, ShipEntity::fireDirectLaserShotAt:, ShipEntity::fireMissileWithIdentifier:andTarget:, ShipEntity::fireWeapon:direction:range:, Universe(OOPrivate)::fractionalPositionFrom:to:withFraction:, OOCommodities(OOPrivate)::generatePriceForGood:inEconomy:, OOCommodities(OOPrivate)::generateQuantityForGood:inEconomy:, Universe::getSunSkimEndPositionForShip:, OOExplosionCloudEntity(OOPrivate)::initExplosionCloudWithEntity:size:andSettings:, OOSunEntity::initSunWithColor:andDictionary:, SkyEntity::initWithColors:col1:andSystemInfo:, OOParticleSystem::initWithPosition:velocity:count:minSpeed:maxSpeed:duration:baseColor:, ShipEntity::launchCascadeMine, StationEntity::launchIndependentShip:, ShipEntity::leaveWitchspace, Universe::locationByCode:withSun:andPlanet:, ShipEntity::noteTakingDamage:from:type:, ShipEntity::onTarget:withWeapon:, OOFuzzyBooleanFromObject(), OOHPRandomPositionInBoundingBox(), OOHPVectorRandomRadial(), OOHPVectorRandomSpatial(), OORandomPositionInBoundingBox(), OORandomPositionInCylinder(), OORandomUnitHPVector(), OORandomUnitVector(), OOVectorRandomRadial(), OOVectorRandomSpatial(), ShipEntity(AI)::performAttack, ShipEntity(AI)::performFlee, ShipEntity(AI)::performTumble, Universe::populateNormalSpace, OOTrumble::randomizeMotionX, OOTrumble::randomizeMotionY, OOConcreteMutableProbabilitySet::randomObject, ShipEntity::respondToAttackFrom:becauseOf:, ShipEntity::selectMissile, ShipEntity::setCargoFlag:, ShipEntity(PureAI)::setCourseToPlanet, ShipEntity(PureAI)::setDestinationToDockingAbort, ShipEntity(PureAI)::setDestinationWithinTarget, ShipEntity(PureAI)::setPlanetPatrolCoordinates, OOSunEntity::setSunColor:, ShipEntity(PureAI)::setTargetToPrimaryAggressor, OOTrumble::setupForPlayer:digram:, OOSkyDrawable(OOPrivate)::setUpNebulaeWithColor1:color2:clusterFactor:nebulaHueFix:alpha:scale:, ShipEntity(Private)::setUpOneEscort:inGroup:withRole:atPosition:andCount:, ShipEntity::setUpShipFromDictionary:, Universe::setUpSpace, Universe::setUpWitchspaceBetweenSystem:andSystem:, Universe::shipsForSaleForSystem:withTL:atTime:, OOTrumble::spawnFrom:, Universe::spawnShipWithRole:near:, ShipEntity::takeEnergyDamage:from:becauseOf:weaponIdentifier:, PlayerEntity::takeInternalDamage, ShipEntity::takeScrapeDamage:from:, ShipEntity::throwSparks, OOExhaustPlumeEntity::update:, OOQuiriumCascadeEntity::update:, OOSunEntity::update:, OOTrumble::updateBlink:, OOTrumble::updateIdle:, OOTrumble::updatePop:, OOTrumble::updateProot:, OOTrumble::updateShudder:, OOTrumble::updateSleep:, OOTrumble::updateSnarl:, OOTrumble::updateTrumble:, PlayerEntity(OOPrivate)::witchJumpTo:misjump:, and Universe::witchspaceShipWithPrimaryRole:.
float randfWithSeed | ( | RANROTSeed * | ioSeed | ) |
Definition at line 162 of file legacy_random.c.
References RanrotWithSeed().
Referenced by OOProbabilisticTextureManager::selectTexture.
unsigned Ranrot | ( | void | ) |
Definition at line 93 of file legacy_random.c.
References sRANROT.
Referenced by PlayerEntity::addRoleToPlayer:, Universe::addShipAt:withRole:withinRadius:, PlayerEntity(Contracts)::awardContract:commodity:start:destination:eta:fee:premium:, ShipEntity::becomeExplosion, bellf(), PlayerEntity::clearRoleFromPlayer:, Universe::getContainersOfGoods:scarce:legal:, Universe::getRandomAmountOfCommodity:, OOCommodities::getRandomCommodity, Universe::getSafeVectorFromEntity:toDistance:fromPoint:, GlobalRandomName(), ShipEntity::initWithKey:definition:, StationEntity::launchDefenseShip, StationEntity::launchPatrol, StationEntity::launchPolice, PlayerEntity::leaveWitchspace, PlayerEntity(Contracts)::processEscapePods, quaternion_set_random(), randf(), OOCharacter::randomCharacterWithRole:andOriginalSystem:, Universe(OOPrivate)::randomDistanceWithinScanner, Octree::randomFullNodeFrom, ShipEntity::releaseCargoPodsDebris, ShipEntity(Private)::setUpMixedEscorts, Universe::setUpSpace, Universe::shipsForSaleForSystem:withTL:atTime:, StationAddShipToShipyard(), SVGDumpBeginPrimitive(), and Universe::witchspaceShipWithPrimaryRole:.
void ranrot_srand | ( | uint32_t | seed | ) |
Definition at line 150 of file legacy_random.c.
References MakeRanrotSeed(), and sRANROT.
Referenced by GameController::init, PlanetEntity(OOPrivate)::initialiseBaseTerrainArray:, PlanetEntity(OOPrivate)::paintVertex:vi:, OOTrumble::setupForPlayer:digram:, and Universe::shipsForSaleForSystem:withTL:atTime:.
RANROTSeed RANROTGetFullSeed | ( | void | ) |
Definition at line 185 of file legacy_random.c.
References sRANROT.
Referenced by OOCharacter::basicSetUp, fillRanNoiseBuffer(), PlanetEntity(OOPrivate)::initAsAtmosphereForPlanet:dictionary:, PlanetEntity::initFromDictionary:withAtmosphere:andSeed:, PlanetEntity(OOPrivate)::initialiseBaseTerrainArray:, PlanetEntity(OOPrivate)::paintVertex:vi:, Universe::populateSystemFromDictionariesWithSun:andPlanet:, PlayerEntity::setGuiToSystemDataScreenRefreshBackground:, and Universe::shipsForSaleForSystem:withTL:atTime:.
RANROTSeed RanrotSeedFromRandomSeed | ( | Random_Seed | seed | ) |
Definition at line 136 of file legacy_random.c.
References Random_Seed::c, Random_Seed::d, Random_Seed::e, Random_Seed::f, and RanrotSeedFromRNGSeed().
Referenced by Universe::populateSystemFromDictionariesWithSun:andPlanet:, and Universe::shipsForSaleForSystem:withTL:atTime:.
RANROTSeed RanrotSeedFromRNGSeed | ( | RNG_Seed | seed | ) |
Definition at line 130 of file legacy_random.c.
References RNG_Seed::a, RNG_Seed::b, RNG_Seed::c, RNG_Seed::d, and MakeRanrotSeed().
Referenced by RanrotSeedFromRandomSeed(), and seed_for_planet_description().
void RANROTSetFullSeed | ( | RANROTSeed | seed | ) |
Definition at line 191 of file legacy_random.c.
References sRANROT.
Referenced by OOCharacter::basicSetUp, PlanetEntity(OOPrivate)::initAsAtmosphereForPlanet:dictionary:, PlanetEntity::initFromDictionary:withAtmosphere:andSeed:, PlanetEntity(OOPrivate)::initialiseBaseTerrainArray:, PlanetEntity(OOPrivate)::paintVertex:vi:, Universe::populateSystemFromDictionariesWithSun:andPlanet:, PlayerEntity::setGuiToSystemDataScreenRefreshBackground:, and Universe::shipsForSaleForSystem:withTL:atTime:.
unsigned RanrotWithSeed | ( | RANROTSeed * | ioSeed | ) |
Definition at line 102 of file legacy_random.c.
References RANROTSeed::high, and RANROTSeed::low.
Referenced by MakeRanrotSeed(), OOReallyRandom(), Universe::populateSystemFromDictionariesWithSun:andPlanet:, randfWithSeed(), and Universe::shipsForSaleForSystem:withTL:atTime:.
void rotate_seed | ( | Random_Seed * | seed_ptr | ) |
Definition at line 320 of file legacy_random.c.
References Random_Seed::a, Random_Seed::b, Random_Seed::c, Random_Seed::d, Random_Seed::e, Random_Seed::f, x, and y.
Referenced by Universe::shipsForSaleForSystem:withTL:atTime:.
void seed_for_planet_description | ( | Random_Seed | s_seed | ) |
Definition at line 206 of file legacy_random.c.
References RanrotSeedFromRNGSeed(), rnd_seed, seed_RNG_only_for_planet_description(), and sRANROT.
Referenced by OOCharacter::basicSetUp, PlanetEntity::initFromDictionary:withAtmosphere:andSeed:, Universe::setUpPlanet, and Universe::setUpSpace.
void seed_RNG_only_for_planet_description | ( | Random_Seed | s_seed | ) |
Definition at line 197 of file legacy_random.c.
References Random_Seed::c, Random_Seed::d, Random_Seed::e, Random_Seed::f, and rnd_seed.
Referenced by OOCharacter::basicSetUp, ShipEntity::commsMessage:withUnpilotedOverride:, PlayerEntity(ScriptingPrivate)::expandMessage:, OOGenerateSystemDescription(), seed_for_planet_description(), ShipEntity::sendExpandedMessage:toShip:, PlayerEntity(ScriptMethods)::systemPseudoRandom100, PlayerEntity(ScriptMethods)::systemPseudoRandom256, and PlayerEntity(ScriptMethods)::systemPseudoRandomFloat.
void setRandomSeed | ( | RNG_Seed | a_seed | ) |
Definition at line 219 of file legacy_random.c.
References rnd_seed.
Referenced by OOCharacter::basicSetUp, GlobalRandomName(), PlanetEntity(OOPrivate)::initAsAtmosphereForPlanet:dictionary:, PlanetEntity::initFromDictionary:withAtmosphere:andSeed:, and PlayerEntity::setGuiToSystemDataScreenRefreshBackground:.
|
static |
Definition at line 41 of file legacy_random.c.
Referenced by clear_checksum(), and munge_checksum().
const Random_Seed kNilRandomSeed = {0} |
Definition at line 34 of file legacy_random.c.
Referenced by OOSystemDescriptionManager::getRandomSeedForCurrentSystem, OOSystemDescriptionManager::getRandomSeedForSystem:inGalaxy:, GlobalExpandDescription(), GlobalExpandMissionText(), is_nil_seed(), and RandomSeedFromString().
|
static |
Definition at line 37 of file legacy_random.c.
Referenced by currentRandomSeed(), gen_rnd_number(), OORestoreRandomState(), OOSaveRandomState(), OOSetReallyRandomRndSeed(), seed_for_planet_description(), seed_RNG_only_for_planet_description(), and setRandomSeed().
|
static |
Definition at line 90 of file legacy_random.c.
Referenced by OORestoreRandomState(), OOSaveRandomState(), OOSetReallyRandomRANROTSeed(), Ranrot(), ranrot_srand(), RANROTGetFullSeed(), RANROTSetFullSeed(), and seed_for_planet_description().
|
static |
Definition at line 245 of file legacy_random.c.
Referenced by OOInitReallyRandom(), OOReallyRandom(), and OOSetReallyRandomRANROTSeed().
|
static |
Definition at line 246 of file legacy_random.c.
Referenced by OOInitReallyRandom(), OOReallyRandom(), and OOSetReallyRandomRANROTSeed().