Just some cosmetic code cleanup

This commit is contained in:
Vatiken
2012-06-19 21:11:14 +00:00
parent 12c506c89a
commit 58ec913b46
12 changed files with 230 additions and 254 deletions

View File

@@ -26,15 +26,15 @@ 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++;
} }
return TRUE; return TRUE;
} }
ACMD(do_say) ACMD(do_say)

View File

@@ -505,16 +505,11 @@ void look_at_room(struct char_data *ch, int ignore_brief)
send_to_char(ch, "%s\r\n", CCNRM(ch, C_NRM)); send_to_char(ch, "%s\r\n", CCNRM(ch, C_NRM));
if ((!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_BRIEF)) || ignore_brief || if ((!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_BRIEF)) || ignore_brief ||
ROOM_FLAGGED(IN_ROOM(ch), ROOM_DEATH)) ROOM_FLAGGED(IN_ROOM(ch), ROOM_DEATH)) {
{ if(!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOMAP) && can_see_map(ch))
if(!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOMAP) && can_see_map(ch))
{
str_and_map(world[target_room].description, ch, target_room); str_and_map(world[target_room].description, ch, target_room);
} else
else send_to_char(ch, "%s", world[IN_ROOM(ch)].description);
{
send_to_char(ch, "%s", world[IN_ROOM(ch)].description);
}
} }
/* autoexits */ /* autoexits */
@@ -1040,7 +1035,7 @@ int search_help(const char *argument, int level)
// if (strn_cmp(argument, help_table[mid].keywords, minlen) || level < help_table[mid].min_level) // if (strn_cmp(argument, help_table[mid].keywords, minlen) || level < help_table[mid].min_level)
if (strn_cmp(argument, help_table[mid].keywords, minlen)) if (strn_cmp(argument, help_table[mid].keywords, minlen))
break; break;
return mid; return mid;
} }
@@ -1481,8 +1476,7 @@ ACMD(do_users)
sprintf(line2, "%s%s%s", CCGRN(ch, C_SPR), line, CCNRM(ch, C_SPR)); sprintf(line2, "%s%s%s", CCGRN(ch, C_SPR), line, CCNRM(ch, C_SPR));
strcpy(line, line2); strcpy(line, line2);
} }
if (STATE(d) != CON_PLAYING || if (STATE(d) != CON_PLAYING || (STATE(d) == CON_PLAYING && CAN_SEE(ch, d->character))) {
(STATE(d) == CON_PLAYING && CAN_SEE(ch, d->character))) {
send_to_char(ch, "%s", line); send_to_char(ch, "%s", line);
num_can_see++; num_can_see++;
} }
@@ -2035,7 +2029,7 @@ ACMD(do_toggle)
return; return;
} }
len = strlen(arg); len = strlen(arg);
for (toggle = 0; *tog_messages[toggle].command != '\n'; toggle++) for (toggle = 0; *tog_messages[toggle].command != '\n'; toggle++)
if (!strncmp(arg, tog_messages[toggle].command, len)) if (!strncmp(arg, tog_messages[toggle].command, len))
break; break;
@@ -2043,7 +2037,7 @@ ACMD(do_toggle)
if (*tog_messages[toggle].command == '\n' || tog_messages[toggle].min_level > GET_LEVEL(ch)) { if (*tog_messages[toggle].command == '\n' || tog_messages[toggle].min_level > GET_LEVEL(ch)) {
send_to_char(ch, "You can't toggle that!\r\n"); send_to_char(ch, "You can't toggle that!\r\n");
return; return;
} }
switch (toggle) { switch (toggle) {
case SCMD_COLOR: case SCMD_COLOR:
@@ -2093,13 +2087,13 @@ ACMD(do_toggle)
} }
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)) {
for (i=0; *arg2 && *(sector_types[i]) != '\n'; i++) for (i=0; *arg2 && *(sector_types[i]) != '\n'; i++)
if (is_abbrev(arg2, sector_types[i])) if (is_abbrev(arg2, 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
@@ -2393,40 +2387,29 @@ ACMD(do_whois)
send_to_char(ch, "Level: %d\r\n", GET_LEVEL(victim)); send_to_char(ch, "Level: %d\r\n", GET_LEVEL(victim));
if (!(GET_LEVEL(victim) < LVL_IMMORT) || (GET_LEVEL(ch) >= GET_LEVEL(victim))) if (!(GET_LEVEL(victim) < LVL_IMMORT) || (GET_LEVEL(ch) >= GET_LEVEL(victim))) {
{
strcpy (buf, (char *) asctime(localtime(&(victim->player.time.logon)))); strcpy (buf, (char *) asctime(localtime(&(victim->player.time.logon))));
buf[10] = '\0'; buf[10] = '\0';
hours = (time(0) - victim->player.time.logon) / 3600; hours = (time(0) - victim->player.time.logon) / 3600;
if (!got_from_file) if (!got_from_file) {
{
send_to_char(ch, "Last Logon: They're playing now! (Idle %d Minutes)", send_to_char(ch, "Last Logon: They're playing now! (Idle %d Minutes)",
victim->char_specials.timer * SECS_PER_MUD_HOUR / SECS_PER_REAL_MIN); victim->char_specials.timer * SECS_PER_MUD_HOUR / SECS_PER_REAL_MIN);
if (!victim->desc) if (!victim->desc)
{
send_to_char(ch, " (Linkless)\r\n"); send_to_char(ch, " (Linkless)\r\n");
}
else else
{
send_to_char(ch, "\r\n"); send_to_char(ch, "\r\n");
}
if (PRF_FLAGGED(victim, PRF_AFK)) if (PRF_FLAGGED(victim, PRF_AFK))
{
send_to_char(ch, "%s%s is afk right now, so %s may not respond to communication.%s\r\n", CBGRN(ch, C_NRM), GET_NAME(victim), GET_SEX(victim) == SEX_NEUTRAL ? "it" : (GET_SEX(victim) == SEX_MALE ? "he" : "she"), CCNRM(ch, C_NRM)); send_to_char(ch, "%s%s is afk right now, so %s may not respond to communication.%s\r\n", CBGRN(ch, C_NRM), GET_NAME(victim), GET_SEX(victim) == SEX_NEUTRAL ? "it" : (GET_SEX(victim) == SEX_MALE ? "he" : "she"), CCNRM(ch, C_NRM));
}
} }
else if (hours > 0) else if (hours > 0)
{
send_to_char(ch, "Last Logon: %s (%d days & %d hours ago.)\r\n", buf, hours/24, hours%24); send_to_char(ch, "Last Logon: %s (%d days & %d hours ago.)\r\n", buf, hours/24, hours%24);
}
else else
{
send_to_char(ch, "Last Logon: %s (0 hours & %d minutes ago.)\r\n", send_to_char(ch, "Last Logon: %s (0 hours & %d minutes ago.)\r\n",
buf, (int)(time(0) - victim->player.time.logon)/60); buf, (int)(time(0) - victim->player.time.logon)/60);
}
} }
if (has_mail(GET_IDNUM(victim))) if (has_mail(GET_IDNUM(victim)))

View File

@@ -385,19 +385,19 @@ 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);
else { else {
send_to_char(ch, "I see no %s there.\r\n", type); send_to_char(ch, "I see no %s there.\r\n", type);
return (-1); return (-1);
} }
} else } else
return (door); return (door);
@@ -530,7 +530,7 @@ static void do_doorcmd(struct char_data *ch, struct obj_data *obj, int door, int
if (!obj && ((other_room = EXIT(ch, door)->to_room) != NOWHERE)) if (!obj && ((other_room = EXIT(ch, door)->to_room) != NOWHERE))
if ((back = world[other_room].dir_option[rev_dir[door]]) != NULL) if ((back = world[other_room].dir_option[rev_dir[door]]) != NULL)
if (back->to_room != IN_ROOM(ch)) if (back->to_room != IN_ROOM(ch))
back = NULL; back = NULL;
switch (scmd) { switch (scmd) {
case SCMD_OPEN: case SCMD_OPEN:
@@ -573,15 +573,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)
@@ -646,14 +646,11 @@ ACMD(do_gen_door)
keynum = DOOR_KEY(ch, obj, door); keynum = DOOR_KEY(ch, obj, door);
if (!(DOOR_IS_OPENABLE(ch, obj, door))) if (!(DOOR_IS_OPENABLE(ch, obj, door)))
send_to_char(ch, "You can't %s that!\r\n", cmd_door[subcmd]); send_to_char(ch, "You can't %s that!\r\n", cmd_door[subcmd]);
else if (!DOOR_IS_OPEN(ch, obj, door) && else if (!DOOR_IS_OPEN(ch, obj, door) && IS_SET(flags_door[subcmd], NEED_OPEN))
IS_SET(flags_door[subcmd], NEED_OPEN))
send_to_char(ch, "But it's already closed!\r\n"); send_to_char(ch, "But it's already closed!\r\n");
else if (!DOOR_IS_CLOSED(ch, obj, door) && else if (!DOOR_IS_CLOSED(ch, obj, door) && IS_SET(flags_door[subcmd], NEED_CLOSED))
IS_SET(flags_door[subcmd], NEED_CLOSED))
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)) && else if (!(DOOR_IS_LOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_LOCKED))
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)) )
{ {
@@ -665,12 +662,10 @@ ACMD(do_gen_door)
{ {
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)) && else if (!(DOOR_IS_UNLOCKED(ch, obj, door)) && IS_SET(flags_door[subcmd], NEED_UNLOCKED) &&
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) && else if (!has_key(ch, keynum) && (GET_LEVEL(ch) < LVL_GOD) && ((subcmd == SCMD_LOCK) || (subcmd == SCMD_UNLOCK)))
((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");
else if (ok_pick(ch, keynum, DOOR_IS_PICKPROOF(ch, obj, door), subcmd)) else if (ok_pick(ch, keynum, DOOR_IS_PICKPROOF(ch, obj, door), subcmd))
do_doorcmd(ch, obj, door, subcmd); do_doorcmd(ch, obj, door, subcmd);
@@ -689,11 +684,11 @@ ACMD(do_enter)
* keyword */ * keyword */
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 (EXIT(ch, door)->keyword)
if (!str_cmp(EXIT(ch, door)->keyword, buf)) { if (!str_cmp(EXIT(ch, door)->keyword, buf)) {
perform_move(ch, door, 1); perform_move(ch, door, 1);
return; return;
} }
send_to_char(ch, "There is no %s here.\r\n", buf); send_to_char(ch, "There is no %s here.\r\n", buf);
} else if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_INDOORS)) } else if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_INDOORS))
send_to_char(ch, "You are already indoors.\r\n"); send_to_char(ch, "You are already indoors.\r\n");
@@ -959,17 +954,17 @@ ACMD(do_follow)
} 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");
return; return;
} }
stop_follower(ch); stop_follower(ch);
} else { } else {
if (circle_follow(ch, leader)) { if (circle_follow(ch, leader)) {
send_to_char(ch, "Sorry, but following in loops is not allowed.\r\n"); send_to_char(ch, "Sorry, but following in loops is not allowed.\r\n");
return; return;
} }
if (ch->master) if (ch->master)
stop_follower(ch); stop_follower(ch);
REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_GROUP); REMOVE_BIT_AR(AFF_FLAGS(ch), AFF_GROUP);
add_follower(ch, leader); add_follower(ch, leader);
} }

View File

@@ -83,7 +83,7 @@ ACMD(do_hit)
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 */
@@ -203,10 +203,10 @@ ACMD(do_order)
act("$n gives $N an order.", FALSE, ch, 0, vict, TO_ROOM); act("$n gives $N an order.", FALSE, ch, 0, vict, TO_ROOM);
if ((vict->master != ch) || !AFF_FLAGGED(vict, AFF_CHARM)) if ((vict->master != ch) || !AFF_FLAGGED(vict, AFF_CHARM))
act("$n has an indifferent look.", FALSE, vict, 0, 0, TO_ROOM); act("$n has an indifferent look.", FALSE, vict, 0, 0, TO_ROOM);
else { else {
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];
@@ -215,16 +215,16 @@ ACMD(do_order)
act(buf, FALSE, ch, 0, 0, TO_ROOM); act(buf, FALSE, ch, 0, 0, TO_ROOM);
for (k = ch->followers; k; k = k->next) { for (k = ch->followers; k; k = k->next) {
if (IN_ROOM(ch) == IN_ROOM(k->follower)) if (IN_ROOM(ch) == IN_ROOM(k->follower))
if (AFF_FLAGGED(k->follower, AFF_CHARM)) { if (AFF_FLAGGED(k->follower, AFF_CHARM)) {
found = TRUE; found = TRUE;
command_interpreter(k->follower, message); command_interpreter(k->follower, message);
} }
} }
if (found) if (found)
send_to_char(ch, "%s", CONFIG_OK); send_to_char(ch, "%s", CONFIG_OK);
else else
send_to_char(ch, "Nobody here is a loyal subject of yours!\r\n"); send_to_char(ch, "Nobody here is a loyal subject of yours!\r\n");
} }
} }
} }

View File

@@ -811,15 +811,15 @@ 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

View File

@@ -2719,7 +2719,7 @@ ACMD(do_show)
/* show thaco */ /* show thaco */
case 11: case 11:
len = strlcpy(buf, "LvL - Mu Cl Th Wa\r\n----------------\r\n", sizeof(buf)); len = strlcpy(buf, "LvL - Mu Cl Th Wa\r\n----------------\r\n", sizeof(buf));
for (j = 1; j < LVL_IMMORT; j++) { for (j = 1; j < LVL_IMMORT; j++) {
nlen = snprintf(buf + len, sizeof(buf) - len, "%-3d - %-2d %-2d %-2d %-2d\r\n", j, nlen = snprintf(buf + len, sizeof(buf) - len, "%-3d - %-2d %-2d %-2d %-2d\r\n", j,
thaco(CLASS_MAGIC_USER, j), thaco(CLASS_MAGIC_USER, j),
@@ -2728,43 +2728,43 @@ ACMD(do_show)
thaco(CLASS_WARRIOR, j)); thaco(CLASS_WARRIOR, j));
if (len + nlen >= sizeof(buf)) if (len + nlen >= sizeof(buf))
break; break;
len += nlen; len += nlen;
} }
page_string(ch->desc, buf, TRUE); page_string(ch->desc, buf, TRUE);
break; break;
/* show experience tables */ /* show experience tables */
case 12: case 12:
len = strlcpy(buf, "LvL - Mu Cl Th Wa\r\n--------------------------\r\n", sizeof(buf)); len = strlcpy(buf, "LvL - Mu Cl Th Wa\r\n--------------------------\r\n", sizeof(buf));
for (i = 1; i < LVL_IMMORT; i++) { for (i = 1; i < LVL_IMMORT; i++) {
nlen = snprintf(buf + len, sizeof(buf) - len, "%-3d - %-6d %-6d %-6d %-6d\r\n", i, nlen = snprintf(buf + len, sizeof(buf) - len, "%-3d - %-6d %-6d %-6d %-6d\r\n", i,
level_exp(CLASS_MAGIC_USER, i) - level_exp(CLASS_MAGIC_USER, i - 1), level_exp(CLASS_MAGIC_USER, i) - level_exp(CLASS_MAGIC_USER, i - 1),
level_exp(CLASS_CLERIC, i) - level_exp(CLASS_CLERIC, i - 1), level_exp(CLASS_CLERIC, i) - level_exp(CLASS_CLERIC, i - 1),
level_exp(CLASS_THIEF, i) - level_exp(CLASS_THIEF, i - 1), level_exp(CLASS_THIEF, i) - level_exp(CLASS_THIEF, i - 1),
level_exp(CLASS_WARRIOR, i) - level_exp(CLASS_WARRIOR, i - 1)); level_exp(CLASS_WARRIOR, i) - level_exp(CLASS_WARRIOR, i - 1));
if (len + nlen >= sizeof(buf)) if (len + nlen >= sizeof(buf))
break; break;
len += nlen; len += nlen;
} }
page_string(ch->desc, buf, TRUE); page_string(ch->desc, buf, TRUE);
break; break;
case 13: case 13:
len = strlcpy(buf, "Colours\r\n--------------------------\r\n", sizeof(buf)); len = strlcpy(buf, "Colours\r\n--------------------------\r\n", sizeof(buf));
k = 0; k = 0;
for (r = 0; r < 6; r++) for (r = 0; r < 6; r++)
for (g = 0; g < 6; g++) for (g = 0; g < 6; g++)
for (b = 0; b < 6; b++) { for (b = 0; b < 6; b++) {
sprintf(colour, "F%d%d%d", r, g, b); sprintf(colour, "F%d%d%d", r, g, b);
nlen = snprintf(buf + len, sizeof(buf) - len, "%s%s%s", ColourRGB(ch->desc, colour), colour, ++k % 6 == 0 ? "\tn\r\n" : " "); nlen = snprintf(buf + len, sizeof(buf) - len, "%s%s%s", ColourRGB(ch->desc, colour), colour, ++k % 6 == 0 ? "\tn\r\n" : " ");
if (len + nlen >= sizeof(buf)) if (len + nlen >= sizeof(buf))
break; break;
len += nlen; len += nlen;
} }
page_string(ch->desc, buf, TRUE); page_string(ch->desc, buf, TRUE);
break; break;
/* show what? */ /* show what? */

View File

@@ -86,7 +86,7 @@ int item_in_list(char *item, obj_data *list)
int count = 0; int count = 0;
if (!item || !*item) if (!item || !*item)
return 0; return 0;
if (*item == UID_CHAR) { if (*item == UID_CHAR) {
long id = atol(item + 1); long id = atol(item + 1);
@@ -218,7 +218,7 @@ int text_processed(char *field, char *subfield, struct trig_var_data *vd,
if (cindex > len || cindex < 1) if (cindex > len || cindex < 1)
strcpy(str, ""); strcpy(str, "");
else else
snprintf(str, slen, "%c", vd->value[cindex - 1]); snprintf(str, slen, "%c", vd->value[cindex - 1]);
return TRUE; return TRUE;
} else if (!str_cmp(field, "mudcommand")) { } else if (!str_cmp(field, "mudcommand")) {
/* find the mud command returned from this text */ /* find the mud command returned from this text */
@@ -658,13 +658,13 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
if (subfield && *subfield) { if (subfield && *subfield) {
int addition = atoi(subfield); int addition = atoi(subfield);
GET_DAMROLL(c) = MAX(1, GET_DAMROLL(c) + addition); GET_DAMROLL(c) = MAX(1, GET_DAMROLL(c) + addition);
} }
snprintf(str, slen, "%d", GET_DAMROLL(c)); snprintf(str, slen, "%d", GET_DAMROLL(c));
} else if (!str_cmp(field, "dex")) { } else if (!str_cmp(field, "dex")) {
if (subfield && *subfield) { if (subfield && *subfield) {
int addition = atoi(subfield); int addition = atoi(subfield);
int max = (IS_NPC(c) || GET_LEVEL(c) >= LVL_GRGOD) ? 25 : 18; int max = (IS_NPC(c) || GET_LEVEL(c) >= LVL_GRGOD) ? 25 : 18;
GET_DEX(c) += addition; GET_DEX(c) += addition;
if (GET_DEX(c) > max) GET_DEX(c) = max; if (GET_DEX(c) > max) GET_DEX(c) = max;
if (GET_DEX(c) < 3) GET_DEX(c) = 3; if (GET_DEX(c) < 3) GET_DEX(c) = 3;
} }
@@ -673,7 +673,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
else if (!str_cmp(field, "drunk")) { else if (!str_cmp(field, "drunk")) {
if (subfield && *subfield) { if (subfield && *subfield) {
int addition = atoi(subfield); int addition = atoi(subfield);
GET_COND(c, DRUNK) = MAX(-1, MIN(addition, 24)); GET_COND(c, DRUNK) = MAX(-1, MIN(addition, 24));
} }
snprintf(str, slen, "%d", GET_COND(c, DRUNK)); snprintf(str, slen, "%d", GET_COND(c, DRUNK));
} }
@@ -760,12 +760,12 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
snprintf(str, slen, "%d", GET_HIT(c)); snprintf(str, slen, "%d", GET_HIT(c));
} }
else if (!str_cmp(field, "hitroll")) { else if (!str_cmp(field, "hitroll")) {
if (subfield && *subfield) { if (subfield && *subfield) {
int addition = atoi(subfield); int addition = atoi(subfield);
GET_HITROLL(c) = MAX(1, GET_HITROLL(c) + addition); GET_HITROLL(c) = MAX(1, GET_HITROLL(c) + addition);
} }
snprintf(str, slen, "%d", GET_HITROLL(c)); snprintf(str, slen, "%d", GET_HITROLL(c));
} }
else if (!str_cmp(field, "hunger")) { else if (!str_cmp(field, "hunger")) {
if (subfield && *subfield) { if (subfield && *subfield) {
int addition = atoi(subfield); int addition = atoi(subfield);
@@ -844,7 +844,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
GET_LEVEL(c) = MIN(MAX(lev, 0), LVL_IMMORT-1); GET_LEVEL(c) = MIN(MAX(lev, 0), LVL_IMMORT-1);
} else } else
snprintf(str, slen, "%d", GET_LEVEL(c)); snprintf(str, slen, "%d", GET_LEVEL(c));
} }
break; break;
case 'm': case 'm':
if (!str_cmp(field, "mana")) { if (!str_cmp(field, "mana")) {
@@ -1202,7 +1202,7 @@ o->contains));
snprintf(str, slen, "%s", (item_in_list(subfield, snprintf(str, slen, "%s", (item_in_list(subfield,
o->contains) ? "1" : "0")); o->contains) ? "1" : "0"));
else else
strcpy(str, "0"); strcpy(str, "0");
} }
else if (!str_cmp(field, "hasattached")) { else if (!str_cmp(field, "hasattached")) {
if (!(subfield && *subfield)) if (!(subfield && *subfield))

View File

@@ -1235,18 +1235,18 @@ int enter_player_game (struct descriptor_data *d)
/* We have to place the character in a room before equipping them /* We have to place the character in a room before equipping them
* or equip_char() will gripe about the person in NOWHERE. */ * or equip_char() will gripe about the person in NOWHERE. */
if ((load_room = GET_LOADROOM(d->character)) != NOWHERE) if ((load_room = GET_LOADROOM(d->character)) != NOWHERE)
load_room = real_room(load_room); load_room = real_room(load_room);
/* If char was saved with NOWHERE, or real_room above failed... */ /* If char was saved with NOWHERE, or real_room above failed... */
if (load_room == NOWHERE) { if (load_room == NOWHERE) {
if (GET_LEVEL(d->character) >= LVL_IMMORT) if (GET_LEVEL(d->character) >= LVL_IMMORT)
load_room = r_immort_start_room; load_room = r_immort_start_room;
else else
load_room = r_mortal_start_room; load_room = r_mortal_start_room;
} }
if (PLR_FLAGGED(d->character, PLR_FROZEN)) if (PLR_FLAGGED(d->character, PLR_FROZEN))
load_room = r_frozen_start_room; load_room = r_frozen_start_room;
/* copyover */ /* copyover */
GET_ID(d->character) = GET_IDNUM(d->character); GET_ID(d->character) = GET_IDNUM(d->character);
@@ -1276,38 +1276,38 @@ int enter_player_game (struct descriptor_data *d)
EVENTFUNC(get_protocols) EVENTFUNC(get_protocols)
{ {
struct descriptor_data *d; struct descriptor_data *d;
struct mud_event_data *pMudEvent; struct mud_event_data *pMudEvent;
char buf[MAX_STRING_LENGTH]; char buf[MAX_STRING_LENGTH];
int len; int len;
if (event_obj == NULL)
return 0;
pMudEvent = (struct mud_event_data *) event_obj;
d = (struct descriptor_data *) pMudEvent->pStruct;
/* Clear extra white space from the "protocol scroll" */
write_to_output(d, "");
len = snprintf(buf, MAX_STRING_LENGTH, "\tO[\toClient\tO] \tw%s\tn | ", d->pProtocol->pVariables[eMSDP_CLIENT_ID]->pValueString); if (event_obj == NULL)
return 0;
if (d->pProtocol->pVariables[eMSDP_XTERM_256_COLORS]->ValueInt)
len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toColors\tO] \tw256\tn | "); pMudEvent = (struct mud_event_data *) event_obj;
else if (d->pProtocol->pVariables[eMSDP_ANSI_COLORS]->ValueInt) d = (struct descriptor_data *) pMudEvent->pStruct;
/* Clear extra white space from the "protocol scroll" */
write_to_output(d, "");
len = snprintf(buf, MAX_STRING_LENGTH, "\tO[\toClient\tO] \tw%s\tn | ", d->pProtocol->pVariables[eMSDP_CLIENT_ID]->pValueString);
if (d->pProtocol->pVariables[eMSDP_XTERM_256_COLORS]->ValueInt)
len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toColors\tO] \tw256\tn | ");
else if (d->pProtocol->pVariables[eMSDP_ANSI_COLORS]->ValueInt)
len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toColors\tO] \twAnsi\tn | "); len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toColors\tO] \twAnsi\tn | ");
else else
len += snprintf(buf + len, MAX_STRING_LENGTH - len, "[Colors] No Color | "); len += snprintf(buf + len, MAX_STRING_LENGTH - len, "[Colors] No Color | ");
len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toMXP\tO] \tw%s\tn | ", d->pProtocol->bMXP ? "Yes" : "No"); len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toMXP\tO] \tw%s\tn | ", d->pProtocol->bMXP ? "Yes" : "No");
len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toMSDP\tO] \tw%s\tn | ", d->pProtocol->bMSDP ? "Yes" : "No"); len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toMSDP\tO] \tw%s\tn | ", d->pProtocol->bMSDP ? "Yes" : "No");
len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toATCP\tO] \tw%s\tn\r\n\r\n", d->pProtocol->bATCP ? "Yes" : "No"); len += snprintf(buf + len, MAX_STRING_LENGTH - len, "\tO[\toATCP\tO] \tw%s\tn\r\n\r\n", d->pProtocol->bATCP ? "Yes" : "No");
write_to_output(d, buf, 0); write_to_output(d, buf, 0);
write_to_output(d, GREETINGS, 0); write_to_output(d, GREETINGS, 0);
STATE(d) = CON_GET_NAME; STATE(d) = CON_GET_NAME;
return 0; return 0;
} }
/* deal with newcomers and other non-playing sockets */ /* deal with newcomers and other non-playing sockets */
@@ -1348,9 +1348,9 @@ void nanny(struct descriptor_data *d, char *arg)
/* Not in OLC. */ /* Not in OLC. */
switch (STATE(d)) { switch (STATE(d)) {
case CON_GET_PROTOCOL: case CON_GET_PROTOCOL:
write_to_output(d, "Collecting Protocol Information... Please Wait.\r\n"); write_to_output(d, "Collecting Protocol Information... Please Wait.\r\n");
return; return;
break; break;
case CON_GET_NAME: /* wait for input of name */ case CON_GET_NAME: /* wait for input of name */
if (d->character == NULL) { if (d->character == NULL) {
CREATE(d->character, struct char_data, 1); CREATE(d->character, struct char_data, 1);

View File

@@ -33,19 +33,19 @@ struct list_data * create_list(void)
else else
first_list = FALSE; first_list = FALSE;
return (pNewList); return (pNewList);
} }
struct item_data * create_item(void) struct item_data * create_item(void)
{ {
struct item_data *pNewItem; struct item_data *pNewItem;
CREATE(pNewItem, struct item_data, 1); CREATE(pNewItem, struct item_data, 1);
pNewItem->pNextItem = NULL; pNewItem->pNextItem = NULL;
pNewItem->pPrevItem = NULL; pNewItem->pPrevItem = NULL;
pNewItem->pContent = NULL; pNewItem->pContent = NULL;
return (pNewItem); return (pNewItem);
} }
@@ -76,15 +76,15 @@ void add_to_list(void * pContent, struct list_data * pList)
/* Allocate our memory */ /* Allocate our memory */
pNewItem = create_item(); pNewItem = create_item();
/* Place the contents in the item */ /* Place the contents in the item */
pNewItem->pContent = pContent; pNewItem->pContent = pContent;
pNewItem->pNextItem = NULL; pNewItem->pNextItem = NULL;
/* If we are the first entry in the list, mark us as such */ /* If we are the first entry in the list, mark us as such */
if (pList->pFirstItem == NULL) if (pList->pFirstItem == NULL)
pList->pFirstItem = pNewItem; pList->pFirstItem = pNewItem;
/* Grab our last item from the list and attach it to our new item */ /* Grab our last item from the list and attach it to our new item */
if (pList->pLastItem) { if (pList->pLastItem) {
pLastItem = pList->pLastItem; pLastItem = pList->pLastItem;
@@ -94,39 +94,37 @@ void add_to_list(void * pContent, struct list_data * pList)
/* Make our new item our last item in the list */ /* Make our new item our last item in the list */
pList->pLastItem = pNewItem; pList->pLastItem = pNewItem;
pList->iSize++; pList->iSize++;
} }
void remove_from_list(void * pContent, struct list_data * pList) void remove_from_list(void * pContent, struct list_data * pList)
{ {
struct item_data *pRemovedItem; struct item_data *pRemovedItem;
if ((pRemovedItem = find_in_list(pContent, pList)) == NULL) { if ((pRemovedItem = find_in_list(pContent, pList)) == NULL) {
mudlog(CMP, LVL_GOD, TRUE, "SYSERR: Attempting to remove contents that don't exist in list."); mudlog(CMP, LVL_GOD, TRUE, "SYSERR: Attempting to remove contents that don't exist in list.");
return; return;
} }
if (pRemovedItem == pList->pFirstItem) if (pRemovedItem == pList->pFirstItem)
pList->pFirstItem = pRemovedItem->pNextItem; pList->pFirstItem = pRemovedItem->pNextItem;
if (pRemovedItem == pList->pLastItem) if (pRemovedItem == pList->pLastItem)
pList->pLastItem = pRemovedItem->pPrevItem; pList->pLastItem = pRemovedItem->pPrevItem;
if (pRemovedItem->pPrevItem) if (pRemovedItem->pPrevItem)
pRemovedItem->pPrevItem->pNextItem = pRemovedItem->pNextItem; pRemovedItem->pPrevItem->pNextItem = pRemovedItem->pNextItem;
if (pRemovedItem->pNextItem) if (pRemovedItem->pNextItem)
pRemovedItem->pNextItem->pPrevItem = pRemovedItem->pPrevItem; pRemovedItem->pNextItem->pPrevItem = pRemovedItem->pPrevItem;
pList->iSize--; pList->iSize--;
if (pList->iSize == 0) { if (pList->iSize == 0) {
pList->pFirstItem = NULL; pList->pFirstItem = NULL;
pList->pLastItem = NULL; pList->pLastItem = NULL;
} }
free(pRemovedItem);
free(pRemovedItem);
} }
/** Merges an iterator with a list /** Merges an iterator with a list
@@ -136,7 +134,7 @@ void remove_from_list(void * pContent, struct list_data * pList)
void * merge_iterator(struct iterator_data * pIterator, struct list_data * pList) void * merge_iterator(struct iterator_data * pIterator, struct list_data * pList)
{ {
void * pContent; void * pContent;
if (pList == NULL) { if (pList == NULL) {
mudlog(NRM, LVL_GOD, TRUE, "SYSERR: Attempting to merge iterator to NULL list."); mudlog(NRM, LVL_GOD, TRUE, "SYSERR: Attempting to merge iterator to NULL list.");
pIterator->pList = NULL; pIterator->pList = NULL;
@@ -149,13 +147,13 @@ void * merge_iterator(struct iterator_data * pIterator, struct list_data * pList
pIterator->pItem = NULL; pIterator->pItem = NULL;
return NULL; return NULL;
} }
pList->iIterators++; pList->iIterators++;
pIterator->pList = pList; pIterator->pList = pList;
pIterator->pItem = pList->pFirstItem; pIterator->pItem = pList->pFirstItem;
pContent = pIterator->pItem ? pIterator->pItem->pContent : NULL; pContent = pIterator->pItem ? pIterator->pItem->pContent : NULL;
return (pContent); return (pContent);
} }
@@ -163,9 +161,9 @@ void remove_iterator(struct iterator_data * pIterator)
{ {
if (pIterator->pList == NULL) { if (pIterator->pList == NULL) {
mudlog(NRM, LVL_GOD, TRUE, "SYSERR: Attempting to remove iterator from NULL list."); mudlog(NRM, LVL_GOD, TRUE, "SYSERR: Attempting to remove iterator from NULL list.");
return; return;
} }
pIterator->pList->iIterators--; pIterator->pList->iIterators--;
pIterator->pList = NULL; pIterator->pList = NULL;
pIterator->pItem = NULL; pIterator->pItem = NULL;
@@ -179,19 +177,19 @@ void * next_in_list(struct iterator_data * pIterator)
{ {
void * pContent; void * pContent;
struct item_data * pTempItem; struct item_data * pTempItem;
if (pIterator->pList == NULL) { if (pIterator->pList == NULL) {
mudlog(NRM, LVL_GOD, TRUE, "SYSERR: Attempting to get content from iterator with NULL list."); mudlog(NRM, LVL_GOD, TRUE, "SYSERR: Attempting to get content from iterator with NULL list.");
return NULL; return NULL;
} }
/* Cycle down the list */ /* Cycle down the list */
pTempItem = pIterator->pItem->pNextItem; pTempItem = pIterator->pItem->pNextItem;
pIterator->pItem = pTempItem; pIterator->pItem = pTempItem;
/* Grab the content */ /* Grab the content */
pContent = pIterator->pItem ? pIterator->pItem->pContent : NULL; pContent = pIterator->pItem ? pIterator->pItem->pContent : NULL;
return (pContent); return (pContent);
} }
@@ -206,21 +204,21 @@ struct item_data * find_in_list(void * pContent, struct list_data * pList)
void * pFoundItem; void * pFoundItem;
struct item_data *pItem = NULL; struct item_data *pItem = NULL;
bool found; bool found;
pFoundItem = merge_iterator(&Iterator, pList); pFoundItem = merge_iterator(&Iterator, pList);
for (found = FALSE; pFoundItem != NULL; pFoundItem = next_in_list(&Iterator)) { for (found = FALSE; pFoundItem != NULL; pFoundItem = next_in_list(&Iterator)) {
if (pFoundItem == pContent) { if (pFoundItem == pContent) {
found = TRUE; found = TRUE;
break; break;
} }
} }
if (found) if (found)
pItem = Iterator.pItem; pItem = Iterator.pItem;
remove_iterator(&Iterator); remove_iterator(&Iterator);
if (found) if (found)
return (pItem); return (pItem);
else else
@@ -245,18 +243,18 @@ void * simple_list(struct list_data * pList)
static bool loop = FALSE; static bool loop = FALSE;
static struct list_data *pLastList = NULL; static struct list_data *pLastList = NULL;
void * pContent; void * pContent;
/* Reset List */ /* Reset List */
if (pList == NULL) { if (pList == NULL) {
loop = FALSE; loop = FALSE;
pLastList = NULL; pLastList = NULL;
return NULL; return NULL;
} }
if (!loop || pLastList != pList) { if (!loop || pLastList != pList) {
if (loop && pLastList != pList) if (loop && pLastList != pList)
mudlog(CMP, LVL_GRGOD, TRUE, "SYSERR: simple_list() forced to reset itself."); mudlog(CMP, LVL_GRGOD, TRUE, "SYSERR: simple_list() forced to reset itself.");
pContent = merge_iterator(&Iterator, pList); pContent = merge_iterator(&Iterator, pList);
if (pContent != NULL) { if (pContent != NULL) {
pLastList = pList; pLastList = pList;
@@ -268,7 +266,7 @@ void * simple_list(struct list_data * pList)
if ((pContent = next_in_list(&Iterator)) != NULL) if ((pContent = next_in_list(&Iterator)) != NULL)
return (pContent); return (pContent);
remove_iterator(&Iterator); remove_iterator(&Iterator);
loop = FALSE; loop = FALSE;
return NULL; return NULL;
@@ -281,23 +279,23 @@ void * random_from_list(struct list_data * pList)
bool found; bool found;
int number; int number;
int count = 1; int count = 1;
if (pList->iSize <= 0) if (pList->iSize <= 0)
return NULL; return NULL;
else else
number = rand_number(1, pList->iSize); number = rand_number(1, pList->iSize);
pFoundItem = merge_iterator(&Iterator, pList); pFoundItem = merge_iterator(&Iterator, pList);
for (found = FALSE; pFoundItem != NULL; pFoundItem = next_in_list(&Iterator), count++) { for (found = FALSE; pFoundItem != NULL; pFoundItem = next_in_list(&Iterator), count++) {
if (count == number) { if (count == number) {
found = TRUE; found = TRUE;
break; break;
} }
} }
remove_iterator(&Iterator); remove_iterator(&Iterator);
if (found) if (found)
return (pFoundItem); return (pFoundItem);
else else

View File

@@ -54,17 +54,17 @@ EVENTFUNC(event_countdown)
{ {
struct mud_event_data * pMudEvent; struct mud_event_data * pMudEvent;
struct char_data * ch = NULL; struct char_data * ch = NULL;
pMudEvent = (struct mud_event_data * ) event_obj; pMudEvent = (struct mud_event_data * ) event_obj;
switch (mud_event_index[pMudEvent->iId].iEvent_Type) { switch (mud_event_index[pMudEvent->iId].iEvent_Type) {
case EVENT_CHAR: case EVENT_CHAR:
ch = (struct char_data * ) pMudEvent->pStruct; ch = (struct char_data * ) pMudEvent->pStruct;
break; break;
default: default:
break; break;
} }
switch (pMudEvent->iId) { switch (pMudEvent->iId) {
default: default:
break; break;
@@ -84,7 +84,7 @@ void attach_mud_event(struct mud_event_data *pMudEvent, long time)
struct char_data * ch; struct char_data * ch;
pEvent = event_create(mud_event_index[pMudEvent->iId].func, pMudEvent, time); pEvent = event_create(mud_event_index[pMudEvent->iId].func, pMudEvent, time);
pEvent->isMudEvent = TRUE; pEvent->isMudEvent = TRUE;
pMudEvent->pEvent = pEvent; pMudEvent->pEvent = pEvent;
switch (mud_event_index[pMudEvent->iId].iEvent_Type) { switch (mud_event_index[pMudEvent->iId].iEvent_Type) {
@@ -106,16 +106,16 @@ struct mud_event_data *new_mud_event(event_id iId, void *pStruct, char *sVariabl
{ {
struct mud_event_data *pMudEvent; struct mud_event_data *pMudEvent;
char *varString; char *varString;
CREATE(pMudEvent, struct mud_event_data, 1); CREATE(pMudEvent, struct mud_event_data, 1);
varString = (sVariables != NULL) ? strdup(sVariables) : NULL; varString = (sVariables != NULL) ? strdup(sVariables) : NULL;
pMudEvent->iId = iId; pMudEvent->iId = iId;
pMudEvent->pStruct = pStruct; pMudEvent->pStruct = pStruct;
pMudEvent->sVariables = varString; pMudEvent->sVariables = varString;
pMudEvent->pEvent = NULL; pMudEvent->pEvent = NULL;
return (pMudEvent); return (pMudEvent);
} }
void free_mud_event(struct mud_event_data *pMudEvent) void free_mud_event(struct mud_event_data *pMudEvent)
@@ -139,7 +139,7 @@ void free_mud_event(struct mud_event_data *pMudEvent)
if (pMudEvent->sVariables != NULL) if (pMudEvent->sVariables != NULL)
free(pMudEvent->sVariables); free(pMudEvent->sVariables);
pMudEvent->pEvent->event_obj = NULL; pMudEvent->pEvent->event_obj = NULL;
free(pMudEvent); free(pMudEvent);
} }
@@ -154,14 +154,14 @@ struct mud_event_data * char_has_mud_event(struct char_data * ch, event_id iId)
return NULL; return NULL;
simple_list(NULL); simple_list(NULL);
while ((pEvent = (struct event *) simple_list(ch->events)) != NULL) { while ((pEvent = (struct event *) simple_list(ch->events)) != NULL) {
if (!pEvent->isMudEvent) if (!pEvent->isMudEvent)
continue; continue;
pMudEvent = (struct mud_event_data * ) pEvent->event_obj; pMudEvent = (struct mud_event_data * ) pEvent->event_obj;
if (pMudEvent->iId == iId) { if (pMudEvent->iId == iId) {
found = TRUE; found = TRUE;
break; break;
} }
} }

View File

@@ -78,18 +78,18 @@ static void prefedit_save_to_char(struct descriptor_data *d)
} }
else else
{ {
if (!vict) { if (!vict) {
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: Unable to save toggles (no vict)"); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: Unable to save toggles (no vict)");
send_to_char(d->character, "Unable to save toggles (no vict)"); send_to_char(d->character, "Unable to save toggles (no vict)");
} else if (!vict->desc) { } else if (!vict->desc) {
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: Unable to save toggles (no vict descriptor)"); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: Unable to save toggles (no vict descriptor)");
send_to_char(d->character, "Unable to save toggles (no vict descriptor)"); send_to_char(d->character, "Unable to save toggles (no vict descriptor)");
} else if (!IS_PLAYING(vict->desc)) { } else if (!IS_PLAYING(vict->desc)) {
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: Unable to save toggles (vict not playing)"); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: Unable to save toggles (vict not playing)");
send_to_char(d->character, "Unable to save toggles (vict not playing)"); send_to_char(d->character, "Unable to save toggles (vict not playing)");
} else { } else {
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: Unable to save toggles (unknown reason)"); mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: Unable to save toggles (unknown reason)");
send_to_char(d->character, "Unable to save toggles (unknown reason)"); send_to_char(d->character, "Unable to save toggles (unknown reason)");
} }
} }
} }

View File

@@ -334,7 +334,7 @@ void ProtocolDestroy( protocol_t *apProtocol )
for ( i = eMSDP_NONE+1; i < eMSDP_MAX; ++i ) for ( i = eMSDP_NONE+1; i < eMSDP_MAX; ++i )
{ {
if (apProtocol->pVariables[i]->pValueString) if (apProtocol->pVariables[i]->pValueString)
free(apProtocol->pVariables[i]->pValueString); free(apProtocol->pVariables[i]->pValueString);
free(apProtocol->pVariables[i]); free(apProtocol->pVariables[i]);
} }
@@ -1402,7 +1402,7 @@ const char *ColourRGB( descriptor_t *apDescriptor, const char *apRGB )
bool charHasColor = TRUE; bool charHasColor = TRUE;
if (apDescriptor->character && !clr(apDescriptor->character, C_CMP)) if (apDescriptor->character && !clr(apDescriptor->character, C_CMP))
charHasColor = FALSE; charHasColor = FALSE;
if ( pProtocol && pProtocol->pVariables[eMSDP_ANSI_COLORS]->ValueInt && charHasColor ) if ( pProtocol && pProtocol->pVariables[eMSDP_ANSI_COLORS]->ValueInt && charHasColor )
{ {