当前位置: 首页>>代码示例>>C++>>正文


C++ Inventory::hasSpaceFor方法代码示例

本文整理汇总了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");
	}
开发者ID:astrellon,项目名称:GPP,代码行数:30,代码来源:lua_inventory.cpp


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