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

@ -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)

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

@ -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,13 +497,13 @@ 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;
@ -514,12 +512,16 @@ void mag_affects(int level, struct char_data *ch, struct char_data *victim,
/* 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. */
@ -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)

View file

@ -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));

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

@ -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);