本文整理汇总了C++中set_level函数的典型用法代码示例。如果您正苦于以下问题:C++ set_level函数的具体用法?C++ set_level怎么用?C++ set_level使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_level函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: update_plot_data
void Widget::refreshPlot()
{
if(initializing)
return;
model->fill_data();
findChild<QLineEdit*>("fermiLevelLineEdit")->setText(QString::number(model->get_fermi_level_eV(), 'f', 6));
update_plot_data();
mainCurve->setSamples(plotData.xs, plotData.ys);
double Ev = 0;
double Ec = Ev + model->get_Eg_eV();
double xmin = mainCurve->minXValue();
double xmax = mainCurve->maxXValue();
set_level(EvCurve, Ev, xmin, xmax);
set_level(EcCurve, Ec, xmin, xmax);
set_level(EaCurve, Ev + model->get_Ea_eV(), xmin, xmax);
set_level(EdCurve, Ec - model->get_Ed_eV(), xmin, xmax);
set_level(fermiLevelCurve, Ev + model->get_fermi_level_eV(), xmin, xmax);
QwtPlot* plotArea = findChild<QwtPlot*>("plotArea");
plotArea->setAxisTitle(QwtPlot::xBottom, xAxisTitle);
plotArea->setAxisTitle(QwtPlot::yLeft, yAxisTitle);
plotArea->replot();
}
示例2: test_hasspell
void test_hasspell(CuTest * tc)
{
spell *sp;
struct unit * u;
struct faction * f;
struct region * r;
test_cleanup();
test_create_world();
r = findregion(0, 0);
f = test_create_faction(0);
f->magiegebiet = M_TYBIED;
u = test_create_unit(f, r);
skill_enabled[SK_MAGIC] = 1;
sp = create_spell("testspell", 0);
sp->sptyp |= POSTCOMBATSPELL;
unit_add_spell(u, 0, sp, 2);
set_level(u, SK_MAGIC, 1);
CuAssertTrue(tc, !u_hasspell(u, sp));
set_level(u, SK_MAGIC, 2);
CuAssertTrue(tc, u_hasspell(u, sp));
set_level(u, SK_MAGIC, 1);
CuAssertTrue(tc, !u_hasspell(u, sp));
}
示例3: test_set_post_combatspell
void test_set_post_combatspell(CuTest * tc)
{
spell *sp;
struct unit * u;
struct faction * f;
struct region * r;
const int index = 2;
test_cleanup();
test_create_world();
r = findregion(0, 0);
f = test_create_faction(0);
f->magiegebiet = M_TYBIED;
u = test_create_unit(f, r);
skill_enabled[SK_MAGIC] = 1;
set_level(u, SK_MAGIC, 1);
sp = create_spell("testspell", 0);
sp->sptyp |= POSTCOMBATSPELL;
unit_add_spell(u, 0, sp, 1);
set_combatspell(u, sp, 0, 2);
CuAssertPtrEquals(tc, sp, (spell *)get_combatspell(u, index));
set_level(u, SK_MAGIC, 2);
CuAssertIntEquals(tc, 2, get_combatspelllevel(u, index));
set_level(u, SK_MAGIC, 1);
CuAssertIntEquals(tc, 1, get_combatspelllevel(u, index));
unset_combatspell(u, sp);
CuAssertIntEquals(tc, 0, get_combatspelllevel(u, index));
CuAssertPtrEquals(tc, 0, (spell *)get_combatspell(u, index));
}
示例4: setup_crew
static void setup_crew(ship *sh, struct faction *f, unit **cap, unit **crew) {
if (!f) f = test_create_faction(NULL);
assert(cap);
assert(crew);
*cap = test_create_unit(f, sh->region);
*crew = test_create_unit(f, sh->region);
(*cap)->ship = sh;
(*crew)->ship = sh;
set_level(*cap, SK_SAILING, sh->type->cptskill);
set_level(*crew, SK_SAILING, sh->type->sumskill - sh->type->cptskill);
}
示例5: finalize
void Setup::finalize()
{
auto default_logger = std::make_shared<spdlog::logger>("", default_sinks_.begin(), default_sinks_.end());
default_logger->set_level(default_level_);
spdlog::register_logger(default_logger);
for(auto pair : levels_) {
auto logger = std::make_shared<spdlog::logger>(pair.first, default_sinks_.begin(), default_sinks_.end());
spdlog::register_logger(logger);
logger->set_level(pair.second);
}
}
示例6: set_any_mode
void set_any_mode(uint8_t primary, uint8_t secondary, uint8_t *modes) {
// primary (H1/M1/L1)
if (primary) {
set_level(modes[0]);
}
// secondary (H2/M2/L2)
else {
set_level(modes[secondary]);
}
#ifdef USE_THERMAL_REGULATION
target_level = actual_level;
#endif
}
示例7: Initialize
void Logger::Initialize()
{
std::vector<spdlog::sink_ptr> sinks;
auto winColorSink = std::make_shared<spdlog::sinks::wincolor_stdout_sink_mt>();
winColorSink->set_level(spdlog::level::trace);
auto dailyFileSink = std::make_shared<spdlog::sinks::daily_file_sink_mt>("../Logs/log.txt", 0, 0);
dailyFileSink->set_level(spdlog::level::trace);
sinks.push_back(winColorSink);
sinks.push_back(dailyFileSink);
spdlog::register_logger(std::make_shared<spdlog::async_logger>("core", sinks.begin(), sinks.end(), 4096));
spdlog::register_logger(std::make_shared<spdlog::async_logger>("graphics", sinks.begin(), sinks.end(), 4096));
}
示例8: create
void create() {
::create();
set_name("slave bee");
set_short("slave bee");
set_long("This slave has been punished for a wrong doing and thus "
"is now a slave to the queen.");
if(random(2))
set_level(30);
else set_level(35);
if(random(2))
set_gender("male");
else set_gender("female");
set_race("bee");
set_body_type("insect");
set_id(({"slave", "slave bee", "bee"}));
示例9: test_give_men_magicians
static void test_give_men_magicians(CuTest * tc) {
struct give env = { 0 };
int p;
message * msg;
test_setup_ex(tc);
mt_create_error(158);
env.f2 = env.f1 = test_create_faction(NULL);
setup_give(&env);
set_level(env.src, SK_MAGIC, 1);
CuAssertPtrNotNull(tc, msg = give_men(1, env.src, env.dst, NULL));
CuAssertStrEquals(tc, "error158", test_get_messagetype(msg));
CuAssertIntEquals(tc, 1, env.dst->number);
CuAssertIntEquals(tc, 1, env.src->number);
msg_release(msg);
p = rpeasants(env.r);
CuAssertPtrNotNull(tc, msg = disband_men(1, env.dst, NULL));
CuAssertStrEquals(tc, "give_person_peasants", test_get_messagetype(msg));
CuAssertIntEquals(tc, 0, env.dst->number);
CuAssertIntEquals(tc, p+1, rpeasants(env.r));
msg_release(msg);
test_teardown();
}
示例10: set_level
/**
* \brief Contructor.
*/
bear::engine::bool_level_variable_getter::bool_level_variable_getter
( const level* lvl, const std::string& var_name )
{
set_level(lvl);
set_name(var_name);
set_default_value(false);
} // bool_level_variable_getter::bool_level_variable_getter()
示例11: setup
void setup() {
object obj;
set_name("shayman");
set_gender( "female" );
add_adj("orc");
add_ids("orc", "orc shayman");
set_short("Orc shayman");
set_long("An ugly orc shayman. This thing looks wilder than your average " +
"orc.");
set_race("orc");
set_level(10);
set_aggressive(1);
set_spell_chance(20);
set_spell_damage(20);
set_spell_message("The shayman casts a magic missile at $t.");
set_hit_skill("combat/unarmed");
set_skill("combat/unarmed", 50);
set_skill("combat/defense", 100);
obj = clone_object(DIR + "/obj/gold_staff.c");
obj->setup();
obj->move(this_object());
obj = clone_object(DIR + "/obj/orc_slayer.c");
obj->setup();
obj->move(this_object());
do_wield(obj);
}
示例12: strncpy
int NLog::startup( const char* _log_path, int _level, int _daemon_mode )
{
if ( start() < 0 )
return -1;
if ( ! _log_path )
return -1;
strncpy( log_path_, _log_path, sizeof(log_path_) );
daemon_mode_ = _daemon_mode;
if( !daemon_mode_ )
{
for ( int i = 0; i < MAX_LOG_TYPE; i++ )
log_[i] = stdout;
}
else
{
log_[ LOG_TYPE_FATAL ] = open_log_file( "fatal" );
log_[ LOG_TYPE_EMERGENCY ] = open_log_file( "emergency" );
log_[ LOG_TYPE_ERROR ] = open_log_file( "error" );
log_[ LOG_TYPE_LOG ] = open_log_file( "log" );
log_[ LOG_TYPE_DEBUG ] = open_log_file( "debug" );
}
set_level( _level );
return 0;
}
示例13: begin
LoggerPtr
LogRegistry::getOrCreateLogger(const std::string &logger_name) {
// If logger already exists, return a copy of it
auto spd_logger = spdlog::get(logger_name);
if (!spd_logger) {
// Bummer, it didn't exist. We'll create one from scratch.
try {
spd_logger = spdlog::details::registry::instance().create(
logger_name, begin(sinks_), end(sinks_));
spd_logger->set_pattern(DEFAULT_PATTERN);
/// @todo should this level be different than other levels?
spd_logger->set_level(convertToLevelEnum(minLevel_));
spd_logger->flush_on(
convertToLevelEnum(DEFAULT_FLUSH_LEVEL));
} catch (const std::exception &e) {
generalPurposeLog_->error()
<< "Caught exception attempting to create logger: "
<< e.what();
generalPurposeLog_->error() << "Error creating logger. "
"Will only log to the "
"console.";
} catch (...) {
generalPurposeLog_->error() << "Error creating logger. "
"Will only log to the "
"console.";
}
}
return Logger::makeFromExistingImplementation(logger_name,
spd_logger);
}
示例14: Pathname
void
EditorScreen::level_new_without_confirm()
{
// FIXME: dialogs don't update
level_pathname = Pathname();
set_level(std::unique_ptr<EditorLevel>(new EditorLevel));
}
示例15: test_piracy_cmd_land_to_land
static void test_piracy_cmd_land_to_land(CuTest * tc) {
unit *u;
region *r;
faction *f;
int target;
const terrain_type *t_plain;
const ship_type *stype;
test_setup();
setup_piracy();
t_plain = get_or_create_terrain("plain");
stype = test_create_shiptype("boat");
/* create a target: */
r = test_create_region(0, 0, t_plain);
f = test_create_faction(NULL);
u = test_create_unit(f, r);
u->ship = test_create_ship(r, stype);
target = f->no;
/* create a pirate: */
r = test_create_region(1, 0, t_plain);
f = test_create_faction(NULL);
u = test_create_unit(f, r);
u->ship = test_create_ship(r, stype);
set_level(u, SK_SAILING, u->ship->type->sumskill);
u->thisorder = create_order(K_PIRACY, f->locale, "%s", itoa36(target));
piracy_cmd(u);
CuAssertPtrEquals(tc, NULL, u->thisorder);
CuAssertPtrEquals(tc, r, u->region);
test_teardown();
}