I recently downloaded the source code to Quake 2 (not including the rendering engine), and I'm trying to understand how it works. In it, there's a source file called p_client.c, which includes a function declared thus:
Inside this function, a pointer is declared like this:
void PutClientInServer (edict_t *ent)
Now here's what I don't get. Say if I make myself another source code file called "bot.c", and I include all the header files that were included in p_client.c:
And then, in a function in "bot.c" I try to declare a pointer like this:
If I do this, I get an error. It says "error C2275: 'gclient_t' : illegal use of this type as an expression".
Could this be something to do with how gclient_t is declared in "game.h"? This file is included by "g_local.h" which is one of the ones I mentioned to be included earlier.
Thanks. If you want to see the full source code you can download it here:
typedef struct edict_s edict_t;
typedef struct gclient_s gclient_t;
player_state_t ps; // communicated by server to clients
// the game dll can add anything it wants after
// this point in the structure