Renamed several functions to lower case and variable wovel to vowel. Removed oasis_delete.h and object type TRAP. --Rumble

This commit is contained in:
Rumble 2007-04-08 10:36:36 +00:00
parent 48a2738d6a
commit 4543522a7d
105 changed files with 1990 additions and 3403 deletions

View file

@ -5,7 +5,13 @@ The Builder Academy
builderacademy.net 9091 builderacademy.net 9091
tbaMUD 3.52 tbaMUD 3.52
[Apr 08 2007] - Rumble
Removed object type TRAP.
Removed oasis_delete.h.
Renamed variable wovel to vowel in ban.c.
Renamed several functions to lower case.
[Apr 02 2007] - Rumble [Apr 02 2007] - Rumble
Stopped Checking abbrevs with doors so players can't spam open a, open b, etc.
Added questpoints! Added questpoints!
[Mar 30 2007] - Rumble [Mar 30 2007] - Rumble
Added unlimited fountains and containers (Thanks Adam Scriven). Added unlimited fountains and containers (Thanks Adam Scriven).
@ -14,7 +20,6 @@ tbaMUD 3.52
[Mar 25 2007] - Rumble [Mar 25 2007] - Rumble
Updated idle timer to keep track of imms too (thanks Jamdog). Updated idle timer to keep track of imms too (thanks Jamdog).
Standardized OLC messages. Standardized OLC messages.
Removed special procedures that were replaced with trigedit.
Updated README.WIN, README.MSVC8, and README.CYGWIN. Updated README.WIN, README.MSVC8, and README.CYGWIN.
[Mar 20 2007] - Rumble [Mar 20 2007] - Rumble
Added object type FURNITURE (thanks Dark). Added object type FURNITURE (thanks Dark).

View file

@ -2,7 +2,7 @@
Welcome to Welcome to
T B A M U D 3 . 5 1 T B A M U D
"We addict players for their own enjoyment." "We addict players for their own enjoyment."
Created by Jeremy Elson Created by Jeremy Elson

View file

@ -1,78 +1,75 @@
(lib/text/news) (lib/text/news)
THE 2007 tbaMUD HERALD
THE tbaMUD HERALD
"We addict players for their own enjoyment." "We addict players for their own enjoyment."
February, 2007
NEW COMMANDS AND NEW MUD BEHAVIOR: NEW COMMANDS AND NEW MUD BEHAVIOR:
--------------------------------- ---------------------------------
** Over 100 new socials, check them out and feel free to suggest new ones. ** Added questpoints so be sure to ask about quests.
** You will now be notified when you have new mail. ** Added furniture for your MUDding comfort.
** You will now be immediately notified when you have new mail, when coming
back from AFK and reconnecting.
** New toggles: autoloot, autogold, autosplit, autosac, and autoassist. ** New toggles: autoloot, autogold, autosplit, autosac, and autoassist.
** Improved toggle command allowing more options. ** Improved toggle command allowing more options.
** You can now use the history command to see the last 100 communications ** You can now use the history command to see a log of all channels.
from all the channels. It clears upon viewing or log off.
** Your mail will now be saved so you will not lose it when you log off. ** Your mail will now be saved so you will not lose it when you log off.
** You can now use the AFK toggle to let people see you are gone under ** NEW AFK toggle that displays in your prompt, under who, and when people
who. look at the room.
** You now have almost 180 stock zones to play. ** You now have almost 180 stock zones to play.
** You can now interact with rooms, mobs, and objects through triggers. ** You can now interact with rooms, mobs, and objects through triggers.
** Multiple objects will now be stacked and preceeded by a quantity so ** Multiple objects will now be stacked and preceeded by a quantity so your
your inventory won't be as long. (3) A waybread. inventory won't be as long. i.e. (3) A waybread.
** Over 100 new socials, and the gemote command to use socials over the ** Over 100 new socials, and the gemote command to use socials over the gossip
gossip channel. Socials can now target bodyparts too, behave. channel. Socials can now target bodyparts too, behave. Check them out and
feel free to suggest new ones.
** You can now use color! @RHELP COLORCODES@n. ** You can now use color! @RHELP COLORCODES@n.
** Added new invisible mobs and objects so everything may not be as it ** Added new invisible mobs and objects so everything may not be as it appears
appears (not even visible with detect invis). (not even visible with detect invis and sense life).
** Added an online dictionary. Tell m-w <word>. ** Added an online dictionary. Tell m-w <word>.
** The player description length has been increased so please write a ** The player description length has been increased so please write a decent
decent description for yourself. description for yourself.
** You can now set your pagelength with the same command. ** You can now set your pagelength!
** You can now "look around" to see anything of interest in the room. But, ** You can now "look around" to see anything of interest in the room. But,
some things may still be hidden and require further investigation. some things may still be hidden and require further investigation.
** You can now use "all" and "all.x" very generally with the get, put, ** You can now use "all" and "all.x" very generally with the get, put, drop,
drop, junk, donate, give, wear and remove commands. Type HELP GET junk, donate, give, wear and remove commands. Type HELP GET for more info.
for more info.
** The "track" function will show you the first step on the shortest ** The "track" function will show you the first step on the shortest path to
path to anyone in the game. anyone in the game.
** You can now remove your own messages from the board. Also, if you ** You can now remove your own messages from the board. Also, if you put
put someone else's name in parentheses in the message header, they someone else's name in parentheses in the message header, they will be
will be able to remove the message too. able to remove the message too.
** The MIDGAARD MAIL SYSTEM is now complete. The Post Office is north ** The MIDGAARD MAIL SYSTEM is now complete. The Post Office is north of the
of the entrance to the Grunting Boar inn. Stamps cost 150 coins. entrance to the Grunting Boar inn. Stamps cost 150 coins.
** Fountains have now been implemented. You can drink from fountains ** Fountains have now been implemented. You can drink from fountains or fill
or fill containers from fountains using the FILL command. containers from fountains using the FILL command.
** The SHOUT command, as always, only reaches people in your zone (you ** The SHOUT command, as always, only reaches people in your zone (you can see
can see who these people are by typing WHERE). The HOLLER command who these people are by typing WHERE). The HOLLER command reaches everyone
reaches everyone in the game but costs extra movement points. in the game but costs extra movement points.
** When you are writing a message, you will now not be interrupted ** When you are writing a message, you will now not be interrupted by tells,
by tells, shouts, emotes, socials, and even people talking in the shouts, emotes, socials, and even people talking in the same room.
same room.
***************************************************************************** *****************************************************************************
IF YOU LEAVE THE GAME FOR MORE THAN AN HOUR, either by renting or plain IF YOU LEAVE THE GAME FOR MORE THAN AN HOUR, either by renting or plain
@ -80,8 +77,8 @@ NEW COMMANDS AND NEW MUD BEHAVIOR:
when you come back! This doesn't work if you're poisoned. when you come back! This doesn't work if you're poisoned.
***************************************************************************** *****************************************************************************
** Use the ASSIST command to engage in mortal combat with someone in the ** Use the ASSIST command to engage in mortal combat with someone in the room
room who is getting pummeled. who is getting pummeled.
** Use the SPLIT command to split gold among the members of your group ** Use the SPLIT command to split gold among the members of your group
(including yourself) who are in the room. i.e. If you are in a group (including yourself) who are in the room. i.e. If you are in a group

View file

@ -26,9 +26,9 @@ 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 aedit.o alias.o \ act.offensive.o act.other.o act.social.o act.wizard.o aedit.o alias.o \
ban.o boards.o bsd-snprintf.o castle.o cedit.o class.o comm.o config.o \ ban.o boards.o bsd-snprintf.o castle.o cedit.o class.o comm.o config.o \
constants.o dg_comm.o dg_db_scripts.o dg_event.o dg_handler.o dg_misc.o \ constants.o context_help.o db.o dg_comm.o dg_db_scripts.o dg_event.o \
dg_mobcmd.o dg_objcmd.o dg_olc.o dg_scripts.o dg_triggers.o \ dg_handler.o dg_misc.o dg_mobcmd.o dg_objcmd.o dg_olc.o dg_scripts.o \
dg_variables.o dg_wldcmd.o db.o context_help.o fight.o genmob.o \ dg_triggers.o dg_variables.o dg_wldcmd.o fight.o genmob.o \
genobj.o genolc.o genshp.o genwld.o genzon.o graph.o handler.o hedit.o \ genobj.o genolc.o genshp.o genwld.o genzon.o graph.o handler.o hedit.o \
house.o improved-edit.o interpreter.o limits.o magic.o mail.o medit.o \ house.o improved-edit.o interpreter.o limits.o magic.o mail.o medit.o \
mobact.o modify.o oasis.o oasis_copy.o oasis_delete.o oasis_list.o \ mobact.o modify.o oasis.o oasis_copy.o oasis_delete.o oasis_list.o \
@ -37,14 +37,17 @@ OBJFILES = act.comm.o act.informative.o act.item.o act.movement.o \
weather.o zedit.o zmalloc.o weather.o zedit.o zmalloc.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 \ act.offensive.c act.other.c act.social.c act.wizard.c aedit.c alias.c \
ban.o boards.c bsd-snprintf.c castle.c cedit.c class.c comm.c config.c \ ban.c boards.c bsd-snprintf.c castle.c cedit.c class.c comm.c config.c \
constants.c db.c fight.c genmob.c genobj.c genolc.c genshp.c genwld.c \ constants.c context_help.c db.c dg_comm.c dg_db_scripts.c dg_event.c \
genzon.c graph.c handler.c hedit.c house.c improved-edit.c \ dg_handler.c dg_misc.c dg_mobcmd.c dg_objcmd.c dg_olc.c dg_scripts.c \
interpreter.c limits.c magic.c mail.c medit.c mobact.c modify.c oasis.c \ dg_triggers.c dg_variables.c dg_wldcmd.c fight.c genmob.c \
oasis_copy.c oasis_delete.c oasis_list.c objsave.c oedit.c olc.c \ genobj.c genolc.c genshp.c genwld.c genzon.c graph.c handler.c hedit.c \
players.c random.c redit.c sedit.c shop.c spec_assign.c spec_procs.c \ house.c improved-edit.c interpreter.c limits.c magic.c mail.c medit.c \
spell_parser.c spells.c tedit.c utils.c weather.c zedit.c mobact.c modify.c oasis.c oasis_copy.c oasis_delete.c oasis_list.c \
objsave.c oedit.c players.c random.c redit.c sedit.c shop.c \
spec_assign.c spec_procs.c spell_parser.c spells.c tedit.c utils.c \
weather.c zedit.c zmalloc.c
default: all default: all

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: act.comm.c Part of CircleMUD * * File: act.comm.c Part of tbaMUD *
* Usage: Player-level communication commands * * Usage: Player-level communication commands. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: act.informative.c Part of CircleMUD * * File: act.informative.c Part of tbaMUD *
* Usage: Player-level commands of an informative nature * * Usage: Player-level commands of an informative nature. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
@ -596,8 +596,8 @@ char *find_exdesc(char *word, struct extra_descr_data *list)
/* Given the argument "look at <target>", figure out what object or char /* Given the argument "look at <target>", figure out what object or char
* matches the target. First, see if there is another char in the room with * matches the target. First, see if there is another char in the room with
* the name. Then check local objs for exdescs. Thanks to Angus Mezick * the name. Then check local objs for exdescs. Thanks to Angus Mezick for
* <angus@EDGIL.CCMAIL.COMPUSERVE.COM> for the suggested fix to this problem. */ * the suggested fix to this problem. */
void look_at_target(struct char_data *ch, char *arg) void look_at_target(struct char_data *ch, char *arg)
{ {
int bits, found = FALSE, j, fnum, i = 0; int bits, found = FALSE, j, fnum, i = 0;
@ -935,11 +935,10 @@ ACMD(do_time)
(time_info.hours % 12 == 0) ? 12 : (time_info.hours % 12), (time_info.hours % 12 == 0) ? 12 : (time_info.hours % 12),
time_info.hours >= 12 ? "pm" : "am", weekdays[weekday]); time_info.hours >= 12 ? "pm" : "am", weekdays[weekday]);
/* Peter Ajamian <peter@PAJAMIAN.DHS.ORG> supplied the following as a fix /* Peter Ajamian supplied the following as a fix for a bug introduced in the
* for a bug introduced in the ordinal display that caused 11, 12, and 13 * ordinal display that caused 11, 12, and 13 to be incorrectly displayed as
* to be incorrectly displayed as 11st, 12nd, and 13rd. Nate Winters * 11st, 12nd, and 13rd. Nate Winters had already submitted a fix, but it
* <wintersn@HOTMAIL.COM> had already submitted a fix, but it hard-coded a * hard-coded a limit on ordinal display which I want to avoid. -dak */
* limit on ordinal display which I want to avoid. -dak */
suf = "th"; suf = "th";
if (((day % 100) / 10) != 1) { if (((day % 100) / 10) != 1) {
@ -1493,7 +1492,7 @@ ACMD(do_gen_ps)
send_to_char(ch, "\033[H\033[J"); send_to_char(ch, "\033[H\033[J");
break; break;
case SCMD_VERSION: case SCMD_VERSION:
send_to_char(ch, "%s\r\n", circlemud_version); send_to_char(ch, "%s\r\n", tbamud_version);
send_to_char(ch, "%s\r\n", oasisolc_version); send_to_char(ch, "%s\r\n", oasisolc_version);
send_to_char(ch, "%s\r\n", DG_SCRIPT_VERSION); send_to_char(ch, "%s\r\n", DG_SCRIPT_VERSION);
send_to_char(ch, "%s\r\n", ascii_pfiles_version); send_to_char(ch, "%s\r\n", ascii_pfiles_version);
@ -1503,14 +1502,12 @@ ACMD(do_gen_ps)
break; break;
default: default:
log("SYSERR: Unhandled case in do_gen_ps. (%d)", subcmd); log("SYSERR: Unhandled case in do_gen_ps. (%d)", subcmd);
/* SYSERR_DESC: /* SYSERR_DESC: General page string function for such things as 'credits',
* General page string function for such things as 'credits', 'news', * 'news', 'wizlist', 'clear', 'version'. This occurs when a call is made
* 'wizlist', 'clear', 'version'. This occurs when a call is made to * to this routine that is not one of the predefined calls. To correct it,
* this routine that is not one of the predefined calls. To correct * either a case needs to be added into the function to account for the
* it, either a case needs to be added into the function to account for * subcmd that is being passed to it, or the call to the function needs to
* the subcmd that is being passed to it, or the call to the function * have the correct subcmd put into place. */
* needs to have the correct subcmd put into place.
*/
return; return;
} }
} }

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: act.item.c Part of CircleMUD * * File: act.item.c Part of tbaMUD *
* Usage: object handling routines -- get/drop and container handling * * Usage: Object handling routines -- get/drop and container handling. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: act.movement.c Part of CircleMUD * * File: act.movement.c Part of tbaMUD *
* Usage: movement commands, door handling, & sleep/rest/etc state * * Usage: Movement commands, door handling, & sleep/rest/etc state. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: act.offensive.c Part of CircleMUD * * File: act.offensive.c Part of tbaMUD *
* Usage: player-level commands of an offensive nature * * Usage: Player-level commands of an offensive nature. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: act.other.c * * File: act.other.c Part of tbaMUD *
* Usage: Miscellaneous player-level commands * * Usage: Miscellaneous player-level commands. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#define __ACT_OTHER_C__ #define __ACT_OTHER_C__

View file

@ -1,17 +1,15 @@
/* ************************************************************************ /**************************************************************************
* File: act.social.c Part of CircleMUD * * File: act.social.c Part of tbaMUD *
* Usage: Functions to handle socials * * Usage: Functions to handle socials. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#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"

View file

@ -1,12 +1,12 @@
/************************************************************************** /**************************************************************************
* File: act.wizard.c Part of CircleMUD * * File: act.wizard.c Part of tbaMUD *
* Usage: Player-level god commands and other goodies * * Usage: Player-level god commands and other goodies. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
@ -247,7 +247,7 @@ room_rnum find_target_room(struct char_data *ch, char *rawroomstr)
} }
} }
/* a location has been found -- if you're >= GRGOD, no restrictions. */ /* A location has been found -- if you're >= GRGOD, no restrictions. */
if (GET_LEVEL(ch) >= LVL_GRGOD) if (GET_LEVEL(ch) >= LVL_GRGOD)
return (location); return (location);
@ -718,9 +718,6 @@ void do_stat_object(struct char_data *ch, struct obj_data *j)
case ITEM_ARMOR: case ITEM_ARMOR:
send_to_char(ch, "AC-apply: [%d]\r\n", GET_OBJ_VAL(j, 0)); send_to_char(ch, "AC-apply: [%d]\r\n", GET_OBJ_VAL(j, 0));
break; break;
case ITEM_TRAP:
send_to_char(ch, "Spell: %d, - Hitpoints: %d\r\n", GET_OBJ_VAL(j, 0), GET_OBJ_VAL(j, 1));
break;
case ITEM_CONTAINER: case ITEM_CONTAINER:
sprintbit(GET_OBJ_VAL(j, 1), container_bits, buf, sizeof(buf)); sprintbit(GET_OBJ_VAL(j, 1), container_bits, buf, sizeof(buf));
send_to_char(ch, "Weight capacity: %d, Lock Type: %s, Key Num: %d, Corpse: %s\r\n", send_to_char(ch, "Weight capacity: %d, Lock Type: %s, Key Num: %d, Corpse: %s\r\n",
@ -1800,25 +1797,23 @@ struct last_entry *find_llog_entry(int punique, long idnum) {
int size,recs,tmp; int size,recs,tmp;
if(!(fp=fopen(LAST_FILE,"r"))) { if(!(fp=fopen(LAST_FILE,"r"))) {
log("error opening last_file for reading"); log("Error opening last_file for reading, will create.");
return NULL; return NULL;
} }
fseek(fp,0L,SEEK_END); fseek(fp,0L,SEEK_END);
size=ftell(fp); size=ftell(fp);
/* recs = number of records in the last file */ /* recs = number of records in the last file */
recs = size/sizeof(struct last_entry); recs = size/sizeof(struct last_entry);
/* we'll search last to first, since it's faster than any thing else /* we'll search last to first, since it's faster than any thing else we can
we can do (like searching for the last shutdown/etc..) */ * do (like searching for the last shutdown/etc..) */
for(tmp=recs-1; tmp > 0; tmp--) { for(tmp=recs-1; tmp > 0; tmp--) {
fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR); fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR);
fread(&mlast,sizeof(struct last_entry),1,fp); fread(&mlast,sizeof(struct last_entry),1,fp);
/*another one to keep that stepback */ /*another one to keep that stepback */
fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR); fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR);
if(mlast.idnum == idnum && if(mlast.idnum == idnum && mlast.punique == punique) {
mlast.punique == punique) {
/* then we've found a match */ /* then we've found a match */
CREATE(llast,struct last_entry,1); CREATE(llast,struct last_entry,1);
memcpy(llast,&mlast,sizeof(struct last_entry)); memcpy(llast,&mlast,sizeof(struct last_entry));
@ -1839,14 +1834,13 @@ void mod_llog_entry(struct last_entry *llast,int type) {
int size,recs,tmp; int size,recs,tmp;
if(!(fp=fopen(LAST_FILE,"r+"))) { if(!(fp=fopen(LAST_FILE,"r+"))) {
log("error opening last_file for reading and writing"); log("Error opening last_file for reading and writing.");
return; return;
} }
fseek(fp,0L,SEEK_END); fseek(fp,0L,SEEK_END);
size=ftell(fp); size=ftell(fp);
/* recs = number of records in the last file */ /* recs = number of records in the last file */
recs = size/sizeof(struct last_entry); recs = size/sizeof(struct last_entry);
/* We'll search last to first, since it's faster than any thing else we can /* We'll search last to first, since it's faster than any thing else we can
@ -1854,14 +1848,12 @@ void mod_llog_entry(struct last_entry *llast,int type) {
for(tmp=recs; tmp > 0; tmp--) { for(tmp=recs; tmp > 0; tmp--) {
fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR); fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR);
fread(&mlast,sizeof(struct last_entry),1,fp); fread(&mlast,sizeof(struct last_entry),1,fp);
/*another one to keep that stepback */ /* Another one to keep that stepback. */
fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR); fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR);
if(mlast.idnum == llast->idnum && if(mlast.idnum == llast->idnum && mlast.punique == llast->punique) {
mlast.punique == llast->punique) { /* Then we've found a match, lets assume quit is inviolate, mainly
/* then we've found a match */ * because disconnect is called after each of these */
/* lets assume quit is inviolate, mainly because
disconnect is called after each of these */
if(mlast.close_type != LAST_QUIT && if(mlast.close_type != LAST_QUIT &&
mlast.close_type != LAST_IDLEOUT && mlast.close_type != LAST_IDLEOUT &&
mlast.close_type != LAST_REBOOT && mlast.close_type != LAST_REBOOT &&
@ -1874,11 +1866,11 @@ void mod_llog_entry(struct last_entry *llast,int type) {
fclose(fp); fclose(fp);
return; return;
} }
/*not the one we seek. next */ /* Not the one we seek, next. */
} }
fclose(fp); fclose(fp);
/*not found, no problem, quit */ /* Not found, no problem, quit. */
return; return;
} }
@ -1971,12 +1963,8 @@ ACMD(do_list_llog_entries) {
fread(&llast, sizeof(struct last_entry), 1, fp); fread(&llast, sizeof(struct last_entry), 1, fp);
while(!feof(fp)) { while(!feof(fp)) {
send_to_char(ch, send_to_char(ch, "%10s\t%d\t%s\t%s", llast.username, llast.punique,
"%10s\t%d\t%s\t%s", last_array[llast.close_type], ctime(&llast.time));
llast.username,
llast.punique,
last_array[llast.close_type],
ctime(&llast.time));
fread(&llast, sizeof(struct last_entry), 1, fp); fread(&llast, sizeof(struct last_entry), 1, fp);
} }
} }
@ -2711,7 +2699,7 @@ ACMD(do_show)
{ "frozen", LVL_GRGOD, 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 }, { "hitpoints", LVL_BUILDER, BOTH, NUMBER },
{ "hitroll", LVL_BUILDER, BOTH, NUMBER }, { "hitroll", LVL_BUILDER, BOTH, NUMBER },
{ "hunger", LVL_BUILDER, BOTH, MISC }, /* 20 */ { "hunger", LVL_BUILDER, BOTH, MISC }, /* 20 */
{ "int", LVL_BUILDER, BOTH, NUMBER }, { "int", LVL_BUILDER, BOTH, NUMBER },
@ -3966,7 +3954,7 @@ ACMD(do_checkloadstatus)
} }
/* Zone Checker code above. */ /* Zone Checker code above. */
/* (c) 1996-97 Erwin S. Andreasen <erwin@pip.dknet.dk> */ /* (c) 1996-97 Erwin S. Andreasen. */
ACMD(do_copyover) ACMD(do_copyover)
{ {
FILE *fp; FILE *fp;

View file

@ -1,10 +1,8 @@
/* /**************************************************************************
* File: aedit.c * File: aedit.c Part of tbaMUD *
* Comment: OLC for MUDs -- this one edits socials * Usage: OLC for MUDs -- this one edits socials. *
* by Michael Scott <scottm@workcomm.net> -- 06/10/96 * by Michael Scott *
* for use with OasisOLC **************************************************************************/
* ftpable from ftp.circlemud.org:/pub/CircleMUD/contrib/code
*/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
@ -34,7 +32,6 @@ void aedit_save_internally(struct descriptor_data *d);
void aedit_save_to_disk(struct descriptor_data *d); void aedit_save_to_disk(struct descriptor_data *d);
/* Utils and exported functions. */ /* Utils and exported functions. */
ACMD(do_oasis_aedit) ACMD(do_oasis_aedit)
{ {
char arg[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH];
@ -314,7 +311,6 @@ void aedit_disp_menu(struct descriptor_data * d) {
OLC_MODE(d) = AEDIT_MAIN_MENU; OLC_MODE(d) = AEDIT_MAIN_MENU;
} }
/* The main loop. */ /* The main loop. */
void aedit_parse(struct descriptor_data * d, char *arg) { void aedit_parse(struct descriptor_data * d, char *arg) {
int i; int i;

View file

@ -1,13 +1,11 @@
/* *********************************************************************** /*************************************************************************
* File: alias.c A utility to CircleMUD * * File: alias.c Part of tbaMUD *
* Usage: writing/reading player's aliases. * * Usage: Writing/reading player's aliases. *
* *
* Code done by Jeremy Hess and Chad Thompson *
* Modifed by George Greer for inclusion into CircleMUD bpl15. *
* * * *
* 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. *
*********************************************************************** */ * by Jeremy Hess, Chad Thompson, and George Greer *
**************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
@ -34,11 +32,9 @@ void write_aliases(struct char_data *ch)
if ((file = fopen(fn, "w")) == NULL) { if ((file = fopen(fn, "w")) == NULL) {
log("SYSERR: Couldn't save aliases for %s in '%s': %s", GET_NAME(ch), fn, strerror(errno)); log("SYSERR: Couldn't save aliases for %s in '%s': %s", GET_NAME(ch), fn, strerror(errno));
/* SYSERR_DESC: /* SYSERR_DESC: This error occurs when the server fails to open the relevant
* This error occurs when the server fails to open the relevant alias * alias file for writing. The text at the end of the error should give a
* file for writing. The text at the end of the error should give a * valid reason why. */
* valid reason why.
*/
return; return;
} }
@ -69,11 +65,9 @@ void read_aliases(struct char_data *ch)
if ((file = fopen(xbuf, "r")) == NULL) { if ((file = fopen(xbuf, "r")) == NULL) {
if (errno != ENOENT) { if (errno != ENOENT) {
log("SYSERR: Couldn't open alias file '%s' for %s: %s", xbuf, GET_NAME(ch), strerror(errno)); log("SYSERR: Couldn't open alias file '%s' for %s: %s", xbuf, GET_NAME(ch), strerror(errno));
/* SYSERR_DESC: /* SYSERR_DESC: This error occurs when the server fails to open the
* This error occurs when the server fails to open the relevant alias * relevant alias file for reading. The text at the end version should
* file for reading. The text at the end version should give a valid * give a valid reason why. */
* reason why.
*/
} }
return; return;
} }
@ -132,15 +126,12 @@ void delete_aliases(const char *charname)
if (remove(filename) < 0 && errno != ENOENT) if (remove(filename) < 0 && errno != ENOENT)
log("SYSERR: deleting alias file %s: %s", filename, strerror(errno)); log("SYSERR: deleting alias file %s: %s", filename, strerror(errno));
/* SYSERR_DESC: /* SYSERR_DESC: When an alias file cannot be removed, this error will occur,
* When an alias file cannot be removed, this error will occur, * and the reason why will be the tail end of the error. */
* and the reason why will be the tail end of the error.
*/
} }
/* until further notice, the alias->pfiles save and load functions will
// until further notice, the alias->pfiles save and load functions will function * function along side the old seperate alias file load, for compatibility. */
// along side the old seperate alias file load, for compatibility.
void write_aliases_ascii(FILE *file, struct char_data *ch) void write_aliases_ascii(FILE *file, struct char_data *ch)
{ {
struct alias_data *temp; struct alias_data *temp;
@ -153,11 +144,9 @@ void write_aliases_ascii(FILE *file, struct char_data *ch)
count++; count++;
fprintf(file, "Alis: %d\n", count); fprintf(file, "Alis: %d\n", count);
// the +1 thing below is due to alias replacements having /* the +1 thing below is due to alias replacements having a space prepended
// a space prepended in memory. The reason for this escapes me. * in memory. The reason for this escapes me. Welcor 27/12/06 */
// Welcor 27/12/06
for (temp = GET_ALIASES(ch); temp; temp = temp->next) { for (temp = GET_ALIASES(ch); temp; temp = temp->next) {
fprintf(file, "%s\n" /* Alias */ fprintf(file, "%s\n" /* Alias */
"%s\n" /* Replacement */ "%s\n" /* Replacement */
"%d\n", /* Type */ "%d\n", /* Type */
@ -175,7 +164,7 @@ void read_aliases_ascii(FILE *file, struct char_data *ch, int count)
if (count == 0) { if (count == 0) {
GET_ALIASES(ch) = NULL; GET_ALIASES(ch) = NULL;
return; // no aliases in the list return; /* No aliases in the list. */
} }
for (i = 0; i < count; i++) { for (i = 0; i < count; i++) {
@ -185,13 +174,12 @@ void read_aliases_ascii(FILE *file, struct char_data *ch, int count)
/* Read the replacement. */ /* Read the replacement. */
get_line(file, tbuf); get_line(file, tbuf);
strcpy(rbuf, " "); strcpy(rbuf, " ");
strcat(rbuf, tbuf); // strcat: OK strcat(rbuf, tbuf); /* strcat: OK */
/* read the type */ /* read the type */
get_line(file, tbuf); get_line(file, tbuf);
if (abuf && *abuf && tbuf && *tbuf && rbuf && *rbuf) if (abuf && *abuf && tbuf && *tbuf && rbuf && *rbuf) {
{
CREATE(temp, struct alias_data, 1); CREATE(temp, struct alias_data, 1);
temp->alias = strdup(abuf); temp->alias = strdup(abuf);
temp->replacement = strdup(rbuf); temp->replacement = strdup(rbuf);
@ -200,5 +188,4 @@ void read_aliases_ascii(FILE *file, struct char_data *ch, int count)
GET_ALIASES(ch) = temp; GET_ALIASES(ch) = temp;
} }
} }
} }

View file

@ -1,17 +1,15 @@
/* ************************************************************************ /**************************************************************************
* File: ban.c Part of CircleMUD * * File: ban.c Part of tbaMUD *
* Usage: banning/unbanning/checking sites and player names * * Usage: Banning/unbanning/checking sites and player names. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#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"
@ -29,10 +27,9 @@ void _write_one_node(FILE *fp, struct ban_list_element *node);
void write_ban_list(void); void write_ban_list(void);
ACMD(do_ban); ACMD(do_ban);
ACMD(do_unban); ACMD(do_unban);
int Valid_Name(char *newname); int valid_name(char *newname);
void Read_Invalid_List(void); void read_invalid_list(void);
void Free_Invalid_List(void); void free_invalid_list(void);
const char *ban_types[] = { const char *ban_types[] = {
"no", "no",
@ -42,7 +39,6 @@ const char *ban_types[] = {
"ERROR" "ERROR"
}; };
void load_banned(void) void load_banned(void)
{ {
FILE *fl; FILE *fl;
@ -79,7 +75,6 @@ void load_banned(void)
fclose(fl); fclose(fl);
} }
int isbanned(char *hostname) int isbanned(char *hostname)
{ {
int i; int i;
@ -100,7 +95,6 @@ int isbanned(char *hostname)
return (i); return (i);
} }
void _write_one_node(FILE *fp, struct ban_list_element *node) void _write_one_node(FILE *fp, struct ban_list_element *node)
{ {
if (node) { if (node) {
@ -110,8 +104,6 @@ void _write_one_node(FILE *fp, struct ban_list_element *node)
} }
} }
void write_ban_list(void) void write_ban_list(void)
{ {
FILE *fl; FILE *fl;
@ -125,7 +117,6 @@ void write_ban_list(void)
return; return;
} }
#define BAN_LIST_FORMAT "%-25.25s %-8.8s %-10.10s %-16.16s\r\n" #define BAN_LIST_FORMAT "%-25.25s %-8.8s %-10.10s %-16.16s\r\n"
ACMD(do_ban) ACMD(do_ban)
{ {
@ -201,7 +192,6 @@ ACMD(do_ban)
} }
#undef BAN_LIST_FORMAT #undef BAN_LIST_FORMAT
ACMD(do_unban) ACMD(do_unban)
{ {
char site[MAX_INPUT_LENGTH]; char site[MAX_INPUT_LENGTH];
@ -234,48 +224,38 @@ ACMD(do_unban)
write_ban_list(); write_ban_list();
} }
/* Check for invalid names (i.e., profanity, etc.) Written by Sharon P Garza. */
/**************************************************************************
* Code to check for invalid names (i.e., profanity, etc.) *
* Written by Sharon P. Goza *
**************************************************************************/
#define MAX_INVALID_NAMES 200 #define MAX_INVALID_NAMES 200
char *invalid_list[MAX_INVALID_NAMES]; char *invalid_list[MAX_INVALID_NAMES];
int num_invalid = 0; int num_invalid = 0;
int Valid_Name(char *newname) int valid_name(char *newname)
{ {
int i, wovels = 0; int i, vowels = 0;
struct descriptor_data *dt; struct descriptor_data *dt;
char tempname[MAX_INPUT_LENGTH]; char tempname[MAX_INPUT_LENGTH];
/* /* Make sure someone isn't trying to create this same name. We want to do a
* Make sure someone isn't trying to create this same name. We want to * 'str_cmp' so people can't do 'Bob' and 'BoB'. The creating login will not
* do a 'str_cmp' so people can't do 'Bob' and 'BoB'. The creating login * have a character name yet and other people sitting at the prompt won't
* will not have a character name yet and other people sitting at the * have characters yet. New, unindexed characters (i.e., characters who are
* prompt won't have characters yet. * in the process of creating) will have an idnum of -1, set by clear_char()
* * in db.c. If someone is creating a character by the same name as the one
* New, unindexed characters (i.e., characters who are in the process of creating) * we are checking, then the name is invalid, to prevent character duping.
* will have an idnum of -1, set by clear_char() in db.c. If someone is creating a * THIS SHOULD FIX THE 'invalid name' if disconnected from OLC-bug - Welcor */
* character by the same name as the one we are checking, then the name is invalid,
* to prevent character duping.
* THIS SHOULD FIX THE 'invalid name' if disconnected from OLC-bug - WELCOR 9/00
*/
for (dt = descriptor_list; dt; dt = dt->next) for (dt = descriptor_list; dt; dt = dt->next)
if (dt->character && GET_NAME(dt->character) && !str_cmp(GET_NAME(dt->character), newname)) if (dt->character && GET_NAME(dt->character) && !str_cmp(GET_NAME(dt->character), newname))
if (GET_IDNUM(dt->character) == -1) if (GET_IDNUM(dt->character) == -1)
return (IS_PLAYING(dt)); return (IS_PLAYING(dt));
/* count wovels */ /* count vowels */
for (i = 0; newname[i]; i++) { for (i = 0; newname[i]; i++) {
if (strchr("aeiouyAEIOUY", newname[i])) if (strchr("aeiouyAEIOUY", newname[i]))
wovels++; vowels++;
} }
/* return invalid if no wovels */ /* return invalid if no vowels */
if (!wovels) if (!vowels)
return (0); return (0);
/* return valid if list doesn't exist */ /* return valid if list doesn't exist */
@ -295,9 +275,7 @@ int Valid_Name(char *newname)
return (1); return (1);
} }
void free_invalid_list(void)
/* What's with the wacky capitalization in here? */
void Free_Invalid_List(void)
{ {
int invl; int invl;
@ -307,8 +285,7 @@ void Free_Invalid_List(void)
num_invalid = 0; num_invalid = 0;
} }
void read_invalid_list(void)
void Read_Invalid_List(void)
{ {
FILE *fp; FILE *fp;
char temp[256]; char temp[256];

View file

@ -1,53 +1,35 @@
/* ************************************************************************ /**************************************************************************
* File: boards.c Part of CircleMUD * * File: boards.c Part of tbaMUD *
* Usage: handling of multiple bulletin boards * * Usage: Handling of multiple bulletin boards. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
/* FEATURES & INSTALLATION INSTRUCTIONS ***********************************
This board code has many improvements over the infamously buggy standard
Diku board code. Features include:
- Arbitrary number of boards handled by one set of generalized routines.
Adding a new board is as easy as adding another entry to an array.
- Safe removal of messages while other messages are being written.
- Does not allow messages to be removed by someone of a level less than
the poster's level.
TO ADD A NEW BOARD, simply follow our easy 4-step program:
1 - Create a new board object in the object files
2 - Increase the NUM_OF_BOARDS constant in boards.h
3 - Add a new line to the board_info array below. The fields, in order, are:
Board's virtual number.
Min level one must be to look at this board or read messages on it.
Min level one must be to post a message to the board.
Min level one must be to remove other people's messages from this
board (but you can always remove your own message).
Filename of this board, in quotes.
Last field must always be 0.
4 - In spec_assign.c, find the section which assigns the special procedure
gen_board to the other bulletin boards, and add your new one in a
similar fashion.
*/
/* FEATURES & INSTALLATION INSTRUCTIONS
* - Arbitrary number of boards handled by one set of generalized routines.
* Adding a new board is as easy as adding another entry to an array.
* - Safe removal of messages while other messages are being written.
*
* TO ADD A NEW BOARD, simply follow our easy 4-step program:
* 1 - Create a new board object in the object files.
* 2 - Increase the NUM_OF_BOARDS constant in boards.h.
* 3 - Add a new line to the board_info array below. The fields are:
* Board's virtual number.
* Min level one must be to look at this board or read messages on it.
* Min level one must be to post a message to the board.
* Min level one must be to remove other people's messages from this
* board (but you can always remove your own message).
* Filename of this board, in quotes.
* Last field must always be 0.
* 4 - In spec_assign.c, find the section which assigns the special procedure
* gen_board to the other bulletin boards, and add your new one in a
* similar fashion. */
#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"
@ -60,10 +42,8 @@ TO ADD A NEW BOARD, simply follow our easy 4-step program:
/* Board appearance order. */ /* Board appearance order. */
#define NEWEST_AT_TOP FALSE #define NEWEST_AT_TOP FALSE
/* /* Format: vnum, read lvl, write lvl, remove lvl, filename, 0 at end. Be sure
format: vnum, read lvl, write lvl, remove lvl, filename, 0 at end * to also change NUM_OF_BOARDS in board.h*/
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},
@ -84,9 +64,8 @@ int msg_storage_taken[INDEX_SIZE];
int num_of_msgs[NUM_OF_BOARDS]; int num_of_msgs[NUM_OF_BOARDS];
int ACMD_READ, ACMD_LOOK, ACMD_EXAMINE, ACMD_WRITE, ACMD_REMOVE; int ACMD_READ, ACMD_LOOK, ACMD_EXAMINE, ACMD_WRITE, ACMD_REMOVE;
struct board_msginfo msg_index[NUM_OF_BOARDS][MAX_BOARD_MESSAGES]; struct board_msginfo msg_index[NUM_OF_BOARDS][MAX_BOARD_MESSAGES];
void Board_reset_board(int board_type); void board_reset_board(int board_type);
void Board_clear_board(int board_type); void board_clear_board(int board_type);
int find_slot(void) int find_slot(void)
{ {
@ -100,7 +79,6 @@ int find_slot(void)
return (-1); return (-1);
} }
/* search the room ch is standing in to find which board he's looking at */ /* search the room ch is standing in to find which board he's looking at */
int find_board(struct char_data *ch) int find_board(struct char_data *ch)
{ {
@ -121,7 +99,6 @@ int find_board(struct char_data *ch)
return (-1); return (-1);
} }
void init_boards(void) void init_boards(void)
{ {
int i, j, fatal_error = 0; int i, j, fatal_error = 0;
@ -142,14 +119,13 @@ void init_boards(void)
memset((char *) &(msg_index[i][j]), 0, sizeof(struct board_msginfo)); memset((char *) &(msg_index[i][j]), 0, sizeof(struct board_msginfo));
msg_index[i][j].slot_num = -1; msg_index[i][j].slot_num = -1;
} }
Board_load_board(i); board_load_board(i);
} }
// if (fatal_error) if (fatal_error)
// exit(1); exit(1);
} }
SPECIAL(gen_board) SPECIAL(gen_board)
{ {
int board_type; int board_type;
@ -178,19 +154,18 @@ SPECIAL(gen_board)
return (0); return (0);
} }
if (cmd == ACMD_WRITE) if (cmd == ACMD_WRITE)
return (Board_write_message(board_type, ch, argument, board)); return (board_write_message(board_type, ch, argument, board));
else if (cmd == ACMD_LOOK || cmd == ACMD_EXAMINE) else if (cmd == ACMD_LOOK || cmd == ACMD_EXAMINE)
return (Board_show_board(board_type, ch, argument, board)); return (board_show_board(board_type, ch, argument, board));
else if (cmd == ACMD_READ) else if (cmd == ACMD_READ)
return (Board_display_msg(board_type, ch, argument, board)); return (board_display_msg(board_type, ch, argument, board));
else if (cmd == ACMD_REMOVE) else if (cmd == ACMD_REMOVE)
return (Board_remove_msg(board_type, ch, argument, board)); return (board_remove_msg(board_type, ch, argument, board));
else else
return (0); return (0);
} }
int board_write_message(int board_type, struct char_data *ch, char *arg, struct obj_data *board)
int Board_write_message(int board_type, struct char_data *ch, char *arg, struct obj_data *board)
{ {
time_t ct; time_t ct;
char buf[MAX_INPUT_LENGTH], buf2[MAX_NAME_LENGTH + 3], tmstr[MAX_STRING_LENGTH]; char buf[MAX_INPUT_LENGTH], buf2[MAX_NAME_LENGTH + 3], tmstr[MAX_STRING_LENGTH];
@ -212,7 +187,7 @@ int Board_write_message(int board_type, struct char_data *ch, char *arg, struct
skip_spaces(&arg); skip_spaces(&arg);
delete_doubledollar(arg); delete_doubledollar(arg);
/* JE 27 Oct 95 - Truncate headline at 80 chars if it's longer than that */ /* JE Truncate headline at 80 chars if it's longer than that. */
arg[80] = '\0'; arg[80] = '\0';
if (!*arg) { if (!*arg) {
@ -238,8 +213,7 @@ int Board_write_message(int board_type, struct char_data *ch, char *arg, struct
return (1); return (1);
} }
int board_show_board(int board_type, struct char_data *ch, char *arg, struct obj_data *board)
int Board_show_board(int board_type, struct char_data *ch, char *arg, struct obj_data *board)
{ {
int i; int i;
char tmp[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH]; char tmp[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH];
@ -300,8 +274,7 @@ fubar:
return (1); return (1);
} }
int board_display_msg(int board_type, struct char_data *ch, char *arg, struct obj_data *board)
int Board_display_msg(int board_type, struct char_data *ch, char *arg, struct obj_data *board)
{ {
char number[MAX_INPUT_LENGTH], buffer[MAX_STRING_LENGTH]; char number[MAX_INPUT_LENGTH], buffer[MAX_STRING_LENGTH];
int msg, ind; int msg, ind;
@ -310,7 +283,7 @@ int Board_display_msg(int board_type, struct char_data *ch, char *arg, struct ob
if (!*number) if (!*number)
return (0); return (0);
if (isname(number, board->name)) /* so "read board" works */ if (isname(number, board->name)) /* so "read board" works */
return (Board_show_board(board_type, ch, arg, board)); return (board_show_board(board_type, ch, arg, board));
if (!is_number(number)) /* read 2.mail, look 2.sword */ if (!is_number(number)) /* read 2.mail, look 2.sword */
return (0); return (0);
if (!(msg = atoi(number))) if (!(msg = atoi(number)))
@ -356,8 +329,7 @@ int Board_display_msg(int board_type, struct char_data *ch, char *arg, struct ob
return (1); return (1);
} }
int board_remove_msg(int board_type, struct char_data *ch, char *arg, struct obj_data *board)
int Board_remove_msg(int board_type, struct char_data *ch, char *arg, struct obj_data *board)
{ {
int ind, msg, slot_num; int ind, msg, slot_num;
char number[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH]; char number[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH];
@ -425,13 +397,12 @@ int Board_remove_msg(int board_type, struct char_data *ch, char *arg, struct obj
send_to_char(ch, "Message removed.\r\n"); send_to_char(ch, "Message removed.\r\n");
snprintf(buf, sizeof(buf), "$n just removed message %d.", msg); snprintf(buf, sizeof(buf), "$n just removed message %d.", msg);
act(buf, FALSE, ch, 0, 0, TO_ROOM); act(buf, FALSE, ch, 0, 0, TO_ROOM);
Board_save_board(board_type); board_save_board(board_type);
return (1); return (1);
} }
void board_save_board(int board_type)
void Board_save_board(int board_type)
{ {
FILE *fl; FILE *fl;
int i; int i;
@ -470,8 +441,7 @@ void Board_save_board(int board_type)
fclose(fl); fclose(fl);
} }
void board_load_board(int board_type)
void Board_load_board(int board_type)
{ {
FILE *fl; FILE *fl;
int i, len1, len2; int i, len1, len2;
@ -485,14 +455,14 @@ void Board_load_board(int board_type)
fread(&(num_of_msgs[board_type]), sizeof(int), 1, fl); fread(&(num_of_msgs[board_type]), sizeof(int), 1, fl);
if (num_of_msgs[board_type] < 1 || num_of_msgs[board_type] > MAX_BOARD_MESSAGES) { if (num_of_msgs[board_type] < 1 || num_of_msgs[board_type] > MAX_BOARD_MESSAGES) {
log("SYSERR: Board file %d corrupt. Resetting.", board_type); log("SYSERR: Board file %d corrupt. Resetting.", board_type);
Board_reset_board(board_type); board_reset_board(board_type);
return; return;
} }
for (i = 0; i < num_of_msgs[board_type]; i++) { for (i = 0; i < num_of_msgs[board_type]; i++) {
fread(&(msg_index[board_type][i]), sizeof(struct board_msginfo), 1, fl); fread(&(msg_index[board_type][i]), sizeof(struct board_msginfo), 1, fl);
if ((len1 = msg_index[board_type][i].heading_len) <= 0) { if ((len1 = msg_index[board_type][i].heading_len) <= 0) {
log("SYSERR: Board file %d corrupt! Resetting.", board_type); log("SYSERR: Board file %d corrupt! Resetting.", board_type);
Board_reset_board(board_type); board_reset_board(board_type);
return; return;
} }
CREATE(tmp1, char, len1); CREATE(tmp1, char, len1);
@ -501,7 +471,7 @@ void Board_load_board(int board_type)
if ((MSG_SLOTNUM(board_type, i) = find_slot()) == -1) { if ((MSG_SLOTNUM(board_type, i) = find_slot()) == -1) {
log("SYSERR: Out of slots booting board %d! Resetting...", board_type); log("SYSERR: Out of slots booting board %d! Resetting...", board_type);
Board_reset_board(board_type); board_reset_board(board_type);
return; return;
} }
if ((len2 = msg_index[board_type][i].message_len) > 0) { if ((len2 = msg_index[board_type][i].message_len) > 0) {
@ -515,19 +485,17 @@ void Board_load_board(int board_type)
fclose(fl); fclose(fl);
} }
/* When shutting down, clear all boards. */ /* When shutting down, clear all boards. */
void Board_clear_all(void) void board_clear_all(void)
{ {
int i; int i;
for (i = 0; i < NUM_OF_BOARDS; i++) for (i = 0; i < NUM_OF_BOARDS; i++)
Board_clear_board(i); board_clear_board(i);
} }
/* Clear the in-memory structures. */ /* Clear the in-memory structures. */
void Board_clear_board(int board_type) void board_clear_board(int board_type)
{ {
int i; int i;
@ -545,10 +513,9 @@ void Board_clear_board(int board_type)
num_of_msgs[board_type] = 0; num_of_msgs[board_type] = 0;
} }
/* Destroy the on-disk and in-memory board. */ /* Destroy the on-disk and in-memory board. */
void Board_reset_board(int board_type) void board_reset_board(int board_type)
{ {
Board_clear_board(board_type); board_clear_board(board_type);
remove(FILENAME(board_type)); remove(FILENAME(board_type));
} }

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: boards.h Part of CircleMUD * * File: boards.h Part of tbaMUD *
* Usage: header file for bulletin boards * * Usage: header file for bulletin boards *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#define NUM_OF_BOARDS 10 /* change if needed! */ #define NUM_OF_BOARDS 10 /* change if needed! */
#define MAX_BOARD_MESSAGES 60 /* arbitrary -- change if needed */ #define MAX_BOARD_MESSAGES 60 /* arbitrary -- change if needed */
@ -45,10 +45,10 @@ struct board_info_type {
#define MSG_SLOTNUM(i, j) (msg_index[i][j].slot_num) #define MSG_SLOTNUM(i, j) (msg_index[i][j].slot_num)
#define MSG_LEVEL(i, j) (msg_index[i][j].level) #define MSG_LEVEL(i, j) (msg_index[i][j].level)
int Board_display_msg(int board_type, struct char_data *ch, char *arg, struct obj_data *board); int board_display_msg(int board_type, struct char_data *ch, char *arg, struct obj_data *board);
int Board_show_board(int board_type, struct char_data *ch, char *arg, struct obj_data *board); int board_show_board(int board_type, struct char_data *ch, char *arg, struct obj_data *board);
int Board_remove_msg(int board_type, struct char_data *ch, char *arg, struct obj_data *board); int board_remove_msg(int board_type, struct char_data *ch, char *arg, struct obj_data *board);
int Board_write_message(int board_type, struct char_data *ch, char *arg, struct obj_data *board); int board_write_message(int board_type, struct char_data *ch, char *arg, struct obj_data *board);
void Board_save_board(int board_type); void board_save_board(int board_type);
void Board_load_board(int board_type); void board_load_board(int board_type);
void Board_clear_all(void); void board_clear_all(void);

View file

@ -1,5 +1,9 @@
/* /**************************************************************************
* This file taken from openbsd-compat of OpenSSH 3.1. It is only used * File: bsd-snprintf.c Part of tbaMUD *
* Usage: Used if your OS does not provide snprintf() or vsnprintf(). *
**************************************************************************/
/* This file taken from openbsd-compat of OpenSSH 3.1. It is only used
* if your operating system does not provide snprintf() or vsnprintf(). * if your operating system does not provide snprintf() or vsnprintf().
* *
* --- 8< --- OpenSSH LICENSE --- 8< --- * --- 8< --- OpenSSH LICENSE --- 8< ---

View file

@ -1,5 +1,9 @@
/* /**************************************************************************
* This file taken from openbsd-compat of OpenSSH 3.1: * File: bsd-snprintf.h Part of tbaMUD *
* Usage: Used if your OS does not provide snprintf() or vsnprintf(). *
**************************************************************************/
/* This file taken from openbsd-compat of OpenSSH 3.1:
* *
* --- 8< --- OpenSSH LICENSE --- 8< --- * --- 8< --- OpenSSH LICENSE --- 8< ---
* Remaining components of the software are provided under a standard * Remaining components of the software are provided under a standard

View file

@ -1,18 +1,15 @@
/* ************************************************************************ /**************************************************************************
* File: castle.c Part of CircleMUD * * File: castle.c Part of tbaMUD *
* Usage: Special procedures for King's Castle area * * Usage: Special procedures for King's Castle area. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license for complete information. *
* * * *
* Special procedures for Kings Castle by Pjotr (d90-pem@nada.kth.se) * * Special procedures for Kings Castle by Pjotr. Coded by Sapowox. *
* Coded by Sapowox (d90-jkr@nada.kth.se) *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */ **************************************************************************/
#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"
@ -21,16 +18,11 @@
#include "db.h" #include "db.h"
#include "spells.h" #include "spells.h"
/* IMPORTANT! The below defined number is the zone number of the Kings Castle.
/* IMPORTANT! * Change it to apply to your chosen zone number. The default zone number
The below defined number is the zone number of the Kings Castle. * is 80. */
Change it to apply to your chosen zone number. The default zone
number (On Alex and Alfa) is 80 (That is rooms and mobs have numbers
in the 8000 series... */
#define Z_KINGS_C 150 #define Z_KINGS_C 150
/* external variables */ /* external variables */
extern struct time_info_data time_info; extern struct time_info_data time_info;
extern int mini_mud; extern int mini_mud;
@ -53,12 +45,7 @@ int castle_cleaner(struct char_data *ch, int cmd, int gripe);
int castle_twin_proc(struct char_data *ch, int cmd, char *arg, int ctlnum, const char *twinname); int castle_twin_proc(struct char_data *ch, int cmd, char *arg, int ctlnum, const char *twinname);
void castle_mob_spec(mob_vnum mobnum, SPECIAL(*specproc)); void castle_mob_spec(mob_vnum mobnum, SPECIAL(*specproc));
/* Special procedures for Kings Castle by Pjotr. Coded by Sapowox. */
/**********************************************************************\
|* Special procedures for Kings Castle by Pjotr (d90-pem@nada.kth.se) *|
|* Coded by Sapowox (d90-jkr@nada.kth.se) *|
\**********************************************************************/
SPECIAL(CastleGuard); SPECIAL(CastleGuard);
SPECIAL(James); SPECIAL(James);
SPECIAL(cleaning); SPECIAL(cleaning);
@ -73,12 +60,8 @@ SPECIAL(guild);
ACMD(do_gen_door); ACMD(do_gen_door);
ACMD(do_follow); ACMD(do_follow);
/* /* Assign castle special procedures. NOTE: The mobile number isn't fully
* Assign castle special procedures. * specified. It's only an offset from the zone's base. */
*
* NOTE: The mobile number isn't fully specified. It's only an offset
* from the zone's base.
*/
void castle_mob_spec(mob_vnum mobnum, SPECIAL(*specproc)) void castle_mob_spec(mob_vnum mobnum, SPECIAL(*specproc))
{ {
mob_vnum vmv = castle_virtual(mobnum); mob_vnum vmv = castle_virtual(mobnum);
@ -90,16 +73,13 @@ void castle_mob_spec(mob_vnum mobnum, SPECIAL(*specproc))
if (rmr == NOBODY) { if (rmr == NOBODY) {
if (!mini_mud) if (!mini_mud)
log("SYSERR: assign_kings_castle(): can't find mob #%d.", vmv); log("SYSERR: assign_kings_castle(): can't find mob #%d.", vmv);
/* SYSERR_DESC: /* SYSERR_DESC: When the castle_mob_spec() function is given a mobnum
* When the castle_mob_spec() function is given a mobnum that * that does not correspond to a mod loaded (when not in minimud mode),
* does not correspond to a mod loaded (when not in minimud mode), * this error will result. */
* this error will result.
*/
} else } else
mob_index[rmr].func = specproc; mob_index[rmr].func = specproc;
} }
mob_vnum castle_virtual(mob_vnum offset) mob_vnum castle_virtual(mob_vnum offset)
{ {
zone_rnum zon; zone_rnum zon;
@ -110,7 +90,6 @@ mob_vnum castle_virtual(mob_vnum offset)
return zone_table[zon].bot + offset; return zone_table[zon].bot + offset;
} }
room_rnum castle_real_room(room_vnum roomoffset) room_rnum castle_real_room(room_vnum roomoffset)
{ {
zone_rnum zon; zone_rnum zon;
@ -121,17 +100,11 @@ room_rnum castle_real_room(room_vnum roomoffset)
return real_room(zone_table[zon].bot + roomoffset); return real_room(zone_table[zon].bot + roomoffset);
} }
/* Routine: assign_kings_castle. Used to assign function pointers to all mobiles
/* * in the Kings Castle. Called from spec_assign.c. */
* Routine: assign_kings_castle
*
* Used to assign function pointers to all mobiles in the Kings Castle.
* Called from spec_assign.c.
*/
void assign_kings_castle(void) void assign_kings_castle(void)
{ {
castle_mob_spec(0, CastleGuard); /* Gwydion */ castle_mob_spec(0, CastleGuard); /* Gwydion */
/* Added the previous line -- Furry */
castle_mob_spec(1, king_welmar); /* Our dear friend, the King */ castle_mob_spec(1, king_welmar); /* Our dear friend, the King */
castle_mob_spec(3, CastleGuard); /* Jim */ castle_mob_spec(3, CastleGuard); /* Jim */
castle_mob_spec(4, CastleGuard); /* Brian */ castle_mob_spec(4, CastleGuard); /* Brian */
@ -148,8 +121,7 @@ void assign_kings_castle(void)
castle_mob_spec(17, cleaning); /* Ze Cleaning Fomen */ castle_mob_spec(17, cleaning); /* Ze Cleaning Fomen */
castle_mob_spec(20, tim); /* Tim, Tom's twin */ castle_mob_spec(20, tim); /* Tim, Tom's twin */
castle_mob_spec(21, tom); /* Tom, Tim's twin */ castle_mob_spec(21, tom); /* Tom, Tim's twin */
castle_mob_spec(24, DicknDavid); /* Dick, guard of the castle_mob_spec(24, DicknDavid); /* Dick, guard of the Treasury */
* Treasury */
castle_mob_spec(25, DicknDavid); /* David, Dicks brother */ castle_mob_spec(25, DicknDavid); /* David, Dicks brother */
castle_mob_spec(26, jerry); /* Jerry, the Gambler */ castle_mob_spec(26, jerry); /* Jerry, the Gambler */
castle_mob_spec(27, CastleGuard); /* Michael */ castle_mob_spec(27, CastleGuard); /* Michael */
@ -157,13 +129,8 @@ void assign_kings_castle(void)
castle_mob_spec(29, CastleGuard); /* Boris */ castle_mob_spec(29, CastleGuard); /* Boris */
} }
/* Routine: member_of_staff. Used to see if a character is a member of the
/* * castle staff. Used mainly by BANZAI:ng NPC:s. */
* Routine: member_of_staff
*
* Used to see if a character is a member of the castle staff.
* Used mainly by BANZAI:ng NPC:s.
*/
int member_of_staff(struct char_data *chChar) int member_of_staff(struct char_data *chChar)
{ {
int ch_num; int ch_num;
@ -188,13 +155,8 @@ int member_of_staff(struct char_data *chChar)
return (FALSE); return (FALSE);
} }
/* Function: member_of_royal_guard. Returns TRUE if the character is a guard on
/* * duty, otherwise FALSE. Used by Peter the captain of the royal guard. */
* Function: member_of_royal_guard
*
* Returns TRUE if the character is a guard on duty, otherwise FALSE.
* Used by Peter the captain of the royal guard.
*/
int member_of_royal_guard(struct char_data *chChar) int member_of_royal_guard(struct char_data *chChar)
{ {
int ch_num; int ch_num;
@ -216,13 +178,8 @@ int member_of_royal_guard(struct char_data *chChar)
return (FALSE); return (FALSE);
} }
/* Function: find_npc_by_name. Returns a pointer to an npc by the given name.
/* * Used by Tim and Tom. */
* Function: find_npc_by_name
*
* Returns a pointer to an npc by the given name.
* Used by Tim and Tom
*/
struct char_data *find_npc_by_name(struct char_data *chAtChar, struct char_data *find_npc_by_name(struct char_data *chAtChar,
const char *pszName, int iLen) const char *pszName, int iLen)
{ {
@ -235,13 +192,8 @@ struct char_data *find_npc_by_name(struct char_data *chAtChar,
return (NULL); return (NULL);
} }
/* Function: find_guard. Returns the pointer to a guard on duty. Used by Peter
/* * the Captain of the Royal Guard */
* Function: find_guard
*
* Returns the pointer to a guard on duty.
* Used by Peter the Captain of the Royal Guard
*/
struct char_data *find_guard(struct char_data *chAtChar) struct char_data *find_guard(struct char_data *chAtChar)
{ {
struct char_data *ch; struct char_data *ch;
@ -253,14 +205,9 @@ struct char_data *find_guard(struct char_data *chAtChar)
return (NULL); return (NULL);
} }
/* Function: get_victim. Returns a pointer to a randomly chosen character in
/* * the same room, fighting someone in the castle staff. Used by BANZAII-ing
* Function: get_victim * characters and King Welmar... */
*
* Returns a pointer to a randomly chosen character in the same room,
* fighting someone in the castle staff...
* Used by BANZAII-ing characters and King Welmar...
*/
struct char_data *get_victim(struct char_data *chAtChar) struct char_data *get_victim(struct char_data *chAtChar)
{ {
struct char_data *ch; struct char_data *ch;
@ -295,13 +242,8 @@ struct char_data *get_victim(struct char_data *chAtChar)
return (NULL); return (NULL);
} }
/* Banzaii. Makes a character banzaii on attackers of the castle staff. Used
/* * by Guards, Tim, Tom, Dick, David, Peter, Master, and the King. */
* Function: banzaii
*
* Makes a character banzaii on attackers of the castle staff.
* Used by Guards, Tim, Tom, Dick, David, Peter, Master, King and Guards.
*/
int banzaii(struct char_data *ch) int banzaii(struct char_data *ch)
{ {
struct char_data *chOpponent; struct char_data *chOpponent;
@ -315,13 +257,7 @@ int banzaii(struct char_data *ch)
return (TRUE); return (TRUE);
} }
/* Do_npc_rescue. Makes ch_hero rescue ch_victim. Used by Tim and Tom. */
/*
* Function: do_npc_rescue
*
* Makes ch_hero rescue ch_victim.
* Used by Tim and Tom
*/
int do_npc_rescue(struct char_data *ch_hero, struct char_data *ch_victim) int do_npc_rescue(struct char_data *ch_hero, struct char_data *ch_victim)
{ {
struct char_data *ch_bad_guy; struct char_data *ch_bad_guy;
@ -349,11 +285,8 @@ int do_npc_rescue(struct char_data *ch_hero, struct char_data *ch_victim)
return (TRUE); return (TRUE);
} }
/* Procedure to block a person trying to enter a room. Used by Tim/Tom at Kings
/* * bedroom and Dick/David at treasury. */
* Procedure to block a person trying to enter a room.
* Used by Tim/Tom at Kings bedroom and Dick/David at treasury.
*/
int block_way(struct char_data *ch, int cmd, char *arg, room_vnum iIn_room, int block_way(struct char_data *ch, int cmd, char *arg, room_vnum iIn_room,
int iProhibited_direction) int iProhibited_direction)
{ {
@ -373,11 +306,8 @@ int block_way(struct char_data *ch, int cmd, char *arg, room_vnum iIn_room,
return (TRUE); return (TRUE);
} }
/* Routine to check if an object is trash. Used by James the Butler and the
/* * Cleaning Lady. */
* Routine to check if an object is trash...
* Used by James the Butler and the Cleaning Lady.
*/
int is_trash(struct obj_data *i) int is_trash(struct obj_data *i)
{ {
if (!OBJWEAR_FLAGGED(i, ITEM_WEAR_TAKE)) if (!OBJWEAR_FLAGGED(i, ITEM_WEAR_TAKE))
@ -389,13 +319,8 @@ int is_trash(struct obj_data *i)
return (FALSE); return (FALSE);
} }
/* Fry_victim. Finds a suitabe victim, and cast some _NASTY_ spell on him. Used
/* * by King Welmar. */
* Function: fry_victim
*
* Finds a suitabe victim, and cast some _NASTY_ spell on him.
* Used by King Welmar
*/
void fry_victim(struct char_data *ch) void fry_victim(struct char_data *ch)
{ {
struct char_data *tch; struct char_data *tch;
@ -439,13 +364,7 @@ void fry_victim(struct char_data *ch)
return; return;
} }
/* King_welmar. Control the actions and movements of the King. */
/*
* Function: king_welmar
*
* Control the actions and movements of the King.
* Used by King Welmar.
*/
SPECIAL(king_welmar) SPECIAL(king_welmar)
{ {
char actbuf[MAX_INPUT_LENGTH]; char actbuf[MAX_INPUT_LENGTH];
@ -560,14 +479,9 @@ SPECIAL(king_welmar)
return (FALSE); return (FALSE);
} }
/* Training_master. Acts actions to the training room, if his students are
/* * present. Also allowes warrior-class to practice. Used by the Training
* Function: training_master * Master. */
*
* Acts actions to the training room, if his students are present.
* Also allowes warrior-class to practice.
* Used by the Training Master.
*/
SPECIAL(training_master) SPECIAL(training_master)
{ {
struct char_data *pupil1, *pupil2 = NULL, *tch; struct char_data *pupil1, *pupil2 = NULL, *tch;
@ -653,7 +567,6 @@ SPECIAL(training_master)
return (FALSE); return (FALSE);
} }
SPECIAL(tom) SPECIAL(tom)
{ {
return castle_twin_proc(ch, cmd, argument, 48, "Tim"); return castle_twin_proc(ch, cmd, argument, 48, "Tim");
@ -664,9 +577,7 @@ SPECIAL(tim)
return castle_twin_proc(ch, cmd, argument, 49, "Tom"); return castle_twin_proc(ch, cmd, argument, 49, "Tom");
} }
/* /* Common routine for the Castle Twins. */
* Common routine for the Castle Twins.
*/
int castle_twin_proc(struct char_data *ch, int cmd, char *arg, int ctlnum, const char *twinname) int castle_twin_proc(struct char_data *ch, int cmd, char *arg, int ctlnum, const char *twinname)
{ {
struct char_data *king, *twin; struct char_data *king, *twin;
@ -697,20 +608,14 @@ int castle_twin_proc(struct char_data *ch, int cmd, char *arg, int ctlnum, const
} }
/* /* Routine for James the Butler. Complains if he finds any trash. This doesn't
* Routine for James the Butler. * make sure he _can_ carry it. */
* Complains if he finds any trash...
*
* This doesn't make sure he _can_ carry it...
*/
SPECIAL(James) SPECIAL(James)
{ {
return castle_cleaner(ch, cmd, TRUE); return castle_cleaner(ch, cmd, TRUE);
} }
/* /* Common code for James and the Cleaning Woman. */
* Common code for James and the Cleaning Woman.
*/
int castle_cleaner(struct char_data *ch, int cmd, int gripe) int castle_cleaner(struct char_data *ch, int cmd, int gripe)
{ {
struct obj_data *i; struct obj_data *i;
@ -735,22 +640,13 @@ int castle_cleaner(struct char_data *ch, int cmd, int gripe)
return (FALSE); return (FALSE);
} }
/* Routine for the Cleaning Woman. Picks up any trash she finds. */
/*
* Routine for the Cleaning Woman.
* Picks up any trash she finds...
*/
SPECIAL(cleaning) SPECIAL(cleaning)
{ {
return castle_cleaner(ch, cmd, FALSE); return castle_cleaner(ch, cmd, FALSE);
} }
/* CastleGuard. Standard routine for ordinary castle guards. */
/*
* Routine: CastleGuard
*
* Standard routine for ordinary castle guards.
*/
SPECIAL(CastleGuard) SPECIAL(CastleGuard)
{ {
if (cmd || !AWAKE(ch) || (GET_POS(ch) == POS_FIGHTING)) if (cmd || !AWAKE(ch) || (GET_POS(ch) == POS_FIGHTING))
@ -759,12 +655,7 @@ SPECIAL(CastleGuard)
return (banzaii(ch)); return (banzaii(ch));
} }
/* DicknDave. Routine for the guards Dick and David. */
/*
* Routine: DicknDave
*
* Routine for the guards Dick and David.
*/
SPECIAL(DicknDavid) SPECIAL(DicknDavid)
{ {
if (!AWAKE(ch)) if (!AWAKE(ch))
@ -776,11 +667,7 @@ SPECIAL(DicknDavid)
return (block_way(ch, cmd, argument, castle_virtual(36), 1)); return (block_way(ch, cmd, argument, castle_virtual(36), 1));
} }
/*Peter. Routine for Captain of the Guards. */
/*
* Routine: peter
* Routine for Captain of the Guards.
*/
SPECIAL(peter) SPECIAL(peter)
{ {
struct char_data *ch_guard = NULL; struct char_data *ch_guard = NULL;
@ -843,11 +730,8 @@ SPECIAL(peter)
return (FALSE); return (FALSE);
} }
/* Procedure for Jerry and Michael in x08 of King's Castle. Code by Sapowox
/* * modified by Pjotr.(Original code from Master) */
* Procedure for Jerry and Michael in x08 of King's Castle.
* Code by Sapowox modified by Pjotr.(Original code from Master)
*/
SPECIAL(jerry) SPECIAL(jerry)
{ {
struct char_data *gambler1, *gambler2 = NULL, *tch; struct char_data *gambler1, *gambler2 = NULL, *tch;

View file

@ -1,8 +1,9 @@
/************************************************************************ /**************************************************************************
* OasisOLC - Game configuration / cedit.c v2.0 * * File: cedit.c Part of tbaMUD *
* Copyright 2002-2003 Kip Potter (kip_potter@hotmail.com) * * Usage: A graphical in-game game configuration utility for OasisOLC. *
* A graphical in-game game configuration utility for OasisOLC. * * *
************************************************************************/ * Copyright 2002-2003 Kip Potter *
**************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
@ -524,9 +525,7 @@ void cedit_disp_menu(struct descriptor_data *d)
get_char_colors(d->character); get_char_colors(d->character);
clear_screen(d); clear_screen(d);
/* /* Menu header. */
* Menu header
*/
write_to_output(d, write_to_output(d,
"OasisOLC MUD Configuration Editor\r\n" "OasisOLC MUD Configuration Editor\r\n"
"%sG%s) Game Play Options\r\n" "%sG%s) Game Play Options\r\n"
@ -717,7 +716,7 @@ void cedit_disp_autowiz_options(struct descriptor_data *d)
OLC_MODE(d) = CEDIT_AUTOWIZ_OPTIONS_MENU; OLC_MODE(d) = CEDIT_AUTOWIZ_OPTIONS_MENU;
} }
/* The GARGANTAUN event handler */ /* The event handler. */
void cedit_parse(struct descriptor_data *d, char *arg) void cedit_parse(struct descriptor_data *d, char *arg)
{ {
char *oldtext = NULL; char *oldtext = NULL;

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: class.c Part of CircleMUD * * File: class.c Part of tbaMUD *
* Usage: Source file for class-specific code * * Usage: Source file for class-specific code. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
/* This file attempts to concentrate most of the code which must be changed /* This file attempts to concentrate most of the code which must be changed
* in order for new classes to be added. If you're adding a new class, you * in order for new classes to be added. If you're adding a new class, you
@ -125,6 +125,28 @@ int prac_params[4][NUM_CLASSES] = {
{ SPELL, SPELL, SKILL, SKILL }, /* prac name */ { SPELL, SPELL, SKILL, SKILL }, /* prac name */
}; };
/* The appropriate rooms for each guildmaster/guildguard; controls which types
* of people the various guildguards let through. i.e., the first line shows
* that from room 3017, only MAGIC_USERS are allowed to go south. Don't forget
* to visit spec_assign.c if you create any new mobiles that should be a guild
* master or guard so they can act appropriately. If you "recycle" the
* existing mobs that are used in other guilds for your new guild, then you
* don't have to change that file, only here. */
struct guild_info_type guild_info[] = {
/* Midgaard */
{ CLASS_MAGIC_USER, 3017, SCMD_SOUTH },
{ CLASS_CLERIC, 3004, SCMD_NORTH },
{ CLASS_THIEF, 3027, SCMD_EAST },
{ CLASS_WARRIOR, 3021, SCMD_EAST },
/* Brass Dragon */
{ -999 /* all */ , 5065, SCMD_WEST },
/* this must go last -- add new guards above! */
{ -1, NOWHERE, -1}
};
/* Saving throws for : MCTW : PARA, ROD, PETRI, BREATH, SPELL. Levels 0-40. Do /* Saving throws for : MCTW : PARA, ROD, PETRI, BREATH, SPELL. Levels 0-40. Do
* not forget to change extern declaration in magic.c if you add to this. */ * not forget to change extern declaration in magic.c if you add to this. */
byte saving_throws(int class_num, int type, int level) byte saving_throws(int class_num, int type, int level)

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: comm.c Part of CircleMUD * * File: comm.c Part of tbaMUD *
* Usage: Communication, socket handling, main(), central game loop * * Usage: Communication, socket handling, main(), central game loop. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#define __COMM_C__ #define __COMM_C__
@ -76,7 +76,7 @@
extern struct ban_list_element *ban_list; extern struct ban_list_element *ban_list;
extern int num_invalid; extern int num_invalid;
extern char *GREETINGS; extern char *GREETINGS;
extern const char *circlemud_version; extern const char *tbamud_version;
extern const char *oasisolc_version; extern const char *oasisolc_version;
extern const char *ascii_pfiles_version; extern const char *ascii_pfiles_version;
extern int circle_restrict; extern int circle_restrict;
@ -168,9 +168,9 @@ int isbanned(char *hostname);
void weather_and_time(int mode); void weather_and_time(int mode);
int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen); int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen);
void free_messages(void); void free_messages(void);
void Board_clear_all(void); void board_clear_all(void);
void free_social_messages(void); void free_social_messages(void);
void Free_Invalid_List(void); void free_invalid_list(void);
void free_command_list(void); void free_command_list(void);
void load_config(void); void load_config(void);
void new_hist_messg(struct descriptor_data *d, const char *msg); void new_hist_messg(struct descriptor_data *d, const char *msg);
@ -301,10 +301,8 @@ int main(int argc, char **argv)
puts("Suppressing assignment of special routines."); puts("Suppressing assignment of special routines.");
break; break;
case 'h': case 'h':
/* From: Anil Mahajan <amahajan@proxicom.com> */ /* From: Anil Mahajan. Do NOT use -C, this is the copyover mode and
/* Do NOT use -C, this is the copyover mode and without * without the proper copyover.dat file, the game will go nuts! */
* the proper copyover.dat file, the game will go nuts!
* -spl */
printf("Usage: %s [-c] [-m] [-q] [-r] [-s] [-d pathname] [port #]\n" printf("Usage: %s [-c] [-m] [-q] [-r] [-s] [-d pathname] [port #]\n"
" -c Enable syntax check mode.\n" " -c Enable syntax check mode.\n"
" -d <directory> Specify library directory (defaults to 'lib').\n" " -d <directory> Specify library directory (defaults to 'lib').\n"
@ -342,7 +340,7 @@ int main(int argc, char **argv)
/* Moved here to distinguish command line options and to show up /* Moved here to distinguish command line options and to show up
* in the log if stderr is redirected to a file. */ * in the log if stderr is redirected to a file. */
log("Using %s for configuration.", CONFIG_CONFFILE); log("Using %s for configuration.", CONFIG_CONFFILE);
log("%s", circlemud_version); log("%s", tbamud_version);
log("%s", oasisolc_version); log("%s", oasisolc_version);
log("%s", DG_SCRIPT_VERSION); log("%s", DG_SCRIPT_VERSION);
log("%s", ascii_pfiles_version); log("%s", ascii_pfiles_version);
@ -369,12 +367,12 @@ int main(int argc, char **argv)
free_player_index(); /* players.c */ free_player_index(); /* players.c */
free_messages(); /* fight.c */ free_messages(); /* fight.c */
free_text_files(); /* db.c */ free_text_files(); /* db.c */
Board_clear_all(); /* boards.c */ board_clear_all(); /* boards.c */
free(cmd_sort_info); /* act.informative.c */ free(cmd_sort_info); /* act.informative.c */
free_command_list(); /* act.informative.c */ free_command_list(); /* act.informative.c */
free_social_messages(); /* act.social.c */ free_social_messages(); /* act.social.c */
free_help_table(); /* db.c */ free_help_table(); /* db.c */
Free_Invalid_List(); /* ban.c */ free_invalid_list(); /* ban.c */
free_strings(&config_info, OASIS_CFG); /* oasis_delete.c */ free_strings(&config_info, OASIS_CFG); /* oasis_delete.c */
} }
@ -594,8 +592,7 @@ socket_t init_socket(ush_int port)
set_sendbuf(s); set_sendbuf(s);
/* The GUSI sockets library is derived from BSD, so it defines SO_LINGER, even /* The GUSI sockets library is derived from BSD, so it defines SO_LINGER, even
* though setsockopt() is unimplimented. (from Dean Takemori * though setsockopt() is unimplimented. (from Dean Takemori) */
* <dean@UHHEPH.PHYS.HAWAII.EDU>) */
#if defined(SO_LINGER) && !defined(CIRCLE_MACINTOSH) #if defined(SO_LINGER) && !defined(CIRCLE_MACINTOSH)
{ {
struct linger ld; struct linger ld;
@ -1011,8 +1008,7 @@ void timediff(struct timeval *rslt, struct timeval *a, struct timeval *b)
} }
} }
/* Add 2 time values. Patch sent by "d. hall" <dhall@OOI.NET> to fix 'static' /* Add 2 time values. Patch sent by "d. hall" to fix 'static' usage. */
* usage. */
void timeadd(struct timeval *rslt, struct timeval *a, struct timeval *b) void timeadd(struct timeval *rslt, struct timeval *a, struct timeval *b)
{ {
rslt->tv_sec = a->tv_sec + b->tv_sec; rslt->tv_sec = a->tv_sec + b->tv_sec;
@ -1109,7 +1105,6 @@ size_t proc_colors(char *txt, size_t maxlen, int parse)
} }
/* if we get here we have a color code */ /* if we get here we have a color code */
s++; /* s now points to the code */ s++; /* s now points to the code */
if (!*s) { /* string was terminated with @ */ if (!*s) { /* string was terminated with @ */
@ -1554,7 +1549,6 @@ int new_descriptor(socket_t s)
return (0); return (0);
} }
/* Send all of the output that we've accumulated for a player out to the /* Send all of the output that we've accumulated for a player out to the
* player's descriptor. 32 byte GARBAGE_SPACE in MAX_SOCK_BUF used for: * player's descriptor. 32 byte GARBAGE_SPACE in MAX_SOCK_BUF used for:
* 2 bytes: prepended \r\n * 2 bytes: prepended \r\n
@ -1631,7 +1625,6 @@ int process_output(struct descriptor_data *t)
} else { } else {
/* Not all data in buffer sent. result < output buffersize. */ /* Not all data in buffer sent. result < output buffersize. */
strcpy(t->output, t->output + result); /* strcpy: OK (overlap) */ strcpy(t->output, t->output + result); /* strcpy: OK (overlap) */
t->bufptr -= result; t->bufptr -= result;
t->bufspace += result; t->bufspace += result;
@ -1781,7 +1774,6 @@ ssize_t perform_socket_read(socket_t desc, char *read_point, size_t space_left)
} }
/* Read returned a value < 0: there was an error. */ /* Read returned a value < 0: there was an error. */
#if defined(CIRCLE_WINDOWS) /* Windows */ #if defined(CIRCLE_WINDOWS) /* Windows */
if (WSAGetLastError() == WSAEWOULDBLOCK || WSAGetLastError() == WSAEINTR) if (WSAGetLastError() == WSAEWOULDBLOCK || WSAGetLastError() == WSAEINTR)
return (0); return (0);
@ -1857,7 +1849,6 @@ int process_input(struct descriptor_data *t)
return (0); return (0);
/* at this point, we know we got some data from the read */ /* at this point, we know we got some data from the read */
*(read_point + bytes_read) = '\0'; /* terminate the string */ *(read_point + bytes_read) = '\0'; /* terminate the string */
/* search for a newline in the data we just read */ /* search for a newline in the data we just read */
@ -1979,19 +1970,17 @@ int process_input(struct descriptor_data *t)
return (1); return (1);
} }
/* perform substitution for the '^..^' csh-esque syntax orig is the /* Perform substitution for the '^..^' csh-esque syntax orig is the orig string,
* orig string, i.e. the one being modified. subst contains the * i.e. the one being modified. subst contains the substition string, i.e.
* substition string, i.e. "^telm^tell" */ * "^telm^tell" */
int perform_subst(struct descriptor_data *t, char *orig, char *subst) int perform_subst(struct descriptor_data *t, char *orig, char *subst)
{ {
char newsub[MAX_INPUT_LENGTH + 5]; char newsub[MAX_INPUT_LENGTH + 5];
char *first, *second, *strpos; char *first, *second, *strpos;
/* /* First is the position of the beginning of the first string (the one to be
* first is the position of the beginning of the first string (the one * replaced. */
* to be replaced
*/
first = subst + 1; first = subst + 1;
/* now find the second '^' */ /* now find the second '^' */
@ -2547,13 +2536,13 @@ char *act(const char *str, int hide_invisible, struct char_data *ch,
if (!str || !*str) if (!str || !*str)
return NULL; return NULL;
/* Warning: the following TO_SLEEP code is a hack. /* Warning: the following TO_SLEEP code is a hack. I wanted to be able to tell
* I wanted to be able to tell act to deliver a message regardless of sleep * act to deliver a message regardless of sleep without adding an additional
* without adding an additional argument. TO_SLEEP is 128 (a single bit * argument. TO_SLEEP is 128 (a single bit high up). It's ONLY legal to
* high up). It's ONLY legal to combine TO_SLEEP with one other TO_x * combine TO_SLEEP with one other TO_x command. It's not legal to combine
* command. It's not legal to combine TO_x's with each other otherwise. * TO_x's with each other otherwise. TO_SLEEP only works because its value
* TO_SLEEP only works because its value "happens to be" a single bit; * "happens to be" a single bit; do not change it to something else. In
* do not change it to something else. In short, it is a hack. */ * short, it is a hack. */
/* check if TO_SLEEP is there, and remove it if it is. */ /* check if TO_SLEEP is there, and remove it if it is. */
if ((to_sleeping = (type & TO_SLEEP))) if ((to_sleeping = (type & TO_SLEEP)))
@ -2678,18 +2667,14 @@ int open_logfile(const char *filename, FILE *stderr_fp)
return (FALSE); return (FALSE);
} }
/* /* This may not be pretty but it keeps game_loop() neater than if it was inline. */
* This may not be pretty but it keeps game_loop() neater than if it was inline.
*/
#if defined(CIRCLE_WINDOWS) #if defined(CIRCLE_WINDOWS)
void circle_sleep(struct timeval *timeout) void circle_sleep(struct timeval *timeout)
{ {
Sleep(timeout->tv_sec * 1000 + timeout->tv_usec / 1000); Sleep(timeout->tv_sec * 1000 + timeout->tv_usec / 1000);
} }
#else #else
void circle_sleep(struct timeval *timeout) void circle_sleep(struct timeval *timeout)
{ {
if (select(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, timeout) < 0) { if (select(0, (fd_set *) 0, (fd_set *) 0, (fd_set *) 0, timeout) < 0) {

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: comm.h Part of CircleMUD * * File: comm.h Part of tbaMUD *
* Usage: header file: prototypes of public communication functions * * Usage: Header file, prototypes of public communication functions. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#define NUM_RESERVED_DESCS 8 #define NUM_RESERVED_DESCS 8
#define COPYOVER_FILE "copyover.dat" #define COPYOVER_FILE "copyover.dat"

View file

@ -1,13 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: config.c Part of CircleMUD * * File: config.c Part of tbaMUD *
* Usage: Configuration of various aspects of CircleMUD operation * * Usage: Configuration of various aspects of tbaMUD operation. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#define __CONFIG_C__ #define __CONFIG_C__
@ -22,7 +21,7 @@
* this file instead. - Mythran */ * this file instead. - Mythran */
/* Below are several constants which you can change to alter certain aspects /* Below are several constants which you can change to alter certain aspects
* of the way CircleMUD acts. Since this is a .c file, all you have to do * of the way tbaMUD acts. Since this is a .c file, all you have to do
* to change one of the constants (assuming you keep your object files around) * to change one of the constants (assuming you keep your object files around)
* is change the constant in this file and type 'make'. Make will recompile * is change the constant in this file and type 'make'. Make will recompile
* this file and relink; you don't have to wait for the whole thing to recompile * this file and relink; you don't have to wait for the whole thing to recompile
@ -228,7 +227,7 @@ int max_filesize = 50000;
/* Maximum number of password attempts before disconnection. */ /* Maximum number of password attempts before disconnection. */
int max_bad_pws = 3; int max_bad_pws = 3;
/* Rationale for enabling this, as explained by naved@bird.taponline.com. /* Rationale for enabling this, as explained by Naved:
* Usually, when you select ban a site, it is because one or two people are * Usually, when you select ban a site, it is because one or two people are
* causing troubles while there are still many people from that site who you * causing troubles while there are still many people from that site who you
* want to still log on. Right now if I want to add a new select ban, I need * want to still log on. Right now if I want to add a new select ban, I need

View file

@ -1,19 +1,19 @@
/* ************************************************************************ /**************************************************************************
* File: constants.c Part of CircleMUD * * File: constants.c Part of tbaMUD *
* Usage: Numeric and string contants used by the MUD * * Usage: Numeric and string contants used by the MUD. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
#include "structs.h" #include "structs.h"
#include "interpreter.h" /* alias_data */ #include "interpreter.h" /* alias_data */
cpp_extern const char *circlemud_version = "tbaMUD, version 3.52"; cpp_extern const char *tbamud_version = "tbaMUD, version 3.52";
cpp_extern const char *oasisolc_version = "OasisOLC 2.0.6"; cpp_extern const char *oasisolc_version = "OasisOLC 2.0.6";
cpp_extern const char *ascii_pfiles_version = "ASCII Player Files 3.0.1"; cpp_extern const char *ascii_pfiles_version = "ASCII Player Files 3.0.1";
@ -302,14 +302,14 @@ const char *item_types[] = {
"STAFF", "STAFF",
"WEAPON", "WEAPON",
"FURNITURE", "FURNITURE",
"UNDEFINED", "FREE",
"TREASURE", "TREASURE",
"ARMOR", "ARMOR",
"POTION", "POTION",
"WORN", "WORN",
"OTHER", "OTHER",
"TRASH", "TRASH",
"TRAP", "FREE2",
"CONTAINER", "CONTAINER",
"NOTE", "NOTE",
"LIQ CONTAINER", "LIQ CONTAINER",

View file

@ -1,13 +1,14 @@
/* ************************************************************************ /**************************************************************************
* File: constants.h Part of tbaMUD * * File: constants.h Part of tbaMUD *
* Usage: Header file for constants. * * Usage: Header file for constants. *
* *
* All rights reserved. See license for complete information. * * All rights reserved. See license 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 *
* tbaMUD is based on CircleMUD and DikuMUD, Copyright (C) 1990, 1991. * * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */ **************************************************************************/
extern const char *circlemud_version; extern const char *tbamud_version;
extern const char *oasisolc_version; extern const char *oasisolc_version;
extern const char *ascii_pfiles_version; extern const char *ascii_pfiles_version;
extern const char *dirs[]; extern const char *dirs[];

View file

@ -1,11 +1,11 @@
/* /**************************************************************************
* The functions below this point is handling the context sensitive help system * File: context_help.c Part of tbaMUD *
* If you add more olc options, be sure to add a case for it here. - Welcor * Usage: Handles the context sensitive help system. *
*/ * By Welcor. *
**************************************************************************/
#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"
@ -20,6 +20,7 @@ ACMD(do_help);
/* local global */ /* local global */
char *context_help_list[NUM_CONTEXTS]; char *context_help_list[NUM_CONTEXTS];
/* If you add more olc options, be sure to add a case for it here. - Welcor */
int find_context(struct descriptor_data *d) int find_context(struct descriptor_data *d)
{ {
switch STATE(d) { switch STATE(d) {

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: db.c Part of CircleMUD * * File: db.c Part of tbaMUD *
* Usage: Loading/saving chars, booting/resetting world, internal funcs * * Usage: Loading/saving chars, booting/resetting world, internal funcs. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#define __DB_C__ #define __DB_C__
@ -143,7 +143,7 @@ void update_obj_file(void); /* In objsave.c */
void sort_commands(void); void sort_commands(void);
void sort_spells(void); void sort_spells(void);
void load_banned(void); void load_banned(void);
void Read_Invalid_List(void); void read_invalid_list(void);
void boot_the_shops(FILE *shop_f, char *filename, int rec_count); void boot_the_shops(FILE *shop_f, char *filename, int rec_count);
int hsort(const void *a, const void *b); int hsort(const void *a, const void *b);
void prune_crlf(char *txt); void prune_crlf(char *txt);
@ -715,7 +715,7 @@ void boot_db(void)
} }
log("Reading banned site and invalid-name list."); log("Reading banned site and invalid-name list.");
load_banned(); load_banned();
Read_Invalid_List(); read_invalid_list();
if (!no_rent_check) { if (!no_rent_check) {
log("Deleting timed-out crash and rent files:"); log("Deleting timed-out crash and rent files:");

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: db.h Part of CircleMUD * * File: db.h Part of tbaMUD *
* Usage: header file for database handling * * Usage: Header file for database handling. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
/* arbitrary constants used by index_boot() (must be unique) */ /* arbitrary constants used by index_boot() (must be unique) */
#define DB_BOOT_WLD 0 #define DB_BOOT_WLD 0
@ -175,22 +175,18 @@ struct reset_com {
char *sarg1; /* string argument */ char *sarg1; /* string argument */
char *sarg2; /* string argument */ char *sarg2; /* string argument */
/* /* Commands:
* Commands: * * 'M': Read a mobile
* 'M': Read a mobile * * 'O': Read an object
* 'O': Read an object * * 'G': Give obj to mob
* 'G': Give obj to mob * * 'P': Put obj in obj
* 'P': Put obj in obj * * 'G': Obj to char
* 'G': Obj to char * * 'E': Obj to char equip
* 'E': Obj to char equip * * 'D': Set state of door
* 'D': Set state of door * * 'T': Trigger command
* 'T': Trigger command * * 'V': Assign a variable */
* 'V': Assign a variable *
*/
}; };
/* zone definition structure. for the 'zone-table' */ /* zone definition structure. for the 'zone-table' */
struct zone_data { struct zone_data {
char *name; /* name of this zone */ char *name; /* name of this zone */
@ -205,35 +201,26 @@ struct zone_data {
zone_vnum number; /* virtual number of this zone */ zone_vnum number; /* virtual number of this zone */
struct reset_com *cmd; /* command table for reset */ struct reset_com *cmd; /* command table for reset */
/* /* Reset mode:
* Reset mode:
* 0: Don't reset, and don't update age. * 0: Don't reset, and don't update age.
* 1: Reset if no PC's are located in zone. * 1: Reset if no PC's are located in zone.
* 2: Just reset. * 2: Just reset. */
*/
}; };
/* for queueing zones for update */ /* for queueing zones for update */
struct reset_q_element { struct reset_q_element {
zone_rnum zone_to_reset; /* ref to zone_data */ zone_rnum zone_to_reset; /* ref to zone_data */
struct reset_q_element *next; struct reset_q_element *next;
}; };
/* structure for the update queue */ /* structure for the update queue */
struct reset_q_type { struct reset_q_type {
struct reset_q_element *head; struct reset_q_element *head;
struct reset_q_element *tail; struct reset_q_element *tail;
}; };
/* Added level, flags, and last, primarily for pfile autocleaning. You can also
/* Added level, flags, and last, primarily for pfile autocleaning. You * use them to keep online statistics, and add race, class, etc if you like. */
can also use them to keep online statistics, and can add race, class,
etc if you like.
*/
struct player_index_element { struct player_index_element {
char *name; char *name;
long id; long id;
@ -242,7 +229,6 @@ struct player_index_element {
time_t last; time_t last;
}; };
struct help_index_element { struct help_index_element {
char *index; /*Future Use */ char *index; /*Future Use */
char *keywords; /*Keyword Place holder and sorter */ char *keywords; /*Keyword Place holder and sorter */
@ -251,7 +237,6 @@ struct help_index_element {
int min_level; /*Min Level to read help entry*/ int min_level; /*Min Level to read help entry*/
}; };
/* don't change these */ /* don't change these */
#define BAN_NOT 0 #define BAN_NOT 0
#define BAN_NEW 1 #define BAN_NEW 1

View file

@ -1,9 +1,8 @@
/* ************************************************************************ /**************************************************************************
* File: dg_comm.c Part of Death's Gate MUD * * File: dg_comm.c Part of tbaMUD *
* Usage: Contains routines to handle mud to player communication. *
* * * *
* Usage: Contains routines to handle mud to player communication * * All rights reserved. See license for complete information. *
* *
* All rights reserved. See license.doc for complete information. *
* * * *
* Death's Gate MUD is based on CircleMUD, Copyright (C) 1993, 94. * * Death's Gate MUD is based on CircleMUD, Copyright (C) 1993, 94. *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
@ -11,11 +10,10 @@
* $Author: Mark A. Heilpern/egreen/Welcor $ * * $Author: Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ * * $Date: 2004/10/11 12:07:00$ *
* $Revision: 1.0.14 $ * * $Revision: 1.0.14 $ *
************************************************************************ */ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
#include "structs.h" #include "structs.h"
#include "dg_scripts.h" #include "dg_scripts.h"
#include "utils.h" #include "utils.h"
@ -38,8 +36,7 @@ char *any_one_name(char *argument, char *first_arg)
/* Find length of first word */ /* Find length of first word */
for(arg = first_arg ; for(arg = first_arg ;
*argument && !isspace(*argument) && *argument && !isspace(*argument) && (!ispunct(*argument) || *argument == '#' || *argument == '-') ;
(!ispunct(*argument) || *argument == '#' || *argument == '-') ;
arg++, argument++) arg++, argument++)
*arg = LOWER(*argument); *arg = LOWER(*argument);
*arg = '\0'; *arg = '\0';
@ -47,21 +44,17 @@ char *any_one_name(char *argument, char *first_arg)
return argument; return argument;
} }
void sub_write_to_char(char_data *ch, char *tokens[], void *otokens[], char type[])
void sub_write_to_char(char_data *ch, char *tokens[],
void *otokens[], char type[])
{ {
char sb[MAX_STRING_LENGTH]; char sb[MAX_STRING_LENGTH];
int i; int i;
strcpy(sb,""); strcpy(sb,"");
for (i = 0; tokens[i + 1]; i++) for (i = 0; tokens[i + 1]; i++) {
{
strcat(sb,tokens[i]); strcat(sb,tokens[i]);
switch (type[i]) switch (type[i]) {
{
case '~': case '~':
if (!otokens[i]) if (!otokens[i])
strcat(sb,"someone"); strcat(sb,"someone");
@ -76,8 +69,7 @@ void sub_write_to_char(char_data *ch, char *tokens[],
strcat(sb,"someone's"); strcat(sb,"someone's");
else if ((char_data *)otokens[i] == ch) else if ((char_data *)otokens[i] == ch)
strcat(sb,"your"); strcat(sb,"your");
else else {
{
strcat(sb,PERS((char_data *) otokens[i], ch)); strcat(sb,PERS((char_data *) otokens[i], ch));
strcat(sb,"'s"); strcat(sb,"'s");
} }
@ -125,7 +117,6 @@ void sub_write_to_char(char_data *ch, char *tokens[],
send_to_char(ch, "%s", sb); send_to_char(ch, "%s", sb);
} }
void sub_write(char *arg, char_data *ch, byte find_invis, int targets) void sub_write(char *arg, char_data *ch, byte find_invis, int targets)
{ {
char str[MAX_INPUT_LENGTH * 2]; char str[MAX_INPUT_LENGTH * 2];
@ -142,8 +133,7 @@ void sub_write(char *arg, char_data *ch, byte find_invis, int targets)
tokens[0] = str; tokens[0] = str;
for (i = 0, p = arg, s = str; *p;) for (i = 0, p = arg, s = str; *p;) {
{
switch (*p) { switch (*p) {
case '~': case '~':
case '|': case '|':

View file

@ -1,9 +1,8 @@
/* ************************************************************************ /**************************************************************************
* File: dg_db_scripts.c Part of Death's Gate MUD * * File: dg_db_scripts.c Part of tbaMUD *
* Usage: Contains routines to handle db functions for scripts and trigs. *
* * * *
* Usage: Contains routines to handle db functions for scripts and trigs * * All rights reserved. See license for complete information. *
* *
* All rights reserved. See license.doc for complete information. *
* * * *
* Death's Gate MUD is based on CircleMUD, Copyright (C) 1993, 94. * * Death's Gate MUD is based on CircleMUD, Copyright (C) 1993, 94. *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
@ -11,11 +10,10 @@
* $Author: Mark A. Heilpern/egreen/Welcor $ * * $Author: Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ * * $Date: 2004/10/11 12:07:00$ *
* $Revision: 1.0.14 $ * * $Revision: 1.0.14 $ *
************************************************************************ */ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
#include "structs.h" #include "structs.h"
#include "dg_scripts.h" #include "dg_scripts.h"
#include "utils.h" #include "utils.h"
@ -77,11 +75,7 @@ void parse_trigger(FILE *trig_f, int nr)
trig_index[top_of_trigt++] = t_index; trig_index[top_of_trigt++] = t_index;
} }
/* Create a new trigger from a prototype. nr is the real number of the trigger. */
/*
* create a new trigger from a prototype.
* nr is the real number of the trigger.
*/
trig_data *read_trigger(int nr) trig_data *read_trigger(int nr)
{ {
index_data *t_index; index_data *t_index;
@ -99,8 +93,6 @@ trig_data *read_trigger(int nr)
return trig; return trig;
} }
void trig_data_init(trig_data *this_data) void trig_data_init(trig_data *this_data)
{ {
this_data->nr = NOTHING; this_data->nr = NOTHING;
@ -119,7 +111,6 @@ void trig_data_init(trig_data *this_data)
this_data->next = NULL; this_data->next = NULL;
} }
void trig_data_copy(trig_data *this_data, const trig_data *trg) void trig_data_copy(trig_data *this_data, const trig_data *trg)
{ {
trig_data_init(this_data); trig_data_init(this_data);

View file

@ -1,32 +1,13 @@
/************************************************************************** /**************************************************************************
* File: dg_event.c * * File: dg_event.c Part of tbaMUD *
* * * Usage: This file contains a simplified event system to allow trigedit *
* Usage: This file contains a simplified event system to allow * * to use the "wait" command, causing a delay in the middle of a script. *
* DG Script triggers to use the "wait" command, causing a delay in the *
* middle of a script. *
* *
* By: Mark A. Heilpern (Sammy @ eQuoria MUD equoria.com:4000) *
* *
* As of dg scripts pl 8 this includes the 'FULL' DG event package. * *
* This file includes the file queue.c, which handles the priority queues.* *
* Thomas Arp - Welcor - 2002 *
* * * *
* $Author: Mark A. Heilpern/egreen/Welcor $ * * $Author: Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ * * $Date: 2004/10/11 12:07:00$ *
* $Revision: 1.0.14 $ * * $Revision: 1.0.14 $ *
**************************************************************************/ **************************************************************************/
/*
* dg_event.c: This file contains a simplified event system to allow
* DG Script triggers to use the "wait" command, causing a delay in the
* middle of a script.
*
* By: Mark A. Heilpern (Sammy @ eQuoria MUD equoria.com:4000)
*
* As of dg scripts pl 8 this includes the 'FULL' DG event package.
* This file includes the file queue.c, which handles the priority queues.
* Thomas Arp - Welcor - 2002
*
*/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
#include "structs.h" #include "structs.h"
@ -46,10 +27,7 @@ void event_init(void)
} }
/* /* Add an event to the current list. Creates an event and returns it. */
** Add an event to the current list
*/
/* creates an event and returns it */
struct event *event_create(EVENTFUNC(*func), void *event_obj, long when) struct event *event_create(EVENTFUNC(*func), void *event_obj, long when)
{ {
struct event *new_event; struct event *new_event;
@ -65,7 +43,6 @@ struct event *event_create(EVENTFUNC(*func), void *event_obj, long when)
return new_event; return new_event;
} }
/* removes the event from the system */ /* removes the event from the system */
void event_cancel(struct event *event) void event_cancel(struct event *event)
{ {
@ -84,7 +61,6 @@ void event_cancel(struct event *event)
free(event); free(event);
} }
/* Process any events whose time has come. */ /* Process any events whose time has come. */
void event_process(void) void event_process(void)
{ {
@ -97,11 +73,9 @@ void event_process(void)
return; return;
} }
/* /* Set the_event->q_el to NULL so that any functions called beneath
** Set the_event->q_el to NULL so that any functions called beneath * event_process can tell if they're being called beneath the actual
** event_process can tell if they're being called beneath the actual * event function. */
** event function.
*/
the_event->q_el = NULL; the_event->q_el = NULL;
/* call event func, reenqueue event if retval > 0 */ /* call event func, reenqueue event if retval > 0 */
@ -112,7 +86,6 @@ void event_process(void)
} }
} }
/* returns the time remaining before the event */ /* returns the time remaining before the event */
long event_time(struct event *event) long event_time(struct event *event)
{ {
@ -123,7 +96,6 @@ long event_time(struct event *event)
return (when - pulse); return (when - pulse);
} }
/* frees all events in the queue */ /* frees all events in the queue */
void event_free_all(void) void event_free_all(void)
{ {
@ -147,13 +119,7 @@ int event_is_queued(struct event *event)
return 0; return 0;
} }
/* ************************************************************************ /* Generic queue functions for building and using a priority queue. */
* File: queue.c *
* *
* Usage: generic queue functions for building and using a priority queue *
* *
************************************************************************ */
/* returns a new, initialized queue */ /* returns a new, initialized queue */
struct queue *queue_init(void) struct queue *queue_init(void)
{ {
@ -164,7 +130,6 @@ struct queue *queue_init(void)
return q; return q;
} }
/* add data into the priority queue q with key */ /* add data into the priority queue q with key */
struct q_element *queue_enq(struct queue *q, void *data, long key) struct q_element *queue_enq(struct queue *q, void *data, long key)
{ {
@ -209,7 +174,6 @@ struct q_element *queue_enq(struct queue *q, void *data, long key)
return qe; return qe;
} }
/* remove queue element qe from the priority queue q */ /* remove queue element qe from the priority queue q */
void queue_deq(struct queue *q, struct q_element *qe) void queue_deq(struct queue *q, struct q_element *qe)
{ {
@ -232,11 +196,7 @@ void queue_deq(struct queue *q, struct q_element *qe)
free(qe); free(qe);
} }
/* Removes and returns the data of the first element of the priority queue q. */
/*
* removes and returns the data of the
* first element of the priority queue q
*/
void *queue_head(struct queue *q) void *queue_head(struct queue *q)
{ {
void *dg_data; void *dg_data;
@ -252,11 +212,8 @@ void *queue_head(struct queue *q)
return dg_data; return dg_data;
} }
/* Returns the key of the head element of the priority queue if q is NULL, then
/* * return the largest unsigned number. */
* returns the key of the head element of the priority queue
* if q is NULL, then return the largest unsigned number
*/
long queue_key(struct queue *q) long queue_key(struct queue *q)
{ {
int i; int i;
@ -269,14 +226,12 @@ long queue_key(struct queue *q)
return LONG_MAX; return LONG_MAX;
} }
/* returns the key of queue element qe */ /* returns the key of queue element qe */
long queue_elmt_key(struct q_element *qe) long queue_elmt_key(struct q_element *qe)
{ {
return qe->key; return qe->key;
} }
/* free q and contents */ /* free q and contents */
void queue_free(struct queue *q) void queue_free(struct queue *q)
{ {
@ -292,4 +247,3 @@ void queue_free(struct queue *q)
free(q); free(q);
} }

View file

@ -1,42 +1,27 @@
/* ************************************************************************ /**************************************************************************
* File: dg_event.h * * File: dg_event.h Part of tbaMUD *
* Usage: Structures and prototypes for events. *
* * * *
* Usage: structures and prototypes for events *
* *
* Written by Eric Green (ejg3@cornell.edu) *
* *
* Changes: *
* 3/6/98 ejg: Changed return type of EVENTFUNC from void to long. *
* Moved struct event definition to events.c. *
* $Author: Mark A. Heilpern/egreen/Welcor $ * * $Author: Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ * * $Date: 2004/10/11 12:07:00$ *
* $Revision: 1.0.14 $ * * $Revision: 1.0.14 $ *
************************************************************************ */ **************************************************************************/
/* /* How often will heartbeat() call the 'wait' event function? */
** how often will heartbeat() call the 'wait' event function?
*/
#define PULSE_DG_EVENT 1 #define PULSE_DG_EVENT 1
/* Event related section.*/
/********** Event related section *********/
#define EVENTFUNC(name) long (name)(void *event_obj) #define EVENTFUNC(name) long (name)(void *event_obj)
/* Define event related structures. */
/*
** define event related structures
*/
struct event { struct event {
EVENTFUNC(*func); EVENTFUNC(*func);
void *event_obj; void *event_obj;
struct q_element *q_el; struct q_element *q_el;
}; };
/* End of Event related info. */
/****** End of Event related info ********/ /* Queue related info. */
/***** Queue related info ******/
/* number of queues to use (reduces enqueue cost) */ /* number of queues to use (reduces enqueue cost) */
#define NUM_EVENT_QUEUES 10 #define NUM_EVENT_QUEUES 10
@ -49,7 +34,7 @@ struct q_element {
long key; long key;
struct q_element *prev, *next; struct q_element *prev, *next;
}; };
/****** End of Queue related info ********/ /* End of Queue related info. */
/* - events - function protos need by other modules */ /* - events - function protos need by other modules */
void event_init(void); void event_init(void);

View file

@ -1,9 +1,8 @@
/************************************************************************** /**************************************************************************
* File: dg_handler.c * * File: dg_handler.c Part of tbaMUD *
* Usage: Contains functions to handle memory for scripts. *
* * * *
* Usage: contains functions to handle memory for scripts. * * All rights reserved. See license for complete information. *
* *
* All rights reserved. See license.doc for complete information. *
* * * *
* Death's Gate MUD is based on CircleMUD, Copyright (C) 1993, 94. * * Death's Gate MUD is based on CircleMUD, Copyright (C) 1993, 94. *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
@ -15,8 +14,6 @@
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
#include "structs.h" #include "structs.h"
#include "dg_scripts.h" #include "dg_scripts.h"
#include "utils.h" #include "utils.h"
@ -49,10 +46,7 @@ void free_varlist(struct trig_var_data *vd)
} }
} }
/* /* Remove var name from var_list. Returns 1 if found, else 0. */
* remove var name from var_list
* returns 1 if found, else 0
*/
int remove_var(struct trig_var_data **var_list, char *name) int remove_var(struct trig_var_data **var_list, char *name)
{ {
struct trig_var_data *i, *j; struct trig_var_data *i, *j;
@ -75,11 +69,8 @@ int remove_var(struct trig_var_data **var_list, char *name)
return 0; return 0;
} }
/* /* Return memory used by a trigger. The command list is free'd when changed and
* Return memory used by a trigger * when shutting down. */
* The command list is free'd when changed and when
* shutting down.
*/
void free_trigger(struct trig_data *trig) void free_trigger(struct trig_data *trig)
{ {
free(trig->name); free(trig->name);
@ -99,7 +90,6 @@ void free_trigger(struct trig_data *trig)
free(trig); free(trig);
} }
/* remove a single trigger from a mob/obj/room */ /* remove a single trigger from a mob/obj/room */
void extract_trigger(struct trig_data *trig) void extract_trigger(struct trig_data *trig)
{ {

View file

@ -1,6 +1,6 @@
/************************************************************************** /**************************************************************************
* File: dg_misc.c * * File: dg_misc.c Part of tbaMUD *
* Usage: contains general functions for script usage. * * Usage: Contains general functions for script usage. *
* * * *
* $Author: Mark A. Heilpern/egreen/Welcor $ * * $Author: Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ * * $Date: 2004/10/11 12:07:00$ *
@ -9,8 +9,6 @@
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
#include "structs.h" #include "structs.h"
#include "dg_scripts.h" #include "dg_scripts.h"
#include "utils.h" #include "utils.h"
@ -31,17 +29,13 @@ void die(struct char_data *ch, struct char_data * killer);
/* external vars */ /* external vars */
extern struct spell_info_type spell_info[]; extern struct spell_info_type spell_info[];
/* Cast a spell; can be called by mobiles, objects and rooms, and no level
/* cast a spell; can be called by mobiles, objects and rooms, and no */ * check is required. Note that mobs should generally use the normal 'cast'
/* level check is required. Note that mobs should generally use the */ * command (which must be patched to allow mobs to cast spells) as the spell
/* normal 'cast' command (which must be patched to allow mobs to cast */ * system is designed to have a character caster, and this cast routine may
/* spells) as the spell system is designed to have a character caster, */ * overlook certain issues. LIMITATION: a target MUST exist for the spell unless
/* and this cast routine may overlook certain issues. */ * the spell is set to TAR_IGNORE. Also, group spells are not permitted. */
/* LIMITATION: a target MUST exist for the spell unless the spell is */ void do_dg_cast(void *go, struct script_data *sc, trig_data *trig, int type, char *cmd)
/* set to TAR_IGNORE. Also, group spells are not permitted */
/* code borrowed from do_cast() */
void do_dg_cast(void *go, struct script_data *sc, trig_data *trig,
int type, char *cmd)
{ {
struct char_data *caster = NULL; struct char_data *caster = NULL;
struct char_data *tch = NULL; struct char_data *tch = NULL;
@ -153,12 +147,10 @@ void do_dg_cast(void *go, struct script_data *sc, trig_data *trig,
call_magic(caster, tch, tobj, spellnum, GET_LEVEL(caster), CAST_SPELL); call_magic(caster, tch, tobj, spellnum, GET_LEVEL(caster), CAST_SPELL);
} }
/* Modify an affection on the target. affections can be of the AFF_x variety
/* modify an affection on the target. affections can be of the AFF_x */ * or APPLY_x type. APPLY_x's have an integer value for them while AFF_x's
/* variety or APPLY_x type. APPLY_x's have an integer value for them */ * have boolean values. In any case, the duration MUST be non-zero.
/* while AFF_x's have boolean values. In any case, the duration MUST */ * Usage: apply <target> <property> <value> <duration> */
/* be non-zero. */
/* usage: apply <target> <property> <value> <duration> */
#define APPLY_TYPE 1 #define APPLY_TYPE 1
#define AFFECT_TYPE 2 #define AFFECT_TYPE 2
void do_dg_affect(void *go, struct script_data *sc, trig_data *trig, void do_dg_affect(void *go, struct script_data *sc, trig_data *trig,
@ -223,7 +215,6 @@ void do_dg_affect(void *go, struct script_data *sc, trig_data *trig,
return; return;
} }
/* locate the target */ /* locate the target */
ch = get_char(charname); ch = get_char(charname);
if (!ch) { if (!ch) {
@ -281,12 +272,9 @@ void send_char_pos(struct char_data *ch, int dam)
} }
} }
/* Used throughout the xxxcmds.c files for checking if a char can be targetted
/* Used throughout the xxxcmds.c files for checking if a char * - allow_gods is false when called by %force%, for instance, while true for
* can be targetted * %teleport%. - Welcor */
* - allow_gods is false when called by %force%, for instance,
* while true for %teleport%. -- Welcor
*/
int valid_dg_target(struct char_data *ch, int bitvector) int valid_dg_target(struct char_data *ch, int bitvector)
{ {
if (IS_NPC(ch)) if (IS_NPC(ch))
@ -302,7 +290,6 @@ int valid_dg_target(struct char_data *ch, int bitvector)
return FALSE; /* The rest are gods with nohassle on... */ return FALSE; /* The rest are gods with nohassle on... */
} }
void script_damage(struct char_data *vict, int dam) void script_damage(struct char_data *vict, int dam)
{ {
if (GET_LEVEL(vict)>=LVL_IMMORT && (dam > 0)) { if (GET_LEVEL(vict)>=LVL_IMMORT && (dam > 0)) {

View file

@ -1,34 +1,6 @@
/***************************************************************************
* Original Diku Mud copyright (C) 1990, 1991 by Sebastian Hammer, *
* Michael Seifert, Hans Henrik St{rfeldt, Tom Madsen, and Katja Nyboe. *
* *
* Merc Diku Mud improvments copyright (C) 1992, 1993 by Michael *
* Chastain, Michael Quan, and Mitchell Tse. *
* *
* In order to use any part of this Merc Diku Mud, you must comply with *
* both the original Diku license in 'license.doc' as well the Merc *
* license in 'license.txt'. In particular, you may not remove either of *
* these copyright notices. *
* *
* Much time and thought has gone into this software and you are *
* benefitting. We hope that you share your changes too. What goes *
* around, comes around. *
***************************************************************************/
/***************************************************************************
* The MOBprograms have been contributed by N'Atas-ha. Any support for *
* these routines should not be expected from Merc Industries. However, *
* under no circumstances should the blame for bugs, etc be placed on *
* Merc Industries. They are not guaranteed to work on all systems due *
* to their frequent use of strxxx functions. They are also not the most *
* efficient way to perform their tasks, but hopefully should be in the *
* easiest possible way to install and begin using. Documentation for *
* such installation can be found in INSTALL. Enjoy........ N'Atas-Ha *
***************************************************************************/
/************************************************************************** /**************************************************************************
* File: dg_mobcmd.c * * File: dg_mobcmd.c Part of tbaMUD *
* Usage: contains the mobile script commands. * * Usage: Contains the mobile script commands. *
* *
* * * *
* $Author: N'Atas-ha/Mark A. Heilpern/egreen/Welcor $ * * $Author: N'Atas-ha/Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ * * $Date: 2004/10/11 12:07:00$ *
@ -37,8 +9,6 @@
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
#include "structs.h" #include "structs.h"
#include "screen.h" #include "screen.h"
#include "dg_scripts.h" #include "dg_scripts.h"
@ -50,17 +20,13 @@
#include "spells.h" #include "spells.h"
#include "constants.h" #include "constants.h"
/* /* External functions */
* External functions
*/
bitvector_t asciiflag_conv(char *flag); bitvector_t asciiflag_conv(char *flag);
zone_rnum real_zone_by_thing(room_vnum vznum); zone_rnum real_zone_by_thing(room_vnum vznum);
void die(struct char_data *ch, struct char_data *killer); void die(struct char_data *ch, struct char_data *killer);
room_rnum find_target_room(struct char_data *ch, char *rawroomstr); room_rnum find_target_room(struct char_data *ch, char *rawroomstr);
/* /* Local functions. */
* Local functions.
*/
void mob_log(char_data *mob, const char *format, ...); void mob_log(char_data *mob, const char *format, ...);
ACMD(do_masound); ACMD(do_masound);
ACMD(do_mkill); ACMD(do_mkill);
@ -98,14 +64,11 @@ void mob_log(char_data *mob, const char *format, ...)
va_end(args); va_end(args);
} }
/* /* Macro to determine if a mob is permitted to use these commands. */
** macro to determine if a mob is permitted to use these commands
*/
#define MOB_OR_IMPL(ch) \ #define MOB_OR_IMPL(ch) \
(IS_NPC(ch) && (!(ch)->desc || GET_LEVEL((ch)->desc->original)>=LVL_IMPL)) (IS_NPC(ch) && (!(ch)->desc || GET_LEVEL((ch)->desc->original)>=LVL_IMPL))
/* mob commands */ /* mob commands */
/* prints the argument to all the rooms aroud the mobile */ /* prints the argument to all the rooms aroud the mobile */
ACMD(do_masound) ACMD(do_masound)
{ {
@ -145,7 +108,6 @@ ACMD(do_masound)
IN_ROOM(ch) = was_in_room; IN_ROOM(ch) = was_in_room;
} }
/* lets the mobile kill any player or mobile without murder*/ /* lets the mobile kill any player or mobile without murder*/
ACMD(do_mkill) ACMD(do_mkill)
{ {
@ -196,12 +158,9 @@ ACMD(do_mkill)
return; return;
} }
/* Lets the mobile destroy an object in its inventory it can also destroy a
/* * worn object and it can destroy items using all.xxxxx or just plain all of
* lets the mobile destroy an object in its inventory * them. */
* it can also destroy a worn object and it can destroy
* items using all.xxxxx or just plain all of them
*/
ACMD(do_mjunk) ACMD(do_mjunk)
{ {
char arg[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH];
@ -249,7 +208,6 @@ ACMD(do_mjunk)
return; return;
} }
/* prints the message to everyone in the room other than the mob and victim */ /* prints the message to everyone in the room other than the mob and victim */
ACMD(do_mechoaround) ACMD(do_mechoaround)
{ {
@ -286,7 +244,6 @@ ACMD(do_mechoaround)
sub_write(p, victim, TRUE, TO_ROOM); sub_write(p, victim, TRUE, TO_ROOM);
} }
/* sends the message to only the victim */ /* sends the message to only the victim */
ACMD(do_msend) ACMD(do_msend)
{ {
@ -323,7 +280,6 @@ ACMD(do_msend)
sub_write(p, victim, TRUE, TO_CHAR); sub_write(p, victim, TRUE, TO_CHAR);
} }
/* prints the message to the room at large */ /* prints the message to the room at large */
ACMD(do_mecho) ACMD(do_mecho)
{ {
@ -367,10 +323,8 @@ ACMD(do_mzoneecho)
} }
} }
/* /* Lets the mobile load an item or mobile. All items are loaded into
* lets the mobile load an item or mobile. All items * inventory, unless it is NO-TAKE. */
* are loaded into inventory, unless it is NO-TAKE.
*/
ACMD(do_mload) ACMD(do_mload)
{ {
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
@ -476,12 +430,9 @@ ACMD(do_mload)
mob_log(ch, "mload: bad type"); mob_log(ch, "mload: bad type");
} }
/* Lets the mobile purge all objects and other npcs in the room, or purge a
/* * specified object or mob in the room. It can purge itself, but this will
* lets the mobile purge all objects and other npcs in the room, * be the last command it does. */
* or purge a specified object or mob in the room. It can purge
* itself, but this will be the last command it does.
*/
ACMD(do_mpurge) ACMD(do_mpurge)
{ {
char arg[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH];
@ -549,7 +500,6 @@ ACMD(do_mpurge)
extract_char(victim); extract_char(victim);
} }
/* lets the mobile goto any location it wishes that is not private */ /* lets the mobile goto any location it wishes that is not private */
ACMD(do_mgoto) ACMD(do_mgoto)
{ {
@ -584,7 +534,6 @@ ACMD(do_mgoto)
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1); enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
} }
/* lets the mobile do a command at another location. Very useful */ /* lets the mobile do a command at another location. Very useful */
ACMD(do_mat) ACMD(do_mat)
{ {
@ -626,11 +575,8 @@ ACMD(do_mat)
} }
} }
/* Lets the mobile transfer people. The all argument transfers everyone in the
/* * current room to the specified location. */
* lets the mobile transfer people. the all argument transfers
* everyone in the current room to the specified location
*/
ACMD(do_mteleport) ACMD(do_mteleport)
{ {
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
@ -693,7 +639,6 @@ ACMD(do_mteleport)
} }
} }
ACMD(do_mdamage) { ACMD(do_mdamage) {
char name[MAX_INPUT_LENGTH], amount[MAX_INPUT_LENGTH]; char name[MAX_INPUT_LENGTH], amount[MAX_INPUT_LENGTH];
int dam = 0; int dam = 0;
@ -728,10 +673,8 @@ ACMD(do_mdamage) {
script_damage(vict, dam); script_damage(vict, dam);
} }
/* /* Lets the mobile force someone to do something. must be mortal level and the
* lets the mobile force someone to do something. must be mortal level * all argument only affects those in the room with the mobile. */
* and the all argument only affects those in the room with the mobile
*/
ACMD(do_mforce) ACMD(do_mforce)
{ {
char arg[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH];
@ -832,7 +775,6 @@ ACMD(do_mhunt)
} }
/* place someone into the mob's memory list */ /* place someone into the mob's memory list */
ACMD(do_mremember) ACMD(do_mremember)
{ {
@ -884,7 +826,6 @@ ACMD(do_mremember)
} }
} }
/* remove someone from the list */ /* remove someone from the list */
ACMD(do_mforget) ACMD(do_mforget)
{ {
@ -941,7 +882,6 @@ ACMD(do_mforget)
} }
} }
/* transform into a different mobile */ /* transform into a different mobile */
ACMD(do_mtransform) ACMD(do_mtransform)
{ {
@ -984,7 +924,6 @@ ACMD(do_mtransform)
} }
/* move new obj info over to old object and delete new obj */ /* move new obj info over to old object and delete new obj */
for (pos = 0; pos < NUM_WEARS; pos++) { for (pos = 0; pos < NUM_WEARS; pos++) {
if (GET_EQ(ch, pos)) if (GET_EQ(ch, pos))
obj[pos] = unequip_char(ch, pos); obj[pos] = unequip_char(ch, pos);
@ -1010,7 +949,6 @@ ACMD(do_mtransform)
if(m->player.description) if(m->player.description)
tmpmob.player.description = strdup(m->player.description); tmpmob.player.description = strdup(m->player.description);
tmpmob.id = ch->id; tmpmob.id = ch->id;
tmpmob.affected = ch->affected; tmpmob.affected = ch->affected;
tmpmob.carrying = ch->carrying; tmpmob.carrying = ch->carrying;
@ -1047,7 +985,6 @@ ACMD(do_mtransform)
} }
} }
ACMD(do_mdoor) ACMD(do_mdoor)
{ {
char target[MAX_INPUT_LENGTH], direction[MAX_INPUT_LENGTH]; char target[MAX_INPUT_LENGTH], direction[MAX_INPUT_LENGTH];
@ -1066,7 +1003,6 @@ ACMD(do_mdoor)
"\n" "\n"
}; };
if (!MOB_OR_IMPL(ch)) { if (!MOB_OR_IMPL(ch)) {
send_to_char(ch, "Huh?!?\r\n"); send_to_char(ch, "Huh?!?\r\n");
return; return;
@ -1220,8 +1156,8 @@ ACMD(do_mfollow)
leader->followers = k; leader->followers = k;
} }
/* prints the message to everyone in the range of numbers */ /* Prints the message to everyone in the range of numbers. Thanks to Jamie
/* Thx to Jamie Nelson of 4D for this contribution */ * Nelson of 4D for this contribution */
ACMD(do_mrecho) ACMD(do_mrecho)
{ {
char start[MAX_INPUT_LENGTH], finish[MAX_INPUT_LENGTH], *msg; char start[MAX_INPUT_LENGTH], finish[MAX_INPUT_LENGTH], *msg;

View file

@ -1,8 +1,6 @@
/************************************************************************** /**************************************************************************
* File: dg_objcmd.c * * File: dg_objcmd.c Part of tbaMUD *
* Usage: contains the command_interpreter for objects, * * Usage: Contains the command_interpreter for objects, object commands. *
* object commands. *
* *
* * * *
* $Author: galion/Mark A. Heilpern/egreen/Welcor $ * * $Author: galion/Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ * * $Date: 2004/10/11 12:07:00$ *
@ -11,8 +9,6 @@
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
#include "structs.h" #include "structs.h"
#include "screen.h" #include "screen.h"
#include "dg_scripts.h" #include "dg_scripts.h"
@ -27,9 +23,7 @@ void die(struct char_data * ch, struct char_data *killer);
bitvector_t asciiflag_conv(char *flag); bitvector_t asciiflag_conv(char *flag);
zone_rnum real_zone_by_thing(room_vnum vznum); zone_rnum real_zone_by_thing(room_vnum vznum);
/* /* Local functions */
* Local functions
*/
#define OCMD(name) \ #define OCMD(name) \
void (name)(obj_data *obj, char *argument, int cmd, int subcmd) void (name)(obj_data *obj, char *argument, int cmd, int subcmd)
@ -52,20 +46,16 @@ OCMD(do_osetval);
OCMD(do_oat); OCMD(do_oat);
void obj_command_interpreter(obj_data *obj, char *argument); void obj_command_interpreter(obj_data *obj, char *argument);
struct obj_command_info { struct obj_command_info {
char *command; char *command;
void (*command_pointer)(obj_data *obj, char *argument, int cmd, int subcmd); void (*command_pointer)(obj_data *obj, char *argument, int cmd, int subcmd);
int subcmd; int subcmd;
}; };
/* do_osend */ /* do_osend */
#define SCMD_OSEND 0 #define SCMD_OSEND 0
#define SCMD_OECHOAROUND 1 #define SCMD_OECHOAROUND 1
/* attaches object name and vnum to msg and sends it to script_log */ /* attaches object name and vnum to msg and sends it to script_log */
void obj_log(obj_data *obj, const char *format, ...) void obj_log(obj_data *obj, const char *format, ...)
{ {
@ -94,7 +84,6 @@ room_rnum obj_room(obj_data *obj)
return NOWHERE; return NOWHERE;
} }
/* returns the real room number, or NOWHERE if not found or invalid */ /* returns the real room number, or NOWHERE if not found or invalid */
room_rnum find_obj_target_room(obj_data *obj, char *rawroomstr) room_rnum find_obj_target_room(obj_data *obj, char *rawroomstr)
{ {
@ -143,10 +132,7 @@ room_rnum find_obj_target_room(obj_data *obj, char *rawroomstr)
return location; return location;
} }
/* Object commands */ /* Object commands */
OCMD(do_oecho) OCMD(do_oecho)
{ {
int room; int room;
@ -168,7 +154,6 @@ OCMD(do_oecho)
obj_log(obj, "oecho called by object in NOWHERE"); obj_log(obj, "oecho called by object in NOWHERE");
} }
OCMD(do_oforce) OCMD(do_oforce)
{ {
char_data *ch, *next_ch; char_data *ch, *next_ch;
@ -268,8 +253,8 @@ OCMD(do_osend)
obj_log(obj, "no target found for osend"); obj_log(obj, "no target found for osend");
} }
/* prints the message to everyone in the range of numbers */ /* Prints the message to everyone in the range of numbers. Thanks to Jamie
/* Thx to Jamie Nelson of 4D for this contribution */ * Nelson of 4D for this contribution. */
OCMD(do_orecho) OCMD(do_orecho)
{ {
char start[MAX_INPUT_LENGTH], finish[MAX_INPUT_LENGTH], *msg; char start[MAX_INPUT_LENGTH], finish[MAX_INPUT_LENGTH], *msg;
@ -285,7 +270,6 @@ OCMD(do_orecho)
} }
/* set the object's timer value */ /* set the object's timer value */
OCMD(do_otimer) OCMD(do_otimer)
{ {
@ -301,10 +285,8 @@ OCMD(do_otimer)
GET_OBJ_TIMER(obj) = atoi(arg); GET_OBJ_TIMER(obj) = atoi(arg);
} }
/* Transform into a different object. Note: this shouldn't be used with
/* transform into a different object */ * containers unless both objects are containers! */
/* note: this shouldn't be used with containers unless both objects */
/* are containers! */
OCMD(do_otransform) OCMD(do_otransform)
{ {
char arg[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH];
@ -354,7 +336,6 @@ OCMD(do_otransform)
} }
} }
/* purge all objects an npcs in room, or specified object or mob */ /* purge all objects an npcs in room, or specified object or mob */
OCMD(do_opurge) OCMD(do_opurge)
{ {
@ -405,7 +386,6 @@ OCMD(do_opurge)
extract_char(ch); extract_char(ch);
} }
OCMD(do_oteleport) OCMD(do_oteleport)
{ {
char_data *ch, *next_ch; char_data *ch, *next_ch;
@ -457,7 +437,6 @@ OCMD(do_oteleport)
} }
} }
OCMD(do_dgoload) OCMD(do_dgoload)
{ {
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
@ -583,7 +562,6 @@ OCMD(do_odamage) {
script_damage(ch, dam); script_damage(ch, dam);
} }
OCMD(do_oasound) OCMD(do_oasound)
{ {
room_rnum room; room_rnum room;
@ -612,7 +590,6 @@ OCMD(do_oasound)
} }
} }
OCMD(do_odoor) OCMD(do_odoor)
{ {
char target[MAX_INPUT_LENGTH], direction[MAX_INPUT_LENGTH]; char target[MAX_INPUT_LENGTH], direction[MAX_INPUT_LENGTH];
@ -631,7 +608,6 @@ OCMD(do_odoor)
"\n" "\n"
}; };
argument = two_arguments(argument, target, direction); argument = two_arguments(argument, target, direction);
value = one_argument(argument, field); value = one_argument(argument, field);
skip_spaces(&value); skip_spaces(&value);
@ -706,7 +682,6 @@ OCMD(do_odoor)
} }
} }
OCMD(do_osetval) OCMD(do_osetval)
{ {
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
@ -727,7 +702,7 @@ OCMD(do_osetval)
obj_log(obj, "osetval: position out of bounds!"); obj_log(obj, "osetval: position out of bounds!");
} }
/* submitted by PurpleOnyx - tkhasi@shadowglen.com*/ /* Submitted by PurpleOnyx */
OCMD(do_oat) OCMD(do_oat)
{ {
room_rnum loc = NOWHERE; room_rnum loc = NOWHERE;
@ -790,11 +765,7 @@ const struct obj_command_info obj_cmd_info[] = {
{ "\n", 0, 0 } /* this must be last */ { "\n", 0, 0 } /* this must be last */
}; };
/* This is the command interpreter used by objects, called by script_driver. */
/*
* This is the command interpreter used by objects, called by script_driver.
*/
void obj_command_interpreter(obj_data *obj, char *argument) void obj_command_interpreter(obj_data *obj, char *argument)
{ {
int cmd, length; int cmd, length;

View file

@ -1,11 +1,6 @@
/************************************************************************** /**************************************************************************
* File: dg_olc.c * * File: dg_olc.c Part of tbaMUD *
* * * Usage: this source file is used in extending Oasis OLC for trigedit. *
* Usage: this source file is used in extending Oasis style OLC for *
* dg-scripts onto a CircleMUD that already has dg-scripts (as released *
* by Mark Heilpern on 1/1/98) implemented. *
* *
* Parts of this file by Chris Jacobson of _Aliens vs Predator: The MUD_ *
* * * *
* $Author: Chris Jacobsen/Mark A. Heilpern/egreen/Welcor $ * * $Author: Chris Jacobsen/Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ * * $Date: 2004/10/11 12:07:00$ *
@ -768,8 +763,7 @@ int dg_script_edit_parse(struct descriptor_data *d, char *arg)
* Solution: Here we just point the working copies to the new * Solution: Here we just point the working copies to the new
* proto_scripts. We only update the original when choosing to save * proto_scripts. We only update the original when choosing to save
* internally, then free the unused memory there. -Welcor * internally, then free the unused memory there. -Welcor
* Thanks to Jeremy Stanley - fungi@yuggoth.org and Torgny Bjers - * Thanks to Jeremy Stanley and Torgny Bjers for the bug report.
* artovil@arcanerealms.org for the bug report.
* After updating to OasisOLC 2.0.3 I discovered some malfunctions * After updating to OasisOLC 2.0.3 I discovered some malfunctions
* in this code, so I restructured it a bit. Now things work like * in this code, so I restructured it a bit. Now things work like
* this: OLC_SCRIPT(d) is assigned a copy of the edited things' * this: OLC_SCRIPT(d) is assigned a copy of the edited things'

View file

@ -1,9 +1,7 @@
/************************************************************************** /**************************************************************************
* File: dg_olc.h * * File: dg_olc.h Part of tbaMUD *
* * * *
* Usage: this source file is used in extending Oasis style OLC for * * Usage: This source file is used in extending Oasis OLC for trigedit. *
* dg-scripts onto a CircleMUD that already has dg-scripts (as released *
* by Mark Heilpern on 1/1/98) implemented. *
* * * *
* $Author: Mark A. Heilpern/egreen/Welcor $ * * $Author: Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ * * $Date: 2004/10/11 12:07:00$ *
@ -12,12 +10,9 @@
#include "dg_scripts.h" #include "dg_scripts.h"
#define NUM_TRIG_TYPE_FLAGS 20 #define NUM_TRIG_TYPE_FLAGS 20
/* /* Submodes of TRIGEDIT connectedness. */
* Submodes of TRIGEDIT connectedness.
*/
#define TRIGEDIT_MAIN_MENU 0 #define TRIGEDIT_MAIN_MENU 0
#define TRIGEDIT_TRIGTYPE 1 #define TRIGEDIT_TRIGTYPE 1
#define TRIGEDIT_CONFIRM_SAVESTRING 2 #define TRIGEDIT_CONFIRM_SAVESTRING 2

View file

@ -1,7 +1,6 @@
/************************************************************************** /**************************************************************************
* File: dg_scripts.c * * File: dg_scripts.c Part of tbaMUD *
* Usage: contains the main script driver interface. * * Usage: Contains the main script driver interface. *
* *
* * * *
* $Author: Mark A. Heilpern/egreen/Welcor $ * * $Author: Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ * * $Date: 2004/10/11 12:07:00$ *
@ -10,8 +9,6 @@
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
#include "structs.h" #include "structs.h"
#include "dg_scripts.h" #include "dg_scripts.h"
#include "utils.h" #include "utils.h"
@ -87,8 +84,8 @@ ACMD(do_detach);
ACMD(do_vdelete); ACMD(do_vdelete);
ACMD(do_tstat); ACMD(do_tstat);
/* Return pointer to first occurrence of string ct in */ /* Return pointer to first occurrence of string ct in cs, or NULL if not
/* cs, or NULL if not present. Case insensitive */ * present. Case insensitive */
char *str_str(char *cs, char *ct) char *str_str(char *cs, char *ct)
{ {
char *s, *t; char *s, *t;
@ -116,7 +113,6 @@ char *str_str(char *cs, char *ct)
return NULL; return NULL;
} }
int trgvar_in_room(room_vnum vnum) { int trgvar_in_room(room_vnum vnum) {
room_rnum rnum = real_room(vnum); room_rnum rnum = real_room(vnum);
int i = 0; int i = 0;
@ -189,8 +185,8 @@ obj_data *get_object_in_equip(char_data * ch, char *name)
return NULL; return NULL;
} }
/* Handles 'held', 'light' and 'wield' positions - Welcor /* Handles 'held', 'light' and 'wield' positions - Welcor. After idea from
After idea from Byron Ellacott - bje@apnic.net */ * Byron Ellacott. */
int find_eq_pos_script(char *arg) int find_eq_pos_script(char *arg)
{ {
int i; int i;
@ -255,11 +251,7 @@ int can_wear_on_pos(struct obj_data *obj, int pos)
} }
} }
/************************************************************ /* Search by number routines. Return char with UID n. */
* search by number routines
************************************************************/
/* return char with UID n */
struct char_data *find_char(long n) struct char_data *find_char(long n)
{ {
if (n>=ROOM_ID_BASE) /* See note in dg_scripts.h */ if (n>=ROOM_ID_BASE) /* See note in dg_scripts.h */
@ -268,7 +260,6 @@ struct char_data *find_char(long n)
return find_char_by_uid_in_lookup_table(n); return find_char_by_uid_in_lookup_table(n);
} }
/* return object with UID n */ /* return object with UID n */
obj_data *find_obj(long n) obj_data *find_obj(long n)
{ {
@ -294,10 +285,7 @@ room_data *find_room(long n)
return NULL; return NULL;
} }
/************************************************************ /* Generic searches based only on name. */
* generic searches based only on name
************************************************************/
/* search the entire world for a char, and return a pointer */ /* search the entire world for a char, and return a pointer */
char_data *get_char(char *name) char_data *get_char(char *name)
{ {
@ -318,9 +306,7 @@ char_data *get_char(char *name)
return NULL; return NULL;
} }
/* /* Finds a char in the same room as the object with the name 'name.' */
* Finds a char in the same room as the object with the name 'name'
*/
char_data *get_char_near_obj(obj_data *obj, char *name) char_data *get_char_near_obj(obj_data *obj, char *name)
{ {
char_data *ch; char_data *ch;
@ -342,11 +328,8 @@ char_data *get_char_near_obj(obj_data *obj, char *name)
return NULL; return NULL;
} }
/* Returns a pointer to the first character in world by name name, or NULL if
/* * none found. Starts searching in room room first. */
* returns a pointer to the first character in world by name name,
* or NULL if none found. Starts searching in room room first
*/
char_data *get_char_in_room(room_data *room, char *name) char_data *get_char_in_room(room_data *room, char *name)
{ {
char_data *ch; char_data *ch;
@ -367,7 +350,6 @@ char_data *get_char_in_room(room_data *room, char *name)
} }
/* searches the room with the object for an object with name 'name'*/ /* searches the room with the object for an object with name 'name'*/
obj_data *get_obj_near_obj(obj_data *obj, char *name) obj_data *get_obj_near_obj(obj_data *obj, char *name)
{ {
obj_data *i = NULL; obj_data *i = NULL;
@ -428,7 +410,6 @@ obj_data *get_obj(char *name)
return NULL; return NULL;
} }
/* finds room by id or vnum. returns NULL if not found */ /* finds room by id or vnum. returns NULL if not found */
room_data *get_room(char *name) room_data *get_room(char *name)
{ {
@ -442,11 +423,8 @@ room_data *get_room(char *name)
return &world[nr]; return &world[nr];
} }
/* Returns a pointer to the first character in world by name name, or NULL if
/* * none found. Starts searching with the person owing the object. */
* returns a pointer to the first character in world by name name,
* or NULL if none found. Starts searching with the person owing the object
*/
char_data *get_char_by_obj(obj_data *obj, char *name) char_data *get_char_by_obj(obj_data *obj, char *name)
{ {
char_data *ch; char_data *ch;
@ -476,11 +454,8 @@ char_data *get_char_by_obj(obj_data *obj, char *name)
return NULL; return NULL;
} }
/* Returns a pointer to the first character in world by name name, or NULL if
/* * none found. Starts searching in room room first. */
* returns a pointer to the first character in world by name name,
* or NULL if none found. Starts searching in room room first
*/
char_data *get_char_by_room(room_data *room, char *name) char_data *get_char_by_room(room_data *room, char *name)
{ {
char_data *ch; char_data *ch;
@ -505,11 +480,8 @@ char_data *get_char_by_room(room_data *room, char *name)
return NULL; return NULL;
} }
/* Returns the object in the world with name name, or NULL if not found search
/* * based on obj. */
* returns the object in the world with name name, or NULL if not found
* search based on obj
*/
obj_data *get_obj_by_obj(obj_data *obj, char *name) obj_data *get_obj_by_obj(obj_data *obj, char *name)
{ {
obj_data *i = NULL; obj_data *i = NULL;
@ -663,7 +635,6 @@ void check_time_triggers(void)
} }
} }
EVENTFUNC(trig_wait_event) EVENTFUNC(trig_wait_event)
{ {
struct wait_event_data *wait_event_obj = (struct wait_event_data *)event_obj; struct wait_event_data *wait_event_obj = (struct wait_event_data *)event_obj;
@ -713,7 +684,6 @@ EVENTFUNC(trig_wait_event)
return 0; return 0;
} }
void do_stat_trigger(struct char_data *ch, trig_data *trig) void do_stat_trigger(struct char_data *ch, trig_data *trig)
{ {
struct cmdlist_element *cmd_list; struct cmdlist_element *cmd_list;
@ -764,7 +734,6 @@ void do_stat_trigger(struct char_data *ch, trig_data *trig)
page_string(ch->desc, sb, 1); page_string(ch->desc, sb, 1);
} }
/* find the name of what the uid points to */ /* find the name of what the uid points to */
void find_uid_name(char *uid, char *name, size_t nlen) void find_uid_name(char *uid, char *name, size_t nlen)
{ {
@ -779,7 +748,6 @@ void find_uid_name(char *uid, char *name, size_t nlen)
snprintf(name, nlen, "uid = %s, (not found)", uid + 1); snprintf(name, nlen, "uid = %s, (not found)", uid + 1);
} }
/* general function to display stats on script sc */ /* general function to display stats on script sc */
void script_stat (char_data *ch, struct script_data *sc) void script_stat (char_data *ch, struct script_data *sc)
{ {
@ -840,7 +808,6 @@ void script_stat (char_data *ch, struct script_data *sc)
} }
} }
void do_sstat_room(struct char_data * ch, struct room_data *rm) void do_sstat_room(struct char_data * ch, struct room_data *rm)
{ {
send_to_char(ch, "Script information:\r\n"); send_to_char(ch, "Script information:\r\n");
@ -852,7 +819,6 @@ void do_sstat_room(struct char_data * ch, struct room_data *rm)
script_stat(ch, SCRIPT(rm)); script_stat(ch, SCRIPT(rm));
} }
void do_sstat_object(char_data *ch, obj_data *j) void do_sstat_object(char_data *ch, obj_data *j)
{ {
send_to_char(ch, "Script information:\r\n"); send_to_char(ch, "Script information:\r\n");
@ -864,7 +830,6 @@ void do_sstat_object(char_data *ch, obj_data *j)
script_stat(ch, SCRIPT(j)); script_stat(ch, SCRIPT(j));
} }
void do_sstat_character(char_data *ch, char_data *k) void do_sstat_character(char_data *ch, char_data *k)
{ {
send_to_char(ch, "Script information:\r\n"); send_to_char(ch, "Script information:\r\n");
@ -876,11 +841,8 @@ void do_sstat_character(char_data *ch, char_data *k)
script_stat(ch, SCRIPT(k)); script_stat(ch, SCRIPT(k));
} }
/* Adds the trigger t to script sc in in location loc. loc = -1 means add to
/* * the end, loc = 0 means add before all other triggers. */
* adds the trigger t to script sc in in location loc. loc = -1 means
* add to the end, loc = 0 means add before all other triggers.
*/
void add_trigger(struct script_data *sc, trig_data *t, int loc) void add_trigger(struct script_data *sc, trig_data *t, int loc)
{ {
trig_data *i; trig_data *i;
@ -904,7 +866,6 @@ void add_trigger(struct script_data *sc, trig_data *t, int loc)
trigger_list = t; trigger_list = t;
} }
ACMD(do_attach) ACMD(do_attach)
{ {
char_data *victim; char_data *victim;
@ -1042,15 +1003,12 @@ ACMD(do_attach)
send_to_char(ch, "Please specify 'mob', 'obj', or 'room'.\r\n"); send_to_char(ch, "Please specify 'mob', 'obj', or 'room'.\r\n");
} }
/* Removes the trigger specified by name, and the script of o if it removes the
/* * last trigger. name can either be a number, or a 'silly' name for the
* removes the trigger specified by name, and the script of o if * trigger, including things like 2.beggar-death. Returns 0 if did not find the
* it removes the last trigger. name can either be a number, or * trigger, otherwise 1. If it matters, you might need to check to see if all
* a 'silly' name for the trigger, including things like 2.beggar-death. * the triggers were removed after this function returns, in order to remove
* returns 0 if did not find the trigger, otherwise 1. If it matters, * the script. */
* you might need to check to see if all the triggers were removed after
* this function returns, in order to remove the script.
*/
int remove_trigger(struct script_data *sc, char *name) int remove_trigger(struct script_data *sc, char *name)
{ {
trig_data *i, *j; trig_data *i, *j;
@ -1078,9 +1036,8 @@ int remove_trigger(struct script_data *sc, char *name)
break; break;
} }
/* this isn't clean... */ /* This isn't clean. A numeric value will match if it's position OR vnum
/* a numeric value will match if it's position OR vnum */ * is found. originally the number was position-only. */
/* is found. originally the number was position-only */
else if (++n >= num) else if (++n >= num)
break; break;
else if (trig_index[i->nr]->vnum == num) else if (trig_index[i->nr]->vnum == num)
@ -1258,10 +1215,8 @@ ACMD(do_detach)
} }
} }
/* /* Logs any errors caused by scripts to the system log. Will eventually allow
* Logs any errors caused by scripts to the system log. * on-line view of script errors. */
* Will eventually allow on-line view of script errors.
*/
void script_vlog(const char *format, va_list args) void script_vlog(const char *format, va_list args)
{ {
char output[MAX_STRING_LENGTH]; char output[MAX_STRING_LENGTH];
@ -1290,7 +1245,6 @@ void script_vlog(const char *format, va_list args)
} }
} }
void script_log(const char *format, ...) void script_log(const char *format, ...)
{ {
va_list args; va_list args;
@ -1300,8 +1254,8 @@ void script_log(const char *format, ...)
va_end(args); va_end(args);
} }
/* returns 1 if string is all digits, else 0 */ /* Returns 1 if string is all digits, else 0. Bugfixed - would have returned
/* bugfixed - would have returned true on num="------" */ * true on num="------". */
int is_num(char *arg) int is_num(char *arg)
{ {
if (*arg == '\0') if (*arg == '\0')
@ -1319,7 +1273,6 @@ int is_num(char *arg)
return TRUE; return TRUE;
} }
/* evaluates 'lhs op rhs', and copies to result */ /* evaluates 'lhs op rhs', and copies to result */
void eval_op(char *op, char *lhs, char *rhs, char *result, void *go, void eval_op(char *op, char *lhs, char *rhs, char *result, void *go,
struct script_data *sc, trig_data *trig) struct script_data *sc, trig_data *trig)
@ -1419,11 +1372,8 @@ void eval_op(char *op, char *lhs, char *rhs, char *result, void *go,
} }
} }
/* p points to the first quote, returns the matching end quote, or the last
/* * non-null char in p.*/
* p points to the first quote, returns the matching
* end quote, or the last non-null char in p.
*/
char *matching_quote(char *p) char *matching_quote(char *p)
{ {
for (p++; *p && (*p != '"'); p++) { for (p++; *p && (*p != '"'); p++) {
@ -1437,10 +1387,8 @@ char *matching_quote(char *p)
return p; return p;
} }
/* /* p points to the first paren. returns a pointer to the matching closing
* p points to the first paren. returns a pointer to the * paren, or the last non-null char in p. */
* matching closing paren, or the last non-null char in p.
*/
char *matching_paren(char *p) char *matching_paren(char *p)
{ {
int i; int i;
@ -1457,7 +1405,6 @@ char *matching_paren(char *p)
return --p; return --p;
} }
/* evaluates line, and returns answer in result */ /* evaluates line, and returns answer in result */
void eval_expr(char *line, char *result, void *go, struct script_data *sc, void eval_expr(char *line, char *result, void *go, struct script_data *sc,
trig_data *trig, int type) trig_data *trig, int type)
@ -1480,11 +1427,8 @@ void eval_expr(char *line, char *result, void *go, struct script_data *sc,
var_subst(go, sc, trig, type, line, result); var_subst(go, sc, trig, type, line, result);
} }
/* Evaluates expr if it is in the form lhs op rhs, and copies answer in result.
/* * Returns 1 if expr is evaluated, else 0. */
* evaluates expr if it is in the form lhs op rhs, and copies
* answer in result. returns 1 if expr is evaluated, else 0
*/
int eval_lhs_op_rhs(char *expr, char *result, void *go, struct script_data *sc, int eval_lhs_op_rhs(char *expr, char *result, void *go, struct script_data *sc,
trig_data *trig, int type) trig_data *trig, int type)
{ {
@ -1516,10 +1460,8 @@ int eval_lhs_op_rhs(char *expr, char *result, void *go, struct script_data *sc,
p = strcpy(line, expr); p = strcpy(line, expr);
/* /* Initialize tokens, an array of pointers to locations in line where the
* initialize tokens, an array of pointers to locations * ops could possibly occur. */
* in line where the ops could possibly occur.
*/
for (j = 0; *p; j++) { for (j = 0; *p; j++) {
tokens[j] = p; tokens[j] = p;
if (*p == '(') if (*p == '(')
@ -1549,8 +1491,6 @@ int eval_lhs_op_rhs(char *expr, char *result, void *go, struct script_data *sc,
return 0; return 0;
} }
/* returns 1 if cond is true, else 0 */ /* returns 1 if cond is true, else 0 */
int process_if(char *cond, void *go, struct script_data *sc, int process_if(char *cond, void *go, struct script_data *sc,
trig_data *trig, int type) trig_data *trig, int type)
@ -1568,9 +1508,8 @@ int process_if(char *cond, void *go, struct script_data *sc,
return 1; return 1;
} }
/* Scans for end of if-block. returns the line containg 'end', or the last
/* scans for end of if-block. returns the line containg 'end', or the last * line of the trigger if not found. */
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;
@ -1601,14 +1540,10 @@ struct cmdlist_element *find_end(trig_data *trig, struct cmdlist_element *cl)
return c; return c;
} }
/* Searches for valid elseif, else, or end to continue execution at. Returns
/* * line of elseif, else, or end if found, or last line of trigger. */
* searches for valid elseif, else, or end to continue execution at.
* returns line of elseif, else, or end if found, or last line of trigger.
*/
struct cmdlist_element *find_else_end(trig_data *trig, struct cmdlist_element *find_else_end(trig_data *trig,
struct cmdlist_element *cl, void *go, struct cmdlist_element *cl, void *go, struct script_data *sc, int type)
struct script_data *sc, int type)
{ {
struct cmdlist_element *c; struct cmdlist_element *c;
char *p; char *p;
@ -1644,14 +1579,13 @@ struct cmdlist_element *find_else_end(trig_data *trig,
} }
} }
//rryan: if we got here, it's the last line, if its not an end, script_log it /* rryan: if we got here, it's the last line, if its not an end, log it. */
for (p = c->cmd; *p && isspace(*p); p++); /* skip spaces */ for (p = c->cmd; *p && isspace(*p); p++); /* skip spaces */
if(strn_cmp("end", p, 3)) if(strn_cmp("end", p, 3))
script_log("Trigger VNum %d has 'if' without 'end'. (error 5)", GET_TRIG_VNUM(trig)); script_log("Trigger VNum %d has 'if' without 'end'. (error 5)", GET_TRIG_VNUM(trig));
return c; return c;
} }
/* processes any 'wait' commands in a trigger */ /* processes any 'wait' commands in a trigger */
void process_wait(void *go, trig_data *trig, int type, char *cmd, void process_wait(void *go, trig_data *trig, int type, char *cmd,
struct cmdlist_element *cl) struct cmdlist_element *cl)
@ -1709,7 +1643,6 @@ void process_wait(void *go, trig_data *trig, int type, char *cmd,
trig->curr_state = cl->next; trig->curr_state = cl->next;
} }
/* processes a script set command */ /* processes a script set command */
void process_set(struct script_data *sc, trig_data *trig, char *cmd) void process_set(struct script_data *sc, trig_data *trig, char *cmd)
{ {
@ -1751,7 +1684,6 @@ void process_eval(void *go, struct script_data *sc, trig_data *trig,
add_var(&GET_TRIG_VARS(trig), name, result, sc ? sc->context : 0); add_var(&GET_TRIG_VARS(trig), name, result, sc ? sc->context : 0);
} }
/* script attaching a trigger to something */ /* script attaching a trigger to something */
void process_attach(void *go, struct script_data *sc, trig_data *trig, void process_attach(void *go, struct script_data *sc, trig_data *trig,
int type, char *cmd) int type, char *cmd)
@ -1832,10 +1764,8 @@ void process_attach(void *go, struct script_data *sc, trig_data *trig,
add_trigger(SCRIPT(r), newtrig, -1); add_trigger(SCRIPT(r), newtrig, -1);
return; return;
} }
} }
/* script detaching a trigger from something */ /* script detaching a trigger from something */
void process_detach(void *go, struct script_data *sc, trig_data *trig, void process_detach(void *go, struct script_data *sc, trig_data *trig,
int type, char *cmd) int type, char *cmd)
@ -1933,7 +1863,6 @@ struct room_data *dg_room_of_obj(struct obj_data *obj)
return NULL; return NULL;
} }
/* create a UID variable from the id number */ /* create a UID variable from the id number */
void makeuid_var(void *go, struct script_data *sc, trig_data *trig, void makeuid_var(void *go, struct script_data *sc, trig_data *trig,
int type, char *cmd) int type, char *cmd)
@ -2032,10 +1961,8 @@ void makeuid_var(void *go, struct script_data *sc, trig_data *trig,
add_var(&GET_TRIG_VARS(trig), varname, uid, sc ? sc->context : 0); add_var(&GET_TRIG_VARS(trig), varname, uid, sc ? sc->context : 0);
} }
/* /* Processes a script return command. Returns the new value for the script to
* processes a script return command. * return. */
* returns the new value for the script to return.
*/
int process_return(trig_data *trig, char *cmd) int process_return(trig_data *trig, char *cmd)
{ {
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
@ -2052,11 +1979,8 @@ int process_return(trig_data *trig, char *cmd)
return atoi(arg2); return atoi(arg2);
} }
/* Removes a variable from the global vars of sc, or the local vars of trig if
/* * not found in global list. */
* removes a variable from the global vars of sc,
* or the local vars of trig if not found in global list.
*/
void process_unset(struct script_data *sc, trig_data *trig, char *cmd) void process_unset(struct script_data *sc, trig_data *trig, char *cmd)
{ {
char arg[MAX_INPUT_LENGTH], *var; char arg[MAX_INPUT_LENGTH], *var;
@ -2075,11 +1999,8 @@ void process_unset(struct script_data *sc, trig_data *trig, char *cmd)
remove_var(&GET_TRIG_VARS(trig), var); remove_var(&GET_TRIG_VARS(trig), var);
} }
/* Copy a locally owned variable to the globals of another script.
/* * 'remote <variable_name> <uid>' */
* copy a locally owned variable to the globals of another script
* 'remote <variable_name> <uid>'
*/
void process_remote(struct script_data *sc, trig_data *trig, char *cmd) void process_remote(struct script_data *sc, trig_data *trig, char *cmd)
{ {
struct trig_var_data *vd; struct trig_var_data *vd;
@ -2129,8 +2050,8 @@ void process_remote(struct script_data *sc, trig_data *trig, char *cmd)
return; return;
} }
/* for all but PC's, context comes from the existing context. */ /* For all but PC's, context comes from the existing context. For PC's,
/* for PC's, context is 0 (global) */ * context is 0 (global) */
context = vd->context; context = vd->context;
if ((room = find_room(uid))) { if ((room = find_room(uid))) {
@ -2151,11 +2072,8 @@ void process_remote(struct script_data *sc, trig_data *trig, char *cmd)
add_var(&(sc_remote->global_vars), vd->name, vd->value, context); add_var(&(sc_remote->global_vars), vd->name, vd->value, context);
} }
/* Command-line interface to rdelete. Named vdelete so people didn't think it
/* * was to delete rooms. */
* command-line interface to rdelete
* named vdelete so people didn't think it was to delete rooms
*/
ACMD(do_vdelete) ACMD(do_vdelete)
{ {
struct trig_var_data *vd, *vd_prev=NULL; struct trig_var_data *vd, *vd_prev=NULL;
@ -2179,7 +2097,6 @@ ACMD(do_vdelete)
return; return;
} }
/* find the target script from the uid number */ /* find the target script from the uid number */
uid = atoi(buf2); uid = atoi(buf2);
if (uid<=0) { if (uid<=0) {
@ -2187,7 +2104,6 @@ ACMD(do_vdelete)
return; return;
} }
if ((room = find_room(uid))) { if ((room = find_room(uid))) {
sc_remote = SCRIPT(room); sc_remote = SCRIPT(room);
} else if ((mob = find_char(uid))) { } else if ((mob = find_char(uid))) {
@ -2245,10 +2161,8 @@ ACMD(do_vdelete)
send_to_char(ch, "Deleted.\r\n"); send_to_char(ch, "Deleted.\r\n");
} }
/* /* Called from do_set - return 0 for failure, 1 for success. ch and vict are
* Called from do_set - return 0 for failure, 1 for success. * verified. */
* ch and vict are verified
*/
int perform_set_dg_var(struct char_data *ch, struct char_data *vict, char *val_arg) int perform_set_dg_var(struct char_data *ch, struct char_data *vict, char *val_arg)
{ {
char var_name[MAX_INPUT_LENGTH], *var_value; char var_name[MAX_INPUT_LENGTH], *var_value;
@ -2266,10 +2180,8 @@ int perform_set_dg_var(struct char_data *ch, struct char_data *vict, char *val_a
return 1; return 1;
} }
/* /* Delete a variable from the globals of another script.
* delete a variable from the globals of another script * 'rdelete <variable_name> <uid>' */
* 'rdelete <variable_name> <uid>'
*/
void process_rdelete(struct script_data *sc, trig_data *trig, char *cmd) void process_rdelete(struct script_data *sc, trig_data *trig, char *cmd)
{ {
struct trig_var_data *vd, *vd_prev=NULL; struct trig_var_data *vd, *vd_prev=NULL;
@ -2288,14 +2200,12 @@ void process_rdelete(struct script_data *sc, trig_data *trig, char *cmd)
skip_spaces(&var); skip_spaces(&var);
skip_spaces(&uid_p); skip_spaces(&uid_p);
if (!*buf || !*buf2) { if (!*buf || !*buf2) {
script_log("Trigger: %s, VNum %d. rdelete: invalid arguments '%s'", script_log("Trigger: %s, VNum %d. rdelete: invalid arguments '%s'",
GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), cmd); GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), cmd);
return; return;
} }
/* find the target script from the uid number */ /* find the target script from the uid number */
uid = atoi(buf2); uid = atoi(buf2);
if (uid<=0) { if (uid<=0) {
@ -2304,7 +2214,6 @@ void process_rdelete(struct script_data *sc, trig_data *trig, char *cmd)
return; return;
} }
if ((room = find_room(uid))) { if ((room = find_room(uid))) {
sc_remote = SCRIPT(room); sc_remote = SCRIPT(room);
} else if ((mob = find_char(uid))) { } else if ((mob = find_char(uid))) {
@ -2339,10 +2248,7 @@ void process_rdelete(struct script_data *sc, trig_data *trig, char *cmd)
free(vd); free(vd);
} }
/* Makes a local variable into a global variable. */
/*
* makes a local variable into a global variable
*/
void process_global(struct script_data *sc, trig_data *trig, char *cmd, long id) void process_global(struct script_data *sc, trig_data *trig, char *cmd, long id)
{ {
struct trig_var_data *vd; struct trig_var_data *vd;
@ -2372,7 +2278,6 @@ void process_global(struct script_data *sc, trig_data *trig, char *cmd, long id)
remove_var(&GET_TRIG_VARS(trig), vd->name); remove_var(&GET_TRIG_VARS(trig), vd->name);
} }
/* set the current context for a script */ /* set the current context for a script */
void process_context(struct script_data *sc, trig_data *trig, char *cmd) void process_context(struct script_data *sc, trig_data *trig, char *cmd)
{ {
@ -2418,26 +2323,17 @@ void extract_value(struct script_data *sc, trig_data *trig, char *cmd)
add_var(&GET_TRIG_VARS(trig), to, buf, sc ? sc->context : 0); add_var(&GET_TRIG_VARS(trig), to, buf, sc ? sc->context : 0);
} }
/* /* Thanks to Jamie Nelson for 4 dimensions for this addition.
Thanks to Jamie Nelson for 4 dimensions for this addition * Syntax :
* dg_letter <new varname> <letter position> <string to get from>.
Syntax : * set string L337-String
dg_letter <new varname> <letter position> <string to get from> * dg_letter var1 4 %string%
* dg_letter var2 11 %string%
ie: * now %var1% == 7 and %var2% == g
set string L337-String * Note that the index starts at 1. */
dg_letter var1 4 %string%
dg_letter var2 11 %string%
now %var1% == 7 and %var2% == g
Note that the index starts at 1.
*/
void dg_letter_value(struct script_data *sc, trig_data *trig, char *cmd) void dg_letter_value(struct script_data *sc, trig_data *trig, char *cmd)
{ {
//set the letter/number at position 'num' as the variable. /* Set the letter/number at position 'num' as the variable. */
char junk[MAX_INPUT_LENGTH]; char junk[MAX_INPUT_LENGTH];
char varname[MAX_INPUT_LENGTH]; char varname[MAX_INPUT_LENGTH];
char num_s[MAX_INPUT_LENGTH]; char num_s[MAX_INPUT_LENGTH];
@ -2469,23 +2365,22 @@ void dg_letter_value(struct script_data *sc, trig_data *trig, char *cmd)
add_var(&GET_TRIG_VARS(trig), varname, junk, sc->context); add_var(&GET_TRIG_VARS(trig), varname, junk, sc->context);
} }
/* This is the core driver for scripts. */ /* This is the core driver for scripts.
/* Arguments: * Arguments:
void *go_adress * void *go_adress
A pointer to a pointer to the entity running the script. * A pointer to a pointer to the entity running the script. The reason for
The reason for this approcah is that we want to be able to see * this approcah is that we want to be able to see from the calling function,
from the calling function, if the entity has been free'd. * if the entity has been free'd.
*
trig_data *trig * trig_data *trig
A pointer to the current running trigger. * A pointer to the current running trigger.
*
int type * int type
MOB_TRIGGER, OBJ_TRIGGER or WLD_TRIGGER, respectively. * MOB_TRIGGER, OBJ_TRIGGER or WLD_TRIGGER, respectively.
*
int mode * int mode
TRIG_NEW just started from dg_triggers.c TRIG_NEW just started from dg_triggers.c
TRIG_RESTART restarted after a 'wait' TRIG_RESTART restarted after a 'wait' */
*/
int script_driver(void *go_adress, trig_data *trig, int type, int mode) int script_driver(void *go_adress, trig_data *trig, int type, int mode)
{ {
static int depth = 0; static int depth = 0;
@ -2534,17 +2429,11 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode)
extract_script(go, type); extract_script(go, type);
/* /* extract_script() works on rooms, but on mobiles and objects, it will be
extract_script() works on rooms, but on mobiles and objects, * called again if the caller is load_mtrigger or load_otrigger if it is
it will be called again if the * one of these, we must make sure the script is not just reloaded on the
caller is load_mtrigger or load_otrigger * next mob. We make the calling code decide how to handle it, so it does
if it is one of these, we must make sure the script * not get totally removed unless it's a load_xtrigger(). */
is not just reloaded on the next mob
We make the calling code decide how to handle it, so it doesn't
get totally removed unless it's a load_xtrigger().
*/
return SCRIPT_ERROR_CODE; return SCRIPT_ERROR_CODE;
} }
@ -2574,9 +2463,7 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode)
else if (!strn_cmp("elseif ", p, 7) || else if (!strn_cmp("elseif ", p, 7) ||
!strn_cmp("else", p, 4)) { !strn_cmp("else", p, 4)) {
/* /* If not in an if-block, ignore the extra 'else[if]' and warn about it. */
* if not in an if-block, ignore the extra 'else[if]' and warn about it
*/
if (GET_TRIG_DEPTH(trig) == 1) { if (GET_TRIG_DEPTH(trig) == 1) {
script_log("Trigger VNum %d has 'else' without 'if'.", script_log("Trigger VNum %d has 'else' without 'if'.",
GET_TRIG_VNUM(trig)); GET_TRIG_VNUM(trig));
@ -2600,9 +2487,7 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode)
} else if (!strn_cmp("switch ", p, 7)) { } else if (!strn_cmp("switch ", p, 7)) {
cl = find_case(trig, cl, go, sc, type, p + 7); cl = find_case(trig, cl, go, sc, type, p + 7);
} else if (!strn_cmp("end", p, 3)) { } else if (!strn_cmp("end", p, 3)) {
/* /* If not in an if-block, ignore the extra 'end' and warn about it. */
* if not in an if-block, ignore the extra 'end' and warn about it.
*/
if (GET_TRIG_DEPTH(trig) == 1) { if (GET_TRIG_DEPTH(trig) == 1) {
script_log("Trigger VNum %d has 'end' without 'if'.", script_log("Trigger VNum %d has 'end' without 'if'.",
GET_TRIG_VNUM(trig)); GET_TRIG_VNUM(trig));
@ -2639,9 +2524,7 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode)
/* Do nothing, this allows multiple cases to a single instance */ /* Do nothing, this allows multiple cases to a single instance */
} }
else { else {
var_subst(go, sc, trig, type, p, cmd); var_subst(go, sc, trig, type, p, cmd);
if (!strn_cmp(cmd, "eval ", 5)) if (!strn_cmp(cmd, "eval ", 5))
@ -2722,7 +2605,6 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode)
return ret_val; return ret_val;
} }
} }
} }
} }
@ -2782,11 +2664,8 @@ ACMD(do_tstat)
send_to_char(ch, "Usage: tstat <vnum>\r\n"); send_to_char(ch, "Usage: tstat <vnum>\r\n");
} }
/* /* Scans for a case/default instance. Returns the line containg the correct
* scans for a case/default instance * case instance, or the last line of the trigger if not found. */
* returns the line containg the correct case instance, or the last
* line of the trigger if not found.
*/
struct cmdlist_element * struct cmdlist_element *
find_case(struct trig_data *trig, struct cmdlist_element *cl, find_case(struct trig_data *trig, struct cmdlist_element *cl,
void *go, struct script_data *sc, int type, char *cond) void *go, struct script_data *sc, int type, char *cond)
@ -2821,12 +2700,9 @@ find_case(struct trig_data *trig, struct cmdlist_element *cl,
return c; return c;
} }
/* /* Scans for end of while/switch-blocks. Returns the line containg 'end', or
* scans for end of while/switch-blocks. * the last line of the trigger if not found. Malformed scripts may cause NULL
* returns the line containg 'end', or the last * to be returned. */
* line of the trigger if not found.
* Malformed scripts may cause NULL to be returned.
*/
struct cmdlist_element *find_done(struct cmdlist_element *cl) struct cmdlist_element *find_done(struct cmdlist_element *cl)
{ {
struct cmdlist_element *c; struct cmdlist_element *c;
@ -2847,7 +2723,6 @@ struct cmdlist_element *find_done(struct cmdlist_element *cl)
return c; return c;
} }
/* read a line in from a file, return the number of chars read */ /* read a line in from a file, return the number of chars read */
int fgetline(FILE *file, char *p) int fgetline(FILE *file, char *p)
{ {
@ -2866,7 +2741,6 @@ int fgetline(FILE *file, char *p)
return count; return count;
} }
/* load in a character's saved variables */ /* load in a character's saved variables */
void read_saved_vars(struct char_data *ch) void read_saved_vars(struct char_data *ch)
{ {
@ -2877,16 +2751,14 @@ void read_saved_vars(struct char_data *ch)
char varname[32]; char varname[32];
char context_str[16]; char context_str[16];
/* /* If getting to the menu from inside the game, the vars aren't removed. So
* If getting to the menu from inside the game, the vars aren't removed. * let's not allocate them again. */
* So let's not allocate them again.
*/
if (SCRIPT(ch)) if (SCRIPT(ch))
return; return;
/* create the space for the script structure which holds the vars */ /* Create the space for the script structure which holds the vars. We need to
/* We need to do this first, because later calls to 'remote' will need */ * do this first, because later calls to 'remote' will need. A script already
/* a script already assigned. */ * assigned. */
CREATE(SCRIPT(ch), struct script_data, 1); CREATE(SCRIPT(ch), struct script_data, 1);
/* find the file that holds the saved variables and open it*/ /* find the file that holds the saved variables and open it*/
@ -2923,8 +2795,8 @@ void save_char_vars(struct char_data *ch)
char fn[127]; char fn[127];
struct trig_var_data *vars; struct trig_var_data *vars;
/* immediate return if no script (and therefore no variables) structure */ /* Immediate return if no script (and therefore no variables) structure has
/* has been created. this will happen when the player is logging in */ * been created. this will happen when the player is logging in */
if (SCRIPT(ch) == NULL) return; if (SCRIPT(ch) == NULL) return;
/* we should never be called for an NPC, but just in case... */ /* we should never be called for an NPC, but just in case... */
@ -2944,8 +2816,8 @@ void save_char_vars(struct char_data *ch)
fn, strerror(errno)); fn, strerror(errno));
return; return;
} }
/* note that currently, context will always be zero. this may change */ /* Note that currently, context will always be zero. This may change in the
/* in the future */ * future. */
while (vars) { while (vars) {
if (*vars->name != '-') /* don't save if it begins with - */ if (*vars->name != '-') /* don't save if it begins with - */
fprintf(file, "%s %ld %s\n", vars->name, vars->context, vars->value); fprintf(file, "%s %ld %s\n", vars->name, vars->context, vars->value);
@ -2964,16 +2836,14 @@ void read_saved_vars_ascii(FILE *file, struct char_data *ch, int count)
char context_str[READ_SIZE]; char context_str[READ_SIZE];
int i; int i;
/* /* If getting to the menu from inside the game, the vars aren't removed. So
* If getting to the menu from inside the game, the vars aren't removed. * let's not allocate them again. */
* So let's not allocate them again.
*/
if (SCRIPT(ch)) if (SCRIPT(ch))
return; return;
/* create the space for the script structure which holds the vars */ /* Create the space for the script structure which holds the vars. We need to
/* We need to do this first, because later calls to 'remote' will need */ * do this first, because later calls to 'remote' will need. A script already
/* a script already assigned. */ * assigned. */
CREATE(SCRIPT(ch), struct script_data, 1); CREATE(SCRIPT(ch), struct script_data, 1);
/* walk through each line in the file parsing variables */ /* walk through each line in the file parsing variables */
@ -2997,8 +2867,8 @@ void save_char_vars_ascii(FILE *file, struct char_data *ch)
{ {
struct trig_var_data *vars; struct trig_var_data *vars;
int count = 0; int count = 0;
/* immediate return if no script (and therefore no variables) structure */ /* Immediate return if no script (and therefore no variables) structure has
/* has been created. this will happen when the player is logging in */ * been created. this will happen when the player is logging in */
if (SCRIPT(ch) == NULL) return; if (SCRIPT(ch) == NULL) return;
/* we should never be called for an NPC, but just in case... */ /* we should never be called for an NPC, but just in case... */
@ -3007,8 +2877,8 @@ void save_char_vars_ascii(FILE *file, struct char_data *ch)
/* make sure this char has global variables to save */ /* make sure this char has global variables to save */
if (ch->script->global_vars == NULL) return; if (ch->script->global_vars == NULL) return;
/* note that currently, context will always be zero. this may change */ /* Note that currently, context will always be zero. This may change in the
/* in the future */ * future */
for (vars = ch->script->global_vars;vars;vars = vars->next) for (vars = ch->script->global_vars;vars;vars = vars->next)
if (*vars->name != '-') if (*vars->name != '-')
count++; count++;
@ -3023,10 +2893,9 @@ void save_char_vars_ascii(FILE *file, struct char_data *ch)
} }
/* find_char() helpers */ /* find_char() helpers */
/* Must be power of 2. */
// Must be power of 2
#define BUCKET_COUNT 64 #define BUCKET_COUNT 64
// to recognize an empty bucket /* To recognize an empty bucket. */
#define UID_OUT_OF_RANGE 1000000000 #define UID_OUT_OF_RANGE 1000000000
struct lookup_table_t { struct lookup_table_t {
@ -3095,12 +2964,8 @@ void remove_from_lookup_table(long uid)
int bucket = (int) (uid & (BUCKET_COUNT - 1)); int bucket = (int) (uid & (BUCKET_COUNT - 1));
struct lookup_table_t *lt = &lookup_table[bucket], *flt = NULL; struct lookup_table_t *lt = &lookup_table[bucket], *flt = NULL;
/* /* This is not supposed to happen. UID 0 is not used. However, while I'm
* This is not supposed to happen. UID 0 is not used. * debugging the issue, let's just return right away. - Welcor */
* However, while I'm debugging the issue, let's just return right away.
*
* Welcor 02/04
*/
if (uid == 0) if (uid == 0)
return; return;

View file

@ -1,8 +1,8 @@
/************************************************************************** /**************************************************************************
* File: dg_scripts.h * * File: dg_scripts.h Part of tbaMUD *
* Usage: header file for script structures and constants, and *
* function prototypes for dg_scripts.c *
* * * *
* Usage: header file for script structures, constants, and function *
* prototypes for dg_scripts.c *
* * * *
* $Author: Mark A. Heilpern/egreen/Welcor $ * * $Author: Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ * * $Date: 2004/10/11 12:07:00$ *
@ -20,19 +20,16 @@
/* spells cast by objects and rooms use this level */ /* spells cast by objects and rooms use this level */
#define DG_SPELL_LEVEL 25 #define DG_SPELL_LEVEL 25
/* /* Define this if you don't want wear/remove triggers to fire when a player
* define this if you don't want wear/remove triggers to fire when * is saved. */
* a player is saved.
*/
#define NO_EXTRANEOUS_TRIGGERS #define NO_EXTRANEOUS_TRIGGERS
/*
* %actor.room% behaviour : /* %actor.room% behaviour :
* Until pl 7 %actor.room% returned a room vnum. * Until pl 7 %actor.room% returned a room vnum. Working with this number in
* Working with this number in scripts was unnecessarily hard, * scripts was unnecessarily hard, especially in those situations one needed
* especially in those situations one needed the id of the room, * the id of the room, the items in it, etc. As a result of this, the output
* the items in it, etc. As a result of this, the output * has been changed (as of pl 8) to a room variable.i This means old scripts
* has been changed (as of pl 8) to a room variable. * will need a minor adjustment;
* This means old scripts will need a minor adjustment;
* *
* Before: * Before:
* if %actor.room%==3001 * if %actor.room%==3001
@ -44,9 +41,7 @@
* %echo% You are at the main temple. * %echo% You are at the main temple.
* *
* If you wish to continue using the old style, comment out the line below. * If you wish to continue using the old style, comment out the line below.
* * - Welcor */
* Welcor
*/
#define ACTOR_ROOM_IS_UID 1 #define ACTOR_ROOM_IS_UID 1
/* mob trigger types */ /* mob trigger types */
@ -119,14 +114,10 @@
#define TRIG_NEW 0 /* trigger starts from top */ #define TRIG_NEW 0 /* trigger starts from top */
#define TRIG_RESTART 1 /* trigger restarting */ #define TRIG_RESTART 1 /* trigger restarting */
/* These are slightly off of PULSE_MOBILE so everything isnt happening at the
/* * same time. */
* These are slightly off of PULSE_MOBILE so
* everything isnt happening at the same time
*/
#define PULSE_DG_SCRIPT (13 RL_SEC) #define PULSE_DG_SCRIPT (13 RL_SEC)
#define MAX_SCRIPT_DEPTH 10 /* maximum depth triggers can #define MAX_SCRIPT_DEPTH 10 /* maximum depth triggers can
recurse into each other */ recurse into each other */
@ -168,7 +159,6 @@ struct trig_data {
struct trig_data *next_in_world; /* next in the global trigger list */ struct trig_data *next_in_world; /* next in the global trigger list */
}; };
/* a complete script (composed of several triggers) */ /* a complete script (composed of several triggers) */
struct script_data { struct script_data {
long types; /* bitvector of trigger types */ long types; /* bitvector of trigger types */
@ -201,7 +191,6 @@ struct script_memory {
struct script_memory *next; struct script_memory *next;
}; };
/* function prototypes from dg_triggers.c */ /* function prototypes from dg_triggers.c */
char *one_phrase(char *arg, char *first_arg); char *one_phrase(char *arg, char *first_arg);
int is_substring(char *sub, char *string); int is_substring(char *sub, char *string);
@ -315,7 +304,6 @@ void dg_read_trigger(FILE *fp, void *proto, int type);
void dg_obj_trigger(char *line, struct obj_data *obj); void dg_obj_trigger(char *line, struct obj_data *obj);
void assign_triggers(void *i, int type); void assign_triggers(void *i, int type);
/* From dg_variables.c */ /* From dg_variables.c */
void add_var(struct trig_var_data **var_list, char *name, char *value, long id); void add_var(struct trig_var_data **var_list, char *name, char *value, long id);
int item_in_list(char *item, obj_data *list); int item_in_list(char *item, obj_data *list);
@ -328,7 +316,6 @@ int text_processed(char *field, char *subfield, struct trig_var_data *vd,
void find_replacement(void *go, struct script_data *sc, trig_data *trig, void find_replacement(void *go, struct script_data *sc, trig_data *trig,
int type, char *var, char *field, char *subfield, char *str, size_t slen); int type, char *var, char *field, char *subfield, char *str, size_t slen);
/* From dg_handler.c */ /* From dg_handler.c */
void free_var_el(struct trig_var_data *var); void free_var_el(struct trig_var_data *var);
void free_varlist(struct trig_var_data *vd); void free_varlist(struct trig_var_data *vd);
@ -363,7 +350,6 @@ room_rnum obj_room(obj_data *obj);
#define DG_ALLOW_GODS (1<<0) #define DG_ALLOW_GODS (1<<0)
/* Macros for scripts */ /* Macros for scripts */
#define UID_CHAR '}' #define UID_CHAR '}'
#define GET_TRIG_NAME(t) ((t)->name) #define GET_TRIG_NAME(t) ((t)->name)
#define GET_TRIG_RNUM(t) ((t)->nr) #define GET_TRIG_RNUM(t) ((t)->nr)
@ -377,10 +363,10 @@ room_rnum obj_room(obj_data *obj);
#define GET_TRIG_DEPTH(t) ((t)->depth) #define GET_TRIG_DEPTH(t) ((t)->depth)
#define GET_TRIG_LOOPS(t) ((t)->loops) #define GET_TRIG_LOOPS(t) ((t)->loops)
/* player id's: 0 to MOB_ID_BASE - 1 */ /* player id's: 0 to MOB_ID_BASE - 1
/* mob id's: MOB_ID_BASE to ROOM_ID_BASE - 1 */ * mob id's: MOB_ID_BASE to ROOM_ID_BASE - 1
/* room id's: ROOM_ID_BASE to OBJ_ID_BASE - 1 */ * room id's: ROOM_ID_BASE to OBJ_ID_BASE - 1
/* object id's: OBJ_ID_BASE and higher */ * object id's: OBJ_ID_BASE and higher */
#define MOB_ID_BASE 50000 /* 50000 player IDNUMS should suffice */ #define MOB_ID_BASE 50000 /* 50000 player IDNUMS should suffice */
#define ROOM_ID_BASE 1050000 /* 1000000 Mobs */ #define ROOM_ID_BASE 1050000 /* 1000000 Mobs */
#define OBJ_ID_BASE 1300000 /* 250000 Rooms */ #define OBJ_ID_BASE 1300000 /* 250000 Rooms */
@ -393,7 +379,6 @@ room_rnum obj_room(obj_data *obj);
#define GET_SHORT(ch) ((ch)->player.short_descr) #define GET_SHORT(ch) ((ch)->player.short_descr)
#define SCRIPT_CHECK(go, type) (SCRIPT(go) && \ #define SCRIPT_CHECK(go, type) (SCRIPT(go) && \
IS_SET(SCRIPT_TYPES(SCRIPT(go)), type)) IS_SET(SCRIPT_TYPES(SCRIPT(go)), type))
#define TRIGGER_CHECK(t, type) (IS_SET(GET_TRIG_TYPE(t), type) && \ #define TRIGGER_CHECK(t, type) (IS_SET(GET_TRIG_TYPE(t), type) && \

View file

@ -1,9 +1,8 @@
/************************************************************************** /**************************************************************************
* File: dg_triggers.c * * File: dg_triggers.c part of tbaMUD *
* Usage: Contains all the trigger functions for scripts. *
* * * *
* Usage: contains all the trigger functions for scripts. * * All rights reserved. See license for complete information. *
* *
* All rights reserved. See license.doc for complete information. *
* * * *
* Death's Gate MUD is based on CircleMUD, Copyright (C) 1993, 94. * * Death's Gate MUD is based on CircleMUD, Copyright (C) 1993, 94. *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. * * CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
@ -15,8 +14,6 @@
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
#include "structs.h" #include "structs.h"
#include "dg_scripts.h" #include "dg_scripts.h"
#include "utils.h" #include "utils.h"
@ -33,14 +30,9 @@ extern struct time_info_data time_info;
/* external functions */ /* external functions */
const char *skill_name(int num); const char *skill_name(int num);
/* /* General functions used by several triggers. */
* General functions used by several triggers
*/
/* Copy first phrase into first_arg, returns rest of string. */
/*
* Copy first phrase into first_arg, returns rest of string
*/
char *one_phrase(char *arg, char *first_arg) char *one_phrase(char *arg, char *first_arg)
{ {
skip_spaces(&arg); skip_spaces(&arg);
@ -79,7 +71,6 @@ char *one_phrase(char *arg, char *first_arg)
return arg; return arg;
} }
int is_substring(char *sub, char *string) int is_substring(char *sub, char *string)
{ {
char *s; char *s;
@ -101,12 +92,9 @@ int is_substring(char *sub, char *string)
return 0; return 0;
} }
/* Return 1 if str contains a word or phrase from wordlist. Phrases are in
/* * double quotes ("). if wrdlist is NULL, then return 1, if str is NULL,
* return 1 if str contains a word or phrase from wordlist. * return 0. */
* phrases are in double quotes (").
* if wrdlist is NULL, then return 1, if str is NULL, return 0.
*/
int word_check(char *str, char *wordlist) int word_check(char *str, char *wordlist)
{ {
char words[MAX_INPUT_LENGTH], phrase[MAX_INPUT_LENGTH], *s; char words[MAX_INPUT_LENGTH], phrase[MAX_INPUT_LENGTH], *s;
@ -122,20 +110,12 @@ int word_check(char *str, char *wordlist)
return 0; return 0;
} }
/*Mob triggers. */
/*
* mob triggers
*/
void random_mtrigger(char_data *ch) void random_mtrigger(char_data *ch)
{ {
trig_data *t; trig_data *t;
/* /* This trigger is only called if a char is in the zone without nohassle. */
* This trigger is only called if a char is in the zone without nohassle.
*/
if (!SCRIPT_CHECK(ch, MTRIG_RANDOM) || AFF_FLAGGED(ch, AFF_CHARM)) if (!SCRIPT_CHECK(ch, MTRIG_RANDOM) || AFF_FLAGGED(ch, AFF_CHARM))
return; return;
@ -220,7 +200,6 @@ void greet_memory_mtrigger(char_data *actor)
} }
} }
int greet_mtrigger(char_data *actor, int dir) int greet_mtrigger(char_data *actor, int dir)
{ {
trig_data *t; trig_data *t;
@ -255,7 +234,6 @@ int greet_mtrigger(char_data *actor, int dir)
return final; return final;
} }
void entry_memory_mtrigger(char_data *ch) void entry_memory_mtrigger(char_data *ch)
{ {
trig_data *t; trig_data *t;
@ -359,7 +337,6 @@ int command_mtrigger(char_data *actor, char *cmd, char *argument)
return 0; return 0;
} }
void speech_mtrigger(char_data *actor, char *str) void speech_mtrigger(char_data *actor, char *str)
{ {
char_data *ch, *ch_next; char_data *ch, *ch_next;
@ -393,7 +370,6 @@ void speech_mtrigger(char_data *actor, char *str)
} }
} }
void act_mtrigger(const char_data *ch, char *str, char_data *actor, void act_mtrigger(const char_data *ch, char *str, char_data *actor,
char_data *victim, obj_data *object, char_data *victim, obj_data *object,
obj_data *target, char *arg) obj_data *target, char *arg)
@ -437,7 +413,6 @@ void act_mtrigger(const char_data *ch, char *str, char_data *actor,
} }
} }
void fight_mtrigger(char_data *ch) void fight_mtrigger(char_data *ch)
{ {
struct char_data *actor; struct char_data *actor;
@ -463,7 +438,6 @@ void fight_mtrigger(char_data *ch)
} }
} }
void hitprcnt_mtrigger(char_data *ch) void hitprcnt_mtrigger(char_data *ch)
{ {
struct char_data *actor; struct char_data *actor;
@ -486,7 +460,6 @@ void hitprcnt_mtrigger(char_data *ch)
} }
} }
int receive_mtrigger(char_data *ch, char_data *actor, obj_data *obj) int receive_mtrigger(char_data *ch, char_data *actor, obj_data *obj)
{ {
trig_data *t; trig_data *t;
@ -513,7 +486,6 @@ int receive_mtrigger(char_data *ch, char_data *actor, obj_data *obj)
return 1; return 1;
} }
int death_mtrigger(char_data *ch, char_data *actor) int death_mtrigger(char_data *ch, char_data *actor)
{ {
trig_data *t; trig_data *t;
@ -646,10 +618,7 @@ void time_mtrigger(char_data *ch)
trig_data *t; trig_data *t;
char buf[MAX_INPUT_LENGTH]; char buf[MAX_INPUT_LENGTH];
/* /* This trigger is called if the hour is the same as specified in Narg. */
* This trigger is called if the hour is the same as specified in Narg.
*/
if (!SCRIPT_CHECK(ch, MTRIG_TIME) || AFF_FLAGGED(ch, AFF_CHARM)) if (!SCRIPT_CHECK(ch, MTRIG_TIME) || AFF_FLAGGED(ch, AFF_CHARM))
return; return;
@ -664,10 +633,7 @@ void time_mtrigger(char_data *ch)
} }
} }
/* /* Object triggers. */
* object triggers
*/
void random_otrigger(obj_data *obj) void random_otrigger(obj_data *obj)
{ {
trig_data *t; trig_data *t;
@ -684,7 +650,6 @@ void random_otrigger(obj_data *obj)
} }
} }
void timer_otrigger(struct obj_data *obj) void timer_otrigger(struct obj_data *obj)
{ {
trig_data *t; trig_data *t;
@ -701,7 +666,6 @@ void timer_otrigger(struct obj_data *obj)
return; return;
} }
int get_otrigger(obj_data *obj, char_data *actor) int get_otrigger(obj_data *obj, char_data *actor)
{ {
trig_data *t; trig_data *t;
@ -728,7 +692,6 @@ int get_otrigger(obj_data *obj, char_data *actor)
return 1; return 1;
} }
/* checks for command trigger on specific object. assumes obj has cmd trig */ /* checks for command trigger on specific object. assumes obj has cmd trig */
int cmd_otrig(obj_data *obj, char_data *actor, char *cmd, int cmd_otrig(obj_data *obj, char_data *actor, char *cmd,
char *argument, int type) char *argument, int type)
@ -766,7 +729,6 @@ int cmd_otrig(obj_data *obj, char_data *actor, char *cmd,
return 0; return 0;
} }
int command_otrigger(char_data *actor, char *cmd, char *argument) int command_otrigger(char_data *actor, char *cmd, char *argument)
{ {
obj_data *obj; obj_data *obj;
@ -792,7 +754,6 @@ int command_otrigger(char_data *actor, char *cmd, char *argument)
return 0; return 0;
} }
int wear_otrigger(obj_data *obj, char_data *actor, int where) int wear_otrigger(obj_data *obj, char_data *actor, int where)
{ {
trig_data *t; trig_data *t;
@ -819,7 +780,6 @@ int wear_otrigger(obj_data *obj, char_data *actor, int where)
return 1; return 1;
} }
int remove_otrigger(obj_data *obj, char_data *actor) int remove_otrigger(obj_data *obj, char_data *actor)
{ {
trig_data *t; trig_data *t;
@ -846,7 +806,6 @@ int remove_otrigger(obj_data *obj, char_data *actor)
return 1; return 1;
} }
int drop_otrigger(obj_data *obj, char_data *actor) int drop_otrigger(obj_data *obj, char_data *actor)
{ {
trig_data *t; trig_data *t;
@ -873,7 +832,6 @@ int drop_otrigger(obj_data *obj, char_data *actor)
return 1; return 1;
} }
int give_otrigger(obj_data *obj, char_data *actor, char_data *victim) int give_otrigger(obj_data *obj, char_data *actor, char_data *victim)
{ {
trig_data *t; trig_data *t;
@ -1040,10 +998,7 @@ void time_otrigger(obj_data *obj)
} }
} }
/* /* World triggers. */
* world triggers
*/
void reset_wtrigger(struct room_data *room) void reset_wtrigger(struct room_data *room)
{ {
trig_data *t; trig_data *t;
@ -1076,7 +1031,6 @@ void random_wtrigger(struct room_data *room)
} }
} }
int enter_wtrigger(struct room_data *room, char_data *actor, int dir) int enter_wtrigger(struct room_data *room, char_data *actor, int dir)
{ {
trig_data *t; trig_data *t;
@ -1100,7 +1054,6 @@ int enter_wtrigger(struct room_data *room, char_data *actor, int dir)
return 1; return 1;
} }
int command_wtrigger(char_data *actor, char *cmd, char *argument) int command_wtrigger(char_data *actor, char *cmd, char *argument)
{ {
struct room_data *room; struct room_data *room;
@ -1140,7 +1093,6 @@ int command_wtrigger(char_data *actor, char *cmd, char *argument)
return 0; return 0;
} }
void speech_wtrigger(char_data *actor, char *str) void speech_wtrigger(char_data *actor, char *str)
{ {
struct room_data *room; struct room_data *room;
@ -1228,7 +1180,6 @@ int cast_wtrigger(char_data *actor, char_data *vict, obj_data *obj, int spellnum
return 1; return 1;
} }
int leave_wtrigger(struct room_data *room, char_data *actor, int dir) int leave_wtrigger(struct room_data *room, char_data *actor, int dir)
{ {
trig_data *t; trig_data *t;

View file

@ -1,7 +1,6 @@
/************************************************************************** /**************************************************************************
* File: dg_variables.c * * File: dg_variables.c Part of tbaMUD *
* Usage: contains the functions dealing with variable substitution. * * Usage: Contains the functions dealing with variable substitution. *
* *
* * * *
* $Author: Mark A. Heilpern/egreen/Welcor $ * * $Author: Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00 $ * * $Date: 2004/10/11 12:07:00 $ *
@ -10,8 +9,6 @@
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
#include "structs.h" #include "structs.h"
#include "dg_scripts.h" #include "dg_scripts.h"
#include "utils.h" #include "utils.h"
@ -24,18 +21,15 @@
#include "constants.h" #include "constants.h"
#include "spells.h" #include "spells.h"
/* External variables and functions */ /* External variables and functions */
extern const char *pc_class_types[]; extern const char *pc_class_types[];
extern struct time_info_data time_info; extern struct time_info_data time_info;
/* Utility functions */ /* Utility functions */
/* /* Thanks to James Long for his assistance in plugging the memory leak that
* Thanks to James Long for his assistance in plugging the memory leak * used to be here. - Welcor */
* that used to be here. -- Welcor /* Adds a variable with given name and value to trigger. */
*/
/* adds a variable with given name and value to trigger */
void add_var(struct trig_var_data **var_list, char *name, char *value, long id) void add_var(struct trig_var_data **var_list, char *name, char *value, long id)
{ {
struct trig_var_data *vd; struct trig_var_data *vd;
@ -68,7 +62,6 @@ void add_var(struct trig_var_data **var_list, char *name, char *value, long id)
strcpy(vd->value, value); /* strcpy: ok*/ strcpy(vd->value, value); /* strcpy: ok*/
} }
/* perhaps not the best place for this, but I didn't want a new file */ /* perhaps not the best place for this, but I didn't want a new file */
char *skill_percent(struct char_data *ch, char *skill) char *skill_percent(struct char_data *ch, char *skill)
{ {
@ -82,16 +75,9 @@ char *skill_percent(struct char_data *ch, char *skill)
return retval; return retval;
} }
/* /* Search through all the persons items, including containers. 0 if it doesnt
search through all the persons items, including containers * exist, and greater then 0 if it does! Jamie Nelson. Now also searches by
and 0 if it doesnt exist, and greater then 0 if it does! * vnum and returns the number of matching objects. - Welcor */
Jamie Nelson (mordecai@timespace.co.nz)
MUD -- 4dimensions.org:6000
Now also searches by vnum -- Welcor
Now returns the number of matching objects -- Welcor 02/04
*/
int item_in_list(char *item, obj_data *list) int item_in_list(char *item, obj_data *list)
{ {
obj_data *i; obj_data *i;
@ -129,16 +115,9 @@ int item_in_list(char *item, obj_data *list)
return count; return count;
} }
/* /* BOOLEAN return, just check if a player or mob has an item of any sort,
BOOLEAN return, just check if a player or mob * searched for by name or id. Searching equipment as well as inventory, and
has an item of any sort, searched for by name * containers. Jamie Nelson */
or id.
searching equipment as well as inventory,
and containers.
Jamie Nelson (mordecai@timespace.co.nz)
MUD -- 4dimensions.org:6000
*/
int char_has_item(char *item, struct char_data *ch) int char_has_item(char *item, struct char_data *ch)
{ {
@ -224,7 +203,6 @@ int text_processed(char *field, char *subfield, struct trig_var_data *vd,
return FALSE; return FALSE;
} }
/* sets str to be the value of var.field */ /* sets str to be the value of var.field */
void find_replacement(void *go, struct script_data *sc, trig_data *trig, void find_replacement(void *go, struct script_data *sc, trig_data *trig,
int type, char *var, char *field, char *subfield, char *str, size_t slen) int type, char *var, char *field, char *subfield, char *str, size_t slen)
@ -414,28 +392,16 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
else *str = '\0'; else *str = '\0';
return; return;
} }
/* /* %findobj.<room vnum X>(<object vnum/id/name>)%
* - count number of objects in room X with this name/id/vnum
%findobj.<room vnum X>(<object vnum/id/name>)% * %findmob.<room vnum X>(<mob vnum Y>)%
- count number of objects in room X with this name/id/vnum * - count number of mobs in room X with vnum Y
%findmob.<room vnum X>(<mob vnum Y>)% * For example you want to check how many PC's are in room with vnum 1204. PC's
- count number of mobs in room X with vnum Y * have the vnum -1 so: %echo% players in room 1204: %findmob.1204(-1)%
* Or say you had a bank, and you want a script to check the number of bags of
for example you want to check how many PC's are in room with vnum 1204. * gold (vnum: 1234). In the vault (vnum: 453). Use: %findobj.453(1234)% and it
as PC's have the vnum -1... * will return the number of bags of gold.
you would type: * Addition inspired by Jamie Nelson */
in any script:
%echo% players in room 1204: %findmob.1204(-1)%
Or say you had a bank, and you want a script to check the number of
bags
of gold (vnum: 1234)
in the vault (vnum: 453) now and then. you can just use
%findobj.453(1234)% and it will return the number of bags of gold.
**/
/* addition inspired by Jamie Nelson - mordecai@xtra.co.nz */
else if (!str_cmp(var, "findmob")) { else if (!str_cmp(var, "findmob")) {
if (!field || !*field || !subfield || !*subfield) { if (!field || !*field || !subfield || !*subfield) {
script_log("findmob.vnum(mvnum) - illegal syntax"); script_log("findmob.vnum(mvnum) - illegal syntax");
@ -456,7 +422,7 @@ in the vault (vnum: 453) now and then. you can just use
} }
} }
} }
/* addition inspired by Jamie Nelson - mordecai@xtra.co.nz */ /* Addition inspired by Jamie Nelson. */
else if (!str_cmp(var, "findobj")) { else if (!str_cmp(var, "findobj")) {
if (!field || !*field || !subfield || !*subfield) { if (!field || !*field || !subfield || !*subfield) {
script_log("findobj.vnum(ovnum) - illegal syntax"); script_log("findobj.vnum(ovnum) - illegal syntax");
@ -1441,20 +1407,12 @@ o->contains) ? "1" : "0"));
} }
} }
/* /* Now automatically checks if the variable has more then one field in it. And
* Now automatically checks if the variable has more then one field * if the field returns a name or a script UID or the like it can recurse. If
* in it. And if the field returns a name or a script UID or the like * you supply a value like, %actor.int.str% it wont blow up on you either. Now
* it can recurse. * also lets subfields have variables parsed inside of them so that: %echo%
* If you supply a value like, %actor.int.str% it wont blow up on you * %actor.gold(%actor.gold%)% will double the actors gold every time its called.
* either. * - Jamie Nelson */
* - Jamie Nelson 31st Oct 2003 01:03
*
* Now also lets subfields have variables parsed inside of them
* so that:
* %echo% %actor.gold(%actor.gold%)%
* will double the actors gold every time its called. etc...
* - Jamie Nelson 31st Oct 2003 01:24
*/
/* substitutes any variables into line and returns it as buf */ /* substitutes any variables into line and returns it as buf */
void var_subst(void *go, struct script_data *sc, trig_data *trig, void var_subst(void *go, struct script_data *sc, trig_data *trig,

View file

@ -1,8 +1,6 @@
/************************************************************************** /**************************************************************************
* File: dg_wldcmd.c * * File: dg_wldcmd.c Part of tbaMUD *
* Usage: contains the command_interpreter for rooms, * * Usage: Contains the command_interpreter for rooms, room commands. *
* room commands. *
* *
* * * *
* $Author: galion/Mark A. Heilpern/egreen/Welcor $ * * $Author: galion/Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ * * $Date: 2004/10/11 12:07:00$ *
@ -11,8 +9,6 @@
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
#include "structs.h" #include "structs.h"
#include "screen.h" #include "screen.h"
#include "dg_scripts.h" #include "dg_scripts.h"
@ -23,16 +19,12 @@
#include "db.h" #include "db.h"
#include "constants.h" #include "constants.h"
/* /* External functions. */
* External functions
*/
void die(struct char_data * ch, struct char_data * killer); void die(struct char_data * ch, struct char_data * killer);
zone_rnum real_zone_by_thing(room_vnum vznum); zone_rnum real_zone_by_thing(room_vnum vznum);
bitvector_t asciiflag_conv(char *flag); bitvector_t asciiflag_conv(char *flag);
/* /* Local functions. */
* Local functions
*/
#define WCMD(name) \ #define WCMD(name) \
void (name)(room_data *room, char *argument, int cmd, int subcmd) void (name)(room_data *room, char *argument, int cmd, int subcmd)
@ -53,7 +45,6 @@ WCMD(do_wdamage);
WCMD(do_wat); WCMD(do_wat);
void wld_command_interpreter(room_data *room, char *argument); void wld_command_interpreter(room_data *room, char *argument);
struct wld_command_info { struct wld_command_info {
char *command; char *command;
void (*command_pointer) void (*command_pointer)
@ -61,13 +52,10 @@ struct wld_command_info {
int subcmd; int subcmd;
}; };
/* do_wsend */ /* do_wsend */
#define SCMD_WSEND 0 #define SCMD_WSEND 0
#define SCMD_WECHOAROUND 1 #define SCMD_WECHOAROUND 1
/* attaches room vnum to msg and sends it to script_log */ /* attaches room vnum to msg and sends it to script_log */
void wld_log(room_data *room, const char *format, ...) void wld_log(room_data *room, const char *format, ...)
{ {
@ -88,19 +76,14 @@ void act_to_room(char *str, room_data *room)
if (!room->people) if (!room->people)
return; return;
/* /* Since you can't use act(..., TO_ROOM) for an room, send it TO_ROOM and
* since you can't use act(..., TO_ROOM) for an room, send it * TO_CHAR for some char in the room. (just dont use $n or you might get
* TO_ROOM and TO_CHAR for some char in the room. * strange results). */
* (just dont use $n or you might get strange results)
*/
act(str, FALSE, room->people, 0, 0, TO_ROOM); act(str, FALSE, room->people, 0, 0, TO_ROOM);
act(str, FALSE, room->people, 0, 0, TO_CHAR); act(str, FALSE, room->people, 0, 0, TO_CHAR);
} }
/* World commands */ /* World commands */
/* prints the argument to all the rooms aroud the room */ /* prints the argument to all the rooms aroud the room */
WCMD(do_wasound) WCMD(do_wasound)
{ {
@ -122,7 +105,6 @@ WCMD(do_wasound)
} }
} }
WCMD(do_wecho) WCMD(do_wecho)
{ {
skip_spaces(&argument); skip_spaces(&argument);
@ -134,7 +116,6 @@ WCMD(do_wecho)
act_to_room(argument, room); act_to_room(argument, room);
} }
WCMD(do_wsend) WCMD(do_wsend)
{ {
char buf[MAX_INPUT_LENGTH], *msg; char buf[MAX_INPUT_LENGTH], *msg;
@ -298,7 +279,6 @@ WCMD(do_wdoor)
} }
} }
WCMD(do_wteleport) WCMD(do_wteleport)
{ {
char_data *ch, *next_ch; char_data *ch, *next_ch;
@ -350,7 +330,6 @@ WCMD(do_wteleport)
} }
} }
WCMD(do_wforce) WCMD(do_wforce)
{ {
char_data *ch, *next_ch; char_data *ch, *next_ch;
@ -391,7 +370,6 @@ WCMD(do_wforce)
} }
} }
/* purge all objects an npcs in room, or specified object or mob */ /* purge all objects an npcs in room, or specified object or mob */
WCMD(do_wpurge) WCMD(do_wpurge)
{ {
@ -444,7 +422,6 @@ WCMD(do_wpurge)
extract_char(ch); extract_char(ch);
} }
/* loads a mobile or object into the room */ /* loads a mobile or object into the room */
WCMD(do_wload) WCMD(do_wload)
{ {
@ -609,10 +586,7 @@ const struct wld_command_info wld_cmd_info[] = {
{ "\n", 0, 0 } /* this must be last */ { "\n", 0, 0 } /* this must be last */
}; };
/* This is the command interpreter used by rooms, called by script_driver. */
/*
* This is the command interpreter used by rooms, called by script_driver.
*/
void wld_command_interpreter(room_data *room, char *argument) void wld_command_interpreter(room_data *room, char *argument)
{ {
int cmd, length; int cmd, length;

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: fight.c Part of CircleMUD * * File: fight.c Part of tbaMUD *
* Usage: Combat system * * Usage: Combat system. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"

View file

@ -1,12 +1,12 @@
/************************************************************************ /**************************************************************************
* Generic OLC Library - Mobiles / genmob.c v1.0 * * File: genmob.c Part of tbaMUD *
* Copyright 1996 by Harvey Gilpin * * Usage: Generic OLC Library - Mobiles. *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) * * *
************************************************************************/ * Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
**************************************************************************/
#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 "db.h" #include "db.h"
@ -70,23 +70,17 @@ int add_mobile(struct char_data *mob, mob_vnum vnum)
log("GenOLC: add_mobile: Added mobile %d at index #%d.", vnum, found); log("GenOLC: add_mobile: Added mobile %d at index #%d.", vnum, found);
/* /* Update live mobile rnums. */
* Update live mobile rnums.
*/
for (live_mob = character_list; live_mob; live_mob = live_mob->next) for (live_mob = character_list; live_mob; live_mob = live_mob->next)
GET_MOB_RNUM(live_mob) += (GET_MOB_RNUM(live_mob) >= found); GET_MOB_RNUM(live_mob) += (GET_MOB_RNUM(live_mob) >= found);
/* /* Update zone table. */
* Update zone table.
*/
for (zone = 0; zone <= top_of_zone_table; zone++) for (zone = 0; zone <= top_of_zone_table; zone++)
for (cmd_no = 0; ZCMD(zone, cmd_no).command != 'S'; cmd_no++) for (cmd_no = 0; ZCMD(zone, cmd_no).command != 'S'; cmd_no++)
if (ZCMD(zone, cmd_no).command == 'M') if (ZCMD(zone, cmd_no).command == 'M')
ZCMD(zone, cmd_no).arg1 += (ZCMD(zone, cmd_no).arg1 >= found); ZCMD(zone, cmd_no).arg1 += (ZCMD(zone, cmd_no).arg1 >= found);
/* /* Update shop keepers. */
* Update shop keepers.
*/
if (shop_index) if (shop_index)
for (shop = 0; shop <= top_shop - top_shop_offset; shop++) for (shop = 0; shop <= top_shop - top_shop_offset; shop++)
SHOP_KEEPER(shop) += (SHOP_KEEPER(shop) >= found); SHOP_KEEPER(shop) += (SHOP_KEEPER(shop) >= found);
@ -144,23 +138,17 @@ int delete_mobile(mob_rnum refpt)
RECREATE(mob_index, struct index_data, top_of_mobt + 1); RECREATE(mob_index, struct index_data, top_of_mobt + 1);
RECREATE(mob_proto, struct char_data, top_of_mobt + 1); RECREATE(mob_proto, struct char_data, top_of_mobt + 1);
/* /* Update live mobile rnums. */
* Update live mobile rnums.
*/
for (live_mob = character_list; live_mob; live_mob = live_mob->next) for (live_mob = character_list; live_mob; live_mob = live_mob->next)
GET_MOB_RNUM(live_mob) -= (GET_MOB_RNUM(live_mob) >= refpt); GET_MOB_RNUM(live_mob) -= (GET_MOB_RNUM(live_mob) >= refpt);
/* /* Update zone table. */
* Update zone table.
*/
for (zone = 0; zone <= top_of_zone_table; zone++) for (zone = 0; zone <= top_of_zone_table; zone++)
for (cmd_no = 0; ZCMD(zone, cmd_no).command != 'S'; cmd_no++) for (cmd_no = 0; ZCMD(zone, cmd_no).command != 'S'; cmd_no++)
if (ZCMD(zone, cmd_no).command == 'M' && ZCMD(zone, cmd_no).arg1 == refpt) if (ZCMD(zone, cmd_no).command == 'M' && ZCMD(zone, cmd_no).arg1 == refpt)
delete_zone_command(&zone_table[zone], cmd_no); delete_zone_command(&zone_table[zone], cmd_no);
/* /* Update shop keepers. */
* Update shop keepers.
*/
if (shop_index) if (shop_index)
for (counter = 0; counter <= top_shop - top_shop_offset; counter++) for (counter = 0; counter <= top_shop - top_shop_offset; counter++)
SHOP_KEEPER(counter) -= (SHOP_KEEPER(counter) >= refpt); SHOP_KEEPER(counter) -= (SHOP_KEEPER(counter) >= refpt);
@ -215,10 +203,8 @@ int free_mobile_strings(struct char_data *mob)
return TRUE; return TRUE;
} }
/* /* Free a mobile structure that has been edited. Take care of existing mobiles
* Free a mobile structure that has been edited. * and their mob_proto! */
* Take care of existing mobiles and their mob_proto!
*/
int free_mobile(struct char_data *mob) int free_mobile(struct char_data *mob)
{ {
mob_rnum i; mob_rnum i;
@ -226,9 +212,7 @@ int free_mobile(struct char_data *mob)
if (mob == NULL) if (mob == NULL)
return FALSE; return FALSE;
/* /* Non-prototyped mobile. Also known as new mobiles. */
* Non-prototyped mobile. Also known as new mobiles.
*/
if ((i = GET_MOB_RNUM(mob)) == NOBODY) { if ((i = GET_MOB_RNUM(mob)) == NOBODY) {
free_mobile_strings(mob); free_mobile_strings(mob);
/* free script proto list */ /* free script proto list */
@ -322,7 +306,6 @@ int write_mobile_espec(mob_vnum mvnum, struct char_data *mob, FILE *fd)
return TRUE; return TRUE;
} }
int write_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd) int write_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd)
{ {

View file

@ -1,8 +1,10 @@
/************************************************************************ /**************************************************************************
* Generic OLC Library - Mobiles / genmob.h v1.0 * * File: genmob.h Part of tbaMUD *
* Copyright 1996 by Harvey Gilpin * * *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) * * Usage: Generic OLC Library - Mobiles. *
************************************************************************/ * *
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
**************************************************************************/
int delete_mobile(mob_rnum); int delete_mobile(mob_rnum);
int copy_mobile(struct char_data *to, struct char_data *from); int copy_mobile(struct char_data *to, struct char_data *from);

View file

@ -1,9 +1,9 @@
/************************************************************************ /**************************************************************************
* Generic OLC Library - Objects / genobj.c v1.0 * * File: genobj.c Part of tbaMUD *
* Original author: Levork * * Usage: Generic OLC Library - Objects. *
* Copyright 1996 by Harvey Gilpin * * *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) * * Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
************************************************************************/ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"

View file

@ -1,9 +1,10 @@
/************************************************************************ /**************************************************************************
* Generic OLC Library - Objects / genobj.h v1.0 * * File: genobj.h Part of tbaMUD *
* Original author: Levork * * *
* Copyright 1996 by Harvey Gilpin * * Usage: Generic OLC Library - Objects. *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) * * *
************************************************************************/ * Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
**************************************************************************/
void free_object_strings(struct obj_data *obj); void free_object_strings(struct obj_data *obj);
int copy_object(struct obj_data *to, struct obj_data *from); int copy_object(struct obj_data *to, struct obj_data *from);

View file

@ -1,9 +1,9 @@
/************************************************************************ /**************************************************************************
* Generic OLC Library - General / genolc.c v1.0 * * File: genolc.c Part of tbaMUD *
* Original author: Levork * * Usage: Generic OLC Library - General. *
* Copyright 1996 by Harvey Gilpin * * *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) * * Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
************************************************************************/ **************************************************************************/
#define __GENOLC_C__ #define __GENOLC_C__
@ -29,14 +29,10 @@
int save_config( IDXTYPE nowhere ); /* Exported from cedit.c */ int save_config( IDXTYPE nowhere ); /* Exported from cedit.c */
int top_shop_offset = 0; int top_shop_offset = 0;
/* /* List of zones to be saved. */
* List of zones to be saved.
*/
struct save_list_data *save_list; struct save_list_data *save_list;
/* /* Structure defining all known save types. */
* Structure defining all known save types.
*/
struct { struct {
int save_type; int save_type;
int (*func)(IDXTYPE rnum); int (*func)(IDXTYPE rnum);
@ -52,8 +48,6 @@ struct {
{ -1, NULL, NULL }, { -1, NULL, NULL },
}; };
/* -------------------------------------------------------------------------- */
int genolc_checkstring(struct descriptor_data *d, char *arg) int genolc_checkstring(struct descriptor_data *d, char *arg)
{ {
smash_tilde(arg); smash_tilde(arg);
@ -65,9 +59,7 @@ char *str_udup(const char *txt)
return strdup((txt && *txt) ? txt : "undefined"); return strdup((txt && *txt) ? txt : "undefined");
} }
/* /* Original use: to be called at shutdown time. */
* Original use: to be called at shutdown time.
*/
int save_all(void) int save_all(void)
{ {
while (save_list) { while (save_list) {
@ -84,11 +76,7 @@ int save_all(void)
return TRUE; return TRUE;
} }
/* -------------------------------------------------------------------------- */ /* NOTE: This changes the buffer passed in. */
/*
* NOTE: This changes the buffer passed in.
*/
void strip_cr(char *buffer) void strip_cr(char *buffer)
{ {
int rpos, wpos; int rpos, wpos;
@ -103,8 +91,6 @@ void strip_cr(char *buffer)
buffer[wpos] = '\0'; buffer[wpos] = '\0';
} }
/* -------------------------------------------------------------------------- */
void copy_ex_descriptions(struct extra_descr_data **to, struct extra_descr_data *from) void copy_ex_descriptions(struct extra_descr_data **to, struct extra_descr_data *from)
{ {
struct extra_descr_data *wpos; struct extra_descr_data *wpos;
@ -120,8 +106,6 @@ void copy_ex_descriptions(struct extra_descr_data **to, struct extra_descr_data
} }
} }
/* -------------------------------------------------------------------------- */
void free_ex_descriptions(struct extra_descr_data *head) void free_ex_descriptions(struct extra_descr_data *head)
{ {
struct extra_descr_data *thised, *next_one; struct extra_descr_data *thised, *next_one;
@ -141,8 +125,6 @@ void free_ex_descriptions(struct extra_descr_data *head)
} }
} }
/* -------------------------------------------------------------------------- */
int remove_from_save_list(zone_vnum zone, int type) int remove_from_save_list(zone_vnum zone, int type)
{ {
struct save_list_data *ritem, *temp; struct save_list_data *ritem, *temp;
@ -160,8 +142,6 @@ int remove_from_save_list(zone_vnum zone, int type)
return TRUE; return TRUE;
} }
/* -------------------------------------------------------------------------- */
int add_to_save_list(zone_vnum zone, int type) int add_to_save_list(zone_vnum zone, int type)
{ {
struct save_list_data *nitem; struct save_list_data *nitem;
@ -190,8 +170,6 @@ int add_to_save_list(zone_vnum zone, int type)
return TRUE; return TRUE;
} }
/* -------------------------------------------------------------------------- */
int in_save_list(zone_vnum zone, int type) int in_save_list(zone_vnum zone, int type)
{ {
struct save_list_data *nitem; struct save_list_data *nitem;
@ -226,15 +204,11 @@ room_vnum genolc_zonep_bottom(struct zone_data *zone)
return zone->bot; return zone->bot;
} }
/* -------------------------------------------------------------------------- */
zone_vnum genolc_zone_bottom(zone_rnum rznum) zone_vnum genolc_zone_bottom(zone_rnum rznum)
{ {
return zone_table[rznum].bot; return zone_table[rznum].bot;
} }
/* -------------------------------------------------------------------------- */
int sprintascii(char *out, bitvector_t bits) int sprintascii(char *out, bitvector_t bits)
{ {
int i, j = 0; int i, j = 0;
@ -253,11 +227,7 @@ int sprintascii(char *out, bitvector_t bits)
return j; return j;
} }
/* Zone export functions */ /* Zone export functions */
int export_save_shops(zone_rnum zrnum); int export_save_shops(zone_rnum zrnum);
int export_save_mobiles(zone_rnum rznum); int export_save_mobiles(zone_rnum rznum);
int export_save_zone(zone_rnum zrnum); int export_save_zone(zone_rnum zrnum);
@ -403,17 +373,13 @@ int export_save_shops(zone_rnum zrnum)
fclose(shop_file); fclose(shop_file);
return FALSE; return FALSE;
} }
/* /* Search database for shops in this zone. */
* Search database for shops in this zone.
*/
for (i = genolc_zone_bottom(zrnum); i <= zone_table[zrnum].top; i++) { for (i = genolc_zone_bottom(zrnum); i <= zone_table[zrnum].top; i++) {
if ((rshop = real_shop(i)) != NOWHERE) { if ((rshop = real_shop(i)) != NOWHERE) {
fprintf(shop_file, "#QQ%02d~\n", i%100); fprintf(shop_file, "#QQ%02d~\n", i%100);
shop = &shop_index[rshop]; shop = &shop_index[rshop];
/* /* Save the products. */
* Save the products.
*/
for (j = 0; S_PRODUCT(shop, j) != NOTHING; j++) { for (j = 0; S_PRODUCT(shop, j) != NOTHING; j++) {
if (obj_index[S_PRODUCT(shop, j)].vnum < genolc_zone_bottom(zrnum) || if (obj_index[S_PRODUCT(shop, j)].vnum < genolc_zone_bottom(zrnum) ||
obj_index[S_PRODUCT(shop, j)].vnum > zone_table[zrnum].top) obj_index[S_PRODUCT(shop, j)].vnum > zone_table[zrnum].top)
@ -423,27 +389,20 @@ int export_save_shops(zone_rnum zrnum)
} }
fprintf(shop_file, "-1\n"); fprintf(shop_file, "-1\n");
/* /* Save the rates. */
* Save the rates.
*/
fprintf(shop_file, "%1.2f\n" fprintf(shop_file, "%1.2f\n"
"%1.2f\n", "%1.2f\n",
S_BUYPROFIT(shop), S_BUYPROFIT(shop),
S_SELLPROFIT(shop)); S_SELLPROFIT(shop));
/* /* Save the buy types and namelists. */
* Save the buy types and namelists.
*/
for (j = 0;S_BUYTYPE(shop, j) != NOTHING; j++) for (j = 0;S_BUYTYPE(shop, j) != NOTHING; j++)
fprintf(shop_file, "%d%s\n", fprintf(shop_file, "%d%s\n",
S_BUYTYPE(shop, j), S_BUYTYPE(shop, j),
S_BUYWORD(shop, j) ? S_BUYWORD(shop, j) : ""); S_BUYWORD(shop, j) ? S_BUYWORD(shop, j) : "");
fprintf(shop_file, "-1\n"); fprintf(shop_file, "-1\n");
/* /* Save messages. Added some defaults as sanity checks. */
* Save messages'n'stuff.
* Added some small'n'silly defaults as sanity checks.
*/
fprintf(shop_file, fprintf(shop_file,
"%s~\n" "%s~\n"
"%s~\n" "%s~\n"
@ -469,9 +428,7 @@ int export_save_shops(zone_rnum zrnum)
S_NOTRADE(shop) S_NOTRADE(shop)
); );
/* /* Save the rooms. */
* Save the rooms.
*/
for (j = 0;S_ROOM(shop, j) != NOWHERE; j++) { for (j = 0;S_ROOM(shop, j) != NOWHERE; j++) {
if (S_ROOM(shop, j) < genolc_zone_bottom(zrnum) || if (S_ROOM(shop, j) < genolc_zone_bottom(zrnum) ||
S_ROOM(shop, j) > zone_table[zrnum].top) S_ROOM(shop, j) > zone_table[zrnum].top)
@ -481,9 +438,7 @@ int export_save_shops(zone_rnum zrnum)
} }
fprintf(shop_file, "-1\n"); fprintf(shop_file, "-1\n");
/* /* Save open/closing times. */
* Save open/closing times
*/
fprintf(shop_file, "%d\n%d\n%d\n%d\n", S_OPEN1(shop), S_CLOSE1(shop), fprintf(shop_file, "%d\n%d\n%d\n%d\n", S_OPEN1(shop), S_CLOSE1(shop),
S_OPEN2(shop), S_CLOSE2(shop)); S_OPEN2(shop), S_CLOSE2(shop));
} }
@ -518,7 +473,6 @@ int export_save_mobiles(zone_rnum rznum)
return TRUE; return TRUE;
} }
int export_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd) int export_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd)
{ {
@ -578,9 +532,7 @@ int export_save_zone(zone_rnum zrnum)
return FALSE; return FALSE;
} }
/* /* Print zone header to file. */
* Print zone header to file
*/
fprintf(zone_file, "#QQ\n" fprintf(zone_file, "#QQ\n"
"%s~\n" "%s~\n"
"%s~\n" "%s~\n"
@ -595,8 +547,7 @@ int export_save_zone(zone_rnum zrnum)
zone_table[zrnum].reset_mode zone_table[zrnum].reset_mode
); );
/* /* Handy Quick Reference Chart for Zone Values.
* Handy Quick Reference Chart for Zone Values.
* *
* Field #1 Field #3 Field #4 Field #5 * Field #1 Field #3 Field #4 Field #5
* ------------------------------------------------- * -------------------------------------------------
@ -609,8 +560,7 @@ int export_save_zone(zone_rnum zrnum)
* R (Remove) Room-Vnum Obj-Vnum Unused * R (Remove) Room-Vnum Obj-Vnum Unused
* T (Trigger) Trig-type Trig-Vnum Room-Vnum * T (Trigger) Trig-type Trig-Vnum Room-Vnum
* V (var) Trig-type Context Room-Vnum Varname Value * V (var) Trig-type Context Room-Vnum Varname Value
* ------------------------------------------------- * ------------------------------------------------- */
*/
for (subcmd = 0; ZCMD(zrnum, subcmd).command != 'S'; subcmd++) { for (subcmd = 0; ZCMD(zrnum, subcmd).command != 'S'; subcmd++) {
switch (ZCMD(zrnum, subcmd).command) { switch (ZCMD(zrnum, subcmd).command) {
@ -686,9 +636,7 @@ int export_save_zone(zone_rnum zrnum)
ZCMD(zrnum, subcmd).sarg2); ZCMD(zrnum, subcmd).sarg2);
break; break;
case '*': case '*':
/* /* Invalid commands are replaced with '*' - Ignore them. */
* Invalid commands are replaced with '*' - Ignore them.
*/
continue; continue;
default: default:
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: export_save_zone(): Unknown cmd '%c' - NOT saving", ZCMD(zrnum, subcmd).command); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: export_save_zone(): Unknown cmd '%c' - NOT saving", ZCMD(zrnum, subcmd).command);
@ -715,9 +663,7 @@ int export_save_objects(zone_rnum zrnum)
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_save_objects : Cannot open file!"); mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_save_objects : Cannot open file!");
return FALSE; return FALSE;
} }
/* /* Start running through all objects in this zone. */
* Start running through all objects in this zone.
*/
for (ovnum = genolc_zone_bottom(zrnum); ovnum <= zone_table[zrnum].top; ovnum++) { for (ovnum = genolc_zone_bottom(zrnum); ovnum <= zone_table[zrnum].top; ovnum++) {
if ((ornum = real_object(ovnum)) != NOTHING) { if ((ornum = real_object(ovnum)) != NOTHING) {
if ((obj = &obj_proto[ornum])->action_description) { if ((obj = &obj_proto[ornum])->action_description) {
@ -764,19 +710,13 @@ int export_save_objects(zone_rnum zrnum)
"%d %d %d %d\n", "%d %d %d %d\n",
GET_OBJ_WEIGHT(obj), GET_OBJ_COST(obj), GET_OBJ_RENT(obj), GET_OBJ_LEVEL(obj)); GET_OBJ_WEIGHT(obj), GET_OBJ_COST(obj), GET_OBJ_RENT(obj), GET_OBJ_LEVEL(obj));
/* /* Do we have script(s) attached? */
* Do we have script(s) attached ?
*/
export_script_save_to_disk(obj_file, obj, OBJ_TRIGGER); export_script_save_to_disk(obj_file, obj, OBJ_TRIGGER);
/* /* Do we have extra descriptions? */
* Do we have extra descriptions?
*/
if (obj->ex_description) { /* Yes, save them too. */ if (obj->ex_description) { /* Yes, save them too. */
for (ex_desc = obj->ex_description; ex_desc; ex_desc = ex_desc->next) { for (ex_desc = obj->ex_description; ex_desc; ex_desc = ex_desc->next) {
/* /* Sanity check to prevent nasty protection faults. */
* Sanity check to prevent nasty protection faults.
*/
if (!ex_desc->keyword || !ex_desc->description || !*ex_desc->keyword || !*ex_desc->description) { if (!ex_desc->keyword || !ex_desc->description || !*ex_desc->keyword || !*ex_desc->description) {
mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: OLC: export_save_objects: Corrupt ex_desc!"); mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: OLC: export_save_objects: Corrupt ex_desc!");
continue; continue;
@ -788,9 +728,7 @@ int export_save_objects(zone_rnum zrnum)
"%s~\n", ex_desc->keyword, buf); "%s~\n", ex_desc->keyword, buf);
} }
} }
/* /* Do we have affects? */
* Do we have affects?
*/
for (i = 0; i < MAX_OBJ_AFFECT; i++) for (i = 0; i < MAX_OBJ_AFFECT; i++)
if (obj->affected[i].modifier) if (obj->affected[i].modifier)
fprintf(obj_file, "A\n" fprintf(obj_file, "A\n"
@ -800,9 +738,7 @@ int export_save_objects(zone_rnum zrnum)
} }
} }
/* /* Write the final line, close the file. */
* Write the final line, close the file.
*/
fprintf(obj_file, "$~\n"); fprintf(obj_file, "$~\n");
fclose(obj_file); fclose(obj_file);
@ -831,15 +767,11 @@ int export_save_rooms(zone_rnum zrnum)
room = &world[rnum]; room = &world[rnum];
/* /* Copy the description and strip off trailing newlines. */
* Copy the description and strip off trailing newlines.
*/
strncpy(buf, room->description ? room->description : "Empty room.", sizeof(buf)-1 ); strncpy(buf, room->description ? room->description : "Empty room.", sizeof(buf)-1 );
strip_cr(buf); strip_cr(buf);
/* /* Save the numeric and string section of the file. */
* Save the numeric and string section of the file.
*/
sprintascii(bit, room->room_flags); sprintascii(bit, room->room_flags);
fprintf(room_file, "#QQ%02d\n" fprintf(room_file, "#QQ%02d\n"
"%s%c\n" "%s%c\n"
@ -851,9 +783,7 @@ int export_save_rooms(zone_rnum zrnum)
bit, room->sector_type bit, room->sector_type
); );
/* /* Now you write out the exits for the room. */
* Now you write out the exits for the room.
*/
for (j = 0; j < NUM_OF_DIRS; j++) { for (j = 0; j < NUM_OF_DIRS; j++) {
if (R_EXIT(room, j)) { if (R_EXIT(room, j)) {
int dflag; int dflag;
@ -863,9 +793,7 @@ int export_save_rooms(zone_rnum zrnum)
} else } else
*buf = '\0'; *buf = '\0';
/* /* Figure out door flag. */
* Figure out door flag.
*/
if (IS_SET(R_EXIT(room, j)->exit_info, EX_ISDOOR)) { if (IS_SET(R_EXIT(room, j)->exit_info, EX_ISDOOR)) {
if (IS_SET(R_EXIT(room, j)->exit_info, EX_PICKPROOF)) if (IS_SET(R_EXIT(room, j)->exit_info, EX_PICKPROOF))
dflag = 2; dflag = 2;
@ -879,9 +807,7 @@ int export_save_rooms(zone_rnum zrnum)
else else
*buf1 = '\0'; *buf1 = '\0';
/* /* Now write the exit to the file. */
* Now write the exit to the file.
*/
if (R_EXIT(room, j)->to_room == NOWHERE || world[R_EXIT(room, j)->to_room].zone == zrnum) if (R_EXIT(room, j)->to_room == NOWHERE || world[R_EXIT(room, j)->to_room].zone == zrnum)
fprintf(room_file,"D%d\n" fprintf(room_file,"D%d\n"
"%s~\n" "%s~\n"
@ -928,9 +854,7 @@ int export_save_rooms(zone_rnum zrnum)
} }
} }
/* /* Write the final line and close it. */
* Write the final line and close it.
*/
fprintf(room_file, "$~\n"); fprintf(room_file, "$~\n");
fclose(room_file); fclose(room_file);

View file

@ -1,9 +1,10 @@
/************************************************************************ /**************************************************************************
* Generic OLC Library - General / genolc.h v1.0 * * File: genolc.h Part of tbaMUD *
* Original author: Levork * * *
* Copyright 1996 by Harvey Gilpin * * Usage: Generic OLC Library - General. *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) * * *
************************************************************************/ * Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
**************************************************************************/
#define STRING_TERMINATOR '~' #define STRING_TERMINATOR '~'
#define CONFIG_GENOLC_MOBPROG 0 #define CONFIG_GENOLC_MOBPROG 0

View file

@ -1,8 +1,9 @@
/************************************************************************ /**************************************************************************
* Generic OLC Library - Shops / genshp.c v1.0 * * File: genshp.c Part of tbaMUD *
* Copyright 1996 by Harvey Gilpin * * Usage: Generic OLC Library - Shops. *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) * * *
************************************************************************/ * Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
**************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
@ -14,10 +15,8 @@
#include "genshp.h" #include "genshp.h"
#include "genzon.h" #include "genzon.h"
/* /* NOTE (gg): Didn't modify sedit much. Don't consider it as 'recent' as the
* NOTE (gg): Didn't modify sedit much. Don't consider it as 'recent' * other editors with regard to updates or style. */
* as the other editors with regard to updates or style.
*/
/* local functions */ /* local functions */
void copy_shop_list(IDXTYPE **tlist, IDXTYPE *flist); void copy_shop_list(IDXTYPE **tlist, IDXTYPE *flist);
@ -25,13 +24,9 @@ void copy_shop_type_list(struct shop_buy_data **tlist, struct shop_buy_data *fli
void free_shop_strings(struct shop_data *shop); void free_shop_strings(struct shop_data *shop);
void free_shop_type_list(struct shop_buy_data **list); void free_shop_type_list(struct shop_buy_data **list);
/*-------------------------------------------------------------------*/
void copy_shop(struct shop_data *tshop, struct shop_data *fshop, int free_old_strings) void copy_shop(struct shop_data *tshop, struct shop_data *fshop, int free_old_strings)
{ {
/* /* Copy basic information over. */
* Copy basic information over.
*/
S_NUM(tshop) = S_NUM(fshop); S_NUM(tshop) = S_NUM(fshop);
S_KEEPER(tshop) = S_KEEPER(fshop); S_KEEPER(tshop) = S_KEEPER(fshop);
S_OPEN1(tshop) = S_OPEN1(fshop); S_OPEN1(tshop) = S_OPEN1(fshop);
@ -47,16 +42,12 @@ void copy_shop(struct shop_data *tshop, struct shop_data *fshop, int free_old_st
S_SELLPROFIT(tshop) = S_SELLPROFIT(fshop); S_SELLPROFIT(tshop) = S_SELLPROFIT(fshop);
S_FUNC(tshop) = S_FUNC(fshop); S_FUNC(tshop) = S_FUNC(fshop);
/* /* Copy lists over. */
* Copy lists over.
*/
copy_shop_list(&(S_ROOMS(tshop)), S_ROOMS(fshop)); copy_shop_list(&(S_ROOMS(tshop)), S_ROOMS(fshop));
copy_shop_list(&(S_PRODUCTS(tshop)), S_PRODUCTS(fshop)); copy_shop_list(&(S_PRODUCTS(tshop)), S_PRODUCTS(fshop));
copy_shop_type_list(&(tshop->type), fshop->type); copy_shop_type_list(&(tshop->type), fshop->type);
/* /* Copy notification strings over. */
* Copy notification strings over.
*/
if (free_old_strings) if (free_old_strings)
free_shop_strings(tshop); free_shop_strings(tshop);
S_NOITEM1(tshop) = str_udup(S_NOITEM1(fshop)); S_NOITEM1(tshop) = str_udup(S_NOITEM1(fshop));
@ -69,11 +60,7 @@ void copy_shop(struct shop_data *tshop, struct shop_data *fshop, int free_old_st
} }
/*-------------------------------------------------------------------*/ /* Copy a 'NOTHING' terminated integer array list. */
/*
* Copy a 'NOTHING' terminated integer array list.
*/
void copy_shop_list(IDXTYPE **tlist, IDXTYPE *flist) void copy_shop_list(IDXTYPE **tlist, IDXTYPE *flist)
{ {
int num_items, i; int num_items, i;
@ -81,30 +68,19 @@ void copy_shop_list(IDXTYPE **tlist, IDXTYPE *flist)
if (*tlist) if (*tlist)
free(*tlist); free(*tlist);
/* /* Count number of entries. */
* Count number of entries.
*/
for (i = 0; flist[i] != NOTHING; i++); for (i = 0; flist[i] != NOTHING; i++);
num_items = i + 1; num_items = i + 1;
/* /* Make space for entries. */
* Make space for entries.
*/
CREATE(*tlist, IDXTYPE, num_items); CREATE(*tlist, IDXTYPE, num_items);
/* /* Copy entries over. */
* Copy entries over.
*/
for (i = 0; i < num_items; i++) for (i = 0; i < num_items; i++)
(*tlist)[i] = flist[i]; (*tlist)[i] = flist[i];
} }
/*-------------------------------------------------------------------*/ /* Copy a -1 terminated (in the type field) shop_buy_data array list. */
/*
* Copy a -1 terminated (in the type field) shop_buy_data
* array list.
*/
void copy_shop_type_list(struct shop_buy_data **tlist, struct shop_buy_data *flist) void copy_shop_type_list(struct shop_buy_data **tlist, struct shop_buy_data *flist)
{ {
int num_items, i; int num_items, i;
@ -112,20 +88,14 @@ void copy_shop_type_list(struct shop_buy_data **tlist, struct shop_buy_data *fli
if (*tlist) if (*tlist)
free_shop_type_list(tlist); free_shop_type_list(tlist);
/* /* Count number of entries. */
* Count number of entries.
*/
for (i = 0; BUY_TYPE(flist[i]) != NOTHING; i++); for (i = 0; BUY_TYPE(flist[i]) != NOTHING; i++);
num_items = i + 1; num_items = i + 1;
/* /* Make space for entries. */
* Make space for entries.
*/
CREATE(*tlist, struct shop_buy_data, num_items); CREATE(*tlist, struct shop_buy_data, num_items);
/* /* Copy entries over. */
* Copy entries over.
*/
for (i = 0; i < num_items; i++) { for (i = 0; i < num_items; i++) {
(*tlist)[i].type = flist[i].type; (*tlist)[i].type = flist[i].type;
if (BUY_WORD(flist[i])) if (BUY_WORD(flist[i]))
@ -133,16 +103,12 @@ void copy_shop_type_list(struct shop_buy_data **tlist, struct shop_buy_data *fli
} }
} }
/*-------------------------------------------------------------------*/
void remove_shop_from_type_list(struct shop_buy_data **list, int num) void remove_shop_from_type_list(struct shop_buy_data **list, int num)
{ {
int i, num_items; int i, num_items;
struct shop_buy_data *nlist; struct shop_buy_data *nlist;
/* /* Count number of entries. */
* Count number of entries.
*/
for (i = 0; (*list)[i].type != NOTHING; i++); for (i = 0; (*list)[i].type != NOTHING; i++);
if (num < 0 || num >= i) if (num < 0 || num >= i)
@ -159,22 +125,16 @@ void remove_shop_from_type_list(struct shop_buy_data **list, int num)
*list = nlist; *list = nlist;
} }
/*-------------------------------------------------------------------*/
void add_shop_to_type_list(struct shop_buy_data **list, struct shop_buy_data *newl) void add_shop_to_type_list(struct shop_buy_data **list, struct shop_buy_data *newl)
{ {
int i, num_items; int i, num_items;
struct shop_buy_data *nlist; struct shop_buy_data *nlist;
/* /* Count number of entries. */
* Count number of entries.
*/
for (i = 0; (*list)[i].type != NOTHING; i++); for (i = 0; (*list)[i].type != NOTHING; i++);
num_items = i; num_items = i;
/* /* Make a new list and slot in the new entry. */
* Make a new list and slot in the new entry.
*/
CREATE(nlist, struct shop_buy_data, num_items + 2); CREATE(nlist, struct shop_buy_data, num_items + 2);
for (i = 0; i < num_items; i++) for (i = 0; i < num_items; i++)
@ -182,28 +142,20 @@ void add_shop_to_type_list(struct shop_buy_data **list, struct shop_buy_data *ne
nlist[num_items] = *newl; nlist[num_items] = *newl;
nlist[num_items + 1].type = NOTHING; nlist[num_items + 1].type = NOTHING;
/* /* Out with the old, in with the new. */
* Out with the old, in with the new.
*/
free(*list); free(*list);
*list = nlist; *list = nlist;
} }
/*-------------------------------------------------------------------*/
void add_shop_to_int_list(IDXTYPE **list, IDXTYPE newi) void add_shop_to_int_list(IDXTYPE **list, IDXTYPE newi)
{ {
IDXTYPE i, num_items, *nlist; IDXTYPE i, num_items, *nlist;
/* /* Count number of entries. */
* Count number of entries.
*/
for (i = 0; (*list)[i] != NOTHING; i++); for (i = 0; (*list)[i] != NOTHING; i++);
num_items = i; num_items = i;
/* /* Make a new list and slot in the new entry. */
* Make a new list and slot in the new entry.
*/
CREATE(nlist, IDXTYPE, num_items + 2); CREATE(nlist, IDXTYPE, num_items + 2);
for (i = 0; i < num_items; i++) for (i = 0; i < num_items; i++)
@ -211,22 +163,16 @@ void add_shop_to_int_list(IDXTYPE **list, IDXTYPE newi)
nlist[num_items] = newi; nlist[num_items] = newi;
nlist[num_items + 1] = NOTHING; nlist[num_items + 1] = NOTHING;
/* /* Out with the old, in with the new. */
* Out with the old, in with the new.
*/
free(*list); free(*list);
*list = nlist; *list = nlist;
} }
/*-------------------------------------------------------------------*/
void remove_shop_from_int_list(IDXTYPE **list, IDXTYPE num) void remove_shop_from_int_list(IDXTYPE **list, IDXTYPE num)
{ {
IDXTYPE i, num_items, *nlist; IDXTYPE i, num_items, *nlist;
/* /* Count number of entries. */
* Count number of entries.
*/
for (i = 0; (*list)[i] != NOTHING; i++); for (i = 0; (*list)[i] != NOTHING; i++);
#if CIRCLE_UNSIGNED_INDEX #if CIRCLE_UNSIGNED_INDEX
@ -246,11 +192,7 @@ void remove_shop_from_int_list(IDXTYPE **list, IDXTYPE num)
*list = nlist; *list = nlist;
} }
/*-------------------------------------------------------------------*/ /* Free all the notice character strings in a shop structure. */
/*
* Free all the notice character strings in a shop structure.
*/
void free_shop_strings(struct shop_data *shop) void free_shop_strings(struct shop_data *shop)
{ {
if (S_NOITEM1(shop)) { if (S_NOITEM1(shop)) {
@ -283,11 +225,7 @@ void free_shop_strings(struct shop_data *shop)
} }
} }
/*-------------------------------------------------------------------*/ /* Free a type list and all the strings it contains. */
/*
* Free a type list and all the strings it contains.
*/
void free_shop_type_list(struct shop_buy_data **list) void free_shop_type_list(struct shop_buy_data **list)
{ {
int i; int i;
@ -300,11 +238,7 @@ void free_shop_type_list(struct shop_buy_data **list)
*list = NULL; *list = NULL;
} }
/*-------------------------------------------------------------------*/ /* Free up the whole shop structure and it's content. */
/*
* Free up the whole shop structure and it's content.
*/
void free_shop(struct shop_data *shop) void free_shop(struct shop_data *shop)
{ {
free_shop_strings(shop); free_shop_strings(shop);
@ -314,12 +248,8 @@ void free_shop(struct shop_data *shop)
free(shop); free(shop);
} }
/*-------------------------------------------------------------------*/ /* Returns the real number of the shop with given virtual number. We take so
* good care to keep it sorted - let's use it. - Welcor */
/* returns the real number of the shop with given virtual number
*
* We take so good care to keep it sorted - let's use it :) - Welcor
*/
shop_rnum real_shop(shop_vnum vnum) shop_rnum real_shop(shop_vnum vnum)
{ {
int bot, top, mid; int bot, top, mid;
@ -340,20 +270,14 @@ shop_rnum real_shop(shop_vnum vnum)
return NOWHERE; return NOWHERE;
} }
/*-------------------------------------------------------------------*/ /* Generic string modifier for shop keeper messages. */
/*
* Generic string modifier for shop keeper messages.
*/
void modify_shop_string(char **str, char *new_s) void modify_shop_string(char **str, char *new_s)
{ {
char buf[MAX_STRING_LENGTH]; char buf[MAX_STRING_LENGTH];
char *pointer; char *pointer;
/* /* Check the '%s' is present, if not, add it. */
* Check the '%s' is present, if not, add it.
*/
if (*new_s != '%') { if (*new_s != '%') {
snprintf(buf, sizeof(buf), "%%s %s", new_s); snprintf(buf, sizeof(buf), "%%s %s", new_s);
pointer = buf; pointer = buf;
@ -365,17 +289,13 @@ void modify_shop_string(char **str, char *new_s)
*str = strdup(pointer); *str = strdup(pointer);
} }
/*-------------------------------------------------------------------*/
int add_shop(struct shop_data *nshp) int add_shop(struct shop_data *nshp)
{ {
shop_rnum rshop; shop_rnum rshop;
int found = 0; int found = 0;
zone_rnum rznum = real_zone_by_thing(S_NUM(nshp)); zone_rnum rznum = real_zone_by_thing(S_NUM(nshp));
/* /* The shop already exists, just update it. */
* The shop already exists, just update it.
*/
if ((rshop = real_shop(S_NUM(nshp))) != NOWHERE) { if ((rshop = real_shop(S_NUM(nshp))) != NOWHERE) {
/* free old strings. They're not used in any other place -- Welcor */ /* free old strings. They're not used in any other place -- Welcor */
copy_shop(&shop_index[rshop], nshp, TRUE); copy_shop(&shop_index[rshop], nshp, TRUE);
@ -421,8 +341,6 @@ int add_shop(struct shop_data *nshp)
return rshop; return rshop;
} }
/*-------------------------------------------------------------------*/
int save_shops(zone_rnum zone_num) int save_shops(zone_rnum zone_num)
{ {
int i, j, rshop; int i, j, rshop;
@ -448,47 +366,31 @@ int save_shops(zone_rnum zone_num)
fclose(shop_file); fclose(shop_file);
return FALSE; return FALSE;
} }
/* /* Search database for shops in this zone. */
* Search database for shops in this zone.
*/
for (i = genolc_zone_bottom(zone_num); i <= zone_table[zone_num].top; i++) { for (i = genolc_zone_bottom(zone_num); i <= zone_table[zone_num].top; i++) {
if ((rshop = real_shop(i)) != NOWHERE) { if ((rshop = real_shop(i)) != NOWHERE) {
fprintf(shop_file, "#%d~\n", i); fprintf(shop_file, "#%d~\n", i);
shop = shop_index + rshop; shop = shop_index + rshop;
/* /* Save the products. */
* Save the products.
*/
for (j = 0; S_PRODUCT(shop, j) != NOTHING; j++) for (j = 0; S_PRODUCT(shop, j) != NOTHING; j++)
fprintf(shop_file, "%d\n", obj_index[S_PRODUCT(shop, j)].vnum); fprintf(shop_file, "%d\n", obj_index[S_PRODUCT(shop, j)].vnum);
fprintf(shop_file, "-1\n"); fprintf(shop_file, "-1\n");
/* /* Save the rates. */
* Save the rates.
*/
fprintf(shop_file, "%1.2f\n" fprintf(shop_file, "%1.2f\n"
"%1.2f\n", "%1.2f\n",
S_BUYPROFIT(shop), S_BUYPROFIT(shop),
S_SELLPROFIT(shop)); S_SELLPROFIT(shop));
/* /* Save the buy types and namelists. */
* Save the buy types and namelists.
*/
for (j = 0;S_BUYTYPE(shop, j) != NOTHING; j++) for (j = 0;S_BUYTYPE(shop, j) != NOTHING; j++)
fprintf(shop_file, "%d%s\n", fprintf(shop_file, "%d%s\n",
S_BUYTYPE(shop, j), S_BUYTYPE(shop, j),
S_BUYWORD(shop, j) ? S_BUYWORD(shop, j) : ""); S_BUYWORD(shop, j) ? S_BUYWORD(shop, j) : "");
fprintf(shop_file, "-1\n"); fprintf(shop_file, "-1\n");
/* Not allowed to use Ascii in shopfile anymore (bpl21) /* Save messages. Added some defaults as sanity checks. */
sprintascii(buf1, S_BITVECTOR(shop));
sprintascii(buf2, S_NOTRADE(shop));
*/
/*
* Save messages'n'stuff.
* Added some small'n'silly defaults as sanity checks.
*/
fprintf(shop_file, fprintf(shop_file,
"%s~\n" "%s~\n"
"%s~\n" "%s~\n"
@ -514,16 +416,12 @@ int save_shops(zone_rnum zone_num)
S_NOTRADE(shop) S_NOTRADE(shop)
); );
/* /* Save the rooms. */
* Save the rooms.
*/
for (j = 0;S_ROOM(shop, j) != NOWHERE; j++) for (j = 0;S_ROOM(shop, j) != NOWHERE; j++)
fprintf(shop_file, "%d\n", S_ROOM(shop, j)); fprintf(shop_file, "%d\n", S_ROOM(shop, j));
fprintf(shop_file, "-1\n"); fprintf(shop_file, "-1\n");
/* /* Save open/closing times. */
* Save open/closing times
*/
fprintf(shop_file, "%d\n%d\n%d\n%d\n", S_OPEN1(shop), S_CLOSE1(shop), fprintf(shop_file, "%d\n%d\n%d\n%d\n", S_OPEN1(shop), S_CLOSE1(shop),
S_OPEN2(shop), S_CLOSE2(shop)); S_OPEN2(shop), S_CLOSE2(shop));
} }

View file

@ -1,8 +1,10 @@
/************************************************************************ /**************************************************************************
* Generic OLC Library - Shops / genshp.h v1.0 * * File: genshp.h Part of tbaMUD *
* Copyright 1996 by Harvey Gilpin * * *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) * * Usage: Generic OLC Library - Shops. *
************************************************************************/ * *
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
**************************************************************************/
void copy_shop(struct shop_data *tshop, struct shop_data *fshop, int free_old_strings); void copy_shop(struct shop_data *tshop, struct shop_data *fshop, int free_old_strings);
void remove_shop_from_type_list(struct shop_buy_data **list, int num); void remove_shop_from_type_list(struct shop_buy_data **list, int num);
@ -16,9 +18,7 @@ int add_shop(struct shop_data *shop);
int save_shops(zone_rnum zone_num); int save_shops(zone_rnum zone_num);
shop_rnum real_shop(shop_vnum vnum); shop_rnum real_shop(shop_vnum vnum);
/* /* Handy macros. */
* Handy macros.
*/
#define S_NUM(i) ((i)->vnum) #define S_NUM(i) ((i)->vnum)
#define S_KEEPER(i) ((i)->keeper) #define S_KEEPER(i) ((i)->keeper)
#define S_OPEN1(i) ((i)->open1) #define S_OPEN1(i) ((i)->open1)

View file

@ -1,13 +1,12 @@
/************************************************************************ /**************************************************************************
* Generic OLC Library - Rooms / genwld.c v1.0 * * File: genwld.c Part of tbaMUD *
* Original author: Levork * * Usage: Generic OLC Library - Rooms. *
* Copyright 1996 by Harvey Gilpin * * *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) * * By Levork. Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
************************************************************************/ **************************************************************************/
#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 "db.h" #include "db.h"
@ -23,10 +22,8 @@ extern room_rnum r_mortal_start_room;
extern room_rnum r_immort_start_room; extern room_rnum r_immort_start_room;
extern room_rnum r_frozen_start_room; extern room_rnum r_frozen_start_room;
/* /* This function will copy the strings so be sure you free your own copies of
* This function will copy the strings so be sure you free your own * the description, title, and such. */
* copies of the description, title, and such.
*/
room_rnum add_room(struct room_data *room) room_rnum add_room(struct room_data *room)
{ {
struct char_data *tch; struct char_data *tch;
@ -79,12 +76,9 @@ room_rnum add_room(struct room_data *room)
} }
log("GenOLC: add_room: Added room %d at index #%d.", room->number, found); log("GenOLC: add_room: Added room %d at index #%d.", room->number, found);
/* found is equal to the array index where we added the room. */ /* found is equal to the array index where we added the room. */
/* /* Find what zone that room was in so we can update the loading table. */
* Find what zone that room was in so we can update the loading table.
*/
for (i = room->zone; i <= top_of_zone_table; i++) for (i = room->zone; i <= top_of_zone_table; i++)
for (j = 0; ZCMD(i, j).command != 'S'; j++) for (j = 0; ZCMD(i, j).command != 'S'; j++)
switch (ZCMD(i, j).command) { switch (ZCMD(i, j).command) {
@ -107,16 +101,12 @@ room_rnum add_room(struct room_data *room)
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: GenOLC: add_room: Unknown zone entry found!"); mudlog(BRF, LVL_GOD, TRUE, "SYSERR: GenOLC: add_room: Unknown zone entry found!");
} }
/* /* Update the loadroom table. Adds 1 or 0. */
* Update the loadroom table. Adds 1 or 0.
*/
r_mortal_start_room += (r_mortal_start_room >= found); r_mortal_start_room += (r_mortal_start_room >= found);
r_immort_start_room += (r_immort_start_room >= found); r_immort_start_room += (r_immort_start_room >= found);
r_frozen_start_room += (r_frozen_start_room >= found); r_frozen_start_room += (r_frozen_start_room >= found);
/* /* Update world exits. */
* Update world exits.
*/
i = top_of_world + 1; i = top_of_world + 1;
do { do {
i--; i--;
@ -127,14 +117,10 @@ room_rnum add_room(struct room_data *room)
add_to_save_list(zone_table[room->zone].number, SL_WLD); add_to_save_list(zone_table[room->zone].number, SL_WLD);
/* /* Return what array entry we placed the new room in. */
* Return what array entry we placed the new room in.
*/
return found; return found;
} }
/* -------------------------------------------------------------------------- */
int delete_room(room_rnum rnum) int delete_room(room_rnum rnum)
{ {
room_rnum i; room_rnum i;
@ -166,10 +152,8 @@ int delete_room(room_rnum rnum)
r_frozen_start_room = 0; /* The Void */ r_frozen_start_room = 0; /* The Void */
} }
/* /* Dump the contents of this room into the Void. We could also just extract
* Dump the contents of this room into the Void. We could also just * the people, mobs, and objects here. */
* extract the people, mobs, and objects here.
*/
for (obj = world[rnum].contents; obj; obj = next_obj) { for (obj = world[rnum].contents; obj; obj = next_obj) {
next_obj = obj->next_content; next_obj = obj->next_content;
obj_from_room(obj); obj_from_room(obj);
@ -186,10 +170,8 @@ int delete_room(room_rnum rnum)
extract_script(room, WLD_TRIGGER); extract_script(room, WLD_TRIGGER);
free_proto_script(room, WLD_TRIGGER); free_proto_script(room, WLD_TRIGGER);
/* /* Change any exit going to this room to go the void. Also fix all the exits
* Change any exit going to this room to go the void. * pointing to rooms above this. */
* Also fix all the exits pointing to rooms above this.
*/
i = top_of_world + 1; i = top_of_world + 1;
do { do {
i--; i--;
@ -216,9 +198,7 @@ int delete_room(room_rnum rnum)
} }
} while (i > 0); } while (i > 0);
/* /* Find what zone that room was in so we can update the loading table. */
* Find what zone that room was in so we can update the loading table.
*/
for (i = 0; i <= top_of_zone_table; i++) for (i = 0; i <= top_of_zone_table; i++)
for (j = 0; ZCMD(i , j).command != 'S'; j++) for (j = 0; ZCMD(i , j).command != 'S'; j++)
switch (ZCMD(i, j).command) { switch (ZCMD(i, j).command) {
@ -247,18 +227,14 @@ int delete_room(room_rnum rnum)
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: GenOLC: delete_room: Unknown zone entry found!"); mudlog(BRF, LVL_GOD, TRUE, "SYSERR: GenOLC: delete_room: Unknown zone entry found!");
} }
/* /* Remove this room from all shop lists. */
* Remove this room from all shop lists.
*/
for (i = 0;i < top_shop;i++) { for (i = 0;i < top_shop;i++) {
for (j = 0;SHOP_ROOM(i, j) != NOWHERE;j++) { for (j = 0;SHOP_ROOM(i, j) != NOWHERE;j++) {
if (SHOP_ROOM(i, j) == world[rnum].number) if (SHOP_ROOM(i, j) == world[rnum].number)
SHOP_ROOM(i, j) = 0; /* set to the void */ SHOP_ROOM(i, j) = 0; /* set to the void */
} }
} }
/* /* Now we actually move the rooms down. */
* Now we actually move the rooms down.
*/
for (i = rnum; i < top_of_world; i++) { for (i = rnum; i < top_of_world; i++) {
world[i] = world[i + 1]; world[i] = world[i + 1];
update_wait_events(&world[i], &world[i+1]); update_wait_events(&world[i], &world[i+1]);
@ -276,7 +252,6 @@ int delete_room(room_rnum rnum)
return TRUE; return TRUE;
} }
int save_rooms(zone_rnum rzone) int save_rooms(zone_rnum rzone)
{ {
int i; int i;
@ -313,15 +288,11 @@ int save_rooms(zone_rnum rzone)
room = (world + rnum); room = (world + rnum);
/* /* Copy the description and strip off trailing newlines. */
* Copy the description and strip off trailing newlines.
*/
strncpy(buf, room->description ? room->description : "Empty room.", sizeof(buf)-1 ); strncpy(buf, room->description ? room->description : "Empty room.", sizeof(buf)-1 );
strip_cr(buf); strip_cr(buf);
/* /* Save the numeric and string section of the file. */
* Save the numeric and string section of the file.
*/
sprintascii(bit, room->room_flags); sprintascii(bit, room->room_flags);
fprintf(sf, "#%d\n" fprintf(sf, "#%d\n"
"%s%c\n" "%s%c\n"
@ -333,9 +304,7 @@ int save_rooms(zone_rnum rzone)
zone_table[room->zone].number, bit, room->sector_type zone_table[room->zone].number, bit, room->sector_type
); );
/* /* Now you write out the exits for the room. */
* Now you write out the exits for the room.
*/
for (j = 0; j < NUM_OF_DIRS; j++) { for (j = 0; j < NUM_OF_DIRS; j++) {
if (R_EXIT(room, j)) { if (R_EXIT(room, j)) {
int dflag; int dflag;
@ -345,9 +314,7 @@ int save_rooms(zone_rnum rzone)
} else } else
*buf = '\0'; *buf = '\0';
/* /* Figure out door flag. */
* Figure out door flag.
*/
if (IS_SET(R_EXIT(room, j)->exit_info, EX_ISDOOR)) { if (IS_SET(R_EXIT(room, j)->exit_info, EX_ISDOOR)) {
if (IS_SET(R_EXIT(room, j)->exit_info, EX_PICKPROOF)) if (IS_SET(R_EXIT(room, j)->exit_info, EX_PICKPROOF))
dflag = 2; dflag = 2;
@ -361,9 +328,7 @@ int save_rooms(zone_rnum rzone)
else else
*buf1 = '\0'; *buf1 = '\0';
/* /* Now write the exit to the file. */
* Now write the exit to the file.
*/
fprintf(sf, "D%d\n" fprintf(sf, "D%d\n"
"%s~\n" "%s~\n"
"%s~\n" "%s~\n"
@ -390,9 +355,7 @@ int save_rooms(zone_rnum rzone)
} }
} }
/* /* Write the final line and close it. */
* Write the final line and close it.
*/
fprintf(sf, "$~\n"); fprintf(sf, "$~\n");
fclose(sf); fclose(sf);
@ -413,17 +376,14 @@ int copy_room(struct room_data *to, struct room_data *from)
*to = *from; *to = *from;
copy_room_strings(to, from); copy_room_strings(to, from);
/* Don't put people and objects in two locations. /* Don't put people and objects in two locations. Should this be done here? */
Am thinking this shouldn't be done here... */
from->people = NULL; from->people = NULL;
from->contents = NULL; from->contents = NULL;
return TRUE; return TRUE;
} }
/* /* Idea by Cris Jacob. */
* Idea by: Cris Jacobin <jacobin@bellatlantic.net>
*/
room_rnum duplicate_room(room_vnum dest_vnum, room_rnum orig) room_rnum duplicate_room(room_vnum dest_vnum, room_rnum orig)
{ {
int new_rnum, znum; int new_rnum, znum;
@ -441,9 +401,7 @@ room_rnum duplicate_room(room_vnum dest_vnum, room_rnum orig)
return NOWHERE; return NOWHERE;
} }
/* /* add_room will make its own copies of strings. */
* add_room will make its own copies of strings.
*/
if ((new_rnum = add_room(&nroom)) == NOWHERE) { if ((new_rnum = add_room(&nroom)) == NOWHERE) {
log("SYSERR: GenOLC: copy_room: Problem adding room."); log("SYSERR: GenOLC: copy_room: Problem adding room.");
return NOWHERE; return NOWHERE;
@ -453,21 +411,17 @@ room_rnum duplicate_room(room_vnum dest_vnum, room_rnum orig)
nroom.number = dest_vnum; nroom.number = dest_vnum;
nroom.zone = znum; nroom.zone = znum;
/* So the people and objects aren't in two places at once... */ /* So the people and objects aren't in two places at once. */
nroom.contents = NULL; nroom.contents = NULL;
nroom.people = NULL; nroom.people = NULL;
return new_rnum; return new_rnum;
} }
/* -------------------------------------------------------------------------- */ /* Copy strings over so bad things don't happen. We do not free the existing
* strings here because copy_room() did a shallow copy previously and we'd be
/* * freeing the very strings we're copying. If this function is used elsewhere,
* Copy strings over so bad things don't happen. We do not free the * be sure to free_room_strings() the 'dest' room first. */
* existing strings here because copy_room() did a shallow copy previously
* and we'd be freeing the very strings we're copying. If this function
* is used elsewhere, be sure to free_room_strings() the 'dest' room first.
*/
int copy_room_strings(struct room_data *dest, struct room_data *source) int copy_room_strings(struct room_data *dest, struct room_data *source)
{ {
int i; int i;

View file

@ -1,9 +1,10 @@
/************************************************************************ /**************************************************************************
* Generic OLC Library - Rooms / genwld.h v1.0 * * File: genwld.h Part of tbaMUD *
* Original author: Levork * * *
* Copyright 1996 by Harvey Gilpin * * Usage: Generic OLC Library - Rooms. *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) * * *
************************************************************************/ * By Levork. Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
**************************************************************************/
room_rnum add_room(struct room_data *); room_rnum add_room(struct room_data *);
int delete_room(room_rnum); int delete_room(room_rnum);

View file

@ -1,8 +1,9 @@
/************************************************************************ /**************************************************************************
* Generic OLC Library - Zones / genzon.c v1.0 * * File: genzon.c Part of tbaMUD *
* Copyright 1996 by Harvey Gilpin * * Usage: Generic OLC Library - Zones. *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) * * *
************************************************************************/ * Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
**************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
@ -71,9 +72,7 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top,
return NOWHERE; return NOWHERE;
} }
/* /* Create the zone file. */
* Create the zone file.
*/
snprintf(buf, sizeof(buf), "%s/%d.zon", ZON_PREFIX, vzone_num); snprintf(buf, sizeof(buf), "%s/%d.zon", ZON_PREFIX, vzone_num);
if (!(fp = fopen(buf, "w"))) { if (!(fp = fopen(buf, "w"))) {
mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new zone file."); mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new zone file.");
@ -83,9 +82,7 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top,
fprintf(fp, "#%d\nNone~\nNew Zone~\n%d %d 30 2\nS\n$\n", vzone_num, bottom, top); fprintf(fp, "#%d\nNone~\nNew Zone~\n%d %d 30 2\nS\n$\n", vzone_num, bottom, top);
fclose(fp); fclose(fp);
/* /* Create the room file. */
* Create the room file.
*/
snprintf(buf, sizeof(buf), "%s/%d.wld", WLD_PREFIX, vzone_num); snprintf(buf, sizeof(buf), "%s/%d.wld", WLD_PREFIX, vzone_num);
if (!(fp = fopen(buf, "w"))) { if (!(fp = fopen(buf, "w"))) {
mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new world file."); mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new world file.");
@ -95,9 +92,7 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top,
fprintf(fp, "#%d\nThe Beginning~\nNot much here.\n~\n%d 0 0\nS\n$\n", bottom, vzone_num); fprintf(fp, "#%d\nThe Beginning~\nNot much here.\n~\n%d 0 0\nS\n$\n", bottom, vzone_num);
fclose(fp); fclose(fp);
/* /* Create the mobile file. */
* Create the mobile file.
*/
snprintf(buf, sizeof(buf), "%s/%d.mob", MOB_PREFIX, vzone_num); snprintf(buf, sizeof(buf), "%s/%d.mob", MOB_PREFIX, vzone_num);
if (!(fp = fopen(buf, "w"))) { if (!(fp = fopen(buf, "w"))) {
mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new mob file."); mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new mob file.");
@ -107,9 +102,7 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top,
fprintf(fp, "$\n"); fprintf(fp, "$\n");
fclose(fp); fclose(fp);
/* /* Create the object file. */
* Create the object file.
*/
snprintf(buf, sizeof(buf), "%s/%d.obj", OBJ_PREFIX, vzone_num); snprintf(buf, sizeof(buf), "%s/%d.obj", OBJ_PREFIX, vzone_num);
if (!(fp = fopen(buf, "w"))) { if (!(fp = fopen(buf, "w"))) {
mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new obj file."); mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new obj file.");
@ -119,9 +112,7 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top,
fprintf(fp, "$\n"); fprintf(fp, "$\n");
fclose(fp); fclose(fp);
/* /* Create the shop file. */
* Create the shop file.
*/
snprintf(buf, sizeof(buf), "%s/%d.shp", SHP_PREFIX, vzone_num); snprintf(buf, sizeof(buf), "%s/%d.shp", SHP_PREFIX, vzone_num);
if (!(fp = fopen(buf, "w"))) { if (!(fp = fopen(buf, "w"))) {
mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new shop file."); mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new shop file.");
@ -131,9 +122,7 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top,
fprintf(fp, "$~\n"); fprintf(fp, "$~\n");
fclose(fp); fclose(fp);
/* /* Create the trigger file. */
* Create the trigger file.
*/
snprintf(buf, sizeof(buf), "%s/%d.trg", TRG_PREFIX, vzone_num); snprintf(buf, sizeof(buf), "%s/%d.trg", TRG_PREFIX, vzone_num);
if (!(fp = fopen(buf, "w"))) { if (!(fp = fopen(buf, "w"))) {
mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new trigger file"); mudlog(BRF, LVL_IMPL, TRUE, "SYSERR: OLC: Can't write new trigger file");
@ -143,9 +132,7 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top,
fprintf(fp, "$~\n"); fprintf(fp, "$~\n");
fclose(fp); fclose(fp);
/* /* Update index files. */
* Update index files.
*/
create_world_index(vzone_num, "zon"); create_world_index(vzone_num, "zon");
create_world_index(vzone_num, "wld"); create_world_index(vzone_num, "wld");
create_world_index(vzone_num, "mob"); create_world_index(vzone_num, "mob");
@ -153,16 +140,13 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top,
create_world_index(vzone_num, "shp"); create_world_index(vzone_num, "shp");
create_world_index(vzone_num, "trg"); create_world_index(vzone_num, "trg");
/* /* Make a new zone in memory. This was the source of all the zedit new
* Make a new zone in memory. This was the source of all the zedit new * crashes. It was happily overwriting the stack. This new loop by Andrew
* crashes reported to the CircleMUD list. It was happily overwriting * Helm fixes that problem and is more understandable at the same time.
* the stack. This new loop by Andrew Helm fixes that problem and is
* more understandable at the same time.
* *
* The variable is 'top_of_zone_table_table + 2' because we need record 0 * The variable is 'top_of_zone_table_table + 2' because we need record 0
* through top_of_zone (top_of_zone_table + 1 items) and a new one which * through top_of_zone (top_of_zone_table + 1 items) and a new one which
* makes it top_of_zone_table + 2 elements large. * makes it top_of_zone_table + 2 elements large. */
*/
RECREATE(zone_table, struct zone_data, top_of_zone_table + 2); RECREATE(zone_table, struct zone_data, top_of_zone_table + 2);
zone_table[top_of_zone_table + 1].number = 32000; zone_table[top_of_zone_table + 1].number = 32000;
@ -180,9 +164,7 @@ rznum = i;
} }
zone = &zone_table[rznum]; zone = &zone_table[rznum];
/* /* Ok, insert the new zone here. */
* Ok, insert the new zone here.
*/
zone->name = strdup("New Zone"); zone->name = strdup("New Zone");
zone->number = vzone_num; zone->number = vzone_num;
zone->builders = strdup("None"); zone->builders = strdup("None");
@ -191,9 +173,7 @@ rznum = i;
zone->lifespan = 30; zone->lifespan = 30;
zone->age = 0; zone->age = 0;
zone->reset_mode = 2; zone->reset_mode = 2;
/* /* No zone commands, just terminate it with an 'S' */
* No zone commands, just terminate it with an 'S'
*/
CREATE(zone->cmd, struct reset_com, 1); CREATE(zone->cmd, struct reset_com, 1);
zone->cmd[0].command = 'S'; zone->cmd[0].command = 'S';
@ -203,8 +183,6 @@ rznum = i;
return rznum; return rznum;
} }
/*-------------------------------------------------------------------*/
void create_world_index(int znum, const char *type) void create_world_index(int znum, const char *type)
{ {
FILE *newfile, *oldfile; FILE *newfile, *oldfile;
@ -233,9 +211,7 @@ void create_world_index(int znum, const char *type)
prefix = TRG_PREFIX; prefix = TRG_PREFIX;
break; break;
default: default:
/* /* Caller messed up. */
* Caller messed up
*/
return; return;
} }
@ -251,16 +227,12 @@ void create_world_index(int znum, const char *type)
return; return;
} }
/* /* Index contents must be in order: search through the old file for the right
* Index contents must be in order: search through the old file for the * place, insert the new file, then copy the rest over. */
* right place, insert the new file, then copy the rest over.
*/
snprintf(buf1, sizeof(buf1), "%d.%s", znum, type); snprintf(buf1, sizeof(buf1), "%d.%s", znum, type);
while (get_line(oldfile, buf)) { while (get_line(oldfile, buf)) {
if (*buf == '$') { if (*buf == '$') {
/* /* The following used to add a blank line, thanks to Brian Taylor for the fix. */
* The following used to add a blank line, thanks to Brian Taylor for the fix... (Mythran)
*/
fprintf(newfile, "%s", (!found ? strncat(buf1, "\n$\n", sizeof(buf1)-1) : "$\n")); fprintf(newfile, "%s", (!found ? strncat(buf1, "\n$\n", sizeof(buf1)-1) : "$\n"));
break; break;
} else if (!found) { } else if (!found) {
@ -275,23 +247,17 @@ void create_world_index(int znum, const char *type)
fclose(newfile); fclose(newfile);
fclose(oldfile); fclose(oldfile);
/* /* Out with the old, in with the new. */
* Out with the old, in with the new.
*/
remove(old_name); remove(old_name);
rename(new_name, old_name); rename(new_name, old_name);
} }
/*-------------------------------------------------------------------*/
void remove_room_zone_commands(zone_rnum zone, room_rnum room_num) void remove_room_zone_commands(zone_rnum zone, room_rnum room_num)
{ {
int subcmd = 0, cmd_room = -2; int subcmd = 0, cmd_room = -2;
/* /* Delete all entries in zone_table that relate to this room so we can add
* Delete all entries in zone_table that relate to this room so we * all the ones we have in their place. */
* can add all the ones we have in their place.
*/
while (zone_table[zone].cmd[subcmd].command != 'S') { while (zone_table[zone].cmd[subcmd].command != 'S') {
switch (zone_table[zone].cmd[subcmd].command) { switch (zone_table[zone].cmd[subcmd].command) {
case 'M': case 'M':
@ -314,13 +280,9 @@ void remove_room_zone_commands(zone_rnum zone, room_rnum room_num)
} }
} }
/*-------------------------------------------------------------------*/ /* Save all the zone_table for this zone to disk. This function now writes
* simple comments in the form of (<name>) to each record. A header for each
/* * field is also there. */
* Save all the zone_table for this zone to disk. This function now
* writes simple comments in the form of (<name>) to each record. A
* header for each field is also there.
*/
int save_zone(zone_rnum zone_num) int save_zone(zone_rnum zone_num)
{ {
int subcmd, arg1 = -1, arg2 = -1, arg3 = -1; int subcmd, arg1 = -1, arg2 = -1, arg3 = -1;
@ -343,9 +305,7 @@ int save_zone(zone_rnum zone_num)
return FALSE; return FALSE;
} }
/* /* Print zone header to file. */
* Print zone header to file
*/
fprintf(zfile, "#%d\n" fprintf(zfile, "#%d\n"
"%s~\n" "%s~\n"
"%s~\n" "%s~\n"
@ -361,8 +321,7 @@ int save_zone(zone_rnum zone_num)
zone_table[zone_num].reset_mode zone_table[zone_num].reset_mode
); );
/* /* Handy Quick Reference Chart for Zone Values.
* Handy Quick Reference Chart for Zone Values.
* *
* Field #1 Field #3 Field #4 Field #5 * Field #1 Field #3 Field #4 Field #5
* ------------------------------------------------- * -------------------------------------------------
@ -375,8 +334,7 @@ int save_zone(zone_rnum zone_num)
* R (Remove) Room-Vnum Obj-Vnum Unused * R (Remove) Room-Vnum Obj-Vnum Unused
* T (Trigger) Trig-type Trig-Vnum Room-Vnum * T (Trigger) Trig-type Trig-Vnum Room-Vnum
* V (var) Trig-type Context Room-Vnum Varname Value * V (var) Trig-type Context Room-Vnum Varname Value
* ------------------------------------------------- * ------------------------------------------------- */
*/
for (subcmd = 0; ZCMD(zone_num, subcmd).command != 'S'; subcmd++) { for (subcmd = 0; ZCMD(zone_num, subcmd).command != 'S'; subcmd++) {
switch (ZCMD(zone_num, subcmd).command) { switch (ZCMD(zone_num, subcmd).command) {
@ -434,9 +392,7 @@ int save_zone(zone_rnum zone_num)
arg3 = world[ZCMD(zone_num, subcmd).arg3].number; arg3 = world[ZCMD(zone_num, subcmd).arg3].number;
break; break;
case '*': case '*':
/* /* Invalid commands are replaced with '*' - Ignore them. */
* Invalid commands are replaced with '*' - Ignore them.
*/
continue; continue;
default: default:
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: z_save_to_disk(): Unknown cmd '%c' - NOT saving", ZCMD(zone_num, subcmd).command); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: z_save_to_disk(): Unknown cmd '%c' - NOT saving", ZCMD(zone_num, subcmd).command);
@ -461,11 +417,7 @@ int save_zone(zone_rnum zone_num)
return TRUE; return TRUE;
} }
/*-------------------------------------------------------------------*/ /* Some common code to count the number of comands in the list. */
/*
* Some common code to count the number of comands in the list.
*/
int count_commands(struct reset_com *list) int count_commands(struct reset_com *list)
{ {
int count = 0; int count = 0;
@ -476,130 +428,89 @@ int count_commands(struct reset_com *list)
return count; return count;
} }
/*-------------------------------------------------------------------*/ /* Adds a new reset command into a list. Takes a pointer to the list so that
* it may play with the memory locations. */
/*
* Adds a new reset command into a list. Takes a pointer to the list
* so that it may play with the memory locations.
*/
void add_cmd_to_list(struct reset_com **list, struct reset_com *newcmd, int pos) void add_cmd_to_list(struct reset_com **list, struct reset_com *newcmd, int pos)
{ {
int count, i, l; int count, i, l;
struct reset_com *newlist; struct reset_com *newlist;
/* /* Count number of commands (not including terminator). */
* Count number of commands (not including terminator).
*/
count = count_commands(*list); count = count_commands(*list);
/* /* Value is +2 for the terminator and new field to add. */
* Value is +2 for the terminator and new field to add.
*/
CREATE(newlist, struct reset_com, count + 2); CREATE(newlist, struct reset_com, count + 2);
/* /* Even tighter loop to copy the old list and insert a new command. */
* Even tighter loop to copy the old list and insert a new command.
*/
for (i = 0, l = 0; i <= count; i++) { for (i = 0, l = 0; i <= count; i++) {
newlist[i] = ((i == pos) ? *newcmd : (*list)[l++]); newlist[i] = ((i == pos) ? *newcmd : (*list)[l++]);
} }
/* /* Add terminator, then insert new list. */
* Add terminator, then insert new list.
*/
newlist[count + 1].command = 'S'; newlist[count + 1].command = 'S';
free(*list); free(*list);
*list = newlist; *list = newlist;
} }
/*-------------------------------------------------------------------*/ /* Remove a reset command from a list. Takes a pointer to the list so that it
* may play with the memory locations. */
/*
* Remove a reset command from a list. Takes a pointer to the list
* so that it may play with the memory locations.
*/
void remove_cmd_from_list(struct reset_com **list, int pos) void remove_cmd_from_list(struct reset_com **list, int pos)
{ {
int count, i, l; int count, i, l;
struct reset_com *newlist; struct reset_com *newlist;
/* /* Count number of commands (not including terminator). */
* Count number of commands (not including terminator)
*/
count = count_commands(*list); count = count_commands(*list);
/* /* Value is 'count' because we didn't include the terminator above but since
* Value is 'count' because we didn't include the terminator above * we're deleting one thing anyway we want one less. */
* but since we're deleting one thing anyway we want one less.
*/
CREATE(newlist, struct reset_com, count); CREATE(newlist, struct reset_com, count);
/* /* Even tighter loop to copy old list and skip unwanted command. */
* Even tighter loop to copy old list and skip unwanted command.
*/
for (i = 0, l = 0; i < count; i++) { for (i = 0, l = 0; i < count; i++) {
if (i != pos) { if (i != pos) {
newlist[l++] = (*list)[i]; newlist[l++] = (*list)[i];
} }
} }
/* /* Add the terminator, then insert the new list. */
* Add the terminator, then insert the new list.
*/
newlist[count - 1].command = 'S'; newlist[count - 1].command = 'S';
free(*list); free(*list);
*list = newlist; *list = newlist;
} }
/*-------------------------------------------------------------------*/ /* Error check user input and then add new (blank) command. */
/*
* Error check user input and then add new (blank) command
*/
int new_command(struct zone_data *zone, int pos) int new_command(struct zone_data *zone, int pos)
{ {
int subcmd = 0; int subcmd = 0;
struct reset_com *new_com; struct reset_com *new_com;
/* /* Error check to ensure users hasn't given too large an index. */
* Error check to ensure users hasn't given too large an index
*/
while (zone->cmd[subcmd].command != 'S') while (zone->cmd[subcmd].command != 'S')
subcmd++; subcmd++;
if (pos < 0 || pos > subcmd) if (pos < 0 || pos > subcmd)
return 0; return 0;
/* /* Ok, let's add a new (blank) command. */
* Ok, let's add a new (blank) command
*/
CREATE(new_com, struct reset_com, 1); CREATE(new_com, struct reset_com, 1);
new_com->command = 'N'; new_com->command = 'N';
add_cmd_to_list(&zone->cmd, new_com, pos); add_cmd_to_list(&zone->cmd, new_com, pos);
return 1; return 1;
} }
/*-------------------------------------------------------------------*/ /* Error check user input and then remove command. */
/*
* Error check user input and then remove command
*/
void delete_zone_command(struct zone_data *zone, int pos) void delete_zone_command(struct zone_data *zone, int pos)
{ {
int subcmd = 0; int subcmd = 0;
/* /* Error check to ensure users hasn't given too large an index. */
* Error check to ensure users hasn't given too large an index
*/
while (zone->cmd[subcmd].command != 'S') while (zone->cmd[subcmd].command != 'S')
subcmd++; subcmd++;
if (pos < 0 || pos >= subcmd) if (pos < 0 || pos >= subcmd)
return; return;
/* /* Ok, let's zap it. */
* Ok, let's zap it
*/
remove_cmd_from_list(&zone->cmd, pos); remove_cmd_from_list(&zone->cmd, pos);
} }
/*-------------------------------------------------------------------*/

View file

@ -1,8 +1,10 @@
/************************************************************************ /**************************************************************************
* Generic OLC Library - Zones / genzon.h v1.0 * * File: genzon.h Part of tbaMUD *
* Copyright 1996 by Harvey Gilpin * * *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) * * Usage: Generic OLC Library - Zones. *
************************************************************************/ * *
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
**************************************************************************/
zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top, const char **error); zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top, const char **error);
void remove_room_zone_commands(zone_rnum zone, room_rnum room_num); void remove_room_zone_commands(zone_rnum zone, room_rnum room_num);
@ -13,4 +15,3 @@ int new_command(struct zone_data *zone, int pos);
void delete_zone_command(struct zone_data *zone, int pos); void delete_zone_command(struct zone_data *zone, int pos);
zone_rnum real_zone_by_thing(room_vnum vznum); zone_rnum real_zone_by_thing(room_vnum vznum);
/* Make delete_zone() */

View file

@ -1,8 +1,8 @@
/* ************************************************************************ /**************************************************************************
* File: graph.c Part of CircleMUD * * File: graph.c Part of tbaMUD *
* Usage: various graph algorithms * * Usage: Various graph algorithms. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
@ -10,8 +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"
@ -20,7 +18,6 @@
#include "db.h" #include "db.h"
#include "spells.h" #include "spells.h"
/* external functions */ /* external functions */
ACMD(do_say); ACMD(do_say);
@ -79,7 +76,6 @@ void bfs_enqueue(room_rnum room, int dir)
queue_head = queue_tail = curr; queue_head = queue_tail = curr;
} }
void bfs_dequeue(void) void bfs_dequeue(void)
{ {
struct bfs_queue_struct *curr; struct bfs_queue_struct *curr;
@ -91,21 +87,16 @@ void bfs_dequeue(void)
free(curr); free(curr);
} }
void bfs_clear_queue(void) void bfs_clear_queue(void)
{ {
while (queue_head) while (queue_head)
bfs_dequeue(); bfs_dequeue();
} }
/* find_first_step: given a source room and a target room, find the first step
/* * on the shortest path from the source to the target. Intended usage: in
* find_first_step: given a source room and a target room, find the first * mobile_activity, give a mob a dir to go if they're tracking another mob or a
* step on the shortest path from the source to the target. * PC. Or, a 'track' skill for PCs. */
*
* Intended usage: in mobile_activity, give a mob a dir to go if they're
* tracking another mob or a PC. Or, a 'track' skill for PCs.
*/
int find_first_step(room_rnum src, room_rnum target) int find_first_step(room_rnum src, room_rnum target)
{ {
int curr_dir; int curr_dir;
@ -150,11 +141,7 @@ int find_first_step(room_rnum src, room_rnum target)
return (BFS_NO_PATH); return (BFS_NO_PATH);
} }
/* Functions and Commands which use the above functions. */
/********************************************************
* Functions and Commands which use the above functions. *
********************************************************/
ACMD(do_track) ACMD(do_track)
{ {
char arg[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH];
@ -212,7 +199,6 @@ ACMD(do_track)
} }
} }
void hunt_victim(struct char_data *ch) void hunt_victim(struct char_data *ch)
{ {
int dir; int dir;

View file

@ -1,8 +1,8 @@
/* ************************************************************************ /**************************************************************************
* File: handler.c Part of CircleMUD * * File: handler.c Part of tbaMUD *
* Usage: internal funcs: moving and finding chars/objs * * Usage: Internal funcs: moving and finding chars/objs. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
@ -49,8 +49,7 @@ char *fname(const char *namelist)
return (holder); return (holder);
} }
/* Stock isname(). Leave this here even if you put in a newer * /* Leave this here even if you put in a newer isname(). Used for OasisOLC. */
* isname(). Used for OasisOLC. */
int is_name(const char *str, const char *namelist) int is_name(const char *str, const char *namelist)
{ {
const char *curname, *curstr; const char *curname, *curstr;
@ -139,17 +138,10 @@ void affect_modify(struct char_data *ch, byte loc, sbyte mod,
GET_CHA(ch) += mod; GET_CHA(ch) += mod;
break; break;
/* Do Not Use. */
case APPLY_CLASS: case APPLY_CLASS:
/* ??? GET_CLASS(ch) += mod; */
break; break;
/* My personal thoughts on these two would be to set the person to the value
* of the apply. That way you won't have to worry about people making +1
* level things to be imp (you restrict anything that gives immortal level of
* course). It also makes more sense to set someone to a class rather than
* adding to the class number. -gg */
case APPLY_LEVEL: case APPLY_LEVEL:
/* ??? GET_LEVEL(ch) += mod; */
break; break;
case APPLY_AGE: case APPLY_AGE:
@ -236,7 +228,6 @@ void affect_total(struct char_data *ch)
GET_OBJ_AFFECT(GET_EQ(ch, i)), FALSE); GET_OBJ_AFFECT(GET_EQ(ch, i)), FALSE);
} }
for (af = ch->affected; af; af = af->next) for (af = ch->affected; af; af = af->next)
affect_modify(ch, af->location, af->modifier, af->bitvector, FALSE); affect_modify(ch, af->location, af->modifier, af->bitvector, FALSE);
@ -1037,7 +1028,7 @@ struct char_data *get_char_room_vis(struct char_data *ch, char *name, int *numbe
num = get_number(&name); num = get_number(&name);
} }
/* JE 7/18/94 :-) :-) */ /* JE */
if (!str_cmp(name, "self") || !str_cmp(name, "me")) if (!str_cmp(name, "self") || !str_cmp(name, "me"))
return (ch); return (ch);

View file

@ -1,12 +1,13 @@
/* ************************************************************************ /**************************************************************************
* File: handler.h Part of CircleMUD * * File: handler.h Part of tbaMUD *
* *
* Usage: header file: prototypes of handling and utility functions * * Usage: header file: prototypes of handling and utility functions *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
/* handling the affected-structures */ /* handling the affected-structures */
void affect_total(struct char_data *ch); void affect_total(struct char_data *ch);
@ -25,8 +26,7 @@ int is_name(const char *str, const char *namelist);
char *fname(const char *namelist); char *fname(const char *namelist);
int get_number(char **name); int get_number(char **name);
/* ******** objects *********** */ /* objects */
void obj_to_char(struct obj_data *object, struct char_data *ch); void obj_to_char(struct obj_data *object, struct char_data *ch);
void obj_from_char(struct obj_data *object); void obj_from_char(struct obj_data *object);
@ -42,8 +42,7 @@ void object_list_new_owner(struct obj_data *list, struct char_data *ch);
void extract_obj(struct obj_data *obj); void extract_obj(struct obj_data *obj);
/* ******* characters ********* */ /* characters*/
struct char_data *get_char_room(char *name, int *num, room_rnum room); struct char_data *get_char_room(char *name, int *num, room_rnum room);
struct char_data *get_char_num(mob_rnum nr); struct char_data *get_char_num(mob_rnum nr);
@ -66,9 +65,7 @@ struct obj_data *get_obj_vis(struct char_data *ch, char *name, int *num);
struct obj_data *get_obj_in_equip_vis(struct char_data *ch, char *arg, int *number, struct obj_data *equipment[]); struct obj_data *get_obj_in_equip_vis(struct char_data *ch, char *arg, int *number, struct obj_data *equipment[]);
int get_obj_pos_in_equip_vis(struct char_data *ch, char *arg, int *num, struct obj_data *equipment[]); int get_obj_pos_in_equip_vis(struct char_data *ch, char *arg, int *num, struct obj_data *equipment[]);
/* find all dots */ /* find all dots */
int find_all_dots(char *arg); int find_all_dots(char *arg);
#define FIND_INDIV 0 #define FIND_INDIV 0
@ -77,7 +74,6 @@ int find_all_dots(char *arg);
/* Generic Find */ /* Generic Find */
int generic_find(char *arg, bitvector_t bitvector, struct char_data *ch, int generic_find(char *arg, bitvector_t bitvector, struct char_data *ch,
struct char_data **tar_ch, struct obj_data **tar_obj); struct char_data **tar_ch, struct obj_data **tar_obj);
@ -90,7 +86,6 @@ int generic_find(char *arg, bitvector_t bitvector, struct char_data *ch,
/* prototypes from crash save system */ /* prototypes from crash save system */
int Crash_delete_file(char *name); int Crash_delete_file(char *name);
int Crash_delete_crashfile(struct char_data *ch); int Crash_delete_crashfile(struct char_data *ch);
int Crash_clean_file(char *name); int Crash_clean_file(char *name);
@ -111,7 +106,6 @@ int skill_message(int dam, struct char_data *ch, struct char_data *vict,
int attacktype); int attacktype);
/* For new last command: */ /* For new last command: */
#define LAST_FILE LIB_ETC"last" #define LAST_FILE LIB_ETC"last"
#define LAST_CONNECT 0 #define LAST_CONNECT 0

View file

@ -1,8 +1,9 @@
/************************************************************************ /**************************************************************************
* hedit.c Hedit version 3.0 for Oasis OLC 5/5/06 * * File: hedit.c Part of tbaMUD *
* by Steve Wolfe - siv@cyberenet.net * * Usage: Help Editor. *
* Updated by Scott Meisenholder for Oasis 2.0.6 * * *
* **********************************************************************/ * By Steve Wolfe. Updated by Scott Meisenholder. *
**************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"

View file

@ -1,16 +1,15 @@
/* ************************************************************************ /**************************************************************************
* File: house.c Part of CircleMUD * * File: house.c Part of tbaMUD *
* Usage: Handling of player houses * * Usage: Handling of player houses. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#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"
@ -44,15 +43,13 @@ void House_listrent(struct char_data *ch, room_vnum vnum);
ACMD(do_hcontrol); ACMD(do_hcontrol);
ACMD(do_house); ACMD(do_house);
/* CONVERSION code starts here -- see comment below. */
// CONVERSION code starts here -- see comment below
int ascii_convert_house(struct char_data *ch, obj_vnum vnum); int ascii_convert_house(struct char_data *ch, obj_vnum vnum);
void hcontrol_convert_houses(struct char_data *ch); void hcontrol_convert_houses(struct char_data *ch);
struct obj_data *Obj_from_store(struct obj_file_elem object, int *location); struct obj_data *Obj_from_store(struct obj_file_elem object, int *location);
// CONVERSION code ends here -- see comment below /* CONVERSION code ends here -- see comment below. */
/* First, the basics: finding the filename; loading/saving objects */ /* First, the basics: finding the filename; loading/saving objects */
/* Return a filename given a house vnum */ /* Return a filename given a house vnum */
int House_get_filename(room_vnum vnum, char *filename, size_t maxlen) int House_get_filename(room_vnum vnum, char *filename, size_t maxlen)
{ {
@ -63,7 +60,6 @@ int House_get_filename(room_vnum vnum, char *filename, size_t maxlen)
return (1); return (1);
} }
/* Load all objects for a house */ /* Load all objects for a house */
int House_load(room_vnum vnum) int House_load(room_vnum vnum)
{ {
@ -98,9 +94,8 @@ int House_load(room_vnum vnum)
return (1); return (1);
} }
/* Save all objects for a house (recursive; initial call must be followed by a
/* Save all objects for a house (recursive; initial call must be followed * call to House_restore_weight) Assumes file is open already. */
by a call to House_restore_weight) Assumes file is open already. */
int House_save(struct obj_data *obj, FILE *fp) int House_save(struct obj_data *obj, FILE *fp)
{ {
struct obj_data *tmp; struct obj_data *tmp;
@ -119,7 +114,6 @@ int House_save(struct obj_data *obj, FILE *fp)
return (1); return (1);
} }
/* restore weight of containers after House_save has changed them for saving */ /* restore weight of containers after House_save has changed them for saving */
void House_restore_weight(struct obj_data *obj) void House_restore_weight(struct obj_data *obj)
{ {
@ -131,7 +125,6 @@ void House_restore_weight(struct obj_data *obj)
} }
} }
/* Save all objects in a house */ /* Save all objects in a house */
void House_crashsave(room_vnum vnum) void House_crashsave(room_vnum vnum)
{ {
@ -156,7 +149,6 @@ void House_crashsave(room_vnum vnum)
REMOVE_BIT(ROOM_FLAGS(rnum), ROOM_HOUSE_CRASH); REMOVE_BIT(ROOM_FLAGS(rnum), ROOM_HOUSE_CRASH);
} }
/* Delete a house save file */ /* Delete a house save file */
void House_delete_file(room_vnum vnum) void House_delete_file(room_vnum vnum)
{ {
@ -175,7 +167,6 @@ void House_delete_file(room_vnum vnum)
log("SYSERR: Error deleting house file #%d. (2): %s", vnum, strerror(errno)); log("SYSERR: Error deleting house file #%d. (2): %s", vnum, strerror(errno));
} }
/* List all objects in a house file */ /* List all objects in a house file */
void House_listrent(struct char_data *ch, room_vnum vnum) void House_listrent(struct char_data *ch, room_vnum vnum)
{ {
@ -214,13 +205,7 @@ void House_listrent(struct char_data *ch, room_vnum vnum)
fclose(fl); fclose(fl);
} }
/* Functions for house administration (creation, deletion, etc. */
/******************************************************************
* Functions for house administration (creation, deletion, etc. *
*****************************************************************/
int find_house(room_vnum vnum) int find_house(room_vnum vnum)
{ {
int i; int i;
@ -232,8 +217,6 @@ int find_house(room_vnum vnum)
return (NOWHERE); return (NOWHERE);
} }
/* Save the house control information */ /* Save the house control information */
void House_save_control(void) void House_save_control(void)
{ {
@ -249,9 +232,8 @@ void House_save_control(void)
fclose(fl); fclose(fl);
} }
/* Call from boot_db - will load control recs, load objs, set atrium bits.
/* call from boot_db - will load control recs, load objs, set atrium bits */ * Should do sanity checks on vnums & remove invalid records. */
/* should do sanity checks on vnums & remove invalid records */
void House_boot(void) void House_boot(void)
{ {
struct house_control_rec temp_house; struct house_control_rec temp_house;
@ -302,10 +284,7 @@ void House_boot(void)
House_save_control(); House_save_control();
} }
/* "House Control" functions */ /* "House Control" functions */
const char *HCONTROL_FORMAT = const char *HCONTROL_FORMAT =
"Usage: hcontrol build <house vnum> <exit direction> <player name>\r\n" "Usage: hcontrol build <house vnum> <exit direction> <player name>\r\n"
" hcontrol destroy <house vnum>\r\n" " hcontrol destroy <house vnum>\r\n"
@ -371,8 +350,6 @@ void hcontrol_list_houses(struct char_data *ch, char *arg)
} }
} }
void hcontrol_build_house(struct char_data *ch, char *arg) void hcontrol_build_house(struct char_data *ch, char *arg)
{ {
char arg1[MAX_INPUT_LENGTH]; char arg1[MAX_INPUT_LENGTH];
@ -456,8 +433,6 @@ void hcontrol_build_house(struct char_data *ch, char *arg)
House_save_control(); House_save_control();
} }
void hcontrol_destroy_house(struct char_data *ch, char *arg) void hcontrol_destroy_house(struct char_data *ch, char *arg)
{ {
int i, j; int i, j;
@ -491,17 +466,13 @@ void hcontrol_destroy_house(struct char_data *ch, char *arg)
send_to_char(ch, "House deleted.\r\n"); send_to_char(ch, "House deleted.\r\n");
House_save_control(); House_save_control();
/* /* Now, reset the ROOM_ATRIUM flag on all existing houses' atriums, just in
* Now, reset the ROOM_ATRIUM flag on all existing houses' atriums, * case the house we just deleted shared an atrium with another house. -JE */
* just in case the house we just deleted shared an atrium with another
* house. --JE 9/19/94
*/
for (i = 0; i < num_of_houses; i++) for (i = 0; i < num_of_houses; i++)
if ((real_atrium = real_room(house_control[i].atrium)) != NOWHERE) if ((real_atrium = real_room(house_control[i].atrium)) != NOWHERE)
SET_BIT(ROOM_FLAGS(real_atrium), ROOM_ATRIUM); SET_BIT(ROOM_FLAGS(real_atrium), ROOM_ATRIUM);
} }
void hcontrol_pay_house(struct char_data *ch, char *arg) void hcontrol_pay_house(struct char_data *ch, char *arg)
{ {
int i; int i;
@ -519,7 +490,6 @@ void hcontrol_pay_house(struct char_data *ch, char *arg)
} }
} }
/* The hcontrol command itself, used by imms to create/destroy houses */ /* The hcontrol command itself, used by imms to create/destroy houses */
ACMD(do_hcontrol) ACMD(do_hcontrol)
{ {
@ -535,16 +505,14 @@ ACMD(do_hcontrol)
hcontrol_pay_house(ch, arg2); hcontrol_pay_house(ch, arg2);
else if (is_abbrev(arg1, "show")) else if (is_abbrev(arg1, "show"))
hcontrol_list_houses(ch, arg2); hcontrol_list_houses(ch, arg2);
// CONVERSION code starts here -- see comment below /* CONVERSION code starts here -- see comment below not in hcontrol_format. */
// not in hcontrol_format
else if (!str_cmp(arg1, "asciiconvert")) else if (!str_cmp(arg1, "asciiconvert"))
hcontrol_convert_houses(ch); hcontrol_convert_houses(ch);
// CONVERSION ends here -- read more below /* CONVERSION ends here -- read more below. */
else else
send_to_char(ch, "%s", HCONTROL_FORMAT); send_to_char(ch, "%s", HCONTROL_FORMAT);
} }
/* The house command, used by mortal house owners to assign guests */ /* The house command, used by mortal house owners to assign guests */
ACMD(do_house) ACMD(do_house)
{ {
@ -586,11 +554,7 @@ ACMD(do_house)
} }
} }
/* Misc. administrative functions */ /* Misc. administrative functions */
/* crash-save all the houses */ /* crash-save all the houses */
void House_save_all(void) void House_save_all(void)
{ {
@ -603,7 +567,6 @@ void House_save_all(void)
House_crashsave(house_control[i].vnum); House_crashsave(house_control[i].vnum);
} }
/* note: arg passed must be house vnum, so there. */ /* note: arg passed must be house vnum, so there. */
int House_can_enter(struct char_data *ch, room_vnum house) int House_can_enter(struct char_data *ch, room_vnum house)
{ {
@ -652,7 +615,7 @@ void House_list_guests(struct char_data *ch, int i, int quiet)
send_to_char(ch, "\r\n"); send_to_char(ch, "\r\n");
} }
/* *********************************************************************** /*************************************************************************
* All code below this point and the code above, marked "CONVERSION" * * All code below this point and the code above, marked "CONVERSION" *
* can be removed after you have converted your house rent files using * * can be removed after you have converted your house rent files using *
* the command * * the command *
@ -660,14 +623,9 @@ void House_list_guests(struct char_data *ch, int i, int quiet)
* * * *
* You can only use this command as implementor. * * You can only use this command as implementor. *
* After you have converted your house files, I suggest a reboot, which * * After you have converted your house files, I suggest a reboot, which *
* will let your house files load on the next bootup. * * will let your house files load on the next bootup. -Welcor *
* *
* Welcor *
************************************************************************/ ************************************************************************/
/* /* Code for conversion to ascii house rent files. */
* Code for conversion to ascii house rent files
*/
void hcontrol_convert_houses(struct char_data *ch) void hcontrol_convert_houses(struct char_data *ch)
{ {
int i; int i;
@ -691,7 +649,7 @@ void hcontrol_convert_houses(struct char_data *ch)
if (!ascii_convert_house(ch, house_control[i].vnum)) if (!ascii_convert_house(ch, house_control[i].vnum))
{ {
// let ascii_convert_house() tell about the error /* Let ascii_convert_house() tell about the error. */
return; return;
} }
else else
@ -702,7 +660,6 @@ void hcontrol_convert_houses(struct char_data *ch)
send_to_char(ch, "All done.\r\n"); send_to_char(ch, "All done.\r\n");
} }
int ascii_convert_house(struct char_data *ch, obj_vnum vnum) int ascii_convert_house(struct char_data *ch, obj_vnum vnum)
{ {
FILE *in, *out; FILE *in, *out;
@ -761,17 +718,13 @@ int ascii_convert_house(struct char_data *ch, obj_vnum vnum)
fclose(in); fclose(in);
fclose(out); fclose(out);
// copy the new file over the old one
// remove(infile);
// rename(outfile, infile);
free(outfile); free(outfile);
send_to_char(ch, "...%d items", j); send_to_char(ch, "...%d items", j);
return 1; return 1;
} }
// the circle 3.1 function for reading rent files. No longer used by the rent system. /* The circle 3.1 function for reading rent files. No longer used by the rent system. */
struct obj_data *Obj_from_store(struct obj_file_elem object, int *location) struct obj_data *Obj_from_store(struct obj_file_elem object, int *location)
{ {
struct obj_data *obj; struct obj_data *obj;

View file

@ -1,12 +1,10 @@
/* /**************************************************************************
* File: improved-edit.c Part of tbaMUD *
improved-edit.c Routines specific to the improved editor. * Usage: Routines specific to the improved editor. *
**************************************************************************/
*/
#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 "db.h" #include "db.h"
@ -93,9 +91,7 @@ int improved_editor_execute(struct descriptor_data *d, char *str)
return STRINGADD_ACTION; return STRINGADD_ACTION;
} }
/* /* Handle some editor commands. */
* Handle some editor commands.
*/
void parse_edit_action(int command, char *string, struct descriptor_data *d) void parse_edit_action(int command, char *string, struct descriptor_data *d)
{ {
int indent = 0, rep_all = 0, flags = 0, replaced, i, line_low, line_high, j = 0; int indent = 0, rep_all = 0, flags = 0, replaced, i, line_low, line_high, j = 0;
@ -240,10 +236,8 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d)
} }
break; break;
case PARSE_LIST_NORM: case PARSE_LIST_NORM:
/* /* Note: Rv's buf, buf1, buf2, and arg variables are defined to 32k so they
* Note: Rv's buf, buf1, buf2, and arg variables are defined to 32k so * are ok for what we do here. */
* they are probly ok for what to do here.
*/
*buf = '\0'; *buf = '\0';
if (*string) if (*string)
switch (sscanf(string, " %d - %d ", &line_low, &line_high)) { switch (sscanf(string, " %d - %d ", &line_low, &line_high)) {
@ -295,17 +289,13 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d)
*s = temp; *s = temp;
} else } else
strcat(buf, t); strcat(buf, t);
/* /* This is kind of annoying...but some people like it. */
* This is kind of annoying...but some people like it.
*/
sprintf(buf + strlen(buf), "\r\n%d line%sshown.\r\n", total_len, (total_len != 1) ? "s " : " "); sprintf(buf + strlen(buf), "\r\n%d line%sshown.\r\n", total_len, (total_len != 1) ? "s " : " ");
page_string(d, buf, TRUE); page_string(d, buf, TRUE);
break; break;
case PARSE_LIST_NUM: case PARSE_LIST_NUM:
/* /* Note: Rv's buf, buf1, buf2, and arg variables are defined to 32k so they
* Note: Rv's buf, buf1, buf2, and arg variables are defined to 32k so * are probably ok for what we do here. */
* they are probly ok for what to do here.
*/
*buf = '\0'; *buf = '\0';
if (*string) if (*string)
switch (sscanf(string, " %d - %d ", &line_low, &line_high)) { switch (sscanf(string, " %d - %d ", &line_low, &line_high)) {
@ -430,63 +420,43 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d)
return; return;
} }
if (line_low > 0) { if (line_low > 0) {
/* /* Loop through the text counting \n characters until we get to the line. */
* Loop through the text counting \n characters until we get to the line.
*/
while (s && i < line_low) while (s && i < line_low)
if ((s = strchr(s, '\n')) != NULL) { if ((s = strchr(s, '\n')) != NULL) {
i++; i++;
s++; s++;
} }
/* /* Make sure that there was a THAT line in the text. */
* Make sure that there was a THAT line in the text.
*/
if (s == NULL || i < line_low) { if (s == NULL || i < line_low) {
write_to_output(d, "Line number out of range; change aborted.\r\n"); write_to_output(d, "Line number out of range; change aborted.\r\n");
return; return;
} }
/* /* If s is the same as *d->str that means I'm at the beginning of the
* If s is the same as *d->str that means I'm at the beginning of the * message text and I don't need to put that into the changed buffer. */
* message text and I don't need to put that into the changed buffer.
*/
if (s != *d->str) { if (s != *d->str) {
/* /* First things first .. we get this part into the buffer. */
* First things first .. we get this part into the buffer.
*/
temp = *s; temp = *s;
*s = '\0'; *s = '\0';
/* /* Put the first 'good' half of the text into storage. */
* Put the first 'good' half of the text into storage.
*/
strcat(buf, *d->str); strcat(buf, *d->str);
*s = temp; *s = temp;
} }
/* /* Put the new 'good' line into place. */
* Put the new 'good' line into place.
*/
strcat(buf, buf2); strcat(buf, buf2);
if ((s = strchr(s, '\n')) != NULL) { if ((s = strchr(s, '\n')) != NULL) {
/* /* This means that we are at the END of the line, we want out of there,
* This means that we are at the END of the line, we want out of * but we want s to point to the beginning of the line. AFTER the line
* there, but we want s to point to the beginning of the line * we want edited. */
* AFTER the line we want edited
*/
s++; s++;
/* /* Now put the last 'good' half of buffer into storage. */
* Now put the last 'good' half of buffer into storage.
*/
strcat(buf, s); strcat(buf, s);
} }
/* /* Check for buffer overflow. */
* Check for buffer overflow.
*/
if (strlen(buf) > d->max_str) { if (strlen(buf) > d->max_str) {
write_to_output(d, "Change causes new length to exceed buffer maximum size, aborted.\r\n"); write_to_output(d, "Change causes new length to exceed buffer maximum size, aborted.\r\n");
return; return;
} }
/* /* Change the size of the REAL buffer to fit the new text. */
* Change the size of the REAL buffer to fit the new text.
*/
RECREATE(*d->str, char, strlen(buf) + 3); RECREATE(*d->str, char, strlen(buf) + 3);
strcpy(*d->str, buf); strcpy(*d->str, buf);
write_to_output(d, "Line changed.\r\n"); write_to_output(d, "Line changed.\r\n");
@ -502,11 +472,8 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d)
} }
} }
/* Re-formats message type formatted char *. (for strings edited with d->str)
/* * (mostly olc and mail). */
* Re-formats message type formatted char *.
* (for strings edited with d->str) (mostly olc and mail)
*/
int format_text(char **ptr_string, int mode, struct descriptor_data *d, unsigned int maxlen, int low, int high) int format_text(char **ptr_string, int mode, struct descriptor_data *d, unsigned int maxlen, int low, int high)
{ {
int line_chars, cap_next = TRUE, cap_next_next = FALSE, color_chars = 0, i, pass_line = 0; int line_chars, cap_next = TRUE, cap_next_next = FALSE, color_chars = 0, i, pass_line = 0;
@ -520,7 +487,6 @@ int format_text(char **ptr_string, int mode, struct descriptor_data *d, unsigned
} }
/* XXX: Want to make sure the string doesn't grow either... */ /* XXX: Want to make sure the string doesn't grow either... */
if ((flow = *ptr_string) == NULL) if ((flow = *ptr_string) == NULL)
return 0; return 0;
@ -573,25 +539,18 @@ int format_text(char **ptr_string, int mode, struct descriptor_data *d, unsigned
cap_next = TRUE; cap_next = TRUE;
} }
/* /* This is so that if we stopped on a sentence, we move off the sentence
* This is so that if we stopped on a sentence .. we move off the * delimiter. */
* sentence delimiter.
*/
while (strchr(".!?", *flow)) { while (strchr(".!?", *flow)) {
cap_next_next = TRUE; cap_next_next = TRUE;
flow++; flow++;
} }
/* /* Special case: if we're at the end of the last line, and the last
* special case: if we're at the end of the last line, and the last
* character is a delimiter, the flow++ above will have *flow pointing * character is a delimiter, the flow++ above will have *flow pointing
* to the \r (or \n) character after the delimiter. Thus *flow will * to the \r (or \n) character after the delimiter. Thus *flow will be
* be non-null, and an extra (blank) line might be added erroneously. * non-null, and an extra (blank) line might be added erroneously. We
* We fix it by skipping the newline characters in between. * fix it by skipping the newline characters in between. - Welcor */
*
* Welcor 04/04
*/
if (strchr("\n\r", *flow)) { if (strchr("\n\r", *flow)) {
*flow = '\0'; /* terminate 'start' string */ *flow = '\0'; /* terminate 'start' string */
flow++; /* we know this is safe */ flow++; /* we know this is safe */

View file

@ -1,8 +1,12 @@
/* /**************************************************************************
* This is here to allow different code for the basic and improved editor. * File: improved-edit.h Part of tbaMUD *
* If do not wish to use the improved editor, put #if 0 below, otherwise * *
* you should leave the setting at #if 1. * Usage: The basic and improved editor. *
*/ **************************************************************************/
/* This is here to allow different code for the basic and improved editor. If
* you do not wish to use the improved editor, put #if 0 below, otherwise you
* should leave the setting at #if 1. */
#define CONFIG_IMPROVED_EDITOR 1 #define CONFIG_IMPROVED_EDITOR 1
#define using_improved_editor CONFIG_IMPROVED_EDITOR #define using_improved_editor CONFIG_IMPROVED_EDITOR
@ -13,9 +17,7 @@ int format_text(char **ptr_string, int mode, struct descriptor_data *d, unsigned
int replace_str(char **string, char *pattern, char *replacement, int rep_all, unsigned int max_size); int replace_str(char **string, char *pattern, char *replacement, int rep_all, unsigned int max_size);
void send_editor_help(struct descriptor_data *d); void send_editor_help(struct descriptor_data *d);
/* /* Action modes for parse_edit_action(). */
* Action modes for parse_edit_action().
*/
#define PARSE_FORMAT 0 #define PARSE_FORMAT 0
#define PARSE_REPLACE 1 #define PARSE_REPLACE 1
#define PARSE_HELP 2 #define PARSE_HELP 2
@ -25,9 +27,7 @@ void send_editor_help(struct descriptor_data *d);
#define PARSE_LIST_NUM 6 #define PARSE_LIST_NUM 6
#define PARSE_EDIT 7 #define PARSE_EDIT 7
/* /* Defines for the action variable. */
* Defines for the action variable.
*/
#define STRINGADD_OK 0 /* Just keep adding text. */ #define STRINGADD_OK 0 /* Just keep adding text. */
#define STRINGADD_SAVE 1 /* Save current text. */ #define STRINGADD_SAVE 1 /* Save current text. */
#define STRINGADD_ABORT 2 /* Abort edit, restore old text. */ #define STRINGADD_ABORT 2 /* Abort edit, restore old text. */

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: interpreter.c Part of CircleMUD * * File: interpreter.c Part of tbaMUD *
* Usage: parse user commands, search for specials, call ACMD functions * * Usage: Parse user commands, search for specials, call ACMD functions. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#define __INTERPRETER_C__ #define __INTERPRETER_C__
@ -48,7 +48,7 @@ void do_start(struct char_data *ch);
int parse_class(char arg); int parse_class(char arg);
int special(struct char_data *ch, int cmd, char *arg); int special(struct char_data *ch, int cmd, char *arg);
int isbanned(char *hostname); int isbanned(char *hostname);
int Valid_Name(char *newname); int valid_name(char *newname);
void read_aliases(struct char_data *ch); void read_aliases(struct char_data *ch);
void delete_aliases(const char *charname); void delete_aliases(const char *charname);
void remove_player(int pfilepos); void remove_player(int pfilepos);
@ -1341,7 +1341,7 @@ void nanny(struct descriptor_data *d, char *arg)
char buf[MAX_INPUT_LENGTH], tmp_name[MAX_INPUT_LENGTH]; char buf[MAX_INPUT_LENGTH], tmp_name[MAX_INPUT_LENGTH];
if ((_parse_name(arg, tmp_name)) || strlen(tmp_name) < 2 || if ((_parse_name(arg, tmp_name)) || strlen(tmp_name) < 2 ||
strlen(tmp_name) > MAX_NAME_LENGTH || !Valid_Name(tmp_name) || strlen(tmp_name) > MAX_NAME_LENGTH || !valid_name(tmp_name) ||
fill_word(strcpy(buf, tmp_name)) || reserved_word(buf)) { /* strcpy: OK (mutual MAX_INPUT_LENGTH) */ fill_word(strcpy(buf, tmp_name)) || reserved_word(buf)) { /* strcpy: OK (mutual MAX_INPUT_LENGTH) */
write_to_output(d, "Invalid name, please try another.\r\nName: "); write_to_output(d, "Invalid name, please try another.\r\nName: ");
return; return;
@ -1360,7 +1360,7 @@ void nanny(struct descriptor_data *d, char *arg)
/* We get a false positive from the original deleted character. */ /* We get a false positive from the original deleted character. */
free_char(d->character); free_char(d->character);
/* Check for multiple creations... */ /* Check for multiple creations... */
if (!Valid_Name(tmp_name)) { if (!valid_name(tmp_name)) {
write_to_output(d, "Invalid name, please try another.\r\nName: "); write_to_output(d, "Invalid name, please try another.\r\nName: ");
return; return;
} }
@ -1390,7 +1390,7 @@ void nanny(struct descriptor_data *d, char *arg)
/* player unknown -- make new character */ /* player unknown -- make new character */
/* Check for multiple creations of a character. */ /* Check for multiple creations of a character. */
if (!Valid_Name(tmp_name)) { if (!valid_name(tmp_name)) {
write_to_output(d, "Invalid name, please try another.\r\nName: "); write_to_output(d, "Invalid name, please try another.\r\nName: ");
return; return;
} }

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: interpreter.h Part of CircleMUD * * File: interpreter.h Part of tbaMUD *
* Usage: header file: public procs, macro defs, subcommand defines * * Usage: header file: public procs, macro defs, subcommand defines *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#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

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: limits.c Part of CircleMUD * * File: limits.c Part of tbaMUD *
* Usage: limits & gain funcs for HMV, exp, hunger/thirst, idle time * * Usage: Limits & gain funcs for HMV, exp, hunger/thirst, idle time. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
@ -113,9 +113,7 @@ int hit_gain(struct char_data *ch)
gain = graf(age(ch)->year, 8, 12, 20, 32, 16, 10, 4); gain = graf(age(ch)->year, 8, 12, 20, 32, 16, 10, 4);
/* Class/Level calculations */ /* Class/Level calculations */
/* Skill/Spell calculations */ /* Skill/Spell calculations */
/* Position calculations */ /* Position calculations */
switch (GET_POS(ch)) { switch (GET_POS(ch)) {

View file

@ -1,17 +1,15 @@
/* ************************************************************************ /**************************************************************************
* File: magic.c Part of CircleMUD * * File: magic.c Part of tbaMUD *
* Usage: low-level functions for magic; spell template code * * Usage: Low-level functions for magic; spell template code. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#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"
@ -36,18 +34,10 @@ void perform_mag_groups(int level, struct char_data *ch, struct char_data *tch,
int mag_savingthrow(struct char_data *ch, int type, int modifier); int mag_savingthrow(struct char_data *ch, int type, int modifier);
void affect_update(void); void affect_update(void);
/* /* Negative apply_saving_throw[] values make saving throws better! So do
* Saving throws are now in class.c as of bpl13. * negative modifiers. Though people may be used to the reverse of that.
*/ * It's due to the code modifying the target saving throw instead of the
* random number of the character as in some other systems. */
/*
* Negative apply_saving_throw[] values make saving throws better!
* Then, so do negative modifiers. Though people may be used to
* the reverse of that. It's due to the code modifying the target
* saving throw instead of the random number of the character as
* in some other systems.
*/
int mag_savingthrow(struct char_data *ch, int type, int modifier) int mag_savingthrow(struct char_data *ch, int type, int modifier)
{ {
/* NPCs use warrior tables according to some book */ /* NPCs use warrior tables according to some book */
@ -69,7 +59,6 @@ int mag_savingthrow(struct char_data *ch, int type, int modifier)
return (FALSE); return (FALSE);
} }
/* affect_update: called from comm.c (causes spells to wear off) */ /* affect_update: called from comm.c (causes spells to wear off) */
void affect_update(void) void affect_update(void)
{ {
@ -94,15 +83,10 @@ void affect_update(void)
} }
} }
/* mag_materials: Checks for up to 3 vnums (spell reagents) in the player's
/* * inventory. No spells currently use mag_materials, but you can use it to
* mag_materials: * implement your own spells which require ingredients (i.e. heal spells which
* Checks for up to 3 vnums (spell reagents) in the player's inventory. * requires a rare herb or some such.) */
*
* No spells implemented in Circle use mag_materials, but you can use
* it to implement your own spells which require ingredients (i.e., some
* heal spell which requires a rare herb or some such.)
*/
int mag_materials(struct char_data *ch, int item0, int item1, int item2, int mag_materials(struct char_data *ch, int item0, int item1, int item2,
int extract, int verbose) int extract, int verbose)
{ {
@ -153,15 +137,9 @@ int mag_materials(struct char_data *ch, int item0, int item1, int item2,
} }
/* Every spell that does damage comes through here. This calculates the amount
* of damage, adds in any modifiers, determines what the saves are, tests for
/* * save and calls damage(). -1 = dead, otherwise the amount of damage done. */
* Every spell that does damage comes through here. This calculates the
* amount of damage, adds in any modifiers, determines what the saves are,
* tests for save and calls damage().
*
* -1 = dead, otherwise the amount of damage done.
*/
int mag_damage(int level, struct char_data *ch, struct char_data *victim, int mag_damage(int level, struct char_data *ch, struct char_data *victim,
int spellnum, int savetype) int spellnum, int savetype)
{ {
@ -265,14 +243,9 @@ int mag_damage(int level, struct char_data *ch, struct char_data *victim,
} }
/* /* Every spell that does an affect comes through here. This determines the
* Every spell that does an affect comes through here. This determines * effect, whether it is added or replacement, whether it is legal or not, etc.
* the effect, whether it is added or replacement, whether it is legal or * affect_join(vict, aff, add_dur, avg_dur, add_mod, avg_mod) */
* not, etc.
*
* affect_join(vict, aff, add_dur, avg_dur, add_mod, avg_mod)
*/
#define MAX_SPELL_AFFECTS 5 /* change if more needed */ #define MAX_SPELL_AFFECTS 5 /* change if more needed */
void mag_affects(int level, struct char_data *ch, struct char_data *victim, void mag_affects(int level, struct char_data *ch, struct char_data *victim,
@ -487,11 +460,9 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
break; break;
} }
/* /* If this is a mob that has this affect set in its mob file, do not perform
* If this is a mob that has this affect set in its mob file, do not * the affect. This prevents people from un-sancting mobs by sancting them
* perform the affect. This prevents people from un-sancting mobs * and waiting for it to fade, for example. */
* by sancting them and waiting for it to fade, for example.
*/
if (IS_NPC(victim) && !affected_by_spell(victim, spellnum)) if (IS_NPC(victim) && !affected_by_spell(victim, spellnum))
for (i = 0; i < MAX_SPELL_AFFECTS; i++) for (i = 0; i < MAX_SPELL_AFFECTS; i++)
if (AFF_FLAGGED(victim, af[i].bitvector)) { if (AFF_FLAGGED(victim, af[i].bitvector)) {
@ -499,10 +470,8 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
return; return;
} }
/* /* If the victim is already affected by this spell, and the spell does not
* If the victim is already affected by this spell, and the spell does * have an accumulative effect, then fail the spell. */
* not have an accumulative effect, then fail the spell.
*/
if (affected_by_spell(victim,spellnum) && !(accum_duration||accum_affect)) { if (affected_by_spell(victim,spellnum) && !(accum_duration||accum_affect)) {
send_to_char(ch, "%s", CONFIG_NOEFFECT); send_to_char(ch, "%s", CONFIG_NOEFFECT);
return; return;
@ -518,11 +487,8 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
act(to_room, TRUE, victim, 0, ch, TO_ROOM); act(to_room, TRUE, victim, 0, ch, TO_ROOM);
} }
/* This function is used to provide services to mag_groups. This function is
/* * the one you should change to add new group spells. */
* This function is used to provide services to mag_groups. This function
* is the one you should change to add new group spells.
*/
void perform_mag_groups(int level, struct char_data *ch, void perform_mag_groups(int level, struct char_data *ch,
struct char_data *tch, int spellnum, int savetype) struct char_data *tch, int spellnum, int savetype)
{ {
@ -539,18 +505,11 @@ void perform_mag_groups(int level, struct char_data *ch,
} }
} }
/* Every spell that affects the group should run through here perform_mag_groups
/* * contains the switch statement to send us to the right magic. Group spells
* Every spell that affects the group should run through here * affect everyone grouped with the caster who is in the room, caster last. To
* perform_mag_groups contains the switch statement to send us to the right * add new group spells, you shouldn't have to change anything in mag_groups.
* magic. * Just add a new case to perform_mag_groups. */
*
* group spells affect everyone grouped with the caster who is in the room,
* caster last.
*
* To add new group spells, you shouldn't have to change anything in
* mag_groups -- just add a new case to perform_mag_groups.
*/
void mag_groups(int level, struct char_data *ch, int spellnum, int savetype) void mag_groups(int level, struct char_data *ch, int spellnum, int savetype)
{ {
struct char_data *tch, *k; struct char_data *tch, *k;
@ -582,12 +541,8 @@ void mag_groups(int level, struct char_data *ch, int spellnum, int savetype)
perform_mag_groups(level, ch, ch, spellnum, savetype); perform_mag_groups(level, ch, ch, spellnum, savetype);
} }
/* Mass spells affect every creature in the room except the caster. No spells
/* * of this class currently implemented. */
* mass spells affect every creature in the room except the caster.
*
* No spells of this class currently implemented.
*/
void mag_masses(int level, struct char_data *ch, int spellnum, int savetype) void mag_masses(int level, struct char_data *ch, int spellnum, int savetype)
{ {
struct char_data *tch, *tch_next; struct char_data *tch, *tch_next;
@ -602,15 +557,10 @@ void mag_masses(int level, struct char_data *ch, int spellnum, int savetype)
} }
} }
/* Every spell that affects an area (room) runs through here. These are
/* * generally offensive spells. This calls mag_damage to do the actual damage.
* Every spell that affects an area (room) runs through here. These are * All spells listed here must also have a case in mag_damage() in order for
* generally offensive spells. This calls mag_damage to do the actual * them to work. Area spells have limited targets within the room. */
* damage -- all spells listed here must also have a case in mag_damage()
* in order for them to work.
*
* area spells have limited targets within the room.
*/
void mag_areas(int level, struct char_data *ch, int spellnum, int savetype) void mag_areas(int level, struct char_data *ch, int spellnum, int savetype)
{ {
struct char_data *tch, *next_tch; struct char_data *tch, *next_tch;
@ -619,10 +569,8 @@ void mag_areas(int level, struct char_data *ch, int spellnum, int savetype)
if (ch == NULL) if (ch == NULL)
return; return;
/* /* to add spells just add the message here plus an entry in mag_damage for
* to add spells to this fn, just add the message here plus an entry * the damaging part of the spell. */
* in mag_damage for the damaging part of the spell.
*/
switch (spellnum) { switch (spellnum) {
case SPELL_EARTHQUAKE: case SPELL_EARTHQUAKE:
to_char = "You gesture and the earth begins to shake all around you!"; to_char = "You gesture and the earth begins to shake all around you!";
@ -639,13 +587,10 @@ void mag_areas(int level, struct char_data *ch, int spellnum, int savetype)
for (tch = world[IN_ROOM(ch)].people; tch; tch = next_tch) { for (tch = world[IN_ROOM(ch)].people; tch; tch = next_tch) {
next_tch = tch->next_in_room; next_tch = tch->next_in_room;
/* /* The skips: 1: the caster
* The skips: 1: the caster
* 2: immortals * 2: immortals
* 3: if no pk on this mud, skips over all players * 3: if no pk on this mud, skips over all players
* 4: pets (charmed NPCs) * 4: pets (charmed NPCs) */
*/
if (tch == ch) if (tch == ch)
continue; continue;
if (!IS_NPC(tch) && GET_LEVEL(tch) >= LVL_IMMORT) if (!IS_NPC(tch) && GET_LEVEL(tch) >= LVL_IMMORT)
@ -660,20 +605,8 @@ void mag_areas(int level, struct char_data *ch, int spellnum, int savetype)
} }
} }
/* Every spell which summons/gates/conjours a mob comes through here. */
/* /* These use act(), don't put the \r\n. */
* Every spell which summons/gates/conjours a mob comes through here.
*
* None of these spells are currently implemented in CircleMUD; these
* were taken as examples from the JediMUD code. Summons can be used
* for spells like clone, ariel servant, etc.
*
* 10/15/97 (gg) - Implemented Animate Dead and Clone.
*/
/*
* These use act(), don't put the \r\n.
*/
const char *mag_summon_msgs[] = { const char *mag_summon_msgs[] = {
"\r\n", "\r\n",
"$n makes a strange magical gesture; you feel a strong breeze!", "$n makes a strange magical gesture; you feel a strong breeze!",
@ -690,9 +623,7 @@ const char *mag_summon_msgs[] = {
"$n animates a corpse!" "$n animates a corpse!"
}; };
/* /* Keep the \r\n because these use send_to_char. */
* Keep the \r\n because these use send_to_char.
*/
const char *mag_summon_fail_msgs[] = { const char *mag_summon_fail_msgs[] = {
"\r\n", "\r\n",
"There are no such creatures.\r\n", "There are no such creatures.\r\n",
@ -704,21 +635,12 @@ const char *mag_summon_fail_msgs[] = {
"There is no corpse!\r\n" "There is no corpse!\r\n"
}; };
/* These mobiles do not exist. */
#define MOB_MONSUM_I 130
#define MOB_MONSUM_II 140
#define MOB_MONSUM_III 150
#define MOB_GATE_I 160
#define MOB_GATE_II 170
#define MOB_GATE_III 180
/* Defined mobiles. */ /* Defined mobiles. */
#define MOB_ELEMENTAL_BASE 20 /* Only one for now. */ #define MOB_ELEMENTAL_BASE 20
#define MOB_CLONE 10 #define MOB_CLONE 10
#define MOB_ZOMBIE 11 #define MOB_ZOMBIE 11
#define MOB_AERIALSERVANT 19 #define MOB_AERIALSERVANT 19
void mag_summons(int level, struct char_data *ch, struct obj_data *obj, void mag_summons(int level, struct char_data *ch, struct obj_data *obj,
int spellnum, int savetype) int spellnum, int savetype)
{ {
@ -790,7 +712,6 @@ void mag_summons(int level, struct char_data *ch, struct obj_data *obj,
} }
} }
void mag_points(int level, struct char_data *ch, struct char_data *victim, void mag_points(int level, struct char_data *ch, struct char_data *victim,
int spellnum, int savetype) int spellnum, int savetype)
{ {
@ -818,7 +739,6 @@ void mag_points(int level, struct char_data *ch, struct char_data *victim,
update_pos(victim); update_pos(victim);
} }
void mag_unaffects(int level, struct char_data *ch, struct char_data *victim, void mag_unaffects(int level, struct char_data *ch, struct char_data *victim,
int spellnum, int type) int spellnum, int type)
{ {
@ -830,10 +750,8 @@ void mag_unaffects(int level, struct char_data *ch, struct char_data *victim,
switch (spellnum) { switch (spellnum) {
case SPELL_HEAL: case SPELL_HEAL:
/* /* Heal also restores health, so don't give the "no effect" message if the
* Heal also restores health, so don't give the "no effect" message * target isn't afflicted by the 'blindness' spell. */
* if the target isn't afflicted by the 'blindness' spell.
*/
msg_not_affected = FALSE; msg_not_affected = FALSE;
/* fall-through */ /* fall-through */
case SPELL_CURE_BLIND: case SPELL_CURE_BLIND:
@ -866,10 +784,8 @@ void mag_unaffects(int level, struct char_data *ch, struct char_data *victim,
act(to_vict, FALSE, victim, 0, ch, TO_CHAR); act(to_vict, FALSE, victim, 0, ch, TO_CHAR);
if (to_room != NULL) if (to_room != NULL)
act(to_room, TRUE, victim, 0, ch, TO_ROOM); act(to_room, TRUE, victim, 0, ch, TO_ROOM);
} }
void mag_alter_objs(int level, struct char_data *ch, struct obj_data *obj, void mag_alter_objs(int level, struct char_data *ch, struct obj_data *obj,
int spellnum, int savetype) int spellnum, int savetype)
{ {
@ -935,11 +851,8 @@ void mag_alter_objs(int level, struct char_data *ch, struct obj_data *obj,
act(to_room, TRUE, ch, obj, 0, TO_ROOM); act(to_room, TRUE, ch, obj, 0, TO_ROOM);
else if (to_char != NULL) else if (to_char != NULL)
act(to_char, TRUE, ch, obj, 0, TO_ROOM); act(to_char, TRUE, ch, obj, 0, TO_ROOM);
} }
void mag_creations(int level, struct char_data *ch, int spellnum) void mag_creations(int level, struct char_data *ch, int spellnum)
{ {
struct obj_data *tobj; struct obj_data *tobj;

View file

@ -1,24 +1,16 @@
/* ************************************************************************ /**************************************************************************
* File: mail.c Part of CircleMUD * * File: mail.c Part of tbaMUD *
* Usage: Internal funcs and player spec-procs of mud-mail system * * Usage: Internal funcs and player spec-procs of mudmail system. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ * By Jeremy Elson. Rewritten by Welcor. *
**************************************************************************/
/******* MUD MAIL SYSTEM MAIN FILE ***************************************
Written by Jeremy Elson (jelson@circlemud.org)
*************************************************************************/
/* And completely rewritten by Welcor 16th of december, 2005 */
#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"
@ -27,7 +19,6 @@ Written by Jeremy Elson (jelson@circlemud.org)
#include "handler.h" #include "handler.h"
#include "mail.h" #include "mail.h"
/* external variables */ /* external variables */
extern int no_mail; extern int no_mail;
extern struct player_index_element *player_table; extern struct player_index_element *player_table;
@ -42,7 +33,6 @@ void postmaster_receive_mail(struct char_data *ch, struct char_data *mailman, in
int mail_recip_ok(const char *name); int mail_recip_ok(const char *name);
void write_mail_record(FILE *mail_file, struct mail_t *record); void write_mail_record(FILE *mail_file, struct mail_t *record);
/* -------------------------------------------------------------------------- */
char *decrypt_hex(char *string, size_t len) char *decrypt_hex(char *string, size_t len)
{ {
static char output[MAX_STRING_LENGTH]; static char output[MAX_STRING_LENGTH];
@ -82,8 +72,6 @@ char *encrypt_hex(char *string, size_t len)
return output; return output;
} }
int mail_recip_ok(const char *name) int mail_recip_ok(const char *name)
{ {
int player_i, ret = FALSE; int player_i, ret = FALSE;
@ -95,7 +83,6 @@ int mail_recip_ok(const char *name)
return ret; return ret;
} }
void free_mail_record(struct mail_t *record) void free_mail_record(struct mail_t *record)
{ {
if (record->body) if (record->body)
@ -139,13 +126,11 @@ void write_mail_record(FILE *mail_file, struct mail_t *record)
record->body ); record->body );
} }
/* /* int scan_file(none)
* int scan_file(none)
* Returns false if mail file is corrupted or true if everything correct. * Returns false if mail file is corrupted or true if everything correct.
* *
* This is called once during boot-up. It scans through the mail file * This is called once during boot-up. It scans through the mail file
* and indexes all entries currently in the mail file. * and indexes all entries currently in the mail file. */
*/
int scan_file(void) int scan_file(void)
{ {
FILE *mail_file; FILE *mail_file;
@ -171,13 +156,11 @@ int scan_file(void)
return TRUE; return TRUE;
} }
/* /* int has_mail(long #1)
* int has_mail(long #1)
* #1 - id number of the person to check for mail. * #1 - id number of the person to check for mail.
* Returns true or false. * Returns true or false.
* *
* A simple little function which tells you if the guy has mail or not. * A simple little function which tells you if the player has mail or not. */
*/
int has_mail(long recipient) int has_mail(long recipient)
{ {
FILE *mail_file; FILE *mail_file;
@ -203,17 +186,14 @@ int has_mail(long recipient)
return FALSE; return FALSE;
} }
/* void store_mail(long #1, long #2, char * #3)
/*
* void store_mail(long #1, long #2, char * #3)
* #1 - id number of the person to mail to. * #1 - id number of the person to mail to.
* #2 - id number of the person the mail is from. * #2 - id number of the person the mail is from.
* #3 - The actual message to send. * #3 - The actual message to send.
* *
* call store_mail to store mail. (hard, huh? :-) ) Pass 3 arguments: * call store_mail to store mail. (hard, huh? :-) ) Pass 3 arguments:
* who the mail is to (long), who it's from (long), and a pointer to the * who the mail is to (long), who it's from (long), and a pointer to the
* actual message text (char *). * actual message text (char *). */
*/
void store_mail(long to, long from, char *message_pointer) void store_mail(long to, long from, char *message_pointer)
{ {
FILE *mail_file; FILE *mail_file;
@ -235,17 +215,12 @@ void store_mail(long to, long from, char *message_pointer)
fclose(mail_file); fclose(mail_file);
} }
/* char *read_delete(long #1)
/*
* char *read_delete(long #1)
* #1 - The id number of the person we're checking mail for. * #1 - The id number of the person we're checking mail for.
* Returns the message text of the mail received. * Returns the message text of the mail received.
* *
* Retrieves one messsage for a player. The mail is then discarded from * Retrieves one messsage for a player. The mail is then discarded from
* the file. * the file. Expects mail to exist. */
*
* Expects mail to exist.
*/
char *read_delete(long recipient) char *read_delete(long recipient)
{ {
FILE *mail_file, *new_file; FILE *mail_file, *new_file;
@ -311,12 +286,7 @@ char *read_delete(long recipient)
return strdup(buf); return strdup(buf);
} }
/* spec_proc for a postmaster using the above routines. By Jeremy Elson */
/****************************************************************
* Below is the spec_proc for a postmaster using the above *
* routines. Written by Jeremy Elson (jelson@circlemud.org) *
****************************************************************/
SPECIAL(postmaster) SPECIAL(postmaster)
{ {
if (!ch->desc || IS_NPC(ch)) if (!ch->desc || IS_NPC(ch))
@ -343,7 +313,6 @@ SPECIAL(postmaster)
return (0); return (0);
} }
void postmaster_send_mail(struct char_data *ch, struct char_data *mailman, void postmaster_send_mail(struct char_data *ch, struct char_data *mailman,
int cmd, char *arg) int cmd, char *arg)
{ {
@ -391,7 +360,6 @@ void postmaster_send_mail(struct char_data *ch, struct char_data *mailman,
string_write(ch->desc, mailwrite, MAX_MAIL_SIZE, recipient, NULL); string_write(ch->desc, mailwrite, MAX_MAIL_SIZE, recipient, NULL);
} }
void postmaster_check_mail(struct char_data *ch, struct char_data *mailman, void postmaster_check_mail(struct char_data *ch, struct char_data *mailman,
int cmd, char *arg) int cmd, char *arg)
{ {
@ -401,7 +369,6 @@ void postmaster_check_mail(struct char_data *ch, struct char_data *mailman,
act("$n tells you, 'Sorry, you don't have any mail waiting.'", FALSE, mailman, 0, ch, TO_VICT); act("$n tells you, 'Sorry, you don't have any mail waiting.'", FALSE, mailman, 0, ch, TO_VICT);
} }
void postmaster_receive_mail(struct char_data *ch, struct char_data *mailman, void postmaster_receive_mail(struct char_data *ch, struct char_data *mailman,
int cmd, char *arg) int cmd, char *arg)
{ {

View file

@ -1,18 +1,13 @@
/* ************************************************************************ /**************************************************************************
* File: mail.h Part of CircleMUD * * File: mail.h Part of tbaMUD *
* Usage: header file for mail system * * Usage: header file for mudmail system *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ * By Jeremy Elson. *
**************************************************************************/
/******* MUD MAIL SYSTEM HEADER FILE **********************
*** written by Jeremy Elson (jelson@circlemud.org) ***
*********************************************************/
/* INSTALLATION INSTRUCTIONS in MAIL.C */
/* You can modify the following constants to fit your own MUD. */ /* You can modify the following constants to fit your own MUD. */
@ -28,22 +23,13 @@
/* size of mail file allocation blocks */ /* size of mail file allocation blocks */
#define BLOCK_SIZE 100 #define BLOCK_SIZE 100
/* /* NOTE: Make sure that your block size is big enough. If not, HEADER_BLOCK_
* NOTE: Make sure that your block size is big enough -- if not, * DATASIZE will end up negative. This is a bad thing. Check the define below
* HEADER_BLOCK_DATASIZE will end up negative. This is a bad thing. * to make sure it is >0 when choosing values for NAME_SIZE and BLOCK_SIZE.
* Check the define below to make sure it is >0 when choosing values * 100 is a nice round number for BLOCK_SIZE and is the default. The mail system
* for NAME_SIZE and BLOCK_SIZE. 100 is a nice round number for * will always allocate disk space in chunks of size BLOCK_SIZE. */
* BLOCK_SIZE and is the default ... why bother trying to change it
* anyway?
*
* The mail system will always allocate disk space in chunks of size
* BLOCK_SIZE.
*/
/* USER CHANGABLE DEFINES ABOVE **
***************************************************************************
** DON'T TOUCH DEFINES BELOW */
/* DON'T TOUCH DEFINES BELOW. */
int scan_file(void); int scan_file(void);
int has_mail(long recipient); int has_mail(long recipient);
void store_mail(long to, long from, char *message_pointer); void store_mail(long to, long from, char *message_pointer);
@ -57,21 +43,14 @@ struct mail_t {
char *body; char *body;
}; };
/* old stuff below */ /* old stuff below */
#define HEADER_BLOCK (-1) #define HEADER_BLOCK (-1)
#define LAST_BLOCK (-2) #define LAST_BLOCK (-2)
#define DELETED_BLOCK (-3) #define DELETED_BLOCK (-3)
/* /* Note: next_block is part of header_blk in a data block; we can't combine them
* note: next_block is part of header_blk in a data block; we can't combine * here because we have to be able to differentiate a data block from a header
* them here because we have to be able to differentiate a data block from a * block when booting mail system. */
* header block when booting mail system.
*/
struct header_data_type { struct header_data_type {
long next_block; /* if header block, link to next block */ long next_block; /* if header block, link to next block */
long from; /* idnum of the mail's sender */ long from; /* idnum of the mail's sender */

View file

@ -1,8 +1,9 @@
/************************************************************************ /**************************************************************************
* OasisOLC - Mobiles / medit.c v2.0 * * File: medit.c Part of tbaMUD *
* Copyright 1996 Harvey Gilpin * * Usage: Oasis OLC - Mobiles. *
* Copyright 1997-2001 George Greer (greerga@circlemud.org) * * *
************************************************************************/ * Copyright 1996 Harvey Gilpin. 1997-2001 George Greer. *
**************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"

View file

@ -1,17 +1,15 @@
/* ************************************************************************ /**************************************************************************
* File: mobact.c Part of CircleMUD * * File: mobact.c Part of tbaMUD *
* Usage: Functions for generating intelligent (?) behavior in mobiles * * Usage: Functions for generating intelligent (?) behavior in mobiles. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#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 "db.h" #include "db.h"
@ -21,7 +19,6 @@
#include "spells.h" #include "spells.h"
#include "constants.h" #include "constants.h"
/* external globals */ /* external globals */
extern int no_specials; extern int no_specials;
@ -143,15 +140,10 @@ void mobile_activity(void)
} }
} }
/* /* Charmed Mob Rebellion: In order to rebel, there need to be more charmed
* Charmed Mob Rebellion * monsters than the person can feasibly control at a time. Then the
*
* In order to rebel, there need to be more charmed monsters
* than the person can feasibly control at a time. Then the
* mobiles have a chance based on the charisma of their leader. * mobiles have a chance based on the charisma of their leader.
* * 1-4 = 0, 5-7 = 1, 8-10 = 2, 11-13 = 3, 14-16 = 4, 17-19 = 5, etc. */
* 1-4 = 0, 5-7 = 1, 8-10 = 2, 11-13 = 3, 14-16 = 4, 17-19 = 5, etc.
*/
if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && num_followers_charmed(ch->master) > (GET_CHA(ch->master) - 2) / 3) { if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && num_followers_charmed(ch->master) > (GET_CHA(ch->master) - 2) / 3) {
if (!aggressive_mob_on_a_leash(ch, ch->master, ch->master)) { if (!aggressive_mob_on_a_leash(ch, ch->master, ch->master)) {
if (CAN_SEE(ch, ch->master) && !PRF_FLAGGED(ch->master, PRF_NOHASSLE)) if (CAN_SEE(ch, ch->master) && !PRF_FLAGGED(ch->master, PRF_NOHASSLE))
@ -180,10 +172,7 @@ void mobile_activity(void)
} /* end for() */ } /* end for() */
} }
/* Mob Memory Routines */ /* Mob Memory Routines */
/* make ch remember victim */ /* make ch remember victim */
void remember(struct char_data *ch, struct char_data *victim) void remember(struct char_data *ch, struct char_data *victim)
{ {
@ -205,7 +194,6 @@ void remember(struct char_data *ch, struct char_data *victim)
} }
} }
/* make ch forget victim */ /* make ch forget victim */
void forget(struct char_data *ch, struct char_data *victim) void forget(struct char_data *ch, struct char_data *victim)
{ {
@ -230,7 +218,6 @@ void forget(struct char_data *ch, struct char_data *victim)
free(curr); free(curr);
} }
/* erase ch's memory */ /* erase ch's memory */
void clearMemory(struct char_data *ch) void clearMemory(struct char_data *ch)
{ {
@ -247,13 +234,9 @@ void clearMemory(struct char_data *ch)
MEMORY(ch) = NULL; MEMORY(ch) = NULL;
} }
/* An aggressive mobile wants to attack something. If they're under the
/* * influence of mind altering PC, then see if their master can talk them out
* An aggressive mobile wants to attack something. If * of it, eye them down, or otherwise intimidate the slave. */
* they're under the influence of mind altering PC, then
* see if their master can talk them out of it, eye them
* down, or otherwise intimidate the slave.
*/
bool aggressive_mob_on_a_leash(struct char_data *slave, struct char_data *master, struct char_data *attack) bool aggressive_mob_on_a_leash(struct char_data *slave, struct char_data *master, struct char_data *attack)
{ {
static int snarl_cmd; static int snarl_cmd;

View file

@ -1,17 +1,15 @@
/* ************************************************************************ /**************************************************************************
* File: modify.c Part of CircleMUD * * File: modify.c Part of tbaMUD *
* Usage: Run-time modification of game variables * * Usage: Run-time modification of game variables. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#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 "interpreter.h" #include "interpreter.h"
@ -50,7 +48,6 @@ const char *string_fields[] =
"\n" "\n"
}; };
/* maximum length for text field x+1 */ /* maximum length for text field x+1 */
int length[] = int length[] =
{ {
@ -61,39 +58,25 @@ int length[] =
60 60
}; };
/* modification of malloc'ed strings */
/* ************************************************************************ /* Put '#if 1' here to erase ~, or roll your own method. A common idea is
* modification of malloc'ed strings * * smash/show tilde to convert the tilde to another innocuous character to
************************************************************************ */ * save and then back to display it. Whatever you do, at least keep the
* function around because other MUD packages use it, like mudFTP. -gg */
/*
* Put '#if 1' here to erase ~, or roll your own method. A common idea
* is smash/show tilde to convert the tilde to another innocuous character
* to save and then back to display it. Whatever you do, at least keep the
* function around because other MUD packages use it, like mudFTP.
* -gg 9/9/98
*/
void smash_tilde(char *str) void smash_tilde(char *str)
{ {
/* /* Erase any _line ending_ tildes inserted in the editor. The load mechanism
* Erase any _line ending_ tildes inserted in the editor. * can't handle those, yet. - Welcor */
* The load mechanism can't handle those, yet.
* -- Welcor 04/2003
*/
char *p = str; char *p = str;
for (; *p; p++) for (; *p; p++)
if (*p == '~' && (*(p+1)=='\r' || *(p+1)=='\n' || *(p+1)=='\0')) if (*p == '~' && (*(p+1)=='\r' || *(p+1)=='\n' || *(p+1)=='\0'))
*p=' '; *p=' ';
} }
/* /* Basic API function to start writing somewhere. 'data' isn't used, but you
* Basic API function to start writing somewhere. * can use it to pass whatever else you may want through it. The improved
* * editor patch when updated could use it to pass the old text buffer, for
* 'data' isn't used in stock CircleMUD but you can use it to pass whatever * instance. */
* else you may want through it. The improved editor patch when updated
* could use it to pass the old text buffer, for instance.
*/
void string_write(struct descriptor_data *d, char **writeto, size_t len, long mailto, void *data) void string_write(struct descriptor_data *d, char **writeto, size_t len, long mailto, void *data)
{ {
if (d->character && !IS_NPC(d->character)) if (d->character && !IS_NPC(d->character))
@ -109,23 +92,20 @@ void string_write(struct descriptor_data *d, char **writeto, size_t len, long ma
d->mail_to = mailto; d->mail_to = mailto;
} }
/* /* Add user input to the 'current' string (as defined by d->str). This is still
* Add user input to the 'current' string (as defined by d->str). * overly complex. */
* This is still overly complex.
*/
void string_add(struct descriptor_data *d, char *str) void string_add(struct descriptor_data *d, char *str)
{ {
int action; int action;
/* determine if this is the terminal string, and truncate if so */ /* Determine if this is the terminal string, and truncate if so. Changed to
/* changed to only accept '@' at the beginning of line - J. Elson 1/17/94 */ * only accept '@' at the beginning of line. - JE */
delete_doubledollar(str); delete_doubledollar(str);
smash_tilde(str); smash_tilde(str);
/* determine if this is the terminal string, and truncate if so */ /* Determine if this is the terminal string, and truncate if so. Changed to
/* changed to only accept '@' at the beginning of line - J. Elson 1/17/94 */ * only accept '@' if it's by itself. - fnord */
/* changed to only accept '@' if it's by itself - fnord 10/15/2004 */
if ((action = (*str == '@' && !str[1]))) if ((action = (*str == '@' && !str[1])))
*str = '\0'; *str = '\0';
else else
@ -159,9 +139,7 @@ void string_add(struct descriptor_data *d, char *str)
} }
} }
/* /* Common cleanup code. */
* Common cleanup code.
*/
switch (action) { switch (action) {
case STRINGADD_ABORT: case STRINGADD_ABORT:
switch (STATE(d)) { switch (STATE(d)) {
@ -197,7 +175,6 @@ void string_add(struct descriptor_data *d, char *str)
} }
/* Ok, now final cleanup. */ /* Ok, now final cleanup. */
if (action == STRINGADD_SAVE || action == STRINGADD_ABORT) { if (action == STRINGADD_SAVE || action == STRINGADD_ABORT) {
int i; int i;
struct { struct {
@ -243,11 +220,10 @@ void playing_string_cleanup(struct descriptor_data *d, int action)
free(d->str); free(d->str);
} }
/* /* We have no way of knowing which slot the post was sent to so we can only
* We have no way of knowing which slot the post was sent to so we can only give the message... * give the message. */
*/
if (d->mail_to >= BOARD_MAGIC) { if (d->mail_to >= BOARD_MAGIC) {
Board_save_board(d->mail_to - BOARD_MAGIC); board_save_board(d->mail_to - BOARD_MAGIC);
if (action == STRINGADD_ABORT) if (action == STRINGADD_ABORT)
write_to_output(d, "Post not aborted, use REMOVE <post #>.\r\n"); write_to_output(d, "Post not aborted, use REMOVE <post #>.\r\n");
} }
@ -262,11 +238,7 @@ void exdesc_string_cleanup(struct descriptor_data *d, int action)
STATE(d) = CON_MENU; STATE(d) = CON_MENU;
} }
/* Modification of character skills. */
/* **********************************************************************
* Modification of character skills *
********************************************************************** */
ACMD(do_skillset) ACMD(do_skillset)
{ {
struct char_data *vict; struct char_data *vict;
@ -342,27 +314,15 @@ ACMD(do_skillset)
return; return;
} }
/* /* find_skill_num() guarantees a valid spell_info[] index, or -1, and we
* find_skill_num() guarantees a valid spell_info[] index, or -1, and we * checked for the -1 above so we are safe here. */
* checked for the -1 above so we are safe here.
*/
SET_SKILL(vict, skill, value); SET_SKILL(vict, skill, value);
mudlog(BRF, LVL_IMMORT, TRUE, "%s changed %s's %s to %d.", GET_NAME(ch), GET_NAME(vict), spell_info[skill].name, value); mudlog(BRF, LVL_IMMORT, TRUE, "%s changed %s's %s to %d.", GET_NAME(ch), GET_NAME(vict), spell_info[skill].name, value);
send_to_char(ch, "You change %s's %s to %d.\r\n", GET_NAME(vict), spell_info[skill].name, value); send_to_char(ch, "You change %s's %s to %d.\r\n", GET_NAME(vict), spell_info[skill].name, value);
} }
/* By Michael Buselli. Traverse down the string until the begining of the next
* page has been reached. Return NULL if this is the last page of the string. */
/*********************************************************************
* New Pagination Code
* Michael Buselli submitted the following code for an enhanced pager
* for CircleMUD. All functions below are his. --JE 8 Mar 96
*
*********************************************************************/
/* Traverse down the string until the begining of the next page has been
* reached. Return NULL if this is the last page of the string.
*/
char *next_page(char *str, struct char_data *ch) char *next_page(char *str, struct char_data *ch)
{ {
int col = 1, line = 1; int col = 1, line = 1;
@ -394,9 +354,8 @@ char *next_page(char *str, struct char_data *ch)
else if (*str == '\n') else if (*str == '\n')
line++; line++;
/* We need to check here and see if we are over the page width, /* We need to check here and see if we are over the page width, and if
* and if so, compensate by going to the begining of the next line. * so, compensate by going to the begining of the next line. */
*/
else if (col++ > PAGE_WIDTH) { else if (col++ > PAGE_WIDTH) {
col = 1; col = 1;
line++; line++;
@ -414,11 +373,9 @@ int count_pages(char *str, struct char_data *ch)
return (pages); return (pages);
} }
/* This function assigns all the pointers for showstr_vector for the /* This function assigns all the pointers for showstr_vector for the
* page_string function, after showstr_vector has been allocated and * page_string function, after showstr_vector has been allocated and
* showstr_count set. * showstr_count set. */
*/
void paginate_string(char *str, struct descriptor_data *d) void paginate_string(char *str, struct descriptor_data *d)
{ {
int i; int i;
@ -432,7 +389,6 @@ void paginate_string(char *str, struct descriptor_data *d)
d->showstr_page = 0; d->showstr_page = 0;
} }
/* The call that gets the paging ball rolling... */ /* The call that gets the paging ball rolling... */
void page_string(struct descriptor_data *d, char *str, int keep_internal) void page_string(struct descriptor_data *d, char *str, int keep_internal)
{ {
@ -458,7 +414,6 @@ void page_string(struct descriptor_data *d, char *str, int keep_internal)
show_string(d, actbuf); show_string(d, actbuf);
} }
/* The call that displays the next page. */ /* The call that displays the next page. */
void show_string(struct descriptor_data *d, char *input) void show_string(struct descriptor_data *d, char *input)
{ {
@ -478,21 +433,15 @@ void show_string(struct descriptor_data *d, char *input)
} }
return; return;
} }
/* R is for refresh, so back up one page internally so we can display /* Back up one page internally so we can display it again. */
* it again.
*/
else if (LOWER(*buf) == 'r') else if (LOWER(*buf) == 'r')
d->showstr_page = MAX(0, d->showstr_page - 1); d->showstr_page = MAX(0, d->showstr_page - 1);
/* B is for back, so back up two pages internally so we can display the /* Back up two pages internally so we can display the correct page here. */
* correct page here.
*/
else if (LOWER(*buf) == 'b') else if (LOWER(*buf) == 'b')
d->showstr_page = MAX(0, d->showstr_page - 2); d->showstr_page = MAX(0, d->showstr_page - 2);
/* Feature to 'goto' a page. Just type the number of the page and you /* Type the number of the page and you are there! */
* are there!
*/
else if (isdigit(*buf)) else if (isdigit(*buf))
d->showstr_page = MAX(0, MIN(atoi(buf) - 1, d->showstr_count - 1)); d->showstr_page = MAX(0, MIN(atoi(buf) - 1, d->showstr_count - 1));
@ -501,9 +450,8 @@ void show_string(struct descriptor_data *d, char *input)
return; return;
} }
/* If we're displaying the last page, just send it to the character, and /* If we're displaying the last page, just send it to the character, and
* then free up the space we used. * then free up the space we used. Also send a @n - to make color stop
*/ * bleeding. - Welcor */
/* also send a @n - to make color stop bleeding. -- Welcor */
if (d->showstr_page + 1 >= d->showstr_count) { if (d->showstr_page + 1 >= d->showstr_count) {
send_to_char(d->character, "%s@n", d->showstr_vector[d->showstr_page]); send_to_char(d->character, "%s@n", d->showstr_vector[d->showstr_page]);
free(d->showstr_vector); free(d->showstr_vector);
@ -520,10 +468,7 @@ void show_string(struct descriptor_data *d, char *input)
if (diff > MAX_STRING_LENGTH - 3) /* 3=\r\n\0 */ if (diff > MAX_STRING_LENGTH - 3) /* 3=\r\n\0 */
diff = MAX_STRING_LENGTH - 3; diff = MAX_STRING_LENGTH - 3;
strncpy(buffer, d->showstr_vector[d->showstr_page], diff); /* strncpy: OK (size truncated above) */ strncpy(buffer, d->showstr_vector[d->showstr_page], diff); /* strncpy: OK (size truncated above) */
/* /* Fix for prompt overwriting last line in compact mode by Peter Ajamian */
* Fix for prompt overwriting last line in compact mode submitted by
* Peter Ajamian <peter@pajamian.dhs.org> on 04/21/2001
*/
if (buffer[diff - 2] == '\r' && buffer[diff - 1]=='\n') if (buffer[diff - 2] == '\r' && buffer[diff - 1]=='\n')
buffer[diff] = '\0'; buffer[diff] = '\0';
else if (buffer[diff - 2] == '\n' && buffer[diff - 1] == '\r') else if (buffer[diff - 2] == '\n' && buffer[diff - 1] == '\r')

View file

@ -1,9 +1,9 @@
/************************************************************************ /**************************************************************************
* OasisOLC - General / oasis.c v2.0 * * File: oasis.c Part of tbaMUD *
* Original author: Levork * * Usage: Oasis - General. *
* Copyright 1996 by Harvey Gilpin * * *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) * * By Levork. Copyright 1996 Harvey Gilpin. 1997-2001 George Greer. *
************************************************************************/ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
@ -187,8 +187,6 @@ void cleanup_olc(struct descriptor_data *d, byte cleanup_type)
d->olc = NULL; d->olc = NULL;
} }
/* This function is an exact duplicate of the tag_argument function found in
* one of the ascii patches located on the circlemud ftp website. */
void split_argument(char *argument, char *tag) void split_argument(char *argument, char *tag)
{ {
char *tmp = argument, *ttag = tag, *wrt = argument; char *tmp = argument, *ttag = tag, *wrt = argument;

View file

@ -1,9 +1,9 @@
/************************************************************************ /**************************************************************************
* OasisOLC - General / oasis.h v2.0 * * File: oasis.c Part of tbaMUD *
* Original author: Levork * * Usage: Oasis - General. *
* Copyright 1996 by Harvey Gilpin * * *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) * * By Levork. Copyright 1996 Harvey Gilpin. 1997-2001 George Greer. *
************************************************************************/ **************************************************************************/
#define _OASISOLC 0x206 /* 2.0.6 */ #define _OASISOLC 0x206 /* 2.0.6 */

View file

@ -1,13 +1,13 @@
/******************************************************************************/ /**************************************************************************
/** OasisOLC - InGame OLC Copying v2.0 **/ * File: oasis_copy.c Part of tbaMUD *
/** Original author: Levork **/ * Usage: Oasis OLC copying. *
/** Copyright 1996 Harvey Gilpin **/ * *
/** Copyright 1997-2001 George Greer (greerga@circlemud.org) **/ * By Levork. Copyright 1996 Harvey Gilpin. 1997-2001 George Greer. *
/** Copyright 2002 Kip Potter [Mythran] (kip_potter@hotmail.com) **/ * 2002 Kip Potter [Mythran]. *
/******************************************************************************/ **************************************************************************/
#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"
@ -21,18 +21,13 @@
#include "improved-edit.h" #include "improved-edit.h"
#include "constants.h" #include "constants.h"
/* Internal Functions */
/******************************************************************************/
/** Internal Functions **/
/******************************************************************************/
ACMD(do_dig); ACMD(do_dig);
ACMD(do_room_copy); ACMD(do_room_copy);
room_vnum redit_find_new_vnum(zone_rnum zone); room_vnum redit_find_new_vnum(zone_rnum zone);
int buildwalk(struct char_data *ch, int dir); int buildwalk(struct char_data *ch, int dir);
/******************************************************************************/ /* Commands */
/** Commands **/
/******************************************************************************/
ACMD(do_dig) ACMD(do_dig)
{ {
char sdir[MAX_INPUT_LENGTH], sroom[MAX_INPUT_LENGTH], *new_room_name; char sdir[MAX_INPUT_LENGTH], sroom[MAX_INPUT_LENGTH], *new_room_name;
@ -71,17 +66,13 @@ ACMD(do_dig)
send_to_char(ch, "You do not have permission to edit this zone.\r\n"); send_to_char(ch, "You do not have permission to edit this zone.\r\n");
return; return;
} }
/* /* Lets not allow digging to limbo. After all, it'd just get us more errors
* Lets not allow digging to limbo. * on 'show errors.' */
* After all, it'd just get us more errors on 'show errors'
*/
if (rvnum == 0) { if (rvnum == 0) {
send_to_char(ch, "The target exists, but you can't dig to limbo!\r\n"); send_to_char(ch, "The target exists, but you can't dig to limbo!\r\n");
return; return;
} }
/* /* Target room == -1 removes the exit. */
* target room == -1 removes the exit
*/
if (rvnum == NOTHING) { if (rvnum == NOTHING) {
if (W_EXIT(IN_ROOM(ch), dir)) { if (W_EXIT(IN_ROOM(ch), dir)) {
/* free the old pointers, if any */ /* free the old pointers, if any */
@ -99,9 +90,7 @@ ACMD(do_dig)
"No exit removed.\r\n", dirs[dir]); "No exit removed.\r\n", dirs[dir]);
return; return;
} }
/* /* Can't dig in a direction, if it's already a door. */
* Can't dig in a direction, if it's already a door.
*/
if (W_EXIT(IN_ROOM(ch), dir)) { if (W_EXIT(IN_ROOM(ch), dir)) {
send_to_char(ch, "There already is an exit to the %s.\r\n", dirs[dir]); send_to_char(ch, "There already is an exit to the %s.\r\n", dirs[dir]);
return; return;
@ -117,15 +106,11 @@ ACMD(do_dig)
send_to_char(ch, "You do not have permission to edit room #%d.\r\n", rvnum); send_to_char(ch, "You do not have permission to edit room #%d.\r\n", rvnum);
return; return;
} }
/* /* Now we know the builder is allowed to make the link. */
* Now we know the builder is allowed to make the link
*/
/* If the room doesn't exist, create it.*/ /* If the room doesn't exist, create it.*/
if (rrnum == NOWHERE) { if (rrnum == NOWHERE) {
/* /* Give the descriptor an olc struct. This way we can let
* Give the descriptor an olc struct. * redit_save_internally handle the room adding. */
* This way we can let redit_save_internally handle the room adding.
*/
if (d->olc) { if (d->olc) {
mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_dig: Player already had olc structure."); mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_dig: Player already had olc structure.");
free(d->olc); free(d->olc);
@ -147,24 +132,18 @@ ACMD(do_dig)
OLC_ROOM(d)->zone = OLC_ZNUM(d); OLC_ROOM(d)->zone = OLC_ZNUM(d);
OLC_ROOM(d)->number = NOWHERE; OLC_ROOM(d)->number = NOWHERE;
/* /* Save the new room to memory. redit_save_internally handles adding the
* Save the new room to memory. * room in the right place, etc. */
* redit_save_internally handles adding the room in the right place, etc.
*/
redit_save_internally(d); redit_save_internally(d);
OLC_VAL(d) = 0; OLC_VAL(d) = 0;
send_to_char(ch, "New room (%d) created.\r\n", rvnum); send_to_char(ch, "New room (%d) created.\r\n", rvnum);
cleanup_olc(d, CLEANUP_STRUCTS); cleanup_olc(d, CLEANUP_STRUCTS);
/* /* Update rrnum to the correct room rnum after adding the room. */
* update rrnum to the correct room rnum after adding the room
*/
rrnum = real_room(rvnum); rrnum = real_room(rvnum);
} }
/* /* Now dig. */
* Now dig.
*/
CREATE(W_EXIT(IN_ROOM(ch), dir), struct room_direction_data, 1); CREATE(W_EXIT(IN_ROOM(ch), dir), struct room_direction_data, 1);
W_EXIT(IN_ROOM(ch), dir)->general_description = NULL; W_EXIT(IN_ROOM(ch), dir)->general_description = NULL;
W_EXIT(IN_ROOM(ch), dir)->keyword = NULL; W_EXIT(IN_ROOM(ch), dir)->keyword = NULL;
@ -174,9 +153,7 @@ ACMD(do_dig)
send_to_char(ch, "You make an exit %s to room %d (%s).\r\n", send_to_char(ch, "You make an exit %s to room %d (%s).\r\n",
dirs[dir], rvnum, world[rrnum].name); dirs[dir], rvnum, world[rrnum].name);
/* /* 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, "You cannot 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]]);
@ -187,7 +164,6 @@ ACMD(do_dig)
W_EXIT(rrnum, rev_dir[dir])->to_room = IN_ROOM(ch); W_EXIT(rrnum, rev_dir[dir])->to_room = IN_ROOM(ch);
add_to_save_list(zone_table[world[rrnum].zone].number, SL_WLD); add_to_save_list(zone_table[world[rrnum].zone].number, SL_WLD);
} }
} }
ACMD(do_room_copy) ACMD(do_room_copy)
@ -227,9 +203,7 @@ ACMD(do_room_copy)
room_dst->zone = dst_zone; room_dst->zone = dst_zone;
/* /* Allocate space for all strings. */
* Allocate space for all strings.
*/
send_to_char(ch, "Cloning room....\r\n"); send_to_char(ch, "Cloning room....\r\n");
room_dst->name = str_udup(world[IN_ROOM(ch)].name); room_dst->name = str_udup(world[IN_ROOM(ch)].name);
@ -239,10 +213,7 @@ ACMD(do_room_copy)
room_dst->room_flags = ROOM_FLAGS(IN_ROOM(ch)); room_dst->room_flags = ROOM_FLAGS(IN_ROOM(ch));
room_dst->sector_type = world[IN_ROOM(ch)].sector_type; room_dst->sector_type = world[IN_ROOM(ch)].sector_type;
/* /* Extra descriptions, if necessary. */
* Extra descriptions, if necessary.
*/
send_to_char(ch, "Cloning extra descriptions....\r\n"); send_to_char(ch, "Cloning extra descriptions....\r\n");
if (world[IN_ROOM(ch)].ex_description) { if (world[IN_ROOM(ch)].ex_description) {
struct extra_descr_data *tdesc, *temp, *temp2; struct extra_descr_data *tdesc, *temp, *temp2;
@ -260,9 +231,7 @@ ACMD(do_room_copy)
temp->next = NULL; temp->next = NULL;
} }
} }
/* /* Now save the room in the right place. */
* Now save the room in the right place:
*/
send_to_char(ch, "Saving new room...\r\n"); send_to_char(ch, "Saving new room...\r\n");
if ((room_num = add_room(room_dst)) == NOWHERE) { if ((room_num = add_room(room_dst)) == NOWHERE) {
@ -270,7 +239,7 @@ ACMD(do_room_copy)
log("SYSERR: do_room_copy: Something failed! (%d)", room_num); log("SYSERR: do_room_copy: Something failed! (%d)", room_num);
return; return;
} }
/* Idea contributed by C.Raehl 4/27/99 */ /* Idea contributed by C.Raehl. */
for (dsc = descriptor_list; dsc; dsc = dsc->next) { for (dsc = descriptor_list; dsc; dsc = dsc->next) {
if (dsc == ch->desc) if (dsc == ch->desc)
continue; continue;
@ -301,11 +270,7 @@ ACMD(do_room_copy)
send_to_char(ch, "Room cloned to %d.\r\nAll Done.\r\n", buf_num); send_to_char(ch, "Room cloned to %d.\r\nAll Done.\r\n", buf_num);
} }
/* BuildWalk - OasisOLC Extension by D. Tyler Barnes. */
/****************************************************************************
* BuildWalk - OasisOLC Extension by D. Tyler Barnes *
****************************************************************************/
/* For buildwalk. Finds the next free vnum in the zone */ /* For buildwalk. Finds the next free vnum in the zone */
room_vnum redit_find_new_vnum(zone_rnum zone) room_vnum redit_find_new_vnum(zone_rnum zone)
{ {
@ -343,10 +308,8 @@ int buildwalk(struct char_data *ch, int dir)
send_to_char(ch, "No free vnums are available in this zone!\r\n"); send_to_char(ch, "No free vnums are available in this zone!\r\n");
} else { } else {
struct descriptor_data *d = ch->desc; struct descriptor_data *d = ch->desc;
/* /* Give the descriptor an olc struct. This way we can let
* Give the descriptor an olc struct. * redit_save_internally handle the room adding. */
* This way we can let redit_save_internally handle the room adding.
*/
if (d->olc) { if (d->olc) {
mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: buildwalk(): Player already had olc structure."); mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: buildwalk(): Player already had olc structure.");
free(d->olc); free(d->olc);
@ -363,10 +326,8 @@ int buildwalk(struct char_data *ch, int dir)
OLC_ROOM(d)->zone = OLC_ZNUM(d); OLC_ROOM(d)->zone = OLC_ZNUM(d);
OLC_ROOM(d)->number = NOWHERE; OLC_ROOM(d)->number = NOWHERE;
/* /* Save the new room to memory. redit_save_internally handles adding the
* Save the new room to memory. * room in the right place, etc. */
* redit_save_internally handles adding the room in the right place, etc.
*/
redit_save_internally(d); redit_save_internally(d);
OLC_VAL(d) = 0; OLC_VAL(d) = 0;

View file

@ -1,27 +1,13 @@
/************************************************************************ /**************************************************************************
* OasisOLC - InGame OLC Deletion v2.0 * * File: oasis_delete.c Part of tbaMUD *
* Original author: Levork * * Usage: Oasis OLC deletion. *
* Copyright 1996 Harvey Gilpin * * *
* Copyright 1997-2001 George Greer (greerga@circlemud.org) * * By Levork. Copyright 1996 Harvey Gilpin. 1997-2001 George Greer. *
* Copyright 2002 Kip Potter [Mythran] (kip_potter@hotmail.com) * * 2002 Kip Potter [Mythran]. *
************************************************************************/ **************************************************************************/
/*
+-----------------------------------------------------------------------+
| As of right now, all I have made is the ability to delete rooms. |
| Deleting the rest of the area (objects, zones, mobiles) will be |
| a little more difficult. This is because they are broader and |
| deleting one is more tedious (but not impossible). I will (hopefully)|
| be adding more deletion code after this patch. |
| -- Mythran |
+-----------------------------------------------------------------------+
*/
#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,17 +18,9 @@
#include "oasis.h" #include "oasis.h"
#include "improved-edit.h" #include "improved-edit.h"
/************************************************************************\ /* Free's strings from any object, room, mobiles, or player. TRUE if successful,
** Description : ** * otherwise, it returns FALSE. Type - The OLC type constant relating to the
** Free's strings from any object, room, mobiles, or player. ** * data type of data. */
** **
** Return Value: **
** TRUE if successful, otherwise, it returns FALSE. **
** **
** Parameters : **
** type - The OLC type constant relating to the data type of data. **
\************************************************************************/
int free_strings(void *data, int type) int free_strings(void *data, int type)
{ {
struct room_data *room; struct room_data *room;

View file

@ -1,4 +0,0 @@
/*
* Function prototypes defined in oasis_delete.c.
*/
void remove_room_from_memory(room_rnum rnum);

View file

@ -1,13 +1,13 @@
/******************************************************************************/ /**************************************************************************
/** OasisOLC - InGame OLC Listings v2.0 **/ * File: oasis_list.c Part of tbaMUD *
/** Original author: Levork **/ * Usage: Oasis OLC listings. *
/** Copyright 1996 Harvey Gilpin **/ * *
/** Copyright 1997-2001 George Greer (greerga@circlemud.org) **/ * By Levork. Copyright 1996 Harvey Gilpin. 1997-2001 George Greer. *
/** Copyright 2002 Kip Potter [Mythran] (kip_potter@hotmail.com) **/ * 2002 Kip Potter [Mythran]. *
/******************************************************************************/ **************************************************************************/
#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"
@ -30,9 +30,7 @@ void list_objects(struct char_data *ch, zone_rnum rnum, obj_vnum vmin , obj_vnum
void list_shops(struct char_data *ch , zone_rnum rnum, shop_vnum vmin, shop_vnum vmax); void list_shops(struct char_data *ch , zone_rnum rnum, shop_vnum vmin, shop_vnum vmax);
void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax); void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax);
/******************************************************************************/ /* Ingame Commands */
/** Ingame Commands **/
/******************************************************************************/
ACMD(do_oasis_list) ACMD(do_oasis_list)
{ {
zone_rnum rzone = NOWHERE; zone_rnum rzone = NOWHERE;
@ -53,7 +51,7 @@ ACMD(do_oasis_list)
return; return;
} }
} else { } else {
/** Listing by min vnum / max vnum. Retrieve the numeric values. **/ /* Listing by min vnum / max vnum. Retrieve the numeric values. */
vmin = atoi(smin); vmin = atoi(smin);
vmax = atoi(smax); vmax = atoi(smax);
@ -82,7 +80,6 @@ ACMD(do_oasis_list)
} }
} }
ACMD(do_oasis_links) ACMD(do_oasis_links)
{ {
zone_rnum zrnum; zone_rnum zrnum;
@ -134,22 +131,15 @@ ACMD(do_oasis_links)
} }
} }
/* Helper Functions */
/******************************************************************************/ /* List all rooms in a zone. */
/** Helper Functions **/
/******************************************************************************/
/*
* List all rooms in a zone.
*/
void list_rooms(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum vmax) void list_rooms(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum vmax)
{ {
room_rnum i; room_rnum i;
room_vnum bottom, top; room_vnum bottom, top;
int j, counter = 0; int j, counter = 0;
/* /* Expect a minimum / maximum number if the rnum for the zone is NOWHERE. */
* Expect a minimum / maximum number if the rnum for the zone is NOWHERE.
*/
if (rnum != NOWHERE) { if (rnum != NOWHERE) {
bottom = zone_table[rnum].bot; bottom = zone_table[rnum].bot;
top = zone_table[rnum].top; top = zone_table[rnum].top;
@ -193,10 +183,7 @@ void list_rooms(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum
send_to_char(ch, "No rooms found for zone/range specified.\r\n"); send_to_char(ch, "No rooms found for zone/range specified.\r\n");
} }
/* List all mobiles in a zone. */
/*
* List all mobiles in a zone.
*/
void list_mobiles(struct char_data *ch, zone_rnum rnum, mob_vnum vmin, mob_vnum vmax) void list_mobiles(struct char_data *ch, zone_rnum rnum, mob_vnum vmin, mob_vnum vmax)
{ {
mob_rnum i; mob_rnum i;
@ -232,9 +219,7 @@ void list_mobiles(struct char_data *ch, zone_rnum rnum, mob_vnum vmin, mob_vnum
send_to_char(ch, "None found.\r\n"); send_to_char(ch, "None found.\r\n");
} }
/* /* List all objects in a zone. */
* List all objects in a zone.
*/
void list_objects(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum vmax) void list_objects(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum vmax)
{ {
obj_rnum i; obj_rnum i;
@ -271,9 +256,7 @@ void list_objects(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnu
send_to_char(ch, "None found.\r\n"); send_to_char(ch, "None found.\r\n");
} }
/* /* List all shops in a zone. */
* List all shops in a zone.
*/
void list_shops(struct char_data *ch, zone_rnum rnum, shop_vnum vmin, shop_vnum vmax) void list_shops(struct char_data *ch, zone_rnum rnum, shop_vnum vmin, shop_vnum vmax)
{ {
shop_rnum i; shop_rnum i;
@ -300,7 +283,7 @@ void list_shops(struct char_data *ch, zone_rnum rnum, shop_vnum vmin, shop_vnum
send_to_char(ch, "%s%4d%s) [%s%-5d%s] [%s%-5d%s]", send_to_char(ch, "%s%4d%s) [%s%-5d%s] [%s%-5d%s]",
QGRN, counter, QNRM, QGRN, SHOP_NUM(i), QNRM, QGRN, i + 1, QNRM); QGRN, counter, QNRM, QGRN, SHOP_NUM(i), QNRM, QGRN, i + 1, QNRM);
/* Thanks to Ken Ray (kenr86@hotmail.com) for this display fix -- Welcor*/ /* Thanks to Ken Ray for this display fix. -Welcor */
for (j = 0; SHOP_ROOM(i, j) != NOWHERE; j++) for (j = 0; SHOP_ROOM(i, j) != NOWHERE; j++)
send_to_char(ch, "%s%s[%s%-5d%s]%s", send_to_char(ch, "%s%s[%s%-5d%s]%s",
((j > 0) && (j % 6 == 0)) ? "\r\n " : " ", ((j > 0) && (j % 6 == 0)) ? "\r\n " : " ",
@ -316,9 +299,8 @@ void list_shops(struct char_data *ch, zone_rnum rnum, shop_vnum vmin, shop_vnum
if (counter == 0) if (counter == 0)
send_to_char(ch, "None found.\r\n"); send_to_char(ch, "None found.\r\n");
} }
/*
* List all zones in the world (sort of like 'show zones'). /* List all zones in the world (sort of like 'show zones'). */
*/
void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax) void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax)
{ {
int counter = 0; int counter = 0;
@ -351,13 +333,7 @@ void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum
send_to_char(ch, " None found within those parameters.\r\n"); send_to_char(ch, " None found within those parameters.\r\n");
} }
/* Prints all of the zone information for the selected zone. */
/*
* Prints all of the zone information for the selected zone.
*/
void print_zone(struct char_data *ch, zone_vnum vnum) void print_zone(struct char_data *ch, zone_vnum vnum)
{ {
zone_rnum rnum; zone_rnum rnum;
@ -370,10 +346,7 @@ void print_zone(struct char_data *ch, zone_vnum vnum)
return; return;
} }
/****************************************************************************/ /* Locate the largest of the three, top_of_world, top_of_mobt, or top_of_objt. */
/** Locate the largest of the three, top_of_world, top_of_mobt, or **/
/** top_of_objt. **/
/****************************************************************************/
if (top_of_world >= top_of_objt && top_of_world >= top_of_mobt) if (top_of_world >= top_of_objt && top_of_world >= top_of_mobt)
largest_table = top_of_world; largest_table = top_of_world;
else if (top_of_objt >= top_of_mobt && top_of_objt >= top_of_world) else if (top_of_objt >= top_of_mobt && top_of_objt >= top_of_world)
@ -381,9 +354,7 @@ void print_zone(struct char_data *ch, zone_vnum vnum)
else else
largest_table = top_of_mobt; largest_table = top_of_mobt;
/****************************************************************************/ /* Initialize some of the variables. */
/** Initialize some of the variables. **/
/****************************************************************************/
size_rooms = 0; size_rooms = 0;
size_objects = 0; size_objects = 0;
size_mobiles = 0; size_mobiles = 0;
@ -404,9 +375,7 @@ void print_zone(struct char_data *ch, zone_vnum vnum)
size_mobiles++; size_mobiles++;
} }
/****************************************************************************/ /* Display all of the zone information at once. */
/** Display all of the zone information at once. **/
/****************************************************************************/
send_to_char(ch, send_to_char(ch,
"%sVirtual Number = %s%d\r\n" "%sVirtual Number = %s%d\r\n"
"%sName of zone = %s%s\r\n" "%sName of zone = %s%s\r\n"
@ -435,13 +404,13 @@ void print_zone(struct char_data *ch, zone_vnum vnum)
QGRN, QCYN, size_mobiles, QNRM); QGRN, QCYN, size_mobiles, QNRM);
} }
/* List code by Ronald Evers - dlanor@xs4all.nl */ /* List code by Ronald Evers. */
void list_triggers(struct char_data *ch, zone_rnum rnum, trig_vnum vmin, trig_vnum vmax) void list_triggers(struct char_data *ch, zone_rnum rnum, trig_vnum vmin, trig_vnum vmax)
{ {
int i, bottom, top, counter = 0; int i, bottom, top, counter = 0;
char trgtypes[256]; char trgtypes[256];
/** Expect a minimum / maximum number if the rnum for the zone is NOWHERE. **/ /* Expect a minimum / maximum number if the rnum for the zone is NOWHERE. */
if (rnum != NOWHERE) { if (rnum != NOWHERE) {
bottom = zone_table[rnum].bot; bottom = zone_table[rnum].bot;
top = zone_table[rnum].top; top = zone_table[rnum].top;
@ -451,13 +420,12 @@ void list_triggers(struct char_data *ch, zone_rnum rnum, trig_vnum vmin, trig_vn
} }
/** Store the header for the room listing. **/ /* Store the header for the room listing. */
send_to_char (ch, send_to_char (ch,
"Index VNum Trigger Name Type\r\n" "Index VNum Trigger Name Type\r\n"
"----- ------- -------------------------------------------------------\r\n"); "----- ------- -------------------------------------------------------\r\n");
/* Loop through the world and find each room. */
/** Loop through the world and find each room. **/
for (i = 0; i < top_of_trigt; i++) { for (i = 0; i < top_of_trigt; i++) {
/** Check to see if this room is one of the ones needed to be listed. **/ /** Check to see if this room is one of the ones needed to be listed. **/
if ((trig_index[i]->vnum >= bottom) && (trig_index[i]->vnum <= top)) { if ((trig_index[i]->vnum >= bottom) && (trig_index[i]->vnum <= top)) {

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: objsave.c Part of CircleMUD * * File: objsave.c Part of tbaMUD *
* Usage: loading/saving player objects for rent and crash-save * * Usage: loading/saving player objects for rent and crash-save *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
@ -188,7 +188,7 @@ int objsave_save_obj_record(struct obj_data *obj, FILE *fp, int locate)
#undef TEST_OBJS #undef TEST_OBJS
#undef TEST_OBJN #undef TEST_OBJN
/* AutoEQ by Burkhard Knopf <burkhard.knopf@informatik.tu-clausthal.de> */ /* AutoEQ by Burkhard Knopf. */
void auto_equip(struct char_data *ch, struct obj_data *obj, int location) void auto_equip(struct char_data *ch, struct obj_data *obj, int location)
{ {
int j; int j;

View file

@ -1,9 +1,9 @@
/************************************************************************ /**************************************************************************
* OasisOLC - Objects / oedit.c v2.0 * * File: oedit.c Part of tbaMUD *
* Original author: Levork * * Usage: Oasis OLC - Objects. *
* Copyright 1996 by Harvey Gilpin * * *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) * * By Levork. Copyright 1996 Harvey Gilpin. 1997-2001 George Greer. *
************************************************************************/ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"

View file

@ -1,13 +1,13 @@
/**************************************************************************
* File: pfdefaults.h Part of tbaMUD *
* Usage: ASCII player file defaults. *
**************************************************************************/
#ifndef _PFDEFAULTS_H_ #ifndef _PFDEFAULTS_H_
#define _PFDEFAULTS_H_ #define _PFDEFAULTS_H_
/* /* WARNING: Do not change the values below if you have existing ascii player
ascii pfile variable defaults * files you don't want to screw up. */
WARNING: Do not change the values below if you've got existing ascii
player files you don't want to screw up. See the documentation
included in the ascii pfiles distribution for more information.
*/
#define PFDEF_SEX 0 #define PFDEF_SEX 0
#define PFDEF_CLASS 0 #define PFDEF_CLASS 0

View file

@ -1,16 +1,15 @@
/* ************************************************************************ /**************************************************************************
* File: players.c Part of CircleMUD * * File: players.c Part of tbaMUD *
* Usage: Player loading/saving and utility routines * * Usage: Player loading/saving and utility routines. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#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 "db.h" #include "db.h"
@ -47,27 +46,11 @@ int top_of_p_table = 0; /* ref to top of table */
int top_of_p_file = 0; /* ref of size of p file */ int top_of_p_file = 0; /* ref of size of p file */
long top_idnum = 0; /* highest idnum in use */ long top_idnum = 0; /* highest idnum in use */
/* external ASCII Player Files vars */ /* external ASCII Player Files vars */
extern struct pclean_criteria_data pclean_criteria[]; extern struct pclean_criteria_data pclean_criteria[];
/* New version to build player index for ASCII Player Files. Generate index
/* ASCII Player Files - set this FALSE if you don't want poofin/poofout * table for the player file. */
strings saved in the pfiles
Welcor, 27/12/06 - This was bugged. The check below was #ifdef, not #if,
so poofs were saved regardless of the text. Changed to TRUE to maintain
the saved poofs, and altered to #if below.
*/
#define ASCII_SAVE_POOFS TRUE
/*************************************************************************
* stuff related to the player index *
*************************************************************************/
/* new version to build player index for ASCII Player Files */
/* generate index table for the player file */
void build_player_index(void) void build_player_index(void)
{ {
int rec_count = 0, i; int rec_count = 0, i;
@ -108,12 +91,9 @@ void build_player_index(void)
top_of_p_file = top_of_p_table = i - 1; top_of_p_file = top_of_p_table = i - 1;
} }
/* Create a new entry in the in-memory index table for the player file. If the
/* * name already exists, by overwriting a deleted character, then we re-use the
* Create a new entry in the in-memory index table for the player file. * old position. */
* If the name already exists, by overwriting a deleted character, then
* we re-use the old position.
*/
int create_entry(char *name) int create_entry(char *name)
{ {
int i, pos; int i, pos;
@ -140,7 +120,6 @@ int create_entry(char *name)
return (pos); return (pos);
} }
/* This function necessary to save a seperate ASCII player index */ /* This function necessary to save a seperate ASCII player index */
void save_player_index(void) void save_player_index(void)
{ {
@ -166,7 +145,6 @@ void save_player_index(void)
fclose(index_file); fclose(index_file);
} }
void free_player_index(void) void free_player_index(void)
{ {
int tp; int tp;
@ -183,7 +161,6 @@ void free_player_index(void)
top_of_p_table = 0; top_of_p_table = 0;
} }
long get_ptable_by_name(const char *name) long get_ptable_by_name(const char *name)
{ {
int i; int i;
@ -195,7 +172,6 @@ long get_ptable_by_name(const char *name)
return (-1); return (-1);
} }
long get_id_by_name(const char *name) long get_id_by_name(const char *name)
{ {
int i; int i;
@ -207,7 +183,6 @@ long get_id_by_name(const char *name)
return (-1); return (-1);
} }
char *get_name_by_id(long id) char *get_name_by_id(long id)
{ {
int i; int i;
@ -219,16 +194,11 @@ char *get_name_by_id(long id)
return (NULL); return (NULL);
} }
/* Stuff related to the save/load player system. */
/*************************************************************************
* stuff related to the save/load player system *
*************************************************************************/
#define NUM_OF_SAVE_THROWS 5 #define NUM_OF_SAVE_THROWS 5
/* new load_char reads ASCII Player Files */ /* New load_char reads ASCII Player Files. Load a char, TRUE if loaded, FALSE
/* Load a char, TRUE if loaded, FALSE if not */ * if not. */
int load_char(const char *name, struct char_data *ch) int load_char(const char *name, struct char_data *ch)
{ {
int id, i; int id, i;
@ -246,8 +216,7 @@ int load_char(const char *name, struct char_data *ch)
return (-1); return (-1);
} }
/* character initializations */ /* Character initializations. Necessary to keep some things straight. */
/* initializations necessary to keep some things straight */
ch->affected = NULL; ch->affected = NULL;
for (i = 1; i <= MAX_SKILLS; i++) for (i = 1; i <= MAX_SKILLS; i++)
GET_SKILL(ch, i) = 0; GET_SKILL(ch, i) = 0;
@ -381,10 +350,8 @@ int load_char(const char *name, struct char_data *ch)
if (!strcmp(tag, "Page")) GET_PAGE_LENGTH(ch) = atoi(line); if (!strcmp(tag, "Page")) GET_PAGE_LENGTH(ch) = atoi(line);
else if (!strcmp(tag, "Pass")) strcpy(GET_PASSWD(ch), line); else if (!strcmp(tag, "Pass")) strcpy(GET_PASSWD(ch), line);
else if (!strcmp(tag, "Plyd")) ch->player.time.played = atoi(line); else if (!strcmp(tag, "Plyd")) ch->player.time.played = atoi(line);
#if ASCII_SAVE_POOFS
else if (!strcmp(tag, "PfIn")) POOFIN(ch) = strdup(line); else if (!strcmp(tag, "PfIn")) POOFIN(ch) = strdup(line);
else if (!strcmp(tag, "PfOt")) POOFOUT(ch) = strdup(line); else if (!strcmp(tag, "PfOt")) POOFOUT(ch) = strdup(line);
#endif
else if (!strcmp(tag, "Pref")) PRF_FLAGS(ch) = asciiflag_conv(line); else if (!strcmp(tag, "Pref")) PRF_FLAGS(ch) = asciiflag_conv(line);
break; break;
@ -437,12 +404,8 @@ int load_char(const char *name, struct char_data *ch)
return(id); return(id);
} }
/* /* Write the vital data of a player to the player file. */
* write the vital data of a player to the player file /* This is the ASCII Player Files save routine. */
*
* And that's it! No more fudging around with the load room.
*/
/* This is the ASCII Player Files save routine */
void save_char(struct char_data * ch) void save_char(struct char_data * ch)
{ {
FILE *fl; FILE *fl;
@ -454,10 +417,7 @@ void save_char(struct char_data * ch)
if (IS_NPC(ch) || GET_PFILEPOS(ch) < 0) if (IS_NPC(ch) || GET_PFILEPOS(ch) < 0)
return; return;
/* /* If ch->desc is not null, then update session data before saving. */
* If ch->desc is not null, then we need to update some session data
* before saving.
*/
if (ch->desc) { if (ch->desc) {
if (ch->desc->host && *ch->desc->host) { if (ch->desc->host && *ch->desc->host) {
if (!GET_HOST(ch)) if (!GET_HOST(ch))
@ -468,10 +428,7 @@ void save_char(struct char_data * ch)
} }
} }
/* /* Only update the time.played and time.logon if the character is playing. */
* We only update the time.played and time.logon if the character
* is playing.
*/
if (STATE(ch->desc) == CON_PLAYING) { if (STATE(ch->desc) == CON_PLAYING) {
ch->player.time.played += time(0) - ch->player.time.logon; ch->player.time.played += time(0) - ch->player.time.logon;
ch->player.time.logon = time(0); ch->player.time.logon = time(0);
@ -485,9 +442,7 @@ void save_char(struct char_data * ch)
return; return;
} }
/* remove affects from eq and spells (from char_to_store) */ /* Unaffect everything a character can be affected by. */
/* Unaffect everything a character can be affected by */
for (i = 0; i < NUM_WEARS; i++) { for (i = 0; i < NUM_WEARS; i++) {
if (GET_EQ(ch, i)) { if (GET_EQ(ch, i)) {
char_eq[i] = unequip_char(ch, i); char_eq[i] = unequip_char(ch, i);
@ -513,12 +468,9 @@ void save_char(struct char_data * ch)
tmp_aff[i].next = 0; tmp_aff[i].next = 0;
} }
} }
// save_char_vars(ch);
/* /* Remove the affections so that the raw values are stored; otherwise the
* remove the affections so that the raw values are stored; otherwise the * effects are doubled when the char logs back in. */
* effects are doubled when the char logs back in.
*/
while (ch->affected) while (ch->affected)
affect_remove(ch, ch->affected); affect_remove(ch, ch->affected);
@ -527,7 +479,6 @@ void save_char(struct char_data * ch)
log("SYSERR: WARNING: OUT OF STORE ROOM FOR AFFECTED TYPES!!!"); log("SYSERR: WARNING: OUT OF STORE ROOM FOR AFFECTED TYPES!!!");
ch->aff_abils = ch->real_abils; ch->aff_abils = ch->real_abils;
/* end char_to_store code */ /* end char_to_store code */
if (GET_NAME(ch)) fprintf(fl, "Name: %s\n", GET_NAME(ch)); if (GET_NAME(ch)) fprintf(fl, "Name: %s\n", GET_NAME(ch));
@ -538,10 +489,8 @@ void save_char(struct char_data * ch)
strip_cr(buf); strip_cr(buf);
fprintf(fl, "Desc:\n%s~\n", buf); fprintf(fl, "Desc:\n%s~\n", buf);
} }
#if ASCII_SAVE_POOFS
if (POOFIN(ch)) fprintf(fl, "PfIn: %s\n", POOFIN(ch)); if (POOFIN(ch)) fprintf(fl, "PfIn: %s\n", POOFIN(ch));
if (POOFOUT(ch)) fprintf(fl, "PfOt: %s\n", POOFOUT(ch)); if (POOFOUT(ch)) fprintf(fl, "PfOt: %s\n", POOFOUT(ch));
#endif
if (GET_SEX(ch) != PFDEF_SEX) fprintf(fl, "Sex : %d\n", GET_SEX(ch)); if (GET_SEX(ch) != PFDEF_SEX) fprintf(fl, "Sex : %d\n", GET_SEX(ch));
if (GET_CLASS(ch) != PFDEF_CLASS) fprintf(fl, "Clas: %d\n", GET_CLASS(ch)); if (GET_CLASS(ch) != PFDEF_CLASS) fprintf(fl, "Clas: %d\n", GET_CLASS(ch));
if (GET_LEVEL(ch) != PFDEF_LEVEL) fprintf(fl, "Levl: %d\n", GET_LEVEL(ch)); if (GET_LEVEL(ch) != PFDEF_LEVEL) fprintf(fl, "Levl: %d\n", GET_LEVEL(ch));
@ -635,9 +584,7 @@ void save_char(struct char_data * ch)
fclose(fl); fclose(fl);
/* more char_to_store code to restore affects */ /* More char_to_store code to add spell and eq affections back in. */
/* add spell and eq affections back in now */
for (i = 0; i < MAX_AFFECT; i++) { for (i = 0; i < MAX_AFFECT; i++) {
if (tmp_aff[i].type) if (tmp_aff[i].type)
affect_to_char(ch, &tmp_aff[i]); affect_to_char(ch, &tmp_aff[i]);
@ -654,7 +601,6 @@ void save_char(struct char_data * ch)
obj_to_char(char_eq[i], ch); obj_to_char(char_eq[i], ch);
#endif #endif
} }
/* end char_to_store code */ /* end char_to_store code */
if ((id = get_ptable_by_name(GET_NAME(ch))) < 0) if ((id = get_ptable_by_name(GET_NAME(ch))) < 0)
@ -706,15 +652,10 @@ void tag_argument(char *argument, char *tag)
*wrt = '\0'; *wrt = '\0';
} }
/************************************************************************* /* Stuff related to the player file cleanup system. */
* stuff related to the player file cleanup system *
*************************************************************************/
/* /* remove_player() removes all files associated with a player who is self-deleted,
* remove_player() removes all files associated with a player who is * deleted by an immortal, or deleted by the auto-wipe system (if enabled). */
* self-deleted, deleted by an immortal, or deleted by the auto-wipe
* system (if enabled).
*/
void remove_player(int pfilepos) void remove_player(int pfilepos)
{ {
char fname[40]; char fname[40];
@ -736,29 +677,21 @@ void remove_player(int pfilepos)
save_player_index(); save_player_index();
} }
void clean_pfiles(void) void clean_pfiles(void)
{ {
int i, ci; int i, ci;
for (i = 0; i <= top_of_p_table; i++) { for (i = 0; i <= top_of_p_table; i++) {
/* /* We only want to go further if the player isn't protected from deletion
* We only want to go further if the player isn't protected * and hasn't already been deleted. */
* from deletion and hasn't already been deleted.
*/
if (!IS_SET(player_table[i].flags, PINDEX_NODELETE) && if (!IS_SET(player_table[i].flags, PINDEX_NODELETE) &&
*player_table[i].name) { *player_table[i].name) {
/* /* If the player is already flagged for deletion, then go ahead and get
* If the player is already flagged for deletion, then go * rid of him. */
* ahead and get rid of him.
*/
if (IS_SET(player_table[i].flags, PINDEX_DELETED)) { if (IS_SET(player_table[i].flags, PINDEX_DELETED)) {
remove_player(i); remove_player(i);
} else { } else {
/* /* Check to see if the player has overstayed his welcome based on level. */
* Now we check to see if the player has overstayed his
* welcome based on level.
*/
for (ci = 0; pclean_criteria[ci].level > -1; ci++) { for (ci = 0; pclean_criteria[ci].level > -1; ci++) {
if (player_table[i].level <= pclean_criteria[ci].level && if (player_table[i].level <= pclean_criteria[ci].level &&
((time(0) - player_table[i].last) > ((time(0) - player_table[i].last) >
@ -767,17 +700,13 @@ void clean_pfiles(void)
break; break;
} }
} }
/* /* If we got this far and the players hasn't been kicked out, then he
* If we got this far and the players hasn't been kicked out, * can stay a little while longer. */
* then he can stay a little while longer.
*/
} }
} }
} }
/* /* After everything is done, we should rebuild player_index and remove the
* After everything is done, we should rebuild player_index and * entries of the players that were just deleted. */
* remove the entries of the players that were just deleted.
*/
} }
void load_affects(FILE *fl, struct char_data *ch) void load_affects(FILE *fl, struct char_data *ch)
@ -802,7 +731,6 @@ void load_affects(FILE *fl, struct char_data *ch)
} while (num != 0); } while (num != 0);
} }
void load_skills(FILE *fl, struct char_data *ch) void load_skills(FILE *fl, struct char_data *ch)
{ {
int num = 0, num2 = 0; int num = 0, num2 = 0;
@ -816,7 +744,6 @@ void load_skills(FILE *fl, struct char_data *ch)
} while (num != 0); } while (num != 0);
} }
void load_HMVS(struct char_data *ch, const char *line, int mode) void load_HMVS(struct char_data *ch, const char *line, int mode)
{ {
int num = 0, num2 = 0; int num = 0, num2 = 0;

View file

@ -1,46 +1,23 @@
/* ************************************************************************ /**************************************************************************
* File: random.c Part of CircleMUD * * File: random.c Part of tbaMUD *
* Usage: pseudo-random number generator * * Usage: Pseudo-random number generator. *
************************************************************************ */ **************************************************************************/
/* /* I am bothered by the non-portablility of 'rand' and 'random' -- rand is ANSI
* I am bothered by the non-portablility of 'rand' and 'random' -- rand * C, but on some systems such as Suns, rand has seriously tragic spectral
* is ANSI C, but on some systems such as Suns, rand has seriously tragic * properties (the low bit alternates between 0 and 1!). random is better but
* spectral properties (the low bit alternates between 0 and 1!). random * isn't supported by all systems. So, in my quest for portability, I decided
* is better but isn't supported by all systems. So, in my quest for Ultimate * to include this code for a simple but relatively effective random number
* CircleMUD Portability, I decided to include this code for a simple but * generator. It's not the best RNG code around, but I like it because it's
* relatively effective random number generator. It's not the best RNG code * very short and simple, and for our purposes it's "random enough". -JE */
* around, but I like it because it's very short and simple, and for our
* purposes it's "random enough".
* --Jeremy Elson 2/23/95
*
* Now that we're using GNU's autoconf, I've coded Circle to always use
* random(), and automatically link in this object file if random() isn't
* supported on the target system. -JE 2/3/96
*
* Well, despite autoconf we're back to using this random all the
* time. Oh well, there's no harm in changing my mind on this one
* from release to release... -JE 10/28/97
*/
/***************************************************************************/ /* This program is public domain and was written by William S. England. It is
* based on an article by: Stephen K. Park and Keith W. Miller.
/* * The following is a portable c program for generating random numbers. The
* * modulus and multipilier have been extensively tested and should not be
* This program is public domain and was written by William S. England * changed except by someone who is a professional Lehmer generator writer.
* (Oct 1988). It is based on an article by: * THIS GENERATOR REPRESENTS THE MINIMUM STANDARD AGAINST WHICH OTHER
* * GENERATORS SHOULD BE JUDGED. */
* Stephen K. Park and Keith W. Miller. RANDOM NUMBER GENERATORS:
* GOOD ONES ARE HARD TO FIND. Communications of the ACM,
* New York, NY.,October 1988 p.1192
The following is a portable c program for generating random numbers.
The modulus and multipilier have been extensively tested and should
not be changed except by someone who is a professional Lehmer generator
writer. THIS GENERATOR REPRESENTS THE MINIMUM STANDARD AGAINST WHICH
OTHER GENERATORS SHOULD BE JUDGED. ("Quote from the referenced article's
authors. WSE" )
*/
#define m (unsigned long)2147483647 #define m (unsigned long)2147483647
#define q (unsigned long)127773 #define q (unsigned long)127773
@ -48,8 +25,7 @@
#define a (unsigned int)16807 #define a (unsigned int)16807
#define r (unsigned int)2836 #define r (unsigned int)2836
/* /* F(z) = (az)%m
** F(z) = (az)%m
** = az-m(az/m) ** = az-m(az/m)
** **
** F(z) = G(z)+mT(z) ** F(z) = G(z)+mT(z)
@ -57,8 +33,7 @@
** T(z) = (z/q) - (az/m) ** T(z) = (z/q) - (az/m)
** **
** F(z) = a(z%q)- rz/q+ m((z/q) - a(z/m)) ** F(z) = a(z%q)- rz/q+ m((z/q) - a(z/m))
** = a(z%q)- rz/q+ m(z/q) - az ** = a(z%q)- rz/q+ m(z/q) - az */
*/
static unsigned long seed; static unsigned long seed;
@ -66,13 +41,11 @@ static unsigned long seed;
void circle_srandom(unsigned long initial_seed); void circle_srandom(unsigned long initial_seed);
unsigned long circle_random(void); unsigned long circle_random(void);
void circle_srandom(unsigned long initial_seed) void circle_srandom(unsigned long initial_seed)
{ {
seed = initial_seed; seed = initial_seed;
} }
unsigned long circle_random(void) unsigned long circle_random(void)
{ {
int lo, hi, test; int lo, hi, test;

View file

@ -1,9 +1,9 @@
/************************************************************************ /**************************************************************************
* OasisOLC - Rooms / redit.c v2.0 * * File: redit.c Part of tbaMUD *
* Original author: Levork * * Usage: Oasis OLC - Rooms. *
* Copyright 1996 Harvey Gilpin * * *
* Copyright 1997-2001 George Greer (greerga@circlemud.org) * * By Levork. Copyright 1996 Harvey Gilpin. 1997-2001 George Greer. *
************************************************************************/ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"

View file

@ -1,8 +1,8 @@
/* ************************************************************************ /**************************************************************************
* File: screen.h Part of CircleMUD * * File: screen.h Part of tbaMUD *
* Usage: header file with ANSI color codes for online color * * Usage: Header file with ANSI color codes for online color. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *

View file

@ -1,8 +1,9 @@
/************************************************************************ /**************************************************************************
* OasisOLC - Shops / sedit.c v2.0 * * File: sedit.c Part of tbaMUD *
* Copyright 1996 Harvey Gilpin * * Usage: Oasis OLC - Shops. *
* Copyright 1997-2001 George Greer (greerga@circlemud.org) * * *
************************************************************************/ * Copyright 1996 Harvey Gilpin. 1997-2001 George Greer. *
**************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"

View file

@ -1,14 +1,13 @@
/* ************************************************************************ /**************************************************************************
* File: shop.c Part of CircleMUD * * File: shop.c Part of tbaMUD *
* Usage: shopkeepers: loading config files, spec procs. * * Usage: Shopkeepers, loading config files, spec procs. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ * By Jeff Fink. *
**************************************************************************/
/* 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"
@ -337,10 +336,8 @@ int transaction_amt(char *arg)
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
We don't do that if we only have one argument, like 'buy 5', buy #5. * that if we only have one argument, like 'buy 5', buy #5. By Andrey Fidrya */
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) */
@ -635,12 +632,12 @@ 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 /* This function is a slight hack! To make sure that duplicate items are only
* only listed once on the "list", this function groups "identical" * listed once on the "list", this function groups "identical" objects together
* objects together on the shopkeeper's inventory list. The hack involves * on the shopkeeper's inventory list. The hack involves knowing how the list
* knowing how the list is put together, and manipulating the order of * is put together, and manipulating the order of the objects on the list. (But
* the objects on the list. (But since most of DIKU is not encapsulated, * since most of DIKU is not encapsulated, and information hiding is almost
* and information hiding is almost never used, it isn't that big a deal) -JF */ * never used, it isn't that big a deal). -JF */
struct obj_data *slide_obj(struct obj_data *obj, struct char_data *keeper, int shop_nr) struct obj_data *slide_obj(struct obj_data *obj, struct char_data *keeper, int shop_nr)
{ {
struct obj_data *loop; struct obj_data *loop;

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: shop.h Part of CircleMUD * * File: shop.h Part of tbaMUD *
* Usage: shop file definitions, structures, constants * * Usage: Shop file definitions, structures, constants. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
int find_shop(int); int find_shop(int);
@ -43,31 +43,26 @@ struct shop_data {
SPECIAL (*func); /* Secondary spec_proc for shopkeeper */ SPECIAL (*func); /* Secondary spec_proc for shopkeeper */
}; };
#define MAX_TRADE 5 /* List maximums for compatibility */ #define MAX_TRADE 5 /* List maximums for compatibility */
#define MAX_PROD 5 /* with shops before v3.0 */ #define MAX_PROD 5 /* with shops before v3.0 */
#define VERSION3_TAG "v3.0" /* The file has v3.0 shops in it! */ #define VERSION3_TAG "v3.0" /* The file has v3.0 shops in it! */
#define MAX_SHOP_OBJ 100 /* "Soft" maximum for list maximums */ #define MAX_SHOP_OBJ 100 /* "Soft" maximum for list maximums */
/* Pretty general macros that could be used elsewhere */ /* Pretty general macros that could be used elsewhere */
#define IS_GOD(ch) (!IS_NPC(ch) && (GET_LEVEL(ch) >= LVL_GOD)) #define IS_GOD(ch) (!IS_NPC(ch) && (GET_LEVEL(ch) >= LVL_GOD))
#define END_OF(buffer) ((buffer) + strlen((buffer))) #define END_OF(buffer) ((buffer) + strlen((buffer)))
/* Possible states for objects trying to be sold */ /* Possible states for objects trying to be sold */
#define OBJECT_DEAD 0 #define OBJECT_DEAD 0
#define OBJECT_NOTOK 1 #define OBJECT_NOTOK 1
#define OBJECT_OK 2 #define OBJECT_OK 2
#define OBJECT_NOVAL 3 #define OBJECT_NOVAL 3
/* Types of lists to read */ /* Types of lists to read */
#define LIST_PRODUCE 0 #define LIST_PRODUCE 0
#define LIST_TRADE 1 #define LIST_TRADE 1
#define LIST_ROOM 2 #define LIST_ROOM 2
/* Whom will we not trade with (bitvector for SHOP_TRADE_WITH()) */ /* Whom will we not trade with (bitvector for SHOP_TRADE_WITH()) */
#define TRADE_NOGOOD (1 << 0) #define TRADE_NOGOOD (1 << 0)
#define TRADE_NOEVIL (1 << 1) #define TRADE_NOEVIL (1 << 1)
@ -77,7 +72,6 @@ struct shop_data {
#define TRADE_NOTHIEF (1 << 5) #define TRADE_NOTHIEF (1 << 5)
#define TRADE_NOWARRIOR (1 << 6) #define TRADE_NOWARRIOR (1 << 6)
struct stack_data { struct stack_data {
int data[100]; int data[100];
int len; int len;
@ -86,7 +80,6 @@ struct stack_data {
#define S_DATA(stack, index) ((stack)->data[(index)]) #define S_DATA(stack, index) ((stack)->data[(index)])
#define S_LEN(stack) ((stack)->len) #define S_LEN(stack) ((stack)->len)
/* Which expression type we are now parsing */ /* Which expression type we are now parsing */
#define OPER_OPEN_PAREN 0 #define OPER_OPEN_PAREN 0
#define OPER_CLOSE_PAREN 1 #define OPER_CLOSE_PAREN 1
@ -95,7 +88,6 @@ struct stack_data {
#define OPER_NOT 4 #define OPER_NOT 4
#define MAX_OPER 4 #define MAX_OPER 4
#define SHOP_NUM(i) (shop_index[(i)].vnum) #define SHOP_NUM(i) (shop_index[(i)].vnum)
#define SHOP_KEEPER(i) (shop_index[(i)].keeper) #define SHOP_KEEPER(i) (shop_index[(i)].keeper)
#define SHOP_OPEN1(i) (shop_index[(i)].open1) #define SHOP_OPEN1(i) (shop_index[(i)].open1)
@ -123,8 +115,6 @@ struct stack_data {
#define NOTRADE_THIEF(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOTHIEF)) #define NOTRADE_THIEF(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOTHIEF))
#define NOTRADE_WARRIOR(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOWARRIOR)) #define NOTRADE_WARRIOR(i) (IS_SET(SHOP_TRADE_WITH((i)), TRADE_NOWARRIOR))
#define WILL_START_FIGHT (1 << 0) #define WILL_START_FIGHT (1 << 0)
#define WILL_BANK_MONEY (1 << 1) #define WILL_BANK_MONEY (1 << 1)
#define HAS_UNLIMITED_CASH (1 << 2) #define HAS_UNLIMITED_CASH (1 << 2)
@ -132,7 +122,6 @@ struct stack_data {
#define SHOP_KILL_CHARS(i) (IS_SET(SHOP_BITVECTOR(i), WILL_START_FIGHT)) #define SHOP_KILL_CHARS(i) (IS_SET(SHOP_BITVECTOR(i), WILL_START_FIGHT))
#define SHOP_USES_BANK(i) (IS_SET(SHOP_BITVECTOR(i), WILL_BANK_MONEY)) #define SHOP_USES_BANK(i) (IS_SET(SHOP_BITVECTOR(i), WILL_BANK_MONEY))
#define MIN_OUTSIDE_BANK 5000 #define MIN_OUTSIDE_BANK 5000
#define MAX_OUTSIDE_BANK 15000 #define MAX_OUTSIDE_BANK 15000

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: spec_assign.c Part of CircleMUD * * File: spec_assign.c Part of tbaMUD *
* Usage: Functions to assign function pointers to objs/mobs/rooms * * Usage: Functions to assign function pointers to objs/mobs/rooms *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"

View file

@ -1,12 +1,15 @@
/* ************************************************************************ /**************************************************************************
* File: spec_procs.c Part of CircleMUD * * File: spec_procs.c Part of tbaMUD *
* Usage: implementation of special procedures for mobiles/objects/rooms * * Usage: Implementation of special procedures for mobiles/objects/rooms. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
/* For more examples:
* ftp://ftp.circlemud.org/pub/CircleMUD/contrib/snippets/specials */
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
@ -22,6 +25,7 @@
/* external vars */ /* external vars */
extern struct time_info_data time_info; extern struct time_info_data time_info;
extern struct spell_info_type spell_info[]; extern struct spell_info_type spell_info[];
extern struct guild_info_type guild_info[];
/* extern functions */ /* extern functions */
ACMD(do_drop); ACMD(do_drop);
@ -37,6 +41,15 @@ void list_skills(struct char_data *ch);
SPECIAL(guild); SPECIAL(guild);
SPECIAL(dump); SPECIAL(dump);
SPECIAL(mayor); SPECIAL(mayor);
void npc_steal(struct char_data *ch, struct char_data *victim);
SPECIAL(snake);
SPECIAL(thief);
SPECIAL(magic_user);
SPECIAL(guild_guard);
SPECIAL(puff);
SPECIAL(fido);
SPECIAL(janitor);
SPECIAL(cityguard);
SPECIAL(pet_shops); SPECIAL(pet_shops);
SPECIAL(bank); SPECIAL(bank);
@ -299,6 +312,293 @@ SPECIAL(mayor)
return (FALSE); return (FALSE);
} }
/* General special procedures for mobiles. */
void npc_steal(struct char_data *ch, struct char_data *victim)
{
int gold;
if (IS_NPC(victim))
return;
if (GET_LEVEL(victim) >= LVL_IMMORT)
return;
if (!CAN_SEE(ch, victim))
return;
if (AWAKE(victim) && (rand_number(0, GET_LEVEL(ch)) == 0)) {
act("You discover that $n has $s hands in your wallet.", FALSE, ch, 0, victim, TO_VICT);
act("$n tries to steal gold from $N.", TRUE, ch, 0, victim, TO_NOTVICT);
} else {
/* Steal some gold coins */
gold = (GET_GOLD(victim) * rand_number(1, 10)) / 100;
if (gold > 0) {
GET_GOLD(ch) += gold;
GET_GOLD(victim) -= gold;
}
}
}
/* Quite lethal to low-level characters. */
SPECIAL(snake)
{
if (cmd || GET_POS(ch) != POS_FIGHTING || !FIGHTING(ch))
return (FALSE);
if (IN_ROOM(FIGHTING(ch)) != IN_ROOM(ch) || rand_number(0, GET_LEVEL(ch)) != 0)
return (FALSE);
act("$n bites $N!", 1, ch, 0, FIGHTING(ch), TO_NOTVICT);
act("$n bites you!", 1, ch, 0, FIGHTING(ch), TO_VICT);
call_magic(ch, FIGHTING(ch), 0, SPELL_POISON, GET_LEVEL(ch), CAST_SPELL);
return (TRUE);
}
SPECIAL(thief)
{
struct char_data *cons;
if (cmd || GET_POS(ch) != POS_STANDING)
return (FALSE);
for (cons = world[IN_ROOM(ch)].people; cons; cons = cons->next_in_room)
if (!IS_NPC(cons) && GET_LEVEL(cons) < LVL_IMMORT && !rand_number(0, 4)) {
npc_steal(ch, cons);
return (TRUE);
}
return (FALSE);
}
SPECIAL(magic_user)
{
struct char_data *vict;
if (cmd || GET_POS(ch) != POS_FIGHTING)
return (FALSE);
/* pseudo-randomly choose someone in the room who is fighting me */
for (vict = world[IN_ROOM(ch)].people; vict; vict = vict->next_in_room)
if (FIGHTING(vict) == ch && !rand_number(0, 4))
break;
/* if I didn't pick any of those, then just slam the guy I'm fighting */
if (vict == NULL && IN_ROOM(FIGHTING(ch)) == IN_ROOM(ch))
vict = FIGHTING(ch);
/* Hm...didn't pick anyone...I'll wait a round. */
if (vict == NULL)
return (TRUE);
if (GET_LEVEL(ch) > 13 && rand_number(0, 10) == 0)
cast_spell(ch, vict, NULL, SPELL_POISON);
if (GET_LEVEL(ch) > 7 && rand_number(0, 8) == 0)
cast_spell(ch, vict, NULL, SPELL_BLINDNESS);
if (GET_LEVEL(ch) > 12 && rand_number(0, 12) == 0) {
if (IS_EVIL(ch))
cast_spell(ch, vict, NULL, SPELL_ENERGY_DRAIN);
else if (IS_GOOD(ch))
cast_spell(ch, vict, NULL, SPELL_DISPEL_EVIL);
}
if (rand_number(0, 4))
return (TRUE);
switch (GET_LEVEL(ch)) {
case 4:
case 5:
cast_spell(ch, vict, NULL, SPELL_MAGIC_MISSILE);
break;
case 6:
case 7:
cast_spell(ch, vict, NULL, SPELL_CHILL_TOUCH);
break;
case 8:
case 9:
cast_spell(ch, vict, NULL, SPELL_BURNING_HANDS);
break;
case 10:
case 11:
cast_spell(ch, vict, NULL, SPELL_SHOCKING_GRASP);
break;
case 12:
case 13:
cast_spell(ch, vict, NULL, SPELL_LIGHTNING_BOLT);
break;
case 14:
case 15:
case 16:
case 17:
cast_spell(ch, vict, NULL, SPELL_COLOR_SPRAY);
break;
default:
cast_spell(ch, vict, NULL, SPELL_FIREBALL);
break;
}
return (TRUE);
}
/* Special procedures for mobiles. */
SPECIAL(guild_guard)
{
int i;
struct char_data *guard = (struct char_data *)me;
const char *buf = "The guard humiliates you, and blocks your way.\r\n";
const char *buf2 = "The guard humiliates $n, and blocks $s way.";
if (!IS_MOVE(cmd) || AFF_FLAGGED(guard, AFF_BLIND))
return (FALSE);
if (GET_LEVEL(ch) >= LVL_IMMORT)
return (FALSE);
for (i = 0; guild_info[i].guild_room != NOWHERE; i++) {
/* Wrong guild or not trying to enter. */
if (GET_ROOM_VNUM(IN_ROOM(ch)) != guild_info[i].guild_room || cmd != guild_info[i].direction)
continue;
/* Allow the people of the guild through. */
if (!IS_NPC(ch) && GET_CLASS(ch) == guild_info[i].pc_class)
continue;
send_to_char(ch, "%s", buf);
act(buf2, FALSE, ch, 0, 0, TO_ROOM);
return (TRUE);
}
return (FALSE);
}
SPECIAL(puff)
{
char actbuf[MAX_INPUT_LENGTH];
if (cmd)
return (FALSE);
switch (rand_number(0, 60)) {
case 0:
do_say(ch, strcpy(actbuf, "My god! It's full of stars!"), 0, 0); /* strcpy: OK */
return (TRUE);
case 1:
do_say(ch, strcpy(actbuf, "How'd all those fish get up here?"), 0, 0); /* strcpy: OK */
return (TRUE);
case 2:
do_say(ch, strcpy(actbuf, "I'm a very female dragon."), 0, 0); /* strcpy: OK */
return (TRUE);
case 3:
do_say(ch, strcpy(actbuf, "I've got a peaceful, easy feeling."), 0, 0); /* strcpy: OK */
return (TRUE);
default:
return (FALSE);
}
}
SPECIAL(fido)
{
struct obj_data *i, *temp, *next_obj;
if (cmd || !AWAKE(ch))
return (FALSE);
for (i = world[IN_ROOM(ch)].contents; i; i = i->next_content) {
if (!IS_CORPSE(i))
continue;
act("$n savagely devours a corpse.", FALSE, ch, 0, 0, TO_ROOM);
for (temp = i->contains; temp; temp = next_obj) {
next_obj = temp->next_content;
obj_from_obj(temp);
obj_to_room(temp, IN_ROOM(ch));
}
extract_obj(i);
return (TRUE);
}
return (FALSE);
}
SPECIAL(janitor)
{
struct obj_data *i;
if (cmd || !AWAKE(ch))
return (FALSE);
for (i = world[IN_ROOM(ch)].contents; i; i = i->next_content) {
if (!CAN_WEAR(i, ITEM_WEAR_TAKE))
continue;
if (GET_OBJ_TYPE(i) != ITEM_DRINKCON && GET_OBJ_COST(i) >= 15)
continue;
act("$n picks up some trash.", FALSE, ch, 0, 0, TO_ROOM);
obj_from_room(i);
obj_to_char(i, ch);
return (TRUE);
}
return (FALSE);
}
SPECIAL(cityguard)
{
struct char_data *tch, *evil, *spittle;
int max_evil, min_cha;
if (cmd || !AWAKE(ch) || FIGHTING(ch))
return (FALSE);
max_evil = 1000;
min_cha = 6;
spittle = evil = NULL;
for (tch = world[IN_ROOM(ch)].people; tch; tch = tch->next_in_room) {
if (!CAN_SEE(ch, tch))
continue;
if (!IS_NPC(tch) && PLR_FLAGGED(tch, PLR_KILLER)) {
act("$n screams 'HEY!!! You're one of those PLAYER KILLERS!!!!!!'", FALSE, ch, 0, 0, TO_ROOM);
hit(ch, tch, TYPE_UNDEFINED);
return (TRUE);
}
if (!IS_NPC(tch) && PLR_FLAGGED(tch, PLR_THIEF)) {
act("$n screams 'HEY!!! You're one of those PLAYER THIEVES!!!!!!'", FALSE, ch, 0, 0, TO_ROOM);
hit(ch, tch, TYPE_UNDEFINED);
return (TRUE);
}
if (FIGHTING(tch) && GET_ALIGNMENT(tch) < max_evil && (IS_NPC(tch) || IS_NPC(FIGHTING(tch)))) {
max_evil = GET_ALIGNMENT(tch);
evil = tch;
}
if (GET_CHA(tch) < min_cha) {
spittle = tch;
min_cha = GET_CHA(tch);
}
}
if (evil && GET_ALIGNMENT(FIGHTING(evil)) >= 0) {
act("$n screams 'PROTECT THE INNOCENT! BANZAI! CHARGE! ARARARAGGGHH!'", FALSE, ch, 0, 0, TO_ROOM);
hit(ch, evil, TYPE_UNDEFINED);
return (TRUE);
}
/* Reward the socially inept. */
if (spittle && !rand_number(0, 9)) {
static int spit_social;
if (!spit_social)
spit_social = find_command("spit");
if (spit_social > 0) {
char spitbuf[MAX_NAME_LENGTH + 1];
strncpy(spitbuf, GET_NAME(spittle), sizeof(spitbuf)); /* strncpy: OK */
spitbuf[sizeof(spitbuf) - 1] = '\0';
do_action(ch, spitbuf, spit_social, 0);
return (TRUE);
}
}
return (FALSE);
}
#define PET_PRICE(pet) (GET_LEVEL(pet) * 300) #define PET_PRICE(pet) (GET_LEVEL(pet) * 300)
SPECIAL(pet_shops) SPECIAL(pet_shops)
{ {
@ -363,7 +663,7 @@ SPECIAL(pet_shops)
return (FALSE); return (FALSE);
} }
/* Special procedures for objects */ /* Special procedures for objects. */
SPECIAL(bank) SPECIAL(bank)
{ {
int amount; int amount;

View file

@ -1,13 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: spell_parser.c Part of CircleMUD * * File: spell_parser.c Part of tbaMUD *
* Usage: top-level magic routines; outside points of entry to magic sys. * * Usage: Top-level magic routines; outside points of entry to magic sys. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
@ -185,8 +184,7 @@ int find_skill_num(char *name)
return (-1); return (-1);
} }
/* /* This function is the very heart of the entire magic system. All invocations
* This function is the very heart of the entire magic system. All invocations
* of all types of magic -- objects, spoken and unspoken PC and NPC spells, the * of all types of magic -- objects, spoken and unspoken PC and NPC spells, the
* works -- all come through this function eventually. This is also the entry * works -- all come through this function eventually. This is also the entry
* point for non-spoken or unrestricted spells. Spellnum 0 is legal but silently * point for non-spoken or unrestricted spells. Spellnum 0 is legal but silently
@ -922,14 +920,12 @@ void mag_assign_spells(void)
/* NON-castable spells should appear below here. */ /* NON-castable spells should appear below here. */
spello(SPELL_IDENTIFY, "identify", 0, 0, 0, 0, spello(SPELL_IDENTIFY, "identify", 0, 0, 0, 0,
TAR_CHAR_ROOM | TAR_OBJ_INV | TAR_OBJ_ROOM, FALSE, MAG_MANUAL, TAR_CHAR_ROOM | TAR_OBJ_INV | TAR_OBJ_ROOM, FALSE, MAG_MANUAL,
NULL); NULL);
/* These spells are currently not used, not implemented, and not castable. /* These spells are currently not used, not implemented, and not castable.
* Values for the 'breath' spells are filled in assuming a dragon's breath. */ * Values for the 'breath' spells are filled in assuming a dragon's breath. */
spello(SPELL_FIRE_BREATH, "fire breath", 0, 0, 0, POS_SITTING, spello(SPELL_FIRE_BREATH, "fire breath", 0, 0, 0, POS_SITTING,
TAR_IGNORE, TRUE, 0, TAR_IGNORE, TRUE, 0,
NULL); NULL);

View file

@ -1,13 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: spells.c Part of CircleMUD * * File: spells.c Part of tbaMUD *
* Usage: Implementation of "manual spells". Circle 2.2 spell compat. * * Usage: Implementation of "manual spells". *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
@ -284,8 +283,6 @@ ASPELL(spell_charm)
} }
} }
ASPELL(spell_identify) ASPELL(spell_identify)
{ {
int i, found; int i, found;
@ -374,12 +371,8 @@ ASPELL(spell_identify)
} }
} }
/* Cannot use this spell on an equipped object or it will mess up the wielding
* character's hit/dam totals. */
/*
* Cannot use this spell on an equipped object or it will mess up the
* wielding character's hit/dam totals.
*/
ASPELL(spell_enchant_weapon) ASPELL(spell_enchant_weapon)
{ {
int i; int i;
@ -414,7 +407,6 @@ ASPELL(spell_enchant_weapon)
act("$p glows yellow.", FALSE, ch, obj, 0, TO_CHAR); act("$p glows yellow.", FALSE, ch, obj, 0, TO_CHAR);
} }
ASPELL(spell_detect_poison) ASPELL(spell_detect_poison)
{ {
if (victim) { if (victim) {

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: spells.h Part of CircleMUD * * File: spells.h Part of tbaMUD *
* Usage: header file: constants and fn prototypes for spell system * * Usage: Header file: constants and fn prototypes for spell system. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#define DEFAULT_STAFF_LVL 12 #define DEFAULT_STAFF_LVL 12
#define DEFAULT_WAND_LVL 12 #define DEFAULT_WAND_LVL 12
@ -30,12 +30,10 @@
#define MAG_CREATIONS (1 << 9) #define MAG_CREATIONS (1 << 9)
#define MAG_MANUAL (1 << 10) #define MAG_MANUAL (1 << 10)
#define TYPE_UNDEFINED (-1) #define TYPE_UNDEFINED (-1)
#define SPELL_RESERVED_DBC 0 /* SKILL NUMBER ZERO -- RESERVED */ #define SPELL_RESERVED_DBC 0 /* SKILL NUMBER ZERO -- RESERVED */
/* PLAYER SPELLS -- Numbered from 1 to MAX_SPELLS */ /* PLAYER SPELLS -- Numbered from 1 to MAX_SPELLS */
#define SPELL_ARMOR 1 /* Reserved Skill[] DO NOT CHANGE */ #define SPELL_ARMOR 1 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_TELEPORT 2 /* Reserved Skill[] DO NOT CHANGE */ #define SPELL_TELEPORT 2 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_BLESS 3 /* Reserved Skill[] DO NOT CHANGE */ #define SPELL_BLESS 3 /* Reserved Skill[] DO NOT CHANGE */
@ -103,15 +101,11 @@
#define SKILL_TRACK 140 /* Reserved Skill[] DO NOT CHANGE */ #define SKILL_TRACK 140 /* Reserved Skill[] DO NOT CHANGE */
/* New skills may be added here up to MAX_SKILLS (200) */ /* New skills may be added here up to MAX_SKILLS (200) */
/* NON-PLAYER AND OBJECT SPELLS AND SKILLS: The practice levels for the spells
/* * and skills below are _not_ recorded in the players file; therefore, the
* NON-PLAYER AND OBJECT SPELLS AND SKILLS * intended use is for spells and skills associated with objects (such as
* The practice levels for the spells and skills below are _not_ recorded * SPELL_IDENTIFY used with scrolls of identify) or non-players (such as NPC
* in the players file; therefore, the intended use is for spells and skills * only spells). */
* associated with objects (such as SPELL_IDENTIFY used with scrolls of
* identify) or non-players (such as NPC-only spells).
*/
#define SPELL_IDENTIFY 201 #define SPELL_IDENTIFY 201
#define SPELL_FIRE_BREATH 202 #define SPELL_FIRE_BREATH 202
#define SPELL_GAS_BREATH 203 #define SPELL_GAS_BREATH 203
@ -119,17 +113,14 @@
#define SPELL_ACID_BREATH 205 #define SPELL_ACID_BREATH 205
#define SPELL_LIGHTNING_BREATH 206 #define SPELL_LIGHTNING_BREATH 206
/* To make an affect induced by dg_affect look correct on 'stat' we need to
* define it with a 'spellname'. */
#define SPELL_DG_AFFECT 298
#define SPELL_DG_AFFECT 298 /* to make an affect induced by dg_affect
* look correct on 'stat' we need to define
* it with a 'spellname'.
*/
#define TOP_SPELL_DEFINE 299 #define TOP_SPELL_DEFINE 299
/* NEW NPC/OBJECT SPELLS can be inserted here up to 299 */ /* NEW NPC/OBJECT SPELLS can be inserted here up to 299 */
/* WEAPON ATTACK TYPES */ /* WEAPON ATTACK TYPES */
#define TYPE_HIT 300 #define TYPE_HIT 300
#define TYPE_STING 301 #define TYPE_STING 301
#define TYPE_WHIP 302 #define TYPE_WHIP 302
@ -149,15 +140,12 @@
/* new attack types can be added here - up to TYPE_SUFFERING */ /* new attack types can be added here - up to TYPE_SUFFERING */
#define TYPE_SUFFERING 399 #define TYPE_SUFFERING 399
#define SAVING_PARA 0 #define SAVING_PARA 0
#define SAVING_ROD 1 #define SAVING_ROD 1
#define SAVING_PETRI 2 #define SAVING_PETRI 2
#define SAVING_BREATH 3 #define SAVING_BREATH 3
#define SAVING_SPELL 4 #define SAVING_SPELL 4
#define TAR_IGNORE (1 << 0) #define TAR_IGNORE (1 << 0)
#define TAR_CHAR_ROOM (1 << 1) #define TAR_CHAR_ROOM (1 << 1)
#define TAR_CHAR_WORLD (1 << 2) #define TAR_CHAR_WORLD (1 << 2)
@ -185,7 +173,6 @@ struct spell_info_type {
}; };
/* Possible Targets: /* Possible Targets:
bit 0 : IGNORE TARGET bit 0 : IGNORE TARGET
bit 1 : PC/NPC in room bit 1 : PC/NPC in room
bit 2 : PC/NPC in world bit 2 : PC/NPC in world
@ -195,25 +182,19 @@ struct spell_info_type {
bit 6 : Object in world bit 6 : Object in world
bit 7 : If fighting, and no argument, select tar_char as self bit 7 : If fighting, and no argument, select tar_char as self
bit 8 : If fighting, and no argument, select tar_char as victim (fighting) bit 8 : If fighting, and no argument, select tar_char as victim (fighting)
bit 9 : If no argument, select self, if argument check that it IS self. bit 9 : If no argument, select self, if argument check that it IS self. */
*/
#define SPELL_TYPE_SPELL 0 #define SPELL_TYPE_SPELL 0
#define SPELL_TYPE_POTION 1 #define SPELL_TYPE_POTION 1
#define SPELL_TYPE_WAND 2 #define SPELL_TYPE_WAND 2
#define SPELL_TYPE_STAFF 3 #define SPELL_TYPE_STAFF 3
#define SPELL_TYPE_SCROLL 4 #define SPELL_TYPE_SCROLL 4
/* Attacktypes with grammar */ /* Attacktypes with grammar */
struct attack_hit_type { struct attack_hit_type {
const char *singular; const char *singular;
const char *plural; const char *plural;
}; };
#define ASPELL(spellname) \ #define ASPELL(spellname) \
void spellname(int level, struct char_data *ch, \ void spellname(int level, struct char_data *ch, \
struct char_data *victim, struct obj_data *obj) struct char_data *victim, struct obj_data *obj)
@ -270,7 +251,6 @@ void mag_objectmagic(struct char_data *ch, struct obj_data *obj,
int cast_spell(struct char_data *ch, struct char_data *tch, int cast_spell(struct char_data *ch, struct char_data *tch,
struct obj_data *tobj, int spellnum); struct obj_data *tobj, int spellnum);
/* other prototypes */ /* other prototypes */
void spell_level(int spell, int chclass, int level); void spell_level(int spell, int chclass, int level);
void init_spell_levels(void); void init_spell_levels(void);

View file

@ -1,19 +1,20 @@
/* ************************************************************************ /**************************************************************************
* File: structs.h Part of CircleMUD * * File: structs.h Part of tbaMUD *
* Usage: header file for central structures and constants * * Usage: Header file for central structures and constants. *
* All rights reserved. See license.doc for complete information. * * *
* All rights reserved. See license 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 a
* variety of CircleMUD versions without modifications. For instance, an * variety of versions without modifications. For instance, an IS_CORPSE()
* IS_CORPSE() macro was introduced in pl13. Any future code add-ons could * macro was introduced in pl13. Any future code add-ons could take into
* take into account the CircleMUD version and supply their own definition for * account the version and supply their own definition for the macro if used
* the macro if used on an older version of CircleMUD. You are supposed to * on an older version. You are supposed to compare this with the macro
* compare this with the macro CIRCLEMUD_VERSION() in utils.h. */ * TBAMUD_VERSION() in utils.h. */
#define _CIRCLEMUD 0x030520 /* Major/Minor/Patchlevel - MMmmPP */ #define _TBAMUD 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. */
@ -295,14 +296,14 @@
#define ITEM_STAFF 4 /* Item is a staff */ #define ITEM_STAFF 4 /* Item is a staff */
#define ITEM_WEAPON 5 /* Item is a weapon */ #define ITEM_WEAPON 5 /* Item is a weapon */
#define ITEM_FURNITURE 6 /* Sittable Furniture */ #define ITEM_FURNITURE 6 /* Sittable Furniture */
#define ITEM_UNDEFINED 7 /* Unimplemented */ #define ITEM_FREE 7 /* Unimplemented */
#define ITEM_TREASURE 8 /* Item is a treasure, not gold */ #define ITEM_TREASURE 8 /* Item is a treasure, not gold */
#define ITEM_ARMOR 9 /* Item is armor */ #define ITEM_ARMOR 9 /* Item is armor */
#define ITEM_POTION 10 /* Item is a potion */ #define ITEM_POTION 10 /* Item is a potion */
#define ITEM_WORN 11 /* Unimplemented */ #define ITEM_WORN 11 /* Unimplemented */
#define ITEM_OTHER 12 /* Misc object */ #define ITEM_OTHER 12 /* Misc object */
#define ITEM_TRASH 13 /* Trash - shopkeeps won't buy */ #define ITEM_TRASH 13 /* Trash - shopkeeps won't buy */
#define ITEM_TRAP 14 /* Unimplemented */ #define ITEM_FREE2 14 /* Unimplemented */
#define ITEM_CONTAINER 15 /* Item is a container */ #define ITEM_CONTAINER 15 /* Item is a container */
#define ITEM_NOTE 16 /* Item is note */ #define ITEM_NOTE 16 /* Item is note */
#define ITEM_DRINKCON 17 /* Item is a drink container */ #define ITEM_DRINKCON 17 /* Item is a drink container */
@ -1018,6 +1019,12 @@ struct trig_proto_list {
struct trig_proto_list *next; /* next trigger */ struct trig_proto_list *next; /* next trigger */
}; };
struct guild_info_type {
int pc_class;
room_vnum guild_room;
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

View file

@ -1,133 +1,66 @@
/* ************************************************************************ /**************************************************************************
* File: sysdep.h Part of CircleMUD * * File: sysdep.h Part of tbaMUD *
* Usage: machine-specific defs based on values in conf.h (from configure)* * Usage: Machine-specific defs based on values in conf.h (from configure)*
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
/* Configurables: */
/*
* CircleMUD uses the crypt(3) function to encrypt player passwords in the
* players file so that they are never stored in plaintext form. However,
* due to U.S. export restrictions on machine-readable cryptographic
* software, the crypt() function is not available on some operating
* systems such as FreeBSD. By default, the 'configure' script will
* determine if you have crypt() available and enable or disable password
* encryption appropriately. #define NOCRYPT (by uncommenting the line
* below) if you'd like to explicitly disable password encryption (i.e.,
* if you have moved your MUD from an OS that does not support encryption
* to one that does.)
*
* See running.doc for details.
*/
/* Configurables: tbaMUD uses the crypt(3) function to encrypt player passwords
* in the players file so that they are never stored in plaintext form. However,
* due to U.S. export restrictions on machine-readable cryptographic software,
* the crypt() function is not available on some operating systems such as
* FreeBSD. By default, the 'configure' script will determine if you have
* crypt() available and enable or disable password encryption appropriately.
* #define NOCRYPT (by uncommenting the line below) if you'd like to explicitly
* disable password encryption (i.e., if you have moved your MUD from an OS that
* does not support encryption to one that does). */
/* #define NOCRYPT */ /* #define NOCRYPT */
/**************************************************************************/ /* If you are porting tbaMUD to a new (untested) platform and you find that
* POSIX-standard non-blocking I/O does *not* work, you can define the constant
/* * below to work around the problem. Not having non-blocking I/O can cause the
* If you are porting CircleMUD to a new (untested) platform and you find * MUD to freeze if someone types part of a command while the MUD waits for the
* that POSIX-standard non-blocking I/O does *not* work, you can define * remainder of the command.
* the constant below to have Circle work around the problem. Not having
* non-blocking I/O can cause the MUD to freeze if someone types part of
* a command while the MUD waits for the remainder of the command.
* *
* NOTE: **DO** **NOT** use this constant unless you are SURE you understand * NOTE: **DO** **NOT** use this constant unless you are SURE you understand
* exactly what non-blocking I/O is, and you are SURE that your operating * exactly what non-blocking I/O is, and you are SURE that your operating system
* system does NOT have it! (The only UNIX system I've ever seen that has * does NOT have it! (The only UNIX system I've ever seen that has broken POSIX
* broken POSIX non-blocking I/O is AIX 3.2.) If your MUD is freezing but * non-blocking I/O is AIX 3.2.) If your MUD is freezing but you're not sure
* you're not sure why, do NOT use this constant. Use this constant ONLY * why, do NOT use this constant. Use this constant ONLY if you're sure that
* if you're sure that your MUD is freezing because of a non-blocking I/O * your MUD is freezing because of a non-blocking I/O problem. */
* problem.
*
* See running.doc for details.
*/
/* #define POSIX_NONBLOCK_BROKEN */ /* #define POSIX_NONBLOCK_BROKEN */
/**************************************************************************/ /* The code prototypes library functions to avoid compiler warnings. (Operating
* system header files *should* do this, but sometimes don't.) However, Circle's
/* * prototypes cause the compilation to fail under some combinations of operating
* The Circle code prototypes library functions to avoid compiler warnings. * systems and compilers. If your compiler reports "conflicting types" for
* (Operating system header files *should* do this, but sometimes don't.) * functions, you need to define this constant to turn off library function
* However, Circle's prototypes cause the compilation to fail under some * prototyping. Note, **DO** **NOT** blindly turn on this constant unless you
* combinations of operating systems and compilers. * are sure the problem is type conflicts between my header files and the header
* * files of your operating system. The error message will look something like
* If your compiler reports "conflicting types" for functions, you need to * this: In file included from comm.c:14:
* define this constant to turn off library function prototyping. Note,
* **DO** **NOT** blindly turn on this constant unless you're sure the
* problem is type conflicts between my header files and the header files
* of your operating system. The error message will look something like
* this:
*
* In file included from comm.c:14:
* sysdep.h:207: conflicting types for `random' * sysdep.h:207: conflicting types for `random'
* /usr/local/lib/gcc-lib/alpha-dec-osf3.2/2.7.2/include/stdlib.h:253: * /usr/local/lib/gcc-lib/alpha-dec-osf3.2/2.7.2/include/stdlib.h:253:
* previous declaration of `random' * previous declaration of `random' */
*
* See running.doc for details.
*/
/* #define NO_LIBRARY_PROTOTYPES */ /* #define NO_LIBRARY_PROTOTYPES */
/**************************************************************************/ /* If using the GNU C library, version 2+, then you can have it trace memory
* allocations to check for leaks, uninitialized uses, and bogus free() calls.
/* * To see if your version supports it, run:
* If using the GNU C library, version 2+, then you can have it trace
* memory allocations to check for leaks, uninitialized uses, and bogus
* free() calls. To see if your version supports it, run:
*
* info libc 'Allocation Debugging' 'Tracing malloc' * info libc 'Allocation Debugging' 'Tracing malloc'
*
* Example usage (Bourne shell): * Example usage (Bourne shell):
*
* MALLOC_TRACE=/tmp/circle-trace bin/circle * MALLOC_TRACE=/tmp/circle-trace bin/circle
*
* After it finishes:
*
* mtrace bin/circle /tmp/circle-trace
*
* (Stock CircleMUD produces a file approximately 1.5 megabytes in size
* just running in Syntax Check mode.)
*
* NOTE: The GNU C library version 2.1.3 leaks a tiny bit of memory
* by itself. You will see something similar to:
*
* - 0000000000 Free 36910 was never alloc'd /lib/libcrypt.so.1:(fcrypt+0x883)[0x4001b9ef]
*
* Memory not freed:
* -----------------
* Address Size Caller
* 0x080ca830 0xf at /lib/libc.so.6:(__strdup+0x29)[0x400a6a09]
* 0x080ca848 0xc at /lib/libc.so.6:(adjtime+0x25c)[0x400d127c]
* 0x080ca858 0xc at /lib/libc.so.6:(adjtime+0x25c)[0x400d127c]
* 0x080ca868 0xc at /lib/libc.so.6:(adjtime+0x25c)[0x400d127c]
*
* But with GNU C library version 2.2.4:
*
* No memory leaks.
*
* Read the entire "Allocation Debugging" section of the GNU C library * Read the entire "Allocation Debugging" section of the GNU C library
* documentation before setting this to '1'. * documentation before setting this to '1'. */
*/
#define CIRCLE_GNU_LIBC_MEMORY_TRACK 0 /* 0 = off, 1 = on */ #define CIRCLE_GNU_LIBC_MEMORY_TRACK 0 /* 0 = off, 1 = on */
/* Do not change anything below this line. */
/************************************************************************/ /* Set up various machine-specific things based on the values determined from
/*** Do not change anything below this line *****************************/ * configure and conf.h. */
/************************************************************************/
/*
* Set up various machine-specific things based on the values determined
* from configure and conf.h.
*/
/* Standard C headers *************************************************/
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
@ -141,7 +74,6 @@
#include <strings.h> #include <strings.h>
#endif #endif
#if (defined (STDC_HEADERS) || defined (__GNU_LIBRARY__)) #if (defined (STDC_HEADERS) || defined (__GNU_LIBRARY__))
#include <stdlib.h> #include <stdlib.h>
@ -158,8 +90,7 @@ extern void abort (), exit ();
#endif /* Standard headers. */ #endif /* Standard headers. */
/* POSIX compliance *************************************************/ /* POSIX compliance */
#ifdef HAVE_SYS_TYPES_H #ifdef HAVE_SYS_TYPES_H
# include <sys/types.h> # include <sys/types.h>
#endif #endif
@ -197,12 +128,7 @@ extern void abort (), exit ();
#define POSIX_NONBLOCK_BROKEN #define POSIX_NONBLOCK_BROKEN
#endif #endif
/* Header files *******************************************************/
/* Header files common to all source files */ /* Header files common to all source files */
#ifdef HAVE_LIMITS_H #ifdef HAVE_LIMITS_H
#include <limits.h> #include <limits.h>
#endif #endif
@ -241,9 +167,7 @@ extern void abort (), exit ();
#define assert(arg) #define assert(arg)
#endif #endif
/* Header files only used in comm.c and some of the utils */ /* Header files only used in comm.c and some of the utils */
#if defined(__COMM_C__) || defined(CIRCLE_UTIL) #if defined(__COMM_C__) || defined(CIRCLE_UTIL)
#ifndef HAVE_STRUCT_IN_ADDR #ifndef HAVE_STRUCT_IN_ADDR
@ -304,7 +228,6 @@ struct in_addr {
#endif /* __COMM_C__ && CIRCLE_UNIX */ #endif /* __COMM_C__ && CIRCLE_UNIX */
/* Header files that are only used in act.other.c */ /* Header files that are only used in act.other.c */
#ifdef __ACT_OTHER_C__ #ifdef __ACT_OTHER_C__
@ -314,9 +237,7 @@ struct in_addr {
#endif /* __ACT_OTHER_C__ */ #endif /* __ACT_OTHER_C__ */
/* Basic system dependencies. */
/* Basic system dependencies *******************************************/
#if CIRCLE_GNU_LIBC_MEMORY_TRACK && !defined(HAVE_MCHECK_H) #if CIRCLE_GNU_LIBC_MEMORY_TRACK && !defined(HAVE_MCHECK_H)
#error "Cannot use GNU C library memory tracking without <mcheck.h>" #error "Cannot use GNU C library memory tracking without <mcheck.h>"
#endif #endif
@ -373,9 +294,7 @@ struct in_addr {
#elif defined(CIRCLE_VMS) #elif defined(CIRCLE_VMS)
/* /* Necessary Definitions For DEC C With DEC C Sockets Under OpenVMS. */
* Necessary Definitions For DEC C With DEC C Sockets Under OpenVMS.
*/
# if defined(DECC) # if defined(DECC)
# include <stdio.h> # include <stdio.h>
# include <time.h> # include <time.h>
@ -410,7 +329,6 @@ struct in_addr {
#endif #endif
#endif #endif
/* Make sure we have STDERR_FILENO */ /* Make sure we have STDERR_FILENO */
#ifndef STDERR_FILENO #ifndef STDERR_FILENO
#define STDERR_FILENO 2 #define STDERR_FILENO 2
@ -425,50 +343,15 @@ struct in_addr {
# include "bsd-snprintf.h" # include "bsd-snprintf.h"
#endif #endif
/* Function prototypes ************************************************/ /* Function prototypes. */
/* Header files of many OS's do not contain function prototypes for the
/* * standard C library functions. This produces annoying warning messages
* For reasons that perplex me, the header files of many OS's do not contain * (sometimes, a lot of them) on such OS's when compiling with gcc's -Wall.
* function prototypes for the standard C library functions. This produces
* annoying warning messages (sometimes, a huge number of them) on such OS's
* when compiling with gcc's -Wall.
* *
* Some versions of CircleMUD prior to 3.0 patchlevel 9 attempted to * Configuration script has been changed to detect which prototypes exist
* include prototypes taken from OS man pages for a large number of * already; this header file only prototypes functions that aren't already
* OS's in the header files. I now think such an approach is a bad * prototyped by the system headers. A clash should be impossible. This
* idea: maintaining that list is very difficult and time-consuming, * should give us our strong type-checking back. */
* and when new revisions of OS's are released with new header files,
* Circle can break if the prototypes contained in Circle's .h files
* differs from the new OS header files; for example, Circle 3.0
* patchlevel 8 failed with compiler errors under Solaris 2.5 and
* Linux 1.3.xx whereas under previous revisions of those OS's it had
* been fine.
*
* Thus, to silence the compiler warnings but still maintain some level of
* portability (albiet at the expense of worse error checking in the code),
* my solution is to define a "typeless" function prototype for all problem
* functions that have not already been prototyped by the OS. --JE
*
* 20 Mar 96: My quest is not yet over. These definitions still cause
* clashes with some compilers. Therefore, we only use these prototypes
* if we're using gcc (which makes sense, since they're only here for gcc's
* -Wall option in the first place), and configure tells gcc to use
* -fno-strict-prototypes, so that these definitions don't clash with
* previous prototypes.
*
* 4 June 96: The quest continues. OSF/1 still doesn't like these
* prototypes, even with gcc and -fno-strict-prototypes. I've created
* the constant NO_LIBRARY_PROTOTYPES to allow people to turn off the
* prototyping.
*
* 27 Oct 97: This is driving me crazy but I think I've finally come
* up with the solution that will work. I've changed the configure
* script to detect which prototypes exist already; this header file
* only prototypes functions that aren't already prototyped by the
* system headers. A clash should be impossible. This should give us
* our strong type-checking back. This should be the last word on
* this issue!
*/
#ifndef NO_LIBRARY_PROTOTYPES #ifndef NO_LIBRARY_PROTOTYPES
@ -480,12 +363,10 @@ struct in_addr {
long atol(const char *str); long atol(const char *str);
#endif #endif
/* /* bzero is deprecated - use memset() instead. This prototype is needed for
* bzero is deprecated - use memset() instead. Not directly used in Circle * FD_xxx macros on some machines. */
* but the prototype needed for FD_xxx macros on some machines.
*/
#ifdef NEED_BZERO_PROTO #ifdef NEED_BZERO_PROTO
// void bzero(char *b, int length); void bzero(char *b, int length);
#endif #endif
#ifdef NEED_CRYPT_PROTO #ifdef NEED_CRYPT_PROTO
@ -505,7 +386,7 @@ struct in_addr {
#endif #endif
#ifdef NEED_FPRINTF_PROTO #ifdef NEED_FPRINTF_PROTO
// int fprintf(FILE *strm, const char *format, /* args */ ... ); int fprintf(FILE *strm, const char *format, /* args */ ... );
#endif #endif
#ifdef NEED_FREAD_PROTO #ifdef NEED_FREAD_PROTO
@ -542,11 +423,11 @@ struct in_addr {
#endif #endif
#ifdef NEED_SPRINTF_PROTO #ifdef NEED_SPRINTF_PROTO
// int sprintf(char *s, const char *format, /* args */ ... ); int sprintf(char *s, const char *format, /* args */ ... );
#endif #endif
#ifdef NEED_SSCANF_PROTO #ifdef NEED_SSCANF_PROTO
// int sscanf(const char *s, const char *format, ...); int sscanf(const char *s, const char *format, ...);
#endif #endif
#ifdef NEED_STRDUP_PROTO #ifdef NEED_STRDUP_PROTO
@ -578,7 +459,6 @@ struct in_addr {
#endif #endif
/* Function prototypes that are only used in comm.c and some of the utils */ /* Function prototypes that are only used in comm.c and some of the utils */
#if defined(__COMM_C__) || defined(CIRCLE_UTIL) #if defined(__COMM_C__) || defined(CIRCLE_UTIL)
#ifdef NEED_ACCEPT_PROTO #ifdef NEED_ACCEPT_PROTO
@ -606,7 +486,7 @@ struct in_addr {
#endif #endif
#ifdef NEED_FPUTS_PROTO #ifdef NEED_FPUTS_PROTO
// int fputs(const char *s, FILE *stream); int fputs(const char *s, FILE *stream);
#endif #endif
#ifdef NEED_GETPEERNAME_PROTO #ifdef NEED_GETPEERNAME_PROTO
@ -654,7 +534,7 @@ struct in_addr {
#endif #endif
#ifdef NEED_PRINTF_PROTO #ifdef NEED_PRINTF_PROTO
// int printf(char *format, ...); int printf(char *format, ...);
#endif #endif
#ifdef NEED_READ_PROTO #ifdef NEED_READ_PROTO
@ -690,5 +570,4 @@ struct in_addr {
#endif /* __COMM_C__ */ #endif /* __COMM_C__ */
#endif /* NO_LIBRARY_PROTOTYPES */ #endif /* NO_LIBRARY_PROTOTYPES */

View file

@ -1,9 +1,9 @@
/* /**************************************************************************
* Originally written by: Michael Scott -- Manx. * File: tedit.c Part of tbaMUD *
* Last known e-mail address: scottm@workcomm.net * Usage: Oasis OLC - Text files. *
* * *
* XXX: This needs Oasis-ifying. * By Michael Scott [Manx]. *
*/ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"

View file

@ -18,7 +18,7 @@
#define MAX_PWD_LENGTH 30 /* Used in char_file_u *DO*NOT*CHANGE* */ #define MAX_PWD_LENGTH 30 /* Used in char_file_u *DO*NOT*CHANGE* */
#define MAX_TITLE_LENGTH 80 /* Used in char_file_u *DO*NOT*CHANGE* */ #define MAX_TITLE_LENGTH 80 /* Used in char_file_u *DO*NOT*CHANGE* */
#define HOST_LENGTH 30 /* Used in char_file_u *DO*NOT*CHANGE* */ #define HOST_LENGTH 40 /* Used in char_file_u *DO*NOT*CHANGE* */
#define PLR_DESC_LENGTH 512 /* Used in char_file_u *DO*NOT*CHANGE* */ #define PLR_DESC_LENGTH 512 /* Used in char_file_u *DO*NOT*CHANGE* */
#define MAX_TONGUE 3 /* Used in char_file_u *DO*NOT*CHANGE* */ #define MAX_TONGUE 3 /* Used in char_file_u *DO*NOT*CHANGE* */
#define MAX_SKILLS 200 /* Used in char_file_u *DO*NOT*CHANGE* */ #define MAX_SKILLS 200 /* Used in char_file_u *DO*NOT*CHANGE* */

View file

@ -1,12 +1,12 @@
/* ************************************************************************ /**************************************************************************
* File: utils.c Part of CircleMUD * * File: utils.c Part of tbaMUD *
* Usage: various internal functions of a utility nature * * Usage: Various internal functions of a utility nature. *
* * * *
* All rights reserved. See license.doc for complete information. * * All rights reserved. See license 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. *
************************************************************************ */ **************************************************************************/
#include "conf.h" #include "conf.h"
#include "sysdep.h" #include "sysdep.h"
@ -342,7 +342,6 @@ time_t mud_time_to_secs(struct time_info_data *now)
when += now->month * SECS_PER_MUD_MONTH; when += now->month * SECS_PER_MUD_MONTH;
when += now->day * SECS_PER_MUD_DAY; when += now->day * SECS_PER_MUD_DAY;
when += now->hours * SECS_PER_MUD_HOUR; when += now->hours * SECS_PER_MUD_HOUR;
return (time(NULL) - when); return (time(NULL) - when);
} }

Some files were not shown because too many files have changed in this diff Show more