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
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
Stopped Checking abbrevs with doors so players can't spam open a, open b, etc.
Added questpoints!
[Mar 30 2007] - Rumble
Added unlimited fountains and containers (Thanks Adam Scriven).
@ -14,7 +20,6 @@ tbaMUD 3.52
[Mar 25 2007] - Rumble
Updated idle timer to keep track of imms too (thanks Jamdog).
Standardized OLC messages.
Removed special procedures that were replaced with trigedit.
Updated README.WIN, README.MSVC8, and README.CYGWIN.
[Mar 20 2007] - Rumble
Added object type FURNITURE (thanks Dark).

View file

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

View file

@ -1,78 +1,75 @@
(lib/text/news)
THE tbaMUD HERALD
THE 2007 tbaMUD HERALD
"We addict players for their own enjoyment."
February, 2007
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.
** Improved toggle command allowing more options.
** You can now use the history command to see the last 100 communications
from all the channels. It clears upon viewing or log off.
** You can now use the history command to see a log of all channels.
** 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
who.
** NEW AFK toggle that displays in your prompt, under who, and when people
look at the room.
** You now have almost 180 stock zones to play.
** You can now interact with rooms, mobs, and objects through triggers.
** Multiple objects will now be stacked and preceeded by a quantity so
your inventory won't be as long. (3) A waybread.
** Multiple objects will now be stacked and preceeded by a quantity so your
inventory won't be as long. i.e. (3) A waybread.
** Over 100 new socials, and the gemote command to use socials over the
gossip channel. Socials can now target bodyparts too, behave.
** Over 100 new socials, and the gemote command to use socials over the gossip
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.
** Added new invisible mobs and objects so everything may not be as it
appears (not even visible with detect invis).
** Added new invisible mobs and objects so everything may not be as it appears
(not even visible with detect invis and sense life).
** Added an online dictionary. Tell m-w <word>.
** The player description length has been increased so please write a
decent description for yourself.
** The player description length has been increased so please write a decent
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,
some things may still be hidden and require further investigation.
** You can now use "all" and "all.x" very generally with the get, put,
drop, junk, donate, give, wear and remove commands. Type HELP GET
for more info.
** You can now use "all" and "all.x" very generally with the get, put, drop,
junk, donate, give, wear and remove commands. Type HELP GET for more info.
** The "track" function will show you the first step on the shortest
path to anyone in the game.
** The "track" function will show you the first step on the shortest path to
anyone in the game.
** You can now remove your own messages from the board. Also, if you
put someone else's name in parentheses in the message header, they
will be able to remove the message too.
** You can now remove your own messages from the board. Also, if you put
someone else's name in parentheses in the message header, they will be
able to remove the message too.
** The MIDGAARD MAIL SYSTEM is now complete. The Post Office is north
of the entrance to the Grunting Boar inn. Stamps cost 150 coins.
** The MIDGAARD MAIL SYSTEM is now complete. The Post Office is north of the
entrance to the Grunting Boar inn. Stamps cost 150 coins.
** Fountains have now been implemented. You can drink from fountains
or fill containers from fountains using the FILL command.
** Fountains have now been implemented. You can drink from fountains or fill
containers from fountains using the FILL command.
** The SHOUT command, as always, only reaches people in your zone (you
can see who these people are by typing WHERE). The HOLLER command
reaches everyone in the game but costs extra movement points.
** The SHOUT command, as always, only reaches people in your zone (you can see
who these people are by typing WHERE). The HOLLER command reaches everyone
in the game but costs extra movement points.
** When you are writing a message, you will now not be interrupted
by tells, shouts, emotes, socials, and even people talking in the
same room.
** When you are writing a message, you will now not be interrupted by tells,
shouts, emotes, socials, and even people talking in the same room.
*****************************************************************************
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.
*****************************************************************************
** Use the ASSIST command to engage in mortal combat with someone in the
room who is getting pummeled.
** Use the ASSIST command to engage in mortal combat with someone in the room
who is getting pummeled.
** 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

View file

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

View file

@ -1,12 +1,12 @@
/* ************************************************************************
* File: act.comm.c Part of CircleMUD *
* Usage: Player-level communication commands *
/**************************************************************************
* File: act.comm.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.h"
#include "sysdep.h"

View file

@ -1,12 +1,12 @@
/* ************************************************************************
* File: act.informative.c Part of CircleMUD *
* Usage: Player-level commands of an informative nature *
/**************************************************************************
* File: act.informative.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.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
* 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
* <angus@EDGIL.CCMAIL.COMPUSERVE.COM> for the suggested fix to this problem. */
* the name. Then check local objs for exdescs. Thanks to Angus Mezick for
* the suggested fix to this problem. */
void look_at_target(struct char_data *ch, char *arg)
{
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 ? "pm" : "am", weekdays[weekday]);
/* Peter Ajamian <peter@PAJAMIAN.DHS.ORG> supplied the following as a fix
* for a bug introduced in the ordinal display that caused 11, 12, and 13
* to be incorrectly displayed as 11st, 12nd, and 13rd. Nate Winters
* <wintersn@HOTMAIL.COM> had already submitted a fix, but it hard-coded a
* limit on ordinal display which I want to avoid. -dak */
/* Peter Ajamian supplied the following as a fix for a bug introduced in the
* ordinal display that caused 11, 12, and 13 to be incorrectly displayed as
* 11st, 12nd, and 13rd. Nate Winters had already submitted a fix, but it
* hard-coded a limit on ordinal display which I want to avoid. -dak */
suf = "th";
if (((day % 100) / 10) != 1) {
@ -1493,7 +1492,7 @@ ACMD(do_gen_ps)
send_to_char(ch, "\033[H\033[J");
break;
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", DG_SCRIPT_VERSION);
send_to_char(ch, "%s\r\n", ascii_pfiles_version);
@ -1503,14 +1502,12 @@ ACMD(do_gen_ps)
break;
default:
log("SYSERR: Unhandled case in do_gen_ps. (%d)", subcmd);
/* SYSERR_DESC:
* General page string function for such things as 'credits', 'news',
* 'wizlist', 'clear', 'version'. This occurs when a call is made to
* this routine that is not one of the predefined calls. To correct
* it, either a case needs to be added into the function to account for
* the subcmd that is being passed to it, or the call to the function
* needs to have the correct subcmd put into place.
*/
/* SYSERR_DESC: General page string function for such things as 'credits',
* 'news', 'wizlist', 'clear', 'version'. This occurs when a call is made
* to this routine that is not one of the predefined calls. To correct it,
* either a case needs to be added into the function to account for the
* subcmd that is being passed to it, or the call to the function needs to
* have the correct subcmd put into place. */
return;
}
}

View file

@ -1,12 +1,12 @@
/* ************************************************************************
* File: act.item.c Part of CircleMUD *
* Usage: object handling routines -- get/drop and container handling *
/**************************************************************************
* File: act.item.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.h"
#include "sysdep.h"

View file

@ -1,12 +1,12 @@
/* ************************************************************************
* File: act.movement.c Part of CircleMUD *
* Usage: movement commands, door handling, & sleep/rest/etc state *
/**************************************************************************
* File: act.movement.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.h"
#include "sysdep.h"

View file

@ -1,12 +1,12 @@
/* ************************************************************************
* File: act.offensive.c Part of CircleMUD *
* Usage: player-level commands of an offensive nature *
/**************************************************************************
* File: act.offensive.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.h"
#include "sysdep.h"

View file

@ -1,12 +1,12 @@
/* ************************************************************************
* File: act.other.c *
* Usage: Miscellaneous player-level commands *
/**************************************************************************
* File: act.other.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#define __ACT_OTHER_C__

View file

@ -1,17 +1,15 @@
/* ************************************************************************
* File: act.social.c Part of CircleMUD *
* Usage: Functions to handle socials *
/**************************************************************************
* File: act.social.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"

View file

@ -1,12 +1,12 @@
/**************************************************************************
* File: act.wizard.c Part of CircleMUD *
* Usage: Player-level god commands and other goodies *
* File: act.wizard.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.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)
return (location);
@ -718,9 +718,6 @@ void do_stat_object(struct char_data *ch, struct obj_data *j)
case ITEM_ARMOR:
send_to_char(ch, "AC-apply: [%d]\r\n", GET_OBJ_VAL(j, 0));
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:
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",
@ -1800,34 +1797,32 @@ struct last_entry *find_llog_entry(int punique, long idnum) {
int size,recs,tmp;
if(!(fp=fopen(LAST_FILE,"r"))) {
log("error opening last_file for reading");
log("Error opening last_file for reading, will create.");
return NULL;
}
fseek(fp,0L,SEEK_END);
size=ftell(fp);
/* recs = number of records in the last file */
recs = size/sizeof(struct last_entry);
/* we'll search last to first, since it's faster than any thing else
we can do (like searching for the last shutdown/etc..) */
/* we'll search last to first, since it's faster than any thing else we can
* do (like searching for the last shutdown/etc..) */
for(tmp=recs-1; tmp > 0; tmp--) {
fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR);
fread(&mlast,sizeof(struct last_entry),1,fp);
/*another one to keep that stepback */
fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR);
if(mlast.idnum == idnum &&
mlast.punique == punique) {
/* then we've found a match */
if(mlast.idnum == idnum && mlast.punique == punique) {
/* then we've found a match */
CREATE(llast,struct last_entry,1);
memcpy(llast,&mlast,sizeof(struct last_entry));
fclose(fp);
return llast;
}
/*not the one we seek. next */
/*not the one we seek. next */
}
/*not found, no problem, quit */
/*not found, no problem, quit */
fclose(fp);
return NULL;
}
@ -1839,14 +1834,13 @@ void mod_llog_entry(struct last_entry *llast,int type) {
int size,recs,tmp;
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;
}
fseek(fp,0L,SEEK_END);
size=ftell(fp);
/* recs = number of records in the last file */
recs = size/sizeof(struct last_entry);
/* We'll search last to first, since it's faster than any thing else we can
@ -1854,31 +1848,29 @@ void mod_llog_entry(struct last_entry *llast,int type) {
for(tmp=recs; tmp > 0; tmp--) {
fseek(fp,-1*(sizeof(struct last_entry)),SEEK_CUR);
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);
if(mlast.idnum == llast->idnum &&
mlast.punique == llast->punique) {
/* then we've found a match */
/* lets assume quit is inviolate, mainly because
disconnect is called after each of these */
if(mlast.idnum == llast->idnum && mlast.punique == llast->punique) {
/* Then we've found a match, lets assume quit is inviolate, mainly
* because disconnect is called after each of these */
if(mlast.close_type != LAST_QUIT &&
mlast.close_type != LAST_IDLEOUT &&
mlast.close_type != LAST_REBOOT &&
mlast.close_type != LAST_SHUTDOWN) {
mlast.close_type != LAST_IDLEOUT &&
mlast.close_type != LAST_REBOOT &&
mlast.close_type != LAST_SHUTDOWN) {
mlast.close_type=type;
}
mlast.close_time=time(0);
/*write it, and we're done!*/
/*write it, and we're done!*/
fwrite(&mlast,sizeof(struct last_entry),1,fp);
fclose(fp);
return;
}
/*not the one we seek. next */
/* Not the one we seek, next. */
}
fclose(fp);
/*not found, no problem, quit */
/* Not found, no problem, quit. */
return;
}
@ -1971,12 +1963,8 @@ ACMD(do_list_llog_entries) {
fread(&llast, sizeof(struct last_entry), 1, fp);
while(!feof(fp)) {
send_to_char(ch,
"%10s\t%d\t%s\t%s",
llast.username,
llast.punique,
last_array[llast.close_type],
ctime(&llast.time));
send_to_char(ch, "%10s\t%d\t%s\t%s", llast.username, llast.punique,
last_array[llast.close_type], ctime(&llast.time));
fread(&llast, sizeof(struct last_entry), 1, fp);
}
}
@ -2711,7 +2699,7 @@ ACMD(do_show)
{ "frozen", LVL_GRGOD, PC, BINARY }, /* 15 */
{ "gold", LVL_BUILDER, BOTH, NUMBER },
{ "height", LVL_BUILDER, BOTH, NUMBER },
{ "hit", LVL_BUILDER, BOTH, NUMBER },
{ "hitpoints", LVL_BUILDER, BOTH, NUMBER },
{ "hitroll", LVL_BUILDER, BOTH, NUMBER },
{ "hunger", LVL_BUILDER, BOTH, MISC }, /* 20 */
{ "int", LVL_BUILDER, BOTH, NUMBER },
@ -3966,7 +3954,7 @@ ACMD(do_checkloadstatus)
}
/* Zone Checker code above. */
/* (c) 1996-97 Erwin S. Andreasen <erwin@pip.dknet.dk> */
/* (c) 1996-97 Erwin S. Andreasen. */
ACMD(do_copyover)
{
FILE *fp;

View file

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

View file

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

View file

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

View file

@ -1,53 +1,35 @@
/* ************************************************************************
* File: boards.c Part of CircleMUD *
* Usage: handling of multiple bulletin boards *
/**************************************************************************
* File: boards.c Part of tbaMUD *
* 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 *
* 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 "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"
@ -60,10 +42,8 @@ TO ADD A NEW BOARD, simply follow our easy 4-step program:
/* Board appearance order. */
#define NEWEST_AT_TOP FALSE
/*
format: vnum, read lvl, write lvl, remove lvl, filename, 0 at end
Be sure to also change NUM_OF_BOARDS in board.h
*/
/* Format: vnum, read lvl, write lvl, remove lvl, filename, 0 at end. Be sure
* to also change NUM_OF_BOARDS in board.h*/
struct board_info_type board_info[NUM_OF_BOARDS] = {
{3099, 0, 0, LVL_GOD, LIB_ETC "board.mortal", 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 ACMD_READ, ACMD_LOOK, ACMD_EXAMINE, ACMD_WRITE, ACMD_REMOVE;
struct board_msginfo msg_index[NUM_OF_BOARDS][MAX_BOARD_MESSAGES];
void Board_reset_board(int board_type);
void Board_clear_board(int board_type);
void board_reset_board(int board_type);
void board_clear_board(int board_type);
int find_slot(void)
{
@ -100,7 +79,6 @@ int find_slot(void)
return (-1);
}
/* search the room ch is standing in to find which board he's looking at */
int find_board(struct char_data *ch)
{
@ -121,7 +99,6 @@ int find_board(struct char_data *ch)
return (-1);
}
void init_boards(void)
{
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));
msg_index[i][j].slot_num = -1;
}
Board_load_board(i);
board_load_board(i);
}
// if (fatal_error)
// exit(1);
if (fatal_error)
exit(1);
}
SPECIAL(gen_board)
{
int board_type;
@ -178,19 +154,18 @@ SPECIAL(gen_board)
return (0);
}
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)
return (Board_show_board(board_type, ch, argument, board));
return (board_show_board(board_type, ch, argument, board));
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)
return (Board_remove_msg(board_type, ch, argument, board));
return (board_remove_msg(board_type, ch, argument, board));
else
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;
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);
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';
if (!*arg) {
@ -238,8 +213,7 @@ int Board_write_message(int board_type, struct char_data *ch, char *arg, struct
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;
char tmp[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH];
@ -300,8 +274,7 @@ fubar:
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];
int msg, ind;
@ -310,7 +283,7 @@ int Board_display_msg(int board_type, struct char_data *ch, char *arg, struct ob
if (!*number)
return (0);
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 */
return (0);
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);
}
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;
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");
snprintf(buf, sizeof(buf), "$n just removed message %d.", msg);
act(buf, FALSE, ch, 0, 0, TO_ROOM);
Board_save_board(board_type);
board_save_board(board_type);
return (1);
}
void Board_save_board(int board_type)
void board_save_board(int board_type)
{
FILE *fl;
int i;
@ -470,8 +441,7 @@ void Board_save_board(int board_type)
fclose(fl);
}
void Board_load_board(int board_type)
void board_load_board(int board_type)
{
FILE *fl;
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);
if (num_of_msgs[board_type] < 1 || num_of_msgs[board_type] > MAX_BOARD_MESSAGES) {
log("SYSERR: Board file %d corrupt. Resetting.", board_type);
Board_reset_board(board_type);
board_reset_board(board_type);
return;
}
for (i = 0; i < num_of_msgs[board_type]; i++) {
fread(&(msg_index[board_type][i]), sizeof(struct board_msginfo), 1, fl);
if ((len1 = msg_index[board_type][i].heading_len) <= 0) {
log("SYSERR: Board file %d corrupt! Resetting.", board_type);
Board_reset_board(board_type);
board_reset_board(board_type);
return;
}
CREATE(tmp1, char, len1);
@ -501,7 +471,7 @@ void Board_load_board(int board_type)
if ((MSG_SLOTNUM(board_type, i) = find_slot()) == -1) {
log("SYSERR: Out of slots booting board %d! Resetting...", board_type);
Board_reset_board(board_type);
board_reset_board(board_type);
return;
}
if ((len2 = msg_index[board_type][i].message_len) > 0) {
@ -515,19 +485,17 @@ void Board_load_board(int board_type)
fclose(fl);
}
/* When shutting down, clear all boards. */
void Board_clear_all(void)
void board_clear_all(void)
{
int i;
for (i = 0; i < NUM_OF_BOARDS; i++)
Board_clear_board(i);
board_clear_board(i);
}
/* Clear the in-memory structures. */
void Board_clear_board(int board_type)
void board_clear_board(int board_type)
{
int i;
@ -545,10 +513,9 @@ void Board_clear_board(int board_type)
num_of_msgs[board_type] = 0;
}
/* 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));
}

View file

@ -1,12 +1,12 @@
/* ************************************************************************
* File: boards.h Part of CircleMUD *
/**************************************************************************
* File: boards.h Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#define NUM_OF_BOARDS 10 /* 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_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_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_write_message(int board_type, struct char_data *ch, char *arg, struct obj_data *board);
void Board_save_board(int board_type);
void Board_load_board(int board_type);
void Board_clear_all(void);
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_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);
void board_save_board(int board_type);
void board_load_board(int board_type);
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().
*
* --- 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< ---
* Remaining components of the software are provided under a standard

View file

@ -1,18 +1,15 @@
/* ************************************************************************
* File: castle.c Part of CircleMUD *
* Usage: Special procedures for King's Castle area *
/**************************************************************************
* File: castle.c Part of tbaMUD *
* 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) *
* Coded by Sapowox (d90-jkr@nada.kth.se) *
* Special procedures for Kings Castle by Pjotr. Coded by Sapowox. *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"
@ -21,16 +18,11 @@
#include "db.h"
#include "spells.h"
/* IMPORTANT!
The below defined number is the zone number of the Kings Castle.
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... */
/* IMPORTANT! The below defined number is the zone number of the Kings Castle.
* Change it to apply to your chosen zone number. The default zone number
* is 80. */
#define Z_KINGS_C 150
/* external variables */
extern struct time_info_data time_info;
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);
void castle_mob_spec(mob_vnum mobnum, SPECIAL(*specproc));
/**********************************************************************\
|* Special procedures for Kings Castle by Pjotr (d90-pem@nada.kth.se) *|
|* Coded by Sapowox (d90-jkr@nada.kth.se) *|
\**********************************************************************/
/* Special procedures for Kings Castle by Pjotr. Coded by Sapowox. */
SPECIAL(CastleGuard);
SPECIAL(James);
SPECIAL(cleaning);
@ -73,12 +60,8 @@ SPECIAL(guild);
ACMD(do_gen_door);
ACMD(do_follow);
/*
* Assign castle special procedures.
*
* NOTE: The mobile number isn't fully specified. It's only an offset
* from the zone's base.
*/
/* Assign castle special procedures. 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))
{
mob_vnum vmv = castle_virtual(mobnum);
@ -90,16 +73,13 @@ void castle_mob_spec(mob_vnum mobnum, SPECIAL(*specproc))
if (rmr == NOBODY) {
if (!mini_mud)
log("SYSERR: assign_kings_castle(): can't find mob #%d.", vmv);
/* SYSERR_DESC:
* When the castle_mob_spec() function is given a mobnum that
* does not correspond to a mod loaded (when not in minimud mode),
* this error will result.
*/
/* SYSERR_DESC: When the castle_mob_spec() function is given a mobnum
* that does not correspond to a mod loaded (when not in minimud mode),
* this error will result. */
} else
mob_index[rmr].func = specproc;
}
mob_vnum castle_virtual(mob_vnum offset)
{
zone_rnum zon;
@ -110,7 +90,6 @@ mob_vnum castle_virtual(mob_vnum offset)
return zone_table[zon].bot + offset;
}
room_rnum castle_real_room(room_vnum roomoffset)
{
zone_rnum zon;
@ -121,17 +100,11 @@ room_rnum castle_real_room(room_vnum 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)
{
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(3, CastleGuard); /* Jim */
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(20, tim); /* Tim, Tom's twin */
castle_mob_spec(21, tom); /* Tom, Tim's twin */
castle_mob_spec(24, DicknDavid); /* Dick, guard of the
* Treasury */
castle_mob_spec(24, DicknDavid); /* Dick, guard of the Treasury */
castle_mob_spec(25, DicknDavid); /* David, Dicks brother */
castle_mob_spec(26, jerry); /* Jerry, the Gambler */
castle_mob_spec(27, CastleGuard); /* Michael */
@ -157,13 +129,8 @@ void assign_kings_castle(void)
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 ch_num;
@ -188,13 +155,8 @@ int member_of_staff(struct char_data *chChar)
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 ch_num;
@ -216,13 +178,8 @@ int member_of_royal_guard(struct char_data *chChar)
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,
const char *pszName, int iLen)
{
@ -235,13 +192,8 @@ struct char_data *find_npc_by_name(struct char_data *chAtChar,
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 *ch;
@ -253,14 +205,9 @@ struct char_data *find_guard(struct char_data *chAtChar)
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 characters and King Welmar...
*/
/* 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
* characters and King Welmar... */
struct char_data *get_victim(struct char_data *chAtChar)
{
struct char_data *ch;
@ -295,13 +242,8 @@ struct char_data *get_victim(struct char_data *chAtChar)
return (NULL);
}
/*
* Function: banzaii
*
* Makes a character banzaii on attackers of the castle staff.
* Used by Guards, Tim, Tom, Dick, David, Peter, Master, King and Guards.
*/
/* Banzaii. Makes a character banzaii on attackers of the castle staff. Used
* by Guards, Tim, Tom, Dick, David, Peter, Master, and the King. */
int banzaii(struct char_data *ch)
{
struct char_data *chOpponent;
@ -315,13 +257,7 @@ int banzaii(struct char_data *ch)
return (TRUE);
}
/*
* Function: do_npc_rescue
*
* Makes ch_hero rescue ch_victim.
* Used by Tim and Tom
*/
/* 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)
{
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);
}
/*
* 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 iProhibited_direction)
{
@ -373,11 +306,8 @@ int block_way(struct char_data *ch, int cmd, char *arg, room_vnum iIn_room,
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)
{
if (!OBJWEAR_FLAGGED(i, ITEM_WEAR_TAKE))
@ -389,13 +319,8 @@ int is_trash(struct obj_data *i)
return (FALSE);
}
/*
* Function: fry_victim
*
* Finds a suitabe victim, and cast some _NASTY_ spell on him.
* Used by King Welmar
*/
/* Fry_victim. Finds a suitabe victim, and cast some _NASTY_ spell on him. Used
* by King Welmar. */
void fry_victim(struct char_data *ch)
{
struct char_data *tch;
@ -439,13 +364,7 @@ void fry_victim(struct char_data *ch)
return;
}
/*
* Function: king_welmar
*
* Control the actions and movements of the King.
* Used by King Welmar.
*/
/* King_welmar. Control the actions and movements of the King. */
SPECIAL(king_welmar)
{
char actbuf[MAX_INPUT_LENGTH];
@ -560,14 +479,9 @@ SPECIAL(king_welmar)
return (FALSE);
}
/*
* Function: training_master
*
* Acts actions to the training room, if his students are present.
* Also allowes warrior-class to practice.
* Used by the Training Master.
*/
/* Training_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)
{
struct char_data *pupil1, *pupil2 = NULL, *tch;
@ -653,7 +567,6 @@ SPECIAL(training_master)
return (FALSE);
}
SPECIAL(tom)
{
return castle_twin_proc(ch, cmd, argument, 48, "Tim");
@ -664,9 +577,7 @@ SPECIAL(tim)
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)
{
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 make sure he _can_ carry it...
*/
/* Routine for James the Butler. Complains if he finds any trash. This doesn't
* make sure he _can_ carry it. */
SPECIAL(James)
{
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)
{
struct obj_data *i;
@ -735,22 +640,13 @@ int castle_cleaner(struct char_data *ch, int cmd, int gripe)
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)
{
return castle_cleaner(ch, cmd, FALSE);
}
/*
* Routine: CastleGuard
*
* Standard routine for ordinary castle guards.
*/
/* CastleGuard. Standard routine for ordinary castle guards. */
SPECIAL(CastleGuard)
{
if (cmd || !AWAKE(ch) || (GET_POS(ch) == POS_FIGHTING))
@ -759,12 +655,7 @@ SPECIAL(CastleGuard)
return (banzaii(ch));
}
/*
* Routine: DicknDave
*
* Routine for the guards Dick and David.
*/
/* DicknDave. Routine for the guards Dick and David. */
SPECIAL(DicknDavid)
{
if (!AWAKE(ch))
@ -776,11 +667,7 @@ SPECIAL(DicknDavid)
return (block_way(ch, cmd, argument, castle_virtual(36), 1));
}
/*
* Routine: peter
* Routine for Captain of the Guards.
*/
/*Peter. Routine for Captain of the Guards. */
SPECIAL(peter)
{
struct char_data *ch_guard = NULL;
@ -843,11 +730,8 @@ SPECIAL(peter)
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)
{
struct char_data *gambler1, *gambler2 = NULL, *tch;

View file

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

View file

@ -1,12 +1,12 @@
/* ************************************************************************
* File: class.c Part of CircleMUD *
* Usage: Source file for class-specific code *
/**************************************************************************
* File: class.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
/* 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
@ -125,6 +125,28 @@ int prac_params[4][NUM_CLASSES] = {
{ 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
* not forget to change extern declaration in magic.c if you add to this. */
byte saving_throws(int class_num, int type, int level)

View file

@ -1,12 +1,12 @@
/* ************************************************************************
* File: comm.c Part of CircleMUD *
* Usage: Communication, socket handling, main(), central game loop *
/**************************************************************************
* File: comm.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#define __COMM_C__
@ -76,7 +76,7 @@
extern struct ban_list_element *ban_list;
extern int num_invalid;
extern char *GREETINGS;
extern const char *circlemud_version;
extern const char *tbamud_version;
extern const char *oasisolc_version;
extern const char *ascii_pfiles_version;
extern int circle_restrict;
@ -168,9 +168,9 @@ int isbanned(char *hostname);
void weather_and_time(int mode);
int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen);
void free_messages(void);
void Board_clear_all(void);
void board_clear_all(void);
void free_social_messages(void);
void Free_Invalid_List(void);
void free_invalid_list(void);
void free_command_list(void);
void load_config(void);
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.");
break;
case 'h':
/* From: Anil Mahajan <amahajan@proxicom.com> */
/* Do NOT use -C, this is the copyover mode and without
* the proper copyover.dat file, the game will go nuts!
* -spl */
/* From: Anil Mahajan. Do NOT use -C, this is the copyover mode and
* without the proper copyover.dat file, the game will go nuts! */
printf("Usage: %s [-c] [-m] [-q] [-r] [-s] [-d pathname] [port #]\n"
" -c Enable syntax check mode.\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
* in the log if stderr is redirected to a file. */
log("Using %s for configuration.", CONFIG_CONFFILE);
log("%s", circlemud_version);
log("%s", tbamud_version);
log("%s", oasisolc_version);
log("%s", DG_SCRIPT_VERSION);
log("%s", ascii_pfiles_version);
@ -369,12 +367,12 @@ int main(int argc, char **argv)
free_player_index(); /* players.c */
free_messages(); /* fight.c */
free_text_files(); /* db.c */
Board_clear_all(); /* boards.c */
board_clear_all(); /* boards.c */
free(cmd_sort_info); /* act.informative.c */
free_command_list(); /* act.informative.c */
free_social_messages(); /* act.social.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 */
}
@ -594,8 +592,7 @@ socket_t init_socket(ush_int port)
set_sendbuf(s);
/* The GUSI sockets library is derived from BSD, so it defines SO_LINGER, even
* though setsockopt() is unimplimented. (from Dean Takemori
* <dean@UHHEPH.PHYS.HAWAII.EDU>) */
* though setsockopt() is unimplimented. (from Dean Takemori) */
#if defined(SO_LINGER) && !defined(CIRCLE_MACINTOSH)
{
struct linger ld;
@ -979,7 +976,7 @@ void heartbeat(int heart_pulse)
record_usage();
if (!(heart_pulse % PULSE_TIMESAVE))
save_mud_time(&time_info);
save_mud_time(&time_info);
/* Every pulse! Don't want them to stink the place up... */
extract_pending_chars();
@ -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'
* usage. */
/* Add 2 time values. Patch sent by "d. hall" to fix 'static' usage. */
void timeadd(struct timeval *rslt, struct timeval *a, struct timeval *b)
{
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 */
s++; /* s now points to the code */
if (!*s) { /* string was terminated with @ */
@ -1554,7 +1549,6 @@ int new_descriptor(socket_t s)
return (0);
}
/* 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:
* 2 bytes: prepended \r\n
@ -1631,7 +1625,6 @@ int process_output(struct descriptor_data *t)
} else {
/* Not all data in buffer sent. result < output buffersize. */
strcpy(t->output, t->output + result); /* strcpy: OK (overlap) */
t->bufptr -= 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. */
#if defined(CIRCLE_WINDOWS) /* Windows */
if (WSAGetLastError() == WSAEWOULDBLOCK || WSAGetLastError() == WSAEINTR)
return (0);
@ -1857,7 +1849,6 @@ int process_input(struct descriptor_data *t)
return (0);
/* at this point, we know we got some data from the read */
*(read_point + bytes_read) = '\0'; /* terminate the string */
/* search for a newline in the data we just read */
@ -1979,19 +1970,17 @@ int process_input(struct descriptor_data *t)
return (1);
}
/* perform substitution for the '^..^' csh-esque syntax orig is the
* orig string, i.e. the one being modified. subst contains the
* substition string, i.e. "^telm^tell" */
/* Perform substitution for the '^..^' csh-esque syntax orig is the orig string,
* i.e. the one being modified. subst contains the substition string, i.e.
* "^telm^tell" */
int perform_subst(struct descriptor_data *t, char *orig, char *subst)
{
char newsub[MAX_INPUT_LENGTH + 5];
char *first, *second, *strpos;
/*
* first is the position of the beginning of the first string (the one
* to be replaced
*/
/* First is the position of the beginning of the first string (the one to be
* replaced. */
first = subst + 1;
/* now find the second '^' */
@ -2547,13 +2536,13 @@ char *act(const char *str, int hide_invisible, struct char_data *ch,
if (!str || !*str)
return NULL;
/* Warning: the following TO_SLEEP code is a hack.
* I wanted to be able to tell act to deliver a message regardless of sleep
* without adding an additional argument. TO_SLEEP is 128 (a single bit
* high up). It's ONLY legal to combine TO_SLEEP with one other TO_x
* command. It's not legal to combine TO_x's with each other otherwise.
* TO_SLEEP only works because its value "happens to be" a single bit;
* do not change it to something else. In short, it is a hack. */
/* Warning: the following TO_SLEEP code is a hack. I wanted to be able to tell
* act to deliver a message regardless of sleep without adding an additional
* argument. TO_SLEEP is 128 (a single bit high up). It's ONLY legal to
* combine TO_SLEEP with one other TO_x command. It's not legal to combine
* TO_x's with each other otherwise. TO_SLEEP only works because its value
* "happens to be" a single bit; do not change it to something else. In
* short, it is a hack. */
/* check if TO_SLEEP is there, and remove it if it is. */
if ((to_sleeping = (type & TO_SLEEP)))
@ -2678,18 +2667,14 @@ int open_logfile(const char *filename, FILE *stderr_fp)
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)
void circle_sleep(struct timeval *timeout)
{
Sleep(timeout->tv_sec * 1000 + timeout->tv_usec / 1000);
}
#else
void circle_sleep(struct timeval *timeout)
{
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 *
* Usage: header file: prototypes of public communication functions *
/**************************************************************************
* File: comm.h Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#define NUM_RESERVED_DESCS 8
#define COPYOVER_FILE "copyover.dat"

View file

@ -1,13 +1,12 @@
/* ************************************************************************
* File: config.c Part of CircleMUD *
* Usage: Configuration of various aspects of CircleMUD operation *
/**************************************************************************
* File: config.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#define __CONFIG_C__
@ -22,7 +21,7 @@
* this file instead. - Mythran */
/* Below are several constants which you can change to alter certain aspects
* of the way CircleMUD acts. Since this is a .c file, all you have to do
* 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)
* 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
@ -228,7 +227,7 @@ int max_filesize = 50000;
/* Maximum number of password attempts before disconnection. */
int max_bad_pws = 3;
/* Rationale for enabling this, as explained by naved@bird.taponline.com.
/* Rationale for enabling this, as explained by Naved:
* Usually, when you select ban a site, it is because one or two people are
* causing troubles while there are still many people from that site who you
* want to still log on. Right now if I want to add a new select ban, I need

View file

@ -1,19 +1,19 @@
/* ************************************************************************
* File: constants.c Part of CircleMUD *
* Usage: Numeric and string contants used by the MUD *
/**************************************************************************
* File: constants.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#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 *ascii_pfiles_version = "ASCII Player Files 3.0.1";
@ -302,14 +302,14 @@ const char *item_types[] = {
"STAFF",
"WEAPON",
"FURNITURE",
"UNDEFINED",
"FREE",
"TREASURE",
"ARMOR",
"POTION",
"WORN",
"OTHER",
"TRASH",
"TRAP",
"FREE2",
"CONTAINER",
"NOTE",
"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. *
* *
* All rights reserved. See license for complete information. *
* *
* 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 *ascii_pfiles_version;
extern const char *dirs[];

View file

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

View file

@ -1,12 +1,12 @@
/* ************************************************************************
* File: db.c Part of CircleMUD *
* Usage: Loading/saving chars, booting/resetting world, internal funcs *
/**************************************************************************
* File: db.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#define __DB_C__
@ -143,7 +143,7 @@ void update_obj_file(void); /* In objsave.c */
void sort_commands(void);
void sort_spells(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);
int hsort(const void *a, const void *b);
void prune_crlf(char *txt);
@ -715,7 +715,7 @@ void boot_db(void)
}
log("Reading banned site and invalid-name list.");
load_banned();
Read_Invalid_List();
read_invalid_list();
if (!no_rent_check) {
log("Deleting timed-out crash and rent files:");

View file

@ -1,12 +1,12 @@
/* ************************************************************************
* File: db.h Part of CircleMUD *
* Usage: header file for database handling *
/**************************************************************************
* File: db.h Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
/* arbitrary constants used by index_boot() (must be unique) */
#define DB_BOOT_WLD 0
@ -175,22 +175,18 @@ struct reset_com {
char *sarg1; /* string argument */
char *sarg2; /* string argument */
/*
* Commands: *
* 'M': Read a mobile *
* 'O': Read an object *
* 'G': Give obj to mob *
* 'P': Put obj in obj *
* 'G': Obj to char *
* 'E': Obj to char equip *
* 'D': Set state of door *
* 'T': Trigger command *
* 'V': Assign a variable *
*/
/* Commands:
* 'M': Read a mobile
* 'O': Read an object
* 'G': Give obj to mob
* 'P': Put obj in obj
* 'G': Obj to char
* 'E': Obj to char equip
* 'D': Set state of door
* 'T': Trigger command
* 'V': Assign a variable */
};
/* zone definition structure. for the 'zone-table' */
struct zone_data {
char *name; /* name of this zone */
@ -205,35 +201,26 @@ struct zone_data {
zone_vnum number; /* virtual number of this zone */
struct reset_com *cmd; /* command table for reset */
/*
* Reset mode:
/* Reset mode:
* 0: Don't reset, and don't update age.
* 1: Reset if no PC's are located in zone.
* 2: Just reset.
*/
* 2: Just reset. */
};
/* for queueing zones for update */
struct reset_q_element {
zone_rnum zone_to_reset; /* ref to zone_data */
struct reset_q_element *next;
};
/* structure for the update queue */
struct reset_q_type {
struct reset_q_element *head;
struct reset_q_element *tail;
};
/* Added level, flags, and last, primarily for pfile autocleaning. You
can also use them to keep online statistics, and can add race, class,
etc if you like.
*/
/* Added level, flags, and last, primarily for pfile autocleaning. You can also
* use them to keep online statistics, and add race, class, etc if you like. */
struct player_index_element {
char *name;
long id;
@ -242,7 +229,6 @@ struct player_index_element {
time_t last;
};
struct help_index_element {
char *index; /*Future Use */
char *keywords; /*Keyword Place holder and sorter */
@ -251,7 +237,6 @@ struct help_index_element {
int min_level; /*Min Level to read help entry*/
};
/* don't change these */
#define BAN_NOT 0
#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.doc for complete information. *
* All rights reserved. See license for complete information. *
* *
* Death's Gate MUD is based on CircleMUD, Copyright (C) 1993, 94. *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
@ -11,11 +10,10 @@
* $Author: Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ *
* $Revision: 1.0.14 $ *
************************************************************************ */
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "dg_scripts.h"
#include "utils.h"
@ -30,171 +28,163 @@ void sub_write_to_char(char_data *ch, char *tokens[], void *otokens[], char type
/* same as any_one_arg except that it stops at punctuation */
char *any_one_name(char *argument, char *first_arg)
{
char* arg;
char* arg;
/* Find first non blank */
while(isspace(*argument))
argument++;
/* Find first non blank */
while(isspace(*argument))
argument++;
/* Find length of first word */
for(arg = first_arg ;
*argument && !isspace(*argument) &&
(!ispunct(*argument) || *argument == '#' || *argument == '-') ;
arg++, argument++)
*arg = LOWER(*argument);
*arg = '\0';
/* Find length of first word */
for(arg = first_arg ;
*argument && !isspace(*argument) && (!ispunct(*argument) || *argument == '#' || *argument == '-') ;
arg++, argument++)
*arg = LOWER(*argument);
*arg = '\0';
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];
int i;
char sb[MAX_STRING_LENGTH];
int i;
strcpy(sb,"");
for (i = 0; tokens[i + 1]; i++)
{
strcat(sb,tokens[i]);
switch (type[i])
{
case '~':
if (!otokens[i])
strcat(sb,"someone");
else if ((char_data *)otokens[i] == ch)
strcat(sb,"you");
else
strcat(sb,PERS((char_data *)otokens[i], ch));
break;
case '|':
if (!otokens[i])
strcat(sb,"someone's");
else if ((char_data *)otokens[i] == ch)
strcat(sb,"your");
else
{
strcat(sb,PERS((char_data *) otokens[i], ch));
strcat(sb,"'s");
}
break;
case '^':
if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
strcat(sb,"its");
else if (otokens[i] == ch)
strcat(sb,"your");
else
strcat(sb,HSHR((char_data *) otokens[i]));
break;
case '&':
if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
strcat(sb,"it");
else if (otokens[i] == ch)
strcat(sb,"you");
else
strcat(sb,HSSH((char_data *) otokens[i]));
break;
case '*':
if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
strcat(sb,"it");
else if (otokens[i] == ch)
strcat(sb,"you");
else
strcat(sb,HMHR((char_data *) otokens[i]));
break;
case '¨':
if (!otokens[i])
strcat(sb,"something");
else
strcat(sb,OBJS(((obj_data *) otokens[i]), ch));
break;
}
}
strcpy(sb,"");
for (i = 0; tokens[i + 1]; i++) {
strcat(sb,tokens[i]);
strcat(sb,"\n\r");
sb[0] = toupper(sb[0]);
send_to_char(ch, "%s", sb);
}
switch (type[i]) {
case '~':
if (!otokens[i])
strcat(sb,"someone");
else if ((char_data *)otokens[i] == ch)
strcat(sb,"you");
else
strcat(sb,PERS((char_data *)otokens[i], ch));
break;
case '|':
if (!otokens[i])
strcat(sb,"someone's");
else if ((char_data *)otokens[i] == ch)
strcat(sb,"your");
else {
strcat(sb,PERS((char_data *) otokens[i], ch));
strcat(sb,"'s");
}
break;
case '^':
if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
strcat(sb,"its");
else if (otokens[i] == ch)
strcat(sb,"your");
else
strcat(sb,HSHR((char_data *) otokens[i]));
break;
case '&':
if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
strcat(sb,"it");
else if (otokens[i] == ch)
strcat(sb,"you");
else
strcat(sb,HSSH((char_data *) otokens[i]));
break;
case '*':
if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
strcat(sb,"it");
else if (otokens[i] == ch)
strcat(sb,"you");
else
strcat(sb,HMHR((char_data *) otokens[i]));
break;
case '¨':
if (!otokens[i])
strcat(sb,"something");
else
strcat(sb,OBJS(((obj_data *) otokens[i]), ch));
break;
}
}
strcat(sb,tokens[i]);
strcat(sb,"\n\r");
sb[0] = toupper(sb[0]);
send_to_char(ch, "%s", sb);
}
void sub_write(char *arg, char_data *ch, byte find_invis, int targets)
{
char str[MAX_INPUT_LENGTH * 2];
char type[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH];
char *tokens[MAX_INPUT_LENGTH], *s, *p;
void *otokens[MAX_INPUT_LENGTH];
char_data *to;
obj_data *obj;
int i, tmp;
int to_sleeping = 1; /* mainly for windows compiles */
char str[MAX_INPUT_LENGTH * 2];
char type[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH];
char *tokens[MAX_INPUT_LENGTH], *s, *p;
void *otokens[MAX_INPUT_LENGTH];
char_data *to;
obj_data *obj;
int i, tmp;
int to_sleeping = 1; /* mainly for windows compiles */
if (!arg)
return;
if (!arg)
return;
tokens[0] = str;
tokens[0] = str;
for (i = 0, p = arg, s = str; *p;)
{
switch (*p) {
case '~':
case '|':
case '^':
case '&':
case '*':
/* get char_data, move to next token */
type[i] = *p;
*s = '\0';
p = any_one_name(++p, name);
otokens[i] =
find_invis ? (void *)get_char_in_room(&world[IN_ROOM(ch)], name) : (void *)get_char_room_vis(ch, name, NULL);
tokens[++i] = ++s;
break;
for (i = 0, p = arg, s = str; *p;) {
switch (*p) {
case '~':
case '|':
case '^':
case '&':
case '*':
/* get char_data, move to next token */
type[i] = *p;
*s = '\0';
p = any_one_name(++p, name);
otokens[i] =
find_invis ? (void *)get_char_in_room(&world[IN_ROOM(ch)], name) : (void *)get_char_room_vis(ch, name, NULL);
tokens[++i] = ++s;
break;
case '¨':
/* get obj_data, move to next token */
type[i] = *p;
*s = '\0';
p = any_one_name(++p, name);
case '¨':
/* get obj_data, move to next token */
type[i] = *p;
*s = '\0';
p = any_one_name(++p, name);
if (find_invis) obj = get_obj_in_room(&world[IN_ROOM(ch)], name);
else if (!(obj = get_obj_in_list_vis(ch, name, NULL, world[IN_ROOM(ch)].contents))) ;
else if (!(obj = get_obj_in_equip_vis(ch, name, &tmp, ch->equipment))) ;
else obj = get_obj_in_list_vis(ch, name, NULL, ch->carrying);
if (find_invis) obj = get_obj_in_room(&world[IN_ROOM(ch)], name);
else if (!(obj = get_obj_in_list_vis(ch, name, NULL, world[IN_ROOM(ch)].contents))) ;
else if (!(obj = get_obj_in_equip_vis(ch, name, &tmp, ch->equipment))) ;
else obj = get_obj_in_list_vis(ch, name, NULL, ch->carrying);
otokens[i] = (void *)obj;
tokens[++i] = ++s;
break;
otokens[i] = (void *)obj;
tokens[++i] = ++s;
break;
case '\\':
p++;
*s++ = *p++;
break;
case '\\':
p++;
*s++ = *p++;
break;
default:
*s++ = *p++;
}
default:
*s++ = *p++;
}
}
*s = '\0';
tokens[++i] = NULL;
*s = '\0';
tokens[++i] = NULL;
if (IS_SET(targets, TO_CHAR) && SENDOK(ch))
sub_write_to_char(ch, tokens, otokens, type);
if (IS_SET(targets, TO_CHAR) && SENDOK(ch))
sub_write_to_char(ch, tokens, otokens, type);
if (IS_SET(targets, TO_ROOM))
for (to = world[IN_ROOM(ch)].people;
to; to = to->next_in_room)
if (to != ch && SENDOK(to))
sub_write_to_char(to, tokens, otokens, type);
if (IS_SET(targets, TO_ROOM))
for (to = world[IN_ROOM(ch)].people;
to; to = to->next_in_room)
if (to != ch && SENDOK(to))
sub_write_to_char(to, tokens, otokens, type);
}
void send_to_zone(char *messg, zone_rnum zone)

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.doc for complete information. *
* All rights reserved. See license for complete information. *
* *
* Death's Gate MUD is based on CircleMUD, Copyright (C) 1993, 94. *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
@ -11,11 +10,10 @@
* $Author: Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ *
* $Revision: 1.0.14 $ *
************************************************************************ */
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "dg_scripts.h"
#include "utils.h"
@ -77,11 +75,7 @@ void parse_trigger(FILE *trig_f, int nr)
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)
{
index_data *t_index;
@ -99,8 +93,6 @@ trig_data *read_trigger(int nr)
return trig;
}
void trig_data_init(trig_data *this_data)
{
this_data->nr = NOTHING;
@ -119,7 +111,6 @@ void trig_data_init(trig_data *this_data)
this_data->next = NULL;
}
void trig_data_copy(trig_data *this_data, const trig_data *trg)
{
trig_data_init(this_data);

View file

@ -1,32 +1,13 @@
/**************************************************************************
* File: dg_event.c *
* *
* Usage: 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 *
* File: dg_event.c Part of tbaMUD *
* Usage: This file contains a simplified event system to allow trigedit *
* to use the "wait" command, causing a delay in the middle of a script. *
* *
* $Author: Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ *
* $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 "sysdep.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 *new_event;
@ -65,7 +43,6 @@ struct event *event_create(EVENTFUNC(*func), void *event_obj, long when)
return new_event;
}
/* removes the event from the system */
void event_cancel(struct event *event)
{
@ -84,7 +61,6 @@ void event_cancel(struct event *event)
free(event);
}
/* Process any events whose time has come. */
void event_process(void)
{
@ -97,11 +73,9 @@ void event_process(void)
return;
}
/*
** 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 function.
*/
/* 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 function. */
the_event->q_el = NULL;
/* call event func, reenqueue event if retval > 0 */
@ -112,7 +86,6 @@ void event_process(void)
}
}
/* returns the time remaining before the event */
long event_time(struct event *event)
{
@ -123,7 +96,6 @@ long event_time(struct event *event)
return (when - pulse);
}
/* frees all events in the queue */
void event_free_all(void)
{
@ -147,13 +119,7 @@ int event_is_queued(struct event *event)
return 0;
}
/* ************************************************************************
* File: queue.c *
* *
* Usage: generic queue functions for building and using a priority queue *
* *
************************************************************************ */
/* Generic queue functions for building and using a priority queue. */
/* returns a new, initialized queue */
struct queue *queue_init(void)
{
@ -164,7 +130,6 @@ struct queue *queue_init(void)
return q;
}
/* add data into the priority queue q with 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;
}
/* remove queue element qe from the priority queue q */
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);
}
/*
* 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 *dg_data;
@ -252,11 +212,8 @@ void *queue_head(struct queue *q)
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)
{
int i;
@ -269,14 +226,12 @@ long queue_key(struct queue *q)
return LONG_MAX;
}
/* returns the key of queue element qe */
long queue_elmt_key(struct q_element *qe)
{
return qe->key;
}
/* free q and contents */
void queue_free(struct queue *q)
{
@ -292,4 +247,3 @@ void queue_free(struct queue *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 $ *
* $Date: 2004/10/11 12:07:00$ *
* $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
/********** Event related section *********/
/* Event related section.*/
#define EVENTFUNC(name) long (name)(void *event_obj)
/*
** define event related structures
*/
/* Define event related structures. */
struct event {
EVENTFUNC(*func);
void *event_obj;
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) */
#define NUM_EVENT_QUEUES 10
@ -49,7 +34,7 @@ struct q_element {
long key;
struct q_element *prev, *next;
};
/****** End of Queue related info ********/
/* End of Queue related info. */
/* - events - function protos need by other modules */
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.doc for complete information. *
* All rights reserved. See license for complete information. *
* *
* Death's Gate MUD is based on CircleMUD, Copyright (C) 1993, 94. *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
@ -15,8 +14,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "dg_scripts.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)
{
struct trig_var_data *i, *j;
@ -75,11 +69,8 @@ int remove_var(struct trig_var_data **var_list, char *name)
return 0;
}
/*
* Return memory used by a trigger
* The command list is free'd when changed and when
* shutting down.
*/
/* Return memory used by a trigger. The command list is free'd when changed and
* when shutting down. */
void free_trigger(struct trig_data *trig)
{
free(trig->name);
@ -99,7 +90,6 @@ void free_trigger(struct trig_data *trig)
free(trig);
}
/* remove a single trigger from a mob/obj/room */
void extract_trigger(struct trig_data *trig)
{

View file

@ -1,6 +1,6 @@
/**************************************************************************
* File: dg_misc.c *
* Usage: contains general functions for script usage. *
* File: dg_misc.c Part of tbaMUD *
* Usage: Contains general functions for script usage. *
* *
* $Author: Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ *
@ -9,8 +9,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "dg_scripts.h"
#include "utils.h"
@ -31,17 +29,13 @@ void die(struct char_data *ch, struct char_data * killer);
/* external vars */
extern struct spell_info_type spell_info[];
/* cast a spell; can be called by mobiles, objects and rooms, and no */
/* level check is required. Note that mobs should generally use the */
/* normal 'cast' command (which must be patched to allow mobs to cast */
/* spells) as the spell system is designed to have a character caster, */
/* and this cast routine may overlook certain issues. */
/* LIMITATION: a target MUST exist for the spell unless the spell is */
/* 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)
/* Cast a spell; can be called by mobiles, objects and rooms, and no level
* check is required. Note that mobs should generally use the normal 'cast'
* command (which must be patched to allow mobs to cast spells) as the spell
* system is designed to have a character caster, and this cast routine may
* overlook certain issues. LIMITATION: a target MUST exist for the spell unless
* the spell is set to TAR_IGNORE. Also, group spells are not permitted. */
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 *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);
}
/* modify an affection on the target. affections can be of the AFF_x */
/* variety or APPLY_x type. APPLY_x's have an integer value for them */
/* while AFF_x's have boolean values. In any case, the duration MUST */
/* be non-zero. */
/* usage: apply <target> <property> <value> <duration> */
/* Modify an affection on the target. affections can be of the AFF_x variety
* or APPLY_x type. APPLY_x's have an integer value for them while AFF_x's
* have boolean values. In any case, the duration MUST be non-zero.
* Usage: apply <target> <property> <value> <duration> */
#define APPLY_TYPE 1
#define AFFECT_TYPE 2
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;
}
/* locate the target */
ch = get_char(charname);
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
* - allow_gods is false when called by %force%, for instance,
* while true for %teleport%. -- Welcor
*/
/* Used throughout the xxxcmds.c files for checking if a char can be targetted
* - 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)
{
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... */
}
void script_damage(struct char_data *vict, int dam)
{
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 *
* Usage: contains the mobile script commands. *
* *
* File: dg_mobcmd.c Part of tbaMUD *
* Usage: Contains the mobile script commands. *
* *
* $Author: N'Atas-ha/Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ *
@ -37,8 +9,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "screen.h"
#include "dg_scripts.h"
@ -50,17 +20,13 @@
#include "spells.h"
#include "constants.h"
/*
* External functions
*/
/* External functions */
bitvector_t asciiflag_conv(char *flag);
zone_rnum real_zone_by_thing(room_vnum vznum);
void die(struct char_data *ch, struct char_data *killer);
room_rnum find_target_room(struct char_data *ch, char *rawroomstr);
/*
* Local functions.
*/
/* Local functions. */
void mob_log(char_data *mob, const char *format, ...);
ACMD(do_masound);
ACMD(do_mkill);
@ -98,14 +64,11 @@ void mob_log(char_data *mob, const char *format, ...)
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) \
(IS_NPC(ch) && (!(ch)->desc || GET_LEVEL((ch)->desc->original)>=LVL_IMPL))
/* mob commands */
/* prints the argument to all the rooms aroud the mobile */
ACMD(do_masound)
{
@ -145,7 +108,6 @@ ACMD(do_masound)
IN_ROOM(ch) = was_in_room;
}
/* lets the mobile kill any player or mobile without murder*/
ACMD(do_mkill)
{
@ -196,12 +158,9 @@ ACMD(do_mkill)
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 them
*/
/* 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
* them. */
ACMD(do_mjunk)
{
char arg[MAX_INPUT_LENGTH];
@ -249,7 +208,6 @@ ACMD(do_mjunk)
return;
}
/* prints the message to everyone in the room other than the mob and victim */
ACMD(do_mechoaround)
{
@ -286,7 +244,6 @@ ACMD(do_mechoaround)
sub_write(p, victim, TRUE, TO_ROOM);
}
/* sends the message to only the victim */
ACMD(do_msend)
{
@ -323,7 +280,6 @@ ACMD(do_msend)
sub_write(p, victim, TRUE, TO_CHAR);
}
/* prints the message to the room at large */
ACMD(do_mecho)
{
@ -367,10 +323,8 @@ ACMD(do_mzoneecho)
}
}
/*
* lets the mobile load an item or mobile. All items
* are loaded into inventory, unless it is NO-TAKE.
*/
/* Lets the mobile load an item or mobile. All items are loaded into
* inventory, unless it is NO-TAKE. */
ACMD(do_mload)
{
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
@ -476,12 +430,9 @@ ACMD(do_mload)
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 be the last command it does.
*/
/* 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
* be the last command it does. */
ACMD(do_mpurge)
{
char arg[MAX_INPUT_LENGTH];
@ -549,7 +500,6 @@ ACMD(do_mpurge)
extract_char(victim);
}
/* lets the mobile goto any location it wishes that is not private */
ACMD(do_mgoto)
{
@ -584,7 +534,6 @@ ACMD(do_mgoto)
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
}
/* lets the mobile do a command at another location. Very useful */
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)
{
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
@ -693,7 +639,6 @@ ACMD(do_mteleport)
}
}
ACMD(do_mdamage) {
char name[MAX_INPUT_LENGTH], amount[MAX_INPUT_LENGTH];
int dam = 0;
@ -728,10 +673,8 @@ ACMD(do_mdamage) {
script_damage(vict, dam);
}
/*
* lets the mobile force someone to do something. must be mortal level
* and the all argument only affects those in the room with the mobile
*/
/* Lets the mobile force someone to do something. must be mortal level and the
* all argument only affects those in the room with the mobile. */
ACMD(do_mforce)
{
char arg[MAX_INPUT_LENGTH];
@ -832,7 +775,6 @@ ACMD(do_mhunt)
}
/* place someone into the mob's memory list */
ACMD(do_mremember)
{
@ -884,7 +826,6 @@ ACMD(do_mremember)
}
}
/* remove someone from the list */
ACMD(do_mforget)
{
@ -941,7 +882,6 @@ ACMD(do_mforget)
}
}
/* transform into a different mobile */
ACMD(do_mtransform)
{
@ -984,7 +924,6 @@ ACMD(do_mtransform)
}
/* move new obj info over to old object and delete new obj */
for (pos = 0; pos < NUM_WEARS; pos++) {
if (GET_EQ(ch, pos))
obj[pos] = unequip_char(ch, pos);
@ -1010,7 +949,6 @@ ACMD(do_mtransform)
if(m->player.description)
tmpmob.player.description = strdup(m->player.description);
tmpmob.id = ch->id;
tmpmob.affected = ch->affected;
tmpmob.carrying = ch->carrying;
@ -1047,7 +985,6 @@ ACMD(do_mtransform)
}
}
ACMD(do_mdoor)
{
char target[MAX_INPUT_LENGTH], direction[MAX_INPUT_LENGTH];
@ -1066,7 +1003,6 @@ ACMD(do_mdoor)
"\n"
};
if (!MOB_OR_IMPL(ch)) {
send_to_char(ch, "Huh?!?\r\n");
return;
@ -1220,8 +1156,8 @@ ACMD(do_mfollow)
leader->followers = k;
}
/* prints the message to everyone in the range of numbers */
/* Thx to Jamie Nelson of 4D for this contribution */
/* Prints the message to everyone in the range of numbers. Thanks to Jamie
* Nelson of 4D for this contribution */
ACMD(do_mrecho)
{
char start[MAX_INPUT_LENGTH], finish[MAX_INPUT_LENGTH], *msg;

View file

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

View file

@ -1,11 +1,6 @@
/**************************************************************************
* File: dg_olc.c *
* *
* 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_ *
* File: dg_olc.c Part of tbaMUD *
* Usage: this source file is used in extending Oasis OLC for trigedit. *
* *
* $Author: Chris Jacobsen/Mark A. Heilpern/egreen/Welcor $ *
* $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
* proto_scripts. We only update the original when choosing to save
* internally, then free the unused memory there. -Welcor
* Thanks to Jeremy Stanley - fungi@yuggoth.org and Torgny Bjers -
* artovil@arcanerealms.org for the bug report.
* Thanks to Jeremy Stanley and Torgny Bjers for the bug report.
* After updating to OasisOLC 2.0.3 I discovered some malfunctions
* in this code, so I restructured it a bit. Now things work like
* this: OLC_SCRIPT(d) is assigned a copy of the edited things'

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

View file

@ -1,7 +1,6 @@
/**************************************************************************
* File: dg_scripts.c *
* Usage: contains the main script driver interface. *
* *
* File: dg_scripts.c Part of tbaMUD *
* Usage: Contains the main script driver interface. *
* *
* $Author: Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ *
@ -10,8 +9,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "dg_scripts.h"
#include "utils.h"
@ -87,8 +84,8 @@ ACMD(do_detach);
ACMD(do_vdelete);
ACMD(do_tstat);
/* Return pointer to first occurrence of string ct in */
/* cs, or NULL if not present. Case insensitive */
/* Return pointer to first occurrence of string ct in cs, or NULL if not
* present. Case insensitive */
char *str_str(char *cs, char *ct)
{
char *s, *t;
@ -116,7 +113,6 @@ char *str_str(char *cs, char *ct)
return NULL;
}
int trgvar_in_room(room_vnum vnum) {
room_rnum rnum = real_room(vnum);
int i = 0;
@ -189,8 +185,8 @@ obj_data *get_object_in_equip(char_data * ch, char *name)
return NULL;
}
/* Handles 'held', 'light' and 'wield' positions - Welcor
After idea from Byron Ellacott - bje@apnic.net */
/* Handles 'held', 'light' and 'wield' positions - Welcor. After idea from
* Byron Ellacott. */
int find_eq_pos_script(char *arg)
{
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)
{
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 object with UID n */
obj_data *find_obj(long n)
{
@ -294,10 +285,7 @@ room_data *find_room(long n)
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 */
char_data *get_char(char *name)
{
@ -318,9 +306,7 @@ char_data *get_char(char *name)
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 *ch;
@ -342,11 +328,8 @@ char_data *get_char_near_obj(obj_data *obj, char *name)
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 *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'*/
obj_data *get_obj_near_obj(obj_data *obj, char *name)
{
obj_data *i = NULL;
@ -428,7 +410,6 @@ obj_data *get_obj(char *name)
return NULL;
}
/* finds room by id or vnum. returns NULL if not found */
room_data *get_room(char *name)
{
@ -442,11 +423,8 @@ room_data *get_room(char *name)
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 *ch;
@ -476,11 +454,8 @@ char_data *get_char_by_obj(obj_data *obj, char *name)
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 *ch;
@ -505,11 +480,8 @@ char_data *get_char_by_room(room_data *room, char *name)
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 *i = NULL;
@ -663,7 +635,6 @@ void check_time_triggers(void)
}
}
EVENTFUNC(trig_wait_event)
{
struct wait_event_data *wait_event_obj = (struct wait_event_data *)event_obj;
@ -713,7 +684,6 @@ EVENTFUNC(trig_wait_event)
return 0;
}
void do_stat_trigger(struct char_data *ch, trig_data *trig)
{
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);
}
/* find the name of what the uid points to */
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);
}
/* general function to display stats on script 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)
{
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));
}
void do_sstat_object(char_data *ch, obj_data *j)
{
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));
}
void do_sstat_character(char_data *ch, char_data *k)
{
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));
}
/*
* 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)
{
trig_data *i;
@ -904,7 +866,6 @@ void add_trigger(struct script_data *sc, trig_data *t, int loc)
trigger_list = t;
}
ACMD(do_attach)
{
char_data *victim;
@ -1042,15 +1003,12 @@ ACMD(do_attach)
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 trigger, including things like 2.beggar-death.
* returns 0 if did not find the trigger, otherwise 1. If it matters,
* you might need to check to see if all the triggers were removed after
* this function returns, in order to remove the script.
*/
/* 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
* trigger, including things like 2.beggar-death. Returns 0 if did not find the
* trigger, otherwise 1. If it matters, 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)
{
trig_data *i, *j;
@ -1078,9 +1036,8 @@ int remove_trigger(struct script_data *sc, char *name)
break;
}
/* this isn't clean... */
/* a numeric value will match if it's position OR vnum */
/* is found. originally the number was position-only */
/* This isn't clean. A numeric value will match if it's position OR vnum
* is found. originally the number was position-only. */
else if (++n >= num)
break;
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 on-line view of script errors.
*/
/* Logs any errors caused by scripts to the system log. Will eventually allow
* on-line view of script errors. */
void script_vlog(const char *format, va_list args)
{
char output[MAX_STRING_LENGTH];
@ -1290,7 +1245,6 @@ void script_vlog(const char *format, va_list args)
}
}
void script_log(const char *format, ...)
{
va_list args;
@ -1300,8 +1254,8 @@ void script_log(const char *format, ...)
va_end(args);
}
/* returns 1 if string is all digits, else 0 */
/* bugfixed - would have returned true on num="------" */
/* Returns 1 if string is all digits, else 0. Bugfixed - would have returned
* true on num="------". */
int is_num(char *arg)
{
if (*arg == '\0')
@ -1319,7 +1273,6 @@ int is_num(char *arg)
return TRUE;
}
/* evaluates 'lhs op rhs', and copies to result */
void eval_op(char *op, char *lhs, char *rhs, char *result, void *go,
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)
{
for (p++; *p && (*p != '"'); p++) {
@ -1437,10 +1387,8 @@ char *matching_quote(char *p)
return p;
}
/*
* p points to the first paren. returns a pointer to the
* matching closing paren, or the last non-null char in p.
*/
/* p points to the first paren. returns a pointer to the matching closing
* paren, or the last non-null char in p. */
char *matching_paren(char *p)
{
int i;
@ -1457,7 +1405,6 @@ char *matching_paren(char *p)
return --p;
}
/* evaluates line, and returns answer in result */
void eval_expr(char *line, char *result, void *go, struct script_data *sc,
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);
}
/*
* 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,
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);
/*
* initialize tokens, an array of pointers to locations
* in line where the ops could possibly occur.
*/
/* Initialize tokens, an array of pointers to locations in line where the
* ops could possibly occur. */
for (j = 0; *p; j++) {
tokens[j] = p;
if (*p == '(')
@ -1549,8 +1491,6 @@ int eval_lhs_op_rhs(char *expr, char *result, void *go, struct script_data *sc,
return 0;
}
/* returns 1 if cond is true, else 0 */
int process_if(char *cond, void *go, struct script_data *sc,
trig_data *trig, int type)
@ -1568,9 +1508,8 @@ int process_if(char *cond, void *go, struct script_data *sc,
return 1;
}
/* scans for end of if-block. returns the line containg 'end', or the last
line of the trigger if not found. */
/* Scans for end of if-block. returns the line containg 'end', or the last
* line of the trigger if not found. */
struct cmdlist_element *find_end(trig_data *trig, struct cmdlist_element *cl)
{
struct cmdlist_element *c;
@ -1601,14 +1540,10 @@ struct cmdlist_element *find_end(trig_data *trig, struct cmdlist_element *cl)
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 *cl, void *go,
struct script_data *sc, int type)
struct cmdlist_element *cl, void *go, struct script_data *sc, int type)
{
struct cmdlist_element *c;
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 */
if(strn_cmp("end", p, 3))
script_log("Trigger VNum %d has 'if' without 'end'. (error 5)", GET_TRIG_VNUM(trig));
return c;
}
/* processes any 'wait' commands in a trigger */
void process_wait(void *go, trig_data *trig, int type, char *cmd,
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;
}
/* processes a script set command */
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);
}
/* script attaching a trigger to something */
void process_attach(void *go, struct script_data *sc, trig_data *trig,
int type, char *cmd)
@ -1832,13 +1764,11 @@ void process_attach(void *go, struct script_data *sc, trig_data *trig,
add_trigger(SCRIPT(r), newtrig, -1);
return;
}
}
/* script detaching a trigger from something */
void process_detach(void *go, struct script_data *sc, trig_data *trig,
int type, char *cmd)
int type, char *cmd)
{
char arg[MAX_INPUT_LENGTH], trignum_s[MAX_INPUT_LENGTH];
char result[MAX_INPUT_LENGTH], *id_p;
@ -1933,7 +1863,6 @@ struct room_data *dg_room_of_obj(struct obj_data *obj)
return NULL;
}
/* create a UID variable from the id number */
void makeuid_var(void *go, struct script_data *sc, trig_data *trig,
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);
}
/*
* processes a script return command.
* returns the new value for the script to return.
*/
/* Processes a script return command. Returns the new value for the script to
* return. */
int process_return(trig_data *trig, char *cmd)
{
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
@ -2052,11 +1979,8 @@ int process_return(trig_data *trig, char *cmd)
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)
{
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);
}
/*
* 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)
{
struct trig_var_data *vd;
@ -2129,8 +2050,8 @@ void process_remote(struct script_data *sc, trig_data *trig, char *cmd)
return;
}
/* for all but PC's, context comes from the existing context. */
/* for PC's, context is 0 (global) */
/* For all but PC's, context comes from the existing context. For PC's,
* context is 0 (global) */
context = vd->context;
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);
}
/*
* 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)
{
struct trig_var_data *vd, *vd_prev=NULL;
@ -2179,7 +2097,6 @@ ACMD(do_vdelete)
return;
}
/* find the target script from the uid number */
uid = atoi(buf2);
if (uid<=0) {
@ -2187,7 +2104,6 @@ ACMD(do_vdelete)
return;
}
if ((room = find_room(uid))) {
sc_remote = SCRIPT(room);
} else if ((mob = find_char(uid))) {
@ -2245,10 +2161,8 @@ ACMD(do_vdelete)
send_to_char(ch, "Deleted.\r\n");
}
/*
* Called from do_set - return 0 for failure, 1 for success.
* ch and vict are verified
*/
/* Called from do_set - return 0 for failure, 1 for success. ch and vict are
* verified. */
int perform_set_dg_var(struct char_data *ch, struct char_data *vict, char *val_arg)
{
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;
}
/*
* delete a variable from the globals of another script
* 'rdelete <variable_name> <uid>'
*/
/* Delete a variable from the globals of another script.
* 'rdelete <variable_name> <uid>' */
void process_rdelete(struct script_data *sc, trig_data *trig, char *cmd)
{
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(&uid_p);
if (!*buf || !*buf2) {
script_log("Trigger: %s, VNum %d. rdelete: invalid arguments '%s'",
GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), cmd);
return;
}
/* find the target script from the uid number */
uid = atoi(buf2);
if (uid<=0) {
@ -2304,7 +2214,6 @@ void process_rdelete(struct script_data *sc, trig_data *trig, char *cmd)
return;
}
if ((room = find_room(uid))) {
sc_remote = SCRIPT(room);
} else if ((mob = find_char(uid))) {
@ -2339,10 +2248,7 @@ void process_rdelete(struct script_data *sc, trig_data *trig, char *cmd)
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)
{
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);
}
/* set the current context for a script */
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);
}
/*
Thanks to Jamie Nelson for 4 dimensions for this addition
Syntax :
dg_letter <new varname> <letter position> <string to get from>
ie:
set string L337-String
dg_letter var1 4 %string%
dg_letter var2 11 %string%
now %var1% == 7 and %var2% == g
Note that the index starts at 1.
*/
/* Thanks to Jamie Nelson for 4 dimensions for this addition.
* Syntax :
* dg_letter <new varname> <letter position> <string to get from>.
* set string L337-String
* 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)
{
//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 varname[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);
}
/* This is the core driver for scripts. */
/* Arguments:
void *go_adress
A pointer to a pointer to the entity running the script.
The reason for this approcah is that we want to be able to see
from the calling function, if the entity has been free'd.
trig_data *trig
A pointer to the current running trigger.
int type
MOB_TRIGGER, OBJ_TRIGGER or WLD_TRIGGER, respectively.
int mode
TRIG_NEW just started from dg_triggers.c
TRIG_RESTART restarted after a 'wait'
*/
/* This is the core driver for scripts.
* Arguments:
* void *go_adress
* A pointer to a pointer to the entity running the script. The reason for
* this approcah is that we want to be able to see from the calling function,
* if the entity has been free'd.
*
* trig_data *trig
* A pointer to the current running trigger.
*
* int type
* MOB_TRIGGER, OBJ_TRIGGER or WLD_TRIGGER, respectively.
*
* int mode
TRIG_NEW just started from dg_triggers.c
TRIG_RESTART restarted after a 'wait' */
int script_driver(void *go_adress, trig_data *trig, int type, int mode)
{
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() works on rooms, but on mobiles and objects,
it will be called again if the
caller is load_mtrigger or load_otrigger
if it is one of these, we must make sure the script
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().
*/
/* extract_script() works on rooms, but on mobiles and objects, it will be
* called again if the caller is load_mtrigger or load_otrigger if it is
* one of these, we must make sure the script is not just reloaded on the
* next mob. We make the calling code decide how to handle it, so it does
* not get totally removed unless it's a load_xtrigger(). */
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) ||
!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) {
script_log("Trigger VNum %d has 'else' without 'if'.",
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)) {
cl = find_case(trig, cl, go, sc, type, p + 7);
} 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) {
script_log("Trigger VNum %d has 'end' without 'if'.",
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 */
}
else {
var_subst(go, sc, trig, type, p, cmd);
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;
}
}
}
}
@ -2782,11 +2664,8 @@ ACMD(do_tstat)
send_to_char(ch, "Usage: tstat <vnum>\r\n");
}
/*
* scans for a case/default instance
* returns the line containg the correct case instance, or the last
* line of the trigger if not found.
*/
/* Scans for a case/default instance. Returns the line containg the correct
* case instance, or the last line of the trigger if not found. */
struct cmdlist_element *
find_case(struct trig_data *trig, struct cmdlist_element *cl,
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;
}
/*
* scans for end of while/switch-blocks.
* returns the line containg 'end', or the last
* line of the trigger if not found.
* Malformed scripts may cause NULL to be returned.
*/
/* Scans for end of while/switch-blocks. Returns the line containg 'end', or
* the last 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 *c;
@ -2847,7 +2723,6 @@ struct cmdlist_element *find_done(struct cmdlist_element *cl)
return c;
}
/* read a line in from a file, return the number of chars read */
int fgetline(FILE *file, char *p)
{
@ -2866,7 +2741,6 @@ int fgetline(FILE *file, char *p)
return count;
}
/* load in a character's saved variables */
void read_saved_vars(struct char_data *ch)
{
@ -2877,16 +2751,14 @@ void read_saved_vars(struct char_data *ch)
char varname[32];
char context_str[16];
/*
* If getting to the menu from inside the game, the vars aren't removed.
* So let's not allocate them again.
*/
/* If getting to the menu from inside the game, the vars aren't removed. So
* let's not allocate them again. */
if (SCRIPT(ch))
return;
/* create the space for the script structure which holds the vars */
/* We need to do this first, because later calls to 'remote' will need */
/* a script already assigned. */
/* Create the space for the script structure which holds the vars. We need to
* do this first, because later calls to 'remote' will need. A script already
* assigned. */
CREATE(SCRIPT(ch), struct script_data, 1);
/* 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];
struct trig_var_data *vars;
/* immediate return if no script (and therefore no variables) structure */
/* has been created. this will happen when the player is logging in */
/* Immediate return if no script (and therefore no variables) structure has
* been created. this will happen when the player is logging in */
if (SCRIPT(ch) == NULL) return;
/* 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));
return;
}
/* note that currently, context will always be zero. this may change */
/* in the future */
/* Note that currently, context will always be zero. This may change in the
* future. */
while (vars) {
if (*vars->name != '-') /* don't save if it begins with - */
fprintf(file, "%s %ld %s\n", vars->name, vars->context, vars->value);
@ -2962,18 +2834,16 @@ void read_saved_vars_ascii(FILE *file, struct char_data *ch, int count)
char input_line[1024], *temp, *p;
char varname[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 let's not allocate them again.
*/
/* If getting to the menu from inside the game, the vars aren't removed. So
* let's not allocate them again. */
if (SCRIPT(ch))
return;
/* create the space for the script structure which holds the vars */
/* We need to do this first, because later calls to 'remote' will need */
/* a script already assigned. */
/* Create the space for the script structure which holds the vars. We need to
* do this first, because later calls to 'remote' will need. A script already
* assigned. */
CREATE(SCRIPT(ch), struct script_data, 1);
/* 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;
int count = 0;
/* immediate return if no script (and therefore no variables) structure */
/* has been created. this will happen when the player is logging in */
/* Immediate return if no script (and therefore no variables) structure has
* been created. this will happen when the player is logging in */
if (SCRIPT(ch) == NULL) return;
/* 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 */
if (ch->script->global_vars == NULL) return;
/* note that currently, context will always be zero. this may change */
/* in the future */
/* Note that currently, context will always be zero. This may change in the
* future */
for (vars = ch->script->global_vars;vars;vars = vars->next)
if (*vars->name != '-')
count++;
@ -3023,10 +2893,9 @@ void save_char_vars_ascii(FILE *file, struct char_data *ch)
}
/* find_char() helpers */
// Must be power of 2
/* Must be power of 2. */
#define BUCKET_COUNT 64
// to recognize an empty bucket
/* To recognize an empty bucket. */
#define UID_OUT_OF_RANGE 1000000000
struct lookup_table_t {
@ -3095,12 +2964,8 @@ void remove_from_lookup_table(long uid)
int bucket = (int) (uid & (BUCKET_COUNT - 1));
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 debugging the issue, let's just return right away.
*
* Welcor 02/04
*/
/* This is not supposed to happen. UID 0 is not used. However, while I'm
* debugging the issue, let's just return right away. - Welcor */
if (uid == 0)
return;

View file

@ -1,8 +1,8 @@
/**************************************************************************
* File: dg_scripts.h *
* Usage: header file for script structures and constants, and *
* function prototypes for dg_scripts.c *
* File: dg_scripts.h Part of tbaMUD *
* *
* Usage: header file for script structures, constants, and function *
* prototypes for dg_scripts.c *
* *
* $Author: Mark A. Heilpern/egreen/Welcor $ *
* $Date: 2004/10/11 12:07:00$ *
@ -20,19 +20,16 @@
/* spells cast by objects and rooms use this level */
#define DG_SPELL_LEVEL 25
/*
* define this if you don't want wear/remove triggers to fire when
* a player is saved.
*/
/* Define this if you don't want wear/remove triggers to fire when a player
* is saved. */
#define NO_EXTRANEOUS_TRIGGERS
/*
* %actor.room% behaviour :
* Until pl 7 %actor.room% returned a room vnum.
* Working with this number in scripts was unnecessarily hard,
* especially in those situations one needed the id of the room,
* the items in it, etc. As a result of this, the output
* has been changed (as of pl 8) to a room variable.
* This means old scripts will need a minor adjustment;
/* %actor.room% behaviour :
* Until pl 7 %actor.room% returned a room vnum. Working with this number in
* scripts was unnecessarily hard, especially in those situations one needed
* the id of the room, 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
* will need a minor adjustment;
*
* Before:
* if %actor.room%==3001
@ -44,9 +41,7 @@
* %echo% You are at the main temple.
*
* If you wish to continue using the old style, comment out the line below.
*
* Welcor
*/
* - Welcor */
#define ACTOR_ROOM_IS_UID 1
/* mob trigger types */
@ -119,14 +114,10 @@
#define TRIG_NEW 0 /* trigger starts from top */
#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 MAX_SCRIPT_DEPTH 10 /* maximum depth triggers can
recurse into each other */
@ -168,7 +159,6 @@ struct trig_data {
struct trig_data *next_in_world; /* next in the global trigger list */
};
/* a complete script (composed of several triggers) */
struct script_data {
long types; /* bitvector of trigger types */
@ -201,7 +191,6 @@ struct script_memory {
struct script_memory *next;
};
/* function prototypes from dg_triggers.c */
char *one_phrase(char *arg, char *first_arg);
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 assign_triggers(void *i, int type);
/* From dg_variables.c */
void add_var(struct trig_var_data **var_list, char *name, char *value, long id);
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,
int type, char *var, char *field, char *subfield, char *str, size_t slen);
/* From dg_handler.c */
void free_var_el(struct trig_var_data *var);
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)
/* Macros for scripts */
#define UID_CHAR '}'
#define GET_TRIG_NAME(t) ((t)->name)
#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_LOOPS(t) ((t)->loops)
/* player id's: 0 to MOB_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 */
/* object id's: OBJ_ID_BASE and higher */
/* player id's: 0 to MOB_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
* object id's: OBJ_ID_BASE and higher */
#define MOB_ID_BASE 50000 /* 50000 player IDNUMS should suffice */
#define ROOM_ID_BASE 1050000 /* 1000000 Mobs */
#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 SCRIPT_CHECK(go, type) (SCRIPT(go) && \
IS_SET(SCRIPT_TYPES(SCRIPT(go)), 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.doc for complete information. *
* All rights reserved. See license for complete information. *
* *
* Death's Gate MUD is based on CircleMUD, Copyright (C) 1993, 94. *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
@ -15,8 +14,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "dg_scripts.h"
#include "utils.h"
@ -33,14 +30,9 @@ extern struct time_info_data time_info;
/* external functions */
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)
{
skip_spaces(&arg);
@ -79,7 +71,6 @@ char *one_phrase(char *arg, char *first_arg)
return arg;
}
int is_substring(char *sub, char *string)
{
char *s;
@ -101,12 +92,9 @@ int is_substring(char *sub, char *string)
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 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 0. */
int word_check(char *str, char *wordlist)
{
char words[MAX_INPUT_LENGTH], phrase[MAX_INPUT_LENGTH], *s;
@ -122,20 +110,12 @@ int word_check(char *str, char *wordlist)
return 0;
}
/*
* mob triggers
*/
/*Mob triggers. */
void random_mtrigger(char_data *ch)
{
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))
return;
@ -220,7 +200,6 @@ void greet_memory_mtrigger(char_data *actor)
}
}
int greet_mtrigger(char_data *actor, int dir)
{
trig_data *t;
@ -255,7 +234,6 @@ int greet_mtrigger(char_data *actor, int dir)
return final;
}
void entry_memory_mtrigger(char_data *ch)
{
trig_data *t;
@ -359,7 +337,6 @@ int command_mtrigger(char_data *actor, char *cmd, char *argument)
return 0;
}
void speech_mtrigger(char_data *actor, char *str)
{
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,
char_data *victim, obj_data *object,
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)
{
struct char_data *actor;
@ -463,7 +438,6 @@ void fight_mtrigger(char_data *ch)
}
}
void hitprcnt_mtrigger(char_data *ch)
{
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)
{
trig_data *t;
@ -513,7 +486,6 @@ int receive_mtrigger(char_data *ch, char_data *actor, obj_data *obj)
return 1;
}
int death_mtrigger(char_data *ch, char_data *actor)
{
trig_data *t;
@ -646,10 +618,7 @@ void time_mtrigger(char_data *ch)
trig_data *t;
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))
return;
@ -664,10 +633,7 @@ void time_mtrigger(char_data *ch)
}
}
/*
* object triggers
*/
/* Object triggers. */
void random_otrigger(obj_data *obj)
{
trig_data *t;
@ -684,7 +650,6 @@ void random_otrigger(obj_data *obj)
}
}
void timer_otrigger(struct obj_data *obj)
{
trig_data *t;
@ -701,7 +666,6 @@ void timer_otrigger(struct obj_data *obj)
return;
}
int get_otrigger(obj_data *obj, char_data *actor)
{
trig_data *t;
@ -728,7 +692,6 @@ int get_otrigger(obj_data *obj, char_data *actor)
return 1;
}
/* checks for command trigger on specific object. assumes obj has cmd trig */
int cmd_otrig(obj_data *obj, char_data *actor, char *cmd,
char *argument, int type)
@ -766,7 +729,6 @@ int cmd_otrig(obj_data *obj, char_data *actor, char *cmd,
return 0;
}
int command_otrigger(char_data *actor, char *cmd, char *argument)
{
obj_data *obj;
@ -792,7 +754,6 @@ int command_otrigger(char_data *actor, char *cmd, char *argument)
return 0;
}
int wear_otrigger(obj_data *obj, char_data *actor, int where)
{
trig_data *t;
@ -819,7 +780,6 @@ int wear_otrigger(obj_data *obj, char_data *actor, int where)
return 1;
}
int remove_otrigger(obj_data *obj, char_data *actor)
{
trig_data *t;
@ -846,7 +806,6 @@ int remove_otrigger(obj_data *obj, char_data *actor)
return 1;
}
int drop_otrigger(obj_data *obj, char_data *actor)
{
trig_data *t;
@ -873,7 +832,6 @@ int drop_otrigger(obj_data *obj, char_data *actor)
return 1;
}
int give_otrigger(obj_data *obj, char_data *actor, char_data *victim)
{
trig_data *t;
@ -1040,10 +998,7 @@ void time_otrigger(obj_data *obj)
}
}
/*
* world triggers
*/
/* World triggers. */
void reset_wtrigger(struct room_data *room)
{
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)
{
trig_data *t;
@ -1100,7 +1054,6 @@ int enter_wtrigger(struct room_data *room, char_data *actor, int dir)
return 1;
}
int command_wtrigger(char_data *actor, char *cmd, char *argument)
{
struct room_data *room;
@ -1140,7 +1093,6 @@ int command_wtrigger(char_data *actor, char *cmd, char *argument)
return 0;
}
void speech_wtrigger(char_data *actor, char *str)
{
struct room_data *room;
@ -1228,7 +1180,6 @@ int cast_wtrigger(char_data *actor, char_data *vict, obj_data *obj, int spellnum
return 1;
}
int leave_wtrigger(struct room_data *room, char_data *actor, int dir)
{
trig_data *t;

View file

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

View file

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

View file

@ -1,12 +1,12 @@
/* ************************************************************************
* File: fight.c Part of CircleMUD *
* Usage: Combat system *
/**************************************************************************
* File: fight.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.h"
#include "sysdep.h"

View file

@ -1,12 +1,12 @@
/************************************************************************
* Generic OLC Library - Mobiles / genmob.c v1.0 *
* Copyright 1996 by Harvey Gilpin *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) *
************************************************************************/
/**************************************************************************
* File: genmob.c Part of tbaMUD *
* Usage: Generic OLC Library - Mobiles. *
* *
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.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);
/*
* Update live mobile rnums.
*/
/* Update live mobile rnums. */
for (live_mob = character_list; live_mob; live_mob = live_mob->next)
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 (cmd_no = 0; ZCMD(zone, cmd_no).command != 'S'; cmd_no++)
if (ZCMD(zone, cmd_no).command == 'M')
ZCMD(zone, cmd_no).arg1 += (ZCMD(zone, cmd_no).arg1 >= found);
/*
* Update shop keepers.
*/
/* Update shop keepers. */
if (shop_index)
for (shop = 0; shop <= top_shop - top_shop_offset; shop++)
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_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)
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 (cmd_no = 0; ZCMD(zone, cmd_no).command != 'S'; cmd_no++)
if (ZCMD(zone, cmd_no).command == 'M' && ZCMD(zone, cmd_no).arg1 == refpt)
delete_zone_command(&zone_table[zone], cmd_no);
/*
* Update shop keepers.
*/
/* Update shop keepers. */
if (shop_index)
for (counter = 0; counter <= top_shop - top_shop_offset; counter++)
SHOP_KEEPER(counter) -= (SHOP_KEEPER(counter) >= refpt);
@ -215,10 +203,8 @@ int free_mobile_strings(struct char_data *mob)
return TRUE;
}
/*
* Free a mobile structure that has been edited.
* Take care of existing mobiles and their mob_proto!
*/
/* Free a mobile structure that has been edited. Take care of existing mobiles
* and their mob_proto! */
int free_mobile(struct char_data *mob)
{
mob_rnum i;
@ -226,9 +212,7 @@ int free_mobile(struct char_data *mob)
if (mob == NULL)
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) {
free_mobile_strings(mob);
/* free script proto list */
@ -322,7 +306,6 @@ int write_mobile_espec(mob_vnum mvnum, struct char_data *mob, FILE *fd)
return TRUE;
}
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 *
* Copyright 1996 by Harvey Gilpin *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) *
************************************************************************/
/**************************************************************************
* File: genmob.h Part of tbaMUD *
* *
* Usage: Generic OLC Library - Mobiles. *
* *
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
**************************************************************************/
int delete_mobile(mob_rnum);
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 *
* Original author: Levork *
* Copyright 1996 by Harvey Gilpin *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) *
************************************************************************/
/**************************************************************************
* File: genobj.c Part of tbaMUD *
* Usage: Generic OLC Library - Objects. *
* *
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
**************************************************************************/
#include "conf.h"
#include "sysdep.h"

View file

@ -1,9 +1,10 @@
/************************************************************************
* Generic OLC Library - Objects / genobj.h v1.0 *
* Original author: Levork *
* Copyright 1996 by Harvey Gilpin *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) *
************************************************************************/
/**************************************************************************
* File: genobj.h Part of tbaMUD *
* *
* Usage: Generic OLC Library - Objects. *
* *
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
**************************************************************************/
void free_object_strings(struct obj_data *obj);
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 *
* Original author: Levork *
* Copyright 1996 by Harvey Gilpin *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) *
************************************************************************/
/**************************************************************************
* File: genolc.c Part of tbaMUD *
* Usage: Generic OLC Library - General. *
* *
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
**************************************************************************/
#define __GENOLC_C__
@ -29,14 +29,10 @@
int save_config( IDXTYPE nowhere ); /* Exported from cedit.c */
int top_shop_offset = 0;
/*
* List of zones to be saved.
*/
/* List of zones to be saved. */
struct save_list_data *save_list;
/*
* Structure defining all known save types.
*/
/* Structure defining all known save types. */
struct {
int save_type;
int (*func)(IDXTYPE rnum);
@ -52,8 +48,6 @@ struct {
{ -1, NULL, NULL },
};
/* -------------------------------------------------------------------------- */
int genolc_checkstring(struct descriptor_data *d, char *arg)
{
smash_tilde(arg);
@ -65,9 +59,7 @@ char *str_udup(const char *txt)
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)
{
while (save_list) {
@ -84,11 +76,7 @@ int save_all(void)
return TRUE;
}
/* -------------------------------------------------------------------------- */
/*
* NOTE: This changes the buffer passed in.
*/
/* NOTE: This changes the buffer passed in. */
void strip_cr(char *buffer)
{
int rpos, wpos;
@ -103,8 +91,6 @@ void strip_cr(char *buffer)
buffer[wpos] = '\0';
}
/* -------------------------------------------------------------------------- */
void copy_ex_descriptions(struct extra_descr_data **to, struct extra_descr_data *from)
{
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)
{
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)
{
struct save_list_data *ritem, *temp;
@ -160,8 +142,6 @@ int remove_from_save_list(zone_vnum zone, int type)
return TRUE;
}
/* -------------------------------------------------------------------------- */
int add_to_save_list(zone_vnum zone, int type)
{
struct save_list_data *nitem;
@ -190,8 +170,6 @@ int add_to_save_list(zone_vnum zone, int type)
return TRUE;
}
/* -------------------------------------------------------------------------- */
int in_save_list(zone_vnum zone, int type)
{
struct save_list_data *nitem;
@ -226,15 +204,11 @@ room_vnum genolc_zonep_bottom(struct zone_data *zone)
return zone->bot;
}
/* -------------------------------------------------------------------------- */
zone_vnum genolc_zone_bottom(zone_rnum rznum)
{
return zone_table[rznum].bot;
}
/* -------------------------------------------------------------------------- */
int sprintascii(char *out, bitvector_t bits)
{
int i, j = 0;
@ -253,11 +227,7 @@ int sprintascii(char *out, bitvector_t bits)
return j;
}
/* Zone export functions */
int export_save_shops(zone_rnum zrnum);
int export_save_mobiles(zone_rnum rznum);
int export_save_zone(zone_rnum zrnum);
@ -403,17 +373,13 @@ int export_save_shops(zone_rnum zrnum)
fclose(shop_file);
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++) {
if ((rshop = real_shop(i)) != NOWHERE) {
fprintf(shop_file, "#QQ%02d~\n", i%100);
shop = &shop_index[rshop];
/*
* Save the products.
*/
/* Save the products. */
for (j = 0; S_PRODUCT(shop, j) != NOTHING; j++) {
if (obj_index[S_PRODUCT(shop, j)].vnum < genolc_zone_bottom(zrnum) ||
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");
/*
* Save the rates.
*/
/* Save the rates. */
fprintf(shop_file, "%1.2f\n"
"%1.2f\n",
S_BUYPROFIT(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++)
fprintf(shop_file, "%d%s\n",
S_BUYTYPE(shop, j),
S_BUYWORD(shop, j) ? S_BUYWORD(shop, j) : "");
fprintf(shop_file, "-1\n");
/*
* Save messages'n'stuff.
* Added some small'n'silly defaults as sanity checks.
*/
/* Save messages. Added some defaults as sanity checks. */
fprintf(shop_file,
"%s~\n"
"%s~\n"
@ -469,9 +428,7 @@ int export_save_shops(zone_rnum zrnum)
S_NOTRADE(shop)
);
/*
* Save the rooms.
*/
/* Save the rooms. */
for (j = 0;S_ROOM(shop, j) != NOWHERE; j++) {
if (S_ROOM(shop, j) < genolc_zone_bottom(zrnum) ||
S_ROOM(shop, j) > zone_table[zrnum].top)
@ -481,9 +438,7 @@ int export_save_shops(zone_rnum zrnum)
}
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),
S_OPEN2(shop), S_CLOSE2(shop));
}
@ -518,7 +473,6 @@ int export_save_mobiles(zone_rnum rznum)
return TRUE;
}
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;
}
/*
* Print zone header to file
*/
/* Print zone header to file. */
fprintf(zone_file, "#QQ\n"
"%s~\n"
"%s~\n"
@ -595,8 +547,7 @@ int export_save_zone(zone_rnum zrnum)
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
* -------------------------------------------------
@ -609,8 +560,7 @@ int export_save_zone(zone_rnum zrnum)
* R (Remove) Room-Vnum Obj-Vnum Unused
* T (Trigger) Trig-type Trig-Vnum Room-Vnum
* V (var) Trig-type Context Room-Vnum Varname Value
* -------------------------------------------------
*/
* ------------------------------------------------- */
for (subcmd = 0; ZCMD(zrnum, subcmd).command != 'S'; subcmd++) {
switch (ZCMD(zrnum, subcmd).command) {
@ -686,9 +636,7 @@ int export_save_zone(zone_rnum zrnum)
ZCMD(zrnum, subcmd).sarg2);
break;
case '*':
/*
* Invalid commands are replaced with '*' - Ignore them.
*/
/* Invalid commands are replaced with '*' - Ignore them. */
continue;
default:
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!");
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++) {
if ((ornum = real_object(ovnum)) != NOTHING) {
if ((obj = &obj_proto[ornum])->action_description) {
@ -764,19 +710,13 @@ int export_save_objects(zone_rnum zrnum)
"%d %d %d %d\n",
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);
/*
* Do we have extra descriptions?
*/
/* Do we have extra descriptions? */
if (obj->ex_description) { /* Yes, save them too. */
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) {
mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: OLC: export_save_objects: Corrupt ex_desc!");
continue;
@ -788,9 +728,7 @@ int export_save_objects(zone_rnum zrnum)
"%s~\n", ex_desc->keyword, buf);
}
}
/*
* Do we have affects?
*/
/* Do we have affects? */
for (i = 0; i < MAX_OBJ_AFFECT; i++)
if (obj->affected[i].modifier)
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");
fclose(obj_file);
@ -831,15 +767,11 @@ int export_save_rooms(zone_rnum zrnum)
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 );
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);
fprintf(room_file, "#QQ%02d\n"
"%s%c\n"
@ -851,9 +783,7 @@ int export_save_rooms(zone_rnum zrnum)
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++) {
if (R_EXIT(room, j)) {
int dflag;
@ -863,9 +793,7 @@ int export_save_rooms(zone_rnum zrnum)
} else
*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_PICKPROOF))
dflag = 2;
@ -879,9 +807,7 @@ int export_save_rooms(zone_rnum zrnum)
else
*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)
fprintf(room_file,"D%d\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");
fclose(room_file);

View file

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

View file

@ -1,8 +1,9 @@
/************************************************************************
* Generic OLC Library - Shops / genshp.c v1.0 *
* Copyright 1996 by Harvey Gilpin *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) *
************************************************************************/
/**************************************************************************
* File: genshp.c Part of tbaMUD *
* Usage: Generic OLC Library - Shops. *
* *
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
@ -14,10 +15,8 @@
#include "genshp.h"
#include "genzon.h"
/*
* NOTE (gg): Didn't modify sedit much. Don't consider it as 'recent'
* as the other editors with regard to updates or style.
*/
/* NOTE (gg): Didn't modify sedit much. Don't consider it as 'recent' as the
* other editors with regard to updates or style. */
/* local functions */
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_type_list(struct shop_buy_data **list);
/*-------------------------------------------------------------------*/
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_KEEPER(tshop) = S_KEEPER(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_FUNC(tshop) = S_FUNC(fshop);
/*
* Copy lists over.
*/
/* Copy lists over. */
copy_shop_list(&(S_ROOMS(tshop)), S_ROOMS(fshop));
copy_shop_list(&(S_PRODUCTS(tshop)), S_PRODUCTS(fshop));
copy_shop_type_list(&(tshop->type), fshop->type);
/*
* Copy notification strings over.
*/
/* Copy notification strings over. */
if (free_old_strings)
free_shop_strings(tshop);
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)
{
int num_items, i;
@ -81,30 +68,19 @@ void copy_shop_list(IDXTYPE **tlist, IDXTYPE *flist)
if (*tlist)
free(*tlist);
/*
* Count number of entries.
*/
/* Count number of entries. */
for (i = 0; flist[i] != NOTHING; i++);
num_items = i + 1;
/*
* Make space for entries.
*/
/* Make space for entries. */
CREATE(*tlist, IDXTYPE, num_items);
/*
* Copy entries over.
*/
/* Copy entries over. */
for (i = 0; i < num_items; 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)
{
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)
free_shop_type_list(tlist);
/*
* Count number of entries.
*/
/* Count number of entries. */
for (i = 0; BUY_TYPE(flist[i]) != NOTHING; i++);
num_items = i + 1;
/*
* Make space for entries.
*/
/* Make space for entries. */
CREATE(*tlist, struct shop_buy_data, num_items);
/*
* Copy entries over.
*/
/* Copy entries over. */
for (i = 0; i < num_items; i++) {
(*tlist)[i].type = flist[i].type;
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)
{
int i, num_items;
struct shop_buy_data *nlist;
/*
* Count number of entries.
*/
/* Count number of entries. */
for (i = 0; (*list)[i].type != NOTHING; 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;
}
/*-------------------------------------------------------------------*/
void add_shop_to_type_list(struct shop_buy_data **list, struct shop_buy_data *newl)
{
int i, num_items;
struct shop_buy_data *nlist;
/*
* Count number of entries.
*/
/* Count number of entries. */
for (i = 0; (*list)[i].type != NOTHING; 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);
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 + 1].type = NOTHING;
/*
* Out with the old, in with the new.
*/
/* Out with the old, in with the new. */
free(*list);
*list = nlist;
}
/*-------------------------------------------------------------------*/
void add_shop_to_int_list(IDXTYPE **list, IDXTYPE newi)
{
IDXTYPE i, num_items, *nlist;
/*
* Count number of entries.
*/
/* Count number of entries. */
for (i = 0; (*list)[i] != NOTHING; 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);
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 + 1] = NOTHING;
/*
* Out with the old, in with the new.
*/
/* Out with the old, in with the new. */
free(*list);
*list = nlist;
}
/*-------------------------------------------------------------------*/
void remove_shop_from_int_list(IDXTYPE **list, IDXTYPE num)
{
IDXTYPE i, num_items, *nlist;
/*
* Count number of entries.
*/
/* Count number of entries. */
for (i = 0; (*list)[i] != NOTHING; i++);
#if CIRCLE_UNSIGNED_INDEX
@ -246,11 +192,7 @@ void remove_shop_from_int_list(IDXTYPE **list, IDXTYPE num)
*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)
{
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)
{
int i;
@ -300,11 +238,7 @@ void free_shop_type_list(struct shop_buy_data **list)
*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)
{
free_shop_strings(shop);
@ -314,12 +248,8 @@ void free_shop(struct shop_data *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)
{
int bot, top, mid;
@ -340,20 +270,14 @@ shop_rnum real_shop(shop_vnum vnum)
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)
{
char buf[MAX_STRING_LENGTH];
char *pointer;
/*
* Check the '%s' is present, if not, add it.
*/
/* Check the '%s' is present, if not, add it. */
if (*new_s != '%') {
snprintf(buf, sizeof(buf), "%%s %s", new_s);
pointer = buf;
@ -365,17 +289,13 @@ void modify_shop_string(char **str, char *new_s)
*str = strdup(pointer);
}
/*-------------------------------------------------------------------*/
int add_shop(struct shop_data *nshp)
{
shop_rnum rshop;
int found = 0;
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) {
/* free old strings. They're not used in any other place -- Welcor */
copy_shop(&shop_index[rshop], nshp, TRUE);
@ -421,8 +341,6 @@ int add_shop(struct shop_data *nshp)
return rshop;
}
/*-------------------------------------------------------------------*/
int save_shops(zone_rnum zone_num)
{
int i, j, rshop;
@ -448,47 +366,31 @@ int save_shops(zone_rnum zone_num)
fclose(shop_file);
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++) {
if ((rshop = real_shop(i)) != NOWHERE) {
fprintf(shop_file, "#%d~\n", i);
shop = shop_index + rshop;
/*
* Save the products.
*/
/* Save the products. */
for (j = 0; S_PRODUCT(shop, j) != NOTHING; j++)
fprintf(shop_file, "%d\n", obj_index[S_PRODUCT(shop, j)].vnum);
fprintf(shop_file, "-1\n");
/*
* Save the rates.
*/
/* Save the rates. */
fprintf(shop_file, "%1.2f\n"
"%1.2f\n",
S_BUYPROFIT(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++)
fprintf(shop_file, "%d%s\n",
S_BUYTYPE(shop, j),
S_BUYWORD(shop, j) ? S_BUYWORD(shop, j) : "");
fprintf(shop_file, "-1\n");
/* Not allowed to use Ascii in shopfile anymore (bpl21)
sprintascii(buf1, S_BITVECTOR(shop));
sprintascii(buf2, S_NOTRADE(shop));
*/
/*
* Save messages'n'stuff.
* Added some small'n'silly defaults as sanity checks.
*/
/* Save messages. Added some defaults as sanity checks. */
fprintf(shop_file,
"%s~\n"
"%s~\n"
@ -514,16 +416,12 @@ int save_shops(zone_rnum zone_num)
S_NOTRADE(shop)
);
/*
* Save the rooms.
*/
/* Save the rooms. */
for (j = 0;S_ROOM(shop, j) != NOWHERE; j++)
fprintf(shop_file, "%d\n", S_ROOM(shop, j));
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),
S_OPEN2(shop), S_CLOSE2(shop));
}

View file

@ -1,8 +1,10 @@
/************************************************************************
* Generic OLC Library - Shops / genshp.h v1.0 *
* Copyright 1996 by Harvey Gilpin *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) *
************************************************************************/
/**************************************************************************
* File: genshp.h Part of tbaMUD *
* *
* 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 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);
shop_rnum real_shop(shop_vnum vnum);
/*
* Handy macros.
*/
/* Handy macros. */
#define S_NUM(i) ((i)->vnum)
#define S_KEEPER(i) ((i)->keeper)
#define S_OPEN1(i) ((i)->open1)

View file

@ -1,13 +1,12 @@
/************************************************************************
* Generic OLC Library - Rooms / genwld.c v1.0 *
* Original author: Levork *
* Copyright 1996 by Harvey Gilpin *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) *
************************************************************************/
/**************************************************************************
* File: genwld.c Part of tbaMUD *
* Usage: Generic OLC Library - Rooms. *
* *
* By Levork. Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.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_frozen_start_room;
/*
* This function will copy the strings so be sure you free your own
* copies of the description, title, and such.
*/
/* This function will copy the strings so be sure you free your own copies of
* the description, title, and such. */
room_rnum add_room(struct room_data *room)
{
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);
/* 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 (j = 0; ZCMD(i, j).command != 'S'; j++)
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!");
}
/*
* 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_immort_start_room += (r_immort_start_room >= found);
r_frozen_start_room += (r_frozen_start_room >= found);
/*
* Update world exits.
*/
/* Update world exits. */
i = top_of_world + 1;
do {
i--;
@ -127,14 +117,10 @@ room_rnum add_room(struct room_data *room)
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;
}
/* -------------------------------------------------------------------------- */
int delete_room(room_rnum rnum)
{
room_rnum i;
@ -166,10 +152,8 @@ int delete_room(room_rnum rnum)
r_frozen_start_room = 0; /* The Void */
}
/*
* Dump the contents of this room into the Void. We could also just
* extract the people, mobs, and objects here.
*/
/* Dump the contents of this room into the Void. We could also just extract
* the people, mobs, and objects here. */
for (obj = world[rnum].contents; obj; obj = next_obj) {
next_obj = obj->next_content;
obj_from_room(obj);
@ -186,10 +170,8 @@ int delete_room(room_rnum rnum)
extract_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 pointing to rooms above this.
*/
/* Change any exit going to this room to go the void. Also fix all the exits
* pointing to rooms above this. */
i = top_of_world + 1;
do {
i--;
@ -216,9 +198,7 @@ int delete_room(room_rnum rnum)
}
} 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 (j = 0; ZCMD(i , j).command != 'S'; j++)
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!");
}
/*
* Remove this room from all shop lists.
*/
/* Remove this room from all shop lists. */
for (i = 0;i < top_shop;i++) {
for (j = 0;SHOP_ROOM(i, j) != NOWHERE;j++) {
if (SHOP_ROOM(i, j) == world[rnum].number)
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++) {
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;
}
int save_rooms(zone_rnum rzone)
{
int i;
@ -313,15 +288,11 @@ int save_rooms(zone_rnum rzone)
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 );
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);
fprintf(sf, "#%d\n"
"%s%c\n"
@ -333,9 +304,7 @@ int save_rooms(zone_rnum rzone)
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++) {
if (R_EXIT(room, j)) {
int dflag;
@ -345,9 +314,7 @@ int save_rooms(zone_rnum rzone)
} else
*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_PICKPROOF))
dflag = 2;
@ -361,9 +328,7 @@ int save_rooms(zone_rnum rzone)
else
*buf1 = '\0';
/*
* Now write the exit to the file.
*/
/* Now write the exit to the file. */
fprintf(sf, "D%d\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");
fclose(sf);
@ -413,17 +376,14 @@ int copy_room(struct room_data *to, struct room_data *from)
*to = *from;
copy_room_strings(to, from);
/* Don't put people and objects in two locations.
Am thinking this shouldn't be done here... */
/* Don't put people and objects in two locations. Should this be done here? */
from->people = NULL;
from->contents = NULL;
return TRUE;
}
/*
* Idea by: Cris Jacobin <jacobin@bellatlantic.net>
*/
/* Idea by Cris Jacob. */
room_rnum duplicate_room(room_vnum dest_vnum, room_rnum orig)
{
int new_rnum, znum;
@ -441,9 +401,7 @@ room_rnum duplicate_room(room_vnum dest_vnum, room_rnum orig)
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) {
log("SYSERR: GenOLC: copy_room: Problem adding room.");
return NOWHERE;
@ -453,21 +411,17 @@ room_rnum duplicate_room(room_vnum dest_vnum, room_rnum orig)
nroom.number = dest_vnum;
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.people = NULL;
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, be sure to free_room_strings() the 'dest' room first.
*/
/* 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,
* be sure to free_room_strings() the 'dest' room first. */
int copy_room_strings(struct room_data *dest, struct room_data *source)
{
int i;

View file

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

View file

@ -1,8 +1,9 @@
/************************************************************************
* Generic OLC Library - Zones / genzon.c v1.0 *
* Copyright 1996 by Harvey Gilpin *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) *
************************************************************************/
/**************************************************************************
* File: genzon.c Part of tbaMUD *
* Usage: Generic OLC Library - Zones. *
* *
* Copyright 1996 by Harvey Gilpin, 1997-2001 by George Greer. *
**************************************************************************/
#include "conf.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;
}
/*
* Create the zone file.
*/
/* Create the zone file. */
snprintf(buf, sizeof(buf), "%s/%d.zon", ZON_PREFIX, vzone_num);
if (!(fp = fopen(buf, "w"))) {
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);
fclose(fp);
/*
* Create the room file.
*/
/* Create the room file. */
snprintf(buf, sizeof(buf), "%s/%d.wld", WLD_PREFIX, vzone_num);
if (!(fp = fopen(buf, "w"))) {
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);
fclose(fp);
/*
* Create the mobile file.
*/
/* Create the mobile file. */
snprintf(buf, sizeof(buf), "%s/%d.mob", MOB_PREFIX, vzone_num);
if (!(fp = fopen(buf, "w"))) {
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");
fclose(fp);
/*
* Create the object file.
*/
/* Create the object file. */
snprintf(buf, sizeof(buf), "%s/%d.obj", OBJ_PREFIX, vzone_num);
if (!(fp = fopen(buf, "w"))) {
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");
fclose(fp);
/*
* Create the shop file.
*/
/* Create the shop file. */
snprintf(buf, sizeof(buf), "%s/%d.shp", SHP_PREFIX, vzone_num);
if (!(fp = fopen(buf, "w"))) {
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");
fclose(fp);
/*
* Create the trigger file.
*/
/* Create the trigger file. */
snprintf(buf, sizeof(buf), "%s/%d.trg", TRG_PREFIX, vzone_num);
if (!(fp = fopen(buf, "w"))) {
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");
fclose(fp);
/*
* Update index files.
*/
/* Update index files. */
create_world_index(vzone_num, "zon");
create_world_index(vzone_num, "wld");
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, "trg");
/*
* Make a new zone in memory. This was the source of all the zedit new
* crashes reported to the CircleMUD list. It was happily overwriting
* the stack. This new loop by Andrew Helm fixes that problem and is
* more understandable at the same time.
/* 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
* 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
* 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);
zone_table[top_of_zone_table + 1].number = 32000;
@ -180,9 +164,7 @@ rznum = i;
}
zone = &zone_table[rznum];
/*
* Ok, insert the new zone here.
*/
/* Ok, insert the new zone here. */
zone->name = strdup("New Zone");
zone->number = vzone_num;
zone->builders = strdup("None");
@ -191,9 +173,7 @@ rznum = i;
zone->lifespan = 30;
zone->age = 0;
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);
zone->cmd[0].command = 'S';
@ -203,8 +183,6 @@ rznum = i;
return rznum;
}
/*-------------------------------------------------------------------*/
void create_world_index(int znum, const char *type)
{
FILE *newfile, *oldfile;
@ -233,9 +211,7 @@ void create_world_index(int znum, const char *type)
prefix = TRG_PREFIX;
break;
default:
/*
* Caller messed up
*/
/* Caller messed up. */
return;
}
@ -251,16 +227,12 @@ void create_world_index(int znum, const char *type)
return;
}
/*
* Index contents must be in order: search through the old file for the
* right place, insert the new file, then copy the rest over.
*/
/* Index contents must be in order: search through the old file for the right
* place, insert the new file, then copy the rest over. */
snprintf(buf1, sizeof(buf1), "%d.%s", znum, type);
while (get_line(oldfile, buf)) {
if (*buf == '$') {
/*
* The following used to add a blank line, thanks to Brian Taylor for the fix... (Mythran)
*/
/* The following used to add a blank line, thanks to Brian Taylor for the fix. */
fprintf(newfile, "%s", (!found ? strncat(buf1, "\n$\n", sizeof(buf1)-1) : "$\n"));
break;
} else if (!found) {
@ -275,23 +247,17 @@ void create_world_index(int znum, const char *type)
fclose(newfile);
fclose(oldfile);
/*
* Out with the old, in with the new.
*/
/* Out with the old, in with the new. */
remove(old_name);
rename(new_name, old_name);
}
/*-------------------------------------------------------------------*/
void remove_room_zone_commands(zone_rnum zone, room_rnum room_num)
{
int subcmd = 0, cmd_room = -2;
/*
* Delete all entries in zone_table that relate to this room so we
* can add all the ones we have in their place.
*/
/* Delete all entries in zone_table that relate to this room so we can add
* all the ones we have in their place. */
while (zone_table[zone].cmd[subcmd].command != 'S') {
switch (zone_table[zone].cmd[subcmd].command) {
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 subcmd, arg1 = -1, arg2 = -1, arg3 = -1;
@ -343,9 +305,7 @@ int save_zone(zone_rnum zone_num)
return FALSE;
}
/*
* Print zone header to file
*/
/* Print zone header to file. */
fprintf(zfile, "#%d\n"
"%s~\n"
"%s~\n"
@ -361,8 +321,7 @@ int save_zone(zone_rnum zone_num)
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
* -------------------------------------------------
@ -375,8 +334,7 @@ int save_zone(zone_rnum zone_num)
* R (Remove) Room-Vnum Obj-Vnum Unused
* T (Trigger) Trig-type Trig-Vnum Room-Vnum
* V (var) Trig-type Context Room-Vnum Varname Value
* -------------------------------------------------
*/
* ------------------------------------------------- */
for (subcmd = 0; ZCMD(zone_num, subcmd).command != 'S'; subcmd++) {
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;
break;
case '*':
/*
* Invalid commands are replaced with '*' - Ignore them.
*/
/* Invalid commands are replaced with '*' - Ignore them. */
continue;
default:
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;
}
/*-------------------------------------------------------------------*/
/*
* 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 = 0;
@ -476,130 +428,89 @@ int count_commands(struct reset_com *list)
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)
{
int count, i, l;
struct reset_com *newlist;
/*
* Count number of commands (not including terminator).
*/
/* Count number of commands (not including terminator). */
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);
/*
* 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++) {
newlist[i] = ((i == pos) ? *newcmd : (*list)[l++]);
}
/*
* Add terminator, then insert new list.
*/
/* Add terminator, then insert new list. */
newlist[count + 1].command = 'S';
free(*list);
*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)
{
int count, i, l;
struct reset_com *newlist;
/*
* Count number of commands (not including terminator)
*/
/* Count number of commands (not including terminator). */
count = count_commands(*list);
/*
* Value is 'count' because we didn't include the terminator above
* but since we're deleting one thing anyway we want one less.
*/
/* Value is 'count' because we didn't include the terminator above but since
* we're deleting one thing anyway we want one less. */
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++) {
if (i != pos) {
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';
free(*list);
*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 subcmd = 0;
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')
subcmd++;
if (pos < 0 || pos > subcmd)
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);
new_com->command = 'N';
add_cmd_to_list(&zone->cmd, new_com, pos);
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)
{
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')
subcmd++;
if (pos < 0 || pos >= subcmd)
return;
/*
* Ok, let's zap it
*/
/* Ok, let's zap it. */
remove_cmd_from_list(&zone->cmd, pos);
}
/*-------------------------------------------------------------------*/

View file

@ -1,8 +1,10 @@
/************************************************************************
* Generic OLC Library - Zones / genzon.h v1.0 *
* Copyright 1996 by Harvey Gilpin *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) *
************************************************************************/
/**************************************************************************
* File: genzon.h Part of tbaMUD *
* *
* 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);
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);
zone_rnum real_zone_by_thing(room_vnum vznum);
/* Make delete_zone() */

View file

@ -1,8 +1,8 @@
/* ************************************************************************
* File: graph.c Part of CircleMUD *
* Usage: various graph algorithms *
/**************************************************************************
* File: graph.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
@ -10,8 +10,6 @@
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"
@ -20,7 +18,6 @@
#include "db.h"
#include "spells.h"
/* external functions */
ACMD(do_say);
@ -79,7 +76,6 @@ void bfs_enqueue(room_rnum room, int dir)
queue_head = queue_tail = curr;
}
void bfs_dequeue(void)
{
struct bfs_queue_struct *curr;
@ -91,21 +87,16 @@ void bfs_dequeue(void)
free(curr);
}
void bfs_clear_queue(void)
{
while (queue_head)
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 mobile_activity, give a mob a dir to go if they're
* tracking another mob or a PC. Or, a 'track' skill for PCs.
*/
/* 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
* 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 curr_dir;
@ -150,11 +141,7 @@ int find_first_step(room_rnum src, room_rnum target)
return (BFS_NO_PATH);
}
/********************************************************
* Functions and Commands which use the above functions. *
********************************************************/
/* Functions and Commands which use the above functions. */
ACMD(do_track)
{
char arg[MAX_INPUT_LENGTH];
@ -212,7 +199,6 @@ ACMD(do_track)
}
}
void hunt_victim(struct char_data *ch)
{
int dir;

View file

@ -1,8 +1,8 @@
/* ************************************************************************
* File: handler.c Part of CircleMUD *
* Usage: internal funcs: moving and finding chars/objs *
/**************************************************************************
* File: handler.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
@ -49,8 +49,7 @@ char *fname(const char *namelist)
return (holder);
}
/* Stock isname(). Leave this here even if you put in a newer *
* isname(). Used for OasisOLC. */
/* Leave this here even if you put in a newer isname(). Used for OasisOLC. */
int is_name(const char *str, const char *namelist)
{
const char *curname, *curstr;
@ -139,17 +138,10 @@ void affect_modify(struct char_data *ch, byte loc, sbyte mod,
GET_CHA(ch) += mod;
break;
/* Do Not Use. */
case APPLY_CLASS:
/* ??? GET_CLASS(ch) += mod; */
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:
/* ??? GET_LEVEL(ch) += mod; */
break;
case APPLY_AGE:
@ -236,7 +228,6 @@ void affect_total(struct char_data *ch)
GET_OBJ_AFFECT(GET_EQ(ch, i)), FALSE);
}
for (af = ch->affected; af; af = af->next)
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);
}
/* JE 7/18/94 :-) :-) */
/* JE */
if (!str_cmp(name, "self") || !str_cmp(name, "me"))
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 *
* *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
/* handling the affected-structures */
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);
int get_number(char **name);
/* ******** objects *********** */
/* objects */
void obj_to_char(struct obj_data *object, struct char_data *ch);
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);
/* ******* characters ********* */
/* characters*/
struct char_data *get_char_room(char *name, int *num, room_rnum room);
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[]);
int get_obj_pos_in_equip_vis(struct char_data *ch, char *arg, int *num, struct obj_data *equipment[]);
/* find all dots */
int find_all_dots(char *arg);
#define FIND_INDIV 0
@ -77,7 +74,6 @@ int find_all_dots(char *arg);
/* Generic Find */
int generic_find(char *arg, bitvector_t bitvector, struct char_data *ch,
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 */
int Crash_delete_file(char *name);
int Crash_delete_crashfile(struct char_data *ch);
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);
/* For new last command: */
#define LAST_FILE LIB_ETC"last"
#define LAST_CONNECT 0

View file

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

View file

@ -1,16 +1,15 @@
/* ************************************************************************
* File: house.c Part of CircleMUD *
* Usage: Handling of player houses *
/**************************************************************************
* File: house.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "comm.h"
#include "handler.h"
@ -44,15 +43,13 @@ void House_listrent(struct char_data *ch, room_vnum vnum);
ACMD(do_hcontrol);
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);
void hcontrol_convert_houses(struct char_data *ch);
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 */
/* Return a filename given a house vnum */
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);
}
/* Load all objects for a house */
int House_load(room_vnum vnum)
{
@ -98,9 +94,8 @@ int House_load(room_vnum vnum)
return (1);
}
/* Save all objects for a house (recursive; initial call must be followed
by a call to House_restore_weight) Assumes file is open already. */
/* Save all objects for a house (recursive; initial call must be followed by a
* call to House_restore_weight) Assumes file is open already. */
int House_save(struct obj_data *obj, FILE *fp)
{
struct obj_data *tmp;
@ -119,7 +114,6 @@ int House_save(struct obj_data *obj, FILE *fp)
return (1);
}
/* restore weight of containers after House_save has changed them for saving */
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 */
void House_crashsave(room_vnum vnum)
{
@ -156,7 +149,6 @@ void House_crashsave(room_vnum vnum)
REMOVE_BIT(ROOM_FLAGS(rnum), ROOM_HOUSE_CRASH);
}
/* Delete a house save file */
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));
}
/* List all objects in a house file */
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);
}
/******************************************************************
* Functions for house administration (creation, deletion, etc. *
*****************************************************************/
/* Functions for house administration (creation, deletion, etc. */
int find_house(room_vnum vnum)
{
int i;
@ -232,8 +217,6 @@ int find_house(room_vnum vnum)
return (NOWHERE);
}
/* Save the house control information */
void House_save_control(void)
{
@ -249,9 +232,8 @@ void House_save_control(void)
fclose(fl);
}
/* call from boot_db - will load control recs, load objs, set atrium bits */
/* should do sanity checks on vnums & remove invalid records */
/* Call from boot_db - will load control recs, load objs, set atrium bits.
* Should do sanity checks on vnums & remove invalid records. */
void House_boot(void)
{
struct house_control_rec temp_house;
@ -302,10 +284,7 @@ void House_boot(void)
House_save_control();
}
/* "House Control" functions */
const char *HCONTROL_FORMAT =
"Usage: hcontrol build <house vnum> <exit direction> <player name>\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)
{
char arg1[MAX_INPUT_LENGTH];
@ -456,8 +433,6 @@ void hcontrol_build_house(struct char_data *ch, char *arg)
House_save_control();
}
void hcontrol_destroy_house(struct char_data *ch, char *arg)
{
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");
House_save_control();
/*
* Now, reset the ROOM_ATRIUM flag on all existing houses' atriums,
* just in case the house we just deleted shared an atrium with another
* house. --JE 9/19/94
*/
/* Now, reset the ROOM_ATRIUM flag on all existing houses' atriums, just in
* case the house we just deleted shared an atrium with another house. -JE */
for (i = 0; i < num_of_houses; i++)
if ((real_atrium = real_room(house_control[i].atrium)) != NOWHERE)
SET_BIT(ROOM_FLAGS(real_atrium), ROOM_ATRIUM);
}
void hcontrol_pay_house(struct char_data *ch, char *arg)
{
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 */
ACMD(do_hcontrol)
{
@ -535,16 +505,14 @@ ACMD(do_hcontrol)
hcontrol_pay_house(ch, arg2);
else if (is_abbrev(arg1, "show"))
hcontrol_list_houses(ch, arg2);
// CONVERSION code starts here -- see comment below
// not in hcontrol_format
/* CONVERSION code starts here -- see comment below not in hcontrol_format. */
else if (!str_cmp(arg1, "asciiconvert"))
hcontrol_convert_houses(ch);
// CONVERSION ends here -- read more below
/* CONVERSION ends here -- read more below. */
else
send_to_char(ch, "%s", HCONTROL_FORMAT);
}
/* The house command, used by mortal house owners to assign guests */
ACMD(do_house)
{
@ -586,11 +554,7 @@ ACMD(do_house)
}
}
/* Misc. administrative functions */
/* crash-save all the houses */
void House_save_all(void)
{
@ -603,7 +567,6 @@ void House_save_all(void)
House_crashsave(house_control[i].vnum);
}
/* note: arg passed must be house vnum, so there. */
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");
}
/* ***********************************************************************
/*************************************************************************
* All code below this point and the code above, marked "CONVERSION" *
* can be removed after you have converted your house rent files using *
* 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. *
* After you have converted your house files, I suggest a reboot, which *
* will let your house files load on the next bootup. *
* *
* Welcor *
* ***********************************************************************/
/*
* Code for conversion to ascii house rent files
*/
* will let your house files load on the next bootup. -Welcor *
************************************************************************/
/* Code for conversion to ascii house rent files. */
void hcontrol_convert_houses(struct char_data *ch)
{
int i;
@ -691,7 +649,7 @@ void hcontrol_convert_houses(struct char_data *ch)
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;
}
else
@ -702,7 +660,6 @@ void hcontrol_convert_houses(struct char_data *ch)
send_to_char(ch, "All done.\r\n");
}
int ascii_convert_house(struct char_data *ch, obj_vnum vnum)
{
FILE *in, *out;
@ -761,17 +718,13 @@ int ascii_convert_house(struct char_data *ch, obj_vnum vnum)
fclose(in);
fclose(out);
// copy the new file over the old one
// remove(infile);
// rename(outfile, infile);
free(outfile);
send_to_char(ch, "...%d items", j);
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;

View file

@ -1,12 +1,10 @@
/*
improved-edit.c Routines specific to the improved editor.
*/
/**************************************************************************
* File: improved-edit.c Part of tbaMUD *
* Usage: Routines specific to the improved editor. *
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "db.h"
@ -93,9 +91,7 @@ int improved_editor_execute(struct descriptor_data *d, char *str)
return STRINGADD_ACTION;
}
/*
* Handle some editor commands.
*/
/* Handle some editor commands. */
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;
@ -240,10 +236,8 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d)
}
break;
case PARSE_LIST_NORM:
/*
* Note: Rv's buf, buf1, buf2, and arg variables are defined to 32k so
* they are probly ok for what to do here.
*/
/* Note: Rv's buf, buf1, buf2, and arg variables are defined to 32k so they
* are ok for what we do here. */
*buf = '\0';
if (*string)
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;
} else
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 " : " ");
page_string(d, buf, TRUE);
break;
case PARSE_LIST_NUM:
/*
* Note: Rv's buf, buf1, buf2, and arg variables are defined to 32k so
* they are probly ok for what to do here.
*/
/* Note: Rv's buf, buf1, buf2, and arg variables are defined to 32k so they
* are probably ok for what we do here. */
*buf = '\0';
if (*string)
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;
}
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)
if ((s = strchr(s, '\n')) != NULL) {
i++;
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) {
write_to_output(d, "Line number out of range; change aborted.\r\n");
return;
}
/*
* 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.
*/
/* 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. */
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;
*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);
*s = temp;
}
/*
* Put the new 'good' line into place.
*/
/* Put the new 'good' line into place. */
strcat(buf, buf2);
if ((s = strchr(s, '\n')) != NULL) {
/*
* This means that we are at the END of the line, we want out of
* there, but we want s to point to the beginning of the line
* AFTER the line we want edited
*/
/* This means that we are at the END of the line, we want out of there,
* but we want s to point to the beginning of the line. AFTER the line
* we want edited. */
s++;
/*
* Now put the last 'good' half of buffer into storage.
*/
/* Now put the last 'good' half of buffer into storage. */
strcat(buf, s);
}
/*
* Check for buffer overflow.
*/
/* Check for buffer overflow. */
if (strlen(buf) > d->max_str) {
write_to_output(d, "Change causes new length to exceed buffer maximum size, aborted.\r\n");
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);
strcpy(*d->str, buf);
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 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... */
if ((flow = *ptr_string) == NULL)
return 0;
@ -573,25 +539,18 @@ int format_text(char **ptr_string, int mode, struct descriptor_data *d, unsigned
cap_next = TRUE;
}
/*
* This is so that if we stopped on a sentence .. we move off the
* sentence delimiter.
*/
/* This is so that if we stopped on a sentence, we move off the sentence
* delimiter. */
while (strchr(".!?", *flow)) {
cap_next_next = TRUE;
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
* to the \r (or \n) character after the delimiter. Thus *flow will
* be non-null, and an extra (blank) line might be added erroneously.
* We fix it by skipping the newline characters in between.
*
* Welcor 04/04
*/
* to the \r (or \n) character after the delimiter. Thus *flow will be
* non-null, and an extra (blank) line might be added erroneously. We
* fix it by skipping the newline characters in between. - Welcor */
if (strchr("\n\r", *flow)) {
*flow = '\0'; /* terminate 'start' string */
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.
* If do not wish to use the improved editor, put #if 0 below, otherwise
* you should leave the setting at #if 1.
*/
/**************************************************************************
* File: improved-edit.h Part of tbaMUD *
* *
* 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 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);
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_REPLACE 1
#define PARSE_HELP 2
@ -25,9 +27,7 @@ void send_editor_help(struct descriptor_data *d);
#define PARSE_LIST_NUM 6
#define PARSE_EDIT 7
/*
* Defines for the action variable.
*/
/* Defines for the action variable. */
#define STRINGADD_OK 0 /* Just keep adding text. */
#define STRINGADD_SAVE 1 /* Save current text. */
#define STRINGADD_ABORT 2 /* Abort edit, restore old text. */

View file

@ -1,12 +1,12 @@
/* ************************************************************************
* File: interpreter.c Part of CircleMUD *
* Usage: parse user commands, search for specials, call ACMD functions *
/**************************************************************************
* File: interpreter.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#define __INTERPRETER_C__
@ -48,7 +48,7 @@ void do_start(struct char_data *ch);
int parse_class(char arg);
int special(struct char_data *ch, int cmd, char *arg);
int isbanned(char *hostname);
int Valid_Name(char *newname);
int valid_name(char *newname);
void read_aliases(struct char_data *ch);
void delete_aliases(const char *charname);
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];
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) */
write_to_output(d, "Invalid name, please try another.\r\nName: ");
return;
@ -1360,7 +1360,7 @@ void nanny(struct descriptor_data *d, char *arg)
/* We get a false positive from the original deleted character. */
free_char(d->character);
/* 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: ");
return;
}
@ -1390,7 +1390,7 @@ void nanny(struct descriptor_data *d, char *arg)
/* player unknown -- make new 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: ");
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 *
* *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#define ACMD(name) \
void name(struct char_data *ch, char *argument, int cmd, int subcmd)

View file

@ -1,12 +1,12 @@
/* ************************************************************************
* File: limits.c Part of CircleMUD *
* Usage: limits & gain funcs for HMV, exp, hunger/thirst, idle time *
/**************************************************************************
* File: limits.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.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);
/* Class/Level calculations */
/* Skill/Spell calculations */
/* Position calculations */
switch (GET_POS(ch)) {

View file

@ -1,17 +1,15 @@
/* ************************************************************************
* File: magic.c Part of CircleMUD *
* Usage: low-level functions for magic; spell template code *
/**************************************************************************
* File: magic.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.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);
void affect_update(void);
/*
* Saving throws are now in class.c as of bpl13.
*/
/*
* 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.
*/
/* Negative apply_saving_throw[] values make saving throws better! 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)
{
/* 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);
}
/* affect_update: called from comm.c (causes spells to wear off) */
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 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.)
*/
/* 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
* implement your own spells which require ingredients (i.e. heal spells which
* requires a rare herb or some such.) */
int mag_materials(struct char_data *ch, int item0, int item1, int item2,
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 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 effect, whether it is added or replacement, whether it is legal or
* not, etc.
*
* affect_join(vict, aff, add_dur, avg_dur, add_mod, avg_mod)
*/
/* Every spell that does an affect comes through here. This determines the
* effect, whether it is added or replacement, whether it is legal or not, etc.
* affect_join(vict, aff, add_dur, avg_dur, add_mod, avg_mod) */
#define MAX_SPELL_AFFECTS 5 /* change if more needed */
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;
}
/*
* If this is a mob that has this affect set in its mob file, do not
* perform the affect. This prevents people from un-sancting mobs
* by sancting them and waiting for it to fade, for example.
*/
/* If this is a mob that has this affect set in its mob file, do not perform
* the affect. This prevents people from un-sancting mobs by sancting them
* and waiting for it to fade, for example. */
if (IS_NPC(victim) && !affected_by_spell(victim, spellnum))
for (i = 0; i < MAX_SPELL_AFFECTS; i++)
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;
}
/*
* If the victim is already affected by this spell, and the spell does
* not have an accumulative effect, then fail the spell.
*/
/* If the victim is already affected by this spell, and the spell does not
* have an accumulative effect, then fail the spell. */
if (affected_by_spell(victim,spellnum) && !(accum_duration||accum_affect)) {
send_to_char(ch, "%s", CONFIG_NOEFFECT);
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);
}
/*
* 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,
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 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.
*/
/* 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
* 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)
{
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);
}
/*
* 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)
{
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 -- 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.
*/
/* Every spell that affects an area (room) runs through here. These are
* generally offensive spells. This calls mag_damage to do the actual 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)
{
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)
return;
/*
* to add spells to this fn, just add the message here plus an entry
* in mag_damage for the damaging part of the spell.
*/
/* to add spells just add the message here plus an entry in mag_damage for
* the damaging part of the spell. */
switch (spellnum) {
case SPELL_EARTHQUAKE:
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) {
next_tch = tch->next_in_room;
/*
* The skips: 1: the caster
/* The skips: 1: the caster
* 2: immortals
* 3: if no pk on this mud, skips over all players
* 4: pets (charmed NPCs)
*/
* 4: pets (charmed NPCs) */
if (tch == ch)
continue;
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.
*
* 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.
*/
/* Every spell which summons/gates/conjours a mob comes through here. */
/* These use act(), don't put the \r\n. */
const char *mag_summon_msgs[] = {
"\r\n",
"$n makes a strange magical gesture; you feel a strong breeze!",
@ -690,9 +623,7 @@ const char *mag_summon_msgs[] = {
"$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[] = {
"\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"
};
/* 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. */
#define MOB_ELEMENTAL_BASE 20 /* Only one for now. */
#define MOB_ELEMENTAL_BASE 20
#define MOB_CLONE 10
#define MOB_ZOMBIE 11
#define MOB_AERIALSERVANT 19
void mag_summons(int level, struct char_data *ch, struct obj_data *obj,
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,
int spellnum, int savetype)
{
@ -818,7 +739,6 @@ void mag_points(int level, struct char_data *ch, struct char_data *victim,
update_pos(victim);
}
void mag_unaffects(int level, struct char_data *ch, struct char_data *victim,
int spellnum, int type)
{
@ -830,10 +750,8 @@ void mag_unaffects(int level, struct char_data *ch, struct char_data *victim,
switch (spellnum) {
case SPELL_HEAL:
/*
* Heal also restores health, so don't give the "no effect" message
* if the target isn't afflicted by the 'blindness' spell.
*/
/* Heal also restores health, so don't give the "no effect" message if the
* target isn't afflicted by the 'blindness' spell. */
msg_not_affected = FALSE;
/* fall-through */
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);
if (to_room != NULL)
act(to_room, TRUE, victim, 0, ch, TO_ROOM);
}
void mag_alter_objs(int level, struct char_data *ch, struct obj_data *obj,
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);
else if (to_char != NULL)
act(to_char, TRUE, ch, obj, 0, TO_ROOM);
}
void mag_creations(int level, struct char_data *ch, int spellnum)
{
struct obj_data *tobj;

View file

@ -1,24 +1,16 @@
/* ************************************************************************
* File: mail.c Part of CircleMUD *
* Usage: Internal funcs and player spec-procs of mud-mail system *
/**************************************************************************
* File: mail.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
/******* MUD MAIL SYSTEM MAIN FILE ***************************************
Written by Jeremy Elson (jelson@circlemud.org)
*************************************************************************/
/* And completely rewritten by Welcor 16th of december, 2005 */
* By Jeremy Elson. Rewritten by Welcor. *
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"
@ -27,7 +19,6 @@ Written by Jeremy Elson (jelson@circlemud.org)
#include "handler.h"
#include "mail.h"
/* external variables */
extern int no_mail;
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);
void write_mail_record(FILE *mail_file, struct mail_t *record);
/* -------------------------------------------------------------------------- */
char *decrypt_hex(char *string, size_t len)
{
static char output[MAX_STRING_LENGTH];
@ -82,8 +72,6 @@ char *encrypt_hex(char *string, size_t len)
return output;
}
int mail_recip_ok(const char *name)
{
int player_i, ret = FALSE;
@ -95,7 +83,6 @@ int mail_recip_ok(const char *name)
return ret;
}
void free_mail_record(struct mail_t *record)
{
if (record->body)
@ -139,13 +126,11 @@ void write_mail_record(FILE *mail_file, struct mail_t *record)
record->body );
}
/*
* int scan_file(none)
/* int scan_file(none)
* 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
* and indexes all entries currently in the mail file.
*/
* and indexes all entries currently in the mail file. */
int scan_file(void)
{
FILE *mail_file;
@ -171,13 +156,11 @@ int scan_file(void)
return TRUE;
}
/*
* int has_mail(long #1)
/* int has_mail(long #1)
* #1 - id number of the person to check for mail.
* 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)
{
FILE *mail_file;
@ -203,17 +186,14 @@ int has_mail(long recipient)
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.
* #2 - id number of the person the mail is from.
* #3 - The actual message to send.
*
* 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
* actual message text (char *).
*/
* actual message text (char *). */
void store_mail(long to, long from, char *message_pointer)
{
FILE *mail_file;
@ -235,17 +215,12 @@ void store_mail(long to, long from, char *message_pointer)
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.
* Returns the message text of the mail received.
*
* Retrieves one messsage for a player. The mail is then discarded from
* the file.
*
* Expects mail to exist.
*/
* the file. Expects mail to exist. */
char *read_delete(long recipient)
{
FILE *mail_file, *new_file;
@ -311,12 +286,7 @@ char *read_delete(long recipient)
return strdup(buf);
}
/****************************************************************
* Below is the spec_proc for a postmaster using the above *
* routines. Written by Jeremy Elson (jelson@circlemud.org) *
****************************************************************/
/* spec_proc for a postmaster using the above routines. By Jeremy Elson */
SPECIAL(postmaster)
{
if (!ch->desc || IS_NPC(ch))
@ -343,7 +313,6 @@ SPECIAL(postmaster)
return (0);
}
void postmaster_send_mail(struct char_data *ch, struct char_data *mailman,
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);
}
void postmaster_check_mail(struct char_data *ch, struct char_data *mailman,
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);
}
void postmaster_receive_mail(struct char_data *ch, struct char_data *mailman,
int cmd, char *arg)
{

View file

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

View file

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

View file

@ -1,17 +1,15 @@
/* ************************************************************************
* File: mobact.c Part of CircleMUD *
* Usage: Functions for generating intelligent (?) behavior in mobiles *
/**************************************************************************
* File: mobact.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "db.h"
@ -21,7 +19,6 @@
#include "spells.h"
#include "constants.h"
/* external globals */
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 monsters
* than the person can feasibly control at a time. Then the
/* Charmed Mob Rebellion: 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.
*
* 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 (!aggressive_mob_on_a_leash(ch, ch->master, ch->master)) {
if (CAN_SEE(ch, ch->master) && !PRF_FLAGGED(ch->master, PRF_NOHASSLE))
@ -180,10 +172,7 @@ void mobile_activity(void)
} /* end for() */
}
/* Mob Memory Routines */
/* make ch remember 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 */
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);
}
/* erase ch's memory */
void clearMemory(struct char_data *ch)
{
@ -247,13 +234,9 @@ void clearMemory(struct char_data *ch)
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 of it, eye them
* down, or otherwise intimidate the slave.
*/
/* 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
* 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)
{
static int snarl_cmd;

View file

@ -1,17 +1,15 @@
/* ************************************************************************
* File: modify.c Part of CircleMUD *
* Usage: Run-time modification of game variables *
/**************************************************************************
* File: modify.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "interpreter.h"
@ -50,7 +48,6 @@ const char *string_fields[] =
"\n"
};
/* maximum length for text field x+1 */
int length[] =
{
@ -61,39 +58,25 @@ int length[] =
60
};
/* ************************************************************************
* modification of malloc'ed strings *
************************************************************************ */
/*
* 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
*/
/* modification of malloc'ed strings */
/* 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 */
void smash_tilde(char *str)
{
/*
* Erase any _line ending_ tildes inserted in the editor.
* The load mechanism can't handle those, yet.
* -- Welcor 04/2003
*/
char *p = str;
for (; *p; p++)
if (*p == '~' && (*(p+1)=='\r' || *(p+1)=='\n' || *(p+1)=='\0'))
*p=' ';
/* Erase any _line ending_ tildes inserted in the editor. The load mechanism
* can't handle those, yet. - Welcor */
char *p = str;
for (; *p; p++)
if (*p == '~' && (*(p+1)=='\r' || *(p+1)=='\n' || *(p+1)=='\0'))
*p=' ';
}
/*
* Basic API function to start writing somewhere.
*
* 'data' isn't used in stock CircleMUD but you 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 instance.
*/
/* Basic API function to start writing somewhere. 'data' isn't used, but you
* can use it to pass whatever else you may want through it. The improved
* 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)
{
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;
}
/*
* Add user input to the 'current' string (as defined by d->str).
* This is still overly complex.
*/
/* Add user input to the 'current' string (as defined by d->str). This is still
* overly complex. */
void string_add(struct descriptor_data *d, char *str)
{
int action;
/* determine if this is the terminal string, and truncate if so */
/* changed to only accept '@' at the beginning of line - J. Elson 1/17/94 */
/* Determine if this is the terminal string, and truncate if so. Changed to
* only accept '@' at the beginning of line. - JE */
delete_doubledollar(str);
smash_tilde(str);
/* determine if this is the terminal string, and truncate if so */
/* changed to only accept '@' at the beginning of line - J. Elson 1/17/94 */
/* changed to only accept '@' if it's by itself - fnord 10/15/2004 */
/* Determine if this is the terminal string, and truncate if so. Changed to
* only accept '@' if it's by itself. - fnord */
if ((action = (*str == '@' && !str[1])))
*str = '\0';
else
@ -159,9 +139,7 @@ void string_add(struct descriptor_data *d, char *str)
}
}
/*
* Common cleanup code.
*/
/* Common cleanup code. */
switch (action) {
case STRINGADD_ABORT:
switch (STATE(d)) {
@ -197,7 +175,6 @@ void string_add(struct descriptor_data *d, char *str)
}
/* Ok, now final cleanup. */
if (action == STRINGADD_SAVE || action == STRINGADD_ABORT) {
int i;
struct {
@ -243,11 +220,10 @@ void playing_string_cleanup(struct descriptor_data *d, int action)
free(d->str);
}
/*
* We have no way of knowing which slot the post was sent to so we can only give the message...
*/
/* We have no way of knowing which slot the post was sent to so we can only
* give the message. */
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)
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;
}
/* **********************************************************************
* Modification of character skills *
********************************************************************** */
/* Modification of character skills. */
ACMD(do_skillset)
{
struct char_data *vict;
@ -342,27 +314,15 @@ ACMD(do_skillset)
return;
}
/*
* find_skill_num() guarantees a valid spell_info[] index, or -1, and we
* checked for the -1 above so we are safe here.
*/
/* find_skill_num() guarantees a valid spell_info[] index, or -1, and we
* checked for the -1 above so we are safe here. */
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);
send_to_char(ch, "You change %s's %s to %d.\r\n", GET_NAME(vict), spell_info[skill].name, value);
}
/*********************************************************************
* 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.
*/
/* 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. */
char *next_page(char *str, struct char_data *ch)
{
int col = 1, line = 1;
@ -394,9 +354,8 @@ char *next_page(char *str, struct char_data *ch)
else if (*str == '\n')
line++;
/* We need to check here and see if we are over the page width,
* and if so, compensate by going to the begining of the next line.
*/
/* We need to check here and see if we are over the page width, and if
* so, compensate by going to the begining of the next line. */
else if (col++ > PAGE_WIDTH) {
col = 1;
line++;
@ -414,11 +373,9 @@ int count_pages(char *str, struct char_data *ch)
return (pages);
}
/* This function assigns all the pointers for showstr_vector for the
* 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)
{
int i;
@ -432,7 +389,6 @@ void paginate_string(char *str, struct descriptor_data *d)
d->showstr_page = 0;
}
/* The call that gets the paging ball rolling... */
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);
}
/* The call that displays the next page. */
void show_string(struct descriptor_data *d, char *input)
{
@ -478,21 +433,15 @@ void show_string(struct descriptor_data *d, char *input)
}
return;
}
/* R is for refresh, so back up one page internally so we can display
* it again.
*/
/* Back up one page internally so we can display it again. */
else if (LOWER(*buf) == 'r')
d->showstr_page = MAX(0, d->showstr_page - 1);
/* B is for back, so back up two pages internally so we can display the
* correct page here.
*/
/* Back up two pages internally so we can display the correct page here. */
else if (LOWER(*buf) == 'b')
d->showstr_page = MAX(0, d->showstr_page - 2);
/* Feature to 'goto' a page. Just type the number of the page and you
* are there!
*/
/* Type the number of the page and you are there! */
else if (isdigit(*buf))
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;
}
/* If we're displaying the last page, just send it to the character, and
* then free up the space we used.
*/
/* also send a @n - to make color stop bleeding. -- Welcor */
* then free up the space we used. Also send a @n - to make color stop
* bleeding. - Welcor */
if (d->showstr_page + 1 >= d->showstr_count) {
send_to_char(d->character, "%s@n", d->showstr_vector[d->showstr_page]);
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 */
diff = MAX_STRING_LENGTH - 3;
strncpy(buffer, d->showstr_vector[d->showstr_page], diff); /* strncpy: OK (size truncated above) */
/*
* Fix for prompt overwriting last line in compact mode submitted by
* Peter Ajamian <peter@pajamian.dhs.org> on 04/21/2001
*/
/* Fix for prompt overwriting last line in compact mode by Peter Ajamian */
if (buffer[diff - 2] == '\r' && buffer[diff - 1]=='\n')
buffer[diff] = '\0';
else if (buffer[diff - 2] == '\n' && buffer[diff - 1] == '\r')

View file

@ -1,9 +1,9 @@
/************************************************************************
* OasisOLC - General / oasis.c v2.0 *
* Original author: Levork *
* Copyright 1996 by Harvey Gilpin *
* Copyright 1997-2001 by George Greer (greerga@circlemud.org) *
************************************************************************/
/**************************************************************************
* File: oasis.c Part of tbaMUD *
* Usage: Oasis - General. *
* *
* By Levork. Copyright 1996 Harvey Gilpin. 1997-2001 George Greer. *
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
@ -187,8 +187,6 @@ void cleanup_olc(struct descriptor_data *d, byte cleanup_type)
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)
{
char *tmp = argument, *ttag = tag, *wrt = argument;

View file

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

View file

@ -1,13 +1,13 @@
/******************************************************************************/
/** OasisOLC - InGame OLC Copying v2.0 **/
/** Original author: Levork **/
/** Copyright 1996 Harvey Gilpin **/
/** Copyright 1997-2001 George Greer (greerga@circlemud.org) **/
/** Copyright 2002 Kip Potter [Mythran] (kip_potter@hotmail.com) **/
/******************************************************************************/
/**************************************************************************
* File: oasis_copy.c Part of tbaMUD *
* Usage: Oasis OLC copying. *
* *
* By Levork. Copyright 1996 Harvey Gilpin. 1997-2001 George Greer. *
* 2002 Kip Potter [Mythran]. *
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"
@ -21,18 +21,13 @@
#include "improved-edit.h"
#include "constants.h"
/******************************************************************************/
/** Internal Functions **/
/******************************************************************************/
/* Internal Functions */
ACMD(do_dig);
ACMD(do_room_copy);
room_vnum redit_find_new_vnum(zone_rnum zone);
int buildwalk(struct char_data *ch, int dir);
/******************************************************************************/
/** Commands **/
/******************************************************************************/
/* Commands */
ACMD(do_dig)
{
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");
return;
}
/*
* Lets not allow digging to limbo.
* After all, it'd just get us more errors on 'show errors'
*/
/* Lets not allow digging to limbo. After all, it'd just get us more errors
* on 'show errors.' */
if (rvnum == 0) {
send_to_char(ch, "The target exists, but you can't dig to limbo!\r\n");
return;
}
/*
* target room == -1 removes the exit
*/
/* Target room == -1 removes the exit. */
if (rvnum == NOTHING) {
if (W_EXIT(IN_ROOM(ch), dir)) {
/* free the old pointers, if any */
@ -99,9 +90,7 @@ ACMD(do_dig)
"No exit removed.\r\n", dirs[dir]);
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)) {
send_to_char(ch, "There already is an exit to the %s.\r\n", dirs[dir]);
return;
@ -117,15 +106,11 @@ ACMD(do_dig)
send_to_char(ch, "You do not have permission to edit room #%d.\r\n", rvnum);
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 (rrnum == NOWHERE) {
/*
* Give the descriptor an olc struct.
* This way we can let redit_save_internally handle the room adding.
*/
/* Give the descriptor an olc struct. This way we can let
* redit_save_internally handle the room adding. */
if (d->olc) {
mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_dig: Player already had olc structure.");
free(d->olc);
@ -147,24 +132,18 @@ ACMD(do_dig)
OLC_ROOM(d)->zone = OLC_ZNUM(d);
OLC_ROOM(d)->number = NOWHERE;
/*
* Save the new room to memory.
* redit_save_internally handles adding the room in the right place, etc.
*/
/* Save the new room to memory. redit_save_internally handles adding the
* room in the right place, etc. */
redit_save_internally(d);
OLC_VAL(d) = 0;
send_to_char(ch, "New room (%d) created.\r\n", rvnum);
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);
}
/*
* Now dig.
*/
/* Now dig. */
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)->keyword = NULL;
@ -174,9 +153,7 @@ ACMD(do_dig)
send_to_char(ch, "You make an exit %s to room %d (%s).\r\n",
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]))
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]]);
@ -187,7 +164,6 @@ ACMD(do_dig)
W_EXIT(rrnum, rev_dir[dir])->to_room = IN_ROOM(ch);
add_to_save_list(zone_table[world[rrnum].zone].number, SL_WLD);
}
}
ACMD(do_room_copy)
@ -227,9 +203,7 @@ ACMD(do_room_copy)
room_dst->zone = dst_zone;
/*
* Allocate space for all strings.
*/
/* Allocate space for all strings. */
send_to_char(ch, "Cloning room....\r\n");
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->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");
if (world[IN_ROOM(ch)].ex_description) {
struct extra_descr_data *tdesc, *temp, *temp2;
@ -260,9 +231,7 @@ ACMD(do_room_copy)
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");
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);
return;
}
/* Idea contributed by C.Raehl 4/27/99 */
/* Idea contributed by C.Raehl. */
for (dsc = descriptor_list; dsc; dsc = dsc->next) {
if (dsc == ch->desc)
continue;
@ -301,11 +270,7 @@ ACMD(do_room_copy)
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 */
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");
} else {
struct descriptor_data *d = ch->desc;
/*
* Give the descriptor an olc struct.
* This way we can let redit_save_internally handle the room adding.
*/
/* Give the descriptor an olc struct. This way we can let
* redit_save_internally handle the room adding. */
if (d->olc) {
mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: buildwalk(): Player already had olc structure.");
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)->number = NOWHERE;
/*
* Save the new room to memory.
* redit_save_internally handles adding the room in the right place, etc.
*/
/* Save the new room to memory. redit_save_internally handles adding the
* room in the right place, etc. */
redit_save_internally(d);
OLC_VAL(d) = 0;

View file

@ -1,27 +1,13 @@
/************************************************************************
* OasisOLC - InGame OLC Deletion v2.0 *
* Original author: Levork *
* Copyright 1996 Harvey Gilpin *
* Copyright 1997-2001 George Greer (greerga@circlemud.org) *
* Copyright 2002 Kip Potter [Mythran] (kip_potter@hotmail.com) *
************************************************************************/
/*
+-----------------------------------------------------------------------+
| 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 |
+-----------------------------------------------------------------------+
*/
/**************************************************************************
* File: oasis_delete.c Part of tbaMUD *
* Usage: Oasis OLC deletion. *
* *
* By Levork. Copyright 1996 Harvey Gilpin. 1997-2001 George Greer. *
* 2002 Kip Potter [Mythran]. *
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.h"
#include "comm.h"
@ -32,17 +18,9 @@
#include "oasis.h"
#include "improved-edit.h"
/************************************************************************\
** Description : **
** Free's strings from any object, room, mobiles, or player. **
** **
** Return Value: **
** TRUE if successful, otherwise, it returns FALSE. **
** **
** Parameters : **
** type - The OLC type constant relating to the data type of data. **
\************************************************************************/
/* Free's strings from any object, room, mobiles, or player. TRUE if successful,
* otherwise, it returns FALSE. Type - The OLC type constant relating to the
* data type of data. */
int free_strings(void *data, int type)
{
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 **/
/** Original author: Levork **/
/** Copyright 1996 Harvey Gilpin **/
/** Copyright 1997-2001 George Greer (greerga@circlemud.org) **/
/** Copyright 2002 Kip Potter [Mythran] (kip_potter@hotmail.com) **/
/******************************************************************************/
/**************************************************************************
* File: oasis_list.c Part of tbaMUD *
* Usage: Oasis OLC listings. *
* *
* By Levork. Copyright 1996 Harvey Gilpin. 1997-2001 George Greer. *
* 2002 Kip Potter [Mythran]. *
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.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_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax);
/******************************************************************************/
/** Ingame Commands **/
/******************************************************************************/
/* Ingame Commands */
ACMD(do_oasis_list)
{
zone_rnum rzone = NOWHERE;
@ -53,7 +51,7 @@ ACMD(do_oasis_list)
return;
}
} else {
/** Listing by min vnum / max vnum. Retrieve the numeric values. **/
/* Listing by min vnum / max vnum. Retrieve the numeric values. */
vmin = atoi(smin);
vmax = atoi(smax);
@ -82,7 +80,6 @@ ACMD(do_oasis_list)
}
}
ACMD(do_oasis_links)
{
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)
{
room_rnum i;
room_vnum bottom, top;
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) {
bottom = zone_table[rnum].bot;
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");
}
/*
* 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)
{
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");
}
/*
* 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)
{
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");
}
/*
* 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)
{
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]",
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++)
send_to_char(ch, "%s%s[%s%-5d%s]%s",
((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)
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)
{
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");
}
/*
* 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)
{
zone_rnum rnum;
@ -370,10 +346,7 @@ void print_zone(struct char_data *ch, zone_vnum vnum)
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)
largest_table = 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
largest_table = top_of_mobt;
/****************************************************************************/
/** Initialize some of the variables. **/
/****************************************************************************/
/* Initialize some of the variables. */
size_rooms = 0;
size_objects = 0;
size_mobiles = 0;
@ -404,9 +375,7 @@ void print_zone(struct char_data *ch, zone_vnum vnum)
size_mobiles++;
}
/****************************************************************************/
/** Display all of the zone information at once. **/
/****************************************************************************/
/* Display all of the zone information at once. */
send_to_char(ch,
"%sVirtual Number = %s%d\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);
}
/* 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)
{
int i, bottom, top, counter = 0;
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) {
bottom = zone_table[rnum].bot;
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,
"Index VNum Trigger Name Type\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++) {
/** 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)) {

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 *
* *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.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_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)
{
int j;

View file

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

View file

@ -1,13 +1,13 @@
/**************************************************************************
* File: pfdefaults.h Part of tbaMUD *
* Usage: ASCII player file defaults. *
**************************************************************************/
#ifndef _PFDEFAULTS_H_
#define _PFDEFAULTS_H_
/*
ascii pfile variable defaults
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.
*/
/* WARNING: Do not change the values below if you have existing ascii player
* files you don't want to screw up. */
#define PFDEF_SEX 0
#define PFDEF_CLASS 0

View file

@ -1,16 +1,15 @@
/* ************************************************************************
* File: players.c Part of CircleMUD *
* Usage: Player loading/saving and utility routines *
/**************************************************************************
* File: players.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
#include "structs.h"
#include "utils.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 */
long top_idnum = 0; /* highest idnum in use */
/* external ASCII Player Files vars */
extern struct pclean_criteria_data pclean_criteria[];
/* ASCII Player Files - set this FALSE if you don't want poofin/poofout
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 */
/* New version to build player index for ASCII Player Files. Generate index
* table for the player file. */
void build_player_index(void)
{
int rec_count = 0, i;
@ -108,12 +91,9 @@ void build_player_index(void)
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 old position.
*/
/* 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
* old position. */
int create_entry(char *name)
{
int i, pos;
@ -132,7 +112,7 @@ int create_entry(char *name)
/* copy lowercase equivalent of name to table field */
for (i = 0; (player_table[pos].name[i] = LOWER(name[i])); i++)
/* Nothing */;
/* Nothing */;
/* clear the bitflag in case we have garbage data */
player_table[pos].flags = 0;
@ -140,7 +120,6 @@ int create_entry(char *name)
return (pos);
}
/* This function necessary to save a seperate ASCII player index */
void save_player_index(void)
{
@ -166,7 +145,6 @@ void save_player_index(void)
fclose(index_file);
}
void free_player_index(void)
{
int tp;
@ -183,7 +161,6 @@ void free_player_index(void)
top_of_p_table = 0;
}
long get_ptable_by_name(const char *name)
{
int i;
@ -195,7 +172,6 @@ long get_ptable_by_name(const char *name)
return (-1);
}
long get_id_by_name(const char *name)
{
int i;
@ -207,7 +183,6 @@ long get_id_by_name(const char *name)
return (-1);
}
char *get_name_by_id(long id)
{
int i;
@ -219,16 +194,11 @@ char *get_name_by_id(long id)
return (NULL);
}
/*************************************************************************
* stuff related to the save/load player system *
*************************************************************************/
/* Stuff related to the save/load player system. */
#define NUM_OF_SAVE_THROWS 5
/* new load_char reads ASCII Player Files */
/* Load a char, TRUE if loaded, FALSE if not */
/* New load_char reads ASCII Player Files. Load a char, TRUE if loaded, FALSE
* if not. */
int load_char(const char *name, struct char_data *ch)
{
int id, i;
@ -246,8 +216,7 @@ int load_char(const char *name, struct char_data *ch)
return (-1);
}
/* character initializations */
/* initializations necessary to keep some things straight */
/* Character initializations. Necessary to keep some things straight. */
ch->affected = NULL;
for (i = 1; i <= MAX_SKILLS; i++)
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);
else if (!strcmp(tag, "Pass")) strcpy(GET_PASSWD(ch), 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, "PfOt")) POOFOUT(ch) = strdup(line);
#endif
else if (!strcmp(tag, "Pref")) PRF_FLAGS(ch) = asciiflag_conv(line);
break;
@ -437,12 +404,8 @@ int load_char(const char *name, struct char_data *ch)
return(id);
}
/*
* write the vital data of a player to the player file
*
* And that's it! No more fudging around with the load room.
*/
/* This is the ASCII Player Files save routine */
/* Write the vital data of a player to the player file. */
/* This is the ASCII Player Files save routine. */
void save_char(struct char_data * ch)
{
FILE *fl;
@ -454,10 +417,7 @@ void save_char(struct char_data * ch)
if (IS_NPC(ch) || GET_PFILEPOS(ch) < 0)
return;
/*
* If ch->desc is not null, then we need to update some session data
* before saving.
*/
/* If ch->desc is not null, then update session data before saving. */
if (ch->desc) {
if (ch->desc->host && *ch->desc->host) {
if (!GET_HOST(ch))
@ -468,10 +428,7 @@ void save_char(struct char_data * ch)
}
}
/*
* We only update the time.played and time.logon if the character
* is playing.
*/
/* Only update the time.played and time.logon if the character is playing. */
if (STATE(ch->desc) == CON_PLAYING) {
ch->player.time.played += time(0) - ch->player.time.logon;
ch->player.time.logon = time(0);
@ -485,9 +442,7 @@ void save_char(struct char_data * ch)
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++) {
if (GET_EQ(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;
}
}
// save_char_vars(ch);
/*
* remove the affections so that the raw values are stored; otherwise the
* effects are doubled when the char logs back in.
*/
/* Remove the affections so that the raw values are stored; otherwise the
* effects are doubled when the char logs back in. */
while (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!!!");
ch->aff_abils = ch->real_abils;
/* end char_to_store code */
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);
fprintf(fl, "Desc:\n%s~\n", buf);
}
#if ASCII_SAVE_POOFS
if (POOFIN(ch)) fprintf(fl, "PfIn: %s\n", POOFIN(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_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));
@ -635,9 +584,7 @@ void save_char(struct char_data * ch)
fclose(fl);
/* more char_to_store code to restore affects */
/* add spell and eq affections back in now */
/* More char_to_store code to add spell and eq affections back in. */
for (i = 0; i < MAX_AFFECT; i++) {
if (tmp_aff[i].type)
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);
#endif
}
/* end char_to_store code */
if ((id = get_ptable_by_name(GET_NAME(ch))) < 0)
@ -706,15 +652,10 @@ void tag_argument(char *argument, char *tag)
*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, deleted by an immortal, or deleted by the auto-wipe
* system (if enabled).
*/
/* remove_player() removes all files associated with a player who is self-deleted,
* deleted by an immortal, or deleted by the auto-wipe system (if enabled). */
void remove_player(int pfilepos)
{
char fname[40];
@ -736,29 +677,21 @@ void remove_player(int pfilepos)
save_player_index();
}
void clean_pfiles(void)
{
int i, ci;
for (i = 0; i <= top_of_p_table; i++) {
/*
* We only want to go further if the player isn't protected
* from deletion and hasn't already been deleted.
*/
/* We only want to go further if the player isn't protected from deletion
* and hasn't already been deleted. */
if (!IS_SET(player_table[i].flags, PINDEX_NODELETE) &&
*player_table[i].name) {
/*
* If the player is already flagged for deletion, then go
* ahead and get rid of him.
*/
/* If the player is already flagged for deletion, then go ahead and get
* rid of him. */
if (IS_SET(player_table[i].flags, PINDEX_DELETED)) {
remove_player(i);
} else {
/*
* Now we check to see if the player has overstayed his
* welcome based on level.
*/
/* Check to see if the player has overstayed his welcome based on level. */
for (ci = 0; pclean_criteria[ci].level > -1; ci++) {
if (player_table[i].level <= pclean_criteria[ci].level &&
((time(0) - player_table[i].last) >
@ -767,17 +700,13 @@ void clean_pfiles(void)
break;
}
}
/*
* If we got this far and the players hasn't been kicked out,
* then he can stay a little while longer.
*/
/* If we got this far and the players hasn't been kicked out, then he
* can stay a little while longer. */
}
}
}
/*
* After everything is done, we should rebuild player_index and
* remove the entries of the players that were just deleted.
*/
/* After everything is done, we should rebuild player_index and remove the
* entries of the players that were just deleted. */
}
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);
}
void load_skills(FILE *fl, struct char_data *ch)
{
int num = 0, num2 = 0;
@ -816,7 +744,6 @@ void load_skills(FILE *fl, struct char_data *ch)
} while (num != 0);
}
void load_HMVS(struct char_data *ch, const char *line, int mode)
{
int num = 0, num2 = 0;

View file

@ -1,46 +1,23 @@
/* ************************************************************************
* File: random.c Part of CircleMUD *
* Usage: pseudo-random number generator *
************************************************************************ */
/**************************************************************************
* File: random.c Part of tbaMUD *
* Usage: Pseudo-random number generator. *
**************************************************************************/
/*
* I am bothered by the non-portablility of 'rand' and 'random' -- rand
* is ANSI C, but on some systems such as Suns, rand has seriously tragic
* spectral properties (the low bit alternates between 0 and 1!). random
* is better but isn't supported by all systems. So, in my quest for Ultimate
* CircleMUD Portability, I decided to include this code for a simple but
* relatively effective random number generator. It's not the best RNG code
* 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
*/
/* I am bothered by the non-portablility of 'rand' and 'random' -- rand is ANSI
* C, but on some systems such as Suns, rand has seriously tragic spectral
* properties (the low bit alternates between 0 and 1!). random is better but
* isn't supported by all systems. So, in my quest for portability, I decided
* to include this code for a simple but relatively effective random number
* generator. It's not the best RNG code around, but I like it because it's
* very short and simple, and for our purposes it's "random enough". -JE */
/***************************************************************************/
/*
*
* This program is public domain and was written by William S. England
* (Oct 1988). It is based on an article by:
*
* 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" )
*/
/* 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
* changed except by someone who is a professional Lehmer generator writer.
* THIS GENERATOR REPRESENTS THE MINIMUM STANDARD AGAINST WHICH OTHER
* GENERATORS SHOULD BE JUDGED. */
#define m (unsigned long)2147483647
#define q (unsigned long)127773
@ -48,8 +25,7 @@
#define a (unsigned int)16807
#define r (unsigned int)2836
/*
** F(z) = (az)%m
/* F(z) = (az)%m
** = az-m(az/m)
**
** F(z) = G(z)+mT(z)
@ -57,8 +33,7 @@
** T(z) = (z/q) - (az/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;
@ -66,13 +41,11 @@ static unsigned long seed;
void circle_srandom(unsigned long initial_seed);
unsigned long circle_random(void);
void circle_srandom(unsigned long initial_seed)
{
seed = initial_seed;
}
unsigned long circle_random(void)
{
int lo, hi, test;

View file

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

View file

@ -1,8 +1,8 @@
/* ************************************************************************
* File: screen.h Part of CircleMUD *
* Usage: header file with ANSI color codes for online color *
/**************************************************************************
* File: screen.h Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *

View file

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

View file

@ -1,14 +1,13 @@
/* ************************************************************************
* File: shop.c Part of CircleMUD *
* Usage: shopkeepers: loading config files, spec procs. *
/**************************************************************************
* File: shop.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
/* The entire shop rewrite for Circle 3.0 was done by Jeff Fink. Thanks Jeff! */
* By Jeff Fink. *
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
@ -337,10 +336,8 @@ int transaction_amt(char *arg)
char *buywhat;
/* If we have two arguments, it means 'buy 5 3', or buy 5 of #3.
We don't do that if we only have one argument, like 'buy 5', buy #5.
Code from Andrey Fidrya <andrey@ALEX-UA.COM> */
/* If we have two arguments, it means 'buy 5 3', or buy 5 of #3. We don't do
* that if we only have one argument, like 'buy 5', buy #5. By Andrey Fidrya */
buywhat = one_argument(arg, buf);
if (*buywhat && *buf && is_number(buf)) {
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);
}
/* This function is a slight hack! To make sure that duplicate items are
* only listed once on the "list", this function groups "identical"
* objects together on the shopkeeper's inventory list. The hack involves
* knowing how the list is put together, and manipulating the order of
* the objects on the list. (But since most of DIKU is not encapsulated,
* and information hiding is almost never used, it isn't that big a deal) -JF */
/* This function is a slight hack! To make sure that duplicate items are only
* listed once on the "list", this function groups "identical" objects together
* on the shopkeeper's inventory list. The hack involves knowing how the list
* is put together, and manipulating the order of the objects on the list. (But
* since most of DIKU is not encapsulated, and information hiding is almost
* never used, it isn't that big a deal). -JF */
struct obj_data *slide_obj(struct obj_data *obj, struct char_data *keeper, int shop_nr)
{
struct obj_data *loop;

View file

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

View file

@ -1,12 +1,15 @@
/* ************************************************************************
* File: spec_procs.c Part of CircleMUD *
* Usage: implementation of special procedures for mobiles/objects/rooms *
/**************************************************************************
* File: spec_procs.c Part of tbaMUD *
* 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 *
* 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 "sysdep.h"
@ -22,6 +25,7 @@
/* external vars */
extern struct time_info_data time_info;
extern struct spell_info_type spell_info[];
extern struct guild_info_type guild_info[];
/* extern functions */
ACMD(do_drop);
@ -37,6 +41,15 @@ void list_skills(struct char_data *ch);
SPECIAL(guild);
SPECIAL(dump);
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(bank);
@ -299,6 +312,293 @@ SPECIAL(mayor)
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)
SPECIAL(pet_shops)
{
@ -363,7 +663,7 @@ SPECIAL(pet_shops)
return (FALSE);
}
/* Special procedures for objects */
/* Special procedures for objects. */
SPECIAL(bank)
{
int amount;

View file

@ -1,13 +1,12 @@
/* ************************************************************************
* File: spell_parser.c Part of CircleMUD *
* Usage: top-level magic routines; outside points of entry to magic sys. *
/**************************************************************************
* File: spell_parser.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
@ -185,8 +184,7 @@ int find_skill_num(char *name)
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
* 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
@ -922,14 +920,12 @@ void mag_assign_spells(void)
/* NON-castable spells should appear below here. */
spello(SPELL_IDENTIFY, "identify", 0, 0, 0, 0,
TAR_CHAR_ROOM | TAR_OBJ_INV | TAR_OBJ_ROOM, FALSE, MAG_MANUAL,
NULL);
/* These spells are currently not used, not implemented, and not castable.
* Values for the 'breath' spells are filled in assuming a dragon's breath. */
spello(SPELL_FIRE_BREATH, "fire breath", 0, 0, 0, POS_SITTING,
TAR_IGNORE, TRUE, 0,
NULL);

View file

@ -1,13 +1,12 @@
/* ************************************************************************
* File: spells.c Part of CircleMUD *
* Usage: Implementation of "manual spells". Circle 2.2 spell compat. *
/**************************************************************************
* File: spells.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.h"
#include "sysdep.h"
@ -284,8 +283,6 @@ ASPELL(spell_charm)
}
}
ASPELL(spell_identify)
{
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)
{
int i;
@ -414,7 +407,6 @@ ASPELL(spell_enchant_weapon)
act("$p glows yellow.", FALSE, ch, obj, 0, TO_CHAR);
}
ASPELL(spell_detect_poison)
{
if (victim) {

View file

@ -1,12 +1,12 @@
/* ************************************************************************
* File: spells.h Part of CircleMUD *
* Usage: header file: constants and fn prototypes for spell system *
/**************************************************************************
* File: spells.h Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#define DEFAULT_STAFF_LVL 12
#define DEFAULT_WAND_LVL 12
@ -30,12 +30,10 @@
#define MAG_CREATIONS (1 << 9)
#define MAG_MANUAL (1 << 10)
#define TYPE_UNDEFINED (-1)
#define SPELL_RESERVED_DBC 0 /* SKILL NUMBER ZERO -- RESERVED */
/* PLAYER SPELLS -- Numbered from 1 to MAX_SPELLS */
#define SPELL_ARMOR 1 /* Reserved Skill[] DO NOT CHANGE */
#define SPELL_TELEPORT 2 /* 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 */
/* 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 intended use is for spells and skills
* associated with objects (such as SPELL_IDENTIFY used with scrolls of
* identify) or non-players (such as NPC-only spells).
*/
/* 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
* intended use is for spells and skills 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_FIRE_BREATH 202
#define SPELL_GAS_BREATH 203
@ -119,17 +113,14 @@
#define SPELL_ACID_BREATH 205
#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
/* NEW NPC/OBJECT SPELLS can be inserted here up to 299 */
/* WEAPON ATTACK TYPES */
#define TYPE_HIT 300
#define TYPE_STING 301
#define TYPE_WHIP 302
@ -149,15 +140,12 @@
/* new attack types can be added here - up to TYPE_SUFFERING */
#define TYPE_SUFFERING 399
#define SAVING_PARA 0
#define SAVING_ROD 1
#define SAVING_PETRI 2
#define SAVING_BREATH 3
#define SAVING_SPELL 4
#define TAR_IGNORE (1 << 0)
#define TAR_CHAR_ROOM (1 << 1)
#define TAR_CHAR_WORLD (1 << 2)
@ -185,7 +173,6 @@ struct spell_info_type {
};
/* Possible Targets:
bit 0 : IGNORE TARGET
bit 1 : PC/NPC in room
bit 2 : PC/NPC in world
@ -195,25 +182,19 @@ struct spell_info_type {
bit 6 : Object in world
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 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_POTION 1
#define SPELL_TYPE_WAND 2
#define SPELL_TYPE_STAFF 3
#define SPELL_TYPE_SCROLL 4
/* Attacktypes with grammar */
struct attack_hit_type {
const char *singular;
const char *plural;
};
#define ASPELL(spellname) \
void spellname(int level, struct char_data *ch, \
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,
struct obj_data *tobj, int spellnum);
/* other prototypes */
void spell_level(int spell, int chclass, int level);
void init_spell_levels(void);

View file

@ -1,19 +1,20 @@
/* ************************************************************************
* File: structs.h Part of CircleMUD *
* Usage: header file for central structures and constants *
* All rights reserved. See license.doc for complete information. *
/**************************************************************************
* File: structs.h Part of tbaMUD *
* Usage: Header file for central structures and constants. *
* *
* All rights reserved. See license for complete information. *
* *
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
/* Intended use of this macro is to allow external packages to work with a
* variety of CircleMUD versions without modifications. For instance, an
* IS_CORPSE() macro was introduced in pl13. Any future code add-ons could
* take into account the CircleMUD version and supply their own definition for
* the macro if used on an older version of CircleMUD. You are supposed to
* compare this with the macro CIRCLEMUD_VERSION() in utils.h. */
#define _CIRCLEMUD 0x030520 /* Major/Minor/Patchlevel - MMmmPP */
* variety of versions without modifications. For instance, an IS_CORPSE()
* macro was introduced in pl13. Any future code add-ons could take into
* account the version and supply their own definition for the macro if used
* on an older version. You are supposed to compare this with the macro
* TBAMUD_VERSION() in utils.h. */
#define _TBAMUD 0x030520 /* Major/Minor/Patchlevel - MMmmPP */
/* If you want equipment to be automatically equipped to the same place
* 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_WEAPON 5 /* Item is a weapon */
#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_ARMOR 9 /* Item is armor */
#define ITEM_POTION 10 /* Item is a potion */
#define ITEM_WORN 11 /* Unimplemented */
#define ITEM_OTHER 12 /* Misc object */
#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_NOTE 16 /* Item is note */
#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 guild_info_type {
int pc_class;
room_vnum guild_room;
int direction;
};
/* Config structs */
/* The game configuration structure used for configurating the game play

View file

@ -1,133 +1,66 @@
/* ************************************************************************
* File: sysdep.h Part of CircleMUD *
* Usage: machine-specific defs based on values in conf.h (from configure)*
/**************************************************************************
* File: sysdep.h Part of tbaMUD *
* 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 *
* 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 */
/**************************************************************************/
/*
* If you are porting CircleMUD 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 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.
/* 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
* 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
* exactly what non-blocking I/O is, and you are SURE that your operating
* system does NOT have it! (The only UNIX system I've ever seen that has
* broken POSIX non-blocking I/O is AIX 3.2.) If your MUD is freezing but
* you're not sure why, do NOT use this constant. Use this constant ONLY
* if you're sure that your MUD is freezing because of a non-blocking I/O
* problem.
*
* See running.doc for details.
*/
* exactly what non-blocking I/O is, and you are SURE that your operating system
* does NOT have it! (The only UNIX system I've ever seen that has broken POSIX
* non-blocking I/O is AIX 3.2.) If your MUD is freezing but you're not sure
* why, do NOT use this constant. Use this constant ONLY if you're sure that
* your MUD is freezing because of a non-blocking I/O problem. */
/* #define POSIX_NONBLOCK_BROKEN */
/**************************************************************************/
/*
* The Circle 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 systems and compilers.
*
* If your compiler reports "conflicting types" for functions, you need to
* 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:
/* 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
* systems and compilers. If your compiler reports "conflicting types" for
* functions, you need to define this constant to turn off library function
* prototyping. Note, **DO** **NOT** blindly turn on this constant unless you
* 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
* this: In file included from comm.c:14:
* sysdep.h:207: conflicting types for `random'
* /usr/local/lib/gcc-lib/alpha-dec-osf3.2/2.7.2/include/stdlib.h:253:
* previous declaration of `random'
*
* See running.doc for details.
*/
* previous declaration of `random' */
/* #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:
*
* info libc 'Allocation Debugging' 'Tracing malloc'
*
/* 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'
* Example usage (Bourne shell):
*
* 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
* documentation before setting this to '1'.
*/
* documentation before setting this to '1'. */
#define CIRCLE_GNU_LIBC_MEMORY_TRACK 0 /* 0 = off, 1 = on */
/* Do not change anything below this line. */
/************************************************************************/
/*** Do not change anything below this line *****************************/
/************************************************************************/
/*
* Set up various machine-specific things based on the values determined
* from configure and conf.h.
*/
/* Standard C headers *************************************************/
/* Set up various machine-specific things based on the values determined from
* configure and conf.h. */
#include <stdio.h>
#include <ctype.h>
@ -141,7 +74,6 @@
#include <strings.h>
#endif
#if (defined (STDC_HEADERS) || defined (__GNU_LIBRARY__))
#include <stdlib.h>
@ -158,8 +90,7 @@ extern void abort (), exit ();
#endif /* Standard headers. */
/* POSIX compliance *************************************************/
/* POSIX compliance */
#ifdef HAVE_SYS_TYPES_H
# include <sys/types.h>
#endif
@ -197,12 +128,7 @@ extern void abort (), exit ();
#define POSIX_NONBLOCK_BROKEN
#endif
/* Header files *******************************************************/
/* Header files common to all source files */
#ifdef HAVE_LIMITS_H
#include <limits.h>
#endif
@ -241,9 +167,7 @@ extern void abort (), exit ();
#define assert(arg)
#endif
/* Header files only used in comm.c and some of the utils */
#if defined(__COMM_C__) || defined(CIRCLE_UTIL)
#ifndef HAVE_STRUCT_IN_ADDR
@ -304,7 +228,6 @@ struct in_addr {
#endif /* __COMM_C__ && CIRCLE_UNIX */
/* Header files that are only used in act.other.c */
#ifdef __ACT_OTHER_C__
@ -314,9 +237,7 @@ struct in_addr {
#endif /* __ACT_OTHER_C__ */
/* Basic system dependencies *******************************************/
/* Basic system dependencies. */
#if CIRCLE_GNU_LIBC_MEMORY_TRACK && !defined(HAVE_MCHECK_H)
#error "Cannot use GNU C library memory tracking without <mcheck.h>"
#endif
@ -373,9 +294,7 @@ struct in_addr {
#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)
# include <stdio.h>
# include <time.h>
@ -410,7 +329,6 @@ struct in_addr {
#endif
#endif
/* Make sure we have STDERR_FILENO */
#ifndef STDERR_FILENO
#define STDERR_FILENO 2
@ -425,50 +343,15 @@ struct in_addr {
# include "bsd-snprintf.h"
#endif
/* Function prototypes ************************************************/
/*
* For reasons that perplex me, the header files of many OS's do not contain
* 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.
/* Function prototypes. */
/* Header files of many OS's do not contain function prototypes for the
* standard C library functions. This produces annoying warning messages
* (sometimes, a lot of them) on such OS's when compiling with gcc's -Wall.
*
* Some versions of CircleMUD prior to 3.0 patchlevel 9 attempted to
* include prototypes taken from OS man pages for a large number of
* OS's in the header files. I now think such an approach is a bad
* idea: maintaining that list is very difficult and time-consuming,
* 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!
*/
* Configuration script has been changed 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. */
#ifndef NO_LIBRARY_PROTOTYPES
@ -480,12 +363,10 @@ struct in_addr {
long atol(const char *str);
#endif
/*
* bzero is deprecated - use memset() instead. Not directly used in Circle
* but the prototype needed for FD_xxx macros on some machines.
*/
/* bzero is deprecated - use memset() instead. This prototype is needed for
* FD_xxx macros on some machines. */
#ifdef NEED_BZERO_PROTO
// void bzero(char *b, int length);
void bzero(char *b, int length);
#endif
#ifdef NEED_CRYPT_PROTO
@ -505,7 +386,7 @@ struct in_addr {
#endif
#ifdef NEED_FPRINTF_PROTO
// int fprintf(FILE *strm, const char *format, /* args */ ... );
int fprintf(FILE *strm, const char *format, /* args */ ... );
#endif
#ifdef NEED_FREAD_PROTO
@ -542,11 +423,11 @@ struct in_addr {
#endif
#ifdef NEED_SPRINTF_PROTO
// int sprintf(char *s, const char *format, /* args */ ... );
int sprintf(char *s, const char *format, /* args */ ... );
#endif
#ifdef NEED_SSCANF_PROTO
// int sscanf(const char *s, const char *format, ...);
int sscanf(const char *s, const char *format, ...);
#endif
#ifdef NEED_STRDUP_PROTO
@ -578,7 +459,6 @@ struct in_addr {
#endif
/* Function prototypes that are only used in comm.c and some of the utils */
#if defined(__COMM_C__) || defined(CIRCLE_UTIL)
#ifdef NEED_ACCEPT_PROTO
@ -606,7 +486,7 @@ struct in_addr {
#endif
#ifdef NEED_FPUTS_PROTO
// int fputs(const char *s, FILE *stream);
int fputs(const char *s, FILE *stream);
#endif
#ifdef NEED_GETPEERNAME_PROTO
@ -654,7 +534,7 @@ struct in_addr {
#endif
#ifdef NEED_PRINTF_PROTO
// int printf(char *format, ...);
int printf(char *format, ...);
#endif
#ifdef NEED_READ_PROTO
@ -690,5 +570,4 @@ struct in_addr {
#endif /* __COMM_C__ */
#endif /* NO_LIBRARY_PROTOTYPES */

View file

@ -1,9 +1,9 @@
/*
* Originally written by: Michael Scott -- Manx.
* Last known e-mail address: scottm@workcomm.net
*
* XXX: This needs Oasis-ifying.
*/
/**************************************************************************
* File: tedit.c Part of tbaMUD *
* Usage: Oasis OLC - Text files. *
* *
* By Michael Scott [Manx]. *
**************************************************************************/
#include "conf.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_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 MAX_TONGUE 3 /* 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 *
* Usage: various internal functions of a utility nature *
/**************************************************************************
* File: utils.c Part of tbaMUD *
* 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 *
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
************************************************************************ */
**************************************************************************/
#include "conf.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->day * SECS_PER_MUD_DAY;
when += now->hours * SECS_PER_MUD_HOUR;
return (time(NULL) - when);
}

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