Skip to content

Commit

Permalink
CGAME: userinfo sex is a string not an integer
Browse files Browse the repository at this point in the history
  • Loading branch information
kai-li-wop committed Oct 30, 2023
1 parent b0b2753 commit c5f3593
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions code/cgame/cg_players.c
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,13 @@ static qboolean CG_ParseAnimationFile(const char *filename, clientInfo_t *ci) {
}
continue;
} else if (!Q_stricmp(token, "sex")) {
token = COM_Parse(&text_p);
if (!token[0]) {
break;
}
// not given in the userinfo - then use the one from animation.cfg
if (ci->gender == GENDER_MAX) {
token = COM_Parse(&text_p);
if (!token[0]) {
ci->gender = GENDER_NONE;
break;
}
if (token[0] == 'm' || token[0] == 'M') {
ci->gender = GENDER_MALE;
} else if (token[0] == 'f' || token[0] == 'F') {
Expand Down Expand Up @@ -886,7 +887,15 @@ void CG_NewClientInfo(int clientNum) {
newInfo.gender = GENDER_MAX;
v = Info_ValueForKey(configstring, "s");
if (v[0] != '\0') {
newInfo.gender = atoi(v);
if (!Q_stricmp(v, "none")) {
newInfo.gender = GENDER_NONE;
} else if (!Q_stricmp(v, "neuter")) {
newInfo.gender = GENDER_NEUTER;
} else if (!Q_stricmp(v, "female")) {
newInfo.gender = GENDER_FEMALE;
} else if (!Q_stricmp(v, "male")) {
newInfo.gender = GENDER_MALE;
}
}

oldTeam = ci->team;
Expand Down

0 comments on commit c5f3593

Please sign in to comment.