From 5825f9f4291da0e8e18049a66c5119cbfc2f36a7 Mon Sep 17 00:00:00 2001 From: nveid Date: Mon, 9 Apr 2007 03:51:14 +0000 Subject: [PATCH] Changed the way we convert flag tables when coming from pennmush. (cherry picked from commit 716fcf28d1e2db23752f71d19bfaa04058b76be5) --- game/txt/changes/0.72p4 | 2 ++ hdrs/flags.h | 1 + hdrs/mushdb.h | 2 ++ src/bsd.c | 4 ++-- src/flags.c | 10 +++++++++- 5 files changed, 16 insertions(+), 3 deletions(-) diff --git a/game/txt/changes/0.72p4 b/game/txt/changes/0.72p4 index 75911b9..a0646a6 100644 --- a/game/txt/changes/0.72p4 +++ b/game/txt/changes/0.72p4 @@ -13,5 +13,7 @@ CobraMUSH Version 0.72p4 * Parts of the RPMODE_SYS were not appropriately enclosed in ifdef statements, causing all non-privileged players to be rpgagged on channels. [RLB] + * Improved PennMUSH to CobraMUSH flag conversion code for flags that are + set to be of 'ANY' type. [RLB] * Fixed a bug related to uninitialized lastmod entries [AEJ] diff --git a/hdrs/flags.h b/hdrs/flags.h index 96f7588..d087bd1 100644 --- a/hdrs/flags.h +++ b/hdrs/flags.h @@ -122,6 +122,7 @@ extern void decompile_flags(dbref player, dbref thing, const char *name); #define NOTYPE 0xFFFF #define ALLTYPES (0 | TYPE_ROOM | TYPE_THING | TYPE_EXIT | TYPE_PLAYER | TYPE_DIVISION) +#define ALL_PENNMUSH_TYPES (0 | TYPE_ROOM | TYPE_THING | TYPE_EXIT | TYPE_PLAYER) diff --git a/hdrs/mushdb.h b/hdrs/mushdb.h index 6a8cc26..499d878 100644 --- a/hdrs/mushdb.h +++ b/hdrs/mushdb.h @@ -223,6 +223,8 @@ int unfindable(dbref); #define HAS_COBRADBFLAG(x,y) (!(x & DBF_TYPE_GARBAGE) && (x & y)) /* Macro exists so cobra & penn dbflags can exist as same DBFs */ +#define IS_COBRA_DB(x) (!(x & DBF_TYPE_GARBAGE)) + /* Reboot DB flag macros - these should be defined whether or not the * corresponding system option is defined * They are successive binary numbers diff --git a/src/bsd.c b/src/bsd.c index e263674..39a3f01 100644 --- a/src/bsd.c +++ b/src/bsd.c @@ -510,10 +510,10 @@ main(int argc, char **argv) } #endif #ifdef HAS_TEXTDOMAIN - textdomain("pennmush"); + textdomain("cobramush"); #endif #ifdef HAS_BINDTEXTDOMAIN - bindtextdomain("pennmush", "../po"); + bindtextdomain("cobramush", "../po"); #endif /* Build the locale-dependant tables used by PCRE */ diff --git a/src/flags.c b/src/flags.c index 3958cbb..f9a0e1f 100644 --- a/src/flags.c +++ b/src/flags.c @@ -498,8 +498,12 @@ flag_read(FILE * in) db_read_this_labeled_string(in, "type", &tmp); if(!strcmp(tmp, "ANY")) f->type = ALLTYPES; - else + else { f->type = string_to_privs(type_privs, tmp, 0); + /* Check to See if we're converting from Penn.. if so, change their Any to include our Any */ + if(!IS_COBRA_DB(flagdb_flags) && f->type == ALL_PENNMUSH_TYPES) + f->type = ALLTYPES; + } db_read_this_labeled_string(in, "perms", &tmp); f->perms = string_to_privs(flag_privs, tmp, 0); db_read_this_labeled_string(in, "negate_perms", &tmp); @@ -711,6 +715,8 @@ init_flag_table(const char *ns) return; } + do_rawlog(LT_ERR, T("Initializing flag table.")); + ptab_init(n->tab); /* do regular flags first */ for (f = n->flag_table; f->name; f++) { @@ -727,6 +733,8 @@ init_flag_table(const char *ns) T("FLAG INIT: flag alias %s matches no known flag."), a->alias); } flag_add_additional(); + + do_rawlog(LT_ERR, T("Flag table initialization complete.")); } /* This is where the developers will put flag_add statements to create -- 2.30.2