I've been trying to resolve this for most of the day, and its really getting on my tits. I hope you guys can help.
This code that is about to be posted contains large chunks of the quake 3 source code. This code is freely avalible from ID Software, officially.
mkah. I've a class called ' ci '.
Code:
typedef struct {
qboolean infoValid;
char name[MAX_QPATH];
team_t team;
int botSkill; // 0 = not bot, 1-5 = bot
vec3_t color1;
vec3_t color2;
int player; // updated by player servercmds
int location; // location index for team mode
int health; // you only get this info about your teammates
int armor;
int curWeapon;
int handicap;
int wins, losses; // in tourney mode
int teamTask; // task in teamplay (offence/defence)
qboolean teamLeader; // true when this is a team leader
int powerups; // so can display quad/flag status
int medkitUsageTime;
int invulnerabilityStartTime;
int invulnerabilityStopTime;
int breathPuffTime;
// when clientinfo is changed, the loading of models/skins/sounds
// can be deferred until you are dead, to prevent hitches in
// gameplay
char modelName[MAX_QPATH];
char skinName[MAX_QPATH];
char headModelName[MAX_QPATH];
char headSkinName[MAX_QPATH];
char redTeam[MAX_TEAMNAME];
char blueTeam[MAX_TEAMNAME];
qboolean deferred;
qboolean newAnims; // true if using the new mission pack animations
qboolean fixedlegs; // true if legs yaw is always the same as torso yaw
qboolean fixedtorso; // true if torso never changes yaw
vec3_t headOffset; // move head in icon views
footstep_t footsteps;
gender_t gender; // from model
qhandle_t legsModel;
qhandle_t legsSkin;
qhandle_t torsoModel;
qhandle_t torsoSkin;
qhandle_t headModel;
qhandle_t headSkin;
qhandle_t modelIcon;
animation_t animations[MAX_TOTALANIMATIONS];
sfxHandle_t sounds[MAX_CUSTOM_SOUNDS];
} clientInfo_t;
Look at the datatypes of handicap, name, wins losses, for example.
In a function, in another file, I am using the class...
Code:
static void CG_DrawClient( score_t *player, qboolean largeFormat ) {
char xc_handicap;
char xc_winloss;
char xc_name;
char xc_ping;
char xc_score;
vec3_t headAngles;
clientInfo_t *ci;
ROW_Y = (ROW_Y + 32);
ci = &cgs.clientinfo[player->client];
xc_handicap = ci->handicap;
xc_name = ci->handicap;
xc_winloss = 10;// ci->wins ci->losses
xc_ping = player->ping;
xc_score = ci->handicap;
....
I am assigning the members of the class to variables.
Then using these variables in a function;
Code:
CG_DrawStringExt( HANDICAP_X, ROW_Y, xc_handicap, colorWhite, qfalse, qtrue,SMALLCHAR_WIDTH, SMALLCHAR_HEIGHT, 0 );
And the function CG_DrawStringExt looks like this;
Code:
void CG_DrawStringExt( int x, int y, const char *string, const float *setColor, qboolean forceColor, qboolean shadow, int charWidth, int charHeight, int maxChars )
Then I get the following compile error, refuring the the 3rd code example;
warning; passing arg 3 of CG_DrawStringExt makes pointer from integer without a cast
This error occours with every use of the CG_DrawStringExt, using the xc_variables. I believe the problem is the datatypes. In the class, handicap is declared as an int, whereas in the 2nd code example, i am assigning it to char datatype. The CG_DrawStringExt function expects something else... I'm not sure.
Please help
Many thanks.