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

@@ -505,17 +505,12 @@ 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 */
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOEXIT)) if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOEXIT))
@@ -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++;
} }
@@ -2393,41 +2387,30 @@ 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)))
send_to_char (ch, "They have mail waiting.\r\n"); send_to_char (ch, "They have mail waiting.\r\n");

View File

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

View File

@@ -120,12 +120,10 @@ void remove_from_list(void * pContent, struct list_data * pList)
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);
} }