static void init_boards(void) { int i, j, fatal_error = 0; for (i = 0; i < INDEX_SIZE; i++) { msg_storage[i] = 0; msg_storage_taken[i] = 0; } for (i = 0; i < NUM_OF_BOARDS; i++) { if ((BOARD_RNUM(i) = real_object(BOARD_VNUM(i))) == NOTHING) { log("SYSERR: Fatal board error: board vnum %d does not exist!", BOARD_VNUM(i)); fatal_error = 1; } num_of_msgs[i] = 0; for (j = 0; j < MAX_BOARD_MESSAGES; j++) { memset((char *) &(msg_index[i][j]), 0, sizeof(struct board_msginfo)); msg_index[i][j].slot_num = -1; } board_load_board(i); } if (fatal_error) exit(1); }
int board(struct char_data *ch, int cmd, char *arg) { static int has_loaded = 0; if (!ch->desc) return(FALSE); /* By MS or all NPC's will be trapped at the board */ /* note: I'll let display and remove return 0 if the arg was non-board- */ /* related. Thus, it'll be possible to read other things than the board */ /* while you're in the room. Conceiveably, you could do this for write, */ /* too, but I'm not in the mood for such hacking. */ if (!has_loaded) { board_load_board(); has_loaded = 1; } switch (cmd) { case 15: /* look */ return(board_show_board(ch, arg)); case 149: /* write */ board_write_msg(ch, arg); return 1; case 63: /* read */ return(board_display_msg(ch, arg)); case 66: /* remove */ return(board_remove_msg(ch, arg)); default: return 0; } }
int board(struct char_data *ch, const char * cmd, char *arg, struct obj_data *obj, int type) { static int has_loaded = 0; int bnum = -1; int obj_num; if (type != PULSE_COMMAND) return (FALSE); if (!ch->desc) return (0); /* By MS or all NPC's will be trapped at the board */ if (!has_loaded) { board_load_board(); has_loaded = 1; } if (!cmd) return (FALSE); /* Identify which board we're dealing with */ obj_num = (obj->item_number); if (obj_num == (real_object(3099))) bnum = 0; else if (obj_num == (real_object(3098))) bnum = 1; else if (obj_num == (real_object(3097))) bnum = 2; if (STREQ(cmd, "look")) { return (board_show_board(ch, arg, bnum)); } else if (STREQ(cmd, "write")) { board_write_msg(ch, arg, bnum); return 1; } else if (STREQ(cmd, "read")) { return (board_display_msg(ch, arg, bnum)); } else if (STREQ(cmd, "remove")) { return (board_remove_msg(ch, arg, bnum)); } else { return 0; } }
int board(struct char_data *ch, int cmd, char *arg, struct obj_data *obj, int type) { static int has_loaded = 0; char buf[80]; int bnum = -1; int obj_num; if (type != PULSE_COMMAND) return(FALSE); if (!ch->desc) return(0); /* By MS or all NPC's will be trapped at the board */ if (!has_loaded) { board_load_board(); has_loaded = 1; } if (!cmd) return(FALSE); /* Identify which board we're dealing with */ obj_num = (obj->item_number); if (obj_num == (real_object(3099))) bnum = 0; else if (obj_num == (real_object(3098))) bnum = 1; else if (obj_num == (real_object(3097))) bnum = 2; switch (cmd) { case 15: /* look */ return(board_show_board(ch, arg, bnum)); case 149: /* write */ board_write_msg(ch, arg, bnum); return 1; case 63: /* read */ return(board_display_msg(ch, arg, bnum)); case 66: /* remove */ return(board_remove_msg(ch, arg, bnum)); default: return 0; } }