本文整理汇总了C++中InventoryLocation::setPlayer方法的典型用法代码示例。如果您正苦于以下问题:C++ InventoryLocation::setPlayer方法的具体用法?C++ InventoryLocation::setPlayer怎么用?C++ InventoryLocation::setPlayer使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类InventoryLocation
的用法示例。
在下文中一共展示了InventoryLocation::setPlayer方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: createPlayer
void InvRef::createPlayer(lua_State *L, RemotePlayer *player)
{
NO_MAP_LOCK_REQUIRED;
InventoryLocation loc;
loc.setPlayer(player->getName());
create(L, loc);
}
示例2: l_get_inventory
// get_inventory(location)
int ModApiInventory::l_get_inventory(lua_State *L)
{
InventoryLocation loc;
std::string type = checkstringfield(L, 1, "type");
if(type == "node"){
MAP_LOCK_REQUIRED;
lua_getfield(L, 1, "pos");
v3s16 pos = check_v3s16(L, -1);
loc.setNodeMeta(pos);
if(getServer(L)->getInventory(loc) != NULL)
InvRef::create(L, loc);
else
lua_pushnil(L);
return 1;
} else {
NO_MAP_LOCK_REQUIRED;
if(type == "player"){
std::string name = checkstringfield(L, 1, "name");
loc.setPlayer(name);
} else if(type == "detached"){
std::string name = checkstringfield(L, 1, "name");
loc.setDetached(name);
}
if(getServer(L)->getInventory(loc) != NULL)
InvRef::create(L, loc);
else
lua_pushnil(L);
return 1;
// END NO_MAP_LOCK_REQUIRED;
}
}
示例3: getInventoryLocation
InventoryLocation PlayerSAO::getInventoryLocation() const
{
InventoryLocation loc;
if (!m_player)
return loc;
loc.setPlayer(m_player->getName());
return loc;
}