I usually write things in C++, but I have to use C to work with this vr library, so please excuse the stupid question. I have a bunch of data allocated like this:
Code:
#define MAXWALLS 1000 //maximum number of walls
typedef struct {
Vec pos;
float th, w, h;
} Wall;
typedef struct {
enum {placingWall, rotatingWall} state;
int numBalls;
int numWalls;
Vec tip;
Vec ground;
bool goodGround;
Ball ball[MAXBALLS];
Wall wall[MAXWALLS];
vrLock lock;
} WorldData;
And at another point in my code I want to increment the th value of a wall, which I'm doing like this (expanded into multiple lines to isolate the error):
Code:
int index = (wd->numWalls-1) % MAXWALLS;
Wall* wall = &wd->wall[index];
wall->th += WALLROTATESPEED * deltaTime; <- this line generates the error
/*wd->wall[(wd->numWalls-1)%MAXWALLS].th += WALLROTATESPEED * deltaTime;*/
The problem is that when I try to compile this with cc, I get this error:
mp2sim.c:118: error: syntax error before ‘=’ token
I don't see what could be causing this. Is there some cryptic c thing going on here or am I declaring my structs wrong or what?