Remove conf.h from SVN and some bug fixes

This commit is contained in:
JamDog 2010-11-04 10:52:01 +00:00
parent 95b4f8267c
commit 2743ff82ec
15 changed files with 178 additions and 481 deletions

View file

@ -35,6 +35,11 @@ export (QQ's a zone into a tarball)
Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist) Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist)
(lots of major bugfixes too) (lots of major bugfixes too)
@ @
[Nov 04 2010] - Jamdog
Bug-Fix: Converted affect flags in struct affected_type from 32-bit to 128-bit
Bug Fix: Players with too much gold now don't lose eq when renting
Removed conf.h fron the SVN, as this is created by the configure script
Minor IBT system change for accurately finding who logged an IBT
[Nov 01 2010] - Rumble [Nov 01 2010] - Rumble
Fixed do_scan crash due to exits to NOWHERE. (thanks Rhade) Fixed do_scan crash due to exits to NOWHERE. (thanks Rhade)
Changed do_score experience tnl to list only mortals since LVL_IMMORT showed negative EXP. Changed do_score experience tnl to list only mortals since LVL_IMMORT showed negative EXP.

View file

@ -84,7 +84,7 @@ static void perform_put(struct char_data *ch, struct obj_data *obj, struct obj_d
1) put <object> <container> 1) put <object> <container>
2) put all.<object> <container> 2) put all.<object> <container>
3) put all <container> 3) put all <container>
The <container> must be in inventory or on ground. All objects to be put The <container> must be in inventory or on ground. All objects to be put
into container must be in inventory. */ into container must be in inventory. */
ACMD(do_put) ACMD(do_put)
{ {
@ -473,7 +473,7 @@ static int perform_drop(struct char_data *ch, struct obj_data *obj,
return (value); return (value);
default: default:
log("SYSERR: Incorrect argument %d passed to perform_drop.", mode); log("SYSERR: Incorrect argument %d passed to perform_drop.", mode);
/* SYSERR_DESC: This error comes from perform_drop() and is output when /* SYSERR_DESC: This error comes from perform_drop() and is output when
* perform_drop() is called with an illegal 'mode' argument. */ * perform_drop() is called with an illegal 'mode' argument. */
break; break;
} }
@ -619,7 +619,7 @@ static void perform_give(struct char_data *ch, struct char_data *vict,
act("You give $p to $N.", FALSE, ch, obj, vict, TO_CHAR); act("You give $p to $N.", FALSE, ch, obj, vict, TO_CHAR);
act("$n gives you $p.", FALSE, ch, obj, vict, TO_VICT); act("$n gives you $p.", FALSE, ch, obj, vict, TO_VICT);
act("$n gives $p to $N.", TRUE, ch, obj, vict, TO_NOTVICT); act("$n gives $p to $N.", TRUE, ch, obj, vict, TO_NOTVICT);
autoquest_trigger_check( ch, vict, obj, AQ_OBJ_RETURN); autoquest_trigger_check( ch, vict, obj, AQ_OBJ_RETURN);
} }
@ -748,8 +748,8 @@ void weight_change_object(struct obj_data *obj, int weight)
obj_to_obj(obj, tmp_obj); obj_to_obj(obj, tmp_obj);
} else { } else {
log("SYSERR: Unknown attempt to subtract weight from an object."); log("SYSERR: Unknown attempt to subtract weight from an object.");
/* SYSERR_DESC: weight_change_object() outputs this error when weight is /* SYSERR_DESC: weight_change_object() outputs this error when weight is
* attempted to be removed from an object that is not carried or in * attempted to be removed from an object that is not carried or in
* another object. */ * another object. */
} }
} }
@ -766,8 +766,8 @@ void name_from_drinkcon(struct obj_data *obj)
liqname = drinknames[GET_OBJ_VAL(obj, 2)]; liqname = drinknames[GET_OBJ_VAL(obj, 2)];
if (!isname(liqname, obj->name)) { if (!isname(liqname, obj->name)) {
log("SYSERR: Can't remove liquid '%s' from '%s' (%d) item.", liqname, obj->name, obj->item_number); log("SYSERR: Can't remove liquid '%s' from '%s' (%d) item.", liqname, obj->name, obj->item_number);
/* SYSERR_DESC: From name_from_drinkcon(), this error comes about if the /* SYSERR_DESC: From name_from_drinkcon(), this error comes about if the
* object noted (by keywords and item vnum) does not contain the liquid * object noted (by keywords and item vnum) does not contain the liquid
* string being searched for. */ * string being searched for. */
return; return;
} }
@ -907,7 +907,7 @@ ACMD(do_drink)
weight = MIN(amount, GET_OBJ_WEIGHT(temp)); weight = MIN(amount, GET_OBJ_WEIGHT(temp));
weight_change_object(temp, -weight); /* Subtract amount */ weight_change_object(temp, -weight); /* Subtract amount */
} }
gain_condition(ch, DRUNK, drink_aff[GET_OBJ_VAL(temp, 2)][DRUNK] * amount / 4); gain_condition(ch, DRUNK, drink_aff[GET_OBJ_VAL(temp, 2)][DRUNK] * amount / 4);
gain_condition(ch, HUNGER, drink_aff[GET_OBJ_VAL(temp, 2)][HUNGER] * amount / 4); gain_condition(ch, HUNGER, drink_aff[GET_OBJ_VAL(temp, 2)][HUNGER] * amount / 4);
gain_condition(ch, THIRST, drink_aff[GET_OBJ_VAL(temp, 2)][THIRST] * amount / 4); gain_condition(ch, THIRST, drink_aff[GET_OBJ_VAL(temp, 2)][THIRST] * amount / 4);
@ -925,11 +925,10 @@ ACMD(do_drink)
send_to_char(ch, "Oops, it tasted rather strange!\r\n"); send_to_char(ch, "Oops, it tasted rather strange!\r\n");
act("$n chokes and utters some strange sounds.", TRUE, ch, 0, 0, TO_ROOM); act("$n chokes and utters some strange sounds.", TRUE, ch, 0, 0, TO_ROOM);
new_affect(&af);
af.type = SPELL_POISON; af.type = SPELL_POISON;
af.duration = amount * 3; af.duration = amount * 3;
af.modifier = 0; SET_BIT_AR(af.bitvector, AFF_POISON);
af.location = APPLY_NONE;
af.bitvector = AFF_POISON;
affect_join(ch, &af, FALSE, FALSE, FALSE, FALSE); affect_join(ch, &af, FALSE, FALSE, FALSE, FALSE);
} }
/* Empty the container (unless unlimited), and no longer poison. */ /* Empty the container (unless unlimited), and no longer poison. */
@ -1001,11 +1000,10 @@ ACMD(do_eat)
send_to_char(ch, "Oops, that tasted rather strange!\r\n"); send_to_char(ch, "Oops, that tasted rather strange!\r\n");
act("$n coughs and utters some strange sounds.", FALSE, ch, 0, 0, TO_ROOM); act("$n coughs and utters some strange sounds.", FALSE, ch, 0, 0, TO_ROOM);
new_affect(&af);
af.type = SPELL_POISON; af.type = SPELL_POISON;
af.duration = amount * 2; af.duration = amount * 2;
af.modifier = 0; SET_BIT_AR(af.bitvector, AFF_POISON);
af.location = APPLY_NONE;
af.bitvector = AFF_POISON;
affect_join(ch, &af, FALSE, FALSE, FALSE, FALSE); affect_join(ch, &af, FALSE, FALSE, FALSE, FALSE);
} }
if (subcmd == SCMD_EAT) if (subcmd == SCMD_EAT)
@ -1450,7 +1448,7 @@ static void perform_remove(struct char_data *ch, int pos)
log("SYSERR: perform_remove: bad pos %d passed.", pos); log("SYSERR: perform_remove: bad pos %d passed.", pos);
/* This error occurs when perform_remove() is passed a bad 'pos' /* This error occurs when perform_remove() is passed a bad 'pos'
* (location) to remove an object from. */ * (location) to remove an object from. */
else if (OBJ_FLAGGED(obj, ITEM_NODROP) && !PRF_FLAGGED(ch, PRF_NOHASSLE)) else if (OBJ_FLAGGED(obj, ITEM_NODROP) && !PRF_FLAGGED(ch, PRF_NOHASSLE))
act("You can't remove $p, it must be CURSED!", FALSE, ch, obj, 0, TO_CHAR); act("You can't remove $p, it must be CURSED!", FALSE, ch, obj, 0, TO_CHAR);
else if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch)&& !PRF_FLAGGED(ch, PRF_NOHASSLE)) else if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch)&& !PRF_FLAGGED(ch, PRF_NOHASSLE))
act("$p: you can't carry that many items!", FALSE, ch, obj, 0, TO_CHAR); act("$p: you can't carry that many items!", FALSE, ch, obj, 0, TO_CHAR);

View file

@ -117,11 +117,10 @@ ACMD(do_sneak)
if (percent > GET_SKILL(ch, SKILL_SNEAK) + dex_app_skill[GET_DEX(ch)].sneak) if (percent > GET_SKILL(ch, SKILL_SNEAK) + dex_app_skill[GET_DEX(ch)].sneak)
return; return;
new_affect(&af);
af.type = SKILL_SNEAK; af.type = SKILL_SNEAK;
af.duration = GET_LEVEL(ch); af.duration = GET_LEVEL(ch);
af.modifier = 0; SET_BIT_AR(af.bitvector, AFF_SNEAK);
af.location = APPLY_NONE;
af.bitvector = AFF_SNEAK;
affect_to_char(ch, &af); affect_to_char(ch, &af);
} }

View file

@ -887,11 +887,14 @@ static void do_stat_character(struct char_data *ch, struct char_data *k)
if (aff->modifier) if (aff->modifier)
send_to_char(ch, "%+d to %s", aff->modifier, apply_types[(int) aff->location]); send_to_char(ch, "%+d to %s", aff->modifier, apply_types[(int) aff->location]);
if (aff->bitvector) { if (aff->bitvector[0] || aff->bitvector[1] || aff->bitvector[2] || aff->bitvector[3]) {
if (aff->modifier) if (aff->modifier)
send_to_char(ch, ", "); send_to_char(ch, ", ");
for (i=0; i<NUM_AFF_FLAGS; i++) {
send_to_char(ch, "sets %s", affected_bits[aff->bitvector]); if (IS_SET_AR(aff->bitvector, i)) {
send_to_char(ch, "sets %s, ", affected_bits[i]);
}
}
} }
send_to_char(ch, "\r\n"); send_to_char(ch, "\r\n");
} }

View file

@ -1,338 +0,0 @@
/* src/conf.h. Generated automatically by configure. */
/* src/conf.h.in. Generated automatically from configure.in by autoheader. */
#ifndef _CONF_H_
#define _CONF_H_
/* Define to empty if the keyword does not work. */
/* #undef const */
/* Define if you don't have vprintf but do have _doprnt. */
/* #undef HAVE_DOPRNT */
/* Define if you have <sys/wait.h> that is POSIX.1 compatible. */
#define HAVE_SYS_WAIT_H 1
/* Define if you have the vprintf function. */
#define HAVE_VPRINTF 1
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef pid_t */
/* Define as the return type of signal handlers (int or void). */
#define RETSIGTYPE void
/* Define to `unsigned' if <sys/types.h> doesn't define. */
/* #undef size_t */
/* Define if you have the ANSI C header files. */
#define STDC_HEADERS 1
/* Define if you can safely include both <sys/time.h> and <time.h>. */
#define TIME_WITH_SYS_TIME 1
/* Define if we're compiling CircleMUD under any type of UNIX system. */
#define CIRCLE_UNIX 1
/* Define if the system is capable of using crypt() to encrypt. */
#define CIRCLE_CRYPT 1
/* Define if we don't have proper support for the system's crypt(). */
/* #undef HAVE_UNSAFE_CRYPT */
/* Define is the system has struct in_addr. */
#define HAVE_STRUCT_IN_ADDR 1
/* Define to `int' if <sys/socket.h> doesn't define. */
/* #undef socklen_t */
/* Define to `int' if <sys/types.h> doesn't define. */
/* #undef ssize_t */
/* Define if you have the gettimeofday function. */
#define HAVE_GETTIMEOFDAY 1
/* Define if you have the inet_addr function. */
#define HAVE_INET_ADDR 1
/* Define if you have the inet_aton function. */
#define HAVE_INET_ATON 1
/* Define if you have the select function. */
#define HAVE_SELECT 1
/* Define if you have the snprintf function. */
#define HAVE_SNPRINTF 1
/* Define if you have the strcasecmp function. */
#define HAVE_STRCASECMP 1
/* Define if you have the strdup function. */
#define HAVE_STRDUP 1
/* Define if you have the strerror function. */
#define HAVE_STRERROR 1
/* Define if you have the stricmp function. */
/* #undef HAVE_STRICMP */
/* Define if you have the strlcpy function. */
/* #undef HAVE_STRLCPY */
/* Define if you have the strncasecmp function. */
#define HAVE_STRNCASECMP 1
/* Define if you have the strnicmp function. */
/* #undef HAVE_STRNICMP */
/* Define if you have the strstr function. */
#define HAVE_STRSTR 1
/* Define if you have the vsnprintf function. */
#define HAVE_VSNPRINTF 1
/* Define if you have the <arpa/inet.h> header file. */
#define HAVE_ARPA_INET_H 1
/* Define if you have the <arpa/telnet.h> header file. */
#define HAVE_ARPA_TELNET_H 1
/* Define if you have the <assert.h> header file. */
#define HAVE_ASSERT_H 1
/* Define if you have the <crypt.h> header file. */
#define HAVE_CRYPT_H 1
/* Define if you have the <errno.h> header file. */
#define HAVE_ERRNO_H 1
/* Define if you have the <fcntl.h> header file. */
#define HAVE_FCNTL_H 1
/* Define if you have the <limits.h> header file. */
#define HAVE_LIMITS_H 1
/* Define if you have the <mcheck.h> header file. */
#define HAVE_MCHECK_H 1
/* Define if you have the <memory.h> header file. */
#define HAVE_MEMORY_H 1
/* Define if you have the <net/errno.h> header file. */
/* #undef HAVE_NET_ERRNO_H */
/* Define if you have the <netdb.h> header file. */
#define HAVE_NETDB_H 1
/* Define if you have the <netinet/in.h> header file. */
#define HAVE_NETINET_IN_H 1
/* Define if you have the <signal.h> header file. */
#define HAVE_SIGNAL_H 1
/* Define if you have the <string.h> header file. */
#define HAVE_STRING_H 1
/* Define if you have the <strings.h> header file. */
#define HAVE_STRINGS_H 1
/* Define if you have the <sys/fcntl.h> header file. */
#define HAVE_SYS_FCNTL_H 1
/* Define if you have the <sys/resource.h> header file. */
#define HAVE_SYS_RESOURCE_H 1
/* Define if you have the <sys/select.h> header file. */
#define HAVE_SYS_SELECT_H 1
/* Define if you have the <sys/socket.h> header file. */
#define HAVE_SYS_SOCKET_H 1
/* Define if you have the <sys/stat.h> header file. */
#define HAVE_SYS_STAT_H 1
/* Define if you have the <sys/time.h> header file. */
#define HAVE_SYS_TIME_H 1
/* Define if you have the <sys/types.h> header file. */
#define HAVE_SYS_TYPES_H 1
/* Define if you have the <sys/uio.h> header file. */
#define HAVE_SYS_UIO_H 1
/* Define if you have the <unistd.h> header file. */
#define HAVE_UNISTD_H 1
/* Define if you have the malloc library (-lmalloc). */
/* #undef HAVE_LIBMALLOC */
/* Check for a prototype to accept. */
/* #undef NEED_ACCEPT_PROTO */
/* Check for a prototype to atoi. */
/* #undef NEED_ATOI_PROTO */
/* Check for a prototype to atol. */
/* #undef NEED_ATOL_PROTO */
/* Check for a prototype to bind. */
/* #undef NEED_BIND_PROTO */
/* Check for a prototype to bzero. */
/* #undef NEED_BZERO_PROTO */
/* Check for a prototype to chdir. */
/* #undef NEED_CHDIR_PROTO */
/* Check for a prototype to close. */
/* #undef NEED_CLOSE_PROTO */
/* Check for a prototype to crypt. */
/* #undef NEED_CRYPT_PROTO */
/* Check for a prototype to fclose. */
/* #undef NEED_FCLOSE_PROTO */
/* Check for a prototype to fcntl. */
/* #undef NEED_FCNTL_PROTO */
/* Check for a prototype to fflush. */
/* #undef NEED_FFLUSH_PROTO */
/* Check for a prototype to fprintf. */
/* #undef NEED_FPRINTF_PROTO */
/* Check for a prototype to fputc. */
/* #undef NEED_FPUTC_PROTO */
/* Check for a prototype to fputs. */
/* #undef NEED_FPUTS_PROTO */
/* Check for a prototype to fread. */
/* #undef NEED_FREAD_PROTO */
/* Check for a prototype to fscanf. */
/* #undef NEED_FSCANF_PROTO */
/* Check for a prototype to fseek. */
/* #undef NEED_FSEEK_PROTO */
/* Check for a prototype to fwrite. */
/* #undef NEED_FWRITE_PROTO */
/* Check for a prototype to getpeername. */
/* #undef NEED_GETPEERNAME_PROTO */
/* Check for a prototype to getpid. */
/* #undef NEED_GETPID_PROTO */
/* Check for a prototype to getrlimit. */
/* #undef NEED_GETRLIMIT_PROTO */
/* Check for a prototype to getsockname. */
/* #undef NEED_GETSOCKNAME_PROTO */
/* Check for a prototype to gettimeofday. */
/* #undef NEED_GETTIMEOFDAY_PROTO */
/* Check for a prototype to htonl. */
/* #undef NEED_HTONL_PROTO */
/* Check for a prototype to htons. */
/* #undef NEED_HTONS_PROTO */
/* Check for a prototype to inet_addr. */
/* #undef NEED_INET_ADDR_PROTO */
/* Check for a prototype to inet_aton. */
/* #undef NEED_INET_ATON_PROTO */
/* Check for a prototype to inet_ntoa. */
/* #undef NEED_INET_NTOA_PROTO */
/* Check for a prototype to listen. */
/* #undef NEED_LISTEN_PROTO */
/* Check for a prototype to ntohl. */
/* #undef NEED_NTOHL_PROTO */
/* Check for a prototype to perror. */
/* #undef NEED_PERROR_PROTO */
/* Check for a prototype to printf. */
/* #undef NEED_PRINTF_PROTO */
/* Check for a prototype to qsort. */
/* #undef NEED_QSORT_PROTO */
/* Check for a prototype to read. */
/* #undef NEED_READ_PROTO */
/* Check for a prototype to remove. */
/* #undef NEED_REMOVE_PROTO */
/* Check for a prototype to rewind. */
/* #undef NEED_REWIND_PROTO */
/* Check for a prototype to select. */
/* #undef NEED_SELECT_PROTO */
/* Check for a prototype to setitimer. */
/* #undef NEED_SETITIMER_PROTO */
/* Check for a prototype to setrlimit. */
/* #undef NEED_SETRLIMIT_PROTO */
/* Check for a prototype to setsockopt. */
/* #undef NEED_SETSOCKOPT_PROTO */
/* Check for a prototype to snprintf. */
/* #undef NEED_SNPRINTF_PROTO */
/* Check for a prototype to socket. */
/* #undef NEED_SOCKET_PROTO */
/* Check for a prototype to sprintf. */
/* #undef NEED_SPRINTF_PROTO */
/* Check for a prototype to sscanf. */
/* #undef NEED_SSCANF_PROTO */
/* Check for a prototype to strcasecmp. */
/* #undef NEED_STRCASECMP_PROTO */
/* Check for a prototype to strdup. */
/* #undef NEED_STRDUP_PROTO */
/* Check for a prototype to strerror. */
/* #undef NEED_STRERROR_PROTO */
/* Check for a prototype to stricmp. */
#define NEED_STRICMP_PROTO
/* Check for a prototype to strlcpy. */
#define NEED_STRLCPY_PROTO
/* Check for a prototype to strncasecmp. */
/* #undef NEED_STRNCASECMP_PROTO */
/* Check for a prototype to strnicmp. */
#define NEED_STRNICMP_PROTO
/* Check for a prototype to system. */
/* #undef NEED_SYSTEM_PROTO */
/* Check for a prototype to time. */
/* #undef NEED_TIME_PROTO */
/* Check for a prototype to unlink. */
/* #undef NEED_UNLINK_PROTO */
/* Check for a prototype to vsnprintf. */
/* #undef NEED_VSNPRINTF_PROTO */
/* Check for a prototype to write. */
/* #undef NEED_WRITE_PROTO */
#endif /* _CONF_H_ */

View file

@ -227,16 +227,15 @@ void do_dg_affect(void *go, struct script_data *sc, trig_data *trig,
} }
/* add the affect */ /* add the affect */
new_affect(&af);
af.type = SPELL_DG_AFFECT; af.type = SPELL_DG_AFFECT;
af.duration = duration -1; af.duration = duration -1;
af.modifier = value; af.modifier = value;
if (type == APPLY_TYPE) { if (type == APPLY_TYPE) {
af.location = i; af.location = i;
af.bitvector = 0;
} else { } else {
af.location = 0; SET_BIT_AR(af.bitvector, i);
af.bitvector = i;
} }
affect_to_char(ch, &af); affect_to_char(ch, &af);

View file

@ -29,8 +29,7 @@ static int extractions_pending = 0;
/* local file scope functions */ /* local file scope functions */
static int apply_ac(struct char_data *ch, int eq_pos); static int apply_ac(struct char_data *ch, int eq_pos);
static void update_object(struct obj_data *obj, int use); static void update_object(struct obj_data *obj, int use);
static void affect_modify(struct char_data *ch, byte loc, sbyte mod, long bitv, bool add); static void affect_modify_ar(struct char_data * ch, byte loc, sbyte mod, int bitv[], bool add);
char *fname(const char *namelist) char *fname(const char *namelist)
{ {
@ -203,19 +202,7 @@ void aff_apply_modify(struct char_data *ch, byte loc, sbyte mod, char *msg)
} /* switch */ } /* switch */
} }
static void affect_modify(struct char_data * ch, byte loc, sbyte mod, long bitv, bool add) static void affect_modify_ar(struct char_data * ch, byte loc, sbyte mod, int bitv[], bool add)
{
if (add) {
SET_BIT_AR(AFF_FLAGS(ch), bitv);
} else {
REMOVE_BIT_AR(AFF_FLAGS(ch), bitv);
mod = -mod;
}
aff_apply_modify(ch, loc, mod, "affect_modify");
}
void affect_modify_ar(struct char_data * ch, byte loc, sbyte mod, int bitv[], bool add)
{ {
int i , j; int i , j;
@ -251,7 +238,7 @@ void affect_total(struct char_data *ch)
} }
for (af = ch->affected; af; af = af->next) for (af = ch->affected; af; af = af->next)
affect_modify(ch, af->location, af->modifier, af->bitvector, FALSE); affect_modify_ar(ch, af->location, af->modifier, af->bitvector, FALSE);
ch->aff_abils = ch->real_abils; ch->aff_abils = ch->real_abils;
@ -264,7 +251,7 @@ void affect_total(struct char_data *ch)
} }
for (af = ch->affected; af; af = af->next) for (af = ch->affected; af; af = af->next)
affect_modify(ch, af->location, af->modifier, af->bitvector, TRUE); affect_modify_ar(ch, af->location, af->modifier, af->bitvector, TRUE);
/* Make certain values are between 0..25, not < 0 and not > 25! */ /* Make certain values are between 0..25, not < 0 and not > 25! */
i = (IS_NPC(ch) || GET_LEVEL(ch) >= LVL_GRGOD) ? 25 : 18; i = (IS_NPC(ch) || GET_LEVEL(ch) >= LVL_GRGOD) ? 25 : 18;
@ -299,7 +286,7 @@ void affect_to_char(struct char_data *ch, struct affected_type *af)
affected_alloc->next = ch->affected; affected_alloc->next = ch->affected;
ch->affected = affected_alloc; ch->affected = affected_alloc;
affect_modify(ch, af->location, af->modifier, af->bitvector, TRUE); affect_modify_ar(ch, af->location, af->modifier, af->bitvector, TRUE);
affect_total(ch); affect_total(ch);
} }
@ -315,7 +302,7 @@ void affect_remove(struct char_data *ch, struct affected_type *af)
return; return;
} }
affect_modify(ch, af->location, af->modifier, af->bitvector, FALSE); affect_modify_ar(ch, af->location, af->modifier, af->bitvector, FALSE);
REMOVE_FROM_LIST(af, ch->affected, next); REMOVE_FROM_LIST(af, ch->affected, next);
free(af); free(af);
affect_total(ch); affect_total(ch);

View file

@ -56,6 +56,7 @@ static void free_ibt_list(IBT_DATA *first_ibt, IBT_DATA *last_ibt);
static IBT_DATA *read_ibt(char *filename, FILE *fp); static IBT_DATA *read_ibt(char *filename, FILE *fp);
static IBT_DATA *get_first_ibt(int mode); static IBT_DATA *get_first_ibt(int mode);
static IBT_DATA *get_last_ibt(int mode); static IBT_DATA *get_last_ibt(int mode);
static bool is_ibt_logger(IBT_DATA *ibtData, struct char_data *ch);
/* Internal (static) OLC functions */ /* Internal (static) OLC functions */
static void ibtedit_setup(struct descriptor_data *d); static void ibtedit_setup(struct descriptor_data *d);
static void ibtedit_save(struct descriptor_data *d); static void ibtedit_save(struct descriptor_data *d);
@ -419,6 +420,22 @@ bool free_ibt(int mode, IBT_DATA *ibtData)
return TRUE; return TRUE;
} }
/* Return TRUE if 'ch' is the person who logged the IBT */
static bool is_ibt_logger(IBT_DATA *ibtData, struct char_data *ch)
{
if ( ch && !IS_NPC(ch) && ibtData ) {
/* Check the ID number first (in case of name change) */
if ((ibtData->id_num != NOBODY) && (ibtData->id_num == GET_IDNUM(ch)))
return TRUE;
/* Check the name next (in case of deletion/recreation) */
if (strcmp(ibtData->name, GET_NAME(ch)) == 0)
return TRUE;
}
return FALSE;
}
ACMD(do_ibt) ACMD(do_ibt)
{ {
char arg[MAX_STRING_LENGTH], arg2[MAX_STRING_LENGTH]; char arg[MAX_STRING_LENGTH], arg2[MAX_STRING_LENGTH];
@ -482,7 +499,7 @@ ACMD(do_ibt)
send_to_char(ch, "That %s doesn't exist.\r\n", CMD_NAME); send_to_char(ch, "That %s doesn't exist.\r\n", CMD_NAME);
return; return;
} else { } else {
if ((GET_LEVEL(ch) < LVL_IMMORT) && (GET_IDNUM(ch) != ibtData->id_num)) { if ((GET_LEVEL(ch) < LVL_IMMORT) && (!is_ibt_logger(ibtData, ch))) {
send_to_char(ch, "Sorry but you may only view %ss you have posted yourself.\n\r", ibt_types[subcmd]); send_to_char(ch, "Sorry but you may only view %ss you have posted yourself.\n\r", ibt_types[subcmd]);
} else { } else {
@ -522,7 +539,7 @@ ACMD(do_ibt)
i++; i++;
/* For mortals, skip IBT's that they didn't log */ /* For mortals, skip IBT's that they didn't log */
if ((GET_LEVEL(ch) < LVL_IMMORT) && (ibtData->id_num != GET_IDNUM(ch))) if ((GET_LEVEL(ch) < LVL_IMMORT) && !is_ibt_logger(ibtData,ch))
continue; continue;
/* Set up the 'important' flag */ /* Set up the 'important' flag */

View file

@ -28,9 +28,9 @@ static int mag_materials(struct char_data *ch, IDXTYPE item0, IDXTYPE item1, IDX
static void perform_mag_groups(int level, struct char_data *ch, struct char_data *tch, int spellnum, int savetype); static void perform_mag_groups(int level, struct char_data *ch, struct char_data *tch, int spellnum, int savetype);
/* Negative apply_saving_throw[] values make saving throws better! So do /* Negative apply_saving_throw[] values make saving throws better! So do
* negative modifiers. Though people may be used to the reverse of that. * 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 * It's due to the code modifying the target saving throw instead of the
* random number of the character as in some other systems. */ * random number of the character as in some other systems. */
int mag_savingthrow(struct char_data *ch, int type, int modifier) int mag_savingthrow(struct char_data *ch, int type, int modifier)
{ {
@ -91,7 +91,7 @@ void affect_update(void)
* FALSE to send no in game messages from this function. * FALSE to send no in game messages from this function.
* @retval int TRUE if ch has all materials to cast the spell, FALSE if not. * @retval int TRUE if ch has all materials to cast the spell, FALSE if not.
*/ */
static int mag_materials(struct char_data *ch, IDXTYPE item0, static int mag_materials(struct char_data *ch, IDXTYPE item0,
IDXTYPE item1, IDXTYPE item2, int extract, int verbose) IDXTYPE item1, IDXTYPE item2, int extract, int verbose)
{ {
/* Begin Local variable definitions. */ /* Begin Local variable definitions. */
@ -106,33 +106,33 @@ static int mag_materials(struct char_data *ch, IDXTYPE item0,
/* Begin success checks. Checks must pass to signal a success. */ /* Begin success checks. Checks must pass to signal a success. */
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* Check for the objects in the players inventory. */ /* Check for the objects in the players inventory. */
for (tobj = ch->carrying; tobj; tobj = tobj->next_content) for (tobj = ch->carrying; tobj; tobj = tobj->next_content)
{ {
if ((item0 != NOTHING) && (GET_OBJ_VNUM(tobj) == item0)) if ((item0 != NOTHING) && (GET_OBJ_VNUM(tobj) == item0))
{ {
obj0 = tobj; obj0 = tobj;
item0 = NOTHING; item0 = NOTHING;
} }
else if ((item1 != NOTHING) && (GET_OBJ_VNUM(tobj) == item1)) else if ((item1 != NOTHING) && (GET_OBJ_VNUM(tobj) == item1))
{ {
obj1 = tobj; obj1 = tobj;
item1 = NOTHING; item1 = NOTHING;
} }
else if ((item2 != NOTHING) && (GET_OBJ_VNUM(tobj) == item2)) else if ((item2 != NOTHING) && (GET_OBJ_VNUM(tobj) == item2))
{ {
obj2 = tobj; obj2 = tobj;
item2 = NOTHING; item2 = NOTHING;
} }
} }
/* If we needed items, but didn't find all of them, then the spell is a /* If we needed items, but didn't find all of them, then the spell is a
* failure. */ * failure. */
if ((item0 != NOTHING) || (item1 != NOTHING) || (item2 != NOTHING)) if ((item0 != NOTHING) || (item1 != NOTHING) || (item2 != NOTHING))
{ {
/* Generic spell failure messages. */ /* Generic spell failure messages. */
if (verbose) if (verbose)
{ {
switch (rand_number(0, 2)) switch (rand_number(0, 2))
{ {
case 0: case 0:
send_to_char(ch, "A wart sprouts on your nose.\r\n"); send_to_char(ch, "A wart sprouts on your nose.\r\n");
@ -150,14 +150,14 @@ static int mag_materials(struct char_data *ch, IDXTYPE item0,
} }
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* End success checks. */ /* End success checks. */
/* From here on, ch has all required materials in their inventory and the /* From here on, ch has all required materials in their inventory and the
* material check will return a success. */ * material check will return a success. */
/* Begin Material Processing. */ /* Begin Material Processing. */
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* Extract (destroy) the materials, if so called for. */ /* Extract (destroy) the materials, if so called for. */
if (extract) if (extract)
{ {
if (obj0 != NULL) if (obj0 != NULL)
extract_obj(obj0); extract_obj(obj0);
@ -166,22 +166,22 @@ static int mag_materials(struct char_data *ch, IDXTYPE item0,
if (obj2 != NULL) if (obj2 != NULL)
extract_obj(obj2); extract_obj(obj2);
/* Generic success messages that signals extracted objects. */ /* Generic success messages that signals extracted objects. */
if (verbose) if (verbose)
{ {
send_to_char(ch, "A puff of smoke rises from your pack.\r\n"); send_to_char(ch, "A puff of smoke rises from your pack.\r\n");
act("A puff of smoke rises from $n's pack.", TRUE, ch, NULL, NULL, TO_ROOM); act("A puff of smoke rises from $n's pack.", TRUE, ch, NULL, NULL, TO_ROOM);
} }
} }
/* Don't extract the objects, but signal materials successfully found. */ /* Don't extract the objects, but signal materials successfully found. */
if(!extract && verbose) if(!extract && verbose)
{ {
send_to_char(ch, "Your pack rumbles.\r\n"); send_to_char(ch, "Your pack rumbles.\r\n");
act("Something rumbles in $n's pack.", TRUE, ch, NULL, NULL, TO_ROOM); act("Something rumbles in $n's pack.", TRUE, ch, NULL, NULL, TO_ROOM);
} }
/*------------------------------------------------------------------------*/ /*------------------------------------------------------------------------*/
/* End Material Processing. */ /* End Material Processing. */
/* Signal to calling function that the materials were successfully found /* Signal to calling function that the materials were successfully found
* and processed. */ * and processed. */
return (TRUE); return (TRUE);
@ -189,7 +189,7 @@ static int mag_materials(struct char_data *ch, IDXTYPE item0,
/* Every spell that does damage comes through here. This calculates the amount /* 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 * 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. */ * save and calls damage(). -1 = dead, otherwise the amount of damage done. */
int mag_damage(int level, struct char_data *ch, struct char_data *victim, int mag_damage(int level, struct char_data *ch, struct char_data *victim,
int spellnum, int savetype) int spellnum, int savetype)
@ -294,7 +294,7 @@ int mag_damage(int level, struct char_data *ch, struct char_data *victim,
} }
/* Every spell that does an affect comes through here. This determines the /* Every spell that does an affect comes through here. This determines the
* effect, whether it is added or replacement, whether it is legal or not, etc. * 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) */ * affect_join(vict, aff, add_dur, avg_dur, add_mod, avg_mod) */
#define MAX_SPELL_AFFECTS 5 /* change if more needed */ #define MAX_SPELL_AFFECTS 5 /* change if more needed */
@ -305,17 +305,15 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
struct affected_type af[MAX_SPELL_AFFECTS]; struct affected_type af[MAX_SPELL_AFFECTS];
bool accum_affect = FALSE, accum_duration = FALSE; bool accum_affect = FALSE, accum_duration = FALSE;
const char *to_vict = NULL, *to_room = NULL; const char *to_vict = NULL, *to_room = NULL;
int i; int i, j;
if (victim == NULL || ch == NULL) if (victim == NULL || ch == NULL)
return; return;
for (i = 0; i < MAX_SPELL_AFFECTS; i++) { for (i = 0; i < MAX_SPELL_AFFECTS; i++) {
new_affect(&(af[i]));
af[i].type = spellnum; af[i].type = spellnum;
af[i].bitvector = 0;
af[i].modifier = 0;
af[i].location = APPLY_NONE;
} }
switch (spellnum) { switch (spellnum) {
@ -361,12 +359,12 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
af[0].location = APPLY_HITROLL; af[0].location = APPLY_HITROLL;
af[0].modifier = -4; af[0].modifier = -4;
af[0].duration = 2; af[0].duration = 2;
af[0].bitvector = AFF_BLIND; SET_BIT_AR(af[0].bitvector, AFF_BLIND);
af[1].location = APPLY_AC; af[1].location = APPLY_AC;
af[1].modifier = 40; af[1].modifier = 40;
af[1].duration = 2; af[1].duration = 2;
af[1].bitvector = AFF_BLIND; SET_BIT_AR(af[1].bitvector, AFF_BLIND);
to_room = "$n seems to be blinded!"; to_room = "$n seems to be blinded!";
to_vict = "You have been blinded!"; to_vict = "You have been blinded!";
@ -381,12 +379,12 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
af[0].location = APPLY_HITROLL; af[0].location = APPLY_HITROLL;
af[0].duration = 1 + (GET_LEVEL(ch) / 2); af[0].duration = 1 + (GET_LEVEL(ch) / 2);
af[0].modifier = -1; af[0].modifier = -1;
af[0].bitvector = AFF_CURSE; SET_BIT_AR(af[0].bitvector, AFF_CURSE);
af[1].location = APPLY_DAMROLL; af[1].location = APPLY_DAMROLL;
af[1].duration = 1 + (GET_LEVEL(ch) / 2); af[1].duration = 1 + (GET_LEVEL(ch) / 2);
af[1].modifier = -1; af[1].modifier = -1;
af[1].bitvector = AFF_CURSE; SET_BIT_AR(af[1].bitvector, AFF_CURSE);
accum_duration = TRUE; accum_duration = TRUE;
accum_affect = TRUE; accum_affect = TRUE;
@ -396,28 +394,28 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
case SPELL_DETECT_ALIGN: case SPELL_DETECT_ALIGN:
af[0].duration = 12 + level; af[0].duration = 12 + level;
af[0].bitvector = AFF_DETECT_ALIGN; SET_BIT_AR(af[0].bitvector, AFF_DETECT_ALIGN);
accum_duration = TRUE; accum_duration = TRUE;
to_vict = "Your eyes tingle."; to_vict = "Your eyes tingle.";
break; break;
case SPELL_DETECT_INVIS: case SPELL_DETECT_INVIS:
af[0].duration = 12 + level; af[0].duration = 12 + level;
af[0].bitvector = AFF_DETECT_INVIS; SET_BIT_AR(af[0].bitvector, AFF_DETECT_INVIS);
accum_duration = TRUE; accum_duration = TRUE;
to_vict = "Your eyes tingle."; to_vict = "Your eyes tingle.";
break; break;
case SPELL_DETECT_MAGIC: case SPELL_DETECT_MAGIC:
af[0].duration = 12 + level; af[0].duration = 12 + level;
af[0].bitvector = AFF_DETECT_MAGIC; SET_BIT_AR(af[0].bitvector, AFF_DETECT_MAGIC);
accum_duration = TRUE; accum_duration = TRUE;
to_vict = "Your eyes tingle."; to_vict = "Your eyes tingle.";
break; break;
case SPELL_INFRAVISION: case SPELL_INFRAVISION:
af[0].duration = 12 + level; af[0].duration = 12 + level;
af[0].bitvector = AFF_INFRAVISION; SET_BIT_AR(af[0].bitvector, AFF_INFRAVISION);
accum_duration = TRUE; accum_duration = TRUE;
to_vict = "Your eyes glow red."; to_vict = "Your eyes glow red.";
to_room = "$n's eyes glow red."; to_room = "$n's eyes glow red.";
@ -430,7 +428,7 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
af[0].duration = 12 + (GET_LEVEL(ch) / 4); af[0].duration = 12 + (GET_LEVEL(ch) / 4);
af[0].modifier = -40; af[0].modifier = -40;
af[0].location = APPLY_AC; af[0].location = APPLY_AC;
af[0].bitvector = AFF_INVISIBLE; SET_BIT_AR(af[0].bitvector, AFF_INVISIBLE);
accum_duration = TRUE; accum_duration = TRUE;
to_vict = "You vanish."; to_vict = "You vanish.";
to_room = "$n slowly fades out of existence."; to_room = "$n slowly fades out of existence.";
@ -445,21 +443,21 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
af[0].location = APPLY_STR; af[0].location = APPLY_STR;
af[0].duration = GET_LEVEL(ch); af[0].duration = GET_LEVEL(ch);
af[0].modifier = -2; af[0].modifier = -2;
af[0].bitvector = AFF_POISON; SET_BIT_AR(af[0].bitvector, AFF_POISON);
to_vict = "You feel very sick."; to_vict = "You feel very sick.";
to_room = "$n gets violently ill!"; to_room = "$n gets violently ill!";
break; break;
case SPELL_PROT_FROM_EVIL: case SPELL_PROT_FROM_EVIL:
af[0].duration = 24; af[0].duration = 24;
af[0].bitvector = AFF_PROTECT_EVIL; SET_BIT_AR(af[0].bitvector, AFF_PROTECT_EVIL);
accum_duration = TRUE; accum_duration = TRUE;
to_vict = "You feel invulnerable!"; to_vict = "You feel invulnerable!";
break; break;
case SPELL_SANCTUARY: case SPELL_SANCTUARY:
af[0].duration = 4; af[0].duration = 4;
af[0].bitvector = AFF_SANCTUARY; SET_BIT_AR(af[0].bitvector, AFF_SANCTUARY);
accum_duration = TRUE; accum_duration = TRUE;
to_vict = "A white aura momentarily surrounds you."; to_vict = "A white aura momentarily surrounds you.";
@ -475,7 +473,7 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
return; return;
af[0].duration = 4 + (GET_LEVEL(ch) / 4); af[0].duration = 4 + (GET_LEVEL(ch) / 4);
af[0].bitvector = AFF_SLEEP; SET_BIT_AR(af[0].bitvector, AFF_SLEEP);
if (GET_POS(victim) > POS_SLEEPING) { if (GET_POS(victim) > POS_SLEEPING) {
send_to_char(victim, "You feel very sleepy... Zzzz......\r\n"); send_to_char(victim, "You feel very sleepy... Zzzz......\r\n");
@ -499,29 +497,33 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
case SPELL_SENSE_LIFE: case SPELL_SENSE_LIFE:
to_vict = "Your feel your awareness improve."; to_vict = "Your feel your awareness improve.";
af[0].duration = GET_LEVEL(ch); af[0].duration = GET_LEVEL(ch);
af[0].bitvector = AFF_SENSE_LIFE; SET_BIT_AR(af[0].bitvector, AFF_SENSE_LIFE);
accum_duration = TRUE; accum_duration = TRUE;
break; break;
case SPELL_WATERWALK: case SPELL_WATERWALK:
af[0].duration = 24; af[0].duration = 24;
af[0].bitvector = AFF_WATERWALK; SET_BIT_AR(af[0].bitvector, AFF_WATERWALK);
accum_duration = TRUE; accum_duration = TRUE;
to_vict = "You feel webbing between your toes."; to_vict = "You feel webbing between your toes.";
break; break;
} }
/* If this is a mob that has this affect set in its mob file, do not perform /* If this is a mob that has this affect set in its mob file, do not perform
* the affect. This prevents people from un-sancting mobs by sancting them * the affect. This prevents people from un-sancting mobs by sancting them
* and waiting for it to fade, for example. */ * and waiting for it to fade, for example. */
if (IS_NPC(victim) && !affected_by_spell(victim, spellnum)) if (IS_NPC(victim) && !affected_by_spell(victim, spellnum)) {
for (i = 0; i < MAX_SPELL_AFFECTS; i++) for (i = 0; i < MAX_SPELL_AFFECTS; i++) {
if (AFF_FLAGGED(victim, af[i].bitvector) && (af[i].bitvector > 0)) { for (j=0; j<NUM_AFF_FLAGS; j++) {
send_to_char(ch, "%s", CONFIG_NOEFFECT); if (IS_SET_AR(af[i].bitvector, j) && AFF_FLAGGED(victim, j)) {
return; send_to_char(ch, "%s", CONFIG_NOEFFECT);
return;
}
} }
}
}
/* If the victim is already affected by this spell, and the spell does not /* If the victim is already affected by this spell, and the spell does not
* have an accumulative effect, then fail the spell. */ * have an accumulative effect, then fail the spell. */
if (affected_by_spell(victim,spellnum) && !(accum_duration||accum_affect)) { if (affected_by_spell(victim,spellnum) && !(accum_duration||accum_affect)) {
send_to_char(ch, "%s", CONFIG_NOEFFECT); send_to_char(ch, "%s", CONFIG_NOEFFECT);
@ -529,7 +531,9 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
} }
for (i = 0; i < MAX_SPELL_AFFECTS; i++) for (i = 0; i < MAX_SPELL_AFFECTS; i++)
if (af[i].bitvector || (af[i].location != APPLY_NONE)) if (af[i].bitvector[0] || af[i].bitvector[1] ||
af[i].bitvector[2] || af[i].bitvector[3] ||
(af[i].location != APPLY_NONE))
affect_join(victim, af+i, accum_duration, FALSE, accum_affect, FALSE); affect_join(victim, af+i, accum_duration, FALSE, accum_affect, FALSE);
if (to_vict != NULL) if (to_vict != NULL)
@ -538,7 +542,7 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
act(to_room, TRUE, victim, 0, ch, TO_ROOM); act(to_room, TRUE, victim, 0, ch, TO_ROOM);
} }
/* This function is used to provide services to mag_groups. This function is /* This function is used to provide services to mag_groups. This function is
* the one you should change to add new group spells. */ * the one you should change to add new group spells. */
static void perform_mag_groups(int level, struct char_data *ch, static void perform_mag_groups(int level, struct char_data *ch,
struct char_data *tch, int spellnum, int savetype) struct char_data *tch, int spellnum, int savetype)
@ -557,8 +561,8 @@ static void perform_mag_groups(int level, struct char_data *ch,
} }
/* Every spell that affects the group should run through here 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 * 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 * 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. * add new group spells, you shouldn't have to change anything in mag_groups.
* Just add a new case to perform_mag_groups. */ * Just add a new case to perform_mag_groups. */
void mag_groups(int level, struct char_data *ch, int spellnum, int savetype) void mag_groups(int level, struct char_data *ch, int spellnum, int savetype)
@ -592,7 +596,7 @@ void mag_groups(int level, struct char_data *ch, int spellnum, int savetype)
perform_mag_groups(level, ch, ch, spellnum, savetype); perform_mag_groups(level, ch, ch, spellnum, savetype);
} }
/* Mass spells affect every creature in the room except the caster. No spells /* Mass spells affect every creature in the room except the caster. No spells
* of this class currently implemented. */ * of this class currently implemented. */
void mag_masses(int level, struct char_data *ch, int spellnum, int savetype) void mag_masses(int level, struct char_data *ch, int spellnum, int savetype)
{ {
@ -610,7 +614,7 @@ 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 /* Every spell that affects an area (room) runs through here. These are
* generally offensive spells. This calls mag_damage to do the actual damage. * 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 * 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. */ * them to work. Area spells have limited targets within the room. */
void mag_areas(int level, struct char_data *ch, int spellnum, int savetype) void mag_areas(int level, struct char_data *ch, int spellnum, int savetype)
{ {
@ -620,7 +624,7 @@ void mag_areas(int level, struct char_data *ch, int spellnum, int savetype)
if (ch == NULL) if (ch == NULL)
return; return;
/* to add spells just add the message here plus an entry in mag_damage for /* to add spells just add the message here plus an entry in mag_damage for
* the damaging part of the spell. */ * the damaging part of the spell. */
switch (spellnum) { switch (spellnum) {
case SPELL_EARTHQUAKE: case SPELL_EARTHQUAKE:
@ -715,10 +719,10 @@ void mag_summons(int level, struct char_data *ch, struct obj_data *obj,
msg = 10; msg = 10;
fmsg = rand_number(2, 6); /* Random fail message. */ fmsg = rand_number(2, 6); /* Random fail message. */
mob_num = MOB_CLONE; mob_num = MOB_CLONE;
/* /*
* We have designated the clone spell as the example for how to use the * We have designated the clone spell as the example for how to use the
* mag_materials function. * mag_materials function.
* In stock tbaMUD it checks to see if the character has item with * In stock tbaMUD it checks to see if the character has item with
* vnum 161 which is a set of sacrificial entrails. If we have the entrails * vnum 161 which is a set of sacrificial entrails. If we have the entrails
* the spell will succeed, and if not, the spell will fail 102% of the time * the spell will succeed, and if not, the spell will fail 102% of the time
* (prevents random success... see below). * (prevents random success... see below).
@ -830,7 +834,7 @@ void mag_unaffects(int level, struct char_data *ch, struct char_data *victim,
switch (spellnum) { switch (spellnum) {
case SPELL_HEAL: case SPELL_HEAL:
/* Heal also restores health, so don't give the "no effect" message if the /* Heal also restores health, so don't give the "no effect" message if the
* target isn't afflicted by the 'blindness' spell. */ * target isn't afflicted by the 'blindness' spell. */
msg_not_affected = FALSE; msg_not_affected = FALSE;
/* fall-through */ /* fall-through */

View file

@ -86,7 +86,7 @@ int objsave_save_obj_record(struct obj_data *obj, FILE *fp, int locate)
GET_OBJ_VAL(obj, 2), GET_OBJ_VAL(obj, 2),
GET_OBJ_VAL(obj, 3) GET_OBJ_VAL(obj, 3)
); );
if (GET_OBJ_EXTRA(obj) != GET_OBJ_EXTRA(temp)) if (GET_OBJ_EXTRA(obj) != GET_OBJ_EXTRA(temp))
fprintf(fp, "Flag: %d %d %d %d\n", GET_OBJ_EXTRA(obj)[0], GET_OBJ_EXTRA(obj)[1], GET_OBJ_EXTRA(obj)[2], GET_OBJ_EXTRA(obj)[3]); fprintf(fp, "Flag: %d %d %d %d\n", GET_OBJ_EXTRA(obj)[0], GET_OBJ_EXTRA(obj)[1], GET_OBJ_EXTRA(obj)[2], GET_OBJ_EXTRA(obj)[3]);
#define TEST_OBJS(obj1, obj2, field) ((!obj1->field || !obj2->field || \ #define TEST_OBJS(obj1, obj2, field) ((!obj1->field || !obj2->field || \
@ -115,7 +115,7 @@ int objsave_save_obj_record(struct obj_data *obj, FILE *fp, int locate)
fprintf(fp, "Cost: %d\n", GET_OBJ_COST(obj)); fprintf(fp, "Cost: %d\n", GET_OBJ_COST(obj));
if (TEST_OBJN(cost_per_day)) if (TEST_OBJN(cost_per_day))
fprintf(fp, "Rent: %d\n", GET_OBJ_RENT(obj)); fprintf(fp, "Rent: %d\n", GET_OBJ_RENT(obj));
if (TEST_OBJN(bitvector)) if (TEST_OBJN(bitvector))
fprintf(fp, "Perm: %d %d %d %d\n", GET_OBJ_PERM(obj)[0], GET_OBJ_PERM(obj)[1], GET_OBJ_PERM(obj)[2], GET_OBJ_PERM(obj)[3]); fprintf(fp, "Perm: %d %d %d %d\n", GET_OBJ_PERM(obj)[0], GET_OBJ_PERM(obj)[1], GET_OBJ_PERM(obj)[2], GET_OBJ_PERM(obj)[3]);
if (TEST_OBJN(wear_flags)) if (TEST_OBJN(wear_flags))
fprintf(fp, "Wear: %d %d %d %d\n", GET_OBJ_WEAR(obj)[0], GET_OBJ_WEAR(obj)[1], GET_OBJ_WEAR(obj)[2], GET_OBJ_WEAR(obj)[3]); fprintf(fp, "Wear: %d %d %d %d\n", GET_OBJ_WEAR(obj)[0], GET_OBJ_WEAR(obj)[1], GET_OBJ_WEAR(obj)[2], GET_OBJ_WEAR(obj)[3]);
@ -241,7 +241,7 @@ static void auto_equip(struct char_data *ch, struct obj_data *obj, int location)
if (location > 0) { /* Wearable. */ if (location > 0) { /* Wearable. */
if (!GET_EQ(ch,j)) { if (!GET_EQ(ch,j)) {
/* Check the characters's alignment to prevent them from being zapped /* Check the characters's alignment to prevent them from being zapped
* through the auto-equipping. */ * through the auto-equipping. */
if (invalid_align(ch, obj) || invalid_class(ch, obj)) if (invalid_align(ch, obj) || invalid_class(ch, obj))
location = LOC_INVENTORY; location = LOC_INVENTORY;
@ -482,7 +482,7 @@ static void Crash_restore_weight(struct obj_data *obj)
} }
} }
/* Get !RENT items from equipment to inventory and extract !RENT out of worn /* Get !RENT items from equipment to inventory and extract !RENT out of worn
* containers. */ * containers. */
static void Crash_extract_norent_eq(struct char_data *ch) static void Crash_extract_norent_eq(struct char_data *ch)
{ {
@ -975,7 +975,7 @@ void Crash_save_all(void)
} }
/* Parses the object records stored in fl, and returns the first object in a /* Parses the object records stored in fl, and returns the first object in a
* linked list, which also handles location if worn. This list can then be * linked list, which also handles location if worn. This list can then be
* handled by house code, listrent code, autoeq code, etc. */ * handled by house code, listrent code, autoeq code, etc. */
obj_save_data *objsave_parse_objects(FILE *fl) obj_save_data *objsave_parse_objects(FILE *fl)
{ {
@ -1169,7 +1169,8 @@ static int Crash_load_objs(struct char_data *ch) {
char line[READ_SIZE]; char line[READ_SIZE];
char buf[MAX_STRING_LENGTH]; char buf[MAX_STRING_LENGTH];
char str[64]; char str[64];
int i, num_of_days, orig_rent_code, cost, num_objs=0; int i, num_of_days, orig_rent_code, num_objs=0;
unsigned long cost;
struct obj_data *cont_row[MAX_BAG_ROWS]; struct obj_data *cont_row[MAX_BAG_ROWS];
int rentcode,timed,netcost,gold,account,nitems; int rentcode,timed,netcost,gold,account,nitems;
obj_save_data *loaded, *current; obj_save_data *loaded, *current;
@ -1198,8 +1199,8 @@ static int Crash_load_objs(struct char_data *ch) {
if (rentcode == RENT_RENTED || rentcode == RENT_TIMEDOUT) { if (rentcode == RENT_RENTED || rentcode == RENT_TIMEDOUT) {
sprintf(str, "%d", SECS_PER_REAL_DAY); sprintf(str, "%d", SECS_PER_REAL_DAY);
num_of_days = (int)((float) (time(0) - timed) / (float)atoi(str)); num_of_days = (int)((float) (time(0) - timed) / (float)atoi(str));
cost = (int) (netcost * num_of_days); cost = (unsigned int) (netcost * num_of_days);
if (cost > GET_GOLD(ch) + GET_BANK_GOLD(ch)) { if (cost > (unsigned int)GET_GOLD(ch) + (unsigned int)GET_BANK_GOLD(ch)) {
fclose(fl); fclose(fl);
mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE, mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE,
"%s entering game, rented equipment lost (no $).", GET_NAME(ch)); "%s entering game, rented equipment lost (no $).", GET_NAME(ch));
@ -1271,15 +1272,15 @@ static int handle_obj(struct obj_data *temp, struct char_data *ch, int locate, s
auto_equip(ch, temp, locate); auto_equip(ch, temp, locate);
/* What to do with a new loaded item: /* What to do with a new loaded item:
* If there's a list with <locate> less than 1 below this: (equipped items * If there's a list with <locate> less than 1 below this: (equipped items
* are assumed to have <locate>==0 here) then its container has disappeared * are assumed to have <locate>==0 here) then its container has disappeared
* from the file *gasp* -> put all the list back to ch's inventory if * from the file *gasp* -> put all the list back to ch's inventory if
* there's a list of contents with <locate> 1 below this: check if it's a * there's a list of contents with <locate> 1 below this: check if it's a
* container - if so: get it from ch, fill it, and give it back to ch (this * container - if so: get it from ch, fill it, and give it back to ch (this
* way the container has its correct weight before modifying ch) - if not: * way the container has its correct weight before modifying ch) - if not:
* the container is missing -> put all the list to ch's inventory. For items * the container is missing -> put all the list to ch's inventory. For items
* with negative <locate>: If there's already a list of contents with the * with negative <locate>: If there's already a list of contents with the
* same <locate> put obj to it if not, start a new list. Since <locate> for * same <locate> put obj to it if not, start a new list. Since <locate> for
* contents is < 0 the list indices are switched to non-negative. */ * contents is < 0 the list indices are switched to non-negative. */
if (locate > 0) { /* item equipped */ if (locate > 0) { /* item equipped */

View file

@ -504,7 +504,7 @@ void save_char(struct char_data * ch)
{ {
FILE *fl; FILE *fl;
char filename[40], buf[MAX_STRING_LENGTH], bits[127], bits2[127], bits3[127], bits4[127]; char filename[40], buf[MAX_STRING_LENGTH], bits[127], bits2[127], bits3[127], bits4[127];
int i, id, save_index = FALSE; int i, j, id, save_index = FALSE;
struct affected_type *aff, tmp_aff[MAX_AFFECT]; struct affected_type *aff, tmp_aff[MAX_AFFECT];
struct obj_data *char_eq[NUM_WEARS]; struct obj_data *char_eq[NUM_WEARS];
trig_data *t; trig_data *t;
@ -552,14 +552,12 @@ void save_char(struct char_data * ch)
for (aff = ch->affected, i = 0; i < MAX_AFFECT; i++) { for (aff = ch->affected, i = 0; i < MAX_AFFECT; i++) {
if (aff) { if (aff) {
tmp_aff[i] = *aff; tmp_aff[i] = *aff;
for (j=0; j<AF_ARRAY_MAX; j++)
tmp_aff[i].bitvector[j] = aff->bitvector[j];
tmp_aff[i].next = 0; tmp_aff[i].next = 0;
aff = aff->next; aff = aff->next;
} else { } else {
tmp_aff[i].type = 0; /* Zero signifies not used */ new_affect(&(tmp_aff[i]));
tmp_aff[i].duration = 0;
tmp_aff[i].modifier = 0;
tmp_aff[i].location = 0;
tmp_aff[i].bitvector = 0;
tmp_aff[i].next = 0; tmp_aff[i].next = 0;
} }
} }
@ -695,10 +693,10 @@ void save_char(struct char_data * ch)
for (i = 0; i < MAX_AFFECT; i++) { for (i = 0; i < MAX_AFFECT; i++) {
aff = &tmp_aff[i]; aff = &tmp_aff[i];
if (aff->type) if (aff->type)
fprintf(fl, "%d %d %d %d %d\n", aff->type, aff->duration, fprintf(fl, "%d %d %d %d %d %d %d %d\n", aff->type, aff->duration,
aff->modifier, aff->location, (int)aff->bitvector); aff->modifier, aff->location, aff->bitvector[0], aff->bitvector[1], aff->bitvector[2], aff->bitvector[3]);
} }
fprintf(fl, "0 0 0 0 0\n"); fprintf(fl, "0 0 0 0 0 0 0 0\n");
} }
write_aliases_ascii(fl, ch); write_aliases_ascii(fl, ch);
@ -835,22 +833,35 @@ void clean_pfiles(void)
* entries of the players that were just deleted. */ * entries of the players that were just deleted. */
} }
/* load_affects function now handles both 32-bit and
128-bit affect bitvectors for backward compatibility */
static void load_affects(FILE *fl, struct char_data *ch) static void load_affects(FILE *fl, struct char_data *ch)
{ {
int num = 0, num2 = 0, num3 = 0, num4 = 0, num5 = 0, i; int num = 0, num2 = 0, num3 = 0, num4 = 0, num5 = 0, num6 = 0, num7 = 0, num8 = 0, i, n_vars;
char line[MAX_INPUT_LENGTH + 1]; char line[MAX_INPUT_LENGTH + 1];
struct affected_type af; struct affected_type af;
i = 0; i = 0;
do { do {
new_affect(&af);
get_line(fl, line); get_line(fl, line);
sscanf(line, "%d %d %d %d %d", &num, &num2, &num3, &num4, &num5); n_vars = sscanf(line, "%d %d %d %d %d %d %d %d", &num, &num2, &num3, &num4, &num5, &num6, &num7, &num8);
if (num > 0) { if (num > 0) {
af.type = num; af.type = num;
af.duration = num2; af.duration = num2;
af.modifier = num3; af.modifier = num3;
af.location = num4; af.location = num4;
af.bitvector = num5; if (n_vars == 8) { /* New 128-bit version */
af.bitvector[0] = num5;
af.bitvector[1] = num6;
af.bitvector[2] = num7;
af.bitvector[3] = num8;
} else if (n_vars == 5) { /* Old 32-bit conversion version */
if (num5 > 0 && num5 <= NUM_AFF_FLAGS) /* Ignore invalid values */
SET_BIT_AR(af.bitvector, num5);
} else {
log("SYSERR: Invalid affects in pfile (%s), expecting 5 or 8 values", GET_NAME(ch));
}
affect_to_char(ch, &af); affect_to_char(ch, &af);
i++; i++;
} }

View file

@ -277,15 +277,14 @@ ASPELL(spell_charm)
add_follower(victim, ch); add_follower(victim, ch);
new_affect(&af);
af.type = SPELL_CHARM; af.type = SPELL_CHARM;
af.duration = 24 * 2; af.duration = 24 * 2;
if (GET_CHA(ch)) if (GET_CHA(ch))
af.duration *= GET_CHA(ch); af.duration *= GET_CHA(ch);
if (GET_INT(victim)) if (GET_INT(victim))
af.duration /= GET_INT(victim); af.duration /= GET_INT(victim);
af.modifier = 0; SET_BIT_AR(af.bitvector, AFF_CHARM);
af.location = 0;
af.bitvector = AFF_CHARM;
affect_to_char(victim, &af); affect_to_char(victim, &af);
act("Isn't $n just such a nice fellow?", FALSE, ch, 0, victim, TO_VICT); act("Isn't $n just such a nice fellow?", FALSE, ch, 0, victim, TO_VICT);

View file

@ -219,7 +219,7 @@
#define MOB_NOKILL 18 /**< Mob can't be attacked */ #define MOB_NOKILL 18 /**< Mob can't be attacked */
#define MOB_NOTDEADYET 19 /**< (R) Mob being extracted */ #define MOB_NOTDEADYET 19 /**< (R) Mob being extracted */
#define NUM_MOB_FLAGS 19 #define NUM_MOB_FLAGS 19
/* Preference flags: used by char_data.player_specials.pref */ /* Preference flags: used by char_data.player_specials.pref */
#define PRF_BRIEF 0 /**< Room descs won't normally be shown */ #define PRF_BRIEF 0 /**< Room descs won't normally be shown */
@ -576,7 +576,6 @@
/** Controls when to save the current ingame MUD time to disk. /** Controls when to save the current ingame MUD time to disk.
* This should be set >= SECS_PER_MUD_HOUR */ * This should be set >= SECS_PER_MUD_HOUR */
#define PULSE_TIMESAVE (30 * 60 RL_SEC) #define PULSE_TIMESAVE (30 * 60 RL_SEC)
/* Variables for the output buffering system */ /* Variables for the output buffering system */
#define MAX_SOCK_BUF (24 * 1024) /**< Size of kernel's sock buf */ #define MAX_SOCK_BUF (24 * 1024) /**< Size of kernel's sock buf */
#define MAX_PROMPT_LENGTH 96 /**< Max length of prompt */ #define MAX_PROMPT_LENGTH 96 /**< Max length of prompt */
@ -973,7 +972,7 @@ struct affected_type
sh_int duration; /**< For how long its effects will last */ sh_int duration; /**< For how long its effects will last */
sbyte modifier; /**< Added/subtracted to/from apropriate ability */ sbyte modifier; /**< Added/subtracted to/from apropriate ability */
byte location; /**< Tells which ability to change(APPLY_XXX). */ byte location; /**< Tells which ability to change(APPLY_XXX). */
long /*bitvector_t*/bitvector; /**< Tells which bits to set (AFF_XXX). */ int bitvector[AF_ARRAY_MAX]; /**< Tells which bits to set (AFF_XXX). */
struct affected_type *next; /**< The next affect in the list of affects. */ struct affected_type *next; /**< The next affect in the list of affects. */
}; };

View file

@ -1459,3 +1459,15 @@ char *strpaste(char *str1, char *str2, char *joiner)
*rp = '\0'; *rp = '\0';
return ret; return ret;
} }
/* Create a blank affect struct */
void new_affect(struct affected_type *af)
{
int i;
af->type = 0;
af->duration = 0;
af->modifier = 0;
af->location = APPLY_NONE;
for (i=0; i<AF_ARRAY_MAX; i++) af->bitvector[i]=0;
}

View file

@ -66,6 +66,7 @@ int file_numlines( FILE *file );
IDXTYPE atoidx( const char *str_to_conv ); IDXTYPE atoidx( const char *str_to_conv );
char *strfrmt(char *str, int w, int h, int justify, int hpad, int vpad); char *strfrmt(char *str, int w, int h, int justify, int hpad, int vpad);
char *strpaste(char *str1, char *str2, char *joiner); char *strpaste(char *str1, char *str2, char *joiner);
void new_affect(struct affected_type *af);
/* Public functions made available form weather.c */ /* Public functions made available form weather.c */
void weather_and_time(int mode); void weather_and_time(int mode);