Hi,
I'm creating a spacesim (like Freelancer).
I've got about 50 tradable wares in the game and therefore I only create 50 instances of a type called TWareType.
This type has the name, description and required cargospace per unit for each kind of tradable ware.
Each spacestation can then have a link (pointer) to these TWareTypes, but the problem is that B3D only supports static arrays within types (you have to set the size upfront with a constant).
Each station must be able to hold different amounts of tradable wares, so that one station could sell ore for example, and the other cannot.
Would it be wise to set the array to a preset maximum (100 or so), and just set the neccessary indexes to point to such a TWareType (and leave the others empty = they point to nothing), or is there another way?
Having a station with an array which can hold 100 wares, when only 10 are used, is in my opinion a waste of memory.
I also want the ability to let the player add his own tradable wares (let players MOD the game a little), the current setup allows this already (it loads all stuff from a datafile in plain ASCII).
But then the player will be limited to only create 100 different ware types, because a station can hold only 100 different waretypes.
In BMax (I ported my code to B3D, as I will be beginning to create 3D models soon) I could add as many wares as required, because the arrays could be resized during runtime.
So in short:
Station 1 could hold 5 ware types (ore, silicon, water, food and toxic waste), while station 2 could hold 17 wares, station 3 only has 2 wares, and so on.
This will be declared in that datafile as well, so the user would be able to add wares to any station.
Is there a way to achieve this?
I'm creating a spacesim (like Freelancer).
I've got about 50 tradable wares in the game and therefore I only create 50 instances of a type called TWareType.
This type has the name, description and required cargospace per unit for each kind of tradable ware.
Each spacestation can then have a link (pointer) to these TWareTypes, but the problem is that B3D only supports static arrays within types (you have to set the size upfront with a constant).
Each station must be able to hold different amounts of tradable wares, so that one station could sell ore for example, and the other cannot.
Would it be wise to set the array to a preset maximum (100 or so), and just set the neccessary indexes to point to such a TWareType (and leave the others empty = they point to nothing), or is there another way?
Having a station with an array which can hold 100 wares, when only 10 are used, is in my opinion a waste of memory.
I also want the ability to let the player add his own tradable wares (let players MOD the game a little), the current setup allows this already (it loads all stuff from a datafile in plain ASCII).
But then the player will be limited to only create 100 different ware types, because a station can hold only 100 different waretypes.
In BMax (I ported my code to B3D, as I will be beginning to create 3D models soon) I could add as many wares as required, because the arrays could be resized during runtime.
So in short:
Station 1 could hold 5 ware types (ore, silicon, water, food and toxic waste), while station 2 could hold 17 wares, station 3 only has 2 wares, and so on.
This will be declared in that datafile as well, so the user would be able to add wares to any station.
Is there a way to achieve this?