int Board_display_msg(int board_type, struct char_data *ch, char *arg, struct obj_data *board) { char number[MAX_INPUT_LENGTH], buffer[MAX_STRING_LENGTH]; int msg, ind; one_argument(arg, number); if (!*number) return (0); if (isname(number, board->name)) /* so "read board" works */ return (Board_show_board(board_type, ch, arg, board)); if (!is_number(number)) /* read 2.mail, look 2.sword */ return (0); if (!(msg = atoi(number))) return (0); if (GET_LEVEL(ch) < READ_LVL(board_type)) { send_to_char(ch, "You try but fail to understand the holy words.\r\n"); return (1); } if (!num_of_msgs[board_type]) { send_to_char(ch, "The board is empty!\r\n"); return (1); } if (msg < 1 || msg > num_of_msgs[board_type]) { send_to_char(ch, "That message exists only in your imagination.\r\n"); return (1); } #if NEWEST_AT_TOP ind = num_of_msgs[board_type] - msg; #else ind = msg - 1; #endif if (MSG_SLOTNUM(board_type, ind) < 0 || MSG_SLOTNUM(board_type, ind) >= INDEX_SIZE) { send_to_char(ch, "Sorry, the board is not working.\r\n"); log("SYSERR: Board is screwed up. (Room #%d)", GET_ROOM_VNUM(IN_ROOM(ch))); return (1); } if (!(MSG_HEADING(board_type, ind))) { send_to_char(ch, "That message appears to be screwed up.\r\n"); return (1); } if (!(msg_storage[MSG_SLOTNUM(board_type, ind)])) { send_to_char(ch, "That message seems to be empty.\r\n"); return (1); } snprintf(buffer, sizeof(buffer), "Message %d : %s\r\n\r\n%s\r\n", msg, MSG_HEADING(board_type, ind), msg_storage[MSG_SLOTNUM(board_type, ind)]); page_string(ch->desc, buffer, TRUE); return (1); }
int Board_display_msg(int board_type, struct char_data * ch, char *arg) { char number[MAX_STRING_LENGTH], buffer[MAX_STRING_LENGTH]; int msg, ind; one_argument(arg, number); if (!*number) return 0; if (isname(number, "board bulletin")) /* so "read board" works */ return (Board_show_board(board_type, ch, arg)); if (!isdigit(*number) || (!(msg = atoi(number)))) return 0; if (READ_LVL(board_type) != 0 && !COM_FLAGGED(ch, READ_LVL(board_type))) { send_to_char("You try but fail to understand the holy words.\r\n", ch); return 1; } if (!num_of_msgs[board_type]) { send_to_char("The board is empty!\r\n", ch); return (1); } if (msg < 1 || msg > num_of_msgs[board_type]) { send_to_char("That message exists only in your imagination.\r\n", ch); return (1); } ind = msg - 1; if (MSG_SLOTNUM(board_type, ind) < 0 || MSG_SLOTNUM(board_type, ind) >= INDEX_SIZE) { send_to_char("Sorry, the board is not working.\r\n", ch); stderr_log("SYSERR: Board is screwed up."); return 1; } if (!(MSG_HEADING(board_type, ind))) { send_to_char("That message appears to be screwed up.\r\n", ch); return 1; } if (!(msg_storage[MSG_SLOTNUM(board_type, ind)])) { send_to_char("That message seems to be empty.\r\n", ch); return 1; } sprintf(buffer, "Message %d : %s\r\n\r\n%s\r\n", msg, MSG_HEADING(board_type, ind), msg_storage[MSG_SLOTNUM(board_type, ind)]); page_string(ch->desc, buffer, 1); return 1; }