PDA

View Full Version : 'global variable'



slenkar
24-11-2010, 03:29 AM
EDIT-nevermind I was declaring the var in the implementation instead of the interface L:)

Im porting a game with 6 different types of ships but I may want to reduce that to 5

so I create some arrays to hold some ships stats

e.g.


using mytypes;

ships_owned:array of integer;

setlength (ships_owned,mytypes.number_different_ships);


which holds the number of ships owned for each ship_type
the number_different_ships variable is in the unit 'mytypes'
when i try to compile it says it cant find number_different_ships even though it is in 'mytypes'

I could put the variable into the same unit as the array but there are other arrays that need to know how many different types of ship there are in other units.

So is there a way of sharing a variable between all these units?