Changeset 415
- Timestamp:
- 08/12/06 17:02:10 (2 years ago)
- Files:
-
- 1.7.7/CHANGES (modified) (1 diff)
- 1.7.7/Patchlevel (modified) (1 diff)
- 1.7.7/game/txt/hlp/pennvers.hlp (modified) (3 diffs)
- 1.7.7/hdrs/command.h (modified) (1 diff)
- 1.7.7/hdrs/externs.h (modified) (1 diff)
- 1.7.7/hdrs/game.h (modified) (1 diff)
- 1.7.7/hdrs/version.h (modified) (1 diff)
- 1.7.7/src/bsd.c (modified) (1 diff)
- 1.7.7/src/cmdlocal.dst (modified) (2 diffs)
- 1.7.7/src/cmds.c (modified) (2 diffs)
- 1.7.7/src/command.c (modified) (1 diff)
- 1.7.7/src/conf.c (modified) (11 diffs)
- 1.7.7/src/flags.c (modified) (7 diffs)
- 1.7.7/src/game.c (modified) (2 diffs)
- 1.7.7/src/help.c (modified) (1 diff)
- 1.7.7/src/timer.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
1.7.7/CHANGES
r413 r415 18 18 19 19 ========================================================================== 20 21 Version 1.7.7 patchlevel 8 January 27, 2003 22 23 Minor Changes: 24 * command_add now expects to receive the flag list and the 25 switch list as strings. Folks who hack into cmdlocal.c should 26 take note and read example in the new cmdlocal.dst 27 Fixes: 28 * Players were not created with all the player_flags. In a related 29 bug, checking of command flag restrictions wouldn't work with 30 all flags. Reported by Cory Descoteau. 31 * Flagmasks on commands weren't grown properly when flags were added. 32 20 33 21 34 Version 1.7.7 patchlevel 7 January 25, 2003 1.7.7/Patchlevel
r413 r415 1 1 Do not edit this file. It is maintained by the official PennMUSH patches. 2 This is PennMUSH 1.7.7p 72 This is PennMUSH 1.7.7p8 1.7.7/game/txt/hlp/pennvers.hlp
r413 r415 1 1 & changes 2 & 1.7.7p 72 & 1.7.7p8 3 3 This is a list of changes in this patchlevel which are probably of 4 4 interest to players. More information about new commands and functions … … 12 12 be read in 'help patchlevels'. 13 13 14 Version 1.7.7 patchlevel 7 January 23, 2003 14 Version 1.7.7 patchlevel 8 January 27, 2003 15 16 Minor Changes: 17 * command_add now expects to receive the flag list and the 18 switch list as strings. Folks who hack into cmdlocal.c should 19 take note and read example in the new cmdlocal.dst 20 Fixes: 21 * Players were not created with all the player_flags. In a related 22 bug, checking of command flag restrictions wouldn't work with 23 all flags. Reported by Cory Descoteau. 24 * Flagmasks on commands weren't grown properly when flags were added. 25 26 27 & 1.7.7p7 28 Version 1.7.7 patchlevel 7 January 25, 2003 15 29 16 30 Fixes: … … 6031 6045 type 'help <version>p<patchlevel>'. For example, 'help 1.7.2p3' 6032 6046 6033 1.7.7: 0, 1, 2, 3, 4, 5, 6, 7 6047 1.7.7: 0, 1, 2, 3, 4, 5, 6, 7, 8 6034 6048 1.7.6: 0, 1, 2, 3, 4, 5, 6 6035 6049 1.7.5: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 1.7.7/hdrs/command.h
r411 r415 165 165 extern COMMAND_INFO *command_find_exact(const char *name); 166 166 extern COMMAND_INFO *command_add 167 (const char *name, int type, object_flag_type flagmask, int powers,168 switch_mask *sw, command_func func);167 (const char *name, int type, const char *flagstr, int powers, 168 const char *switchstr, command_func func); 169 169 extern COMMAND_INFO *make_command 170 170 (const char *name, int type, object_flag_type flagmask, int powers, 1.7.7/hdrs/externs.h
r411 r415 51 51 dbref cause, int from_port); 52 52 extern int init_game_dbs(void); 53 extern void init_game_postdb(const char *conf); 53 54 extern void init_game_config(const char *conf); 54 55 extern void dump_database(void); 1.7.7/hdrs/game.h
r411 r415 43 43 44 44 /* From conf.c */ 45 extern int config_file_startup(const char *conf );45 extern int config_file_startup(const char *conf, int restrictions); 46 46 47 47 /* From db.c */ 1.7.7/hdrs/version.h
r413 r415 1 #define VERSION "PennMUSH version 1.7.7 patchlevel 7 [01/25/2003]"2 #define SHORTVN "PennMUSH 1.7.7p 7"3 #define NUMVERSION 00100700700 71 #define VERSION "PennMUSH version 1.7.7 patchlevel 8 [01/27/2003]" 2 #define SHORTVN "PennMUSH 1.7.7p8" 3 #define NUMVERSION 001007007008 1.7.7/src/bsd.c
r411 r415 622 622 exit(2); 623 623 } 624 625 init_game_postdb(confname); 626 624 627 set_signals(); 625 628 1.7.7/src/cmdlocal.dst
r411 r415 59 59 * command into the command hash table. Any command you add here 60 60 * will be auto-aliased for you. 61 * The way to call command_add is illustrated below. The arguments are: 62 * Name of the command, a string ("@SILLY") 63 * Command parsing modifiers, a bitmask (see hdrs/command.h) 64 * Flags to restrict command to, a string ("WIZARD ROYALTY") or NULL 65 * (Someone with *any* one of these flags can use the command) 66 * Powers to restrict command to, a bitmask (see hdrs/flags.h) or 0 67 * (Someone with this power can use the command) 68 * Switches the command can take, a string or NULL ("NOISY NOEVAL") 69 * Hardcoded function the command should call (cmd_local_silly) 61 70 */ 62 71 void … … 64 73 { 65 74 #ifdef EXAMPLE 66 command_add("@SILLY", CMD_T_ANY, 0, 0, switchmask("NOISY NOEVAL"),75 command_add("@SILLY", CMD_T_ANY, "WIZARD ROYALTY", SEE_ALL, "NOISY NOEVAL", 67 76 cmd_local_silly); 68 77 #endif 1.7.7/src/cmds.c
r411 r415 47 47 void do_scan(dbref player, char *command, int flag); 48 48 void do_uptime(dbref player, int mortal); 49 extern int config_set(const char *opt, char *val, int source );49 extern int config_set(const char *opt, char *val, int source, int restrictions); 50 50 51 51 /* From command.c */ … … 207 207 return; 208 208 } 209 if (!config_set(arg_left, arg_right, 1)) 209 if (!config_set(arg_left, arg_right, 1, 0) 210 && !config_set(arg_left, arg_right, 1, 1)) 210 211 notify(player, T("Couldn't set that option")); 211 212 else 1.7.7/src/command.c
r411 r415 415 415 416 416 COMMAND_INFO * 417 command_add(const char *name, int type, object_flag_type flagmask, int powers, 418 switch_mask *sw, command_func func) 419 { 420 417 command_add(const char *name, int type, const char *flagstr, 418 int powers, const char *switchstr, command_func func) 419 { 420 object_flag_type flagmask = NULL; 421 switch_mask *sw = switchmask(switchstr); 422 423 if (flagstr) 424 flagmask = string_to_bits(flagstr); 421 425 ptab_start_inserts(&ptab_command); 422 426 ptab_insert(&ptab_command, name, 1.7.7/src/conf.c
r411 r415 66 66 int cf_flag(const char *opt, const char *val, void *loc, int maxval, 67 67 int source); 68 int config_set(const char *opt, char *val, int source );68 int config_set(const char *opt, char *val, int source, int restrictions); 69 69 void conf_default_set(void); 70 70 … … 594 594 595 595 int 596 config_set(const char *opt, char *val, int source )596 config_set(const char *opt, char *val, int source, int restrictions) 597 597 /* source: 0 from mush.cnf, 1 from @config or config() */ 598 598 { … … 602 602 /* Was this "restrict_command <command> <restriction>"? If so, do it */ 603 603 if (!strcasecmp(opt, "restrict_command")) { 604 if (!restrictions) 605 return 1; 604 606 for (p = val; *p && !isspace((unsigned char) *p); p++) ; 605 607 if (*p) { … … 622 624 } 623 625 return 1; 624 } else if (!strcasecmp(opt, "command_alias")) {625 for (p = val; *p && !isspace((unsigned char) *p); p++) ;626 if (*p) {627 *p++ = '\0';628 if (!alias_command(val, p)) {629 if (source == 0) {630 do_rawlog(LT_ERR, T("CONFIG: Couldn't alias %s to %s.\n"), p, val);631 }632 return 0;633 }634 } else {635 if (source == 0) {636 do_rawlog(LT_ERR,637 T("CONFIG: command_alias %s requires an alias.\n"), val);638 }639 return 0;640 }641 return 1;642 } else if (!strcasecmp(opt, "attribute_alias")) {643 for (p = val; *p && !isspace((unsigned char) *p); p++) ;644 if (*p) {645 *p++ = '\0';646 if (!alias_attribute(val, p)) {647 if (source == 0) {648 do_rawlog(LT_ERR, T("CONFIG: Couldn't alias %s to %s.\n"), p, val);649 }650 return 0;651 }652 } else {653 if (source == 0) {654 do_rawlog(LT_ERR,655 T("CONFIG: attribute_alias %s requires an alias.\n"), val);656 }657 return 0;658 }659 return 1;660 } else if (!strcasecmp(opt, "function_alias")) {661 for (p = val; *p && !isspace((unsigned char) *p); p++) ;662 if (*p) {663 *p++ = '\0';664 if (!alias_function(val, p)) {665 if (source == 0) {666 do_rawlog(LT_ERR, T("CONFIG: Couldn't alias %s to %s.\n"), p, val);667 }668 return 0;669 }670 } else {671 if (source == 0) {672 do_rawlog(LT_ERR,673 T("CONFIG: function_alias %s requires an alias.\n"), val);674 }675 return 0;676 }677 return 1;678 626 } else if (!strcasecmp(opt, "restrict_function")) { 627 if (!restrictions) 628 return 1; 679 629 for (p = val; *p && !isspace((unsigned char) *p); p++) ; 680 630 if (*p) { … … 699 649 return 1; 700 650 } else if (!strcasecmp(opt, "reserve_alias")) { 651 if (!restrictions) 652 return 1; 701 653 reserve_alias(val); 654 return 1; 655 } else if (!strcasecmp(opt, "command_alias")) { 656 if (!restrictions) 657 return 1; 658 for (p = val; *p && !isspace((unsigned char) *p); p++) ; 659 if (*p) { 660 *p++ = '\0'; 661 if (!alias_command(val, p)) { 662 if (source == 0) { 663 do_rawlog(LT_ERR, T("CONFIG: Couldn't alias %s to %s.\n"), p, val); 664 } 665 return 0; 666 } 667 } else { 668 if (source == 0) { 669 do_rawlog(LT_ERR, 670 T("CONFIG: command_alias %s requires an alias.\n"), val); 671 } 672 return 0; 673 } 674 return 1; 675 } else if (!strcasecmp(opt, "attribute_alias")) { 676 if (!restrictions) 677 return 1; 678 for (p = val; *p && !isspace((unsigned char) *p); p++) ; 679 if (*p) { 680 *p++ = '\0'; 681 if (!alias_attribute(val, p)) { 682 if (source == 0) { 683 do_rawlog(LT_ERR, T("CONFIG: Couldn't alias %s to %s.\n"), p, val); 684 } 685 return 0; 686 } 687 } else { 688 if (source == 0) { 689 do_rawlog(LT_ERR, 690 T("CONFIG: attribute_alias %s requires an alias.\n"), val); 691 } 692 return 0; 693 } 694 return 1; 695 } else if (!strcasecmp(opt, "function_alias")) { 696 if (!restrictions) 697 return 1; 698 for (p = val; *p && !isspace((unsigned char) *p); p++) ; 699 if (*p) { 700 *p++ = '\0'; 701 if (!alias_function(val, p)) { 702 if (source == 0) { 703 do_rawlog(LT_ERR, T("CONFIG: Couldn't alias %s to %s.\n"), p, val); 704 } 705 return 0; 706 } 707 } else { 708 if (source == 0) { 709 do_rawlog(LT_ERR, 710 T("CONFIG: function_alias %s requires an alias.\n"), val); 711 } 712 return 0; 713 } 702 714 return 1; 703 715 } else if (!strcasecmp(opt, "help_command") … … 705 717 char *comm, *file; 706 718 int admin = !strcasecmp(opt, "ahelp_command"); 719 if (!restrictions) 720 return 1; 707 721 /* Add a new help-like command */ 708 722 if (source == 1) … … 726 740 return 0; 727 741 } 742 } else if (restrictions) { 743 return 1; 728 744 } 729 745 /* search conf table for the option; if found, add it, if not found, … … 906 922 907 923 int 908 config_file_startup(const char *conf )924 config_file_startup(const char *conf, int restrictions) 909 925 { 910 926 /* read a configuration file. Return 0 on failure, 1 on success */ 927 /* If 'restrictions' is 0, ignore restrict*. If it's 1, only 928 * look at restrict* 929 */ 911 930 912 931 FILE *fp = NULL; … … 929 948 } 930 949 do_rawlog(LT_ERR, "Reading %s", cfile); 931 conf_default_set(); /* initialize defaults the first time */932 950 } else { 933 951 if (conf && *conf) … … 995 1013 conf); 996 1014 } else { 997 config_file_startup(q );1015 config_file_startup(q, restrictions); 998 1016 } 999 1017 conf_recursion--; 1000 1018 } else 1001 config_set(p, q, 0 );1019 config_set(p, q, 0, restrictions); 1002 1020 } 1003 1021 fgets(tbuf1, BUFFER_LEN, fp); … … 1213 1231 return; 1214 1232 } 1215 if (!config_set(args[0], args[1], 1)) { 1233 if (!config_set(args[0], args[1], 1, 0) 1234 && !config_set(args[0], args[1], 1, 1)) { 1216 1235 safe_str(T("#-1 UNABLE TO SET OPTION"), buff, bp); 1217 1236 return; 1.7.7/src/flags.c
r411 r415 25 25 26 26 #include "conf.h" 27 #include "command.h" 27 28 #include "attrib.h" 28 29 #include "mushdb.h" … … 58 59 * position. Aliases not inclued. */ 59 60 static int flagbits = 0; /* The current length of the flags array */ 61 62 extern PTAB ptab_command; /* Uses flag bitmasks */ 63 60 64 61 65 /* This is the old default flag table. We still use it when we have to … … 382 386 dbref it; 383 387 object_flag_type p; 388 COMMAND_INFO *command; 384 389 385 390 for (it = 0; it < db_top; it++) { … … 388 393 p = Flags(it) + numbytes - 1; 389 394 memset(p, 0, 1); 395 } 396 /* We also need to make sure that all the command flagmasks are 397 * reallocated! 398 */ 399 command = (COMMAND_INFO *) ptab_firstentry(&ptab_command); 400 while (command) { 401 if (command->flagmask) { 402 command->flagmask = 403 (object_flag_type) realloc(command->flagmask, numbytes); 404 /* Zero them out */ 405 p = command->flagmask + numbytes - 1; 406 memset(p, 0, 1); 407 } 408 command = (COMMAND_INFO *) ptab_nextentry(&ptab_command); 390 409 } 391 410 } … … 655 674 copy_flag_bitmask(object_flag_type dest, object_flag_type given) 656 675 { 657 memcpy((void *) dest, (void *) given, sizeof(dest)); 676 int flagbytes = 1 + flagbits / 8; 677 memcpy((void *) dest, (void *) given, flagbytes); 658 678 } 659 679 … … 709 729 unsigned int i; 710 730 int ok = 1; 711 for (i = 0; i < sizeof(source); i++) 731 unsigned int flagbytes = 1 + flagbits / 8; 732 for (i = 0; i < flagbytes; i++) 712 733 ok &= ((*(bitmask + i) & *(source + i)) == *(bitmask + i)); 713 734 return ok; … … 720 741 unsigned int i; 721 742 int ok = 0; 722 for (i = 0; i < sizeof(source); i++) 743 unsigned int flagbytes = 1 + flagbits / 8; 744 for (i = 0; i < flagbytes; i++) 723 745 ok |= (*(bitmask + i) & *(source + i)); 724 746 return ok; 1.7.7/src/game.c
r411 r415 102 102 int paranoid_checkpt = 0; /* write out an okay message every x objs */ 103 103 extern long indb_flags; 104 extern void conf_default_set(void); 104 105 static void dump_database_internal(void); 105 106 static FILE *db_open(const char *filename); … … 626 627 memset(¤t_state, 0, sizeof current_state); 627 628 629 /* Load all the config file stuff except restrict_* */ 630 conf_default_set(); 631 config_file_startup(conf, 0); 632 } 633 634 /* Code that should be run after dbs are loaded (usually because we 635 * need to have the flag table loaded 636 */ 637 void 638 init_game_postdb(const char *conf) 639 { 640 /* Commands and functions require the flag table for restrictions */ 628 641 command_init_preconfig(); 629 config_file_startup(conf);630 642 command_init_postconfig(); 631 643 function_init_postconfig(); 632 } 644 /* Load further restrictions from config file */ 645 config_file_startup(conf, 1); 646 } 647 633 648 634 649 int 1.7.7/src/help.c
r411 r415 109 109 return; 110 110 } 111 (void) command_add(h->command, CMD_T_ANY | CMD_T_NOPARSE, 0, 0, NULL,111 (void) command_add(h->command, CMD_T_ANY | CMD_T_NOPARSE, NULL, 0, NULL, 112 112 cmd_helpcmd); 113 113 hashadd(h->command, h, &help_files); 1.7.7/src/timer.c
r411 r415 97 97 if (hup_triggered) { 98 98 do_rawlog(LT_ERR, T("SIGHUP received: reloading .txt and .cnf files")); 99 config_file_startup(NULL); 99 config_file_startup(NULL, 0); 100 config_file_startup(NULL, 1); 100 101 fcache_load(NOTHING); 101 102 help_reindex(NOTHING);
