Stop snooping at do_quit, added afk to prompt, g++ compiler cleanup (thanks Rhade), fixed locate object (thanks JamDog), and renamed immort_level_ok to no_mort_to_immort --Rumble

This commit is contained in:
Rumble 2007-03-18 16:10:10 +00:00
parent 86568f9d4d
commit 1f74a71456
18 changed files with 445 additions and 949 deletions

View file

@ -1,11 +1,18 @@
TbaMUD is currently being developed by The Builder Academy. If you need any
help, find any bugs, or have ideas for improvement please stop by TBA.
Rumble
The Builder Academy
builderacademy.net 9091
tbaMUD 3.52
[Mar 18 2007] - Rumble
Cleaned up the code by running it through a g++ compiler (thanks Rhade).
Added AFK to the prompt.
Stop snooping at do_quit to prevent snooping of passwords on deletion or password reset.
[Mar 17 2007] - Rumble
Fixed locate object spell (thanks JamDog).
Added plist and and improved history command (thanks Rhade).
Renamed immort_level_ok to no_mort_to_immort and rewrote the convuluted comments.
[Mar 04 2007] - Rumble
Fixed fight_messages not displaying (thanks Rhade).
Removed LVL_FREEZE and set ban/freeze to LVL_GRGOD.

View file

@ -1852,13 +1852,13 @@ ACMD(do_toggle)
{"holylight", PRF_HOLYLIGHT, LVL_IMMORT,
"HolyLight mode off.\r\n",
"HolyLight mode on.\r\n"},
{"slownameserver", -1, LVL_IMPL,
{"slownameserver", 0, LVL_IMPL,
"Nameserver_is_slow changed to OFF; IP addresses will now be resolved.\r\n",
"Nameserver_is_slow changed to ON; sitenames will no longer be resolved.\r\n"},
{"autoexits", PRF_AUTOEXIT, 0,
"Autoexits disabled.\r\n",
"Autoexits enabled.\r\n"},
{"trackthru", -1, LVL_IMPL,
{"trackthru", 0, LVL_IMPL,
"Players can no longer track through doors.\r\n",
"Players can now track through doors.\r\n"},
{"clsolc", PRF_CLS, LVL_BUILDER,
@ -1870,10 +1870,10 @@ ACMD(do_toggle)
{"afk", PRF_AFK, 0,
"AFK is now Off.\r\n",
"AFK is now On.\r\n"},
{"color", -1, 0, "\n", "\n"},
{"syslog", -1, LVL_IMMORT, "\n", "\n"},
{"wimpy", -1, 0, "\n", "\n"},
{"pagelength", -1, 0, "\n", "\n"},
{"color", 0, 0, "\n", "\n"},
{"syslog", 0, LVL_IMMORT, "\n", "\n"},
{"wimpy", 0, 0, "\n", "\n"},
{"pagelength", 0, 0, "\n", "\n"},
{"autoloot", PRF_AUTOLOOT, 0,
"Autoloot disabled.\r\n",
"Autoloot enabled.\r\n"},
@ -1889,7 +1889,7 @@ ACMD(do_toggle)
{"autoassist", PRF_AUTOASSIST, 0,
"Autoassist disabled.\r\n",
"Autoassist enabled.\r\n"},
{"\n", -1, -1, "\n", "\n"} /* must be last */
{"\n", 0, -1, "\n", "\n"} /* must be last */
};
len = strlen(arg);
@ -2141,12 +2141,12 @@ ACMD(do_history)
void add_history(struct char_data *ch, char *str, int type)
{
int i = 0;
struct txt_block *tmp = GET_HISTORY(ch, type);
char time_str[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH];
if (IS_NPC(ch))
return;
struct txt_block *tmp = GET_HISTORY(ch, type);
time_t ct = time(0);
strftime(time_str, sizeof(time_str), "%H:%M ", localtime(&ct));

View file

@ -1,5 +1,5 @@
/* ************************************************************************
* File: act.other.c Part of CircleMUD *
* File: act.other.c *
* Usage: Miscellaneous player-level commands *
* *
* All rights reserved. See license.doc for complete information. *
@ -12,7 +12,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"
@ -76,23 +75,26 @@ ACMD(do_quit)
mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, "%s has quit the game.", GET_NAME(ch));
send_to_char(ch, "Goodbye, friend.. Come back soon!\r\n");
/* We used to check here for duping attempts, but we may as well
* do it right in extract_char(), since there is no check if a
* player rents out and it can leave them in an equally screwy
* situation.
*/
/* We used to check here for duping attempts, but we may as well do it right
* in extract_char(), since there is no check if a player rents out and it
* can leave them in an equally screwy situation. */
if (CONFIG_FREE_RENT)
Crash_rentsave(ch, 0);
GET_LOADROOM(ch) = GET_ROOM_VNUM(IN_ROOM(ch));
/* Stop snooping so you can't see passwords during deletion or change. */
if (ch->desc->snoop_by) {
write_to_output(ch->desc->snoop_by, "Your victim is no longer among us.\r\n");
ch->desc->snoop_by->snooping = NULL;
ch->desc->snoop_by = NULL;
}
extract_char(ch); /* Char is saved before extracting. */
}
}
ACMD(do_save)
{
if (IS_NPC(ch) || !ch->desc)
@ -106,16 +108,13 @@ ACMD(do_save)
GET_LOADROOM(ch) = GET_ROOM_VNUM(IN_ROOM(ch));
}
/* generic function for commands which are normally overridden by
special procedures - i.e., shop commands, mail commands, etc. */
/* Generic function for commands which are normally overridden by special
* procedures - i.e., shop commands, mail commands, etc. */
ACMD(do_not_here)
{
send_to_char(ch, "Sorry, but you cannot do that here!\r\n");
}
ACMD(do_sneak)
{
struct affected_type af;
@ -142,8 +141,6 @@ ACMD(do_sneak)
affect_to_char(ch, &af);
}
ACMD(do_hide)
{
byte percent;
@ -166,9 +163,6 @@ ACMD(do_hide)
SET_BIT(AFF_FLAGS(ch), AFF_HIDE);
}
ACMD(do_steal)
{
struct char_data *vict;
@ -293,8 +287,6 @@ ACMD(do_steal)
hit(vict, ch, TYPE_UNDEFINED);
}
ACMD(do_practice)
{
char arg[MAX_INPUT_LENGTH];
@ -310,8 +302,6 @@ ACMD(do_practice)
list_skills(ch);
}
ACMD(do_visible)
{
if (GET_LEVEL(ch) >= LVL_IMMORT) {
@ -326,8 +316,6 @@ ACMD(do_visible)
send_to_char(ch, "You are already visible.\r\n");
}
ACMD(do_title)
{
skip_spaces(&argument);
@ -347,7 +335,6 @@ ACMD(do_title)
}
}
int perform_group(struct char_data *ch, struct char_data *vict)
{
if (AFF_FLAGGED(vict, AFF_GROUP) || !CAN_SEE(ch, vict))
@ -361,7 +348,6 @@ int perform_group(struct char_data *ch, struct char_data *vict)
return (1);
}
void print_group(struct char_data *ch)
{
struct char_data *k;
@ -394,8 +380,6 @@ void print_group(struct char_data *ch)
}
}
ACMD(do_group)
{
char buf[MAX_STRING_LENGTH];
@ -442,8 +426,6 @@ ACMD(do_group)
}
}
ACMD(do_ungroup)
{
char buf[MAX_INPUT_LENGTH];
@ -496,9 +478,6 @@ ACMD(do_ungroup)
stop_follower(tch);
}
ACMD(do_report)
{
char buf[MAX_STRING_LENGTH];
@ -527,8 +506,6 @@ ACMD(do_report)
send_to_char(ch, "You report to the group.\r\n");
}
ACMD(do_split)
{
char buf[MAX_INPUT_LENGTH];
@ -613,8 +590,6 @@ ACMD(do_split)
}
}
ACMD(do_use)
{
char buf[MAX_INPUT_LENGTH], arg[MAX_INPUT_LENGTH];
@ -641,10 +616,8 @@ ACMD(do_use)
return;
default:
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'.
*/
/* 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;
}
}
@ -722,8 +695,6 @@ ACMD(do_display)
send_to_char(ch, "%s", CONFIG_OK);
}
ACMD(do_gen_write)
{
FILE *fl;
@ -765,11 +736,9 @@ ACMD(do_gen_write)
if (stat(filename, &fbuf) < 0) {
perror("SYSERR: Can't stat() file");
/* SYSERR_DESC:
* This is from do_gen_write() and indicates that it cannot call the
* stat() system call on the file required. The error string at the
* end of the line should explain what the problem is.
*/
/* SYSERR_DESC: This is from do_gen_write() and indicates that it cannot
* call the stat() system call on the file required. The error string at
* the end of the line should explain what the problem is. */
return;
}
if (fbuf.st_size >= CONFIG_MAX_FILESIZE) {
@ -778,11 +747,9 @@ ACMD(do_gen_write)
}
if (!(fl = fopen(filename, "a"))) {
perror("SYSERR: do_gen_write");
/* SYSERR_DESC:
* This is from do_gen_write(), and will be output if the file in
* question cannot be opened for appending to. The error string
* at the end of the line should explain what the problem is.
*/
/* SYSERR_DESC: This is from do_gen_write(), and will be output if the file
* in question cannot be opened for appending to. The error string at the
* end of the line should explain what the problem is. */
send_to_char(ch, "Could not open the file. Sorry.\r\n");
return;
@ -795,9 +762,7 @@ ACMD(do_gen_write)
#define TOG_OFF 0
#define TOG_ON 1
#define PRF_TOG_CHK(ch,flag) ((TOGGLE_BIT(PRF_FLAGS(ch), (flag))) & (flag))
ACMD(do_gen_tog)
{
long result;
@ -845,7 +810,6 @@ ACMD(do_gen_tog)
"AFK flag is now on.\r\n"}
};
if (IS_NPC(ch))
return;

View file

@ -42,7 +42,7 @@ extern struct player_index_element *player_table;
/* external functions */
int level_exp(int chclass, int level);
void show_shops(struct char_data *ch, char *value);
void hcontrol_list_houses(struct char_data *ch);
void hcontrol_list_houses(struct char_data *ch, char *arg);
void do_start(struct char_data *ch);
void appear(struct char_data *ch);
void reset_zone(zone_rnum zone);
@ -50,7 +50,7 @@ void roll_real_abils(struct char_data *ch);
int parse_class(char arg);
void run_autowiz(void);
int save_all(void);
extern zone_rnum real_zone_by_thing(room_vnum vznum); /* added for zone_checker */
zone_rnum real_zone_by_thing(room_vnum vznum);
SPECIAL(shop_keeper);
void Crash_rentsave(struct char_data * ch, int cost);
void new_hist_messg(struct descriptor_data *d, const char *msg);
@ -2634,7 +2634,7 @@ ACMD(do_show)
/* show houses */
case 9:
hcontrol_list_houses(ch);
hcontrol_list_houses(ch, value);
break;
/* show snoop */
@ -4234,7 +4234,7 @@ ACMD(do_changelog)
}
#define PLIST_FORMAT \
"plist [minlev[-maxlev]] [-n name] [-d days] [-h hours] [-i] [-m]"
"Usage: plist [minlev[-maxlev]] [-n name] [-d days] [-h hours] [-i] [-m]"
ACMD(do_plist)
{
@ -4315,7 +4315,7 @@ ACMD(do_plist)
strcpy(time_str, asctime(localtime(&player_table[i].last)));
time_str[strlen(time_str) - 1] = '\0';
len += snprintf(buf + len, sizeof(buf) - len, "[%3ld] (%2d) %-12s %s\r\n",
len += snprintf(buf + len, sizeof(buf) - len, "[%3ld] (%2d) %-15s %s\r\n",
player_table[i].id, player_table[i].level,
CAP(strdup(player_table[i].name)), time_str);
count++;

View file

@ -41,9 +41,7 @@ ACMD(do_oasis_cedit)
struct descriptor_data *d;
char buf1[MAX_STRING_LENGTH];
/****************************************************************************/
/** Parse any arguments. **/
/****************************************************************************/
/* Parse any arguments. */
one_argument(argument, buf1);
if (GET_LEVEL(ch) < LVL_IMPL) {
@ -76,21 +74,13 @@ ACMD(do_oasis_cedit)
cedit_save_to_disk();
}
/*-------------------------------------------------------------------*/
void cedit_setup(struct descriptor_data *d)
{
/****************************************************************************/
/** Create the config_data struct. **/
/****************************************************************************/
/* Create the config_data struct. */
CREATE(OLC_CONFIG(d), struct config_data, 1);
/****************************************************************************/
/** Copy the current configuration from the config_info to this one. **/
/****************************************************************************/
/****************************************************************************/
/** Copy the game play options from the configuration info struct. **/
/****************************************************************************/
/* Copy the current configuration from the config_info to this one and copy
* the game play options from the configuration info struct. */
OLC_CONFIG(d)->play.pk_allowed = CONFIG_PK_ALLOWED;
OLC_CONFIG(d)->play.pt_allowed = CONFIG_PT_ALLOWED;
OLC_CONFIG(d)->play.level_can_shout = CONFIG_LEVEL_CAN_SHOUT;
@ -106,11 +96,9 @@ void cedit_setup(struct descriptor_data *d)
OLC_CONFIG(d)->play.dts_are_dumps = CONFIG_DTS_ARE_DUMPS;
OLC_CONFIG(d)->play.load_into_inventory = CONFIG_LOAD_INVENTORY;
OLC_CONFIG(d)->play.track_through_doors = CONFIG_TRACK_T_DOORS;
OLC_CONFIG(d)->play.immort_level_ok = CONFIG_IMMORT_LEVEL_OK;
OLC_CONFIG(d)->play.no_mort_to_immort = CONFIG_NO_MORT_TO_IMMORT;
/****************************************************************************/
/** Crash Saves **/
/****************************************************************************/
/* Crash Saves */
OLC_CONFIG(d)->csd.free_rent = CONFIG_FREE_RENT;
OLC_CONFIG(d)->csd.max_obj_save = CONFIG_MAX_OBJ_SAVE;
OLC_CONFIG(d)->csd.min_rent_cost = CONFIG_MIN_RENT_COST;
@ -119,9 +107,7 @@ void cedit_setup(struct descriptor_data *d)
OLC_CONFIG(d)->csd.crash_file_timeout = CONFIG_CRASH_TIMEOUT;
OLC_CONFIG(d)->csd.rent_file_timeout = CONFIG_RENT_TIMEOUT;
/****************************************************************************/
/** Room Numbers **/
/****************************************************************************/
/* Room Numbers */
OLC_CONFIG(d)->room_nums.mortal_start_room = CONFIG_MORTAL_START;
OLC_CONFIG(d)->room_nums.immort_start_room = CONFIG_IMMORTAL_START;
OLC_CONFIG(d)->room_nums.frozen_start_room = CONFIG_FROZEN_START;
@ -129,9 +115,7 @@ void cedit_setup(struct descriptor_data *d)
OLC_CONFIG(d)->room_nums.donation_room_2 = CONFIG_DON_ROOM_2;
OLC_CONFIG(d)->room_nums.donation_room_3 = CONFIG_DON_ROOM_3;
/****************************************************************************/
/** Game Operation **/
/****************************************************************************/
/* Game Operation */
OLC_CONFIG(d)->operation.DFLT_PORT = CONFIG_DFLT_PORT;
OLC_CONFIG(d)->operation.max_playing = CONFIG_MAX_PLAYING;
OLC_CONFIG(d)->operation.max_filesize = CONFIG_MAX_FILESIZE;
@ -141,16 +125,12 @@ void cedit_setup(struct descriptor_data *d)
OLC_CONFIG(d)->operation.auto_save_olc = CONFIG_OLC_SAVE;
OLC_CONFIG(d)->operation.nameserver_is_slow = CONFIG_NS_IS_SLOW;
/****************************************************************************/
/** Autowiz **/
/****************************************************************************/
/* Autowiz */
OLC_CONFIG(d)->autowiz.use_autowiz = CONFIG_USE_AUTOWIZ;
OLC_CONFIG(d)->autowiz.min_wizlist_lev = CONFIG_MIN_WIZLIST_LEV;
/****************************************************************************/
/** Allocate space for the strings. **/
/****************************************************************************/
/* Allocate space for the strings. */
OLC_CONFIG(d)->play.OK = str_udup(CONFIG_OK);
OLC_CONFIG(d)->play.NOPERSON = str_udup(CONFIG_NOPERSON);
OLC_CONFIG(d)->play.NOEFFECT = str_udup(CONFIG_NOEFFECT);
@ -188,15 +168,11 @@ void cedit_setup(struct descriptor_data *d)
cedit_disp_menu(d);
}
/******************************************************************************/
void cedit_save_internally(struct descriptor_data *d)
{
/* see if we need to reassign spec procs on rooms */
int reassign = (CONFIG_DTS_ARE_DUMPS != OLC_CONFIG(d)->play.dts_are_dumps);
/****************************************************************************/
/** Copy the data back from the descriptor to the config_info structure. **/
/****************************************************************************/
/* Copy the data back from the descriptor to the config_info structure. */
CONFIG_PK_ALLOWED = OLC_CONFIG(d)->play.pk_allowed;
CONFIG_PT_ALLOWED = OLC_CONFIG(d)->play.pt_allowed;
CONFIG_LEVEL_CAN_SHOUT = OLC_CONFIG(d)->play.level_can_shout;
@ -212,11 +188,9 @@ void cedit_save_internally(struct descriptor_data *d)
CONFIG_DTS_ARE_DUMPS = OLC_CONFIG(d)->play.dts_are_dumps;
CONFIG_LOAD_INVENTORY = OLC_CONFIG(d)->play.load_into_inventory;
CONFIG_TRACK_T_DOORS = OLC_CONFIG(d)->play.track_through_doors;
CONFIG_IMMORT_LEVEL_OK = OLC_CONFIG(d)->play.immort_level_ok;
CONFIG_NO_MORT_TO_IMMORT = OLC_CONFIG(d)->play.no_mort_to_immort;
/****************************************************************************/
/** Crash Saves **/
/****************************************************************************/
/* Crash Saves */
CONFIG_FREE_RENT = OLC_CONFIG(d)->csd.free_rent;
CONFIG_MAX_OBJ_SAVE = OLC_CONFIG(d)->csd.max_obj_save;
CONFIG_MIN_RENT_COST = OLC_CONFIG(d)->csd.min_rent_cost;
@ -225,9 +199,7 @@ void cedit_save_internally(struct descriptor_data *d)
CONFIG_CRASH_TIMEOUT = OLC_CONFIG(d)->csd.crash_file_timeout;
CONFIG_RENT_TIMEOUT = OLC_CONFIG(d)->csd.rent_file_timeout;
/****************************************************************************/
/** Room Numbers **/
/****************************************************************************/
/* Room Numbers */
CONFIG_MORTAL_START = OLC_CONFIG(d)->room_nums.mortal_start_room;
CONFIG_IMMORTAL_START = OLC_CONFIG(d)->room_nums.immort_start_room;
CONFIG_FROZEN_START = OLC_CONFIG(d)->room_nums.frozen_start_room;
@ -235,9 +207,7 @@ void cedit_save_internally(struct descriptor_data *d)
CONFIG_DON_ROOM_2 = OLC_CONFIG(d)->room_nums.donation_room_2;
CONFIG_DON_ROOM_3 = OLC_CONFIG(d)->room_nums.donation_room_3;
/****************************************************************************/
/** Game Operation **/
/****************************************************************************/
/* Game Operation */
CONFIG_DFLT_PORT = OLC_CONFIG(d)->operation.DFLT_PORT;
CONFIG_MAX_PLAYING = OLC_CONFIG(d)->operation.max_playing;
CONFIG_MAX_FILESIZE = OLC_CONFIG(d)->operation.max_filesize;
@ -247,15 +217,11 @@ void cedit_save_internally(struct descriptor_data *d)
CONFIG_NS_IS_SLOW = OLC_CONFIG(d)->operation.nameserver_is_slow;
CONFIG_OLC_SAVE = OLC_CONFIG(d)->operation.auto_save_olc;
/****************************************************************************/
/** Autowiz **/
/****************************************************************************/
/* Autowiz */
CONFIG_USE_AUTOWIZ = OLC_CONFIG(d)->autowiz.use_autowiz;
CONFIG_MIN_WIZLIST_LEV = OLC_CONFIG(d)->autowiz.min_wizlist_lev;
/****************************************************************************/
/** Allocate space for the strings. **/
/****************************************************************************/
/* Allocate space for the strings. */
if (CONFIG_OK)
free(CONFIG_OK);
CONFIG_OK = str_udup(OLC_CONFIG(d)->play.OK);
@ -275,7 +241,6 @@ void cedit_save_internally(struct descriptor_data *d)
else
CONFIG_DFLT_IP = NULL;
if (CONFIG_DFLT_DIR)
free(CONFIG_DFLT_DIR);
if (OLC_CONFIG(d)->operation.DFLT_DIR)
@ -318,18 +283,12 @@ void cedit_save_internally(struct descriptor_data *d)
add_to_save_list(NOWHERE, SL_CFG);
}
/******************************************************************************/
void cedit_save_to_disk( void )
{
/****************************************************************************/
/** Just call save_config and get it over with. **/
/****************************************************************************/
/* Just call save_config and get it over with. */
save_config( NOWHERE );
}
/******************************************************************************/
int save_config( IDXTYPE nowhere )
{
FILE *fl;
@ -385,7 +344,7 @@ int save_config( IDXTYPE nowhere )
fprintf(fl, "* Should PC's be able to track through hidden or closed doors?\n"
"track_through_doors = %d\n\n", CONFIG_TRACK_T_DOORS);
fprintf(fl, "* Should players who reach enough exp automatically level to immortal?\n"
"immort_level_ok = %d\n\n", CONFIG_IMMORT_LEVEL_OK);
"no_mort_to_immort = %d\n\n", CONFIG_NO_MORT_TO_IMMORT);
strcpy(buf, CONFIG_OK);
strip_cr(buf);
@ -405,11 +364,7 @@ int save_config( IDXTYPE nowhere )
fprintf(fl, "* Text sent to players when an effect fails.\n"
"noeffect = %s\n", buf);
/************************************************************************
** RENT / CRASHSAVE OPTIONS **
************************************************************************/
/* RENT / CRASHSAVE OPTIONS */
fprintf(fl, "\n\n\n* [ Rent/Crashsave Options ]\n");
fprintf(fl, "* Should the MUD allow you to 'rent' for free? (i.e. if you just quit,\n"
@ -431,10 +386,7 @@ int save_config( IDXTYPE nowhere )
fprintf(fl, "* Lifetime of normal rent files in days.\n"
"rent_file_timeout = %d\n\n", CONFIG_RENT_TIMEOUT);
/************************************************************************
** ROOM NUMBERS **
************************************************************************/
/* ROOM NUMBERS */
fprintf(fl, "\n\n\n* [ Room Numbers ]\n");
fprintf(fl, "* The virtual number of the room that mortals should enter at.\n"
@ -562,13 +514,7 @@ int save_config( IDXTYPE nowhere )
return (TRUE);
}
/**************************************************************************
Menu functions
**************************************************************************/
/*
* the main menu
*/
/* Menu functions - The main menu. */
void cedit_disp_menu(struct descriptor_data *d)
{
get_char_colors(d->character);
@ -598,7 +544,6 @@ void cedit_disp_menu(struct descriptor_data *d)
OLC_MODE(d) = CEDIT_MAIN_MENU;
}
/*-------------------------------------------------------------------*/
void cedit_disp_game_play_options(struct descriptor_data *d)
{
get_char_colors(d->character);
@ -642,7 +587,7 @@ void cedit_disp_game_play_options(struct descriptor_data *d)
grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.dts_are_dumps),
grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.load_into_inventory),
grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.track_through_doors),
grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.immort_level_ok),
grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.no_mort_to_immort),
grn, nrm, cyn, OLC_CONFIG(d)->play.OK,
grn, nrm, cyn, OLC_CONFIG(d)->play.NOPERSON,
@ -654,8 +599,6 @@ void cedit_disp_game_play_options(struct descriptor_data *d)
OLC_MODE(d) = CEDIT_GAME_OPTIONS_MENU;
}
/*-------------------------------------------------------------------*/
void cedit_disp_crash_save_options(struct descriptor_data *d)
{
get_char_colors(d->character);
@ -684,8 +627,6 @@ void cedit_disp_crash_save_options(struct descriptor_data *d)
OLC_MODE(d) = CEDIT_CRASHSAVE_OPTIONS_MENU;
}
/*-------------------------------------------------------------------*/
void cedit_disp_room_numbers(struct descriptor_data *d)
{
get_char_colors(d->character);
@ -712,9 +653,6 @@ void cedit_disp_room_numbers(struct descriptor_data *d)
OLC_MODE(d) = CEDIT_ROOM_NUMBERS_MENU;
}
/*-------------------------------------------------------------------*/
void cedit_disp_operation_options(struct descriptor_data *d)
{
get_char_colors(d->character);
@ -757,9 +695,6 @@ void cedit_disp_operation_options(struct descriptor_data *d)
OLC_MODE(d) = CEDIT_OPERATION_OPTIONS_MENU;
}
/*-------------------------------------------------------------------*/
void cedit_disp_autowiz_options(struct descriptor_data *d)
{
get_char_colors(d->character);
@ -778,12 +713,7 @@ void cedit_disp_autowiz_options(struct descriptor_data *d)
OLC_MODE(d) = CEDIT_AUTOWIZ_OPTIONS_MENU;
}
/*-------------------------------------------------------------------*/
/**************************************************************************
The GARGANTAUN event handler
**************************************************************************/
/* The GARGANTAUN event handler */
void cedit_parse(struct descriptor_data *d, char *arg)
{
char *oldtext = NULL;
@ -814,8 +744,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
return;
}
/*-------------------------------------------------------------------*/
case CEDIT_MAIN_MENU:
switch (*arg) {
case 'g':
@ -861,9 +789,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_GAME_OPTIONS_MENU:
switch (*arg) {
case 'a':
@ -953,7 +878,7 @@ void cedit_parse(struct descriptor_data *d, char *arg)
case 'p':
case 'P':
TOGGLE_VAR(OLC_CONFIG(d)->play.immort_level_ok);
TOGGLE_VAR(OLC_CONFIG(d)->play.no_mort_to_immort);
break;
case '1':
@ -984,8 +909,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
cedit_disp_game_play_options(d);
return;
/*-------------------------------------------------------------------*/
case CEDIT_CRASHSAVE_OPTIONS_MENU:
switch (*arg) {
case 'a':
@ -1040,8 +963,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
cedit_disp_crash_save_options(d);
return;
/*-------------------------------------------------------------------*/
case CEDIT_ROOM_NUMBERS_MENU:
switch (*arg) {
case 'a':
@ -1089,8 +1010,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
cedit_disp_room_numbers(d);
return;
/*-------------------------------------------------------------------*/
case CEDIT_OPERATION_OPTIONS_MENU:
switch (*arg) {
case 'a':
@ -1214,8 +1133,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
cedit_disp_operation_options(d);
return;
/*-------------------------------------------------------------------*/
case CEDIT_AUTOWIZ_OPTIONS_MENU:
switch (*arg) {
case 'a':
@ -1241,8 +1158,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
cedit_disp_autowiz_options(d);
return;
/*-------------------------------------------------------------------*/
case CEDIT_LEVEL_CAN_SHOUT:
if (!*arg) {
write_to_output(d,
@ -1254,8 +1169,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_HOLLER_MOVE_COST:
if (!*arg) {
write_to_output(d,
@ -1267,8 +1180,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_TUNNEL_SIZE:
if (!*arg) {
write_to_output(d,
@ -1280,8 +1191,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_MAX_EXP_GAIN:
if (*arg)
OLC_CONFIG(d)->play.max_exp_gain = atoi(arg);
@ -1289,8 +1198,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
cedit_disp_game_play_options(d);
break;
/*-------------------------------------------------------------------*/
case CEDIT_MAX_EXP_LOSS:
if (*arg)
OLC_CONFIG(d)->play.max_exp_loss = atoi(arg);
@ -1298,9 +1205,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
cedit_disp_game_play_options(d);
break;
/*-------------------------------------------------------------------*/
case CEDIT_MAX_NPC_CORPSE_TIME:
if (!*arg) {
write_to_output(d,
@ -1312,8 +1216,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_MAX_PC_CORPSE_TIME:
if (!*arg) {
write_to_output(d,
@ -1325,8 +1227,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_IDLE_VOID:
if (!*arg) {
write_to_output(d,
@ -1338,8 +1238,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_IDLE_RENT_TIME:
if (!*arg) {
write_to_output(d,
@ -1351,8 +1249,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_IDLE_MAX_LEVEL:
if (!*arg) {
write_to_output(d,
@ -1364,8 +1260,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_OK:
if (!genolc_checkstring(d, arg))
break;
@ -1379,8 +1273,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
cedit_disp_game_play_options(d);
break;
/*-------------------------------------------------------------------*/
case CEDIT_NOPERSON:
if (!genolc_checkstring(d, arg))
break;
@ -1394,8 +1286,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
cedit_disp_game_play_options(d);
break;
/*-------------------------------------------------------------------*/
case CEDIT_NOEFFECT:
if (!genolc_checkstring(d, arg))
break;
@ -1409,8 +1299,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
cedit_disp_game_play_options(d);
break;
/*-------------------------------------------------------------------*/
case CEDIT_MAX_OBJ_SAVE:
if (!*arg) {
write_to_output(d,
@ -1422,8 +1310,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_MIN_RENT_COST:
if (!*arg) {
write_to_output(d,
@ -1435,8 +1321,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_AUTOSAVE_TIME:
if (!*arg) {
write_to_output(d,
@ -1448,8 +1332,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_CRASH_FILE_TIMEOUT:
if (!*arg) {
write_to_output(d,
@ -1461,8 +1343,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_RENT_FILE_TIMEOUT:
if (!*arg) {
write_to_output(d,
@ -1474,8 +1354,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_MORTAL_START_ROOM:
if (!*arg) {
write_to_output(d,
@ -1491,8 +1369,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_IMMORT_START_ROOM:
if (!*arg) {
write_to_output(d,
@ -1508,8 +1384,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_FROZEN_START_ROOM:
if (!*arg) {
write_to_output(d,
@ -1525,8 +1399,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_DONATION_ROOM_1:
if (!*arg) {
write_to_output(d,
@ -1542,8 +1414,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_DONATION_ROOM_2:
if (!*arg) {
write_to_output(d,
@ -1559,8 +1429,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_DONATION_ROOM_3:
if (!*arg) {
write_to_output(d,
@ -1576,15 +1444,11 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_DFLT_PORT:
OLC_CONFIG(d)->operation.DFLT_PORT = atoi(arg);
cedit_disp_operation_options(d);
break;
/*-------------------------------------------------------------------*/
case CEDIT_DFLT_IP:
if (!*arg) {
write_to_output(d,
@ -1596,8 +1460,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_DFLT_DIR:
if (!*arg) {
write_to_output(d,
@ -1609,8 +1471,6 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_LOGNAME:
if (!*arg) {
write_to_output(d,
@ -1622,29 +1482,21 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
case CEDIT_MAX_PLAYING:
OLC_CONFIG(d)->operation.max_playing = atoi(arg);
cedit_disp_operation_options(d);
break;
/*-------------------------------------------------------------------*/
case CEDIT_MAX_FILESIZE:
OLC_CONFIG(d)->operation.max_filesize = atoi(arg);
cedit_disp_operation_options(d);
break;
/*-------------------------------------------------------------------*/
case CEDIT_MAX_BAD_PWS:
OLC_CONFIG(d)->operation.max_bad_pws = atoi(arg);
cedit_disp_operation_options(d);
break;
/*-------------------------------------------------------------------*/
case CEDIT_MIN_WIZLIST_LEV:
if (atoi(arg) > LVL_IMPL) {
write_to_output(d,
@ -1656,22 +1508,14 @@ void cedit_parse(struct descriptor_data *d, char *arg)
}
break;
/*-------------------------------------------------------------------*/
default:
/*
* We should never get here, but just in case...
*/
default: /* We should never get here, but just in case... */
cleanup_olc(d, CLEANUP_CONFIG);
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: cedit_parse(): Reached default case!");
write_to_output(d, "Oops...\r\n");
break;
}
}
} /* End of parse_cedit() */
/*
* End of parse_cedit()
*/
void reassign_rooms(void)
{
void assign_rooms(void);

View file

@ -1219,6 +1219,12 @@ char *make_prompt(struct descriptor_data *d)
len += count;
}
if (PRF_FLAGGED(d->character, PRF_AFK) && len < sizeof(prompt)) {
count = snprintf(prompt + len, sizeof(prompt) - len, "AFK ");
if (count >= 0)
len += count;
}
if (len < sizeof(prompt))
strncat(prompt, "> ", sizeof(prompt) - len - 1); /* strncat: OK */
} else if (STATE(d) == CON_PLAYING && IS_NPC(d->character))

View file

@ -13,37 +13,26 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "interpreter.h" /* alias_data definition for structs.h */
/*
* Update: The following constants and variables are now the default values
/* Update: The following constants and variables are now the default values
* for backwards compatibility with the new cedit game configurator. If you
* would not like to use the cedit command, you can change the values in
* this file instead. - Mythran
*/
/*
* Below are several constants which you can change to alter certain aspects
* this file instead. - Mythran */
/* Below are several constants which you can change to alter certain aspects
* of the way CircleMUD acts. Since this is a .c file, all you have to do
* to change one of the constants (assuming you keep your object files around)
* is change the constant in this file and type 'make'. Make will recompile
* this file and relink; you don't have to wait for the whole thing to
* recompile as you do if you change a header file.
*
* I realize that it would be slightly more efficient to have lots of
* #defines strewn about, so that, for example, the autowiz code isn't
* compiled at all if you don't want to use autowiz. However, the actual
* code for the various options is quite small, as is the computational time
* in checking the option you've selected at run-time, so I've decided the
* convenience of having all your options in this one file outweighs the
* efficency of doing it the other way.
*
*/
/****************************************************************************/
/****************************************************************************/
* this file and relink; you don't have to wait for the whole thing to recompile
* as you do if you change a header file. I realize that it would be slightly
* more efficient to have lots of #defines strewn about, so that, for example,
* the autowiz code isn't compiled at all if you don't want to use autowiz.
* However, the actual code for the various options is quite small, as is the
* computational time in checking the option you've selected at run-time, so
* I've decided the convenience of having all your options in this one file
* outweighs the efficency of doing it the other way. */
/* GAME PLAY OPTIONS */
#if !defined(NO)
@ -62,34 +51,31 @@
#define TRUE (!FALSE)
#endif
/*
* pk_allowed sets the tone of the entire game. If pk_allowed is set to
* NO, then players will not be allowed to kill, summon, charm, or sleep
* other players, as well as a variety of other "asshole player" protections.
* However, if you decide you want to have an all-out knock-down drag-out
* PK Mud, just set pk_allowed to YES - and anything goes.
*/
/* pk_allowed sets the tone of the entire game. If pk_allowed is set to NO,
* then players will not be allowed to kill, summon, charm, or sleep other
* players, as well as a variety of other "asshole player" protections. However,
* if you decide you want to have an all-out knock-down drag-out PK Mud, just
* set pk_allowed to YES - and anything goes. */
int pk_allowed = NO;
/* is playerthieving allowed? */
/* Is playerthieving allowed? */
int pt_allowed = NO;
/* minimum level a player must be to shout/holler/gossip/auction */
/* Minimum level a player must be to shout/holler/gossip/auction. */
int level_can_shout = 1;
/* number of movement points it costs to holler */
/* Number of movement points it costs to holler. */
int holler_move_cost = 20;
/* how many people can get into a tunnel? The default is two, but there
* is also an alternate message in the case of one person being allowed.
*/
/* How many people can get into a tunnel? The default is two, but there is
* also an alternate message in the case of one person being allowed. */
int tunnel_size = 2;
/* exp change limits */
/* Exp change limits. */
int max_exp_gain = 100000; /* max gainable per kill */
int max_exp_loss = 500000; /* max losable per death */
/* number of tics (usually 75 seconds) before PC/NPC corpses decompose */
/* Number of tics (usually 75 seconds) before PC/NPC corpses decompose. */
int max_npc_corpse_time = 5;
int max_pc_corpse_time = 10;
@ -100,16 +86,14 @@ int idle_rent_time = 48;
/* This level and up is immune to idling, LVL_IMPL+1 will disable it. */
int idle_max_level = LVL_GOD;
/* should items in death traps automatically be junked? */
/* Should items in death traps automatically be junked? */
int dts_are_dumps = YES;
/*
* Whether you want items that immortals load to appear on the ground or not.
/* Whether you want items that immortals load to appear on the ground or not.
* It is most likely best to set this to 'YES' so that something else doesn't
* grab the item before the immortal does, but that also means people will be
* able to carry around things like boards. That's not necessarily a bad
* thing, but this will be left at a default of 'NO' for historic reasons.
*/
* able to carry around things like boards. That's not necessarily a bad thing,
* but this will be left at a default of 'NO' for historic reasons. */
int load_into_inventory = YES;
/* "okay" etc. */
@ -117,92 +101,67 @@ const char *OK = "Okay.\r\n";
const char *NOPERSON = "No-one by that name here.\r\n";
const char *NOEFFECT = "Nothing seems to happen.\r\n";
/*
* You can define or not define TRACK_THOUGH_DOORS, depending on whether
* or not you want track to find paths which lead through closed or
* hidden doors. A setting of 'NO' means to not go through the doors
* while 'YES' will pass through doors to find the target.
*/
/* You can define or not define TRACK_THOUGH_DOORS, depending on whether or not
* you want track to find paths which lead through closed or hidden doors. A
* setting of 'NO' means to not go through the doors while 'YES' will pass
* through doors to find the target. */
int track_through_doors = YES;
/*
* If you want mortals to level up to immortal once they have enough
* experience, then set this to NO. This is the stock behaviour for
* CircleMUD because it was the stock DikuMud behaviour. Subtracting
* this from LVL_IMMORT gives the top level that people can advance to
* in gain_exp() in limits.c
* For example, to stop people from advancing to LVL_IMMORT, simply set
* immort_level_ok to YES.
*/
int immort_level_ok = NO;
/****************************************************************************/
/****************************************************************************/
/* If you do not want mortals to level up to immortal once they have enough
* experience, then set this to YES. Subtracting this from LVL_IMMORT gives
* the top level that people can advance to in gain_exp() in limits.c */
int no_mort_to_immort = YES;
/* RENT/CRASHSAVE OPTIONS */
/*
* Should the MUD allow you to 'rent' for free? (i.e. if you just quit,
* your objects are saved at no cost, as in Merc-type MUDs.)
*/
/* Should the MUD allow you to 'rent' for free? (i.e. if you just quit, your
* objects are saved at no cost). */
int free_rent = YES;
/* maximum number of items players are allowed to rent */
/* Maximum number of items players are allowed to rent. */
int max_obj_save = 30;
/* receptionist's surcharge on top of item costs */
/* Receptionist's surcharge on top of item costs. */
int min_rent_cost = 100;
/*
* Should the game automatically save people? (i.e., save player data
* every 4 kills (on average), and Crash-save as defined below. This
* option has an added meaning past bpl13. If auto_save is YES, then
* the 'save' command will be disabled to prevent item duplication via
* game crashes.
*/
/* Should the game automatically save people? (i.e., save player data every 4
* kills (on average), and Crash-save as defined below. If auto_save is YES,
* then the 'save' command will be disabled to prevent item duplication via
* game crashes. */
int auto_save = YES;
/*
* if auto_save (above) is yes, how often (in minutes) should the MUD
* Crash-save people's objects? Also, this number indicates how often
* the MUD will Crash-save players' houses.
*/
/* if auto_save (above) is yes, how often (in minutes) should the MUD Crash-save
* people's objects? Also, this number indicates how often the MUD will Crash-
* save players' houses. */
int autosave_time = 5;
/* Lifetime of crashfiles and forced-rent (idlesave) files in days */
/* Lifetime of crashfiles and forced-rent (idlesave) files in days. */
int crash_file_timeout = 10;
/* Lifetime of normal rent files in days */
/* Lifetime of normal rent files in days. */
int rent_file_timeout = 30;
/* Do you want to automatically wipe players who've been gone too long? */
int auto_pwipe = NO;
/* Autowipe deletion criteria
This struct holds information used to determine which players to wipe
then the mud boots. The levels must be in ascending order, with a
descending level marking the end of the array. A level -1 entry in the
beginning is the case for players with the PLR_DELETED flag. The
values below match the stock purgeplay.c criteria.
/* Autowipe deletion criteria. This struct holds information used to determine
* which players to wipe when the mud boots. The levels must be in ascending
* order, with a descending level marking the end of the array. A level -1
* entry in the beginning is the case for players with the PLR_DELETED flag.
* The values below match the stock purgeplay.c criteria.
Detailed explanation by array element:
* Element 0, level -1, days 0: Players with PLR_DELETED flag are always wiped
* Element 1, level 0, days 0: Players at level 0 have created a
character, but have never actually entered the game, so always
wipe them.
* Element 2, level 1, days 4: Players at level 1 are wiped if they
haven't logged on in the past 4 days.
* Element 3, level 4, days 7: Players level 2 through 4 are wiped if
they haven't logged on in the past 7 days.
* Element 1, level 0, days 0: Players at level 0 have created a character,
but have never actually entered the game, so always wipe them.
* Element 2, level 1, days 4: Players at level 1 are wiped if they haven't
logged on in the past 4 days.
* Element 3, level 4, days 7: Players level 2 through 4 are wiped if they
haven't logged on in the past 7 days.
* Element 4, level 10, days 30: Players level 5-10 get 30 days.
* Element 5, level LVL_IMMORT - 1, days 60: All other mortals get
60 days.
* Element 5, level LVL_IMMORT - 1, days 60: All other mortals get 60 days.
* Element 6, level LVL_IMPL, days 90: Immortals get 90 days.
* Element 7: Because -2 is less than LVL_IMPL, this is assumed to
be the end of the criteria. The days entry is not used in this
case.
*/
* Element 7: Because -2 is less than LVL_IMPL, this is assumed to be the end
of the criteria. The days entry is not used in this case. */
struct pclean_criteria_data pclean_criteria[] = {
/* LEVEL DAYS */
{ 0 ,0 }, /* level 0 */
@ -214,126 +173,89 @@ struct pclean_criteria_data pclean_criteria[] = {
{ -1 ,0 } /* no more level checks */
};
/* Do you want players who self-delete to be wiped immediately with no
backup?
*/
/* Do you want players who self-delete to be wiped immediately with no backup? */
int selfdelete_fastwipe = YES;
/****************************************************************************/
/****************************************************************************/
/* ROOM NUMBERS */
/* virtual number of room that mortals should enter at */
/* Virtual number of room that mortals should enter at. */
room_vnum mortal_start_room = 3001;
/* virtual number of room that immorts should enter at by default */
/* Virtual number of room that immorts should enter at by default. */
room_vnum immort_start_room = 1204;
/* virtual number of room that frozen players should enter at */
/* Virtual number of room that frozen players should enter at. */
room_vnum frozen_start_room = 1202;
/*
* virtual numbers of donation rooms. note: you must change code in
* do_drop of act.item.c if you change the number of non-NOWHERE
* donation rooms.
*/
/* Virtual numbers of donation rooms. note: you must change code in do_drop of
* act.item.c if you change the number of non-NOWHERE donation rooms. */
room_vnum donation_room_1 = 3063;
room_vnum donation_room_2 = 5510;
room_vnum donation_room_3 = 235;
/****************************************************************************/
/****************************************************************************/
/* GAME OPERATION OPTIONS */
/*
* This is the default port on which the game should run if no port is
* given on the command-line. NOTE WELL: If you're using the
* 'autorun' script, the port number there will override this setting.
* Change the PORT= line in autorun instead of (or in addition to)
* changing this.
*/
/* This is the default port on which the game should run if no port is given on
* the command-line. NOTE WELL: If you're using the 'autorun' script, the port
* number there will override this setting. Change the PORT= line in autorun
* instead of (or in addition to) changing this. */
ush_int DFLT_PORT = 4000;
/*
* IP address to which the MUD should bind. This is only useful if
* you're running Circle on a host that host more than one IP interface,
* and you only want to bind to *one* of them instead of all of them.
* Setting this to NULL (the default) causes Circle to bind to all
* interfaces on the host. Otherwise, specify a numeric IP address in
* dotted quad format, and Circle will only bind to that IP address. (Of
* course, that IP address must be one of your host's interfaces, or it
* won't work.)
*/
/* IP address to which the MUD should bind. This is only useful if you're
* running Circle on a host that host more than one IP interface, and you only
* want to bind to *one* of them instead of all of them. Setting this to NULL
* (the default) causes Circle to bind to all interfaces on the host.
* Otherwise, specify a numeric IP address in dotted quad format, and Circle
* will only bind to that IP address. (Of course, that IP address must be one
* of your host's interfaces, or it won't work.) */
const char *DFLT_IP = NULL; /* bind to all interfaces */
/* const char *DFLT_IP = "192.168.1.1"; -- bind only to one interface */
/* default directory to use as data directory */
/* Default directory to use as data directory. */
const char *DFLT_DIR = "lib";
/*
* What file to log messages to (ex: "log/syslog"). Setting this to NULL
* means you want to log to stderr, which was the default in earlier
* versions of Circle. If you specify a file, you don't get messages to
* the screen. (Hint: Try 'tail -f' if you have a UNIX machine.)
*/
/* What file to log messages to (ex: "log/syslog"). Setting this to NULL means
* you want to log to stderr, which was the default in earlier versions of
* Circle. If you specify a file, you don't get messages to the screen. (Hint:
* Try 'tail -f' if you have a UNIX machine.) */
const char *LOGNAME = NULL;
/* const char *LOGNAME = "log/syslog"; -- useful for Windows users */
/* maximum number of players allowed before game starts to turn people away */
/* Maximum number of players allowed before game starts to turn people away. */
int max_playing = 300;
/* maximum size of bug, typo and idea files in bytes (to prevent bombing) */
/* Maximum size of bug, typo and idea files in bytes (to prevent bombing). */
int max_filesize = 50000;
/* maximum number of password attempts before disconnection */
/* Maximum number of password attempts before disconnection. */
int max_bad_pws = 3;
/*
* Rationale for enabling this, as explained by naved@bird.taponline.com.
*
/* Rationale for enabling this, as explained by naved@bird.taponline.com.
* Usually, when you select ban a site, it is because one or two people are
* causing troubles while there are still many people from that site who you
* want to still log on. Right now if I want to add a new select ban, I need
* to first add the ban, then SITEOK all the players from that site except for
* the one or two who I don't want logging on. Wouldn't it be more convenient
* to just have to remove the SITEOK flags from those people I want to ban
* rather than what is currently done?
*/
* rather than what is currently done? */
int siteok_everyone = TRUE;
/*
* Some nameservers are very slow and cause the game to lag terribly every
* time someone logs in. The lag is caused by the gethostbyaddr() function
* which is responsible for resolving numeric IP addresses to alphabetic names.
/* Some nameservers are very slow and cause the game to lag terribly every time
* someone logs in. The lag is caused by the gethostbyaddr() function which is
* responsible for resolving numeric IP addresses to alphabetic names.
* Sometimes, nameservers can be so slow that the incredible lag caused by
* gethostbyaddr() isn't worth the luxury of having names instead of numbers
* for players' sitenames.
*
* If your nameserver is fast, set the variable below to NO. If your
* nameserver is slow, of it you would simply prefer to have numbers
* instead of names for some other reason, set the variable to YES.
*
* You can experiment with the setting of nameserver_is_slow on-line using
* the SLOWNS command from within the MUD.
*/
* for players' sitenames. If your nameserver is fast, set the variable below
* to NO. If your nameserver is slow, of it you would simply prefer to have
* numbers instead of names for some other reason, set the variable to YES.
* You can experiment with the setting of nameserver_is_slow on-line using the
* SLOWNS command from within the MUD. */
int nameserver_is_slow = NO;
/*
* Will changes save automaticaly in OLC ?
*/
/* Will changes save automaticaly in OLC? */
int auto_save_olc = YES;
/*
* if you wish to enable Aedit, set this to YES
* This will make the mud look for a file called socials.new,
* which is in a different format than the stock socials file.
*/
/* if you wish to enable Aedit, set this to YES. This will make the mud look
* for a file called socials.new, which is in a different format than the
* stock socials file. */
int use_new_socials = YES;
const char *MENU =
@ -348,8 +270,6 @@ const char *MENU =
"\r\n"
" Make your choice: ";
const char *WELC_MESSG =
"\r\n"
"Welcome to tbaMUD! May your visit here be... Enlightening"
@ -360,19 +280,12 @@ const char *START_MESSG =
"gain experience, find weapons and equipment, and much more -- while\r\n"
"meeting people from around the world!\r\n";
/****************************************************************************/
/****************************************************************************/
/* AUTOWIZ OPTIONS */
/*
* Should the game automatically create a new wizlist/immlist every time
* someone immorts, or is promoted to a higher (or lower) god level?
* NOTE: this only works under UNIX systems.
*/
/* Should the game automatically create a new wizlist/immlist every time someone
* immorts, or is promoted to a higher (or lower) god level? NOTE: this only
* works under UNIX systems. */
int use_autowiz = YES;
/* If yes, what is the lowest level which should be on the wizlist? (All
immort levels below the level you specify will go on the immlist instead.) */
/* If yes, what is the lowest level which should be on the wizlist? (All immort
* levels below the level you specify will go on the immlist instead.) */
int min_wizlist_lev = LVL_GOD;

388
src/db.c
View file

@ -12,8 +12,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "db.h"
@ -28,17 +26,13 @@
#include "dg_scripts.h"
#include "dg_event.h"
/**************************************************************************
* declarations of most of the 'global' variables *
**************************************************************************/
/* declarations of most of the 'global' variables */
struct config_data config_info; /* Game configuration list. */
struct room_data *world = NULL; /* array of rooms */
room_rnum top_of_world = 0; /* ref to top element of world */
struct char_data *character_list = NULL; /* global linked list of
* chars */
struct char_data *character_list = NULL; /* global linked list of chars */
struct index_data *mob_index; /* index table for mobile file */
struct char_data *mob_proto; /* prototypes for mobs */
mob_rnum top_of_mobt = 0; /* top of mobile index table */
@ -166,18 +160,14 @@ extern struct descriptor_data *descriptor_list;
extern const char *unused_spellname; /* spell_parser.c */
extern int no_specials;
extern int scheck;
extern struct player_index_element *player_table;
int top_of_p_table;
long top_idnum;
extern int top_of_p_table;
extern long top_idnum;
/* external ASCII Player Files vars */
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];
@ -185,11 +175,9 @@ char *fread_action(FILE *fl, int nr)
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.
*/
/* 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 == '#')
@ -209,11 +197,9 @@ void boot_social_messages(void)
/* 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.
*/
/* 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 */
@ -227,11 +213,9 @@ void boot_social_messages(void)
/* 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.
*/
/* 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 */
@ -255,14 +239,12 @@ void boot_social_messages(void)
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').
*/
/* 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++;
@ -275,14 +257,12 @@ void boot_social_messages(void)
} 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
/* 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').
*/
* 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++;
@ -297,13 +277,11 @@ void boot_social_messages(void)
#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
/* SYSERR_DESC: The only time that this error should ever arise is if you
* are running your MUD 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().
*/
* is in boot_social_messages(). */
#endif
soc_mess_list[curr_soc].char_no_arg = fread_action(fl, nr);
@ -343,7 +321,6 @@ void reboot_wizlists(void)
file_to_string_alloc(IMMLIST_FILE, &immlist);
}
/* Wipe out all the loaded text files, for shutting down. */
void free_text_files(void)
{
@ -360,13 +337,9 @@ void free_text_files(void)
}
}
/*
* Too bad it doesn't check the return values to let the user
* know about -1 values. This will result in an 'Okay.' to a
* 'reload' command even when the string was not replaced.
* To fix later, if desired. -gg 6/24/99
*/
/* Too bad it doesn't check the return values to let the user know about -1
* values. This will result in an 'Okay.' to a 'reload' command even when the
* string was not replaced. To fix later. */
ACMD(do_reboot)
{
char arg[MAX_INPUT_LENGTH];
@ -458,7 +431,6 @@ ACMD(do_reboot)
send_to_char(ch, "%s", CONFIG_OK);
}
void boot_world(void)
{
log("Loading zone table.");
@ -491,7 +463,6 @@ void boot_world(void)
}
}
void free_extra_descriptions(struct extra_descr_data *edesc)
{
struct extra_descr_data *enext;
@ -505,7 +476,6 @@ void free_extra_descriptions(struct extra_descr_data *edesc)
}
}
/* Free the world, in a memory allocation sense. */
void destroy_db(void)
{
@ -601,7 +571,6 @@ void destroy_db(void)
destroy_shops();
/* Zones */
#define THIS_CMD zone_table[cnt].cmd[itr]
for (cnt = 0; cnt <= top_of_zone_table; cnt++) {
@ -663,10 +632,8 @@ void destroy_db(void)
/* context sensitive help system */
free_context_help();
}
/* body of the booting system */
void boot_db(void)
{
@ -793,7 +760,6 @@ void boot_db(void)
log("Boot db -- DONE.");
}
/* reset the time in the game from file */
void reset_time(void)
{
@ -844,7 +810,6 @@ time_info = *mud_time_passed(time(0), beginning_of_time);
weather_info.sky = SKY_CLOUDLESS;
}
/* Write the time in 'when' to the MUD-time file. */
void save_mud_time(struct time_info_data *when)
{
@ -858,11 +823,8 @@ void save_mud_time(struct time_info_data *when)
}
}
/*
* Thanks to Andrey (andrey@alex-ua.com) for this bit of code, although I
* did add the 'goto' and changed some "while()" into "do { } while()".
* -gg 6/24/98 (technically 6/25/98, but I care not.)
*/
/* Thanks to Andrey (andrey@alex-ua.com) for this bit of code, although I did
* add the 'goto' and changed some "while()" into "do { } while()". -gg */
int count_alias_records(FILE *fl)
{
char key[READ_SIZE], next_key[READ_SIZE];
@ -916,8 +878,6 @@ int count_hash_records(FILE *fl)
return (count);
}
void index_boot(int mode)
{
const char *index_filename, *prefix = NULL; /* NULL or egcs 1.1 complains */
@ -994,9 +954,7 @@ void index_boot(int mode)
exit(1);
}
/*
* NOTE: "bytes" does _not_ include strings or other later malloc'd things.
*/
/* "bytes" does _not_ include strings or other later malloc'd things. */
switch (mode) {
case DB_BOOT_TRG:
CREATE(trig_index, struct index_data *, rec_count);
@ -1070,7 +1028,6 @@ void index_boot(int mode)
}
}
void discrete_load(FILE *fl, int mode, char *filename)
{
int nr = -1, last;
@ -1080,10 +1037,8 @@ void discrete_load(FILE *fl, int mode, char *filename)
/* modes positions correspond to DB_BOOT_xxx in db.h */
for (;;) {
/*
* we have to do special processing with the obj files because they have
* no end-of-record marker :(
*/
/* We have to do special processing with the obj files because they have no
* end-of-record marker. */
if (mode != DB_BOOT_OBJ || nr < 0)
if (!get_line(fl, line)) {
if (nr == -1) {
@ -1162,7 +1117,6 @@ bitvector_t asciiflag_conv(char *flag)
return (flags);
}
/* load the rooms */
void parse_room(FILE *fl, int virtual_nr)
{
@ -1233,10 +1187,8 @@ void parse_room(FILE *fl, int virtual_nr)
CREATE(new_descr, struct extra_descr_data, 1);
new_descr->keyword = fread_string(fl, buf2);
new_descr->description = fread_string(fl, buf2);
/* fix for crashes in the editor when formatting
* - e-descs are assumed to end with a \r\n
* -- Welcor 09/03
*/
/* Fix for crashes in the editor when formatting. E-descs are assumed to
* end with a \r\n. -Welcor */
{
char *end = strchr(new_descr->description, '\0');
if (end > new_descr->description && *(end-1) != '\n') {
@ -1267,8 +1219,6 @@ void parse_room(FILE *fl, int virtual_nr)
}
}
/* read direction data */
void setup_dir(FILE *fl, int room, int dir)
{
@ -1300,7 +1250,6 @@ void setup_dir(FILE *fl, int room, int dir)
world[room].dir_option[dir]->to_room = ((t[2] == -1 || t[2] == 0) ? NOWHERE : t[2]);
}
/* make sure the start rooms exist & resolve their vnums to rnums */
void check_start_rooms(void)
{
@ -1320,7 +1269,6 @@ void check_start_rooms(void)
}
}
/* resolve all vnums into rnums in the world */
void renum_world(void)
{
@ -1334,20 +1282,14 @@ void renum_world(void)
real_room(world[room].dir_option[door]->to_room);
}
#define ZCMD zone_table[zone].cmd[cmd_no]
/*
* "resulve vnums into rnums in the zone reset tables"
*
* Or in English: Once all of the zone reset tables have been loaded, we
* resolve the virtual numbers into real numbers all at once so we don't have
* to do it repeatedly while the game is running. This does make adding any
* room, mobile, or object a little more difficult while the game is running.
*
* NOTE 1: Assumes NOWHERE == NOBODY == NOTHING.
* NOTE 2: Assumes sizeof(room_rnum) >= (sizeof(mob_rnum) and sizeof(obj_rnum))
*/
/* Resolve vnums into rnums in the zone reset tables. In English: Once all of
* the zone reset tables have been loaded, we resolve the virtual numbers into
* real numbers all at once so we don't have to do it repeatedly while the game
* is running. This does make adding any room, mobile, or object a little more
* difficult while the game is running. Assumes NOWHERE == NOBODY == NOTHING.
* Assumes sizeof(room_rnum) >= (sizeof(mob_rnum) and sizeof(obj_rnum)) */
void renum_zone_table(void)
{
int cmd_no;
@ -1407,8 +1349,6 @@ void renum_zone_table(void)
}
}
void parse_simple_mob(FILE *mob_f, int i, int nr)
{
int j, t[10];
@ -1485,31 +1425,22 @@ void parse_simple_mob(FILE *mob_f, int i, int nr)
GET_WEIGHT(mob_proto + i) = 200;
GET_HEIGHT(mob_proto + i) = 198;
/*
* these are now save applies; base save numbers for MOBs are now from
* the warrior save table.
*/
/* These are now save applies; base save numbers for MOBs are now from the
* warrior save table. */
for (j = 0; j < 5; j++)
GET_SAVE(mob_proto + i, j) = 0;
}
/*
* interpret_espec is the function that takes espec keywords and values
* and assigns the correct value to the mob as appropriate. Adding new
* e-specs is absurdly easy -- just add a new CASE statement to this
* function! No other changes need to be made anywhere in the code.
*
/* interpret_espec is the function that takes espec keywords and values and
* assigns the correct value to the mob as appropriate. Adding new e-specs is
* absurdly easy -- just add a new CASE statement to this function! No other
* changes need to be made anywhere in the code.
* CASE : Requires a parameter through 'value'.
* BOOL_CASE : Being specified at all is its value.
*/
* BOOL_CASE : Being specified at all is its value. */
#define CASE(test) \
if (value && !matched && !str_cmp(keyword, test) && (matched = TRUE))
#define BOOL_CASE(test) \
if (!value && !matched && !str_cmp(keyword, test) && (matched = TRUE))
#define RANGE(low, high) \
(num_arg = MAX((low), MIN((high), (num_arg))))
@ -1517,10 +1448,8 @@ void interpret_espec(const char *keyword, const char *value, int i, int nr)
{
int num_arg = 0, matched = FALSE;
/*
* If there isn't a colon, there is no value. While Boolean options are
* possible, we don't actually have any. Feel free to make some.
*/
/* If there isn't a colon, there is no value. While Boolean options are
* possible, we don't actually have any. Feel free to make some. */
if (value)
num_arg = atoi(value);
@ -1586,7 +1515,6 @@ void parse_espec(char *buf, int i, int nr)
interpret_espec(buf, ptr, i, nr);
}
void parse_enhanced_mob(FILE *mob_f, int i, int nr)
{
char line[READ_SIZE];
@ -1607,7 +1535,6 @@ void parse_enhanced_mob(FILE *mob_f, int i, int nr)
exit(1);
}
void parse_mobile(FILE *mob_f, int nr)
{
static int i = 0;
@ -1621,15 +1548,13 @@ void parse_mobile(FILE *mob_f, int nr)
clear_char(mob_proto + i);
/*
* Mobiles should NEVER use anything in the 'player_specials' structure.
/* Mobiles should NEVER use anything in the 'player_specials' structure.
* The only reason we have every mob in the game share this copy of the
* structure is to save newbie coders from themselves. -gg 2/25/98
*/
* structure is to save newbie coders from themselves. -gg */
mob_proto[i].player_specials = &dummy_mob;
sprintf(buf2, "mob vnum %d", nr); /* sprintf: OK (for 'buf2 >= 19') */
/***** String data *****/
/* String data */
mob_proto[i].player.name = fread_string(mob_f, buf2);
tmpptr = mob_proto[i].player.short_descr = fread_string(mob_f, buf2);
if (tmpptr && *tmpptr)
@ -1640,7 +1565,7 @@ void parse_mobile(FILE *mob_f, int nr)
mob_proto[i].player.description = fread_string(mob_f, buf2);
GET_TITLE(mob_proto + i) = NULL;
/* *** Numeric data *** */
/* Numeric data */
if (!get_line(mob_f, line)) {
log("SYSERR: Format error after string section of mob #%d\n"
"...expecting line of form '# # # {S | E}', but file ended!", nr);
@ -1708,9 +1633,6 @@ void parse_mobile(FILE *mob_f, int nr)
top_of_mobt = i++;
}
/* read all objects from obj file; generate index and prototypes */
char *parse_object(FILE *obj_f, int nr)
{
@ -1730,7 +1652,7 @@ char *parse_object(FILE *obj_f, int nr)
sprintf(buf2, "object #%d", nr); /* sprintf: OK (for 'buf2 >= 19') */
/* *** string data *** */
/* string data */
if ((obj_proto[i].name = fread_string(obj_f, buf2)) == NULL) {
log("SYSERR: Null obj name or format error at or near %s", buf2);
exit(1);
@ -1746,7 +1668,7 @@ char *parse_object(FILE *obj_f, int nr)
CAP(tmpptr);
obj_proto[i].action_description = fread_string(obj_f, buf2);
/* *** numeric data *** */
/* numeric data */
if (!get_line(obj_f, line)) {
log("SYSERR: Expecting first numeric line of %s, but file ended!", buf2);
exit(1);
@ -1804,8 +1726,7 @@ char *parse_object(FILE *obj_f, int nr)
GET_OBJ_WEIGHT(obj_proto + i) = GET_OBJ_VAL(obj_proto + i, 1) + 5;
}
/* *** extra descriptions and affect fields *** */
/* extra descriptions and affect fields */
for (j = 0; j < MAX_OBJ_AFFECT; j++) {
obj_proto[i].affected[j].location = APPLY_NONE;
obj_proto[i].affected[j].modifier = 0;
@ -1865,9 +1786,7 @@ char *parse_object(FILE *obj_f, int nr)
}
}
#define Z zone_table[zone]
/* load the zone table and command tables */
void load_zones(FILE *fl, char *zonename)
{
@ -1883,10 +1802,9 @@ void load_zones(FILE *fl, char *zonename)
for (tmp = 0; tmp < 3; tmp++)
get_line(fl, buf);
/* More accurate count. Previous was always 4 or 5 too high. -gg 2001/1/17
* Note that if a new zone command is added to reset_zone(), this string
* will need to be updated to suit. - ae.
*/
/* More accurate count. Previous was always 4 or 5 too high. -gg Note that if
* a new zone command is added to reset_zone(), this string will need to be
* updated to suit. - ae. */
while (get_line(fl, buf))
if ((strchr("MOPGERDTV", buf[0]) && buf[1] == ' ') || (buf[0] == 'S' && buf[1] == '\0'))
num_of_cmds++;
@ -1919,11 +1837,9 @@ void load_zones(FILE *fl, char *zonename)
line_num += get_line(fl, buf);
if (sscanf(buf, " %hd %hd %d %d ", &Z.bot, &Z.top, &Z.lifespan, &Z.reset_mode) != 4) {
/*
* This may be due to the fact that the zone has no builder. So, we just attempt
* to fix this by copying the previous 2 last reads into this variable and the
* last one.
*/
/* This may be due to the fact that the zone has no builder. So, we just
* attempt to fix this by copying the previous 2 last reads into this
* variable and the last one. */
log("SYSERR: Format error in numeric constant line of %s, attempting to fix.", zname);
if (sscanf(Z.name, " %hd %hd %d %d ", &Z.bot, &Z.top, &Z.lifespan, &Z.reset_mode) != 4) {
log("SYSERR: Could not fix previous error, aborting game.");
@ -2001,10 +1917,8 @@ void load_zones(FILE *fl, char *zonename)
top_of_zone_table = zone++;
}
#undef Z
void get_one_line(FILE *fl, char *buf)
{
if (fgets(buf, READ_SIZE, fl) == NULL) {
@ -2015,10 +1929,6 @@ void get_one_line(FILE *fl, char *buf)
buf[strlen(buf) - 1] = '\0'; /* take off the trailing \n */
}
/*************************************************************************
* procedures for resetting, both play-time and boot-time *
*************************************************************************/
int vnum_mobile(char *searchname, struct char_data *ch)
{
int nr, found = 0;
@ -2032,8 +1942,6 @@ int vnum_mobile(char *searchname, struct char_data *ch)
return (found);
}
int vnum_object(char *searchname, struct char_data *ch)
{
int nr, found = 0;
@ -2086,7 +1994,6 @@ struct char_data *create_char(void)
return (ch);
}
/* create a new mobile from a prototype */
struct char_data *read_mobile(mob_vnum nr, int type) /* and mob_rnum */
{
@ -2133,7 +2040,6 @@ struct char_data *read_mobile(mob_vnum nr, int type) /* and mob_rnum */
return (mob);
}
/* create an object, and add it to the object list */
struct obj_data *create_obj(void)
{
@ -2151,7 +2057,6 @@ struct obj_data *create_obj(void)
return (obj);
}
/* create a new object from a prototype */
struct obj_data *read_object(obj_vnum nr, int type) /* and obj_rnum */
{
@ -2181,10 +2086,7 @@ struct obj_data *read_object(obj_vnum nr, int type) /* and obj_rnum */
return (obj);
}
#define ZO_DEAD 999
/* update zone ages, queue for reset if necessary, and dequeue when possible */
void zone_update(void)
{
@ -2194,11 +2096,8 @@ void zone_update(void)
/* jelson 10/22/92 */
if (((++timer * PULSE_ZONE) / PASSES_PER_SEC) >= 60) {
/* one minute has passed */
/*
* NOT accurate unless PULSE_ZONE is a multiple of PASSES_PER_SEC or a
* factor of 60
*/
/* one minute has passed NOT accurate unless PULSE_ZONE is a multiple of
* PASSES_PER_SEC or a factor of 60 */
timer = 0;
@ -2229,9 +2128,8 @@ void zone_update(void)
}
} /* end - one minute has passed */
/* dequeue zones (if possible) and reset */
/* this code is executed every 10 seconds (i.e. PULSE_ZONE) */
/* Dequeue zones (if possible) and reset. This code is executed every 10
* seconds (i.e. PULSE_ZONE). */
for (update_u = reset_q.head; update_u; update_u = update_u->next)
if (zone_table[update_u->zone_to_reset].reset_mode == 2 ||
is_empty(update_u->zone_to_reset)) {
@ -2282,11 +2180,9 @@ void reset_zone(zone_rnum zone)
if (ZCMD.if_flag && !last_cmd)
continue;
/* This is the list of actual zone commands. If any new
* zone commands are added to the game, be certain to update
* the list of commands in load_zone() so that the counting
* will still be correct. - ae.
*/
/* This is the list of actual zone commands. If any new zone commands are
* added to the game, be certain to update the list of commands in load_zone
* () so that the counting will still be correct. - ae. */
switch (ZCMD.command) {
case '*': /* ignore command */
last_cmd = 0;
@ -2501,8 +2397,6 @@ void reset_zone(zone_rnum zone)
}
}
/* for use in reset_zone; return TRUE if zone 'nr' is free of PC's */
int is_empty(zone_rnum zone_nr)
{
@ -2515,10 +2409,8 @@ int is_empty(zone_rnum zone_nr)
continue;
if (world[IN_ROOM(i->character)].zone != zone_nr)
continue;
/*
* if an immortal has nohassle off, he counts as present
* added for testing zone reset triggers - Welcor
*/
/* If an immortal has nohassle off, he counts as present. Added for testing
* zone reset triggers -Welcor */
if ((GET_LEVEL(i->character) >= LVL_IMMORT) && (PRF_FLAGGED(i->character, PRF_NOHASSLE)))
continue;
@ -2528,11 +2420,7 @@ int is_empty(zone_rnum zone_nr)
return (1);
}
/************************************************************************
* funcs of a (more or less) general utility nature *
************************************************************************/
/* Functions of a general utility nature. */
/* read and allocate space for a '~'-terminated string from a given file */
char *fread_string(FILE *fl, const char *error)
{
@ -2655,20 +2543,14 @@ void free_char(struct char_data *ch)
if (ch->desc)
ch->desc->character = NULL;
/* find_char helper */
/*
* when free_char is called with a blank character struct, ID is set
* to 0, and has not yet been added to the lookup table.
*/
/* find_char helper, when free_char is called with a blank character struct,
* ID is set to 0, and has not yet been added to the lookup table */
if (GET_ID(ch) != 0)
remove_from_lookup_table(GET_ID(ch));
free(ch);
}
/* release memory allocated for an obj struct */
void free_obj(struct obj_data *obj)
{
@ -2692,25 +2574,15 @@ void free_obj(struct obj_data *obj)
free(obj);
}
/*
* Steps:
* 1: Read contents of a text file.
* 2: Make sure no one is using the pointer in paging.
* 3: Allocate space.
* 4: Point 'buf' to it.
*
* We don't want to free() the string that someone may be
* viewing in the pager. page_string() keeps the internal
* strdup()'d copy on ->showstr_head and it won't care
* if we delete the original. Otherwise, strings are kept
* on ->showstr_vector but we'll only match if the pointer
* is to the string we're interested in and not a copy.
*
* If someone is reading a global copy we're trying to
* replace, give everybody using it a different copy so
* as to avoid special cases.
*/
/* Steps: 1: Read contents of a text file. 2: Make sure no one is using the
* pointer in paging. 3: Allocate space. 4: Point 'buf' to it.
* We don't want to free() the string that someone may be viewing in the pager.
* page_string() keeps the internal strdup()'d copy on ->showstr_head and it
* won't care if we delete the original. Otherwise, strings are kept on
* ->showstr_vector but we'll only match if the pointer is to the string we're
* interested in and not a copy. If someone is reading a global copy we're
* trying to replace, give everybody using it a different copy so as to avoid
* special cases. */
int file_to_string_alloc(const char *name, char **buf)
{
int temppage;
@ -2742,7 +2614,6 @@ int file_to_string_alloc(const char *name, char **buf)
return (0);
}
/* read contents of a text file, and place in buf */
int file_to_string(const char *name, char *buf)
{
@ -2778,8 +2649,6 @@ int file_to_string(const char *name, char *buf)
return (0);
}
/* clear some of the the working variables of a char */
void reset_char(struct char_data *ch)
{
@ -2811,8 +2680,6 @@ void reset_char(struct char_data *ch)
GET_LAST_TELL(ch) = NOBODY;
}
/* clear ALL the working variables of a char; do NOT free any space alloc'ed */
void clear_char(struct char_data *ch)
{
@ -2830,7 +2697,6 @@ void clear_char(struct char_data *ch)
ch->points.max_mana = 100;
}
void clear_object(struct obj_data *obj)
{
memset((char *) obj, 0, sizeof(struct obj_data));
@ -2840,13 +2706,8 @@ void clear_object(struct obj_data *obj)
obj->worn_on = NOWHERE;
}
/*
* Called during character creation after picking character class
* (and then never again for that character).
*/
/* Called during character creation after picking character class (and then
* never again for that character). */
void init_char(struct char_data *ch)
{
int i;
@ -2855,7 +2716,7 @@ void init_char(struct char_data *ch)
if (ch->player_specials == NULL)
CREATE(ch->player_specials, struct player_special_data, 1);
/* *** if this is our first player --- he be God *** */
/* If this is our first player make him IMPL. */
if (top_of_p_table == 0) {
GET_LEVEL(ch) = LVL_IMPL;
GET_EXP(ch) = 7000000;
@ -2884,14 +2745,10 @@ void init_char(struct char_data *ch)
for (i = 0; i < MAX_TONGUE; i++)
GET_TALK(ch, i) = 0;
/*
* make favors for sex -- or in English, we bias the height and weight of the
* character depending on what gender they've chosen for themselves. While it
* is possible to have a tall, heavy female it's not as likely as a male.
*
* Height is in centimeters. Weight is in pounds. The only place they're
* ever printed (in stock code) is SPELL_IDENTIFY.
*/
/* Bias the height and weight of the character depending on what gender
* they have chosen. While it is possible to have a tall, heavy female it's
* not as likely as a male. Height is in centimeters. Weight is in pounds.
* The only place they're ever printed (in stock code) is SPELL_IDENTIFY. */
if (GET_SEX(ch) == SEX_MALE) {
GET_WEIGHT(ch) = rand_number(120, 180);
GET_HEIGHT(ch) = rand_number(160, 200); /* 5'4" - 6'8" */
@ -2931,8 +2788,6 @@ void init_char(struct char_data *ch)
GET_LOADROOM(ch) = NOWHERE;
}
/* returns the real number of the room with given virtual number */
room_rnum real_room(room_vnum vnum)
{
@ -2958,8 +2813,6 @@ room_rnum real_room(room_vnum vnum)
}
}
/* returns the real number of the monster with given virtual number */
mob_rnum real_mobile(mob_vnum vnum)
{
@ -2985,7 +2838,6 @@ mob_rnum real_mobile(mob_vnum vnum)
}
}
/* returns the real number of the object with given virtual number */
obj_rnum real_object(obj_vnum vnum)
{
@ -3011,7 +2863,6 @@ obj_rnum real_object(obj_vnum vnum)
}
}
/* returns the real number of the zone with given virtual number */
zone_rnum real_zone(zone_vnum vnum)
{
@ -3037,12 +2888,7 @@ zone_rnum real_zone(zone_vnum vnum)
}
}
/*
* Extend later to include more checks.
*
* TODO: Add checks for unknown bitvectors.
*/
/* Extend later to include more checks and add checks for unknown bitvectors. */
int check_object(struct obj_data *obj)
{
char objname[MAX_INPUT_LENGTH + 32];
@ -3121,10 +2967,8 @@ int check_object_spell_number(struct obj_data *obj, int val)
if (GET_OBJ_VAL(obj, val) == -1) /* i.e.: no spell */
return (error);
/*
* Check for negative spells, spells beyond the top define, and any
* spell which is actually a skill.
*/
/* Check for negative spells, spells beyond the top define, and any spell
* which is actually a skill. */
if (GET_OBJ_VAL(obj, val) < 0)
error = TRUE;
if (GET_OBJ_VAL(obj, val) > TOP_SPELL_DEFINE)
@ -3194,7 +3038,7 @@ extern int idle_max_level;
extern int dts_are_dumps;
extern int load_into_inventory;
extern int track_through_doors;
extern int immort_level_ok;
extern int no_mort_to_immort;
extern int free_rent;
extern int max_obj_save;
extern int min_rent_cost;
@ -3230,13 +3074,9 @@ extern const char *NOEFFECT;
void load_default_config( void )
{
/****************************************************************************/
/** This function is called only once, at boot-time. **/
/** - We assume config_info is empty -- Welcor **/
/****************************************************************************/
/****************************************************************************/
/** Game play options. **/
/****************************************************************************/
/* This function is called only once, at boot-time. We assume config_info is
* empty. -Welcor */
/* Game play options. */
CONFIG_PK_ALLOWED = pk_allowed;
CONFIG_PT_ALLOWED = pt_allowed;
CONFIG_LEVEL_CAN_SHOUT = level_can_shout;
@ -3255,11 +3095,9 @@ void load_default_config( void )
CONFIG_NOPERSON = strdup(NOPERSON);
CONFIG_NOEFFECT = strdup(NOEFFECT);
CONFIG_TRACK_T_DOORS = track_through_doors;
CONFIG_IMMORT_LEVEL_OK = immort_level_ok;
CONFIG_NO_MORT_TO_IMMORT = no_mort_to_immort;
/****************************************************************************/
/** Rent / crashsave options. **/
/****************************************************************************/
/* Rent / crashsave options. */
CONFIG_FREE_RENT = free_rent;
CONFIG_MAX_OBJ_SAVE = max_obj_save;
CONFIG_MIN_RENT_COST = min_rent_cost;
@ -3268,9 +3106,7 @@ void load_default_config( void )
CONFIG_CRASH_TIMEOUT = crash_file_timeout;
CONFIG_RENT_TIMEOUT = rent_file_timeout;
/****************************************************************************/
/** Room numbers. **/
/****************************************************************************/
/* Room numbers. */
CONFIG_MORTAL_START = mortal_start_room;
CONFIG_IMMORTAL_START = immort_start_room;
CONFIG_FROZEN_START = frozen_start_room;
@ -3278,9 +3114,7 @@ void load_default_config( void )
CONFIG_DON_ROOM_2 = donation_room_2;
CONFIG_DON_ROOM_3 = donation_room_3;
/****************************************************************************/
/** Game operation options. **/
/****************************************************************************/
/* Game operation options. */
CONFIG_DFLT_PORT = DFLT_PORT;
if (DFLT_IP)
@ -3306,9 +3140,7 @@ void load_default_config( void )
CONFIG_WELC_MESSG = strdup(WELC_MESSG);
CONFIG_START_MESSG = strdup(START_MESSG);
/****************************************************************************/
/** Autowiz options. **/
/****************************************************************************/
/* Autowiz options. */
CONFIG_USE_AUTOWIZ = use_autowiz;
CONFIG_MIN_WIZLIST_LEV = min_wizlist_lev;
}
@ -3330,9 +3162,7 @@ void load_config( void )
return;
}
/****************************************************************************/
/** Load the game configuration file. **/
/****************************************************************************/
/* Load the game configuration file. */
while (get_line(fl, line)) {
split_argument(line, tag);
num = atoi(line);
@ -3407,8 +3237,8 @@ void load_config( void )
CONFIG_IDLE_RENT_TIME = num;
else if (!str_cmp(tag, "idle_max_level"))
CONFIG_IDLE_MAX_LEVEL = num;
else if (!str_cmp(tag, "immort_level_ok"))
CONFIG_IMMORT_LEVEL_OK = num;
else if (!str_cmp(tag, "no_mort_to_immort"))
CONFIG_NO_MORT_TO_IMMORT = num;
else if (!str_cmp(tag, "immort_start_room"))
CONFIG_IMMORTAL_START = num;
break;

View file

@ -14,7 +14,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"
@ -39,18 +38,13 @@ int format_script(struct descriptor_data *d);
void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num);
void trigedit_setup_new(struct descriptor_data *d);
/* ***********************************************************************
* trigedit
* ***********************************************************************/
/* Trigedit */
ACMD(do_oasis_trigedit)
{
int number, real_num;
struct descriptor_data *d;
/*
* Parse any arguments.
*/
/* Parse any arguments. */
skip_spaces(&argument);
if (!*argument || !isdigit(*argument)) {
send_to_char(ch, "Specify a trigger VNUM to edit.\r\n");
@ -59,9 +53,7 @@ ACMD(do_oasis_trigedit)
number = atoi(argument);
/*
* Check that it isn't already being edited.
*/
/* Check that it isn't already being edited. */
for (d = descriptor_list; d; d = d->next) {
if (STATE(d) == CON_TRIGEDIT) {
if (d->olc && OLC_NUM(d) == number) {
@ -72,9 +64,7 @@ ACMD(do_oasis_trigedit)
}
}
d = ch->desc;
/*
* Give descriptor an OLC structure.
*/
/* Give descriptor an OLC structure. */
if (d->olc) {
mudlog(BRF, LVL_IMMORT, TRUE,
"SYSERR: do_oasis_trigedit: Player already had olc structure.");
@ -82,9 +72,7 @@ ACMD(do_oasis_trigedit)
}
CREATE(d->olc, struct oasis_olc_data, 1);
/*
* Find the zone.
*/
/* Find the zone. */
if ((OLC_ZNUM(d) = real_zone_by_thing(number)) == NOWHERE) {
send_to_char(ch, "Sorry, there is no zone for that number!\r\n");
free(d->olc);
@ -103,10 +91,8 @@ ACMD(do_oasis_trigedit)
}
OLC_NUM(d) = number;
/*
* If this is a new trigger, setup a new one,
* otherwise, setup the a copy of the existing trigger
*/
/* If this is a new trigger, setup a new one, otherwise, setup the a copy of
* the existing trigger. */
if ((real_num = real_trigger(number)) == NOTHING)
trigedit_setup_new(d);
else
@ -121,8 +107,8 @@ ACMD(do_oasis_trigedit)
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
}
/* called when a mob or object is being saved to disk, so its script can */
/* be saved */
/* Called when a mob or object is being saved to disk, so its script can be
* saved. */
void script_save_to_disk(FILE *fp, void *item, int type)
{
struct trig_proto_list *t;
@ -145,21 +131,16 @@ void script_save_to_disk(FILE *fp, void *item, int type)
}
}
void trigedit_setup_new(struct descriptor_data *d)
{
struct trig_data *trig;
/*
* Allocate a scratch trigger structure
*/
/* Allocate a scratch trigger structure. */
CREATE(trig, struct trig_data, 1);
trig->nr = -1;
trig->nr = NOWHERE;
/*
* Set up some defaults
*/
/* Set up some defaults. */
trig->name = strdup("new trigger");
trig->trigger_type = MTRIG_GREET;
@ -179,9 +160,7 @@ void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num)
{
struct trig_data *trig;
struct cmdlist_element *c;
/*
* Allocate a scratch trigger structure
*/
/* Allocate a scratch trigger structure. */
CREATE(trig, struct trig_data, 1);
trig_data_copy(trig, trig_index[rtrg_num]->proto);
@ -197,8 +176,8 @@ void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num)
strcat(OLC_STORAGE(d), "\r\n");
c = c->next;
}
/* now trig->cmdlist is something to pass to the text editor */
/* it will be converted back to a real cmdlist_element list later */
/* Now trig->cmdlist is something to pass to the text editor it will be
* converted back to a real cmdlist_element list later. */
OLC_TRIG(d) = trig;
OLC_VAL(d) = 0; /* Has changed flag. (It hasn't so far, we just made it.) */
@ -206,7 +185,6 @@ void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num)
trigedit_disp_menu(d);
}
void trigedit_disp_menu(struct descriptor_data *d)
{
struct trig_data *trig = OLC_TRIG(d);
@ -404,7 +382,6 @@ void trigedit_parse(struct descriptor_data *d, char *arg)
trigedit_disp_menu(d);
}
/* save the zone's triggers to internal memory and to disk */
void trigedit_save(struct descriptor_data *d)
{
@ -584,9 +561,7 @@ void trigedit_save(struct descriptor_data *d)
for (live_trig = trigger_list; live_trig; live_trig = live_trig->next_in_world)
GET_TRIG_RNUM(live_trig) += (GET_TRIG_RNUM(live_trig) > rnum);
/*
* Update other trigs being edited.
*/
/* Update other trigs being edited. */
for (dsc = descriptor_list; dsc; dsc = dsc->next)
if (STATE(dsc) == CON_TRIGEDIT)
if (GET_TRIG_RNUM(OLC_TRIG(dsc)) >= rnum)
@ -594,13 +569,11 @@ void trigedit_save(struct descriptor_data *d)
}
/* now write the trigger out to disk, along with the rest of the */
/* triggers for this zone, of course */
/* note: we write this to disk NOW instead of letting the builder */
/* have control because if we lose this after having assigned a */
/* new trigger to an item, we will get SYSERR's upton reboot that */
/* could make things hard to debug. */
/* now write the trigger out to disk, along with the rest of the triggers for
* this zone. We write this to disk NOW instead of letting the builder have
* control because if we lose this after having assigned a new trigger to an
* item, we will get SYSERR's upton reboot that could make things hard to
* debug. */
zone = zone_table[OLC_ZNUM(d)].number;
top = zone_table[OLC_ZNUM(d)].top;
@ -666,7 +639,6 @@ void trigedit_save(struct descriptor_data *d)
trigedit_create_index(zone, "trg");
}
void trigedit_create_index(int znum, char *type)
{
FILE *newfile, *oldfile;
@ -687,10 +659,8 @@ void trigedit_create_index(int znum, char *type)
return;
}
/*
* Index contents must be in order: search through the old file for the
* right place, insert the new file, then copy the rest over.
*/
/* Index contents must be in order: search through the old file for the right
* place, insert the new file, then copy the rest over. */
snprintf(buf1, sizeof(buf1), "%d.%s", znum, type);
while (get_line(oldfile, buf)) {
if (*buf == '$') {
@ -711,9 +681,7 @@ void trigedit_create_index(int znum, char *type)
fclose(newfile);
fclose(oldfile);
/*
* Out with the old, in with the new.
*/
/* Out with the old, in with the new. */
remove(old_name);
rename(new_name, old_name);
}
@ -788,33 +756,23 @@ int dg_script_edit_parse(struct descriptor_data *d, char *arg)
case SCRIPT_MAIN_MENU:
switch(tolower(*arg)) {
case 'x':
/* this was buggy.
First we created a copy of a thing, but maintained pointers to scripts,
then if we altered the scripts, we freed the pointers and added new ones
to the OLC_THING. If we then chose _NOT_ to save the changes, the
pointers in the original thing pointed to garbage. If we saved changes
the pointers were updated correctly.
Solution:
Here we just point the working copies to the new proto_scripts
We only update the original when choosing to save internally,
then free the unused memory there.
Welcor
Thanks to
Jeremy Stanley - fungi@yuggoth.org and
Torgny Bjers - artovil@arcanerealms.org
for the bug report.
After updating to OasisOLC 2.0.3 I discovered some malfunctions
in this code, so I restructured it a bit. Now things work like this:
OLC_SCRIPT(d) is assigned a copy of the edited things' proto_script.
OLC_OBJ(d), etc.. are initalized with proto_script = NULL;
On save, the saved copy is updated with OLC_SCRIPT(d) as new proto_script (freeing the old one).
On quit/nosave, OLC_SCRIPT is free()'d, and the prototype not touched.
*/
/* This was buggy. First we created a copy of a thing, but maintained
* pointers to scripts, then if we altered the scripts, we freed the
* pointers and added new ones to the OLC_THING. If we then choose NOT
* to save the changes, the pointers in the original pointed to
* garbage. If we saved changes the pointers were updated correctly.
* Solution: Here we just point the working copies to the new
* proto_scripts. We only update the original when choosing to save
* internally, then free the unused memory there. -Welcor
* Thanks to Jeremy Stanley - fungi@yuggoth.org and Torgny Bjers -
* artovil@arcanerealms.org for the bug report.
* After updating to OasisOLC 2.0.3 I discovered some malfunctions
* in this code, so I restructured it a bit. Now things work like
* this: OLC_SCRIPT(d) is assigned a copy of the edited things'
* proto_script. OLC_OBJ(d), etc.. are initalized with proto_script =
* NULL; On save, the saved copy is updated with OLC_SCRIPT(d) as new
* proto_script (freeing the old one). On quit/nosave, OLC_SCRIPT is
* free()'d, and the prototype not touched. */
return 0;
case 'n':
write_to_output(d, "\r\nPlease enter position, vnum (ex: 1, 200):");

View file

@ -23,14 +23,14 @@ extern struct descriptor_data *descriptor_list;
void hedit_disp_menu(struct descriptor_data *d);
/* external variables */
struct help_index_element *help_table;
int top_of_h_table = 0; /* ref to top of help table */
int top_of_h_file = 0; /* ref of size of help file */
long top_help_idnum = 0; /* highest idnum in use */
extern struct help_index_element *help_table;
void get_one_line(FILE *fl, char *buf);
int search_help(char *argument, int level);
ACMD(do_reboot);
/* local variables */
int top_of_h_table = 0; /* ref to top of help table */
/* local functions */
void hedit_save_internally(struct descriptor_data *d);
void hedit_save_to_disk(struct descriptor_data *d);

View file

@ -238,7 +238,7 @@ void gain_exp(struct char_data *ch, int gain)
if (gain > 0) {
gain = MIN(CONFIG_MAX_EXP_GAIN, gain); /* put a cap on the max gain per kill */
GET_EXP(ch) += gain;
while (GET_LEVEL(ch) < LVL_IMMORT - CONFIG_IMMORT_LEVEL_OK &&
while (GET_LEVEL(ch) < LVL_IMMORT - CONFIG_NO_MORT_TO_IMMORT &&
GET_EXP(ch) >= level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 1)) {
GET_LEVEL(ch) += 1;
num_levels++;

View file

@ -330,7 +330,7 @@ extern const char *nrm, *grn, *cyn, *yel;
#define CEDIT_DTS_ARE_DUMPS 31
#define CEDIT_LOAD_INTO_INVENTORY 32
#define CEDIT_TRACK_THROUGH_DOORS 33
#define CEDIT_IMMORT_LEVEL_OK 34
#define CEDIT_NO_MORT_TO_IMMORT 34
#define CEDIT_MAX_OBJ_SAVE 35
#define CEDIT_MIN_RENT_COST 36
#define CEDIT_AUTOSAVE_TIME 37

View file

@ -81,7 +81,7 @@ int objsave_save_obj_record(struct obj_data *obj, FILE *fp, int locate)
temp=read_object(GET_OBJ_VNUM(obj), VIRTUAL);
else {
temp = create_obj();
temp->item_number = -1;
temp->item_number = NOWHERE;
}
if (obj->action_description) {

View file

@ -11,8 +11,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "interpreter.h"
@ -26,6 +24,7 @@
/* local globals */
struct spell_info_type spell_info[TOP_SPELL_DEFINE + 1];
char cast_arg2[MAX_INPUT_LENGTH];
/* local functions */
void say_spell(struct char_data *ch, int spellnum, struct char_data *tch, struct obj_data *tobj);
@ -35,19 +34,16 @@ ACMD(do_cast);
void unused_spell(int spl);
void mag_assign_spells(void);
/*
* This arrangement is pretty stupid, but the number of skills is limited by
/* This arrangement is pretty stupid, but the number of skills is limited by
* the playerfile. We can arbitrarily increase the number of skills by
* increasing the space in the playerfile. Meanwhile, 200 should provide
* ample slots for skills.
*/
* ample slots for skills. */
struct syllable {
const char *org;
const char *news;
};
struct syllable syls[] = {
{" ", " "},
{"ar", "abra"},
@ -84,7 +80,6 @@ struct syllable syls[] = {
};
const char *unused_spellname = "!UNUSED!"; /* So we can get &unused_spellname */
int mag_manacost(struct char_data *ch, int spellnum)
{
return MAX(SINFO.mana_max - (SINFO.mana_change *
@ -92,7 +87,6 @@ int mag_manacost(struct char_data *ch, int spellnum)
SINFO.mana_min);
}
void say_spell(struct char_data *ch, int spellnum, struct char_data *tch,
struct obj_data *tobj)
{
@ -150,11 +144,9 @@ void say_spell(struct char_data *ch, int spellnum, struct char_data *tch,
}
}
/*
* This function should be used anytime you are not 100% sure that you have
/* This function should be used anytime you are not 100% sure that you have
* a valid spell/skill number. A typical for() loop would not need to use
* this because you can guarantee > 0 and <= TOP_SPELL_DEFINE.
*/
* this because you can guarantee > 0 and <= TOP_SPELL_DEFINE. */
const char *skill_name(int num)
{
if (num > 0 && num <= TOP_SPELL_DEFINE)
@ -165,7 +157,6 @@ const char *skill_name(int num)
return ("UNDEFINED");
}
int find_skill_num(char *name)
{
int skindex, ok;
@ -194,15 +185,12 @@ int find_skill_num(char *name)
return (-1);
}
/*
* This function is the very heart of the entire magic system. All
* invocations of all types of magic -- objects, spoken and unspoken PC
* and NPC spells, the works -- all come through this function eventually.
* This is also the entry point for non-spoken or unrestricted spells.
* Spellnum 0 is legal but silently ignored here, to make callers simpler.
*/
* This function is the very heart of the entire magic system. All invocations
* of all types of magic -- objects, spoken and unspoken PC and NPC spells, the
* works -- all come through this function eventually. This is also the entry
* point for non-spoken or unrestricted spells. Spellnum 0 is legal but silently
* ignored here, to make callers simpler. */
int call_magic(struct char_data *caster, struct char_data *cvict,
struct obj_data *ovict, int spellnum, int level, int casttype)
{
@ -245,7 +233,6 @@ int call_magic(struct char_data *caster, struct char_data *cvict,
break;
}
if (IS_SET(SINFO.routines, MAG_DAMAGE))
if (mag_damage(level, caster, cvict, spellnum, savetype) == -1)
return (-1); /* Successful and target died, don't cast again. */
@ -293,20 +280,15 @@ int call_magic(struct char_data *caster, struct char_data *cvict,
return (1);
}
/*
* mag_objectmagic: This is the entry-point for all magic items. This should
/* mag_objectmagic: This is the entry-point for all magic items. This should
* only be called by the 'quaff', 'use', 'recite', etc. routines.
*
* For reference, object values 0-3:
* staff - [0] level [1] max charges [2] num charges [3] spell num
* wand - [0] level [1] max charges [2] num charges [3] spell num
* scroll - [0] level [1] spell num [2] spell num [3] spell num
* potion - [0] level [1] spell num [2] spell num [3] spell num
*
* Staves and wands will default to level 14 if the level is not specified;
* the DikuMUD format did not specify staff and wand levels in the world
* files (this is a CircleMUD enhancement).
*/
* Staves and wands will default to level 14 if the level is not specified; the
* DikuMUD format did not specify staff and wand levels in the world files */
void mag_objectmagic(struct char_data *ch, struct obj_data *obj,
char *argument)
{
@ -337,12 +319,8 @@ void mag_objectmagic(struct char_data *ch, struct obj_data *obj,
/* Level to cast spell at. */
k = GET_OBJ_VAL(obj, 0) ? GET_OBJ_VAL(obj, 0) : DEFAULT_STAFF_LVL;
/*
* Problem : Area/mass spells on staves can cause crashes.
* Solution: Remove the special nature of area/mass spells on staves.
* Problem : People like that behavior.
* Solution: We special case the area/mass spells here.
*/
/* Area/mass spells on staves can cause crashes. So we use special cases
* for those spells spells here. */
if (HAS_SPELL_ROUTINE(GET_OBJ_VAL(obj, 3), MAG_MASSES | MAG_AREAS)) {
for (i = 0, tch = world[IN_ROOM(ch)].people; tch; tch = tch->next_in_room)
i++;
@ -451,15 +429,10 @@ void mag_objectmagic(struct char_data *ch, struct obj_data *obj,
}
}
/*
* cast_spell is used generically to cast any spoken spell, assuming we
* already have the target char/obj and spell number. It checks all
* restrictions, etc., prints the words, etc.
*
* Entry point for NPC casts. Recommended entry point for spells cast
* by NPCs via specprocs.
*/
/* cast_spell is used generically to cast any spoken spell, assuming we already
* have the target char/obj and spell number. It checks all restrictions,
* prints the words, etc. Entry point for NPC casts. Recommended entry point
* for spells cast by NPCs via specprocs. */
int cast_spell(struct char_data *ch, struct char_data *tch,
struct obj_data *tobj, int spellnum)
{
@ -512,12 +485,10 @@ int cast_spell(struct char_data *ch, struct char_data *tch,
}
/*
* do_cast is the entry point for PC-casted spells. It parses the arguments,
/* do_cast is the entry point for PC-casted spells. It parses the arguments,
* determines the spell number and finds a target, throws the die to see if
* the spell can be cast, checks for sufficient mana and subtracts it, and
* passes control to cast_spell().
*/
* passes control to cast_spell(). */
ACMD(do_cast)
{
struct char_data *tch = NULL;
@ -566,6 +537,9 @@ ACMD(do_cast)
strlcpy(arg, t, sizeof(arg));
one_argument(arg, t);
skip_spaces(&t);
/* Copy target to global cast_arg2, for use in spells like locate object */
strcpy(cast_arg2, t);
}
if (IS_SET(SINFO.targets, TAR_IGNORE)) {
target = TRUE;
@ -653,8 +627,6 @@ ACMD(do_cast)
}
}
void spell_level(int spell, int chclass, int level)
{
int bad = 0;
@ -700,7 +672,6 @@ void spello(int spl, const char *name, int max_mana, int min_mana,
spell_info[spl].wear_off_msg = wearoff;
}
void unused_spell(int spl)
{
int i;
@ -718,52 +689,30 @@ void unused_spell(int spl)
}
#define skillo(skill, name) spello(skill, name, 0, 0, 0, 0, 0, 0, 0, NULL);
/*
* Arguments for spello calls:
*
/* Arguments for spello calls:
* spellnum, maxmana, minmana, manachng, minpos, targets, violent?, routines.
*
* spellnum: Number of the spell. Usually the symbolic name as defined in
* spells.h (such as SPELL_HEAL).
*
* spellname: The name of the spell.
*
* maxmana : The maximum mana this spell will take (i.e., the mana it
* will take when the player first gets the spell).
*
* minmana : The minimum mana this spell will take, no matter how high
* level the caster is.
*
* manachng: The change in mana for the spell from level to level. This
* number should be positive, but represents the reduction in mana cost as
* the caster's level increases.
*
* minpos : Minimum position the caster must be in for the spell to work
* (usually fighting or standing). targets : A "list" of the valid targets
* for the spell, joined with bitwise OR ('|').
*
* violent : TRUE or FALSE, depending on if this is considered a violent
* spell and should not be cast in PEACEFUL rooms or on yourself. Should be
* set on any spell that inflicts damage, is considered aggressive (i.e.
* charm, curse), or is otherwise nasty.
*
* routines: A list of magic routines which are associated with this spell
* if the spell uses spell templates. Also joined with bitwise OR ('|').
*
* See the CircleMUD documentation for a more detailed description of these
* fields.
*/
/*
* NOTE: SPELL LEVELS ARE NO LONGER ASSIGNED HERE AS OF Circle 3.0 bpl9.
* In order to make this cleaner, as well as to make adding new classes
* much easier, spell levels are now assigned in class.c. You only need
* a spello() call to define a new spell; to decide who gets to use a spell
* or skill, look in class.c. -JE 5 Feb 1996
*/
* See the documentation for a more detailed description of these fields. You
* only need a spello() call to define a new spell; to decide who gets to use
* a spell or skill, look in class.c. -JE */
void mag_assign_spells(void)
{
int i;
@ -978,10 +927,8 @@ void mag_assign_spells(void)
TAR_CHAR_ROOM | TAR_OBJ_INV | TAR_OBJ_ROOM, FALSE, MAG_MANUAL,
NULL);
/*
* These spells are currently not used, not implemented, and not castable.
* Values for the 'breath' spells are filled in assuming a dragon's breath.
*/
/* These spells are currently not used, not implemented, and not castable.
* Values for the 'breath' spells are filled in assuming a dragon's breath. */
spello(SPELL_FIRE_BREATH, "fire breath", 0, 0, 0, POS_SITTING,
TAR_IGNORE, TRUE, 0,
@ -1008,12 +955,9 @@ void mag_assign_spells(void)
TAR_IGNORE, TRUE, 0,
NULL);
/*
* Declaration of skills - this actually doesn't do anything except
* set it up so that immortals can use these skills by default. The
* min level to use the skill for other classes is set up in class.c.
*/
/* Declaration of skills - this actually doesn't do anything except set it up
* so that immortals can use these skills by default. The min level to use
* the skill for other classes is set up in class.c. */
skillo(SKILL_BACKSTAB, "backstab");
skillo(SKILL_BASH, "bash");
skillo(SKILL_HIDE, "hide");

View file

@ -11,7 +11,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"
@ -25,6 +24,7 @@
/* external variables */
extern room_rnum r_mortal_start_room;
extern int mini_mud;
extern char cast_arg2[MAX_STRING_LENGTH];
/* external functions */
void weight_change_object(struct obj_data *obj, int weight);
@ -33,10 +33,7 @@ void name_to_drinkcon(struct obj_data *obj, int type);
void name_from_drinkcon(struct obj_data *obj);
int compute_armor_class(struct char_data *ch);
/*
* Special spells appear below.
*/
/* Special spells appear below. */
ASPELL(spell_create_water)
{
int water;
@ -65,7 +62,6 @@ ASPELL(spell_create_water)
}
}
ASPELL(spell_recall)
{
if (victim == NULL || IS_NPC(victim))
@ -81,7 +77,6 @@ ASPELL(spell_recall)
greet_memory_mtrigger(victim);
}
ASPELL(spell_teleport)
{
room_rnum to_room;
@ -105,7 +100,6 @@ ASPELL(spell_teleport)
}
#define SUMMON_FAIL "You failed.\r\n"
ASPELL(spell_summon)
{
if (ch == NULL || victim == NULL)
@ -157,7 +151,52 @@ ASPELL(spell_summon)
greet_memory_mtrigger(victim);
}
/* Used by the locate object spell to check the alias list on objects */
int isname_obj(char *search, char *list)
{
char *found_in_list; //but could be something like 'ring' in 'shimmering'
char searchname[128];
char namelist[MAX_STRING_LENGTH];
int found_pos = -1;
int found_name=0; /* found the name we're looking for */
int match = 1;
int i;
/* Force to lowercase for string comparisons */
sprintf(searchname, "%s", search);
for (i = 0; searchname[i]; i++)
searchname[i] = LOWER(searchname[i]);
sprintf(namelist, "%s", list);
for (i = 0; namelist[i]; i++)
namelist[i] = LOWER(namelist[i]);
/* see if searchname exists any place within namelist */
found_in_list = strstr(namelist, searchname);
if (!found_in_list) {
return 0;
}
/* Found the name in the list, now see if it's a valid hit. The following
* avoids substrings (like ring in shimmering) is it at beginning of
* namelist? */
for (i = 0; searchname[i]; i++)
if (searchname[i] != namelist[i])
match = 0;
if (match) /* It was found at the start of the namelist string. */
found_name = 1;
else { /* It is embedded inside namelist. Is it preceded by a space? */
found_pos = found_in_list - namelist;
if (namelist[found_pos-1] == ' ')
found_name = 1;
}
if (found_name)
return 1;
else
return 0;
}
ASPELL(spell_locate_object)
{
@ -165,22 +204,18 @@ ASPELL(spell_locate_object)
char name[MAX_INPUT_LENGTH];
int j;
/*
* FIXME: This is broken. The spell parser routines took the argument
* the player gave to the spell and located an object with that keyword.
* Since we're passed the object and not the keyword we can only guess
* at what the player originally meant to search for. -gg
*/
if (!obj) {
send_to_char(ch, "You sense nothing.\r\n");
return;
}
strlcpy(name, fname(obj->name), sizeof(name));
j = level / 2;
/* added a global var to catch 2nd arg. */
sprintf(name, "%s", cast_arg2);
j = GET_LEVEL(ch) / 2; /* # items to show = twice char's level */
for (i = object_list; i && (j > 0); i = i->next) {
if (!isname(name, i->name))
if (!isname_obj(name, i->name))
continue;
send_to_char(ch, "%s", CAP(strdup(i->short_description)));
@ -198,13 +233,8 @@ ASPELL(spell_locate_object)
j--;
}
if (j == level / 2)
send_to_char(ch, "You sense nothing.\r\n");
}
ASPELL(spell_charm)
{
struct affected_type af;

View file

@ -1040,7 +1040,7 @@ struct game_data {
int dts_are_dumps; /* Should items in dt's be junked? */
int load_into_inventory;/* Objects load in immortals inventory. */
int track_through_doors;/* Track through doors while closed? */
int immort_level_ok; /* Automatically level mortals to imm? */
int no_mort_to_immort; /* Prevent mortals leveling to imms? */
char *OK; /* When player receives 'Okay.' text. */
char *NOPERSON; /* 'No-one by that name here.' */

View file

@ -152,9 +152,9 @@ void write_wizlist(FILE * out, int minlev, int maxlev)
int i, j;
fprintf(out,
"*************************************************************************\n"
"*******************************************************************************\n"
"* The following people have reached immortality on tbaMUD. *\n"
"*************************************************************************\n\n");
"*******************************************************************************\n\n");
for (curr_level = levels; curr_level; curr_level = curr_level->next) {
if (curr_level->params->level < minlev ||

View file

@ -577,7 +577,7 @@ void update_pos(struct char_data *victim);
#define CONFIG_DTS_ARE_DUMPS config_info.play.dts_are_dumps
#define CONFIG_LOAD_INVENTORY config_info.play.load_into_inventory
#define CONFIG_TRACK_T_DOORS config_info.play.track_through_doors
#define CONFIG_IMMORT_LEVEL_OK config_info.play.immort_level_ok
#define CONFIG_NO_MORT_TO_IMMORT config_info.play.no_mort_to_immort
#define CONFIG_OK config_info.play.OK
#define CONFIG_NOPERSON config_info.play.NOPERSON
#define CONFIG_NOEFFECT config_info.play.NOEFFECT