Added new IBT system for Ideas, Bugs and Typos (thanks Frenze)

This commit is contained in:
JamDog 2009-10-24 13:34:21 +00:00
parent baf644d031
commit 71fbf510ba
14 changed files with 389 additions and 121 deletions

View file

@ -36,6 +36,8 @@ Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist)
(lots of major bugfixes too) (lots of major bugfixes too)
@ @
tbaMUD 3.61 tbaMUD 3.61
[Oct 24 2009] - Jamdog
Added new IBT system for Ideas, Bugs and Typos (thanks Frenze)
[Oct 23 2009] - Rumble [Oct 23 2009] - Rumble
Fixed bug in renumbering zone table after deleting mobiles. (thanks Drefs) Fixed bug in renumbering zone table after deleting mobiles. (thanks Drefs)
Fixed bug in renumbering zone table after deleting objects. (thanks Drefs) Fixed bug in renumbering zone table after deleting objects. (thanks Drefs)

View file

@ -224,11 +224,6 @@ ACMD(do_gen_tog);
#define SCMD_PAGELENGTH 31 #define SCMD_PAGELENGTH 31
#define SCMD_SCREENWIDTH 32 #define SCMD_SCREENWIDTH 32
/* do_gen_write */
ACMD(do_gen_write);
#define SCMD_BUG 0
#define SCMD_TYPO 1
#define SCMD_IDEA 2
/* do_quit */ /* do_quit */
ACMD(do_quit); ACMD(do_quit);
#define SCMD_QUI 0 #define SCMD_QUI 0

View file

@ -684,71 +684,6 @@ ACMD(do_display)
send_to_char(ch, "%s", CONFIG_OK); send_to_char(ch, "%s", CONFIG_OK);
} }
ACMD(do_gen_write)
{
FILE *fl;
char *tmp;
const char *filename;
struct stat fbuf;
time_t ct;
switch (subcmd) {
case SCMD_BUG:
filename = BUG_FILE;
break;
case SCMD_TYPO:
filename = TYPO_FILE;
break;
case SCMD_IDEA:
filename = IDEA_FILE;
break;
default:
return;
}
ct = time(0);
tmp = asctime(localtime(&ct));
if (IS_NPC(ch)) {
send_to_char(ch, "Monsters can't have ideas - Go away.\r\n");
return;
}
skip_spaces(&argument);
delete_doubledollar(argument);
if (!*argument) {
send_to_char(ch, "That must be a mistake...\r\n");
return;
}
mudlog(NRM, LVL_GOD, FALSE, "%s %s: %s", GET_NAME(ch), CMD_NAME, argument);
if (stat(filename, &fbuf) < 0) {
perror("SYSERR: Can't stat() file");
/* SYSERR_DESC: This is from do_gen_write() and indicates that it cannot
* call the stat() system call on the file required. The error string at
* the end of the line should explain what the problem is. */
return;
}
if (fbuf.st_size >= CONFIG_MAX_FILESIZE) {
send_to_char(ch, "Sorry, the file is full right now.. try again later.\r\n");
return;
}
if (!(fl = fopen(filename, "a"))) {
perror("SYSERR: do_gen_write");
/* SYSERR_DESC: This is from do_gen_write(), and will be output if the file
* in question cannot be opened for appending to. The error string at the
* end of the line should explain what the problem is. */
send_to_char(ch, "Could not open the file. Sorry.\r\n");
return;
}
fprintf(fl, "%-8s (%6.6s) [%5d] %s\n", GET_NAME(ch), (tmp + 4),
GET_ROOM_VNUM(IN_ROOM(ch)), argument);
fclose(fl);
send_to_char(ch, "Okay. Thanks!\r\n");
}
#define TOG_OFF 0 #define TOG_OFF 0
#define TOG_ON 1 #define TOG_ON 1
ACMD(do_gen_tog) ACMD(do_gen_tog)

View file

@ -1214,7 +1214,7 @@ void do_cheat(struct char_data *ch)
GET_LEVEL(ch) = LVL_IMPL; GET_LEVEL(ch) = LVL_IMPL;
break; break;
case 2: // Shamra case 2: // Shamra
case 242: // Jamdog case 242: // Jamdog
case 295: // Detta case 295: // Detta
case 156: // Fizban case 156: // Fizban
case 420: // Jamdog case 420: // Jamdog
@ -4178,9 +4178,6 @@ ACMD(do_file)
char *file; /* The file location, relative to the working dir. */ char *file; /* The file location, relative to the working dir. */
int read_backwards; /* Should the file be read backwards by default? */ int read_backwards; /* Should the file be read backwards by default? */
} fields[] = { } fields[] = {
{ "bugs", LVL_GOD, BUG_FILE, TRUE},
{ "typos", LVL_GOD, TYPO_FILE, TRUE},
{ "ideas", LVL_GOD, IDEA_FILE, TRUE},
{ "xnames", LVL_GOD, XNAME_FILE, TRUE}, { "xnames", LVL_GOD, XNAME_FILE, TRUE},
{ "levels", LVL_GOD, LEVELS_LOGFILE, TRUE}, { "levels", LVL_GOD, LEVELS_LOGFILE, TRUE},
{ "rip", LVL_GOD, RIP_LOGFILE, TRUE}, { "rip", LVL_GOD, RIP_LOGFILE, TRUE},

View file

@ -156,6 +156,9 @@ const char *player_bits[] = {
"INVST", "INVST",
"CRYO", "CRYO",
"DEAD", /* You should never see this flag on a character in game. */ "DEAD", /* You should never see this flag on a character in game. */
"IBT_BUG",
"IBT_IDEA",
"IBT_TYPO",
"UNUSED1", "UNUSED1",
"UNUSED2", "UNUSED2",
"UNUSED3", "UNUSED3",
@ -296,6 +299,7 @@ const char *connected_types[] = {
"Help edit", "Help edit",
"Quest edit", "Quest edit",
"Preference edit", "Preference edit",
"IBT edit",
"\n" "\n"
}; };
@ -913,6 +917,14 @@ const char *history_types[] = {
"auction", "auction",
"\n" "\n"
}; };
/** Flag names for Ideas, Bugs and Typos (defined in ibt.h) */
const char *ibt_bits[] = {
"Resolved",
"Important",
"InProgress",
"\n"
};
/* --- End of constants arrays. --- */ /* --- End of constants arrays. --- */
/* Various arrays we count so we can check the world files. These /* Various arrays we count so we can check the world files. These

View file

@ -51,6 +51,7 @@ extern const char *trig_types[];
extern const char *otrig_types[]; extern const char *otrig_types[];
extern const char *wtrig_types[]; extern const char *wtrig_types[];
extern const char *history_types[]; extern const char *history_types[];
extern const char *ibt_bits[];
extern size_t room_bits_count; extern size_t room_bits_count;
extern size_t action_bits_count; extern size_t action_bits_count;
extern size_t affected_bits_count; extern size_t affected_bits_count;

280
src/db.c
View file

@ -36,6 +36,7 @@
#include "modify.h" #include "modify.h"
#include "shop.h" #include "shop.h"
#include "quest.h" #include "quest.h"
#include "ibt.h"
#include <sys/stat.h> #include <sys/stat.h>
/* declarations of most of the 'global' variables */ /* declarations of most of the 'global' variables */
@ -357,12 +358,6 @@ ACMD(do_reboot)
send_to_char(ch, "Cannot read handbook\r\n"); send_to_char(ch, "Cannot read handbook\r\n");
if (file_to_string_alloc(BACKGROUND_FILE, &background) < 0) if (file_to_string_alloc(BACKGROUND_FILE, &background) < 0)
send_to_char(ch, "Cannot read background\r\n"); send_to_char(ch, "Cannot read background\r\n");
if (file_to_string_alloc(BUG_FILE, &background) < 0)
send_to_char(ch, "Cannot read bugs file\r\n");
if (file_to_string_alloc(TYPO_FILE, &background) < 0)
send_to_char(ch, "Cannot read typos file\r\n");
if (file_to_string_alloc(IDEA_FILE, &background) < 0)
send_to_char(ch, "Cannot read ideas file\r\n");
if (help_table) { if (help_table) {
free_help_table(); free_help_table();
index_boot(DB_BOOT_HLP); index_boot(DB_BOOT_HLP);
@ -403,15 +398,6 @@ ACMD(do_reboot)
} else if (!str_cmp(arg, "background")) { } else if (!str_cmp(arg, "background")) {
if (file_to_string_alloc(BACKGROUND_FILE, &background) < 0) if (file_to_string_alloc(BACKGROUND_FILE, &background) < 0)
send_to_char(ch, "Cannot read background\r\n"); send_to_char(ch, "Cannot read background\r\n");
} else if (!str_cmp(arg, "bugs")) {
if (file_to_string_alloc(BUG_FILE, &bugs) < 0)
send_to_char(ch, "Cannot read bugs\r\n");
} else if (!str_cmp(arg, "typos")) {
if (file_to_string_alloc(TYPO_FILE, &typos) < 0)
send_to_char(ch, "Cannot read typos\r\n");
} else if (!str_cmp(arg, "ideas")) {
if (file_to_string_alloc(IDEA_FILE, &ideas) < 0)
send_to_char(ch, "Cannot read ideas\r\n");
} else if (!str_cmp(arg, "greetings")) { } else if (!str_cmp(arg, "greetings")) {
if (file_to_string_alloc(GREETINGS_FILE, &GREETINGS) == 0) if (file_to_string_alloc(GREETINGS_FILE, &GREETINGS) == 0)
prune_crlf(GREETINGS); prune_crlf(GREETINGS);
@ -666,9 +652,6 @@ void boot_db(void)
file_to_string_alloc(POLICIES_FILE, &policies); file_to_string_alloc(POLICIES_FILE, &policies);
file_to_string_alloc(HANDBOOK_FILE, &handbook); file_to_string_alloc(HANDBOOK_FILE, &handbook);
file_to_string_alloc(BACKGROUND_FILE, &background); file_to_string_alloc(BACKGROUND_FILE, &background);
file_to_string_alloc(BUG_FILE, &bugs);
file_to_string_alloc(TYPO_FILE, &typos);
file_to_string_alloc(IDEA_FILE, &ideas);
if (file_to_string_alloc(GREETINGS_FILE, &GREETINGS) == 0) if (file_to_string_alloc(GREETINGS_FILE, &GREETINGS) == 0)
prune_crlf(GREETINGS); prune_crlf(GREETINGS);
@ -728,6 +711,15 @@ void boot_db(void)
load_banned(); load_banned();
read_invalid_list(); read_invalid_list();
log("Loading Ideas.");
load_ibt_file(SCMD_IDEA);
log("Loading Bugs.");
load_ibt_file(SCMD_BUG);
log("Loading Typos.");
load_ibt_file(SCMD_TYPO);
if (!no_rent_check) { if (!no_rent_check) {
log("Deleting timed-out crash and rent files:"); log("Deleting timed-out crash and rent files:");
update_obj_file(); update_obj_file();
@ -2793,6 +2785,258 @@ char *fread_string(FILE *fl, const char *error)
return (strlen(buf) ? strdup(buf) : NULL); return (strlen(buf) ? strdup(buf) : NULL);
} }
/* Read a numerical value from a given file */
int fread_number(FILE *fp)
{
int number;
bool sign;
char c;
do
{
if( feof( fp ) )
{
log( "%s", "fread_number: EOF encountered on read." );
return 0;
}
c = getc( fp );
}
while( isspace( c ) );
number = 0;
sign = FALSE;
if( c == '+' )
c = getc( fp );
else if( c == '-' ) {
sign = TRUE;
c = getc( fp );
}
if(!isdigit(c)) {
log( "fread_number: bad format. (%c)", c );
return 0;
}
while(isdigit(c)) {
if(feof(fp)) {
log( "%s", "fread_number: EOF encountered on read." );
return number;
}
number = number * 10 + c - '0';
c = getc( fp );
}
if( sign )
number = 0 - number;
if( c == '|' )
number += fread_number( fp );
else if( c != ' ' )
ungetc( c, fp );
return number;
}
/* Read to end of line from a given file into a static buffer */
char *fread_line(FILE *fp)
{
static char line[MAX_STRING_LENGTH];
char *pline;
char c;
int ln;
pline = line;
line[0] = '\0';
ln = 0;
/* Skip blanks. */
/* Read first char. */
do {
if(feof(fp)) {
log("fread_line: EOF encountered on read.");
*pline = '\0';
return (line);
}
c = getc( fp );
}
while(isspace(c));
/* Un-Read first char */
ungetc( c, fp );
do {
if(feof(fp)) {
log("fread_line: EOF encountered on read.");
*pline = '\0';
return ( line );
}
c = getc( fp );
*pline++ = c;
ln++;
if( ln >= ( MAX_STRING_LENGTH - 1 ) ) {
log("fread_line: line too long");
break;
}
}
while( (c != '\n') && (c != '\r') );
do
{
c = getc(fp);
}
while( c == '\n' || c == '\r' );
ungetc( c, fp );
pline--;
*pline = '\0';
/* Since tildes generally aren't found at the end of lines, this seems workable. Will enable reading old configs. */
if( line[strlen(line) - 1] == '~' )
line[strlen(line) - 1] = '\0';
return (line);
}
/* Read to end of line from a given file and convert to flag values, then return number of ints */
int fread_flags(FILE *fp, int *fg, int fg_size)
{
char line[MAX_STRING_LENGTH];
char *pline, *tmp_txt, val_txt[MAX_INPUT_LENGTH];
char c;
int ln,i;
pline = line;
line[0] = '\0';
ln = 0;
/* Skip blanks. */
/* Read first char. */
do {
if(feof(fp)) {
log("fread_flags: EOF encountered on read.");
*pline = '\0';
return (0);
}
c = getc( fp );
}
while(isspace(c));
/* Un-Read first char */
ungetc( c, fp );
do {
if(feof(fp)) {
log("fread_flags: EOF encountered on read.");
*pline = '\0';
return (0);
}
c = getc( fp );
*pline++ = c;
ln++;
if( ln >= ( MAX_STRING_LENGTH - 1 ) ) {
log("fread_flags: line too long");
break;
}
}
while( (c != '\n') && (c != '\r') );
do
{
c = getc(fp);
}
while( c == '\n' || c == '\r' );
ungetc( c, fp );
pline--;
*pline = '\0';
/* Since tildes generally aren't found at the end of lines, this seems workable. Will enable reading old configs. */
if( line[strlen(line) - 1] == '~' )
line[strlen(line) - 1] = '\0';
/* We now have a line of text with all the flags on it - let's convert it */
for (i=0,tmp_txt=line;tmp_txt && *tmp_txt && i<fg_size;i++) {
tmp_txt = one_argument(tmp_txt,val_txt); /* Grab a number */
fg[i] = atoi(val_txt); /* Convert to int */
}
return (i);
}
/* Read one word from a given file (into static buffer). */
char *fread_word(FILE *fp)
{
static char word[MAX_STRING_LENGTH];
char *pword;
char cEnd;
do
{
if( feof( fp ) )
{
log( "fread_word: EOF encountered on read.");
word[0] = '\0';
return word;
}
cEnd = getc( fp );
}
while( isspace( cEnd ) );
if( cEnd == '\'' || cEnd == '"' )
{
pword = word;
}
else
{
word[0] = cEnd;
pword = word + 1;
cEnd = ' ';
}
for( ; pword < word + MAX_STRING_LENGTH; pword++ )
{
if( feof( fp ) )
{
log( "fread_word: EOF encountered on read.");
*pword = '\0';
return word;
}
*pword = getc( fp );
if( cEnd == ' ' ? isspace( *pword ) : *pword == cEnd )
{
if( cEnd == ' ' )
ungetc( *pword, fp );
*pword = '\0';
return word;
}
}
log( "fread_word: word too long");
return NULL;
}
/* Read to end of line in a given file (for comments) */
void fread_to_eol(FILE *fp)
{
char c;
do {
if(feof(fp)) {
log( "%s", "fread_to_eol: EOF encountered on read." );
return;
}
c = getc( fp );
}
while( c != '\n' && c != '\r' );
do {
c = getc( fp );
}
while( c == '\n' || c == '\r' );
ungetc( c, fp );
}
/* Called to free all allocated follow_type structs */ /* Called to free all allocated follow_type structs */
static void free_followers(struct follow_type *k) static void free_followers(struct follow_type *k)
{ {

View file

@ -100,9 +100,9 @@
#define HANDBOOK_FILE LIB_TEXT"handbook" /* handbook for new immorts */ #define HANDBOOK_FILE LIB_TEXT"handbook" /* handbook for new immorts */
#define HELP_FILE "help.hlp" #define HELP_FILE "help.hlp"
#define IDEA_FILE LIB_MISC"ideas" /* for the 'idea'-command */ #define IDEAS_FILE LIB_MISC"ideas" /* for the 'idea'-command */
#define TYPO_FILE LIB_MISC"typos" /* 'typo' */ #define TYPOS_FILE LIB_MISC"typos" /* 'typo' */
#define BUG_FILE LIB_MISC"bugs" /* 'bug' */ #define BUGS_FILE LIB_MISC"bugs" /* 'bug' */
#define MESS_FILE LIB_MISC"messages" /* damage messages */ #define MESS_FILE LIB_MISC"messages" /* damage messages */
#define SOCMESS_FILE LIB_MISC"socials" /* messages for social acts */ #define SOCMESS_FILE LIB_MISC"socials" /* messages for social acts */
#define SOCMESS_FILE_NEW LIB_MISC"socials.new" /* messages for social acts with aedit patch*/ #define SOCMESS_FILE_NEW LIB_MISC"socials.new" /* messages for social acts with aedit patch*/
@ -243,6 +243,11 @@ char *fread_action(FILE *fl, int nr);
int create_entry(char *name); int create_entry(char *name);
void zone_update(void); void zone_update(void);
char *fread_string(FILE *fl, const char *error); char *fread_string(FILE *fl, const char *error);
int fread_number(FILE *fp);
char *fread_line(FILE *fp);
int fread_flags(FILE *fp, int *fg, int fg_size);
char *fread_word(FILE *fp);
void fread_to_eol(FILE *fp);
long get_id_by_name(const char *name); long get_id_by_name(const char *name);
char *get_name_by_id(long id); char *get_name_by_id(long id);
void save_mud_time(struct time_info_data *when); void save_mud_time(struct time_info_data *when);

View file

@ -37,6 +37,7 @@
#include "quest.h" #include "quest.h"
#include "asciimap.h" #include "asciimap.h"
#include "prefedit.h" #include "prefedit.h"
#include "ibt.h"
/* local (file scope) functions */ /* local (file scope) functions */
static int perform_dupe_check(struct descriptor_data *d); static int perform_dupe_check(struct descriptor_data *d);
@ -99,7 +100,7 @@ cpp_extern const struct command_info cmd_info[] = {
{ "brief" , "br" , POS_DEAD , do_gen_tog , 0, SCMD_BRIEF }, { "brief" , "br" , POS_DEAD , do_gen_tog , 0, SCMD_BRIEF },
{ "buildwalk", "buildwalk", POS_STANDING, do_gen_tog , LVL_BUILDER, SCMD_BUILDWALK }, { "buildwalk", "buildwalk", POS_STANDING, do_gen_tog , LVL_BUILDER, SCMD_BUILDWALK },
{ "buy" , "bu" , POS_STANDING, do_not_here , 0, 0 }, { "buy" , "bu" , POS_STANDING, do_not_here , 0, 0 },
{ "bug" , "bug" , POS_DEAD , do_gen_write, 0, SCMD_BUG }, { "bug" , "bug" , POS_DEAD , do_ibt , 0, SCMD_BUG },
{ "cast" , "c" , POS_SITTING , do_cast , 1, 0 }, { "cast" , "c" , POS_SITTING , do_cast , 1, 0 },
{ "cedit" , "cedit" , POS_DEAD , do_oasis_cedit, LVL_IMPL, 0 }, { "cedit" , "cedit" , POS_DEAD , do_oasis_cedit, LVL_IMPL, 0 },
@ -171,7 +172,7 @@ cpp_extern const struct command_info cmd_info[] = {
{ "house" , "house" , POS_RESTING , do_house , 0, 0 }, { "house" , "house" , POS_RESTING , do_house , 0, 0 },
{ "inventory", "i" , POS_DEAD , do_inventory, 0, 0 }, { "inventory", "i" , POS_DEAD , do_inventory, 0, 0 },
{ "idea" , "id" , POS_DEAD , do_gen_write, 0, SCMD_IDEA }, { "idea" , "id" , POS_DEAD , do_ibt , 0, SCMD_IDEA },
{ "imotd" , "imo" , POS_DEAD , do_gen_ps , LVL_IMMORT, SCMD_IMOTD }, { "imotd" , "imo" , POS_DEAD , do_gen_ps , LVL_IMMORT, SCMD_IMOTD },
{ "immlist" , "imm" , POS_DEAD , do_gen_ps , 0, SCMD_IMMLIST }, { "immlist" , "imm" , POS_DEAD , do_gen_ps , 0, SCMD_IMMLIST },
{ "info" , "info" , POS_SLEEPING, do_gen_ps , 0, SCMD_INFO }, { "info" , "info" , POS_SLEEPING, do_gen_ps , 0, SCMD_INFO },
@ -300,7 +301,7 @@ cpp_extern const struct command_info cmd_info[] = {
{ "track" , "track" , POS_STANDING, do_track , 0, 0 }, { "track" , "track" , POS_STANDING, do_track , 0, 0 },
{ "transfer" , "transfer", POS_SLEEPING, do_trans , LVL_GOD, 0 }, { "transfer" , "transfer", POS_SLEEPING, do_trans , LVL_GOD, 0 },
{ "trigedit" , "trigedit", POS_DEAD , do_oasis_trigedit, LVL_BUILDER, 0 }, { "trigedit" , "trigedit", POS_DEAD , do_oasis_trigedit, LVL_BUILDER, 0 },
{ "typo" , "typo" , POS_DEAD , do_gen_write, 0, SCMD_TYPO }, { "typo" , "typo" , POS_DEAD , do_ibt , 0, SCMD_TYPO },
{ "tlist" , "tlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_TLIST }, { "tlist" , "tlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_TLIST },
{ "tcopy" , "tcopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_TRIGEDIT }, { "tcopy" , "tcopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_TRIGEDIT },
{ "tstat" , "tstat" , POS_DEAD , do_tstat , LVL_BUILDER, 0 }, { "tstat" , "tstat" , POS_DEAD , do_tstat , LVL_BUILDER, 0 },
@ -1222,6 +1223,7 @@ void nanny(struct descriptor_data *d, char *arg)
{ CON_HEDIT, hedit_parse }, { CON_HEDIT, hedit_parse },
{ CON_QEDIT, qedit_parse }, { CON_QEDIT, qedit_parse },
{ CON_PREFEDIT, prefedit_parse }, { CON_PREFEDIT, prefedit_parse },
{ CON_IBTEDIT, ibtedit_parse },
{ -1, NULL } { -1, NULL }
}; };

View file

@ -24,6 +24,7 @@
#include "dg_scripts.h" /* for trigedit_string_cleanup */ #include "dg_scripts.h" /* for trigedit_string_cleanup */
#include "modify.h" #include "modify.h"
#include "quest.h" #include "quest.h"
#include "ibt.h"
/* local (file scope) function prototpyes */ /* local (file scope) function prototpyes */
static char *next_page(char *str, struct char_data *ch); static char *next_page(char *str, struct char_data *ch);
@ -32,7 +33,7 @@ static void playing_string_cleanup(struct descriptor_data *d, int action);
static void exdesc_string_cleanup(struct descriptor_data *d, int action); static void exdesc_string_cleanup(struct descriptor_data *d, int action);
/* Local (file scope) global variables */ /* Local (file scope) global variables */
/* @deprecated string_fields appears to be no longer be used. /* @deprecated string_fields appears to be no longer be used.
* Left in but commented out. * Left in but commented out.
static const char *string_fields[] = static const char *string_fields[] =
{ {
@ -59,13 +60,13 @@ static int length[] =
*/ */
/* modification of malloc'ed strings */ /* modification of malloc'ed strings */
/* Put '#if 1' here to erase ~, or roll your own method. A common idea is /* Put '#if 1' here to erase ~, or roll your own method. A common idea is
* smash/show tilde to convert the tilde to another innocuous character to * smash/show tilde to convert the tilde to another innocuous character to
* save and then back to display it. Whatever you do, at least keep the * save and then back to display it. Whatever you do, at least keep the
* function around because other MUD packages use it, like mudFTP. -gg */ * function around because other MUD packages use it, like mudFTP. -gg */
void smash_tilde(char *str) void smash_tilde(char *str)
{ {
/* Erase any _line ending_ tildes inserted in the editor. The load mechanism /* Erase any _line ending_ tildes inserted in the editor. The load mechanism
* can't handle those, yet. - Welcor */ * can't handle those, yet. - Welcor */
char *p = str; char *p = str;
for (; *p; p++) for (; *p; p++)
@ -73,9 +74,9 @@ void smash_tilde(char *str)
*p=' '; *p=' ';
} }
/* Basic API function to start writing somewhere. 'data' isn't used, but you /* Basic API function to start writing somewhere. 'data' isn't used, but you
* can use it to pass whatever else you may want through it. The improved * can use it to pass whatever else you may want through it. The improved
* editor patch when updated could use it to pass the old text buffer, for * editor patch when updated could use it to pass the old text buffer, for
* instance. */ * instance. */
void string_write(struct descriptor_data *d, char **writeto, size_t len, long mailto, void *data) void string_write(struct descriptor_data *d, char **writeto, size_t len, long mailto, void *data)
{ {
@ -98,13 +99,13 @@ void string_add(struct descriptor_data *d, char *str)
{ {
int action; int action;
/* Determine if this is the terminal string, and truncate if so. Changed to /* Determine if this is the terminal string, and truncate if so. Changed to
* only accept '@' at the beginning of line. - JE */ * only accept '@' at the beginning of line. - JE */
delete_doubledollar(str); delete_doubledollar(str);
smash_tilde(str); smash_tilde(str);
/* Determine if this is the terminal string, and truncate if so. Changed to /* Determine if this is the terminal string, and truncate if so. Changed to
* only accept '@' if it's by itself. - fnord */ * only accept '@' if it's by itself. - fnord */
if ((action = (*str == '@' && !str[1]))) if ((action = (*str == '@' && !str[1])))
*str = '\0'; *str = '\0';
@ -152,6 +153,7 @@ void string_add(struct descriptor_data *d, char *str)
case CON_TRIGEDIT: case CON_TRIGEDIT:
case CON_HEDIT: case CON_HEDIT:
case CON_QEDIT: case CON_QEDIT:
case CON_IBTEDIT:
free(*d->str); free(*d->str);
*d->str = d->backstr; *d->str = d->backstr;
d->backstr = NULL; d->backstr = NULL;
@ -192,6 +194,7 @@ void string_add(struct descriptor_data *d, char *str)
{ CON_PLAYING, playing_string_cleanup }, { CON_PLAYING, playing_string_cleanup },
{ CON_HEDIT, hedit_string_cleanup }, { CON_HEDIT, hedit_string_cleanup },
{ CON_QEDIT , qedit_string_cleanup }, { CON_QEDIT , qedit_string_cleanup },
{ CON_IBTEDIT, ibtedit_string_cleanup },
{ -1, NULL } { -1, NULL }
}; };
@ -217,14 +220,14 @@ static void playing_string_cleanup(struct descriptor_data *d, int action)
if (action == STRINGADD_SAVE && *d->str) { if (action == STRINGADD_SAVE && *d->str) {
store_mail(d->mail_to, GET_IDNUM(d->character), *d->str); store_mail(d->mail_to, GET_IDNUM(d->character), *d->str);
write_to_output(d, "Message sent!\r\n"); write_to_output(d, "Message sent!\r\n");
notify_if_playing(d->character, d->mail_to); notify_if_playing(d->character, d->mail_to);
} else } else
write_to_output(d, "Mail aborted.\r\n"); write_to_output(d, "Mail aborted.\r\n");
free(*d->str); free(*d->str);
free(d->str); free(d->str);
} }
/* We have no way of knowing which slot the post was sent to so we can only /* We have no way of knowing which slot the post was sent to so we can only
* give the message. */ * give the message. */
if (d->mail_to >= BOARD_MAGIC) { if (d->mail_to >= BOARD_MAGIC) {
board_save_board(d->mail_to - BOARD_MAGIC); board_save_board(d->mail_to - BOARD_MAGIC);
@ -325,7 +328,7 @@ ACMD(do_skillset)
send_to_char(ch, "You change %s's %s to %d.\r\n", GET_NAME(vict), spell_info[skill].name, value); send_to_char(ch, "You change %s's %s to %d.\r\n", GET_NAME(vict), spell_info[skill].name, value);
} }
/* By Michael Buselli. Traverse down the string until the begining of the next /* By Michael Buselli. Traverse down the string until the begining of the next
* page has been reached. Return NULL if this is the last page of the string. */ * page has been reached. Return NULL if this is the last page of the string. */
static char *next_page(char *str, struct char_data *ch) static char *next_page(char *str, struct char_data *ch)
{ {
@ -358,7 +361,7 @@ static char *next_page(char *str, struct char_data *ch)
else if (*str == '\n') else if (*str == '\n')
line++; line++;
/* We need to check here and see if we are over the page width, and if /* We need to check here and see if we are over the page width, and if
* so, compensate by going to the begining of the next line. */ * so, compensate by going to the begining of the next line. */
else if (col++ > PAGE_WIDTH) { else if (col++ > PAGE_WIDTH) {
col = 1; col = 1;
@ -454,7 +457,7 @@ void show_string(struct descriptor_data *d, char *input)
return; return;
} }
/* If we're displaying the last page, just send it to the character, and /* If we're displaying the last page, just send it to the character, and
* then free up the space we used. Also send a @n - to make color stop * then free up the space we used. Also send a @n - to make color stop
* bleeding. - Welcor */ * bleeding. - Welcor */
if (d->showstr_page + 1 >= d->showstr_count) { if (d->showstr_page + 1 >= d->showstr_count) {
send_to_char(d->character, "%s@n", d->showstr_vector[d->showstr_page]); send_to_char(d->character, "%s@n", d->showstr_vector[d->showstr_page]);

View file

@ -96,6 +96,7 @@ struct oasis_olc_data {
struct social_messg *action; /* Aedit uses this one */ struct social_messg *action; /* Aedit uses this one */
struct trig_data *trig; struct trig_data *trig;
struct prefs_data *prefs; /* used for 'prefedit' */ struct prefs_data *prefs; /* used for 'prefedit' */
struct ibt_data *ibt; /* used for 'ibtedit' */
int script_mode; int script_mode;
int trigger_position; int trigger_position;
int item_type; int item_type;
@ -127,6 +128,7 @@ extern const char *nrm, *grn, *cyn, *yel;
#define OLC_ACTION(d) (OLC(d)->action) /**< Action structure */ #define OLC_ACTION(d) (OLC(d)->action) /**< Action structure */
#define OLC_HELP(d) (OLC(d)->help) /**< Hedit structure */ #define OLC_HELP(d) (OLC(d)->help) /**< Hedit structure */
#define OLC_PREFS(d) (OLC(d)->prefs) /**< Preferences structure */ #define OLC_PREFS(d) (OLC(d)->prefs) /**< Preferences structure */
#define OLC_IBT(d) (OLC(d)->ibt) /**< IBT (idea/bug/typo) structure */
/* Other macros. */ /* Other macros. */
#define OLC_EXIT(d) (OLC_ROOM(d)->dir_option[OLC_VAL(d)]) #define OLC_EXIT(d) (OLC_ROOM(d)->dir_option[OLC_VAL(d)])

View file

@ -193,6 +193,9 @@
#define PLR_INVSTART 14 /**< Player should enter game wizinvis */ #define PLR_INVSTART 14 /**< Player should enter game wizinvis */
#define PLR_CRYO 15 /**< Player is cryo-saved (purge prog) */ #define PLR_CRYO 15 /**< Player is cryo-saved (purge prog) */
#define PLR_NOTDEADYET 16 /**< (R) Player being extracted */ #define PLR_NOTDEADYET 16 /**< (R) Player being extracted */
#define PLR_BUG 17 /**< Player is writing a bug */
#define PLR_IDEA 18 /**< Player is writing an idea */
#define PLR_TYPO 19 /**< Player is writing a typo */
/* Mobile flags: used by char_data.char_specials.act */ /* Mobile flags: used by char_data.char_specials.act */
#define MOB_SPEC 0 /**< Mob has a callable spec-proc */ #define MOB_SPEC 0 /**< Mob has a callable spec-proc */
@ -314,6 +317,7 @@
#define CON_HEDIT 27 /**< OLC mode - help edit */ #define CON_HEDIT 27 /**< OLC mode - help edit */
#define CON_QEDIT 28 /**< OLC mode - quest edit */ #define CON_QEDIT 28 /**< OLC mode - quest edit */
#define CON_PREFEDIT 29 /**< OLC mode - preference edit */ #define CON_PREFEDIT 29 /**< OLC mode - preference edit */
#define CON_IBTEDIT 30 /**< OLC mode - idea/bug/typo edit */
/* OLC States range - used by IS_IN_OLC and IS_PLAYING */ /* OLC States range - used by IS_IN_OLC and IS_PLAYING */
#define FIRST_OLC_STATE CON_OEDIT /**< The first CON_ state that is an OLC */ #define FIRST_OLC_STATE CON_OEDIT /**< The first CON_ state that is an OLC */

View file

@ -17,8 +17,8 @@
#include "improved-edit.h" #include "improved-edit.h"
#include "modify.h" #include "modify.h"
extern time_t motdmod; extern time_t motdmod;
extern time_t newsmod; extern time_t newsmod;
void tedit_string_cleanup(struct descriptor_data *d, int terminator) void tedit_string_cleanup(struct descriptor_data *d, int terminator)
{ {
@ -40,10 +40,10 @@ void tedit_string_cleanup(struct descriptor_data *d, int terminator)
fclose(fl); fclose(fl);
mudlog(CMP, LVL_GOD, TRUE, "OLC: %s saves '%s'.", GET_NAME(d->character), storage); mudlog(CMP, LVL_GOD, TRUE, "OLC: %s saves '%s'.", GET_NAME(d->character), storage);
write_to_output(d, "Saved.\r\n"); write_to_output(d, "Saved.\r\n");
if (!strcmp(storage, NEWS_FILE)) if (!strcmp(storage, NEWS_FILE))
newsmod = time(0); newsmod = time(0);
if (!strcmp(storage, MOTD_FILE)) if (!strcmp(storage, MOTD_FILE))
motdmod = time(0); motdmod = time(0);
} }
break; break;
case STRINGADD_ABORT: case STRINGADD_ABORT:
@ -87,9 +87,6 @@ ACMD(do_tedit)
{ "policies", LVL_IMPL, &policies, 8192, POLICIES_FILE}, { "policies", LVL_IMPL, &policies, 8192, POLICIES_FILE},
{ "wizlist", LVL_IMPL, &wizlist, 2400, WIZLIST_FILE}, { "wizlist", LVL_IMPL, &wizlist, 2400, WIZLIST_FILE},
{ "immlist", LVL_GRGOD, &immlist, 2400, IMMLIST_FILE}, { "immlist", LVL_GRGOD, &immlist, 2400, IMMLIST_FILE},
{ "bugs", LVL_GRGOD, &bugs, 8192, BUG_FILE},
{ "typos", LVL_GRGOD, &typos, 8192, TYPO_FILE},
{ "ideas", LVL_GRGOD, &ideas, 8192, IDEA_FILE},
{ "\n", 0, NULL, 0, NULL } { "\n", 0, NULL, 0, NULL }
}; };

View file

@ -245,6 +245,73 @@ void char_from_furniture(struct char_data *ch);
temp->next = (item)->next; \ temp->next = (item)->next; \
} \ } \
/* Connect 'link' to the end of a double-linked list
* The new item becomes the last in the linked list, and the last
* pointer is updated.
* @param link Pointer to item to remove from the list.
* @param first Pointer to the first item of the linked list.
* @param last Pointer to the last item of the linked list.
* @param next The variable name pointing to the next in the list.
* @param prev The variable name pointing to the previous in the list.
* */
#define LINK(link, first, last, next, prev) \
do \
{ \
if ( !(first) ) \
(first) = (link); \
else \
(last)->next = (link); \
(link)->next = NULL; \
(link)->prev = (last); \
(last) = (link); \
} while(0)
/* Remove 'link' from a double-linked list
* @post item is removed from the list, but remains in memory, and must
be free'd after unlinking.
* @param link Pointer to item to remove from the list.
* @param first Pointer to the first item of the linked list.
* @param last Pointer to the last item of the linked list.
* @param next The variable name pointing to the next in the list.
* @param prev The variable name pointing to the previous in the list.
* */
#define UNLINK(link, first, last, next, prev) \
do \
{ \
if ( !(link)->prev ) \
(first) = (link)->next; \
else \
(link)->prev->next = (link)->next; \
if ( !(link)->next ) \
(last) = (link)->prev; \
else \
(link)->next->prev = (link)->prev; \
} while(0)
/* Free a pointer, and log if it was NULL
* @param point The pointer to be free'd.
* */
#define DISPOSE(point) \
do \
{ \
if (!(point)) \
{ \
log( "SYSERR: Freeing null pointer %s:%d", __FILE__, __LINE__ ); \
} \
else free(point); \
point = NULL; \
} while(0)
/* String Utils */
/* Allocate memory for a string, and return a pointer
* @param point The string to be copied.
* */
#define STRALLOC(point) (strdup(point))
/* Free allocated memory for a string
* @param point The string to be free'd.
* */
#define STRFREE(point) DISPOSE(point)
/* basic bitvector utils */ /* basic bitvector utils */
/** Return the bitarray field number x is in. */ /** Return the bitarray field number x is in. */
#define Q_FIELD(x) ((int) (x) / 32) #define Q_FIELD(x) ((int) (x) / 32)
@ -674,6 +741,8 @@ void char_from_furniture(struct char_data *ch);
#define ANA(obj) (strchr("aeiouAEIOU", *(obj)->name) ? "An" : "A") #define ANA(obj) (strchr("aeiouAEIOU", *(obj)->name) ? "An" : "A")
/** "an" or "a" for object (lowercased) */ /** "an" or "a" for object (lowercased) */
#define SANA(obj) (strchr("aeiouAEIOU", *(obj)->name) ? "an" : "a") #define SANA(obj) (strchr("aeiouAEIOU", *(obj)->name) ? "an" : "a")
/** "an" or "a" for text (lowercased) */
#define TANA(obj) (strchr("aeiouAEIOU", *(obj)) ? "an" : "a")
/* Various macros building up to CAN_SEE */ /* Various macros building up to CAN_SEE */