act-files formatted

This commit is contained in:
welcor
2024-10-01 00:09:30 +02:00
parent 5c44f0575e
commit fdb6ff3771
12 changed files with 3855 additions and 3757 deletions

View File

@@ -40,7 +40,7 @@ IncludeCategories:
Priority: 3 Priority: 3
IncludeIsMainRegex: '([-_](test|unittest))?$' IncludeIsMainRegex: '([-_](test|unittest))?$'
IndentCaseBlocks: true IndentCaseBlocks: true
IndentWidth: 4 IndentWidth: 2
InsertNewlineAtEOF: true InsertNewlineAtEOF: true
MacroBlockBegin: '' MacroBlockBegin: ''
MacroBlockEnd: '' MacroBlockEnd: ''
@@ -51,5 +51,5 @@ SpacesInAngles: false
SpacesInConditionalStatement: false SpacesInConditionalStatement: false
SpacesInCStyleCastParentheses: false SpacesInCStyleCastParentheses: false
SpacesInParentheses: false SpacesInParentheses: false
TabWidth: 4 TabWidth: 2
... ...

View File

@@ -22,15 +22,15 @@
#include "act.h" #include "act.h"
#include "modify.h" #include "modify.h"
static bool legal_communication(char * arg); static bool legal_communication(char *arg);
static bool legal_communication(char * arg) static bool legal_communication(char *arg)
{ {
while (*arg) { while (*arg) {
if (*arg == '@') { if (*arg == '@') {
arg++; arg++;
if (*arg == '(' || *arg == ')' || *arg == '<' || *arg == '>') if (*arg == '(' || *arg == ')' || *arg == '<' || *arg == '>')
return FALSE; return FALSE;
} }
arg++; arg++;
} }
@@ -46,7 +46,7 @@ ACMD(do_say)
else { else {
char buf[MAX_INPUT_LENGTH + 14], *msg; char buf[MAX_INPUT_LENGTH + 14], *msg;
struct char_data *vict; struct char_data *vict;
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument)) if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
parse_at(argument); parse_at(argument);
@@ -74,7 +74,7 @@ ACMD(do_say)
ACMD(do_gsay) ACMD(do_gsay)
{ {
skip_spaces(&argument); skip_spaces(&argument);
if (!GROUP(ch)) { if (!GROUP(ch)) {
send_to_char(ch, "But you are not a member of a group!\r\n"); send_to_char(ch, "But you are not a member of a group!\r\n");
return; return;
@@ -82,17 +82,18 @@ ACMD(do_gsay)
if (!*argument) if (!*argument)
send_to_char(ch, "Yes, but WHAT do you want to group-say?\r\n"); send_to_char(ch, "Yes, but WHAT do you want to group-say?\r\n");
else { else {
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument)) if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
parse_at(argument); parse_at(argument);
send_to_group(ch, ch->group, "%s%s%s says, '%s'%s\r\n", CCGRN(ch, C_NRM), CCGRN(ch, C_NRM), GET_NAME(ch), argument, CCNRM(ch, C_NRM)); send_to_group(ch, ch->group, "%s%s%s says, '%s'%s\r\n", CCGRN(ch, C_NRM), CCGRN(ch, C_NRM), GET_NAME(ch),
argument, CCNRM(ch, C_NRM));
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT)) if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
send_to_char(ch, "%s", CONFIG_OK); send_to_char(ch, "%s", CONFIG_OK);
else else
send_to_char(ch, "%sYou group-say, '%s'%s\r\n", CCGRN(ch, C_NRM), argument, CCNRM(ch, C_NRM)); send_to_char(ch, "%sYou group-say, '%s'%s\r\n", CCGRN(ch, C_NRM), argument, CCNRM(ch, C_NRM));
} }
} }
static void perform_tell(struct char_data *ch, struct char_data *vict, char *arg) static void perform_tell(struct char_data *ch, struct char_data *vict, char *arg)
@@ -107,7 +108,7 @@ static void perform_tell(struct char_data *ch, struct char_data *vict, char *arg
send_to_char(ch, "%s", CONFIG_OK); send_to_char(ch, "%s", CONFIG_OK);
else { else {
snprintf(buf, sizeof(buf), "%sYou tell $N, '%s'%s", CCRED(ch, C_NRM), arg, CCNRM(ch, C_NRM)); snprintf(buf, sizeof(buf), "%sYou tell $N, '%s'%s", CCRED(ch, C_NRM), arg, CCNRM(ch, C_NRM));
msg = act(buf, FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); msg = act(buf, FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
add_history(ch, msg, HIST_TELL); add_history(ch, msg, HIST_TELL);
} }
@@ -127,11 +128,12 @@ static int is_tell_ok(struct char_data *ch, struct char_data *vict)
send_to_char(ch, "You can't tell other people while you have notell on.\r\n"); send_to_char(ch, "You can't tell other people while you have notell on.\r\n");
else if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_SOUNDPROOF) && (GET_LEVEL(ch) < LVL_GOD)) else if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_SOUNDPROOF) && (GET_LEVEL(ch) < LVL_GOD))
send_to_char(ch, "The walls seem to absorb your words.\r\n"); send_to_char(ch, "The walls seem to absorb your words.\r\n");
else if (!IS_NPC(vict) && !vict->desc) /* linkless */ else if (!IS_NPC(vict) && !vict->desc) /* linkless */
act("$E's linkless at the moment.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); act("$E's linkless at the moment.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
else if (PLR_FLAGGED(vict, PLR_WRITING)) else if (PLR_FLAGGED(vict, PLR_WRITING))
act("$E's writing a message right now; try again later.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); act("$E's writing a message right now; try again later.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
else if ((!IS_NPC(vict) && PRF_FLAGGED(vict, PRF_NOTELL)) || (ROOM_FLAGGED(IN_ROOM(vict), ROOM_SOUNDPROOF) && (GET_LEVEL(ch) < LVL_GOD))) else if ((!IS_NPC(vict) && PRF_FLAGGED(vict, PRF_NOTELL)) || (
ROOM_FLAGGED(IN_ROOM(vict), ROOM_SOUNDPROOF) && (GET_LEVEL(ch) < LVL_GOD)))
act("$E can't hear you.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); act("$E can't hear you.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
else else
return (TRUE); return (TRUE);
@@ -144,7 +146,7 @@ static int is_tell_ok(struct char_data *ch, struct char_data *vict)
ACMD(do_tell) ACMD(do_tell)
{ {
struct char_data *vict = NULL; struct char_data *vict = NULL;
char buf[MAX_INPUT_LENGTH + 25], buf2[MAX_INPUT_LENGTH]; // +25 to make room for constants char buf[MAX_INPUT_LENGTH + 25], buf2[MAX_INPUT_LENGTH]; // +25 to make room for constants
half_chop(argument, buf, buf2); half_chop(argument, buf, buf2);
@@ -168,7 +170,7 @@ ACMD(do_tell)
} }
/* Only a-z and +/- allowed. */ /* Only a-z and +/- allowed. */
for (p = buf2, q = word; *p ; p++) for (p = buf2, q = word; *p; p++)
if ((LOWER(*p) <= 'z' && LOWER(*p) >= 'a') || (*p == '+') || (*p == '-')) if ((LOWER(*p) <= 'z' && LOWER(*p) >= 'a') || (*p == '+') || (*p == '-'))
*q++ = *p; *q++ = *p;
@@ -178,7 +180,7 @@ ACMD(do_tell)
send_to_char(ch, "Sorry, only letters and +/- are allowed characters.\r\n"); send_to_char(ch, "Sorry, only letters and +/- are allowed characters.\r\n");
return; return;
} }
snprintf(buf, sizeof(buf), "../bin/webster %s %d &", word, (int) getpid()); snprintf(buf, sizeof(buf), "../bin/webster %s %d &", word, (int)getpid());
last_webster_teller = GET_IDNUM(ch); last_webster_teller = GET_IDNUM(ch);
send_to_char(ch, "You look up '%s' in Merriam-Webster.\r\n", word); send_to_char(ch, "You look up '%s' in Merriam-Webster.\r\n", word);
#endif /* platform specific part */ #endif /* platform specific part */
@@ -190,7 +192,7 @@ ACMD(do_tell)
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument)) if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
parse_at(buf2); parse_at(buf2);
perform_tell(ch, vict, buf2); perform_tell(ch, vict, buf2);
} }
} }
ACMD(do_reply) ACMD(do_reply)
@@ -210,8 +212,8 @@ ACMD(do_reply)
/* Make sure the person you're replying to is still playing by searching /* Make sure the person you're replying to is still playing by searching
* for them. Note, now last tell is stored as player IDnum instead of * for them. Note, now last tell is stored as player IDnum instead of
* a pointer, which is much better because it's safer, plus will still * a pointer, which is much better because it's safer, plus will still
* work if someone logs out and back in again. A descriptor list based * work if someone logs out and back in again. A descriptor list based
* search would be faster although we could not find link dead people. * search would be faster although we could not find link dead people.
* Not that they can hear tells anyway. :) -gg 2/24/98 */ * Not that they can hear tells anyway. :) -gg 2/24/98 */
while (tch && (IS_NPC(tch) || GET_IDNUM(tch) != GET_LAST_TELL(ch))) while (tch && (IS_NPC(tch) || GET_IDNUM(tch) != GET_LAST_TELL(ch)))
tch = tch->next; tch = tch->next;
@@ -222,7 +224,7 @@ ACMD(do_reply)
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument)) if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
parse_at(argument); parse_at(argument);
perform_tell(ch, tch, argument); perform_tell(ch, tch, argument);
} }
} }
} }
@@ -269,7 +271,7 @@ ACMD(do_spec_comm)
snprintf(buf1, sizeof(buf1), "$n %s you, '%s'", action_plur, buf2); snprintf(buf1, sizeof(buf1), "$n %s you, '%s'", action_plur, buf2);
act(buf1, FALSE, ch, 0, vict, TO_VICT); act(buf1, FALSE, ch, 0, vict, TO_VICT);
if ((!IS_NPC(ch)) && (PRF_FLAGGED(ch, PRF_NOREPEAT))) if ((!IS_NPC(ch)) && (PRF_FLAGGED(ch, PRF_NOREPEAT)))
send_to_char(ch, "%s", CONFIG_OK); send_to_char(ch, "%s", CONFIG_OK);
else else
send_to_char(ch, "You %s %s, '%s'\r\n", action_sing, GET_NAME(vict), buf2); send_to_char(ch, "You %s %s, '%s'\r\n", action_sing, GET_NAME(vict), buf2);
@@ -374,19 +376,19 @@ ACMD(do_page)
snprintf(buf, sizeof(buf), "\007\007*$n* %s", buf2); snprintf(buf, sizeof(buf), "\007\007*$n* %s", buf2);
if (!str_cmp(arg, "all")) { if (!str_cmp(arg, "all")) {
if (GET_LEVEL(ch) > LVL_GOD) { if (GET_LEVEL(ch) > LVL_GOD) {
for (d = descriptor_list; d; d = d->next) for (d = descriptor_list; d; d = d->next)
if (STATE(d) == CON_PLAYING && d->character) if (STATE(d) == CON_PLAYING && d->character)
act(buf, FALSE, ch, 0, d->character, TO_VICT); act(buf, FALSE, ch, 0, d->character, TO_VICT);
} else } else
send_to_char(ch, "You will never be godly enough to do that!\r\n"); send_to_char(ch, "You will never be godly enough to do that!\r\n");
return; return;
} }
if ((vict = get_char_vis(ch, arg, NULL, FIND_CHAR_WORLD))) { if ((vict = get_char_vis(ch, arg, NULL, FIND_CHAR_WORLD))) {
act(buf, FALSE, ch, 0, vict, TO_VICT); act(buf, FALSE, ch, 0, vict, TO_VICT);
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT)) if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
send_to_char(ch, "%s", CONFIG_OK); send_to_char(ch, "%s", CONFIG_OK);
else else
act(buf, FALSE, ch, 0, vict, TO_CHAR); act(buf, FALSE, ch, 0, vict, TO_CHAR);
} else } else
send_to_char(ch, "There is no such person in the game!\r\n"); send_to_char(ch, "There is no such person in the game!\r\n");
} }
@@ -397,26 +399,26 @@ ACMD(do_gen_comm)
{ {
struct descriptor_data *i; struct descriptor_data *i;
char color_on[24]; char color_on[24];
char buf1[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH + 50], *msg; // + 50 to make room for color codes char buf1[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH + 50], *msg; // + 50 to make room for color codes
bool emoting = FALSE; bool emoting = FALSE;
/* Array of flags which must _not_ be set in order for comm to be heard. */ /* Array of flags which must _not_ be set in order for comm to be heard. */
int channels[] = { int channels[] = {
0, 0,
PRF_NOSHOUT, PRF_NOSHOUT,
PRF_NOGOSS, PRF_NOGOSS,
PRF_NOAUCT, PRF_NOAUCT,
PRF_NOGRATZ, PRF_NOGRATZ,
PRF_NOGOSS, PRF_NOGOSS,
0 0
}; };
int hist_type[] = { int hist_type[] = {
HIST_HOLLER, HIST_HOLLER,
HIST_SHOUT, HIST_SHOUT,
HIST_GOSSIP, HIST_GOSSIP,
HIST_AUCTION, HIST_AUCTION,
HIST_GRATS, HIST_GRATS,
}; };
/* com_msgs: [0] Message if you can't perform the action because of noshout /* com_msgs: [0] Message if you can't perform the action because of noshout
@@ -424,35 +426,42 @@ ACMD(do_gen_comm)
* [2] message if you're not on the channel * [2] message if you're not on the channel
* [3] a color string. */ * [3] a color string. */
const char *com_msgs[][4] = { const char *com_msgs[][4] = {
{"You cannot holler!!\r\n", {
"holler", "You cannot holler!!\r\n",
"", "holler",
KYEL}, "",
KYEL
{"You cannot shout!!\r\n", },
"shout", {
"Turn off your noshout flag first!\r\n", "You cannot shout!!\r\n",
KYEL}, "shout",
"Turn off your noshout flag first!\r\n",
{"You cannot gossip!!\r\n", KYEL
"gossip", },
"You aren't even on the channel!\r\n", {
KYEL}, "You cannot gossip!!\r\n",
"gossip",
{"You cannot auction!!\r\n", "You aren't even on the channel!\r\n",
"auction", KYEL
"You aren't even on the channel!\r\n", },
KMAG}, {
"You cannot auction!!\r\n",
{"You cannot congratulate!\r\n", "auction",
"congrat", "You aren't even on the channel!\r\n",
"You aren't even on the channel!\r\n", KMAG
KGRN}, },
{
{"You cannot gossip your emotions!\r\n", "You cannot congratulate!\r\n",
"gossip", "congrat",
"You aren't even on the channel!\r\n", "You aren't even on the channel!\r\n",
KYEL} KGRN
},
{
"You cannot gossip your emotions!\r\n",
"gossip",
"You aren't even on the channel!\r\n",
KYEL
}
}; };
if (PLR_FLAGGED(ch, PLR_NOSHOUT)) { if (PLR_FLAGGED(ch, PLR_NOSHOUT)) {
@@ -475,7 +484,8 @@ ACMD(do_gen_comm)
/* Level_can_shout defined in config.c. */ /* Level_can_shout defined in config.c. */
if (GET_LEVEL(ch) < CONFIG_LEVEL_CAN_SHOUT) { if (GET_LEVEL(ch) < CONFIG_LEVEL_CAN_SHOUT) {
send_to_char(ch, "You must be at least level %d before you can %s.\r\n", CONFIG_LEVEL_CAN_SHOUT, com_msgs[subcmd][1]); send_to_char(ch, "You must be at least level %d before you can %s.\r\n", CONFIG_LEVEL_CAN_SHOUT,
com_msgs[subcmd][1]);
return; return;
} }
/* Make sure the char is on the channel. */ /* Make sure the char is on the channel. */
@@ -506,12 +516,12 @@ ACMD(do_gen_comm)
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT)) if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT))
send_to_char(ch, "%s", CONFIG_OK); send_to_char(ch, "%s", CONFIG_OK);
else { else {
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument)) if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
parse_at(argument); parse_at(argument);
snprintf(buf1, sizeof(buf1), "%sYou %s, '%s%s'%s", COLOR_LEV(ch) >= C_CMP ? color_on : "", snprintf(buf1, sizeof(buf1), "%sYou %s, '%s%s'%s", COLOR_LEV(ch) >= C_CMP ? color_on : "",
com_msgs[subcmd][1], argument, COLOR_LEV(ch) >= C_CMP ? color_on : "", CCNRM(ch, C_CMP)); com_msgs[subcmd][1], argument, COLOR_LEV(ch) >= C_CMP ? color_on : "", CCNRM(ch, C_CMP));
msg = act(buf1, FALSE, ch, 0, 0, TO_CHAR | TO_SLEEP); msg = act(buf1, FALSE, ch, 0, 0, TO_CHAR | TO_SLEEP);
add_history(ch, msg, hist_type[subcmd]); add_history(ch, msg, hist_type[subcmd]);
} }
@@ -520,7 +530,7 @@ ACMD(do_gen_comm)
/* Now send all the strings out. */ /* Now send all the strings out. */
for (i = descriptor_list; i; i = i->next) { for (i = descriptor_list; i; i = i->next) {
if (STATE(i) != CON_PLAYING || i == ch->desc || !i->character ) if (STATE(i) != CON_PLAYING || i == ch->desc || !i->character)
continue; continue;
if (!IS_NPC(ch) && (PRF_FLAGGED(i->character, channels[subcmd]) || PLR_FLAGGED(i->character, PLR_WRITING))) if (!IS_NPC(ch) && (PRF_FLAGGED(i->character, channels[subcmd]) || PLR_FLAGGED(i->character, PLR_WRITING)))
continue; continue;
@@ -529,10 +539,10 @@ ACMD(do_gen_comm)
continue; continue;
if (subcmd == SCMD_SHOUT && ((world[IN_ROOM(ch)].zone != world[IN_ROOM(i->character)].zone) || if (subcmd == SCMD_SHOUT && ((world[IN_ROOM(ch)].zone != world[IN_ROOM(i->character)].zone) ||
!AWAKE(i->character))) !AWAKE(i->character)))
continue; continue;
snprintf(buf2, sizeof(buf2), "%s%s%s", (COLOR_LEV(i->character) >= C_NRM) ? color_on : "", buf1, KNRM); snprintf(buf2, sizeof(buf2), "%s%s%s", (COLOR_LEV(i->character) >= C_NRM) ? color_on : "", buf1, KNRM);
msg = act(buf2, FALSE, ch, 0, i->character, TO_VICT | TO_SLEEP); msg = act(buf2, FALSE, ch, 0, i->character, TO_VICT | TO_SLEEP);
add_history(i->character, msg, hist_type[subcmd]); add_history(i->character, msg, hist_type[subcmd]);
} }
@@ -551,7 +561,7 @@ ACMD(do_qcomm)
else { else {
char buf[MAX_STRING_LENGTH]; char buf[MAX_STRING_LENGTH];
struct descriptor_data *i; struct descriptor_data *i;
if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument)) if (CONFIG_SPECIAL_IN_COMM && legal_communication(argument))
parse_at(argument); parse_at(argument);

View File

@@ -268,7 +268,6 @@ ACMD(do_action);
ACMD(do_gmote); ACMD(do_gmote);
/***************************************************************************** /*****************************************************************************
* Begin Functions and defines for act.wizard.c * Begin Functions and defines for act.wizard.c
****************************************************************************/ ****************************************************************************/
@@ -327,7 +326,7 @@ ACMD(do_plist);
ACMD(do_purge); ACMD(do_purge);
ACMD(do_recent); ACMD(do_recent);
ACMD(do_restore); ACMD(do_restore);
void return_to_char(struct char_data * ch); void return_to_char(struct char_data *ch);
ACMD(do_return); ACMD(do_return);
ACMD(do_saveall); ACMD(do_saveall);
ACMD(do_send); ACMD(do_send);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -166,8 +166,7 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
return 0; return 0;
/* Charm effect: Does it override the movement? */ /* Charm effect: Does it override the movement? */
if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && was_in == IN_ROOM(ch->master)) if (AFF_FLAGGED(ch, AFF_CHARM) && ch->master && was_in == IN_ROOM(ch->master)) {
{
send_to_char(ch, "The thought of leaving your master makes you weep.\r\n"); send_to_char(ch, "The thought of leaving your master makes you weep.\r\n");
act("$n bursts into tears.", FALSE, ch, 0, 0, TO_ROOM); act("$n bursts into tears.", FALSE, ch, 0, 0, TO_ROOM);
return (0); return (0);
@@ -175,28 +174,23 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
/* Water, No Swimming Rooms: Does the deep water prevent movement? */ /* Water, No Swimming Rooms: Does the deep water prevent movement? */
if ((SECT(was_in) == SECT_WATER_NOSWIM) || if ((SECT(was_in) == SECT_WATER_NOSWIM) ||
(SECT(going_to) == SECT_WATER_NOSWIM)) (SECT(going_to) == SECT_WATER_NOSWIM)) {
{ if (!has_boat(ch)) {
if (!has_boat(ch))
{
send_to_char(ch, "You need a boat to go there.\r\n"); send_to_char(ch, "You need a boat to go there.\r\n");
return (0); return (0);
} }
} }
/* Flying Required: Does lack of flying prevent movement? */ /* Flying Required: Does lack of flying prevent movement? */
if ((SECT(was_in) == SECT_FLYING) || (SECT(going_to) == SECT_FLYING)) if ((SECT(was_in) == SECT_FLYING) || (SECT(going_to) == SECT_FLYING)) {
{ if (!has_flight(ch)) {
if (!has_flight(ch))
{
send_to_char(ch, "You need to be flying to go there!\r\n"); send_to_char(ch, "You need to be flying to go there!\r\n");
return (0); return (0);
} }
} }
/* Underwater Room: Does lack of underwater breathing prevent movement? */ /* Underwater Room: Does lack of underwater breathing prevent movement? */
if ((SECT(was_in) == SECT_UNDERWATER) || (SECT(going_to) == SECT_UNDERWATER)) if ((SECT(was_in) == SECT_UNDERWATER) || (SECT(going_to) == SECT_UNDERWATER)) {
{
if (!has_scuba(ch) && !IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)) { if (!has_scuba(ch) && !IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)) {
send_to_char(ch, "You need to be able to breathe water to go there!\r\n"); send_to_char(ch, "You need to be able to breathe water to go there!\r\n");
return (0); return (0);
@@ -204,10 +198,8 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
} }
/* Houses: Can the player walk into the house? */ /* Houses: Can the player walk into the house? */
if (ROOM_FLAGGED(was_in, ROOM_ATRIUM)) if (ROOM_FLAGGED(was_in, ROOM_ATRIUM)) {
{ if (!House_can_enter(ch, GET_ROOM_VNUM(going_to))) {
if (!House_can_enter(ch, GET_ROOM_VNUM(going_to)))
{
send_to_char(ch, "That's private property -- no trespassing!\r\n"); send_to_char(ch, "That's private property -- no trespassing!\r\n");
return (0); return (0);
} }
@@ -223,15 +215,15 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
send_to_char(ch, "A mysterious barrier forces you back! That area is off-limits.\r\n"); send_to_char(ch, "A mysterious barrier forces you back! That area is off-limits.\r\n");
return (0); return (0);
} }
if (ZONE_FLAGGED(GET_ROOM_ZONE(going_to), ZONE_NOIMMORT) && (GET_LEVEL(ch) >= LVL_IMMORT) && (GET_LEVEL(ch) < LVL_GRGOD)) { if (ZONE_FLAGGED(GET_ROOM_ZONE(going_to), ZONE_NOIMMORT) && (GET_LEVEL(ch) >= LVL_IMMORT) && (
GET_LEVEL(ch) < LVL_GRGOD)) {
send_to_char(ch, "A mysterious barrier forces you back! That area is off-limits.\r\n"); send_to_char(ch, "A mysterious barrier forces you back! That area is off-limits.\r\n");
return (0); return (0);
} }
/* Room Size Capacity: Is the room full of people already? */ /* Room Size Capacity: Is the room full of people already? */
if (ROOM_FLAGGED(going_to, ROOM_TUNNEL) && if (ROOM_FLAGGED(going_to, ROOM_TUNNEL) &&
num_pc_in_room(&(world[going_to])) >= CONFIG_TUNNEL_SIZE) num_pc_in_room(&(world[going_to])) >= CONFIG_TUNNEL_SIZE) {
{
if (CONFIG_TUNNEL_SIZE > 1) if (CONFIG_TUNNEL_SIZE > 1)
send_to_char(ch, "There isn't enough room for you to go there!\r\n"); send_to_char(ch, "There isn't enough room for you to go there!\r\n");
else else
@@ -240,8 +232,7 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
} }
/* Room Level Requirements: Is ch privileged enough to enter the room? */ /* Room Level Requirements: Is ch privileged enough to enter the room? */
if (ROOM_FLAGGED(going_to, ROOM_GODROOM) && GET_LEVEL(ch) < LVL_GOD) if (ROOM_FLAGGED(going_to, ROOM_GODROOM) && GET_LEVEL(ch) < LVL_GOD) {
{
send_to_char(ch, "You aren't godly enough to use that room!\r\n"); send_to_char(ch, "You aren't godly enough to use that room!\r\n");
return (0); return (0);
} }
@@ -250,11 +241,10 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
* move points. */ * move points. */
/* move points needed is avg. move loss for src and destination sect type */ /* move points needed is avg. move loss for src and destination sect type */
need_movement = (movement_loss[SECT(was_in)] + need_movement = (movement_loss[SECT(was_in)] +
movement_loss[SECT(going_to)]) / 2; movement_loss[SECT(going_to)]) / 2;
/* Move Point Requirement Check */ /* Move Point Requirement Check */
if (GET_MOVE(ch) < need_movement && !IS_NPC(ch)) if (GET_MOVE(ch) < need_movement && !IS_NPC(ch)) {
{
if (need_specials_check && ch->master) if (need_specials_check && ch->master)
send_to_char(ch, "You are too exhausted to follow.\r\n"); send_to_char(ch, "You are too exhausted to follow.\r\n");
else else
@@ -274,8 +264,7 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
GET_MOVE(ch) -= need_movement; GET_MOVE(ch) -= need_movement;
/* Generate the leave message and display to others in the was_in room. */ /* Generate the leave message and display to others in the was_in room. */
if (!AFF_FLAGGED(ch, AFF_SNEAK)) if (!AFF_FLAGGED(ch, AFF_SNEAK)) {
{
snprintf(leave_message, sizeof(leave_message), "$n leaves %s.", dirs[dir]); snprintf(leave_message, sizeof(leave_message), "$n leaves %s.", dirs[dir]);
act(leave_message, TRUE, ch, 0, 0, TO_ROOM); act(leave_message, TRUE, ch, 0, 0, TO_ROOM);
} }
@@ -307,9 +296,9 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
look_at_room(ch, 0); look_at_room(ch, 0);
/* ... and Kill the player if the room is a death trap. */ /* ... and Kill the player if the room is a death trap. */
if (ROOM_FLAGGED(going_to, ROOM_DEATH) && GET_LEVEL(ch) < LVL_IMMORT) if (ROOM_FLAGGED(going_to, ROOM_DEATH) && GET_LEVEL(ch) < LVL_IMMORT) {
{ mudlog(BRF, LVL_IMMORT, TRUE, "%s hit death trap #%d (%s)", GET_NAME(ch), GET_ROOM_VNUM(going_to),
mudlog(BRF, LVL_IMMORT, TRUE, "%s hit death trap #%d (%s)", GET_NAME(ch), GET_ROOM_VNUM(going_to), world[going_to].name); world[going_to].name);
death_cry(ch); death_cry(ch);
extract_char(ch); extract_char(ch);
return (0); return (0);
@@ -319,15 +308,13 @@ int do_simple_move(struct char_data *ch, int dir, int need_specials_check)
/* Fire memory and greet triggers, check and see if the greet trigger /* Fire memory and greet triggers, check and see if the greet trigger
* prevents movement, and if so, move the player back to the previous room. */ * prevents movement, and if so, move the player back to the previous room. */
entry_memory_mtrigger(ch); entry_memory_mtrigger(ch);
if (!greet_mtrigger(ch, dir)) if (!greet_mtrigger(ch, dir)) {
{
char_from_room(ch); char_from_room(ch);
char_to_room(ch, was_in); char_to_room(ch, was_in);
look_at_room(ch, 0); look_at_room(ch, 0);
/* Failed move, return a failure */ /* Failed move, return a failure */
return (0); return (0);
} } else
else
greet_memory_mtrigger(ch); greet_memory_mtrigger(ch);
/*---------------------------------------------------------------------*/ /*---------------------------------------------------------------------*/
/* End: Post-move operations. */ /* End: Post-move operations. */
@@ -348,7 +335,8 @@ int perform_move(struct char_data *ch, int dir, int need_specials_check)
send_to_char(ch, "Alas, you cannot go that way...\r\n"); send_to_char(ch, "Alas, you cannot go that way...\r\n");
else if ((!EXIT(ch, dir) && !buildwalk(ch, dir)) || EXIT(ch, dir)->to_room == NOWHERE) else if ((!EXIT(ch, dir) && !buildwalk(ch, dir)) || EXIT(ch, dir)->to_room == NOWHERE)
send_to_char(ch, "Alas, you cannot go that way...\r\n"); send_to_char(ch, "Alas, you cannot go that way...\r\n");
else if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && (GET_LEVEL(ch) < LVL_IMMORT || (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)))) { else if (EXIT_FLAGGED(EXIT(ch, dir), EX_CLOSED) && (GET_LEVEL(ch) < LVL_IMMORT || (
!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE)))) {
if (EXIT(ch, dir)->keyword) if (EXIT(ch, dir)->keyword)
send_to_char(ch, "The %s seems to be closed.\r\n", fname(EXIT(ch, dir)->keyword)); send_to_char(ch, "The %s seems to be closed.\r\n", fname(EXIT(ch, dir)->keyword));
else else
@@ -364,9 +352,9 @@ int perform_move(struct char_data *ch, int dir, int need_specials_check)
for (k = ch->followers; k; k = next) { for (k = ch->followers; k; k = next) {
next = k->next; next = k->next;
if ((IN_ROOM(k->follower) == was_in) && if ((IN_ROOM(k->follower) == was_in) &&
(GET_POS(k->follower) >= POS_STANDING)) { (GET_POS(k->follower) >= POS_STANDING)) {
act("You follow $N.\r\n", FALSE, k->follower, 0, ch, TO_CHAR); act("You follow $N.\r\n", FALSE, k->follower, 0, ch, TO_CHAR);
perform_move(k->follower, dir, 1); perform_move(k->follower, dir, 1);
} }
} }
return (1); return (1);
@@ -384,14 +372,14 @@ static int find_door(struct char_data *ch, const char *type, char *dir, const ch
{ {
int door; int door;
if (*dir) { /* a direction was specified */ if (*dir) { /* a direction was specified */
if ((door = search_block(dir, dirs, FALSE)) == -1) { /* Partial Match */ if ((door = search_block(dir, dirs, FALSE)) == -1) { /* Partial Match */
if ((door = search_block(dir, autoexits, FALSE)) == -1) { /* Check 'short' dirs too */ if ((door = search_block(dir, autoexits, FALSE)) == -1) { /* Check 'short' dirs too */
send_to_char(ch, "That's not a direction.\r\n"); send_to_char(ch, "That's not a direction.\r\n");
return (-1); return (-1);
} }
} }
if (EXIT(ch, door)) { /* Braces added according to indent. -gg */ if (EXIT(ch, door)) { /* Braces added according to indent. -gg */
if (EXIT(ch, door)->keyword) { if (EXIT(ch, door)->keyword) {
if (is_name(type, EXIT(ch, door)->keyword)) if (is_name(type, EXIT(ch, door)->keyword))
return (door); return (door);
@@ -400,40 +388,34 @@ static int find_door(struct char_data *ch, const char *type, char *dir, const ch
return (-1); return (-1);
} }
} else } else
return (door); return (door);
} else { } else {
send_to_char(ch, "I really don't see how you can %s anything there.\r\n", cmdname); send_to_char(ch, "I really don't see how you can %s anything there.\r\n", cmdname);
return (-1); return (-1);
} }
} else { /* try to locate the keyword */ } else { /* try to locate the keyword */
if (!*type) { if (!*type) {
send_to_char(ch, "What is it you want to %s?\r\n", cmdname); send_to_char(ch, "What is it you want to %s?\r\n", cmdname);
return (-1); return (-1);
} }
for (door = 0; door < DIR_COUNT; door++) for (door = 0; door < DIR_COUNT; door++) {
{ if (EXIT(ch, door)) {
if (EXIT(ch, door)) if (EXIT(ch, door)->keyword) {
{ if (isname(type, EXIT(ch, door)->keyword)) {
if (EXIT(ch, door)->keyword)
{
if (isname(type, EXIT(ch, door)->keyword))
{
if ((!IS_NPC(ch)) && (!PRF_FLAGGED(ch, PRF_AUTODOOR))) if ((!IS_NPC(ch)) && (!PRF_FLAGGED(ch, PRF_AUTODOOR)))
return door; return door;
else if (is_abbrev(cmdname, "open")) else if (is_abbrev(cmdname, "open")) {
{
if (IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED)) if (IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED))
return door; return door;
else if (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED)) else if (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED))
return door; return door;
} } else if ((is_abbrev(cmdname, "close")) && (!(IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED))))
else if ((is_abbrev(cmdname, "close")) && (!(IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED))) )
return door; return door;
else if ((is_abbrev(cmdname, "lock")) && (!(IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED))) ) else if ((is_abbrev(cmdname, "lock")) && (!(IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED))))
return door; return door;
else if ((is_abbrev(cmdname, "unlock")) && (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED)) ) else if ((is_abbrev(cmdname, "unlock")) && (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED)))
return door; return door;
else if ((is_abbrev(cmdname, "pick")) && (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED)) ) else if ((is_abbrev(cmdname, "pick")) && (IS_SET(EXIT(ch, door)->exit_info, EX_LOCKED)))
return door; return door;
} }
} }
@@ -483,20 +465,20 @@ int has_key(struct char_data *ch, obj_vnum key)
/* cmd_door is required external from act.movement.c */ /* cmd_door is required external from act.movement.c */
const char *cmd_door[] = const char *cmd_door[] =
{ {
"open", "open",
"close", "close",
"unlock", "unlock",
"lock", "lock",
"pick" "pick"
}; };
static const int flags_door[] = static const int flags_door[] =
{ {
NEED_CLOSED | NEED_UNLOCKED, NEED_CLOSED | NEED_UNLOCKED,
NEED_OPEN, NEED_OPEN,
NEED_CLOSED | NEED_LOCKED, NEED_CLOSED | NEED_LOCKED,
NEED_CLOSED | NEED_UNLOCKED, NEED_CLOSED | NEED_UNLOCKED,
NEED_CLOSED | NEED_LOCKED NEED_CLOSED | NEED_LOCKED
}; };
#define EXITN(room, door) (world[room].dir_option[door]) #define EXITN(room, door) (world[room].dir_option[door])
@@ -576,15 +558,15 @@ static void do_doorcmd(struct char_data *ch, struct obj_data *obj, int door, int
/* Notify the room. */ /* Notify the room. */
if (len < sizeof(buf)) if (len < sizeof(buf))
snprintf(buf + len, sizeof(buf) - len, "%s%s.", snprintf(buf + len, sizeof(buf) - len, "%s%s.",
obj ? "" : "the ", obj ? "$p" : EXIT(ch, door)->keyword ? "$F" : "door"); obj ? "" : "the ", obj ? "$p" : EXIT(ch, door)->keyword ? "$F" : "door");
if (!obj || IN_ROOM(obj) != NOWHERE) if (!obj || IN_ROOM(obj) != NOWHERE)
act(buf, FALSE, ch, obj, obj ? 0 : EXIT(ch, door)->keyword, TO_ROOM); act(buf, FALSE, ch, obj, obj ? 0 : EXIT(ch, door)->keyword, TO_ROOM);
/* Notify the other room */ /* Notify the other room */
if (back && (scmd == SCMD_OPEN || scmd == SCMD_CLOSE)) if (back && (scmd == SCMD_OPEN || scmd == SCMD_CLOSE))
send_to_room(EXIT(ch, door)->to_room, "The %s is %s%s from the other side.\r\n", send_to_room(EXIT(ch, door)->to_room, "The %s is %s%s from the other side.\r\n",
back->keyword ? fname(back->keyword) : "door", cmd_door[scmd], back->keyword ? fname(back->keyword) : "door", cmd_door[scmd],
scmd == SCMD_CLOSE ? "d" : "ed"); scmd == SCMD_CLOSE ? "d" : "ed");
} }
static int ok_pick(struct char_data *ch, obj_vnum keynum, int pickproof, int scmd) static int ok_pick(struct char_data *ch, obj_vnum keynum, int pickproof, int scmd)
@@ -655,18 +637,16 @@ ACMD(do_gen_door)
send_to_char(ch, "But it's currently open!\r\n"); send_to_char(ch, "But it's currently open!\r\n");
else if (!(DOOR_IS_LOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_LOCKED)) else if (!(DOOR_IS_LOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_LOCKED))
send_to_char(ch, "Oh.. it wasn't locked, after all..\r\n"); send_to_char(ch, "Oh.. it wasn't locked, after all..\r\n");
else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) && ((!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOKEY))) && (has_key(ch, keynum)) ) else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) && ((
{ !IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOKEY))) && (has_key(ch, keynum))) {
send_to_char(ch, "It is locked, but you have the key.\r\n"); send_to_char(ch, "It is locked, but you have the key.\r\n");
do_doorcmd(ch, obj, door, SCMD_UNLOCK); do_doorcmd(ch, obj, door, SCMD_UNLOCK);
do_doorcmd(ch, obj, door, subcmd); do_doorcmd(ch, obj, door, subcmd);
} } else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) && ((
else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) && ((!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOKEY))) && (!has_key(ch, keynum)) ) !IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOKEY))) && (!has_key(ch, keynum))) {
{
send_to_char(ch, "It is locked, and you do not have the key!\r\n"); send_to_char(ch, "It is locked, and you do not have the key!\r\n");
} } else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) &&
else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) && (GET_LEVEL(ch) < LVL_IMMORT || (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE))))
(GET_LEVEL(ch) < LVL_IMMORT || (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_NOHASSLE))))
send_to_char(ch, "It seems to be locked.\r\n"); send_to_char(ch, "It seems to be locked.\r\n");
else if (!has_key(ch, keynum) && (GET_LEVEL(ch) < LVL_GOD) && ((subcmd == SCMD_LOCK) || (subcmd == SCMD_UNLOCK))) else if (!has_key(ch, keynum) && (GET_LEVEL(ch) < LVL_GOD) && ((subcmd == SCMD_LOCK) || (subcmd == SCMD_UNLOCK)))
send_to_char(ch, "You don't seem to have the proper key.\r\n"); send_to_char(ch, "You don't seem to have the proper key.\r\n");
@@ -683,7 +663,7 @@ ACMD(do_enter)
one_argument(argument, buf); one_argument(argument, buf);
if (*buf) { /* an argument was supplied, search for door if (*buf) { /* an argument was supplied, search for door
* keyword */ * keyword */
for (door = 0; door < DIR_COUNT; door++) for (door = 0; door < DIR_COUNT; door++)
if (EXIT(ch, door)) if (EXIT(ch, door))
@@ -699,12 +679,12 @@ ACMD(do_enter)
/* try to locate an entrance */ /* try to locate an entrance */
for (door = 0; door < DIR_COUNT; door++) for (door = 0; door < DIR_COUNT; door++)
if (EXIT(ch, door)) if (EXIT(ch, door))
if (EXIT(ch, door)->to_room != NOWHERE) if (EXIT(ch, door)->to_room != NOWHERE)
if (!EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && if (!EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) &&
ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_INDOORS)) { ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_INDOORS)) {
perform_move(ch, door, 1); perform_move(ch, door, 1);
return; return;
} }
send_to_char(ch, "You can't seem to find anything to enter.\r\n"); send_to_char(ch, "You can't seem to find anything to enter.\r\n");
} }
} }
@@ -718,12 +698,12 @@ ACMD(do_leave)
else { else {
for (door = 0; door < DIR_COUNT; door++) for (door = 0; door < DIR_COUNT; door++)
if (EXIT(ch, door)) if (EXIT(ch, door))
if (EXIT(ch, door)->to_room != NOWHERE) if (EXIT(ch, door)->to_room != NOWHERE)
if (!EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && if (!EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) &&
!ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_INDOORS)) { !ROOM_FLAGGED(EXIT(ch, door)->to_room, ROOM_INDOORS)) {
perform_move(ch, door, 1); perform_move(ch, door, 1);
return; return;
} }
send_to_char(ch, "I see no obvious exits to the outside.\r\n"); send_to_char(ch, "I see no obvious exits to the outside.\r\n");
} }
} }
@@ -737,16 +717,16 @@ ACMD(do_stand)
case POS_SITTING: case POS_SITTING:
send_to_char(ch, "You stand up.\r\n"); send_to_char(ch, "You stand up.\r\n");
act("$n clambers to $s feet.", TRUE, ch, 0, 0, TO_ROOM); act("$n clambers to $s feet.", TRUE, ch, 0, 0, TO_ROOM);
/* Were they sitting in something? */ /* Were they sitting in something? */
char_from_furniture(ch); char_from_furniture(ch);
/* Will be sitting after a successful bash and may still be fighting. */ /* Will be sitting after a successful bash and may still be fighting. */
GET_POS(ch) = FIGHTING(ch) ? POS_FIGHTING : POS_STANDING; GET_POS(ch) = FIGHTING(ch) ? POS_FIGHTING : POS_STANDING;
break; break;
case POS_RESTING: case POS_RESTING:
send_to_char(ch, "You stop resting, and stand up.\r\n"); send_to_char(ch, "You stop resting, and stand up.\r\n");
act("$n stops resting, and clambers on $s feet.", TRUE, ch, 0, 0, TO_ROOM); act("$n stops resting, and clambers on $s feet.", TRUE, ch, 0, 0, TO_ROOM);
GET_POS(ch) = POS_STANDING; GET_POS(ch) = POS_STANDING;
/* Were they sitting in something. */ /* Were they sitting in something. */
char_from_furniture(ch); char_from_furniture(ch);
break; break;
case POS_SLEEPING: case POS_SLEEPING:
@@ -758,7 +738,7 @@ ACMD(do_stand)
default: default:
send_to_char(ch, "You stop floating around, and put your feet on the ground.\r\n"); send_to_char(ch, "You stop floating around, and put your feet on the ground.\r\n");
act("$n stops floating around, and puts $s feet on the ground.", act("$n stops floating around, and puts $s feet on the ground.",
TRUE, ch, 0, 0, TO_ROOM); TRUE, ch, 0, 0, TO_ROOM);
GET_POS(ch) = POS_STANDING; GET_POS(ch) = POS_STANDING;
break; break;
} }
@@ -799,7 +779,7 @@ ACMD(do_sit)
} else { } else {
if (OBJ_SAT_IN_BY(furniture) == NULL) if (OBJ_SAT_IN_BY(furniture) == NULL)
OBJ_SAT_IN_BY(furniture) = ch; OBJ_SAT_IN_BY(furniture) = ch;
for (tempch = OBJ_SAT_IN_BY(furniture); tempch != ch ; tempch = NEXT_SITTING(tempch)) { for (tempch = OBJ_SAT_IN_BY(furniture); tempch != ch; tempch = NEXT_SITTING(tempch)) {
if (NEXT_SITTING(tempch)) if (NEXT_SITTING(tempch))
continue; continue;
NEXT_SITTING(tempch) = ch; NEXT_SITTING(tempch) = ch;
@@ -884,7 +864,7 @@ ACMD(do_sleep)
default: default:
send_to_char(ch, "You stop floating around, and lie down to sleep.\r\n"); send_to_char(ch, "You stop floating around, and lie down to sleep.\r\n");
act("$n stops floating around, and lie down to sleep.", act("$n stops floating around, and lie down to sleep.",
TRUE, ch, 0, 0, TO_ROOM); TRUE, ch, 0, 0, TO_ROOM);
GET_POS(ch) = POS_SLEEPING; GET_POS(ch) = POS_SLEEPING;
break; break;
} }
@@ -942,9 +922,9 @@ ACMD(do_follow)
return; return;
} }
} else { } else {
if (ch->master != (char_data*) NULL) { if (ch->master != (char_data *)NULL) {
send_to_char(ch, "You are following %s.\r\n", send_to_char(ch, "You are following %s.\r\n",
GET_NAME(ch->master)); GET_NAME(ch->master));
} else { } else {
send_to_char(ch, "Whom do you wish to follow?\r\n"); send_to_char(ch, "Whom do you wish to follow?\r\n");
} }
@@ -957,7 +937,7 @@ ACMD(do_follow)
} }
if (AFF_FLAGGED(ch, AFF_CHARM) && (ch->master)) { if (AFF_FLAGGED(ch, AFF_CHARM) && (ch->master)) {
act("But you only feel like following $N!", FALSE, ch, 0, ch->master, TO_CHAR); act("But you only feel like following $N!", FALSE, ch, 0, ch->master, TO_CHAR);
} else { /* Not Charmed follow person */ } else { /* Not Charmed follow person */
if (leader == ch) { if (leader == ch) {
if (!ch->master) { if (!ch->master) {
send_to_char(ch, "You are already following yourself.\r\n"); send_to_char(ch, "You are already following yourself.\r\n");
@@ -980,9 +960,9 @@ ACMD(do_follow)
ACMD(do_unfollow) ACMD(do_unfollow)
{ {
if (ch->master) { if (ch->master) {
if (AFF_FLAGGED(ch, AFF_CHARM)) { if (AFF_FLAGGED(ch, AFF_CHARM)) {
send_to_char(ch, "You feel compelled to follow %s.\r\n", send_to_char(ch, "You feel compelled to follow %s.\r\n",
GET_NAME(ch->master)); GET_NAME(ch->master));
} else { } else {
stop_follower(ch); stop_follower(ch);
} }

View File

@@ -46,14 +46,14 @@ ACMD(do_assist)
opponent = FIGHTING(helpee); opponent = FIGHTING(helpee);
else else
for (opponent = world[IN_ROOM(ch)].people; for (opponent = world[IN_ROOM(ch)].people;
opponent && (FIGHTING(opponent) != helpee); opponent && (FIGHTING(opponent) != helpee);
opponent = opponent->next_in_room); opponent = opponent->next_in_room);
if (!opponent) if (!opponent)
act("But nobody is fighting $M!", FALSE, ch, 0, helpee, TO_CHAR); act("But nobody is fighting $M!", FALSE, ch, 0, helpee, TO_CHAR);
else if (!CAN_SEE(ch, opponent)) else if (!CAN_SEE(ch, opponent))
act("You can't see who is fighting $M!", FALSE, ch, 0, helpee, TO_CHAR); act("You can't see who is fighting $M!", FALSE, ch, 0, helpee, TO_CHAR);
/* prevent accidental pkill */ /* prevent accidental pkill */
else if (!CONFIG_PK_ALLOWED && !IS_NPC(opponent)) else if (!CONFIG_PK_ALLOWED && !IS_NPC(opponent))
send_to_char(ch, "You cannot kill other players.\r\n"); send_to_char(ch, "You cannot kill other players.\r\n");
else { else {
@@ -70,7 +70,7 @@ ACMD(do_hit)
char arg[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH];
struct char_data *vict; struct char_data *vict;
one_argument(argument, arg); one_argument(argument, arg);
if (!*arg) if (!*arg)
send_to_char(ch, "Hit who?\r\n"); send_to_char(ch, "Hit who?\r\n");
@@ -82,17 +82,18 @@ ACMD(do_hit)
} else if (AFF_FLAGGED(ch, AFF_CHARM) && (ch->master == vict)) } else if (AFF_FLAGGED(ch, AFF_CHARM) && (ch->master == vict))
act("$N is just such a good friend, you simply can't hit $M.", FALSE, ch, 0, vict, TO_CHAR); act("$N is just such a good friend, you simply can't hit $M.", FALSE, ch, 0, vict, TO_CHAR);
else { else {
if (!CONFIG_PK_ALLOWED && !IS_NPC(vict) && !IS_NPC(ch)) if (!CONFIG_PK_ALLOWED && !IS_NPC(vict) && !IS_NPC(ch))
check_killer(ch, vict); check_killer(ch, vict);
if ((GET_POS(ch) == POS_STANDING) && (vict != FIGHTING(ch))) { if ((GET_POS(ch) == POS_STANDING) && (vict != FIGHTING(ch))) {
if (GET_DEX(ch) > GET_DEX(vict) || (GET_DEX(ch) == GET_DEX(vict) && rand_number(1, 2) == 1)) /* if faster */ if (GET_DEX(ch) > GET_DEX(vict) || (GET_DEX(ch) == GET_DEX(vict) && rand_number(1, 2) == 1)) /* if faster */
hit(ch, vict, TYPE_UNDEFINED); /* first */ hit(ch, vict, TYPE_UNDEFINED); /* first */
else hit(vict, ch, TYPE_UNDEFINED); /* or the victim is first */ else
WAIT_STATE(ch, PULSE_VIOLENCE + 2); hit(vict, ch, TYPE_UNDEFINED); /* or the victim is first */
} else WAIT_STATE(ch, PULSE_VIOLENCE + 2);
send_to_char(ch, "You're fighting the best you can!\r\n"); } else
} send_to_char(ch, "You're fighting the best you can!\r\n");
}
} }
ACMD(do_kill) ACMD(do_kill)
@@ -164,7 +165,7 @@ ACMD(do_backstab)
return; return;
} }
percent = rand_number(1, 101); /* 101% is a complete failure */ percent = rand_number(1, 101); /* 101% is a complete failure */
prob = GET_SKILL(ch, SKILL_BACKSTAB); prob = GET_SKILL(ch, SKILL_BACKSTAB);
if (AWAKE(vict) && (percent > prob)) if (AWAKE(vict) && (percent > prob))
@@ -208,7 +209,7 @@ ACMD(do_order)
send_to_char(ch, "%s", CONFIG_OK); send_to_char(ch, "%s", CONFIG_OK);
command_interpreter(vict, message); command_interpreter(vict, message);
} }
} else { /* This is order "followers" */ } else { /* This is order "followers" */
char buf[MAX_STRING_LENGTH]; char buf[MAX_STRING_LENGTH];
snprintf(buf, sizeof(buf), "$n issues the order '%s'.", message); snprintf(buf, sizeof(buf), "$n issues the order '%s'.", message);
@@ -242,22 +243,22 @@ ACMD(do_flee)
for (i = 0; i < 6; i++) { for (i = 0; i < 6; i++) {
attempt = rand_number(0, DIR_COUNT - 1); /* Select a random direction */ attempt = rand_number(0, DIR_COUNT - 1); /* Select a random direction */
if (CAN_GO(ch, attempt) && if (CAN_GO(ch, attempt) &&
!ROOM_FLAGGED(EXIT(ch, attempt)->to_room, ROOM_DEATH)) { !ROOM_FLAGGED(EXIT(ch, attempt)->to_room, ROOM_DEATH)) {
act("$n panics, and attempts to flee!", TRUE, ch, 0, 0, TO_ROOM); act("$n panics, and attempts to flee!", TRUE, ch, 0, 0, TO_ROOM);
was_fighting = FIGHTING(ch); was_fighting = FIGHTING(ch);
if (do_simple_move(ch, attempt, TRUE)) { if (do_simple_move(ch, attempt, TRUE)) {
send_to_char(ch, "You flee head over heels.\r\n"); send_to_char(ch, "You flee head over heels.\r\n");
if (was_fighting && !IS_NPC(ch)) { if (was_fighting && !IS_NPC(ch)) {
loss = GET_MAX_HIT(was_fighting) - GET_HIT(was_fighting); loss = GET_MAX_HIT(was_fighting) - GET_HIT(was_fighting);
loss *= GET_LEVEL(was_fighting); loss *= GET_LEVEL(was_fighting);
gain_exp(ch, -loss); gain_exp(ch, -loss);
} }
if (FIGHTING(ch)) if (FIGHTING(ch))
stop_fighting(ch); stop_fighting(ch);
if (was_fighting && ch == FIGHTING(was_fighting)) if (was_fighting && ch == FIGHTING(was_fighting))
stop_fighting(was_fighting); stop_fighting(was_fighting);
} else { } else {
act("$n tries to flee, but can't!", TRUE, ch, 0, 0, TO_ROOM); act("$n tries to flee, but can't!", TRUE, ch, 0, 0, TO_ROOM);
} }
return; return;
} }
@@ -302,7 +303,7 @@ ACMD(do_bash)
return; return;
} }
percent = rand_number(1, 101); /* 101% is a complete failure */ percent = rand_number(1, 101); /* 101% is a complete failure */
prob = GET_SKILL(ch, SKILL_BASH); prob = GET_SKILL(ch, SKILL_BASH);
if (MOB_FLAGGED(vict, MOB_NOBASH)) if (MOB_FLAGGED(vict, MOB_NOBASH))
@@ -318,7 +319,7 @@ ACMD(do_bash)
* first to make sure they don't flee, then we can't bash them! So now * first to make sure they don't flee, then we can't bash them! So now
* we only set them sitting if they didn't flee. -gg 9/21/98 * we only set them sitting if they didn't flee. -gg 9/21/98
*/ */
if (damage(ch, vict, 1, SKILL_BASH) > 0) { /* -1 = dead, 0 = miss */ if (damage(ch, vict, 1, SKILL_BASH) > 0) { /* -1 = dead, 0 = miss */
WAIT_STATE(vict, PULSE_VIOLENCE); WAIT_STATE(vict, PULSE_VIOLENCE);
if (IN_ROOM(ch) == IN_ROOM(vict)) if (IN_ROOM(ch) == IN_ROOM(vict))
GET_POS(vict) = POS_SITTING; GET_POS(vict) = POS_SITTING;
@@ -353,21 +354,21 @@ ACMD(do_rescue)
return; return;
} }
for (tmp_ch = world[IN_ROOM(ch)].people; tmp_ch && for (tmp_ch = world[IN_ROOM(ch)].people; tmp_ch &&
(FIGHTING(tmp_ch) != vict); tmp_ch = tmp_ch->next_in_room); (FIGHTING(tmp_ch) != vict); tmp_ch = tmp_ch->next_in_room);
if ((FIGHTING(vict) != NULL) && (FIGHTING(ch) == FIGHTING(vict)) && (tmp_ch == NULL)) { if ((FIGHTING(vict) != NULL) && (FIGHTING(ch) == FIGHTING(vict)) && (tmp_ch == NULL)) {
tmp_ch = FIGHTING(vict); tmp_ch = FIGHTING(vict);
if (FIGHTING(tmp_ch) == ch) { if (FIGHTING(tmp_ch) == ch) {
send_to_char(ch, "You have already rescued %s from %s.\r\n", GET_NAME(vict), GET_NAME(FIGHTING(ch))); send_to_char(ch, "You have already rescued %s from %s.\r\n", GET_NAME(vict), GET_NAME(FIGHTING(ch)));
return; return;
} }
} }
if (!tmp_ch) { if (!tmp_ch) {
act("But nobody is fighting $M!", FALSE, ch, 0, vict, TO_CHAR); act("But nobody is fighting $M!", FALSE, ch, 0, vict, TO_CHAR);
return; return;
} }
percent = rand_number(1, 101); /* 101% is a complete failure */ percent = rand_number(1, 101); /* 101% is a complete failure */
prob = GET_SKILL(ch, SKILL_RESCUE); prob = GET_SKILL(ch, SKILL_RESCUE);
if (percent > prob) { if (percent > prob) {
@@ -397,47 +398,47 @@ EVENTFUNC(event_whirlwind)
struct mud_event_data *pMudEvent; struct mud_event_data *pMudEvent;
struct list_data *room_list; struct list_data *room_list;
int count; int count;
/* This is just a dummy check, but we'll do it anyway */ /* This is just a dummy check, but we'll do it anyway */
if (event_obj == NULL) if (event_obj == NULL)
return 0; return 0;
/* For the sake of simplicity, we will place the event data in easily /* For the sake of simplicity, we will place the event data in easily
* referenced pointers */ * referenced pointers */
pMudEvent = (struct mud_event_data *) event_obj; pMudEvent = (struct mud_event_data *)event_obj;
ch = (struct char_data *) pMudEvent->pStruct; ch = (struct char_data *)pMudEvent->pStruct;
/* When using a list, we have to make sure to allocate the list as it /* When using a list, we have to make sure to allocate the list as it
* uses dynamic memory */ * uses dynamic memory */
room_list = create_list(); room_list = create_list();
/* We search through the "next_in_room", and grab all NPCs and add them /* We search through the "next_in_room", and grab all NPCs and add them
* to our list */ * to our list */
for (tch = world[IN_ROOM(ch)].people; tch; tch = tch->next_in_room) for (tch = world[IN_ROOM(ch)].people; tch; tch = tch->next_in_room)
if (IS_NPC(tch)) if (IS_NPC(tch))
add_to_list(tch, room_list); add_to_list(tch, room_list);
/* If our list is empty or has "0" entries, we free it from memory and /* If our list is empty or has "0" entries, we free it from memory and
* close off our event */ * close off our event */
if (room_list->iSize == 0) { if (room_list->iSize == 0) {
free_list(room_list); free_list(room_list);
send_to_char(ch, "There is no one in the room to whirlwind!\r\n"); send_to_char(ch, "There is no one in the room to whirlwind!\r\n");
return 0; return 0;
} }
/* We spit out some ugly colour, making use of the new colour options, /* We spit out some ugly colour, making use of the new colour options,
* to let the player know they are performing their whirlwind strike */ * to let the player know they are performing their whirlwind strike */
send_to_char(ch, "\t[f313]You deliver a vicious \t[f014]\t[b451]WHIRLWIND!!!\tn\r\n"); send_to_char(ch, "\t[f313]You deliver a vicious \t[f014]\t[b451]WHIRLWIND!!!\tn\r\n");
/* Lets grab some a random NPC from the list, and hit() them up */ /* Lets grab some a random NPC from the list, and hit() them up */
for (count = dice(1, 4); count > 0; count--) { for (count = dice(1, 4); count > 0; count--) {
tch = random_from_list(room_list); tch = random_from_list(room_list);
hit(ch, tch, TYPE_UNDEFINED); hit(ch, tch, TYPE_UNDEFINED);
} }
/* Now that our attack is done, let's free out list */ /* Now that our attack is done, let's free out list */
free_list(room_list); free_list(room_list);
/* The "return" of the event function is the time until the event is called /* The "return" of the event function is the time until the event is called
* again. If we return 0, then the event is freed and removed from the list, but * again. If we return 0, then the event is freed and removed from the list, but
* any other numerical response will be the delay until the next call */ * any other numerical response will be the delay until the next call */
@@ -452,12 +453,12 @@ EVENTFUNC(event_whirlwind)
* mud event and list systems. */ * mud event and list systems. */
ACMD(do_whirlwind) ACMD(do_whirlwind)
{ {
if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_WHIRLWIND)) { if (IS_NPC(ch) || !GET_SKILL(ch, SKILL_WHIRLWIND)) {
send_to_char(ch, "You have no idea how.\r\n"); send_to_char(ch, "You have no idea how.\r\n");
return; return;
} }
if ROOM_FLAGGED(IN_ROOM(ch), ROOM_PEACEFUL) { if ROOM_FLAGGED(IN_ROOM(ch), ROOM_PEACEFUL) {
send_to_char(ch, "This room just has such a peaceful, easy feeling...\r\n"); send_to_char(ch, "This room just has such a peaceful, easy feeling...\r\n");
return; return;
@@ -465,22 +466,22 @@ ACMD(do_whirlwind)
if (GET_POS(ch) < POS_FIGHTING) { if (GET_POS(ch) < POS_FIGHTING) {
send_to_char(ch, "You must be on your feet to perform a whirlwind.\r\n"); send_to_char(ch, "You must be on your feet to perform a whirlwind.\r\n");
return; return;
} }
/* First thing we do is check to make sure the character is not in the middle /* First thing we do is check to make sure the character is not in the middle
* of a whirl wind attack. * of a whirl wind attack.
* *
* "char_had_mud_event() will sift through the character's event list to see if * "char_had_mud_event() will sift through the character's event list to see if
* an event of type "eWHIRLWIND" currently exists. */ * an event of type "eWHIRLWIND" currently exists. */
if (char_has_mud_event(ch, eWHIRLWIND)) { if (char_has_mud_event(ch, eWHIRLWIND)) {
send_to_char(ch, "You are already attempting that!\r\n"); send_to_char(ch, "You are already attempting that!\r\n");
return; return;
} }
send_to_char(ch, "You begin to spin rapidly in circles.\r\n"); send_to_char(ch, "You begin to spin rapidly in circles.\r\n");
act("$n begins to rapidly spin in a circle!", FALSE, ch, 0, 0, TO_ROOM); act("$n begins to rapidly spin in a circle!", FALSE, ch, 0, 0, TO_ROOM);
/* NEW_EVENT() will add a new mud event to the event list of the character. /* NEW_EVENT() will add a new mud event to the event list of the character.
* This function below adds a new event of "eWHIRLWIND", to "ch", and passes "NULL" as * This function below adds a new event of "eWHIRLWIND", to "ch", and passes "NULL" as
* additional data. The event will be called in "3 * PASSES_PER_SEC" or 3 seconds */ * additional data. The event will be called in "3 * PASSES_PER_SEC" or 3 seconds */
@@ -528,11 +529,10 @@ ACMD(do_kick)
ACMD(do_bandage) ACMD(do_bandage)
{ {
char arg[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH];
struct char_data * vict; struct char_data *vict;
int percent, prob; int percent, prob;
if (!GET_SKILL(ch, SKILL_BANDAGE)) if (!GET_SKILL(ch, SKILL_BANDAGE)) {
{
send_to_char(ch, "You are unskilled in the art of bandaging.\r\n"); send_to_char(ch, "You are unskilled in the art of bandaging.\r\n");
return; return;
} }
@@ -556,21 +556,21 @@ ACMD(do_bandage)
WAIT_STATE(ch, PULSE_VIOLENCE * 2); WAIT_STATE(ch, PULSE_VIOLENCE * 2);
percent = rand_number(1, 101); /* 101% is a complete failure */ percent = rand_number(1, 101); /* 101% is a complete failure */
prob = GET_SKILL(ch, SKILL_BANDAGE); prob = GET_SKILL(ch, SKILL_BANDAGE);
if (percent <= prob) { if (percent <= prob) {
act("Your attempt to bandage fails.", FALSE, ch, 0, 0, TO_CHAR); act("Your attempt to bandage fails.", FALSE, ch, 0, 0, TO_CHAR);
act("$n tries to bandage $N, but fails miserably.", TRUE, ch, act("$n tries to bandage $N, but fails miserably.", TRUE, ch,
0, vict, TO_NOTVICT); 0, vict, TO_NOTVICT);
damage(vict, vict, 2, TYPE_SUFFERING); damage(vict, vict, 2, TYPE_SUFFERING);
return; return;
} }
act("You successfully bandage $N.", FALSE, ch, 0, vict, TO_CHAR); act("You successfully bandage $N.", FALSE, ch, 0, vict, TO_CHAR);
act("$n bandages $N, who looks a bit better now.", TRUE, ch, 0, act("$n bandages $N, who looks a bit better now.", TRUE, ch, 0,
vict, TO_NOTVICT); vict, TO_NOTVICT);
act("Someone bandages you, and you feel a bit better now.", act("Someone bandages you, and you feel a bit better now.",
FALSE, ch, 0, vict, TO_VICT); FALSE, ch, 0, vict, TO_VICT);
GET_HIT(vict) = 0; GET_HIT(vict) = 0;
} }

View File

@@ -33,7 +33,7 @@
/* Local defined utility functions */ /* Local defined utility functions */
/* do_group utility functions */ /* do_group utility functions */
static void print_group(struct char_data *ch); static void print_group(struct char_data *ch);
static void display_group_list(struct char_data * ch); static void display_group_list(struct char_data *ch);
ACMD(do_quit) ACMD(do_quit)
{ {
@@ -72,7 +72,7 @@ ACMD(do_quit)
ch->desc->snoop_by = NULL; ch->desc->snoop_by = NULL;
} }
extract_char(ch); /* Char is saved before extracting. */ extract_char(ch); /* Char is saved before extracting. */
} }
} }
@@ -109,7 +109,7 @@ ACMD(do_sneak)
if (AFF_FLAGGED(ch, AFF_SNEAK)) if (AFF_FLAGGED(ch, AFF_SNEAK))
affect_from_char(ch, SKILL_SNEAK); affect_from_char(ch, SKILL_SNEAK);
percent = rand_number(1, 101); /* 101% is a complete failure */ percent = rand_number(1, 101); /* 101% is a complete failure */
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;
@@ -135,7 +135,7 @@ ACMD(do_hide)
if (AFF_FLAGGED(ch, AFF_HIDE)) if (AFF_FLAGGED(ch, AFF_HIDE))
REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_HIDE); REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_HIDE);
percent = rand_number(1, 101); /* 101% is a complete failure */ percent = rand_number(1, 101); /* 101% is a complete failure */
if (percent > GET_SKILL(ch, SKILL_HIDE) + dex_app_skill[GET_DEX(ch)].hide) if (percent > GET_SKILL(ch, SKILL_HIDE) + dex_app_skill[GET_DEX(ch)].hide)
return; return;
@@ -173,73 +173,73 @@ ACMD(do_steal)
percent = rand_number(1, 101) - dex_app_skill[GET_DEX(ch)].p_pocket; percent = rand_number(1, 101) - dex_app_skill[GET_DEX(ch)].p_pocket;
if (GET_POS(vict) < POS_SLEEPING) if (GET_POS(vict) < POS_SLEEPING)
percent = -1; /* ALWAYS SUCCESS, unless heavy object. */ percent = -1; /* ALWAYS SUCCESS, unless heavy object. */
if (!CONFIG_PT_ALLOWED && !IS_NPC(vict)) if (!CONFIG_PT_ALLOWED && !IS_NPC(vict))
pcsteal = 1; pcsteal = 1;
if (!AWAKE(vict)) /* Easier to steal from sleeping people. */ if (!AWAKE(vict)) /* Easier to steal from sleeping people. */
percent -= 50; percent -= 50;
/* No stealing if not allowed. If it is no stealing from Imm's or Shopkeepers. */ /* No stealing if not allowed. If it is no stealing from Imm's or Shopkeepers. */
if (GET_LEVEL(vict) >= LVL_IMMORT || pcsteal || GET_MOB_SPEC(vict) == shop_keeper) if (GET_LEVEL(vict) >= LVL_IMMORT || pcsteal || GET_MOB_SPEC(vict) == shop_keeper)
percent = 101; /* Failure */ percent = 101; /* Failure */
if (str_cmp(obj_name, "coins") && str_cmp(obj_name, "gold")) { if (str_cmp(obj_name, "coins") && str_cmp(obj_name, "gold")) {
if (!(obj = get_obj_in_list_vis(ch, obj_name, NULL, vict->carrying))) { if (!(obj = get_obj_in_list_vis(ch, obj_name, NULL, vict->carrying))) {
for (eq_pos = 0; eq_pos < NUM_WEARS; eq_pos++) for (eq_pos = 0; eq_pos < NUM_WEARS; eq_pos++)
if (GET_EQ(vict, eq_pos) && if (GET_EQ(vict, eq_pos) &&
(isname(obj_name, GET_EQ(vict, eq_pos)->name)) && (isname(obj_name, GET_EQ(vict, eq_pos)->name)) &&
CAN_SEE_OBJ(ch, GET_EQ(vict, eq_pos))) { CAN_SEE_OBJ(ch, GET_EQ(vict, eq_pos))) {
obj = GET_EQ(vict, eq_pos); obj = GET_EQ(vict, eq_pos);
break; break;
} }
if (!obj) { if (!obj) {
act("$E hasn't got that item.", FALSE, ch, 0, vict, TO_CHAR); act("$E hasn't got that item.", FALSE, ch, 0, vict, TO_CHAR);
return; return;
} else { /* It is equipment */ } else { /* It is equipment */
if ((GET_POS(vict) > POS_STUNNED)) { if ((GET_POS(vict) > POS_STUNNED)) {
send_to_char(ch, "Steal the equipment now? Impossible!\r\n"); send_to_char(ch, "Steal the equipment now? Impossible!\r\n");
return; return;
} else { } else {
if (!give_otrigger(obj, vict, ch) || if (!give_otrigger(obj, vict, ch) ||
!receive_mtrigger(ch, vict, obj) ) { !receive_mtrigger(ch, vict, obj)) {
send_to_char(ch, "Impossible!\r\n"); send_to_char(ch, "Impossible!\r\n");
return; return;
} }
act("You unequip $p and steal it.", FALSE, ch, obj, 0, TO_CHAR); act("You unequip $p and steal it.", FALSE, ch, obj, 0, TO_CHAR);
act("$n steals $p from $N.", FALSE, ch, obj, vict, TO_NOTVICT); act("$n steals $p from $N.", FALSE, ch, obj, vict, TO_NOTVICT);
obj_to_char(unequip_char(vict, eq_pos), ch); obj_to_char(unequip_char(vict, eq_pos), ch);
} }
} }
} else { /* obj found in inventory */ } else { /* obj found in inventory */
percent += GET_OBJ_WEIGHT(obj); /* Make heavy harder */ percent += GET_OBJ_WEIGHT(obj); /* Make heavy harder */
if (percent > GET_SKILL(ch, SKILL_STEAL)) { if (percent > GET_SKILL(ch, SKILL_STEAL)) {
ohoh = TRUE; ohoh = TRUE;
send_to_char(ch, "Oops..\r\n"); send_to_char(ch, "Oops..\r\n");
act("$n tried to steal something from you!", FALSE, ch, 0, vict, TO_VICT); act("$n tried to steal something from you!", FALSE, ch, 0, vict, TO_VICT);
act("$n tries to steal something from $N.", TRUE, ch, 0, vict, TO_NOTVICT); act("$n tries to steal something from $N.", TRUE, ch, 0, vict, TO_NOTVICT);
} else { /* Steal the item */ } else { /* Steal the item */
if (IS_CARRYING_N(ch) + 1 < CAN_CARRY_N(ch)) { if (IS_CARRYING_N(ch) + 1 < CAN_CARRY_N(ch)) {
if (!give_otrigger(obj, vict, ch) || if (!give_otrigger(obj, vict, ch) ||
!receive_mtrigger(ch, vict, obj) ) { !receive_mtrigger(ch, vict, obj)) {
send_to_char(ch, "Impossible!\r\n"); send_to_char(ch, "Impossible!\r\n");
return; return;
} }
if (IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj) < CAN_CARRY_W(ch)) { if (IS_CARRYING_W(ch) + GET_OBJ_WEIGHT(obj) < CAN_CARRY_W(ch)) {
obj_from_char(obj); obj_from_char(obj);
obj_to_char(obj, ch); obj_to_char(obj, ch);
send_to_char(ch, "Got it!\r\n"); send_to_char(ch, "Got it!\r\n");
} }
} else } else
send_to_char(ch, "You cannot carry that much.\r\n"); send_to_char(ch, "You cannot carry that much.\r\n");
} }
} }
} else { /* Steal some coins */ } else { /* Steal some coins */
if (AWAKE(vict) && (percent > GET_SKILL(ch, SKILL_STEAL))) { if (AWAKE(vict) && (percent > GET_SKILL(ch, SKILL_STEAL))) {
ohoh = TRUE; ohoh = TRUE;
send_to_char(ch, "Oops..\r\n"); send_to_char(ch, "Oops..\r\n");
@@ -250,14 +250,14 @@ ACMD(do_steal)
gold = (GET_GOLD(vict) * rand_number(1, 10)) / 100; gold = (GET_GOLD(vict) * rand_number(1, 10)) / 100;
gold = MIN(1782, gold); gold = MIN(1782, gold);
if (gold > 0) { if (gold > 0) {
increase_gold(ch, gold); increase_gold(ch, gold);
decrease_gold(vict, gold); decrease_gold(vict, gold);
if (gold > 1) if (gold > 1)
send_to_char(ch, "Bingo! You got %d gold coins.\r\n", gold); send_to_char(ch, "Bingo! You got %d gold coins.\r\n", gold);
else else
send_to_char(ch, "You manage to swipe a solitary gold coin.\r\n"); send_to_char(ch, "You manage to swipe a solitary gold coin.\r\n");
} else { } else {
send_to_char(ch, "You couldn't get any gold...\r\n"); send_to_char(ch, "You couldn't get any gold...\r\n");
} }
} }
} }
@@ -317,52 +317,53 @@ ACMD(do_title)
static void print_group(struct char_data *ch) static void print_group(struct char_data *ch)
{ {
struct char_data * k; struct char_data *k;
send_to_char(ch, "Your group consists of:\r\n"); send_to_char(ch, "Your group consists of:\r\n");
while ((k = (struct char_data *) simple_list(ch->group->members)) != NULL) while ((k = (struct char_data *)simple_list(ch->group->members)) != NULL)
send_to_char(ch, "%-*s: %s[%4d/%-4d]H [%4d/%-4d]M [%4d/%-4d]V%s\r\n", send_to_char(ch, "%-*s: %s[%4d/%-4d]H [%4d/%-4d]M [%4d/%-4d]V%s\r\n",
count_color_chars(GET_NAME(k))+22, GET_NAME(k), count_color_chars(GET_NAME(k)) + 22, GET_NAME(k),
GROUP_LEADER(GROUP(ch)) == k ? CBGRN(ch, C_NRM) : CCGRN(ch, C_NRM), GROUP_LEADER(GROUP(ch)) == k ? CBGRN(ch, C_NRM) : CCGRN(ch, C_NRM),
GET_HIT(k), GET_MAX_HIT(k), GET_HIT(k), GET_MAX_HIT(k),
GET_MANA(k), GET_MAX_MANA(k), GET_MANA(k), GET_MAX_MANA(k),
GET_MOVE(k), GET_MAX_MOVE(k), GET_MOVE(k), GET_MAX_MOVE(k),
CCNRM(ch, C_NRM)); CCNRM(ch, C_NRM));
} }
static void display_group_list(struct char_data * ch) static void display_group_list(struct char_data *ch)
{ {
struct group_data * group; struct group_data *group;
int count = 0; int count = 0;
if (group_list->iSize) { if (group_list->iSize) {
send_to_char(ch, "# Group Leader # of Members In Zone\r\n" send_to_char(ch, "# Group Leader # of Members In Zone\r\n"
"---------------------------------------------------\r\n"); "---------------------------------------------------\r\n");
while ((group = (struct group_data *) simple_list(group_list)) != NULL) { while ((group = (struct group_data *)simple_list(group_list)) != NULL) {
if (IS_SET(GROUP_FLAGS(group), GROUP_NPC)) if (IS_SET(GROUP_FLAGS(group), GROUP_NPC))
continue; continue;
if (GROUP_LEADER(group) && !IS_SET(GROUP_FLAGS(group), GROUP_ANON)) if (GROUP_LEADER(group) && !IS_SET(GROUP_FLAGS(group), GROUP_ANON))
send_to_char(ch, "%-2d) %s%-12s %-2d %s%s\r\n", send_to_char(ch, "%-2d) %s%-12s %-2d %s%s\r\n",
++count, ++count,
IS_SET(GROUP_FLAGS(group), GROUP_OPEN) ? CCGRN(ch, C_NRM) : CCRED(ch, C_NRM), IS_SET(GROUP_FLAGS(group), GROUP_OPEN) ? CCGRN(ch, C_NRM) : CCRED(ch, C_NRM),
GET_NAME(GROUP_LEADER(group)), group->members->iSize, zone_table[world[IN_ROOM(GROUP_LEADER(group))].zone].name, GET_NAME(GROUP_LEADER(group)), group->members->iSize,
CCNRM(ch, C_NRM)); zone_table[world[IN_ROOM(GROUP_LEADER(group))].zone].name,
CCNRM(ch, C_NRM));
else else
send_to_char(ch, "%-2d) Hidden\r\n", ++count); send_to_char(ch, "%-2d) Hidden\r\n", ++count);
} }
} }
if (count) if (count)
send_to_char(ch, "\r\n" send_to_char(ch, "\r\n"
"%sSeeking Members%s\r\n" "%sSeeking Members%s\r\n"
"%sClosed%s\r\n", "%sClosed%s\r\n",
CCGRN(ch, C_NRM), CCNRM(ch, C_NRM), CCGRN(ch, C_NRM), CCNRM(ch, C_NRM),
CCRED(ch, C_NRM), CCNRM(ch, C_NRM)); CCRED(ch, C_NRM), CCNRM(ch, C_NRM));
else else
send_to_char(ch, "\r\n" send_to_char(ch, "\r\n"
"Currently no groups formed.\r\n"); "Currently no groups formed.\r\n");
} }
/* Vatiken's Group System: Version 1.1 */ /* Vatiken's Group System: Version 1.1 */
@@ -380,7 +381,7 @@ ACMD(do_group)
send_to_char(ch, "You must specify a group option, or type HELP GROUP for more info.\r\n"); send_to_char(ch, "You must specify a group option, or type HELP GROUP for more info.\r\n");
return; return;
} }
if (is_abbrev(buf, "new")) { if (is_abbrev(buf, "new")) {
if (GROUP(ch)) if (GROUP(ch))
send_to_char(ch, "You are already in a group.\r\n"); send_to_char(ch, "You are already in a group.\r\n");
@@ -405,8 +406,8 @@ ACMD(do_group)
} else if (!IS_SET(GROUP_FLAGS(GROUP(vict)), GROUP_OPEN)) { } else if (!IS_SET(GROUP_FLAGS(GROUP(vict)), GROUP_OPEN)) {
send_to_char(ch, "That group isn't accepting members.\r\n"); send_to_char(ch, "That group isn't accepting members.\r\n");
return; return;
} }
join_group(ch, GROUP(vict)); join_group(ch, GROUP(vict));
} else if (is_abbrev(buf, "kick")) { } else if (is_abbrev(buf, "kick")) {
skip_spaces(&argument); skip_spaces(&argument);
if (!(vict = get_char_vis(ch, argument, NULL, FIND_CHAR_ROOM))) { if (!(vict = get_char_vis(ch, argument, NULL, FIND_CHAR_ROOM))) {
@@ -415,18 +416,18 @@ ACMD(do_group)
} else if (vict == ch) { } else if (vict == ch) {
send_to_char(ch, "There are easier ways to leave the group.\r\n"); send_to_char(ch, "There are easier ways to leave the group.\r\n");
return; return;
} else if (!GROUP(ch) ) { } else if (!GROUP(ch)) {
send_to_char(ch, "But you are not part of a group.\r\n"); send_to_char(ch, "But you are not part of a group.\r\n");
return; return;
} else if (GROUP_LEADER(GROUP(ch)) != ch ) { } else if (GROUP_LEADER(GROUP(ch)) != ch) {
send_to_char(ch, "Only the group's leader can kick members out.\r\n"); send_to_char(ch, "Only the group's leader can kick members out.\r\n");
return; return;
} else if (GROUP(vict) != GROUP(ch)) { } else if (GROUP(vict) != GROUP(ch)) {
act("$E$u is not a member of your group!", FALSE, ch, 0, vict, TO_CHAR); act("$E$u is not a member of your group!", FALSE, ch, 0, vict, TO_CHAR);
return; return;
} }
send_to_char(ch, "You have kicked %s out of the group.\r\n", GET_NAME(vict)); send_to_char(ch, "You have kicked %s out of the group.\r\n", GET_NAME(vict));
send_to_char(vict, "You have been kicked out of the group.\r\n"); send_to_char(vict, "You have been kicked out of the group.\r\n");
leave_group(vict); leave_group(vict);
} else if (is_abbrev(buf, "regroup")) { } else if (is_abbrev(buf, "regroup")) {
if (!GROUP(ch)) { if (!GROUP(ch)) {
@@ -441,12 +442,12 @@ ACMD(do_group)
join_group(ch, GROUP(vict)); join_group(ch, GROUP(vict));
} }
} else if (is_abbrev(buf, "leave")) { } else if (is_abbrev(buf, "leave")) {
if (!GROUP(ch)) { if (!GROUP(ch)) {
send_to_char(ch, "But you aren't part of a group!\r\n"); send_to_char(ch, "But you aren't part of a group!\r\n");
return; return;
} }
leave_group(ch); leave_group(ch);
} else if (is_abbrev(buf, "option")) { } else if (is_abbrev(buf, "option")) {
skip_spaces(&argument); skip_spaces(&argument);
@@ -459,14 +460,16 @@ ACMD(do_group)
} }
if (is_abbrev(argument, "open")) { if (is_abbrev(argument, "open")) {
TOGGLE_BIT(GROUP_FLAGS(GROUP(ch)), GROUP_OPEN); TOGGLE_BIT(GROUP_FLAGS(GROUP(ch)), GROUP_OPEN);
send_to_char(ch, "The group is now %s to new members.\r\n", IS_SET(GROUP_FLAGS(GROUP(ch)), GROUP_OPEN) ? "open" : "closed"); send_to_char(ch, "The group is now %s to new members.\r\n",
IS_SET(GROUP_FLAGS(GROUP(ch)), GROUP_OPEN) ? "open" : "closed");
} else if (is_abbrev(argument, "anonymous")) { } else if (is_abbrev(argument, "anonymous")) {
TOGGLE_BIT(GROUP_FLAGS(GROUP(ch)), GROUP_ANON); TOGGLE_BIT(GROUP_FLAGS(GROUP(ch)), GROUP_ANON);
send_to_char(ch, "The group location is now %s to other players.\r\n", IS_SET(GROUP_FLAGS(GROUP(ch)), GROUP_ANON) ? "invisible" : "visible"); send_to_char(ch, "The group location is now %s to other players.\r\n",
} else IS_SET(GROUP_FLAGS(GROUP(ch)), GROUP_ANON) ? "invisible" : "visible");
} else
send_to_char(ch, "The flag options are: Open, Anonymous\r\n"); send_to_char(ch, "The flag options are: Open, Anonymous\r\n");
} else { } else {
send_to_char(ch, "You must specify a group option, or type HELP GROUP for more info.\r\n"); send_to_char(ch, "You must specify a group option, or type HELP GROUP for more info.\r\n");
} }
} }
@@ -481,10 +484,10 @@ ACMD(do_report)
} }
send_to_group(NULL, group, "%s reports: %d/%dH, %d/%dM, %d/%dV\r\n", send_to_group(NULL, group, "%s reports: %d/%dH, %d/%dM, %d/%dV\r\n",
GET_NAME(ch), GET_NAME(ch),
GET_HIT(ch), GET_MAX_HIT(ch), GET_HIT(ch), GET_MAX_HIT(ch),
GET_MANA(ch), GET_MAX_MANA(ch), GET_MANA(ch), GET_MAX_MANA(ch),
GET_MOVE(ch), GET_MAX_MOVE(ch)); GET_MOVE(ch), GET_MAX_MOVE(ch));
} }
ACMD(do_split) ACMD(do_split)
@@ -493,7 +496,7 @@ ACMD(do_split)
int amount, num = 0, share, rest; int amount, num = 0, share, rest;
size_t len; size_t len;
struct char_data *k; struct char_data *k;
if (IS_NPC(ch)) if (IS_NPC(ch))
return; return;
@@ -509,9 +512,9 @@ ACMD(do_split)
send_to_char(ch, "You don't seem to have that much gold to split.\r\n"); send_to_char(ch, "You don't seem to have that much gold to split.\r\n");
return; return;
} }
if (GROUP(ch)) if (GROUP(ch))
while ((k = (struct char_data *) simple_list(GROUP(ch)->members)) != NULL) while ((k = (struct char_data *)simple_list(GROUP(ch)->members)) != NULL)
if (IN_ROOM(ch) == IN_ROOM(k) && !IS_NPC(k)) if (IN_ROOM(ch) == IN_ROOM(k) && !IS_NPC(k))
num++; num++;
@@ -527,25 +530,25 @@ ACMD(do_split)
/* Abusing signed/unsigned to make sizeof work. */ /* Abusing signed/unsigned to make sizeof work. */
len = snprintf(buf, sizeof(buf), "%s splits %d coins; you receive %d.\r\n", len = snprintf(buf, sizeof(buf), "%s splits %d coins; you receive %d.\r\n",
GET_NAME(ch), amount, share); GET_NAME(ch), amount, share);
if (rest && len < sizeof(buf)) { if (rest && len < sizeof(buf)) {
snprintf(buf + len, sizeof(buf) - len, snprintf(buf + len, sizeof(buf) - len,
"%d coin%s %s not splitable, so %s keeps the money.\r\n", rest, "%d coin%s %s not splitable, so %s keeps the money.\r\n", rest,
(rest == 1) ? "" : "s", (rest == 1) ? "was" : "were", GET_NAME(ch)); (rest == 1) ? "" : "s", (rest == 1) ? "was" : "were", GET_NAME(ch));
} }
while ((k = (struct char_data *) simple_list(GROUP(ch)->members)) != NULL) while ((k = (struct char_data *)simple_list(GROUP(ch)->members)) != NULL)
if (k != ch && IN_ROOM(ch) == IN_ROOM(k) && !IS_NPC(k)) { if (k != ch && IN_ROOM(ch) == IN_ROOM(k) && !IS_NPC(k)) {
increase_gold(k, share); increase_gold(k, share);
send_to_char(k, "%s", buf); send_to_char(k, "%s", buf);
} }
send_to_char(ch, "You split %d coins among %d members -- %d coins each.\r\n", send_to_char(ch, "You split %d coins among %d members -- %d coins each.\r\n",
amount, num, share); amount, num, share);
if (rest) { if (rest) {
send_to_char(ch, "%d coin%s %s not splitable, so you keep the money.\r\n", send_to_char(ch, "%d coin%s %s not splitable, so you keep the money.\r\n",
rest, (rest == 1) ? "" : "s", (rest == 1) ? "was" : "were"); rest, (rest == 1) ? "" : "s", (rest == 1) ? "was" : "were");
} }
} else { } else {
send_to_char(ch, "How many coins do you wish to split with your group?\r\n"); send_to_char(ch, "How many coins do you wish to split with your group?\r\n");
@@ -570,8 +573,8 @@ ACMD(do_use)
case SCMD_RECITE: case SCMD_RECITE:
case SCMD_QUAFF: case SCMD_QUAFF:
if (!(mag_item = get_obj_in_list_vis(ch, arg, NULL, ch->carrying))) { if (!(mag_item = get_obj_in_list_vis(ch, arg, NULL, ch->carrying))) {
send_to_char(ch, "You don't seem to have %s %s.\r\n", AN(arg), arg); send_to_char(ch, "You don't seem to have %s %s.\r\n", AN(arg), arg);
return; return;
} }
break; break;
case SCMD_USE: case SCMD_USE:
@@ -579,8 +582,8 @@ ACMD(do_use)
return; return;
default: default:
log("SYSERR: Unknown subcmd %d passed to do_use.", subcmd); log("SYSERR: Unknown subcmd %d passed to do_use.", subcmd);
/* SYSERR_DESC: This is the same as the unhandled case in do_gen_ps(), /* SYSERR_DESC: This is the same as the unhandled case in do_gen_ps(),
* but in the function which handles 'quaff', 'recite', and 'use'. */ * but in the function which handles 'quaff', 'recite', and 'use'. */
return; return;
} }
} }
@@ -599,7 +602,7 @@ ACMD(do_use)
break; break;
case SCMD_USE: case SCMD_USE:
if ((GET_OBJ_TYPE(mag_item) != ITEM_WAND) && if ((GET_OBJ_TYPE(mag_item) != ITEM_WAND) &&
(GET_OBJ_TYPE(mag_item) != ITEM_STAFF)) { (GET_OBJ_TYPE(mag_item) != ITEM_STAFF)) {
send_to_char(ch, "You can't seem to figure out how to use it.\r\n"); send_to_char(ch, "You can't seem to figure out how to use it.\r\n");
return; return;
} }
@@ -647,16 +650,16 @@ ACMD(do_display)
switch (LOWER(argument[i])) { switch (LOWER(argument[i])) {
case 'h': case 'h':
SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPHP); SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPHP);
break; break;
case 'm': case 'm':
SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPMANA); SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPMANA);
break; break;
case 'v': case 'v':
SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPMOVE); SET_BIT_AR(PRF_FLAGS(ch), PRF_DISPMOVE);
break; break;
default: default:
send_to_char(ch, "Usage: prompt { { H | M | V } | all | auto | none }\r\n"); send_to_char(ch, "Usage: prompt { { H | M | V } | all | auto | none }\r\n");
return; return;
} }
} }
} }
@@ -673,64 +676,64 @@ ACMD(do_gen_tog)
char arg[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH];
const char *tog_messages[][2] = { const char *tog_messages[][2] = {
{"You are now safe from summoning by other players.\r\n", {"You are now safe from summoning by other players.\r\n",
"You may now be summoned by other players.\r\n"}, "You may now be summoned by other players.\r\n"},
{"Nohassle disabled.\r\n", {"Nohassle disabled.\r\n",
"Nohassle enabled.\r\n"}, "Nohassle enabled.\r\n"},
{"Brief mode off.\r\n", {"Brief mode off.\r\n",
"Brief mode on.\r\n"}, "Brief mode on.\r\n"},
{"Compact mode off.\r\n", {"Compact mode off.\r\n",
"Compact mode on.\r\n"}, "Compact mode on.\r\n"},
{"You can now hear tells.\r\n", {"You can now hear tells.\r\n",
"You are now deaf to tells.\r\n"}, "You are now deaf to tells.\r\n"},
{"You can now hear auctions.\r\n", {"You can now hear auctions.\r\n",
"You are now deaf to auctions.\r\n"}, "You are now deaf to auctions.\r\n"},
{"You can now hear shouts.\r\n", {"You can now hear shouts.\r\n",
"You are now deaf to shouts.\r\n"}, "You are now deaf to shouts.\r\n"},
{"You can now hear gossip.\r\n", {"You can now hear gossip.\r\n",
"You are now deaf to gossip.\r\n"}, "You are now deaf to gossip.\r\n"},
{"You can now hear the congratulation messages.\r\n", {"You can now hear the congratulation messages.\r\n",
"You are now deaf to the congratulation messages.\r\n"}, "You are now deaf to the congratulation messages.\r\n"},
{"You can now hear the Wiz-channel.\r\n", {"You can now hear the Wiz-channel.\r\n",
"You are now deaf to the Wiz-channel.\r\n"}, "You are now deaf to the Wiz-channel.\r\n"},
{"You are no longer part of the Quest.\r\n", {"You are no longer part of the Quest.\r\n",
"Okay, you are part of the Quest!\r\n"}, "Okay, you are part of the Quest!\r\n"},
{"You will no longer see the room flags.\r\n", {"You will no longer see the room flags.\r\n",
"You will now see the room flags.\r\n"}, "You will now see the room flags.\r\n"},
{"You will now have your communication repeated.\r\n", {"You will now have your communication repeated.\r\n",
"You will no longer have your communication repeated.\r\n"}, "You will no longer have your communication repeated.\r\n"},
{"HolyLight mode off.\r\n", {"HolyLight mode off.\r\n",
"HolyLight mode on.\r\n"}, "HolyLight mode on.\r\n"},
{"Nameserver_is_slow changed to NO; IP addresses will now be resolved.\r\n", {"Nameserver_is_slow changed to NO; IP addresses will now be resolved.\r\n",
"Nameserver_is_slow changed to YES; sitenames will no longer be resolved.\r\n"}, "Nameserver_is_slow changed to YES; sitenames will no longer be resolved.\r\n"},
{"Autoexits disabled.\r\n", {"Autoexits disabled.\r\n",
"Autoexits enabled.\r\n"}, "Autoexits enabled.\r\n"},
{"Will no longer track through doors.\r\n", {"Will no longer track through doors.\r\n",
"Will now track through doors.\r\n"}, "Will now track through doors.\r\n"},
{"Will no longer clear screen in OLC.\r\n", {"Will no longer clear screen in OLC.\r\n",
"Will now clear screen in OLC.\r\n"}, "Will now clear screen in OLC.\r\n"},
{"Buildwalk Off.\r\n", {"Buildwalk Off.\r\n",
"Buildwalk On.\r\n"}, "Buildwalk On.\r\n"},
{"AFK flag is now off.\r\n", {"AFK flag is now off.\r\n",
"AFK flag is now on.\r\n"}, "AFK flag is now on.\r\n"},
{"Autoloot disabled.\r\n", {"Autoloot disabled.\r\n",
"Autoloot enabled.\r\n"}, "Autoloot enabled.\r\n"},
{"Autogold disabled.\r\n", {"Autogold disabled.\r\n",
"Autogold enabled.\r\n"}, "Autogold enabled.\r\n"},
{"Autosplit disabled.\r\n", {"Autosplit disabled.\r\n",
"Autosplit enabled.\r\n"}, "Autosplit enabled.\r\n"},
{"Autosacrifice disabled.\r\n", {"Autosacrifice disabled.\r\n",
"Autosacrifice enabled.\r\n"}, "Autosacrifice enabled.\r\n"},
{"Autoassist disabled.\r\n", {"Autoassist disabled.\r\n",
"Autoassist enabled.\r\n"}, "Autoassist enabled.\r\n"},
{"Automap disabled.\r\n", {"Automap disabled.\r\n",
"Automap enabled.\r\n"}, "Automap enabled.\r\n"},
{"Autokey disabled.\r\n", {"Autokey disabled.\r\n",
"Autokey enabled.\r\n"}, "Autokey enabled.\r\n"},
{"Autodoor disabled.\r\n", {"Autodoor disabled.\r\n",
"Autodoor enabled.\r\n"}, "Autodoor enabled.\r\n"},
{"ZoneResets disabled.\r\n", {"ZoneResets disabled.\r\n",
"ZoneResets enabled.\r\n"} "ZoneResets enabled.\r\n"}
}; };
if (IS_NPC(ch)) if (IS_NPC(ch))
@@ -784,7 +787,7 @@ ACMD(do_gen_tog)
break; break;
case SCMD_CLS: case SCMD_CLS:
result = PRF_TOG_CHK(ch, PRF_CLS); result = PRF_TOG_CHK(ch, PRF_CLS);
break; break;
case SCMD_BUILDWALK: case SCMD_BUILDWALK:
if (GET_LEVEL(ch) < LVL_BUILDER) { if (GET_LEVEL(ch) < LVL_BUILDER) {
send_to_char(ch, "Builders only, sorry.\r\n"); send_to_char(ch, "Builders only, sorry.\r\n");
@@ -793,14 +796,14 @@ ACMD(do_gen_tog)
result = PRF_TOG_CHK(ch, PRF_BUILDWALK); result = PRF_TOG_CHK(ch, PRF_BUILDWALK);
if (PRF_FLAGGED(ch, PRF_BUILDWALK)) { if (PRF_FLAGGED(ch, PRF_BUILDWALK)) {
one_argument(argument, arg); one_argument(argument, arg);
for (i=0; *arg && *(sector_types[i]) != '\n'; i++) for (i = 0; *arg && *(sector_types[i]) != '\n'; i++)
if (is_abbrev(arg, sector_types[i])) if (is_abbrev(arg, sector_types[i]))
break; break;
if (*(sector_types[i]) == '\n') if (*(sector_types[i]) == '\n')
i=0; i = 0;
GET_BUILDWALK_SECTOR(ch) = i; GET_BUILDWALK_SECTOR(ch) = i;
send_to_char(ch, "Default sector type is %s\r\n", sector_types[i]); send_to_char(ch, "Default sector type is %s\r\n", sector_types[i]);
mudlog(CMP, GET_LEVEL(ch), TRUE, mudlog(CMP, GET_LEVEL(ch), TRUE,
"OLC: %s turned buildwalk on. Allowed zone %d", GET_NAME(ch), GET_OLC_ZONE(ch)); "OLC: %s turned buildwalk on. Allowed zone %d", GET_NAME(ch), GET_OLC_ZONE(ch));
} else } else
@@ -862,30 +865,27 @@ static void show_happyhour(struct char_data *ch)
char happyexp[80], happygold[80], happyqp[80]; char happyexp[80], happygold[80], happyqp[80];
int secs_left; int secs_left;
if ((IS_HAPPYHOUR) || (GET_LEVEL(ch) >= LVL_GRGOD)) if ((IS_HAPPYHOUR) || (GET_LEVEL(ch) >= LVL_GRGOD)) {
{ if (HAPPY_TIME)
if (HAPPY_TIME) secs_left = ((HAPPY_TIME - 1) * SECS_PER_MUD_HOUR) + next_tick;
secs_left = ((HAPPY_TIME - 1) * SECS_PER_MUD_HOUR) + next_tick; else
else secs_left = 0;
secs_left = 0;
sprintf(happyqp, "%s+%d%%%s to Questpoints per quest\r\n", CCYEL(ch, C_NRM), HAPPY_QP, CCNRM(ch, C_NRM)); sprintf(happyqp, "%s+%d%%%s to Questpoints per quest\r\n", CCYEL(ch, C_NRM), HAPPY_QP, CCNRM(ch, C_NRM));
sprintf(happygold, "%s+%d%%%s to Gold gained per kill\r\n", CCYEL(ch, C_NRM), HAPPY_GOLD, CCNRM(ch, C_NRM)); sprintf(happygold, "%s+%d%%%s to Gold gained per kill\r\n", CCYEL(ch, C_NRM), HAPPY_GOLD, CCNRM(ch, C_NRM));
sprintf(happyexp, "%s+%d%%%s to Experience per kill\r\n", CCYEL(ch, C_NRM), HAPPY_EXP, CCNRM(ch, C_NRM)); sprintf(happyexp, "%s+%d%%%s to Experience per kill\r\n", CCYEL(ch, C_NRM), HAPPY_EXP, CCNRM(ch, C_NRM));
send_to_char(ch, "tbaMUD Happy Hour!\r\n" send_to_char(ch, "tbaMUD Happy Hour!\r\n"
"------------------\r\n" "------------------\r\n"
"%s%s%sTime Remaining: %s%d%s hours %s%d%s mins %s%d%s secs\r\n", "%s%s%sTime Remaining: %s%d%s hours %s%d%s mins %s%d%s secs\r\n",
(IS_HAPPYEXP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyexp : "", (IS_HAPPYEXP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyexp : "",
(IS_HAPPYGOLD || (GET_LEVEL(ch) >= LVL_GOD)) ? happygold : "", (IS_HAPPYGOLD || (GET_LEVEL(ch) >= LVL_GOD)) ? happygold : "",
(IS_HAPPYQP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyqp : "", (IS_HAPPYQP || (GET_LEVEL(ch) >= LVL_GOD)) ? happyqp : "",
CCYEL(ch, C_NRM), (secs_left / 3600), CCNRM(ch, C_NRM), CCYEL(ch, C_NRM), (secs_left / 3600), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), (secs_left % 3600) / 60, CCNRM(ch, C_NRM), CCYEL(ch, C_NRM), (secs_left % 3600) / 60, CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), (secs_left % 60), CCNRM(ch, C_NRM) ); CCYEL(ch, C_NRM), (secs_left % 60), CCNRM(ch, C_NRM));
} } else {
else send_to_char(ch, "Sorry, there is currently no happy hour!\r\n");
{
send_to_char(ch, "Sorry, there is currently no happy hour!\r\n");
} }
} }
@@ -894,8 +894,7 @@ ACMD(do_happyhour)
char arg[MAX_INPUT_LENGTH], val[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH], val[MAX_INPUT_LENGTH];
int num; int num;
if (GET_LEVEL(ch) < LVL_GOD) if (GET_LEVEL(ch) < LVL_GOD) {
{
show_happyhour(ch); show_happyhour(ch);
return; return;
} }
@@ -903,20 +902,15 @@ ACMD(do_happyhour)
/* Only Imms get here, so check args */ /* Only Imms get here, so check args */
two_arguments(argument, arg, val); two_arguments(argument, arg, val);
if (is_abbrev(arg, "experience")) if (is_abbrev(arg, "experience")) {
{
num = MIN(MAX((atoi(val)), 0), 1000); num = MIN(MAX((atoi(val)), 0), 1000);
HAPPY_EXP = num; HAPPY_EXP = num;
send_to_char(ch, "Happy Hour Exp rate set to +%d%%\r\n", HAPPY_EXP); send_to_char(ch, "Happy Hour Exp rate set to +%d%%\r\n", HAPPY_EXP);
} } else if ((is_abbrev(arg, "gold")) || (is_abbrev(arg, "coins"))) {
else if ((is_abbrev(arg, "gold")) || (is_abbrev(arg, "coins")))
{
num = MIN(MAX((atoi(val)), 0), 1000); num = MIN(MAX((atoi(val)), 0), 1000);
HAPPY_GOLD = num; HAPPY_GOLD = num;
send_to_char(ch, "Happy Hour Gold rate set to +%d%%\r\n", HAPPY_GOLD); send_to_char(ch, "Happy Hour Gold rate set to +%d%%\r\n", HAPPY_GOLD);
} } else if ((is_abbrev(arg, "time")) || (is_abbrev(arg, "ticks"))) {
else if ((is_abbrev(arg, "time")) || (is_abbrev(arg, "ticks")))
{
num = MIN(MAX((atoi(val)), 0), 1000); num = MIN(MAX((atoi(val)), 0), 1000);
if (HAPPY_TIME && !num) if (HAPPY_TIME && !num)
game_info("Happyhour has been stopped!"); game_info("Happyhour has been stopped!");
@@ -925,47 +919,39 @@ ACMD(do_happyhour)
HAPPY_TIME = num; HAPPY_TIME = num;
send_to_char(ch, "Happy Hour Time set to %d ticks (%d hours %d mins and %d secs)\r\n", send_to_char(ch, "Happy Hour Time set to %d ticks (%d hours %d mins and %d secs)\r\n",
HAPPY_TIME, HAPPY_TIME,
(HAPPY_TIME*SECS_PER_MUD_HOUR)/3600, (HAPPY_TIME * SECS_PER_MUD_HOUR) / 3600,
((HAPPY_TIME*SECS_PER_MUD_HOUR)%3600) / 60, ((HAPPY_TIME * SECS_PER_MUD_HOUR) % 3600) / 60,
(HAPPY_TIME*SECS_PER_MUD_HOUR)%60 ); (HAPPY_TIME * SECS_PER_MUD_HOUR) % 60);
} } else if ((is_abbrev(arg, "qp")) || (is_abbrev(arg, "questpoints"))) {
else if ((is_abbrev(arg, "qp")) || (is_abbrev(arg, "questpoints")))
{
num = MIN(MAX((atoi(val)), 0), 1000); num = MIN(MAX((atoi(val)), 0), 1000);
HAPPY_QP = num; HAPPY_QP = num;
send_to_char(ch, "Happy Hour Questpoints rate set to +%d%%\r\n", HAPPY_QP); send_to_char(ch, "Happy Hour Questpoints rate set to +%d%%\r\n", HAPPY_QP);
} } else if (is_abbrev(arg, "show")) {
else if (is_abbrev(arg, "show"))
{
show_happyhour(ch); show_happyhour(ch);
} } else if (is_abbrev(arg, "default")) {
else if (is_abbrev(arg, "default"))
{
HAPPY_EXP = 100; HAPPY_EXP = 100;
HAPPY_GOLD = 50; HAPPY_GOLD = 50;
HAPPY_QP = 50; HAPPY_QP = 50;
HAPPY_TIME = 48; HAPPY_TIME = 48;
game_info("A Happyhour has started!"); game_info("A Happyhour has started!");
} } else {
else
{
send_to_char(ch, "Usage: %shappyhour %s- show usage (this info)\r\n" send_to_char(ch, "Usage: %shappyhour %s- show usage (this info)\r\n"
" %shappyhour show %s- display current settings (what mortals see)\r\n" " %shappyhour show %s- display current settings (what mortals see)\r\n"
" %shappyhour time <ticks> %s- set happyhour time and start timer\r\n" " %shappyhour time <ticks> %s- set happyhour time and start timer\r\n"
" %shappyhour qp <num> %s- set qp percentage gain\r\n" " %shappyhour qp <num> %s- set qp percentage gain\r\n"
" %shappyhour exp <num> %s- set exp percentage gain\r\n" " %shappyhour exp <num> %s- set exp percentage gain\r\n"
" %shappyhour gold <num> %s- set gold percentage gain\r\n" " %shappyhour gold <num> %s- set gold percentage gain\r\n"
" \tyhappyhour default \tw- sets a default setting for happyhour\r\n\r\n" " \tyhappyhour default \tw- sets a default setting for happyhour\r\n\r\n"
"Configure the happyhour settings and start a happyhour.\r\n" "Configure the happyhour settings and start a happyhour.\r\n"
"Currently 1 hour IRL = %d ticks\r\n" "Currently 1 hour IRL = %d ticks\r\n"
"If no number is specified, 0 (off) is assumed.\r\nThe command \tyhappyhour time\tn will therefore stop the happyhour timer.\r\n", "If no number is specified, 0 (off) is assumed.\r\nThe command \tyhappyhour time\tn will therefore stop the happyhour timer.\r\n",
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
CCYEL(ch, C_NRM), CCNRM(ch, C_NRM), CCYEL(ch, C_NRM), CCNRM(ch, C_NRM),
(3600 / SECS_PER_MUD_HOUR) ); (3600 / SECS_PER_MUD_HOUR));
} }
} }

View File

@@ -65,7 +65,8 @@ ACMD(do_action)
if (!vict) { if (!vict) {
if (action->char_obj_found) { if (action->char_obj_found) {
targ = get_obj_in_list_vis(ch, arg, NULL, ch->carrying); targ = get_obj_in_list_vis(ch, arg, NULL, ch->carrying);
if (!targ) targ = get_obj_in_list_vis(ch, arg, NULL, world[IN_ROOM(ch)].contents); if (!targ)
targ = get_obj_in_list_vis(ch, arg, NULL, world[IN_ROOM(ch)].contents);
if (targ) { if (targ) {
act(action->char_obj_found, action->hide, ch, targ, 0, TO_CHAR); act(action->char_obj_found, action->hide, ch, targ, 0, TO_CHAR);
act(action->others_obj_found, action->hide, ch, targ, 0, TO_ROOM); act(action->others_obj_found, action->hide, ch, targ, 0, TO_ROOM);
@@ -128,7 +129,8 @@ void create_command_list(void)
/* count the commands in the command list */ /* count the commands in the command list */
i = 0; i = 0;
while(*cmd_info[i].command != '\n') i++; while (*cmd_info[i].command != '\n')
i++;
i++; i++;
CREATE(complete_cmd_info, struct command_info, top_of_socialt + i + 2); CREATE(complete_cmd_info, struct command_info, top_of_socialt + i + 2);
@@ -137,21 +139,21 @@ void create_command_list(void)
i = 0; i = 0;
j = 0; j = 0;
k = 0; k = 0;
while ((*cmd_info[i].command != '\n') || (j <= top_of_socialt)) { while ((*cmd_info[i].command != '\n') || (j <= top_of_socialt)) {
if ((i < RESERVE_CMDS) || (j > top_of_socialt) || if ((i < RESERVE_CMDS) || (j > top_of_socialt) ||
(str_cmp(cmd_info[i].sort_as, soc_mess_list[j].sort_as) < 1)) (str_cmp(cmd_info[i].sort_as, soc_mess_list[j].sort_as) < 1))
complete_cmd_info[k++] = cmd_info[i++]; complete_cmd_info[k++] = cmd_info[i++];
else { else {
soc_mess_list[j].act_nr = k; soc_mess_list[j].act_nr = k;
complete_cmd_info[k].command = soc_mess_list[j].command; complete_cmd_info[k].command = soc_mess_list[j].command;
complete_cmd_info[k].sort_as = soc_mess_list[j].sort_as; complete_cmd_info[k].sort_as = soc_mess_list[j].sort_as;
complete_cmd_info[k].minimum_position = soc_mess_list[j].min_char_position; complete_cmd_info[k].minimum_position = soc_mess_list[j].min_char_position;
complete_cmd_info[k].command_pointer = do_action; complete_cmd_info[k].command_pointer = do_action;
complete_cmd_info[k].minimum_level = soc_mess_list[j++].min_level_char; complete_cmd_info[k].minimum_level = soc_mess_list[j++].min_level_char;
complete_cmd_info[k++].subcmd = 0; complete_cmd_info[k++].subcmd = 0;
} }
} }
complete_cmd_info[k] = cmd_info[i]; complete_cmd_info[k] = cmd_info[i];
log("Command info rebuilt, %d total commands.", k); log("Command info rebuilt, %d total commands.", k);
} }
@@ -166,29 +168,45 @@ void free_social_messages(void)
struct social_messg *mess; struct social_messg *mess;
int i; int i;
for (i = 0;i <= top_of_socialt;i++) { for (i = 0; i <= top_of_socialt; i++) {
mess = &soc_mess_list[i]; mess = &soc_mess_list[i];
free_action(mess); free_action(mess);
} }
free(soc_mess_list); free(soc_mess_list);
} }
void free_action(struct social_messg *mess) { void free_action(struct social_messg *mess)
if (mess->command) free(mess->command); {
if (mess->sort_as) free(mess->sort_as); if (mess->command)
if (mess->char_no_arg) free(mess->char_no_arg); free(mess->command);
if (mess->others_no_arg) free(mess->others_no_arg); if (mess->sort_as)
if (mess->char_found) free(mess->char_found); free(mess->sort_as);
if (mess->others_found) free(mess->others_found); if (mess->char_no_arg)
if (mess->vict_found) free(mess->vict_found); free(mess->char_no_arg);
if (mess->char_body_found) free(mess->char_body_found); if (mess->others_no_arg)
if (mess->others_body_found) free(mess->others_body_found); free(mess->others_no_arg);
if (mess->vict_body_found) free(mess->vict_body_found); if (mess->char_found)
if (mess->not_found) free(mess->not_found); free(mess->char_found);
if (mess->char_auto) free(mess->char_auto); if (mess->others_found)
if (mess->others_auto) free(mess->others_auto); free(mess->others_found);
if (mess->char_obj_found) free(mess->char_obj_found); if (mess->vict_found)
if (mess->others_obj_found) free(mess->others_obj_found); free(mess->vict_found);
if (mess->char_body_found)
free(mess->char_body_found);
if (mess->others_body_found)
free(mess->others_body_found);
if (mess->vict_body_found)
free(mess->vict_body_found);
if (mess->not_found)
free(mess->not_found);
if (mess->char_auto)
free(mess->char_auto);
if (mess->others_auto)
free(mess->others_auto);
if (mess->char_obj_found)
free(mess->char_obj_found);
if (mess->others_obj_found)
free(mess->others_obj_found);
memset(mess, 0, sizeof(struct social_messg)); memset(mess, 0, sizeof(struct social_messg));
} }
@@ -226,7 +244,7 @@ ACMD(do_gmote)
half_chop(argument, buf, arg); half_chop(argument, buf, arg);
if(subcmd) if (subcmd)
for (length = strlen(buf), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++) for (length = strlen(buf), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++)
if (!strncmp(complete_cmd_info[cmd].command, buf, length)) if (!strncmp(complete_cmd_info[cmd].command, buf, length))
break; break;
@@ -242,13 +260,13 @@ ACMD(do_gmote)
return; return;
} }
action = &soc_mess_list[act_nr]; action = &soc_mess_list[act_nr];
if (!action->char_found) if (!action->char_found)
*arg = '\0'; *arg = '\0';
if (!*arg) { if (!*arg) {
if(!action->others_no_arg || !*action->others_no_arg) { if (!action->others_no_arg || !*action->others_no_arg) {
send_to_char(ch, "Who are you going to do that to?\r\n"); send_to_char(ch, "Who are you going to do that to?\r\n");
return; return;
} }
@@ -257,7 +275,7 @@ action = &soc_mess_list[act_nr];
send_to_char(ch, "%s\r\n", action->not_found); send_to_char(ch, "%s\r\n", action->not_found);
return; return;
} else if (vict == ch) { } else if (vict == ch) {
if(!action->others_auto || !*action->others_auto) { if (!action->others_auto || !*action->others_auto) {
send_to_char(ch, "%s\r\n", action->char_auto); send_to_char(ch, "%s\r\n", action->char_auto);
return; return;
} }
@@ -265,7 +283,7 @@ action = &soc_mess_list[act_nr];
} else { } else {
if (GET_POS(vict) < action->min_victim_position) { if (GET_POS(vict) < action->min_victim_position) {
act("$N is not in a proper position for that.", act("$N is not in a proper position for that.",
FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP); FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
return; return;
} }
snprintf(buf, sizeof(buf), "Gemote: %s", action->others_found); snprintf(buf, sizeof(buf), "Gemote: %s", action->others_found);

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -59,17 +59,17 @@ struct time_info_data *mud_time_passed(time_t t2, time_t t1);
void prune_crlf(char *txt); void prune_crlf(char *txt);
void column_list(struct char_data *ch, int num_cols, const char **list, int list_length, bool show_nums); void column_list(struct char_data *ch, int num_cols, const char **list, int list_length, bool show_nums);
int get_flag_by_name(const char *flag_list[], char *flag_name); int get_flag_by_name(const char *flag_list[], char *flag_name);
int file_head( FILE *file, char *buf, size_t bufsize, int lines_to_read ); int file_head(FILE *file, char *buf, size_t bufsize, int lines_to_read);
int file_tail( FILE *file, char *buf, size_t bufsize, int lines_to_read ); int file_tail(FILE *file, char *buf, size_t bufsize, int lines_to_read);
size_t file_sizeof( FILE *file ); size_t file_sizeof(FILE *file);
int file_numlines( FILE *file ); 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); void new_affect(struct affected_type *af);
int get_class_by_name(char *classname); int get_class_by_name(char *classname);
char * convert_from_tabs(char * string); char *convert_from_tabs(char *string);
int count_non_protocol_chars(char * str); int count_non_protocol_chars(char *str);
char *right_trim_whitespace(const char *string); char *right_trim_whitespace(const char *string);
void remove_from_string(char *string, const char *to_remove); void remove_from_string(char *string, const char *to_remove);
@@ -139,7 +139,7 @@ int increase_bank(struct char_data *ch, int amt);
int decrease_bank(struct char_data *ch, int amt); int decrease_bank(struct char_data *ch, int amt);
/* in class.c */ /* in class.c */
void advance_level(struct char_data *ch); void advance_level(struct char_data *ch);
void char_from_furniture(struct char_data *ch); void char_from_furniture(struct char_data *ch);
/** What ch is currently sitting on. */ /** What ch is currently sitting on. */
@@ -255,8 +255,7 @@ void char_from_furniture(struct char_data *ch);
temp = temp->next; \ temp = temp->next; \
if (temp) \ if (temp) \
temp->next = (item)->next; \ temp->next = (item)->next; \
} \ }
/* Connect 'link' to the end of a double-linked list /* Connect 'link' to the end of a double-linked list
* The new item becomes the last in the linked list, and the last * The new item becomes the last in the linked list, and the last
* pointer is updated. * pointer is updated.