コード例 #1
0
void
KnobSerialization::restoreKnobLinks(const KnobPtr & knob,
                                    const NodesList & allNodes,
                                    const std::map<std::string,std::string>& oldNewScriptNamesMapping)
{
    int i = 0;
    
    if (_masterIsAlias) {
        /*
         * _masters can be empty for example if we expand a group: the slaved knobs are no longer slaves
         */
        if (!_masters.empty()) {
            const std::string& aliasKnobName = _masters.front().masterKnobName;
            const std::string& aliasNodeName = _masters.front().masterNodeName;
            const std::string& masterTrackName  = _masters.front().masterTrackName;
            KnobPtr alias = findMaster(knob, allNodes, aliasKnobName, aliasNodeName, masterTrackName, oldNewScriptNamesMapping);
            if (alias) {
                knob->setKnobAsAliasOfThis(alias, true);
            }
        }
    } else {
        
        for (std::list<MasterSerialization>::iterator it = _masters.begin(); it != _masters.end(); ++it) {
            if (it->masterDimension != -1) {
                KnobPtr master = findMaster(knob, allNodes, it->masterKnobName, it->masterNodeName, it->masterTrackName, oldNewScriptNamesMapping);
                if (master) {
                    knob->slaveTo(i, master, it->masterDimension);
                }
            }
            ++i;
        }
    }
}
コード例 #2
0
    Status DBClientShardResolver::chooseWriteHost( const string& shardName,
                                                   ConnectionString* shardHost ) const {

        // Declare up here for parsing later
        string errMsg;

        // Special-case for config and admin
        if ( shardName == "config" || shardName == "admin" ) {
            *shardHost = ConnectionString::parse( configServer.modelServer(), errMsg );
            dassert( errMsg == "" );
            return Status::OK();
        }

        //
        // First get the information about the shard from the shard cache
        //

        // Internally uses our shard cache, does no reload
        Shard shard = Shard::findIfExists( shardName );
        if ( shard.getName() == "" ) {
            return Status( ErrorCodes::ShardNotFound,
                           string("unknown shard name ") + shardName );
        }
        return findMaster(shard.getConnString(), shardHost);
    }
コード例 #3
0
ファイル: targetfind.cpp プロジェクト: Apocalypse612/darkstar
void CTargetFind::addAllInMobList(CBattleEntity* PTarget, bool withPet)
{
    CCharEntity* PChar = (CCharEntity*)findMaster(m_PBattleEntity);
    CBattleEntity* PBattleTarget = NULL;

    for (SpawnIDList_t::const_iterator it = PChar->SpawnMOBList.begin(); it != PChar->SpawnMOBList.end(); ++it)
    {

        PBattleTarget = (CBattleEntity*)it->second;

        if (PBattleTarget && isMobOwner(PBattleTarget)){
            addEntity(PBattleTarget, withPet);
        }

    }
}
コード例 #4
0
ファイル: targetfind.cpp プロジェクト: Apocalypse612/darkstar
void CTargetFind::findWithinArea(CBattleEntity* PTarget, AOERADIUS radiusType, float radius, uint8 flags)
{
    m_findFlags = flags;
    m_radius = radius;
    m_zone = m_PBattleEntity->getZone();

    if (radiusType == AOERADIUS_ATTACKER){
        m_PRadiusAround = &m_PBattleEntity->loc.p;
    }
    else {
        // radius around target
        m_PRadiusAround = &PTarget->loc.p;
    }

    // get master to properly handle loops
    m_PMasterTarget = findMaster(PTarget);

    // no not include pets if this AoE is a buff spell
    // this is a buff because i'm targetting my self
    bool withPet = PETS_CAN_AOE_BUFF || (m_findFlags & FINDFLAGS_PET) || (m_PMasterTarget->objtype != m_PBattleEntity->objtype);

    // always add original target first
    addEntity(PTarget, false); // pet will be added later

    m_PTarget = PTarget;
    isPlayer = checkIsPlayer(m_PBattleEntity);

    if (isPlayer){
        // handle this as a player

        if (m_PMasterTarget->objtype == TYPE_PC)
        {

            // players will never need to add whole alliance
            m_findType = FIND_PLAYER_PLAYER;

            if (m_PMasterTarget->PParty != NULL)
            {
                // player -ra spells should never hit whole alliance
                if ((m_findFlags & FINDFLAGS_ALLIANCE) && m_PMasterTarget->PParty->m_PAlliance != NULL)
                {
                    addAllInAlliance(m_PMasterTarget, withPet);
                }
                else
                {
                    // add party members
                    addAllInParty(m_PMasterTarget, withPet);
                }
            }
            else {
                // just add myself
                addEntity(m_PMasterTarget, withPet);
            }

        }
        else {
            m_findType = FIND_PLAYER_MONSTER;
            // special case to add all mobs in range
            addAllInMobList(m_PMasterTarget, false);
        }

    }
    else {
        // handle this as a mob

        if (m_PMasterTarget->objtype == TYPE_PC){
            m_findType = FIND_MONSTER_PLAYER;
        }
        else {
            m_findType = FIND_MONSTER_MONSTER;
        }

        // do not include pets in monster AoE buffs
        if (m_findType == FIND_MONSTER_MONSTER && m_PTarget->PMaster == NULL)
        {
            withPet = PETS_CAN_AOE_BUFF;
        }

        if (m_findFlags & FINDFLAGS_HIT_ALL)
        {
            addAllInZone(m_PMasterTarget, withPet);
        }
        else
        {
            if (m_PMasterTarget->PParty != NULL)
            {
                if (m_PMasterTarget->PParty->m_PAlliance != NULL)
                {
                    addAllInAlliance(m_PMasterTarget, withPet);
                }
                else {
                    // all party instead
                    addAllInParty(m_PMasterTarget, withPet);
                }
            }
            else {
                addEntity(m_PMasterTarget, withPet);
            }

            // Is the monster casting on a player..
            if (m_findType == FIND_MONSTER_PLAYER)
                addAllInEnmityList();
        }
    }
}