Skip to content

bug in FastTMXTiledMap if visibility off in Tiled? #1281

Closed Answered by rh101
rudiHammad asked this question in Q&A
Discussion options

You must be logged in to vote

Are you sure this is a bug? According to the current implementation, if the layer visibility is false, then it doesn't get created.

void FastTMXTiledMap::buildWithMapInfo(TMXMapInfo* mapInfo)
{
...
    auto& layers = mapInfo->getLayers();
    for (const auto& layerInfo : layers)
    {
        if (layerInfo->_visible) <<<< HERE >>>>
        {
            FastTMXLayer* child = parseLayer(layerInfo, mapInfo);
            if (child == nullptr)
            {
                idx++;
                continue;
            }
            addChild(child, idx, idx);
...
        }
    }
...
}

So, when you select a layer via getLayer(), you should always check the return value. If it's null, then it do…

Replies: 2 comments 4 replies

Comment options

You must be logged in to vote
4 replies
@rudiHammad
Comment options

@rh101
Comment options

rh101 Jul 21, 2023
Collaborator

Answer selected by rudiHammad
@rudiHammad
Comment options

@rh101
Comment options

rh101 Jul 21, 2023
Collaborator

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants