Hey,
The wiki needs an entry explaining managed structs and how to make array of them.
The wiki page is here: http://www.adventuregamestudio.co.uk/wiki/Referencing_custom_struct_types
The content I want to add is below, but I don't have clearance to be able to add content to the wiki:
Simple struct declaration
struct Pos {
int x;
int y;
}
Pos initialPosition;
Pos importantPosition[3];
This kind of struct though can't be passed as argument of a function.
Managed Struct
managed struct Pos {
int x;
int y;
}
Pos * initialPosition;
Pos * importantPosition;
//we can't use 'initialPosition = new Pos;' in the body, it needs to be in a function
function initialisePositions(){
initialPosition = new Pos;
importantPosition = new Pos[3];
importantPosition[0] = new Pos;
importantPosition[1] = new Pos;
importantPosition[2] = new Pos;
}
function moveDancingTo(Pos * destination){
// do something with destination
}
Managed strucs allow passing structs as parameters
Hey, sorry I didn't reply to your PM yet. I'm having difficulty working out why you aren't able to log in to the wiki. All forum users should be able to, so I'm not sure what's stopping you from doing it. As soon as I work it out, I'll let you know!
Hey AGA, I still can't post in the wiki.