I am searching for a way to dynamically change the size of an array during runtime.
I will create an example to explain what I want to do:
Let's say we have a class (partly pseudo code)
Code: Select all
class MyClass {
private:
<array of integer> walkmap
void CreateMap(int map);
};Of course different maps have different walking abilities, therefore I have created the CreateMap() function
My problem is that different maps, too have different sizes:
Code: Select all
void MyClass::CreateMap(int map) {
switch(map) {
case 1:
{
walkmap[0] = 0 0 0 1 1 1 0 0 0;
walkmap[1] = 0 0 1 1 1 0 0 1 1;
walkmap[2] = 0 0 1 1 0 0 1 1 0;
walkmap[3] = 0 0 0 1 1 1 1 0 0;
}
case 2:
{
walkmap[0] = 0 0 0 1 1 1 1 1 1 1 1 1 1 1;
walkmap[1] = 1 1 1 1 1 1 0 0 0 0 0 0 0 0;
}
}
}thnx in advance
-Nova