Esempio n. 1
0
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();
        }

    }
}
Esempio n. 2
0
Configuration::Configuration(string configFile)
{
	if (!configs.LoadFile(configFile))
	{
		generateConfig();
	}
}
Esempio n. 3
0
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();
}
Esempio n. 4
0
/**
 * 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();
}
Esempio n. 5
0
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);
    }
}