Exemplo n.º 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;
}
Exemplo n.º 2
0
static bool hasTerrain(const Tileset &tileset, const QString &name)
{
    for (Terrain *terrain : tileset.terrains())
        if (terrain->name() == name)
            return true;

    return false;
}
Exemplo n.º 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);
}
Exemplo n.º 4
0
QModelIndex TilesetTerrainModel::index(Terrain *terrain) const
{
    Tileset *tileset = terrain->tileset();
    int row = tileset->terrains().indexOf(terrain);
    return index(row, 0);
}