What are records why are they good?

Status
Not open for further replies.
Level 14
Joined
Aug 30, 2004
Messages
909
As I understand it, records are collections of variables. I have a long series of variable that refer to the abilities of my cars: e.g. weight, speed, max speed, and so on. I was planning on making each an array and then using the custom value of the car as the position in each array. For example, Player 3's car would be Car[3], with Speed[3], and so on.

I was told to put these in a "struct" which I believe is a record in the Galaxy Editor. I don't understand what that would do other than make it a little harder to program (i.e. having to click on the record first before each variable when filling out actions). Wouldn't each variable in the record still need to be a long array that links to the units somehow?

I apologize for the general question, but I did a search on the forums and couldn't find anyone who explained records.

Thanks,

Darwin
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,272
If pointers were enabled they are great for creating generic functions to manipulate them. All you would need to do is pass the pointer to a struct (probably stored in a global or global array) to a function and it could perform nice actions. Especially if structs are stored in an array, it would be really fast as it means only 1 array lookup and then direct acess to all the values (unlike parallel arrays which would be array lookups for each element and no easy way to pass to functions).

However, for some unexplained and annoying reason blizzard removed pointers from galaxy before the editor entered the beta (they were in the beta initially).

The result is there is absolutly no theretical speed advantage in using struct arrays over parallel arrays as both need an array lookup for each element. From a programming sense structs are slightly neater and the single array is probably nanoseconds faster at compiling than parallel arrays.

I hope pointers were cut due to time constraints and it would be nice to see them in HotS.
 
Status
Not open for further replies.
Top