pytmx
pytmx copied to clipboard
gid and tests
So, I wanted to walk you through some improvements I made to the decode_gid function. One of the main things I did was implement a global cache. Essentially, a dictionary called flag_cache that stores the mapping between raw GIDs and their corresponding TileFlags objects.
This way, if we encounter the same GID again, we can just grab the cached result instead of recalculating it.
Everything else are additional tests.
Do we need to implement a ValueError if raw_gid < 0?
Out of curiosity did you profile/time this at any point? Curious how big of an affect this has on loading a map