int Player::getAttackRange() const { if(hasFlag("tianyi_success") || hasFlag("jiangchi_invoke")) return 1000; if(weapon) return weapon->getRange(); else if(hasSkill("zhengfeng")) return hp; else return 1; }
void Tile::postAddNotification(Thing* thing, const Cylinder* oldParent, int32_t index, cylinderlink_t link /*= LINK_OWNER*/) { SpectatorVec list; g_game.map.getSpectators(list, getPosition(), true, true); for (Creature* spectator : list) { spectator->getPlayer()->postAddNotification(thing, oldParent, index, LINK_NEAR); } //add a reference to this item, it may be deleted after being added (mailbox for example) Creature* creature = thing->getCreature(); Item* item; if (creature) { creature->incrementReferenceCounter(); item = nullptr; } else { item = thing->getItem(); if (item) { item->incrementReferenceCounter(); } } if (link == LINK_OWNER) { if (hasFlag(TILESTATE_TELEPORT)) { Teleport* teleport = getTeleportItem(); if (teleport) { teleport->addThing(thing); } } else if (hasFlag(TILESTATE_TRASHHOLDER)) { TrashHolder* trashholder = getTrashHolder(); if (trashholder) { trashholder->addThing(thing); } } else if (hasFlag(TILESTATE_MAILBOX)) { Mailbox* mailbox = getMailbox(); if (mailbox) { mailbox->addThing(thing); } } //calling movement scripts Creature* creature = thing->getCreature(); if (creature) { g_moveEvents->onCreatureMove(creature, this, oldParent ? oldParent->getPosition() : getPosition(), MOVE_EVENT_STEP_IN); } else if (item) { g_moveEvents->onItemMove(item, this, true); } } //release the reference to this item onces we are finished if (creature) { g_game.ReleaseCreature(creature); } else if (item) { g_game.ReleaseItem(item); } }
void Renderer::setSurfaceSize(const Size &size) { if (!_surfaceSize.equals(size)) { if (hasFlag(RenderFlag::PaginatedLayout) || !hasFlag(RenderFlag::NoHeightCheck) || size.width != _surfaceSize.width) { _renderingDirty = true; } _surfaceSize = size; } if (!_media.surfaceSize.equals(_surfaceSize)) { _media.surfaceSize = _surfaceSize; } }
void PageMarker::setOptions(const RecognizeOptions& opts) { image_data_->gbOneColumn = opts.oneColumn(); image_data_->hCPAGE = cpage_; image_data_->hCCOM = comp_cont_; image_data_->hCLINE = cline_; image_data_->searchPictures = opts.pictureSearch(); image_data_->gnLanguage = opts.language(); image_data_->hDebugSVLines = hasFlag(DEBUG_SVL); image_data_->hDebugSVLinesStep = hasFlag(DEBUG_SVL_STEP); image_data_->hDebugSVLinesData = hasFlag(DEBUG_SVL_DATA); }
void AbstractOptionStorage::setMinValueCount(int count) { GMX_RELEASE_ASSERT(!hasFlag(efOption_MultipleTimes), "setMinValueCount() not supported with efOption_MultipleTimes"); GMX_RELEASE_ASSERT(count >= 0, "Invalid value count"); minValueCount_ = count; if (isSet() && !hasFlag(efOption_DontCheckMinimumCount) && valueCount() < minValueCount_) { GMX_THROW(InvalidInputError("Too few values")); } }
void Tile::postAddNotification(Creature* actor, Thing* thing, const Cylinder* oldParent, int32_t index, CylinderLink_t link/* = LINK_OWNER*/) { const SpectatorVec& list = g_game.getSpectators(pos); SpectatorVec::const_iterator it; Player* tmpPlayer = NULL; for(it = list.begin(); it != list.end(); ++it) { if((tmpPlayer = (*it)->getPlayer())) tmpPlayer->postAddNotification(actor, thing, oldParent, index, LINK_NEAR); } //add a reference to this item, it may be deleted after being added (mailbox for example) thing->addRef(); if(link == LINK_OWNER) { //calling movement scripts if(Creature* creature = thing->getCreature()) { const Tile* fromTile = NULL; if(oldParent) fromTile = oldParent->getTile(); g_moveEvents->onCreatureMove(actor, creature, fromTile, this, true); } else if(Item* item = thing->getItem()) { g_moveEvents->onAddTileItem(this, item); g_moveEvents->onItemMove(actor, item, this, true); } if(hasFlag(TILESTATE_TELEPORT)) { if(Teleport* teleport = getTeleportItem()) teleport->__addThing(actor, thing); } else if(hasFlag(TILESTATE_TRASHHOLDER)) { if(TrashHolder* trashHolder = getTrashHolder()) trashHolder->__addThing(actor, thing); } else if(hasFlag(TILESTATE_MAILBOX)) { if(Mailbox* mailbox = getMailbox()) mailbox->__addThing(actor, thing); } } //release the reference to this item onces we are finished g_game.freeThing(thing); }
void Tile::postAddNotification(Thing* thing, const Cylinder* oldParent, int32_t index, cylinderlink_t link /*= LINK_OWNER*/) { const Position& cylinderMapPos = getPosition(); SpectatorVec list; g_game.getSpectators(list, cylinderMapPos, true, true); for (SpectatorVec::const_iterator it = list.begin(), end = list.end(); it != end; ++it) { (*it)->getPlayer()->postAddNotification(thing, oldParent, index, LINK_NEAR); } //add a reference to this item, it may be deleted after being added (mailbox for example) thing->useThing2(); if (link == LINK_OWNER) { //calling movement scripts Creature* creature = thing->getCreature(); if (creature) { g_moveEvents->onCreatureMove(creature, this, true); } else { Item* item = thing->getItem(); if (item) { g_moveEvents->onItemMove(item, this, true); } } if (hasFlag(TILESTATE_TELEPORT)) { Teleport* teleport = getTeleportItem(); if (teleport) { teleport->__addThing(thing); } } else if (hasFlag(TILESTATE_TRASHHOLDER)) { TrashHolder* trashholder = getTrashHolder(); if (trashholder) { trashholder->__addThing(thing); } } else if (hasFlag(TILESTATE_MAILBOX)) { Mailbox* mailbox = getMailbox(); if (mailbox) { mailbox->__addThing(thing); } } } //release the reference to this item onces we are finished g_game.FreeThing(thing); }
void AbstractOptionStorage::startSet() { GMX_RELEASE_ASSERT(!bInSet_, "finishSet() not called"); // The last condition takes care of the situation where multiple // sources are used, and a later source should be able to reassign // the value even though the option is already set. if (isSet() && !hasFlag(efOption_MultipleTimes) && !hasFlag(efOption_ClearOnNextSet)) { GMX_THROW(InvalidInputError("Option specified multiple times")); } clearSet(); bInSet_ = true; bSetValuesHadErrors_ = false; }
int Player::getAttackRange(bool include_weapon) const { if (hasFlag("InfinityAttackRange") || getMark("InfinityAttackRange") > 0) return 1000; include_weapon = include_weapon && weapon != NULL; int fixeddis = Sanguosha->correctAttackRange(this, include_weapon, true); if (fixeddis > 0) return fixeddis; int original_range = 1, weapon_range = 0; if (include_weapon) { const Weapon *card = qobject_cast<const Weapon *>(weapon->getRealCard()); Q_ASSERT(card); weapon_range = card->getRange(); } int real_range = qMax(original_range, weapon_range) + Sanguosha->correctAttackRange(this, include_weapon, false); if (real_range < 0) real_range = 0; return real_range; }
void TypeSymbol::codegenDef() { GenInfo *info = gGenInfo; if( id == breakOnCodegenID || (breakOnCodegenCname[0] && 0 == strcmp(cname, breakOnCodegenCname)) ) { gdbShouldBreakHere(); } if (!hasFlag(FLAG_EXTERN)) { type->codegenDef(); } this->addFlag(FLAG_CODEGENNED); if( info->cfile ) { // no action required. } else { #ifdef HAVE_LLVM llvm::Type *type = info->lvt->getType(cname); if(type == NULL) { printf("No type '%s'/'%s' found\n", cname, name); INT_FATAL(this, "No type found"); } llvmType = type; if(debug_info) debug_info->get_type(this->type); #endif } }
TrashHolder* Tile::getTrashHolder() const { if (!hasFlag(TILESTATE_TRASHHOLDER)) { return NULL; } if (ground && ground->getTrashHolder()) { return ground->getTrashHolder(); } if (const TileItemVector* items = getItemList()) { for (ItemVector::const_reverse_iterator it = items->rbegin(); it != items->rend(); ++it) { if ((*it)->getTrashHolder()) { return (*it)->getTrashHolder(); } } } return NULL; }
BedItem* Tile::getBedItem() const { if (!hasFlag(TILESTATE_BED)) { return NULL; } if (ground && ground->getBed()) { return ground->getBed(); } if (const TileItemVector* items = getItemList()) { for (ItemVector::const_reverse_iterator it = items->rbegin(); it != items->rend(); ++it) { if ((*it)->getBed()) { return (*it)->getBed(); } } } return NULL; }
void Console::registerAlias(const std::string &name, const std::string &cmd) { AliasRecord *a = findAlias(name); if (a == nullptr) { verifyRegistration(CON_Lang("Alias registration"), name, false); AliasRecord newAlias(name, cmd); // Zaradi novy alias tak, aby byly setridene podle abecedy size_t position = 0; for (const AliasRecord &alias : aliases) { if (alias.getName().compare(name) > 0) { break; } ++position; } aliases.insert(aliases.begin() + position, newAlias); } else { a->setCommand(cmd); } if (hasFlag(RegInfoFlag)) { print(CON_Format(CON_Lang("Alias registration: \"{0}\" as \"{1}\" has been successful\n")) << name << cmd); } }
void Renderer::setPageMargin(const Margin &margin) { if (_pageMargin != margin) { _pageMargin = margin; if (hasFlag(RenderFlag::PaginatedLayout)) { _renderingDirty = true; } } }
void SelectionData::refreshMassesAndCharges(const t_topology *top) { if (top != NULL && isDynamic() && !hasFlag(efSelection_DynamicMask)) { computeMassesAndCharges(top, rawPositions_, &posMass_, &posCharge_); } }
bool Tile::isMoveableBlocking() const { if (!ground || hasFlag(TILESTATE_BLOCKSOLID)) { return true; } return false; }
ZoneType_t Tile::getZone() const { if (hasFlag(TILESTATE_PROTECTIONZONE)) { return ZONE_PROTECTION; } else if (hasFlag(TILESTATE_NOPVPZONE)) { return ZONE_NOPVP; } else if (hasFlag(TILESTATE_PVPZONE)) { return ZONE_PVP; } return ZONE_NORMAL; }
void Tile::setTileFlags(const Item* item) { if (!hasFlag(TILESTATE_FLOORCHANGE)) { const ItemType& it = Item::items[item->getID()]; if (it.floorChange != 0) { setFlag(it.floorChange); } } if (item->hasProperty(CONST_PROP_IMMOVABLEBLOCKSOLID)) { setFlag(TILESTATE_IMMOVABLEBLOCKSOLID); } if (item->hasProperty(CONST_PROP_BLOCKPATH)) { setFlag(TILESTATE_BLOCKPATH); } if (item->hasProperty(CONST_PROP_NOFIELDBLOCKPATH)) { setFlag(TILESTATE_NOFIELDBLOCKPATH); } if (item->hasProperty(CONST_PROP_IMMOVABLENOFIELDBLOCKPATH)) { setFlag(TILESTATE_IMMOVABLENOFIELDBLOCKPATH); } if (item->getTeleport()) { setFlag(TILESTATE_TELEPORT); } if (item->getMagicField()) { setFlag(TILESTATE_MAGICFIELD); } if (item->getMailbox()) { setFlag(TILESTATE_MAILBOX); } if (item->getTrashHolder()) { setFlag(TILESTATE_TRASHHOLDER); } if (item->hasProperty(CONST_PROP_BLOCKSOLID)) { setFlag(TILESTATE_BLOCKSOLID); } if (item->getBed()) { setFlag(TILESTATE_BED); } const Container* container = item->getContainer(); if (container && container->getDepotLocker()) { setFlag(TILESTATE_DEPOT); } if (item->hasProperty(CONST_PROP_SUPPORTHANGABLE)) { setFlag(TILESTATE_SUPPORTS_HANGABLE); } }
bool Player::hasSkill(const QString &skill_name, bool include_lose) const{ if (!include_lose) { if (!hasEquipSkill(skill_name) && ((hasFlag("huoshui") && getHp() >= (getMaxHp() + 1) / 2) || getMark("Qingcheng" + skill_name) > 0)) return false; } return skills.contains(skill_name) || acquired_skills.contains(skill_name); }
void AbstractOptionStorage::finish() { GMX_RELEASE_ASSERT(!bInSet_, "finishSet() not called"); processAll(); if (isRequired() && !(isSet() || hasFlag(efOption_ExplicitDefaultValue))) { GMX_THROW(InvalidInputError("Option is required, but not set")); } }
bool ArgSymbol::requiresCPtr(void) { /* This used to be true for INTENT_REF, but that is handled with the "_ref" class and we don't need to generate a pointer for it directly */ if (hasFlag(FLAG_ARG_THIS)) { if (is_complex_type(type)) return true; } return argMustUseCPtr(type); }
int ai_shouldattackmelee(struct world* world, struct entity* entity, struct aitask* ai) { if (entity->attacking == NULL || entity->attacking->health <= 0. || (entity->type == ENT_PLAYER && (entity->data.player.player->gamemode == 1 || entity->data.player.player->gamemode == 3))) return 0; struct entity_info* ei = getEntityInfo(entity->type); struct entity_info* ei2 = getEntityInfo(entity->attacking->type); if (ei == NULL || ei2 == NULL || !hasFlag(ei2, "livingbase")) return 0; return entity->attacking != NULL; //float reach = ei->width * 2. * ei->width * 2. + ei2->width; //return reach >= entity_distsq(entity->attacking, entity); }
int Player::getAttackRange() const{ if(hasFlag("tianyi_success") || hasFlag("jiangchi_invoke")) return 1000; if(weapon){ if(weapon->objectName() == "luofeng_bow") return hp; else if(weapon->objectName() == "tianlangh") return qMax(getMark("@tianlang"), 1); else return weapon->getRange(); } else if(hasSkill("zhengfeng")) return hp; else if(hasSkill("CBZhangBa")) return 3; else return 1; }
bool ChatChannel::talk(std::string nick, MessageClasses type, std::string text) { for(UsersMap::iterator it = m_users.begin(); it != m_users.end(); ++it) it->second->sendChannelMessage(nick, text, type, m_id); if(hasFlag(CHANNELFLAG_LOGGED) && m_file->is_open()) *m_file << "[" << formatDate() << "] " << nick << ": " << text << std::endl; return true; }
int Player::getAttackRange() const{ int original_range = 1; if (hasFlag("InfinityAttackRange") || getMark("InfinityAttackRange") > 0) original_range = 10000; // Actually infinity int weapon_range = 0; if (weapon != NULL) { const Weapon *card = qobject_cast<const Weapon *>(weapon->getRealCard()); Q_ASSERT(card); weapon_range = card->getRange(); } return qMax(original_range, weapon_range); }
void AbstractOptionStorage::setMaxValueCount(int count) { GMX_RELEASE_ASSERT(!hasFlag(efOption_MultipleTimes), "setMaxValueCount() not supported with efOption_MultipleTimes"); GMX_RELEASE_ASSERT(count >= -1, "Invalid value count"); maxValueCount_ = count; if (isSet() && maxValueCount_ >= 0 && valueCount() > maxValueCount_) { GMX_THROW(InvalidInputError("Too many values")); } }
void SelectionData::restoreOriginalPositions(const t_topology *top) { if (isDynamic()) { gmx_ana_pos_t &p = rawPositions_; gmx_ana_indexmap_update(&p.m, rootElement().v.u.g, hasFlag(gmx::efSelection_DynamicMask)); refreshMassesAndCharges(top); } }
void PageMarker::markupPage() { processShortVerticalLines(); if (hasFlag(DEBUG_LAYOUT_FROM_FILE)) restoreLayout(); else extractBlocks(); cpage_ = image_data_->hCPAGE; }
int Player::getAttackRange() const{ int original_range = 1; if (hasSkill("zhengfeng") && !weapon && hp > 1) original_range = hp; // @todo_P: new way to remove coupling or just put it into TargetModSkill if (hasFlag("InfinityAttackRange") || getMark("InfinityAttackRange") > 0) original_range = 10000; // Actually infinity int weapon_range = 0; if (weapon != NULL) { const Weapon *card = qobject_cast<const Weapon *>(weapon->getRealCard()); Q_ASSERT(card); weapon_range = card->getRange(); } return qMax(original_range, weapon_range); }
void PageMarker::searchNegatives(CCOM_cont * cont) { if(hasFlag(SKIP_SEARCH_PICTURES)) return; assert(image_data_); PAGEINFO info; GetPageInfo(image_data_->hCPAGE, &info); RNEG_RecogNeg(cont, image_data_->hCPAGE, (uchar*) info.szImageName, info.Incline2048); }