I seem to have encountered a problem, and I cannot think of why its doing this. The error is:
Now, the dsock is defined. (As this)
Without it, it would get a undefinded error. With it, the function crashes the MUD. Here is the full function:
What is this uninitialized problem doing, and how do I correct it?
commands.c:223: warning: `dsock' might be used uninitialized in this function
Now, the dsock is defined. (As this)
D_SOCKET *dsock;
Without it, it would get a undefinded error. With it, the function crashes the MUD. Here is the full function:
void cmd_score(D_MOBILE *dMob, char *arg)
{
BUFFER *buf = buffer_new(MAX_BUFFER);
D_SOCKET *dsock;
bprintf(buf, "#c- - - = = = Score = = = - - -#n\n\r" );
bprintf(buf, "#CName: %s\n\rKills: %d\n\rDeaths: (null)\n\r", dMob->name, dMob->kills);
bprintf(buf, "#CHost: %s\n\r", dsock->hostname );
if ( dMob->level == 4 )
bprintf(buf, "#CRank: Owner\n\r" );
else if ( dMob->level == 3 )
bprintf(buf, "#CRank: Admin\n\r" );
else if ( dMob->level == 2 )
bprintf(buf, "#CRank: Player\n\r" );
else if ( dMob->level == 1 )
bprintf(buf, "#CRank: Guest\n\r" );
bprintf(buf, "#c- - - = = = = = = = = = - - -\n\r#n" );
text_to_mobile(dMob, buf->data);
buffer_free(buf);
}
What is this uninitialized problem doing, and how do I correct it?