[Dec 22 2009] - Rumble

Made copyover save loadroom so players stay in the same room during copyover.
  Added scan command.
This commit is contained in:
Rumble 2009-12-22 20:44:12 +00:00
parent 2b74ef23ad
commit 577d67041f
6 changed files with 111 additions and 5 deletions

View file

@ -93,6 +93,7 @@ ACMD(do_help);
ACMD(do_history);
ACMD(do_inventory);
ACMD(do_levels);
ACMD(do_scan);
ACMD(do_score);
ACMD(do_time);
ACMD(do_toggle);

View file

@ -2525,3 +2525,96 @@ ACMD(do_areas)
if (overlap_shown)
send_to_char(ch, "Areas shown in @rred@n may have some creatures outside the specified range.\r\n");
}
void list_scanned_chars(struct char_data * list, struct char_data * ch, int
distance, int door)
{
char buf[MAX_STRING_LENGTH], buf2[MAX_STRING_LENGTH];
const char *how_far[] = {
"close by",
"a ways off",
"far off to the"
};
struct char_data *i;
int count = 0;
*buf = '\0';
/* this loop is a quick, easy way to help make a grammatical sentence
(i.e., "You see x, x, y, and z." with commas, "and", etc.) */
for (i = list; i; i = i->next_in_room)
/* put any other conditions for scanning someone in this if statement -
i.e., if (CAN_SEE(ch, i) && condition2 && condition3) or whatever */
if (CAN_SEE(ch, i))
count++;
if (!count)
return;
for (i = list; i; i = i->next_in_room) {
/* make sure to add changes to the if statement above to this one also, using
or's to join them.. i.e.,
if (!CAN_SEE(ch, i) || !condition2 || !condition3) */
if (!CAN_SEE(ch, i))
continue;
if (!*buf)
sprintf(buf, "You see %s", GET_NAME(i));
else
sprintf(buf, "%s%s", buf, GET_NAME(i));
if (--count > 1)
strcat(buf, ", ");
else if (count == 1)
strcat(buf, " and ");
else {
sprintf(buf2, " %s %s.\r\n", how_far[distance], dirs[door]);
strcat(buf, buf2);
}
}
send_to_char(ch, buf);
}
ACMD(do_scan)
{
int door;
char buf[MAX_STRING_LENGTH];
*buf = '\0';
if (IS_AFFECTED(ch, AFF_BLIND)) {
send_to_char(ch, "You can't see a damned thing, you're blind!\r\n");
return;
}
/* may want to add more restrictions here, too */
send_to_char(ch, "You quickly scan the area.\r\n");
for (door = 0; door < NUM_OF_DIRS - 2; door++) /* don't scan up/down */
if (EXIT(ch, door) && EXIT(ch, door)->to_room != NOWHERE &&
!IS_SET(EXIT(ch, door)->exit_info, EX_CLOSED)
&& !IS_DARK(EXIT(ch, door)->to_room)) {
if (world[EXIT(ch, door)->to_room].people) {
list_scanned_chars(world[EXIT(ch, door)->to_room].people, ch, 0, door);
} else if (_2ND_EXIT(ch, door) && _2ND_EXIT(ch, door)->to_room !=
NOWHERE && !IS_SET(_2ND_EXIT(ch, door)->exit_info, EX_CLOSED)
&& !IS_DARK(_2ND_EXIT(ch, door)->to_room)) {
/* check the second room away */
if (world[_2ND_EXIT(ch, door)->to_room].people) {
list_scanned_chars(world[_2ND_EXIT(ch, door)->to_room].people, ch, 1, door);
} else if (_3RD_EXIT(ch, door) && _3RD_EXIT(ch, door)->to_room !=
NOWHERE && !IS_SET(_3RD_EXIT(ch, door)->exit_info, EX_CLOSED)
&& !IS_DARK(_3RD_EXIT(ch, door)->to_room)) {
/* check the third room */
if (world[_3RD_EXIT(ch, door)->to_room].people) {
list_scanned_chars(world[_3RD_EXIT(ch, door)->to_room].people, ch, 2,
door);
}
}
}
}
}

View file

@ -4068,6 +4068,7 @@ ACMD(do_copyover)
} else {
fprintf (fp, "%d %ld %s %s\n", d->descriptor, GET_PREF(och), GET_NAME(och), d->host);
/* save och */
GET_LOADROOM(och) = GET_ROOM_VNUM(IN_ROOM(och));
Crash_rentsave(och,0);
save_char(och);
write_to_descriptor (d->descriptor, buf);

View file

@ -171,9 +171,9 @@ cpp_extern const struct command_info cmd_info[] = {
{ "holylight", "holy" , POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_HOLYLIGHT },
{ "house" , "house" , POS_RESTING , do_house , 0, 0 },
{ "identify" , "id" , POS_STANDING, do_not_here , 1, 0 },
{ "inventory", "i" , POS_DEAD , do_inventory, 0, 0 },
{ "idea" , "id" , POS_DEAD , do_ibt , 0, SCMD_IDEA },
{ "identify" , "id" , POS_STANDING, do_not_here , 1, 0 },
{ "idea" , "ide" , POS_DEAD , do_ibt , 0, SCMD_IDEA },
{ "imotd" , "imo" , POS_DEAD , do_gen_ps , LVL_IMMORT, SCMD_IMOTD },
{ "immlist" , "imm" , POS_DEAD , do_gen_ps , 0, SCMD_IMMLIST },
{ "info" , "info" , POS_SLEEPING, do_gen_ps , 0, SCMD_INFO },
@ -264,6 +264,7 @@ cpp_extern const struct command_info cmd_info[] = {
{ "sacrifice", "sac" , POS_RESTING , do_sac , 0, 0 },
{ "say" , "s" , POS_RESTING , do_say , 0, 0 },
{ "score" , "sc" , POS_DEAD , do_score , 0, 0 },
{ "scan" , "sca" , POS_RESTING , do_scan , 0, 0 },
{ "scopy" , "scopy" , POS_DEAD , do_oasis_copy, LVL_GOD, CON_SEDIT },
{ "sit" , "si" , POS_RESTING , do_sit , 0, 0 },
{ "'" , "'" , POS_RESTING , do_say , 0, 0 },

View file

@ -820,6 +820,9 @@ do \
/** Does room pointer have direction option num? */
#define R_EXIT(room, num) ((room)->dir_option[(num)])
#define _2ND_EXIT(ch, door) (world[EXIT(ch, door)->to_room].dir_option[door])
#define _3RD_EXIT(ch, door) (world[_2ND_EXIT(ch, door)->to_room].dir_option[door])
/** Can ch walk through direction door. */
#define CAN_GO(ch, door) (EXIT(ch,door) && \
(EXIT(ch,door)->to_room != NOWHERE) && \