act.other.cc:30:#include "boards.h" awake.h:225:#define PLR_WRITING (1 << 24) /* Player writing (board/mail/olc) */ awake.h:1335:/* Boards */ awake.h:1337:#define NUM_OF_BOARDS 23 /* change if needed! */ awake.h:1338:#define MAX_BOARD_MESSAGES 85 /* arbitrary -- change if needed */ awake.h:1340:#define INDEX_SIZE ((NUM_OF_BOARDS*MAX_BOARD_MESSAGES) + 5) boards.cc:2:* File: boards.c Part of CircleMUD * boards.cc:3:* Usage: handling of multiple bulletin boards * boards.cc:15:TO ADD A NEW BOARD, simply follow our easy 4-step program: boards.cc:17:1 - Create a new board object in the object files boards.cc:18:2 - Increase the NUM_OF_BOARDS constant in board.h boards.cc:19:3 - Add a new line to the board_info array below. The fields, in order, are: boards.cc:20: Board's virtual number. boards.cc:21: Min level one must be to look at this board or read messages on it. boards.cc:22: Min level one must be to post a message to the board. boards.cc:24: board (but you can always remove your own message). boards.cc:25: Filename of this board, in quotes. boards.cc:27: gen_board to the other bulletin boards, and add your new one in a boards.cc:43:#include "boards.h" boards.cc:53: Be sure to also change NUM_OF_BOARDS in board.h */ boards.cc:55:struct board_info_type board_info[NUM_OF_BOARDS] = { boards.cc:56: {3 , LVL_PRESIDENT, LVL_PRESIDENT, LVL_OWNER, "etc/board.rift"}, boards.cc:57: {4 , LVL_PRESIDENT, LVL_PRESIDENT, LVL_OWNER, "etc/board.pook"}, boards.cc:58: {12 , LVL_LEGEND, LVL_LEGEND, LVL_OWNER, "etc/board.dunkelzahn"}, boards.cc:59: {21 , LVL_PRESIDENT, LVL_PRESIDENT, LVL_OWNER, "etc/board.fastjack"}, boards.cc:60: {22 , LVL_PRESIDENT, LVL_PRESIDENT, LVL_OWNER, "etc/board.jerkweed"}, boards.cc:61: {26 , 0, 0, LVL_PRESIDENT, "etc/board.rp"}, boards.cc:62: {28 , 0, 0, LVL_PRESIDENT, "etc/board.quest"}, boards.cc:63: {1006, LVL_LEGEND, LVL_LEGEND, LVL_PRESIDENT, "etc/board.builder"}, boards.cc:64: {1007, LVL_PRESIDENT, LVL_OWNER, LVL_OWNER, "etc/board.impl"}, boards.cc:65: {1038, LVL_LEGEND, LVL_LEGEND, LVL_PRESIDENT, "etc/board.coder"}, boards.cc:66: {1075, LVL_LEGEND, LVL_BUILDER, LVL_OWNER, "etc/board.initiation"}, boards.cc:67: {2104, 0, 0, LVL_ADVISOR, "etc/board.mort"}, boards.cc:68: {2106, LVL_LEGEND, LVL_LEGEND, LVL_PRESIDENT, "etc/board.immort"}, boards.cc:69: {2107, LVL_LEGEND, LVL_FREEZE, LVL_OWNER, "etc/board.freeze"}, boards.cc:70: {3114, 0, 0, LVL_OWNER, "etc/board.matrix_cpu"}, boards.cc:71: {8001, 0, 0, LVL_DIRECTOR, "etc/board.samurai"}, boards.cc:72: {8002, 0, 0, LVL_DIRECTOR, "etc/board.mage"}, boards.cc:73: {8003, 0, 0, LVL_DIRECTOR, "etc/board.decker"}, boards.cc:74: {8004, 0, 0, LVL_DIRECTOR, "etc/board.shaman"}, boards.cc:75: {8013, 0, 0, LVL_DIRECTOR, "etc/board.adept"}, boards.cc:76: {22700,LVL_PRESIDENT,LVL_PRESIDENT,LVL_PRESIDENT,"etc/board.washu"} boards.cc:81:int num_of_msgs[NUM_OF_BOARDS]; boards.cc:83:struct board_msginfo msg_index[NUM_OF_BOARDS][MAX_BOARD_MESSAGES]; boards.cc:97:/* search the room ch is standing in to find which board he's looking at */ boards.cc:98:int find_board(struct char_data * ch, struct obj_data **terminal) boards.cc:104: for (i = 0; i < NUM_OF_BOARDS; i++) boards.cc:105: if (BOARD_VNUM(i) == GET_OBJ_VNUM(obj)) { boards.cc:113:void init_boards(void) boards.cc:123: for (i = 0; i < NUM_OF_BOARDS; i++) { boards.cc:124: if (real_object(BOARD_VNUM(i)) == -1) { boards.cc:125: sprintf(buf, "SYSERR: Fatal board error: board vnum %d does not exist!", boards.cc:126: BOARD_VNUM(i)); boards.cc:131: for (j = 0; j < MAX_BOARD_MESSAGES; j++) { boards.cc:132: memset((char *) &(msg_index[i][j]), 0, sizeof(struct board_msginfo)); boards.cc:135: Board_load_board(i); boards.cc:150:SPECIAL(gen_board) boards.cc:152: int board_type; boards.cc:157: init_boards(); boards.cc:169: if ((board_type = find_board(ch, &terminal)) == -1) { boards.cc:170: log("SYSERR: degenerate board! (what the hell...)"); boards.cc:174: Board_write_message(board_type, terminal, ch, argument); boards.cc:177: return (Board_reply_message(board_type, terminal, ch, argument)); boards.cc:179: return (Board_list_board(board_type, terminal, ch, argument)); boards.cc:181: return (Board_show_board(board_type, terminal, ch, argument)); boards.cc:183: return (Board_display_msg(board_type, terminal, ch, argument)); boards.cc:185: return (Board_remove_msg(board_type, terminal, ch, argument)); boards.cc:189:void Board_write_message(int board_type, struct obj_data *terminal, boards.cc:197: if (GET_LEVEL(ch) < WRITE_LVL(board_type)) { boards.cc:202: /* Prevent Astral beings from writing to boards */ boards.cc:208: if (num_of_msgs[board_type] >= MAX_BOARD_MESSAGES) boards.cc:209: for (i = 0; i < num_of_msgs[board_type]; i++) boards.cc:210: if (MSG_LEVEL(board_type, i) < LVL_OWNER) { boards.cc:211: Board_delete_msg(board_type, i); boards.cc:215: if ((NEW_MSG_INDEX(board_type).slot_num = find_slot()) == -1) { boards.cc:217: log("SYSERR: Board: failed to find empty slot on write."); boards.cc:221: if (num_of_msgs[board_type] >= MAX_BOARD_MESSAGES) { boards.cc:223: msg_storage_taken[NEW_MSG_INDEX(board_type).slot_num] = 0; boards.cc:241: if (!(NEW_MSG_INDEX(board_type).heading = new char[len])) { boards.cc:243: msg_storage_taken[NEW_MSG_INDEX(board_type).slot_num] = 0; boards.cc:246: strcpy(NEW_MSG_INDEX(board_type).heading, buf); boards.cc:247: NEW_MSG_INDEX(board_type).heading[len - 1] = '\0'; boards.cc:248: NEW_MSG_INDEX(board_type).level = GET_LEVEL(ch); boards.cc:257: ch->desc->str = &(msg_storage[NEW_MSG_INDEX(board_type).slot_num]); boards.cc:259: ch->desc->mail_to = board_type + BOARD_MAGIC; boards.cc:261: num_of_msgs[board_type]++; boards.cc:264:int Board_reply_message(int board_type, struct obj_data *terminal, boards.cc:281: if (GET_LEVEL(ch) < WRITE_LVL(board_type) || GET_LEVEL(ch) < READ_LVL(board_type)) { boards.cc:287: if (!num_of_msgs[board_type]) { boards.cc:292: if (msg < 1 || msg > num_of_msgs[board_type]) { boards.cc:297: if (MSG_SLOTNUM(board_type, msg) < 0 || MSG_SLOTNUM(board_type, msg) >= INDEX_SIZE) { boards.cc:302: if (!(MSG_HEADING(board_type, msg))) { boards.cc:306: if (!(msg_storage[MSG_SLOTNUM(board_type, msg)])) { boards.cc:311: if (num_of_msgs[board_type] >= MAX_BOARD_MESSAGES) boards.cc:312: for (i = 0; i < num_of_msgs[board_type]; i++) boards.cc:313: if (MSG_LEVEL(board_type, i) < LVL_OWNER) { boards.cc:314: Board_delete_msg(board_type, i); boards.cc:318: if ((NEW_MSG_INDEX(board_type).slot_num = find_slot()) == -1) { boards.cc:320: log("SYSERR: Board: failed to find empty slot on write."); boards.cc:324: if (num_of_msgs[board_type] >= MAX_BOARD_MESSAGES) { boards.cc:326: msg_storage_taken[NEW_MSG_INDEX(board_type).slot_num] = 0; boards.cc:336: for (i = 0; *(MSG_HEADING(board_type, msg)+i) && boards.cc:337: *(MSG_HEADING(board_type, msg)+i) != ':'; i++); boards.cc:339: heading = (MSG_HEADING(board_type, msg) + i); boards.cc:344: if (!(NEW_MSG_INDEX(board_type).heading = new char[len])) { boards.cc:346: msg_storage_taken[NEW_MSG_INDEX(board_type).slot_num] = 0; boards.cc:349: strcpy(NEW_MSG_INDEX(board_type).heading, buf); boards.cc:350: NEW_MSG_INDEX(board_type).heading[len - 1] = '\0'; boards.cc:351: NEW_MSG_INDEX(board_type).level = GET_LEVEL(ch); boards.cc:360: ch->desc->str = &(msg_storage[NEW_MSG_INDEX(board_type).slot_num]); boards.cc:362: ch->desc->mail_to = board_type + BOARD_MAGIC; boards.cc:364: num_of_msgs[board_type]++; boards.cc:368:int Board_list_board(int board_type, struct obj_data *terminal, boards.cc:395: second = num_of_msgs[board_type] - 1; boards.cc:397: if (first < 0 || second < 0 || first >= MAX_BOARD_MESSAGES || boards.cc:398: second >= MAX_BOARD_MESSAGES) { boards.cc:399: send_to_char(ch, "Values must range from 1 to %d.\r\n", MAX_BOARD_MESSAGES); boards.cc:402: second = MIN(second, num_of_msgs[board_type] - 1); boards.cc:405: if (GET_LEVEL(ch) < READ_LVL(board_type)) { boards.cc:413: if (!num_of_msgs[board_type]) { boards.cc:419: num_of_msgs[board_type], fname(terminal->name)); boards.cc:420: for (i = 0; i < num_of_msgs[board_type]; i++) { boards.cc:421: if (MSG_HEADING(board_type, i)) boards.cc:422: sprintf(buf + strlen(buf), "%-3d: %s\r\n", i + 1, MSG_HEADING(board_type, i)); boards.cc:433: if (MSG_HEADING(board_type, i)) boards.cc:434: sprintf(buf + strlen(buf), "%-3d: %s\r\n", i + 1, MSG_HEADING(board_type, i)); boards.cc:447:int Board_show_board(int board_type, struct obj_data *terminal, boards.cc:461: if (GET_LEVEL(ch) < READ_LVL(board_type)) { boards.cc:468: sprintf(buf, "This is a computer bulletin board system.\r\n" boards.cc:473: if (!num_of_msgs[board_type]) boards.cc:476: num_of_msgs[board_type], fname(terminal->name)); boards.cc:483:int Board_display_msg(int board_type, struct obj_data *terminal, boards.cc:494: return (Board_show_board(board_type, terminal, ch, arg)); boards.cc:503: if (GET_LEVEL(ch) < READ_LVL(board_type)) { boards.cc:507: if (!num_of_msgs[board_type]) { boards.cc:511: if (msg < 1 || msg > num_of_msgs[board_type]) { boards.cc:516: if (MSG_SLOTNUM(board_type, ind) < 0 || boards.cc:517: MSG_SLOTNUM(board_type, ind) >= INDEX_SIZE) { boards.cc:522: if (!(MSG_HEADING(board_type, ind))) { boards.cc:526: if (!(msg_storage[MSG_SLOTNUM(board_type, ind)])) { boards.cc:531: MSG_HEADING(board_type, ind), msg_storage[MSG_SLOTNUM(board_type, ind)]); boards.cc:538:void Board_delete_msg(int board_type, int ind) boards.cc:543: slot_num = MSG_SLOTNUM(board_type, ind); boards.cc:545: if (!MSG_HEADING(board_type, ind) || slot_num < 0 || slot_num >= INDEX_SIZE) boards.cc:556: if (MSG_HEADING(board_type, ind)) boards.cc:557: delete [] MSG_HEADING(board_type, ind); boards.cc:559: for (; ind < num_of_msgs[board_type] - 1; ind++) { boards.cc:560: MSG_HEADING(board_type, ind) = MSG_HEADING(board_type, ind + 1); boards.cc:561: MSG_SLOTNUM(board_type, ind) = MSG_SLOTNUM(board_type, ind + 1); boards.cc:562: MSG_LEVEL(board_type, ind) = MSG_LEVEL(board_type, ind + 1); boards.cc:564: num_of_msgs[board_type]--; boards.cc:565: Board_save_board(board_type); boards.cc:568:int Board_remove_msg(int board_type, struct obj_data *terminal, boards.cc:586: if (!num_of_msgs[board_type]) { boards.cc:590: if (msg < 1 || msg > num_of_msgs[board_type]) { boards.cc:595: if (!MSG_HEADING(board_type, ind)) { boards.cc:600: if (GET_LEVEL(ch) < REMOVE_LVL(board_type) && (IS_NPC(ch) || !access_level(ch, LVL_OWNER)) && boards.cc:601: !(strstr((const char *)MSG_HEADING(board_type, ind), buf))) { boards.cc:605: if (GET_LEVEL(ch) < MSG_LEVEL(board_type, ind) && (IS_NPC(ch) || !access_level(ch, LVL_OWNER))) { boards.cc:610: if (MSG_SLOTNUM(board_type, ind) < 0 || MSG_SLOTNUM(board_type, ind) >= INDEX_SIZE) { boards.cc:616: if (!d->connected && d->str == &(msg_storage[MSG_SLOTNUM(board_type, ind)])) { boards.cc:621: Board_delete_msg(board_type, ind); boards.cc:630:void Board_save_board(int board_type) boards.cc:636: if (!num_of_msgs[board_type]) { boards.cc:637: unlink(FILENAME(board_type)); boards.cc:640: if (!(fl = fopen(FILENAME(board_type), "wb"))) { boards.cc:641: perror("Error writing board"); boards.cc:644: fwrite(&(num_of_msgs[board_type]), sizeof(int), 1, fl); boards.cc:646: for (i = 0; i < num_of_msgs[board_type]; i++) { boards.cc:647: if ((tmp1 = MSG_HEADING(board_type, i))) boards.cc:648: msg_index[board_type][i].heading_len = strlen(tmp1) + 1; boards.cc:649: else msg_index[board_type][i].heading_len = 0; boards.cc:651: if (MSG_SLOTNUM(board_type, i) < 0 || boards.cc:652: MSG_SLOTNUM(board_type, i) >= INDEX_SIZE || boards.cc:653: (!(tmp2 = msg_storage[MSG_SLOTNUM(board_type, i)]))) boards.cc:654: msg_index[board_type][i].message_len = 0; boards.cc:655: else msg_index[board_type][i].message_len = strlen(tmp2) + 1; boards.cc:657: fwrite(&(msg_index[board_type][i]), sizeof(struct board_msginfo), 1, fl); boards.cc:659: fwrite(tmp1, sizeof(char), msg_index[board_type][i].heading_len, fl); boards.cc:661: fwrite(tmp2, sizeof(char), msg_index[board_type][i].message_len, fl); boards.cc:667:void Board_load_board(int board_type) boards.cc:674: if (!(fl = fopen(FILENAME(board_type), "rb"))) { boards.cc:675: perror("Error reading board"); boards.cc:678: fread(&(num_of_msgs[board_type]), sizeof(int), 1, fl); boards.cc:679: if (num_of_msgs[board_type] < 1 || num_of_msgs[board_type] > MAX_BOARD_MESSAGES) { boards.cc:680: log("SYSERR: Board file corrupt. Resetting."); boards.cc:681: Board_reset_board(board_type); boards.cc:684: for (i = 0; i < num_of_msgs[board_type]; i++) { boards.cc:685: fread(&(msg_index[board_type][i]), sizeof(struct board_msginfo), 1, fl); boards.cc:686: if (!(len1 = msg_index[board_type][i].heading_len)) { boards.cc:687: log("SYSERR: Board file corrupt! Resetting."); boards.cc:688: Board_reset_board(board_type); boards.cc:692: log("SYSERR: Error - new failed for board header"); boards.cc:696: MSG_HEADING(board_type, i) = tmp1; boards.cc:698: if ((len2 = msg_index[board_type][i].message_len)) { boards.cc:699: if ((MSG_SLOTNUM(board_type, i) = find_slot()) == -1) { boards.cc:700: log("SYSERR: Out of slots booting board! Resetting..."); boards.cc:701: Board_reset_board(board_type); boards.cc:705: log("SYSERR: new failed for board text"); boards.cc:709: msg_storage[MSG_SLOTNUM(board_type, i)] = tmp2; boards.cc:716:void Board_reset_board(int board_type) boards.cc:720: for (i = 0; i < MAX_BOARD_MESSAGES; i++) { boards.cc:721: if (MSG_HEADING(board_type, i)) boards.cc:722: delete [] MSG_HEADING(board_type, i); boards.cc:723: if (msg_storage[MSG_SLOTNUM(board_type, i)]) boards.cc:724: delete msg_storage[MSG_SLOTNUM(board_type, i)]; boards.cc:725: msg_storage_taken[MSG_SLOTNUM(board_type, i)] = 0; boards.cc:726: memset((char *)&(msg_index[board_type][i]),0,sizeof(struct board_msginfo)); boards.cc:727: msg_index[board_type][i].slot_num = -1; boards.cc:729: num_of_msgs[board_type] = 0; boards.cc:730: unlink(FILENAME(board_type)); boards.h:2:* File: boards.h Part of CircleMUD * boards.h:3:* Usage: header file for bulletin boards * boards.h:11:#ifndef _boards_h_ boards.h:12:#define _boards_h_ boards.h:14:#define BOARD_MAGIC 1048575 /* arbitrary number - see modify.c */ boards.h:16:struct board_msginfo { boards.h:24:struct board_info_type { boards.h:25: int vnum; /* vnum of this board */ boards.h:26: int read_lvl; /* min level to read messages on this board */ boards.h:27: int write_lvl; /* min level to write messages on this board */ boards.h:28: int remove_lvl; /* min level to remove messages from this board */ boards.h:29: char filename[50]; /* file to save this board to */ boards.h:32:#define BOARD_VNUM(i) (board_info[i].vnum) boards.h:33:#define READ_LVL(i) (board_info[i].read_lvl) boards.h:34:#define WRITE_LVL(i) (board_info[i].write_lvl) boards.h:35:#define REMOVE_LVL(i) (board_info[i].remove_lvl) boards.h:36:#define FILENAME(i) (board_info[i].filename) boards.h:43:int Board_display_msg(int board_type, struct obj_data *terminal, boards.h:45:int Board_show_board(int board_type, struct obj_data *terminal, boards.h:47:int Board_list_board(int board_type, struct obj_data *terminal, boards.h:49:int Board_remove_msg(int board_type, struct obj_data *terminal, boards.h:51:int Board_reply_message(int board_type, struct obj_data *terminal, boards.h:53:void Board_write_message(int board_type, struct obj_data *terminal, boards.h:55:void Board_delete_msg(int board_type, int ind); boards.h:56:void Board_save_board(int board_type); boards.h:57:void Board_load_board(int board_type); boards.h:58:void Board_reset_board(int board_num); comm.cc:556: if (d->str) /* writing boards, mail, etc. */ fight.cc:1399: sprintf(buf,"A DocWagon armored speedboat arrives, loading %s's body on\r\nboard before leaving.", GET_NAME(ch)); iedit.cc:24:#include "boards.h" iedit.cc:68:extern struct board_info_type board_info[NUM_OF_BOARDS]; iedit.cc:1149: /* this fixes the creeping board problems */ iedit.cc:1150: // not needed since real nums aren't used with boards anymore iedit.cc:1152: for (counter = 0; counter < NUM_OF_BOARDS; counter++) iedit.cc:1154: if (BOARD_RNUM (counter) >= realcounter) iedit.cc:1155: BOARD_RNUM (counter) = BOARD_RNUM (counter) + 1; matrix.cc:25:#include "boards.h" medit.cc:18:#include "boards.h" modify.cc:26:#include "boards.h" modify.cc:337: if (d->mail_to >= BOARD_MAGIC) { modify.cc:390: Board_save_board(d->mail_to - BOARD_MAGIC); quest.cc:27:#include "boards.h" redit.cc:23:#include "boards.h" spec_assign.cc:377: SPECIAL(gen_board); spec_assign.cc:387: ASSIGNOBJ(3, gen_board); spec_assign.cc:388: ASSIGNOBJ(4, gen_board); spec_assign.cc:389: ASSIGNOBJ(12, gen_board); spec_assign.cc:390: ASSIGNOBJ(21, gen_board); spec_assign.cc:391: ASSIGNOBJ(22, gen_board); spec_assign.cc:392:// ASSIGNOBJ(26, gen_board); spec_assign.cc:393:// ASSIGNOBJ(28, gen_board); spec_assign.cc:394: ASSIGNOBJ(1006, gen_board); /* builder board */ spec_assign.cc:395: ASSIGNOBJ(1007, gen_board); spec_assign.cc:396: ASSIGNOBJ(1038, gen_board); spec_assign.cc:397: ASSIGNOBJ(1075, gen_board); /* Initiation Board */ spec_assign.cc:400: ASSIGNOBJ(2104, gen_board); /* mortal board */ spec_assign.cc:401: ASSIGNOBJ(2106, gen_board); /* immortal board */ spec_assign.cc:402: ASSIGNOBJ(2107, gen_board); /* freeze board */ spec_assign.cc:404:// ASSIGNOBJ(22700, gen_board); /* Washu's Board */ spec_assign.cc:407:// ASSIGNOBJ(3114, gen_board); spec_assign.cc:412: ASSIGNOBJ(8001, gen_board); spec_assign.cc:413: ASSIGNOBJ(8002, gen_board); spec_assign.cc:414: ASSIGNOBJ(8003, gen_board); spec_assign.cc:415: ASSIGNOBJ(8004, gen_board); spec_assign.cc:416: ASSIGNOBJ(8013, gen_board); spec_assign.cc~:377: SPECIAL(gen_board); spec_assign.cc~:387: ASSIGNOBJ(3, gen_board); spec_assign.cc~:388: ASSIGNOBJ(4, gen_board); spec_assign.cc~:389: ASSIGNOBJ(12, gen_board); spec_assign.cc~:390: ASSIGNOBJ(21, gen_board); spec_assign.cc~:391: ASSIGNOBJ(22, gen_board); spec_assign.cc~:392: ASSIGNOBJ(26, gen_board); spec_assign.cc~:393: ASSIGNOBJ(28, gen_board); spec_assign.cc~:394: ASSIGNOBJ(1006, gen_board); /* builder board */ spec_assign.cc~:395: ASSIGNOBJ(1007, gen_board); spec_assign.cc~:396: ASSIGNOBJ(1038, gen_board); spec_assign.cc~:397: ASSIGNOBJ(1075, gen_board); /* Initiation Board */ spec_assign.cc~:400: ASSIGNOBJ(2104, gen_board); /* mortal board */ spec_assign.cc~:401: ASSIGNOBJ(2106, gen_board); /* immortal board */ spec_assign.cc~:402: ASSIGNOBJ(2107, gen_board); /* freeze board */ spec_assign.cc~:404:// ASSIGNOBJ(22700, gen_board); /* Washu's Board */ spec_assign.cc~:407:// ASSIGNOBJ(3114, gen_board); spec_assign.cc~:412: ASSIGNOBJ(8001, gen_board); spec_assign.cc~:413: ASSIGNOBJ(8002, gen_board); spec_assign.cc~:414: ASSIGNOBJ(8003, gen_board); spec_assign.cc~:415: ASSIGNOBJ(8004, gen_board); spec_assign.cc~:416: ASSIGNOBJ(8013, gen_board); zedit.cc:19:#include "boards.h"