• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C++ set_group函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中set_group函数的典型用法代码示例。如果您正苦于以下问题:C++ set_group函数的具体用法?C++ set_group怎么用?C++ set_group使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了set_group函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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();
}
开发者ID:Xolgrim,项目名称:server,代码行数:26,代码来源:group.test.c


示例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;
  }
}
开发者ID:gabixdev,项目名称:supertux,代码行数:30,代码来源:badguy.cpp


示例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_;
}
开发者ID:HybridDog,项目名称:supertux,代码行数:27,代码来源:icecrusher.cpp


示例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 );
    }
}
开发者ID:Rusty-Box,项目名称:supertux,代码行数:27,代码来源:scripted_object.cpp


示例5: set_group

void
Player::set_visible(bool visible_)
{
  this->visible = visible_;
  if( visible_ )
    set_group(COLGROUP_MOVING);
  else
    set_group(COLGROUP_DISABLED);
}
开发者ID:huzongyao,项目名称:AndroidSuperTux,代码行数:9,代码来源:player.cpp


示例6: set_group

void
ScriptedObject::set_solid(bool solid_)
{
  this->solid = solid_;
  if( solid ){
    set_group( COLGROUP_MOVING_STATIC );
  } else {
    set_group( COLGROUP_DISABLED );
  }
}
开发者ID:Narre,项目名称:supertux,代码行数:10,代码来源:scripted_object.cpp


示例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");
}
开发者ID:BabitsPaul,项目名称:dvl,代码行数:13,代码来源:pid.cpp


示例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;
}
开发者ID:hundeboll,项目名称:fox,代码行数:35,代码来源:recoder.cpp


示例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);
}
开发者ID:nihed,项目名称:magnetism,代码行数:25,代码来源:hippo-block-group-revision.c


示例10: set_group

void
Fish::jump()
{
  physic.set_velocity_y(FISH_JUMP_POWER);
  physic.enable_gravity(true);
  set_group(COLGROUP_MOVING);
}
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:7,代码来源:fish.cpp


示例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;

  }
}
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:26,代码来源:weak_block.cpp


示例12: set_state

void
MrIceBlock::ungrab(MovingObject& , Direction dir)
{
  this->dir = dir;
  set_state(dir == UP ? ICESTATE_FLAT : ICESTATE_KICKED);
  set_group(COLGROUP_MOVING);
}
开发者ID:slackstone,项目名称:tuxjunior,代码行数:7,代码来源:mriceblock.cpp


示例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;
  }
}
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:16,代码来源:player.cpp


示例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);
  }
}
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:30,代码来源:yeti.cpp


示例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;
	}
}
开发者ID:ArtBears,项目名称:wesnoth,代码行数:27,代码来源:item_palette.cpp


示例16: sprite

Block::Block(const ReaderMapping& lisp, const std::string& sprite_file) :
  sprite(),
  sprite_name(),
  default_sprite_name(),
  bouncing(false),
  breaking(false),
  bounce_dir(0),
  bounce_offset(0),
  original_y(-1)
{
  lisp.get("x", bbox.p1.x);
  lisp.get("y", bbox.p1.y);

  std::string sf;
  lisp.get("sprite", sf);
  if (sf.empty() || !PHYSFS_exists(sf.c_str())) {
    sf = sprite_file;
  }
  sprite = SpriteManager::current()->create(sf);
  sprite_name = sf;
  default_sprite_name = sprite_name;

  bbox.set_size(32, 32.1f);
  set_group(COLGROUP_STATIC);
  SoundManager::current()->preload("sounds/upgrade.wav");
  SoundManager::current()->preload("sounds/brick.wav");
}
开发者ID:christ2go,项目名称:supertux,代码行数:27,代码来源:block.cpp


示例17: blowing

Wind::Wind(const ReaderMapping& reader) :
  blowing(true),
  speed(),
  acceleration(100),
  elapsed_time(0)
{
  reader.get("name", name);
  reader.get("x", bbox.p1.x);
  reader.get("y", bbox.p1.y);
  float w = 32, h = 32;
  reader.get("width", w);
  reader.get("height", h);
  bbox.set_size(w, h);

  reader.get("blowing", blowing);

  float speed_x = 0, speed_y = 0;
  reader.get("speed-x", speed_x);
  reader.get("speed-y", speed_y);
  speed = Vector(speed_x, speed_y);

  reader.get("acceleration", acceleration);

  set_group(COLGROUP_TOUCHABLE);
}
开发者ID:feilix,项目名称:supertux,代码行数:25,代码来源:wind.cpp


示例18: switch

void
UnstableTile::update(float elapsed_time)
{
  switch (state) {

    case STATE_NORMAL:
      break;

    case STATE_CRUMBLING:
      if (sprite->animation_done()) {
        state = STATE_DISINTEGRATING;
        sprite->set_action("disintegrating", 1);
        set_group(COLGROUP_DISABLED);
        physic.enable_gravity(true);
      }
      break;

    case STATE_DISINTEGRATING:
      movement = physic.get_movement(elapsed_time);
      if (sprite->animation_done()) {
	remove_me();
	return;
      }
      break;
  }
}
开发者ID:BackupTheBerlios,项目名称:supertux-svn,代码行数:26,代码来源:unstable_tile.cpp


示例19: conf_syntax

static Cmdret conf_syntax(List *args)
{
  log_msg("CONFIG", "conf_syntax");
  char *group = list_arg(args, 1, VAR_STRING);
  List *words = list_arg(args, 2, VAR_LIST);
  char *single = list_arg(args, 2, VAR_STRING);
  if (!group && (!words || !single))
    return NORET;

  fn_group *grp = get_group(group);
  if (!grp)
    grp = set_group(group);

  if (single) {
    fn_syn syn = {
      .key = strdup(single),
      .group = grp,
    };
    set_syn(&syn);
    return NORET;
  }

  log_msg("CONFIG", "# %d", utarray_len(words->items));
  for (int i = 0; i < utarray_len(words->items); i++) {
    fn_syn syn = {
      .key = strdup(list_arg(words, i, VAR_STRING)),
      .group = grp,
    };
    set_syn(&syn);
  }
  return NORET;
}
开发者ID:Hummer12007,项目名称:nav,代码行数:32,代码来源:config.c


示例20: type

Flower::Flower(BonusType _type) :
  type(_type),
  sprite(),
  drawing_effect(NO_EFFECT),
  light(1.0f,1.0f,1.0f),
  lightsprite(SpriteManager::current()->create("images/objects/lightmap_light/lightmap_light-small.sprite"))
{
  bbox.set_size(32, 32);
  lightsprite->set_blend(Blend(GL_SRC_ALPHA, GL_ONE));

  if(type == FIRE_BONUS) {
    sprite = SpriteManager::current()->create("images/powerups/fireflower/fireflower.sprite");
    SoundManager::current()->preload("sounds/fire-flower.wav");
    lightsprite->set_color(Color(0.3f, 0.0f, 0.0f));
  }
  else if(type == ICE_BONUS) {
    sprite = SpriteManager::current()->create("images/powerups/iceflower/iceflower.sprite");
    SoundManager::current()->preload("sounds/fire-flower.wav");
    lightsprite->set_color(Color(0.0f, 0.1f, 0.2f));
  }
  else if(type == AIR_BONUS) {
    sprite = SpriteManager::current()->create("images/powerups/airflower/airflower.sprite");
    SoundManager::current()->preload("sounds/fire-flower.wav");
    lightsprite->set_color(Color(0.15f, 0.0f, 0.15f));
  }
  else if(type == EARTH_BONUS) {
    sprite = SpriteManager::current()->create("images/powerups/earthflower/earthflower.sprite");
    SoundManager::current()->preload("sounds/fire-flower.wav");
    lightsprite->set_color(Color(0.0f, 0.3f, 0.0f));
  } else {
    assert(false);
  }

  set_group(COLGROUP_TOUCHABLE);
}
开发者ID:ACMEware,项目名称:Paper-Hurricane,代码行数:35,代码来源:flower.cpp



注:本文中的set_group函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ set_hide_on_ok函数代码示例发布时间:2022-05-30
下一篇:
C++ set_gpio_val函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap