Пример #1
0
static unsigned short terrainId(const QString &name, const Tileset &tileset)
{
    for (Terrain *terrain : tileset.terrains())
        if (terrain->name() == name)
            return terrain->id();

    return 0xFF;
}
Пример #2
0
static bool hasTerrain(const Tileset &tileset, const QString &name)
{
    for (Terrain *terrain : tileset.terrains())
        if (terrain->name() == name)
            return true;

    return false;
}
Пример #3
0
QModelIndex TerrainModel::index(Terrain *terrain, int column) const
{
    Tileset *tileset = terrain->tileset();
    int row = tileset->terrains().indexOf(terrain);
    return createIndex(row, column, tileset);
}
Пример #4
0
QModelIndex TilesetTerrainModel::index(Terrain *terrain) const
{
    Tileset *tileset = terrain->tileset();
    int row = tileset->terrains().indexOf(terrain);
    return index(row, 0);
}