Design always seems to be where my programs fall down, maybe I need to learn more about patterns.
In this case I have a base class for world entities, called Entity, and various other including player, enemy, scenery and so on. When I create a scenery entity, I pass it a string for the name of a texture to use as a height map, it loads and stores the texture, and then gets added to a vector in my world class which hold pointers to the base class, Entity. The problem is that my player needs access to the height map to get its Y position, but I don't think player should store the height map since it's not related to player data. How can I resolve this without having to cast the base class pointer to a Scenery entity pointer?
Yes that's right, thanks rocketboy I think I've been looking at this completely wrongly. The scenery class probably shouldn't even be derived from the entity class should it? It won't change position, it doesn't have health, and the only way that it will interact with the other entities is through getting a value from the height map. It isn't like any of the other entities.
So perhaps a seperate class for scenery entity, a static instance of which is stored in the base entity class?