本文整理汇总了C++中House::getPlayerRights方法的典型用法代码示例。如果您正苦于以下问题:C++ House::getPlayerRights方法的具体用法?C++ House::getPlayerRights怎么用?C++ House::getPlayerRights使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类House
的用法示例。
在下文中一共展示了House::getPlayerRights方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: UseItem
bool Actions::UseItem(Player* player, const Position &pos,const unsigned char stack,
const unsigned short itemid, const unsigned char index)
{
if(canUse(player,pos)== TOO_FAR){
player->sendCancel("Too far away.");
return false;
}
Item *item = dynamic_cast<Item*>(game->getThing(pos,stack,player));
if(!item){
#ifdef __DEBUG__
std::cout << "no item" << std::endl;
#endif
player->sendCancel("You can not use this object.");
return false;
}
if(item->getID() != itemid){
#ifdef __DEBUG__
std::cout << "no id" << std::endl;
#endif
player->sendCancel("You can not use this object.");
return false;
}
#ifdef TLM_HOUSE_SYSTEM
if (Item::items[itemid].isDoor)
{
Tile* tile = game->getTile(pos);
House* house = tile? tile->getHouse() : NULL;
if (house && player->access < g_config.ACCESS_HOUSE && house->getPlayerRights(pos, player->getName()) <= HOUSE_GUEST)
{
player->sendCancel("You are not allowed to open this door.");
return false;
}
}
#endif //TLM_HOUSE_SYSTEM
//look for the item in action maps
Action *action = getAction(item);
//if found execute it
if(action){
Position itempos = game->getThingMapPos(player, pos);
game->autoCloseTrade(item);
PositionEx posEx(pos,stack);
if(action->executeUse(player,item,posEx,posEx)){
return true;
}
}
//if it is a container try to open it
if(dynamic_cast<Container*>(item)){
if(openContainer(player,dynamic_cast<Container*>(item),index))
return true;
}
//we dont know what to do with this item
player->sendCancel("You can not use this object.");
return false;
}