Follow up to 3ab1ada (#5411)
Fixes calls to the function without the character session Thanks to @KrokusPokus
This commit is contained in:
parent
6ba869e398
commit
b1b7d06559
@ -866,12 +866,23 @@ int char_mmo_gender( const struct char_session_data *sd, const struct mmo_charst
|
||||
case 'F':
|
||||
return SEX_FEMALE;
|
||||
#else
|
||||
case 'M':
|
||||
case 'F':
|
||||
// No matter what the database says, always return the account gender
|
||||
return sd->sex;
|
||||
// Per character gender is not supported before 2014-10-16
|
||||
#endif
|
||||
default:
|
||||
// There are calls to this function that do not contain the session
|
||||
if( sd == nullptr ){
|
||||
int i;
|
||||
|
||||
// Find player session
|
||||
ARR_FIND( 0, fd_max, i, session[i] && ( sd = (struct char_session_data*)session[i]->session_data ) && sd->account_id == p->account_id );
|
||||
|
||||
if( i >= fd_max ){
|
||||
ShowWarning( "Session was not found for character '%s' (CID: %d, AID: %d), defaulting gender to male...\n", p->name, p->char_id, p->account_id );
|
||||
return SEX_MALE;
|
||||
}
|
||||
}
|
||||
|
||||
ShowWarning( "Found unknown gender '%c' for character '%s' (CID: %d, AID: %d), returning account gender...\n", sex, p->name, p->char_id, p->account_id );
|
||||
return sd->sex;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user