Couple more gcc warnings killed, fixed a bug within protocol.c, and added initial colour detections based on protocol findings.

This commit is contained in:
Vatiken 2012-02-29 05:54:24 +00:00
parent 70d7785fea
commit db5b776326
5 changed files with 26 additions and 11 deletions

View file

@ -458,7 +458,8 @@ void board_load_board(int board_type)
perror("SYSERR: Error reading board");
return;
}
j = fread(&(num_of_msgs[board_type]), sizeof(int), 1, fl);
if (fread(&(num_of_msgs[board_type]), sizeof(int), 1, fl) != 1)
return;
if (num_of_msgs[board_type] < 1 || num_of_msgs[board_type] > MAX_BOARD_MESSAGES) {
log("SYSERR: Board file %d corrupt. Resetting.", board_type);
board_reset_board(board_type);

View file

@ -1456,8 +1456,6 @@ void do_start(struct char_data *ch)
GET_COND(ch, HUNGER) = 24;
GET_COND(ch, DRUNK) = 0;
SET_BIT_AR(PRF_FLAGS(ch), PRF_AUTOEXIT);
if (CONFIG_SITEOK_ALL)
SET_BIT_AR(PLR_FLAGS(ch), PLR_SITEOK);
}

View file

@ -2376,6 +2376,7 @@ struct char_data *read_mobile(mob_vnum nr, int type) /* and mob_rnum */
mob_index[i].number++;
GET_ID(mob) = max_mob_id++;
/* find_char helper */
add_to_lookup_table(GET_ID(mob), (void *)mob);
@ -3473,6 +3474,18 @@ void init_char(struct char_data *ch)
GET_LOADROOM(ch) = NOWHERE;
GET_SCREEN_WIDTH(ch) = PAGE_WIDTH;
/* Set Beginning Toggles Here */
SET_BIT_AR(PRF_FLAGS(ch), PRF_AUTOEXIT);
if (ch->desc)
if (ch->desc->pProtocol->pVariables[eMSDP_ANSI_COLORS] ||
ch->desc->pProtocol->pVariables[eMSDP_XTERM_256_COLORS]) {
SET_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_1);
SET_BIT_AR(PRF_FLAGS(ch), PRF_COLOR_2);
}
SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPHP);
SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPMANA);
SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPMOVE);
}
/* returns the real number of the room with given virtual number */

View file

@ -213,14 +213,16 @@ static int find_house(room_vnum vnum)
static void House_save_control(void)
{
FILE *fl;
int i;
if (!(fl = fopen(HCONTROL_FILE, "wb"))) {
perror("SYSERR: Unable to open house control file.");
return;
}
/* write all the house control recs in one fell swoop. Pretty nifty, eh? */
i = fwrite(house_control, sizeof(struct house_control_rec), num_of_houses, fl);
if (fwrite(house_control, sizeof(struct house_control_rec), num_of_houses, fl) != num_of_houses) {
perror("SYSERR: Unable to save house control file.");
return;
}
fclose(fl);
}
@ -232,7 +234,6 @@ void House_boot(void)
struct house_control_rec temp_house;
room_rnum real_house, real_atrium;
FILE *fl;
int i;
memset((char *)house_control,0,sizeof(struct house_control_rec)*MAX_HOUSES);
@ -244,7 +245,8 @@ void House_boot(void)
return;
}
while (!feof(fl) && num_of_houses < MAX_HOUSES) {
i = fread(&temp_house, sizeof(struct house_control_rec), 1, fl);
if (fread(&temp_house, sizeof(struct house_control_rec), 1, fl) != 1)
break;
if (feof(fl))
break;
@ -663,7 +665,7 @@ static int ascii_convert_house(struct char_data *ch, obj_vnum vnum)
FILE *in, *out;
char infile[MAX_INPUT_LENGTH], *outfile;
struct obj_data *tmp;
int i, j=0, k;
int i, j=0;
House_get_filename(vnum, infile, sizeof(infile));
@ -687,7 +689,8 @@ static int ascii_convert_house(struct char_data *ch, obj_vnum vnum)
while (!feof(in)) {
struct obj_file_elem object;
k = fread(&object, sizeof(struct obj_file_elem), 1, in);
if (fread(&object, sizeof(struct obj_file_elem), 1, in) != 1)
return (0);
if (ferror(in)) {
perror("SYSERR: Reading house file in House_load");
send_to_char(ch, "...read error in house rent file.\r\n");

View file

@ -37,7 +37,7 @@ typedef struct descriptor_data descriptor_t;
#define MAX_PROTOCOL_BUFFER 2048
#define MAX_VARIABLE_LENGTH 4096
#define MAX_OUTPUT_BUFFER 8192
#define MAX_OUTPUT_BUFFER LARGE_BUFSIZE
#define MAX_MSSP_BUFFER 4096
#define SEND 1