Removal of outdated char_file_u warnings.

Adding of the appropropriate structs to the plrtoascii utility.
Incoorporation of changes from old circlemud CVS snapshot
this also gives more info on SYSERRors.
cleanup of zmalloc language (shit->tmp)
PRF_ROOMFLAGS has been renamed to PRF_SHOWVNUMS for clarity.
"Deaf" has been changed to "No_shout" in preference_bits, for clarity.
Addition of hindex (help index) command.
who command added argument -g and -l to check who are grouped (and 
leaders)
toggle has been expanded, and the commands nohassle, holylight, 
color, buildwalk, syslog and roomflags were moved to toggles.
renaming of some vars in dg files (xxx -> dg_xxx) for clarity.


set <player> password can now be used by other people than the first
 implementor - id check removed.


fix of a couple of minor bugs:
- crash bug related to freeing a pointer twice - ascii pfiles bug.
- host was not updated correctly after switch to ascii pfiles.

Todo: 
make "who #-#", "who #-" and "who -#" all work as "who -l #-#" did before 
Remove redundant commands which are now toggles.
Make script variables save to pfile instead of its own file.
This commit is contained in:
Rumble 2006-12-27 21:16:28 +00:00
parent 9607be0112
commit 047c5d0de3
45 changed files with 765 additions and 474 deletions

View file

@ -103,6 +103,12 @@ void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode)
{ {
if (!obj || !ch) { if (!obj || !ch) {
log("SYSERR: NULL pointer in show_obj_to_char(): obj=%p ch=%p", obj, ch); log("SYSERR: NULL pointer in show_obj_to_char(): obj=%p ch=%p", obj, ch);
/* SYSERR_DESC:
* Somehow a NULL pointer was sent to show_obj_to_char() in either the
* 'obj' or the 'ch' variable. The error will indicate which was NULL
* by listing both of the pointers passed to it. This is often a
* difficult one to trace, and may require stepping through a debugger.
*/
return; return;
} }
@ -112,7 +118,7 @@ void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode)
if (*obj->description == '.' && (IS_NPC(ch) || !PRF_FLAGGED(ch, PRF_HOLYLIGHT))) if (*obj->description == '.' && (IS_NPC(ch) || !PRF_FLAGGED(ch, PRF_HOLYLIGHT)))
return; return;
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_ROOMFLAGS)) if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS))
send_to_char(ch, "[%d] %s", GET_OBJ_VNUM(obj), SCRIPT(obj) ? "[TRIG] " : ""); send_to_char(ch, "[%d] %s", GET_OBJ_VNUM(obj), SCRIPT(obj) ? "[TRIG] " : "");
send_to_char(ch, "%s", CCGRN(ch, C_NRM)); send_to_char(ch, "%s", CCGRN(ch, C_NRM));
@ -120,7 +126,7 @@ void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode)
break; break;
case SHOW_OBJ_SHORT: case SHOW_OBJ_SHORT:
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_ROOMFLAGS)) if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS))
send_to_char(ch, "[%d] %s", GET_OBJ_VNUM(obj), SCRIPT(obj) ? "[TRIG] " : ""); send_to_char(ch, "[%d] %s", GET_OBJ_VNUM(obj), SCRIPT(obj) ? "[TRIG] " : "");
send_to_char(ch, "%s", obj->short_description); send_to_char(ch, "%s", obj->short_description);
@ -150,6 +156,13 @@ void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode)
default: default:
log("SYSERR: Bad display mode (%d) in show_obj_to_char().", mode); log("SYSERR: Bad display mode (%d) in show_obj_to_char().", mode);
/* SYSERR_DESC:
* show_obj_to_char() has some predefined 'mode's (argument #3) to tell
* it what to display to the character when it is called. If the mode
* is not one of these, it will output this error, and indicate what
* mode was passed to it. To correct it, you will need to find the
* call with the incorrect mode and change it to an acceptable mode.
*/
return; return;
} }
@ -296,7 +309,7 @@ void list_one_char(struct char_data *i, struct char_data *ch)
" is standing here." " is standing here."
}; };
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_ROOMFLAGS) && IS_NPC(i)) if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS) && IS_NPC(i))
send_to_char(ch, "[%d] %s", GET_MOB_VNUM(i), SCRIPT(i) ? "[TRIG] " : ""); send_to_char(ch, "[%d] %s", GET_MOB_VNUM(i), SCRIPT(i) ? "[TRIG] " : "");
if (IS_NPC(i) && i->player.long_descr && GET_POS(i) == GET_DEFAULT_POS(i)) { if (IS_NPC(i) && i->player.long_descr && GET_POS(i) == GET_DEFAULT_POS(i)) {
@ -453,7 +466,7 @@ void look_at_room(struct char_data *ch, int ignore_brief)
return; return;
} }
send_to_char(ch, "%s", CCCYN(ch, C_NRM)); send_to_char(ch, "%s", CCCYN(ch, C_NRM));
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_ROOMFLAGS)) { if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS)) {
char buf[MAX_STRING_LENGTH]; char buf[MAX_STRING_LENGTH];
sprintbit(ROOM_FLAGS(IN_ROOM(ch)), room_bits, buf, sizeof(buf)); sprintbit(ROOM_FLAGS(IN_ROOM(ch)), room_bits, buf, sizeof(buf));
@ -979,27 +992,33 @@ void space_to_minus(char *str)
*str = '-'; *str = '-';
} }
int search_help(char *argument)
int search_help(struct char_data *ch, char *argument)
{ {
int chk, bot, top, mid, minlen; int chk, bot, top, mid, minlen;
bot = 0; bot = 0;
top = top_of_h_table; top = top_of_h_table;
minlen = strlen(argument); minlen = strlen(argument);
for (;;) { for (;;) {
mid = (bot + top) / 2; mid = (bot + top) / 2;
if (bot > top) if (bot > top)
return FALSE; return FALSE;
else if (!(chk = strn_cmp(argument, help_table[mid].keywords, minlen))) { else if (!(chk = strn_cmp(argument, help_table[mid].keywords, minlen))) {
/* trace backwards to find first matching entry. Thanks Jeff Fink! */ /* trace backwards to find first matching entry. Thanks Jeff Fink! */
while ((mid > 0) && while ((mid > 0) && (!(chk = strn_cmp(argument, help_table[mid - 1].keywords, minlen))))
(!(chk = strn_cmp(argument, help_table[mid - 1].keywords, minlen)))) mid--;
mid--; if (help_table[mid].min_level > GET_LEVEL(ch))
return mid; /* trace back up... */
while ((mid < top_of_h_table) &&
(!(chk = strn_cmp(argument, help_table[mid + 1].keywords, minlen)))) {
mid++;
if (help_table[mid].min_level < GET_LEVEL(ch))
return mid;
}
return mid;
} else { } else {
if (chk > 0) if (chk > 0)
bot = mid + 1; bot = mid + 1;
else else
top = mid - 1; top = mid - 1;
} }
@ -1029,9 +1048,9 @@ ACMD(do_help)
} }
space_to_minus(argument); space_to_minus(argument);
mid = search_help(argument); mid = search_help(ch, argument);
if ((mid <= 0) || (GET_LEVEL(ch) < help_table[mid].min_level)) { if (mid <= 0) {
send_to_char(ch, "There is no help on that word.\r\n"); send_to_char(ch, "There is no help on that word.\r\n");
mudlog(NRM, MAX(LVL_IMPL, GET_INVIS_LEV(ch)), TRUE, mudlog(NRM, MAX(LVL_IMPL, GET_INVIS_LEV(ch)), TRUE,
"%s tried to get help on %s", GET_NAME(ch), argument); "%s tried to get help on %s", GET_NAME(ch), argument);
@ -1058,8 +1077,9 @@ ACMD(do_help)
#define WHO_FORMAT \ #define WHO_FORMAT \
"Usage: who [minlev[-maxlev]] [-n name] [-c classlist] [-s] [-k] [-q] [-r] [-z]\r\n" "Usage: who [minlev[-maxlev]] [-n name] [-c classlist] [-k] [-l] [-n] [-q] [-r] [-s] [-z]\r\n"
/* Written by Rhade */
ACMD(do_who) ACMD(do_who)
{ {
struct descriptor_data *d; struct descriptor_data *d;
@ -1069,7 +1089,7 @@ ACMD(do_who)
char mode; char mode;
int low = 0, high = LVL_IMPL, localwho = 0, questwho = 0; int low = 0, high = LVL_IMPL, localwho = 0, questwho = 0;
int showclass = 0, short_list = 0, outlaws = 0; int showclass = 0, short_list = 0, outlaws = 0;
int who_room = 0; int who_room = 0, showgroup = 0, showleader = 0;
skip_spaces(&argument); skip_spaces(&argument);
strcpy(buf, argument); /* strcpy: OK (sizeof: argument == buf) */ strcpy(buf, argument); /* strcpy: OK (sizeof: argument == buf) */
@ -1101,10 +1121,6 @@ ACMD(do_who)
questwho = 1; questwho = 1;
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
break; break;
case 'l':
half_chop(buf1, arg, buf);
sscanf(arg, "%d-%d", &low, &high);
break;
case 'n': case 'n':
half_chop(buf1, name_search, buf); half_chop(buf1, name_search, buf);
break; break;
@ -1116,6 +1132,14 @@ ACMD(do_who)
half_chop(buf1, arg, buf); half_chop(buf1, arg, buf);
showclass = find_class_bitvector(arg); showclass = find_class_bitvector(arg);
break; break;
case 'l':
showleader = 1;
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
break;
case 'g':
showgroup = 1;
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
break;
default: default:
send_to_char(ch, "%s", WHO_FORMAT); send_to_char(ch, "%s", WHO_FORMAT);
return; return;
@ -1159,6 +1183,10 @@ ACMD(do_who)
continue; continue;
if (showclass && !(showclass & (1 << GET_CLASS(tch)))) if (showclass && !(showclass & (1 << GET_CLASS(tch))))
continue; continue;
if (showgroup && (!tch->master || !AFF_FLAGGED(tch, AFF_GROUP)))
continue;
if (showleader && (!tch->followers || !AFF_FLAGGED(tch, AFF_GROUP)))
continue;
for (i = 0; *rank[i].disp != '\n'; i++) for (i = 0; *rank[i].disp != '\n'; i++)
if (GET_LEVEL(tch) >= rank[i].min_level && GET_LEVEL(tch) <= rank[i].max_level) if (GET_LEVEL(tch) >= rank[i].min_level && GET_LEVEL(tch) <= rank[i].max_level)
rank[i].count++; rank[i].count++;
@ -1199,6 +1227,10 @@ ACMD(do_who)
continue; continue;
if (showclass && !(showclass & (1 << GET_CLASS(tch)))) if (showclass && !(showclass & (1 << GET_CLASS(tch))))
continue; continue;
if (showgroup && (!tch->master || !AFF_FLAGGED(tch, AFF_GROUP)))
continue;
if (showleader && (!tch->followers || !AFF_FLAGGED(tch, AFF_GROUP)))
continue;
if (short_list) { if (short_list) {
send_to_char(ch, "%s[%2d %s] %-12.12s%s%s", send_to_char(ch, "%s[%2d %s] %-12.12s%s%s",
@ -1478,6 +1510,14 @@ ACMD(do_gen_ps)
break; break;
default: default:
log("SYSERR: Unhandled case in do_gen_ps. (%d)", subcmd); log("SYSERR: Unhandled case in do_gen_ps. (%d)", subcmd);
/* SYSERR_DESC:
* General page string function for such things as 'credits', 'news',
* 'wizlist', 'clear', 'version'. This occurs when a call is made to
* this routine that is not one of the predefined calls. To correct
* it, either a case needs to be added into the function to account for
* the subcmd that is being passed to it, or the call to the function
* needs to have the correct subcmd put into place.
*/
return; return;
} }
} }
@ -1741,81 +1781,238 @@ ACMD(do_color)
ACMD(do_toggle) ACMD(do_toggle)
{ {
char buf2[4]; char buf2[4], arg[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
int toggle, result = 0;
if (IS_NPC(ch)) if (IS_NPC(ch))
return; return;
if (GET_WIMP_LEV(ch) == 0) argument = one_argument(argument, arg);
strcpy(buf2, "OFF"); /* strcpy: OK */ any_one_arg(argument, arg2); /* so that we don't skip 'on' */
else
sprintf(buf2, "%-3.3d", GET_WIMP_LEV(ch)); /* sprintf: OK */ if (!*arg) {
if (!GET_WIMP_LEV(ch))
strcpy(buf2, "OFF"); /* strcpy: OK */
else
sprintf(buf2, "%-3.3d", GET_WIMP_LEV(ch)); /* sprintf: OK */
if (GET_LEVEL(ch) >= LVL_IMMORT) {
send_to_char(ch,
" Buildwalk: %-3s "
" "
" ClsOLC: %-3s\r\n"
" No Hassle: %-3s "
" Holylight: %-3s "
" Show Vnums: %-3s\r\n",
if (GET_LEVEL(ch) >= LVL_IMMORT) {
send_to_char(ch,
" Buildwalk: %-3s "
" ClsOLC: %-3s\r\n",
ONOFF(PRF_FLAGGED(ch, PRF_BUILDWALK)), ONOFF(PRF_FLAGGED(ch, PRF_BUILDWALK)),
ONOFF(PRF_FLAGGED(ch, PRF_CLS)) ONOFF(PRF_FLAGGED(ch, PRF_CLS)),
); ONOFF(PRF_FLAGGED(ch, PRF_NOHASSLE)),
ONOFF(PRF_FLAGGED(ch, PRF_HOLYLIGHT)),
ONOFF(PRF_FLAGGED(ch, PRF_SHOWVNUMS))
send_to_char(ch, );
" No Hassle: %-3s " }
" Holylight: %-3s "
" Room Flags: %-3s\r\n",
ONOFF(PRF_FLAGGED(ch, PRF_NOHASSLE)),
ONOFF(PRF_FLAGGED(ch, PRF_HOLYLIGHT)),
ONOFF(PRF_FLAGGED(ch, PRF_ROOMFLAGS))
);
}
send_to_char(ch, send_to_char(ch,
"Hit Pnt Display: %-3s " "Hit Pnt Display: %-3s "
" Brief Mode: %-3s " " Brief Mode: %-3s "
" Summon Protect: %-3s\r\n" " Summon Protect: %-3s\r\n"
" Move Display: %-3s " " Move Display: %-3s "
" Compact Mode: %-3s " " Compact Mode: %-3s "
" On Quest: %-3s\r\n" " On Quest: %-3s\r\n"
" Mana Display: %-3s " " Mana Display: %-3s "
" NoTell: %-3s " " NoTell: %-3s "
" Repeat Comm.: %-3s\r\n" " Repeat Comm.: %-3s\r\n"
" Auto Show Exit: %-3s " " Auto Show Exit: %-3s "
" NoShout: %-3s " " NoShout: %-3s "
" Wimp Level: %-3s\r\n" " Wimp Level: %-3s\r\n"
" Gossip Channel: %-3s " " Gossip Channel: %-3s "
"Auction Channel: %-3s " "Auction Channel: %-3s "
" Grats Channel: %-3s\r\n" " Grats Channel: %-3s\r\n"
" AFK flag: %-3s " " AFK flag: %-3s "
" Color Level: %s \r\n ", " Color Level: %s \r\n ",
ONOFF(PRF_FLAGGED(ch, PRF_DISPHP)), ONOFF(PRF_FLAGGED(ch, PRF_DISPHP)),
ONOFF(PRF_FLAGGED(ch, PRF_BRIEF)), ONOFF(PRF_FLAGGED(ch, PRF_BRIEF)),
ONOFF(!PRF_FLAGGED(ch, PRF_SUMMONABLE)), ONOFF(!PRF_FLAGGED(ch, PRF_SUMMONABLE)),
ONOFF(PRF_FLAGGED(ch, PRF_DISPMOVE)), ONOFF(PRF_FLAGGED(ch, PRF_DISPMOVE)),
ONOFF(PRF_FLAGGED(ch, PRF_COMPACT)), ONOFF(PRF_FLAGGED(ch, PRF_COMPACT)),
YESNO(PRF_FLAGGED(ch, PRF_QUEST)), YESNO(PRF_FLAGGED(ch, PRF_QUEST)),
ONOFF(PRF_FLAGGED(ch, PRF_DISPMANA)), ONOFF(PRF_FLAGGED(ch, PRF_DISPMANA)),
ONOFF(PRF_FLAGGED(ch, PRF_NOTELL)), ONOFF(PRF_FLAGGED(ch, PRF_NOTELL)),
YESNO(!PRF_FLAGGED(ch, PRF_NOREPEAT)), YESNO(!PRF_FLAGGED(ch, PRF_NOREPEAT)),
ONOFF(PRF_FLAGGED(ch, PRF_AUTOEXIT)), ONOFF(PRF_FLAGGED(ch, PRF_AUTOEXIT)),
YESNO(PRF_FLAGGED(ch, PRF_NOSHOUT)), YESNO(PRF_FLAGGED(ch, PRF_NOSHOUT)),
buf2, buf2,
ONOFF(!PRF_FLAGGED(ch, PRF_NOGOSS)), ONOFF(!PRF_FLAGGED(ch, PRF_NOGOSS)),
ONOFF(!PRF_FLAGGED(ch, PRF_NOAUCT)), ONOFF(!PRF_FLAGGED(ch, PRF_NOAUCT)),
ONOFF(!PRF_FLAGGED(ch, PRF_NOGRATZ)), ONOFF(!PRF_FLAGGED(ch, PRF_NOGRATZ)),
ONOFF(PRF_FLAGGED(ch, PRF_AFK)), ONOFF(PRF_FLAGGED(ch, PRF_AFK)),
ctypes[COLOR_LEV(ch)]); ctypes[COLOR_LEV(ch)]);
return;
}
const struct {
char *command;
bitvector_t toggle; /* this needs changing once hashmaps are implemented */
char min_level;
char *disable_msg;
char *enable_msg;
} tog_messages[] = {
{"summonable", PRF_SUMMONABLE, 0,
"You are now safe from summoning by other players.\r\n",
"You may now be summoned by other players.\r\n"},
{"nohassle", PRF_NOHASSLE, LVL_IMMORT,
"Nohassle disabled.\r\n",
"Nohassle enabled.\r\n"},
{"brief", PRF_BRIEF, 0,
"Brief mode off.\r\n",
"Brief mode on.\r\n"},
{"compact", PRF_COMPACT, 0,
"Compact mode off.\r\n",
"Compact mode on.\r\n"},
{"notell", PRF_NOTELL, 0,
"You can now hear tells.\r\n",
"You are now deaf to tells.\r\n"},
{"noauction", PRF_NOAUCT, 0,
"You can now hear auctions.\r\n",
"You are now deaf to auctions.\r\n"},
{"noshout", PRF_NOSHOUT, 0,
"You can now hear shouts.\r\n",
"You are now deaf to shouts.\r\n"},
{"nogossip", PRF_NOGOSS, 0,
"You can now hear gossip.\r\n",
"You are now deaf to gossip.\r\n"},
{"wiznet", PRF_NOWIZ, 0,
"You can now hear the Wiz-channel.\r\n",
"You are now deaf to the Wiz-channel.\r\n"},
{"noquest", PRF_QUEST, 0,
"You are no longer part of the Quest.\r\n",
"Okay, you are part of the Quest!\r\n"},
{"showvnums", PRF_SHOWVNUMS, LVL_IMMORT,
"You will no longer see the vnums.\r\n",
"You will now see the vnums.\r\n"},
{"norepeat", PRF_NOREPEAT, 0,
"You will now have your communication repeated.\r\n",
"You will no longer have your communication repeated.\r\n"},
{"holylight", PRF_HOLYLIGHT, LVL_IMMORT,
"HolyLight mode off.\r\n",
"HolyLight mode on.\r\n"},
{"slowns", -1, LVL_IMPL,
"Nameserver_is_slow changed to NO; IP addresses will now be resolved.\r\n",
"Nameserver_is_slow changed to YES; sitenames will no longer be resolved.\r\n"},
{"autoexits", PRF_AUTOEXIT, 0,
"Autoexits disabled.\r\n",
"Autoexits enabled.\r\n"},
{"track", -1, LVL_IMPL,
"Will no longer track through doors.\r\n",
"Will now track through doors.\r\n"},
{"clearolc", PRF_CLS, LVL_BUILDER,
"Will no longer clear screen in OLC.\r\n",
"Will now clear screen in OLC.\r\n"},
{"buildwalk", PRF_BUILDWALK, LVL_BUILDER,
"Buildwalk Off.\r\n",
"Buildwalk On.\r\n"},
{"color", -1, 0, "\n", "\n"},
{"syslog", -1, LVL_IMMORT, "\n", "\n"},
{"\n", -1, -1, "\n", "\n"} /* must be last */
};
for (toggle = 0; *tog_messages[toggle].command != '\n'; toggle++)
if (!strcmp(arg, tog_messages[toggle].command))
break;
if (*tog_messages[toggle].command == '\n' || tog_messages[toggle].min_level > GET_LEVEL(ch)) {
send_to_char(ch, "You can't toggle that!\r\n");
return;
}
/* for color and syslog */
int tp;
const char *types[] = { "off", "brief", "normal", "complete", "\n" };
switch (toggle) {
case SCMD_COLOR:
if (!*arg2) {
send_to_char(ch, "Your current color level is %s.\r\n", types[COLOR_LEV(ch)]);
return;
}
if (((tp = search_block(arg2, types, FALSE)) == -1)) {
send_to_char(ch, "Usage: color { Off | Sparse | Normal | Complete }\r\n");
return;
}
REMOVE_BIT(PRF_FLAGS(ch), PRF_COLOR_1 | PRF_COLOR_2);
SET_BIT(PRF_FLAGS(ch), (PRF_COLOR_1 * (tp & 1)) | (PRF_COLOR_2 * (tp & 2) >> 1));
send_to_char(ch, "Your %scolor%s is now %s.\r\n", CCRED(ch, C_SPR), CCNRM(ch, C_OFF), types[tp]);
return;
case SCMD_SYSLOG:
if (!*arg2) {
send_to_char(ch, "Your syslog is currently %s.\r\n",
types[(PRF_FLAGGED(ch, PRF_LOG1) ? 1 : 0) + (PRF_FLAGGED(ch, PRF_LOG2) ? 2 : 0)]);
return;
}
if (((tp = search_block(arg, types, FALSE)) == -1)) {
send_to_char(ch, "Usage: syslog { Off | Brief | Normal | Complete }\r\n");
return;
}
REMOVE_BIT(PRF_FLAGS(ch), PRF_LOG1 | PRF_LOG2);
SET_BIT(PRF_FLAGS(ch), (PRF_LOG1 * (tp & 1)) | (PRF_LOG2 * (tp & 2) >> 1));
send_to_char(ch, "Your syslog is now %s.\r\n", types[tp]);
return;
case SCMD_SLOWNS:
result = (CONFIG_NS_IS_SLOW = !CONFIG_NS_IS_SLOW);
break;
case SCMD_TRACK:
result = (CONFIG_TRACK_T_DOORS = !CONFIG_TRACK_T_DOORS);
break;
case SCMD_BUILDWALK:
if (GET_LEVEL(ch) < LVL_BUILDER) {
send_to_char(ch, "Builders only, sorry.\r\n");
return;
}
result = PRF_TOG_CHK(ch, PRF_BUILDWALK);
if (PRF_FLAGGED(ch, PRF_BUILDWALK))
mudlog(CMP, GET_LEVEL(ch), TRUE,
"OLC: %s turned buildwalk on. Allowed zone %d", GET_NAME(ch), GET_OLC_ZONE(ch));
else
mudlog(CMP, GET_LEVEL(ch), TRUE,
"OLC: %s turned buildwalk off. Allowed zone %d", GET_NAME(ch), GET_OLC_ZONE(ch));
break;
case SCMD_AFK:
if ((result = PRF_TOG_CHK(ch, PRF_AFK)))
act("$n is now away from $s keyboard.", TRUE, ch, 0, 0, TO_ROOM);
else
act("$n has return to $s keyboard.", TRUE, ch, 0, 0, TO_ROOM);
break;
default:
if (!*arg2) {
send_to_char(ch, "Value must either be 'on' or 'off'.\r\n");
return;
} else if (!strcmp(arg2, "on")) {
SET_BIT(PRF_FLAGS(ch), tog_messages[toggle].toggle);
result = 1;
} else if (!strcmp(arg2, "off")) {
REMOVE_BIT(PRF_FLAGS(ch), tog_messages[toggle].toggle);
} else {
send_to_char(ch, "Value must either be 'on' or 'off'.\r\n");
return;
}
}
if (result)
send_to_char(ch, "%s", tog_messages[toggle].enable_msg);
else
send_to_char(ch, "%s", tog_messages[toggle].disable_msg);
} }
int sort_commands_helper(const void *a, const void *b) int sort_commands_helper(const void *a, const void *b)

View file

@ -492,6 +492,10 @@ int perform_drop(struct char_data *ch, struct obj_data *obj,
return (value); return (value);
default: default:
log("SYSERR: Incorrect argument %d passed to perform_drop.", mode); log("SYSERR: Incorrect argument %d passed to perform_drop.", mode);
/* SYSERR_DESC:
* This error comes from perform_drop() and is output when perform_drop()
* is called with an illegal 'mode' argument.
*/
break; break;
} }
@ -770,6 +774,10 @@ void weight_change_object(struct obj_data *obj, int weight)
obj_to_obj(obj, tmp_obj); obj_to_obj(obj, tmp_obj);
} else { } else {
log("SYSERR: Unknown attempt to subtract weight from an object."); log("SYSERR: Unknown attempt to subtract weight from an object.");
/* SYSERR_DESC:
* weight_change_object() outputs this error when weight is attempted to
* be removed from an object that is not carried or in another object.
*/
} }
} }
@ -787,6 +795,11 @@ void name_from_drinkcon(struct obj_data *obj)
liqname = drinknames[GET_OBJ_VAL(obj, 2)]; liqname = drinknames[GET_OBJ_VAL(obj, 2)];
if (!isname(liqname, obj->name)) { if (!isname(liqname, obj->name)) {
log("SYSERR: Can't remove liquid '%s' from '%s' (%d) item.", liqname, obj->name, obj->item_number); log("SYSERR: Can't remove liquid '%s' from '%s' (%d) item.", liqname, obj->name, obj->item_number);
/* SYSERR_DESC:
* From name_from_drinkcon(), this error comes about if the object
* noted (by keywords and item vnum) does not contain the liquid string
* being searched for.
*/
return; return;
} }
@ -1446,6 +1459,10 @@ void perform_remove(struct char_data *ch, int pos)
if (!(obj = GET_EQ(ch, pos))) if (!(obj = GET_EQ(ch, pos)))
log("SYSERR: perform_remove: bad pos %d passed.", pos); log("SYSERR: perform_remove: bad pos %d passed.", pos);
/* SYSERR_DESC:
* This error occurs when perform_remove() is passed a bad 'pos'
* (location) to remove an object from.
*/
else if (OBJ_FLAGGED(obj, ITEM_NODROP)) else if (OBJ_FLAGGED(obj, ITEM_NODROP))
act("You can't remove $p, it must be CURSED!", FALSE, ch, obj, 0, TO_CHAR); act("You can't remove $p, it must be CURSED!", FALSE, ch, obj, 0, TO_CHAR);
else if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch)) else if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch))

View file

@ -184,7 +184,7 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
look_at_room(ch, 0); look_at_room(ch, 0);
if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_DEATH) && GET_LEVEL(ch) < LVL_IMMORT) { if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_DEATH) && GET_LEVEL(ch) < LVL_IMMORT) {
log_death_trap(ch); mudlog(BRF, LVL_IMMORT, TRUE, "%s hit death trap #%d (%s)", GET_NAME(ch), GET_ROOM_VNUM(IN_ROOM(ch)), world[IN_ROOM(ch)].name);
death_cry(ch); death_cry(ch);
extract_char(ch); extract_char(ch);
return (0); return (0);
@ -647,7 +647,7 @@ ACMD(do_rest)
default: default:
send_to_char(ch, "You stop floating around, and stop to rest your tired bones.\r\n"); send_to_char(ch, "You stop floating around, and stop to rest your tired bones.\r\n");
act("$n stops floating around, and rests.", FALSE, ch, 0, 0, TO_ROOM); act("$n stops floating around, and rests.", FALSE, ch, 0, 0, TO_ROOM);
GET_POS(ch) = POS_SITTING; GET_POS(ch) = POS_RESTING;
break; break;
} }
} }

View file

@ -32,7 +32,6 @@ extern const char *class_abbrevs[];
/* extern procedures */ /* extern procedures */
void list_skills(struct char_data *ch); void list_skills(struct char_data *ch);
void appear(struct char_data *ch); void appear(struct char_data *ch);
void write_aliases(struct char_data *ch);
void perform_immort_vis(struct char_data *ch); void perform_immort_vis(struct char_data *ch);
SPECIAL(shop_keeper); SPECIAL(shop_keeper);
ACMD(do_gen_comm); ACMD(do_gen_comm);
@ -102,24 +101,7 @@ ACMD(do_save)
if (IS_NPC(ch) || !ch->desc) if (IS_NPC(ch) || !ch->desc)
return; return;
/* Only tell the char we're saving if they actually typed "save" */ send_to_char(ch, "Saving %s.\r\n", GET_NAME(ch));
if (cmd) {
/*
* This prevents item duplication by two PC's using coordinated saves
* (or one PC with a house) and system crashes. Note that houses are
* still automatically saved without this enabled. This code assumes
* that guest immortals aren't trustworthy. If you've disabled guest
* immortal advances from mortality, you may want < instead of <=.
*/
if (CONFIG_AUTO_SAVE && GET_LEVEL(ch) <= LVL_IMMORT) {
send_to_char(ch, "Saving aliases.\r\n");
write_aliases(ch);
return;
}
send_to_char(ch, "Saving %s and aliases.\r\n", GET_NAME(ch));
}
write_aliases(ch);
save_char(ch); save_char(ch);
Crash_crashsave(ch); Crash_crashsave(ch);
if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_HOUSE_CRASH)) if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_HOUSE_CRASH))
@ -662,6 +644,10 @@ ACMD(do_use)
return; return;
default: default:
log("SYSERR: Unknown subcmd %d passed to do_use.", subcmd); log("SYSERR: Unknown subcmd %d passed to do_use.", subcmd);
/* SYSERR_DESC:
* This is the same as the unhandled case in do_gen_ps(), but in the
* function which handles 'quaff', 'recite', and 'use'.
*/
return; return;
} }
} }
@ -825,6 +811,11 @@ ACMD(do_gen_write)
if (stat(filename, &fbuf) < 0) { if (stat(filename, &fbuf) < 0) {
perror("SYSERR: Can't stat() file"); 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; return;
} }
if (fbuf.st_size >= CONFIG_MAX_FILESIZE) { if (fbuf.st_size >= CONFIG_MAX_FILESIZE) {
@ -833,6 +824,12 @@ ACMD(do_gen_write)
} }
if (!(fl = fopen(filename, "a"))) { if (!(fl = fopen(filename, "a"))) {
perror("SYSERR: do_gen_write"); 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"); send_to_char(ch, "Could not open the file. Sorry.\r\n");
return; return;
} }
@ -935,7 +932,7 @@ ACMD(do_gen_tog)
result = PRF_TOG_CHK(ch, PRF_QUEST); result = PRF_TOG_CHK(ch, PRF_QUEST);
break; break;
case SCMD_ROOMFLAGS: case SCMD_ROOMFLAGS:
result = PRF_TOG_CHK(ch, PRF_ROOMFLAGS); result = PRF_TOG_CHK(ch, PRF_SHOWVNUMS);
break; break;
case SCMD_NOREPEAT: case SCMD_NOREPEAT:
result = PRF_TOG_CHK(ch, PRF_NOREPEAT); result = PRF_TOG_CHK(ch, PRF_NOREPEAT);
@ -977,6 +974,10 @@ ACMD(do_gen_tog)
break; break;
default: default:
log("SYSERR: Unknown subcmd %d in do_gen_toggle.", subcmd); log("SYSERR: Unknown subcmd %d in do_gen_toggle.", subcmd);
/* SYSERR_DESC:
* This is the same as the unhandled case in do_gen_ps(), but in the
* function which handles 'compact', 'brief', and so forth.
*/
return; return;
} }

View file

@ -21,11 +21,9 @@
#include "spells.h" #include "spells.h"
/* local functions */ /* local functions */
char *fread_action(FILE *fl, int nr);
int find_action(int cmd); int find_action(int cmd);
ACMD(do_action); ACMD(do_action);
ACMD(do_insult); ACMD(do_insult);
void boot_social_messages(void);
void free_social_messages(void); void free_social_messages(void);
void free_action(struct social_messg *mess); void free_action(struct social_messg *mess);
void free_command_list(void); void free_command_list(void);
@ -159,112 +157,6 @@ ACMD(do_insult)
send_to_char(ch, "I'm sure you don't want to insult *everybody*...\r\n"); send_to_char(ch, "I'm sure you don't want to insult *everybody*...\r\n");
} }
void boot_social_messages(void)
{
FILE *fl;
int nr = 0, hide, min_char_pos, min_pos, min_lvl, curr_soc = -1;
char next_soc[MAX_STRING_LENGTH], sorted[MAX_INPUT_LENGTH];
if (CONFIG_NEW_SOCIALS == TRUE) {
/* open social file */
if (!(fl = fopen(SOCMESS_FILE_NEW, "r"))) {
log("SYSERR: can't open socials file '%s': %s", SOCMESS_FILE_NEW, strerror(errno));
exit(1);
}
/* count socials */
*next_soc = '\0';
while (!feof(fl)) {
fgets(next_soc, MAX_STRING_LENGTH, fl);
if (*next_soc == '~') top_of_socialt++;
}
} else { /* old style */
/* open social file */
if (!(fl = fopen(SOCMESS_FILE, "r"))) {
log("SYSERR: can't open socials file '%s': %s", SOCMESS_FILE, strerror(errno));
exit(1);
}
/* count socials */
while (!feof(fl)) {
fgets(next_soc, MAX_STRING_LENGTH, fl);
if (*next_soc == '\n' || *next_soc == '\r') top_of_socialt++; /* all socials are followed by a blank line */
}
}
log("Social table contains %d socials.", top_of_socialt);
rewind(fl);
CREATE(soc_mess_list, struct social_messg, top_of_socialt + 1);
/* now read 'em */
for (;;) {
fscanf(fl, " %s ", next_soc);
if (*next_soc == '$') break;
if (CONFIG_NEW_SOCIALS == TRUE) {
if (fscanf(fl, " %s %d %d %d %d \n",
sorted, &hide, &min_char_pos, &min_pos, &min_lvl) != 5) {
log("SYSERR: format error in social file near social '%s'", next_soc);
exit(1);
}
curr_soc++;
soc_mess_list[curr_soc].command = strdup(next_soc+1);
soc_mess_list[curr_soc].sort_as = strdup(sorted);
soc_mess_list[curr_soc].hide = hide;
soc_mess_list[curr_soc].min_char_position = min_char_pos;
soc_mess_list[curr_soc].min_victim_position = min_pos;
soc_mess_list[curr_soc].min_level_char = min_lvl;
} else { /* old style */
if (fscanf(fl, " %d %d \n", &hide, &min_pos) != 2) {
log("SYSERR: format error in social file near social '%s'", next_soc);
exit(1);
}
curr_soc++;
soc_mess_list[curr_soc].command = strdup(next_soc);
soc_mess_list[curr_soc].sort_as = strdup(next_soc);
soc_mess_list[curr_soc].hide = hide;
soc_mess_list[curr_soc].min_char_position = POS_RESTING;
soc_mess_list[curr_soc].min_victim_position = min_pos;
soc_mess_list[curr_soc].min_level_char = 0;
}
#ifdef CIRCLE_ACORN
if (fgetc(fl) != '\n')
log("SYSERR: Acorn bug workaround failed.");
#endif
soc_mess_list[curr_soc].char_no_arg = fread_action(fl, nr);
soc_mess_list[curr_soc].others_no_arg = fread_action(fl, nr);
soc_mess_list[curr_soc].char_found = fread_action(fl, nr);
/* if no char_found, the rest is to be ignored */
if (CONFIG_NEW_SOCIALS == FALSE && !soc_mess_list[curr_soc].char_found)
continue;
soc_mess_list[curr_soc].others_found = fread_action(fl, nr);
soc_mess_list[curr_soc].vict_found = fread_action(fl, nr);
soc_mess_list[curr_soc].not_found = fread_action(fl, nr);
soc_mess_list[curr_soc].char_auto = fread_action(fl, nr);
soc_mess_list[curr_soc].others_auto = fread_action(fl, nr);
if (CONFIG_NEW_SOCIALS == FALSE)
continue;
soc_mess_list[curr_soc].char_body_found = fread_action(fl, nr);
soc_mess_list[curr_soc].others_body_found = fread_action(fl, nr);
soc_mess_list[curr_soc].vict_body_found = fread_action(fl, nr);
soc_mess_list[curr_soc].char_obj_found = fread_action(fl, nr);
soc_mess_list[curr_soc].others_obj_found = fread_action(fl, nr);
}
/* close file & set top */
fclose(fl);
assert(curr_soc <= top_of_socialt);
top_of_socialt = curr_soc;
}
/* this function adds in the loaded socials and assigns them a command # */ /* this function adds in the loaded socials and assigns them a command # */
void create_command_list(void) void create_command_list(void)
{ {
@ -335,22 +227,6 @@ void free_command_list(void)
complete_cmd_info = NULL; complete_cmd_info = NULL;
} }
char *fread_action(FILE *fl, int nr)
{
char buf[MAX_STRING_LENGTH];
fgets(buf, MAX_STRING_LENGTH, fl);
if (feof(fl)) {
log("SYSERR: fread_action: unexpected EOF near action #%d", nr);
exit(1);
}
if (*buf == '#')
return (NULL);
buf[strlen(buf) - 1] = '\0';
return (strdup(buf));
}
void free_social_messages(void) void free_social_messages(void)
{ {
struct social_messg *mess; struct social_messg *mess;

View file

@ -115,6 +115,7 @@ ACMD(do_checkloadstatus);
ACMD(do_poofs); ACMD(do_poofs);
ACMD(do_copyover); ACMD(do_copyover);
ACMD(do_peace); ACMD(do_peace);
void mod_llog_entry(struct last_entry *llast,int type);
int purge_room(room_rnum room) int purge_room(room_rnum room)
{ {
@ -963,7 +964,7 @@ void do_stat_character(struct char_data *ch, struct char_data *k)
} }
} }
if (GET_LEVEL(ch) >= LVL_IMMORT) { if (!IS_NPC(k) && (GET_LEVEL(ch) >= LVL_IMMORT)) {
if (POOFIN(k)) if (POOFIN(k))
send_to_char(ch, "%sPOOFIN: %s%s %s%s\r\n", QYEL, QCYN, GET_NAME(k), POOFIN(k), QNRM); send_to_char(ch, "%sPOOFIN: %s%s %s%s\r\n", QYEL, QCYN, GET_NAME(k), POOFIN(k), QNRM);
else else
@ -1285,7 +1286,7 @@ void do_cheat(struct char_data *ch)
break; break;
default: default:
send_to_char(ch, "You do not have access to this command.\r\n"); send_to_char(ch, "You do not have access to this command.\r\n");
return; return;
} }
send_to_char(ch, "Your level has been restored, for now!\r\n"); send_to_char(ch, "Your level has been restored, for now!\r\n");
} }
@ -1580,14 +1581,15 @@ ACMD(do_advance)
* nice immortal only flags, shall we? * nice immortal only flags, shall we?
*/ */
REMOVE_BIT(PRF_FLAGS(victim), PRF_LOG1 | PRF_LOG2); REMOVE_BIT(PRF_FLAGS(victim), PRF_LOG1 | PRF_LOG2);
REMOVE_BIT(PRF_FLAGS(victim), PRF_NOHASSLE | PRF_HOLYLIGHT | PRF_ROOMFLAGS); REMOVE_BIT(PRF_FLAGS(victim), PRF_NOHASSLE | PRF_HOLYLIGHT | PRF_SHOWVNUMS);
run_autowiz(); run_autowiz();
} else if (oldlevel < LVL_IMMORT && newlevel >= LVL_IMMORT) { } else if (oldlevel < LVL_IMMORT && newlevel >= LVL_IMMORT) {
SET_BIT(PRF_FLAGS(victim), PRF_LOG1); SET_BIT(PRF_FLAGS(victim), PRF_LOG1);
SET_BIT(PRF_FLAGS(victim), PRF_HOLYLIGHT | PRF_ROOMFLAGS | PRF_AUTOEXIT); SET_BIT(PRF_FLAGS(victim), PRF_HOLYLIGHT | PRF_SHOWVNUMS | PRF_AUTOEXIT);
for (i = 1; i <= MAX_SKILLS; i++) for (i = 1; i <= MAX_SKILLS; i++)
SET_SKILL(victim, i, 100); SET_SKILL(victim, i, 100);
run_autowiz(); run_autowiz();
GET_OLC_ZONE(victim) = NOWHERE;
} }
gain_exp_regardless(victim, gain_exp_regardless(victim,
@ -2105,8 +2107,7 @@ ACMD(do_last)
send_to_char(ch, "[%5ld] [%2d %s] %-12s : %-18s : %-20s\r\n", send_to_char(ch, "[%5ld] [%2d %s] %-12s : %-18s : %-20s\r\n",
GET_IDNUM(vict), (int) GET_LEVEL(vict), GET_IDNUM(vict), (int) GET_LEVEL(vict),
class_abbrevs[(int) GET_CLASS(vict)], GET_NAME(vict), class_abbrevs[(int) GET_CLASS(vict)], GET_NAME(vict),
vict->player_specials->host && *vict->player_specials->host GET_HOST(vict) && *GET_HOST(vict) ? GET_HOST(vict) : "(NOHOST)",
? vict->player_specials->host : "(NOHOST)",
ctime(&vict->player.time.logon)); ctime(&vict->player.time.logon));
free_char(vict); free_char(vict);
return; return;
@ -2422,6 +2423,10 @@ ACMD(do_wizutil)
break; break;
default: default:
log("SYSERR: Unknown subcmd %d passed to do_wizutil (%s)", subcmd, __FILE__); log("SYSERR: Unknown subcmd %d passed to do_wizutil (%s)", subcmd, __FILE__);
/* SYSERR_DESC:
* This is the same as the unhandled case in do_gen_ps(), but this
* function handles 'reroll', 'pardon', 'freeze', etc.
*/
break; break;
} }
save_char(vict); save_char(vict);
@ -2801,7 +2806,7 @@ ACMD(do_show)
{ "thirst", LVL_GRGOD, BOTH, MISC }, { "thirst", LVL_GRGOD, BOTH, MISC },
{ "killer", LVL_GOD, PC, BINARY }, { "killer", LVL_GOD, PC, BINARY },
{ "thief", LVL_GOD, PC, BINARY }, { "thief", LVL_GOD, PC, BINARY },
{ "level", LVL_IMPL, BOTH, NUMBER }, { "level", LVL_GOD, BOTH, NUMBER },
{ "room", LVL_IMPL, BOTH, NUMBER }, /* 35 */ { "room", LVL_IMPL, BOTH, NUMBER }, /* 35 */
{ "roomflag", LVL_GRGOD, PC, BINARY }, { "roomflag", LVL_GRGOD, PC, BINARY },
{ "siteok", LVL_GRGOD, PC, BINARY }, { "siteok", LVL_GRGOD, PC, BINARY },
@ -3056,7 +3061,7 @@ int perform_set(struct char_data *ch, struct char_data *vict, int mode,
char_to_room(vict, rnum); char_to_room(vict, rnum);
break; break;
case 36: case 36:
SET_OR_REMOVE(PRF_FLAGS(vict), PRF_ROOMFLAGS); SET_OR_REMOVE(PRF_FLAGS(vict), PRF_SHOWVNUMS);
break; break;
case 37: case 37:
SET_OR_REMOVE(PLR_FLAGS(vict), PLR_SITEOK); SET_OR_REMOVE(PLR_FLAGS(vict), PLR_SITEOK);
@ -3104,10 +3109,6 @@ int perform_set(struct char_data *ch, struct char_data *vict, int mode,
GET_IDNUM(vict) = value; GET_IDNUM(vict) = value;
break; break;
case 45: case 45:
if (GET_IDNUM(ch) > 1) {
send_to_char(ch, "Please don't use this command, yet.\r\n");
return (0);
}
if (GET_LEVEL(vict) >= LVL_GRGOD) { if (GET_LEVEL(vict) >= LVL_GRGOD) {
send_to_char(ch, "You cannot change that.\r\n"); send_to_char(ch, "You cannot change that.\r\n");
return (0); return (0);

View file

@ -20,14 +20,19 @@
#include "constants.h" #include "constants.h"
#include "genolc.h" #include "genolc.h"
/* external functs */ /* external functions */
int sort_command_helper(const void *a, const void *b); int sort_command_helper(const void *a, const void *b);
void sort_commands(void); /* aedit patch -- M. Scott */ void sort_commands(void); /* aedit patch -- M. Scott */
void create_command_list(void); void create_command_list(void);
/* function protos */ /* local functions */
ACMD(do_astat); ACMD(do_astat);
int aedit_find_command(const char *txt); int aedit_find_command(const char *txt);
void aedit_disp_menu(struct descriptor_data * d);
void aedit_setup_new(struct descriptor_data *d);
void aedit_setup_existing(struct descriptor_data *d, int real_num);
void aedit_save_internally(struct descriptor_data *d);
void aedit_save_to_disk(struct descriptor_data *d);
/* /*
* Utils and exported functions. * Utils and exported functions.

View file

@ -33,8 +33,12 @@ void write_aliases(struct char_data *ch)
return; return;
if ((file = fopen(fn, "w")) == NULL) { if ((file = fopen(fn, "w")) == NULL) {
log("SYSERR: Couldn't save aliases for %s in '%s'.", GET_NAME(ch), fn); log("SYSERR: Couldn't save aliases for %s in '%s': %s", GET_NAME(ch), fn, strerror(errno));
perror("SYSERR: write_aliases"); /* SYSERR_DESC:
* This error occurs when the server fails to open the relevant alias
* file for writing. The text at the end of the error should give a
* valid reason why.
*/
return; return;
} }
@ -64,8 +68,12 @@ void read_aliases(struct char_data *ch)
if ((file = fopen(xbuf, "r")) == NULL) { if ((file = fopen(xbuf, "r")) == NULL) {
if (errno != ENOENT) { if (errno != ENOENT) {
log("SYSERR: Couldn't open alias file '%s' for %s.", xbuf, GET_NAME(ch)); log("SYSERR: Couldn't open alias file '%s' for %s: %s", xbuf, GET_NAME(ch), strerror(errno));
perror("SYSERR: read_aliases"); /* SYSERR_DESC:
* This error occurs when the server fails to open the relevant alias
* file for reading. The text at the end version should give a valid
* reason why.
*/
} }
return; return;
} }
@ -124,5 +132,9 @@ void delete_aliases(const char *charname)
if (remove(filename) < 0 && errno != ENOENT) if (remove(filename) < 0 && errno != ENOENT)
log("SYSERR: deleting alias file %s: %s", filename, strerror(errno)); log("SYSERR: deleting alias file %s: %s", filename, strerror(errno));
/* SYSERR_DESC:
* When an alias file cannot be removed, this error will occur,
* and the reason why will be the tail end of the error.
*/
} }

View file

@ -79,12 +79,13 @@ SPECIAL(gen_board);
int find_slot(void); int find_slot(void);
int find_board(struct char_data *ch); int find_board(struct char_data *ch);
void init_boards(void); void init_boards(void);
char *msg_storage[INDEX_SIZE]; char *msg_storage[INDEX_SIZE];
int msg_storage_taken[INDEX_SIZE]; int msg_storage_taken[INDEX_SIZE];
int num_of_msgs[NUM_OF_BOARDS]; int num_of_msgs[NUM_OF_BOARDS];
int ACMD_READ, ACMD_LOOK, ACMD_EXAMINE, ACMD_WRITE, ACMD_REMOVE; int ACMD_READ, ACMD_LOOK, ACMD_EXAMINE, ACMD_WRITE, ACMD_REMOVE;
struct board_msginfo msg_index[NUM_OF_BOARDS][MAX_BOARD_MESSAGES]; struct board_msginfo msg_index[NUM_OF_BOARDS][MAX_BOARD_MESSAGES];
void Board_reset_board(int board_type);
void Board_clear_board(int board_type);
int find_slot(void) int find_slot(void)
@ -533,6 +534,8 @@ void Board_clear_board(int board_type)
int i; int i;
for (i = 0; i < MAX_BOARD_MESSAGES; i++) { for (i = 0; i < MAX_BOARD_MESSAGES; i++) {
if (MSG_SLOTNUM(board_type, i) == -1)
continue; /* don't try to free non-existant slots */
if (MSG_HEADING(board_type, i)) if (MSG_HEADING(board_type, i))
free(MSG_HEADING(board_type, i)); free(MSG_HEADING(board_type, i));
if (msg_storage[MSG_SLOTNUM(board_type, i)]) if (msg_storage[MSG_SLOTNUM(board_type, i)])

View file

@ -51,6 +51,4 @@ int Board_remove_msg(int board_type, struct char_data *ch, char *arg, struct obj
int Board_write_message(int board_type, struct char_data *ch, char *arg, struct obj_data *board); int Board_write_message(int board_type, struct char_data *ch, char *arg, struct obj_data *board);
void Board_save_board(int board_type); void Board_save_board(int board_type);
void Board_load_board(int board_type); void Board_load_board(int board_type);
void Board_reset_board(int board_type);
void Board_clear_board(int board_type);
void Board_clear_all(void); void Board_clear_all(void);

View file

@ -90,6 +90,11 @@ void castle_mob_spec(mob_vnum mobnum, SPECIAL(*specproc))
if (rmr == NOBODY) { if (rmr == NOBODY) {
if (!mini_mud) if (!mini_mud)
log("SYSERR: assign_kings_castle(): can't find mob #%d.", vmv); log("SYSERR: assign_kings_castle(): can't find mob #%d.", vmv);
/* SYSERR_DESC:
* When the castle_mob_spec() function is given a mobnum that
* does not correspond to a mod loaded (when not in minimud mode),
* this error will result.
*/
} else } else
mob_index[rmr].func = specproc; mob_index[rmr].func = specproc;
} }

View file

@ -16,25 +16,14 @@
#include "oasis.h" #include "oasis.h"
#include "improved-edit.h" #include "improved-edit.h"
/* Local Macros */
/******************************************************************************/
/** External Functions **/
/******************************************************************************/
void free_config(struct config_data *data);
/******************************************************************************/
/** Internal Macros **/
/******************************************************************************/
#define NO 0 #define NO 0
#define YES 1 #define YES 1
#define CHECK_VAR(var) ((var == YES) ? "Yes" : "No") #define CHECK_VAR(var) ((var == YES) ? "Yes" : "No")
#define TOGGLE_VAR(var) if (var == YES) { var = NO; } else { var = YES; } #define TOGGLE_VAR(var) if (var == YES) { var = NO; } else { var = YES; }
/* local functions */
/******************************************************************************/
/** Internal Functions **/
/******************************************************************************/
void cedit_disp_menu(struct descriptor_data *d); void cedit_disp_menu(struct descriptor_data *d);
void cedit_save_internally(struct descriptor_data *d); void cedit_save_internally(struct descriptor_data *d);
void cedit_disp_game_play_options(struct descriptor_data *d); void cedit_disp_game_play_options(struct descriptor_data *d);
@ -44,10 +33,9 @@ void cedit_disp_operation_options(struct descriptor_data *d);
void cedit_disp_autowiz_options(struct descriptor_data *d); void cedit_disp_autowiz_options(struct descriptor_data *d);
int save_config( IDXTYPE nowhere ); int save_config( IDXTYPE nowhere );
void reassign_rooms(void); void reassign_rooms(void);
void cedit_setup(struct descriptor_data *d);
void cedit_save_to_disk( void );
/******************************************************************************/
/** Routines **/
/******************************************************************************/
ACMD(do_oasis_cedit) ACMD(do_oasis_cedit)
{ {
struct descriptor_data *d; struct descriptor_data *d;

View file

@ -1506,8 +1506,6 @@ void do_start(struct char_data *ch)
if (CONFIG_SITEOK_ALL) if (CONFIG_SITEOK_ALL)
SET_BIT(PLR_FLAGS(ch), PLR_SITEOK); SET_BIT(PLR_FLAGS(ch), PLR_SITEOK);
ch->player_specials->saved.olc_zone = NOWHERE;
} }

View file

@ -327,14 +327,14 @@ int nameserver_is_slow = NO;
/* /*
* Will changes save automaticaly in OLC ? * Will changes save automaticaly in OLC ?
*/ */
int auto_save_olc = 1; int auto_save_olc = YES;
/* /*
* if you wish to enable Aedit, set this to 1 * if you wish to enable Aedit, set this to 1
* This will make the mud look for a file called socials.new, * This will make the mud look for a file called socials.new,
* which is in a different format than the stock socials file. * which is in a different format than the stock socials file.
*/ */
int use_new_socials = 1; int use_new_socials = YES;
const char *MENU = const char *MENU =
"\r\n" "\r\n"

View file

@ -175,7 +175,7 @@ const char *action_bits[] = {
const char *preference_bits[] = { const char *preference_bits[] = {
"BRIEF", "BRIEF",
"COMPACT", "COMPACT",
"DEAF", "NO_SHOUT",
"NO_TELL", "NO_TELL",
"D_HP", "D_HP",
"D_MANA", "D_MANA",

176
src/db.c
View file

@ -75,9 +75,9 @@ char *credits = NULL; /* game credits */
char *news = NULL; /* mud news */ char *news = NULL; /* mud news */
char *motd = NULL; /* message of the day - mortals */ char *motd = NULL; /* message of the day - mortals */
char *imotd = NULL; /* message of the day - immorts */ char *imotd = NULL; /* message of the day - immorts */
char *GREETINGS = NULL; /* opening credits screen */ char *GREETINGS = NULL; /* opening credits screen */
char *help = NULL; /* help screen */ char *help = NULL; /* help screen */
char *ihelp = NULL; /* help screen (immortals) */ char *ihelp = NULL; /* help screen (immortals) */
char *info = NULL; /* info page */ char *info = NULL; /* info page */
char *wizlist = NULL; /* list of higher gods */ char *wizlist = NULL; /* list of higher gods */
char *immlist = NULL; /* list of peon gods */ char *immlist = NULL; /* list of peon gods */
@ -137,15 +137,14 @@ char fread_letter(FILE *fp);
void free_followers(struct follow_type *k); void free_followers(struct follow_type *k);
void load_default_config( void ); void load_default_config( void );
void load_config( void ); void load_config( void );
void free_extra_descriptions(struct extra_descr_data *edesc);
/* external functions */ /* external functions */
void paginate_string(char *str, struct descriptor_data *d); void paginate_string(char *str, struct descriptor_data *d);
struct time_info_data *mud_time_passed(time_t t2, time_t t1); struct time_info_data *mud_time_passed(time_t t2, time_t t1);
void free_alias(struct alias_data *a); void free_alias(struct alias_data *a);
void load_messages(void); void load_messages(void);
void weather_and_time(int mode);
void mag_assign_spells(void); void mag_assign_spells(void);
void boot_social_messages(void);
void update_obj_file(void); /* In objsave.c */ void update_obj_file(void); /* In objsave.c */
void sort_commands(void); void sort_commands(void);
void sort_spells(void); void sort_spells(void);
@ -179,6 +178,164 @@ extern int auto_pwipe;
* routines for booting the system * * routines for booting the system *
*************************************************************************/ *************************************************************************/
char *fread_action(FILE *fl, int nr)
{
char buf[MAX_STRING_LENGTH];
fgets(buf, MAX_STRING_LENGTH, fl);
if (feof(fl)) {
log("SYSERR: fread_action: unexpected EOF near action #%d", nr);
/* SYSERR_DESC:
* fread_action() will fail if it discovers an end of file marker
* before it is able to read in the expected string. This can be
* caused by a truncated socials file.
*/
exit(1);
}
if (*buf == '#')
return (NULL);
buf[strlen(buf) - 1] = '\0';
return (strdup(buf));
}
void boot_social_messages(void)
{
FILE *fl;
int nr = 0, hide, min_char_pos, min_pos, min_lvl, curr_soc = -1;
char next_soc[MAX_STRING_LENGTH], sorted[MAX_INPUT_LENGTH];
if (CONFIG_NEW_SOCIALS == TRUE) {
/* open social file */
if (!(fl = fopen(SOCMESS_FILE_NEW, "r"))) {
log("SYSERR: can't open socials file '%s': %s", SOCMESS_FILE_NEW, strerror(errno));
/* SYSERR_DESC:
* This error, from boot_social_messages(), occurs when the server
* fails to open the file containing the social messages. The error
* at the end will indicate the reason why.
*/
exit(1);
}
/* count socials */
*next_soc = '\0';
while (!feof(fl)) {
fgets(next_soc, MAX_STRING_LENGTH, fl);
if (*next_soc == '~') top_of_socialt++;
}
} else { /* old style */
/* open social file */
if (!(fl = fopen(SOCMESS_FILE, "r"))) {
log("SYSERR: can't open socials file '%s': %s", SOCMESS_FILE, strerror(errno));
/* SYSERR_DESC:
* This error, from boot_social_messages(), occurs when the server
* fails to open the file containing the social messages. The error
* at the end will indicate the reason why.
*/
exit(1);
}
/* count socials */
while (!feof(fl)) {
fgets(next_soc, MAX_STRING_LENGTH, fl);
if (*next_soc == '\n' || *next_soc == '\r') top_of_socialt++; /* all socials are followed by a blank line */
}
}
log("Social table contains %d socials.", top_of_socialt);
rewind(fl);
CREATE(soc_mess_list, struct social_messg, top_of_socialt + 1);
/* now read 'em */
for (;;) {
fscanf(fl, " %s ", next_soc);
if (*next_soc == '$') break;
if (CONFIG_NEW_SOCIALS == TRUE) {
if (fscanf(fl, " %s %d %d %d %d \n",
sorted, &hide, &min_char_pos, &min_pos, &min_lvl) != 5) {
log("SYSERR: format error in social file near social '%s'", next_soc);
/* SYSERR_DESC:
* From boot_social_messages(), this error is output when the
* server is expecting to find the remainder of the first line of the
* social ('hide' and 'minimum position'). These must follow the
* name of the social with a single space such as: 'accuse 0 5\n'.
* This error often occurs when one of the numbers is missing or the
* social name has a space in it (i.e., 'bend over').
*/
exit(1);
}
curr_soc++;
soc_mess_list[curr_soc].command = strdup(next_soc+1);
soc_mess_list[curr_soc].sort_as = strdup(sorted);
soc_mess_list[curr_soc].hide = hide;
soc_mess_list[curr_soc].min_char_position = min_char_pos;
soc_mess_list[curr_soc].min_victim_position = min_pos;
soc_mess_list[curr_soc].min_level_char = min_lvl;
} else { /* old style */
if (fscanf(fl, " %d %d \n", &hide, &min_pos) != 2) {
log("SYSERR: format error in social file near social '%s'", next_soc);
/* SYSERR_DESC:
* From boot_social_messages(), this error is output when the
* server is expecting to find the remainder of the first line of the
* social ('hide' and 'minimum position'). These must follow the
* name of the social with a single space such as: 'accuse 0 5\n'.
* This error often occurs when one of the numbers is missing or the
* social name has a space in it (i.e., 'bend over').
*/
exit(1);
}
curr_soc++;
soc_mess_list[curr_soc].command = strdup(next_soc);
soc_mess_list[curr_soc].sort_as = strdup(next_soc);
soc_mess_list[curr_soc].hide = hide;
soc_mess_list[curr_soc].min_char_position = POS_RESTING;
soc_mess_list[curr_soc].min_victim_position = min_pos;
soc_mess_list[curr_soc].min_level_char = 0;
}
#ifdef CIRCLE_ACORN
if (fgetc(fl) != '\n')
log("SYSERR: Acorn bug workaround failed.");
/* SYSERR_DESC:
* The only time that this error should ever arise is if you are running
* your CircleMUD on the Acorn platform. The error arises when the
* server cannot properly read a '\n' out of the file at the end of the
* first line of the social (that with 'hide' and 'min position'). This
* is in boot_social_messages().
*/
#endif
soc_mess_list[curr_soc].char_no_arg = fread_action(fl, nr);
soc_mess_list[curr_soc].others_no_arg = fread_action(fl, nr);
soc_mess_list[curr_soc].char_found = fread_action(fl, nr);
/* if no char_found, the rest is to be ignored */
if (CONFIG_NEW_SOCIALS == FALSE && !soc_mess_list[curr_soc].char_found)
continue;
soc_mess_list[curr_soc].others_found = fread_action(fl, nr);
soc_mess_list[curr_soc].vict_found = fread_action(fl, nr);
soc_mess_list[curr_soc].not_found = fread_action(fl, nr);
soc_mess_list[curr_soc].char_auto = fread_action(fl, nr);
soc_mess_list[curr_soc].others_auto = fread_action(fl, nr);
if (CONFIG_NEW_SOCIALS == FALSE)
continue;
soc_mess_list[curr_soc].char_body_found = fread_action(fl, nr);
soc_mess_list[curr_soc].others_body_found = fread_action(fl, nr);
soc_mess_list[curr_soc].vict_body_found = fread_action(fl, nr);
soc_mess_list[curr_soc].char_obj_found = fread_action(fl, nr);
soc_mess_list[curr_soc].others_obj_found = fread_action(fl, nr);
}
/* close file & set top */
fclose(fl);
assert(curr_soc <= top_of_socialt);
top_of_socialt = curr_soc;
}
/* this is necessary for the autowiz system */ /* this is necessary for the autowiz system */
void reboot_wizlists(void) void reboot_wizlists(void)
{ {
@ -360,6 +517,8 @@ void destroy_db(void)
while (character_list) { while (character_list) {
chtmp = character_list; chtmp = character_list;
character_list = character_list->next; character_list = character_list->next;
if (chtmp->master)
stop_follower(chtmp);
free_char(chtmp); free_char(chtmp);
} }
@ -642,7 +801,7 @@ void reset_time(void)
FILE *bgtime; FILE *bgtime;
if ((bgtime = fopen(TIME_FILE, "r")) == NULL) if ((bgtime = fopen(TIME_FILE, "r")) == NULL)
log("SYSERR: Can't read from '%s' time file.", TIME_FILE); log("No time file '%s' starting from the beginning.", TIME_FILE);
else { else {
fscanf(bgtime, "%ld\n", &beginning_of_time); fscanf(bgtime, "%ld\n", &beginning_of_time);
fclose(bgtime); fclose(bgtime);
@ -2444,6 +2603,8 @@ void free_char(struct char_data *ch)
free(ch->player_specials->poofin); free(ch->player_specials->poofin);
if (ch->player_specials->poofout) if (ch->player_specials->poofout)
free(ch->player_specials->poofout); free(ch->player_specials->poofout);
if (GET_HOST(ch))
free(GET_HOST(ch));
free(ch->player_specials); free(ch->player_specials);
if (IS_NPC(ch)) if (IS_NPC(ch))
log("SYSERR: Mob %s (#%d) had player_specials allocated!", GET_NAME(ch), GET_MOB_VNUM(ch)); log("SYSERR: Mob %s (#%d) had player_specials allocated!", GET_NAME(ch), GET_MOB_VNUM(ch));
@ -2461,9 +2622,6 @@ void free_char(struct char_data *ch)
if (ch->player.description) if (ch->player.description)
free(ch->player.description); free(ch->player.description);
if (GET_HOST(ch))
free(GET_HOST(ch));
/* free script proto list */ /* free script proto list */
free_proto_script(ch, MOB_TRIGGER); free_proto_script(ch, MOB_TRIGGER);
@ -3166,7 +3324,7 @@ void load_config( void )
snprintf(buf, sizeof(buf), "%s/%s", DFLT_DIR, CONFIG_CONFFILE); snprintf(buf, sizeof(buf), "%s/%s", DFLT_DIR, CONFIG_CONFFILE);
if ( !(fl = fopen(CONFIG_CONFFILE, "r")) && !(fl = fopen(buf, "r")) ) { if ( !(fl = fopen(CONFIG_CONFFILE, "r")) && !(fl = fopen(buf, "r")) ) {
snprintf(buf, sizeof(buf), "Game Config File: %s", CONFIG_CONFFILE); snprintf(buf, sizeof(buf), "No %s file, using defaults", CONFIG_CONFFILE);
perror(buf); perror(buf);
return; return;
} }

View file

@ -20,7 +20,7 @@
#if defined(CIRCLE_MACINTOSH) #if defined(CIRCLE_MACINTOSH)
#define LIB_WORLD ":world:" #define LIB_WORLD ":world:"
#define LIB_TEXT ":text:" #define LIB_TEXT ":text:"
#define LIB_TEXT_HEDIT ":text:hedit:" #define LIB_TEXT_HELP ":text:help:"
#define LIB_MISC ":misc:" #define LIB_MISC ":misc:"
#define LIB_ETC ":etc:" #define LIB_ETC ":etc:"
#define LIB_PLRTEXT ":plrtext:" #define LIB_PLRTEXT ":plrtext:"
@ -33,7 +33,7 @@
#elif defined(CIRCLE_AMIGA) || defined(CIRCLE_UNIX) || defined(CIRCLE_WINDOWS) || defined(CIRCLE_ACORN) || defined(CIRCLE_VMS) #elif defined(CIRCLE_AMIGA) || defined(CIRCLE_UNIX) || defined(CIRCLE_WINDOWS) || defined(CIRCLE_ACORN) || defined(CIRCLE_VMS)
#define LIB_WORLD "world/" #define LIB_WORLD "world/"
#define LIB_TEXT "text/" #define LIB_TEXT "text/"
#define LIB_TEXT_HEDIT "text/hedit/" #define LIB_TEXT_HELP "text/help/"
#define LIB_MISC "misc/" #define LIB_MISC "misc/"
#define LIB_ETC "etc/" #define LIB_ETC "etc/"
#define LIB_PLRTEXT "plrtext/" #define LIB_PLRTEXT "plrtext/"
@ -78,15 +78,15 @@
#define ZON_PREFIX LIB_WORLD"zon"SLASH /* zon defs & command tables */ #define ZON_PREFIX LIB_WORLD"zon"SLASH /* zon defs & command tables */
#define SHP_PREFIX LIB_WORLD"shp"SLASH /* shop definitions */ #define SHP_PREFIX LIB_WORLD"shp"SLASH /* shop definitions */
#define TRG_PREFIX LIB_WORLD"trg"SLASH /* trigger files */ #define TRG_PREFIX LIB_WORLD"trg"SLASH /* trigger files */
#define HLP_PREFIX LIB_TEXT"hedit"SLASH /* Help files */ #define HLP_PREFIX LIB_TEXT"help"SLASH /* Help files */
#define CREDITS_FILE LIB_TEXT"credits" /* for the 'credits' command */ #define CREDITS_FILE LIB_TEXT"credits" /* for the 'credits' command */
#define NEWS_FILE LIB_TEXT"news" /* for the 'news' command */ #define NEWS_FILE LIB_TEXT"news" /* for the 'news' command */
#define MOTD_FILE LIB_TEXT"motd" /* messages of the day / mortal */ #define MOTD_FILE LIB_TEXT"motd" /* messages of the day / mortal */
#define IMOTD_FILE LIB_TEXT"imotd" /* messages of the day / immort */ #define IMOTD_FILE LIB_TEXT"imotd" /* messages of the day / immort */
#define GREETINGS_FILE LIB_TEXT"greetings" /* The opening screen. */ #define GREETINGS_FILE LIB_TEXT"greetings" /* The opening screen. */
#define HELP_PAGE_FILE LIB_TEXT_HEDIT"screen" /* for HELP <CR> */ #define HELP_PAGE_FILE LIB_TEXT_HELP"screen" /* for HELP <CR> */
#define IHELP_PAGE_FILE LIB_TEXT_HEDIT"iscreen" /* for HELP <CR> imms */ #define IHELP_PAGE_FILE LIB_TEXT_HELP"iscreen" /* for HELP <CR> imms */
#define CONTEXT_HELP_FILE LIB_TEXT"contexthelp" /* context help for olc */ #define CONTEXT_HELP_FILE LIB_TEXT"contexthelp" /* context help for olc */
#define INFO_FILE LIB_TEXT"info" /* for INFO */ #define INFO_FILE LIB_TEXT"info" /* for INFO */
#define WIZLIST_FILE LIB_TEXT"wizlist" /* for WIZLIST */ #define WIZLIST_FILE LIB_TEXT"wizlist" /* for WIZLIST */
@ -127,7 +127,6 @@ char *fread_string(FILE *fl, const char *error);
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);
void free_extra_descriptions(struct extra_descr_data *edesc);
void free_text_files(void); void free_text_files(void);
void free_help_table(void); void free_help_table(void);
void free_player_index(void); void free_player_index(void);

View file

@ -24,6 +24,9 @@
#include "db.h" #include "db.h"
#include "constants.h" #include "constants.h"
/* local functions */
void sub_write_to_char(char_data *ch, char *tokens[], void *otokens[], char type[]);
/* same as any_one_arg except that it stops at punctuation */ /* same as any_one_arg except that it stops at punctuation */
char *any_one_name(char *argument, char *first_arg) char *any_one_name(char *argument, char *first_arg)
{ {

View file

@ -28,6 +28,9 @@
extern void half_chop(char *string, char *arg1, char *arg2); extern void half_chop(char *string, char *arg1, char *arg2);
extern bitvector_t asciiflag_conv(char *flag); extern bitvector_t asciiflag_conv(char *flag);
/* local functions */
void trig_data_init(trig_data *this_data);
void parse_trigger(FILE *trig_f, int nr) void parse_trigger(FILE *trig_f, int nr)
{ {
int t[2], k, attach_type; int t[2], k, attach_type;

View file

@ -239,7 +239,7 @@ void queue_deq(struct queue *q, struct q_element *qe)
*/ */
void *queue_head(struct queue *q) void *queue_head(struct queue *q)
{ {
void *data; void *dg_data;
int i; int i;
i = pulse % NUM_EVENT_QUEUES; i = pulse % NUM_EVENT_QUEUES;
@ -247,9 +247,9 @@ void *queue_head(struct queue *q)
if (!q->head[i]) if (!q->head[i])
return NULL; return NULL;
data = q->head[i]->data; dg_data = q->head[i]->data;
queue_deq(q, q->head[i]); queue_deq(q, q->head[i]);
return data; return dg_data;
} }

View file

@ -39,7 +39,6 @@
/* prototype exported functions from dg_olc.c */ /* prototype exported functions from dg_olc.c */
void script_save_to_disk(FILE *fp, void *item, int type); void script_save_to_disk(FILE *fp, void *item, int type);
void dg_olc_script_free(struct descriptor_data *d);
void dg_olc_script_copy(struct descriptor_data *d); void dg_olc_script_copy(struct descriptor_data *d);
void dg_script_menu(struct descriptor_data *d); void dg_script_menu(struct descriptor_data *d);
int dg_script_edit_parse(struct descriptor_data *d, char *arg); int dg_script_edit_parse(struct descriptor_data *d, char *arg);

View file

@ -1335,9 +1335,9 @@ void eval_op(char *op, char *lhs, char *rhs, char *result, void *go,
while (*rhs && isspace(*rhs)) while (*rhs && isspace(*rhs))
rhs++; rhs++;
for (p = lhs; *p; p++); for (p = (unsigned char *) lhs; *p; p++);
for (--p; isspace(*p) && ((char *)p > lhs); *p-- = '\0'); for (--p; isspace(*p) && ((char *)p > lhs); *p-- = '\0');
for (p = rhs; *p; p++); for (p = (unsigned char *) rhs; *p; p++);
for (--p; isspace(*p) && ((char *)p > rhs); *p-- = '\0'); for (--p; isspace(*p) && ((char *)p > rhs); *p-- = '\0');

View file

@ -310,7 +310,6 @@ void remove_from_lookup_table(long uid);
/* from dg_db_scripts.c */ /* from dg_db_scripts.c */
void parse_trigger(FILE *trig_f, int nr); void parse_trigger(FILE *trig_f, int nr);
trig_data *read_trigger(int nr); trig_data *read_trigger(int nr);
void trig_data_init(trig_data *this_data);
void trig_data_copy(trig_data *this_data, const trig_data *trg); void trig_data_copy(trig_data *this_data, const trig_data *trg);
void dg_read_trigger(FILE *fp, void *proto, int type); void dg_read_trigger(FILE *fp, void *proto, int type);
void dg_obj_trigger(char *line, struct obj_data *obj); void dg_obj_trigger(char *line, struct obj_data *obj);
@ -345,8 +344,6 @@ void update_wait_events(struct room_data *to, struct room_data *from);
/* from dg_comm.c */ /* from dg_comm.c */
char *any_one_name(char *argument, char *first_arg); char *any_one_name(char *argument, char *first_arg);
void sub_write_to_char(char_data *ch, char *tokens[],
void *otokens[], char type[]);
void sub_write(char *arg, char_data *ch, byte find_invis, int targets); void sub_write(char *arg, char_data *ch, byte find_invis, int targets);
void send_to_zone(char *messg, zone_rnum zone); void send_to_zone(char *messg, zone_rnum zone);

View file

@ -18,8 +18,12 @@
#include "dg_olc.h" #include "dg_olc.h"
#include "handler.h" #include "handler.h"
/* extern functions */
extern struct board_info_type board_info[]; extern struct board_info_type board_info[];
/* local functions */
void free_object_strings_proto(struct obj_data *obj);
obj_rnum add_object(struct obj_data *newobj, obj_vnum ovnum) obj_rnum add_object(struct obj_data *newobj, obj_vnum ovnum)
{ {
int found = NOTHING; int found = NOTHING;

View file

@ -7,7 +7,6 @@
void copy_object_strings(struct obj_data *to, struct obj_data *from); void copy_object_strings(struct obj_data *to, struct obj_data *from);
void free_object_strings(struct obj_data *obj); void free_object_strings(struct obj_data *obj);
void free_object_strings_proto(struct obj_data *obj);
int copy_object(struct obj_data *to, struct obj_data *from); int copy_object(struct obj_data *to, struct obj_data *from);
int copy_object_preserve(struct obj_data *to, struct obj_data *from); int copy_object_preserve(struct obj_data *to, struct obj_data *from);
int save_objects(zone_rnum vznum); int save_objects(zone_rnum vznum);

View file

@ -34,7 +34,6 @@ void update_char_objects(struct char_data *ch);
/* external functions */ /* external functions */
int invalid_class(struct char_data *ch, struct obj_data *obj); int invalid_class(struct char_data *ch, struct obj_data *obj);
void remove_follower(struct char_data *ch);
void clearMemory(struct char_data *ch); void clearMemory(struct char_data *ch);
ACMD(do_return); ACMD(do_return);

View file

@ -140,4 +140,3 @@ struct last_entry {
void add_llog_entry(struct char_data *ch, int type); void add_llog_entry(struct char_data *ch, int type);
struct last_entry *find_llog_entry(int punique, long idnum); struct last_entry *find_llog_entry(int punique, long idnum);
void mod_llog_entry(struct last_entry *llast,int type);

View file

@ -37,8 +37,7 @@ int top_of_h_table = 0; /* ref to top of help table */
int top_of_h_file = 0; /* ref of size of help file */ int top_of_h_file = 0; /* ref of size of help file */
long top_help_idnum = 0; /* highest idnum in use */ long top_help_idnum = 0; /* highest idnum in use */
void get_one_line(FILE *fl, char *buf); void get_one_line(FILE *fl, char *buf);
void create_help_index(void); int search_help(struct char_data *ch, char *argument);
int search_help(char *argument);
ACMD(do_reboot); ACMD(do_reboot);
void load_help(FILE *fl, char *name) void load_help(FILE *fl, char *name)
@ -156,7 +155,7 @@ ACMD(do_oasis_hedit)
OLC_NUM(d) = 0; OLC_NUM(d) = 0;
OLC_STORAGE(d) = strdup(argument); OLC_STORAGE(d) = strdup(argument);
OLC_ZNUM(d) = search_help(OLC_STORAGE(d)); OLC_ZNUM(d) = search_help(ch, OLC_STORAGE(d));
for(i = 0; i < (int)strlen(argument); i++) for(i = 0; i < (int)strlen(argument); i++)
argument[i] = toupper(argument[i]); argument[i] = toupper(argument[i]);
@ -439,7 +438,7 @@ ACMD(do_helpcheck)
for(i = 1; *(complete_cmd_info[i].command) != '\n'; i++) { for(i = 1; *(complete_cmd_info[i].command) != '\n'; i++) {
snprintf(arg, sizeof(arg), "%s", complete_cmd_info[i].command); snprintf(arg, sizeof(arg), "%s", complete_cmd_info[i].command);
if(search_help(arg) <= 0) { if(search_help(ch, arg) <= 0) {
if(complete_cmd_info[i].command_pointer == do_action) if(complete_cmd_info[i].command_pointer == do_action)
continue; continue;
w++; w++;
@ -470,7 +469,7 @@ ACMD(do_hindex)
len = sprintf(buf, "Help index entries based on '%s':\r\n", argument); len = sprintf(buf, "Help index entries based on '%s':\r\n", argument);
for (i = 0; i <= top_of_h_table; i++) for (i = 0; i <= top_of_h_table; i++)
if (is_abbrev(argument, help_table[i].keywords)) if (is_abbrev(argument, help_table[i].keywords) && (GET_LEVEL(ch) >= help_table[i].min_level))
len += snprintf(buf + len, sizeof(buf) - len, "%-20.20s%s", len += snprintf(buf + len, sizeof(buf) - len, "%-20.20s%s",
help_table[i].keywords, (++count % 3 ? "" : "\r\n")); help_table[i].keywords, (++count % 3 ? "" : "\r\n"));

View file

@ -324,7 +324,7 @@ void hcontrol_list_houses(struct char_data *ch)
if (house_control[i].last_payment) { if (house_control[i].last_payment) {
timestr = asctime(localtime(&(house_control[i].last_payment))); timestr = asctime(localtime(&(house_control[i].last_payment)));
*(timestr + 10) = '\0'; *(timestr + 10) = '\0';
strlcpy(last_pay, timestr, sizeof(built_on)); strlcpy(last_pay, timestr, sizeof(last_pay));
} else } else
strcpy(last_pay, "None"); /* strcpy: OK (for 'strlen("None") < 128') */ strcpy(last_pay, "None"); /* strcpy: OK (for 'strlen("None") < 128') */

View file

@ -24,7 +24,6 @@
#include "screen.h" #include "screen.h"
#include "genolc.h" #include "genolc.h"
#include "oasis.h" #include "oasis.h"
#include "tedit.h"
#include "improved-edit.h" #include "improved-edit.h"
#include "dg_scripts.h" #include "dg_scripts.h"
#include "constants.h" #include "constants.h"
@ -64,6 +63,7 @@ int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen);
int reserved_word(char *argument); int reserved_word(char *argument);
int _parse_name(char *arg, char *name); int _parse_name(char *arg, char *name);
int enter_player_game (struct descriptor_data *d); int enter_player_game (struct descriptor_data *d);
void write_aliases(struct char_data *ch);
/* prototypes for all do_x functions. */ /* prototypes for all do_x functions. */
ACMD(do_action); ACMD(do_action);
@ -131,7 +131,6 @@ ACMD(do_load);
ACMD(do_look); ACMD(do_look);
/* ACMD(do_move); -- interpreter.h */ /* ACMD(do_move); -- interpreter.h */
ACMD(do_not_here); ACMD(do_not_here);
ACMD(do_olc);
ACMD(do_order); ACMD(do_order);
ACMD(do_page); ACMD(do_page);
ACMD(do_pagelength); ACMD(do_pagelength);
@ -264,7 +263,7 @@ cpp_extern const struct command_info cmd_info[] = {
/* now, the main list */ /* now, the main list */
{ "at" , "at" , POS_DEAD , do_at , LVL_IMMORT, 0 }, { "at" , "at" , POS_DEAD , do_at , LVL_IMMORT, 0 },
{ "advance" , "adv" , POS_DEAD , do_advance , LVL_IMPL, 0 }, { "advance" , "adv" , POS_DEAD , do_advance , LVL_GOD, 0 },
{ "aedit" , "aed" , POS_DEAD , do_oasis , LVL_GOD, SCMD_OASIS_AEDIT }, { "aedit" , "aed" , POS_DEAD , do_oasis , LVL_GOD, SCMD_OASIS_AEDIT },
{ "alias" , "ali" , POS_DEAD , do_alias , 0, 0 }, { "alias" , "ali" , POS_DEAD , do_alias , 0, 0 },
{ "afk" , "afk" , POS_DEAD , do_gen_tog , 0, SCMD_AFK }, { "afk" , "afk" , POS_DEAD , do_gen_tog , 0, SCMD_AFK },
@ -744,7 +743,8 @@ ACMD(do_alias)
a->type = ALIAS_SIMPLE; a->type = ALIAS_SIMPLE;
a->next = GET_ALIASES(ch); a->next = GET_ALIASES(ch);
GET_ALIASES(ch) = a; GET_ALIASES(ch) = a;
send_to_char(ch, "Alias added.\r\n"); write_aliases(ch);
send_to_char(ch, "Alias saved.\r\n");
} }
} }
} }
@ -1401,6 +1401,7 @@ void nanny(struct descriptor_data *d, char *arg)
CREATE(d->character, struct char_data, 1); CREATE(d->character, struct char_data, 1);
clear_char(d->character); clear_char(d->character);
CREATE(d->character->player_specials, struct player_special_data, 1); CREATE(d->character->player_specials, struct player_special_data, 1);
GET_HOST(d->character) = strdup(d->host);
d->character->desc = d; d->character->desc = d;
} }
if (!*arg) if (!*arg)
@ -1435,6 +1436,8 @@ void nanny(struct descriptor_data *d, char *arg)
CREATE(d->character, struct char_data, 1); CREATE(d->character, struct char_data, 1);
clear_char(d->character); clear_char(d->character);
CREATE(d->character->player_specials, struct player_special_data, 1); CREATE(d->character->player_specials, struct player_special_data, 1);
GET_HOST(d->character) = strdup(d->host);
d->character->desc = d; d->character->desc = d;
CREATE(d->character->player.name, char, strlen(tmp_name) + 1); CREATE(d->character->player.name, char, strlen(tmp_name) + 1);
strcpy(d->character->player.name, CAP(tmp_name)); /* strcpy: OK (size checked above) */ strcpy(d->character->player.name, CAP(tmp_name)); /* strcpy: OK (size checked above) */

View file

@ -128,6 +128,8 @@ struct alias_data {
#define SCMD_CLS 17 #define SCMD_CLS 17
#define SCMD_BUILDWALK 18 #define SCMD_BUILDWALK 18
#define SCMD_AFK 19 #define SCMD_AFK 19
#define SCMD_COLOR 20
#define SCMD_SYSLOG 21
/* do_wizutil */ /* do_wizutil */
#define SCMD_REROLL 0 #define SCMD_REROLL 0

View file

@ -29,7 +29,6 @@ extern struct spell_info_type spell_info[];
/* external functions */ /* external functions */
byte saving_throws(int class_num, int type, int level); /* class.c */ byte saving_throws(int class_num, int type, int level); /* class.c */
void clearMemory(struct char_data *ch); void clearMemory(struct char_data *ch);
void weight_change_object(struct obj_data *obj, int weight);
/* local functions */ /* local functions */
int mag_materials(struct char_data *ch, int item0, int item1, int item2, int extract, int verbose); int mag_materials(struct char_data *ch, int item0, int item1, int item2, int extract, int verbose);

View file

@ -23,7 +23,6 @@
#include "boards.h" #include "boards.h"
#include "improved-edit.h" #include "improved-edit.h"
#include "oasis.h" #include "oasis.h"
#include "tedit.h"
void show_string(struct descriptor_data *d, char *input); void show_string(struct descriptor_data *d, char *input);

View file

@ -458,7 +458,6 @@ ACMD(do_oasis);
/* /*
* Prototypes, to be moved later. * Prototypes, to be moved later.
*/ */
void medit_free_mobile(struct char_data *mob);
void medit_setup_new(struct descriptor_data *d); void medit_setup_new(struct descriptor_data *d);
void medit_setup_existing(struct descriptor_data *d, int rmob_num); void medit_setup_existing(struct descriptor_data *d, int rmob_num);
void init_mobile(struct char_data *mob); void init_mobile(struct char_data *mob);
@ -533,7 +532,6 @@ ACMD(do_oasis_sedit);
void zedit_setup(struct descriptor_data *d, int room_num); void zedit_setup(struct descriptor_data *d, int room_num);
void zedit_new_zone(struct char_data *ch, zone_vnum vzone_num, room_vnum bottom, room_vnum top); void zedit_new_zone(struct char_data *ch, zone_vnum vzone_num, room_vnum bottom, room_vnum top);
void zedit_create_index(int znum, char *type);
void zedit_save_internally(struct descriptor_data *d); void zedit_save_internally(struct descriptor_data *d);
void zedit_save_to_disk(int zone_num); void zedit_save_to_disk(int zone_num);
void zedit_disp_menu(struct descriptor_data *d); void zedit_disp_menu(struct descriptor_data *d);
@ -544,9 +542,7 @@ void zedit_disp_arg3(struct descriptor_data *d);
void zedit_parse(struct descriptor_data *d, char *arg); void zedit_parse(struct descriptor_data *d, char *arg);
ACMD(do_oasis_zedit); ACMD(do_oasis_zedit);
void cedit_setup(struct descriptor_data *d);
void cedit_parse(struct descriptor_data *d, char *arg); void cedit_parse(struct descriptor_data *d, char *arg);
void cedit_save_to_disk( void );
void cedit_string_cleanup(struct descriptor_data *d, int terminator); void cedit_string_cleanup(struct descriptor_data *d, int terminator);
ACMD(do_oasis_cedit); ACMD(do_oasis_cedit);
@ -555,12 +551,7 @@ void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num);
void trigedit_setup_new(struct descriptor_data *d); void trigedit_setup_new(struct descriptor_data *d);
ACMD(do_oasis_trigedit); ACMD(do_oasis_trigedit);
void aedit_disp_menu(struct descriptor_data * d);
void aedit_parse(struct descriptor_data * d, char *arg); void aedit_parse(struct descriptor_data * d, char *arg);
void aedit_setup_new(struct descriptor_data *d);
void aedit_setup_existing(struct descriptor_data *d, int real_num);
void aedit_save_to_disk(struct descriptor_data *d);
void aedit_save_internally(struct descriptor_data *d);
void free_action(struct social_messg *mess); void free_action(struct social_messg *mess);
ACMD(do_oasis_aedit); ACMD(do_oasis_aedit);
@ -572,6 +563,9 @@ void hedit_string_cleanup(struct descriptor_data *d, int terminator);
void free_help(struct help_index_element *help); void free_help(struct help_index_element *help);
ACMD(do_oasis_hedit); ACMD(do_oasis_hedit);
void tedit_string_cleanup(struct descriptor_data *d, int terminator);
ACMD(do_tedit);
/* oasis_delete.c */ /* oasis_delete.c */
int free_strings(void *data, int type); int free_strings(void *data, int type);

View file

@ -314,7 +314,7 @@ void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum
if (rnum != NOWHERE) { if (rnum != NOWHERE) {
/* Only one parameter was supplied - just list that zone */ /* Only one parameter was supplied - just list that zone */
print_zone(ch, rnum); print_zone(ch, zone_table[rnum].number);
return; return;
} else { } else {
bottom = vmin; bottom = vmin;

View file

@ -37,7 +37,6 @@ extern int max_obj_save; /* change in config.c */
/* Extern functions */ /* Extern functions */
ACMD(do_action); ACMD(do_action);
ACMD(do_tell);
SPECIAL(receptionist); SPECIAL(receptionist);
SPECIAL(cryogenicist); SPECIAL(cryogenicist);
int invalid_class(struct char_data *ch, struct obj_data *obj); int invalid_class(struct char_data *ch, struct obj_data *obj);

View file

@ -27,7 +27,6 @@
/* local functions */ /* local functions */
void build_player_index(void); void build_player_index(void);
void save_etext(struct char_data *ch);
int sprintascii(char *out, bitvector_t bits); int sprintascii(char *out, bitvector_t bits);
void tag_argument(char *argument, char *tag); void tag_argument(char *argument, char *tag);
void load_affects(FILE *fl, struct char_data *ch); void load_affects(FILE *fl, struct char_data *ch);
@ -472,7 +471,7 @@ void save_char(struct char_data * ch)
if (ch->desc->host && *ch->desc->host) { if (ch->desc->host && *ch->desc->host) {
if (!GET_HOST(ch)) if (!GET_HOST(ch))
GET_HOST(ch) = strdup(ch->desc->host); GET_HOST(ch) = strdup(ch->desc->host);
else if (GET_HOST(ch) && !strcmp(GET_HOST(ch), ch->desc->host)) { else if (GET_HOST(ch) && strcmp(GET_HOST(ch), ch->desc->host)) {
free(GET_HOST(ch)); free(GET_HOST(ch));
GET_HOST(ch) = strdup(ch->desc->host); GET_HOST(ch) = strdup(ch->desc->host);
} }
@ -693,14 +692,6 @@ void save_char(struct char_data * ch)
save_player_index(); save_player_index();
} }
void save_etext(struct char_data *ch)
{
/* this will be really cool soon */
}
/* Separate a 4-character id tag from the data it precedes */ /* Separate a 4-character id tag from the data it precedes */
void tag_argument(char *argument, char *tag) void tag_argument(char *argument, char *tag)
{ {

View file

@ -27,7 +27,6 @@ extern room_rnum r_mortal_start_room;
extern int mini_mud; extern int mini_mud;
/* external functions */ /* external functions */
void clearMemory(struct char_data *ch);
void weight_change_object(struct obj_data *obj, int weight); void weight_change_object(struct obj_data *obj, int weight);
int mag_savingthrow(struct char_data *ch, int type, int modifier); int mag_savingthrow(struct char_data *ch, int type, int modifier);
void name_to_drinkcon(struct obj_data *obj, int type); void name_to_drinkcon(struct obj_data *obj, int type);

View file

@ -107,7 +107,7 @@
/* /*
* NON-PLAYER AND OBJECT SPELLS AND SKILLS * NON-PLAYER AND OBJECT SPELLS AND SKILLS
* The practice levels for the spells and skills below are _not_ recorded * The practice levels for the spells and skills below are _not_ recorded
* in the playerfile; therefore, the intended use is for spells and skills * in the players file; therefore, the intended use is for spells and skills
* associated with objects (such as SPELL_IDENTIFY used with scrolls of * associated with objects (such as SPELL_IDENTIFY used with scrolls of
* identify) or non-players (such as NPC-only spells). * identify) or non-players (such as NPC-only spells).
*/ */

View file

@ -213,7 +213,7 @@
#define PRF_NOAUCT (1 << 18) /* Can't hear auction channel */ #define PRF_NOAUCT (1 << 18) /* Can't hear auction channel */
#define PRF_NOGOSS (1 << 19) /* Can't hear gossip channel */ #define PRF_NOGOSS (1 << 19) /* Can't hear gossip channel */
#define PRF_NOGRATZ (1 << 20) /* Can't hear grats channel */ #define PRF_NOGRATZ (1 << 20) /* Can't hear grats channel */
#define PRF_ROOMFLAGS (1 << 21) /* Can see room flags (ROOM_x) */ #define PRF_SHOWVNUMS (1 << 21) /* Can see VNUMs */
#define PRF_DISPAUTO (1 << 22) /* Show prompt HP, MP, MV when < 25%. */ #define PRF_DISPAUTO (1 << 22) /* Show prompt HP, MP, MV when < 25%. */
#define PRF_CLS (1 << 23) /* Clear screen in OLC */ #define PRF_CLS (1 << 23) /* Clear screen in OLC */
#define PRF_BUILDWALK (1 << 24) /* Build new rooms while walking ? */ #define PRF_BUILDWALK (1 << 24) /* Build new rooms while walking ? */
@ -330,7 +330,7 @@
/* Take/Wear flags: used by obj_data.obj_flags.wear_flags */ /* Take/Wear flags: used by obj_data.obj_flags.wear_flags */
#define ITEM_WEAR_TAKE (1 << 0) /* Item can be takes */ #define ITEM_WEAR_TAKE (1 << 0) /* Item can be taken */
#define ITEM_WEAR_FINGER (1 << 1) /* Can be worn on finger */ #define ITEM_WEAR_FINGER (1 << 1) /* Can be worn on finger */
#define ITEM_WEAR_NECK (1 << 2) /* Can be worn around neck */ #define ITEM_WEAR_NECK (1 << 2) /* Can be worn around neck */
#define ITEM_WEAR_BODY (1 << 3) /* Can be worn on body */ #define ITEM_WEAR_BODY (1 << 3) /* Can be worn on body */
@ -508,22 +508,22 @@
/* Max amount of output that can be buffered */ /* Max amount of output that can be buffered */
#define LARGE_BUFSIZE (MAX_SOCK_BUF - GARBAGE_SPACE - MAX_PROMPT_LENGTH) #define LARGE_BUFSIZE (MAX_SOCK_BUF - GARBAGE_SPACE - MAX_PROMPT_LENGTH)
#define HISTORY_SIZE 5 /* Keep last 5 commands. */ #define HISTORY_SIZE 5 /* Keep last 5 commands. */
#define MAX_STRING_LENGTH 49152 #define MAX_STRING_LENGTH 49152
#define MAX_INPUT_LENGTH 512 /* Max length per *line* of input */ #define MAX_INPUT_LENGTH 512 /* Max length per *line* of input */
#define MAX_RAW_INPUT_LENGTH 512 /* Max size of *raw* input */ #define MAX_RAW_INPUT_LENGTH 512 /* Max size of *raw* input */
#define MAX_MESSAGES 60 #define MAX_MESSAGES 60
#define MAX_NAME_LENGTH 20 /* Used in char_file_u *DO*NOT*CHANGE* */ #define MAX_NAME_LENGTH 20
/* ** MAX_PWD_LENGTH changed from 10 to 30 for ascii test - Sam ** */ /* ** MAX_PWD_LENGTH changed from 10 to 30 for ascii test - Sam ** */
#define MAX_PWD_LENGTH 30 /* Used in char_file_u *DO*NOT*CHANGE* */ #define MAX_PWD_LENGTH 30
#define MAX_TITLE_LENGTH 80 /* Used in char_file_u *DO*NOT*CHANGE* */ #define MAX_TITLE_LENGTH 80
#define HOST_LENGTH 30 /* Used in char_file_u *DO*NOT*CHANGE* */ #define HOST_LENGTH 30
#define PLR_DESC_LENGTH 512 /* Used in char_file_u *DO*NOT*CHANGE* */ #define PLR_DESC_LENGTH 512
#define MAX_TONGUE 3 /* Used in char_file_u *DO*NOT*CHANGE* */ #define MAX_TONGUE 3
#define MAX_SKILLS 200 /* Used in char_file_u *DO*NOT*CHANGE* */ #define MAX_SKILLS 200
#define MAX_AFFECT 32 /* Used in char_file_u *DO*NOT*CHANGE* */ #define MAX_AFFECT 32
#define MAX_OBJ_AFFECT 6 /* Used in obj_file_elem *DO*NOT*CHANGE* */ #define MAX_OBJ_AFFECT 6 /* Used in obj_file_elem */
#define MAX_NOTE_LENGTH 4000 /* arbitrary */ #define MAX_NOTE_LENGTH 4000 /* arbitrary */
#define MAX_LAST_ENTRIES 6000 /* arbitrary */ #define MAX_LAST_ENTRIES 6000 /* arbitrary */
#define MAX_HELP_KEYWORDS 256 #define MAX_HELP_KEYWORDS 256
#define MAX_HELP_ENTRY MAX_STRING_LENGTH #define MAX_HELP_ENTRY MAX_STRING_LENGTH
@ -531,25 +531,10 @@
/* define the largest set of commands for as trigger */ /* define the largest set of commands for as trigger */
#define MAX_CMD_LENGTH 16384 /* 16k should be plenty and then some */ #define MAX_CMD_LENGTH 16384 /* 16k should be plenty and then some */
/*
* A MAX_PWD_LENGTH of 10 will cause BSD-derived systems with MD5 passwords
* and GNU libc 2 passwords to be truncated. On BSD this will enable anyone
* with a name longer than 5 character to log in with any password. If you
* have such a system, it is suggested you change the limit to 20.
*
* Please note that this will erase your player files. If you are not
* prepared to do so, simply erase these lines but heed the above warning.
*/
#if defined(HAVE_UNSAFE_CRYPT) && MAX_PWD_LENGTH == 10
#error You need to increase MAX_PWD_LENGTH to at least 20.
#error See the comment near these errors for more explanation.
#endif
/********************************************************************** /**********************************************************************
* Structures * * Structures *
**********************************************************************/ **********************************************************************/
typedef signed char sbyte; typedef signed char sbyte;
typedef unsigned char ubyte; typedef unsigned char ubyte;
typedef signed short int sh_int; typedef signed short int sh_int;
@ -780,7 +765,7 @@ struct char_player_data {
}; };
/* Char's abilities. Used in char_file_u *DO*NOT*CHANGE* */ /* Char's abilities. */
struct char_ability_data { struct char_ability_data {
sbyte str; sbyte str;
sbyte str_add; /* 000 - 100 if strength 18 */ sbyte str_add; /* 000 - 100 if strength 18 */
@ -792,7 +777,7 @@ struct char_ability_data {
}; };
/* Char's points. Used in char_file_u *DO*NOT*CHANGE* */ /* Char's points. */
struct char_point_data { struct char_point_data {
sh_int mana; sh_int mana;
sh_int max_mana; /* Max mana for PC/NPC */ sh_int max_mana; /* Max mana for PC/NPC */
@ -813,11 +798,7 @@ struct char_point_data {
/* /*
* char_special_data_saved: specials which both a PC and an NPC have in * char_special_data_saved: specials which both a PC and an NPC have in
* common, but which must be saved to the playerfile for PC's. * common, but which must be saved to the players file for PC's.
*
* WARNING: Do not change this structure. Doing so will ruin the
* playerfile. If you want to add to the playerfile, use the spares
* in player_special_data.
*/ */
struct char_special_data_saved { struct char_special_data_saved {
int alignment; /* +-1000 for alignments */ int alignment; /* +-1000 for alignments */
@ -844,15 +825,6 @@ struct char_special_data {
struct char_special_data_saved saved; /* constants saved in plrfile */ struct char_special_data_saved saved; /* constants saved in plrfile */
}; };
/*
* If you want to add new values to the playerfile, do it here. DO NOT
* ADD, DELETE OR MOVE ANY OF THE VARIABLES - doing so will change the
* size of the structure and ruin the playerfile. However, you can change
* the names of the spares to something more meaningful, and then use them
* in your new code. They will automatically be transferred from the
* playerfile into memory when players log in.
*/
struct player_special_data_saved { struct player_special_data_saved {
byte skills[MAX_SKILLS+1]; /* array of skills plus skill 0 */ byte skills[MAX_SKILLS+1]; /* array of skills plus skill 0 */
byte PADDING0; /* used to be spells_to_learn */ byte PADDING0; /* used to be spells_to_learn */
@ -865,39 +837,15 @@ struct player_special_data_saved {
ubyte bad_pws; /* number of bad password attemps */ ubyte bad_pws; /* number of bad password attemps */
sbyte conditions[3]; /* Drunk, full, thirsty */ sbyte conditions[3]; /* Drunk, full, thirsty */
/* spares below for future expansion. You can change the names from
'sparen' to something meaningful, but don't change the order. */
ubyte spare0;
ubyte spare1;
ubyte spare2;
ubyte spare3;
ubyte spare4;
ubyte page_length; ubyte page_length;
int spells_to_learn; /* How many can you learn yet this level*/ int spells_to_learn; /* How many can you learn yet this level*/
int olc_zone; int olc_zone;
int spare8;
int spare9;
int spare10;
int spare11;
int spare12;
int spare13;
int spare14;
int spare15;
int spare16;
long spare17;
long spare18;
long spare19;
long spare20;
long spare21;
}; };
/* /*
* Specials needed only by PCs, not NPCs. Space for this structure is * Specials needed only by PCs, not NPCs. Space for this structure is
* not allocated in memory for NPCs, but it is for PCs and the portion * not allocated in memory for NPCs, but it is for PCs and the portion
* of it labelled 'saved' is saved in the playerfile. This structure can * of it labelled 'saved' is saved in the players file.
* be changed freely; beware, though, that changing the contents of
* player_special_data_saved will corrupt the playerfile.
*/ */
struct player_special_data { struct player_special_data {
struct player_special_data_saved saved; struct player_special_data_saved saved;
@ -922,7 +870,7 @@ struct mob_special_data {
}; };
/* An affect structure. Used in char_file_u *DO*NOT*CHANGE* */ /* An affect structure. */
struct affected_type { struct affected_type {
sh_int type; /* The type of spell that caused this */ sh_int type; /* The type of spell that caused this */
sh_int duration; /* For how long its effects will last */ sh_int duration; /* For how long its effects will last */
@ -976,44 +924,11 @@ struct char_data {
struct char_data *master; /* Who is char following? */ struct char_data *master; /* Who is char following? */
long pref; /* unique session id */ long pref; /* unique session id */
char *host; /* hostname copy */
}; };
/* ====================================================================== */ /* ====================================================================== */
/* ==================== File Structure for Player ======================= */
/* BEWARE: Changing it will ruin the playerfile */
struct char_file_u {
/* char_player_data */
char name[MAX_NAME_LENGTH+1];
char description[PLR_DESC_LENGTH];
char title[MAX_TITLE_LENGTH+1];
byte sex;
byte chclass;
byte level;
sh_int hometown;
time_t birth; /* Time of birth of character */
int played; /* Number of secs played in total */
ubyte weight;
ubyte height;
char pwd[MAX_PWD_LENGTH+1]; /* character's password */
struct char_special_data_saved char_specials_saved;
struct player_special_data_saved player_specials_saved;
struct char_ability_data abilities;
struct char_point_data points;
struct affected_type affected[MAX_AFFECT];
time_t last_logon; /* Time (in secs) of last logon */
char host[HOST_LENGTH+1]; /* host of last logon */
};
/* ====================================================================== */
/* descriptor-related structures ******************************************/ /* descriptor-related structures ******************************************/
struct txt_block { struct txt_block {
char *text; char *text;
int aliased; int aliased;

View file

@ -12,7 +12,7 @@
/* /*
* CircleMUD uses the crypt(3) function to encrypt player passwords in the * CircleMUD uses the crypt(3) function to encrypt player passwords in the
* playerfile so that they are never stored in plaintext form. However, * players file so that they are never stored in plaintext form. However,
* due to U.S. export restrictions on machine-readable cryptographic * due to U.S. export restrictions on machine-readable cryptographic
* software, the crypt() function is not available on some operating * software, the crypt() function is not available on some operating
* systems such as FreeBSD. By default, the 'configure' script will * systems such as FreeBSD. By default, the 'configure' script will
@ -622,7 +622,7 @@ struct in_addr {
#endif #endif
#ifdef NEED_GETTIMEOFDAY_PROTO #ifdef NEED_GETTIMEOFDAY_PROTO
int gettimeofday(struct timeval *tp, void * ); void gettimeofday(struct timeval *tp, void * );
#endif #endif
#ifdef NEED_HTONL_PROTO #ifdef NEED_HTONL_PROTO

View file

@ -15,7 +15,6 @@
#include "genolc.h" #include "genolc.h"
#include "oasis.h" #include "oasis.h"
#include "improved-edit.h" #include "improved-edit.h"
#include "tedit.h"
extern const char *credits; extern const char *credits;
extern const char *news; extern const char *news;

View file

@ -12,20 +12,159 @@
#include "../db.h" #include "../db.h"
#include "../pfdefaults.h" #include "../pfdefaults.h"
// first some stock circle 3.0 defines. Change where appropriate.
#define MAX_NAME_LENGTH 20 /* Used in char_file_u *DO*NOT*CHANGE* */
#define MAX_PWD_LENGTH 30 /* Used in char_file_u *DO*NOT*CHANGE* */
#define MAX_TITLE_LENGTH 80 /* Used in char_file_u *DO*NOT*CHANGE* */
#define HOST_LENGTH 30 /* Used in char_file_u *DO*NOT*CHANGE* */
#define PLR_DESC_LENGTH 512 /* Used in char_file_u *DO*NOT*CHANGE* */
#define MAX_TONGUE 3 /* Used in char_file_u *DO*NOT*CHANGE* */
#define MAX_SKILLS 200 /* Used in char_file_u *DO*NOT*CHANGE* */
#define MAX_AFFECT 32 /* Used in char_file_u *DO*NOT*CHANGE* */
/* Char's abilities. Used in char_file_u *DO*NOT*CHANGE* */
struct char_ability_data_plrtoascii {
sbyte str;
sbyte str_add; /* 000 - 100 if strength 18 */
sbyte intel;
sbyte wis;
sbyte dex;
sbyte con;
sbyte cha;
};
/* Char's points. Used in char_file_u *DO*NOT*CHANGE* */
struct char_point_data_plrtoascii {
sh_int mana;
sh_int max_mana; /* Max mana for PC/NPC */
sh_int hit;
sh_int max_hit; /* Max hit for PC/NPC */
sh_int move;
sh_int max_move; /* Max move for PC/NPC */
sh_int armor; /* Internal -100..100, external -10..10 AC */
int gold; /* Money carried */
int bank_gold; /* Gold the char has in a bank account */
int exp; /* The experience of the player */
sbyte hitroll; /* Any bonus or penalty to the hit roll */
sbyte damroll; /* Any bonus or penalty to the damage roll */
};
/*
* char_special_data_saved: specials which both a PC and an NPC have in
* common, but which must be saved to the playerfile for PC's.
*
* WARNING: Do not change this structure. Doing so will ruin the
* playerfile. If you want to add to the playerfile, use the spares
* in player_special_data.
*/
struct char_special_data_saved_plrtoascii {
int alignment; /* +-1000 for alignments */
long idnum; /* player's idnum; -1 for mobiles */
long /*bitvector_t*/ act; /* act flag for NPC's; player flag for PC's */
long /*bitvector_t*/ affected_by;
/* Bitvector for spells/skills affected by */
sh_int apply_saving_throw[5]; /* Saving throw (Bonuses) */
};
struct player_special_data_saved_plrtoascii {
byte skills[MAX_SKILLS+1]; /* array of skills plus skill 0 */
byte PADDING0; /* used to be spells_to_learn */
bool talks[MAX_TONGUE]; /* PC s Tongues 0 for NPC */
int wimp_level; /* Below this # of hit points, flee! */
byte freeze_level; /* Level of god who froze char, if any */
sh_int invis_level; /* level of invisibility */
room_vnum load_room; /* Which room to place char in */
long /*bitvector_t*/ pref; /* preference flags for PC's. */
ubyte bad_pws; /* number of bad password attemps */
sbyte conditions[3]; /* Drunk, full, thirsty */
/* spares below for future expansion. You can change the names from
'sparen' to something meaningful, but don't change the order. */
ubyte spare0;
ubyte spare1;
ubyte spare2;
ubyte spare3;
ubyte spare4;
ubyte page_length;
int spells_to_learn; /* How many can you learn yet this level*/
int olc_zone;
int spare8;
int spare9;
int spare10;
int spare11;
int spare12;
int spare13;
int spare14;
int spare15;
int spare16;
long spare17;
long spare18;
long spare19;
long spare20;
long spare21;
};
struct affected_type_plrtoascii {
sh_int type; /* The type of spell that caused this */
sh_int duration; /* For how long its effects will last */
sbyte modifier; /* This is added to apropriate ability */
byte location; /* Tells which ability to change(APPLY_XXX)*/
long /*bitvector_t*/ bitvector; /* Tells which bits to set (AFF_XXX) */
struct affected_type_plrtoascii *next;
};
/* ==================== File Structure for Player ======================= */
/* BEWARE: Changing it will ruin the playerfile */
struct char_file_u_plrtoascii {
/* char_player_data */
char name[MAX_NAME_LENGTH+1];
char description[PLR_DESC_LENGTH];
char title[MAX_TITLE_LENGTH+1];
byte sex;
byte chclass;
byte level;
sh_int hometown;
time_t birth; /* Time of birth of character */
int played; /* Number of secs played in total */
ubyte weight;
ubyte height;
char pwd[MAX_PWD_LENGTH+1]; /* character's password */
struct char_special_data_saved_plrtoascii char_specials_saved;
struct player_special_data_saved_plrtoascii player_specials_saved;
struct char_ability_data_plrtoascii abilities;
struct char_point_data_plrtoascii points;
struct affected_type_plrtoascii affected[MAX_AFFECT];
time_t last_logon; /* Time (in secs) of last logon */
char host[HOST_LENGTH+1]; /* host of last logon */
};
/* ====================================================================== */
int sprintascii(char *out, bitvector_t bits); int sprintascii(char *out, bitvector_t bits);
int plr_filename(char *orig_name, char *filename); int plr_filename(char *orig_name, char *filename);
void convert(char *filename) void convert(char *filename)
{ {
FILE *fl, *outfile, *index_file; FILE *fl, *outfile, *index_file;
struct char_file_u player; struct char_file_u_plrtoascii player;
char index_name[40], outname[40], bits[127]; char index_name[40], outname[40], bits[127];
int i; int i;
struct char_special_data_saved *csds; struct char_special_data_saved_plrtoascii *csds;
struct player_special_data_saved *psds; struct player_special_data_saved_plrtoascii *psds;
struct char_ability_data *cad; struct char_ability_data_plrtoascii *cad;
struct char_point_data *cpd; struct char_point_data_plrtoascii *cpd;
struct affected_type *aff; struct affected_type_plrtoascii *aff;
if (!(fl = fopen(filename, "r+"))) { if (!(fl = fopen(filename, "r+"))) {
perror("error opening playerfile"); perror("error opening playerfile");
@ -37,7 +176,7 @@ void convert(char *filename)
exit(1); exit(1);
} }
for (;;) { for (;;) {
fread(&player, sizeof(struct char_file_u), 1, fl); fread(&player, sizeof(struct char_file_u_plrtoascii), 1, fl);
if (feof(fl)) { if (feof(fl)) {
fclose(fl); fclose(fl);
fclose(index_file); fclose(index_file);

View file

@ -192,14 +192,6 @@ int strn_cmp(const char *arg1, const char *arg2, int n)
} }
#endif #endif
/* log a death trap hit */
void log_death_trap(struct char_data *ch)
{
mudlog(BRF, LVL_IMMORT, TRUE, "%s hit death trap #%d (%s)", GET_NAME(ch), GET_ROOM_VNUM(IN_ROOM(ch)), world[IN_ROOM(ch)].name);
}
/* /*
* New variable argument log() function. Works the same as the old for * New variable argument log() function. Works the same as the old for
* previously written code but is very nice for new code. * previously written code but is very nice for new code.

View file

@ -359,54 +359,54 @@ void zmalloc_free_list(meminfo *m)
main() main()
{ {
unsigned char * shit; unsigned char * tmp;
printf("Testing Zmalloc.\n"); printf("Testing Zmalloc.\n");
printf("Malloc test.."); printf("Malloc test..");
printf("You should see no error here.\n"); printf("You should see no error here.\n");
shit = (unsigned char*)malloc(200); tmp = (unsigned char*)malloc(200);
free(shit); free(tmp);
printf("Free free mem test...\n"); printf("Free free mem test...\n");
printf("You should see an ERR: multiple frees here\n"); printf("You should see an ERR: multiple frees here\n");
shit = (unsigned char*)malloc(200); tmp = (unsigned char*)malloc(200);
free(shit); free(tmp);
free(shit); free(tmp);
/* /*
fprintf(zfd,"\nFree unallocated mem test \n"); fprintf(zfd,"\nFree unallocated mem test \n");
shit += 4; tmp += 4;
free(shit); free(tmp);
*/ */
printf("Unfreed mem test...\n"); printf("Unfreed mem test...\n");
printf("You should see an \"UNfreed mem at line %d\" (at end) because of this\n",__LINE__+1); printf("You should see an \"UNfreed mem at line %d\" (at end) because of this\n",__LINE__+1);
shit = (unsigned char*)malloc(200); tmp = (unsigned char*)malloc(200);
printf("Buffer overrun test 1...\n"); printf("Buffer overrun test 1...\n");
printf("You should see an ERR:endPad here\n"); printf("You should see an ERR:endPad here\n");
shit = (unsigned char*)malloc(200); tmp = (unsigned char*)malloc(200);
shit[200] = 0xfa; tmp[200] = 0xfa;
free(shit); free(tmp);
printf("Buffer overrun test 2...\n"); printf("Buffer overrun test 2...\n");
printf("You should see an ERR:endPad here\n"); printf("You should see an ERR:endPad here\n");
shit = (unsigned char*)malloc(200); tmp = (unsigned char*)malloc(200);
shit[215] = 0xbb; tmp[215] = 0xbb;
free(shit); free(tmp);
printf("Buffer underrun test 1...\n"); printf("Buffer underrun test 1...\n");
printf("You should see an ERR:beginPad here\n"); printf("You should see an ERR:beginPad here\n");
shit = (unsigned char*)malloc(200); tmp = (unsigned char*)malloc(200);
shit[-10] = 0x0f; tmp[-10] = 0x0f;
free(shit); free(tmp);
printf("Buffer underrun test 2...\n"); printf("Buffer underrun test 2...\n");
printf("You should see an ERR:beginPad here\n"); printf("You should see an ERR:beginPad here\n");
shit = (unsigned char*)malloc(200); tmp = (unsigned char*)malloc(200);
shit[-1] = 0x00; tmp[-1] = 0x00;
free(shit); free(tmp);
zmalloc_check(); zmalloc_check();