Added send_cannot_edit, removed LVL_FREEZE, and fixed fight_messages. --Rumble

This commit is contained in:
Rumble 2007-03-04 20:18:13 +00:00
parent f2bb44ceb1
commit 42377c319a
37 changed files with 6212 additions and 7018 deletions

19
FAQ
View file

@ -223,14 +223,21 @@ notably it cannot be used to make money in ANY way, the original developers'
names must be in the login screen and that the credits command always presents names must be in the login screen and that the credits command always presents
the same information, etc. the same information, etc.
tbaMUD's vision is to provide the MUDding community a stable and functional
codebase that includes an in-depth World and help files that makes it ready
to be molded into a custom MUD by its coders and builders. We also provide
multiple resources to allow for feedback, contribution, and the sharing of
ideas within the MUDding community to ensure constant development and
improvements.
TbaMUD is highly developed from the programming side, but highly UNdeveloped TbaMUD is highly developed from the programming side, but highly UNdeveloped
on the game-playing side. So, if you're looking for a huge MUD with billions on the game-playing side. So, if you're looking for a huge MUD with billions
of spells, skills, classes, and races, tbaMUD will probably disappoint you of spells, skills, classes, and races, tbaMUD will disappoint you. TbaMUD still
severely. TbaMUD still has only the 4 original Diku classes, the original has only the 4 original Diku classes, the original spells, and the original
spells, and the original skills. On the other hand, if you're looking for a skills. On the other hand, if you're looking for a highly stable, developed,
highly stable, well-developed, well-organized "blank slate" MUD on which you organized, and well documented "blank slate" MUD on which you can put your OWN
can put your OWN ideas for spells, skills, and classes, then tbaMUD is what ideas for spells, skills, and classes, then tbaMUD is what what you are looking
what you are looking for." for.
1.5. What is the history of tbaMUD? 1.5. What is the history of tbaMUD?

View file

@ -1,11 +1,34 @@
tbaMUD is currently being developed by The Builder Academy. If you need any TbaMUD is currently being developed by The Builder Academy. If you need any
help or find any bugs please stop by: builderacademy.net 9091 help, find any bugs, or have ideas for improvement please stop by TBA.
Rumble
The Builder Academy
builderacademy.net 9091
tbaMUD 3.52
[Mar 04 2007] - Rumble
Fixed fight_messages not displaying (thanks Rhade).
Removed LVL_FREEZE and set ban/freeze to LVL_GRGOD.
Added send_cannot_edit function (thanks Rhade).
[Feb 26 2007] - Rumble
updated CYGWIN.README, FAQ, and README
Added in game changelog command (thanks Rhade).
Moved do_file to act.wizard.c.
Alphabetized Makefile.in, yeah I'm anal like that.
Clarified licheck so people know to enter Q to accept the license and quit.
[Feb 25 2007] - Rumble
Fixed oat and wat (thanks Rhade).
Numerous social fixes (thanks Rhade, Fizban, and Amber).
Removed do_insult.
Cleaned up hedit formatting and fixed possible bug from editing a help file
you can't view (thanks Rhade).
Fixed cast ' ' so it won't cast armor (thanks Rhade).
tbaMUD 3.51 tbaMUD 3.51
- Removed the extra space when you have no title (thanks Rhade). - Removed the extra space when you have no title (thanks Rhade).
- Added "Top of File" to the do_file command (thanks Rhade). - Added "Top of File" to the do_file command (thanks Rhade).
- Removed socials from wizhelp. - Removed socials from wizhelp (thanks Rhade).
- Changed zlist with no arg to list zones. - Changed zlist with no arg to list zones (thanks Rhade).
- Wiznet can now be seen while in OLC, again (thanks Fizban). - Wiznet can now be seen while in OLC, again (thanks Fizban).
- Removed MOBprograms. - Removed MOBprograms.
- Added ALL_PERMISSIONS so anyone with OLC can have access to the entire World. - Added ALL_PERMISSIONS so anyone with OLC can have access to the entire World.
@ -260,6 +283,7 @@ CircleMUD 3.5
- Added buildwalk and dig. - Added buildwalk and dig.
Release history: Release history:
Version 3.52 release: April, 2007
Version 3.51 release: February, 2007 Version 3.51 release: February, 2007
Version 3.5 release: December, 2006 Version 3.5 release: December, 2006
Version 3.1 (yes, no beta pl): November 18, 2002 Version 3.1 (yes, no beta pl): November 18, 2002

View file

@ -1,16 +1,13 @@
The README.Cygwin that comes with CircleMUD is outdated. Below is current and Compiling tbaMUD
works as of December 2006.
Compiling CircleMUD
under Microsoft Windows using CygWin under Microsoft Windows using CygWin
CircleMUD 3.1 compiles under Cygwin without needing any special modifications. tbaMUD compiles under Cygwin without needing any special modifications.
This free pseudo-Unix environment for Windows includes the "bash" shell, "gcc" This free pseudo-Unix environment for Windows includes the "bash" shell, "gcc"
family of compilers, and a full set of programs and libraries for Windows users family of compilers, and a full set of programs and libraries for Windows users
to compile and run programs from source code intended for Unix. It can be to compile and run programs from source code intended for Unix. It can be
downloaded from: http://cygwin.com/ downloaded from: http://cygwin.com/
Compiling Circle under Cygwin is basically the same as it would be under Compiling tbaMUD under Cygwin is basically the same as it would be under
another form of Unix: another form of Unix:
1) Download from: http://cygwin.com/setup.exe 1) Download from: http://cygwin.com/setup.exe
@ -23,18 +20,17 @@ another form of Unix:
Click Next. Click Next.
Install, follow prompts. Install, follow prompts.
2) Download and uncompress the latest version of CircleMUD. TBA is now 2) Download and uncompress the latest version of tbaMUD:
recommending everyone use CWG (CircleMUD With Goodies) Buddha since it comes http://cwg.lazuras.org/modules.php?name=Downloads&d_op=viewdownload&cid=16
pre-packaged with many important features like OLC and Trigedit. Join the Join the forums as they will be a great resource for any problems that you
forum and download Buddha at: http://cwg.lazuras.org/ The forums will encounter. Once you download and uncompress tbaMUD (I use winRAR) read
also be a great resource for any problems that come up. Once you download through the /doc directory.
and uncompress Buddha (I use winRAR) read through the /doc directory.
3) Start the Cygwin "bash" shell by double clicking the Cygwin Icon. This will 3) Start the Cygwin "bash" shell by double clicking the Cygwin Icon. This will
open a telnet looking window that mimics a *nix server where you can run the open a telnet looking window that mimics a *nix server where you can run the
MUD. Go to the directory where you extracted CircleMUD by using the "cd" change MUD. Go to the directory where you extracted tbaMUD by using the "cd" change
directory command and "dir" directory listing to find the correct files. For directory command and "dir" directory listing to find the correct files. For
example "C:\circle". "cd c:/circle" "dir" in the listed files you should see example "C:\tbaMUD". "cd c:/tbaMUD" "dir" in the listed files you should see
one called configure. DO NOT go into the SRC directory yet. one called configure. DO NOT go into the SRC directory yet.
4) Run the configure script by typing "./configure". This will automatically 4) Run the configure script by typing "./configure". This will automatically
@ -46,12 +42,12 @@ another form of Unix:
an executable, you can also try "sh configure", "sh ./configure", an executable, you can also try "sh configure", "sh ./configure",
"bash configure" and "bash ./configure" until one of them works. "bash configure" and "bash ./configure" until one of them works.
5) NOW change to the /circle/src directory "cd src", and type "make", and watch 5) NOW change to the /tbaMUD/src directory "cd src", and type "make", and watch
CircleMUD and the additional utilies included in the Circle distribution tbaMUD and the additional utilities included in the tbaMUD distribution
automatically being compiled and placed in /circle/bin. automatically being compiled and placed in /tbaMUD/bin.
6) Go back to /circle, and run the MUD either directly by typing 6) Go back to /tbaMUD, and run the MUD either directly by typing
"bin/circle", or by using the "./autorun &" script. "bin/tbaMUD", or by using the "./autorun &" script.
7) Start a telnet program. Open a connection to your own machine "localhost" 7) Start a telnet program. Open a connection to your own machine "localhost"
on port 4000. You should see the MUD's login screen welcoming you. The on port 4000. You should see the MUD's login screen welcoming you. The
@ -59,22 +55,19 @@ another form of Unix:
If you have problems, read this document again. Most of the questions received If you have problems, read this document again. Most of the questions received
in email or which are posted to USENET newsgroups are answered in this file, or in email or which are posted to USENET newsgroups are answered in this file, or
in other documents included in the CircleMUD distribution. If you are still in other documents included in the tbaMUD distribution. If you are still
having problems and you're *sure* that your question is not answered in this having problems and you're *sure* that your question is not answered in this
document or in one of the others files in the /circle/doc directory, try document or in one of the others files in the /tbaMUD/doc directory, try
reading the through the CircleMUD website at: http://www.circlemud.org reading the forums at http://cwg.lazuras.org/ or stop by TBA for assistance.
It really can not be stressed enough: READ EVERYTHING. It really can not be stressed enough: READ EVERYTHING.
Credit where credit is due: Credit where credit is due:
Some parts of this document have been derived or outright copied from other Some parts of this document have been derived or outright copied from other
files in the CircleMUD distribution by: files by: Jeremy Elson, David Goldstein, Tony Robbins, and George Greer
Jeremy Elson
David Goldstein
Tony Robbins
George Greer
Rumble Rumble
Rumble@@builderacademy.net Rumble@builderacademy.net
The Builder Academy The Builder Academy
builderacademy.net 9091 builderacademy.net 9091

View file

@ -24,28 +24,27 @@ CFLAGS = @CFLAGS@ $(MYFLAGS) $(PROFILE)
LIBS = @LIBS@ @CRYPTLIB@ @NETLIB@ LIBS = @LIBS@ @CRYPTLIB@ @NETLIB@
OBJFILES = act.comm.o act.informative.o act.item.o act.movement.o \ OBJFILES = act.comm.o act.informative.o act.item.o act.movement.o \
act.offensive.o act.other.o act.social.o act.wizard.o alias.o ban.o \ act.offensive.o act.other.o act.social.o act.wizard.o aedit.o alias.o \
boards.o castle.o cedit.o class.o comm.o config.o constants.o db.o \ ban.o boards.o bsd-snprintf.o castle.o cedit.o class.o comm.o config.o \
fight.o genmob.o genobj.o genolc.o genshp.o genwld.o genzon.o graph.o \ constants.o dg_comm.o dg_db_scripts.o dg_event.o dg_handler.o dg_misc.o \
handler.o house.o improved-edit.o interpreter.o limits.o magic.o mail.o \ dg_mobcmd.o dg_objcmd.o dg_olc.o dg_scripts.o dg_triggers.o \
medit.o mobact.o modify.o oasis.o oasis_copy.o oasis_delete.o \ dg_variables.o dg_wldcmd.o db.o context_help.o fight.o genmob.o \
oasis_list.o objsave.o oedit.o random.o redit.o sedit.o \ genobj.o genolc.o genshp.o genwld.o genzon.o graph.o handler.o hedit.o \
shop.o spec_assign.o spec_procs.o spell_parser.o spells.o tedit.o \ house.o improved-edit.o interpreter.o limits.o magic.o mail.o medit.o \
utils.o weather.o zedit.o bsd-snprintf.o \ mobact.o modify.o oasis.o oasis_copy.o oasis_delete.o oasis_list.o \
dg_comm.o dg_db_scripts.o dg_event.o dg_handler.o dg_mobcmd.o \ objsave.o oedit.o players.o random.o redit.o sedit.o shop.o \
dg_misc.o dg_objcmd.o dg_scripts.o dg_triggers.o dg_wldcmd.o dg_olc.o \ spec_assign.o spec_procs.o spell_parser.o spells.o tedit.o utils.o \
dg_variables.o \ weather.o zedit.o zmalloc.o
context_help.o hedit.o aedit.o zmalloc.o players.o
CXREF_FILES = act.comm.c act.informative.c act.item.c act.movement.c \ CXREF_FILES = act.comm.c act.informative.c act.item.c act.movement.c \
act.offensive.c act.other.c act.social.c act.wizard.c alias.c ban.c \ act.offensive.c act.other.c act.social.c act.wizard.c alias.c \
boards.c castle.c cedit.c class.c comm.c config.c constants.c db.c \ ban.o boards.c bsd-snprintf.c castle.c cedit.c class.c comm.c config.c \
fight.c genmob.c genobj.c genolc.c genshp.c genwld.c genzon.c graph.c \ constants.c db.c fight.c genmob.c genobj.c genolc.c genshp.c genwld.c \
handler.c house.c improved-edit.c interpreter.c limits.c magic.c mail.c \ genzon.c graph.c handler.c hedit.c house.c improved-edit.c \
medit.c mobact.c modify.c oasis.c oasis_copy.c oasis_delete.c \ interpreter.c limits.c magic.c mail.c medit.c mobact.c modify.c oasis.c \
oasis_list.c objsave.c oedit.c olc.c random.c redit.c sedit.c \ oasis_copy.c oasis_delete.c oasis_list.c objsave.c oedit.c olc.c \
shop.c spec_assign.c spec_procs.c spell_parser.c spells.c tedit.c \ players.c random.c redit.c sedit.c shop.c spec_assign.c spec_procs.c \
utils.c weather.c zedit.c hedit.c bsd-snprintf.c players.c spell_parser.c spells.c tedit.c utils.c weather.c zedit.c
default: all default: all

View file

@ -1922,7 +1922,7 @@ ACMD(do_toggle)
} }
if (((tp = search_block(arg2, types, FALSE)) == -1)) { if (((tp = search_block(arg2, types, FALSE)) == -1)) {
send_to_char(ch, "Usage: color { Off | Normal | On }\r\n"); send_to_char(ch, "Usage: toggle color { Off | Normal | On }\r\n");
return; return;
} }
REMOVE_BIT(PRF_FLAGS(ch), PRF_COLOR_1 | PRF_COLOR_2); REMOVE_BIT(PRF_FLAGS(ch), PRF_COLOR_1 | PRF_COLOR_2);
@ -1936,7 +1936,7 @@ ACMD(do_toggle)
return; return;
} }
if (((tp = search_block(arg2, types, FALSE)) == -1)) { if (((tp = search_block(arg2, types, FALSE)) == -1)) {
send_to_char(ch, "Usage: syslog { Off | Brief | Normal | On }\r\n"); send_to_char(ch, "Usage: toggle syslog { Off | Brief | Normal | On }\r\n");
return; return;
} }
REMOVE_BIT(PRF_FLAGS(ch), PRF_LOG1 | PRF_LOG2); REMOVE_BIT(PRF_FLAGS(ch), PRF_LOG1 | PRF_LOG2);

View file

@ -462,9 +462,10 @@ int perform_drop(struct char_data *ch, struct obj_data *obj,
if ((mode == SCMD_DROP) && !drop_wtrigger(obj, ch)) if ((mode == SCMD_DROP) && !drop_wtrigger(obj, ch))
return 0; return 0;
if (OBJ_FLAGGED(obj, ITEM_NODROP)) { if (OBJ_FLAGGED(obj, ITEM_NODROP) && !PRF_FLAGGED(ch, PRF_NOHASSLE)) {
snprintf(buf, sizeof(buf), "You can't %s $p, it must be CURSED!", sname); snprintf(buf, sizeof(buf), "You can't %s $p, it must be CURSED!", sname);
act(buf, FALSE, ch, obj, 0, TO_CHAR); act(buf, FALSE, ch, obj, 0, TO_CHAR);
return (0);
} }
snprintf(buf, sizeof(buf), "You %s $p.%s", sname, VANISH(mode)); snprintf(buf, sizeof(buf), "You %s $p.%s", sname, VANISH(mode));
@ -1166,8 +1167,6 @@ ACMD(do_pour)
weight_change_object(to_obj, amount); /* Add weight */ weight_change_object(to_obj, amount); /* Add weight */
} }
void wear_message(struct char_data *ch, struct obj_data *obj, int where) void wear_message(struct char_data *ch, struct obj_data *obj, int where)
{ {
const char *wear_messages[][2] = { const char *wear_messages[][2] = {
@ -1230,8 +1229,6 @@ void wear_message(struct char_data *ch, struct obj_data *obj, int where)
act(wear_messages[where][1], FALSE, ch, obj, 0, TO_CHAR); act(wear_messages[where][1], FALSE, ch, obj, 0, TO_CHAR);
} }
void perform_wear(struct char_data *ch, struct obj_data *obj, int where) void perform_wear(struct char_data *ch, struct obj_data *obj, int where)
{ {
/* /*
@ -1293,8 +1290,6 @@ void perform_wear(struct char_data *ch, struct obj_data *obj, int where)
equip_char(ch, obj, where); equip_char(ch, obj, where);
} }
int find_eq_pos(struct char_data *ch, struct obj_data *obj, char *arg) int find_eq_pos(struct char_data *ch, struct obj_data *obj, char *arg)
{ {
int where = -1; int where = -1;
@ -1340,8 +1335,6 @@ int find_eq_pos(struct char_data *ch, struct obj_data *obj, char *arg)
return (where); return (where);
} }
ACMD(do_wear) ACMD(do_wear)
{ {
char arg1[MAX_INPUT_LENGTH]; char arg1[MAX_INPUT_LENGTH];
@ -1401,8 +1394,6 @@ ACMD(do_wear)
} }
} }
ACMD(do_wield) ACMD(do_wield)
{ {
char arg[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH];
@ -1424,8 +1415,6 @@ ACMD(do_wield)
} }
} }
ACMD(do_grab) ACMD(do_grab)
{ {
char arg[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH];
@ -1451,21 +1440,17 @@ ACMD(do_grab)
} }
} }
void perform_remove(struct char_data *ch, int pos) void perform_remove(struct char_data *ch, int pos)
{ {
struct obj_data *obj; struct obj_data *obj;
if (!(obj = GET_EQ(ch, pos))) if (!(obj = GET_EQ(ch, pos)))
log("SYSERR: perform_remove: bad pos %d passed.", pos); log("SYSERR: perform_remove: bad pos %d passed.", pos);
/* SYSERR_DESC: /* This error occurs when perform_remove() is passed a bad 'pos'
* This error occurs when perform_remove() is passed a bad 'pos' * (location) to remove an object from. */
* (location) to remove an object from. else if (OBJ_FLAGGED(obj, ITEM_NODROP) && !PRF_FLAGGED(ch, PRF_NOHASSLE))
*/
else if (OBJ_FLAGGED(obj, ITEM_NODROP))
act("You can't remove $p, it must be CURSED!", FALSE, ch, obj, 0, TO_CHAR); act("You can't remove $p, it must be CURSED!", FALSE, ch, obj, 0, TO_CHAR);
else if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch)) else if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch)&& !PRF_FLAGGED(ch, PRF_NOHASSLE))
act("$p: you can't carry that many items!", FALSE, ch, obj, 0, TO_CHAR); act("$p: you can't carry that many items!", FALSE, ch, obj, 0, TO_CHAR);
else { else {
if (!remove_otrigger(obj, ch)) if (!remove_otrigger(obj, ch))
@ -1477,8 +1462,6 @@ void perform_remove(struct char_data *ch, int pos)
} }
} }
ACMD(do_remove) ACMD(do_remove)
{ {
char arg[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH];

View file

@ -58,7 +58,6 @@ ACMD(do_use);
ACMD(do_display); ACMD(do_display);
ACMD(do_gen_tog); ACMD(do_gen_tog);
ACMD(do_gen_write); ACMD(do_gen_write);
ACMD(do_file);
ACMD(do_quit) ACMD(do_quit)
{ {
@ -931,104 +930,3 @@ ACMD(do_gen_tog)
return; return;
} }
ACMD(do_file)
{
FILE *req_file;
int cur_line = 0, num_lines = 0, req_lines = 0, i, j, l;
char field[MAX_INPUT_LENGTH], value[MAX_INPUT_LENGTH], line[READ_SIZE];
char buf[MAX_STRING_LENGTH];
size_t len = 0, nlen;
struct file_struct {
char *cmd;
char level;
char *file;
} fields[] = {
{ "bugs", LVL_BUILDER, "../lib/misc/bugs"},
{ "typos", LVL_BUILDER , "../lib/misc/typos"},
{ "ideas", LVL_BUILDER, "../lib/misc/ideas"},
{ "xnames", LVL_BUILDER, "../lib/misc/xnames"},
{ "levels", LVL_BUILDER, "../log/levels" },
{ "rip", LVL_BUILDER, "../log/rip" },
{ "players", LVL_BUILDER, "../log/newplayers" },
{ "rentgone", LVL_BUILDER, "../log/rentgone" },
{ "errors", LVL_BUILDER, "../log/errors" },
{ "godcmds", LVL_BUILDER, "../log/godcmds" },
{ "syslog", LVL_BUILDER, "../syslog" },
{ "crash", LVL_BUILDER, "../syslog.CRASH" },
{ "help", LVL_BUILDER, "../log/help" },
{ "\n", 0, "\n" }
};
skip_spaces(&argument);
if (!*argument) {
send_to_char(ch, "USAGE: file <option> <num lines>\r\n\r\nFile options:\r\n");
for (j = 0, i = 0; fields[i].level; i++)
if (fields[i].level <= GET_LEVEL(ch))
send_to_char(ch, "%-15s%s\r\n", fields[i].cmd, fields[i].file);
return;
}
two_arguments(argument, field, value);
for (l = 0; *(fields[l].cmd) != '\n'; l++)
if (!strncmp(field, fields[l].cmd, strlen(field)))
break;
if(*(fields[l].cmd) == '\n') {
send_to_char(ch, "That is not a valid option!\r\n");
return;
}
if (GET_LEVEL(ch) < fields[l].level) {
send_to_char(ch, "You are not godly enough to view that file!\r\n");
return;
}
if(!*value)
req_lines = 15; /* default is the last 15 lines */
else
req_lines = atoi(value);
if (!(req_file=fopen(fields[l].file,"r"))) {
mudlog(BRF, LVL_IMPL, TRUE,
"SYSERR: Error opening file %s using 'file' command.",
fields[l].file);
return;
}
get_line(req_file, line);
while (!feof(req_file)) {
num_lines++;
get_line(req_file,line);
}
rewind(req_file);
req_lines = MIN(MIN(req_lines, num_lines),150);
len = snprintf(buf, sizeof(buf), "Last %d lines of %s:\r\n", req_lines, fields[l].file);
if (req_lines == num_lines)
len += snprintf(buf + len, sizeof(buf) - len, "Top of file.\r\n");
get_line(req_file,line);
while (!feof(req_file)) {
cur_line++;
if(cur_line > (num_lines - req_lines)) {
nlen = snprintf(buf + len, sizeof(buf) - len, "%s\r\n", line);
if (len + nlen >= sizeof(buf) || nlen < 0)
break;
len += nlen;
}
get_line(req_file,line);
}
fclose(req_file);
if (len >= sizeof(buf)) {
const char *overflow = "\r\n**OVERFLOW**\r\n";
strcpy(buf + sizeof(buf) - strlen(overflow) - 1, overflow); /* strcpy: OK */
}
page_string(ch->desc, buf, 1);
}

View file

@ -2113,7 +2113,7 @@ ACMD(do_force)
if (!(vict = get_char_vis(ch, arg, NULL, FIND_CHAR_WORLD))) if (!(vict = get_char_vis(ch, arg, NULL, FIND_CHAR_WORLD)))
send_to_char(ch, "%s", CONFIG_NOPERSON); send_to_char(ch, "%s", CONFIG_NOPERSON);
else if (!IS_NPC(vict) && GET_LEVEL(ch) < LVL_GOD) else if (!IS_NPC(vict) && GET_LEVEL(ch) < LVL_GOD)
send_to_char(ch, "You can not force players.\r\n"); send_to_char(ch, "Only level GOD and above can force players.\r\n");
else if (!IS_NPC(vict) && GET_LEVEL(ch) <= GET_LEVEL(vict)) else if (!IS_NPC(vict) && GET_LEVEL(ch) <= GET_LEVEL(vict))
send_to_char(ch, "No, no, no!\r\n"); send_to_char(ch, "No, no, no!\r\n");
else { else {
@ -2726,7 +2726,7 @@ ACMD(do_show)
{ "dex", LVL_BUILDER, BOTH, NUMBER }, { "dex", LVL_BUILDER, BOTH, NUMBER },
{ "drunk", LVL_BUILDER, BOTH, MISC }, { "drunk", LVL_BUILDER, BOTH, MISC },
{ "exp", LVL_GOD, BOTH, NUMBER }, { "exp", LVL_GOD, BOTH, NUMBER },
{ "frozen", LVL_FREEZE, PC, BINARY }, /* 15 */ { "frozen", LVL_GRGOD, PC, BINARY }, /* 15 */
{ "gold", LVL_BUILDER, BOTH, NUMBER }, { "gold", LVL_BUILDER, BOTH, NUMBER },
{ "height", LVL_BUILDER, BOTH, NUMBER }, { "height", LVL_BUILDER, BOTH, NUMBER },
{ "hit", LVL_BUILDER, BOTH, NUMBER }, { "hit", LVL_BUILDER, BOTH, NUMBER },
@ -3029,7 +3029,7 @@ int perform_set(struct char_data *ch, struct char_data *vict, int mode, char *va
else if (is_abbrev(val_arg, "off")) else if (is_abbrev(val_arg, "off"))
GET_OLC_ZONE(vict) = NOWHERE; GET_OLC_ZONE(vict) = NOWHERE;
else if (!is_number(val_arg)) { else if (!is_number(val_arg)) {
send_to_char(ch, "Value must be either 'aedit', 'hedit', 'off' or a zone number.\r\n"); send_to_char(ch, "Value must be a zone number, 'aedit', 'hedit', 'off' or 'all'.\r\n");
return (0); return (0);
} else } else
GET_OLC_ZONE(vict) = atoi(val_arg); GET_OLC_ZONE(vict) = atoi(val_arg);
@ -4116,3 +4116,164 @@ ACMD(do_zpurge)
mudlog(NRM, MAX(LVL_GRGOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s purged entire world.", GET_NAME(ch)); mudlog(NRM, MAX(LVL_GRGOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s purged entire world.", GET_NAME(ch));
} }
} }
ACMD(do_file)
{
FILE *req_file;
int cur_line = 0, num_lines = 0, req_lines = 0, i, j, l;
char field[MAX_INPUT_LENGTH], value[MAX_INPUT_LENGTH], line[READ_SIZE];
char buf[MAX_STRING_LENGTH];
size_t len = 0, nlen;
struct file_struct {
char *cmd;
char level;
char *file;
} fields[] = {
{ "bugs", LVL_GOD, "../lib/misc/bugs"},
{ "typos", LVL_GOD, "../lib/misc/typos"},
{ "ideas", LVL_GOD, "../lib/misc/ideas"},
{ "xnames", LVL_GOD, "../lib/misc/xnames"},
{ "levels", LVL_GOD, "../log/levels" },
{ "rip", LVL_GOD, "../log/rip" },
{ "players", LVL_GOD, "../log/newplayers" },
{ "rentgone", LVL_GOD, "../log/rentgone" },
{ "errors", LVL_GOD, "../log/errors" },
{ "godcmds", LVL_GOD, "../log/godcmds" },
{ "syslog", LVL_GOD, "../syslog" },
{ "crash", LVL_GOD, "../syslog.CRASH" },
{ "help", LVL_GOD, "../log/help" },
{ "\n", 0, "\n" }
};
skip_spaces(&argument);
if (!*argument) {
send_to_char(ch, "USAGE: file <option> <num lines>\r\n\r\nFile options:\r\n");
for (j = 0, i = 0; fields[i].level; i++)
if (fields[i].level <= GET_LEVEL(ch))
send_to_char(ch, "%-15s%s\r\n", fields[i].cmd, fields[i].file);
return;
}
two_arguments(argument, field, value);
for (l = 0; *(fields[l].cmd) != '\n'; l++)
if (!strncmp(field, fields[l].cmd, strlen(field)))
break;
if(*(fields[l].cmd) == '\n') {
send_to_char(ch, "That is not a valid option!\r\n");
return;
}
if (GET_LEVEL(ch) < fields[l].level) {
send_to_char(ch, "You are not godly enough to view that file!\r\n");
return;
}
if(!*value)
req_lines = 15; /* default is the last 15 lines */
else
req_lines = atoi(value);
if (!(req_file=fopen(fields[l].file,"r"))) {
mudlog(BRF, LVL_IMPL, TRUE,
"SYSERR: Error opening file %s using 'file' command.",
fields[l].file);
return;
}
get_line(req_file, line);
while (!feof(req_file)) {
num_lines++;
get_line(req_file,line);
}
rewind(req_file);
req_lines = MIN(MIN(req_lines, num_lines),150);
len = snprintf(buf, sizeof(buf), "Last %d lines of %s:\r\n", req_lines, fields[l].file);
if (req_lines == num_lines)
len += snprintf(buf + len, sizeof(buf) - len, "Top of file.\r\n");
get_line(req_file,line);
while (!feof(req_file)) {
cur_line++;
if(cur_line > (num_lines - req_lines)) {
nlen = snprintf(buf + len, sizeof(buf) - len, "%s\r\n", line);
if (len + nlen >= sizeof(buf) || nlen < 0)
break;
len += nlen;
}
get_line(req_file,line);
}
fclose(req_file);
if (len >= sizeof(buf)) {
const char *overflow = "\r\n**OVERFLOW**\r\n";
strcpy(buf + sizeof(buf) - strlen(overflow) - 1, overflow); /* strcpy: OK */
}
page_string(ch->desc, buf, 1);
}
ACMD(do_changelog)
{
time_t rawtime;
char tmstr[MAX_INPUT_LENGTH], line[READ_SIZE], last_buf[READ_SIZE],
buf[READ_SIZE];
FILE *fl, *new;
skip_spaces(&argument);
if (!*argument) {
send_to_char(ch, "Usage: changelog <change>\r\n");
return;
}
sprintf(buf, "%s.bak", CHANGE_LOG_FILE);
if (rename(CHANGE_LOG_FILE, buf)) {
mudlog(BRF, LVL_IMPL, TRUE,
"SYSERR: Error making backup changelog file (%s)", buf);
return;
}
if (!(fl = fopen(buf, "r"))) {
mudlog(BRF, LVL_IMPL, TRUE,
"SYSERR: Error opening backup changelog file (%s)", buf);
return;
}
if (!(new = fopen(CHANGE_LOG_FILE, "w"))) {
mudlog(BRF, LVL_IMPL, TRUE,
"SYSERR: Error opening new changelog file (%s)", CHANGE_LOG_FILE);
return;
}
while (get_line(fl, line)) {
if (*line != '[')
fprintf(new, "%s\n", line);
else {
strcpy(last_buf, line);
break;
}
}
rawtime = time(0);
strftime(tmstr, sizeof(tmstr), "%b %d %Y", localtime(&rawtime));
sprintf(buf, "[%s] - %s", tmstr, GET_NAME(ch));
fprintf(new, "%s\n", buf);
fprintf(new, " %s\n", argument);
if (strcmp(buf, last_buf))
fprintf(new, "%s\n", line);
while (get_line(fl, line))
fprintf(new, "%s\n", line);
fclose(fl);
fclose(new);
send_to_char(ch, "Change added.\r\n");
}

View file

@ -357,7 +357,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
break; break;
default: default:
write_to_output(d, "Invalid choice!\r\n" write_to_output(d, "Invalid choice!\r\n"
"Do you wish to save this action internally? "); "Do you wish to save your changes? ");
break; break;
} }
return; /* end of AEDIT_CONFIRM_SAVESTRING */ return; /* end of AEDIT_CONFIRM_SAVESTRING */
@ -418,7 +418,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
switch (*arg) { switch (*arg) {
case 'q': case 'Q': case 'q': case 'Q':
if (OLC_VAL(d)) { /* Something was modified */ if (OLC_VAL(d)) { /* Something was modified */
write_to_output(d, "Do you wish to save this action internally? "); write_to_output(d, "Do you wish to save your changes? ");
OLC_MODE(d) = AEDIT_CONFIRM_SAVESTRING; OLC_MODE(d) = AEDIT_CONFIRM_SAVESTRING;
} }
else cleanup_olc(d, CLEANUP_ALL); else cleanup_olc(d, CLEANUP_ALL);

View file

@ -67,7 +67,7 @@ Be sure to also change NUM_OF_BOARDS in board.h
struct board_info_type board_info[NUM_OF_BOARDS] = { struct board_info_type board_info[NUM_OF_BOARDS] = {
{3099, 0, 0, LVL_GOD, LIB_ETC "board.mortal", 0}, {3099, 0, 0, LVL_GOD, LIB_ETC "board.mortal", 0},
{3098, LVL_IMMORT, LVL_IMMORT, LVL_GRGOD, LIB_ETC "board.immortal", 0}, {3098, LVL_IMMORT, LVL_IMMORT, LVL_GRGOD, LIB_ETC "board.immortal", 0},
{3097, LVL_IMMORT, LVL_FREEZE, LVL_IMPL, LIB_ETC "board.freeze", 0}, {3097, LVL_IMMORT, LVL_GRGOD, LVL_IMPL, LIB_ETC "board.freeze", 0},
{3096, 0, 0, LVL_IMMORT, LIB_ETC "board.social", 0}, {3096, 0, 0, LVL_IMMORT, LIB_ETC "board.social", 0},
{1226, 0, 0, LVL_IMPL, LIB_ETC "board.builder", 0}, {1226, 0, 0, LVL_IMPL, LIB_ETC "board.builder", 0},
{1227, 0, 0, LVL_IMPL, LIB_ETC "board.staff", 0}, {1227, 0, 0, LVL_IMPL, LIB_ETC "board.staff", 0},

View file

@ -810,7 +810,7 @@ void cedit_parse(struct descriptor_data *d, char *arg)
return; return;
default : default :
write_to_output(d, "\r\nThat is an invalid choice!\r\n"); write_to_output(d, "\r\nThat is an invalid choice!\r\n");
write_to_output(d, "Do you wish to save the configuration? (y/n) : "); write_to_output(d, "Do you wish to save your changes? (y/n) : ");
return; return;
} }
@ -850,7 +850,7 @@ void cedit_parse(struct descriptor_data *d, char *arg)
case 'q': case 'q':
case 'Q': case 'Q':
write_to_output(d, "Do you wish to save the configuration? (y/n) : "); write_to_output(d, "Do you wish to save your changes? (y/n) : ");
OLC_MODE(d) = CEDIT_CONFIRM_SAVESTRING; OLC_MODE(d) = CEDIT_CONFIRM_SAVESTRING;
break; break;

View file

@ -111,6 +111,7 @@
#define BAN_FILE LIB_ETC"badsites" /* for the siteban system */ #define BAN_FILE LIB_ETC"badsites" /* for the siteban system */
#define HCONTROL_FILE LIB_ETC"hcontrol" /* for the house system */ #define HCONTROL_FILE LIB_ETC"hcontrol" /* for the house system */
#define TIME_FILE LIB_ETC"time" /* for calendar system */ #define TIME_FILE LIB_ETC"time" /* for calendar system */
#define CHANGE_LOG_FILE "../changelog" /* for the changelog */
/* new bitvector data for use in player_index_element */ /* new bitvector data for use in player_index_element */
#define PINDEX_DELETED (1 << 0) /* deleted player */ #define PINDEX_DELETED (1 << 0) /* deleted player */

View file

@ -158,8 +158,10 @@ OCMD(do_oecho)
else if ((room = obj_room(obj)) != NOWHERE) else if ((room = obj_room(obj)) != NOWHERE)
{ {
if (world[room].people) if (world[room].people) {
sub_write(argument, world[room].people, TRUE, TO_ROOM | TO_CHAR); sub_write(argument, world[room].people, TRUE, TO_ROOM);
sub_write(argument, world[room].people, TRUE, TO_CHAR);
}
} }
else else
@ -603,8 +605,10 @@ OCMD(do_oasound)
if (world[room].dir_option[door] != NULL && if (world[room].dir_option[door] != NULL &&
(world[room].dir_option[door])->to_room != NOWHERE && (world[room].dir_option[door])->to_room != NOWHERE &&
(world[room].dir_option[door])->to_room != room && (world[room].dir_option[door])->to_room != room &&
world[(world[room].dir_option[door])->to_room].people) world[(world[room].dir_option[door])->to_room].people) {
sub_write(argument, world[(world[room].dir_option[door])->to_room].people, TRUE, TO_ROOM | TO_CHAR); sub_write(argument, world[(world[room].dir_option[door])->to_room].people, TRUE, TO_ROOM);
sub_write(argument, world[(world[room].dir_option[door])->to_room].people, TRUE, TO_CHAR);
}
} }
} }

View file

@ -92,11 +92,9 @@ ACMD(do_oasis_trigedit)
return; return;
} }
/* /* Everyone but IMPLs can only edit zones they have been assigned.*/
* Everyone but IMPLs can only edit zones they have been assigned.
*/
if (!can_edit_zone(ch, OLC_ZNUM(d))) { if (!can_edit_zone(ch, OLC_ZNUM(d))) {
send_to_char(ch, " You do not have permission to edit zone %d. Try zone %d.\r\n", zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); send_cannot_edit(ch, zone_table[OLC_ZNUM(d)].number);
mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d (allowed zone %d)", mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d (allowed zone %d)",
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
free(d->olc); free(d->olc);
@ -664,7 +662,7 @@ void trigedit_save(struct descriptor_data *d)
remove(buf); remove(buf);
rename(fname, buf); rename(fname, buf);
write_to_output(d, "Saving Index file\r\n"); write_to_output(d, "Trigger saved to disk.\r\n");
trigedit_create_index(zone, "trg"); trigedit_create_index(zone, "trg");
} }

View file

@ -701,7 +701,7 @@ EVENTFUNC(trig_wait_event)
log("Trigger restarted on unknown entity. Vnum: %d", GET_TRIG_VNUM(trig)); log("Trigger restarted on unknown entity. Vnum: %d", GET_TRIG_VNUM(trig));
log("Type: %s trigger", type==MOB_TRIGGER ? "Mob" : type == OBJ_TRIGGER ? "Obj" : "Room"); log("Type: %s trigger", type==MOB_TRIGGER ? "Mob" : type == OBJ_TRIGGER ? "Obj" : "Room");
log("attached %d places", trig_index[trig->nr]->number); log("attached %d places", trig_index[trig->nr]->number);
//script_log("Trigger restart attempt on unknown entity."); script_log("Trigger restart attempt on unknown entity.");
return 0; return 0;
} }
} }
@ -1569,22 +1569,19 @@ int process_if(char *cond, void *go, struct script_data *sc,
} }
/* /* scans for end of if-block. returns the line containg 'end', or the last
* scans for end of if-block. line of the trigger if not found. */
* returns the line containg 'end', or the last
* line of the trigger if not found.
*/
struct cmdlist_element *find_end(trig_data *trig, struct cmdlist_element *cl) struct cmdlist_element *find_end(trig_data *trig, struct cmdlist_element *cl)
{ {
struct cmdlist_element *c; struct cmdlist_element *c;
char *p; char *p;
if (!(cl->next)) { //rryan: if this is the last line, theres no end if (!(cl->next)) { /* rryan: if this is the last line, theres no end */
script_log("Trigger VNum %d has 'if' without 'end'. (error 1)", GET_TRIG_VNUM(trig)); script_log("Trigger VNum %d has 'if' without 'end'. (error 1)", GET_TRIG_VNUM(trig));
return cl; return cl;
} }
for (c = cl->next; c && c->next; c = c?c->next:NULL) { for (c = cl->next; c; c = c->next) {
for (p = c->cmd; *p && isspace(*p); p++); for (p = c->cmd; *p && isspace(*p); p++);
if (!strn_cmp("if ", p, 3)) if (!strn_cmp("if ", p, 3))
@ -1599,8 +1596,8 @@ struct cmdlist_element *find_end(trig_data *trig, struct cmdlist_element *cl)
} }
} }
//rryan: we didn't find an end /* rryan: we didn't find an end */
//script_log("Trigger VNum %d has 'if' without 'end'. (error 3)", GET_TRIG_VNUM(trig)); script_log("Trigger VNum %d has 'if' without 'end'. (error 3)", GET_TRIG_VNUM(trig));
return c; return c;
} }
@ -2562,7 +2559,7 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode)
dg_owner_purged = 0; dg_owner_purged = 0;
for (cl = (mode == TRIG_NEW) ? trig->cmdlist : trig->curr_state; for (cl = (mode == TRIG_NEW) ? trig->cmdlist : trig->curr_state;
cl && GET_TRIG_DEPTH(trig); cl = cl ? cl->next : NULL) { cl && GET_TRIG_DEPTH(trig); cl = cl->next) {
for (p = cl->cmd; *p && isspace(*p); p++); for (p = cl->cmd; *p && isspace(*p); p++);
if (*p == '*') /* comment */ if (*p == '*') /* comment */

View file

@ -10,7 +10,6 @@
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
#include "structs.h" #include "structs.h"
#include "utils.h" #include "utils.h"
#include "comm.h" #include "comm.h"
@ -81,9 +80,7 @@ struct attack_hit_type attack_hit_text[] =
}; };
#define IS_WEAPON(type) (((type) >= TYPE_HIT) && ((type) < TYPE_SUFFERING)) #define IS_WEAPON(type) (((type) >= TYPE_HIT) && ((type) < TYPE_SUFFERING))
/* The Fight related routines */ /* The Fight related routines */
void appear(struct char_data *ch) void appear(struct char_data *ch)
{ {
if (affected_by_spell(ch, SPELL_INVISIBLE)) if (affected_by_spell(ch, SPELL_INVISIBLE))
@ -98,7 +95,6 @@ void appear(struct char_data *ch)
FALSE, ch, 0, 0, TO_ROOM); FALSE, ch, 0, 0, TO_ROOM);
} }
int compute_armor_class(struct char_data *ch) int compute_armor_class(struct char_data *ch)
{ {
int armorclass = GET_AC(ch); int armorclass = GET_AC(ch);
@ -109,7 +105,6 @@ int compute_armor_class(struct char_data *ch)
return (MAX(-100, armorclass)); /* -100 is lowest */ return (MAX(-100, armorclass)); /* -100 is lowest */
} }
void free_messages_type(struct msg_type *msg) void free_messages_type(struct msg_type *msg)
{ {
if (msg->attacker_msg) free(msg->attacker_msg); if (msg->attacker_msg) free(msg->attacker_msg);
@ -117,7 +112,6 @@ void free_messages_type(struct msg_type *msg)
if (msg->room_msg) free(msg->room_msg); if (msg->room_msg) free(msg->room_msg);
} }
void free_messages(void) void free_messages(void)
{ {
int i; int i;
@ -136,7 +130,6 @@ void free_messages(void)
} }
} }
void load_messages(void) void load_messages(void)
{ {
FILE *fl; FILE *fl;
@ -155,6 +148,7 @@ void load_messages(void)
fight_messages[i].msg = NULL; fight_messages[i].msg = NULL;
} }
while (!feof(fl)) {
fgets(chk, 128, fl); fgets(chk, 128, fl);
while (!feof(fl) && (*chk == '\n' || *chk == '*')) while (!feof(fl) && (*chk == '\n' || *chk == '*'))
fgets(chk, 128, fl); fgets(chk, 128, fl);
@ -190,11 +184,10 @@ void load_messages(void)
while (!feof(fl) && (*chk == '\n' || *chk == '*')) while (!feof(fl) && (*chk == '\n' || *chk == '*'))
fgets(chk, 128, fl); fgets(chk, 128, fl);
} }
}
fclose(fl); fclose(fl);
} }
void update_pos(struct char_data *victim) void update_pos(struct char_data *victim)
{ {
if ((GET_HIT(victim) > 0) && (GET_POS(victim) > POS_STUNNED)) if ((GET_HIT(victim) > 0) && (GET_POS(victim) > POS_STUNNED))
@ -211,7 +204,6 @@ void update_pos(struct char_data *victim)
GET_POS(victim) = POS_STUNNED; GET_POS(victim) = POS_STUNNED;
} }
void check_killer(struct char_data *ch, struct char_data *vict) void check_killer(struct char_data *ch, struct char_data *vict)
{ {
if (PLR_FLAGGED(vict, PLR_KILLER) || PLR_FLAGGED(vict, PLR_THIEF)) if (PLR_FLAGGED(vict, PLR_KILLER) || PLR_FLAGGED(vict, PLR_THIEF))
@ -225,7 +217,6 @@ void check_killer(struct char_data *ch, struct char_data *vict)
GET_NAME(ch), GET_NAME(vict), world[IN_ROOM(vict)].name); GET_NAME(ch), GET_NAME(vict), world[IN_ROOM(vict)].name);
} }
/* start one char fighting another (yes, it is horrible, I know... ) */ /* start one char fighting another (yes, it is horrible, I know... ) */
void set_fighting(struct char_data *ch, struct char_data *vict) void set_fighting(struct char_data *ch, struct char_data *vict)
{ {
@ -250,8 +241,6 @@ void set_fighting(struct char_data *ch, struct char_data *vict)
check_killer(ch, vict); check_killer(ch, vict);
} }
/* remove a char from the list of fighting chars */ /* remove a char from the list of fighting chars */
void stop_fighting(struct char_data *ch) void stop_fighting(struct char_data *ch)
{ {
@ -267,8 +256,6 @@ void stop_fighting(struct char_data *ch)
update_pos(ch); update_pos(ch);
} }
void make_corpse(struct char_data *ch) void make_corpse(struct char_data *ch)
{ {
char buf2[MAX_NAME_LENGTH + 64]; char buf2[MAX_NAME_LENGTH + 64];
@ -335,19 +322,14 @@ void make_corpse(struct char_data *ch)
obj_to_room(corpse, IN_ROOM(ch)); obj_to_room(corpse, IN_ROOM(ch));
} }
/* When ch kills victim */ /* When ch kills victim */
void change_alignment(struct char_data *ch, struct char_data *victim) void change_alignment(struct char_data *ch, struct char_data *victim)
{ {
/* /* new alignment change algorithm: if you kill a monster with alignment A,
* new alignment change algorithm: if you kill a monster with alignment A, * you move 1/16th of the way to having alignment -A. Simple and fast. */
* you move 1/16th of the way to having alignment -A. Simple and fast.
*/
GET_ALIGNMENT(ch) += (-GET_ALIGNMENT(victim) - GET_ALIGNMENT(ch)) / 16; GET_ALIGNMENT(ch) += (-GET_ALIGNMENT(victim) - GET_ALIGNMENT(ch)) / 16;
} }
void death_cry(struct char_data *ch) void death_cry(struct char_data *ch)
{ {
int door; int door;
@ -359,8 +341,6 @@ void death_cry(struct char_data *ch)
send_to_room(world[IN_ROOM(ch)].dir_option[door]->to_room, "Your blood freezes as you hear someone's death cry.\r\n"); send_to_room(world[IN_ROOM(ch)].dir_option[door]->to_room, "Your blood freezes as you hear someone's death cry.\r\n");
} }
void raw_kill(struct char_data * ch, struct char_data * killer) void raw_kill(struct char_data * ch, struct char_data * killer)
{ {
if (FIGHTING(ch)) if (FIGHTING(ch))
@ -384,8 +364,6 @@ void raw_kill(struct char_data * ch, struct char_data * killer)
extract_char(ch); extract_char(ch);
} }
void die(struct char_data * ch, struct char_data * killer) void die(struct char_data * ch, struct char_data * killer)
{ {
gain_exp(ch, -(GET_EXP(ch) / 2)); gain_exp(ch, -(GET_EXP(ch) / 2));
@ -394,8 +372,6 @@ void die(struct char_data * ch, struct char_data * killer)
raw_kill(ch, killer); raw_kill(ch, killer);
} }
void perform_group_gain(struct char_data *ch, int base, void perform_group_gain(struct char_data *ch, int base,
struct char_data *victim) struct char_data *victim)
{ {
@ -412,7 +388,6 @@ void perform_group_gain(struct char_data *ch, int base,
change_alignment(ch, victim); change_alignment(ch, victim);
} }
void group_gain(struct char_data *ch, struct char_data *victim) void group_gain(struct char_data *ch, struct char_data *victim)
{ {
int tot_members, base, tot_gain; int tot_members, base, tot_gain;
@ -451,7 +426,6 @@ void group_gain(struct char_data *ch, struct char_data *victim)
perform_group_gain(f->follower, base, victim); perform_group_gain(f->follower, base, victim);
} }
void solo_gain(struct char_data *ch, struct char_data *victim) void solo_gain(struct char_data *ch, struct char_data *victim)
{ {
int exp; int exp;
@ -475,7 +449,6 @@ void solo_gain(struct char_data *ch, struct char_data *victim)
change_alignment(ch, victim); change_alignment(ch, victim);
} }
char *replace_string(const char *str, const char *weapon_singular, const char *weapon_plural) char *replace_string(const char *str, const char *weapon_singular, const char *weapon_plural)
{ {
static char buf[256]; static char buf[256];
@ -503,7 +476,6 @@ char *replace_string(const char *str, const char *weapon_singular, const char *w
return (buf); return (buf);
} }
/* message for doing damage with a weapon */ /* message for doing damage with a weapon */
void dam_message(int dam, struct char_data *ch, struct char_data *victim, void dam_message(int dam, struct char_data *ch, struct char_data *victim,
int w_type) int w_type)
@ -574,7 +546,6 @@ void dam_message(int dam, struct char_data *ch, struct char_data *victim,
} }
}; };
w_type -= TYPE_HIT; /* Change to base of table with text */ w_type -= TYPE_HIT; /* Change to base of table with text */
if (dam == 0) msgnum = 0; if (dam == 0) msgnum = 0;
@ -607,11 +578,8 @@ void dam_message(int dam, struct char_data *ch, struct char_data *victim,
send_to_char(victim, CCNRM(victim, C_CMP)); send_to_char(victim, CCNRM(victim, C_CMP));
} }
/* message for doing damage with a spell or skill. Also used for weapon
/* * damage on miss and death blows. */
* message for doing damage with a spell or skill
* C3.0: Also used for weapon damage on miss and death blows
*/
int skill_message(int dam, struct char_data *ch, struct char_data *vict, int skill_message(int dam, struct char_data *ch, struct char_data *vict,
int attacktype) int attacktype)
{ {
@ -679,12 +647,10 @@ int skill_message(int dam, struct char_data *ch, struct char_data *vict,
return (0); return (0);
} }
/* /* This function returns the following codes:
* Alert: As of bpl14, this function returns the following codes:
* < 0 Victim died. * < 0 Victim died.
* = 0 No damage. * = 0 No damage.
* > 0 How much damage done. * > 0 How much damage done. */
*/
int damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype) int damage(struct char_data *ch, struct char_data *victim, int dam, int attacktype)
{ {
long local_gold = 0; long local_gold = 0;
@ -760,8 +726,7 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
update_pos(victim); update_pos(victim);
/* /* skill_message sends a message from the messages file in lib/misc.
* skill_message sends a message from the messages file in lib/misc.
* dam_message just sends a generic "You hit $n extremely hard.". * dam_message just sends a generic "You hit $n extremely hard.".
* skill_message is preferable to dam_message because it is more * skill_message is preferable to dam_message because it is more
* descriptive. * descriptive.
@ -769,8 +734,7 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
* If we are _not_ attacking with a weapon (i.e. a spell), always use * If we are _not_ attacking with a weapon (i.e. a spell), always use
* skill_message. If we are attacking with a weapon: If this is a miss or a * skill_message. If we are attacking with a weapon: If this is a miss or a
* death blow, send a skill_message if one exists; if not, default to a * death blow, send a skill_message if one exists; if not, default to a
* dam_message. Otherwise, always send a dam_message. * dam_message. Otherwise, always send a dam_message. */
*/
if (!IS_WEAPON(attacktype)) if (!IS_WEAPON(attacktype))
skill_message(dam, ch, victim, attacktype); skill_message(dam, ch, victim, attacktype);
else { else {
@ -880,14 +844,9 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
return (dam); return (dam);
} }
/* Calculate the THAC0 of the attacker. 'victim' currently isn't used but you
/* * could use it for special cases like weapons that hit evil creatures easier
* Calculate the THAC0 of the attacker. * or a weapon that always misses attacking an animal. */
*
* 'victim' currently isn't used but you could use it for special cases like
* weapons that hit evil creatures easier or a weapon that always misses
* attacking an animal.
*/
int compute_thaco(struct char_data *ch, struct char_data *victim) int compute_thaco(struct char_data *ch, struct char_data *victim)
{ {
int calc_thaco; int calc_thaco;
@ -904,7 +863,6 @@ int compute_thaco(struct char_data *ch, struct char_data *victim)
return calc_thaco; return calc_thaco;
} }
void hit(struct char_data *ch, struct char_data *victim, int type) void hit(struct char_data *ch, struct char_data *victim, int type)
{ {
struct obj_data *wielded = GET_EQ(ch, WEAR_WIELD); struct obj_data *wielded = GET_EQ(ch, WEAR_WIELD);
@ -939,14 +897,11 @@ void hit(struct char_data *ch, struct char_data *victim, int type)
/* roll the die and take your chances... */ /* roll the die and take your chances... */
diceroll = rand_number(1, 20); diceroll = rand_number(1, 20);
/* /* Decide whether this is a hit or a miss.
* Decide whether this is a hit or a miss.
*
* Victim asleep = hit, otherwise: * Victim asleep = hit, otherwise:
* 1 = Automatic miss. * 1 = Automatic miss.
* 2..19 = Checked vs. AC. * 2..19 = Checked vs. AC.
* 20 = Automatic hit. * 20 = Automatic hit. */
*/
if (diceroll == 20 || !AWAKE(victim)) if (diceroll == 20 || !AWAKE(victim))
dam = TRUE; dam = TRUE;
else if (diceroll == 1) else if (diceroll == 1)
@ -958,9 +913,8 @@ void hit(struct char_data *ch, struct char_data *victim, int type)
/* the attacker missed the victim */ /* the attacker missed the victim */
damage(ch, victim, 0, type == SKILL_BACKSTAB ? SKILL_BACKSTAB : w_type); damage(ch, victim, 0, type == SKILL_BACKSTAB ? SKILL_BACKSTAB : w_type);
else { else {
/* okay, we know the guy has been hit. now calculate damage. */ /* okay, we know the guy has been hit. now calculate damage.
* Start with the damage bonuses: the damroll and strength apply */
/* Start with the damage bonuses: the damroll and strength apply */
dam = str_app[STRENGTH_APPLY_INDEX(ch)].todam; dam = str_app[STRENGTH_APPLY_INDEX(ch)].todam;
dam += GET_DAMROLL(ch); dam += GET_DAMROLL(ch);
@ -976,19 +930,15 @@ void hit(struct char_data *ch, struct char_data *victim, int type)
dam += rand_number(0, 2); /* Max 2 bare hand damage for players */ dam += rand_number(0, 2); /* Max 2 bare hand damage for players */
} }
/* /* Include a damage multiplier if victim isn't ready to fight:
* Include a damage multiplier if victim isn't ready to fight:
*
* Position sitting 1.33 x normal * Position sitting 1.33 x normal
* Position resting 1.66 x normal * Position resting 1.66 x normal
* Position sleeping 2.00 x normal * Position sleeping 2.00 x normal
* Position stunned 2.33 x normal * Position stunned 2.33 x normal
* Position incap 2.66 x normal * Position incap 2.66 x normal
* Position mortally 3.00 x normal * Position mortally 3.00 x normal
*
* Note, this is a hack because it depends on the particular * Note, this is a hack because it depends on the particular
* values of the POSITION_XXX constants. * values of the POSITION_XXX constants. */
*/
if (GET_POS(victim) < POS_FIGHTING) if (GET_POS(victim) < POS_FIGHTING)
dam *= 1 + (POS_FIGHTING - GET_POS(victim)) / 3; dam *= 1 + (POS_FIGHTING - GET_POS(victim)) / 3;
@ -1005,8 +955,6 @@ void hit(struct char_data *ch, struct char_data *victim, int type)
hitprcnt_mtrigger(victim); hitprcnt_mtrigger(victim);
} }
/* control the fights going on. Called every 2 seconds from comm.c. */ /* control the fights going on. Called every 2 seconds from comm.c. */
void perform_violence(void) void perform_violence(void)
{ {

View file

@ -77,6 +77,7 @@ ACMD(do_backstab);
ACMD(do_ban); ACMD(do_ban);
ACMD(do_bash); ACMD(do_bash);
ACMD(do_cast); ACMD(do_cast);
ACMD(do_changelog);
ACMD(do_commands); ACMD(do_commands);
ACMD(do_consider); ACMD(do_consider);
ACMD(do_copyover); ACMD(do_copyover);
@ -279,6 +280,7 @@ cpp_extern const struct command_info cmd_info[] = {
{ "cast" , "c" , POS_SITTING , do_cast , 1, 0 }, { "cast" , "c" , POS_SITTING , do_cast , 1, 0 },
{ "cedit" , "cedit" , POS_DEAD , do_oasis , LVL_IMPL, SCMD_OASIS_CEDIT }, { "cedit" , "cedit" , POS_DEAD , do_oasis , LVL_IMPL, SCMD_OASIS_CEDIT },
{ "changelog", "cha" , POS_DEAD , do_changelog, LVL_IMPL, 0 },
{ "check" , "ch" , POS_STANDING, do_not_here , 1, 0 }, { "check" , "ch" , POS_STANDING, do_not_here , 1, 0 },
{ "checkload", "checkl" , POS_DEAD , do_checkloadstatus, LVL_GOD, 0 }, { "checkload", "checkl" , POS_DEAD , do_checkloadstatus, LVL_GOD, 0 },
{ "close" , "cl" , POS_SITTING , do_gen_door , 0, SCMD_CLOSE }, { "close" , "cl" , POS_SITTING , do_gen_door , 0, SCMD_CLOSE },
@ -316,7 +318,7 @@ cpp_extern const struct command_info cmd_info[] = {
{ "file" , "file" , POS_SLEEPING, do_file , LVL_GOD, 0 }, { "file" , "file" , POS_SLEEPING, do_file , LVL_GOD, 0 },
{ "flee" , "fl" , POS_FIGHTING, do_flee , 1, 0 }, { "flee" , "fl" , POS_FIGHTING, do_flee , 1, 0 },
{ "follow" , "fol" , POS_RESTING , do_follow , 0, 0 }, { "follow" , "fol" , POS_RESTING , do_follow , 0, 0 },
{ "freeze" , "freeze" , POS_DEAD , do_wizutil , LVL_FREEZE, SCMD_FREEZE }, { "freeze" , "freeze" , POS_DEAD , do_wizutil , LVL_GRGOD, SCMD_FREEZE },
{ "get" , "g" , POS_RESTING , do_get , 0, 0 }, { "get" , "g" , POS_RESTING , do_get , 0, 0 },
{ "gecho" , "gecho" , POS_DEAD , do_gecho , LVL_GOD, 0 }, { "gecho" , "gecho" , POS_DEAD , do_gecho , LVL_GOD, 0 },
@ -459,7 +461,7 @@ cpp_extern const struct command_info cmd_info[] = {
{ "taste" , "tas" , POS_RESTING , do_eat , 0, SCMD_TASTE }, { "taste" , "tas" , POS_RESTING , do_eat , 0, SCMD_TASTE },
{ "teleport" , "tele" , POS_DEAD , do_teleport , LVL_GOD, 0 }, { "teleport" , "tele" , POS_DEAD , do_teleport , LVL_GOD, 0 },
{ "tedit" , "tedit" , POS_DEAD , do_tedit , LVL_GOD, 0 }, /* XXX: Oasisify */ { "tedit" , "tedit" , POS_DEAD , do_tedit , LVL_GOD, 0 }, /* XXX: Oasisify */
{ "thaw" , "thaw" , POS_DEAD , do_wizutil , LVL_FREEZE, SCMD_THAW }, { "thaw" , "thaw" , POS_DEAD , do_wizutil , LVL_GRGOD, SCMD_THAW },
{ "title" , "title" , POS_DEAD , do_title , 0, 0 }, { "title" , "title" , POS_DEAD , do_title , 0, 0 },
{ "time" , "time" , POS_DEAD , do_time , 0, 0 }, { "time" , "time" , POS_DEAD , do_time , 0, 0 },
{ "toggle" , "toggle" , POS_DEAD , do_toggle , 0, 0 }, { "toggle" , "toggle" , POS_DEAD , do_toggle , 0, 0 },

View file

@ -37,8 +37,8 @@ char *delete_doubledollar(char *string);
#define argument_interpreter(a, b, c) two_arguments(a, b, c) #define argument_interpreter(a, b, c) two_arguments(a, b, c)
/* WARNING: if you have added diagonal directions and have them at the /* WARNING: if you have added diagonal directions and have them at the
* beginning of the command list.. change this value to 11 or 15 (depending) */ * beginning of the command list.. change this value to 11 or 15 (depending)
/* reserve these commands to come straight from the cmd list then start * reserve these commands to come straight from the cmd list then start
* sorting */ * sorting */
#define RESERVE_CMDS 7 #define RESERVE_CMDS 7
@ -52,19 +52,12 @@ struct command_info {
int subcmd; int subcmd;
}; };
/* /* Necessary for CMD_IS macro. Borland needs the structure defined first
* Necessary for CMD_IS macro. Borland needs the structure defined first * so it has been moved down here. */
* so it has been moved down here.
*/
#ifndef __INTERPRETER_C__ #ifndef __INTERPRETER_C__
extern struct command_info *complete_cmd_info; extern struct command_info *complete_cmd_info;
#endif #endif
/*
* Alert! Changed from 'struct alias' to 'struct alias_data' in bpl15
* because a Windows 95 compiler gives a warning about it having similiar
* named member.
*/
struct alias_data { struct alias_data {
char *alias; char *alias;
char *replacement; char *replacement;
@ -79,12 +72,8 @@ struct alias_data {
#define ALIAS_VAR_CHAR '$' #define ALIAS_VAR_CHAR '$'
#define ALIAS_GLOB_CHAR '*' #define ALIAS_GLOB_CHAR '*'
/* /* SUBCOMMANDS: You can define these however you want to, and the definitions
* SUBCOMMANDS * of the subcommands are independent from function to function.*/
* You can define these however you want to, and the definitions of the
* subcommands are independent from function to function.
*/
/* directions */ /* directions */
#define SCMD_NORTH 1 #define SCMD_NORTH 1
#define SCMD_EAST 2 #define SCMD_EAST 2

View file

@ -2,15 +2,15 @@
cat << EOF cat << EOF
CircleMUD is freeware (it doesn't cost anything), but it is copyrighted TbaMUD is freeware (it doesn't cost anything), but it is copyrighted
and has a license. You must read and agree to abide by the license before and has a license. You must read and agree to abide by the license before
using CircleMUD. using tbaMUD.
This message will only appear once (the first time you compile the server), This message will only appear once (the first time you compile the server),
but is contained in the file doc/license.txt if you'd like to refer back to but is contained in the file doc/license.txt if you'd like to refer back to
it in the future. it in the future.
Press return to read the license. Press return to read the license. Press Q to ACCEPT the terms and quit.
EOF EOF
read temp read temp
cat ../doc/license.txt | $1 cat ../doc/license.txt | $1

View file

@ -414,7 +414,8 @@ void postmaster_receive_mail(struct char_data *ch, struct char_data *mailman,
return; return;
} }
while (has_mail(GET_IDNUM(ch))) { while (has_mail(GET_IDNUM(ch))) {
obj = read_object(1, VIRTUAL); /*a pair of wings will work :)*/ obj = create_obj();
obj->item_number = 1;
obj->name = strdup("mail paper letter"); obj->name = strdup("mail paper letter");
obj->short_description = strdup("a piece of mail"); obj->short_description = strdup("a piece of mail");
obj->description = strdup("Someone has left a piece of mail here."); obj->description = strdup("Someone has left a piece of mail here.");

View file

@ -40,10 +40,7 @@ void medit_disp_mob_flags(struct descriptor_data *d);
void medit_disp_aff_flags(struct descriptor_data *d); void medit_disp_aff_flags(struct descriptor_data *d);
void medit_disp_menu(struct descriptor_data *d); void medit_disp_menu(struct descriptor_data *d);
/*-------------------------------------------------------------------*\ /* utility functions */
utility functions
\*-------------------------------------------------------------------*/
ACMD(do_oasis_medit) ACMD(do_oasis_medit)
{ {
int number = NOBODY, save = 0, real_num; int number = NOBODY, save = 0, real_num;
@ -52,9 +49,7 @@ ACMD(do_oasis_medit)
char buf1[MAX_STRING_LENGTH]; char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH]; char buf2[MAX_STRING_LENGTH];
/****************************************************************************/ /* Parse any arguments */
/** Parse any arguments. **/
/****************************************************************************/
buf3 = two_arguments(argument, buf1, buf2); buf3 = two_arguments(argument, buf1, buf2);
if (!*buf1) { if (!*buf1) {
@ -85,15 +80,11 @@ ACMD(do_oasis_medit)
} }
} }
/****************************************************************************/ /* If a numeric argument was given (like a room number), get it. */
/** If a numeric argument was given (like a room number), get it. **/
/****************************************************************************/
if (number == NOBODY) if (number == NOBODY)
number = atoi(buf1); number = atoi(buf1);
/****************************************************************************/ /* Check that whatever it is isn't already being edited. */
/** Check that whatever it is isn't already being edited. **/
/****************************************************************************/
for (d = descriptor_list; d; d = d->next) { for (d = descriptor_list; d; d = d->next) {
if (STATE(d) == CON_MEDIT) { if (STATE(d) == CON_MEDIT) {
if (d->olc && OLC_NUM(d) == number) { if (d->olc && OLC_NUM(d) == number) {
@ -106,9 +97,7 @@ ACMD(do_oasis_medit)
d = ch->desc; d = ch->desc;
/****************************************************************************/ /* Give descriptor an OLC structure. */
/** Give descriptor an OLC structure. **/
/****************************************************************************/
if (d->olc) { if (d->olc) {
mudlog(BRF, LVL_IMMORT, TRUE, mudlog(BRF, LVL_IMMORT, TRUE,
"SYSERR: do_oasis_medit: Player already had olc structure."); "SYSERR: do_oasis_medit: Player already had olc structure.");
@ -117,9 +106,7 @@ ACMD(do_oasis_medit)
CREATE(d->olc, struct oasis_olc_data, 1); CREATE(d->olc, struct oasis_olc_data, 1);
/****************************************************************************/ /* Find the zone. */
/** Find the zone. **/
/****************************************************************************/
OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number); OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number);
if (OLC_ZNUM(d) == NOWHERE) { if (OLC_ZNUM(d) == NOWHERE) {
send_to_char(ch, "Sorry, there is no zone for that number!\r\n"); send_to_char(ch, "Sorry, there is no zone for that number!\r\n");
@ -128,11 +115,9 @@ ACMD(do_oasis_medit)
return; return;
} }
/****************************************************************************/ /* Everyone but IMPLs can only edit zones they have been assigned. */
/** Everyone but IMPLs can only edit zones they have been assigned. **/
/****************************************************************************/
if (!can_edit_zone(ch, OLC_ZNUM(d))) { if (!can_edit_zone(ch, OLC_ZNUM(d))) {
send_to_char(ch, " You do not have permission to edit zone %d. Try zone %d.\r\n", zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); send_cannot_edit(ch, zone_table[OLC_ZNUM(d)].number);
mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d", mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
free(d->olc); free(d->olc);
@ -140,9 +125,7 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
return; return;
} }
/****************************************************************************/ /* If save is TRUE, save the mobiles. */
/** If save is TRUE, save the mobiles. **/
/****************************************************************************/
if (save) { if (save) {
send_to_char(ch, "Saving all mobiles in zone %d.\r\n", send_to_char(ch, "Saving all mobiles in zone %d.\r\n",
zone_table[OLC_ZNUM(d)].number); zone_table[OLC_ZNUM(d)].number);
@ -150,14 +133,10 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
"OLC: %s saves mobile info for zone %d.", "OLC: %s saves mobile info for zone %d.",
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number); GET_NAME(ch), zone_table[OLC_ZNUM(d)].number);
/**************************************************************************/ /* Save the mobiles. */
/** Save the mobiles. **/
/**************************************************************************/
save_mobiles(OLC_ZNUM(d)); save_mobiles(OLC_ZNUM(d));
/**************************************************************************/ /* Free the olc structure stored in the descriptor. */
/** Free the olc structure stored in the descriptor. **/
/**************************************************************************/
free(d->olc); free(d->olc);
d->olc = NULL; d->olc = NULL;
return; return;
@ -165,10 +144,8 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
OLC_NUM(d) = number; OLC_NUM(d) = number;
/****************************************************************************/ /* If this is a new mobile, setup a new one, otherwise, setup the
/** If this is a new mobile, setup a new one, otherwise, setup the **/ existing mobile. */
/** existing mobile. **/
/****************************************************************************/
if ((real_num = real_mobile(number)) == NOBODY) if ((real_num = real_mobile(number)) == NOBODY)
medit_setup_new(d); medit_setup_new(d);
else else
@ -176,10 +153,8 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
STATE(d) = CON_MEDIT; STATE(d) = CON_MEDIT;
/****************************************************************************/ /* Display the OLC messages to the players in the same room as the
/** Display the OLC messages to the players in the same room as the **/ builder and also log it. */
/** builder and also log it. **/
/****************************************************************************/
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM); act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
SET_BIT(PLR_FLAGS(ch), PLR_WRITING); SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
@ -196,17 +171,13 @@ void medit_setup_new(struct descriptor_data *d)
{ {
struct char_data *mob; struct char_data *mob;
/* /* Allocate a scratch mobile structure. */
* Allocate a scratch mobile structure.
*/
CREATE(mob, struct char_data, 1); CREATE(mob, struct char_data, 1);
init_mobile(mob); init_mobile(mob);
GET_MOB_RNUM(mob) = NOBODY; GET_MOB_RNUM(mob) = NOBODY;
/* /* Set up some default strings. */
* Set up some default strings.
*/
GET_ALIAS(mob) = strdup("mob unfinished"); GET_ALIAS(mob) = strdup("mob unfinished");
GET_SDESC(mob) = strdup("the unfinished mob"); GET_SDESC(mob) = strdup("the unfinished mob");
GET_LDESC(mob) = strdup("An unfinished mob stands here.\r\n"); GET_LDESC(mob) = strdup("An unfinished mob stands here.\r\n");
@ -222,15 +193,11 @@ void medit_setup_new(struct descriptor_data *d)
medit_disp_menu(d); medit_disp_menu(d);
} }
/*-------------------------------------------------------------------*/
void medit_setup_existing(struct descriptor_data *d, int rmob_num) void medit_setup_existing(struct descriptor_data *d, int rmob_num)
{ {
struct char_data *mob; struct char_data *mob;
/* /* Allocate a scratch mobile structure. */
* Allocate a scratch mobile structure.
*/
CREATE(mob, struct char_data, 1); CREATE(mob, struct char_data, 1);
copy_mobile(mob, mob_proto + rmob_num); copy_mobile(mob, mob_proto + rmob_num);
@ -248,12 +215,7 @@ void medit_setup_existing(struct descriptor_data *d, int rmob_num)
medit_disp_menu(d); medit_disp_menu(d);
} }
/*-------------------------------------------------------------------*/ /* Ideally, this function should be in db.c, but I'll put it here for portability. */
/*
* Ideally, this function should be in db.c, but I'll put it here for
* portability.
*/
void init_mobile(struct char_data *mob) void init_mobile(struct char_data *mob)
{ {
clear_char(mob); clear_char(mob);
@ -272,11 +234,7 @@ void init_mobile(struct char_data *mob)
mob->player_specials = &dummy_mob; mob->player_specials = &dummy_mob;
} }
/*-------------------------------------------------------------------*/ /* Save new/edited mob to memory. */
/*
* Save new/edited mob to memory.
*/
void medit_save_internally(struct descriptor_data *d) void medit_save_internally(struct descriptor_data *d)
{ {
int i; int i;
@ -291,8 +249,7 @@ void medit_save_internally(struct descriptor_data *d)
return; return;
} }
/* Update triggers */ /* Update triggers and free old proto list */
/* Free old proto list */
if (mob_proto[new_rnum].proto_script && if (mob_proto[new_rnum].proto_script &&
mob_proto[new_rnum].proto_script != OLC_SCRIPT(d)) mob_proto[new_rnum].proto_script != OLC_SCRIPT(d))
free_proto_script(&mob_proto[new_rnum], MOB_TRIGGER); free_proto_script(&mob_proto[new_rnum], MOB_TRIGGER);
@ -317,9 +274,7 @@ void medit_save_internally(struct descriptor_data *d)
if (!i) /* Only renumber on new mobiles. */ if (!i) /* Only renumber on new mobiles. */
return; return;
/* /* Update keepers in shops being edited and other mobs being edited. */
* Update keepers in shops being edited and other mobs being edited.
*/
for (dsc = descriptor_list; dsc; dsc = dsc->next) { for (dsc = descriptor_list; dsc; dsc = dsc->next) {
if (STATE(dsc) == CON_SEDIT) if (STATE(dsc) == CON_SEDIT)
S_KEEPER(OLC_SHOP(dsc)) += (S_KEEPER(OLC_SHOP(dsc)) >= new_rnum); S_KEEPER(OLC_SHOP(dsc)) += (S_KEEPER(OLC_SHOP(dsc)) >= new_rnum);
@ -327,9 +282,7 @@ void medit_save_internally(struct descriptor_data *d)
GET_MOB_RNUM(OLC_MOB(dsc)) += (GET_MOB_RNUM(OLC_MOB(dsc)) >= new_rnum); GET_MOB_RNUM(OLC_MOB(dsc)) += (GET_MOB_RNUM(OLC_MOB(dsc)) >= new_rnum);
} }
/* /* Update other people in zedit too. From: C.Raehl 4/27/99 */
* Update other people in zedit too. From: C.Raehl 4/27/99
*/
for (dsc = descriptor_list; dsc; dsc = dsc->next) for (dsc = descriptor_list; dsc; dsc = dsc->next)
if (STATE(dsc) == CON_ZEDIT) if (STATE(dsc) == CON_ZEDIT)
for (i = 0; OLC_ZONE(dsc)->cmd[i].command != 'S'; i++) for (i = 0; OLC_ZONE(dsc)->cmd[i].command != 'S'; i++)
@ -338,13 +291,8 @@ void medit_save_internally(struct descriptor_data *d)
OLC_ZONE(dsc)->cmd[i].arg1++; OLC_ZONE(dsc)->cmd[i].arg1++;
} }
/************************************************************************** /* Menu functions
Menu functions Display positions. (sitting, standing, etc) */
**************************************************************************/
/*
* Display positions. (sitting, standing, etc)
*/
void medit_disp_positions(struct descriptor_data *d) void medit_disp_positions(struct descriptor_data *d)
{ {
int i; int i;
@ -358,9 +306,7 @@ void medit_disp_positions(struct descriptor_data *d)
write_to_output(d, "Enter position number : "); write_to_output(d, "Enter position number : ");
} }
/* /* Display the gender of the mobile. */
* Display the gender of the mobile.
*/
void medit_disp_sex(struct descriptor_data *d) void medit_disp_sex(struct descriptor_data *d)
{ {
int i; int i;
@ -374,11 +320,7 @@ void medit_disp_sex(struct descriptor_data *d)
write_to_output(d, "Enter gender number : "); write_to_output(d, "Enter gender number : ");
} }
/*-------------------------------------------------------------------*/ /* Display attack types menu. */
/*
* Display attack types menu.
*/
void medit_disp_attack_types(struct descriptor_data *d) void medit_disp_attack_types(struct descriptor_data *d)
{ {
int i; int i;
@ -392,11 +334,7 @@ void medit_disp_attack_types(struct descriptor_data *d)
write_to_output(d, "Enter attack type : "); write_to_output(d, "Enter attack type : ");
} }
/*-------------------------------------------------------------------*/ /* Display mob-flags menu. */
/*
* Display mob-flags menu.
*/
void medit_disp_mob_flags(struct descriptor_data *d) void medit_disp_mob_flags(struct descriptor_data *d)
{ {
int i, columns = 0; int i, columns = 0;
@ -413,11 +351,7 @@ void medit_disp_mob_flags(struct descriptor_data *d)
cyn, flags, nrm); cyn, flags, nrm);
} }
/*-------------------------------------------------------------------*/ /* Display affection flags menu. */
/*
* Display affection flags menu.
*/
void medit_disp_aff_flags(struct descriptor_data *d) void medit_disp_aff_flags(struct descriptor_data *d)
{ {
int i, columns = 0; int i, columns = 0;
@ -434,11 +368,7 @@ void medit_disp_aff_flags(struct descriptor_data *d)
cyn, flags, nrm); cyn, flags, nrm);
} }
/*-------------------------------------------------------------------*/ /* Display main menu. */
/*
* Display main menu.
*/
void medit_disp_menu(struct descriptor_data *d) void medit_disp_menu(struct descriptor_data *d)
{ {
struct char_data *mob; struct char_data *mob;
@ -506,10 +436,6 @@ void medit_disp_menu(struct descriptor_data *d)
OLC_MODE(d) = MEDIT_MAIN_MENU; OLC_MODE(d) = MEDIT_MAIN_MENU;
} }
/************************************************************************
* The GARGANTAUN event handler *
************************************************************************/
void medit_parse(struct descriptor_data *d, char *arg) void medit_parse(struct descriptor_data *d, char *arg)
{ {
int i = -1; int i = -1;
@ -526,18 +452,13 @@ void medit_parse(struct descriptor_data *d, char *arg)
return; return;
} }
switch (OLC_MODE(d)) { switch (OLC_MODE(d)) {
/*-------------------------------------------------------------------*/
case MEDIT_CONFIRM_SAVESTRING: case MEDIT_CONFIRM_SAVESTRING:
/* /* Ensure mob has MOB_ISNPC set. */
* Ensure mob has MOB_ISNPC set or things will go pear shaped.
*/
SET_BIT(MOB_FLAGS(OLC_MOB(d)), MOB_ISNPC); SET_BIT(MOB_FLAGS(OLC_MOB(d)), MOB_ISNPC);
switch (*arg) { switch (*arg) {
case 'y': case 'y':
case 'Y': case 'Y':
/* /* Save the mob in memory and to disk. */
* Save the mob in memory and to disk.
*/
medit_save_internally(d); medit_save_internally(d);
mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE, "OLC: %s edits mob %d", GET_NAME(d->character), OLC_NUM(d)); mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE, "OLC: %s edits mob %d", GET_NAME(d->character), OLC_NUM(d));
if (CONFIG_OLC_SAVE) { if (CONFIG_OLC_SAVE) {
@ -557,7 +478,6 @@ void medit_parse(struct descriptor_data *d, char *arg)
} }
break; break;
/*-------------------------------------------------------------------*/
case MEDIT_MAIN_MENU: case MEDIT_MAIN_MENU:
i = 0; i = 0;
switch (*arg) { switch (*arg) {
@ -700,25 +620,25 @@ void medit_parse(struct descriptor_data *d, char *arg)
else else
write_to_output(d, "Oops...\r\n"); write_to_output(d, "Oops...\r\n");
return; return;
/*-------------------------------------------------------------------*/
case OLC_SCRIPT_EDIT: case OLC_SCRIPT_EDIT:
if (dg_script_edit_parse(d, arg)) return; if (dg_script_edit_parse(d, arg)) return;
break; break;
/*-------------------------------------------------------------------*/
case MEDIT_KEYWORD: case MEDIT_KEYWORD:
smash_tilde(arg); smash_tilde(arg);
if (GET_ALIAS(OLC_MOB(d))) if (GET_ALIAS(OLC_MOB(d)))
free(GET_ALIAS(OLC_MOB(d))); free(GET_ALIAS(OLC_MOB(d)));
GET_ALIAS(OLC_MOB(d)) = str_udup(arg); GET_ALIAS(OLC_MOB(d)) = str_udup(arg);
break; break;
/*-------------------------------------------------------------------*/
case MEDIT_S_DESC: case MEDIT_S_DESC:
smash_tilde(arg); smash_tilde(arg);
if (GET_SDESC(OLC_MOB(d))) if (GET_SDESC(OLC_MOB(d)))
free(GET_SDESC(OLC_MOB(d))); free(GET_SDESC(OLC_MOB(d)));
GET_SDESC(OLC_MOB(d)) = str_udup(arg); GET_SDESC(OLC_MOB(d)) = str_udup(arg);
break; break;
/*-------------------------------------------------------------------*/
case MEDIT_L_DESC: case MEDIT_L_DESC:
smash_tilde(arg); smash_tilde(arg);
if (GET_LDESC(OLC_MOB(d))) if (GET_LDESC(OLC_MOB(d)))
@ -731,7 +651,7 @@ void medit_parse(struct descriptor_data *d, char *arg)
GET_LDESC(OLC_MOB(d)) = strdup("undefined"); GET_LDESC(OLC_MOB(d)) = strdup("undefined");
break; break;
/*-------------------------------------------------------------------*/
case MEDIT_D_DESC: case MEDIT_D_DESC:
/* /*
* We should never get here. * We should never get here.
@ -740,7 +660,7 @@ void medit_parse(struct descriptor_data *d, char *arg)
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: medit_parse(): Reached D_DESC case!"); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: medit_parse(): Reached D_DESC case!");
write_to_output(d, "Oops...\r\n"); write_to_output(d, "Oops...\r\n");
break; break;
/*-------------------------------------------------------------------*/
case MEDIT_NPC_FLAGS: case MEDIT_NPC_FLAGS:
if ((i = atoi(arg)) <= 0) if ((i = atoi(arg)) <= 0)
break; break;
@ -748,7 +668,7 @@ void medit_parse(struct descriptor_data *d, char *arg)
TOGGLE_BIT(MOB_FLAGS(OLC_MOB(d)), 1 << (i - 1)); TOGGLE_BIT(MOB_FLAGS(OLC_MOB(d)), 1 << (i - 1));
medit_disp_mob_flags(d); medit_disp_mob_flags(d);
return; return;
/*-------------------------------------------------------------------*/
case MEDIT_AFF_FLAGS: case MEDIT_AFF_FLAGS:
if ((i = atoi(arg)) <= 0) if ((i = atoi(arg)) <= 0)
break; break;
@ -761,10 +681,7 @@ void medit_parse(struct descriptor_data *d, char *arg)
medit_disp_aff_flags(d); medit_disp_aff_flags(d);
return; return;
/*-------------------------------------------------------------------*/ /* Numerical responses. */
/*
* Numerical responses.
*/
case MEDIT_SEX: case MEDIT_SEX:
GET_SEX(OLC_MOB(d)) = LIMIT(i, 0, NUM_GENDERS - 1); GET_SEX(OLC_MOB(d)) = LIMIT(i, 0, NUM_GENDERS - 1);
@ -861,23 +778,16 @@ void medit_parse(struct descriptor_data *d, char *arg)
write_to_output(d, "Please answer 'Y' or 'N': "); write_to_output(d, "Please answer 'Y' or 'N': ");
break; break;
/*-------------------------------------------------------------------*/
default: default:
/* /* We should never get here. */
* We should never get here.
*/
cleanup_olc(d, CLEANUP_ALL); cleanup_olc(d, CLEANUP_ALL);
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: medit_parse(): Reached default case!"); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: medit_parse(): Reached default case!");
write_to_output(d, "Oops...\r\n"); write_to_output(d, "Oops...\r\n");
break; break;
} }
/*-------------------------------------------------------------------*/
/* /* END OF CASE If we get here, we have probably changed something, and now want
* END OF CASE to return to main menu. Use OLC_VAL as a 'has changed' flag */
* If we get here, we have probably changed something, and now want to
* return to main menu. Use OLC_VAL as a 'has changed' flag
*/
OLC_VAL(d) = TRUE; OLC_VAL(d) = TRUE;
medit_disp_menu(d); medit_disp_menu(d);

View file

@ -426,3 +426,11 @@ int can_edit_zone(struct char_data *ch, zone_rnum rnum)
return (FALSE); return (FALSE);
} }
void send_cannot_edit(struct char_data *ch, zone_vnum zone)
{
send_to_char(ch, "You do not have permission to edit zone %d.", zone);
if (GET_OLC_ZONE(ch) != NOWHERE)
send_to_char(ch, " Try zone %d.", GET_OLC_ZONE(ch));
send_to_char(ch, "\r\n");
}

View file

@ -7,21 +7,16 @@
#define _OASISOLC 0x206 /* 2.0.6 */ #define _OASISOLC 0x206 /* 2.0.6 */
/* /* Used to determine what version of OasisOLC is installed.
* Used to determine what version of OasisOLC is installed. Ex: #if _OASISOLC >= OASIS_VERSION(2,0,0) */
*
* Ex: #if _OASISOLC >= OASIS_VERSION(2,0,0)
*/
#define OASIS_VERSION(x,y,z) (((x) << 8 | (y) << 4 | (z)) #define OASIS_VERSION(x,y,z) (((x) << 8 | (y) << 4 | (z))
#define AEDIT_PERMISSION 999 /* arbitrary number higher than max zone vnum*/ #define AEDIT_PERMISSION 999 /* arbitrary number higher than max zone vnum*/
#define HEDIT_PERMISSION 888 /* arbitrary number higher then max zone vnum*/ #define HEDIT_PERMISSION 888 /* arbitrary number higher then max zone vnum*/
#define ALL_PERMISSION 666 /* arbitrary number higher then max zone vnum*/ #define ALL_PERMISSION 666 /* arbitrary number higher then max zone vnum*/
/* /* Macros, defines, structs and globals for the OLC suite. You will need
* Macros, defines, structs and globals for the OLC suite. You will need to adjust these numbers if you ever add more. */
* to adjust these numbers if you ever add more.
*/
#define NUM_ROOM_FLAGS 16 #define NUM_ROOM_FLAGS 16
#define NUM_ROOM_SECTORS 10 #define NUM_ROOM_SECTORS 10
@ -41,11 +36,7 @@
#define NUM_SHOP_FLAGS 3 #define NUM_SHOP_FLAGS 3
#define NUM_TRADERS 7 #define NUM_TRADERS 7
/* -------------------------------------------------------------------------- */ /* Limit information. */
/*
* Limit information.
*/
#define MAX_ROOM_NAME 75 #define MAX_ROOM_NAME 75
#define MAX_MOB_NAME 50 #define MAX_MOB_NAME 50
#define MAX_OBJ_NAME 50 #define MAX_OBJ_NAME 50
@ -68,17 +59,16 @@
#define MAX_MOB_GOLD 100000 #define MAX_MOB_GOLD 100000
#define MAX_MOB_EXP 150000 #define MAX_MOB_EXP 150000
/* this is one mud year.. */ /* this is one mud year.. */
#define MAX_OBJ_TIMER 1071000 #define MAX_OBJ_TIMER 1071000
/* this defines how much memory is alloacted for 'bit strings' when /* this defines how much memory is alloacted for 'bit strings' when
* saving in OLC. Remember to change it if you go for longer bitvectors. saving in OLC. Remember to change it if you go for longer bitvectors. */
*/
#define BIT_STRING_LENGTH 33 #define BIT_STRING_LENGTH 33
/*
* The data types for miscellaneous functions. /* The data types for miscellaneous functions. */
*/
#define OASIS_WLD 0 #define OASIS_WLD 0
#define OASIS_MOB 1 #define OASIS_MOB 1
#define OASIS_OBJ 2 #define OASIS_OBJ 2
@ -86,22 +76,14 @@
#define OASIS_EXI 4 #define OASIS_EXI 4
#define OASIS_CFG 5 #define OASIS_CFG 5
/* /* Utilities exported from oasis.c. */
* Utilities exported from olc.c.
* -- Umm, shouldn't this say 'from oasis.c' now??? * Mythran
*/
void cleanup_olc(struct descriptor_data *d, byte cleanup_type); void cleanup_olc(struct descriptor_data *d, byte cleanup_type);
void get_char_colors(struct char_data *ch); void get_char_colors(struct char_data *ch);
void split_argument(char *argument, char *tag); void split_argument(char *argument, char *tag);
void send_cannot_edit(struct char_data *ch, zone_vnum zone);
/* /* OLC structures. */
* OLC structures. /* The following defines used to be in config.c. */
*/
/* -------------------------------------------------------------------------- */
/*
* The following defines used to be in config.c.
*/
#define NO 0 #define NO 0
#define YES 1 #define YES 1
@ -127,14 +109,10 @@ struct oasis_olc_data {
struct help_index_element*help; /* Hedit uses this */ struct help_index_element*help; /* Hedit uses this */
}; };
/* /* Exported globals. */
* Exported globals.
*/
extern const char *nrm, *grn, *cyn, *yel; extern const char *nrm, *grn, *cyn, *yel;
/* /* Descriptor access macros. */
* Descriptor access macros.
*/
#define OLC(d) ((d)->olc) #define OLC(d) ((d)->olc)
#define OLC_MODE(d) (OLC(d)->mode) /* Parse input mode. */ #define OLC_MODE(d) (OLC(d)->mode) /* Parse input mode. */
#define OLC_NUM(d) (OLC(d)->number) /* Room/Obj VNUM. */ #define OLC_NUM(d) (OLC(d)->number) /* Room/Obj VNUM. */
@ -154,14 +132,10 @@ extern const char *nrm, *grn, *cyn, *yel;
#define OLC_ACTION(d) (OLC(d)->action) /* Action structure */ #define OLC_ACTION(d) (OLC(d)->action) /* Action structure */
#define OLC_HELP(d) (OLC(d)->help) /* Hedit structure */ #define OLC_HELP(d) (OLC(d)->help) /* Hedit structure */
/* /* Other macros. */
* Other macros.
*/
#define OLC_EXIT(d) (OLC_ROOM(d)->dir_option[OLC_VAL(d)]) #define OLC_EXIT(d) (OLC_ROOM(d)->dir_option[OLC_VAL(d)])
/* /* Cleanup types. */
* Cleanup types.
*/
#define CLEANUP_ALL 1 /* Free the whole lot. */ #define CLEANUP_ALL 1 /* Free the whole lot. */
#define CLEANUP_STRUCTS 2 /* Don't free strings. */ #define CLEANUP_STRUCTS 2 /* Don't free strings. */
#define CLEANUP_CONFIG 3 /* Used just to send proper message. */ #define CLEANUP_CONFIG 3 /* Used just to send proper message. */
@ -191,9 +165,7 @@ extern const char *nrm, *grn, *cyn, *yel;
#define AEDIT_OBJ_CHAR_FOUND 21 #define AEDIT_OBJ_CHAR_FOUND 21
#define AEDIT_OBJ_OTHERS_FOUND 22 #define AEDIT_OBJ_OTHERS_FOUND 22
/* /* Submodes of OEDIT connectedness. */
* Submodes of OEDIT connectedness.
*/
#define OEDIT_MAIN_MENU 1 #define OEDIT_MAIN_MENU 1
#define OEDIT_KEYWORD 2 #define OEDIT_KEYWORD 2
#define OEDIT_SHORTDESC 3 #define OEDIT_SHORTDESC 3
@ -222,9 +194,7 @@ extern const char *nrm, *grn, *cyn, *yel;
#define OEDIT_PERM 26 #define OEDIT_PERM 26
#define OEDIT_DELETE 27 #define OEDIT_DELETE 27
/* /* Submodes of REDIT connectedness. */
* Submodes of REDIT connectedness.
*/
#define REDIT_MAIN_MENU 1 #define REDIT_MAIN_MENU 1
#define REDIT_NAME 2 #define REDIT_NAME 2
#define REDIT_DESC 3 #define REDIT_DESC 3
@ -243,9 +213,7 @@ extern const char *nrm, *grn, *cyn, *yel;
#define REDIT_EXTRADESC_DESCRIPTION 16 #define REDIT_EXTRADESC_DESCRIPTION 16
#define REDIT_DELETE 17 #define REDIT_DELETE 17
/* /* Submodes of ZEDIT connectedness. */
* Submodes of ZEDIT connectedness.
*/
#define ZEDIT_MAIN_MENU 0 #define ZEDIT_MAIN_MENU 0
#define ZEDIT_DELETE_ENTRY 1 #define ZEDIT_DELETE_ENTRY 1
#define ZEDIT_NEW_ENTRY 2 #define ZEDIT_NEW_ENTRY 2
@ -265,9 +233,7 @@ extern const char *nrm, *grn, *cyn, *yel;
#define ZEDIT_SARG1 20 #define ZEDIT_SARG1 20
#define ZEDIT_SARG2 21 #define ZEDIT_SARG2 21
/* /* Submodes of MEDIT connectedness. */
* Submodes of MEDIT connectedness.
*/
#define MEDIT_MAIN_MENU 0 #define MEDIT_MAIN_MENU 0
#define MEDIT_KEYWORD 1 #define MEDIT_KEYWORD 1
#define MEDIT_S_DESC 2 #define MEDIT_S_DESC 2
@ -276,9 +242,8 @@ extern const char *nrm, *grn, *cyn, *yel;
#define MEDIT_NPC_FLAGS 5 #define MEDIT_NPC_FLAGS 5
#define MEDIT_AFF_FLAGS 6 #define MEDIT_AFF_FLAGS 6
#define MEDIT_CONFIRM_SAVESTRING 7 #define MEDIT_CONFIRM_SAVESTRING 7
/*
* Numerical responses. /* Numerical responses. */
*/
#define MEDIT_NUMERICAL_RESPONSE 10 #define MEDIT_NUMERICAL_RESPONSE 10
#define MEDIT_SEX 11 #define MEDIT_SEX 11
#define MEDIT_HITROLL 12 #define MEDIT_HITROLL 12
@ -298,9 +263,7 @@ extern const char *nrm, *grn, *cyn, *yel;
#define MEDIT_ALIGNMENT 26 #define MEDIT_ALIGNMENT 26
#define MEDIT_DELETE 27 #define MEDIT_DELETE 27
/* /* Submodes of SEDIT connectedness. */
* Submodes of SEDIT connectedness.
*/
#define SEDIT_MAIN_MENU 0 #define SEDIT_MAIN_MENU 0
#define SEDIT_CONFIRM_SAVESTRING 1 #define SEDIT_CONFIRM_SAVESTRING 1
#define SEDIT_NOITEM1 2 #define SEDIT_NOITEM1 2
@ -314,9 +277,8 @@ extern const char *nrm, *grn, *cyn, *yel;
#define SEDIT_ROOMS_MENU 12 #define SEDIT_ROOMS_MENU 12
#define SEDIT_NAMELIST_MENU 13 #define SEDIT_NAMELIST_MENU 13
#define SEDIT_NAMELIST 14 #define SEDIT_NAMELIST 14
/*
* Numerical responses. /* Numerical responses. */
*/
#define SEDIT_NUMERICAL_RESPONSE 20 #define SEDIT_NUMERICAL_RESPONSE 20
#define SEDIT_OPEN1 21 #define SEDIT_OPEN1 21
#define SEDIT_OPEN2 22 #define SEDIT_OPEN2 22
@ -334,9 +296,7 @@ extern const char *nrm, *grn, *cyn, *yel;
#define SEDIT_SHOP_FLAGS 35 #define SEDIT_SHOP_FLAGS 35
#define SEDIT_NOTRADE 36 #define SEDIT_NOTRADE 36
/* /* Submodes of CEDIT connectedness. */
* Submodes of CEDIT connectedness.
*/
#define CEDIT_MAIN_MENU 0 #define CEDIT_MAIN_MENU 0
#define CEDIT_CONFIRM_SAVESTRING 1 #define CEDIT_CONFIRM_SAVESTRING 1
#define CEDIT_GAME_OPTIONS_MENU 2 #define CEDIT_GAME_OPTIONS_MENU 2
@ -355,9 +315,7 @@ extern const char *nrm, *grn, *cyn, *yel;
#define CEDIT_WELC_MESSG 15 #define CEDIT_WELC_MESSG 15
#define CEDIT_START_MESSG 16 #define CEDIT_START_MESSG 16
/* /* Numerical responses. */
* Numerical responses.
*/
#define CEDIT_NUMERICAL_RESPONSE 20 #define CEDIT_NUMERICAL_RESPONSE 20
#define CEDIT_LEVEL_CAN_SHOUT 21 #define CEDIT_LEVEL_CAN_SHOUT 21
#define CEDIT_HOLLER_MOVE_COST 22 #define CEDIT_HOLLER_MOVE_COST 22
@ -402,14 +360,9 @@ extern const char *nrm, *grn, *cyn, *yel;
#define HEDIT_LIST 0 /* Define True, for logging help - FUTURE USE */ #define HEDIT_LIST 0 /* Define True, for logging help - FUTURE USE */
/* -------------------------------------------------------------------------- */
#ifndef __GENOLC_C__ #ifndef __GENOLC_C__
/* /* Prototypes to keep. */
* Prototypes to keep.
*/
#ifndef ACMD #ifndef ACMD
#define ACMD(name) \ #define ACMD(name) \
void name(struct char_data *ch, char *argument, int cmd, int subcmd) void name(struct char_data *ch, char *argument, int cmd, int subcmd)

View file

@ -63,7 +63,7 @@ ACMD(do_dig)
zone = world[IN_ROOM(ch)].zone; zone = world[IN_ROOM(ch)].zone;
if (dir < 0) { if (dir < 0) {
send_to_char(ch, "Can not create an exit to the '%s'.\r\n", sdir); send_to_char(ch, "You cannot create an exit to the '%s'.\r\n", sdir);
return; return;
} }
/* Make sure that the builder has access to the zone he's in. */ /* Make sure that the builder has access to the zone he's in. */
@ -178,7 +178,7 @@ ACMD(do_dig)
* check if we can dig from there to here. * check if we can dig from there to here.
*/ */
if (W_EXIT(rrnum, rev_dir[dir])) if (W_EXIT(rrnum, rev_dir[dir]))
send_to_char(ch, "Can not dig from %d to here. The target room already has an exit to the %s.\r\n", send_to_char(ch, "You cannot dig from %d to here. The target room already has an exit to the %s.\r\n",
rvnum, dirs[rev_dir[dir]]); rvnum, dirs[rev_dir[dir]]);
else { else {
CREATE(W_EXIT(rrnum, rev_dir[dir]), struct room_direction_data, 1); CREATE(W_EXIT(rrnum, rev_dir[dir]), struct room_direction_data, 1);

View file

@ -53,10 +53,7 @@ void oedit_disp_perm_menu(struct descriptor_data *d);
/* handy macro */ /* handy macro */
#define S_PRODUCT(s, i) ((s)->producing[(i)]) #define S_PRODUCT(s, i) ((s)->producing[(i)])
/*------------------------------------------------------------------------*\ /* Utility and exported functions */
Utility and exported functions
\*------------------------------------------------------------------------*/
ACMD(do_oasis_oedit) ACMD(do_oasis_oedit)
{ {
int number = NOWHERE, save = 0, real_num; int number = NOWHERE, save = 0, real_num;
@ -65,15 +62,11 @@ ACMD(do_oasis_oedit)
char buf1[MAX_STRING_LENGTH]; char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH]; char buf2[MAX_STRING_LENGTH];
/****************************************************************************/ /* Parse any arguments. */
/** Parse any arguments. **/
/****************************************************************************/
buf3 = two_arguments(argument, buf1, buf2); buf3 = two_arguments(argument, buf1, buf2);
/****************************************************************************/ /* If there aren't any arguments...well...they can't modify nothing now
/** If there aren't any arguments...well...they can't modify nothing now **/ can they? */
/** can they? **/
/****************************************************************************/
if (!*buf1) { if (!*buf1) {
send_to_char(ch, "Specify an object VNUM to edit.\r\n"); send_to_char(ch, "Specify an object VNUM to edit.\r\n");
return; return;
@ -102,15 +95,11 @@ ACMD(do_oasis_oedit)
} }
} }
/****************************************************************************/ /* If a numeric argument was given, get it. */
/** If a numeric argument was given, get it. **/
/****************************************************************************/
if (number == NOWHERE) if (number == NOWHERE)
number = atoi(buf1); number = atoi(buf1);
/****************************************************************************/ /* Check that whatever it is isn't already being edited. */
/** Check that whatever it is isn't already being edited. **/
/****************************************************************************/
for (d = descriptor_list; d; d = d->next) { for (d = descriptor_list; d; d = d->next) {
if (STATE(d) == CON_OEDIT) { if (STATE(d) == CON_OEDIT) {
if (d->olc && OLC_NUM(d) == number) { if (d->olc && OLC_NUM(d) == number) {
@ -121,14 +110,10 @@ ACMD(do_oasis_oedit)
} }
} }
/****************************************************************************/ /* Point d to the builder's descriptor (for easier typing later). */
/** Point d to the builder's descriptor (for easier typing later). **/
/****************************************************************************/
d = ch->desc; d = ch->desc;
/****************************************************************************/ /* Give the descriptor an OLC structure. */
/** Give the descriptor an OLC structure. **/
/****************************************************************************/
if (d->olc) { if (d->olc) {
mudlog(BRF, LVL_IMMORT, TRUE, mudlog(BRF, LVL_IMMORT, TRUE,
"SYSERR: do_oasis: Player already had olc structure."); "SYSERR: do_oasis: Player already had olc structure.");
@ -137,40 +122,30 @@ ACMD(do_oasis_oedit)
CREATE(d->olc, struct oasis_olc_data, 1); CREATE(d->olc, struct oasis_olc_data, 1);
/****************************************************************************/ /* Find the zone. */
/** Find the zone. **/
/****************************************************************************/
OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number); OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number);
if (OLC_ZNUM(d) == NOWHERE) { if (OLC_ZNUM(d) == NOWHERE) {
send_to_char(ch, "Sorry, there is no zone for that number!\r\n"); send_to_char(ch, "Sorry, there is no zone for that number!\r\n");
/**************************************************************************/ /* Free the descriptor's OLC structure. */
/** Free the descriptor's OLC structure. **/
/**************************************************************************/
free(d->olc); free(d->olc);
d->olc = NULL; d->olc = NULL;
return; return;
} }
/****************************************************************************/ /* Everyone but IMPLs can only edit zones they have been assigned. */
/** Everyone but IMPLs can only edit zones they have been assigned. **/
/****************************************************************************/
if (!can_edit_zone(ch, OLC_ZNUM(d))) { if (!can_edit_zone(ch, OLC_ZNUM(d))) {
send_to_char(ch, " You do not have permission to edit zone %d. Try zone %d.\r\n", zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); send_cannot_edit(ch, zone_table[OLC_ZNUM(d)].number);
mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d", mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
/**************************************************************************/ /* Free the descriptor's OLC structure. */
/** Free the descriptor's OLC structure. **/
/**************************************************************************/
free(d->olc); free(d->olc);
d->olc = NULL; d->olc = NULL;
return; return;
} }
/****************************************************************************/ /* If we need to save, save the objects. */
/** If we need to save, save the objects. **/
/****************************************************************************/
if (save) { if (save) {
send_to_char(ch, "Saving all objects in zone %d.\r\n", send_to_char(ch, "Saving all objects in zone %d.\r\n",
zone_table[OLC_ZNUM(d)].number); zone_table[OLC_ZNUM(d)].number);
@ -178,14 +153,10 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
"OLC: %s saves object info for zone %d.", GET_NAME(ch), "OLC: %s saves object info for zone %d.", GET_NAME(ch),
zone_table[OLC_ZNUM(d)].number); zone_table[OLC_ZNUM(d)].number);
/**************************************************************************/ /* Save the objects in this zone. */
/** Save the objects in this zone. **/
/**************************************************************************/
save_objects(OLC_ZNUM(d)); save_objects(OLC_ZNUM(d));
/**************************************************************************/ /* Free the descriptor's OLC structure. */
/** Free the descriptor's OLC structure. **/
/**************************************************************************/
free(d->olc); free(d->olc);
d->olc = NULL; d->olc = NULL;
return; return;
@ -193,10 +164,8 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
OLC_NUM(d) = number; OLC_NUM(d) = number;
/****************************************************************************/ /* If this is a new object, setup a new object, otherwise setup the existing
/** If this is a new object, setup a new object, otherwise setup the **/ object. */
/** existing object. **/
/****************************************************************************/
if ((real_num = real_object(number)) != NOTHING) if ((real_num = real_object(number)) != NOTHING)
oedit_setup_existing(d, real_num); oedit_setup_existing(d, real_num);
else else
@ -204,15 +173,11 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
STATE(d) = CON_OEDIT; STATE(d) = CON_OEDIT;
/****************************************************************************/ /* Send the OLC message to the players in the same room as the builder. */
/** Send the OLC message to the players in the same room as the builder. **/
/****************************************************************************/
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM); act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
SET_BIT(PLR_FLAGS(ch), PLR_WRITING); SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
/****************************************************************************/ /* Log the OLC message. */
/** Log the OLC message. **/
/****************************************************************************/
mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s starts editing zone %d allowed zone %d", mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s starts editing zone %d allowed zone %d",
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
} }
@ -235,37 +200,27 @@ void oedit_setup_new(struct descriptor_data *d)
oedit_disp_menu(d); oedit_disp_menu(d);
} }
/*------------------------------------------------------------------------*/
void oedit_setup_existing(struct descriptor_data *d, int real_num) void oedit_setup_existing(struct descriptor_data *d, int real_num)
{ {
struct obj_data *obj; struct obj_data *obj;
/* /* Allocate object in memory. */
* Allocate object in memory.
*/
CREATE(obj, struct obj_data, 1); CREATE(obj, struct obj_data, 1);
copy_object(obj, &obj_proto[real_num]); copy_object(obj, &obj_proto[real_num]);
/* /* Attach new object to player's descriptor. */
* Attach new object to player's descriptor.
*/
OLC_OBJ(d) = obj; OLC_OBJ(d) = obj;
OLC_VAL(d) = 0; OLC_VAL(d) = 0;
OLC_ITEM_TYPE(d) = OBJ_TRIGGER; OLC_ITEM_TYPE(d) = OBJ_TRIGGER;
dg_olc_script_copy(d); dg_olc_script_copy(d);
/* /* The edited obj must not have a script. It will be assigned to the updated
* The edited obj must not have a script. obj later, after editing. */
* It will be assigned to the updated obj later, after editing.
*/
SCRIPT(obj) = NULL; SCRIPT(obj) = NULL;
OLC_OBJ(d)->proto_script = NULL; OLC_OBJ(d)->proto_script = NULL;
oedit_disp_menu(d); oedit_disp_menu(d);
} }
/*------------------------------------------------------------------------*/
void oedit_save_internally(struct descriptor_data *d) void oedit_save_internally(struct descriptor_data *d)
{ {
int i; int i;
@ -280,8 +235,7 @@ void oedit_save_internally(struct descriptor_data *d)
return; return;
} }
/* Update triggers : */ /* Update triggers and free old proto list */
/* Free old proto list */
if (obj_proto[robj_num].proto_script && if (obj_proto[robj_num].proto_script &&
obj_proto[robj_num].proto_script != OLC_SCRIPT(d)) obj_proto[robj_num].proto_script != OLC_SCRIPT(d))
free_proto_script(&obj_proto[robj_num], OBJ_TRIGGER); free_proto_script(&obj_proto[robj_num], OBJ_TRIGGER);
@ -305,9 +259,7 @@ void oedit_save_internally(struct descriptor_data *d)
if (!i) /* If it's not a new object, don't renumber. */ if (!i) /* If it's not a new object, don't renumber. */
return; return;
/* /* Renumber produce in shops being edited. */
* Renumber produce in shops being edited.
*/
for (dsc = descriptor_list; dsc; dsc = dsc->next) for (dsc = descriptor_list; dsc; dsc = dsc->next)
if (STATE(dsc) == CON_SEDIT) if (STATE(dsc) == CON_SEDIT)
for (i = 0; S_PRODUCT(OLC_SHOP(dsc), i) != NOTHING; i++) for (i = 0; S_PRODUCT(OLC_SHOP(dsc), i) != NOTHING; i++)
@ -336,20 +288,13 @@ void oedit_save_internally(struct descriptor_data *d)
} }
} }
/*------------------------------------------------------------------------*/
void oedit_save_to_disk(int zone_num) void oedit_save_to_disk(int zone_num)
{ {
save_objects(zone_num); save_objects(zone_num);
} }
/************************************************************************** /* Menu functions */
Menu functions /* For container flags. */
**************************************************************************/
/*
* For container flags.
*/
void oedit_disp_container_flags_menu(struct descriptor_data *d) void oedit_disp_container_flags_menu(struct descriptor_data *d)
{ {
char bits[MAX_STRING_LENGTH]; char bits[MAX_STRING_LENGTH];
@ -367,9 +312,7 @@ void oedit_disp_container_flags_menu(struct descriptor_data *d)
grn, nrm, grn, nrm, grn, nrm, grn, nrm, cyn, bits, nrm); grn, nrm, grn, nrm, grn, nrm, grn, nrm, cyn, bits, nrm);
} }
/* /* For extra descriptions. */
* For extra descriptions.
*/
void oedit_disp_extradesc_menu(struct descriptor_data *d) void oedit_disp_extradesc_menu(struct descriptor_data *d)
{ {
struct extra_descr_data *extra_desc = OLC_DESC(d); struct extra_descr_data *extra_desc = OLC_DESC(d);
@ -390,9 +333,7 @@ void oedit_disp_extradesc_menu(struct descriptor_data *d)
OLC_MODE(d) = OEDIT_EXTRADESC_MENU; OLC_MODE(d) = OEDIT_EXTRADESC_MENU;
} }
/* /* Ask for *which* apply to edit. */
* Ask for *which* apply to edit.
*/
void oedit_disp_prompt_apply_menu(struct descriptor_data *d) void oedit_disp_prompt_apply_menu(struct descriptor_data *d)
{ {
char apply_buf[MAX_STRING_LENGTH]; char apply_buf[MAX_STRING_LENGTH];
@ -414,9 +355,7 @@ void oedit_disp_prompt_apply_menu(struct descriptor_data *d)
OLC_MODE(d) = OEDIT_PROMPT_APPLY; OLC_MODE(d) = OEDIT_PROMPT_APPLY;
} }
/* /* Ask for liquid type. */
* Ask for liquid type.
*/
void oedit_liquid_type(struct descriptor_data *d) void oedit_liquid_type(struct descriptor_data *d)
{ {
int counter, columns = 0; int counter, columns = 0;
@ -432,9 +371,7 @@ void oedit_liquid_type(struct descriptor_data *d)
OLC_MODE(d) = OEDIT_VALUE_3; OLC_MODE(d) = OEDIT_VALUE_3;
} }
/* /* The actual apply to set. */
* The actual apply to set.
*/
void oedit_disp_apply_menu(struct descriptor_data *d) void oedit_disp_apply_menu(struct descriptor_data *d)
{ {
int counter, columns = 0; int counter, columns = 0;
@ -450,9 +387,7 @@ void oedit_disp_apply_menu(struct descriptor_data *d)
OLC_MODE(d) = OEDIT_APPLY; OLC_MODE(d) = OEDIT_APPLY;
} }
/* /* Weapon type. */
* Weapon type.
*/
void oedit_disp_weapon_menu(struct descriptor_data *d) void oedit_disp_weapon_menu(struct descriptor_data *d)
{ {
int counter, columns = 0; int counter, columns = 0;
@ -468,9 +403,7 @@ void oedit_disp_weapon_menu(struct descriptor_data *d)
write_to_output(d, "\r\nEnter weapon type : "); write_to_output(d, "\r\nEnter weapon type : ");
} }
/* /* Spell type. */
* Spell type.
*/
void oedit_disp_spells_menu(struct descriptor_data *d) void oedit_disp_spells_menu(struct descriptor_data *d)
{ {
int counter, columns = 0; int counter, columns = 0;
@ -485,9 +418,7 @@ void oedit_disp_spells_menu(struct descriptor_data *d)
write_to_output(d, "\r\n%sEnter spell choice (-1 for none) : ", nrm); write_to_output(d, "\r\n%sEnter spell choice (-1 for none) : ", nrm);
} }
/* /* Object value #1 */
* Object value #1
*/
void oedit_disp_val1_menu(struct descriptor_data *d) void oedit_disp_val1_menu(struct descriptor_data *d)
{ {
OLC_MODE(d) = OEDIT_VALUE_1; OLC_MODE(d) = OEDIT_VALUE_1;
@ -536,9 +467,7 @@ void oedit_disp_val1_menu(struct descriptor_data *d)
} }
} }
/* /* Object value #2 */
* Object value #2
*/
void oedit_disp_val2_menu(struct descriptor_data *d) void oedit_disp_val2_menu(struct descriptor_data *d)
{ {
OLC_MODE(d) = OEDIT_VALUE_2; OLC_MODE(d) = OEDIT_VALUE_2;
@ -555,9 +484,7 @@ void oedit_disp_val2_menu(struct descriptor_data *d)
write_to_output(d, "Number of damage dice : "); write_to_output(d, "Number of damage dice : ");
break; break;
case ITEM_FOOD: case ITEM_FOOD:
/* /* Values 2 and 3 are unused, jump to 4...Odd. */
* Values 2 and 3 are unused, jump to 4...Odd.
*/
oedit_disp_val4_menu(d); oedit_disp_val4_menu(d);
break; break;
case ITEM_CONTAINER: case ITEM_CONTAINER:
@ -575,9 +502,7 @@ void oedit_disp_val2_menu(struct descriptor_data *d)
} }
} }
/* /* Object value #3 */
* Object value #3
*/
void oedit_disp_val3_menu(struct descriptor_data *d) void oedit_disp_val3_menu(struct descriptor_data *d)
{ {
OLC_MODE(d) = OEDIT_VALUE_3; OLC_MODE(d) = OEDIT_VALUE_3;
@ -608,9 +533,7 @@ void oedit_disp_val3_menu(struct descriptor_data *d)
} }
} }
/* /* Object value #4 */
* Object value #4
*/
void oedit_disp_val4_menu(struct descriptor_data *d) void oedit_disp_val4_menu(struct descriptor_data *d)
{ {
OLC_MODE(d) = OEDIT_VALUE_4; OLC_MODE(d) = OEDIT_VALUE_4;
@ -634,9 +557,7 @@ void oedit_disp_val4_menu(struct descriptor_data *d)
} }
} }
/* /* Object type. */
* Object type.
*/
void oedit_disp_type_menu(struct descriptor_data *d) void oedit_disp_type_menu(struct descriptor_data *d)
{ {
int counter, columns = 0; int counter, columns = 0;
@ -651,9 +572,7 @@ void oedit_disp_type_menu(struct descriptor_data *d)
write_to_output(d, "\r\nEnter object type : "); write_to_output(d, "\r\nEnter object type : ");
} }
/* /* Object extra flags. */
* Object extra flags.
*/
void oedit_disp_extra_menu(struct descriptor_data *d) void oedit_disp_extra_menu(struct descriptor_data *d)
{ {
char bits[MAX_STRING_LENGTH]; char bits[MAX_STRING_LENGTH];
@ -672,9 +591,7 @@ void oedit_disp_extra_menu(struct descriptor_data *d)
cyn, bits, nrm); cyn, bits, nrm);
} }
/* /* Object perm flags. */
* Object perm flags.
*/
void oedit_disp_perm_menu(struct descriptor_data *d) void oedit_disp_perm_menu(struct descriptor_data *d)
{ {
char bits[MAX_STRING_LENGTH]; char bits[MAX_STRING_LENGTH];
@ -691,9 +608,7 @@ void oedit_disp_perm_menu(struct descriptor_data *d)
"Enter object perm flag (0 to quit) : ", cyn, bits, nrm); "Enter object perm flag (0 to quit) : ", cyn, bits, nrm);
} }
/* /* Object wear flags. */
* Object wear flags.
*/
void oedit_disp_wear_menu(struct descriptor_data *d) void oedit_disp_wear_menu(struct descriptor_data *d)
{ {
char bits[MAX_STRING_LENGTH]; char bits[MAX_STRING_LENGTH];
@ -711,9 +626,7 @@ void oedit_disp_wear_menu(struct descriptor_data *d)
"Enter wear flag, 0 to quit : ", cyn, bits, nrm); "Enter wear flag, 0 to quit : ", cyn, bits, nrm);
} }
/* /* Display main menu. */
* Display main menu.
*/
void oedit_disp_menu(struct descriptor_data *d) void oedit_disp_menu(struct descriptor_data *d)
{ {
char buf1[MAX_STRING_LENGTH]; char buf1[MAX_STRING_LENGTH];
@ -724,15 +637,11 @@ void oedit_disp_menu(struct descriptor_data *d)
get_char_colors(d->character); get_char_colors(d->character);
clear_screen(d); clear_screen(d);
/* /* Build buffers for first part of menu. */
* Build buffers for first part of menu.
*/
sprinttype(GET_OBJ_TYPE(obj), item_types, buf1, sizeof(buf1)); sprinttype(GET_OBJ_TYPE(obj), item_types, buf1, sizeof(buf1));
sprintbit(GET_OBJ_EXTRA(obj), extra_bits, buf2, sizeof(buf2)); sprintbit(GET_OBJ_EXTRA(obj), extra_bits, buf2, sizeof(buf2));
/* /* Build first half of menu. */
* Build first half of menu.
*/
write_to_output(d, write_to_output(d,
"-- Item number : [%s%d%s]\r\n" "-- Item number : [%s%d%s]\r\n"
"%s1%s) Keywords : %s%s\r\n" "%s1%s) Keywords : %s%s\r\n"
@ -750,13 +659,7 @@ void oedit_disp_menu(struct descriptor_data *d)
grn, nrm, cyn, buf1, grn, nrm, cyn, buf1,
grn, nrm, cyn, buf2 grn, nrm, cyn, buf2
); );
/* /* Send first half then build second half of menu. */
* Send first half.
*/
/*
* Build second half of menu.
*/
sprintbit(GET_OBJ_WEAR(obj), wear_bits, buf1, sizeof(buf1)); sprintbit(GET_OBJ_WEAR(obj), wear_bits, buf1, sizeof(buf1));
sprintbit(GET_OBJ_PERM(obj), affected_bits, buf2, sizeof(buf2)); sprintbit(GET_OBJ_PERM(obj), affected_bits, buf2, sizeof(buf2));
@ -795,10 +698,7 @@ void oedit_disp_menu(struct descriptor_data *d)
OLC_MODE(d) = OEDIT_MAIN_MENU; OLC_MODE(d) = OEDIT_MAIN_MENU;
} }
/*************************************************************************** /* main loop (of sorts).. basically interpreter throws all input to here. */
main loop (of sorts).. basically interpreter throws all input to here
***************************************************************************/
void oedit_parse(struct descriptor_data *d, char *arg) void oedit_parse(struct descriptor_data *d, char *arg)
{ {
int number, max_val, min_val; int number, max_val, min_val;
@ -835,9 +735,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
} }
case OEDIT_MAIN_MENU: case OEDIT_MAIN_MENU:
/* /* Throw us out to whichever edit mode based on user input. */
* Throw us out to whichever edit mode based on user input.
*/
switch (*arg) { switch (*arg) {
case 'q': case 'q':
case 'Q': case 'Q':
@ -902,9 +800,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
break; break;
case 'c': case 'c':
case 'C': case 'C':
/* /* Clear any old values */
* Clear any old values
*/
GET_OBJ_VAL(OLC_OBJ(d), 0) = 0; GET_OBJ_VAL(OLC_OBJ(d), 0) = 0;
GET_OBJ_VAL(OLC_OBJ(d), 1) = 0; GET_OBJ_VAL(OLC_OBJ(d), 1) = 0;
GET_OBJ_VAL(OLC_OBJ(d), 2) = 0; GET_OBJ_VAL(OLC_OBJ(d), 2) = 0;
@ -918,9 +814,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
break; break;
case 'e': case 'e':
case 'E': case 'E':
/* /* If extra descriptions don't exist. */
* If extra descriptions don't exist.
*/
if (OLC_OBJ(d)->ex_description == NULL) { if (OLC_OBJ(d)->ex_description == NULL) {
CREATE(OLC_OBJ(d)->ex_description, struct extra_descr_data, 1); CREATE(OLC_OBJ(d)->ex_description, struct extra_descr_data, 1);
OLC_OBJ(d)->ex_description->next = NULL; OLC_OBJ(d)->ex_description->next = NULL;
@ -1056,10 +950,6 @@ void oedit_parse(struct descriptor_data *d, char *arg)
return; return;
case OEDIT_VALUE_1: case OEDIT_VALUE_1:
/*
* Lucky, I don't need to check any of these for out of range values.
* Hmm, I'm not so sure - Rv
*/
switch (GET_OBJ_TYPE(OLC_OBJ(d))) { switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
case ITEM_WEAPON: case ITEM_WEAPON:
GET_OBJ_VAL(OLC_OBJ(d), 0) = MIN(MAX(atoi(arg), -50), 50); GET_OBJ_VAL(OLC_OBJ(d), 0) = MIN(MAX(atoi(arg), -50), 50);
@ -1070,15 +960,11 @@ void oedit_parse(struct descriptor_data *d, char *arg)
default: default:
GET_OBJ_VAL(OLC_OBJ(d), 0) = atoi(arg); GET_OBJ_VAL(OLC_OBJ(d), 0) = atoi(arg);
} }
/* /* proceed to menu 2 */
* proceed to menu 2
*/
oedit_disp_val2_menu(d); oedit_disp_val2_menu(d);
return; return;
case OEDIT_VALUE_2: case OEDIT_VALUE_2:
/* /* Here, I do need to check for out of range values. */
* Here, I do need to check for out of range values.
*/
number = atoi(arg); number = atoi(arg);
switch (GET_OBJ_TYPE(OLC_OBJ(d))) { switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
case ITEM_SCROLL: case ITEM_SCROLL:
@ -1091,10 +977,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
oedit_disp_val3_menu(d); oedit_disp_val3_menu(d);
break; break;
case ITEM_CONTAINER: case ITEM_CONTAINER:
/* /* Needs some special handling since we are dealing with flag values here. */
* Needs some special handling since we are dealing with flag values
* here.
*/
if (number < 0 || number > 4) if (number < 0 || number > 4)
oedit_disp_container_flags_menu(d); oedit_disp_container_flags_menu(d);
else if (number != 0) { else if (number != 0) {
@ -1117,9 +1000,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
case OEDIT_VALUE_3: case OEDIT_VALUE_3:
number = atoi(arg); number = atoi(arg);
/* /* Quick'n'easy error checking. */
* Quick'n'easy error checking.
*/
switch (GET_OBJ_TYPE(OLC_OBJ(d))) { switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
case ITEM_SCROLL: case ITEM_SCROLL:
case ITEM_POTION: case ITEM_POTION:
@ -1250,9 +1131,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
if (OLC_DESC(d)->description) if (OLC_DESC(d)->description)
free(OLC_DESC(d)->description); free(OLC_DESC(d)->description);
/* /* Clean up pointers */
* Clean up pointers
*/
REMOVE_FROM_LIST(OLC_DESC(d), OLC_OBJ(d)->ex_description, next); REMOVE_FROM_LIST(OLC_DESC(d), OLC_OBJ(d)->ex_description, next);
free(OLC_DESC(d)); free(OLC_DESC(d));
OLC_DESC(d) = NULL; OLC_DESC(d) = NULL;
@ -1277,9 +1156,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
return; return;
case 3: case 3:
/* /* Only go to the next description if this one is finished. */
* Only go to the next description if this one is finished.
*/
if (OLC_DESC(d)->keyword && OLC_DESC(d)->description) { if (OLC_DESC(d)->keyword && OLC_DESC(d)->description) {
struct extra_descr_data *new_extra; struct extra_descr_data *new_extra;
@ -1319,9 +1196,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
break; break;
} }
/* /* If we get here, we have changed something. */
* If we get here, we have changed something.
*/
OLC_VAL(d) = 1; OLC_VAL(d) = 1;
oedit_disp_menu(d); oedit_disp_menu(d);
} }

View file

@ -7,7 +7,6 @@
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
#include "structs.h" #include "structs.h"
#include "utils.h" #include "utils.h"
#include "comm.h" #include "comm.h"
@ -32,10 +31,7 @@ void redit_disp_flag_menu(struct descriptor_data *d);
void redit_disp_sector_menu(struct descriptor_data *d); void redit_disp_sector_menu(struct descriptor_data *d);
void redit_disp_menu(struct descriptor_data *d); void redit_disp_menu(struct descriptor_data *d);
/*------------------------------------------------------------------------*\ /* Utils and exported functions. */
Utils and exported functions.
\*------------------------------------------------------------------------*/
ACMD(do_oasis_redit) ACMD(do_oasis_redit)
{ {
char *buf3; char *buf3;
@ -74,9 +70,7 @@ ACMD(do_oasis_redit)
} }
} }
/* /* If a numeric argument was given (like a room number), get it. */
* If a numeric argument was given (like a room number), get it.
*/
if (number == NOWHERE) if (number == NOWHERE)
number = atoi(buf1); number = atoi(buf1);
@ -114,7 +108,7 @@ ACMD(do_oasis_redit)
/* Make sure the builder is allowed to modify this zone. */ /* Make sure the builder is allowed to modify this zone. */
if (!can_edit_zone(ch, OLC_ZNUM(d))) { if (!can_edit_zone(ch, OLC_ZNUM(d))) {
send_to_char(ch, " You do not have permission to edit zone %d. Try zone %d.\r\n", zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); send_cannot_edit(ch, zone_table[OLC_ZNUM(d)].number);
mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d", mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
@ -165,39 +159,27 @@ void redit_setup_new(struct descriptor_data *d)
OLC_VAL(d) = 0; OLC_VAL(d) = 0;
} }
/*------------------------------------------------------------------------*/
void redit_setup_existing(struct descriptor_data *d, int real_num) void redit_setup_existing(struct descriptor_data *d, int real_num)
{ {
struct room_data *room; struct room_data *room;
int counter; int counter;
/* /* Build a copy of the room for editing. */
* Build a copy of the room for editing.
*/
CREATE(room, struct room_data, 1); CREATE(room, struct room_data, 1);
*room = world[real_num]; *room = world[real_num];
/* /* Allocate space for all strings. */
* Allocate space for all strings.
*/
room->name = str_udup(world[real_num].name); room->name = str_udup(world[real_num].name);
room->description = str_udup(world[real_num].description); room->description = str_udup(world[real_num].description);
/* /* Exits - We allocate only if necessary. */
* Exits - We allocate only if necessary.
*/
for (counter = 0; counter < NUM_OF_DIRS; counter++) { for (counter = 0; counter < NUM_OF_DIRS; counter++) {
if (world[real_num].dir_option[counter]) { if (world[real_num].dir_option[counter]) {
CREATE(room->dir_option[counter], struct room_direction_data, 1); CREATE(room->dir_option[counter], struct room_direction_data, 1);
/* /* Copy the numbers over. */
* Copy the numbers over.
*/
*room->dir_option[counter] = *world[real_num].dir_option[counter]; *room->dir_option[counter] = *world[real_num].dir_option[counter];
/* /* Allocate the strings. */
* Allocate the strings.
*/
if (world[real_num].dir_option[counter]->general_description) if (world[real_num].dir_option[counter]->general_description)
room->dir_option[counter]->general_description = strdup(world[real_num].dir_option[counter]->general_description); room->dir_option[counter]->general_description = strdup(world[real_num].dir_option[counter]->general_description);
if (world[real_num].dir_option[counter]->keyword) if (world[real_num].dir_option[counter]->keyword)
@ -205,9 +187,7 @@ void redit_setup_existing(struct descriptor_data *d, int real_num)
} }
} }
/* /* Extra descriptions, if necessary. */
* Extra descriptions, if necessary.
*/
if (world[real_num].ex_description) { if (world[real_num].ex_description) {
struct extra_descr_data *tdesc, *temp, *temp2; struct extra_descr_data *tdesc, *temp, *temp2;
CREATE(temp, struct extra_descr_data, 1); CREATE(temp, struct extra_descr_data, 1);
@ -225,9 +205,7 @@ void redit_setup_existing(struct descriptor_data *d, int real_num)
} }
} }
/* /* Attach copy of room to player's descriptor. */
* Attach copy of room to player's descriptor.
*/
OLC_ROOM(d) = room; OLC_ROOM(d) = room;
OLC_VAL(d) = 0; OLC_VAL(d) = 0;
OLC_ITEM_TYPE(d) = WLD_TRIGGER; OLC_ITEM_TYPE(d) = WLD_TRIGGER;
@ -239,8 +217,6 @@ void redit_setup_existing(struct descriptor_data *d, int real_num)
redit_disp_menu(d); redit_disp_menu(d);
} }
/*------------------------------------------------------------------------*/
void redit_save_internally(struct descriptor_data *d) void redit_save_internally(struct descriptor_data *d)
{ {
int j, room_num, new_room = FALSE; int j, room_num, new_room = FALSE;
@ -259,8 +235,7 @@ void redit_save_internally(struct descriptor_data *d)
return; return;
} }
/* Update triggers */ /* Update triggers and free old proto list */
/* Free old proto list */
if (world[room_num].proto_script && if (world[room_num].proto_script &&
world[room_num].proto_script != OLC_SCRIPT(d)) world[room_num].proto_script != OLC_SCRIPT(d))
free_proto_script(&world[room_num], WLD_TRIGGER); free_proto_script(&world[room_num], WLD_TRIGGER);
@ -303,15 +278,11 @@ void redit_save_internally(struct descriptor_data *d)
} }
} }
/*------------------------------------------------------------------------*/
void redit_save_to_disk(zone_vnum zone_num) void redit_save_to_disk(zone_vnum zone_num)
{ {
save_rooms(zone_num); /* :) */ save_rooms(zone_num); /* :) */
} }
/*------------------------------------------------------------------------*/
void free_room(struct room_data *room) void free_room(struct room_data *room)
{ {
/* Free the strings (Mythran). */ /* Free the strings (Mythran). */
@ -325,13 +296,8 @@ void free_room(struct room_data *room)
free(room); /* XXX ? */ free(room); /* XXX ? */
} }
/************************************************************************** /* Menu functions */
Menu functions /* For extra descriptions. */
**************************************************************************/
/*
* For extra descriptions.
*/
void redit_disp_extradesc_menu(struct descriptor_data *d) void redit_disp_extradesc_menu(struct descriptor_data *d)
{ {
struct extra_descr_data *extra_desc = OLC_DESC(d); struct extra_descr_data *extra_desc = OLC_DESC(d);
@ -352,22 +318,16 @@ void redit_disp_extradesc_menu(struct descriptor_data *d)
OLC_MODE(d) = REDIT_EXTRADESC_MENU; OLC_MODE(d) = REDIT_EXTRADESC_MENU;
} }
/* /* For exits. */
* For exits.
*/
void redit_disp_exit_menu(struct descriptor_data *d) void redit_disp_exit_menu(struct descriptor_data *d)
{ {
char door_buf[24]; char door_buf[24];
/* /* if exit doesn't exist, alloc/create it */
* if exit doesn't exist, alloc/create it
*/
if (OLC_EXIT(d) == NULL) { if (OLC_EXIT(d) == NULL) {
CREATE(OLC_EXIT(d), struct room_direction_data, 1); CREATE(OLC_EXIT(d), struct room_direction_data, 1);
OLC_EXIT(d)->to_room = NOWHERE; OLC_EXIT(d)->to_room = NOWHERE;
} }
/* /* Weird door handling! */
* Weird door handling!
*/
if (IS_SET(OLC_EXIT(d)->exit_info, EX_ISDOOR)) { if (IS_SET(OLC_EXIT(d)->exit_info, EX_ISDOOR)) {
if (IS_SET(OLC_EXIT(d)->exit_info, EX_PICKPROOF)) if (IS_SET(OLC_EXIT(d)->exit_info, EX_PICKPROOF))
strncpy(door_buf, "Pickproof", sizeof(door_buf)-1); strncpy(door_buf, "Pickproof", sizeof(door_buf)-1);
@ -397,9 +357,7 @@ void redit_disp_exit_menu(struct descriptor_data *d)
OLC_MODE(d) = REDIT_EXIT_MENU; OLC_MODE(d) = REDIT_EXIT_MENU;
} }
/* /* For exit flags. */
* For exit flags.
*/
void redit_disp_exit_flag_menu(struct descriptor_data *d) void redit_disp_exit_flag_menu(struct descriptor_data *d)
{ {
get_char_colors(d->character); get_char_colors(d->character);
@ -409,9 +367,7 @@ void redit_disp_exit_flag_menu(struct descriptor_data *d)
"Enter choice : ", grn, nrm, grn, nrm, grn, nrm); "Enter choice : ", grn, nrm, grn, nrm, grn, nrm);
} }
/* /* For room flags. */
* For room flags.
*/
void redit_disp_flag_menu(struct descriptor_data *d) void redit_disp_flag_menu(struct descriptor_data *d)
{ {
char bits[MAX_STRING_LENGTH]; char bits[MAX_STRING_LENGTH];
@ -429,9 +385,7 @@ void redit_disp_flag_menu(struct descriptor_data *d)
OLC_MODE(d) = REDIT_FLAGS; OLC_MODE(d) = REDIT_FLAGS;
} }
/* /* For sector type. */
* For sector type.
*/
void redit_disp_sector_menu(struct descriptor_data *d) void redit_disp_sector_menu(struct descriptor_data *d)
{ {
int counter, columns = 0; int counter, columns = 0;
@ -445,9 +399,7 @@ void redit_disp_sector_menu(struct descriptor_data *d)
OLC_MODE(d) = REDIT_SECTOR; OLC_MODE(d) = REDIT_SECTOR;
} }
/* /* The main menu. */
* The main menu.
*/
void redit_disp_menu(struct descriptor_data *d) void redit_disp_menu(struct descriptor_data *d)
{ {
char buf1[MAX_STRING_LENGTH]; char buf1[MAX_STRING_LENGTH];
@ -511,10 +463,7 @@ void redit_disp_menu(struct descriptor_data *d)
OLC_MODE(d) = REDIT_MAIN_MENU; OLC_MODE(d) = REDIT_MAIN_MENU;
} }
/************************************************************************** /* The main loop*/
The main loop
**************************************************************************/
void redit_parse(struct descriptor_data *d, char *arg) void redit_parse(struct descriptor_data *d, char *arg)
{ {
int number; int number;
@ -532,16 +481,12 @@ void redit_parse(struct descriptor_data *d, char *arg)
write_to_output(d, "Room saved to disk.\r\n"); write_to_output(d, "Room saved to disk.\r\n");
} else } else
write_to_output(d, "Room saved to memory.\r\n"); write_to_output(d, "Room saved to memory.\r\n");
/* /* Do NOT free strings! Just the room structure. */
* Do NOT free strings! Just the room structure.
*/
cleanup_olc(d, CLEANUP_STRUCTS); cleanup_olc(d, CLEANUP_STRUCTS);
break; break;
case 'n': case 'n':
case 'N': case 'N':
/* /* Free everything up, including strings, etc. */
* Free everything up, including strings, etc.
*/
cleanup_olc(d, CLEANUP_ALL); cleanup_olc(d, CLEANUP_ALL);
break; break;
default: default:
@ -610,9 +555,7 @@ void redit_parse(struct descriptor_data *d, char *arg)
break; break;
case 'b': case 'b':
case 'B': case 'B':
/* /* If the extra description doesn't exist. */
* If the extra description doesn't exist.
*/
if (!OLC_ROOM(d)->ex_description) if (!OLC_ROOM(d)->ex_description)
CREATE(OLC_ROOM(d)->ex_description, struct extra_descr_data, 1); CREATE(OLC_ROOM(d)->ex_description, struct extra_descr_data, 1);
OLC_DESC(d) = OLC_ROOM(d)->ex_description; OLC_DESC(d) = OLC_ROOM(d)->ex_description;
@ -652,9 +595,7 @@ void redit_parse(struct descriptor_data *d, char *arg)
break; break;
case REDIT_DESC: case REDIT_DESC:
/* /* We will NEVER get here, we hope. */
* We will NEVER get here, we hope.
*/
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: Reached REDIT_DESC case in parse_redit()."); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: Reached REDIT_DESC case in parse_redit().");
write_to_output(d, "Oops, in REDIT_DESC.\r\n"); write_to_output(d, "Oops, in REDIT_DESC.\r\n");
break; break;
@ -667,9 +608,7 @@ void redit_parse(struct descriptor_data *d, char *arg)
} else if (number == 0) } else if (number == 0)
break; break;
else { else {
/* /* Toggle the bit. */
* Toggle the bit.
*/
TOGGLE_BIT(OLC_ROOM(d)->room_flags, 1 << (number - 1)); TOGGLE_BIT(OLC_ROOM(d)->room_flags, 1 << (number - 1));
redit_disp_flag_menu(d); redit_disp_flag_menu(d);
} }
@ -744,9 +683,7 @@ void redit_parse(struct descriptor_data *d, char *arg)
return; return;
case REDIT_EXIT_DESCRIPTION: case REDIT_EXIT_DESCRIPTION:
/* /* We should NEVER get here, hopefully. */
* We should NEVER get here, hopefully.
*/
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: Reached REDIT_EXIT_DESC case in parse_redit"); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: Reached REDIT_EXIT_DESC case in parse_redit");
write_to_output(d, "Oops, in REDIT_EXIT_DESCRIPTION.\r\n"); write_to_output(d, "Oops, in REDIT_EXIT_DESCRIPTION.\r\n");
break; break;
@ -773,15 +710,11 @@ void redit_parse(struct descriptor_data *d, char *arg)
write_to_output(d, "That's not a valid choice!\r\n"); write_to_output(d, "That's not a valid choice!\r\n");
redit_disp_exit_flag_menu(d); redit_disp_exit_flag_menu(d);
} else { } else {
/* /* Doors are a bit idiotic, don't you think? :) -- I agree. -gg */
* Doors are a bit idiotic, don't you think? :) -- I agree. -gg
*/
OLC_EXIT(d)->exit_info = (number == 0 ? 0 : OLC_EXIT(d)->exit_info = (number == 0 ? 0 :
(number == 1 ? EX_ISDOOR : (number == 1 ? EX_ISDOOR :
(number == 2 ? EX_ISDOOR | EX_PICKPROOF : 0))); (number == 2 ? EX_ISDOOR | EX_PICKPROOF : 0)));
/* /* Jump back to the menu system. */
* Jump back to the menu system.
*/
redit_disp_exit_menu(d); redit_disp_exit_menu(d);
} }
return; return;
@ -798,10 +731,8 @@ void redit_parse(struct descriptor_data *d, char *arg)
case REDIT_EXTRADESC_MENU: case REDIT_EXTRADESC_MENU:
switch ((number = atoi(arg))) { switch ((number = atoi(arg))) {
case 0: case 0:
/* /* If something got left out, delete the extra description when backing
* If something got left out, delete the extra description out to the menu. */
* when backing out to the menu.
*/
if (OLC_DESC(d)->keyword == NULL || OLC_DESC(d)->description == NULL) { if (OLC_DESC(d)->keyword == NULL || OLC_DESC(d)->description == NULL) {
struct extra_descr_data *temp; struct extra_descr_data *temp;
if (OLC_DESC(d)->keyword) if (OLC_DESC(d)->keyword)
@ -809,9 +740,7 @@ void redit_parse(struct descriptor_data *d, char *arg)
if (OLC_DESC(d)->description) if (OLC_DESC(d)->description)
free(OLC_DESC(d)->description); free(OLC_DESC(d)->description);
/* /* Clean up pointers. */
* Clean up pointers.
*/
REMOVE_FROM_LIST(OLC_DESC(d), OLC_ROOM(d)->ex_description, next); REMOVE_FROM_LIST(OLC_DESC(d), OLC_ROOM(d)->ex_description, next);
free(OLC_DESC(d)); free(OLC_DESC(d));
} }
@ -840,9 +769,7 @@ void redit_parse(struct descriptor_data *d, char *arg)
if (OLC_DESC(d)->next) if (OLC_DESC(d)->next)
OLC_DESC(d) = OLC_DESC(d)->next; OLC_DESC(d) = OLC_DESC(d)->next;
else { else {
/* /* Make new extra description and attach at end. */
* Make new extra description and attach at end.
*/
CREATE(new_extra, struct extra_descr_data, 1); CREATE(new_extra, struct extra_descr_data, 1);
OLC_DESC(d)->next = new_extra; OLC_DESC(d)->next = new_extra;
OLC_DESC(d) = new_extra; OLC_DESC(d) = new_extra;
@ -872,15 +799,11 @@ void redit_parse(struct descriptor_data *d, char *arg)
break; break;
default: default:
/* /* We should never get here. */
* We should never get here.
*/
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: Reached default case in parse_redit"); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: Reached default case in parse_redit");
break; break;
} }
/* /* If we get this far, something has been changed. */
* If we get this far, something has been changed.
*/
OLC_VAL(d) = 1; OLC_VAL(d) = 1;
redit_disp_menu(d); redit_disp_menu(d);
} }

View file

@ -50,10 +50,7 @@ void sedit_save_to_disk(int num)
save_shops(num); save_shops(num);
} }
/*-------------------------------------------------------------------*\ /* utility functions */
utility functions
\*-------------------------------------------------------------------*/
ACMD(do_oasis_sedit) ACMD(do_oasis_sedit)
{ {
int number = NOWHERE, save = 0; int number = NOWHERE, save = 0;
@ -63,9 +60,7 @@ ACMD(do_oasis_sedit)
char buf1[MAX_INPUT_LENGTH]; char buf1[MAX_INPUT_LENGTH];
char buf2[MAX_INPUT_LENGTH]; char buf2[MAX_INPUT_LENGTH];
/****************************************************************************/ /* Parse any arguments. */
/** Parse any arguments. **/
/****************************************************************************/
buf3 = two_arguments(argument, buf1, buf2); buf3 = two_arguments(argument, buf1, buf2);
if (!*buf1) { if (!*buf1) {
@ -96,15 +91,11 @@ ACMD(do_oasis_sedit)
} }
} }
/****************************************************************************/ /* If a numeric argument was given, get it. */
/** If a numeric argument was given, get it. **/
/****************************************************************************/
if (number == NOWHERE) if (number == NOWHERE)
number = atoi(buf1); number = atoi(buf1);
/****************************************************************************/ /* Check that the shop isn't already being edited. */
/** Check that the shop isn't already being edited. **/
/****************************************************************************/
for (d = descriptor_list; d; d = d->next) { for (d = descriptor_list; d; d = d->next) {
if (STATE(d) == CON_SEDIT) { if (STATE(d) == CON_SEDIT) {
if (d->olc && OLC_NUM(d) == number) { if (d->olc && OLC_NUM(d) == number) {
@ -115,14 +106,10 @@ ACMD(do_oasis_sedit)
} }
} }
/****************************************************************************/ /* Point d to the builder's descriptor. */
/** Point d to the builder's descriptor. **/
/****************************************************************************/
d = ch->desc; d = ch->desc;
/****************************************************************************/ /* Give the descriptor an OLC structure. */
/** Give the descriptor an OLC structure. **/
/****************************************************************************/
if (d->olc) { if (d->olc) {
mudlog(BRF, LVL_IMMORT, TRUE, mudlog(BRF, LVL_IMMORT, TRUE,
"SYSERR: do_oasis_sedit: Player already had olc structure."); "SYSERR: do_oasis_sedit: Player already had olc structure.");
@ -131,9 +118,7 @@ ACMD(do_oasis_sedit)
CREATE(d->olc, struct oasis_olc_data, 1); CREATE(d->olc, struct oasis_olc_data, 1);
/****************************************************************************/ /* Find the zone. */
/** Find the zone. **/
/****************************************************************************/
OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number); OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number);
if (OLC_ZNUM(d) == NOWHERE) { if (OLC_ZNUM(d) == NOWHERE) {
send_to_char(ch, "Sorry, there is no zone for that number!\r\n"); send_to_char(ch, "Sorry, there is no zone for that number!\r\n");
@ -142,15 +127,11 @@ ACMD(do_oasis_sedit)
return; return;
} }
/****************************************************************************/ /* Everyone but IMPLs can only edit zones they have been assigned. */
/** Everyone but IMPLs can only edit zones they have been assigned. **/
/****************************************************************************/
if (!can_edit_zone(ch, OLC_ZNUM(d))) { if (!can_edit_zone(ch, OLC_ZNUM(d))) {
send_to_char(ch, " You do not have permission to edit zone %d. Try zone %d.\r\n", zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); send_cannot_edit(ch, zone_table[OLC_ZNUM(d)].number);
/**************************************************************************/ /* Free the OLC structure. */
/** Free the OLC structure. **/
/**************************************************************************/
free(d->olc); free(d->olc);
d->olc = NULL; d->olc = NULL;
return; return;
@ -163,14 +144,10 @@ send_to_char(ch, " You do not have permission to edit zone %d. Try zone %d.\r\n"
"OLC: %s saves shop info for zone %d.", "OLC: %s saves shop info for zone %d.",
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number); GET_NAME(ch), zone_table[OLC_ZNUM(d)].number);
/**************************************************************************/ /* Save the shops to the shop file. */
/** Save the shops to the shop file. **/
/**************************************************************************/
save_shops(OLC_ZNUM(d)); save_shops(OLC_ZNUM(d));
/**************************************************************************/ /* Free the OLC structure. */
/** Free the OLC structure. **/
/**************************************************************************/
free(d->olc); free(d->olc);
d->olc = NULL; d->olc = NULL;
return; return;
@ -196,21 +173,15 @@ void sedit_setup_new(struct descriptor_data *d)
{ {
struct shop_data *shop; struct shop_data *shop;
/* /* Allocate a scratch shop structure. */
* Allocate a scratch shop structure.
*/
CREATE(shop, struct shop_data, 1); CREATE(shop, struct shop_data, 1);
/* /* Fill in some default values. */
* Fill in some default values.
*/
S_KEEPER(shop) = NOBODY; S_KEEPER(shop) = NOBODY;
S_CLOSE1(shop) = 28; S_CLOSE1(shop) = 28;
S_BUYPROFIT(shop) = 1.0; S_BUYPROFIT(shop) = 1.0;
S_SELLPROFIT(shop) = 1.0; S_SELLPROFIT(shop) = 1.0;
/* /* Add a spice of default strings. */
* Add a spice of default strings.
*/
S_NOITEM1(shop) = strdup("%s Sorry, I don't stock that item."); S_NOITEM1(shop) = strdup("%s Sorry, I don't stock that item.");
S_NOITEM2(shop) = strdup("%s You don't seem to have that."); S_NOITEM2(shop) = strdup("%s You don't seem to have that.");
S_NOCASH1(shop) = strdup("%s I can't afford that!"); S_NOCASH1(shop) = strdup("%s I can't afford that!");
@ -218,9 +189,7 @@ void sedit_setup_new(struct descriptor_data *d)
S_NOBUY(shop) = strdup("%s I don't trade in such items."); S_NOBUY(shop) = strdup("%s I don't trade in such items.");
S_BUY(shop) = strdup("%s That'll be %d coins, thanks."); S_BUY(shop) = strdup("%s That'll be %d coins, thanks.");
S_SELL(shop) = strdup("%s I'll give you %d coins for that."); S_SELL(shop) = strdup("%s I'll give you %d coins for that.");
/* /* Stir the lists lightly. */
* Stir the lists lightly.
*/
CREATE(S_PRODUCTS(shop), obj_vnum, 1); CREATE(S_PRODUCTS(shop), obj_vnum, 1);
S_PRODUCT(shop, 0) = NOTHING; S_PRODUCT(shop, 0) = NOTHING;
@ -231,20 +200,14 @@ void sedit_setup_new(struct descriptor_data *d)
S_BUYTYPE(shop, 0) = NOTHING; S_BUYTYPE(shop, 0) = NOTHING;
/* /* Presto! A shop. */
* Presto! A shop.
*/
OLC_SHOP(d) = shop; OLC_SHOP(d) = shop;
sedit_disp_menu(d); sedit_disp_menu(d);
} }
/*-------------------------------------------------------------------*/
void sedit_setup_existing(struct descriptor_data *d, int rshop_num) void sedit_setup_existing(struct descriptor_data *d, int rshop_num)
{ {
/* /* Create a scratch shop structure. */
* Create a scratch shop structure.
*/
CREATE(OLC_SHOP(d), struct shop_data, 1); CREATE(OLC_SHOP(d), struct shop_data, 1);
/* don't waste time trying to free NULL strings -- Welcor */ /* don't waste time trying to free NULL strings -- Welcor */
@ -252,10 +215,7 @@ void sedit_setup_existing(struct descriptor_data *d, int rshop_num)
sedit_disp_menu(d); sedit_disp_menu(d);
} }
/************************************************************************** /* Menu functions */
Menu functions
**************************************************************************/
void sedit_products_menu(struct descriptor_data *d) void sedit_products_menu(struct descriptor_data *d)
{ {
struct shop_data *shop; struct shop_data *shop;
@ -280,8 +240,6 @@ void sedit_products_menu(struct descriptor_data *d)
OLC_MODE(d) = SEDIT_PRODUCTS_MENU; OLC_MODE(d) = SEDIT_PRODUCTS_MENU;
} }
/*-------------------------------------------------------------------*/
void sedit_compact_rooms_menu(struct descriptor_data *d) void sedit_compact_rooms_menu(struct descriptor_data *d)
{ {
struct shop_data *shop; struct shop_data *shop;
@ -305,8 +263,6 @@ void sedit_compact_rooms_menu(struct descriptor_data *d)
OLC_MODE(d) = SEDIT_ROOMS_MENU; OLC_MODE(d) = SEDIT_ROOMS_MENU;
} }
/*-------------------------------------------------------------------*/
void sedit_rooms_menu(struct descriptor_data *d) void sedit_rooms_menu(struct descriptor_data *d)
{ {
struct shop_data *shop; struct shop_data *shop;
@ -338,8 +294,6 @@ void sedit_rooms_menu(struct descriptor_data *d)
OLC_MODE(d) = SEDIT_ROOMS_MENU; OLC_MODE(d) = SEDIT_ROOMS_MENU;
} }
/*-------------------------------------------------------------------*/
void sedit_namelist_menu(struct descriptor_data *d) void sedit_namelist_menu(struct descriptor_data *d)
{ {
struct shop_data *shop; struct shop_data *shop;
@ -364,8 +318,6 @@ void sedit_namelist_menu(struct descriptor_data *d)
OLC_MODE(d) = SEDIT_NAMELIST_MENU; OLC_MODE(d) = SEDIT_NAMELIST_MENU;
} }
/*-------------------------------------------------------------------*/
void sedit_shop_flags_menu(struct descriptor_data *d) void sedit_shop_flags_menu(struct descriptor_data *d)
{ {
char bits[MAX_STRING_LENGTH]; char bits[MAX_STRING_LENGTH];
@ -383,8 +335,6 @@ void sedit_shop_flags_menu(struct descriptor_data *d)
OLC_MODE(d) = SEDIT_SHOP_FLAGS; OLC_MODE(d) = SEDIT_SHOP_FLAGS;
} }
/*-------------------------------------------------------------------*/
void sedit_no_trade_menu(struct descriptor_data *d) void sedit_no_trade_menu(struct descriptor_data *d)
{ {
char bits[MAX_STRING_LENGTH]; char bits[MAX_STRING_LENGTH];
@ -402,8 +352,6 @@ void sedit_no_trade_menu(struct descriptor_data *d)
OLC_MODE(d) = SEDIT_NOTRADE; OLC_MODE(d) = SEDIT_NOTRADE;
} }
/*-------------------------------------------------------------------*/
void sedit_types_menu(struct descriptor_data *d) void sedit_types_menu(struct descriptor_data *d)
{ {
struct shop_data *shop; struct shop_data *shop;
@ -421,11 +369,7 @@ void sedit_types_menu(struct descriptor_data *d)
OLC_MODE(d) = SEDIT_TYPE_MENU; OLC_MODE(d) = SEDIT_TYPE_MENU;
} }
/*-------------------------------------------------------------------*/ /* Display main menu. */
/*
* Display main menu.
*/
void sedit_disp_menu(struct descriptor_data *d) void sedit_disp_menu(struct descriptor_data *d)
{ {
char buf1[MAX_STRING_LENGTH]; char buf1[MAX_STRING_LENGTH];
@ -483,10 +427,7 @@ void sedit_disp_menu(struct descriptor_data *d)
OLC_MODE(d) = SEDIT_MAIN_MENU; OLC_MODE(d) = SEDIT_MAIN_MENU;
} }
/************************************************************************** /* The GARGANTUAN event handler */
The GARGANTUAN event handler
**************************************************************************/
void sedit_parse(struct descriptor_data *d, char *arg) void sedit_parse(struct descriptor_data *d, char *arg)
{ {
int i; int i;
@ -498,7 +439,6 @@ void sedit_parse(struct descriptor_data *d, char *arg)
} }
} }
switch (OLC_MODE(d)) { switch (OLC_MODE(d)) {
/*-------------------------------------------------------------------*/
case SEDIT_CONFIRM_SAVESTRING: case SEDIT_CONFIRM_SAVESTRING:
switch (*arg) { switch (*arg) {
case 'y': case 'y':
@ -525,7 +465,6 @@ void sedit_parse(struct descriptor_data *d, char *arg)
} }
break; break;
/*-------------------------------------------------------------------*/
case SEDIT_MAIN_MENU: case SEDIT_MAIN_MENU:
i = 0; i = 0;
switch (*arg) { switch (*arg) {
@ -631,7 +570,7 @@ void sedit_parse(struct descriptor_data *d, char *arg)
else else
write_to_output(d, "Oops...\r\n"); write_to_output(d, "Oops...\r\n");
return; return;
/*-------------------------------------------------------------------*/
case SEDIT_NAMELIST_MENU: case SEDIT_NAMELIST_MENU:
switch (*arg) { switch (*arg) {
case 'a': case 'a':
@ -648,7 +587,7 @@ void sedit_parse(struct descriptor_data *d, char *arg)
break; break;
} }
break; break;
/*-------------------------------------------------------------------*/
case SEDIT_PRODUCTS_MENU: case SEDIT_PRODUCTS_MENU:
switch (*arg) { switch (*arg) {
case 'a': case 'a':
@ -666,7 +605,7 @@ void sedit_parse(struct descriptor_data *d, char *arg)
break; break;
} }
break; break;
/*-------------------------------------------------------------------*/
case SEDIT_ROOMS_MENU: case SEDIT_ROOMS_MENU:
switch (*arg) { switch (*arg) {
case 'a': case 'a':
@ -692,10 +631,8 @@ void sedit_parse(struct descriptor_data *d, char *arg)
break; break;
} }
break; break;
/*-------------------------------------------------------------------*/
/* /* String edits. */
* String edits.
*/
case SEDIT_NOITEM1: case SEDIT_NOITEM1:
if (genolc_checkstring(d, arg)) if (genolc_checkstring(d, arg))
modify_shop_string(&S_NOITEM1(OLC_SHOP(d)), arg); modify_shop_string(&S_NOITEM1(OLC_SHOP(d)), arg);
@ -735,10 +672,7 @@ void sedit_parse(struct descriptor_data *d, char *arg)
sedit_namelist_menu(d); sedit_namelist_menu(d);
return; return;
/*-------------------------------------------------------------------*/ /* Numerical responses. */
/*
* Numerical responses.
*/
case SEDIT_KEEPER: case SEDIT_KEEPER:
i = atoi(arg); i = atoi(arg);
if ((i = atoi(arg)) != -1) if ((i = atoi(arg)) != -1)
@ -749,9 +683,7 @@ void sedit_parse(struct descriptor_data *d, char *arg)
S_KEEPER(OLC_SHOP(d)) = i; S_KEEPER(OLC_SHOP(d)) = i;
if (i == -1) if (i == -1)
break; break;
/* /* Fiddle with special procs. */
* Fiddle with special procs.
*/
S_FUNC(OLC_SHOP(d)) = mob_index[i].func != shop_keeper ? mob_index[i].func : NULL; S_FUNC(OLC_SHOP(d)) = mob_index[i].func != shop_keeper ? mob_index[i].func : NULL;
mob_index[i].func = shop_keeper; mob_index[i].func = shop_keeper;
break; break;
@ -825,24 +757,16 @@ void sedit_parse(struct descriptor_data *d, char *arg)
} }
break; break;
/*-------------------------------------------------------------------*/
default: default:
/* /* We should never get here. */
* We should never get here.
*/
cleanup_olc(d, CLEANUP_ALL); cleanup_olc(d, CLEANUP_ALL);
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: sedit_parse(): Reached default case!"); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: sedit_parse(): Reached default case!");
write_to_output(d, "Oops...\r\n"); write_to_output(d, "Oops...\r\n");
break; break;
} }
/*-------------------------------------------------------------------*/ /* If we get here, we have probably changed something, and now want to return
to main menu. Use OLC_VAL as a 'has changed' flag. */
/*
* END OF CASE
* If we get here, we have probably changed something, and now want to
* return to main menu. Use OLC_VAL as a 'has changed' flag.
*/
OLC_VAL(d) = 1; OLC_VAL(d) = 1;
sedit_disp_menu(d); sedit_disp_menu(d);
} }

View file

@ -8,13 +8,10 @@
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */ ************************************************************************ */
/*** /* The entire shop rewrite for Circle 3.0 was done by Jeff Fink. Thanks Jeff! */
* The entire shop rewrite for Circle 3.0 was done by Jeff Fink. Thanks Jeff!
***/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
#include "structs.h" #include "structs.h"
#include "comm.h" #include "comm.h"
#include "handler.h" #include "handler.h"
@ -81,7 +78,6 @@ int end_read_list(struct shop_buy_data *list, int len, int error);
void read_line(FILE *shop_f, const char *string, void *data); void read_line(FILE *shop_f, const char *string, void *data);
void destroy_shops(void); void destroy_shops(void);
/* config arrays */ /* config arrays */
const char *operator_str[] = { const char *operator_str[] = {
"[({", "[({",
@ -103,7 +99,6 @@ const char *trade_letters[] = {
"\n" "\n"
}; };
const char *shop_bits[] = { const char *shop_bits[] = {
"WILL_FIGHT", "WILL_FIGHT",
"USES_BANK", "USES_BANK",
@ -144,7 +139,6 @@ int is_ok_char(struct char_data *keeper, struct char_data *ch, int shop_nr)
return (TRUE); return (TRUE);
} }
int is_open(struct char_data *keeper, int shop_nr, int msg) int is_open(struct char_data *keeper, int shop_nr, int msg)
{ {
char buf[MAX_INPUT_LENGTH]; char buf[MAX_INPUT_LENGTH];
@ -165,7 +159,6 @@ int is_open(struct char_data *keeper, int shop_nr, int msg)
return (FALSE); return (FALSE);
} }
int is_ok(struct char_data *keeper, struct char_data *ch, int shop_nr) int is_ok(struct char_data *keeper, struct char_data *ch, int shop_nr)
{ {
if (is_open(keeper, shop_nr, TRUE)) if (is_open(keeper, shop_nr, TRUE))
@ -174,13 +167,11 @@ int is_ok(struct char_data *keeper, struct char_data *ch, int shop_nr)
return (FALSE); return (FALSE);
} }
void push(struct stack_data *stack, int pushval) void push(struct stack_data *stack, int pushval)
{ {
S_DATA(stack, S_LEN(stack)++) = pushval; S_DATA(stack, S_LEN(stack)++) = pushval;
} }
int top(struct stack_data *stack) int top(struct stack_data *stack)
{ {
if (S_LEN(stack) > 0) if (S_LEN(stack) > 0)
@ -189,7 +180,6 @@ int top(struct stack_data *stack)
return (-1); return (-1);
} }
int pop(struct stack_data *stack) int pop(struct stack_data *stack)
{ {
if (S_LEN(stack) > 0) if (S_LEN(stack) > 0)
@ -200,7 +190,6 @@ int pop(struct stack_data *stack)
} }
} }
void evaluate_operation(struct stack_data *ops, struct stack_data *vals) void evaluate_operation(struct stack_data *ops, struct stack_data *vals)
{ {
int oper; int oper;
@ -219,7 +208,6 @@ void evaluate_operation(struct stack_data *ops, struct stack_data *vals)
} }
} }
int find_oper_num(char token) int find_oper_num(char token)
{ {
int oindex; int oindex;
@ -230,7 +218,6 @@ int find_oper_num(char token)
return (NOTHING); return (NOTHING);
} }
int evaluate_expression(struct obj_data *obj, char *expr) int evaluate_expression(struct obj_data *obj, char *expr)
{ {
struct stack_data ops, vals; struct stack_data ops, vals;
@ -285,7 +272,6 @@ int evaluate_expression(struct obj_data *obj, char *expr)
return (temp); return (temp);
} }
int trade_with(struct obj_data *item, int shop_nr) int trade_with(struct obj_data *item, int shop_nr)
{ {
int counter; int counter;
@ -308,7 +294,6 @@ int trade_with(struct obj_data *item, int shop_nr)
return (OBJECT_NOTOK); return (OBJECT_NOTOK);
} }
int same_obj(struct obj_data *obj1, struct obj_data *obj2) int same_obj(struct obj_data *obj1, struct obj_data *obj2)
{ {
int aindex; int aindex;
@ -333,7 +318,6 @@ int same_obj(struct obj_data *obj1, struct obj_data *obj2)
return (TRUE); return (TRUE);
} }
int shop_producing(struct obj_data *item, int shop_nr) int shop_producing(struct obj_data *item, int shop_nr)
{ {
int counter; int counter;
@ -347,18 +331,16 @@ int shop_producing(struct obj_data *item, int shop_nr)
return (FALSE); return (FALSE);
} }
int transaction_amt(char *arg) int transaction_amt(char *arg)
{ {
char buf[MAX_INPUT_LENGTH]; char buf[MAX_INPUT_LENGTH];
char *buywhat; char *buywhat;
/* /* If we have two arguments, it means 'buy 5 3', or buy 5 of #3.
* If we have two arguments, it means 'buy 5 3', or buy 5 of #3. We don't do that if we only have one argument, like 'buy 5', buy #5.
* We don't do that if we only have one argument, like 'buy 5', buy #5. Code from Andrey Fidrya <andrey@ALEX-UA.COM> */
* Code from Andrey Fidrya <andrey@ALEX-UA.COM>
*/
buywhat = one_argument(arg, buf); buywhat = one_argument(arg, buf);
if (*buywhat && *buf && is_number(buf)) { if (*buywhat && *buf && is_number(buf)) {
strcpy(arg, arg + strlen(buf) + 1); /* strcpy: OK (always smaller) */ strcpy(arg, arg + strlen(buf) + 1); /* strcpy: OK (always smaller) */
@ -367,7 +349,6 @@ int transaction_amt(char *arg)
return (1); return (1);
} }
char *times_message(struct obj_data *obj, char *name, int num) char *times_message(struct obj_data *obj, char *name, int num)
{ {
static char buf[256]; static char buf[256];
@ -390,9 +371,7 @@ char *times_message(struct obj_data *obj, char *name, int num)
return (buf); return (buf);
} }
struct obj_data *get_slide_obj_vis(struct char_data *ch, char *name, struct obj_data *list)
struct obj_data *get_slide_obj_vis(struct char_data *ch, char *name,
struct obj_data *list)
{ {
struct obj_data *i, *last_match = NULL; struct obj_data *i, *last_match = NULL;
int j, number; int j, number;
@ -415,9 +394,7 @@ struct obj_data *get_slide_obj_vis(struct char_data *ch, char *name,
return (NULL); return (NULL);
} }
struct obj_data *get_hash_obj_vis(struct char_data *ch, char *name, struct obj_data *list)
struct obj_data *get_hash_obj_vis(struct char_data *ch, char *name,
struct obj_data *list)
{ {
struct obj_data *loop, *last_obj = NULL; struct obj_data *loop, *last_obj = NULL;
int qindex; int qindex;
@ -439,9 +416,7 @@ struct obj_data *get_hash_obj_vis(struct char_data *ch, char *name,
return (NULL); return (NULL);
} }
struct obj_data *get_purchase_obj(struct char_data *ch, char *arg, struct char_data *keeper, int shop_nr, int msg)
struct obj_data *get_purchase_obj(struct char_data *ch, char *arg,
struct char_data *keeper, int shop_nr, int msg)
{ {
char name[MAX_INPUT_LENGTH]; char name[MAX_INPUT_LENGTH];
struct obj_data *obj; struct obj_data *obj;
@ -469,38 +444,30 @@ struct obj_data *get_purchase_obj(struct char_data *ch, char *arg,
return (obj); return (obj);
} }
/* Shop purchase adjustment, based on charisma-difference from buyer to keeper.
/* for i in `seq 15 -15`; do printf " * %3d: %6.4f\n" $i \
* Shop purchase adjustment, based on charisma-difference from buyer to keeper. `echo "scale=4; 1+$i/70" | bc`; done
* Shopkeeper higher charisma (markup)
* for i in `seq 15 -15`; do printf " * %3d: %6.4f\n" $i \ ^ 15: 1.2142 14: 1.2000 13: 1.1857 12: 1.1714 11: 1.1571
* `echo "scale=4; 1+$i/70" | bc`; done | 10: 1.1428 9: 1.1285 8: 1.1142 7: 1.1000 6: 1.0857
* | 5: 1.0714 4: 1.0571 3: 1.0428 2: 1.0285 1: 1.0142
* Shopkeeper higher charisma (markup) + 0: 1.0000
* ^ 15: 1.2142 14: 1.2000 13: 1.1857 12: 1.1714 11: 1.1571 | -1: 0.9858 -2: 0.9715 -3: 0.9572 -4: 0.9429 -5: 0.9286
* | 10: 1.1428 9: 1.1285 8: 1.1142 7: 1.1000 6: 1.0857 | -6: 0.9143 -7: 0.9000 -8: 0.8858 -9: 0.8715 -10: 0.8572
* | 5: 1.0714 4: 1.0571 3: 1.0428 2: 1.0285 1: 1.0142 v -11: 0.8429 -12: 0.8286 -13: 0.8143 -14: 0.8000 -15: 0.7858
* + 0: 1.0000 Player higher charisma (discount)
* | -1: 0.9858 -2: 0.9715 -3: 0.9572 -4: 0.9429 -5: 0.9286 Most mobiles have 11 charisma so an 18 charisma player would get a 10%
* | -6: 0.9143 -7: 0.9000 -8: 0.8858 -9: 0.8715 -10: 0.8572 discount beyond the basic price. That assumes they put a lot of points
* v -11: 0.8429 -12: 0.8286 -13: 0.8143 -14: 0.8000 -15: 0.7858 into charisma, because on the flip side they'd get 11% inflation by
* Player higher charisma (discount) having a 3. */
*
* Most mobiles have 11 charisma so an 18 charisma player would get a 10%
* discount beyond the basic price. That assumes they put a lot of points
* into charisma, because on the flip side they'd get 11% inflation by
* having a 3.
*/
int buy_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *buyer) int buy_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *buyer)
{ {
return (int) (GET_OBJ_COST(obj) * SHOP_BUYPROFIT(shop_nr) return (int) (GET_OBJ_COST(obj) * SHOP_BUYPROFIT(shop_nr)
* (1 + (GET_CHA(keeper) - GET_CHA(buyer)) / (float)70)); * (1 + (GET_CHA(keeper) - GET_CHA(buyer)) / (float)70));
} }
/* /* When the shopkeeper is buying, we reverse the discount. Also make sure
* When the shopkeeper is buying, we reverse the discount. Also make sure we don't buy for more than we sell for, to prevent infinite money-making. */
* we don't buy for more than we sell for, to prevent infinite money-making.
*/
int sell_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *seller) int sell_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, struct char_data *seller)
{ {
float sell_cost_modifier = SHOP_SELLPROFIT(shop_nr) * (1 - (GET_CHA(keeper) - GET_CHA(seller)) / (float)70); float sell_cost_modifier = SHOP_SELLPROFIT(shop_nr) * (1 - (GET_CHA(keeper) - GET_CHA(seller)) / (float)70);
@ -512,7 +479,6 @@ int sell_price(struct obj_data *obj, int shop_nr, struct char_data *keeper, stru
return (int) (GET_OBJ_COST(obj) * sell_cost_modifier); return (int) (GET_OBJ_COST(obj) * sell_cost_modifier);
} }
void shopping_buy(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr) void shopping_buy(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr)
{ {
char tempstr[MAX_INPUT_LENGTH], tempbuf[MAX_INPUT_LENGTH]; char tempstr[MAX_INPUT_LENGTH], tempbuf[MAX_INPUT_LENGTH];
@ -629,7 +595,6 @@ void shopping_buy(char *arg, struct char_data *ch, struct char_data *keeper, int
} }
} }
struct obj_data *get_selling_obj(struct char_data *ch, char *name, struct char_data *keeper, int shop_nr, int msg) struct obj_data *get_selling_obj(struct char_data *ch, char *name, struct char_data *keeper, int shop_nr, int msg)
{ {
char buf[MAX_INPUT_LENGTH]; char buf[MAX_INPUT_LENGTH];
@ -670,17 +635,13 @@ struct obj_data *get_selling_obj(struct char_data *ch, char *name, struct char_d
return (NULL); return (NULL);
} }
/* This function is a slight hack! To make sure that duplicate items are
struct obj_data *slide_obj(struct obj_data *obj, struct char_data *keeper, * only listed once on the "list", this function groups "identical"
int shop_nr) * objects together on the shopkeeper's inventory list. The hack involves
/* * knowing how the list is put together, and manipulating the order of
This function is a slight hack! To make sure that duplicate items are * the objects on the list. (But since most of DIKU is not encapsulated,
only listed once on the "list", this function groups "identical" * and information hiding is almost never used, it isn't that big a deal) -JF */
objects together on the shopkeeper's inventory list. The hack involves struct obj_data *slide_obj(struct obj_data *obj, struct char_data *keeper, int shop_nr)
knowing how the list is put together, and manipulating the order of
the objects on the list. (But since most of DIKU is not encapsulated,
and information hiding is almost never used, it isn't that big a deal) -JF
*/
{ {
struct obj_data *loop; struct obj_data *loop;
int temp; int temp;
@ -710,7 +671,6 @@ struct obj_data *slide_obj(struct obj_data *obj, struct char_data *keeper,
return (obj); return (obj);
} }
void sort_keeper_objs(struct char_data *keeper, int shop_nr) void sort_keeper_objs(struct char_data *keeper, int shop_nr)
{ {
struct obj_data *list = NULL, *temp; struct obj_data *list = NULL, *temp;
@ -734,7 +694,6 @@ void sort_keeper_objs(struct char_data *keeper, int shop_nr)
} }
} }
void shopping_sell(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr) void shopping_sell(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr)
{ {
char tempstr[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH], tempbuf[MAX_INPUT_LENGTH]; char tempstr[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH], tempbuf[MAX_INPUT_LENGTH];
@ -812,7 +771,6 @@ void shopping_sell(char *arg, struct char_data *ch, struct char_data *keeper, in
} }
} }
void shopping_value(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr) void shopping_value(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr)
{ {
char buf[MAX_STRING_LENGTH], name[MAX_INPUT_LENGTH]; char buf[MAX_STRING_LENGTH], name[MAX_INPUT_LENGTH];
@ -834,7 +792,6 @@ void shopping_value(char *arg, struct char_data *ch, struct char_data *keeper, i
do_tell(keeper, buf, cmd_tell, 0); do_tell(keeper, buf, cmd_tell, 0);
} }
char *list_object(struct obj_data *obj, int cnt, int aindex, int shop_nr, struct char_data *keeper, struct char_data *ch) char *list_object(struct obj_data *obj, int cnt, int aindex, int shop_nr, struct char_data *keeper, struct char_data *ch)
{ {
static char result[256]; static char result[256];
@ -866,12 +823,12 @@ char *list_object(struct obj_data *obj, int cnt, int aindex, int shop_nr, struct
} }
CAP(itemname); CAP(itemname);
snprintf(result, sizeof(result), " %2d) %9s %-48s %6d\r\n", snprintf(result, sizeof(result), " %2d) %9s %-*s %6d\r\n", aindex, quantity,
aindex, quantity, itemname, buy_price(obj, shop_nr, keeper, ch)); 48 - count_color_chars(itemname), itemname, buy_price(obj, shop_nr, keeper, ch));
return (result); return (result);
} }
void shopping_list(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr) void shopping_list(char *arg, struct char_data *ch, struct char_data *keeper, int shop_nr)
{ {
char buf[MAX_STRING_LENGTH], name[MAX_INPUT_LENGTH]; char buf[MAX_STRING_LENGTH], name[MAX_INPUT_LENGTH];
@ -924,7 +881,6 @@ void shopping_list(char *arg, struct char_data *ch, struct char_data *keeper, in
} }
} }
int ok_shop_room(int shop_nr, room_vnum room) int ok_shop_room(int shop_nr, room_vnum room)
{ {
int mindex; int mindex;
@ -935,7 +891,6 @@ int ok_shop_room(int shop_nr, room_vnum room)
return (FALSE); return (FALSE);
} }
SPECIAL(shop_keeper) SPECIAL(shop_keeper)
{ {
struct char_data *keeper = (struct char_data *)me; struct char_data *keeper = (struct char_data *)me;
@ -989,7 +944,6 @@ SPECIAL(shop_keeper)
return (FALSE); return (FALSE);
} }
int ok_damage_shopkeeper(struct char_data *ch, struct char_data *victim) int ok_damage_shopkeeper(struct char_data *ch, struct char_data *victim)
{ {
int sindex; int sindex;
@ -1015,7 +969,6 @@ int ok_damage_shopkeeper(struct char_data *ch, struct char_data *victim)
return (TRUE); return (TRUE);
} }
/* val == obj_vnum and obj_rnum (?) */ /* val == obj_vnum and obj_rnum (?) */
int add_to_list(struct shop_buy_data *list, int type, int *len, int *val) int add_to_list(struct shop_buy_data *list, int type, int *len, int *val)
{ {
@ -1035,7 +988,6 @@ int add_to_list(struct shop_buy_data *list, int type, int *len, int *val)
return (FALSE); return (FALSE);
} }
int end_read_list(struct shop_buy_data *list, int len, int error) int end_read_list(struct shop_buy_data *list, int len, int error)
{ {
if (error) if (error)
@ -1045,7 +997,6 @@ int end_read_list(struct shop_buy_data *list, int len, int error)
return (len); return (len);
} }
void read_line(FILE *shop_f, const char *string, void *data) void read_line(FILE *shop_f, const char *string, void *data)
{ {
char buf[READ_SIZE]; char buf[READ_SIZE];
@ -1056,7 +1007,6 @@ void read_line(FILE *shop_f, const char *string, void *data)
} }
} }
int read_list(FILE *shop_f, struct shop_buy_data *list, int new_format, int read_list(FILE *shop_f, struct shop_buy_data *list, int new_format,
int max, int type) int max, int type)
{ {
@ -1077,7 +1027,6 @@ int read_list(FILE *shop_f, struct shop_buy_data *list, int new_format,
return (end_read_list(list, len, error)); return (end_read_list(list, len, error));
} }
/* END_OF inefficient. */ /* END_OF inefficient. */
int read_type_list(FILE *shop_f, struct shop_buy_data *list, int read_type_list(FILE *shop_f, struct shop_buy_data *list,
int new_format, int max) int new_format, int max)
@ -1125,7 +1074,6 @@ int read_type_list(FILE *shop_f, struct shop_buy_data *list,
return (end_read_list(list, len, error)); return (end_read_list(list, len, error));
} }
char *read_shop_message(int mnum, room_vnum shr, FILE *shop_f, const char *why) char *read_shop_message(int mnum, room_vnum shr, FILE *shop_f, const char *why)
{ {
int cht, ss = 0, ds = 0, err = 0; int cht, ss = 0, ds = 0, err = 0;
@ -1164,7 +1112,6 @@ char *read_shop_message(int mnum, room_vnum shr, FILE *shop_f, const char *why)
return (tbuf); return (tbuf);
} }
void boot_the_shops(FILE *shop_f, char *filename, int rec_count) void boot_the_shops(FILE *shop_f, char *filename, int rec_count)
{ {
char *buf, buf2[256]; char *buf, buf2[256];
@ -1236,7 +1183,6 @@ void boot_the_shops(FILE *shop_f, char *filename, int rec_count)
} }
} }
void assign_the_shopkeepers(void) void assign_the_shopkeepers(void)
{ {
int cindex; int cindex;
@ -1266,7 +1212,6 @@ void assign_the_shopkeepers(void)
} }
} }
char *customer_string(int shop_nr, int detailed) char *customer_string(int shop_nr, int detailed)
{ {
int sindex = 0, flag = 1, nlen; int sindex = 0, flag = 1, nlen;
@ -1299,7 +1244,6 @@ char *customer_string(int shop_nr, int detailed)
return (buf); return (buf);
} }
/* END_OF inefficient */ /* END_OF inefficient */
void list_all_shops(struct char_data *ch) void list_all_shops(struct char_data *ch)
{ {
@ -1339,7 +1283,6 @@ void list_all_shops(struct char_data *ch)
page_string(ch->desc, buf, TRUE); page_string(ch->desc, buf, TRUE);
} }
void list_detailed_shop(struct char_data *ch, int shop_nr) void list_detailed_shop(struct char_data *ch, int shop_nr)
{ {
struct char_data *k; struct char_data *k;
@ -1348,7 +1291,6 @@ void list_detailed_shop(struct char_data *ch, int shop_nr)
send_to_char(ch, "Vnum: [%5d], Rnum: [%5d]\r\n", SHOP_NUM(shop_nr), shop_nr + 1); send_to_char(ch, "Vnum: [%5d], Rnum: [%5d]\r\n", SHOP_NUM(shop_nr), shop_nr + 1);
send_to_char(ch, "Rooms: "); send_to_char(ch, "Rooms: ");
column = 12; /* ^^^ strlen ^^^ */ column = 12; /* ^^^ strlen ^^^ */
for (sindex = 0; SHOP_ROOM(shop_nr, sindex) != NOWHERE; sindex++) { for (sindex = 0; SHOP_ROOM(shop_nr, sindex) != NOWHERE; sindex++) {
@ -1392,10 +1334,8 @@ void list_detailed_shop(struct char_data *ch, int shop_nr)
} else } else
send_to_char(ch, "<NONE>\r\n"); send_to_char(ch, "<NONE>\r\n");
send_to_char(ch, "Customers: %s\r\n", (ptrsave = customer_string(shop_nr, TRUE)) ? ptrsave : "None"); send_to_char(ch, "Customers: %s\r\n", (ptrsave = customer_string(shop_nr, TRUE)) ? ptrsave : "None");
send_to_char(ch, "Produces: "); send_to_char(ch, "Produces: ");
column = 12; /* ^^^ strlen ^^^ */ column = 12; /* ^^^ strlen ^^^ */
for (sindex = 0; SHOP_PRODUCT(shop_nr, sindex) != NOTHING; sindex++) { for (sindex = 0; SHOP_PRODUCT(shop_nr, sindex) != NOTHING; sindex++) {
@ -1458,7 +1398,6 @@ void list_detailed_shop(struct char_data *ch, int shop_nr)
SHOP_SELLPROFIT(shop_nr), SHOP_BUYPROFIT(shop_nr), SHOP_OPEN1(shop_nr), SHOP_SELLPROFIT(shop_nr), SHOP_BUYPROFIT(shop_nr), SHOP_OPEN1(shop_nr),
SHOP_CLOSE1(shop_nr), SHOP_OPEN2(shop_nr), SHOP_CLOSE2(shop_nr)); SHOP_CLOSE1(shop_nr), SHOP_OPEN2(shop_nr), SHOP_CLOSE2(shop_nr));
/* Need a local buffer. */ /* Need a local buffer. */
{ {
char buf1[128]; char buf1[128];
@ -1467,7 +1406,6 @@ void list_detailed_shop(struct char_data *ch, int shop_nr)
} }
} }
void show_shops(struct char_data *ch, char *arg) void show_shops(struct char_data *ch, char *arg)
{ {
int shop_nr; int shop_nr;
@ -1497,7 +1435,6 @@ void show_shops(struct char_data *ch, char *arg)
} }
} }
void destroy_shops(void) void destroy_shops(void)
{ {
ssize_t cnt, itr; ssize_t cnt, itr;
@ -1538,7 +1475,6 @@ void destroy_shops(void)
top_shop = -1; top_shop = -1;
} }
int find_shop(int vnum) int find_shop(int vnum)
{ {
int bot, mid, top; int bot, mid, top;

View file

@ -228,7 +228,7 @@ ASPELL(spell_charm)
else if (!CONFIG_PK_ALLOWED && !IS_NPC(victim)) else if (!CONFIG_PK_ALLOWED && !IS_NPC(victim))
send_to_char(ch, "You fail - shouldn't be doing it anyway.\r\n"); send_to_char(ch, "You fail - shouldn't be doing it anyway.\r\n");
else if (circle_follow(victim, ch)) else if (circle_follow(victim, ch))
send_to_char(ch, "Sorry, following in circles can not be allowed.\r\n"); send_to_char(ch, "Sorry, following in circles is not allowed.\r\n");
else if (mag_savingthrow(victim, SAVING_PARA, 0)) else if (mag_savingthrow(victim, SAVING_PARA, 0))
send_to_char(ch, "Your victim resists!\r\n"); send_to_char(ch, "Your victim resists!\r\n");
else { else {

View file

@ -1,41 +1,29 @@
/* ************************************************************************ /* ************************************************************************
* File: structs.h Part of CircleMUD * * File: structs.h Part of CircleMUD *
* Usage: header file for central structures and contstants * * Usage: header file for central structures and contstants *
* *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license.doc for complete information. *
* * * *
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University * * Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */ ************************************************************************ */
/* /* Intended use of this macro is to allow external packages to work with a
* Intended use of this macro is to allow external packages to work with * variety of CircleMUD versions without modifications. For instance, an
* a variety of CircleMUD versions without modifications. For instance, * IS_CORPSE() macro was introduced in pl13. Any future code add-ons could
* an IS_CORPSE() macro was introduced in pl13. Any future code add-ons * take into account the CircleMUD version and supply their own definition for
* could take into account the CircleMUD version and supply their own * the macro if used on an older version of CircleMUD. You are supposed to
* definition for the macro if used on an older version of CircleMUD. * compare this with the macro CIRCLEMUD_VERSION() in utils.h. */
* You are supposed to compare this with the macro CIRCLEMUD_VERSION()
* in utils.h. See there for usage.
*/
#define _CIRCLEMUD 0x030520 /* Major/Minor/Patchlevel - MMmmPP */ #define _CIRCLEMUD 0x030520 /* Major/Minor/Patchlevel - MMmmPP */
/* /* If you want equipment to be automatically equipped to the same place
* If you want equipment to be automatically equipped to the same place * it was when players rented, set the define below to 1. */
* it was when players rented, set the define below to 1.
*/
#define USE_AUTOEQ 1 /* TRUE/FALSE aren't defined yet. */ #define USE_AUTOEQ 1 /* TRUE/FALSE aren't defined yet. */
/* preamble */
/* preamble *************************************************************/ /* As of bpl20, it should be safe to use unsigned data types for the various
* virtual and real number data types. There really isn't a reason to use
/* * signed anymore so use the unsigned types and get 65,535 objects instead of
* As of bpl20, it should be safe to use unsigned data types for the * 32,768. NOTE: This will likely be unconditionally unsigned later. */
* various virtual and real number data types. There really isn't a
* reason to use signed anymore so use the unsigned types and get
* 65,535 objects instead of 32,768.
*
* NOTE: This will likely be unconditionally unsigned later.
*/
#define CIRCLE_UNSIGNED_INDEX 1 /* 0 = signed, 1 = unsigned */ #define CIRCLE_UNSIGNED_INDEX 1 /* 0 = signed, 1 = unsigned */
#if CIRCLE_UNSIGNED_INDEX #if CIRCLE_UNSIGNED_INDEX
@ -53,10 +41,7 @@
#define SPECIAL(name) \ #define SPECIAL(name) \
int (name)(struct char_data *ch, void *me, int cmd, char *argument) int (name)(struct char_data *ch, void *me, int cmd, char *argument)
/* room-related defines */
/* room-related defines *************************************************/
/* The cardinal directions: used as index to room_data.dir_option[] */ /* The cardinal directions: used as index to room_data.dir_option[] */
#define NORTH 0 #define NORTH 0
#define EAST 1 #define EAST 1
@ -65,7 +50,6 @@
#define UP 4 #define UP 4
#define DOWN 5 #define DOWN 5
/* Room flags: used in room_data.room_flags */ /* Room flags: used in room_data.room_flags */
/* WARNING: In the world files, NEVER set the bits marked "R" ("Reserved") */ /* WARNING: In the world files, NEVER set the bits marked "R" ("Reserved") */
#define ROOM_DARK (1 << 0) /* Dark */ #define ROOM_DARK (1 << 0) /* Dark */
@ -85,14 +69,12 @@
#define ROOM_OLC (1 << 14) /* (R) Modifyable/!compress */ #define ROOM_OLC (1 << 14) /* (R) Modifyable/!compress */
#define ROOM_BFS_MARK (1 << 15) /* (R) breath-first srch mrk */ #define ROOM_BFS_MARK (1 << 15) /* (R) breath-first srch mrk */
/* Exit info: used in room_data.dir_option.exit_info */ /* Exit info: used in room_data.dir_option.exit_info */
#define EX_ISDOOR (1 << 0) /* Exit is a door */ #define EX_ISDOOR (1 << 0) /* Exit is a door */
#define EX_CLOSED (1 << 1) /* The door is closed */ #define EX_CLOSED (1 << 1) /* The door is closed */
#define EX_LOCKED (1 << 2) /* The door is locked */ #define EX_LOCKED (1 << 2) /* The door is locked */
#define EX_PICKPROOF (1 << 3) /* Lock can't be picked */ #define EX_PICKPROOF (1 << 3) /* Lock can't be picked */
/* Sector types: used in room_data.sector_type */ /* Sector types: used in room_data.sector_type */
#define SECT_INSIDE 0 /* Indoors */ #define SECT_INSIDE 0 /* Indoors */
#define SECT_CITY 1 /* In a city */ #define SECT_CITY 1 /* In a city */
@ -105,10 +87,7 @@
#define SECT_FLYING 8 /* Wheee! */ #define SECT_FLYING 8 /* Wheee! */
#define SECT_UNDERWATER 9 /* Underwater */ #define SECT_UNDERWATER 9 /* Underwater */
/* char and mob-related defines */
/* char and mob-related defines *****************************************/
/* PC classes */ /* PC classes */
#define CLASS_UNDEFINED (-1) #define CLASS_UNDEFINED (-1)
#define CLASS_MAGIC_USER 0 #define CLASS_MAGIC_USER 0
@ -126,13 +105,11 @@
#define CLASS_DRAGON 4 #define CLASS_DRAGON 4
#define CLASS_GIANT 5 #define CLASS_GIANT 5
/* Sex */ /* Sex */
#define SEX_NEUTRAL 0 #define SEX_NEUTRAL 0
#define SEX_MALE 1 #define SEX_MALE 1
#define SEX_FEMALE 2 #define SEX_FEMALE 2
/* Positions */ /* Positions */
#define POS_DEAD 0 /* dead */ #define POS_DEAD 0 /* dead */
#define POS_MORTALLYW 1 /* mortally wounded */ #define POS_MORTALLYW 1 /* mortally wounded */
@ -144,7 +121,6 @@
#define POS_FIGHTING 7 /* fighting */ #define POS_FIGHTING 7 /* fighting */
#define POS_STANDING 8 /* standing */ #define POS_STANDING 8 /* standing */
/* Player flags: used by char_data.char_specials.act */ /* Player flags: used by char_data.char_specials.act */
#define PLR_KILLER (1 << 0) /* Player is a player-killer */ #define PLR_KILLER (1 << 0) /* Player is a player-killer */
#define PLR_THIEF (1 << 1) /* Player is a player-thief */ #define PLR_THIEF (1 << 1) /* Player is a player-thief */
@ -164,7 +140,6 @@
#define PLR_CRYO (1 << 15) /* Player is cryo-saved (purge prog) */ #define PLR_CRYO (1 << 15) /* Player is cryo-saved (purge prog) */
#define PLR_NOTDEADYET (1 << 16) /* (R) Player being extracted. */ #define PLR_NOTDEADYET (1 << 16) /* (R) Player being extracted. */
/* Mobile flags: used by char_data.char_specials.act */ /* Mobile flags: used by char_data.char_specials.act */
#define MOB_SPEC (1 << 0) /* Mob has a callable spec-proc */ #define MOB_SPEC (1 << 0) /* Mob has a callable spec-proc */
#define MOB_SENTINEL (1 << 1) /* Mob should not move */ #define MOB_SENTINEL (1 << 1) /* Mob should not move */
@ -186,7 +161,6 @@
#define MOB_NOBLIND (1 << 17) /* Mob can't be blinded */ #define MOB_NOBLIND (1 << 17) /* Mob can't be blinded */
#define MOB_NOTDEADYET (1 << 18) /* (R) Mob being extracted. */ #define MOB_NOTDEADYET (1 << 18) /* (R) Mob being extracted. */
/* Preference flags: used by char_data.player_specials.pref */ /* Preference flags: used by char_data.player_specials.pref */
#define PRF_BRIEF (1 << 0) /* Room descs won't normally be shown */ #define PRF_BRIEF (1 << 0) /* Room descs won't normally be shown */
#define PRF_COMPACT (1 << 1) /* No extra CRLF pair before prompts */ #define PRF_COMPACT (1 << 1) /* No extra CRLF pair before prompts */
@ -245,7 +219,6 @@
#define AFF_UNUSED20 (1 << 20) /* Room for future expansion */ #define AFF_UNUSED20 (1 << 20) /* Room for future expansion */
#define AFF_CHARM (1 << 21) /* Char is charmed */ #define AFF_CHARM (1 << 21) /* Char is charmed */
/* Modes of connectedness: used by descriptor_data.state */ /* Modes of connectedness: used by descriptor_data.state */
#define CON_PLAYING 0 /* Playing - Nominal state */ #define CON_PLAYING 0 /* Playing - Nominal state */
#define CON_CLOSE 1 /* User disconnect, remove character. */ #define CON_CLOSE 1 /* User disconnect, remove character. */
@ -300,10 +273,7 @@
#define NUM_WEARS 18 /* This must be the # of eq positions!! */ #define NUM_WEARS 18 /* This must be the # of eq positions!! */
/* object-related defines */
/* object-related defines ********************************************/
/* Item types: used by obj_data.obj_flags.type_flag */ /* Item types: used by obj_data.obj_flags.type_flag */
#define ITEM_LIGHT 1 /* Item is a light source */ #define ITEM_LIGHT 1 /* Item is a light source */
#define ITEM_SCROLL 2 /* Item is a scroll */ #define ITEM_SCROLL 2 /* Item is a scroll */
@ -329,7 +299,6 @@
#define ITEM_BOAT 22 /* Item is a boat */ #define ITEM_BOAT 22 /* Item is a boat */
#define ITEM_FOUNTAIN 23 /* Item is a fountain */ #define ITEM_FOUNTAIN 23 /* Item is a fountain */
/* Take/Wear flags: used by obj_data.obj_flags.wear_flags */ /* Take/Wear flags: used by obj_data.obj_flags.wear_flags */
#define ITEM_WEAR_TAKE (1 << 0) /* Item can be taken */ #define ITEM_WEAR_TAKE (1 << 0) /* Item can be taken */
#define ITEM_WEAR_FINGER (1 << 1) /* Can be worn on finger */ #define ITEM_WEAR_FINGER (1 << 1) /* Can be worn on finger */
@ -347,7 +316,6 @@
#define ITEM_WEAR_WIELD (1 << 13) /* Can be wielded */ #define ITEM_WEAR_WIELD (1 << 13) /* Can be wielded */
#define ITEM_WEAR_HOLD (1 << 14) /* Can be held */ #define ITEM_WEAR_HOLD (1 << 14) /* Can be held */
/* Extra object flags: used by obj_data.obj_flags.extra_flags */ /* Extra object flags: used by obj_data.obj_flags.extra_flags */
#define ITEM_GLOW (1 << 0) /* Item is glowing */ #define ITEM_GLOW (1 << 0) /* Item is glowing */
#define ITEM_HUM (1 << 1) /* Item is humming */ #define ITEM_HUM (1 << 1) /* Item is humming */
@ -367,7 +335,6 @@
#define ITEM_ANTI_WARRIOR (1 << 15) /* Not usable by warriors */ #define ITEM_ANTI_WARRIOR (1 << 15) /* Not usable by warriors */
#define ITEM_NOSELL (1 << 16) /* Shopkeepers won't touch it */ #define ITEM_NOSELL (1 << 16) /* Shopkeepers won't touch it */
/* Modifier constants used with obj affects ('A' fields) */ /* Modifier constants used with obj affects ('A' fields) */
#define APPLY_NONE 0 /* No effect */ #define APPLY_NONE 0 /* No effect */
#define APPLY_STR 1 /* Apply to strength */ #define APPLY_STR 1 /* Apply to strength */
@ -395,14 +362,12 @@
#define APPLY_SAVING_BREATH 23 /* Apply to save throw: breath */ #define APPLY_SAVING_BREATH 23 /* Apply to save throw: breath */
#define APPLY_SAVING_SPELL 24 /* Apply to save throw: spells */ #define APPLY_SAVING_SPELL 24 /* Apply to save throw: spells */
/* Container flags - value[1] */ /* Container flags - value[1] */
#define CONT_CLOSEABLE (1 << 0) /* Container can be closed */ #define CONT_CLOSEABLE (1 << 0) /* Container can be closed */
#define CONT_PICKPROOF (1 << 1) /* Container is pickproof */ #define CONT_PICKPROOF (1 << 1) /* Container is pickproof */
#define CONT_CLOSED (1 << 2) /* Container is closed */ #define CONT_CLOSED (1 << 2) /* Container is closed */
#define CONT_LOCKED (1 << 3) /* Container is locked */ #define CONT_LOCKED (1 << 3) /* Container is locked */
/* Some different kind of liquids for use in values of drink containers */ /* Some different kind of liquids for use in values of drink containers */
#define LIQ_WATER 0 #define LIQ_WATER 0
#define LIQ_BEER 1 #define LIQ_BEER 1
@ -421,30 +386,24 @@
#define LIQ_SALTWATER 14 #define LIQ_SALTWATER 14
#define LIQ_CLEARWATER 15 #define LIQ_CLEARWATER 15
/* other miscellaneous defines */
/* other miscellaneous defines *******************************************/
/* Player conditions */ /* Player conditions */
#define DRUNK 0 #define DRUNK 0
#define HUNGER 1 #define HUNGER 1
#define THIRST 2 #define THIRST 2
/* Sun state for weather_data */ /* Sun state for weather_data */
#define SUN_DARK 0 #define SUN_DARK 0
#define SUN_RISE 1 #define SUN_RISE 1
#define SUN_LIGHT 2 #define SUN_LIGHT 2
#define SUN_SET 3 #define SUN_SET 3
/* Sky conditions for weather_data */ /* Sky conditions for weather_data */
#define SKY_CLOUDLESS 0 #define SKY_CLOUDLESS 0
#define SKY_CLOUDY 1 #define SKY_CLOUDY 1
#define SKY_RAINING 2 #define SKY_RAINING 2
#define SKY_LIGHTNING 3 #define SKY_LIGHTNING 3
/* Rent codes */ /* Rent codes */
#define RENT_UNDEF 0 #define RENT_UNDEF 0
#define RENT_CRASH 1 #define RENT_CRASH 1
@ -453,19 +412,14 @@
#define RENT_FORCED 4 #define RENT_FORCED 4
#define RENT_TIMEDOUT 5 #define RENT_TIMEDOUT 5
/* other #defined constants */
/* other #defined constants **********************************************/ /* **DO**NOT** blindly change the number of levels in your MUD merely by
/*
* **DO**NOT** blindly change the number of levels in your MUD merely by
* changing these numbers and without changing the rest of the code to match. * changing these numbers and without changing the rest of the code to match.
* Other changes throughout the code are required. See coding.doc for * Other changes throughout the code are required. See coding.doc for details.
* details.
* *
* LVL_IMPL should always be the HIGHEST possible immortal level, and * LVL_IMPL should always be the HIGHEST possible immortal level, and
* LVL_IMMORT should always be the LOWEST immortal level. The number of * LVL_IMMORT should always be the LOWEST immortal level. The number of
* mortal levels will always be LVL_IMMORT - 1. * mortal levels will always be LVL_IMMORT - 1. */
*/
#define LVL_IMPL 34 #define LVL_IMPL 34
#define LVL_GRGOD 33 #define LVL_GRGOD 33
#define LVL_GOD 32 #define LVL_GOD 32
@ -474,20 +428,15 @@
/* Builders that have access to the saveall command */ /* Builders that have access to the saveall command */
#define LVL_BUILDER LVL_IMMORT #define LVL_BUILDER LVL_IMMORT
/* Level of the 'freeze' command */
#define LVL_FREEZE LVL_GRGOD
#define NUM_OF_DIRS 6 /* number of directions in a room (nsewud) */ #define NUM_OF_DIRS 6 /* number of directions in a room (nsewud) */
#define MAGIC_NUMBER (0x06) /* Arbitrary number that won't be in a string */ #define MAGIC_NUMBER (0x06) /* Arbitrary number that won't be in a string */
/* /* OPT_USEC determines how many commands will be processed by the MUD per
* OPT_USEC determines how many commands will be processed by the MUD per
* second and how frequently it does socket I/O. A low setting will cause * second and how frequently it does socket I/O. A low setting will cause
* actions to be executed more frequently but will increase overhead due to * actions to be executed more frequently but will increase overhead due to
* more cycling to check. A high setting (e.g. 1 Hz) may upset your players * more cycling to check. A high setting (e.g. 1 Hz) may upset your players
* as actions (such as large speedwalking chains) take longer to be executed. * as actions (such as large speedwalking chains) take longer to be executed.
* You shouldn't need to adjust this. * You shouldn't need to adjust this. */
*/
#define OPT_USEC 100000 /* 10 passes per second */ #define OPT_USEC 100000 /* 10 passes per second */
#define PASSES_PER_SEC (1000000 / OPT_USEC) #define PASSES_PER_SEC (1000000 / OPT_USEC)
#define RL_SEC * PASSES_PER_SEC #define RL_SEC * PASSES_PER_SEC
@ -532,10 +481,7 @@
/* define the largest set of commands for a trigger */ /* define the largest set of commands for a trigger */
#define MAX_CMD_LENGTH 16384 /* 16k should be plenty and then some */ #define MAX_CMD_LENGTH 16384 /* 16k should be plenty and then some */
/********************************************************************** /* Structures */
* Structures *
**********************************************************************/
typedef signed char sbyte; typedef signed char sbyte;
typedef unsigned char ubyte; typedef unsigned char ubyte;
typedef signed short int sh_int; typedef signed short int sh_int;
@ -564,15 +510,10 @@ typedef IDXTYPE zone_rnum;
typedef IDXTYPE shop_rnum; typedef IDXTYPE shop_rnum;
typedef IDXTYPE trig_rnum; typedef IDXTYPE trig_rnum;
/* Bitvector type for 32 bit unsigned long bitvectors. 'unsigned long long'
/* * will give you at least 64 bits if you have GCC. You'll have to search
* Bitvector type for 32 bit unsigned long bitvectors. * throughout the code for "bitvector_t" and change them yourself if you'd
* 'unsigned long long' will give you at least 64 bits if you have GCC. * like this extra flexibility. */
*
* Since we don't want to break the pfiles, you'll have to search throughout
* the code for "bitvector_t" and change them yourself if you'd like this
* extra flexibility.
*/
typedef unsigned long int bitvector_t; typedef unsigned long int bitvector_t;
/* Extra description: used in objects, mobiles, and rooms */ /* Extra description: used in objects, mobiles, and rooms */
@ -582,9 +523,7 @@ struct extra_descr_data {
struct extra_descr_data *next; /* Next in list */ struct extra_descr_data *next; /* Next in list */
}; };
/* object-related structures */
/* object-related structures ******************************************/
#define NUM_OBJ_VAL_POSITIONS 4 #define NUM_OBJ_VAL_POSITIONS 4
/* object flags; used in obj_data */ /* object flags; used in obj_data */
struct obj_flag_data { struct obj_flag_data {
@ -600,15 +539,13 @@ struct obj_flag_data {
long /*bitvector_t*/ bitvector; /* To set chars bits */ long /*bitvector_t*/ bitvector; /* To set chars bits */
}; };
/* Used in obj_file_elem *DO*NOT*CHANGE* */ /* Used in obj_file_elem *DO*NOT*CHANGE* */
struct obj_affected_type { struct obj_affected_type {
byte location; /* Which ability to change (APPLY_XXX) */ byte location; /* Which ability to change (APPLY_XXX) */
sbyte modifier; /* How much it changes by */ sbyte modifier; /* How much it changes by */
}; };
/* Memory Structure for Objects */
/* ================== Memory Structure for Objects ================== */
struct obj_data { struct obj_data {
obj_rnum item_number; /* Where in data-base */ obj_rnum item_number; /* Where in data-base */
room_rnum in_room; /* In what room -1 when conta/carr */ room_rnum in_room; /* In what room -1 when conta/carr */
@ -635,11 +572,8 @@ struct obj_data {
struct obj_data *next_content; /* For 'contains' lists */ struct obj_data *next_content; /* For 'contains' lists */
struct obj_data *next; /* For the object list */ struct obj_data *next; /* For the object list */
}; };
/* ======================================================================= */
/* File Element for Objects BEWARE: Changing it will ruin rent files */
/* ====================== File Element for Objects ======================= */
/* BEWARE: Changing it will ruin rent files */
struct obj_file_elem { struct obj_file_elem {
obj_vnum item_number; obj_vnum item_number;
@ -654,7 +588,6 @@ struct obj_file_elem {
struct obj_affected_type affected[MAX_OBJ_AFFECT]; struct obj_affected_type affected[MAX_OBJ_AFFECT];
}; };
/* header block for rent files. BEWARE: Changing it will ruin rent files */ /* header block for rent files. BEWARE: Changing it will ruin rent files */
struct rent_info { struct rent_info {
int time; int time;
@ -672,12 +605,8 @@ struct rent_info {
int spare6; int spare6;
int spare7; int spare7;
}; };
/* ======================================================================= */
/* room-related structures ************************************************/
/* room-related structures */
struct room_direction_data { struct room_direction_data {
char *general_description; /* When look DIR. */ char *general_description; /* When look DIR. */
@ -688,8 +617,7 @@ struct room_direction_data {
room_rnum to_room; /* Where direction leads (NOWHERE) */ room_rnum to_room; /* Where direction leads (NOWHERE) */
}; };
/* Memory Structure for room */
/* ================== Memory Structure for room ======================= */
struct room_data { struct room_data {
room_vnum number; /* Rooms number (vnum) */ room_vnum number; /* Rooms number (vnum) */
zone_rnum zone; /* Room zone (for resetting) */ zone_rnum zone; /* Room zone (for resetting) */
@ -709,12 +637,8 @@ struct room_data {
struct obj_data *contents; /* List of items in room */ struct obj_data *contents; /* List of items in room */
struct char_data *people; /* List of NPC / PC in room */ struct char_data *people; /* List of NPC / PC in room */
}; };
/* ====================================================================== */
/* char-related structures ************************************************/
/* char-related structures */
/* memory structure for characters */ /* memory structure for characters */
struct memory_rec_struct { struct memory_rec_struct {
long id; long id;
@ -723,15 +647,13 @@ struct memory_rec_struct {
typedef struct memory_rec_struct memory_rec; typedef struct memory_rec_struct memory_rec;
/* This structure is purely intended to be an easy way to transfer and return
/* This structure is purely intended to be an easy way to transfer */ * information about time (real or mudwise). */
/* and return information about time (real or mudwise). */
struct time_info_data { struct time_info_data {
int hours, day, month; int hours, day, month;
sh_int year; sh_int year;
}; };
/* These data contain information about a players time data */ /* These data contain information about a players time data */
struct time_data { struct time_data {
time_t birth; /* This represents the characters age */ time_t birth; /* This represents the characters age */
@ -739,10 +661,9 @@ struct time_data {
int played; /* This is the total accumulated time played in secs */ int played; /* This is the total accumulated time played in secs */
}; };
/* The pclean_criteria_data is set up in config.c and used in db.c to /* The pclean_criteria_data is set up in config.c and used in db.c to determine
determine the conditions which will cause a player character to be * the conditions which will cause a player character to be deleted from disk
deleted from disk if the automagic pwipe system is enabled (see config.c). * if the automagic pwipe system is enabled (see config.c). */
*/
struct pclean_criteria_data { struct pclean_criteria_data {
int level; /* max level for this time limit */ int level; /* max level for this time limit */
int days; /* time limit in days */ int days; /* time limit in days */
@ -765,7 +686,6 @@ struct char_player_data {
ubyte height; /* PC / NPC's height */ ubyte height; /* PC / NPC's height */
}; };
/* Char's abilities. */ /* Char's abilities. */
struct char_ability_data { struct char_ability_data {
sbyte str; sbyte str;
@ -777,7 +697,6 @@ struct char_ability_data {
sbyte cha; sbyte cha;
}; };
/* Char's points. */ /* Char's points. */
struct char_point_data { struct char_point_data {
sh_int mana; sh_int mana;
@ -796,11 +715,8 @@ struct char_point_data {
sbyte damroll; /* Any bonus or penalty to the damage roll */ sbyte damroll; /* Any bonus or penalty to the damage roll */
}; };
/* char_special_data_saved: specials which both a PC and an NPC have in
/* * common, but which must be saved to the players file for PC's. */
* char_special_data_saved: specials which both a PC and an NPC have in
* common, but which must be saved to the players file for PC's.
*/
struct char_special_data_saved { struct char_special_data_saved {
int alignment; /* +-1000 for alignments */ int alignment; /* +-1000 for alignments */
long idnum; /* player's idnum; -1 for mobiles */ long idnum; /* player's idnum; -1 for mobiles */
@ -811,7 +727,6 @@ struct char_special_data_saved {
sh_int apply_saving_throw[5]; /* Saving throw (Bonuses) */ sh_int apply_saving_throw[5]; /* Saving throw (Bonuses) */
}; };
/* Special playing constants shared by PCs and NPCs which aren't in pfile */ /* Special playing constants shared by PCs and NPCs which aren't in pfile */
struct char_special_data { struct char_special_data {
struct char_data *fighting; /* Opponent */ struct char_data *fighting; /* Opponent */
@ -843,11 +758,9 @@ struct player_special_data_saved {
int olc_zone; int olc_zone;
}; };
/* /* Specials needed only by PCs, not NPCs. Space for this structure is
* Specials needed only by PCs, not NPCs. Space for this structure is
* not allocated in memory for NPCs, but it is for PCs and the portion * not allocated in memory for NPCs, but it is for PCs and the portion
* of it labelled 'saved' is saved in the players file. * of it labelled 'saved' is saved in the players file. */
*/
struct player_special_data { struct player_special_data {
struct player_special_data_saved saved; struct player_special_data_saved saved;
@ -860,7 +773,6 @@ struct player_special_data {
char *host; /* player host */ char *host; /* player host */
}; };
/* Specials used by NPCs, not PCs */ /* Specials used by NPCs, not PCs */
struct mob_special_data { struct mob_special_data {
memory_rec *memory; /* List of attackers to remember */ memory_rec *memory; /* List of attackers to remember */
@ -870,7 +782,6 @@ struct mob_special_data {
byte damsizedice; /* The size of the damage dice's */ byte damsizedice; /* The size of the damage dice's */
}; };
/* An affect structure. */ /* An affect structure. */
struct affected_type { struct affected_type {
sh_int type; /* The type of spell that caused this */ sh_int type; /* The type of spell that caused this */
@ -882,15 +793,13 @@ struct affected_type {
struct affected_type *next; struct affected_type *next;
}; };
/* Structure used for chars following other chars */ /* Structure used for chars following other chars */
struct follow_type { struct follow_type {
struct char_data *follower; struct char_data *follower;
struct follow_type *next; struct follow_type *next;
}; };
/* Structure for player/non-player */
/* ================== Structure for player/non-player ===================== */
struct char_data { struct char_data {
int pfilepos; /* playerfile pos */ int pfilepos; /* playerfile pos */
mob_rnum nr; /* Mob's rnum */ mob_rnum nr; /* Mob's rnum */
@ -926,17 +835,14 @@ struct char_data {
long pref; /* unique session id */ long pref; /* unique session id */
}; };
/* ====================================================================== */
/* descriptor-related structures ******************************************/
/* descriptor-related structures */
struct txt_block { struct txt_block {
char *text; char *text;
int aliased; int aliased;
struct txt_block *next; struct txt_block *next;
}; };
struct txt_q { struct txt_q {
struct txt_block *head; struct txt_block *head;
struct txt_block *tail; struct txt_block *tail;
@ -978,9 +884,7 @@ struct descriptor_data {
struct oasis_olc_data *olc; /* OLC info */ struct oasis_olc_data *olc; /* OLC info */
}; };
/* other miscellaneous structures */
/* other miscellaneous structures ***************************************/
struct msg_type { struct msg_type {
char *attacker_msg; /* message to attacker */ char *attacker_msg; /* message to attacker */
char *victim_msg; /* message to victim */ char *victim_msg; /* message to victim */
@ -1047,14 +951,12 @@ struct dex_skill_type {
sh_int hide; sh_int hide;
}; };
struct dex_app_type { struct dex_app_type {
sh_int reaction; sh_int reaction;
sh_int miss_att; sh_int miss_att;
sh_int defensive; sh_int defensive;
}; };
struct str_app_type { struct str_app_type {
sh_int tohit; /* To Hit (THAC0) Bonus/Penalty */ sh_int tohit; /* To Hit (THAC0) Bonus/Penalty */
sh_int todam; /* Damage Bonus/Penalty */ sh_int todam; /* Damage Bonus/Penalty */
@ -1062,23 +964,19 @@ struct str_app_type {
sh_int wield_w; /* Maximum weight that can be wielded */ sh_int wield_w; /* Maximum weight that can be wielded */
}; };
struct wis_app_type { struct wis_app_type {
byte bonus; /* how many practices player gains per lev */ byte bonus; /* how many practices player gains per lev */
}; };
struct int_app_type { struct int_app_type {
byte learn; /* how many % a player learns a spell/skill */ byte learn; /* how many % a player learns a spell/skill */
}; };
struct con_app_type { struct con_app_type {
sh_int hitp; sh_int hitp;
sh_int shock; sh_int shock;
}; };
struct weather_data { struct weather_data {
int pressure; /* How is the pressure ( Mb ) */ int pressure; /* How is the pressure ( Mb ) */
int change; /* How fast and what way does it change. */ int change; /* How fast and what way does it change. */
@ -1086,12 +984,8 @@ struct weather_data {
int sunlight; /* And how much sun. */ int sunlight; /* And how much sun. */
}; };
/* Element in monster and object index-tables.
/* NOTE: Assumes sizeof(mob_vnum) >= sizeof(obj_vnum) */
* Element in monster and object index-tables.
*
* NOTE: Assumes sizeof(mob_vnum) >= sizeof(obj_vnum)
*/
struct index_data { struct index_data {
mob_vnum vnum; /* virtual number of this mob/obj */ mob_vnum vnum; /* virtual number of this mob/obj */
int number; /* number of existing units of this mob/obj */ int number; /* number of existing units of this mob/obj */
@ -1113,15 +1007,10 @@ struct guild_info_type {
int direction; int direction;
}; };
/* /* Config structs */
* Config structs
*
*/
/* /* The game configuration structure used for configurating the game play
* The game configuration structure used for configurating the game play variables. */
* variables.
*/
struct game_data { struct game_data {
int pk_allowed; /* Is player killing allowed? */ int pk_allowed; /* Is player killing allowed? */
int pt_allowed; /* Is player thieving allowed? */ int pt_allowed; /* Is player thieving allowed? */
@ -1145,11 +1034,7 @@ struct game_data {
char *NOEFFECT; /* 'Nothing seems to happen.' */ char *NOEFFECT; /* 'Nothing seems to happen.' */
}; };
/* The rent and crashsave options. */
/*
* The rent and crashsave options.
*/
struct crash_save_data { struct crash_save_data {
int free_rent; /* Should the MUD allow rent for free? */ int free_rent; /* Should the MUD allow rent for free? */
int max_obj_save; /* Max items players can rent. */ int max_obj_save; /* Max items players can rent. */
@ -1160,10 +1045,7 @@ struct crash_save_data {
int rent_file_timeout; /* Lifetime of normal rent files in days*/ int rent_file_timeout; /* Lifetime of normal rent files in days*/
}; };
/* The room numbers. */
/*
* The room numbers.
*/
struct room_numbers { struct room_numbers {
room_vnum mortal_start_room; /* vnum of room that mortals enter at. */ room_vnum mortal_start_room; /* vnum of room that mortals enter at. */
room_vnum immort_start_room; /* vnum of room that immorts enter at. */ room_vnum immort_start_room; /* vnum of room that immorts enter at. */
@ -1173,10 +1055,7 @@ struct room_numbers {
room_vnum donation_room_3; /* vnum of donation room #3. */ room_vnum donation_room_3; /* vnum of donation room #3. */
}; };
/* The game operational constants. */
/*
* The game operational constants.
*/
struct game_operation { struct game_operation {
ush_int DFLT_PORT; /* The default port to run the game. */ ush_int DFLT_PORT; /* The default port to run the game. */
char *DFLT_IP; /* Bind to all interfaces. */ char *DFLT_IP; /* Bind to all interfaces. */
@ -1194,17 +1073,13 @@ struct game_operation {
char *START_MESSG; /* The start msg for new characters. */ char *START_MESSG; /* The start msg for new characters. */
}; };
/* /* The Autowizard options. */
* The Autowizard options.
*/
struct autowiz_data { struct autowiz_data {
int use_autowiz; /* Use the autowiz feature? */ int use_autowiz; /* Use the autowiz feature? */
int min_wizlist_lev; /* Minimun level to show on wizlist. */ int min_wizlist_lev; /* Minimun level to show on wizlist. */
}; };
/* /* The main configuration structure; */
* The main configuration structure;
*/
struct config_data { struct config_data {
char *CONFFILE; /* config file path */ char *CONFFILE; /* config file path */
struct game_data play; /* play related config */ struct game_data play; /* play related config */

View file

@ -211,10 +211,7 @@ void update_pos(struct char_data *victim);
#define ROOM_FLAGS(loc) (world[(loc)].room_flags) #define ROOM_FLAGS(loc) (world[(loc)].room_flags)
#define SPELL_ROUTINES(spl) (spell_info[spl].routines) #define SPELL_ROUTINES(spl) (spell_info[spl].routines)
/* /* IS_MOB() acts as a VALID_MOB_RNUM()-like function.*/
* See http://www.circlemud.org/~greerga/todo/todo.009 to eliminate MOB_ISNPC.
* IS_MOB() acts as a VALID_MOB_RNUM()-like function.
*/
#define IS_NPC(ch) (IS_SET(MOB_FLAGS(ch), MOB_ISNPC)) #define IS_NPC(ch) (IS_SET(MOB_FLAGS(ch), MOB_ISNPC))
#define IS_MOB(ch) (IS_NPC(ch) && GET_MOB_RNUM(ch) <= top_of_mobt && \ #define IS_MOB(ch) (IS_NPC(ch) && GET_MOB_RNUM(ch) <= top_of_mobt && \
GET_MOB_RNUM(ch) != NOBODY) GET_MOB_RNUM(ch) != NOBODY)

View file

@ -17,11 +17,7 @@
#include "oasis.h" #include "oasis.h"
#include "dg_scripts.h" #include "dg_scripts.h"
/*-------------------------------------------------------------------*/ /* Nasty internal macros to clean up the code. */
/*
* Nasty internal macros to clean up the code.
*/
#define MYCMD (OLC_ZONE(d)->cmd[subcmd]) #define MYCMD (OLC_ZONE(d)->cmd[subcmd])
#define OLC_CMD(d) (OLC_ZONE(d)->cmd[OLC_VAL(d)]) #define OLC_CMD(d) (OLC_ZONE(d)->cmd[OLC_VAL(d)])
#define MAX_DUPLICATES 100 #define MAX_DUPLICATES 100
@ -38,8 +34,6 @@ void zedit_disp_arg1(struct descriptor_data *d);
void zedit_disp_arg2(struct descriptor_data *d); void zedit_disp_arg2(struct descriptor_data *d);
void zedit_disp_arg3(struct descriptor_data *d); void zedit_disp_arg3(struct descriptor_data *d);
/*-------------------------------------------------------------------*/
ACMD(do_oasis_zedit) ACMD(do_oasis_zedit)
{ {
int number = NOWHERE, save = 0, real_num; int number = NOWHERE, save = 0, real_num;
@ -48,14 +42,10 @@ ACMD(do_oasis_zedit)
char buf1[MAX_STRING_LENGTH]; char buf1[MAX_STRING_LENGTH];
char buf2[MAX_STRING_LENGTH]; char buf2[MAX_STRING_LENGTH];
/****************************************************************************/ /* Parse any arguments. */
/** Parse any arguments. **/
/****************************************************************************/
buf3 = two_arguments(argument, buf1, buf2); buf3 = two_arguments(argument, buf1, buf2);
/****************************************************************************/ /* If no argument was given, use the zone the builder is standing in. */
/** If no argument was given, use the zone the builder is standing in. **/
/****************************************************************************/
if (!*buf1) if (!*buf1)
number = GET_ROOM_VNUM(IN_ROOM(ch)); number = GET_ROOM_VNUM(IN_ROOM(ch));
else if (!isdigit(*buf1)) { else if (!isdigit(*buf1)) {
@ -94,15 +84,11 @@ ACMD(do_oasis_zedit)
bottom = atoi(sbot); bottom = atoi(sbot);
top = atoi(stop); top = atoi(stop);
/**********************************************************************/ /* Setup the new zone (displays the menu to the builder). */
/** Setup the new zone (displays the menu to the builder). **/
/**********************************************************************/
zedit_new_zone(ch, number, bottom, top); zedit_new_zone(ch, number, bottom, top);
} }
/************************************************************************/ /* Done now, exit the function. */
/** Done now, exit the function. **/
/************************************************************************/
return; return;
} else { } else {
@ -111,15 +97,11 @@ ACMD(do_oasis_zedit)
} }
} }
/****************************************************************************/ /* If a numeric argumentwas given, retrieve it. */
/** If a numeric argumentwas given, retrieve it. **/
/****************************************************************************/
if (number == NOWHERE) if (number == NOWHERE)
number = atoi(buf1); number = atoi(buf1);
/****************************************************************************/ /* Check that nobody is currently editing this zone. */
/** Check that nobody is currently editing this zone. **/
/****************************************************************************/
for (d = descriptor_list; d; d = d->next) { for (d = descriptor_list; d; d = d->next) {
if (STATE(d) == CON_ZEDIT) { if (STATE(d) == CON_ZEDIT) {
if (d->olc && OLC_NUM(d) == number) { if (d->olc && OLC_NUM(d) == number) {
@ -130,14 +112,10 @@ ACMD(do_oasis_zedit)
} }
} }
/****************************************************************************/ /* Store the builder's descriptor in d. */
/** Store the builder's descriptor in d. **/
/****************************************************************************/
d = ch->desc; d = ch->desc;
/****************************************************************************/ /* Give the builder's descriptor an OLC structure. */
/** Give the builder's descriptor an OLC structure. **/
/****************************************************************************/
if (d->olc) { if (d->olc) {
mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_oasis_zedit: Player already " mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_oasis_zedit: Player already "
"had olc structure."); "had olc structure.");
@ -146,26 +124,20 @@ ACMD(do_oasis_zedit)
CREATE(d->olc, struct oasis_olc_data, 1); CREATE(d->olc, struct oasis_olc_data, 1);
/****************************************************************************/ /* Find the zone. */
/** Find the zone. **/
/****************************************************************************/
OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number); OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number);
if (OLC_ZNUM(d) == NOWHERE) { if (OLC_ZNUM(d) == NOWHERE) {
send_to_char(ch, "Sorry, there is no zone for that number!\r\n"); send_to_char(ch, "Sorry, there is no zone for that number!\r\n");
/**************************************************************************/ /* Free the descriptor's OLC structure. */
/** Free the descriptor's OLC structure. **/
/**************************************************************************/
free(d->olc); free(d->olc);
d->olc = NULL; d->olc = NULL;
return; return;
} }
/****************************************************************************/ /* Everyone but IMPLs can only edit zones they have been assigned. */
/** Everyone but IMPLs can only edit zones they have been assigned. **/
/****************************************************************************/
if (!can_edit_zone(ch, OLC_ZNUM(d))) { if (!can_edit_zone(ch, OLC_ZNUM(d))) {
send_to_char(ch, " You do not have permission to edit zone %d. Try zone %d.\r\n", zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); send_cannot_edit(ch, zone_table[OLC_ZNUM(d)].number);
mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d", mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch)); GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
free(d->olc); free(d->olc);
@ -173,9 +145,7 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
return; return;
} }
/****************************************************************************/ /* If we need to save, then save the zone. */
/** If we need to save, then save the zone. **/
/****************************************************************************/
if (save) { if (save) {
send_to_char(ch, "Saving all zone information for zone %d.\r\n", send_to_char(ch, "Saving all zone information for zone %d.\r\n",
zone_table[OLC_ZNUM(d)].number); zone_table[OLC_ZNUM(d)].number);
@ -183,14 +153,10 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
"OLC: %s saves zone information for zone %d.", GET_NAME(ch), "OLC: %s saves zone information for zone %d.", GET_NAME(ch),
zone_table[OLC_ZNUM(d)].number); zone_table[OLC_ZNUM(d)].number);
/**************************************************************************/ /* Save the zone information to the zone file. */
/** Save the zone information to the zone file. **/
/**************************************************************************/
save_zone(OLC_ZNUM(d)); save_zone(OLC_ZNUM(d));
/**************************************************************************/ /* Free the descriptor's OLC structure. */
/** Free the descriptor's OLC structure. **/
/**************************************************************************/
free(d->olc); free(d->olc);
d->olc = NULL; d->olc = NULL;
return; return;
@ -201,9 +167,7 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
if ((real_num = real_room(number)) == NOWHERE) { if ((real_num = real_room(number)) == NOWHERE) {
write_to_output(d, "That room does not exist.\r\n"); write_to_output(d, "That room does not exist.\r\n");
/**************************************************************************/ /* Free the descriptor's OLC structure. */
/** Free the descriptor's OLC structure. **/
/**************************************************************************/
free(d->olc); free(d->olc);
d->olc = NULL; d->olc = NULL;
return; return;
@ -224,14 +188,10 @@ void zedit_setup(struct descriptor_data *d, int room_num)
struct zone_data *zone; struct zone_data *zone;
int subcmd = 0, count = 0, cmd_room = NOWHERE; int subcmd = 0, count = 0, cmd_room = NOWHERE;
/* /* Allocate one scratch zone structure. */
* Allocate one scratch zone structure.
*/
CREATE(zone, struct zone_data, 1); CREATE(zone, struct zone_data, 1);
/* /* Copy all the zone header information over. */
* Copy all the zone header information over.
*/
zone->name = strdup(zone_table[OLC_ZNUM(d)].name); zone->name = strdup(zone_table[OLC_ZNUM(d)].name);
if (zone_table[OLC_ZNUM(d)].builders) if (zone_table[OLC_ZNUM(d)].builders)
zone->builders = strdup(zone_table[OLC_ZNUM(d)].builders); zone->builders = strdup(zone_table[OLC_ZNUM(d)].builders);
@ -239,21 +199,15 @@ void zedit_setup(struct descriptor_data *d, int room_num)
zone->bot = zone_table[OLC_ZNUM(d)].bot; zone->bot = zone_table[OLC_ZNUM(d)].bot;
zone->top = zone_table[OLC_ZNUM(d)].top; zone->top = zone_table[OLC_ZNUM(d)].top;
zone->reset_mode = zone_table[OLC_ZNUM(d)].reset_mode; zone->reset_mode = zone_table[OLC_ZNUM(d)].reset_mode;
/* /* The remaining fields are used as a 'has been modified' flag */
* The remaining fields are used as a 'has been modified' flag
*/
zone->number = 0; /* Header information has changed. */ zone->number = 0; /* Header information has changed. */
zone->age = 0; /* The commands have changed. */ zone->age = 0; /* The commands have changed. */
/* /* Start the reset command list with a terminator. */
* Start the reset command list with a terminator.
*/
CREATE(zone->cmd, struct reset_com, 1); CREATE(zone->cmd, struct reset_com, 1);
zone->cmd[0].command = 'S'; zone->cmd[0].command = 'S';
/* /* Add all entries in zone_table that relate to this room. */
* Add all entries in zone_table that relate to this room.
*/
while (ZCMD(OLC_ZNUM(d), subcmd).command != 'S') { while (ZCMD(OLC_ZNUM(d), subcmd).command != 'S') {
switch (ZCMD(OLC_ZNUM(d), subcmd).command) { switch (ZCMD(OLC_ZNUM(d), subcmd).command) {
case 'M': case 'M':
@ -283,11 +237,7 @@ void zedit_setup(struct descriptor_data *d, int room_num)
zedit_disp_menu(d); zedit_disp_menu(d);
} }
/*-------------------------------------------------------------------*/ /* Create a new zone. */
/*
* Create a new zone.
*/
void zedit_new_zone(struct char_data *ch, zone_vnum vzone_num, room_vnum bottom, room_vnum top) void zedit_new_zone(struct char_data *ch, zone_vnum vzone_num, room_vnum bottom, room_vnum top)
{ {
int result; int result;
@ -322,12 +272,8 @@ void zedit_new_zone(struct char_data *ch, zone_vnum vzone_num, room_vnum bottom,
write_to_output(ch->desc, "Zone created successfully.\r\n"); write_to_output(ch->desc, "Zone created successfully.\r\n");
} }
/*-------------------------------------------------------------------*/ /* Save all the information in the player's temporary buffer back into
* the current zone table. */
/*
* Save all the information in the player's temporary buffer back into
* the current zone table.
*/
void zedit_save_internally(struct descriptor_data *d) void zedit_save_internally(struct descriptor_data *d)
{ {
int mobloaded = FALSE, int mobloaded = FALSE,
@ -342,19 +288,15 @@ void zedit_save_internally(struct descriptor_data *d)
remove_room_zone_commands(OLC_ZNUM(d), room_num); remove_room_zone_commands(OLC_ZNUM(d), room_num);
/* /* Now add all the entries in the players descriptor list */
* Now add all the entries in the players descriptor list
*/
for (subcmd = 0; MYCMD.command != 'S'; subcmd++) { for (subcmd = 0; MYCMD.command != 'S'; subcmd++) {
/* /* Since Circle does not keep track of what rooms the 'G', 'E', and
* Since Circle does not keep track of what rooms the 'G', 'E', and
* 'P' commands are exitted in, but OasisOLC groups zone commands * 'P' commands are exitted in, but OasisOLC groups zone commands
* by rooms, this creates interesting problems when builders use these * by rooms, this creates interesting problems when builders use these
* commands without loading a mob or object first. This fix prevents such * commands without loading a mob or object first. This fix prevents such
* commands from being saved and 'wandering' through the zone command * commands from being saved and 'wandering' through the zone command
* list looking for mobs/objects to latch onto. * list looking for mobs/objects to latch onto.
* C.Raehl 4/27/99 * C.Raehl 4/27/99 */
*/
switch (MYCMD.command) { switch (MYCMD.command) {
/* Possible fail cases. */ /* Possible fail cases. */
case 'G': case 'G':
@ -382,9 +324,7 @@ void zedit_save_internally(struct descriptor_data *d)
add_cmd_to_list(&(zone_table[OLC_ZNUM(d)].cmd), &MYCMD, subcmd); add_cmd_to_list(&(zone_table[OLC_ZNUM(d)].cmd), &MYCMD, subcmd);
} }
/* /* Finally, if zone headers have been changed, copy over */
* Finally, if zone headers have been changed, copy over
*/
if (OLC_ZONE(d)->number) { if (OLC_ZONE(d)->number) {
free(zone_table[OLC_ZNUM(d)].name); free(zone_table[OLC_ZNUM(d)].name);
free(zone_table[OLC_ZNUM(d)].builders); free(zone_table[OLC_ZNUM(d)].builders);
@ -399,37 +339,24 @@ void zedit_save_internally(struct descriptor_data *d)
add_to_save_list(zone_table[OLC_ZNUM(d)].number, SL_ZON); add_to_save_list(zone_table[OLC_ZNUM(d)].number, SL_ZON);
} }
/*-------------------------------------------------------------------*/
void zedit_save_to_disk(int zone) void zedit_save_to_disk(int zone)
{ {
save_zone(zone); save_zone(zone);
} }
/*-------------------------------------------------------------------*/ /* Error check user input and then setup change */
/*
* Error check user input and then setup change
*/
int start_change_command(struct descriptor_data *d, int pos) int start_change_command(struct descriptor_data *d, int pos)
{ {
if (pos < 0 || pos >= count_commands(OLC_ZONE(d)->cmd)) if (pos < 0 || pos >= count_commands(OLC_ZONE(d)->cmd))
return 0; return 0;
/* /* Ok, let's get editing. */
* Ok, let's get editing.
*/
OLC_VAL(d) = pos; OLC_VAL(d) = pos;
return 1; return 1;
} }
/************************************************************************** /* Menu functions */
Menu functions /* the main menu */
**************************************************************************/
/*
* the main menu
*/
void zedit_disp_menu(struct descriptor_data *d) void zedit_disp_menu(struct descriptor_data *d)
{ {
int subcmd = 0, room, counter = 0; int subcmd = 0, room, counter = 0;
@ -438,9 +365,7 @@ void zedit_disp_menu(struct descriptor_data *d)
clear_screen(d); clear_screen(d);
room = real_room(OLC_NUM(d)); room = real_room(OLC_NUM(d));
/* /* Menu header */
* Menu header
*/
send_to_char(d->character, send_to_char(d->character,
"Room number: %s%d%s Room zone: %s%d\r\n" "Room number: %s%d%s Room zone: %s%d\r\n"
"%s1%s) Builders : %s%s\r\n" "%s1%s) Builders : %s%s\r\n"
@ -464,13 +389,9 @@ void zedit_disp_menu(struct descriptor_data *d)
nrm nrm
); );
/* /* Print the commands for this room into display buffer. */
* Print the commands for this room into display buffer.
*/
while (MYCMD.command != 'S') { while (MYCMD.command != 'S') {
/* /* Translate what the command means. */
* Translate what the command means.
*/
write_to_output(d, "%s%d - %s", nrm, counter++, yel); write_to_output(d, "%s%d - %s", nrm, counter++, yel);
switch (MYCMD.command) { switch (MYCMD.command) {
case 'M': case 'M':
@ -554,9 +475,7 @@ void zedit_disp_menu(struct descriptor_data *d)
write_to_output(d, "\r\n"); write_to_output(d, "\r\n");
subcmd++; subcmd++;
} }
/* /* Finish off menu */
* Finish off menu
*/
write_to_output(d, write_to_output(d,
"%s%d - <END OF LIST>\r\n" "%s%d - <END OF LIST>\r\n"
"%sN%s) Insert new command.\r\n" "%sN%s) Insert new command.\r\n"
@ -569,11 +488,7 @@ void zedit_disp_menu(struct descriptor_data *d)
OLC_MODE(d) = ZEDIT_MAIN_MENU; OLC_MODE(d) = ZEDIT_MAIN_MENU;
} }
/*-------------------------------------------------------------------*/ /* Print the command type menu and setup response catch. */
/*
* Print the command type menu and setup response catch.
*/
void zedit_disp_comtype(struct descriptor_data *d) void zedit_disp_comtype(struct descriptor_data *d)
{ {
get_char_colors(d->character); get_char_colors(d->character);
@ -593,12 +508,8 @@ void zedit_disp_comtype(struct descriptor_data *d)
OLC_MODE(d) = ZEDIT_COMMAND_TYPE; OLC_MODE(d) = ZEDIT_COMMAND_TYPE;
} }
/*-------------------------------------------------------------------*/ /* Print the appropriate message for the command type for arg1 and set
up the input catch clause */
/*
* Print the appropriate message for the command type for arg1 and set
* up the input catch clause
*/
void zedit_disp_arg1(struct descriptor_data *d) void zedit_disp_arg1(struct descriptor_data *d)
{ {
write_to_output(d, "\r\n"); write_to_output(d, "\r\n");
@ -617,9 +528,7 @@ void zedit_disp_arg1(struct descriptor_data *d)
break; break;
case 'D': case 'D':
case 'R': case 'R':
/* /* Arg1 for these is the room number, skip to arg2 */
* Arg1 for these is the room number, skip to arg2
*/
OLC_CMD(d).arg1 = real_room(OLC_NUM(d)); OLC_CMD(d).arg1 = real_room(OLC_NUM(d));
zedit_disp_arg2(d); zedit_disp_arg2(d);
break; break;
@ -629,9 +538,7 @@ void zedit_disp_arg1(struct descriptor_data *d)
OLC_MODE(d) = ZEDIT_ARG1; OLC_MODE(d) = ZEDIT_ARG1;
break; break;
default: default:
/* /* We should never get here. */
* We should never get here.
*/
cleanup_olc(d, CLEANUP_ALL); cleanup_olc(d, CLEANUP_ALL);
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_disp_arg1(): Help!"); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_disp_arg1(): Help!");
write_to_output(d, "Oops...\r\n"); write_to_output(d, "Oops...\r\n");
@ -639,12 +546,8 @@ void zedit_disp_arg1(struct descriptor_data *d)
} }
} }
/*-------------------------------------------------------------------*/ /* Print the appropriate message for the command type for arg2 and set
up the input catch clause. */
/*
* Print the appropriate message for the command type for arg2 and set
* up the input catch clause.
*/
void zedit_disp_arg2(struct descriptor_data *d) void zedit_disp_arg2(struct descriptor_data *d)
{ {
int i; int i;
@ -675,9 +578,7 @@ void zedit_disp_arg2(struct descriptor_data *d)
write_to_output(d, "Global's context (0 for none) : "); write_to_output(d, "Global's context (0 for none) : ");
break; break;
default: default:
/* /* We should never get here, but just in case. */
* We should never get here, but just in case...
*/
cleanup_olc(d, CLEANUP_ALL); cleanup_olc(d, CLEANUP_ALL);
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_disp_arg2(): Help!"); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_disp_arg2(): Help!");
write_to_output(d, "Oops...\r\n"); write_to_output(d, "Oops...\r\n");
@ -686,12 +587,8 @@ void zedit_disp_arg2(struct descriptor_data *d)
OLC_MODE(d) = ZEDIT_ARG2; OLC_MODE(d) = ZEDIT_ARG2;
} }
/*-------------------------------------------------------------------*/ /* Print the appropriate message for the command type for arg3 and set
up the input catch clause. */
/*
* Print the appropriate message for the command type for arg3 and set
* up the input catch clause.
*/
void zedit_disp_arg3(struct descriptor_data *d) void zedit_disp_arg3(struct descriptor_data *d)
{ {
int i = 0; int i = 0;
@ -727,9 +624,7 @@ void zedit_disp_arg3(struct descriptor_data *d)
case 'R': case 'R':
case 'G': case 'G':
default: default:
/* /* We should never get here, just in case. */
* We should never get here, just in case.
*/
cleanup_olc(d, CLEANUP_ALL); cleanup_olc(d, CLEANUP_ALL);
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_disp_arg3(): Help!"); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_disp_arg3(): Help!");
write_to_output(d, "Oops...\r\n"); write_to_output(d, "Oops...\r\n");
@ -738,23 +633,17 @@ void zedit_disp_arg3(struct descriptor_data *d)
OLC_MODE(d) = ZEDIT_ARG3; OLC_MODE(d) = ZEDIT_ARG3;
} }
/************************************************************************** /* The event handler */
The GARGANTAUN event handler
**************************************************************************/
void zedit_parse(struct descriptor_data *d, char *arg) void zedit_parse(struct descriptor_data *d, char *arg)
{ {
int pos, i = 0; int pos, i = 0;
switch (OLC_MODE(d)) { switch (OLC_MODE(d)) {
/*-------------------------------------------------------------------*/
case ZEDIT_CONFIRM_SAVESTRING: case ZEDIT_CONFIRM_SAVESTRING:
switch (*arg) { switch (*arg) {
case 'y': case 'y':
case 'Y': case 'Y':
/* /* Save the zone in memory, hiding invisible people. */
* Save the zone in memory, hiding invisible people.
*/
zedit_save_internally(d); zedit_save_internally(d);
if (CONFIG_OLC_SAVE) { if (CONFIG_OLC_SAVE) {
write_to_output(d, "Saving zone info to disk.\r\n"); write_to_output(d, "Saving zone info to disk.\r\n");
@ -770,19 +659,18 @@ void zedit_parse(struct descriptor_data *d, char *arg)
break; break;
default: default:
write_to_output(d, "Invalid choice!\r\n"); write_to_output(d, "Invalid choice!\r\n");
write_to_output(d, "Do you wish to save the zone info? : "); write_to_output(d, "Do you wish to save your changes? : ");
break; break;
} }
break; break;
/* End of ZEDIT_CONFIRM_SAVESTRING */ /* End of ZEDIT_CONFIRM_SAVESTRING */
/*-------------------------------------------------------------------*/
case ZEDIT_MAIN_MENU: case ZEDIT_MAIN_MENU:
switch (*arg) { switch (*arg) {
case 'q': case 'q':
case 'Q': case 'Q':
if (OLC_ZONE(d)->age || OLC_ZONE(d)->number) { if (OLC_ZONE(d)->age || OLC_ZONE(d)->number) {
write_to_output(d, "Do you wish to save the changes to the zone info? (y/n) : "); write_to_output(d, "Do you wish to save your changes? (y/n) : ");
OLC_MODE(d) = ZEDIT_CONFIRM_SAVESTRING; OLC_MODE(d) = ZEDIT_CONFIRM_SAVESTRING;
} else { } else {
write_to_output(d, "No changes made.\r\n"); write_to_output(d, "No changes made.\r\n");
@ -791,9 +679,7 @@ void zedit_parse(struct descriptor_data *d, char *arg)
break; break;
case 'n': case 'n':
case 'N': case 'N':
/* /* New entry. */
* New entry.
*/
if (OLC_ZONE(d)->cmd[0].command == 'S') { if (OLC_ZONE(d)->cmd[0].command == 'S') {
/* first command */ /* first command */
if (new_command(OLC_ZONE(d), 0) && start_change_command(d, 0)) { if (new_command(OLC_ZONE(d), 0) && start_change_command(d, 0)) {
@ -807,40 +693,30 @@ void zedit_parse(struct descriptor_data *d, char *arg)
break; break;
case 'e': case 'e':
case 'E': case 'E':
/* /* Change an entry. */
* Change an entry.
*/
write_to_output(d, "Which command do you wish to change? : "); write_to_output(d, "Which command do you wish to change? : ");
OLC_MODE(d) = ZEDIT_CHANGE_ENTRY; OLC_MODE(d) = ZEDIT_CHANGE_ENTRY;
break; break;
case 'd': case 'd':
case 'D': case 'D':
/* /* Delete an entry. */
* Delete an entry.
*/
write_to_output(d, "Which command do you wish to delete? : "); write_to_output(d, "Which command do you wish to delete? : ");
OLC_MODE(d) = ZEDIT_DELETE_ENTRY; OLC_MODE(d) = ZEDIT_DELETE_ENTRY;
break; break;
case 'z': case 'z':
case 'Z': case 'Z':
/* /* Edit zone name. */
* Edit zone name.
*/
write_to_output(d, "Enter new zone name : "); write_to_output(d, "Enter new zone name : ");
OLC_MODE(d) = ZEDIT_ZONE_NAME; OLC_MODE(d) = ZEDIT_ZONE_NAME;
break; break;
case '1': case '1':
/* /* Edit zone builders. */
* Edit zone builders.
*/
write_to_output(d, "Enter new builders list : "); write_to_output(d, "Enter new builders list : ");
OLC_MODE(d) = ZEDIT_ZONE_BUILDERS; OLC_MODE(d) = ZEDIT_ZONE_BUILDERS;
break; break;
case 'b': case 'b':
case 'B': case 'B':
/* /* Edit bottom of zone. */
* Edit bottom of zone.
*/
if (GET_LEVEL(d->character) < LVL_IMPL) if (GET_LEVEL(d->character) < LVL_IMPL)
zedit_disp_menu(d); zedit_disp_menu(d);
else { else {
@ -850,9 +726,7 @@ void zedit_parse(struct descriptor_data *d, char *arg)
break; break;
case 't': case 't':
case 'T': case 'T':
/* /* Edit top of zone. */
* Edit top of zone.
*/
if (GET_LEVEL(d->character) < LVL_IMPL) if (GET_LEVEL(d->character) < LVL_IMPL)
zedit_disp_menu(d); zedit_disp_menu(d);
else { else {
@ -862,17 +736,13 @@ void zedit_parse(struct descriptor_data *d, char *arg)
break; break;
case 'l': case 'l':
case 'L': case 'L':
/* /* Edit zone lifespan. */
* Edit zone lifespan.
*/
write_to_output(d, "Enter new zone lifespan : "); write_to_output(d, "Enter new zone lifespan : ");
OLC_MODE(d) = ZEDIT_ZONE_LIFE; OLC_MODE(d) = ZEDIT_ZONE_LIFE;
break; break;
case 'r': case 'r':
case 'R': case 'R':
/* /* Edit zone reset mode. */
* Edit zone reset mode.
*/
write_to_output(d, "\r\n" write_to_output(d, "\r\n"
"0) Never reset\r\n" "0) Never reset\r\n"
"1) Reset only when no players in zone\r\n" "1) Reset only when no players in zone\r\n"
@ -887,11 +757,8 @@ void zedit_parse(struct descriptor_data *d, char *arg)
break; break;
/* End of ZEDIT_MAIN_MENU */ /* End of ZEDIT_MAIN_MENU */
/*-------------------------------------------------------------------*/
case ZEDIT_NEW_ENTRY: case ZEDIT_NEW_ENTRY:
/* /* Get the line number and insert the new line. */
* Get the line number and insert the new line.
*/
pos = atoi(arg); pos = atoi(arg);
if (isdigit(*arg) && new_command(OLC_ZONE(d), pos)) { if (isdigit(*arg) && new_command(OLC_ZONE(d), pos)) {
if (start_change_command(d, pos)) { if (start_change_command(d, pos)) {
@ -902,11 +769,8 @@ void zedit_parse(struct descriptor_data *d, char *arg)
zedit_disp_menu(d); zedit_disp_menu(d);
break; break;
/*-------------------------------------------------------------------*/
case ZEDIT_DELETE_ENTRY: case ZEDIT_DELETE_ENTRY:
/* /* Get the line number and delete the line. */
* Get the line number and delete the line.
*/
pos = atoi(arg); pos = atoi(arg);
if (isdigit(*arg)) { if (isdigit(*arg)) {
delete_zone_command(OLC_ZONE(d), pos); delete_zone_command(OLC_ZONE(d), pos);
@ -915,15 +779,9 @@ void zedit_parse(struct descriptor_data *d, char *arg)
zedit_disp_menu(d); zedit_disp_menu(d);
break; break;
/*-------------------------------------------------------------------*/
case ZEDIT_CHANGE_ENTRY: case ZEDIT_CHANGE_ENTRY:
/* /* Parse the input for which line to edit, and goto next quiz. Abort edit,
* Parse the input for which line to edit, and goto next quiz. and return to main menu idea from Mark Garringer zizazat@hotmail.com */
*/
/*
* Abort edit, and return to main menu
* - idea from Mark Garringer zizazat@hotmail.com
*/
if (toupper(*arg) == 'A') { if (toupper(*arg) == 'A') {
if (OLC_CMD(d).command == 'N') { if (OLC_CMD(d).command == 'N') {
OLC_CMD(d).command = '*'; OLC_CMD(d).command = '*';
@ -940,12 +798,8 @@ void zedit_parse(struct descriptor_data *d, char *arg)
zedit_disp_menu(d); zedit_disp_menu(d);
break; break;
/*-------------------------------------------------------------------*/
case ZEDIT_COMMAND_TYPE: case ZEDIT_COMMAND_TYPE:
/* /* Parse the input for which type of command this is, and goto next quiz. */
* Parse the input for which type of command this is, and goto next
* quiz.
*/
OLC_CMD(d).command = toupper(*arg); OLC_CMD(d).command = toupper(*arg);
if (!OLC_CMD(d).command || (strchr("MOPEDGRTV", OLC_CMD(d).command) == NULL)) { if (!OLC_CMD(d).command || (strchr("MOPEDGRTV", OLC_CMD(d).command) == NULL)) {
write_to_output(d, "Invalid choice, try again : "); write_to_output(d, "Invalid choice, try again : ");
@ -965,11 +819,8 @@ void zedit_parse(struct descriptor_data *d, char *arg)
} }
break; break;
/*-------------------------------------------------------------------*/
case ZEDIT_IF_FLAG: case ZEDIT_IF_FLAG:
/* /* Parse the input for the if flag, and goto next quiz. */
* Parse the input for the if flag, and goto next quiz.
*/
switch (*arg) { switch (*arg) {
case 'y': case 'y':
case 'Y': case 'Y':
@ -986,11 +837,8 @@ void zedit_parse(struct descriptor_data *d, char *arg)
zedit_disp_arg1(d); zedit_disp_arg1(d);
break; break;
/*-------------------------------------------------------------------*/
case ZEDIT_ARG1: case ZEDIT_ARG1:
/* /* Parse the input for arg1, and goto next quiz. */
* Parse the input for arg1, and goto next quiz.
*/
if (!isdigit(*arg)) { if (!isdigit(*arg)) {
write_to_output(d, "Must be a numeric value, try again : "); write_to_output(d, "Must be a numeric value, try again : ");
return; return;
@ -1025,9 +873,7 @@ void zedit_parse(struct descriptor_data *d, char *arg)
case 'D': case 'D':
case 'R': case 'R':
default: default:
/* /* We should never get here. */
* We should never get here.
*/
cleanup_olc(d, CLEANUP_ALL); cleanup_olc(d, CLEANUP_ALL);
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_parse(): case ARG1: Ack!"); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_parse(): case ARG1: Ack!");
write_to_output(d, "Oops...\r\n"); write_to_output(d, "Oops...\r\n");
@ -1035,11 +881,8 @@ void zedit_parse(struct descriptor_data *d, char *arg)
} }
break; break;
/*-------------------------------------------------------------------*/
case ZEDIT_ARG2: case ZEDIT_ARG2:
/* /* Parse the input for arg2, and goto next quiz. */
* Parse the input for arg2, and goto next quiz.
*/
if (!isdigit(*arg)) { if (!isdigit(*arg)) {
write_to_output(d, "Must be a numeric value, try again : "); write_to_output(d, "Must be a numeric value, try again : ");
return; return;
@ -1076,9 +919,7 @@ void zedit_parse(struct descriptor_data *d, char *arg)
break; break;
case 'D': case 'D':
pos = atoi(arg); pos = atoi(arg);
/* /* Count directions. */
* Count directions.
*/
if (pos < 0 || pos > NUM_OF_DIRS) if (pos < 0 || pos > NUM_OF_DIRS)
write_to_output(d, "Try again : "); write_to_output(d, "Try again : ");
else { else {
@ -1094,9 +935,7 @@ void zedit_parse(struct descriptor_data *d, char *arg)
write_to_output(d, "That object does not exist, try again : "); write_to_output(d, "That object does not exist, try again : ");
break; break;
default: default:
/* /* We should never get here, but just in case. */
* We should never get here, but just in case...
*/
cleanup_olc(d, CLEANUP_ALL); cleanup_olc(d, CLEANUP_ALL);
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_parse(): case ARG2: Ack!"); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_parse(): case ARG2: Ack!");
write_to_output(d, "Oops...\r\n"); write_to_output(d, "Oops...\r\n");
@ -1104,11 +943,8 @@ void zedit_parse(struct descriptor_data *d, char *arg)
} }
break; break;
/*-------------------------------------------------------------------*/
case ZEDIT_ARG3: case ZEDIT_ARG3:
/* /* Parse the input for arg3, and go back to main menu. */
* Parse the input for arg3, and go back to main menu.
*/
if (!isdigit(*arg)) { if (!isdigit(*arg)) {
write_to_output(d, "Must be a numeric value, try again : "); write_to_output(d, "Must be a numeric value, try again : ");
return; return;
@ -1116,10 +952,8 @@ void zedit_parse(struct descriptor_data *d, char *arg)
switch (OLC_CMD(d).command) { switch (OLC_CMD(d).command) {
case 'E': case 'E':
pos = atoi(arg); pos = atoi(arg);
/* /* Count number of wear positions. We could use NUM_WEARS, this is
* Count number of wear positions. We could use NUM_WEARS, this is more reliable. */
* more reliable.
*/
while (*equipment_types[i] != '\n') while (*equipment_types[i] != '\n')
i++; i++;
if (pos < 0 || pos > i) if (pos < 0 || pos > i)
@ -1152,9 +986,7 @@ void zedit_parse(struct descriptor_data *d, char *arg)
case 'T': case 'T':
case 'V': case 'V':
default: default:
/* /* We should never get here, but just in case. */
* We should never get here, but just in case...
*/
cleanup_olc(d, CLEANUP_ALL); cleanup_olc(d, CLEANUP_ALL);
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_parse(): case ARG3: Ack!"); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_parse(): case ARG3: Ack!");
write_to_output(d, "Oops...\r\n"); write_to_output(d, "Oops...\r\n");
@ -1162,7 +994,6 @@ void zedit_parse(struct descriptor_data *d, char *arg)
} }
break; break;
/*-------------------------------------------------------------------*/
case ZEDIT_SARG1: case ZEDIT_SARG1:
if (strlen(arg)) { if (strlen(arg)) {
OLC_CMD(d).sarg1 = strdup(arg); OLC_CMD(d).sarg1 = strdup(arg);
@ -1172,7 +1003,6 @@ void zedit_parse(struct descriptor_data *d, char *arg)
write_to_output(d, "Must have some name to assign : "); write_to_output(d, "Must have some name to assign : ");
break; break;
/*-------------------------------------------------------------------*/
case ZEDIT_SARG2: case ZEDIT_SARG2:
if (strlen(arg)) { if (strlen(arg)) {
OLC_CMD(d).sarg2 = strdup(arg); OLC_CMD(d).sarg2 = strdup(arg);
@ -1181,11 +1011,8 @@ void zedit_parse(struct descriptor_data *d, char *arg)
write_to_output(d, "Must have some value to set it to :"); write_to_output(d, "Must have some value to set it to :");
break; break;
/*-------------------------------------------------------------------*/
case ZEDIT_ZONE_NAME: case ZEDIT_ZONE_NAME:
/* /* Add new name and return to main menu. */
* Add new name and return to main menu.
*/
if (genolc_checkstring(d, arg)) { if (genolc_checkstring(d, arg)) {
if (OLC_ZONE(d)->name) if (OLC_ZONE(d)->name)
free(OLC_ZONE(d)->name); free(OLC_ZONE(d)->name);
@ -1197,11 +1024,8 @@ void zedit_parse(struct descriptor_data *d, char *arg)
zedit_disp_menu(d); zedit_disp_menu(d);
break; break;
/*-------------------------------------------------------------------*/
case ZEDIT_ZONE_BUILDERS: case ZEDIT_ZONE_BUILDERS:
/* /* Add new builders list and return to main menu. */
* Add new builders list and return to main menu.
*/
if (genolc_checkstring(d, arg)) { if (genolc_checkstring(d, arg)) {
if (OLC_ZONE(d)->builders) if (OLC_ZONE(d)->builders)
free(OLC_ZONE(d)->builders); free(OLC_ZONE(d)->builders);
@ -1213,11 +1037,8 @@ void zedit_parse(struct descriptor_data *d, char *arg)
zedit_disp_menu(d); zedit_disp_menu(d);
break; break;
/*-------------------------------------------------------------------*/
case ZEDIT_ZONE_RESET: case ZEDIT_ZONE_RESET:
/* /* Parse and add new reset_mode and return to main menu. */
* Parse and add new reset_mode and return to main menu.
*/
pos = atoi(arg); pos = atoi(arg);
if (!isdigit(*arg) || pos < 0 || pos > 2) if (!isdigit(*arg) || pos < 0 || pos > 2)
write_to_output(d, "Try again (0-2) : "); write_to_output(d, "Try again (0-2) : ");
@ -1228,11 +1049,8 @@ void zedit_parse(struct descriptor_data *d, char *arg)
} }
break; break;
/*-------------------------------------------------------------------*/
case ZEDIT_ZONE_LIFE: case ZEDIT_ZONE_LIFE:
/* /* Parse and add new lifespan and return to main menu. */
* Parse and add new lifespan and return to main menu.
*/
pos = atoi(arg); pos = atoi(arg);
if (!isdigit(*arg) || pos < 0 || pos > 240) if (!isdigit(*arg) || pos < 0 || pos > 240)
write_to_output(d, "Try again (0-240) : "); write_to_output(d, "Try again (0-240) : ");
@ -1243,11 +1061,8 @@ void zedit_parse(struct descriptor_data *d, char *arg)
} }
break; break;
/*-------------------------------------------------------------------*/
case ZEDIT_ZONE_BOT: case ZEDIT_ZONE_BOT:
/* /* Parse and add new bottom room in zone and return to main menu. */
* Parse and add new bottom room in zone and return to main menu.
*/
if (OLC_ZNUM(d) == 0) if (OLC_ZNUM(d) == 0)
OLC_ZONE(d)->bot = LIMIT(atoi(arg), 0, OLC_ZONE(d)->top); OLC_ZONE(d)->bot = LIMIT(atoi(arg), 0, OLC_ZONE(d)->top);
else else
@ -1256,11 +1071,8 @@ void zedit_parse(struct descriptor_data *d, char *arg)
zedit_disp_menu(d); zedit_disp_menu(d);
break; break;
/*-------------------------------------------------------------------*/
case ZEDIT_ZONE_TOP: case ZEDIT_ZONE_TOP:
/* /* Parse and add new top room in zone and return to main menu. */
* Parse and add new top room in zone and return to main menu.
*/
if (OLC_ZNUM(d) == top_of_zone_table) if (OLC_ZNUM(d) == top_of_zone_table)
OLC_ZONE(d)->top = LIMIT(atoi(arg), genolc_zonep_bottom(OLC_ZONE(d)), 32000); OLC_ZONE(d)->top = LIMIT(atoi(arg), genolc_zonep_bottom(OLC_ZONE(d)), 32000);
else else
@ -1269,18 +1081,11 @@ void zedit_parse(struct descriptor_data *d, char *arg)
zedit_disp_menu(d); zedit_disp_menu(d);
break; break;
/*-------------------------------------------------------------------*/
default: default:
/* /* We should never get here, but just in case... */
* We should never get here, but just in case...
*/
cleanup_olc(d, CLEANUP_ALL); cleanup_olc(d, CLEANUP_ALL);
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_parse(): Reached default case!"); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: zedit_parse(): Reached default case!");
write_to_output(d, "Oops...\r\n"); write_to_output(d, "Oops...\r\n");
break; break;
} }
} }
/******************************************************************************/
/** End of parse_zedit() **/
/******************************************************************************/

View file

@ -1,18 +1,13 @@
/* /** Zmalloc, a simple memory-allocation monitor.
** Zmalloc, a simple memory-allocation monitor.
** **
** Version 2. added detection for writing off the end or beginning ** Version 2. added detection for writing off the end or beginning
** of buffers, freeing the same block multiple times. Also now use the ** of buffers, freeing the same block multiple times. Also now use the
** env variable to set the name of a file to write output to. ** env variable to set the name of a file to write output to.
** **
**
** Copyright 1996,1998,1999,2000 Eric Murray, ericm@lne.com ** Copyright 1996,1998,1999,2000 Eric Murray, ericm@lne.com
** **
** You may make free use of this code but please give me credit. ** You may make free use of this code but please give me credit.
** **
**
** Documentation: http://www.lne.com/ericm/zmalloc
**
** $Id: zmalloc.c,v 1.3 2000/06/26 18:38:53 ericm Exp $ ** $Id: zmalloc.c,v 1.3 2000/06/26 18:38:53 ericm Exp $
** $Log: zmalloc.c,v $ ** $Log: zmalloc.c,v $
** Revision 1.3 2000/06/26 18:38:53 ericm ** Revision 1.3 2000/06/26 18:38:53 ericm
@ -25,10 +20,7 @@
** use env variable to set output to stdin, stdout, file ** use env variable to set output to stdin, stdout, file
** **
** Revision 1.1 1998/05/25 16:31:35 ericm ** Revision 1.1 1998/05/25 16:31:35 ericm
** Initial revision ** Initial revision */
**
**
*/
/* local functions */ /* local functions */
void zfree_special (int *, char *, int); void zfree_special (int *, char *, int);

View file

@ -1,21 +1,13 @@
/* Zmalloc, a simple memory-allocation monitor.
/*
** Zmalloc, a simple memory-allocation monitor.
** **
** Copyright 1996 Eric Murray, ericm@lne.com ** Copyright 1996 Eric Murray, ericm@lne.com
** **
** You may make free use of this code but please give me credit. ** You may make free use of this code but please give me credit.
** **
**
** Documentation: http://www.lne.com/ericm/zmalloc
**
** $Id: zmalloc.h,v 1.1 1998/05/25 16:31:35 ericm Exp $ ** $Id: zmalloc.h,v 1.1 1998/05/25 16:31:35 ericm Exp $
** $Log: zmalloc.h,v $ ** $Log: zmalloc.h,v $
** Revision 1.1 1998/05/25 16:31:35 ericm ** Revision 1.1 1998/05/25 16:31:35 ericm
** Initial revision ** Initial revision */
**
**
*/
#ifndef ZMALLOC_H #ifndef ZMALLOC_H
#define ZMALLOC_H #define ZMALLOC_H
@ -32,4 +24,3 @@ char *zstrdup(const char*, char*, int);
#define strdup(x) zstrdup((x), __FILE__, __LINE__) #define strdup(x) zstrdup((x), __FILE__, __LINE__)
#endif /* ZMALLOC_H */ #endif /* ZMALLOC_H */