thanks, i didn''t know about this method spellbound mentioned, but i am sure i will use it next time i need a dynamical map...
but, can you also add elements to the array once it has already been initialized? i mean like doing
int *Map = new int[Width * Height];
int *End = Map[Width*Height];
memset(End, sizeof(int)*Width);
and you have a new row allocated. or does that only generate a protection fault?
How to create a dynamic sized map?
No you can''t. It would generate a protection fault.
If you want to resize the map you need to allocate more memory and copy the whole existing map into it and then set your new rooms.
But you can always make a really large map at the beginning with walls that don''t let you use the whole map, then when you need to expand you just knock down a wall an build a new room.
If you want to resize the map you need to allocate more memory and copy the whole existing map into it and then set your new rooms.
But you can always make a really large map at the beginning with walls that don''t let you use the whole map, then when you need to expand you just knock down a wall an build a new room.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement