Tarvok
|
A struct (short for structure) is a special variable that contains other variables, so they can be kept together in a logical format. I'm bad at explaining, so here's an example.
Suppose you want to keep track of the stats for a player character in the game. You could create a strcuct called PC, and include things like strength (STR), intelligence (INT), spell ability, etc. all in this struct. Code example:
Well gee. I guess it's not in the docs, meaning it's unsupported. Don't even try to use it unless you know what you're doing. It's right up there next to pointers (which should be removed, IMO).
In C, it would be done like this:
struct Hero
{ int STR; //this would influence how hard they hit
int INT; //magical ability, possibly skills
int magic; // 0 for none, 1 for wizard, 2 - priest?
int weapon; //references an integer list of weapon
//... and so on
}
it would be declared like this (I think):
Hero Darin;
individual members would be accessed like this
//level up
Darin-STR = Darin-STR+1
It's been a while, so this could be wrong. You should also be thouroughly confused now. Until they include it in the docs, dont worry about it. Unsupported features can cause *bad* problems.
- Tarvok
Posted on 2000-11-27 13:16:33
|