These hills can form complicated structures for things like mountains:
I also want to be able to select tiles with the mouse. I used this solution for a flat map:
This question. The proposed solution does not work because slopes may have different silhouettes so you can't simplify every tile into lines with the same angles.
This solution. As I understand, I'd have to create a second rectangular texture around each tile and use color data to represent the central tile and its neighbours. Still, but I don't think it would work well in my case because the tile can be drawn far from its actual position due to height or it can be completely covered by a large hill can completely cover it in front of it.
Short version: I split my map into small chunks of 100x100 pixels and use their red and green channels to store info about respective tiles.
Full version: I have these fields in my TownLevel class with a map:
I render an entire map to one texture and split it into chunks. I can't use the full map by itself because SDL_RenderReadPixels() works too slowly with large textures. The full map is not necessary and can break my code on other systems due to SDL_Texture size limitations, I'll remove it later. Also, I use a Texture class for all textures. I createcreated a full map and chunks in the constructor:
