本文整理汇总了C++中Obj::is_in_inventory方法的典型用法代码示例。如果您正苦于以下问题:C++ Obj::is_in_inventory方法的具体用法?C++ Obj::is_in_inventory怎么用?C++ Obj::is_in_inventory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Obj
的用法示例。
在下文中一共展示了Obj::is_in_inventory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: drag_accept_drop
bool InventoryWidget::drag_accept_drop(int x, int y, int message, void *data)
{
GUI::get_gui()->force_full_redraw();
DEBUG(0,LEVEL_DEBUGGING,"InventoryWidget::drag_accept_drop()\n");
if(message == GUI_DRAG_OBJ)
{
Obj *obj = (Obj*)data;
x -= area.x;
y -= area.y;
if(target_obj == NULL) //we need to check this so we don't screw up target_obj on subsequent calls
{
if(drag_set_target_obj(x, y) == false)
{
DEBUG(0,LEVEL_WARNING,"InventoryWidget: Didn't hit any widget object targets!\n");
return false;
}
}
Actor *src_actor = Game::get_game()->get_player()->get_actor();
if(obj->get_actor_holding_obj() == actor)
src_actor = actor;
else if(!obj->is_in_inventory() && actor == Game::get_game()->get_player()->get_actor())
{
Game::get_game()->get_scroll()->display_string("Get-");
Game::get_game()->get_scroll()->display_string(obj_manager->look_obj(obj, OBJ_SHOW_PREFIX));
}
else
Game::get_game()->get_event()->display_move_text(actor, obj);
if(!obj->is_in_inventory()
&& !Game::get_game()->get_map_window()->can_get_obj(actor, obj))
{
Game::get_game()->get_scroll()->message("\n\nblocked\n\n");
return false;
}
if((Game::get_game()->get_usecode()->has_getcode(obj)
&& !Game::get_game()->get_usecode()->get_obj(obj, actor))
|| !Game::get_game()->get_event()->can_move_obj_between_actors(obj, src_actor, actor))
{
Game::get_game()->get_scroll()->message("\n\n");
return false;
}
else if(!obj->is_in_inventory()
&& obj_manager->obj_is_damaging(obj, Game::get_game()->get_player()->get_actor()))
{
Game::get_game()->get_player()->subtract_movement_points(3);
return false;
}
else if(src_actor != actor || !obj->is_in_inventory())
Game::get_game()->get_scroll()->message("\n\n");
if(src_actor != actor) // get plus move
Game::get_game()->get_player()->subtract_movement_points(8);
else if(!obj->is_in_inventory()) // get
Game::get_game()->get_player()->subtract_movement_points(3);
UseCode *usecode = Game::get_game()->get_usecode();
if(usecode->is_chest(obj) && obj->frame_n == 0) //open chest
obj->frame_n = 1; //close the chest
DEBUG(0,LEVEL_DEBUGGING,"Drop Accepted\n");
return true;
}
DEBUG(0,LEVEL_DEBUGGING,"Drop Refused\n");
return false;
}