本文整理汇总了C++中Inventory::hasSpaceFor方法的典型用法代码示例。如果您正苦于以下问题:C++ Inventory::hasSpaceFor方法的具体用法?C++ Inventory::hasSpaceFor怎么用?C++ Inventory::hasSpaceFor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Inventory
的用法示例。
在下文中一共展示了Inventory::hasSpaceFor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Inventory_has_space_for
/**
* Returns true if there is enough space to place the given item at
* the given location. False indicates that either the location will put
* the item outside of the bounds of the inventory or that there is another
* item blocking this items placement.
*
* @param Item item The item to place.
* @param integer x The x location to check at
* @param integer y The y location to check at
* @returns boolean True if there is space at the given location for the given item.
* False otherwise if there isn't any space or the location is invalid.
*/
int Inventory_has_space_for(lua_State *lua)
{
Inventory *inv = castUData<Inventory>(lua, 1);
if (inv)
{
Item *item = castUData<Item>(lua, 2);
if (item)
{
if (lua_isnum(lua, 3) && lua_isnum(lua, 4))
{
lua_pushboolean(lua, inv->hasSpaceFor(item, lua_tointeger(lua, 3), lua_tointeger(lua, 4)));
return 1;
}
}
return LuaState::expectedArgs(lua, "has_space_for", "Item item, integer x, integer y");
}
return LuaState::expectedContext(lua, "has_space_for", "Inventory");
}