Reading from a struct array: Offset error.
Displaying 1-4 of 4 total.
1
Please enter a numerical value for the importance of this sticky.
Enter 0 to unsticky.
Omni

I have the following struct.


#define MAXLAYER 256

struct vme_LayerSystem
{
int visible[MAXLAYER]; //Is the layer rendered?
int xoff[MAXLAYER]; //X offset of this layer.
int yoff[MAXLAYER]; //Y offset of this layer.
int xwrap[MAXLAYER]; //Wrap this layer horizontally? 0 = no, 1 = yes
int ywrap[MAYLAYER]; //Wrap this layer vertically? 0 = no, 1 = yes
int angle[MAXLAYER]; //Angle of map layer rotation, centered around
//the center of the screen.
int lucency[MAXLAYER]; //Lucency of layer...
int blendtype[MAXLAYER]; //Blending type. 0 = normal, 1 = add, 2 = sub.
string onrender[MAXLAYER]; //Call at render time to apply layer effects.

int wrapwidth[MAXLAYER]; //If layer wrapping enabled, the width at which to
//constantly wrap the tile. In pixels.
int wrapheight[MAXLAYER]; //If layer wrapping enabled the height at which to
//constantly wrap the tile. In pixels.

int renderwidth[MAXLAYER]; //Width of map to render into destination.
//Scaled to fit destination.
int renderheight[MAXLAYER]; //Height of map to render into destination.
//Scaled to fit destination.
int multix[MAXLAYER];
int multiy[MAXLAYER];
int divx[MAXLAYER];
int divy[MAXLAYER];
}

vme_LayerSystem layerz;


Now, whenever I try:


layerz.ywrap[1] = 1;


Verge3 crashes on startup with:

"Bad offset on reading array layerz_ywrap (1/0);
UNKNOWN: 5712"

What does this mean? Why can't I access the array? Is this a limit on Verge3 structs? There's no other function accessing this variable, and the only time it's accessed is in a small autoexec() function in test.vc (which is a map vc file).

Posted on 2004-07-14 04:00:13

vecna

There shouldn't be. But for curiosity's sake, does it crash if you comment out the string from the struct?

Also, are you using a recent exe? try it with http://vecna.verge-rpg.com/verge.exe

Posted on 2004-07-14 04:29:39 (last edited on 2004-07-14 04:29:55)

Omni

I tried downloading the new Verge engine, and commenting out the string. Neither fixed the solution. I commented out all the strings in all my structs (all 2 of them).

I've commented out the Map VC function that has the error until nothing but this remains:


void test_autoexec()
{
Log("test: "+str(layerz.ywrap[1]));
}


This gives me the same error as before. However, instead of saying "UNKNOWN: "something, it says "test_autoexec (0)".

Could this be a missing bracket or something? Do I just have too many arrays in a struct?

EDIT: Also, I have a vme_abs() function and a vme_Pythagorean() function that return numeric values. These were at the bottom of the VC file. At the time, whenever I used them, it said they were unknown tokens. Moving them to the top of the VC file removed this error.

Since I know VC shouldn't have a problem finding a function without a prototype...something's wrong there.

Posted on 2004-07-14 04:42:20 (last edited on 2004-07-14 04:46:13)

Omni

I figured it out...this was really stupid :)


struct LayerSystem{
int ywrap[MAYLAYER];
}


The name of the constant was MAXLAYER :)

Posted on 2004-07-14 16:53:48


Displaying 1-4 of 4 total.
1
 
Newest messages

Ben McGraw's lovingly crafted this website from scratch for years.
It's a lot prettier this go around because of Jon Wofford.
Verge-rpg.com is a member of the lunarnet irc network, and would like to take this opportunity to remind you that regardless how babies taste, it is wrong to eat them.