void CBankInstanceConstructor::configureObject(CGObjectInstance * object, CRandomGenerator & rng) const { //logGlobal->debugStream() << "Seed used to configure bank is " << rng.nextInt(); auto bank = dynamic_cast<CBank*>(object); bank->resetDuration = bankResetDuration; si32 totalChance = 0; for (auto & node : levels) totalChance += node["chance"].Float(); assert(totalChance != 0); si32 selectedChance = rng.nextInt(totalChance - 1); //logGlobal->debugStream() << "Selected chance for bank config is " << selectedChance; for (auto & node : levels) { if (selectedChance < node["chance"].Float()) { bank->setConfig(generateConfig(node, rng)); } else { selectedChance -= node["chance"].Float(); } } }
Configuration::Configuration(string configFile) { if (!configs.LoadFile(configFile)) { generateConfig(); } }
void CommandsDefPrivate::setConfig(const char *cfg_str) { if (cfg_str == NULL) cfg_str = ""; if (!strcmp(cfg_str, config.c_str()) && cfg.size()) return; cfg.clear(); config = cfg_str; generateConfig(); }
/** * Request generateConfig() to generate the current configuration and to write it at path. * Then update the DimServerName/Config service with the path. */ void NA62DimServer::publishConfig(std::string &path){ //std::stringstream ss; //Generate the config stream (implemented in derived class) generateConfig(path); //Put the config stream in the buffer strcpy(fConfig, path.c_str()); if(fIsStarted) fDimConfig->updateService(); }
void z::CmakeGenerator::Impl::run() { for(z::Ast::Project::ConfigList::const_iterator it = _project.configList().begin(); it != _project.configList().end(); ++it) { const z::Ast::Config& config = z::ref(it->second); generateConfig(config); } }