Esempio n. 1
0
void SpriteModel::addSprites( quint8 resourceType, ResourceList& resources )
{
    if( resourceType != m_resourceType )
        return;

    emit addedSprites( resourceType, resources.size() );

    beginInsertRows( QModelIndex(), m_resourceList.size(), m_resourceList.size() + resources.size() );
    m_resourceList += resources;
    endInsertRows();
}
Esempio n. 2
0
void SurveyTool::StartUsing(PlayerObject* player)
{
    Message*			message;
    ResourceCategory*	mainCat = gResourceManager->getResourceCategoryById(getInternalAttribute<uint32>("survey_tool_resource_category"));
    ResourceList		resourceList;

    mainCat->getResources(resourceList,true);

    gMessageFactory->StartMessage();
    gMessageFactory->addUint32(opResourceListForSurveyMessage);

    gMessageFactory->addUint32(resourceList.size());

    ResourceList::iterator resourceIt = resourceList.begin();

    while(resourceIt != resourceList.end())
    {
        Resource* tmpResource = (*resourceIt);

        gMessageFactory->addString(tmpResource->getName());
        gMessageFactory->addUint64(tmpResource->getId());
        gMessageFactory->addString((tmpResource->getType())->getDescriptor());

        ++resourceIt;
    }

    gMessageFactory->addString(mainCat->getName());
    gMessageFactory->addUint64(mId);

    message = gMessageFactory->EndMessage();

    (player->getClient())->SendChannelA(message, player->getAccountId(),CR_Client,4);
}
Esempio n. 3
0
bool
QResource::unregisterResource(const uchar *rccData, const QString &resourceRoot)
{
    QString r = qt_resource_fixResourceRoot(resourceRoot);

    QMutexLocker lock(resourceMutex());
    ResourceList *list = resourceList();
    for(int i = 0; i < list->size(); ++i) {
        QResourceRoot *res = list->at(i);
        if(res->type() == QResourceRoot::Resource_Buffer) {
	    QDynamicBufferResourceRoot *root = reinterpret_cast<QDynamicBufferResourceRoot*>(res);
	    if(root->mappingBuffer() == rccData && root->mappingRoot() == r) {
                resourceList()->removeAt(i);
                if(!root->ref.deref()) {
                    delete root;
                    return true;
                }
		return false;
            }
	}
    }
    return false;
}
Esempio n. 4
0
QStringList QResourceInfo::children() const
{
    if(!container || related.isEmpty())
        return QStringList();

    if(!hasChildren) {
        hasChildren = true;
        QString path = searchFile;
        if(path.startsWith(QLatin1Char(':')))
            path = path.mid(1);
        QSet<QString> kids;
        for(int i = 0; i < related.size(); ++i) {
            QStringList related_children = related.at(i).children(path);
            for(int kid = 0; kid < related_children.size(); ++kid) {
                QString k = related_children.at(kid);
                if(!kids.contains(k)) {
                    mChildren += k;
                    kids.insert(k);
                }
            }
        }
    }
    return mChildren;
}