When you resize an array using slices, the contents of the array are copied also.
I do this in my game too.
I'm trying to create a spacesim (like Freelancer), which needs info about each object in space (location, price, name, description, cargospace needed = for commodities to trade, ...).
I'm loading a textfile, which holds all this data, into arrays.
In this file, there are datablocks (parts of the file which identify each object).
Every time a datablock has been found, the appropriate array is resized (size increased by 1).
Contents are not lost.
If you want to take a look at the source-code:
http://users.pandora.be/vge/SG/SG.zip
I do this in my game too.
I'm trying to create a spacesim (like Freelancer), which needs info about each object in space (location, price, name, description, cargospace needed = for commodities to trade, ...).
I'm loading a textfile, which holds all this data, into arrays.
In this file, there are datablocks (parts of the file which identify each object).
Every time a datablock has been found, the appropriate array is resized (size increased by 1).
Contents are not lost.
If you want to take a look at the source-code:
http://users.pandora.be/vge/SG/SG.zip