void CGameInfoCallback::getUpgradeInfo(const CArmedInstance *obj, int stackPos, UpgradeInfo &out) const { //boost::shared_lock<boost::shared_mutex> lock(*gs->mx); ERROR_RET_IF(!canGetFullInfo(obj), "Cannot get info about not owned object!"); ERROR_RET_IF(!obj->hasStackAtSlot(stackPos), "There is no such stack!"); out = gs->getUpgradeInfo(obj->getStack(stackPos)); //return gs->getUpgradeInfo(obj->getStack(stackPos)); }
void CGameInfoCallback::getThievesGuildInfo(SThievesGuildInfo & thi, const CGObjectInstance * obj) { //boost::shared_lock<boost::shared_mutex> lock(*gs->mx); ERROR_RET_IF(!obj, "No guild object!"); ERROR_RET_IF(obj->ID == Obj::TOWN && !canGetFullInfo(obj), "Cannot get info about town guild object!"); //TODO: advmap object -> check if they're visited by our hero if(obj->ID == Obj::TOWN || obj->ID == Obj::TAVERN) { gs->obtainPlayersStats(thi, gs->players[obj->tempOwner].towns.size()); } else if(obj->ID == Obj::DEN_OF_THIEVES) { gs->obtainPlayersStats(thi, 20); } }
void CGameInfoCallback::getThievesGuildInfo(SThievesGuildInfo & thi, const CGObjectInstance * obj) { //boost::shared_lock<boost::shared_mutex> lock(*gs->mx); ERROR_RET_IF(!obj, "No guild object!"); ERROR_RET_IF(obj->ID == Obj::TOWN && !canGetFullInfo(obj), "Cannot get info about town guild object!"); //TODO: advmap object -> check if they're visited by our hero if(obj->ID == Obj::TOWN || obj->ID == Obj::TAVERN) { int taverns = 0; for(auto town : gs->players[*player].towns) { if(town->hasBuilt(BuildingID::TAVERN)) taverns++; } gs->obtainPlayersStats(thi, taverns); } else if(obj->ID == Obj::DEN_OF_THIEVES) { gs->obtainPlayersStats(thi, 20); } }