本文整理汇总了C++中set_group函数的典型用法代码示例。如果您正苦于以下问题:C++ set_group函数的具体用法?C++ set_group怎么用?C++ set_group使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了set_group函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: test_group
static void test_group(CuTest * tc)
{
unit *u;
region *r;
faction *f;
group *g;
test_cleanup();
test_create_world();
r = findregion(0, 0);
f = test_create_faction(0);
assert(r && f);
u = test_create_unit(f, r);
assert(u);
CuAssertTrue(tc, join_group(u, "hodor"));
CuAssertPtrNotNull(tc, (g = get_group(u)));
CuAssertStrEquals(tc, "hodor", g->name);
CuAssertIntEquals(tc, 1, g->members);
set_group(u, 0);
CuAssertIntEquals(tc, 0, g->members);
CuAssertPtrEquals(tc, 0, get_group(u));
set_group(u, g);
CuAssertIntEquals(tc, 1, g->members);
CuAssertPtrEquals(tc, g, get_group(u));
test_cleanup();
}
示例2: switch
void
BadGuy::set_state(State state_)
{
if(this->state == state_)
return;
State laststate = this->state;
this->state = state_;
switch(state_) {
case STATE_SQUISHED:
state_timer.start(SQUISH_TIME);
break;
case STATE_ACTIVE:
set_group(colgroup_active);
//bbox.set_pos(start_position);
break;
case STATE_INACTIVE:
// was the badguy dead anyway?
if(laststate == STATE_SQUISHED || laststate == STATE_FALLING) {
remove_me();
}
set_group(COLGROUP_DISABLED);
break;
case STATE_FALLING:
set_group(COLGROUP_DISABLED);
break;
default:
break;
}
}
示例3: switch
void
IceCrusher::set_state(IceCrusherState state_, bool force)
{
if ((state == state_) && (!force)) return;
switch (state_) {
case IDLE:
set_group(COLGROUP_STATIC);
physic.enable_gravity (false);
m_sprite->set_action("idle");
break;
case CRUSHING:
set_group(COLGROUP_MOVING_STATIC);
physic.reset ();
physic.enable_gravity (true);
m_sprite->set_action("crushing");
break;
case RECOVERING:
set_group(COLGROUP_MOVING_STATIC);
physic.enable_gravity (false);
m_sprite->set_action("recovering");
break;
default:
log_debug << "IceCrusher in invalid state" << std::endl;
break;
}
state = state_;
}
示例4: MovingSprite
ScriptedObject::ScriptedObject(const ReaderMapping& lisp) :
MovingSprite(lisp, "images/objects/bonus_block/brick.sprite", LAYER_OBJECTS, COLGROUP_MOVING_STATIC),
ExposedObject<ScriptedObject, scripting::ScriptedObject>(this),
physic(),
solid(),
physic_enabled(),
visible(),
new_vel_set(false),
new_vel(),
new_size()
{
if (!lisp.get("name", name)) name = "";
if(name.empty()) {
name = "unnamed" + std::to_string(graphicsRandom.rand());
log_warning << "Scripted object must have a name specified, setting to: " << name << std::endl;
}
if (!lisp.get("solid", solid)) solid = true;
if (!lisp.get("physic-enabled", physic_enabled)) physic_enabled = true;
if (!lisp.get("visible", visible)) visible = true;
layer = reader_get_layer (lisp, /* default = */ LAYER_OBJECTS);
if( solid ) {
set_group( COLGROUP_MOVING_STATIC );
} else {
set_group( COLGROUP_DISABLED );
}
}
示例5: set_group
void
Player::set_visible(bool visible_)
{
this->visible = visible_;
if( visible_ )
set_group(COLGROUP_MOVING);
else
set_group(COLGROUP_DISABLED);
}
示例6: set_group
void
ScriptedObject::set_solid(bool solid_)
{
this->solid = solid_;
if( solid ){
set_group( COLGROUP_MOVING_STATIC );
} else {
set_group( COLGROUP_DISABLED );
}
}
示例7: set_group
dvl::pid_table::pid_table()
{
//register internal ids
set_group(pid().set_group(GROUP_INTERNAL), L"INTERNAL");
set_element(EMPTY, L"EMPTY");
set_element(PARSER, L"PARSER");
//register diagnostic routines
set_group(pid().set_group(GROUP_DIAGNOSTIC), L"DIAGNOSTIC");
set_element(ECHO, L"ECHO");
}
示例8: g
void recoder::init()
{
guard g(m_lock);
set_group("recoder");
set_state(STATE_WAIT);
init_timeout(FLAGS_recoder_timeout);
/* reset counters */
m_budget = 0;
m_rec_pkt_count = 0;
m_io->read_one_hops(_key.dst);
helper_msg best_helper = m_io->get_best_one_hop(_key.dst);
if (best_helper.tq_total == 0) {
VLOG(LOG_GEN) << "Recoder " << m_coder << ": No best one hop";
m_max_budget = this->symbols()*FLAGS_fixed_overshoot;
return;
}
m_io->read_link(best_helper.addr);
m_io->read_link(_key.dst);
e1 = ONE - m_io->get_link(best_helper.addr);
e2 = ONE - best_helper.tq_second_hop * 4.5; // Scale to revert hop penalty
e3 = ONE - m_io->get_link(_key.dst);
if (e1 == ONE || e2 == ONE || e3 == ONE) {
VLOG(LOG_GEN) << "Recoder " << m_coder << ": Missing link estimate";
m_max_budget = this->symbols()*FLAGS_fixed_overshoot;
return;
}
m_max_budget = recoder_budget(this->symbols(), e1, e2, e3);
VLOG(LOG_GEN) << "Recoder " << m_coder << ": Initialized" << _key;
}
示例9: hippo_block_group_revision_update
static void
hippo_block_group_revision_update (HippoBlock *block)
{
HippoBlockGroupRevision *block_group_revision = HIPPO_BLOCK_GROUP_REVISION(block);
DDMDataResource *group_resource;
DDMDataResource *revision_resource;
HippoGroup *group = NULL;
HIPPO_BLOCK_CLASS(hippo_block_group_revision_parent_class)->update(block);
ddm_data_resource_get(block->resource,
"group", DDM_DATA_RESOURCE, &group_resource,
"revision", DDM_DATA_RESOURCE, &revision_resource,
NULL);
if (group_resource != NULL)
group = hippo_group_get_for_resource(group_resource);
set_group(block_group_revision, group);
update_edit_link(block_group_revision);
update_chat_id(block_group_revision);
if (group != NULL)
g_object_unref(group);
}
示例10: set_group
void
Fish::jump()
{
physic.set_velocity_y(FISH_JUMP_POWER);
physic.enable_gravity(true);
set_group(COLGROUP_MOVING);
}
示例11: switch
void
WeakBlock::update(float )
{
switch (state) {
case STATE_NORMAL:
break;
case STATE_BURNING:
if (sprite->animation_done()) {
state = STATE_DISINTEGRATING;
sprite->set_action("disintegrating", 1);
flags &= ~FLAG_SOLID;
set_group(COLGROUP_DISABLED);
}
break;
case STATE_DISINTEGRATING:
if (sprite->animation_done()) {
remove_me();
return;
}
break;
}
}
示例12: set_state
void
MrIceBlock::ungrab(MovingObject& , Direction dir)
{
this->dir = dir;
set_state(dir == UP ? ICESTATE_FLAT : ICESTATE_KICKED);
set_group(COLGROUP_MOVING);
}
示例13: set_group
void
Player::set_ghost_mode(bool enable)
{
if (ghost_mode == enable) return;
if (enable) {
ghost_mode = true;
set_group(COLGROUP_DISABLED);
physic.enable_gravity(false);
log_debug << "You feel lightheaded. Use movement controls to float around, press ACTION to scare badguys." << std::endl;
} else {
ghost_mode = false;
set_group(COLGROUP_MOVING);
physic.enable_gravity(true);
log_debug << "You feel solid again." << std::endl;
}
}
示例14: set_group
void Yeti::take_hit(Player& )
{
if(safe_timer.started())
return;
sound_manager->play("sounds/yeti_roar.wav");
hit_points--;
if(hit_points <= 0) {
// We're dead
physic.enable_gravity(true);
physic.set_velocity_x(0);
physic.set_velocity_y(0);
state = SQUISHED;
state_timer.start(SQUISH_TIME);
set_group(COLGROUP_MOVING_ONLY_STATIC);
sprite->set_action("dead");
if (countMe) Sector::current()->get_level()->stats.badguys++;
if(dead_script != "") {
std::istringstream stream(dead_script);
Sector::current()->run_script(stream, "Yeti - dead-script");
}
}
else {
safe_timer.start(SAFE_TIME);
}
}
示例15: overlay
void item_palette::setup(const config& cfg)
{
for (const config& group : cfg.child_range("item_group")) {
groups_.push_back(item_group(group));
for (const config& item : group.child_range("item")) {
item_map_.insert(std::pair<std::string, overlay>(item["id"], overlay(item)));
group_map_[group["id"]].push_back(item["id"]);
if (!group["core"].to_bool(false))
non_core_items_.insert(item["id"]);
}
nmax_items_ = std::max(nmax_items_, group_map_[group["id"]].size());
}
select_fg_item("anvil");
select_bg_item("altar");
// Set the default group
set_group("items");
if(active_group().empty()) {
ERR_ED << "No items found." << std::endl;
}
}