PennMUSH Community

Changeset 415

Show
Ignore:
Timestamp:
08/12/06 17:02:10 (2 years ago)
Author:
pennmush
Message:

PennMUSH 1.7.7p8 Archival

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • 1.7.7/CHANGES

    r413 r415  
    1818 
    1919========================================================================== 
     20 
     21Version 1.7.7 patchlevel 8                      January 27, 2003 
     22 
     23Minor 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 
     27Fixes: 
     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 
    2033 
    2134Version 1.7.7 patchlevel 7                      January 25, 2003 
  • 1.7.7/Patchlevel

    r413 r415  
    11Do not edit this file. It is maintained by the official PennMUSH patches. 
    2 This is PennMUSH 1.7.7p7 
     2This is PennMUSH 1.7.7p8 
  • 1.7.7/game/txt/hlp/pennvers.hlp

    r413 r415  
    11& changes 
    2 & 1.7.7p7 
     2& 1.7.7p8 
    33This is a list of changes in this patchlevel which are probably of 
    44interest to players. More information about new commands and functions 
     
    1212be read in 'help patchlevels'. 
    1313 
    14 Version 1.7.7 patchlevel 7                      January 23, 2003 
     14Version 1.7.7 patchlevel 8                      January 27, 2003 
     15 
     16Minor 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 
     20Fixes: 
     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 
     28Version 1.7.7 patchlevel 7                      January 25, 2003 
    1529 
    1630Fixes: 
     
    60316045type 'help <version>p<patchlevel>'. For example, 'help 1.7.2p3' 
    60326046 
    6033 1.7.7: 0, 1, 2, 3, 4, 5, 6, 7 
     60471.7.7: 0, 1, 2, 3, 4, 5, 6, 7, 8 
    603460481.7.6: 0, 1, 2, 3, 4, 5, 6 
    603560491.7.5: 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 
  • 1.7.7/hdrs/command.h

    r411 r415  
    165165extern COMMAND_INFO *command_find_exact(const char *name); 
    166166extern 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); 
    169169extern COMMAND_INFO *make_command 
    170170  (const char *name, int type, object_flag_type flagmask, int powers, 
  • 1.7.7/hdrs/externs.h

    r411 r415  
    5151                dbref cause, int from_port); 
    5252extern int init_game_dbs(void); 
     53extern void init_game_postdb(const char *conf); 
    5354extern void init_game_config(const char *conf); 
    5455extern void dump_database(void); 
  • 1.7.7/hdrs/game.h

    r411 r415  
    4343 
    4444/* From conf.c */ 
    45 extern int config_file_startup(const char *conf); 
     45extern int config_file_startup(const char *conf, int restrictions); 
    4646 
    4747/* 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.7p7
    3 #define NUMVERSION 001007007007 
     1#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  
    622622    exit(2); 
    623623  } 
     624 
     625  init_game_postdb(confname); 
     626 
    624627  set_signals(); 
    625628 
  • 1.7.7/src/cmdlocal.dst

    r411 r415  
    5959 * command into the command hash table. Any command you add here 
    6060 * 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) 
    6170 */ 
    6271void 
     
    6473{ 
    6574#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"
    6776          cmd_local_silly); 
    6877#endif 
  • 1.7.7/src/cmds.c

    r411 r415  
    4747void do_scan(dbref player, char *command, int flag); 
    4848void do_uptime(dbref player, int mortal); 
    49 extern int config_set(const char *opt, char *val, int source); 
     49extern int config_set(const char *opt, char *val, int source, int restrictions); 
    5050 
    5151/* From command.c */ 
     
    207207      return; 
    208208    } 
    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)) 
    210211      notify(player, T("Couldn't set that option")); 
    211212    else 
  • 1.7.7/src/command.c

    r411 r415  
    415415 
    416416COMMAND_INFO * 
    417 command_add(const char *name, int type, object_flag_type flagmask, int powers, 
    418         switch_mask *sw, command_func func) 
    419 
    420  
     417command_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); 
    421425  ptab_start_inserts(&ptab_command); 
    422426  ptab_insert(&ptab_command, name, 
  • 1.7.7/src/conf.c

    r411 r415  
    6666int cf_flag(const char *opt, const char *val, void *loc, int maxval, 
    6767        int source); 
    68 int config_set(const char *opt, char *val, int source); 
     68int config_set(const char *opt, char *val, int source, int restrictions); 
    6969void conf_default_set(void); 
    7070 
     
    594594 
    595595int 
    596 config_set(const char *opt, char *val, int source
     596config_set(const char *opt, char *val, int source, int restrictions
    597597    /* source: 0 from mush.cnf, 1 from @config or config() */ 
    598598{ 
     
    602602  /* Was this "restrict_command <command> <restriction>"? If so, do it */ 
    603603  if (!strcasecmp(opt, "restrict_command")) { 
     604    if (!restrictions) 
     605      return 1; 
    604606    for (p = val; *p && !isspace((unsigned char) *p); p++) ; 
    605607    if (*p) { 
     
    622624    } 
    623625    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; 
    678626  } else if (!strcasecmp(opt, "restrict_function")) { 
     627    if (!restrictions) 
     628      return 1; 
    679629    for (p = val; *p && !isspace((unsigned char) *p); p++) ; 
    680630    if (*p) { 
     
    699649    return 1; 
    700650  } else if (!strcasecmp(opt, "reserve_alias")) { 
     651    if (!restrictions) 
     652      return 1; 
    701653    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    } 
    702714    return 1; 
    703715  } else if (!strcasecmp(opt, "help_command") 
     
    705717    char *comm, *file; 
    706718    int admin = !strcasecmp(opt, "ahelp_command"); 
     719    if (!restrictions) 
     720      return 1; 
    707721    /* Add a new help-like command */ 
    708722    if (source == 1) 
     
    726740      return 0; 
    727741    } 
     742  } else if (restrictions) { 
     743    return 1; 
    728744  } 
    729745  /* search conf table for the option; if found, add it, if not found, 
     
    906922 
    907923int 
    908 config_file_startup(const char *conf
     924config_file_startup(const char *conf, int restrictions
    909925{ 
    910926  /* 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   */ 
    911930 
    912931  FILE *fp = NULL; 
     
    929948    } 
    930949    do_rawlog(LT_ERR, "Reading %s", cfile); 
    931     conf_default_set();     /* initialize defaults the first time */ 
    932950  } else { 
    933951    if (conf && *conf) 
     
    9951013            conf); 
    9961014    } else { 
    997       config_file_startup(q); 
     1015      config_file_startup(q, restrictions); 
    9981016    } 
    9991017    conf_recursion--; 
    10001018      } else 
    1001     config_set(p, q, 0); 
     1019    config_set(p, q, 0, restrictions); 
    10021020    } 
    10031021    fgets(tbuf1, BUFFER_LEN, fp); 
     
    12131231      return; 
    12141232    } 
    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)) { 
    12161235      safe_str(T("#-1 UNABLE TO SET OPTION"), buff, bp); 
    12171236      return; 
  • 1.7.7/src/flags.c

    r411 r415  
    2525 
    2626#include "conf.h" 
     27#include "command.h" 
    2728#include "attrib.h" 
    2829#include "mushdb.h" 
     
    5859                 * position. Aliases not inclued. */ 
    5960static int flagbits = 0;    /* The current length of the flags array */ 
     61 
     62extern PTAB ptab_command;   /* Uses flag bitmasks */ 
     63 
    6064 
    6165/* This is the old default flag table. We still use it when we have to 
     
    382386  dbref it; 
    383387  object_flag_type p; 
     388  COMMAND_INFO *command; 
    384389 
    385390  for (it = 0; it < db_top; it++) { 
     
    388393    p = Flags(it) + numbytes - 1; 
    389394    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); 
    390409  } 
    391410} 
     
    655674copy_flag_bitmask(object_flag_type dest, object_flag_type given) 
    656675{ 
    657   memcpy((void *) dest, (void *) given, sizeof(dest)); 
     676  int flagbytes = 1 + flagbits / 8; 
     677  memcpy((void *) dest, (void *) given, flagbytes); 
    658678} 
    659679 
     
    709729  unsigned int i; 
    710730  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++) 
    712733    ok &= ((*(bitmask + i) & *(source + i)) == *(bitmask + i)); 
    713734  return ok; 
     
    720741  unsigned int i; 
    721742  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++) 
    723745    ok |= (*(bitmask + i) & *(source + i)); 
    724746  return ok; 
  • 1.7.7/src/game.c

    r411 r415  
    102102int paranoid_checkpt = 0;   /* write out an okay message every x objs */ 
    103103extern long indb_flags; 
     104extern void conf_default_set(void); 
    104105static void dump_database_internal(void); 
    105106static FILE *db_open(const char *filename); 
     
    626627  memset(&current_state, 0, sizeof current_state); 
    627628 
     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 */ 
     637void 
     638init_game_postdb(const char *conf) 
     639{ 
     640  /* Commands and functions require the flag table for restrictions */ 
    628641  command_init_preconfig(); 
    629   config_file_startup(conf); 
    630642  command_init_postconfig(); 
    631643  function_init_postconfig(); 
    632 
     644  /* Load further restrictions from config file */ 
     645  config_file_startup(conf, 1); 
     646
     647 
    633648 
    634649int 
  • 1.7.7/src/help.c

    r411 r415  
    109109    return; 
    110110  } 
    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, 
    112112             cmd_helpcmd); 
    113113  hashadd(h->command, h, &help_files); 
  • 1.7.7/src/timer.c

    r411 r415  
    9797  if (hup_triggered) { 
    9898    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); 
    100101    fcache_load(NOTHING); 
    101102    help_reindex(NOTHING);