本文整理汇总了C++中TilesetManager::removeReference方法的典型用法代码示例。如果您正苦于以下问题:C++ TilesetManager::removeReference方法的具体用法?C++ TilesetManager::removeReference怎么用?C++ TilesetManager::removeReference使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TilesetManager
的用法示例。
在下文中一共展示了TilesetManager::removeReference方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: unifyTilesets
/**
* Replaces tilesets in \a map by similar tilesets in this map when possible,
* and adds tilesets to \a missingTilesets whenever there is a tileset without
* replacement in this map.
*
* \warning This method assumes that the tilesets in \a map are managed by
* the TilesetManager!
*/
void MapDocument::unifyTilesets(Map *map, QVector<SharedTileset> &missingTilesets)
{
QVector<SharedTileset> availableTilesets = mMap->tilesets();
for (const SharedTileset &tileset : qAsConst(missingTilesets))
if (!availableTilesets.contains(tileset))
availableTilesets.append(tileset);
TilesetManager *tilesetManager = TilesetManager::instance();
// Iterate over a copy because map->replaceTileset may invalidate iterator
const QVector<SharedTileset> tilesets = map->tilesets();
for (const SharedTileset &tileset : tilesets) {
// tileset already added
if (availableTilesets.contains(tileset))
continue;
SharedTileset replacement = tileset->findSimilarTileset(availableTilesets);
// tileset not present and no replacement tileset found
if (!replacement) {
missingTilesets.append(tileset);
availableTilesets.append(tileset);
continue;
}
// replacement tileset found, change given map
if (map->replaceTileset(tileset, replacement))
tilesetManager->addReference(replacement);
tilesetManager->removeReference(tileset);
}
}
示例2: removeTilesetAt
/**
* Removes the tileset at the given \a index from this map. Emits the
* appropriate signal.
*
* \warning Does not make sure that any references to tiles in the removed
* tileset are cleared.
*/
void MapDocument::removeTilesetAt(int index)
{
emit tilesetAboutToBeRemoved(index);
SharedTileset tileset = mMap->tilesets().at(index);
mMap->removeTilesetAt(index);
emit tilesetRemoved(tileset.data());
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->removeReference(tileset);
}
示例3: replaceTileset
/**
* Replaces the tileset at the given \a index with the new \a tileset. Replaces
* all tiles from the replaced tileset with tiles from the new tileset.
*
* @return The replaced tileset.
*/
SharedTileset MapDocument::replaceTileset(int index, const SharedTileset &tileset)
{
SharedTileset oldTileset = mMap->tilesetAt(index);
bool added = mMap->replaceTileset(oldTileset, tileset);
TilesetManager *tilesetManager = TilesetManager::instance();
if (added)
tilesetManager->addReference(tileset);
tilesetManager->removeReference(oldTileset);
if (added)
emit tilesetReplaced(index, tileset.data(), oldTileset.data());
else
emit tilesetRemoved(oldTileset.data());
return oldTileset;
}
示例4:
TilesetDocument::~TilesetDocument()
{
TilesetManager *tilesetManager = TilesetManager::instance();
tilesetManager->removeReference(mTileset);
}