Hi,
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:
Code:
void PutClientInServer (edict_t *ent)
Inside this function, a pointer is declared like this:
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:
Code:
#include "g_local.h"
#include "m_player.h"
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.
Code:
typedef struct edict_s edict_t;
typedef struct gclient_s gclient_t;
#ifndef GAME_INCLUDE
struct gclient_s
{
player_state_t ps; // communicated by server to clients
int ping;
// the game dll can add anything it wants after
// this point in the structure
};
Thanks. If you want to see the full source code you can download it here:
ftp://ftp.idsoftware.com/idstuff/qua...e/q2src320.exe