irrlicht array of structs

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Armen138
Posts: 298
Joined: Mon Feb 23, 2004 3:38 am

irrlicht array of structs

Post by Armen138 »

hoi
i got some trouble using an irrlicht array...
here is the relevant code:

declaration of struct Quad

Code: Select all

 
 struct Quad
{
    bool moveable;
    bool buildable;
    int unitID;
    int terrainType;
	float height;
};

Code: Select all

core::array<Quad> *quadMap;

Code: Select all

quadMap=new core::array<Quad>(size.X*size.Y);
and now to change an element in the array(this is where it crashes)

Code: Select all

	Quad *quadMapPointer=quadMap->pointer();
	quadMapPointer[quadElement].unitID=unitID;
does anyone have any idea whats going wrong?
if you're looking for me, start looking on irc, i'm probably there.
yin nadie
Posts: 43
Joined: Wed Mar 31, 2004 1:03 pm
Location: Seville, Spain
Contact:

Post by yin nadie »

try:

Code: Select all

quadMap[quadElement].unitID=unitID;
instead of:

Code: Select all

Quad *quadMapPointer=quadMap->pointer();
quadMapPointer[quadElement].unitID=unitID;
Post Reply