mirror of
https://github.com/tbamud/tbamud.git
synced 2026-01-30 12:55:16 +01:00
tbaMUD 3.54
[Oct 04 2007] - Rumble Changed autoexit to display doors as Exits: n (e) w s. DISP_CLOSED_DOORS added to cedit. Added rcopy, ocopy, etc. for all forms of OLC. (thanks Neme) [Oct 01 2007] - Rumble Added trigedit variables %zonename% and %zonenumber%. (thanks Drefs) Fixed memory leak in do_dig. (thanks Neme) Added trigedit variables %roomflag% and object %affects%. (thanks Jamdog) [Sep 27 2007] - Rumble Update to do_hit to prevent crash if the player is AFF_CHARM somehow without a master. (thanks Jamdog) Removed alias.c. New ASCII aliases handled in players.c and saved in plrfiles.
This commit is contained in:
parent
1f7a7b4182
commit
40b643b7d5
35 changed files with 798 additions and 540 deletions
|
|
@ -24,7 +24,7 @@ OBJFILES = comm.o act.comm.o act.informative.o act.movement.o act.item.o \
|
|||
castle.o class.o config.o constants.o db.o fight.o graph.o handler.o \
|
||||
house.o interpreter.o limits.o magic.o mail.o mobact.o modify.o \
|
||||
objsave.o shop.o spec_assign.o spec_procs.o spell_parser.o \
|
||||
spells.o utils.o weather.o alias.o players.o
|
||||
spells.o utils.o weather.o players.o
|
||||
|
||||
default: .accepted
|
||||
$(MAKE) ../bin/circle
|
||||
|
|
@ -91,8 +91,6 @@ clean:
|
|||
# Dependencies for the object files (automagically generated with
|
||||
# gcc -MM)
|
||||
|
||||
alias.o: alias.c conf.h sysdep.h structs.h utils.h interpreter.h db.h
|
||||
$(CC) -c $(CFLAGS) alias.c
|
||||
act.comm.o: act.comm.c conf.h sysdep.h structs.h utils.h comm.h interpreter.h \
|
||||
handler.h db.h screen.h
|
||||
$(CC) -c $(CFLAGS) act.comm.c
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ OBJFILES = o.comm act.o.comm act.o.informative act.o.movement act.o.item \
|
|||
o.castle o.class o.config o.constants o.db o.fight o.graph o.handler \
|
||||
o.house o.interpreter o.limits o.magic o.mail o.mobact o.modify \
|
||||
o.objsave o.random o.shop o.spec_assign o.spec_procs \
|
||||
o.spell_parser o.spells o.utils o.weather o.players o.alias
|
||||
o.spell_parser o.spells o.utils o.weather o.players
|
||||
|
||||
default: all
|
||||
|
||||
|
|
@ -41,8 +41,6 @@ clean:
|
|||
# Dependencies for the object files (automagically generated with
|
||||
# gcc -MM)
|
||||
|
||||
o.alias: c.alias h.conf h.sysdep h.structs h.utils h.interpreter h.db
|
||||
$(CC) -c $(CFLAGS) c.alias -o o.alias
|
||||
act.o.comm: act.c.comm h.conf h.sysdep h.structs \
|
||||
h.utils h.comm h.interpreter h.handler \
|
||||
h.db h.screen
|
||||
|
|
|
|||
|
|
@ -43,7 +43,6 @@ circle : BccW32.cfg $(Dep_circle)
|
|||
echo MakeNode
|
||||
|
||||
Dep_circledexe = \
|
||||
alias.obj\
|
||||
act.comm.obj\
|
||||
act.movement.obj\
|
||||
act.item.obj\
|
||||
|
|
@ -85,7 +84,6 @@ circle.exe : $(Dep_circledexe)
|
|||
$(TLINK32) @&&|
|
||||
/v $(IDE_LinkFLAGS32) $(LinkerOptsAt_circledexe) $(LinkerInheritOptsAt_circledexe) +
|
||||
C:\BC5\LIB\c0x32.obj+
|
||||
alias.obj+
|
||||
act.comm.obj+
|
||||
act.movement.obj+
|
||||
act.item.obj+
|
||||
|
|
@ -129,11 +127,6 @@ C:\BC5\LIB\cw32i.lib
|
|||
|
||||
|
||||
|
|
||||
alias.obj : alias.c
|
||||
$(BCC32) -P- -c @&&|
|
||||
$(CompOptsAt_circledexe) $(CompInheritOptsAt_circledexe) -o$@ alias.c
|
||||
|
|
||||
|
||||
act.comm.obj : act.comm.c
|
||||
$(BCC32) -P- -c @&&|
|
||||
$(CompOptsAt_circledexe) $(CompInheritOptsAt_circledexe) -o$@ act.comm.c
|
||||
|
|
|
|||
|
|
@ -44,7 +44,6 @@ circle : BccW32.cfg $(Dep_circle)
|
|||
echo MakeNode
|
||||
|
||||
Dep_circledexe = \
|
||||
alias.obj\
|
||||
act.comm.obj\
|
||||
act.movement.obj\
|
||||
act.item.obj\
|
||||
|
|
@ -86,7 +85,6 @@ circle.exe : $(Dep_circledexe)
|
|||
$(TLINK32) @&&|
|
||||
/v $(IDE_LinkFLAGS32) $(LinkerOptsAt_circledexe) $(LinkerInheritOptsAt_circledexe) +
|
||||
C:\BORLAND\BCC55\LIB\c0x32.obj+
|
||||
alias.obj+
|
||||
act.comm.obj+
|
||||
act.movement.obj+
|
||||
act.item.obj+
|
||||
|
|
@ -128,11 +126,6 @@ C:\BORLAND\BCC55\LIB\import32.lib+
|
|||
C:\BORLAND\BCC55\LIB\cw32i.lib
|
||||
|
||||
|
|
||||
alias.obj : alias.c
|
||||
$(BCC32) -P- -c @&&|
|
||||
$(CompOptsAt_circledexe) $(CompInheritOptsAt_circledexe) -o$@ alias.c
|
||||
|
|
||||
|
||||
act.comm.obj : act.comm.c
|
||||
$(BCC32) -P- -c @&&|
|
||||
$(CompOptsAt_circledexe) $(CompInheritOptsAt_circledexe) -o$@ act.comm.c
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ CFLAGS = @CFLAGS@ $(MYFLAGS) $(PROFILE)
|
|||
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 \
|
||||
act.offensive.o act.other.o act.social.o act.wizard.o aedit.o \
|
||||
ban.o boards.o bsd-snprintf.o castle.o cedit.o class.o comm.o config.o \
|
||||
constants.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 \
|
||||
|
|
@ -37,7 +37,7 @@ 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 aedit.c alias.c \
|
||||
act.offensive.c act.other.c act.social.c act.wizard.c aedit.c \
|
||||
ban.c boards.c bsd-snprintf.c castle.c cedit.c class.c comm.c config.c \
|
||||
constants.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 \
|
||||
|
|
|
|||
|
|
@ -52,7 +52,6 @@ OBJS=\
|
|||
act.item.obj \
|
||||
act.informative.obj \
|
||||
act.comm.obj \
|
||||
alias.obj
|
||||
|
||||
LIBS=$(LCCDIR)\lib\wsock32.lib
|
||||
|
||||
|
|
@ -551,14 +550,3 @@ ACT_COMM_C=\
|
|||
act.comm.obj: $(ACT_COMM_C) $(DISTDIR)\src\act.comm.c
|
||||
$(CC) $(CFLAGS) $(DISTDIR)\src\act.comm.c
|
||||
|
||||
# Build ALIAS.C
|
||||
ALIAS_C=\
|
||||
$(DISTDIR)\src\sysdep.h\
|
||||
$(DISTDIR)\src\structs.h\
|
||||
$(DISTDIR)\src\utils.h\
|
||||
$(DISTDIR)\src\interpreter.h\
|
||||
$(DISTDIR)\src\db.h\
|
||||
|
||||
alias.obj: $(ALIAS_C) $(DISTDIR)\src\alias.c
|
||||
$(CC) $(CFLAGS) $(DISTDIR)\src\alias.c
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ OBJFILES = comm.obj act.comm.obj act.informative.obj act.movement.obj act.item.o
|
|||
castle.obj class.obj config.obj constants.obj db.obj fight.obj graph.obj handler.obj \
|
||||
house.obj interpreter.obj limits.obj magic.obj mail.obj mobact.obj modify.obj \
|
||||
objsave.obj shop.obj spec_assign.obj spec_procs.obj spell_parser.obj \
|
||||
spells.obj utils.obj weather.obj random.obj alias.obj players.obj
|
||||
spells.obj utils.obj weather.obj random.obj players.obj
|
||||
|
||||
default: circle.exe
|
||||
$(MAKE) circle.exe
|
||||
|
|
@ -52,8 +52,6 @@ circle.exe : $(OBJFILES)
|
|||
# Dependencies for the object files (automagically generated with
|
||||
# gcc -MM)
|
||||
|
||||
alias.obj: alias.c conf.h sysdep.h structs.h utils.h interpreter.h db.h
|
||||
$(CC) -c $(CFLAGS) alias.c
|
||||
act.comm.obj: act.comm.c conf.h sysdep.h structs.h utils.h comm.h interpreter.h \
|
||||
handler.h db.h screen.h
|
||||
$(CC) -c $(CFLAGS) act.comm.c
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ OBJFILES = comm.o act.comm.o act.informative.o act.movement.o act.item.o \
|
|||
castle.o class.o config.o constants.o db.o fight.o graph.o handler.o \
|
||||
house.o interpreter.o limits.o magic.o mail.o mobact.o modify.o \
|
||||
objsave.o shop.o spec_assign.o spec_procs.o spell_parser.o \
|
||||
spells.o utils.o weather.o random.o alias.o players.o
|
||||
spells.o utils.o weather.o random.o players.o
|
||||
|
||||
default: .accepted
|
||||
$(MAKE) ../bin/circle
|
||||
|
|
@ -93,8 +93,6 @@ clean:
|
|||
# Dependencies for the object files (automagically generated with
|
||||
# gcc -MM)
|
||||
|
||||
alias.o: alias.c conf.h sysdep.h structs.h utils.h interpreter.h db.h
|
||||
$(CC) -c $(CFLAGS) alias.c
|
||||
act.comm.o: act.comm.c conf.h sysdep.h structs.h utils.h comm.h interpreter.h \
|
||||
handler.h db.h screen.h
|
||||
$(CC) -c $(CFLAGS) act.comm.c
|
||||
|
|
|
|||
|
|
@ -434,10 +434,12 @@ void do_auto_exits(struct char_data *ch)
|
|||
for (door = 0; door < NUM_OF_DIRS; door++) {
|
||||
if (!EXIT(ch, door) || EXIT(ch, door)->to_room == NOWHERE)
|
||||
continue;
|
||||
if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED))
|
||||
if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && !CONFIG_DISP_CLOSED_DOORS)
|
||||
continue;
|
||||
|
||||
send_to_char(ch, "%c ", LOWER(*dirs[door]));
|
||||
if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED))
|
||||
send_to_char(ch, "%s(%c)%s ", CCRED(ch, C_NRM), LOWER(*dirs[door]), CCCYN(ch, C_NRM));
|
||||
else
|
||||
send_to_char(ch, "%c ", LOWER(*dirs[door]));
|
||||
slen++;
|
||||
}
|
||||
|
||||
|
|
@ -458,14 +460,18 @@ ACMD(do_exits)
|
|||
for (door = 0; door < NUM_OF_DIRS; door++) {
|
||||
if (!EXIT(ch, door) || EXIT(ch, door)->to_room == NOWHERE)
|
||||
continue;
|
||||
if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED))
|
||||
if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && !CONFIG_DISP_CLOSED_DOORS)
|
||||
continue;
|
||||
|
||||
len++;
|
||||
|
||||
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS))
|
||||
send_to_char(ch, "%-5s - [%5d] %s\r\n", dirs[door], GET_ROOM_VNUM(EXIT(ch, door)->to_room),
|
||||
world[EXIT(ch, door)->to_room].name);
|
||||
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS) && !EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED))
|
||||
send_to_char(ch, "%-5s - [%5d] %s\r\n", dirs[door], GET_ROOM_VNUM(EXIT(ch, door)->to_room), world[EXIT(ch, door)->to_room].name);
|
||||
else if (CONFIG_DISP_CLOSED_DOORS && EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED)) {
|
||||
/* But we tell them the door is closed */
|
||||
send_to_char(ch, "%-5s - The %s is closed.\r\n", dirs[door],
|
||||
(EXIT(ch, door)->keyword)? fname(EXIT(ch, door)->keyword) : "opening" );
|
||||
}
|
||||
else
|
||||
send_to_char(ch, "%-5s - %s\r\n", dirs[door], IS_DARK(EXIT(ch, door)->to_room) &&
|
||||
!CAN_SEE_IN_DARK(ch) ? "Too dark to tell." : world[EXIT(ch, door)->to_room].name);
|
||||
|
|
@ -1607,7 +1613,7 @@ void perform_immort_where(struct char_data *ch, char *arg)
|
|||
send_to_char(ch, "M%3d. %-25s%s - [%5d] %-25s%s", ++num, GET_NAME(i), QNRM,
|
||||
GET_ROOM_VNUM(IN_ROOM(i)), world[IN_ROOM(i)].name, QNRM);
|
||||
if (SCRIPT(i))
|
||||
send_to_char(ch, "[T%d] ", i->proto_script->vnum);
|
||||
send_to_char(ch, "[T%5d] ", i->proto_script->vnum);
|
||||
send_to_char(ch, "%s\r\n", QNRM);
|
||||
}
|
||||
for (num = 0, k = object_list; k; k = k->next)
|
||||
|
|
|
|||
|
|
@ -105,7 +105,7 @@ ACMD(do_hit)
|
|||
check_killer(ch, vict);
|
||||
}
|
||||
}
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM) && !IS_NPC(ch->master) && !IS_NPC(vict))
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && !IS_NPC(ch->master) && vict && !IS_NPC(vict))
|
||||
return; /* you can't order a charmed pet to attack a
|
||||
* player */
|
||||
}
|
||||
|
|
@ -273,9 +273,11 @@ ACMD(do_flee)
|
|||
loss = GET_MAX_HIT(was_fighting) - GET_HIT(was_fighting);
|
||||
loss *= GET_LEVEL(was_fighting);
|
||||
gain_exp(ch, -loss);
|
||||
stop_fighting(ch);
|
||||
stop_fighting(was_fighting);
|
||||
}
|
||||
}
|
||||
if (FIGHTING(ch))
|
||||
stop_fighting(ch);
|
||||
if (was_fighting && ch == FIGHTING(was_fighting))
|
||||
stop_fighting(was_fighting);
|
||||
} else {
|
||||
act("$n tries to flee, but can't!", TRUE, ch, 0, 0, TO_ROOM);
|
||||
}
|
||||
|
|
|
|||
191
src/alias.c
191
src/alias.c
|
|
@ -1,191 +0,0 @@
|
|||
/*************************************************************************
|
||||
* 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"
|
||||
#include "structs.h"
|
||||
#include "utils.h"
|
||||
#include "interpreter.h"
|
||||
#include "db.h"
|
||||
|
||||
void write_aliases(struct char_data *ch);
|
||||
void read_aliases(struct char_data *ch);
|
||||
void delete_aliases(const char *charname);
|
||||
|
||||
void write_aliases(struct char_data *ch)
|
||||
{
|
||||
FILE *file;
|
||||
char fn[MAX_STRING_LENGTH];
|
||||
struct alias_data *temp;
|
||||
|
||||
get_filename(fn, sizeof(fn), ALIAS_FILE, GET_NAME(ch));
|
||||
remove(fn);
|
||||
|
||||
if (GET_ALIASES(ch) == NULL)
|
||||
return;
|
||||
|
||||
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. */
|
||||
return;
|
||||
}
|
||||
|
||||
for (temp = GET_ALIASES(ch); temp; temp = temp->next) {
|
||||
int aliaslen = strlen(temp->alias);
|
||||
int repllen = strlen(temp->replacement) - 1;
|
||||
|
||||
fprintf(file, "%d\n%s\n" /* Alias */
|
||||
"%d\n%s\n" /* Replacement */
|
||||
"%d\n", /* Type */
|
||||
aliaslen, temp->alias,
|
||||
repllen, temp->replacement + 1,
|
||||
temp->type);
|
||||
}
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
void read_aliases(struct char_data *ch)
|
||||
{
|
||||
FILE *file;
|
||||
char xbuf[MAX_STRING_LENGTH];
|
||||
struct alias_data *t2, *prev = NULL;
|
||||
int length;
|
||||
|
||||
get_filename(xbuf, sizeof(xbuf), ALIAS_FILE, GET_NAME(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. */
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
CREATE(GET_ALIASES(ch), struct alias_data, 1);
|
||||
t2 = GET_ALIASES(ch);
|
||||
|
||||
for (;;) {
|
||||
/* Read the aliased command. */
|
||||
if (fscanf(file, "%d\n", &length) != 1)
|
||||
goto read_alias_error;
|
||||
|
||||
fgets(xbuf, length + 1, file);
|
||||
t2->alias = strdup(xbuf);
|
||||
|
||||
/* Build the replacement. */
|
||||
if (fscanf(file, "%d\n", &length) != 1)
|
||||
goto read_alias_error;
|
||||
|
||||
*xbuf = ' '; /* Doesn't need terminated, fgets() will. */
|
||||
fgets(xbuf + 1, length + 1, file);
|
||||
t2->replacement = strdup(xbuf);
|
||||
|
||||
/* Figure out the alias type. */
|
||||
if (fscanf(file, "%d\n", &length) != 1)
|
||||
goto read_alias_error;
|
||||
|
||||
t2->type = length;
|
||||
|
||||
if (feof(file))
|
||||
break;
|
||||
|
||||
CREATE(t2->next, struct alias_data, 1);
|
||||
prev = t2;
|
||||
t2 = t2->next;
|
||||
};
|
||||
|
||||
fclose(file);
|
||||
return;
|
||||
|
||||
read_alias_error:
|
||||
if (t2->alias)
|
||||
free(t2->alias);
|
||||
free(t2);
|
||||
if (prev)
|
||||
prev->next = NULL;
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
void delete_aliases(const char *charname)
|
||||
{
|
||||
char filename[PATH_MAX];
|
||||
|
||||
if (!get_filename(filename, sizeof(filename), ALIAS_FILE, charname))
|
||||
return;
|
||||
|
||||
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. */
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
if (GET_ALIASES(ch) == NULL)
|
||||
return;
|
||||
|
||||
for (temp = GET_ALIASES(ch); temp; temp = temp->next)
|
||||
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 */
|
||||
for (temp = GET_ALIASES(ch); temp; temp = temp->next) {
|
||||
fprintf(file, "%s\n" /* Alias */
|
||||
"%s\n" /* Replacement */
|
||||
"%d\n", /* Type */
|
||||
temp->alias,
|
||||
temp->replacement+1,
|
||||
temp->type);
|
||||
}
|
||||
}
|
||||
|
||||
void read_aliases_ascii(FILE *file, struct char_data *ch, int count)
|
||||
{
|
||||
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. */
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
/* Read the aliased command. */
|
||||
get_line(file, abuf);
|
||||
|
||||
/* Read the replacement. */
|
||||
get_line(file, tbuf);
|
||||
strcpy(rbuf, " ");
|
||||
strcat(rbuf, tbuf); /* strcat: OK */
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
19
src/cedit.c
19
src/cedit.c
|
|
@ -102,6 +102,7 @@ void cedit_setup(struct descriptor_data *d)
|
|||
OLC_CONFIG(d)->play.load_into_inventory = CONFIG_LOAD_INVENTORY;
|
||||
OLC_CONFIG(d)->play.track_through_doors = CONFIG_TRACK_T_DOORS;
|
||||
OLC_CONFIG(d)->play.no_mort_to_immort = CONFIG_NO_MORT_TO_IMMORT;
|
||||
OLC_CONFIG(d)->play.disp_closed_doors = CONFIG_DISP_CLOSED_DOORS;
|
||||
|
||||
/* Crash Saves */
|
||||
OLC_CONFIG(d)->csd.free_rent = CONFIG_FREE_RENT;
|
||||
|
|
@ -194,6 +195,7 @@ void cedit_save_internally(struct descriptor_data *d)
|
|||
CONFIG_LOAD_INVENTORY = OLC_CONFIG(d)->play.load_into_inventory;
|
||||
CONFIG_TRACK_T_DOORS = OLC_CONFIG(d)->play.track_through_doors;
|
||||
CONFIG_NO_MORT_TO_IMMORT = OLC_CONFIG(d)->play.no_mort_to_immort;
|
||||
CONFIG_DISP_CLOSED_DOORS = OLC_CONFIG(d)->play.disp_closed_doors;
|
||||
|
||||
/* Crash Saves */
|
||||
CONFIG_FREE_RENT = OLC_CONFIG(d)->csd.free_rent;
|
||||
|
|
@ -350,6 +352,8 @@ int save_config( IDXTYPE nowhere )
|
|||
"track_through_doors = %d\n\n", CONFIG_TRACK_T_DOORS);
|
||||
fprintf(fl, "* Should players who reach enough exp automatically level to immortal?\n"
|
||||
"no_mort_to_immort = %d\n\n", CONFIG_NO_MORT_TO_IMMORT);
|
||||
fprintf(fl, "* Should closed doors be shown on autoexit / exit?\n"
|
||||
"disp_closed_doors = %d\n\n", CONFIG_DISP_CLOSED_DOORS);
|
||||
|
||||
strcpy(buf, CONFIG_OK);
|
||||
strip_cr(buf);
|
||||
|
|
@ -568,8 +572,9 @@ void cedit_disp_game_play_options(struct descriptor_data *d)
|
|||
"%sM%s) Death Traps Junk Items : %s%s\r\n"
|
||||
"%sN%s) Objects Load Into Inventory : %s%s\r\n"
|
||||
"%sO%s) Track Through Doors : %s%s\r\n"
|
||||
"%sP%s) Mortals Level To Immortal : %s%s\r\n"
|
||||
"%s1%s) OK Message Text : %s%s"
|
||||
"%sP%s) Display Closed Doors : %s%s\r\n"
|
||||
"%sR%s) Mortals Level To Immortal : %s%s\r\n"
|
||||
"%s1%s) OK Message Text : %s%s"
|
||||
"%s2%s) NOPERSON Message Text : %s%s"
|
||||
"%s3%s) NOEFFECT Message Text : %s%s"
|
||||
"%sQ%s) Exit To The Main Menu\r\n"
|
||||
|
|
@ -590,7 +595,8 @@ void cedit_disp_game_play_options(struct descriptor_data *d)
|
|||
grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.dts_are_dumps),
|
||||
grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.load_into_inventory),
|
||||
grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.track_through_doors),
|
||||
grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.no_mort_to_immort),
|
||||
grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.disp_closed_doors),
|
||||
grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.no_mort_to_immort),
|
||||
|
||||
grn, nrm, cyn, OLC_CONFIG(d)->play.OK,
|
||||
grn, nrm, cyn, OLC_CONFIG(d)->play.NOPERSON,
|
||||
|
|
@ -881,7 +887,12 @@ void cedit_parse(struct descriptor_data *d, char *arg)
|
|||
|
||||
case 'p':
|
||||
case 'P':
|
||||
TOGGLE_VAR(OLC_CONFIG(d)->play.no_mort_to_immort);
|
||||
TOGGLE_VAR(OLC_CONFIG(d)->play.disp_closed_doors);
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
case 'R':
|
||||
TOGGLE_VAR(OLC_CONFIG(d)->play.no_mort_to_immort);
|
||||
break;
|
||||
|
||||
case '1':
|
||||
|
|
|
|||
|
|
@ -298,3 +298,7 @@ int use_autowiz = YES;
|
|||
/* If yes, what is the lowest level which should be on the wizlist? (All immort
|
||||
* levels below the level you specify will go on the immlist instead.) */
|
||||
int min_wizlist_lev = LVL_GOD;
|
||||
|
||||
/* To mimic stack behavior set to NO. To allow mortals to see doors in exits
|
||||
* set to YES. */
|
||||
int display_closed_doors = YES;
|
||||
|
|
|
|||
6
src/db.c
6
src/db.c
|
|
@ -169,6 +169,7 @@ extern int bitsavetodisk;
|
|||
extern struct player_index_element *player_table;
|
||||
extern int top_of_p_table;
|
||||
extern long top_idnum;
|
||||
extern int display_closed_doors;
|
||||
|
||||
/* external ASCII Player Files vars */
|
||||
extern int auto_pwipe;
|
||||
|
|
@ -3364,6 +3365,7 @@ void load_default_config( void )
|
|||
CONFIG_NOEFFECT = strdup(NOEFFECT);
|
||||
CONFIG_TRACK_T_DOORS = track_through_doors;
|
||||
CONFIG_NO_MORT_TO_IMMORT = no_mort_to_immort;
|
||||
CONFIG_DISP_CLOSED_DOORS = display_closed_doors;
|
||||
|
||||
/* Rent / crashsave options. */
|
||||
CONFIG_FREE_RENT = free_rent;
|
||||
|
|
@ -3451,7 +3453,9 @@ void load_config( void )
|
|||
break;
|
||||
|
||||
case 'd':
|
||||
if (!str_cmp(tag, "dts_are_dumps"))
|
||||
if (!str_cmp(tag, "display_closed_doors"))
|
||||
CONFIG_DISP_CLOSED_DOORS = num;
|
||||
else if (!str_cmp(tag, "dts_are_dumps"))
|
||||
CONFIG_DTS_ARE_DUMPS = num;
|
||||
else if (!str_cmp(tag, "donation_room_1"))
|
||||
if (num == -1)
|
||||
|
|
|
|||
3
src/db.h
3
src/db.h
|
|
@ -26,7 +26,6 @@
|
|||
#define LIB_PLRTEXT ":plrtext:"
|
||||
#define LIB_PLROBJS ":plrobjs:"
|
||||
#define LIB_PLRVARS ":plrvars:"
|
||||
#define LIB_PLRALIAS ":plralias:"
|
||||
#define LIB_PLRFILES ":plrfiles:"
|
||||
#define LIB_HOUSE ":house:"
|
||||
#define SLASH ":"
|
||||
|
|
@ -39,7 +38,6 @@
|
|||
#define LIB_PLRTEXT "plrtext/"
|
||||
#define LIB_PLROBJS "plrobjs/"
|
||||
#define LIB_PLRVARS "plrvars/"
|
||||
#define LIB_PLRALIAS "plralias/"
|
||||
#define LIB_HOUSE "house/"
|
||||
#define LIB_PLRFILES "plrfiles/"
|
||||
#define SLASH "/"
|
||||
|
|
@ -49,7 +47,6 @@
|
|||
|
||||
#define SUF_OBJS "objs"
|
||||
#define SUF_TEXT "text"
|
||||
#define SUF_ALIAS "alias"
|
||||
#define SUF_MEM "mem"
|
||||
#define SUF_PLR "plr"
|
||||
|
||||
|
|
|
|||
|
|
@ -96,6 +96,7 @@ ACMD(do_oasis_trigedit)
|
|||
else
|
||||
trigedit_setup_existing(d, real_num);
|
||||
|
||||
trigedit_disp_menu(d);
|
||||
STATE(d) = CON_TRIGEDIT;
|
||||
|
||||
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||
|
|
@ -150,8 +151,6 @@ void trigedit_setup_new(struct descriptor_data *d)
|
|||
|
||||
OLC_TRIG(d) = trig;
|
||||
OLC_VAL(d) = 0; /* Has changed flag. (It hasn't so far, we just made it.) */
|
||||
|
||||
trigedit_disp_menu(d);
|
||||
}
|
||||
|
||||
void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num)
|
||||
|
|
@ -179,8 +178,6 @@ void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num)
|
|||
|
||||
OLC_TRIG(d) = trig;
|
||||
OLC_VAL(d) = 0; /* Has changed flag. (It hasn't so far, we just made it.) */
|
||||
|
||||
trigedit_disp_menu(d);
|
||||
}
|
||||
|
||||
void trigedit_disp_menu(struct descriptor_data *d)
|
||||
|
|
|
|||
|
|
@ -2984,3 +2984,17 @@ void remove_from_lookup_table(long uid)
|
|||
|
||||
log("remove_from_lookup. UID %ld not found.", uid);
|
||||
}
|
||||
|
||||
bool check_flags_by_name_ar(int *array, int numflags, char *search, const char *namelist[])
|
||||
{
|
||||
int i, item=-1;
|
||||
|
||||
for (i=0; i<numflags && item < 0; i++)
|
||||
if (!strcmp(search, namelist[i])) item = i;
|
||||
|
||||
if (item < 0) return FALSE;
|
||||
|
||||
if (IS_SET_AR(array, item)) return TRUE;
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -20,11 +20,13 @@
|
|||
#include "screen.h"
|
||||
#include "constants.h"
|
||||
#include "spells.h"
|
||||
#include "oasis.h"
|
||||
|
||||
/* External variables and functions */
|
||||
extern const char *pc_class_types[];
|
||||
extern struct time_info_data time_info;
|
||||
int find_eq_pos_script(char *arg);
|
||||
bool check_flags_by_name_ar(int *array, int numflags, char *search, const char *namelist[]);
|
||||
|
||||
/* Utility functions */
|
||||
|
||||
|
|
@ -1062,7 +1064,17 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
|||
|
||||
*str = '\x1';
|
||||
switch (LOWER(*field)) {
|
||||
case 'c':
|
||||
case 'a':
|
||||
if (!str_cmp(field, "affects")) {
|
||||
if (subfield && *subfield) {
|
||||
if (check_flags_by_name_ar(GET_OBJ_AFFECT(o), NUM_AFF_FLAGS, subfield, affected_bits) == TRUE)
|
||||
snprintf(str, slen, "1");
|
||||
else
|
||||
snprintf(str, slen, "0");
|
||||
} else
|
||||
snprintf(str, slen, "0");
|
||||
}
|
||||
case 'c':
|
||||
if (!str_cmp(field, "cost")) {
|
||||
if (subfield && *subfield) {
|
||||
int addition = atoi(subfield);
|
||||
|
|
@ -1301,6 +1313,20 @@ o->contains) ? "1" : "0"));
|
|||
else
|
||||
*str = '\0';
|
||||
}
|
||||
else if (!str_cmp(field, "zonenumber"))
|
||||
snprintf(str, slen, "%d", zone_table[r->zone].number);
|
||||
else if (!str_cmp(field, "zonename"))
|
||||
snprintf(str, slen, "%s", zone_table[r->zone].name);
|
||||
else if (!str_cmp(field, "roomflag")) {
|
||||
if (subfield && *subfield) {
|
||||
room_rnum thisroom = real_room(r->number);
|
||||
if (check_flags_by_name_ar(ROOM_FLAGS(thisroom), NUM_ROOM_FLAGS, subfield, room_bits) == TRUE)
|
||||
snprintf(str, slen, "1");
|
||||
else
|
||||
snprintf(str, slen, "0");
|
||||
} else
|
||||
snprintf(str, slen, "0");
|
||||
}
|
||||
else if (!str_cmp(field, "north")) {
|
||||
if (R_EXIT(r, NORTH)) {
|
||||
if (subfield && *subfield) {
|
||||
|
|
|
|||
35
src/genwld.c
35
src/genwld.c
|
|
@ -382,41 +382,6 @@ int copy_room(struct room_data *to, struct room_data *from)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* Idea by Cris Jacob. */
|
||||
room_rnum duplicate_room(room_vnum dest_vnum, room_rnum orig)
|
||||
{
|
||||
int new_rnum, znum;
|
||||
struct room_data nroom;
|
||||
|
||||
#if CIRCLE_UNSIGNED_INDEX
|
||||
if (orig == NOWHERE || orig > top_of_world) {
|
||||
#else
|
||||
if (orig < 0 || orig > top_of_world) {
|
||||
#endif
|
||||
log("SYSERR: GenOLC: copy_room: Given bad original real room.");
|
||||
return NOWHERE;
|
||||
} else if ((znum = real_zone_by_thing(dest_vnum)) == NOWHERE) {
|
||||
log("SYSERR: GenOLC: copy_room: No such destination zone.");
|
||||
return NOWHERE;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
nroom = world[new_rnum];
|
||||
nroom.number = dest_vnum;
|
||||
nroom.zone = znum;
|
||||
|
||||
/* 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,
|
||||
|
|
|
|||
|
|
@ -49,8 +49,6 @@ int parse_class(char arg);
|
|||
int special(struct char_data *ch, int cmd, char *arg);
|
||||
int isbanned(char *hostname);
|
||||
int valid_name(char *newname);
|
||||
void read_aliases(struct char_data *ch);
|
||||
void delete_aliases(const char *charname);
|
||||
void remove_player(int pfilepos);
|
||||
|
||||
/* local functions */
|
||||
|
|
@ -62,7 +60,6 @@ int perform_alias(struct descriptor_data *d, char *orig, size_t maxlen);
|
|||
int reserved_word(char *argument);
|
||||
int _parse_name(char *arg, char *name);
|
||||
int enter_player_game (struct descriptor_data *d);
|
||||
void write_aliases(struct char_data *ch);
|
||||
|
||||
/* prototypes for all do_x functions. */
|
||||
ACMD(do_action);
|
||||
|
|
@ -157,6 +154,7 @@ ACMD(do_mtransform);
|
|||
ACMD(do_mzoneecho);
|
||||
ACMD(do_mrecho);
|
||||
ACMD(do_not_here);
|
||||
ACMD(do_oasis_copy);
|
||||
ACMD(do_order);
|
||||
ACMD(do_page);
|
||||
ACMD(do_peace);
|
||||
|
|
@ -175,7 +173,6 @@ ACMD(do_rescue);
|
|||
ACMD(do_rest);
|
||||
ACMD(do_restore);
|
||||
ACMD(do_return);
|
||||
ACMD(do_room_copy);
|
||||
ACMD(do_save);
|
||||
ACMD(do_saveall);
|
||||
ACMD(do_say);
|
||||
|
|
@ -366,6 +363,7 @@ cpp_extern const struct command_info cmd_info[] = {
|
|||
{ "mail" , "mail" , POS_STANDING, do_not_here , 1, 0 },
|
||||
{ "medit" , "med" , POS_DEAD , do_oasis_medit, LVL_BUILDER, 0 },
|
||||
{ "mlist" , "mlist" , POS_DEAD , do_oasis_list , LVL_BUILDER, SCMD_OASIS_MLIST },
|
||||
{ "mcopy" , "mcopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_MEDIT },
|
||||
{ "mute" , "mute" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_MUTE },
|
||||
|
||||
{ "news" , "news" , POS_SLEEPING, do_gen_ps , 0, SCMD_NEWS },
|
||||
|
|
@ -386,6 +384,7 @@ cpp_extern const struct command_info cmd_info[] = {
|
|||
{ "olc" , "olc" , POS_DEAD , do_show_save_list, LVL_BUILDER, 0 },
|
||||
{ "olist" , "olist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_OLIST },
|
||||
{ "oedit" , "oedit" , POS_DEAD , do_oasis_oedit, LVL_BUILDER, 0 },
|
||||
{ "ocopy" , "ocopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_OEDIT },
|
||||
|
||||
{ "put" , "p" , POS_RESTING , do_put , 0, 0 },
|
||||
{ "peace" , "pe" , POS_DEAD , do_peace , LVL_BUILDER, 0 },
|
||||
|
|
@ -421,11 +420,12 @@ cpp_extern const struct command_info cmd_info[] = {
|
|||
{ "return" , "retu" , POS_DEAD , do_return , 0, 0 },
|
||||
{ "redit" , "redit" , POS_DEAD , do_oasis_redit, LVL_BUILDER, 0 },
|
||||
{ "rlist" , "rlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_RLIST },
|
||||
{ "rclone" , "rclone" , POS_DEAD , do_room_copy, LVL_BUILDER, 0 },
|
||||
{ "rcopy" , "rcopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_REDIT },
|
||||
{ "roomflags", "roomflags", POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_SHOWVNUMS },
|
||||
|
||||
{ "say" , "s" , POS_RESTING , do_say , 0, 0 },
|
||||
{ "score" , "sc" , POS_DEAD , do_score , 0, 0 },
|
||||
{ "scopy" , "scopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_SEDIT },
|
||||
{ "sit" , "si" , POS_RESTING , do_sit , 0, 0 },
|
||||
{ "'" , "'" , POS_RESTING , do_say , 0, 0 },
|
||||
{ "save" , "sav" , POS_SLEEPING, do_save , 0, 0 },
|
||||
|
|
@ -465,6 +465,7 @@ cpp_extern const struct command_info cmd_info[] = {
|
|||
{ "trigedit" , "trigedit", POS_DEAD , do_oasis_trigedit, LVL_BUILDER, 0 },
|
||||
{ "typo" , "typo" , POS_DEAD , do_gen_write, 0, SCMD_TYPO },
|
||||
{ "tlist" , "tlist" , POS_DEAD , do_oasis_list, LVL_BUILDER, SCMD_OASIS_TLIST },
|
||||
{ "tcopy" , "tcopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_TRIGEDIT },
|
||||
{ "tstat" , "tstat" , POS_DEAD , do_tstat , LVL_BUILDER, 0 },
|
||||
|
||||
{ "unlock" , "unlock" , POS_SITTING , do_gen_door , 0, SCMD_UNLOCK },
|
||||
|
|
@ -1250,19 +1251,10 @@ int perform_dupe_check(struct descriptor_data *d)
|
|||
/* load the player, put them in the right room - used by copyover_recover too */
|
||||
int enter_player_game (struct descriptor_data *d)
|
||||
{
|
||||
|
||||
int load_result;
|
||||
room_vnum load_room;
|
||||
|
||||
reset_char(d->character);
|
||||
/* See if there might be some aliases in the old alias file. Only do this
|
||||
* if there were no aliases in the pfile. */
|
||||
if (GET_ALIASES(d->character) == NULL)
|
||||
{
|
||||
read_aliases(d->character);
|
||||
/* delete the old file - player will be saved in a second. */
|
||||
delete_aliases(GET_NAME(d->character));
|
||||
}
|
||||
|
||||
if (PLR_FLAGGED(d->character, PLR_INVSTART))
|
||||
GET_INVIS_LEV(d->character) = GET_LEVEL(d->character);
|
||||
|
|
@ -1731,7 +1723,6 @@ void nanny(struct descriptor_data *d, char *arg)
|
|||
remove_player(player_i);
|
||||
}
|
||||
|
||||
delete_aliases(GET_NAME(d->character));
|
||||
delete_variables(GET_NAME(d->character));
|
||||
write_to_output(d, "Character '%s' deleted! Goodbye.\r\n", GET_NAME(d->character));
|
||||
mudlog(NRM, LVL_GOD, TRUE, "%s (lev %d) has self-deleted.", GET_NAME(d->character), GET_LEVEL(d->character));
|
||||
|
|
|
|||
10
src/medit.c
10
src/medit.c
|
|
@ -155,6 +155,7 @@ ACMD(do_oasis_medit)
|
|||
else
|
||||
medit_setup_existing(d, real_num);
|
||||
|
||||
medit_disp_menu(d);
|
||||
STATE(d) = CON_MEDIT;
|
||||
|
||||
/* Display the OLC messages to the players in the same room as the
|
||||
|
|
@ -193,8 +194,6 @@ void medit_setup_new(struct descriptor_data *d)
|
|||
/* Has changed flag. (It hasn't so far, we just made it.) */
|
||||
OLC_VAL(d) = FALSE;
|
||||
OLC_ITEM_TYPE(d) = MOB_TRIGGER;
|
||||
|
||||
medit_disp_menu(d);
|
||||
}
|
||||
|
||||
void medit_setup_existing(struct descriptor_data *d, int rmob_num)
|
||||
|
|
@ -215,8 +214,6 @@ void medit_setup_existing(struct descriptor_data *d, int rmob_num)
|
|||
*/
|
||||
SCRIPT(mob) = NULL;
|
||||
OLC_MOB(d)->proto_script = NULL;
|
||||
|
||||
medit_disp_menu(d);
|
||||
}
|
||||
|
||||
/* Ideally, this function should be in db.c, but I'll put it here for portability. */
|
||||
|
|
@ -787,8 +784,8 @@ void medit_parse(struct descriptor_data *d, char *arg)
|
|||
return;
|
||||
} else
|
||||
write_to_output(d, "Please answer 'Y' or 'N': ");
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
/* We should never get here. */
|
||||
cleanup_olc(d, CLEANUP_ALL);
|
||||
|
|
@ -814,4 +811,3 @@ void medit_string_cleanup(struct descriptor_data *d, int terminator)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
243
src/oasis_copy.c
243
src/oasis_copy.c
|
|
@ -14,19 +14,153 @@
|
|||
#include "interpreter.h"
|
||||
#include "handler.h"
|
||||
#include "db.h"
|
||||
#include "shop.h"
|
||||
#include "genshp.h"
|
||||
#include "genolc.h"
|
||||
#include "genzon.h"
|
||||
#include "genwld.h"
|
||||
#include "oasis.h"
|
||||
#include "improved-edit.h"
|
||||
#include "constants.h"
|
||||
#include "dg_scripts.h"
|
||||
|
||||
/* 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);
|
||||
|
||||
/* External Functions */
|
||||
void trigedit_save(struct descriptor_data *d);
|
||||
void redit_save_internally(struct descriptor_data *d);
|
||||
void oedit_save_internally(struct descriptor_data *d);
|
||||
void medit_save_internally(struct descriptor_data *d);
|
||||
void sedit_save_internally(struct descriptor_data *d);
|
||||
void trigedit_setup_existing(struct descriptor_data *d, int rnum);
|
||||
void redit_setup_existing(struct descriptor_data *d, int rnum);
|
||||
void oedit_setup_existing(struct descriptor_data *d, int rnum);
|
||||
void medit_setup_existing(struct descriptor_data *d, int rnum);
|
||||
void sedit_setup_existing(struct descriptor_data *d, int rnum);
|
||||
|
||||
|
||||
/***********************************************************
|
||||
* This function makes use of the high level OLC functions *
|
||||
* to copy most types of mud objects. The type of data is *
|
||||
* determined by the subcmd variable and the functions are *
|
||||
* looked up in a table. *
|
||||
***********************************************************/
|
||||
ACMD(do_oasis_copy)
|
||||
{
|
||||
int i, src_vnum, src_rnum, dst_vnum, dst_rnum;
|
||||
char buf1[MAX_INPUT_LENGTH];
|
||||
char buf2[MAX_INPUT_LENGTH];
|
||||
struct descriptor_data *d;
|
||||
|
||||
struct {
|
||||
int con_type;
|
||||
IDXTYPE (*binary_search)(IDXTYPE vnum);
|
||||
void (*save_func)(struct descriptor_data *d);
|
||||
void (*setup_existing)(struct descriptor_data *d, int rnum);
|
||||
const char *command;
|
||||
const char *text;
|
||||
} oasis_copy_info[] = {
|
||||
{ CON_REDIT, real_room, redit_save_internally, redit_setup_existing, "rcopy", "room" },
|
||||
{ CON_OEDIT, real_object, oedit_save_internally, oedit_setup_existing, "ocopy", "object" },
|
||||
{ CON_MEDIT, real_mobile, medit_save_internally, medit_setup_existing, "mcopy", "mobile" },
|
||||
{ CON_SEDIT, real_shop, sedit_save_internally, sedit_setup_existing, "scopy", "shop" },
|
||||
{ CON_TRIGEDIT, real_trigger, trigedit_save, trigedit_setup_existing, "tcopy", "trigger" },
|
||||
{ -1, NULL, NULL, NULL, "\n", "\n" }
|
||||
};
|
||||
|
||||
/* Find the given connection type in the table (passed in subcmd). */
|
||||
for (i = 0; *(oasis_copy_info[i].text) != '\n'; i++)
|
||||
if (subcmd == oasis_copy_info[i].con_type)
|
||||
break;
|
||||
/* If not found, we don't support copying that type of data. */
|
||||
if (*(oasis_copy_info[i].text) == '\n')
|
||||
return;
|
||||
|
||||
/* No copying as a mob or while being forced. */
|
||||
if (IS_NPC(ch) || !ch->desc || STATE(ch->desc) != CON_PLAYING)
|
||||
return;
|
||||
|
||||
/* We need two arguments. */
|
||||
two_arguments(argument, buf1, buf2);
|
||||
|
||||
/* Both arguments are required and they must be numeric. */
|
||||
if (!*buf2 || !is_number(buf1) || !is_number(buf2)) {
|
||||
send_to_char(ch, "Syntax: %s <source vnum> <target vnum>\r\n", oasis_copy_info[i].command);
|
||||
return;
|
||||
}
|
||||
|
||||
/* We can't copy non-existing data. */
|
||||
/* Note: the source data can be in any zone. It's not restricted */
|
||||
/* to the builder's designated OLC zone. */
|
||||
src_vnum = atoi(buf1);
|
||||
src_rnum = (*oasis_copy_info[i].binary_search)(src_vnum);
|
||||
if (src_rnum == NOWHERE) {
|
||||
send_to_char(ch, "The source %s (#%d) does not exist.\r\n", oasis_copy_info[i].text, src_vnum);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Don't copy if the target already exists. */
|
||||
dst_vnum = atoi(buf2);
|
||||
dst_rnum = (*oasis_copy_info[i].binary_search)(dst_vnum);
|
||||
if (dst_rnum != NOWHERE) {
|
||||
send_to_char(ch, "The target %s (#%d) already exists.\r\n", oasis_copy_info[i].text, dst_vnum);
|
||||
return;
|
||||
}
|
||||
|
||||
/* Check that whatever it is isn't already being edited. */
|
||||
for (d = descriptor_list; d; d = d->next) {
|
||||
if (STATE(d) == subcmd) {
|
||||
if (d->olc && OLC_NUM(d) == dst_vnum) {
|
||||
send_to_char(ch, "The target %s (#%d) is currently being edited by %s.\r\n",
|
||||
oasis_copy_info[i].text, dst_vnum, GET_NAME(d->character));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
d = ch->desc;
|
||||
|
||||
/* Give the descriptor an OLC structure. */
|
||||
if (d->olc) {
|
||||
mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_oasis_copy: Player already had olc structure.");
|
||||
free(d->olc);
|
||||
}
|
||||
|
||||
/* Create the OLC structure. */
|
||||
CREATE(d->olc, struct oasis_olc_data, 1);
|
||||
|
||||
/* Find the zone. */
|
||||
if ((OLC_ZNUM(d) = real_zone_by_thing(dst_vnum)) == NOWHERE) {
|
||||
send_to_char(ch, "Sorry, there is no zone for the given vnum (#%d)!\r\n", dst_vnum);
|
||||
free(d->olc);
|
||||
d->olc = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
/* Make sure the builder is allowed to modify the target zone. */
|
||||
if (!can_edit_zone(ch, OLC_ZNUM(d))) {
|
||||
send_cannot_edit(ch, zone_table[OLC_ZNUM(d)].number);
|
||||
free(d->olc);
|
||||
d->olc = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
/* We tell the OLC functions that we want to save to the target vnum. */
|
||||
OLC_NUM(d) = dst_vnum;
|
||||
|
||||
/* Perform the copy. */
|
||||
send_to_char(ch, "Copying %s: source: #%d, dest: #%d.\r\n", oasis_copy_info[i].text, src_vnum, dst_vnum);
|
||||
(*oasis_copy_info[i].setup_existing)(d, src_rnum);
|
||||
(*oasis_copy_info[i].save_func)(d);
|
||||
|
||||
/* Currently CLEANUP_ALL should be used for everything. */
|
||||
cleanup_olc(d, CLEANUP_ALL);
|
||||
send_to_char(ch, "Done.\r\n");
|
||||
}
|
||||
|
||||
/* Commands */
|
||||
ACMD(do_dig)
|
||||
{
|
||||
|
|
@ -138,7 +272,7 @@ ACMD(do_dig)
|
|||
OLC_VAL(d) = 0;
|
||||
|
||||
send_to_char(ch, "New room (%d) created.\r\n", rvnum);
|
||||
cleanup_olc(d, CLEANUP_STRUCTS);
|
||||
cleanup_olc(d, CLEANUP_ALL);
|
||||
/* Update rrnum to the correct room rnum after adding the room. */
|
||||
rrnum = real_room(rvnum);
|
||||
}
|
||||
|
|
@ -166,111 +300,6 @@ ACMD(do_dig)
|
|||
}
|
||||
}
|
||||
|
||||
ACMD(do_room_copy)
|
||||
{
|
||||
struct room_data *room_src, *room_dst;
|
||||
int room_num, j, buf_num, taeller;
|
||||
zone_rnum dst_zone;
|
||||
struct descriptor_data *dsc;
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
|
||||
one_argument(argument, buf);
|
||||
|
||||
if (!*buf) {
|
||||
send_to_char(ch, "Usage: rclone <target room>\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (real_room((buf_num = atoi(buf))) != NOWHERE) {
|
||||
send_to_char(ch, "That room already exist!\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if ((dst_zone = real_zone_by_thing(buf_num)) == NOWHERE) {
|
||||
send_to_char(ch, "Sorry, there is no zone for that number!\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
if (!can_edit_zone(ch, dst_zone) ||
|
||||
!can_edit_zone(ch, world[IN_ROOM(ch)].zone) ) {
|
||||
send_to_char(ch, "You may only copy rooms within your designated zone(s)!\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
room_src = &world[IN_ROOM(ch)];
|
||||
CREATE(room_dst, struct room_data, 1);
|
||||
|
||||
room_dst->zone = dst_zone;
|
||||
|
||||
/* Allocate space for all strings. */
|
||||
send_to_char(ch, "Cloning room....\r\n");
|
||||
|
||||
room_dst->name = str_udup(world[IN_ROOM(ch)].name);
|
||||
room_dst->description = str_udup(world[IN_ROOM(ch)].description);
|
||||
room_dst->description = str_udup(world[IN_ROOM(ch)].description);
|
||||
room_dst->number = buf_num;
|
||||
room_dst->sector_type = world[IN_ROOM(ch)].sector_type;
|
||||
for(taeller=0; taeller < RF_ARRAY_MAX; taeller++)
|
||||
room_dst->room_flags[taeller] = ROOM_FLAGS(IN_ROOM(ch))[taeller];
|
||||
|
||||
/* 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;
|
||||
CREATE(temp, struct extra_descr_data, 1);
|
||||
|
||||
room_dst->ex_description = temp;
|
||||
for (tdesc = world[IN_ROOM(ch)].ex_description; tdesc; tdesc = tdesc->next) {
|
||||
temp->keyword = strdup(tdesc->keyword);
|
||||
temp->description = strdup(tdesc->description);
|
||||
if (tdesc->next) {
|
||||
CREATE(temp2, struct extra_descr_data, 1);
|
||||
temp->next = temp2;
|
||||
temp = temp2;
|
||||
} else
|
||||
temp->next = NULL;
|
||||
}
|
||||
}
|
||||
/* 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) {
|
||||
send_to_char(ch, "Something went wrong...\r\n");
|
||||
log("SYSERR: do_room_copy: Something failed! (%d)", room_num);
|
||||
return;
|
||||
}
|
||||
/* Idea contributed by C.Raehl. */
|
||||
for (dsc = descriptor_list; dsc; dsc = dsc->next) {
|
||||
if (dsc == ch->desc)
|
||||
continue;
|
||||
|
||||
if (STATE(dsc) == CON_ZEDIT) {
|
||||
for (j = 0; OLC_ZONE(dsc)->cmd[j].command != 'S'; j++)
|
||||
switch (OLC_ZONE(dsc)->cmd[j].command) {
|
||||
case 'O':
|
||||
case 'M':
|
||||
OLC_ZONE(dsc)->cmd[j].arg3 += (OLC_ZONE(dsc)->cmd[j].arg3 >= room_num);
|
||||
break;
|
||||
case 'D':
|
||||
OLC_ZONE(dsc)->cmd[j].arg2 += (OLC_ZONE(dsc)->cmd[j].arg2 >= room_num);
|
||||
/* Fall through */
|
||||
case 'R':
|
||||
OLC_ZONE(dsc)->cmd[j].arg1 += (OLC_ZONE(dsc)->cmd[j].arg1 >= room_num);
|
||||
break;
|
||||
}
|
||||
} else if (STATE(dsc) == CON_REDIT) {
|
||||
for (j = 0; j < NUM_OF_DIRS; j++)
|
||||
if (OLC_ROOM(dsc)->dir_option[j])
|
||||
if (OLC_ROOM(dsc)->dir_option[j]->to_room >= room_num)
|
||||
OLC_ROOM(dsc)->dir_option[j]->to_room++;
|
||||
}
|
||||
}
|
||||
add_to_save_list(real_zone_by_thing(atoi(buf)), SL_WLD);
|
||||
redit_save_to_disk(real_zone_by_thing(atoi(buf)));
|
||||
send_to_char(ch, "Room cloned to %d.\r\nAll Done.\r\n", buf_num);
|
||||
}
|
||||
|
||||
/* 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)
|
||||
|
|
|
|||
|
|
@ -170,6 +170,7 @@ ACMD(do_oasis_oedit)
|
|||
else
|
||||
oedit_setup_new(d);
|
||||
|
||||
oedit_disp_menu(d);
|
||||
STATE(d) = CON_OEDIT;
|
||||
|
||||
/* Send the OLC message to the players in the same room as the builder. */
|
||||
|
|
@ -195,8 +196,6 @@ void oedit_setup_new(struct descriptor_data *d)
|
|||
|
||||
SCRIPT(OLC_OBJ(d)) = NULL;
|
||||
OLC_OBJ(d)->proto_script = OLC_SCRIPT(d) = NULL;
|
||||
|
||||
oedit_disp_menu(d);
|
||||
}
|
||||
|
||||
void oedit_setup_existing(struct descriptor_data *d, int real_num)
|
||||
|
|
@ -216,8 +215,6 @@ void oedit_setup_existing(struct descriptor_data *d, int real_num)
|
|||
* obj later, after editing. */
|
||||
SCRIPT(obj) = NULL;
|
||||
OLC_OBJ(d)->proto_script = NULL;
|
||||
|
||||
oedit_disp_menu(d);
|
||||
}
|
||||
|
||||
void oedit_save_internally(struct descriptor_data *d)
|
||||
|
|
|
|||
|
|
@ -31,12 +31,12 @@ void tag_argument(char *argument, char *tag);
|
|||
void load_affects(FILE *fl, struct char_data *ch);
|
||||
void load_skills(FILE *fl, struct char_data *ch);
|
||||
void load_HMVS(struct char_data *ch, const char *line, int mode);
|
||||
void write_aliases_ascii(FILE *file, struct char_data *ch);
|
||||
void read_aliases_ascii(FILE *file, struct char_data *ch, int count);
|
||||
|
||||
/* external fuctions */
|
||||
bitvector_t asciiflag_conv(char *flag);
|
||||
void save_char_vars(struct char_data *ch);
|
||||
void write_aliases_ascii(FILE *file, struct char_data *ch);
|
||||
void read_aliases_ascii(FILE *file, struct char_data *ch, int count);
|
||||
void save_char_vars_ascii(FILE *file, struct char_data *ch);
|
||||
void read_saved_vars_ascii(FILE *file, struct char_data *ch, int count);
|
||||
void strip_cr(char *buffer);
|
||||
|
|
@ -100,7 +100,6 @@ int create_entry(char *name)
|
|||
int i, pos;
|
||||
|
||||
if (top_of_p_table == -1) { /* no table */
|
||||
CREATE(player_table, struct player_index_element, 1);
|
||||
pos = top_of_p_table = 0;
|
||||
} else if ((pos = get_ptable_by_name(name)) == -1) { /* new name */
|
||||
i = ++top_of_p_table + 1;
|
||||
|
|
@ -813,3 +812,63 @@ void load_HMVS(struct char_data *ch, const char *line, int mode)
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* 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;
|
||||
|
||||
if (GET_ALIASES(ch) == NULL)
|
||||
return;
|
||||
|
||||
for (temp = GET_ALIASES(ch); temp; temp = temp->next)
|
||||
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 */
|
||||
for (temp = GET_ALIASES(ch); temp; temp = temp->next) {
|
||||
fprintf(file, "%s\n" /* Alias */
|
||||
"%s\n" /* Replacement */
|
||||
"%d\n", /* Type */
|
||||
temp->alias,
|
||||
temp->replacement+1,
|
||||
temp->type);
|
||||
}
|
||||
}
|
||||
|
||||
void read_aliases_ascii(FILE *file, struct char_data *ch, int count)
|
||||
{
|
||||
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. */
|
||||
}
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
/* Read the aliased command. */
|
||||
get_line(file, abuf);
|
||||
|
||||
/* Read the replacement. */
|
||||
get_line(file, tbuf);
|
||||
strcpy(rbuf, " ");
|
||||
strcat(rbuf, tbuf); /* strcat: OK */
|
||||
|
||||
/* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
10
src/redit.c
10
src/redit.c
|
|
@ -139,6 +139,7 @@ ACMD(do_oasis_redit)
|
|||
else
|
||||
redit_setup_new(d);
|
||||
|
||||
redit_disp_menu(d);
|
||||
STATE(d) = CON_REDIT;
|
||||
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||
SET_BIT_AR(PLR_FLAGS(ch), PLR_WRITING);
|
||||
|
|
@ -157,7 +158,6 @@ void redit_setup_new(struct descriptor_data *d)
|
|||
OLC_ITEM_TYPE(d) = WLD_TRIGGER;
|
||||
OLC_ROOM(d)->proto_script = OLC_SCRIPT(d) = NULL;
|
||||
|
||||
redit_disp_menu(d);
|
||||
OLC_VAL(d) = 0;
|
||||
}
|
||||
|
||||
|
|
@ -215,8 +215,6 @@ void redit_setup_existing(struct descriptor_data *d, int real_num)
|
|||
dg_olc_script_copy(d);
|
||||
room->proto_script = NULL;
|
||||
SCRIPT(room) = NULL;
|
||||
|
||||
redit_disp_menu(d);
|
||||
}
|
||||
|
||||
void redit_save_internally(struct descriptor_data *d)
|
||||
|
|
@ -224,10 +222,10 @@ void redit_save_internally(struct descriptor_data *d)
|
|||
int j, room_num, new_room = FALSE;
|
||||
struct descriptor_data *dsc;
|
||||
|
||||
if (OLC_ROOM(d)->number == NOWHERE) {
|
||||
if (OLC_ROOM(d)->number == NOWHERE)
|
||||
new_room = TRUE;
|
||||
OLC_ROOM(d)->number = OLC_NUM(d);
|
||||
}
|
||||
|
||||
OLC_ROOM(d)->number = OLC_NUM(d);
|
||||
/* FIXME: Why is this not set elsewhere? */
|
||||
OLC_ROOM(d)->zone = OLC_ZNUM(d);
|
||||
|
||||
|
|
|
|||
|
|
@ -164,6 +164,7 @@ ACMD(do_oasis_sedit)
|
|||
else
|
||||
sedit_setup_new(d);
|
||||
|
||||
sedit_disp_menu(d);
|
||||
STATE(d) = CON_SEDIT;
|
||||
|
||||
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||
|
|
@ -206,7 +207,6 @@ void sedit_setup_new(struct descriptor_data *d)
|
|||
|
||||
/* Presto! A shop. */
|
||||
OLC_SHOP(d) = shop;
|
||||
sedit_disp_menu(d);
|
||||
}
|
||||
|
||||
void sedit_setup_existing(struct descriptor_data *d, int rshop_num)
|
||||
|
|
@ -216,7 +216,6 @@ void sedit_setup_existing(struct descriptor_data *d, int rshop_num)
|
|||
|
||||
/* don't waste time trying to free NULL strings -- Welcor */
|
||||
copy_shop(OLC_SHOP(d), shop_index + rshop_num, FALSE);
|
||||
sedit_disp_menu(d);
|
||||
}
|
||||
|
||||
/* Menu functions */
|
||||
|
|
|
|||
|
|
@ -1047,6 +1047,7 @@ struct game_data {
|
|||
int load_into_inventory;/* Objects load in immortals inventory. */
|
||||
int track_through_doors;/* Track through doors while closed? */
|
||||
int no_mort_to_immort; /* Prevent mortals leveling to imms? */
|
||||
int disp_closed_doors; /* Display closed doors in autoexit? */
|
||||
|
||||
char *OK; /* When player receives 'Okay.' text. */
|
||||
char *NOPERSON; /* 'No one by that name here.' */
|
||||
|
|
|
|||
|
|
@ -526,10 +526,6 @@ int get_filename(char *filename, size_t fbufsize, int mode, const char *orig_nam
|
|||
prefix = LIB_PLROBJS;
|
||||
suffix = SUF_OBJS;
|
||||
break;
|
||||
case ALIAS_FILE:
|
||||
prefix = LIB_PLRALIAS;
|
||||
suffix = SUF_ALIAS;
|
||||
break;
|
||||
case ETEXT_FILE:
|
||||
prefix = LIB_PLRTEXT;
|
||||
suffix = SUF_TEXT;
|
||||
|
|
|
|||
|
|
@ -108,10 +108,9 @@ void char_from_furniture(struct char_data *ch);
|
|||
/* get_filename() */
|
||||
#define CRASH_FILE 0
|
||||
#define ETEXT_FILE 1
|
||||
#define ALIAS_FILE 2
|
||||
#define SCRIPT_VARS_FILE 3
|
||||
#define PLR_FILE 4
|
||||
#define MAX_FILES 5
|
||||
#define SCRIPT_VARS_FILE 2
|
||||
#define PLR_FILE 3
|
||||
#define MAX_FILES 4
|
||||
|
||||
/* breadth-first searching */
|
||||
#define BFS_ERROR (-1)
|
||||
|
|
@ -548,6 +547,7 @@ void char_from_furniture(struct char_data *ch);
|
|||
#define CONFIG_OK config_info.play.OK
|
||||
#define CONFIG_NOPERSON config_info.play.NOPERSON
|
||||
#define CONFIG_NOEFFECT config_info.play.NOEFFECT
|
||||
#define CONFIG_DISP_CLOSED_DOORS config_info.play.disp_closed_doors
|
||||
|
||||
/* Crash Saves */
|
||||
#define CONFIG_FREE_RENT config_info.csd.free_rent
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue