예제 #1
0
// override the equals to operator
bool pyVaultNode::operator==(const pyVaultNode &vaultNode) const
{
    RelVaultNode* ours = GetNode();
    RelVaultNode* theirs = vaultNode.GetNode();
    if (ours == nil && theirs == nil)
        return true;
    if (ours == nil || theirs == nil)
        return false;
    if (ours->GetNodeId() == theirs->GetNodeId())
        return true;
    return ours->Matches(theirs);
}
예제 #2
0
void plNetLinkingMgr::IPostProcessLink( void )
{
    // Grab some useful things...
    plAgeLinkStruct* link = GetAgeLink();
    plAgeInfoStruct* info = link->GetAgeInfo();

    bool city = (info->GetAgeFilename().CompareI(kCityAgeFilename) == 0);
    bool hood = (info->GetAgeFilename().CompareI(kNeighborhoodAgeFilename) == 0);
    bool psnl = (info->GetAgeFilename().CompareI(kPersonalAgeFilename) == 0);

    // Update our online status 
    if (RelVaultNode* rvnInfo = VaultGetPlayerInfoNodeIncRef()) {
        VaultPlayerInfoNode accInfo(rvnInfo);
        wchar_t ageInstName[MAX_PATH];
        plUUID ageInstGuid = *info->GetAgeInstanceGuid();
        StrToUnicode(ageInstName, info->GetAgeInstanceName(), arrsize(ageInstName));
        accInfo.SetAgeInstName(ageInstName);
        accInfo.SetAgeInstUuid(ageInstGuid);
        accInfo.SetOnline(true);
        rvnInfo->DecRef();
    }
    
    switch (link->GetLinkingRules()) {

        case plNetCommon::LinkingRules::kOwnedBook: {
            // SPECIAL CASE: City: Every player ever created would be in the list; avoid that.
            if (city)
                break;
                
            {   // Ensure we're in the AgeOwners folder
                RelVaultNode* fldr = VaultGetAgeAgeOwnersFolderIncRef();
                RelVaultNode* info = VaultGetPlayerInfoNodeIncRef();
                
                if (fldr && info)
                    if (!fldr->IsParentOf(info->GetNodeId(), 1))
                        VaultAddChildNode(
                            fldr->GetNodeId(),
                            info->GetNodeId(),
                            NetCommGetPlayer()->playerInt,
                            nil,
                            nil
                        );
                
                if (fldr)
                    fldr->DecRef();
                if (info)
                    info->DecRef();
            }
        }
        break;  

        case plNetCommon::LinkingRules::kVisitBook: {
            // SPECIAL CASE: City: Every player ever created would be in the list; avoid that.
            if (city)
                break;
                
            {   // Ensure we're in the CanVisit folder
                RelVaultNode* fldr = VaultGetAgeCanVisitFolderIncRef();
                RelVaultNode* info = VaultGetPlayerInfoNodeIncRef();
                
                if (fldr && info)
                    if (!fldr->IsParentOf(info->GetNodeId(), 1))
                        VaultAddChildNode(
                            fldr->GetNodeId(),
                            info->GetNodeId(),
                            NetCommGetPlayer()->playerInt,
                            nil,
                            nil
                        );
                
                if (fldr)
                    fldr->DecRef();
                if (info)
                    info->DecRef();
            }
        }
        break;
        
        case plNetCommon::LinkingRules::kSubAgeBook: {
            // Register the previous age as a sub age of the current one so that we can link back to that instance
            plAgeLinkStruct subAgeLink;
            VaultAgeFindOrCreateSubAgeLink(GetPrevAgeLink()->GetAgeInfo(), &subAgeLink, NetCommGetAge()->ageInstId);
        }
        break;
    }
}