本文整理汇总了C++中check_item函数的典型用法代码示例。如果您正苦于以下问题:C++ check_item函数的具体用法?C++ check_item怎么用?C++ check_item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了check_item函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: compute_neighboor
/**
* \brief Align \a that on the bridge.
* \param that The other item of the collision.
* \param info Some informations about the collision.
*/
bool bear::bridge::align_on_bridge
( engine::base_item& that, universe::collision_info& info )
{
bool result = false;
universe::position_type previous_pos;
universe::position_type next_pos;
compute_neighboor
(info.other_previous_state().get_bottom_middle(),previous_pos,next_pos);
if ( check_item
( info.other_previous_state().get_bottom_middle(),
previous_pos, next_pos, 0 ) )
{
compute_neighboor(that.get_bottom_middle(),previous_pos,next_pos);
if ( ! check_item( that.get_bottom_middle(), previous_pos, next_pos,
s_line_width ) )
{
universe::position_type pos =
compute_align_position(that,previous_pos, next_pos);
apply_angle_to(that,info);
return collision_align_top(info, pos);
}
}
return result;
} // bridge::align_on_bridge()
开发者ID:yannicklm,项目名称:bear,代码行数:34,代码来源:bridge.cpp
示例2: TEST
TEST (undo_handler, test_add_remove)
{
undo_handler handler;
undoable_stub *new_item1 = new undoable_stub (1);
handler.add_item (new_item1);
EXPECT_EQ (0, new_item1->undo_id ());
handler.create_undo ("Test"); // 1
handler.remove_item (new_item1);
handler.create_undo ("Test"); // 2
undoable_stub *new_item2 = new undoable_stub (2);
handler.add_item (new_item2);
EXPECT_EQ (1, new_item2->undo_id ());
handler.create_undo ("Test"); // 3
handler.undo (1); // 2
EXPECT_EQ (nullptr, handler.get_item (1));
EXPECT_EQ (nullptr, handler.get_item (0));
handler.undo (1); // 1
EXPECT_EQ (nullptr, handler.get_item (1));
check_item (handler, 0, 1);
undoable_stub *new_item3 = new undoable_stub (3);
handler.add_item (new_item3);
handler.create_undo ("Test"); // 2
handler.undo (1); // 1
EXPECT_EQ (nullptr, handler.get_item (1));
check_item (handler, 0, 1);
}
开发者ID:telishev,项目名称:sneakPic,代码行数:32,代码来源:undo_handler_test.cpp
示例3: yp_scheme_check_parser
int yp_scheme_check_parser(
yp_check_ctx_t *ctx,
const yp_parser_t *parser)
{
if (ctx == NULL || parser == NULL) {
return KNOT_EINVAL;
}
int ret;
switch (parser->event) {
case YP_EKEY0:
reset_ctx(ctx, 0);
ret = check_item(parser->key, parser->key_len, parser->data,
parser->data_len, ctx, false);
break;
case YP_EKEY1:
reset_ctx(ctx, 1);
ret = check_item(parser->key, parser->key_len, parser->data,
parser->data_len, ctx, false);
if (ret != KNOT_EOK) {
break;
}
// Check for KEY1 event with id item.
if (ctx->current != 1) {
return KNOT_YP_ENOTSUP_ID;
}
break;
case YP_EID:
reset_ctx(ctx, 1);
ret = check_item(parser->key, parser->key_len, parser->data,
parser->data_len, ctx, false);
if (ret != KNOT_EOK) {
break;
}
// Check for ID event with nonid item.
if (ctx->current != 0) {
return KNOT_YP_EINVAL_ID;
}
break;
default:
ret = KNOT_EPARSEFAIL;
break;
}
return ret;
}
开发者ID:idtek,项目名称:knot,代码行数:51,代码来源:ypscheme.c
示例4: check_item
/**
* \brief Implementation of item:get_game().
* \param l The Lua context that is calling this function.
* \return Number of values to return to Lua.
*/
int LuaContext::item_api_get_game(lua_State* l) {
EquipmentItem& item = check_item(l, 1);
push_game(l, item.get_savegame());
return 1;
}
开发者ID:Umigatsu,项目名称:solarus,代码行数:12,代码来源:ItemApi.cpp
示例5: mallocd
// Create and populate a world from a list of rules.
golem_world *new_world(golem_rule *rules) {
golem_world *world = mallocd(sizeof(golem_world));
world->items = NULL;
golem_item *last = NULL;
for (golem_rule *rule = rules; rule; rule = rule->next) {
if (!rule->effects) {
if (rule->target) {
warn("ignoring target in no-effect rule.");
}
if (rule->others) {
warn("ignoring others in no-effect rule.");
}
log("+ item: %s\n", rule->item->name);
if (check_item(rule->item)) {
if (last) {
last->next_sibling = rule->item;
} else {
world->items = rule->item;
}
last = rule->item;
}
}
}
world->pc = find_pc(world->items);
if (!world->pc) {
die("no PC found.");
}
for (world->current = world->pc; world->current->parent;
world->current = world->current->parent);
return world;
}
开发者ID:julienq,项目名称:golem,代码行数:32,代码来源:golem.c
示例6: check_items
bool LASzip::check_items(const U16 num_items, const LASitem* items)
{
if (num_items == 0) return return_error("number of items cannot be zero");
if (items == 0) return return_error("items pointer cannot be NULL");
U16 i;
for (i = 0; i < num_items; i++)
{
if (!check_item(&items[i])) return false;
}
return true;
}
开发者ID:KAMI911,项目名称:lastools,代码行数:11,代码来源:laszip.cpp
示例7: check_item
/**
* \brief Implementation of item:get_max_amount().
* \param l The Lua context that is calling this function.
* \return Number of values to return to Lua.
*/
int LuaContext::item_api_get_max_amount(lua_State* l) {
EquipmentItem& item = check_item(l, 1);
if (!item.has_amount()) {
error(l, StringConcat() << "Item '" << item.get_name() << "' has no amount");
}
lua_pushinteger(l, item.get_max_amount());
return 1;
}
开发者ID:joshuarobinson,项目名称:solarus,代码行数:16,代码来源:ItemAPI.cpp
示例8: assert
// unpack from VLR data
bool LASzip::unpack(const U8* bytes, const I32 num)
{
// check input
if (num < 34) return return_error("too few bytes to unpack");
if (((num - 34) % 6) != 0) return return_error("wrong number bytes to unpack");
if (((num - 34) / 6) == 0) return return_error("zero items to unpack");
num_items = (num - 34) / 6;
// create item list
if (items) delete [] items;
items = new LASitem[num_items];
// do the unpacking
U16 i;
const U8* b = bytes;
compressor = *((U16*)b);
b += 2;
coder = *((U16*)b);
b += 2;
version_major = *((U8*)b);
b += 1;
version_minor = *((U8*)b);
b += 1;
version_revision = *((U16*)b);
b += 2;
options = *((U32*)b);
b += 4;
chunk_size = *((U32*)b);
b += 4;
number_of_special_evlrs = *((I64*)b);
b += 8;
offset_to_special_evlrs = *((I64*)b);
b += 8;
num_items = *((U16*)b);
b += 2;
for (i = 0; i < num_items; i++)
{
items[i].type = (LASitem::Type)*((U16*)b);
b += 2;
items[i].size = *((U16*)b);
b += 2;
items[i].version = *((U16*)b);
b += 2;
}
assert((bytes + num) == b);
// check if we support the contents
for (i = 0; i < num_items; i++)
{
if (!check_item(&items[i])) return false;
}
return true;
}
开发者ID:KAMI911,项目名称:lastools,代码行数:55,代码来源:laszip.cpp
示例9: check_item
bool Status::equip_item(const char *name)
{
bool result = false;
Item *item = check_item(name);
if (item) {
result = equip_item(item);
}
return result;
}
开发者ID:surdeg,项目名称:dragonscurse,代码行数:11,代码来源:status.cpp
示例10:
/**
* \brief Check if a given item on bridge must be erase.
* \param it Iterator on item to consider.
* \param previous_pos Position of previous item.
* \param next_pos Position of next item.
*/
bool bear::bridge::check_erase_item
(items_list_iterator it, const universe::position_type& previous_pos,
const universe::position_type& next_pos) const
{
return
check_item
( it->get_reference_item()->get_center_of_mass(),
previous_pos, next_pos, 0 ) ||
( it->get_item().get() == NULL ) ||
( it->get_item()->get_bottom() > get_top() ) ||
( it->get_item()->get_horizontal_middle() < get_left() )||
( it->get_item()->get_horizontal_middle() > get_right() );
} // bridge::check_erase_item()
开发者ID:yannicklm,项目名称:bear,代码行数:19,代码来源:bridge.cpp
注:本文中的check_item函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论