mirror of
https://github.com/tbamud/tbamud.git
synced 2025-12-20 09:10:13 +01:00
Removed all whitespace (tabs and spaces) from EOL's. How did we get so many? --Rumble
This commit is contained in:
parent
49c469967a
commit
a2031d64e2
79 changed files with 2851 additions and 2852 deletions
|
|
@ -159,8 +159,8 @@ ACMD(do_tell)
|
||||||
if (!*buf || !*buf2)
|
if (!*buf || !*buf2)
|
||||||
send_to_char(ch, "Who do you wish to tell what??\r\n");
|
send_to_char(ch, "Who do you wish to tell what??\r\n");
|
||||||
else if (!strcmp(buf, "m-w")) {
|
else if (!strcmp(buf, "m-w")) {
|
||||||
char word[MAX_INPUT_LENGTH], *p, *q;
|
char word[MAX_INPUT_LENGTH], *p, *q;
|
||||||
|
|
||||||
if (last_webster_teller != -1L) {
|
if (last_webster_teller != -1L) {
|
||||||
if (GET_IDNUM(ch) == last_webster_teller) {
|
if (GET_IDNUM(ch) == last_webster_teller) {
|
||||||
send_to_char(ch, "You are still waiting for a response.\r\n");
|
send_to_char(ch, "You are still waiting for a response.\r\n");
|
||||||
|
|
@ -172,11 +172,11 @@ 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;
|
||||||
}
|
}
|
||||||
*q = '\0';
|
*q = '\0';
|
||||||
|
|
||||||
if (!*word) {
|
if (!*word) {
|
||||||
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;
|
||||||
|
|
@ -185,7 +185,7 @@ ACMD(do_tell)
|
||||||
system(buf);
|
system(buf);
|
||||||
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);
|
||||||
|
|
||||||
} else if (GET_LEVEL(ch) < LVL_IMMORT && !(vict = get_player_vis(ch, buf, NULL, FIND_CHAR_WORLD)))
|
} else if (GET_LEVEL(ch) < LVL_IMMORT && !(vict = get_player_vis(ch, buf, NULL, FIND_CHAR_WORLD)))
|
||||||
send_to_char(ch, "%s", CONFIG_NOPERSON);
|
send_to_char(ch, "%s", CONFIG_NOPERSON);
|
||||||
else if (GET_LEVEL(ch) >= LVL_IMMORT && !(vict = get_char_vis(ch, buf, NULL, FIND_CHAR_WORLD)))
|
else if (GET_LEVEL(ch) >= LVL_IMMORT && !(vict = get_char_vis(ch, buf, NULL, FIND_CHAR_WORLD)))
|
||||||
|
|
@ -215,7 +215,7 @@ ACMD(do_reply)
|
||||||
* 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.
|
* work if someone logs out and back in again.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX: A descriptor list based search would be faster although
|
* XXX: A descriptor list based search would be faster although
|
||||||
* we could not find link dead people. Not that they can
|
* we could not find link dead people. Not that they can
|
||||||
|
|
@ -347,14 +347,14 @@ ACMD(do_write)
|
||||||
act("You can't write on $p.", FALSE, ch, paper, 0, TO_CHAR);
|
act("You can't write on $p.", FALSE, ch, paper, 0, TO_CHAR);
|
||||||
else {
|
else {
|
||||||
char *backstr = NULL;
|
char *backstr = NULL;
|
||||||
|
|
||||||
/* Something on it, display it as that's in input buffer. */
|
/* Something on it, display it as that's in input buffer. */
|
||||||
if (paper->action_description) {
|
if (paper->action_description) {
|
||||||
backstr = strdup(paper->action_description);
|
backstr = strdup(paper->action_description);
|
||||||
send_to_char(ch, "There's something written on it already:\r\n");
|
send_to_char(ch, "There's something written on it already:\r\n");
|
||||||
send_to_char(ch, "%s", paper->action_description);
|
send_to_char(ch, "%s", paper->action_description);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* we can write - hooray! */
|
/* we can write - hooray! */
|
||||||
act("$n begins to jot down a note.", TRUE, ch, 0, 0, TO_ROOM);
|
act("$n begins to jot down a note.", TRUE, ch, 0, 0, TO_ROOM);
|
||||||
send_editor_help(ch->desc);
|
send_editor_help(ch->desc);
|
||||||
|
|
@ -483,9 +483,9 @@ ACMD(do_gen_comm)
|
||||||
do_gmote(ch, argument + 1, 0, 1);
|
do_gmote(ch, argument + 1, 0, 1);
|
||||||
else
|
else
|
||||||
do_gmote(ch, argument, 0, 1);
|
do_gmote(ch, argument, 0, 1);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 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) {
|
||||||
|
|
@ -526,13 +526,13 @@ 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(PRF_FLAGGED(i->character, channels[subcmd]) || PLR_FLAGGED(i->character, PLR_WRITING))
|
if(PRF_FLAGGED(i->character, channels[subcmd]) || PLR_FLAGGED(i->character, PLR_WRITING))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if(ROOM_FLAGGED(IN_ROOM(i->character), ROOM_SOUNDPROOF) && (GET_LEVEL(ch) < LVL_GOD))
|
if(ROOM_FLAGGED(IN_ROOM(i->character), ROOM_SOUNDPROOF) && (GET_LEVEL(ch) < LVL_GOD))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (subcmd == SCMD_SHOUT &&
|
if (subcmd == SCMD_SHOUT &&
|
||||||
((world[IN_ROOM(ch)].zone != world[IN_ROOM(i->character)].zone) ||
|
((world[IN_ROOM(ch)].zone != world[IN_ROOM(i->character)].zone) ||
|
||||||
!AWAKE(i->character)))
|
!AWAKE(i->character)))
|
||||||
|
|
@ -595,7 +595,7 @@ void free_hist_messg(struct descriptor_data *d)
|
||||||
}
|
}
|
||||||
d->comms = NULL;
|
d->comms = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void new_hist_messg(struct descriptor_data *d, const char *msg)
|
void new_hist_messg(struct descriptor_data *d, const char *msg)
|
||||||
{
|
{
|
||||||
struct txt_block *tmp = d->comms;
|
struct txt_block *tmp = d->comms;
|
||||||
|
|
@ -609,10 +609,10 @@ void new_hist_messg(struct descriptor_data *d, const char *msg)
|
||||||
tmp = tmp->next;
|
tmp = tmp->next;
|
||||||
CREATE(tmp->next, struct txt_block, 1);
|
CREATE(tmp->next, struct txt_block, 1);
|
||||||
tmp->next->text = strdup(msg);
|
tmp->next->text = strdup(msg);
|
||||||
|
|
||||||
for (tmp = d->comms; tmp ; tmp= tmp->next)
|
for (tmp = d->comms; tmp ; tmp= tmp->next)
|
||||||
l++;
|
l++;
|
||||||
|
|
||||||
for (; l > HIST_LENGTH && d->comms; l--) {
|
for (; l > HIST_LENGTH && d->comms; l--) {
|
||||||
tmp = d->comms;
|
tmp = d->comms;
|
||||||
d->comms = tmp->next;
|
d->comms = tmp->next;
|
||||||
|
|
@ -629,16 +629,16 @@ ACMD(do_list_history)
|
||||||
|
|
||||||
if (!d)
|
if (!d)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!d->comms) {
|
if (!d->comms) {
|
||||||
write_to_output(d, "No communications in history.\r\n");
|
write_to_output(d, "No communications in history.\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
write_to_output(d, "Last %d communications:\r\n", HIST_LENGTH);
|
write_to_output(d, "Last %d communications:\r\n", HIST_LENGTH);
|
||||||
|
|
||||||
for (tmp = d->comms;tmp;tmp = tmp->next)
|
for (tmp = d->comms;tmp;tmp = tmp->next)
|
||||||
write_to_output(d, "%s%s%s", QWHT, tmp->text, QNRM);
|
write_to_output(d, "%s%s%s", QWHT, tmp->text, QNRM);
|
||||||
|
|
||||||
free_hist_messg(d);
|
free_hist_messg(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -647,18 +647,18 @@ void handle_webster_file(void) {
|
||||||
struct char_data *ch = find_char(last_webster_teller);
|
struct char_data *ch = find_char(last_webster_teller);
|
||||||
char info[MAX_STRING_LENGTH], line[READ_SIZE];
|
char info[MAX_STRING_LENGTH], line[READ_SIZE];
|
||||||
size_t len = 0, nlen = 0;
|
size_t len = 0, nlen = 0;
|
||||||
|
|
||||||
last_webster_teller = -1L;
|
last_webster_teller = -1L;
|
||||||
|
|
||||||
if (!ch) /* they quit ? */
|
if (!ch) /* they quit ? */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fl = fopen("websterinfo", "r");
|
fl = fopen("websterinfo", "r");
|
||||||
if (!fl) {
|
if (!fl) {
|
||||||
send_to_char(ch, "It seems Merriam-Webster is offline..\r\n");
|
send_to_char(ch, "It seems Merriam-Webster is offline..\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unlink("websterinfo");
|
unlink("websterinfo");
|
||||||
|
|
||||||
get_line(fl, line);
|
get_line(fl, line);
|
||||||
|
|
@ -669,7 +669,7 @@ void handle_webster_file(void) {
|
||||||
len += nlen;
|
len += nlen;
|
||||||
get_line(fl, line);
|
get_line(fl, line);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (len >= sizeof(info)) {
|
if (len >= sizeof(info)) {
|
||||||
const char *overflow = "\r\n**OVERFLOW**\r\n";
|
const char *overflow = "\r\n**OVERFLOW**\r\n";
|
||||||
strcpy(info + sizeof(info) - strlen(overflow) - 1, overflow); /* strcpy: OK */
|
strcpy(info + sizeof(info) - strlen(overflow) - 1, overflow); /* strcpy: OK */
|
||||||
|
|
|
||||||
|
|
@ -115,20 +115,20 @@ void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mode)
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case SHOW_OBJ_LONG:
|
case SHOW_OBJ_LONG:
|
||||||
/* hide objects starting with . from non-holylighted people Idea from Elaseth of TBA */
|
/* hide objects starting with . from non-holylighted people Idea from Elaseth of TBA */
|
||||||
if (*obj->description == '.' && (IS_NPC(ch) || !PRF_FLAGGED(ch, PRF_HOLYLIGHT)))
|
if (*obj->description == '.' && (IS_NPC(ch) || !PRF_FLAGGED(ch, PRF_HOLYLIGHT)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS))
|
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS))
|
||||||
send_to_char(ch, "[%d] %s", GET_OBJ_VNUM(obj), SCRIPT(obj) ? "[TRIG] " : "");
|
send_to_char(ch, "[%d] %s", GET_OBJ_VNUM(obj), SCRIPT(obj) ? "[TRIG] " : "");
|
||||||
|
|
||||||
send_to_char(ch, "%s", CCGRN(ch, C_NRM));
|
send_to_char(ch, "%s", CCGRN(ch, C_NRM));
|
||||||
send_to_char(ch, "%s", obj->description);
|
send_to_char(ch, "%s", obj->description);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SHOW_OBJ_SHORT:
|
case SHOW_OBJ_SHORT:
|
||||||
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS))
|
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS))
|
||||||
send_to_char(ch, "[%d] %s", GET_OBJ_VNUM(obj), SCRIPT(obj) ? "[TRIG] " : "");
|
send_to_char(ch, "[%d] %s", GET_OBJ_VNUM(obj), SCRIPT(obj) ? "[TRIG] " : "");
|
||||||
|
|
||||||
send_to_char(ch, "%s", obj->short_description);
|
send_to_char(ch, "%s", obj->short_description);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -309,9 +309,9 @@ void list_one_char(struct char_data *i, struct char_data *ch)
|
||||||
" is standing here."
|
" is standing here."
|
||||||
};
|
};
|
||||||
|
|
||||||
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS) && IS_NPC(i))
|
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS) && IS_NPC(i))
|
||||||
send_to_char(ch, "[%d] %s", GET_MOB_VNUM(i), SCRIPT(i) ? "[TRIG] " : "");
|
send_to_char(ch, "[%d] %s", GET_MOB_VNUM(i), SCRIPT(i) ? "[TRIG] " : "");
|
||||||
|
|
||||||
if (IS_NPC(i) && i->player.long_descr && GET_POS(i) == GET_DEFAULT_POS(i)) {
|
if (IS_NPC(i) && i->player.long_descr && GET_POS(i) == GET_DEFAULT_POS(i)) {
|
||||||
if (AFF_FLAGGED(i, AFF_INVISIBLE))
|
if (AFF_FLAGGED(i, AFF_INVISIBLE))
|
||||||
send_to_char(ch, "*");
|
send_to_char(ch, "*");
|
||||||
|
|
@ -472,7 +472,7 @@ void look_at_room(struct char_data *ch, int ignore_brief)
|
||||||
sprintbit(ROOM_FLAGS(IN_ROOM(ch)), room_bits, buf, sizeof(buf));
|
sprintbit(ROOM_FLAGS(IN_ROOM(ch)), room_bits, buf, sizeof(buf));
|
||||||
send_to_char(ch, "[%5d] ", GET_ROOM_VNUM(IN_ROOM(ch)));
|
send_to_char(ch, "[%5d] ", GET_ROOM_VNUM(IN_ROOM(ch)));
|
||||||
|
|
||||||
send_to_char(ch, "%s%s [ %s]",
|
send_to_char(ch, "%s%s [ %s]",
|
||||||
SCRIPT(rm) ? "[TRIG] " : "",
|
SCRIPT(rm) ? "[TRIG] " : "",
|
||||||
world[IN_ROOM(ch)].name, buf);
|
world[IN_ROOM(ch)].name, buf);
|
||||||
} else
|
} else
|
||||||
|
|
@ -710,8 +710,8 @@ ACMD(do_look)
|
||||||
|
|
||||||
for (i = world[IN_ROOM(ch)].ex_description; i; i = i->next) {
|
for (i = world[IN_ROOM(ch)].ex_description; i; i = i->next) {
|
||||||
if (*i->keyword != '.') {
|
if (*i->keyword != '.') {
|
||||||
send_to_char(ch, "%s%s:\r\n%s",
|
send_to_char(ch, "%s%s:\r\n%s",
|
||||||
(found ? "\r\n" : ""), i->keyword, i->description);
|
(found ? "\r\n" : ""), i->keyword, i->description);
|
||||||
found = 1;
|
found = 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1028,7 +1028,7 @@ int search_help(struct char_data *ch, char *argument)
|
||||||
ACMD(do_help)
|
ACMD(do_help)
|
||||||
{
|
{
|
||||||
int mid = 0;
|
int mid = 0;
|
||||||
|
|
||||||
if (!ch->desc)
|
if (!ch->desc)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1048,14 +1048,14 @@ ACMD(do_help)
|
||||||
}
|
}
|
||||||
|
|
||||||
space_to_minus(argument);
|
space_to_minus(argument);
|
||||||
mid = search_help(ch, argument);
|
mid = search_help(ch, argument);
|
||||||
|
|
||||||
if (mid <= 0) {
|
if (mid <= 0) {
|
||||||
send_to_char(ch, "There is no help on that word.\r\n");
|
send_to_char(ch, "There is no help on that word.\r\n");
|
||||||
mudlog(NRM, MAX(LVL_IMPL, GET_INVIS_LEV(ch)), TRUE,
|
mudlog(NRM, MAX(LVL_IMPL, GET_INVIS_LEV(ch)), TRUE,
|
||||||
"%s tried to get help on %s", GET_NAME(ch), argument);
|
"%s tried to get help on %s", GET_NAME(ch), argument);
|
||||||
int i, found = 0;
|
int i, found = 0;
|
||||||
for (i = 0; i <= top_of_h_table; i++) {
|
for (i = 0; i <= top_of_h_table; i++) {
|
||||||
if (help_table[i].min_level > GET_LEVEL(ch))
|
if (help_table[i].min_level > GET_LEVEL(ch))
|
||||||
continue;
|
continue;
|
||||||
/* to help narrow down results, if they don't
|
/* to help narrow down results, if they don't
|
||||||
|
|
@ -1080,240 +1080,240 @@ ACMD(do_help)
|
||||||
"Usage: who [minlev[-maxlev]] [-n name] [-c classlist] [-k] [-l] [-n] [-q] [-r] [-s] [-z]\r\n"
|
"Usage: who [minlev[-maxlev]] [-n name] [-c classlist] [-k] [-l] [-n] [-q] [-r] [-s] [-z]\r\n"
|
||||||
|
|
||||||
/* Written by Rhade */
|
/* Written by Rhade */
|
||||||
ACMD(do_who)
|
ACMD(do_who)
|
||||||
{
|
{
|
||||||
struct descriptor_data *d;
|
struct descriptor_data *d;
|
||||||
struct char_data *tch;
|
struct char_data *tch;
|
||||||
int i, num_can_see = 0;
|
int i, num_can_see = 0;
|
||||||
char name_search[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH];
|
char name_search[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH];
|
||||||
char mode;
|
char mode;
|
||||||
int low = 0, high = LVL_IMPL, localwho = 0, questwho = 0;
|
int low = 0, high = LVL_IMPL, localwho = 0, questwho = 0;
|
||||||
int showclass = 0, short_list = 0, outlaws = 0;
|
int showclass = 0, short_list = 0, outlaws = 0;
|
||||||
int who_room = 0, showgroup = 0, showleader = 0;
|
int who_room = 0, showgroup = 0, showleader = 0;
|
||||||
|
|
||||||
skip_spaces(&argument);
|
skip_spaces(&argument);
|
||||||
strcpy(buf, argument); /* strcpy: OK (sizeof: argument == buf) */
|
strcpy(buf, argument); /* strcpy: OK (sizeof: argument == buf) */
|
||||||
name_search[0] = '\0';
|
name_search[0] = '\0';
|
||||||
|
|
||||||
while (*buf) {
|
while (*buf) {
|
||||||
char arg[MAX_INPUT_LENGTH], buf1[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH], buf1[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
half_chop(buf, arg, buf1);
|
half_chop(buf, arg, buf1);
|
||||||
if (isdigit(*arg)) {
|
if (isdigit(*arg)) {
|
||||||
sscanf(arg, "%d-%d", &low, &high);
|
sscanf(arg, "%d-%d", &low, &high);
|
||||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||||
} else if (*arg == '-') {
|
} else if (*arg == '-') {
|
||||||
mode = *(arg + 1); /* just in case; we destroy arg in the switch */
|
mode = *(arg + 1); /* just in case; we destroy arg in the switch */
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case 'k':
|
case 'k':
|
||||||
outlaws = 1;
|
outlaws = 1;
|
||||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||||
break;
|
break;
|
||||||
case 'z':
|
case 'z':
|
||||||
localwho = 1;
|
localwho = 1;
|
||||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
short_list = 1;
|
short_list = 1;
|
||||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||||
break;
|
break;
|
||||||
case 'q':
|
case 'q':
|
||||||
questwho = 1;
|
questwho = 1;
|
||||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||||
break;
|
break;
|
||||||
case 'n':
|
case 'n':
|
||||||
half_chop(buf1, name_search, buf);
|
half_chop(buf1, name_search, buf);
|
||||||
break;
|
break;
|
||||||
case 'r':
|
case 'r':
|
||||||
who_room = 1;
|
who_room = 1;
|
||||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||||
break;
|
break;
|
||||||
case 'c':
|
case 'c':
|
||||||
half_chop(buf1, arg, buf);
|
half_chop(buf1, arg, buf);
|
||||||
showclass = find_class_bitvector(arg);
|
showclass = find_class_bitvector(arg);
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
showleader = 1;
|
showleader = 1;
|
||||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||||
break;
|
break;
|
||||||
case 'g':
|
case 'g':
|
||||||
showgroup = 1;
|
showgroup = 1;
|
||||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
send_to_char(ch, "%s", WHO_FORMAT);
|
send_to_char(ch, "%s", WHO_FORMAT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
send_to_char(ch, "%s", WHO_FORMAT);
|
send_to_char(ch, "%s", WHO_FORMAT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
char *disp;
|
char *disp;
|
||||||
int min_level;
|
int min_level;
|
||||||
int max_level;
|
int max_level;
|
||||||
int count; /* must always start as 0 */
|
int count; /* must always start as 0 */
|
||||||
} rank[] = {
|
} rank[] = {
|
||||||
{ "Immortals\r\n---------\r\n", LVL_IMMORT, LVL_IMPL, 0},
|
{ "Immortals\r\n---------\r\n", LVL_IMMORT, LVL_IMPL, 0},
|
||||||
{ "Mortals\r\n-------\r\n", 1, LVL_IMMORT - 1, 0 },
|
{ "Mortals\r\n-------\r\n", 1, LVL_IMMORT - 1, 0 },
|
||||||
{ "\n", 0, 0, 0 }
|
{ "\n", 0, 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
for (d = descriptor_list; d && !short_list; d = d->next) {
|
for (d = descriptor_list; d && !short_list; d = d->next) {
|
||||||
if (d->original)
|
if (d->original)
|
||||||
tch = d->original;
|
tch = d->original;
|
||||||
else if (!(tch = d->character))
|
else if (!(tch = d->character))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (CAN_SEE(ch, tch) && IS_PLAYING(d)) {
|
if (CAN_SEE(ch, tch) && IS_PLAYING(d)) {
|
||||||
if (*name_search && str_cmp(GET_NAME(tch), name_search) &&
|
if (*name_search && str_cmp(GET_NAME(tch), name_search) &&
|
||||||
!strstr(GET_TITLE(tch), name_search))
|
!strstr(GET_TITLE(tch), name_search))
|
||||||
continue;
|
continue;
|
||||||
if (!CAN_SEE(ch, tch) || GET_LEVEL(tch) < low || GET_LEVEL(tch) > high)
|
if (!CAN_SEE(ch, tch) || GET_LEVEL(tch) < low || GET_LEVEL(tch) > high)
|
||||||
continue;
|
continue;
|
||||||
if (outlaws && !PLR_FLAGGED(tch, PLR_KILLER) && !PLR_FLAGGED(tch, PLR_THIEF))
|
if (outlaws && !PLR_FLAGGED(tch, PLR_KILLER) && !PLR_FLAGGED(tch, PLR_THIEF))
|
||||||
continue;
|
continue;
|
||||||
if (questwho && !PRF_FLAGGED(tch, PRF_QUEST))
|
if (questwho && !PRF_FLAGGED(tch, PRF_QUEST))
|
||||||
continue;
|
continue;
|
||||||
if (localwho && world[IN_ROOM(ch)].zone != world[IN_ROOM(tch)].zone)
|
if (localwho && world[IN_ROOM(ch)].zone != world[IN_ROOM(tch)].zone)
|
||||||
continue;
|
continue;
|
||||||
if (who_room && (IN_ROOM(tch) != IN_ROOM(ch)))
|
if (who_room && (IN_ROOM(tch) != IN_ROOM(ch)))
|
||||||
continue;
|
continue;
|
||||||
if (showclass && !(showclass & (1 << GET_CLASS(tch))))
|
if (showclass && !(showclass & (1 << GET_CLASS(tch))))
|
||||||
continue;
|
continue;
|
||||||
if (showgroup && (!tch->master || !AFF_FLAGGED(tch, AFF_GROUP)))
|
if (showgroup && (!tch->master || !AFF_FLAGGED(tch, AFF_GROUP)))
|
||||||
continue;
|
continue;
|
||||||
if (showleader && (!tch->followers || !AFF_FLAGGED(tch, AFF_GROUP)))
|
if (showleader && (!tch->followers || !AFF_FLAGGED(tch, AFF_GROUP)))
|
||||||
continue;
|
continue;
|
||||||
for (i = 0; *rank[i].disp != '\n'; i++)
|
for (i = 0; *rank[i].disp != '\n'; i++)
|
||||||
if (GET_LEVEL(tch) >= rank[i].min_level && GET_LEVEL(tch) <= rank[i].max_level)
|
if (GET_LEVEL(tch) >= rank[i].min_level && GET_LEVEL(tch) <= rank[i].max_level)
|
||||||
rank[i].count++;
|
rank[i].count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; *rank[i].disp != '\n'; i++) {
|
for (i = 0; *rank[i].disp != '\n'; i++) {
|
||||||
if (!rank[i].count && !short_list)
|
if (!rank[i].count && !short_list)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (short_list)
|
if (short_list)
|
||||||
send_to_char(ch, "Players\r\n-------\r\n");
|
send_to_char(ch, "Players\r\n-------\r\n");
|
||||||
else
|
else
|
||||||
send_to_char(ch, rank[i].disp);
|
send_to_char(ch, rank[i].disp);
|
||||||
|
|
||||||
for (d = descriptor_list; d; d = d->next) {
|
for (d = descriptor_list; d; d = d->next) {
|
||||||
if (d->original)
|
if (d->original)
|
||||||
tch = d->original;
|
tch = d->original;
|
||||||
else if (!(tch = d->character))
|
else if (!(tch = d->character))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if ((GET_LEVEL(tch) < rank[i].min_level || GET_LEVEL(tch) > rank[i].max_level) && !short_list)
|
if ((GET_LEVEL(tch) < rank[i].min_level || GET_LEVEL(tch) > rank[i].max_level) && !short_list)
|
||||||
continue;
|
continue;
|
||||||
if (!IS_PLAYING(d))
|
if (!IS_PLAYING(d))
|
||||||
continue;
|
continue;
|
||||||
if (*name_search && str_cmp(GET_NAME(tch), name_search) &&
|
if (*name_search && str_cmp(GET_NAME(tch), name_search) &&
|
||||||
!strstr(GET_TITLE(tch), name_search))
|
!strstr(GET_TITLE(tch), name_search))
|
||||||
continue;
|
continue;
|
||||||
if (!CAN_SEE(ch, tch) || GET_LEVEL(tch) < low || GET_LEVEL(tch) > high)
|
if (!CAN_SEE(ch, tch) || GET_LEVEL(tch) < low || GET_LEVEL(tch) > high)
|
||||||
continue;
|
continue;
|
||||||
if (outlaws && !PLR_FLAGGED(tch, PLR_KILLER) && !PLR_FLAGGED(tch, PLR_THIEF))
|
if (outlaws && !PLR_FLAGGED(tch, PLR_KILLER) && !PLR_FLAGGED(tch, PLR_THIEF))
|
||||||
continue;
|
continue;
|
||||||
if (questwho && !PRF_FLAGGED(tch, PRF_QUEST))
|
if (questwho && !PRF_FLAGGED(tch, PRF_QUEST))
|
||||||
continue;
|
continue;
|
||||||
if (localwho && world[IN_ROOM(ch)].zone != world[IN_ROOM(tch)].zone)
|
if (localwho && world[IN_ROOM(ch)].zone != world[IN_ROOM(tch)].zone)
|
||||||
continue;
|
continue;
|
||||||
if (who_room && (IN_ROOM(tch) != IN_ROOM(ch)))
|
if (who_room && (IN_ROOM(tch) != IN_ROOM(ch)))
|
||||||
continue;
|
continue;
|
||||||
if (showclass && !(showclass & (1 << GET_CLASS(tch))))
|
if (showclass && !(showclass & (1 << GET_CLASS(tch))))
|
||||||
continue;
|
continue;
|
||||||
if (showgroup && (!tch->master || !AFF_FLAGGED(tch, AFF_GROUP)))
|
if (showgroup && (!tch->master || !AFF_FLAGGED(tch, AFF_GROUP)))
|
||||||
continue;
|
continue;
|
||||||
if (showleader && (!tch->followers || !AFF_FLAGGED(tch, AFF_GROUP)))
|
if (showleader && (!tch->followers || !AFF_FLAGGED(tch, AFF_GROUP)))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (short_list) {
|
if (short_list) {
|
||||||
send_to_char(ch, "%s[%2d %s] %-12.12s%s%s",
|
send_to_char(ch, "%s[%2d %s] %-12.12s%s%s",
|
||||||
(GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""),
|
(GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""),
|
||||||
GET_LEVEL(tch), CLASS_ABBR(tch), GET_NAME(tch),
|
GET_LEVEL(tch), CLASS_ABBR(tch), GET_NAME(tch),
|
||||||
CCNRM(ch, C_SPR), ((!(++num_can_see % 4)) ? "\r\n" : ""));
|
CCNRM(ch, C_SPR), ((!(++num_can_see % 4)) ? "\r\n" : ""));
|
||||||
} else {
|
} else {
|
||||||
num_can_see++;
|
num_can_see++;
|
||||||
send_to_char(ch, "%s[%2d %s] %s%s%s%s",
|
send_to_char(ch, "%s[%2d %s] %s%s%s%s",
|
||||||
(GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""),
|
(GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""),
|
||||||
GET_LEVEL(tch), CLASS_ABBR(tch),
|
GET_LEVEL(tch), CLASS_ABBR(tch),
|
||||||
GET_NAME(tch), (*GET_TITLE(tch) ? " " : ""), GET_TITLE(tch),
|
GET_NAME(tch), (*GET_TITLE(tch) ? " " : ""), GET_TITLE(tch),
|
||||||
CCNRM(ch, C_SPR));
|
CCNRM(ch, C_SPR));
|
||||||
|
|
||||||
if (GET_INVIS_LEV(tch))
|
if (GET_INVIS_LEV(tch))
|
||||||
send_to_char(ch, " (i%d)", GET_INVIS_LEV(tch));
|
send_to_char(ch, " (i%d)", GET_INVIS_LEV(tch));
|
||||||
else if (AFF_FLAGGED(tch, AFF_INVISIBLE))
|
else if (AFF_FLAGGED(tch, AFF_INVISIBLE))
|
||||||
send_to_char(ch, " (invis)");
|
send_to_char(ch, " (invis)");
|
||||||
|
|
||||||
if (PLR_FLAGGED(tch, PLR_MAILING))
|
if (PLR_FLAGGED(tch, PLR_MAILING))
|
||||||
send_to_char(ch, " (mailing)");
|
send_to_char(ch, " (mailing)");
|
||||||
else if (d->olc)
|
else if (d->olc)
|
||||||
send_to_char(ch, " (OLC)");
|
send_to_char(ch, " (OLC)");
|
||||||
else if (PLR_FLAGGED(tch, PLR_WRITING))
|
else if (PLR_FLAGGED(tch, PLR_WRITING))
|
||||||
send_to_char(ch, " (writing)");
|
send_to_char(ch, " (writing)");
|
||||||
|
|
||||||
if (d->original)
|
if (d->original)
|
||||||
send_to_char(ch, " (out of body)");
|
send_to_char(ch, " (out of body)");
|
||||||
|
|
||||||
if (d->connected == CON_OEDIT)
|
if (d->connected == CON_OEDIT)
|
||||||
send_to_char(ch, " (Object Edit)");
|
send_to_char(ch, " (Object Edit)");
|
||||||
if (d->connected == CON_MEDIT)
|
if (d->connected == CON_MEDIT)
|
||||||
send_to_char(ch, " (Mobile Edit)");
|
send_to_char(ch, " (Mobile Edit)");
|
||||||
if (d->connected == CON_ZEDIT)
|
if (d->connected == CON_ZEDIT)
|
||||||
send_to_char(ch, " (Zone Edit)");
|
send_to_char(ch, " (Zone Edit)");
|
||||||
if (d->connected == CON_SEDIT)
|
if (d->connected == CON_SEDIT)
|
||||||
send_to_char(ch, " (Shop Edit)");
|
send_to_char(ch, " (Shop Edit)");
|
||||||
if (d->connected == CON_REDIT)
|
if (d->connected == CON_REDIT)
|
||||||
send_to_char(ch, " (Room Edit)");
|
send_to_char(ch, " (Room Edit)");
|
||||||
if (d->connected == CON_TEDIT)
|
if (d->connected == CON_TEDIT)
|
||||||
send_to_char(ch, " (Text Edit)");
|
send_to_char(ch, " (Text Edit)");
|
||||||
if (d->connected == CON_TRIGEDIT)
|
if (d->connected == CON_TRIGEDIT)
|
||||||
send_to_char(ch, " (Trigger Edit)");
|
send_to_char(ch, " (Trigger Edit)");
|
||||||
if (d->connected == CON_AEDIT)
|
if (d->connected == CON_AEDIT)
|
||||||
send_to_char(ch, " (Social Edit)");
|
send_to_char(ch, " (Social Edit)");
|
||||||
if (d->connected == CON_CEDIT)
|
if (d->connected == CON_CEDIT)
|
||||||
send_to_char(ch, " (Configuration Edit)");
|
send_to_char(ch, " (Configuration Edit)");
|
||||||
if (d->connected == CON_HEDIT)
|
if (d->connected == CON_HEDIT)
|
||||||
send_to_char(ch, " (Help edit)");
|
send_to_char(ch, " (Help edit)");
|
||||||
|
|
||||||
if (PRF_FLAGGED(tch, PRF_BUILDWALK))
|
if (PRF_FLAGGED(tch, PRF_BUILDWALK))
|
||||||
send_to_char(ch, " (Buildwalking)");
|
send_to_char(ch, " (Buildwalking)");
|
||||||
if (PRF_FLAGGED(tch, PRF_AFK))
|
if (PRF_FLAGGED(tch, PRF_AFK))
|
||||||
send_to_char(ch, " (AFK)");
|
send_to_char(ch, " (AFK)");
|
||||||
if (PRF_FLAGGED(ch, PRF_NOGOSS))
|
if (PRF_FLAGGED(ch, PRF_NOGOSS))
|
||||||
send_to_char(ch, " (nogos)");
|
send_to_char(ch, " (nogos)");
|
||||||
if (PRF_FLAGGED(ch, PRF_NOWIZ))
|
if (PRF_FLAGGED(ch, PRF_NOWIZ))
|
||||||
send_to_char(ch, " (nowiz)");
|
send_to_char(ch, " (nowiz)");
|
||||||
if (PRF_FLAGGED(tch, PRF_NOSHOUT))
|
if (PRF_FLAGGED(tch, PRF_NOSHOUT))
|
||||||
send_to_char(ch, " (noshout)");
|
send_to_char(ch, " (noshout)");
|
||||||
if (PRF_FLAGGED(tch, PRF_NOTELL))
|
if (PRF_FLAGGED(tch, PRF_NOTELL))
|
||||||
send_to_char(ch, " (notell)");
|
send_to_char(ch, " (notell)");
|
||||||
if (PRF_FLAGGED(tch, PRF_QUEST))
|
if (PRF_FLAGGED(tch, PRF_QUEST))
|
||||||
send_to_char(ch, " (quest)");
|
send_to_char(ch, " (quest)");
|
||||||
if (PLR_FLAGGED(tch, PLR_THIEF))
|
if (PLR_FLAGGED(tch, PLR_THIEF))
|
||||||
send_to_char(ch, " (THIEF)");
|
send_to_char(ch, " (THIEF)");
|
||||||
if (PLR_FLAGGED(tch, PLR_KILLER))
|
if (PLR_FLAGGED(tch, PLR_KILLER))
|
||||||
send_to_char(ch, " (KILLER)");
|
send_to_char(ch, " (KILLER)");
|
||||||
send_to_char(ch, "\r\n");
|
send_to_char(ch, "\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
send_to_char(ch, "\r\n");
|
send_to_char(ch, "\r\n");
|
||||||
if (short_list)
|
if (short_list)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (short_list && num_can_see % 4)
|
if (short_list && num_can_see % 4)
|
||||||
send_to_char(ch, "\r\n");
|
send_to_char(ch, "\r\n");
|
||||||
if (!num_can_see)
|
if (!num_can_see)
|
||||||
send_to_char(ch, "Nobody at all!\r\n");
|
send_to_char(ch, "Nobody at all!\r\n");
|
||||||
else if (num_can_see == 1)
|
else if (num_can_see == 1)
|
||||||
send_to_char(ch, "One lonely character displayed.\r\n");
|
send_to_char(ch, "One lonely character displayed.\r\n");
|
||||||
else
|
else
|
||||||
send_to_char(ch, "%d characters displayed.\r\n", num_can_see);
|
send_to_char(ch, "%d characters displayed.\r\n", num_can_see);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -1766,17 +1766,17 @@ ACMD(do_toggle)
|
||||||
strcpy(buf2, "OFF"); /* strcpy: OK */
|
strcpy(buf2, "OFF"); /* strcpy: OK */
|
||||||
else
|
else
|
||||||
sprintf(buf2, "%-3.3d", GET_WIMP_LEV(ch)); /* sprintf: OK */
|
sprintf(buf2, "%-3.3d", GET_WIMP_LEV(ch)); /* sprintf: OK */
|
||||||
|
|
||||||
if (GET_LEVEL(ch) == LVL_IMPL) {
|
if (GET_LEVEL(ch) == LVL_IMPL) {
|
||||||
send_to_char(ch,
|
send_to_char(ch,
|
||||||
" SlowNameserver: %-3s "
|
" SlowNameserver: %-3s "
|
||||||
" "
|
" "
|
||||||
" Trackthru Doors: %-3s\r\n",
|
" Trackthru Doors: %-3s\r\n",
|
||||||
|
|
||||||
ONOFF(CONFIG_NS_IS_SLOW),
|
ONOFF(CONFIG_NS_IS_SLOW),
|
||||||
ONOFF(CONFIG_TRACK_T_DOORS));
|
ONOFF(CONFIG_TRACK_T_DOORS));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GET_LEVEL(ch) >= LVL_IMMORT) {
|
if (GET_LEVEL(ch) >= LVL_IMMORT) {
|
||||||
send_to_char(ch,
|
send_to_char(ch,
|
||||||
" Buildwalk: %-3s "
|
" Buildwalk: %-3s "
|
||||||
|
|
@ -1931,7 +1931,7 @@ ACMD(do_toggle)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (toggle) {
|
switch (toggle) {
|
||||||
case SCMD_COLOR:
|
case SCMD_COLOR:
|
||||||
if (!*arg2) {
|
if (!*arg2) {
|
||||||
send_to_char(ch, "Your current color level is %s.\r\n", types[COLOR_LEV(ch)]);
|
send_to_char(ch, "Your current color level is %s.\r\n", types[COLOR_LEV(ch)]);
|
||||||
|
|
@ -1947,17 +1947,17 @@ ACMD(do_toggle)
|
||||||
send_to_char(ch, "Your %scolor%s is now %s.\r\n", CCRED(ch, C_SPR), CCNRM(ch, C_OFF), types[tp]);
|
send_to_char(ch, "Your %scolor%s is now %s.\r\n", CCRED(ch, C_SPR), CCNRM(ch, C_OFF), types[tp]);
|
||||||
return;
|
return;
|
||||||
case SCMD_SYSLOG:
|
case SCMD_SYSLOG:
|
||||||
if (!*arg2) {
|
if (!*arg2) {
|
||||||
send_to_char(ch, "Your syslog is currently %s.\r\n",
|
send_to_char(ch, "Your syslog is currently %s.\r\n",
|
||||||
types[(PRF_FLAGGED(ch, PRF_LOG1) ? 1 : 0) + (PRF_FLAGGED(ch, PRF_LOG2) ? 2 : 0)]);
|
types[(PRF_FLAGGED(ch, PRF_LOG1) ? 1 : 0) + (PRF_FLAGGED(ch, PRF_LOG2) ? 2 : 0)]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (((tp = search_block(arg2, types, FALSE)) == -1)) {
|
if (((tp = search_block(arg2, types, FALSE)) == -1)) {
|
||||||
send_to_char(ch, "Usage: syslog { Off | Brief | Normal | On }\r\n");
|
send_to_char(ch, "Usage: syslog { Off | Brief | Normal | On }\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
REMOVE_BIT(PRF_FLAGS(ch), PRF_LOG1 | PRF_LOG2);
|
REMOVE_BIT(PRF_FLAGS(ch), PRF_LOG1 | PRF_LOG2);
|
||||||
SET_BIT(PRF_FLAGS(ch), (PRF_LOG1 * (tp & 1)) | (PRF_LOG2 * (tp & 2) >> 1));
|
SET_BIT(PRF_FLAGS(ch), (PRF_LOG1 * (tp & 1)) | (PRF_LOG2 * (tp & 2) >> 1));
|
||||||
send_to_char(ch, "Your syslog is now %s.\r\n", types[tp]);
|
send_to_char(ch, "Your syslog is now %s.\r\n", types[tp]);
|
||||||
return;
|
return;
|
||||||
case SCMD_SLOWNS:
|
case SCMD_SLOWNS:
|
||||||
|
|
@ -2020,7 +2020,7 @@ ACMD(do_toggle)
|
||||||
else if (is_number(arg2)) {
|
else if (is_number(arg2)) {
|
||||||
GET_PAGE_LENGTH(ch) = MIN(MAX(atoi(arg2), 5), 255);
|
GET_PAGE_LENGTH(ch) = MIN(MAX(atoi(arg2), 5), 255);
|
||||||
send_to_char(ch, "Okay, your page length is now set to %d lines.\r\n", GET_PAGE_LENGTH(ch));
|
send_to_char(ch, "Okay, your page length is now set to %d lines.\r\n", GET_PAGE_LENGTH(ch));
|
||||||
} else
|
} else
|
||||||
send_to_char(ch, "Please specify a number of lines (5 - 255).\r\n");
|
send_to_char(ch, "Please specify a number of lines (5 - 255).\r\n");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
|
@ -2047,7 +2047,7 @@ ACMD(do_toggle)
|
||||||
|
|
||||||
int sort_commands_helper(const void *a, const void *b)
|
int sort_commands_helper(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
return strcmp(complete_cmd_info[*(const int *)a].sort_as,
|
return strcmp(complete_cmd_info[*(const int *)a].sort_as,
|
||||||
complete_cmd_info[*(const int *)b].sort_as);
|
complete_cmd_info[*(const int *)b].sort_as);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -211,7 +211,7 @@ void perform_get_from_container(struct char_data *ch, struct obj_data *obj,
|
||||||
if (mode == FIND_OBJ_INV || can_take_obj(ch, obj)) {
|
if (mode == FIND_OBJ_INV || can_take_obj(ch, obj)) {
|
||||||
if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch))
|
if (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch))
|
||||||
act("$p: you can't hold any more items.", FALSE, ch, obj, 0, TO_CHAR);
|
act("$p: you can't hold any more items.", FALSE, ch, obj, 0, TO_CHAR);
|
||||||
else if (get_otrigger(obj, ch)) {
|
else if (get_otrigger(obj, ch)) {
|
||||||
obj_from_obj(obj);
|
obj_from_obj(obj);
|
||||||
obj_to_char(obj, ch);
|
obj_to_char(obj, ch);
|
||||||
act("You get $p from $P.", FALSE, ch, obj, cont, TO_CHAR);
|
act("You get $p from $P.", FALSE, ch, obj, cont, TO_CHAR);
|
||||||
|
|
@ -275,7 +275,7 @@ void get_from_container(struct char_data *ch, struct obj_data *cont,
|
||||||
|
|
||||||
int perform_get_from_room(struct char_data *ch, struct obj_data *obj)
|
int perform_get_from_room(struct char_data *ch, struct obj_data *obj)
|
||||||
{
|
{
|
||||||
if (can_take_obj(ch, obj) && get_otrigger(obj, ch)) {
|
if (can_take_obj(ch, obj) && get_otrigger(obj, ch)) {
|
||||||
obj_from_room(obj);
|
obj_from_room(obj);
|
||||||
obj_to_char(obj, ch);
|
obj_to_char(obj, ch);
|
||||||
act("You get $p.", FALSE, ch, obj, 0, TO_CHAR);
|
act("You get $p.", FALSE, ch, obj, 0, TO_CHAR);
|
||||||
|
|
@ -458,7 +458,7 @@ int perform_drop(struct char_data *ch, struct obj_data *obj,
|
||||||
|
|
||||||
if (!drop_otrigger(obj, ch))
|
if (!drop_otrigger(obj, ch))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((mode == SCMD_DROP) && !drop_wtrigger(obj, ch))
|
if ((mode == SCMD_DROP) && !drop_wtrigger(obj, ch))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
|
@ -512,7 +512,7 @@ ACMD(do_drop)
|
||||||
byte mode = SCMD_DROP;
|
byte mode = SCMD_DROP;
|
||||||
int dotmode, amount = 0, multi, num_don_rooms;
|
int dotmode, amount = 0, multi, num_don_rooms;
|
||||||
const char *sname;
|
const char *sname;
|
||||||
|
|
||||||
switch (subcmd) {
|
switch (subcmd) {
|
||||||
case SCMD_JUNK:
|
case SCMD_JUNK:
|
||||||
sname = "junk";
|
sname = "junk";
|
||||||
|
|
@ -522,9 +522,9 @@ ACMD(do_drop)
|
||||||
sname = "donate";
|
sname = "donate";
|
||||||
mode = SCMD_DONATE;
|
mode = SCMD_DONATE;
|
||||||
/* fail + double chance for room 1 */
|
/* fail + double chance for room 1 */
|
||||||
num_don_rooms = (CONFIG_DON_ROOM_1 != NOWHERE) * 2 +
|
num_don_rooms = (CONFIG_DON_ROOM_1 != NOWHERE) * 2 +
|
||||||
(CONFIG_DON_ROOM_2 != NOWHERE) +
|
(CONFIG_DON_ROOM_2 != NOWHERE) +
|
||||||
(CONFIG_DON_ROOM_3 != NOWHERE) + 1 ;
|
(CONFIG_DON_ROOM_3 != NOWHERE) + 1 ;
|
||||||
switch (rand_number(0, num_don_rooms)) {
|
switch (rand_number(0, num_don_rooms)) {
|
||||||
case 0:
|
case 0:
|
||||||
mode = SCMD_JUNK;
|
mode = SCMD_JUNK;
|
||||||
|
|
@ -621,7 +621,7 @@ ACMD(do_drop)
|
||||||
void perform_give(struct char_data *ch, struct char_data *vict,
|
void perform_give(struct char_data *ch, struct char_data *vict,
|
||||||
struct obj_data *obj)
|
struct obj_data *obj)
|
||||||
{
|
{
|
||||||
if (!give_otrigger(obj, ch, vict))
|
if (!give_otrigger(obj, ch, vict))
|
||||||
return;
|
return;
|
||||||
if (!receive_mtrigger(vict, ch, obj))
|
if (!receive_mtrigger(vict, ch, obj))
|
||||||
return;
|
return;
|
||||||
|
|
@ -716,7 +716,7 @@ ACMD(do_give)
|
||||||
send_to_char(ch, "What do you want to give %d of?\r\n", amount);
|
send_to_char(ch, "What do you want to give %d of?\r\n", amount);
|
||||||
else if (!(vict = give_find_vict(ch, argument)))
|
else if (!(vict = give_find_vict(ch, argument)))
|
||||||
return;
|
return;
|
||||||
else if (!(obj = get_obj_in_list_vis(ch, arg, NULL, ch->carrying)))
|
else if (!(obj = get_obj_in_list_vis(ch, arg, NULL, ch->carrying)))
|
||||||
send_to_char(ch, "You don't seem to have any %ss.\r\n", arg);
|
send_to_char(ch, "You don't seem to have any %ss.\r\n", arg);
|
||||||
else {
|
else {
|
||||||
while (obj && amount--) {
|
while (obj && amount--) {
|
||||||
|
|
@ -895,10 +895,10 @@ ACMD(do_drink)
|
||||||
send_to_char(ch, "It's empty.\r\n");
|
send_to_char(ch, "It's empty.\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!consume_otrigger(temp, ch, OCMD_DRINK)) /* check trigger */
|
if (!consume_otrigger(temp, ch, OCMD_DRINK)) /* check trigger */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (subcmd == SCMD_DRINK) {
|
if (subcmd == SCMD_DRINK) {
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -76,7 +76,7 @@ int has_boat(struct char_data *ch)
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* do_simple_move assumes
|
/* do_simple_move assumes
|
||||||
* 1. That there is no master and no followers.
|
* 1. That there is no master and no followers.
|
||||||
|
|
|
||||||
|
|
@ -71,7 +71,7 @@ ACMD(do_assist)
|
||||||
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))
|
||||||
act("Use 'murder' if you really want to attack $N.", FALSE,
|
act("Use 'murder' if you really want to attack $N.", FALSE,
|
||||||
ch, 0, opponent, TO_CHAR);
|
ch, 0, opponent, TO_CHAR);
|
||||||
else {
|
else {
|
||||||
|
|
|
||||||
|
|
@ -232,7 +232,7 @@ ACMD(do_steal)
|
||||||
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;
|
||||||
|
|
@ -253,7 +253,7 @@ ACMD(do_steal)
|
||||||
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;
|
||||||
|
|
@ -492,7 +492,7 @@ ACMD(do_ungroup)
|
||||||
act("$N is no longer a member of your group.", FALSE, ch, 0, tch, TO_CHAR);
|
act("$N is no longer a member of your group.", FALSE, ch, 0, tch, TO_CHAR);
|
||||||
act("You have been kicked out of $n's group!", FALSE, ch, 0, tch, TO_VICT);
|
act("You have been kicked out of $n's group!", FALSE, ch, 0, tch, TO_VICT);
|
||||||
act("$N has been kicked out of $n's group!", FALSE, ch, 0, tch, TO_NOTVICT);
|
act("$N has been kicked out of $n's group!", FALSE, ch, 0, tch, TO_NOTVICT);
|
||||||
|
|
||||||
if (!AFF_FLAGGED(tch, AFF_CHARM))
|
if (!AFF_FLAGGED(tch, AFF_CHARM))
|
||||||
stop_follower(tch);
|
stop_follower(tch);
|
||||||
}
|
}
|
||||||
|
|
@ -901,12 +901,12 @@ ACMD(do_gen_tog)
|
||||||
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");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
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))
|
||||||
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
|
||||||
mudlog(CMP, GET_LEVEL(ch), TRUE,
|
mudlog(CMP, GET_LEVEL(ch), TRUE,
|
||||||
|
|
@ -991,7 +991,7 @@ ACMD(do_file)
|
||||||
req_lines = 15; /* default is the last 15 lines */
|
req_lines = 15; /* default is the last 15 lines */
|
||||||
else
|
else
|
||||||
req_lines = atoi(value);
|
req_lines = atoi(value);
|
||||||
|
|
||||||
if (!(req_file=fopen(fields[l].file,"r"))) {
|
if (!(req_file=fopen(fields[l].file,"r"))) {
|
||||||
mudlog(BRF, LVL_IMPL, TRUE,
|
mudlog(BRF, LVL_IMPL, TRUE,
|
||||||
"SYSERR: Error opening file %s using 'file' command.",
|
"SYSERR: Error opening file %s using 'file' command.",
|
||||||
|
|
@ -1007,7 +1007,7 @@ ACMD(do_file)
|
||||||
rewind(req_file);
|
rewind(req_file);
|
||||||
|
|
||||||
req_lines = MIN(MIN(req_lines, num_lines),150);
|
req_lines = MIN(MIN(req_lines, num_lines),150);
|
||||||
|
|
||||||
len = snprintf(buf, sizeof(buf), "Last %d lines of %s:\r\n", req_lines, fields[l].file);
|
len = snprintf(buf, sizeof(buf), "Last %d lines of %s:\r\n", req_lines, fields[l].file);
|
||||||
|
|
||||||
get_line(req_file,line);
|
get_line(req_file,line);
|
||||||
|
|
|
||||||
|
|
@ -58,7 +58,7 @@ ACMD(do_action)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!action->char_found)
|
if (!action->char_found)
|
||||||
*arg = '\0';
|
*arg = '\0';
|
||||||
|
|
||||||
if (action->char_found && argument)
|
if (action->char_found && argument)
|
||||||
|
|
@ -82,8 +82,8 @@ ACMD(do_action)
|
||||||
else
|
else
|
||||||
send_to_char(ch, "I don't see anything by that name here.\r\n");
|
send_to_char(ch, "I don't see anything by that name here.\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (vict == ch) {
|
if (vict == ch) {
|
||||||
if (action->char_auto)
|
if (action->char_auto)
|
||||||
send_to_char(ch, "%s\r\n", action->char_auto);
|
send_to_char(ch, "%s\r\n", action->char_auto);
|
||||||
|
|
@ -91,8 +91,8 @@ ACMD(do_action)
|
||||||
send_to_char(ch, "Erm, no.");
|
send_to_char(ch, "Erm, no.");
|
||||||
act(action->others_auto, action->hide, ch, 0, 0, TO_ROOM);
|
act(action->others_auto, action->hide, ch, 0, 0, TO_ROOM);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
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.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
|
act("$N is not in a proper position for that.", FALSE, ch, 0, vict, TO_CHAR | TO_SLEEP);
|
||||||
else {
|
else {
|
||||||
|
|
@ -165,7 +165,7 @@ void create_command_list(void)
|
||||||
extern struct command_info cmd_info[];
|
extern struct command_info cmd_info[];
|
||||||
|
|
||||||
/* free up old command list */
|
/* free up old command list */
|
||||||
if (complete_cmd_info)
|
if (complete_cmd_info)
|
||||||
free_command_list();
|
free_command_list();
|
||||||
|
|
||||||
/* re check the sort on the socials */
|
/* re check the sort on the socials */
|
||||||
|
|
@ -193,7 +193,7 @@ void create_command_list(void)
|
||||||
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 {
|
||||||
|
|
@ -215,30 +215,30 @@ void create_command_list(void)
|
||||||
log("Command info rebuilt, %d total commands.", k);
|
log("Command info rebuilt, %d total commands.", k);
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_command_list(void)
|
void free_command_list(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0;*complete_cmd_info[i].command !='\n';i++);
|
for (i = 0;*complete_cmd_info[i].command !='\n';i++);
|
||||||
|
|
||||||
free((char *)complete_cmd_info[i].command); /* special case, the terminator */
|
free((char *)complete_cmd_info[i].command); /* special case, the terminator */
|
||||||
free((char *)complete_cmd_info[i].sort_as);
|
free((char *)complete_cmd_info[i].sort_as);
|
||||||
free(complete_cmd_info);
|
free(complete_cmd_info);
|
||||||
complete_cmd_info = NULL;
|
complete_cmd_info = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_social_messages(void)
|
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->command) free(mess->command);
|
||||||
|
|
@ -303,7 +303,7 @@ ACMD(do_gmote)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_SOUNDPROOF)) {
|
if (ROOM_FLAGGED(IN_ROOM(ch), ROOM_SOUNDPROOF)) {
|
||||||
send_to_char(ch, "The walls seem to absorb your actions.\r\n");
|
send_to_char(ch, "The walls seem to absorb your actions.\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
372
src/act.wizard.c
372
src/act.wizard.c
File diff suppressed because it is too large
Load diff
72
src/aedit.c
72
src/aedit.c
|
|
@ -47,7 +47,7 @@ ACMD(do_oasis_aedit)
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
struct descriptor_data *d;
|
struct descriptor_data *d;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (CONFIG_NEW_SOCIALS == 0) {
|
if (CONFIG_NEW_SOCIALS == 0) {
|
||||||
send_to_char(ch, "Socials cannot be edited at the moment.\r\n");
|
send_to_char(ch, "Socials cannot be edited at the moment.\r\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -65,7 +65,7 @@ ACMD(do_oasis_aedit)
|
||||||
}
|
}
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
|
|
||||||
if (!*arg) {
|
if (!*arg) {
|
||||||
send_to_char(ch, "Please specify a social to edit.\r\n");
|
send_to_char(ch, "Please specify a social to edit.\r\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -80,7 +80,7 @@ ACMD(do_oasis_aedit)
|
||||||
send_to_char(ch, "Done.\r\n");
|
send_to_char(ch, "Done.\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Give descriptor an OLC structure.
|
* Give descriptor an OLC structure.
|
||||||
*/
|
*/
|
||||||
|
|
@ -92,8 +92,8 @@ ACMD(do_oasis_aedit)
|
||||||
|
|
||||||
OLC_NUM(d) = 0;
|
OLC_NUM(d) = 0;
|
||||||
OLC_STORAGE(d) = strdup(arg);
|
OLC_STORAGE(d) = strdup(arg);
|
||||||
|
|
||||||
for (OLC_ZNUM(d) = 0; (OLC_ZNUM(d) <= top_of_socialt); OLC_ZNUM(d)++)
|
for (OLC_ZNUM(d) = 0; (OLC_ZNUM(d) <= top_of_socialt); OLC_ZNUM(d)++)
|
||||||
if (is_abbrev(OLC_STORAGE(d), soc_mess_list[OLC_ZNUM(d)].command))
|
if (is_abbrev(OLC_STORAGE(d), soc_mess_list[OLC_ZNUM(d)].command))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -182,11 +182,11 @@ void aedit_setup_existing(struct descriptor_data *d, int real_num) {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void aedit_save_internally(struct descriptor_data *d) {
|
void aedit_save_internally(struct descriptor_data *d) {
|
||||||
struct social_messg *new_soc_mess_list = NULL;
|
struct social_messg *new_soc_mess_list = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* add a new social into the list */
|
/* add a new social into the list */
|
||||||
if (OLC_ZNUM(d) > top_of_socialt) {
|
if (OLC_ZNUM(d) > top_of_socialt) {
|
||||||
CREATE(new_soc_mess_list, struct social_messg, top_of_socialt + 2);
|
CREATE(new_soc_mess_list, struct social_messg, top_of_socialt + 2);
|
||||||
|
|
@ -251,10 +251,10 @@ void aedit_save_to_disk(struct descriptor_data *d) {
|
||||||
((soc_mess_list[i].char_obj_found)?soc_mess_list[i].char_obj_found:"#"),
|
((soc_mess_list[i].char_obj_found)?soc_mess_list[i].char_obj_found:"#"),
|
||||||
((soc_mess_list[i].others_obj_found)?soc_mess_list[i].others_obj_found:"#"));
|
((soc_mess_list[i].others_obj_found)?soc_mess_list[i].others_obj_found:"#"));
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(fp, "$\n");
|
fprintf(fp, "$\n");
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
remove_from_save_list(AEDIT_PERMISSION, SL_ACTION);
|
remove_from_save_list(AEDIT_PERMISSION, SL_ACTION);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------------------*/
|
/*------------------------------------------------------------------------*/
|
||||||
|
|
@ -267,8 +267,8 @@ void aedit_disp_menu(struct descriptor_data * d) {
|
||||||
struct char_data *ch = d->character;
|
struct char_data *ch = d->character;
|
||||||
|
|
||||||
get_char_colors(ch);
|
get_char_colors(ch);
|
||||||
|
|
||||||
write_to_output(d,
|
write_to_output(d,
|
||||||
"%s-- Action editor\r\n"
|
"%s-- Action editor\r\n"
|
||||||
"%sn%s) Command : %s%-15.15s%s %s1%s) Sort as Command : %s%-15.15s%s\r\n"
|
"%sn%s) Command : %s%-15.15s%s %s1%s) Sort as Command : %s%-15.15s%s\r\n"
|
||||||
"%s2%s) Min Position[CH]: %s%-8.8s %s3%s) Min Position [VT]: %s%-8.8s\r\n"
|
"%s2%s) Min Position[CH]: %s%-8.8s %s3%s) Min Position [VT]: %s%-8.8s\r\n"
|
||||||
|
|
@ -344,7 +344,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
switch (*arg) {
|
switch (*arg) {
|
||||||
case 'y': case 'Y':
|
case 'y': case 'Y':
|
||||||
aedit_save_internally(d);
|
aedit_save_internally(d);
|
||||||
mudlog (CMP, LVL_IMPL, TRUE, "OLC: %s edits action %s",
|
mudlog (CMP, LVL_IMPL, TRUE, "OLC: %s edits action %s",
|
||||||
GET_NAME(d->character), OLC_ACTION(d)->command);
|
GET_NAME(d->character), OLC_ACTION(d)->command);
|
||||||
|
|
||||||
/* do not free the strings.. just the structure */
|
/* do not free the strings.. just the structure */
|
||||||
|
|
@ -373,7 +373,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
case 'n': case 'N':
|
case 'n': case 'N':
|
||||||
OLC_ZNUM(d)++;
|
OLC_ZNUM(d)++;
|
||||||
for (;(OLC_ZNUM(d) <= top_of_socialt); OLC_ZNUM(d)++)
|
for (;(OLC_ZNUM(d) <= top_of_socialt); OLC_ZNUM(d)++)
|
||||||
if (is_abbrev(OLC_STORAGE(d), soc_mess_list[OLC_ZNUM(d)].command))
|
if (is_abbrev(OLC_STORAGE(d), soc_mess_list[OLC_ZNUM(d)].command))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (OLC_ZNUM(d) > top_of_socialt) {
|
if (OLC_ZNUM(d) > top_of_socialt) {
|
||||||
|
|
@ -392,7 +392,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
write_to_output(d, "Invalid choice!\r\n"
|
write_to_output(d, "Invalid choice!\r\n"
|
||||||
"Do you wish to edit the '%s' action? ",
|
"Do you wish to edit the '%s' action? ",
|
||||||
soc_mess_list[OLC_ZNUM(d)].command);
|
soc_mess_list[OLC_ZNUM(d)].command);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -408,7 +408,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
write_to_output(d, "Invalid choice!\r\n"
|
write_to_output(d, "Invalid choice!\r\n"
|
||||||
"Do you wish to add the '%s' action? ",
|
"Do you wish to add the '%s' action? ",
|
||||||
OLC_STORAGE(d));
|
OLC_STORAGE(d));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -435,7 +435,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
write_to_output(d, "Enter the minimum position the Character has to be in to activate social:\r\n");
|
write_to_output(d, "Enter the minimum position the Character has to be in to activate social:\r\n");
|
||||||
for (i=POS_DEAD;i<=POS_STANDING;i++)
|
for (i=POS_DEAD;i<=POS_STANDING;i++)
|
||||||
write_to_output(d, " %d) %s\r\n", i, position_types[i]);
|
write_to_output(d, " %d) %s\r\n", i, position_types[i]);
|
||||||
|
|
||||||
write_to_output(d, "Enter choice: ");
|
write_to_output(d, "Enter choice: ");
|
||||||
OLC_MODE(d) = AEDIT_MIN_CHAR_POS;
|
OLC_MODE(d) = AEDIT_MIN_CHAR_POS;
|
||||||
return;
|
return;
|
||||||
|
|
@ -443,7 +443,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
write_to_output(d, "Enter the minimum position the Victim has to be in to activate social:\r\n");
|
write_to_output(d, "Enter the minimum position the Victim has to be in to activate social:\r\n");
|
||||||
for (i=POS_DEAD;i<=POS_STANDING;i++)
|
for (i=POS_DEAD;i<=POS_STANDING;i++)
|
||||||
write_to_output(d, " %d) %s\r\n", i, position_types[i]);
|
write_to_output(d, " %d) %s\r\n", i, position_types[i]);
|
||||||
|
|
||||||
write_to_output(d, "Enter choice: ");
|
write_to_output(d, "Enter choice: ");
|
||||||
OLC_MODE(d) = AEDIT_MIN_VICT_POS;
|
OLC_MODE(d) = AEDIT_MIN_VICT_POS;
|
||||||
return;
|
return;
|
||||||
|
|
@ -475,7 +475,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
((OLC_ACTION(d)->not_found)?OLC_ACTION(d)->not_found:"NULL"));
|
((OLC_ACTION(d)->not_found)?OLC_ACTION(d)->not_found:"NULL"));
|
||||||
|
|
||||||
OLC_MODE(d) = AEDIT_VICT_NOT_FOUND;
|
OLC_MODE(d) = AEDIT_VICT_NOT_FOUND;
|
||||||
return;
|
return;
|
||||||
case 'd': case 'D':
|
case 'd': case 'D':
|
||||||
|
|
@ -483,7 +483,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
((OLC_ACTION(d)->char_auto)?OLC_ACTION(d)->char_auto:"NULL"));
|
((OLC_ACTION(d)->char_auto)?OLC_ACTION(d)->char_auto:"NULL"));
|
||||||
|
|
||||||
OLC_MODE(d) = AEDIT_SELF_CHAR;
|
OLC_MODE(d) = AEDIT_SELF_CHAR;
|
||||||
return;
|
return;
|
||||||
case 'e': case 'E':
|
case 'e': case 'E':
|
||||||
|
|
@ -491,7 +491,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
((OLC_ACTION(d)->others_auto)?OLC_ACTION(d)->others_auto:"NULL"));
|
((OLC_ACTION(d)->others_auto)?OLC_ACTION(d)->others_auto:"NULL"));
|
||||||
|
|
||||||
OLC_MODE(d) = AEDIT_SELF_OTHERS;
|
OLC_MODE(d) = AEDIT_SELF_OTHERS;
|
||||||
return;
|
return;
|
||||||
case 'f': case 'F':
|
case 'f': case 'F':
|
||||||
|
|
@ -499,7 +499,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
((OLC_ACTION(d)->char_found)?OLC_ACTION(d)->char_found:"NULL"));
|
((OLC_ACTION(d)->char_found)?OLC_ACTION(d)->char_found:"NULL"));
|
||||||
|
|
||||||
OLC_MODE(d) = AEDIT_VICT_CHAR_FOUND;
|
OLC_MODE(d) = AEDIT_VICT_CHAR_FOUND;
|
||||||
return;
|
return;
|
||||||
case 'g': case 'G':
|
case 'g': case 'G':
|
||||||
|
|
@ -507,7 +507,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
((OLC_ACTION(d)->others_found)?OLC_ACTION(d)->others_found:"NULL"));
|
((OLC_ACTION(d)->others_found)?OLC_ACTION(d)->others_found:"NULL"));
|
||||||
|
|
||||||
OLC_MODE(d) = AEDIT_VICT_OTHERS_FOUND;
|
OLC_MODE(d) = AEDIT_VICT_OTHERS_FOUND;
|
||||||
return;
|
return;
|
||||||
case 'h': case 'H':
|
case 'h': case 'H':
|
||||||
|
|
@ -515,7 +515,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
((OLC_ACTION(d)->vict_found)?OLC_ACTION(d)->vict_found:"NULL"));
|
((OLC_ACTION(d)->vict_found)?OLC_ACTION(d)->vict_found:"NULL"));
|
||||||
|
|
||||||
OLC_MODE(d) = AEDIT_VICT_VICT_FOUND;
|
OLC_MODE(d) = AEDIT_VICT_VICT_FOUND;
|
||||||
return;
|
return;
|
||||||
case 'i': case 'I':
|
case 'i': case 'I':
|
||||||
|
|
@ -523,7 +523,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
((OLC_ACTION(d)->char_body_found)?OLC_ACTION(d)->char_body_found:"NULL"));
|
((OLC_ACTION(d)->char_body_found)?OLC_ACTION(d)->char_body_found:"NULL"));
|
||||||
|
|
||||||
OLC_MODE(d) = AEDIT_VICT_CHAR_BODY_FOUND;
|
OLC_MODE(d) = AEDIT_VICT_CHAR_BODY_FOUND;
|
||||||
return;
|
return;
|
||||||
case 'j': case 'J':
|
case 'j': case 'J':
|
||||||
|
|
@ -531,7 +531,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
((OLC_ACTION(d)->others_body_found)?OLC_ACTION(d)->others_body_found:"NULL"));
|
((OLC_ACTION(d)->others_body_found)?OLC_ACTION(d)->others_body_found:"NULL"));
|
||||||
|
|
||||||
OLC_MODE(d) = AEDIT_VICT_OTHERS_BODY_FOUND;
|
OLC_MODE(d) = AEDIT_VICT_OTHERS_BODY_FOUND;
|
||||||
return;
|
return;
|
||||||
case 'k': case 'K':
|
case 'k': case 'K':
|
||||||
|
|
@ -539,7 +539,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
((OLC_ACTION(d)->vict_body_found)?OLC_ACTION(d)->vict_body_found:"NULL"));
|
((OLC_ACTION(d)->vict_body_found)?OLC_ACTION(d)->vict_body_found:"NULL"));
|
||||||
|
|
||||||
OLC_MODE(d) = AEDIT_VICT_VICT_BODY_FOUND;
|
OLC_MODE(d) = AEDIT_VICT_VICT_BODY_FOUND;
|
||||||
return;
|
return;
|
||||||
case 'l': case 'L':
|
case 'l': case 'L':
|
||||||
|
|
@ -547,7 +547,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
((OLC_ACTION(d)->char_obj_found)?OLC_ACTION(d)->char_obj_found:"NULL"));
|
((OLC_ACTION(d)->char_obj_found)?OLC_ACTION(d)->char_obj_found:"NULL"));
|
||||||
|
|
||||||
OLC_MODE(d) = AEDIT_OBJ_CHAR_FOUND;
|
OLC_MODE(d) = AEDIT_OBJ_CHAR_FOUND;
|
||||||
return;
|
return;
|
||||||
case 'm': case 'M':
|
case 'm': case 'M':
|
||||||
|
|
@ -555,7 +555,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
"[OLD]: %s\r\n"
|
"[OLD]: %s\r\n"
|
||||||
"[NEW]: ",
|
"[NEW]: ",
|
||||||
((OLC_ACTION(d)->others_obj_found)?OLC_ACTION(d)->others_obj_found:"NULL"));
|
((OLC_ACTION(d)->others_obj_found)?OLC_ACTION(d)->others_obj_found:"NULL"));
|
||||||
|
|
||||||
OLC_MODE(d) = AEDIT_OBJ_OTHERS_FOUND;
|
OLC_MODE(d) = AEDIT_OBJ_OTHERS_FOUND;
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
|
|
@ -563,12 +563,12 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case AEDIT_ACTION_NAME:
|
case AEDIT_ACTION_NAME:
|
||||||
if (!*arg || strchr(arg,' ')) {
|
if (!*arg || strchr(arg,' ')) {
|
||||||
aedit_disp_menu(d);
|
aedit_disp_menu(d);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (OLC_ACTION(d)->command)
|
if (OLC_ACTION(d)->command)
|
||||||
free(OLC_ACTION(d)->command);
|
free(OLC_ACTION(d)->command);
|
||||||
OLC_ACTION(d)->command = strdup(arg);
|
OLC_ACTION(d)->command = strdup(arg);
|
||||||
|
|
@ -596,13 +596,13 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
if ((i < POS_DEAD) && (i > POS_STANDING)) {
|
if ((i < POS_DEAD) && (i > POS_STANDING)) {
|
||||||
aedit_disp_menu(d);
|
aedit_disp_menu(d);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (OLC_MODE(d) == AEDIT_MIN_CHAR_POS)
|
if (OLC_MODE(d) == AEDIT_MIN_CHAR_POS)
|
||||||
OLC_ACTION(d)->min_char_position = i;
|
OLC_ACTION(d)->min_char_position = i;
|
||||||
else
|
else
|
||||||
OLC_ACTION(d)->min_victim_position = i;
|
OLC_ACTION(d)->min_victim_position = i;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case AEDIT_MIN_CHAR_LEVEL:
|
case AEDIT_MIN_CHAR_LEVEL:
|
||||||
if (!*arg) {
|
if (!*arg) {
|
||||||
aedit_disp_menu(d);
|
aedit_disp_menu(d);
|
||||||
|
|
@ -622,7 +622,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
||||||
if (*arg) {
|
if (*arg) {
|
||||||
delete_doubledollar(arg);
|
delete_doubledollar(arg);
|
||||||
OLC_ACTION(d)->char_no_arg = strdup(arg);
|
OLC_ACTION(d)->char_no_arg = strdup(arg);
|
||||||
} else
|
} else
|
||||||
OLC_ACTION(d)->char_no_arg = NULL;
|
OLC_ACTION(d)->char_no_arg = NULL;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -782,7 +782,7 @@ ACMD(do_astat)
|
||||||
}
|
}
|
||||||
|
|
||||||
get_char_colors(ch);
|
get_char_colors(ch);
|
||||||
send_to_char(ch,
|
send_to_char(ch,
|
||||||
"n) Command : %s%-15.15s%s 1) Sort as Command : %s%-15.15s%s\r\n"
|
"n) Command : %s%-15.15s%s 1) Sort as Command : %s%-15.15s%s\r\n"
|
||||||
"2) Min Position[CH]: %s%-8.8s%s 3) Min Position[VT]: %s%-8.8s%s\r\n"
|
"2) Min Position[CH]: %s%-8.8s%s 3) Min Position[VT]: %s%-8.8s%s\r\n"
|
||||||
"4) Min Level [CH]: %s%-3d%s 5) Show if Invis : %s%s%s\r\n"
|
"4) Min Level [CH]: %s%-3d%s 5) Show if Invis : %s%s%s\r\n"
|
||||||
|
|
@ -822,13 +822,13 @@ ACMD(do_astat)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int aedit_find_command(const char *txt)
|
int aedit_find_command(const char *txt)
|
||||||
{
|
{
|
||||||
int cmd;
|
int cmd;
|
||||||
|
|
||||||
for (cmd = 1; *complete_cmd_info[cmd].command != '\n'; cmd++)
|
for (cmd = 1; *complete_cmd_info[cmd].command != '\n'; cmd++)
|
||||||
if (!strncmp(complete_cmd_info[cmd].sort_as, txt, strlen(txt)) ||
|
if (!strncmp(complete_cmd_info[cmd].sort_as, txt, strlen(txt)) ||
|
||||||
!strcmp(complete_cmd_info[cmd].command, txt))
|
!strcmp(complete_cmd_info[cmd].command, txt))
|
||||||
return (cmd);
|
return (cmd);
|
||||||
return (-1);
|
return (-1);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
34
src/alias.c
34
src/alias.c
|
|
@ -53,12 +53,12 @@ void write_aliases(struct char_data *ch)
|
||||||
repllen, temp->replacement + 1,
|
repllen, temp->replacement + 1,
|
||||||
temp->type);
|
temp->type);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_aliases(struct char_data *ch)
|
void read_aliases(struct char_data *ch)
|
||||||
{
|
{
|
||||||
FILE *file;
|
FILE *file;
|
||||||
char xbuf[MAX_STRING_LENGTH];
|
char xbuf[MAX_STRING_LENGTH];
|
||||||
struct alias_data *t2, *prev = NULL;
|
struct alias_data *t2, *prev = NULL;
|
||||||
|
|
@ -77,9 +77,9 @@ void read_aliases(struct char_data *ch)
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
CREATE(GET_ALIASES(ch), struct alias_data, 1);
|
CREATE(GET_ALIASES(ch), struct alias_data, 1);
|
||||||
t2 = GET_ALIASES(ch);
|
t2 = GET_ALIASES(ch);
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
/* Read the aliased command. */
|
/* Read the aliased command. */
|
||||||
|
|
@ -95,13 +95,13 @@ void read_aliases(struct char_data *ch)
|
||||||
|
|
||||||
*xbuf = ' '; /* Doesn't need terminated, fgets() will. */
|
*xbuf = ' '; /* Doesn't need terminated, fgets() will. */
|
||||||
fgets(xbuf + 1, length + 1, file);
|
fgets(xbuf + 1, length + 1, file);
|
||||||
t2->replacement = strdup(xbuf);
|
t2->replacement = strdup(xbuf);
|
||||||
|
|
||||||
/* Figure out the alias type. */
|
/* Figure out the alias type. */
|
||||||
if (fscanf(file, "%d\n", &length) != 1)
|
if (fscanf(file, "%d\n", &length) != 1)
|
||||||
goto read_alias_error;
|
goto read_alias_error;
|
||||||
|
|
||||||
t2->type = length;
|
t2->type = length;
|
||||||
|
|
||||||
if (feof(file))
|
if (feof(file))
|
||||||
break;
|
break;
|
||||||
|
|
@ -109,7 +109,7 @@ void read_aliases(struct char_data *ch)
|
||||||
CREATE(t2->next, struct alias_data, 1);
|
CREATE(t2->next, struct alias_data, 1);
|
||||||
prev = t2;
|
prev = t2;
|
||||||
t2 = t2->next;
|
t2 = t2->next;
|
||||||
};
|
};
|
||||||
|
|
||||||
fclose(file);
|
fclose(file);
|
||||||
return;
|
return;
|
||||||
|
|
@ -121,7 +121,7 @@ read_alias_error:
|
||||||
if (prev)
|
if (prev)
|
||||||
prev->next = NULL;
|
prev->next = NULL;
|
||||||
fclose(file);
|
fclose(file);
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete_aliases(const char *charname)
|
void delete_aliases(const char *charname)
|
||||||
{
|
{
|
||||||
|
|
@ -151,7 +151,7 @@ void write_aliases_ascii(FILE *file, struct char_data *ch)
|
||||||
|
|
||||||
for (temp = GET_ALIASES(ch); temp; temp = temp->next)
|
for (temp = GET_ALIASES(ch); temp; temp = temp->next)
|
||||||
count++;
|
count++;
|
||||||
|
|
||||||
fprintf(file, "Alis: %d\n", count);
|
fprintf(file, "Alis: %d\n", count);
|
||||||
// the +1 thing below is due to alias replacements having
|
// the +1 thing below is due to alias replacements having
|
||||||
// a space prepended in memory. The reason for this escapes me.
|
// a space prepended in memory. The reason for this escapes me.
|
||||||
|
|
@ -162,13 +162,13 @@ void write_aliases_ascii(FILE *file, struct char_data *ch)
|
||||||
"%s\n" /* Replacement */
|
"%s\n" /* Replacement */
|
||||||
"%d\n", /* Type */
|
"%d\n", /* Type */
|
||||||
temp->alias,
|
temp->alias,
|
||||||
temp->replacement+1,
|
temp->replacement+1,
|
||||||
temp->type);
|
temp->type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void read_aliases_ascii(FILE *file, struct char_data *ch, int count)
|
void read_aliases_ascii(FILE *file, struct char_data *ch, int count)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
struct alias_data *temp;
|
struct alias_data *temp;
|
||||||
char abuf[MAX_INPUT_LENGTH], rbuf[MAX_INPUT_LENGTH+1], tbuf[MAX_INPUT_LENGTH];
|
char abuf[MAX_INPUT_LENGTH], rbuf[MAX_INPUT_LENGTH+1], tbuf[MAX_INPUT_LENGTH];
|
||||||
|
|
@ -177,7 +177,7 @@ void read_aliases_ascii(FILE *file, struct char_data *ch, int count)
|
||||||
GET_ALIASES(ch) = NULL;
|
GET_ALIASES(ch) = NULL;
|
||||||
return; // no aliases in the list
|
return; // no aliases in the list
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < count; i++) {
|
for (i = 0; i < count; i++) {
|
||||||
/* Read the aliased command. */
|
/* Read the aliased command. */
|
||||||
get_line(file, abuf);
|
get_line(file, abuf);
|
||||||
|
|
@ -185,11 +185,11 @@ void read_aliases_ascii(FILE *file, struct char_data *ch, int count)
|
||||||
/* Read the replacement. */
|
/* Read the replacement. */
|
||||||
get_line(file, tbuf);
|
get_line(file, tbuf);
|
||||||
strcpy(rbuf, " ");
|
strcpy(rbuf, " ");
|
||||||
strcat(rbuf, tbuf); // strcat: OK
|
strcat(rbuf, tbuf); // strcat: OK
|
||||||
|
|
||||||
/* read the type */
|
/* read the type */
|
||||||
get_line(file, tbuf);
|
get_line(file, tbuf);
|
||||||
|
|
||||||
if (abuf && *abuf && tbuf && *tbuf && rbuf && *rbuf)
|
if (abuf && *abuf && tbuf && *tbuf && rbuf && *rbuf)
|
||||||
{
|
{
|
||||||
CREATE(temp, struct alias_data, 1);
|
CREATE(temp, struct alias_data, 1);
|
||||||
|
|
@ -199,6 +199,6 @@ void read_aliases_ascii(FILE *file, struct char_data *ch, int count)
|
||||||
temp->next = GET_ALIASES(ch);
|
temp->next = GET_ALIASES(ch);
|
||||||
GET_ALIASES(ch) = temp;
|
GET_ALIASES(ch) = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -66,9 +66,9 @@
|
||||||
* original. Also, there is now a builtin-test, just compile with:
|
* original. Also, there is now a builtin-test, just compile with:
|
||||||
* gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
|
* gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
|
||||||
* and run snprintf for results.
|
* and run snprintf for results.
|
||||||
*
|
*
|
||||||
* Thomas Roessler <roessler@guug.de> 01/27/98 for mutt 0.89i
|
* Thomas Roessler <roessler@guug.de> 01/27/98 for mutt 0.89i
|
||||||
* The PGP code was using unsigned hexadecimal formats.
|
* The PGP code was using unsigned hexadecimal formats.
|
||||||
* Unfortunately, unsigned formats simply didn't work.
|
* Unfortunately, unsigned formats simply didn't work.
|
||||||
*
|
*
|
||||||
* Michael Elkins <me@cs.hmc.edu> 03/05/98 for mutt 0.90.8
|
* Michael Elkins <me@cs.hmc.edu> 03/05/98 for mutt 0.90.8
|
||||||
|
|
@ -98,19 +98,19 @@
|
||||||
|
|
||||||
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
|
#if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF)
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dopr(char *buffer, size_t maxlen, const char *format, va_list args);
|
dopr(char *buffer, size_t maxlen, const char *format, va_list args);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fmtstr(char *buffer, size_t *currlen, size_t maxlen, char *value, int flags,
|
fmtstr(char *buffer, size_t *currlen, size_t maxlen, char *value, int flags,
|
||||||
int min, int max);
|
int min, int max);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fmtint(char *buffer, size_t *currlen, size_t maxlen, long value, int base,
|
fmtint(char *buffer, size_t *currlen, size_t maxlen, long value, int base,
|
||||||
int min, int max, int flags);
|
int min, int max, int flags);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
||||||
int min, int max, int flags);
|
int min, int max, int flags);
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
@ -149,7 +149,7 @@ dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c);
|
||||||
#define abs_val(p) (p < 0 ? -p : p)
|
#define abs_val(p) (p < 0 ? -p : p)
|
||||||
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dopr(char *buffer, size_t maxlen, const char *format, va_list args)
|
dopr(char *buffer, size_t maxlen, const char *format, va_list args)
|
||||||
{
|
{
|
||||||
char *strvalue;
|
char *strvalue;
|
||||||
|
|
@ -162,18 +162,18 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args)
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
int cflags = 0;
|
int cflags = 0;
|
||||||
size_t currlen = 0;
|
size_t currlen = 0;
|
||||||
|
|
||||||
ch = *format++;
|
ch = *format++;
|
||||||
|
|
||||||
while (state != DP_S_DONE) {
|
while (state != DP_S_DONE) {
|
||||||
if ((ch == '\0') || (currlen >= maxlen))
|
if ((ch == '\0') || (currlen >= maxlen))
|
||||||
state = DP_S_DONE;
|
state = DP_S_DONE;
|
||||||
|
|
||||||
switch(state) {
|
switch(state) {
|
||||||
case DP_S_DEFAULT:
|
case DP_S_DEFAULT:
|
||||||
if (ch == '%')
|
if (ch == '%')
|
||||||
state = DP_S_FLAGS;
|
state = DP_S_FLAGS;
|
||||||
else
|
else
|
||||||
dopr_outch(buffer, &currlen, maxlen, ch);
|
dopr_outch(buffer, &currlen, maxlen, ch);
|
||||||
ch = *format++;
|
ch = *format++;
|
||||||
break;
|
break;
|
||||||
|
|
@ -212,14 +212,14 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args)
|
||||||
min = va_arg (args, int);
|
min = va_arg (args, int);
|
||||||
ch = *format++;
|
ch = *format++;
|
||||||
state = DP_S_DOT;
|
state = DP_S_DOT;
|
||||||
} else
|
} else
|
||||||
state = DP_S_DOT;
|
state = DP_S_DOT;
|
||||||
break;
|
break;
|
||||||
case DP_S_DOT:
|
case DP_S_DOT:
|
||||||
if (ch == '.') {
|
if (ch == '.') {
|
||||||
state = DP_S_MAX;
|
state = DP_S_MAX;
|
||||||
ch = *format++;
|
ch = *format++;
|
||||||
} else
|
} else
|
||||||
state = DP_S_MOD;
|
state = DP_S_MOD;
|
||||||
break;
|
break;
|
||||||
case DP_S_MAX:
|
case DP_S_MAX:
|
||||||
|
|
@ -232,7 +232,7 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args)
|
||||||
max = va_arg (args, int);
|
max = va_arg (args, int);
|
||||||
ch = *format++;
|
ch = *format++;
|
||||||
state = DP_S_MOD;
|
state = DP_S_MOD;
|
||||||
} else
|
} else
|
||||||
state = DP_S_MOD;
|
state = DP_S_MOD;
|
||||||
break;
|
break;
|
||||||
case DP_S_MOD:
|
case DP_S_MOD:
|
||||||
|
|
@ -266,7 +266,7 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args)
|
||||||
switch (ch) {
|
switch (ch) {
|
||||||
case 'd':
|
case 'd':
|
||||||
case 'i':
|
case 'i':
|
||||||
if (cflags == DP_C_SHORT)
|
if (cflags == DP_C_SHORT)
|
||||||
value = va_arg(args, int);
|
value = va_arg(args, int);
|
||||||
else if (cflags == DP_C_LONG)
|
else if (cflags == DP_C_LONG)
|
||||||
value = va_arg(args, long int);
|
value = va_arg(args, long int);
|
||||||
|
|
@ -343,7 +343,7 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args)
|
||||||
break;
|
break;
|
||||||
case 's':
|
case 's':
|
||||||
strvalue = va_arg(args, char *);
|
strvalue = va_arg(args, char *);
|
||||||
if (max < 0)
|
if (max < 0)
|
||||||
max = maxlen; /* ie, no max */
|
max = maxlen; /* ie, no max */
|
||||||
fmtstr(buffer, &currlen, maxlen, strvalue, flags, min, max);
|
fmtstr(buffer, &currlen, maxlen, strvalue, flags, min, max);
|
||||||
break;
|
break;
|
||||||
|
|
@ -390,9 +390,9 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args)
|
||||||
break; /* some picky compilers need this */
|
break; /* some picky compilers need this */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (currlen < maxlen - 1)
|
if (currlen < maxlen - 1)
|
||||||
buffer[currlen] = '\0';
|
buffer[currlen] = '\0';
|
||||||
else
|
else
|
||||||
buffer[maxlen - 1] = '\0';
|
buffer[maxlen - 1] = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -402,15 +402,15 @@ fmtstr(char *buffer, size_t *currlen, size_t maxlen,
|
||||||
{
|
{
|
||||||
int padlen, strln; /* amount to pad */
|
int padlen, strln; /* amount to pad */
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
|
|
||||||
if (value == 0)
|
if (value == 0)
|
||||||
value = "<NULL>";
|
value = "<NULL>";
|
||||||
|
|
||||||
for (strln = 0; value[strln]; ++strln); /* strlen */
|
for (strln = 0; value[strln]; ++strln); /* strlen */
|
||||||
padlen = min - strln;
|
padlen = min - strln;
|
||||||
if (padlen < 0)
|
if (padlen < 0)
|
||||||
padlen = 0;
|
padlen = 0;
|
||||||
if (flags & DP_F_MINUS)
|
if (flags & DP_F_MINUS)
|
||||||
padlen = -padlen; /* Left Justify */
|
padlen = -padlen; /* Left Justify */
|
||||||
|
|
||||||
while ((padlen > 0) && (cnt < max)) {
|
while ((padlen > 0) && (cnt < max)) {
|
||||||
|
|
@ -431,7 +431,7 @@ fmtstr(char *buffer, size_t *currlen, size_t maxlen,
|
||||||
|
|
||||||
/* Have to handle DP_F_NUM (ie 0x and 0 alternates) */
|
/* Have to handle DP_F_NUM (ie 0x and 0 alternates) */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
||||||
long value, int base, int min, int max, int flags)
|
long value, int base, int min, int max, int flags)
|
||||||
{
|
{
|
||||||
|
|
@ -442,7 +442,7 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
||||||
int spadlen = 0; /* amount to space pad */
|
int spadlen = 0; /* amount to space pad */
|
||||||
int zpadlen = 0; /* amount to zero pad */
|
int zpadlen = 0; /* amount to zero pad */
|
||||||
int caps = 0;
|
int caps = 0;
|
||||||
|
|
||||||
if (max < 0)
|
if (max < 0)
|
||||||
max = 0;
|
max = 0;
|
||||||
|
|
||||||
|
|
@ -457,8 +457,8 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
||||||
else if (flags & DP_F_SPACE)
|
else if (flags & DP_F_SPACE)
|
||||||
signvalue = ' ';
|
signvalue = ' ';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (flags & DP_F_UP)
|
if (flags & DP_F_UP)
|
||||||
caps = 1; /* Should characters be upper case? */
|
caps = 1; /* Should characters be upper case? */
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
@ -467,7 +467,7 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
||||||
[uvalue % (unsigned)base];
|
[uvalue % (unsigned)base];
|
||||||
uvalue = (uvalue / (unsigned)base );
|
uvalue = (uvalue / (unsigned)base );
|
||||||
} while (uvalue && (place < 20));
|
} while (uvalue && (place < 20));
|
||||||
if (place == 20)
|
if (place == 20)
|
||||||
place--;
|
place--;
|
||||||
convert[place] = 0;
|
convert[place] = 0;
|
||||||
|
|
||||||
|
|
@ -481,7 +481,7 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
||||||
zpadlen = MAX(zpadlen, spadlen);
|
zpadlen = MAX(zpadlen, spadlen);
|
||||||
spadlen = 0;
|
spadlen = 0;
|
||||||
}
|
}
|
||||||
if (flags & DP_F_MINUS)
|
if (flags & DP_F_MINUS)
|
||||||
spadlen = -spadlen; /* Left Justifty */
|
spadlen = -spadlen; /* Left Justifty */
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -492,7 +492,7 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Sign */
|
/* Sign */
|
||||||
if (signvalue)
|
if (signvalue)
|
||||||
dopr_outch(buffer, currlen, maxlen, signvalue);
|
dopr_outch(buffer, currlen, maxlen, signvalue);
|
||||||
|
|
||||||
/* Zeros */
|
/* Zeros */
|
||||||
|
|
@ -504,9 +504,9 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Digits */
|
/* Digits */
|
||||||
while (place > 0)
|
while (place > 0)
|
||||||
dopr_outch(buffer, currlen, maxlen, convert[--place]);
|
dopr_outch(buffer, currlen, maxlen, convert[--place]);
|
||||||
|
|
||||||
/* Left Justified spaces */
|
/* Left Justified spaces */
|
||||||
while (spadlen < 0) {
|
while (spadlen < 0) {
|
||||||
dopr_outch (buffer, currlen, maxlen, ' ');
|
dopr_outch (buffer, currlen, maxlen, ' ');
|
||||||
|
|
@ -514,7 +514,7 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static long double
|
static long double
|
||||||
pow10(int exp)
|
pow10(int exp)
|
||||||
{
|
{
|
||||||
long double result = 1;
|
long double result = 1;
|
||||||
|
|
@ -523,11 +523,11 @@ pow10(int exp)
|
||||||
result *= 10;
|
result *= 10;
|
||||||
exp--;
|
exp--;
|
||||||
}
|
}
|
||||||
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static long
|
static long
|
||||||
round(long double value)
|
round(long double value)
|
||||||
{
|
{
|
||||||
long intpart = value;
|
long intpart = value;
|
||||||
|
|
@ -539,8 +539,8 @@ round(long double value)
|
||||||
return intpart;
|
return intpart;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
||||||
int min, int max, int flags)
|
int min, int max, int flags)
|
||||||
{
|
{
|
||||||
char iconvert[20];
|
char iconvert[20];
|
||||||
|
|
@ -549,13 +549,13 @@ fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
||||||
int iplace = 0;
|
int iplace = 0;
|
||||||
int fplace = 0;
|
int fplace = 0;
|
||||||
int padlen = 0; /* amount to pad */
|
int padlen = 0; /* amount to pad */
|
||||||
int zpadlen = 0;
|
int zpadlen = 0;
|
||||||
int caps = 0;
|
int caps = 0;
|
||||||
long intpart;
|
long intpart;
|
||||||
long fracpart;
|
long fracpart;
|
||||||
long double ufvalue;
|
long double ufvalue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* AIX manpage says the default is 0, but Solaris says the default
|
* AIX manpage says the default is 0, but Solaris says the default
|
||||||
* is 6, and sprintf on AIX defaults to 6
|
* is 6, and sprintf on AIX defaults to 6
|
||||||
*/
|
*/
|
||||||
|
|
@ -573,8 +573,8 @@ fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
||||||
|
|
||||||
intpart = ufvalue;
|
intpart = ufvalue;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Sorry, we only support 9 digits past the decimal because of our
|
* Sorry, we only support 9 digits past the decimal because of our
|
||||||
* conversion method
|
* conversion method
|
||||||
*/
|
*/
|
||||||
if (max > 9)
|
if (max > 9)
|
||||||
|
|
@ -596,7 +596,7 @@ fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
||||||
(caps? "0123456789ABCDEF":"0123456789abcdef")[intpart % 10];
|
(caps? "0123456789ABCDEF":"0123456789abcdef")[intpart % 10];
|
||||||
intpart = (intpart / 10);
|
intpart = (intpart / 10);
|
||||||
} while(intpart && (iplace < 20));
|
} while(intpart && (iplace < 20));
|
||||||
if (iplace == 20)
|
if (iplace == 20)
|
||||||
iplace--;
|
iplace--;
|
||||||
iconvert[iplace] = 0;
|
iconvert[iplace] = 0;
|
||||||
|
|
||||||
|
|
@ -606,18 +606,18 @@ fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
||||||
(caps? "0123456789ABCDEF":"0123456789abcdef")[fracpart % 10];
|
(caps? "0123456789ABCDEF":"0123456789abcdef")[fracpart % 10];
|
||||||
fracpart = (fracpart / 10);
|
fracpart = (fracpart / 10);
|
||||||
} while(fracpart && (fplace < 20));
|
} while(fracpart && (fplace < 20));
|
||||||
if (fplace == 20)
|
if (fplace == 20)
|
||||||
fplace--;
|
fplace--;
|
||||||
fconvert[fplace] = 0;
|
fconvert[fplace] = 0;
|
||||||
|
|
||||||
/* -1 for decimal point, another -1 if we are printing a sign */
|
/* -1 for decimal point, another -1 if we are printing a sign */
|
||||||
padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
|
padlen = min - iplace - max - 1 - ((signvalue) ? 1 : 0);
|
||||||
zpadlen = max - fplace;
|
zpadlen = max - fplace;
|
||||||
if (zpadlen < 0)
|
if (zpadlen < 0)
|
||||||
zpadlen = 0;
|
zpadlen = 0;
|
||||||
if (padlen < 0)
|
if (padlen < 0)
|
||||||
padlen = 0;
|
padlen = 0;
|
||||||
if (flags & DP_F_MINUS)
|
if (flags & DP_F_MINUS)
|
||||||
padlen = -padlen; /* Left Justifty */
|
padlen = -padlen; /* Left Justifty */
|
||||||
|
|
||||||
if ((flags & DP_F_ZERO) && (padlen > 0)) {
|
if ((flags & DP_F_ZERO) && (padlen > 0)) {
|
||||||
|
|
@ -635,10 +635,10 @@ fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
||||||
dopr_outch(buffer, currlen, maxlen, ' ');
|
dopr_outch(buffer, currlen, maxlen, ' ');
|
||||||
--padlen;
|
--padlen;
|
||||||
}
|
}
|
||||||
if (signvalue)
|
if (signvalue)
|
||||||
dopr_outch(buffer, currlen, maxlen, signvalue);
|
dopr_outch(buffer, currlen, maxlen, signvalue);
|
||||||
|
|
||||||
while (iplace > 0)
|
while (iplace > 0)
|
||||||
dopr_outch(buffer, currlen, maxlen, iconvert[--iplace]);
|
dopr_outch(buffer, currlen, maxlen, iconvert[--iplace]);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -647,7 +647,7 @@ fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
||||||
*/
|
*/
|
||||||
dopr_outch(buffer, currlen, maxlen, '.');
|
dopr_outch(buffer, currlen, maxlen, '.');
|
||||||
|
|
||||||
while (fplace > 0)
|
while (fplace > 0)
|
||||||
dopr_outch(buffer, currlen, maxlen, fconvert[--fplace]);
|
dopr_outch(buffer, currlen, maxlen, fconvert[--fplace]);
|
||||||
|
|
||||||
while (zpadlen > 0) {
|
while (zpadlen > 0) {
|
||||||
|
|
@ -661,7 +661,7 @@ fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c)
|
dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c)
|
||||||
{
|
{
|
||||||
if (*currlen < maxlen)
|
if (*currlen < maxlen)
|
||||||
|
|
@ -670,7 +670,7 @@ dopr_outch(char *buffer, size_t *currlen, size_t maxlen, char c)
|
||||||
#endif /* !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) */
|
#endif /* !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) */
|
||||||
|
|
||||||
#ifndef HAVE_VSNPRINTF
|
#ifndef HAVE_VSNPRINTF
|
||||||
int
|
int
|
||||||
vsnprintf(char *str, size_t count, const char *fmt, va_list args)
|
vsnprintf(char *str, size_t count, const char *fmt, va_list args)
|
||||||
{
|
{
|
||||||
str[0] = 0;
|
str[0] = 0;
|
||||||
|
|
@ -681,7 +681,7 @@ vsnprintf(char *str, size_t count, const char *fmt, va_list args)
|
||||||
#endif /* !HAVE_VSNPRINTF */
|
#endif /* !HAVE_VSNPRINTF */
|
||||||
|
|
||||||
#ifndef HAVE_SNPRINTF
|
#ifndef HAVE_SNPRINTF
|
||||||
int
|
int
|
||||||
snprintf(char *str,size_t count,const char *fmt,...)
|
snprintf(char *str,size_t count,const char *fmt,...)
|
||||||
{
|
{
|
||||||
va_list ap;
|
va_list ap;
|
||||||
|
|
@ -694,7 +694,7 @@ snprintf(char *str,size_t count,const char *fmt,...)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TEST_SNPRINTF
|
#ifdef TEST_SNPRINTF
|
||||||
int
|
int
|
||||||
main(void)
|
main(void)
|
||||||
{
|
{
|
||||||
#define LONG_STRING 1024
|
#define LONG_STRING 1024
|
||||||
|
|
@ -714,17 +714,17 @@ main(void)
|
||||||
"%3.2f",
|
"%3.2f",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
double fp_nums[] = {
|
double fp_nums[] = {
|
||||||
-1.5,
|
-1.5,
|
||||||
134.21,
|
134.21,
|
||||||
91340.2,
|
91340.2,
|
||||||
341.1234,
|
341.1234,
|
||||||
0203.9,
|
0203.9,
|
||||||
0.96,
|
0.96,
|
||||||
0.996,
|
0.996,
|
||||||
0.9996,
|
0.9996,
|
||||||
1.996,
|
1.996,
|
||||||
4.136,
|
4.136,
|
||||||
0
|
0
|
||||||
};
|
};
|
||||||
char *int_fmt[] = {
|
char *int_fmt[] = {
|
||||||
|
|
@ -754,7 +754,7 @@ main(void)
|
||||||
sprintf (buf2, fp_fmt[x], fp_nums[y]);
|
sprintf (buf2, fp_fmt[x], fp_nums[y]);
|
||||||
if (strcmp (buf1, buf2)) {
|
if (strcmp (buf1, buf2)) {
|
||||||
printf("snprintf doesn't match Format: %s\n\t"
|
printf("snprintf doesn't match Format: %s\n\t"
|
||||||
"snprintf = %s\n\tsprintf = %s\n",
|
"snprintf = %s\n\tsprintf = %s\n",
|
||||||
fp_fmt[x], buf1, buf2);
|
fp_fmt[x], buf1, buf2);
|
||||||
fail++;
|
fail++;
|
||||||
}
|
}
|
||||||
|
|
@ -767,7 +767,7 @@ main(void)
|
||||||
sprintf(buf2, int_fmt[x], int_nums[y]);
|
sprintf(buf2, int_fmt[x], int_nums[y]);
|
||||||
if (strcmp (buf1, buf2)) {
|
if (strcmp (buf1, buf2)) {
|
||||||
printf("snprintf doesn't match Format: %s\n\t"
|
printf("snprintf doesn't match Format: %s\n\t"
|
||||||
"snprintf = %s\n\tsprintf = %s\n",
|
"snprintf = %s\n\tsprintf = %s\n",
|
||||||
int_fmt[x], buf1, buf2);
|
int_fmt[x], buf1, buf2);
|
||||||
fail++;
|
fail++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
448
src/cedit.c
448
src/cedit.c
File diff suppressed because it is too large
Load diff
10
src/class.c
10
src/class.c
|
|
@ -114,7 +114,7 @@ bitvector_t find_class_bitvector(const char *arg)
|
||||||
* a character of the class is allowed to attain in any skill. (After
|
* a character of the class is allowed to attain in any skill. (After
|
||||||
* this level, attempts to practice will say "You are already learned in
|
* this level, attempts to practice will say "You are already learned in
|
||||||
* this area."
|
* this area."
|
||||||
*
|
*
|
||||||
* The second line controls the maximum percent gain in learnedness a
|
* The second line controls the maximum percent gain in learnedness a
|
||||||
* character is allowed per practice -- in other words, if the random
|
* character is allowed per practice -- in other words, if the random
|
||||||
* die throw comes out higher than this number, the gain will only be
|
* die throw comes out higher than this number, the gain will only be
|
||||||
|
|
@ -124,7 +124,7 @@ bitvector_t find_class_bitvector(const char *arg)
|
||||||
* character is allowed per practice -- in other words, if the random
|
* character is allowed per practice -- in other words, if the random
|
||||||
* die throw comes out below this number, the gain will be set up to
|
* die throw comes out below this number, the gain will be set up to
|
||||||
* this number.
|
* this number.
|
||||||
*
|
*
|
||||||
* The fourth line simply sets whether the character knows 'spells'
|
* The fourth line simply sets whether the character knows 'spells'
|
||||||
* or 'skills'. This does not affect anything except the message given
|
* or 'skills'. This does not affect anything except the message given
|
||||||
* to the character when trying to practice (i.e. "You know of the
|
* to the character when trying to practice (i.e. "You know of the
|
||||||
|
|
@ -971,7 +971,7 @@ byte saving_throws(int class_num, int type, int level)
|
||||||
case 50: return 0;
|
case 50: return 0;
|
||||||
default:
|
default:
|
||||||
log("SYSERR: Missing level for warrior paralyzation saving throw.");
|
log("SYSERR: Missing level for warrior paralyzation saving throw.");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case SAVING_ROD: /* Rods */
|
case SAVING_ROD: /* Rods */
|
||||||
switch (level) {
|
switch (level) {
|
||||||
|
|
@ -1886,7 +1886,7 @@ int level_exp(int chclass, int level)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default titles of male characters.
|
* Default titles of male characters.
|
||||||
*/
|
*/
|
||||||
const char *title_male(int chclass, int level)
|
const char *title_male(int chclass, int level)
|
||||||
|
|
@ -2033,7 +2033,7 @@ const char *title_male(int chclass, int level)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Default titles of female characters.
|
* Default titles of female characters.
|
||||||
*/
|
*/
|
||||||
const char *title_female(int chclass, int level)
|
const char *title_female(int chclass, int level)
|
||||||
|
|
|
||||||
68
src/comm.c
68
src/comm.c
|
|
@ -111,7 +111,7 @@ static bool fCopyOver; /* Are we booting in copyover mode? */
|
||||||
ush_int port;
|
ush_int port;
|
||||||
socket_t mother_desc;
|
socket_t mother_desc;
|
||||||
int log_this_messg;
|
int log_this_messg;
|
||||||
|
|
||||||
/* functions in this file */
|
/* functions in this file */
|
||||||
RETSIGTYPE reread_wizlists(int sig);
|
RETSIGTYPE reread_wizlists(int sig);
|
||||||
RETSIGTYPE unrestrict_game(int sig);
|
RETSIGTYPE unrestrict_game(int sig);
|
||||||
|
|
@ -261,7 +261,7 @@ int main(int argc, char **argv)
|
||||||
CONFIG_CONFFILE = strdup(CONFIG_FILE);
|
CONFIG_CONFFILE = strdup(CONFIG_FILE);
|
||||||
|
|
||||||
load_config();
|
load_config();
|
||||||
|
|
||||||
port = CONFIG_DFLT_PORT;
|
port = CONFIG_DFLT_PORT;
|
||||||
dir = CONFIG_DFLT_DIR;
|
dir = CONFIG_DFLT_DIR;
|
||||||
|
|
||||||
|
|
@ -421,7 +421,7 @@ void copyover_recover()
|
||||||
bool fOld;
|
bool fOld;
|
||||||
char name[MAX_INPUT_LENGTH];
|
char name[MAX_INPUT_LENGTH];
|
||||||
long pref;
|
long pref;
|
||||||
|
|
||||||
log ("Copyover recovery initiated");
|
log ("Copyover recovery initiated");
|
||||||
|
|
||||||
fp = fopen (COPYOVER_FILE, "r");
|
fp = fopen (COPYOVER_FILE, "r");
|
||||||
|
|
@ -433,8 +433,8 @@ void copyover_recover()
|
||||||
}
|
}
|
||||||
|
|
||||||
/* In case something crashes - doesn't prevent reading */
|
/* In case something crashes - doesn't prevent reading */
|
||||||
unlink (COPYOVER_FILE);
|
unlink (COPYOVER_FILE);
|
||||||
|
|
||||||
/* read boot_time - first line in file */
|
/* read boot_time - first line in file */
|
||||||
fscanf(fp, "%ld\n", &boot_time);
|
fscanf(fp, "%ld\n", &boot_time);
|
||||||
|
|
||||||
|
|
@ -444,7 +444,7 @@ void copyover_recover()
|
||||||
if (desc == -1)
|
if (desc == -1)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* Write something, and check if it goes error-free */
|
/* Write something, and check if it goes error-free */
|
||||||
if (write_to_descriptor (desc, "\n\rRestoring from copyover...\n\r") < 0) {
|
if (write_to_descriptor (desc, "\n\rRestoring from copyover...\n\r") < 0) {
|
||||||
close (desc); /* nope */
|
close (desc); /* nope */
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -479,7 +479,7 @@ void copyover_recover()
|
||||||
/* Player file not found?! */
|
/* Player file not found?! */
|
||||||
if (!fOld) {
|
if (!fOld) {
|
||||||
write_to_descriptor (desc, "\n\rSomehow, your character was lost in the copyover. Sorry.\n\r");
|
write_to_descriptor (desc, "\n\rSomehow, your character was lost in the copyover. Sorry.\n\r");
|
||||||
close_socket (d);
|
close_socket (d);
|
||||||
} else {
|
} else {
|
||||||
write_to_descriptor (desc, "\n\rCopyover recovery complete.\n\r");
|
write_to_descriptor (desc, "\n\rCopyover recovery complete.\n\r");
|
||||||
GET_PREF(d->character) = pref;
|
GET_PREF(d->character) = pref;
|
||||||
|
|
@ -802,7 +802,7 @@ void game_loop(socket_t mother_desc)
|
||||||
* to sleep until the next 0.1 second tick. The first step is to
|
* to sleep until the next 0.1 second tick. The first step is to
|
||||||
* calculate how long we took processing the previous iteration.
|
* calculate how long we took processing the previous iteration.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
gettimeofday(&before_sleep, (struct timezone *) 0); /* current time */
|
gettimeofday(&before_sleep, (struct timezone *) 0); /* current time */
|
||||||
timediff(&process_time, &before_sleep, &last_time);
|
timediff(&process_time, &before_sleep, &last_time);
|
||||||
|
|
||||||
|
|
@ -1157,18 +1157,18 @@ const char *ANSI[] = { "@", A"0m",A"0m",A"0;30m",A"0;34m",A"0;32m",A"0;36m",A"0;
|
||||||
#undef A
|
#undef A
|
||||||
const char CCODE[] = "@nNdbgcrmywDBGCRMYW01234567luoe!";
|
const char CCODE[] = "@nNdbgcrmywDBGCRMYW01234567luoe!";
|
||||||
|
|
||||||
size_t proc_colors(char *txt, size_t maxlen, int parse)
|
size_t proc_colors(char *txt, size_t maxlen, int parse)
|
||||||
{
|
{
|
||||||
char *d, *s, *c, *p;
|
char *d, *s, *c, *p;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!txt || !strchr(txt, '@')) /* skip out if no color codes */
|
if (!txt || !strchr(txt, '@')) /* skip out if no color codes */
|
||||||
return strlen(txt);
|
return strlen(txt);
|
||||||
|
|
||||||
s = txt;
|
s = txt;
|
||||||
CREATE(d, char, maxlen);
|
CREATE(d, char, maxlen);
|
||||||
p = d;
|
p = d;
|
||||||
|
|
||||||
for( ; *s && (d-p < maxlen); ) {
|
for( ; *s && (d-p < maxlen); ) {
|
||||||
/* no color code - just copy */
|
/* no color code - just copy */
|
||||||
if (*s != '@') {
|
if (*s != '@') {
|
||||||
|
|
@ -1191,17 +1191,17 @@ size_t proc_colors(char *txt, size_t maxlen, int parse)
|
||||||
*d++ = '@';
|
*d++ = '@';
|
||||||
}
|
}
|
||||||
s++; /* skip to next (non-colorcode) char */
|
s++; /* skip to next (non-colorcode) char */
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* parse the color code */
|
/* parse the color code */
|
||||||
for (i = 0; CCODE[i] != '!'; i++) { /* do we find it ? */
|
for (i = 0; CCODE[i] != '!'; i++) { /* do we find it ? */
|
||||||
if ((*s) == CCODE[i]) { /* if so :*/
|
if ((*s) == CCODE[i]) { /* if so :*/
|
||||||
|
|
||||||
/* c now points to the first char in color code*/
|
/* c now points to the first char in color code*/
|
||||||
for(c = (char *)ANSI[i] ; *c && (d-p < maxlen); )
|
for(c = (char *)ANSI[i] ; *c && (d-p < maxlen); )
|
||||||
*d++ = *c++;
|
*d++ = *c++;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1210,16 +1210,16 @@ size_t proc_colors(char *txt, size_t maxlen, int parse)
|
||||||
* - Welcor
|
* - Welcor
|
||||||
*/
|
*/
|
||||||
s++;
|
s++;
|
||||||
|
|
||||||
} /* for loop */
|
} /* for loop */
|
||||||
|
|
||||||
|
|
||||||
/* make sure txt is NULL - terminated */
|
/* make sure txt is NULL - terminated */
|
||||||
d = '\0';
|
d = '\0';
|
||||||
strncpy(txt, p, maxlen-1);
|
strncpy(txt, p, maxlen-1);
|
||||||
|
|
||||||
free(p);
|
free(p);
|
||||||
|
|
||||||
return strlen(txt);
|
return strlen(txt);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1270,13 +1270,13 @@ char *make_prompt(struct descriptor_data *d)
|
||||||
if (count >= 0)
|
if (count >= 0)
|
||||||
len += count;
|
len += count;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PRF_FLAGGED(d->character, PRF_DISPMANA) && len < sizeof(prompt)) {
|
if (PRF_FLAGGED(d->character, PRF_DISPMANA) && len < sizeof(prompt)) {
|
||||||
count = snprintf(prompt + len, sizeof(prompt) - len, "%dM ", GET_MANA(d->character));
|
count = snprintf(prompt + len, sizeof(prompt) - len, "%dM ", GET_MANA(d->character));
|
||||||
if (count >= 0)
|
if (count >= 0)
|
||||||
len += count;
|
len += count;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PRF_FLAGGED(d->character, PRF_DISPMOVE) && len < sizeof(prompt)) {
|
if (PRF_FLAGGED(d->character, PRF_DISPMOVE) && len < sizeof(prompt)) {
|
||||||
count = snprintf(prompt + len, sizeof(prompt) - len, "%dV ", GET_MOVE(d->character));
|
count = snprintf(prompt + len, sizeof(prompt) - len, "%dV ", GET_MOVE(d->character));
|
||||||
if (count >= 0)
|
if (count >= 0)
|
||||||
|
|
@ -1448,7 +1448,7 @@ size_t vwrite_to_output(struct descriptor_data *t, const char *format, va_list a
|
||||||
void free_bufpool(void)
|
void free_bufpool(void)
|
||||||
{
|
{
|
||||||
struct txt_block *tmp;
|
struct txt_block *tmp;
|
||||||
|
|
||||||
while (bufpool) {
|
while (bufpool) {
|
||||||
tmp = bufpool->next;
|
tmp = bufpool->next;
|
||||||
if (bufpool->text)
|
if (bufpool->text)
|
||||||
|
|
@ -1559,7 +1559,7 @@ int set_sendbuf(socket_t s)
|
||||||
void init_descriptor (struct descriptor_data *newd, int desc)
|
void init_descriptor (struct descriptor_data *newd, int desc)
|
||||||
{
|
{
|
||||||
static int last_desc = 0; /* last descriptor number */
|
static int last_desc = 0; /* last descriptor number */
|
||||||
|
|
||||||
newd->descriptor = desc;
|
newd->descriptor = desc;
|
||||||
newd->idle_tics = 0;
|
newd->idle_tics = 0;
|
||||||
newd->output = newd->small_outbuf;
|
newd->output = newd->small_outbuf;
|
||||||
|
|
@ -1842,7 +1842,7 @@ ssize_t perform_socket_write(socket_t desc, const char *txt, size_t length)
|
||||||
|
|
||||||
#endif /* CIRCLE_WINDOWS */
|
#endif /* CIRCLE_WINDOWS */
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* write_to_descriptor takes a descriptor, and text to write to the
|
* write_to_descriptor takes a descriptor, and text to write to the
|
||||||
* descriptor. It keeps calling the system-level write() until all
|
* descriptor. It keeps calling the system-level write() until all
|
||||||
|
|
@ -2173,7 +2173,7 @@ int perform_subst(struct descriptor_data *t, char *orig, char *subst)
|
||||||
void close_socket(struct descriptor_data *d)
|
void close_socket(struct descriptor_data *d)
|
||||||
{
|
{
|
||||||
struct descriptor_data *temp;
|
struct descriptor_data *temp;
|
||||||
|
|
||||||
REMOVE_FROM_LIST(d, descriptor_list, next);
|
REMOVE_FROM_LIST(d, descriptor_list, next);
|
||||||
CLOSE_SOCKET(d->descriptor);
|
CLOSE_SOCKET(d->descriptor);
|
||||||
flush_queues(d);
|
flush_queues(d);
|
||||||
|
|
@ -2203,7 +2203,7 @@ void close_socket(struct descriptor_data *d)
|
||||||
}
|
}
|
||||||
|
|
||||||
add_llog_entry(d->character, LAST_DISCONNECT);
|
add_llog_entry(d->character, LAST_DISCONNECT);
|
||||||
|
|
||||||
if (IS_PLAYING(d) || STATE(d) == CON_DISCONNECT) {
|
if (IS_PLAYING(d) || STATE(d) == CON_DISCONNECT) {
|
||||||
struct char_data *link_challenged = d->original ? d->original : d->character;
|
struct char_data *link_challenged = d->original ? d->original : d->character;
|
||||||
|
|
||||||
|
|
@ -2230,9 +2230,9 @@ void close_socket(struct descriptor_data *d)
|
||||||
free(d->history[cnt]);
|
free(d->history[cnt]);
|
||||||
free(d->history);
|
free(d->history);
|
||||||
}
|
}
|
||||||
|
|
||||||
free_hist_messg(d);
|
free_hist_messg(d);
|
||||||
|
|
||||||
if (d->showstr_head)
|
if (d->showstr_head)
|
||||||
free(d->showstr_head);
|
free(d->showstr_head);
|
||||||
if (d->showstr_count)
|
if (d->showstr_count)
|
||||||
|
|
@ -2559,14 +2559,14 @@ void send_to_range(room_vnum start, room_vnum finish, const char *messg, ...)
|
||||||
struct char_data *i;
|
struct char_data *i;
|
||||||
va_list args;
|
va_list args;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
if (start > finish) {
|
if (start > finish) {
|
||||||
log("send_to_range passed start room value greater then finish.");
|
log("send_to_range passed start room value greater then finish.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (messg == NULL)
|
if (messg == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (j = 0; j < top_of_world; j++) {
|
for (j = 0; j < top_of_world; j++) {
|
||||||
if (GET_ROOM_VNUM(j) >= start && GET_ROOM_VNUM(j) <= finish) {
|
if (GET_ROOM_VNUM(j) >= start && GET_ROOM_VNUM(j) <= finish) {
|
||||||
for (i = world[j].people; i; i = i->next_in_room) {
|
for (i = world[j].people; i; i = i->next_in_room) {
|
||||||
|
|
@ -2708,7 +2708,7 @@ void perform_act(const char *orig, struct char_data *ch, struct obj_data *obj,
|
||||||
|
|
||||||
if (to->desc) {
|
if (to->desc) {
|
||||||
write_to_output(to->desc, "%s", CAP(lbuf));
|
write_to_output(to->desc, "%s", CAP(lbuf));
|
||||||
if (log_this_messg)
|
if (log_this_messg)
|
||||||
new_hist_messg(to->desc, lbuf);
|
new_hist_messg(to->desc, lbuf);
|
||||||
}
|
}
|
||||||
log_this_messg = 0;
|
log_this_messg = 0;
|
||||||
|
|
@ -2729,7 +2729,7 @@ void act(const char *str, int hide_invisible, struct char_data *ch,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Warning: the following TO_SLEEP code is a hack.
|
* Warning: the following TO_SLEEP code is a hack.
|
||||||
*
|
*
|
||||||
* I wanted to be able to tell act to deliver a message regardless of sleep
|
* I wanted to be able to tell act to deliver a message regardless of sleep
|
||||||
* without adding an additional argument. TO_SLEEP is 128 (a single bit
|
* without adding an additional argument. TO_SLEEP is 128 (a single bit
|
||||||
* high up). It's ONLY legal to combine TO_SLEEP with one other TO_x
|
* high up). It's ONLY legal to combine TO_SLEEP with one other TO_x
|
||||||
|
|
@ -2750,8 +2750,8 @@ void act(const char *str, int hide_invisible, struct char_data *ch,
|
||||||
/* And this too.. */
|
/* And this too.. */
|
||||||
log_this_messg = IS_SET(type, LOG_MESSG);
|
log_this_messg = IS_SET(type, LOG_MESSG);
|
||||||
if (log_this_messg)
|
if (log_this_messg)
|
||||||
REMOVE_BIT(type, LOG_MESSG);
|
REMOVE_BIT(type, LOG_MESSG);
|
||||||
|
|
||||||
if (type == TO_CHAR) {
|
if (type == TO_CHAR) {
|
||||||
if (ch && SENDOK(ch))
|
if (ch && SENDOK(ch))
|
||||||
perform_act(str, ch, obj, vict_obj, ch);
|
perform_act(str, ch, obj, vict_obj, ch);
|
||||||
|
|
|
||||||
|
|
@ -307,7 +307,7 @@ int max_bad_pws = 3;
|
||||||
int siteok_everyone = TRUE;
|
int siteok_everyone = TRUE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some nameservers are very slow and cause the game to lag terribly every
|
* Some nameservers are very slow and cause the game to lag terribly every
|
||||||
* time someone logs in. The lag is caused by the gethostbyaddr() function
|
* time someone logs in. The lag is caused by the gethostbyaddr() function
|
||||||
* which is responsible for resolving numeric IP addresses to alphabetic names.
|
* which is responsible for resolving numeric IP addresses to alphabetic names.
|
||||||
* Sometimes, nameservers can be so slow that the incredible lag caused by
|
* Sometimes, nameservers can be so slow that the incredible lag caused by
|
||||||
|
|
@ -330,7 +330,7 @@ int nameserver_is_slow = NO;
|
||||||
int auto_save_olc = YES;
|
int auto_save_olc = YES;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* if you wish to enable Aedit, set this to YES
|
* if you wish to enable Aedit, set this to YES
|
||||||
* This will make the mud look for a file called socials.new,
|
* This will make the mud look for a file called socials.new,
|
||||||
* which is in a different format than the stock socials file.
|
* which is in a different format than the stock socials file.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include "interpreter.h" /* alias_data */
|
#include "interpreter.h" /* alias_data */
|
||||||
|
|
||||||
cpp_extern const char *circlemud_version =
|
cpp_extern const char *circlemud_version =
|
||||||
"tbaMUD, version 3.51";
|
"tbaMUD, version 3.51";
|
||||||
|
|
||||||
cpp_extern const char *oasisolc_version =
|
cpp_extern const char *oasisolc_version =
|
||||||
|
|
@ -806,7 +806,7 @@ const char *month_name[] = {
|
||||||
|
|
||||||
/* mob trigger types */
|
/* mob trigger types */
|
||||||
const char *trig_types[] = {
|
const char *trig_types[] = {
|
||||||
"Global",
|
"Global",
|
||||||
"Random",
|
"Random",
|
||||||
"Command",
|
"Command",
|
||||||
"Speech",
|
"Speech",
|
||||||
|
|
|
||||||
|
|
@ -186,7 +186,7 @@ int find_context_trigedit(struct descriptor_data *d)
|
||||||
{
|
{
|
||||||
switch (OLC_MODE(d)) {
|
switch (OLC_MODE(d)) {
|
||||||
case TRIGEDIT_MAIN_MENU: return CONTEXT_TRIGEDIT_MAIN_MENU;
|
case TRIGEDIT_MAIN_MENU: return CONTEXT_TRIGEDIT_MAIN_MENU;
|
||||||
case TRIGEDIT_TRIGTYPE: return CONTEXT_TRIGEDIT_TRIGTYPE;
|
case TRIGEDIT_TRIGTYPE: return CONTEXT_TRIGEDIT_TRIGTYPE;
|
||||||
case TRIGEDIT_CONFIRM_SAVESTRING:return CONTEXT_TRIGEDIT_CONFIRM_SAVESTRING;
|
case TRIGEDIT_CONFIRM_SAVESTRING:return CONTEXT_TRIGEDIT_CONFIRM_SAVESTRING;
|
||||||
case TRIGEDIT_NAME: return CONTEXT_TRIGEDIT_NAME;
|
case TRIGEDIT_NAME: return CONTEXT_TRIGEDIT_NAME;
|
||||||
case TRIGEDIT_INTENDED: return CONTEXT_TRIGEDIT_INTENDED;
|
case TRIGEDIT_INTENDED: return CONTEXT_TRIGEDIT_INTENDED;
|
||||||
|
|
@ -201,9 +201,9 @@ int find_context_trigedit(struct descriptor_data *d)
|
||||||
int find_context_script_edit(struct descriptor_data *d)
|
int find_context_script_edit(struct descriptor_data *d)
|
||||||
{
|
{
|
||||||
switch (OLC_SCRIPT_EDIT_MODE(d)) {
|
switch (OLC_SCRIPT_EDIT_MODE(d)) {
|
||||||
case SCRIPT_MAIN_MENU: return CONTEXT_SCRIPT_MAIN_MENU;
|
case SCRIPT_MAIN_MENU: return CONTEXT_SCRIPT_MAIN_MENU;
|
||||||
case SCRIPT_NEW_TRIGGER:return CONTEXT_SCRIPT_NEW_TRIGGER;
|
case SCRIPT_NEW_TRIGGER:return CONTEXT_SCRIPT_NEW_TRIGGER;
|
||||||
case SCRIPT_DEL_TRIGGER:return CONTEXT_SCRIPT_DEL_TRIGGER;
|
case SCRIPT_DEL_TRIGGER:return CONTEXT_SCRIPT_DEL_TRIGGER;
|
||||||
default: return NOTHING;
|
default: return NOTHING;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -218,13 +218,13 @@ int context_help(struct descriptor_data *d, char *arg)
|
||||||
/* skip if context help isn't wanted */
|
/* skip if context help isn't wanted */
|
||||||
if (strncmp(arg, CONTEXT_HELP_STRING, strlen(CONTEXT_HELP_STRING)))
|
if (strncmp(arg, CONTEXT_HELP_STRING, strlen(CONTEXT_HELP_STRING)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
tmp = one_argument(arg, actbuf); /* the totally useless 'help' string.. */
|
tmp = one_argument(arg, actbuf); /* the totally useless 'help' string.. */
|
||||||
skip_spaces(&tmp);
|
skip_spaces(&tmp);
|
||||||
|
|
||||||
if (!*tmp)
|
if (!*tmp)
|
||||||
context = find_context(d);
|
context = find_context(d);
|
||||||
|
|
||||||
if (context != NOTHING && context < NUM_CONTEXTS && *context_help_list[context]) {
|
if (context != NOTHING && context < NUM_CONTEXTS && *context_help_list[context]) {
|
||||||
if (*context_help_list[context] == FIND_HELP_CHAR) {
|
if (*context_help_list[context] == FIND_HELP_CHAR) {
|
||||||
strncpy(actbuf, context_help_list[context]+1, sizeof(actbuf)-1);
|
strncpy(actbuf, context_help_list[context]+1, sizeof(actbuf)-1);
|
||||||
|
|
@ -233,7 +233,7 @@ int context_help(struct descriptor_data *d, char *arg)
|
||||||
write_to_output(d, "\r\n%s\r\n> ", context_help_list[context]);
|
write_to_output(d, "\r\n%s\r\n> ", context_help_list[context]);
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
strncpy(actbuf, tmp, sizeof(actbuf)-1);
|
strncpy(actbuf, tmp, sizeof(actbuf)-1);
|
||||||
do_help(d->character, actbuf, 0, 0);
|
do_help(d->character, actbuf, 0, 0);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
@ -249,8 +249,8 @@ void boot_context_help(void) {
|
||||||
/* init to 'no help' string */
|
/* init to 'no help' string */
|
||||||
for (i=0;i < NUM_CONTEXTS;i++)
|
for (i=0;i < NUM_CONTEXTS;i++)
|
||||||
context_help_list[i] = NO_HELP;
|
context_help_list[i] = NO_HELP;
|
||||||
|
|
||||||
if (!fl) {
|
if (!fl) {
|
||||||
log("No context help found : %s", strerror(errno));
|
log("No context help found : %s", strerror(errno));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -258,7 +258,7 @@ void boot_context_help(void) {
|
||||||
if (sscanf(line, "#%d *", &num) == 1 && num >= 0 && num < NUM_CONTEXTS) /* got a number, now get the text */
|
if (sscanf(line, "#%d *", &num) == 1 && num >= 0 && num < NUM_CONTEXTS) /* got a number, now get the text */
|
||||||
context_help_list[num] = fread_string(fl, "Context sensitive help");
|
context_help_list[num] = fread_string(fl, "Context sensitive help");
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fl);
|
fclose(fl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
180
src/db.c
180
src/db.c
|
|
@ -243,7 +243,7 @@ void boot_social_messages(void)
|
||||||
|
|
||||||
log("Social table contains %d socials.", top_of_socialt);
|
log("Social table contains %d socials.", top_of_socialt);
|
||||||
rewind(fl);
|
rewind(fl);
|
||||||
|
|
||||||
CREATE(soc_mess_list, struct social_messg, top_of_socialt + 1);
|
CREATE(soc_mess_list, struct social_messg, top_of_socialt + 1);
|
||||||
|
|
||||||
/* now read 'em */
|
/* now read 'em */
|
||||||
|
|
@ -320,7 +320,7 @@ void boot_social_messages(void)
|
||||||
soc_mess_list[curr_soc].char_auto = fread_action(fl, nr);
|
soc_mess_list[curr_soc].char_auto = fread_action(fl, nr);
|
||||||
soc_mess_list[curr_soc].others_auto = fread_action(fl, nr);
|
soc_mess_list[curr_soc].others_auto = fread_action(fl, nr);
|
||||||
|
|
||||||
if (CONFIG_NEW_SOCIALS == FALSE)
|
if (CONFIG_NEW_SOCIALS == FALSE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
soc_mess_list[curr_soc].char_body_found = fread_action(fl, nr);
|
soc_mess_list[curr_soc].char_body_found = fread_action(fl, nr);
|
||||||
|
|
@ -376,69 +376,69 @@ ACMD(do_reboot)
|
||||||
if (!str_cmp(arg, "all") || *arg == '*') {
|
if (!str_cmp(arg, "all") || *arg == '*') {
|
||||||
if (file_to_string_alloc(GREETINGS_FILE, &GREETINGS) == 0)
|
if (file_to_string_alloc(GREETINGS_FILE, &GREETINGS) == 0)
|
||||||
prune_crlf(GREETINGS);
|
prune_crlf(GREETINGS);
|
||||||
if (file_to_string_alloc(WIZLIST_FILE, &wizlist) < 0)
|
if (file_to_string_alloc(WIZLIST_FILE, &wizlist) < 0)
|
||||||
send_to_char(ch, "Can not read wizlist\r\n");
|
send_to_char(ch, "Can not read wizlist\r\n");
|
||||||
if (file_to_string_alloc(IMMLIST_FILE, &immlist) < 0)
|
if (file_to_string_alloc(IMMLIST_FILE, &immlist) < 0)
|
||||||
send_to_char(ch, "Can not read immlist\r\n");
|
send_to_char(ch, "Can not read immlist\r\n");
|
||||||
if (file_to_string_alloc(NEWS_FILE, &news) < 0)
|
if (file_to_string_alloc(NEWS_FILE, &news) < 0)
|
||||||
send_to_char(ch, "Can not read news\r\n");
|
send_to_char(ch, "Can not read news\r\n");
|
||||||
if (file_to_string_alloc(CREDITS_FILE, &credits) < 0)
|
if (file_to_string_alloc(CREDITS_FILE, &credits) < 0)
|
||||||
send_to_char(ch, "Can not read credits\r\n");
|
send_to_char(ch, "Can not read credits\r\n");
|
||||||
if (file_to_string_alloc(MOTD_FILE, &motd) < 0)
|
if (file_to_string_alloc(MOTD_FILE, &motd) < 0)
|
||||||
send_to_char(ch, "Can not read motd\r\n");
|
send_to_char(ch, "Can not read motd\r\n");
|
||||||
if (file_to_string_alloc(IMOTD_FILE, &imotd) < 0)
|
if (file_to_string_alloc(IMOTD_FILE, &imotd) < 0)
|
||||||
send_to_char(ch, "Can not read imotd\r\n");
|
send_to_char(ch, "Can not read imotd\r\n");
|
||||||
if (file_to_string_alloc(HELP_PAGE_FILE, &help) < 0)
|
if (file_to_string_alloc(HELP_PAGE_FILE, &help) < 0)
|
||||||
send_to_char(ch, "Can not read help front page\r\n");
|
send_to_char(ch, "Can not read help front page\r\n");
|
||||||
if (file_to_string_alloc(IHELP_PAGE_FILE, &ihelp) < 0)
|
if (file_to_string_alloc(IHELP_PAGE_FILE, &ihelp) < 0)
|
||||||
send_to_char(ch, "Can not read help front page\r\n");
|
send_to_char(ch, "Can not read help front page\r\n");
|
||||||
if (file_to_string_alloc(INFO_FILE, &info) < 0)
|
if (file_to_string_alloc(INFO_FILE, &info) < 0)
|
||||||
send_to_char(ch, "Can not read info file\r\n");
|
send_to_char(ch, "Can not read info file\r\n");
|
||||||
if (file_to_string_alloc(POLICIES_FILE, &policies) < 0)
|
if (file_to_string_alloc(POLICIES_FILE, &policies) < 0)
|
||||||
send_to_char(ch, "Can not read policies\r\n");
|
send_to_char(ch, "Can not read policies\r\n");
|
||||||
if (file_to_string_alloc(HANDBOOK_FILE, &handbook) < 0)
|
if (file_to_string_alloc(HANDBOOK_FILE, &handbook) < 0)
|
||||||
send_to_char(ch, "Can not read handbook\r\n");
|
send_to_char(ch, "Can not read handbook\r\n");
|
||||||
if (file_to_string_alloc(BACKGROUND_FILE, &background) < 0)
|
if (file_to_string_alloc(BACKGROUND_FILE, &background) < 0)
|
||||||
send_to_char(ch, "Can not read background\r\n");
|
send_to_char(ch, "Can not read background\r\n");
|
||||||
if (help_table) {
|
if (help_table) {
|
||||||
free_help_table();
|
free_help_table();
|
||||||
index_boot(DB_BOOT_HLP);
|
index_boot(DB_BOOT_HLP);
|
||||||
}
|
}
|
||||||
} else if (!str_cmp(arg, "wizlist")) {
|
} else if (!str_cmp(arg, "wizlist")) {
|
||||||
if (file_to_string_alloc(WIZLIST_FILE, &wizlist) < 0)
|
if (file_to_string_alloc(WIZLIST_FILE, &wizlist) < 0)
|
||||||
send_to_char(ch, "Can not read wizlist\r\n");
|
send_to_char(ch, "Can not read wizlist\r\n");
|
||||||
} else if (!str_cmp(arg, "immlist")) {
|
} else if (!str_cmp(arg, "immlist")) {
|
||||||
if (file_to_string_alloc(IMMLIST_FILE, &immlist) < 0)
|
if (file_to_string_alloc(IMMLIST_FILE, &immlist) < 0)
|
||||||
send_to_char(ch, "Can not read immlist\r\n");
|
send_to_char(ch, "Can not read immlist\r\n");
|
||||||
} else if (!str_cmp(arg, "news")) {
|
} else if (!str_cmp(arg, "news")) {
|
||||||
if (file_to_string_alloc(NEWS_FILE, &news) < 0)
|
if (file_to_string_alloc(NEWS_FILE, &news) < 0)
|
||||||
send_to_char(ch, "Can not read news\r\n");
|
send_to_char(ch, "Can not read news\r\n");
|
||||||
} else if (!str_cmp(arg, "credits")) {
|
} else if (!str_cmp(arg, "credits")) {
|
||||||
if (file_to_string_alloc(CREDITS_FILE, &credits) < 0)
|
if (file_to_string_alloc(CREDITS_FILE, &credits) < 0)
|
||||||
send_to_char(ch, "Can not read credits\r\n");
|
send_to_char(ch, "Can not read credits\r\n");
|
||||||
} else if (!str_cmp(arg, "motd")) {
|
} else if (!str_cmp(arg, "motd")) {
|
||||||
if (file_to_string_alloc(MOTD_FILE, &motd) < 0)
|
if (file_to_string_alloc(MOTD_FILE, &motd) < 0)
|
||||||
send_to_char(ch, "Can not read motd\r\n");
|
send_to_char(ch, "Can not read motd\r\n");
|
||||||
} else if (!str_cmp(arg, "imotd")) {
|
} else if (!str_cmp(arg, "imotd")) {
|
||||||
if (file_to_string_alloc(IMOTD_FILE, &imotd) < 0)
|
if (file_to_string_alloc(IMOTD_FILE, &imotd) < 0)
|
||||||
send_to_char(ch, "Can not read imotd\r\n");
|
send_to_char(ch, "Can not read imotd\r\n");
|
||||||
} else if (!str_cmp(arg, "help")) {
|
} else if (!str_cmp(arg, "help")) {
|
||||||
if (file_to_string_alloc(HELP_PAGE_FILE, &help) < 0)
|
if (file_to_string_alloc(HELP_PAGE_FILE, &help) < 0)
|
||||||
send_to_char(ch, "Can not read help front page\r\n");
|
send_to_char(ch, "Can not read help front page\r\n");
|
||||||
} else if (!str_cmp(arg, "ihelp")) {
|
} else if (!str_cmp(arg, "ihelp")) {
|
||||||
if (file_to_string_alloc(IHELP_PAGE_FILE, &ihelp) < 0)
|
if (file_to_string_alloc(IHELP_PAGE_FILE, &ihelp) < 0)
|
||||||
send_to_char(ch, "Can not read help front page\r\n");
|
send_to_char(ch, "Can not read help front page\r\n");
|
||||||
} else if (!str_cmp(arg, "info")) {
|
} else if (!str_cmp(arg, "info")) {
|
||||||
if (file_to_string_alloc(INFO_FILE, &info) < 0)
|
if (file_to_string_alloc(INFO_FILE, &info) < 0)
|
||||||
send_to_char(ch, "Can not read info\r\n");
|
send_to_char(ch, "Can not read info\r\n");
|
||||||
} else if (!str_cmp(arg, "policy")) {
|
} else if (!str_cmp(arg, "policy")) {
|
||||||
if (file_to_string_alloc(POLICIES_FILE, &policies) < 0)
|
if (file_to_string_alloc(POLICIES_FILE, &policies) < 0)
|
||||||
send_to_char(ch, "Can not read policy\r\n");
|
send_to_char(ch, "Can not read policy\r\n");
|
||||||
} else if (!str_cmp(arg, "handbook")) {
|
} else if (!str_cmp(arg, "handbook")) {
|
||||||
if (file_to_string_alloc(HANDBOOK_FILE, &handbook) < 0)
|
if (file_to_string_alloc(HANDBOOK_FILE, &handbook) < 0)
|
||||||
send_to_char(ch, "Can not read handbook\r\n");
|
send_to_char(ch, "Can not read handbook\r\n");
|
||||||
} else if (!str_cmp(arg, "background")) {
|
} else if (!str_cmp(arg, "background")) {
|
||||||
if (file_to_string_alloc(BACKGROUND_FILE, &background) < 0)
|
if (file_to_string_alloc(BACKGROUND_FILE, &background) < 0)
|
||||||
send_to_char(ch, "Can not read background\r\n");
|
send_to_char(ch, "Can not read background\r\n");
|
||||||
} else if (!str_cmp(arg, "greetings")) {
|
} else if (!str_cmp(arg, "greetings")) {
|
||||||
if (file_to_string_alloc(GREETINGS_FILE, &GREETINGS) == 0)
|
if (file_to_string_alloc(GREETINGS_FILE, &GREETINGS) == 0)
|
||||||
|
|
@ -542,7 +542,7 @@ void destroy_db(void)
|
||||||
extract_script(&world[cnt], WLD_TRIGGER);
|
extract_script(&world[cnt], WLD_TRIGGER);
|
||||||
/* free script proto list */
|
/* free script proto list */
|
||||||
free_proto_script(&world[cnt], WLD_TRIGGER);
|
free_proto_script(&world[cnt], WLD_TRIGGER);
|
||||||
|
|
||||||
for (itr = 0; itr < NUM_OF_DIRS; itr++) {
|
for (itr = 0; itr < NUM_OF_DIRS; itr++) {
|
||||||
if (!world[cnt].dir_option[itr])
|
if (!world[cnt].dir_option[itr])
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -556,7 +556,7 @@ void destroy_db(void)
|
||||||
}
|
}
|
||||||
free(world);
|
free(world);
|
||||||
top_of_world = 0;
|
top_of_world = 0;
|
||||||
|
|
||||||
/* Objects */
|
/* Objects */
|
||||||
for (cnt = 0; cnt <= top_of_objt; cnt++) {
|
for (cnt = 0; cnt <= top_of_objt; cnt++) {
|
||||||
if (obj_proto[cnt].name)
|
if (obj_proto[cnt].name)
|
||||||
|
|
@ -633,9 +633,9 @@ void destroy_db(void)
|
||||||
temp = ftemp->next;
|
temp = ftemp->next;
|
||||||
free(ftemp);
|
free(ftemp);
|
||||||
ftemp = temp;
|
ftemp = temp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Triggers */
|
/* Triggers */
|
||||||
for (cnt=0; cnt < top_of_trigt; cnt++) {
|
for (cnt=0; cnt < top_of_trigt; cnt++) {
|
||||||
if (trig_index[cnt]->proto) {
|
if (trig_index[cnt]->proto) {
|
||||||
|
|
@ -657,10 +657,10 @@ void destroy_db(void)
|
||||||
free(trig_index[cnt]);
|
free(trig_index[cnt]);
|
||||||
}
|
}
|
||||||
free(trig_index);
|
free(trig_index);
|
||||||
|
|
||||||
/* Events */
|
/* Events */
|
||||||
event_free_all();
|
event_free_all();
|
||||||
|
|
||||||
/* context sensitive help system */
|
/* context sensitive help system */
|
||||||
free_context_help();
|
free_context_help();
|
||||||
|
|
||||||
|
|
@ -769,7 +769,7 @@ void boot_db(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
extern SPECIAL(shop_keeper);
|
extern SPECIAL(shop_keeper);
|
||||||
|
|
||||||
for (i = 0 ; i < top_of_objt; i++) {
|
for (i = 0 ; i < top_of_objt; i++) {
|
||||||
if (obj_proto[i].script == (struct script_data *)&shop_keeper) {
|
if (obj_proto[i].script == (struct script_data *)&shop_keeper) {
|
||||||
log("Item %d (%s) had shopkeeper trouble.", obj_index[i].vnum, obj_proto[i].short_description);
|
log("Item %d (%s) had shopkeeper trouble.", obj_index[i].vnum, obj_proto[i].short_description);
|
||||||
|
|
@ -898,7 +898,7 @@ int count_alias_records(FILE *fl)
|
||||||
return (total_keywords);
|
return (total_keywords);
|
||||||
|
|
||||||
/* No, they are not evil. -gg 6/24/98 */
|
/* No, they are not evil. -gg 6/24/98 */
|
||||||
ackeof:
|
ackeof:
|
||||||
log("SYSERR: Unexpected end of help file.");
|
log("SYSERR: Unexpected end of help file.");
|
||||||
exit(1); /* Some day we hope to handle these things better... */
|
exit(1); /* Some day we hope to handle these things better... */
|
||||||
}
|
}
|
||||||
|
|
@ -1135,7 +1135,7 @@ char fread_letter(FILE *fp)
|
||||||
{
|
{
|
||||||
char c;
|
char c;
|
||||||
do {
|
do {
|
||||||
c = getc(fp);
|
c = getc(fp);
|
||||||
} while (isspace(c));
|
} while (isspace(c));
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
@ -1171,7 +1171,7 @@ void parse_room(FILE *fl, int virtual_nr)
|
||||||
char line[READ_SIZE], flags[128], buf2[MAX_STRING_LENGTH], buf[128];
|
char line[READ_SIZE], flags[128], buf2[MAX_STRING_LENGTH], buf[128];
|
||||||
struct extra_descr_data *new_descr;
|
struct extra_descr_data *new_descr;
|
||||||
char letter;
|
char letter;
|
||||||
|
|
||||||
/* This really had better fit or there are other problems. */
|
/* This really had better fit or there are other problems. */
|
||||||
snprintf(buf2, sizeof(buf2), "room #%d", virtual_nr);
|
snprintf(buf2, sizeof(buf2), "room #%d", virtual_nr);
|
||||||
|
|
||||||
|
|
@ -1233,11 +1233,11 @@ void parse_room(FILE *fl, int virtual_nr)
|
||||||
CREATE(new_descr, struct extra_descr_data, 1);
|
CREATE(new_descr, struct extra_descr_data, 1);
|
||||||
new_descr->keyword = fread_string(fl, buf2);
|
new_descr->keyword = fread_string(fl, buf2);
|
||||||
new_descr->description = fread_string(fl, buf2);
|
new_descr->description = fread_string(fl, buf2);
|
||||||
/* fix for crashes in the editor when formatting
|
/* fix for crashes in the editor when formatting
|
||||||
* - e-descs are assumed to end with a \r\n
|
* - e-descs are assumed to end with a \r\n
|
||||||
* -- Welcor 09/03
|
* -- Welcor 09/03
|
||||||
*/
|
*/
|
||||||
{
|
{
|
||||||
char *end = strchr(new_descr->description, '\0');
|
char *end = strchr(new_descr->description, '\0');
|
||||||
if (end > new_descr->description && *(end-1) != '\n') {
|
if (end > new_descr->description && *(end-1) != '\n') {
|
||||||
CREATE(end, char, strlen(new_descr->description)+3);
|
CREATE(end, char, strlen(new_descr->description)+3);
|
||||||
|
|
@ -1536,7 +1536,7 @@ void interpret_espec(const char *keyword, const char *value, int i, int nr)
|
||||||
|
|
||||||
CASE("StrAdd") {
|
CASE("StrAdd") {
|
||||||
RANGE(0, 100);
|
RANGE(0, 100);
|
||||||
mob_proto[i].real_abils.str_add = num_arg;
|
mob_proto[i].real_abils.str_add = num_arg;
|
||||||
}
|
}
|
||||||
|
|
||||||
CASE("Int") {
|
CASE("Int") {
|
||||||
|
|
@ -1567,7 +1567,7 @@ void interpret_espec(const char *keyword, const char *value, int i, int nr)
|
||||||
if (!matched) {
|
if (!matched) {
|
||||||
log("SYSERR: Warning: unrecognized espec keyword %s in mob #%d",
|
log("SYSERR: Warning: unrecognized espec keyword %s in mob #%d",
|
||||||
keyword, nr);
|
keyword, nr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#undef CASE
|
#undef CASE
|
||||||
|
|
@ -1765,7 +1765,7 @@ char *parse_object(FILE *obj_f, int nr)
|
||||||
GET_OBJ_EXTRA(obj_proto + i) = asciiflag_conv(f1);
|
GET_OBJ_EXTRA(obj_proto + i) = asciiflag_conv(f1);
|
||||||
GET_OBJ_WEAR(obj_proto + i) = asciiflag_conv(f2);
|
GET_OBJ_WEAR(obj_proto + i) = asciiflag_conv(f2);
|
||||||
GET_OBJ_PERM(obj_proto + i) = asciiflag_conv(f3);
|
GET_OBJ_PERM(obj_proto + i) = asciiflag_conv(f3);
|
||||||
|
|
||||||
if (!get_line(obj_f, line)) {
|
if (!get_line(obj_f, line)) {
|
||||||
log("SYSERR: Expecting second numeric line of %s, but file ended!", buf2);
|
log("SYSERR: Expecting second numeric line of %s, but file ended!", buf2);
|
||||||
exit(1);
|
exit(1);
|
||||||
|
|
@ -1791,12 +1791,12 @@ char *parse_object(FILE *obj_f, int nr)
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GET_OBJ_WEIGHT(obj_proto + i) = t[0];
|
GET_OBJ_WEIGHT(obj_proto + i) = t[0];
|
||||||
GET_OBJ_COST(obj_proto + i) = t[1];
|
GET_OBJ_COST(obj_proto + i) = t[1];
|
||||||
GET_OBJ_RENT(obj_proto + i) = t[2];
|
GET_OBJ_RENT(obj_proto + i) = t[2];
|
||||||
GET_OBJ_LEVEL(obj_proto + i) = t[3];
|
GET_OBJ_LEVEL(obj_proto + i) = t[3];
|
||||||
|
|
||||||
/* check to make sure that weight of containers exceeds curr. quantity */
|
/* check to make sure that weight of containers exceeds curr. quantity */
|
||||||
if (GET_OBJ_TYPE(obj_proto + i) == ITEM_DRINKCON ||
|
if (GET_OBJ_TYPE(obj_proto + i) == ITEM_DRINKCON ||
|
||||||
GET_OBJ_TYPE(obj_proto + i) == ITEM_FOUNTAIN) {
|
GET_OBJ_TYPE(obj_proto + i) == ITEM_FOUNTAIN) {
|
||||||
|
|
@ -1876,7 +1876,7 @@ void load_zones(FILE *fl, char *zonename)
|
||||||
char *ptr, buf[READ_SIZE], zname[READ_SIZE], buf2[MAX_STRING_LENGTH];
|
char *ptr, buf[READ_SIZE], zname[READ_SIZE], buf2[MAX_STRING_LENGTH];
|
||||||
int zone_fix = FALSE;
|
int zone_fix = FALSE;
|
||||||
char t1[80], t2[80];
|
char t1[80], t2[80];
|
||||||
|
|
||||||
strlcpy(zname, zonename, sizeof(zname));
|
strlcpy(zname, zonename, sizeof(zname));
|
||||||
|
|
||||||
/* Skip first 3 lines lest we mistake the zone name for a command. */
|
/* Skip first 3 lines lest we mistake the zone name for a command. */
|
||||||
|
|
@ -1911,7 +1911,7 @@ void load_zones(FILE *fl, char *zonename)
|
||||||
if ((ptr = strchr(buf, '~')) != NULL) /* take off the '~' if it's there */
|
if ((ptr = strchr(buf, '~')) != NULL) /* take off the '~' if it's there */
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
Z.builders = strdup(buf);
|
Z.builders = strdup(buf);
|
||||||
|
|
||||||
line_num += get_line(fl, buf);
|
line_num += get_line(fl, buf);
|
||||||
if ((ptr = strchr(buf, '~')) != NULL) /* take off the '~' if it's there */
|
if ((ptr = strchr(buf, '~')) != NULL) /* take off the '~' if it's there */
|
||||||
*ptr = '\0';
|
*ptr = '\0';
|
||||||
|
|
@ -1952,7 +1952,7 @@ void load_zones(FILE *fl, char *zonename)
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
zone_fix = FALSE;
|
zone_fix = FALSE;
|
||||||
|
|
||||||
line_num += tmp;
|
line_num += tmp;
|
||||||
ptr = buf;
|
ptr = buf;
|
||||||
skip_spaces(&ptr);
|
skip_spaces(&ptr);
|
||||||
|
|
@ -2017,7 +2017,7 @@ void get_one_line(FILE *fl, char *buf)
|
||||||
|
|
||||||
/*************************************************************************
|
/*************************************************************************
|
||||||
* procedures for resetting, both play-time and boot-time *
|
* procedures for resetting, both play-time and boot-time *
|
||||||
*************************************************************************/
|
*************************************************************************/
|
||||||
|
|
||||||
int vnum_mobile(char *searchname, struct char_data *ch)
|
int vnum_mobile(char *searchname, struct char_data *ch)
|
||||||
{
|
{
|
||||||
|
|
@ -2025,7 +2025,7 @@ int vnum_mobile(char *searchname, struct char_data *ch)
|
||||||
|
|
||||||
for (nr = 0; nr <= top_of_mobt; nr++)
|
for (nr = 0; nr <= top_of_mobt; nr++)
|
||||||
if (isname(searchname, mob_proto[nr].player.name))
|
if (isname(searchname, mob_proto[nr].player.name))
|
||||||
send_to_char(ch, "%3d. [%5d] %-40s %s\r\n",
|
send_to_char(ch, "%3d. [%5d] %-40s %s\r\n",
|
||||||
++found, mob_index[nr].vnum, mob_proto[nr].player.short_descr,
|
++found, mob_index[nr].vnum, mob_proto[nr].player.short_descr,
|
||||||
mob_proto[nr].proto_script ? "[TRIG]" : "" );
|
mob_proto[nr].proto_script ? "[TRIG]" : "" );
|
||||||
|
|
||||||
|
|
@ -2040,7 +2040,7 @@ int vnum_object(char *searchname, struct char_data *ch)
|
||||||
|
|
||||||
for (nr = 0; nr <= top_of_objt; nr++)
|
for (nr = 0; nr <= top_of_objt; nr++)
|
||||||
if (isname(searchname, obj_proto[nr].name))
|
if (isname(searchname, obj_proto[nr].name))
|
||||||
send_to_char(ch, "%3d. [%5d] %-40s %s\r\n",
|
send_to_char(ch, "%3d. [%5d] %-40s %s\r\n",
|
||||||
++found, obj_index[nr].vnum, obj_proto[nr].short_description,
|
++found, obj_index[nr].vnum, obj_proto[nr].short_description,
|
||||||
obj_proto[nr].proto_script ? "[TRIG]" : "" );
|
obj_proto[nr].proto_script ? "[TRIG]" : "" );
|
||||||
|
|
||||||
|
|
@ -2067,7 +2067,7 @@ int vnum_trig(char *searchname, struct char_data *ch)
|
||||||
send_to_char(ch, "%3d. [%5d] %-40s\r\n",
|
send_to_char(ch, "%3d. [%5d] %-40s\r\n",
|
||||||
++found, trig_index[nr]->vnum, trig_index[nr]->proto->name);
|
++found, trig_index[nr]->vnum, trig_index[nr]->proto->name);
|
||||||
return (found);
|
return (found);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* create a character, and add it to the char list */
|
/* create a character, and add it to the char list */
|
||||||
struct char_data *create_char(void)
|
struct char_data *create_char(void)
|
||||||
|
|
@ -2078,11 +2078,11 @@ struct char_data *create_char(void)
|
||||||
clear_char(ch);
|
clear_char(ch);
|
||||||
ch->next = character_list;
|
ch->next = character_list;
|
||||||
character_list = ch;
|
character_list = ch;
|
||||||
|
|
||||||
GET_ID(ch) = max_mob_id++;
|
GET_ID(ch) = max_mob_id++;
|
||||||
/* find_char helper */
|
/* find_char helper */
|
||||||
add_to_lookup_table(GET_ID(ch), (void *)ch);
|
add_to_lookup_table(GET_ID(ch), (void *)ch);
|
||||||
|
|
||||||
return (ch);
|
return (ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2236,7 +2236,7 @@ void zone_update(void)
|
||||||
if (zone_table[update_u->zone_to_reset].reset_mode == 2 ||
|
if (zone_table[update_u->zone_to_reset].reset_mode == 2 ||
|
||||||
is_empty(update_u->zone_to_reset)) {
|
is_empty(update_u->zone_to_reset)) {
|
||||||
reset_zone(update_u->zone_to_reset);
|
reset_zone(update_u->zone_to_reset);
|
||||||
mudlog(CMP, LVL_IMPL, FALSE, "Auto zone reset: %s (Zone %d)",
|
mudlog(CMP, LVL_IMPL, FALSE, "Auto zone reset: %s (Zone %d)",
|
||||||
zone_table[update_u->zone_to_reset].name, zone_table[update_u->zone_to_reset].number);
|
zone_table[update_u->zone_to_reset].name, zone_table[update_u->zone_to_reset].number);
|
||||||
/* dequeue */
|
/* dequeue */
|
||||||
if (update_u == reset_q.head)
|
if (update_u == reset_q.head)
|
||||||
|
|
@ -2516,8 +2516,8 @@ int is_empty(zone_rnum zone_nr)
|
||||||
if (world[IN_ROOM(i->character)].zone != zone_nr)
|
if (world[IN_ROOM(i->character)].zone != zone_nr)
|
||||||
continue;
|
continue;
|
||||||
/*
|
/*
|
||||||
* if an immortal has nohassle off, he counts as present
|
* if an immortal has nohassle off, he counts as present
|
||||||
* added for testing zone reset triggers - Welcor
|
* added for testing zone reset triggers - Welcor
|
||||||
*/
|
*/
|
||||||
if ((GET_LEVEL(i->character) >= LVL_IMMORT) && (PRF_FLAGGED(i->character, PRF_NOHASSLE)))
|
if ((GET_LEVEL(i->character) >= LVL_IMMORT) && (PRF_FLAGGED(i->character, PRF_NOHASSLE)))
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -2604,7 +2604,7 @@ void free_char(struct char_data *ch)
|
||||||
free(ch->player_specials->poofin);
|
free(ch->player_specials->poofin);
|
||||||
if (ch->player_specials->poofout)
|
if (ch->player_specials->poofout)
|
||||||
free(ch->player_specials->poofout);
|
free(ch->player_specials->poofout);
|
||||||
if (GET_HOST(ch))
|
if (GET_HOST(ch))
|
||||||
free(GET_HOST(ch));
|
free(GET_HOST(ch));
|
||||||
free(ch->player_specials);
|
free(ch->player_specials);
|
||||||
if (IS_NPC(ch))
|
if (IS_NPC(ch))
|
||||||
|
|
@ -2622,10 +2622,10 @@ void free_char(struct char_data *ch)
|
||||||
free(ch->player.long_descr);
|
free(ch->player.long_descr);
|
||||||
if (ch->player.description)
|
if (ch->player.description)
|
||||||
free(ch->player.description);
|
free(ch->player.description);
|
||||||
|
|
||||||
/* free script proto list */
|
/* free script proto list */
|
||||||
free_proto_script(ch, MOB_TRIGGER);
|
free_proto_script(ch, MOB_TRIGGER);
|
||||||
|
|
||||||
} else if ((i = GET_MOB_RNUM(ch)) != NOBODY) {
|
} else if ((i = GET_MOB_RNUM(ch)) != NOBODY) {
|
||||||
/* otherwise, free strings only if the string is not pointing at proto */
|
/* otherwise, free strings only if the string is not pointing at proto */
|
||||||
if (ch->player.name && ch->player.name != mob_proto[i].player.name)
|
if (ch->player.name && ch->player.name != mob_proto[i].player.name)
|
||||||
|
|
@ -2657,10 +2657,10 @@ void free_char(struct char_data *ch)
|
||||||
|
|
||||||
/* find_char helper */
|
/* find_char helper */
|
||||||
/*
|
/*
|
||||||
* when free_char is called with a blank character struct, ID is set
|
* when free_char is called with a blank character struct, ID is set
|
||||||
* to 0, and has not yet been added to the lookup table.
|
* to 0, and has not yet been added to the lookup table.
|
||||||
*/
|
*/
|
||||||
if (GET_ID(ch) != 0)
|
if (GET_ID(ch) != 0)
|
||||||
remove_from_lookup_table(GET_ID(ch));
|
remove_from_lookup_table(GET_ID(ch));
|
||||||
|
|
||||||
free(ch);
|
free(ch);
|
||||||
|
|
@ -3106,7 +3106,7 @@ int check_object(struct obj_data *obj)
|
||||||
}
|
}
|
||||||
next_name = any_one_arg(next_name, onealias);
|
next_name = any_one_arg(next_name, onealias);
|
||||||
} while (onealias && *onealias);
|
} while (onealias && *onealias);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -3256,7 +3256,7 @@ void load_default_config( void )
|
||||||
CONFIG_NOEFFECT = strdup(NOEFFECT);
|
CONFIG_NOEFFECT = strdup(NOEFFECT);
|
||||||
CONFIG_TRACK_T_DOORS = track_through_doors;
|
CONFIG_TRACK_T_DOORS = track_through_doors;
|
||||||
CONFIG_IMMORT_LEVEL_OK = immort_level_ok;
|
CONFIG_IMMORT_LEVEL_OK = immort_level_ok;
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Rent / crashsave options. **/
|
/** Rent / crashsave options. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -3267,7 +3267,7 @@ void load_default_config( void )
|
||||||
CONFIG_AUTOSAVE_TIME = autosave_time;
|
CONFIG_AUTOSAVE_TIME = autosave_time;
|
||||||
CONFIG_CRASH_TIMEOUT = crash_file_timeout;
|
CONFIG_CRASH_TIMEOUT = crash_file_timeout;
|
||||||
CONFIG_RENT_TIMEOUT = rent_file_timeout;
|
CONFIG_RENT_TIMEOUT = rent_file_timeout;
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Room numbers. **/
|
/** Room numbers. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -3277,24 +3277,24 @@ void load_default_config( void )
|
||||||
CONFIG_DON_ROOM_1 = donation_room_1;
|
CONFIG_DON_ROOM_1 = donation_room_1;
|
||||||
CONFIG_DON_ROOM_2 = donation_room_2;
|
CONFIG_DON_ROOM_2 = donation_room_2;
|
||||||
CONFIG_DON_ROOM_3 = donation_room_3;
|
CONFIG_DON_ROOM_3 = donation_room_3;
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/**eration options. **/
|
/**eration options. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
CONFIG_DFLT_PORT = DFLT_PORT;
|
CONFIG_DFLT_PORT = DFLT_PORT;
|
||||||
|
|
||||||
if (DFLT_IP)
|
if (DFLT_IP)
|
||||||
CONFIG_DFLT_IP = strdup(DFLT_IP);
|
CONFIG_DFLT_IP = strdup(DFLT_IP);
|
||||||
else
|
else
|
||||||
CONFIG_DFLT_IP = NULL;
|
CONFIG_DFLT_IP = NULL;
|
||||||
|
|
||||||
CONFIG_DFLT_DIR = strdup(DFLT_DIR);
|
CONFIG_DFLT_DIR = strdup(DFLT_DIR);
|
||||||
|
|
||||||
if (LOGNAME)
|
if (LOGNAME)
|
||||||
CONFIG_LOGNAME = strdup(LOGNAME);
|
CONFIG_LOGNAME = strdup(LOGNAME);
|
||||||
else
|
else
|
||||||
CONFIG_LOGNAME = NULL;
|
CONFIG_LOGNAME = NULL;
|
||||||
|
|
||||||
CONFIG_MAX_PLAYING = max_playing;
|
CONFIG_MAX_PLAYING = max_playing;
|
||||||
CONFIG_MAX_FILESIZE = max_filesize;
|
CONFIG_MAX_FILESIZE = max_filesize;
|
||||||
CONFIG_MAX_BAD_PWS = max_bad_pws;
|
CONFIG_MAX_BAD_PWS = max_bad_pws;
|
||||||
|
|
@ -3305,7 +3305,7 @@ void load_default_config( void )
|
||||||
CONFIG_MENU = strdup(MENU);
|
CONFIG_MENU = strdup(MENU);
|
||||||
CONFIG_WELC_MESSG = strdup(WELC_MESSG);
|
CONFIG_WELC_MESSG = strdup(WELC_MESSG);
|
||||||
CONFIG_START_MESSG = strdup(START_MESSG);
|
CONFIG_START_MESSG = strdup(START_MESSG);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Autowiz options. **/
|
/** Autowiz options. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -3322,21 +3322,21 @@ void load_config( void )
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
load_default_config();
|
load_default_config();
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf), "%s/%s", DFLT_DIR, CONFIG_CONFFILE);
|
snprintf(buf, sizeof(buf), "%s/%s", DFLT_DIR, CONFIG_CONFFILE);
|
||||||
if ( !(fl = fopen(CONFIG_CONFFILE, "r")) && !(fl = fopen(buf, "r")) ) {
|
if ( !(fl = fopen(CONFIG_CONFFILE, "r")) && !(fl = fopen(buf, "r")) ) {
|
||||||
snprintf(buf, sizeof(buf), "No %s file, using defaults", CONFIG_CONFFILE);
|
snprintf(buf, sizeof(buf), "No %s file, using defaults", CONFIG_CONFFILE);
|
||||||
perror(buf);
|
perror(buf);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Load the game configuration file. **/
|
/** Load the game configuration file. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
while (get_line(fl, line)) {
|
while (get_line(fl, line)) {
|
||||||
split_argument(line, tag);
|
split_argument(line, tag);
|
||||||
num = atoi(line);
|
num = atoi(line);
|
||||||
|
|
||||||
switch (LOWER(*tag)) {
|
switch (LOWER(*tag)) {
|
||||||
case 'a':
|
case 'a':
|
||||||
if (!str_cmp(tag, "auto_save"))
|
if (!str_cmp(tag, "auto_save"))
|
||||||
|
|
@ -3346,12 +3346,12 @@ void load_config( void )
|
||||||
else if (!str_cmp(tag, "auto_save_olc"))
|
else if (!str_cmp(tag, "auto_save_olc"))
|
||||||
CONFIG_OLC_SAVE = num;
|
CONFIG_OLC_SAVE = num;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
if (!str_cmp(tag, "crash_file_timeout"))
|
if (!str_cmp(tag, "crash_file_timeout"))
|
||||||
CONFIG_CRASH_TIMEOUT = num;
|
CONFIG_CRASH_TIMEOUT = num;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'd':
|
case 'd':
|
||||||
if (!str_cmp(tag, "dts_are_dumps"))
|
if (!str_cmp(tag, "dts_are_dumps"))
|
||||||
CONFIG_DTS_ARE_DUMPS = num;
|
CONFIG_DTS_ARE_DUMPS = num;
|
||||||
|
|
@ -3387,19 +3387,19 @@ void load_config( void )
|
||||||
} else if (!str_cmp(tag, "dflt_port"))
|
} else if (!str_cmp(tag, "dflt_port"))
|
||||||
CONFIG_DFLT_PORT = num;
|
CONFIG_DFLT_PORT = num;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'f':
|
case 'f':
|
||||||
if (!str_cmp(tag, "free_rent"))
|
if (!str_cmp(tag, "free_rent"))
|
||||||
CONFIG_FREE_RENT = num;
|
CONFIG_FREE_RENT = num;
|
||||||
else if (!str_cmp(tag, "frozen_start_room"))
|
else if (!str_cmp(tag, "frozen_start_room"))
|
||||||
CONFIG_FROZEN_START = num;
|
CONFIG_FROZEN_START = num;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'h':
|
case 'h':
|
||||||
if (!str_cmp(tag, "holler_move_cost"))
|
if (!str_cmp(tag, "holler_move_cost"))
|
||||||
CONFIG_HOLLER_MOVE_COST = num;
|
CONFIG_HOLLER_MOVE_COST = num;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'i':
|
case 'i':
|
||||||
if (!str_cmp(tag, "idle_void"))
|
if (!str_cmp(tag, "idle_void"))
|
||||||
CONFIG_IDLE_VOID = num;
|
CONFIG_IDLE_VOID = num;
|
||||||
|
|
@ -3412,7 +3412,7 @@ void load_config( void )
|
||||||
else if (!str_cmp(tag, "immort_start_room"))
|
else if (!str_cmp(tag, "immort_start_room"))
|
||||||
CONFIG_IMMORTAL_START = num;
|
CONFIG_IMMORTAL_START = num;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'l':
|
case 'l':
|
||||||
if (!str_cmp(tag, "level_can_shout"))
|
if (!str_cmp(tag, "level_can_shout"))
|
||||||
CONFIG_LEVEL_CAN_SHOUT = num;
|
CONFIG_LEVEL_CAN_SHOUT = num;
|
||||||
|
|
@ -3427,7 +3427,7 @@ void load_config( void )
|
||||||
CONFIG_LOGNAME = NULL;
|
CONFIG_LOGNAME = NULL;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'm':
|
case 'm':
|
||||||
if (!str_cmp(tag, "max_bad_pws"))
|
if (!str_cmp(tag, "max_bad_pws"))
|
||||||
CONFIG_MAX_BAD_PWS = num;
|
CONFIG_MAX_BAD_PWS = num;
|
||||||
|
|
@ -3457,7 +3457,7 @@ void load_config( void )
|
||||||
else if (!str_cmp(tag, "mortal_start_room"))
|
else if (!str_cmp(tag, "mortal_start_room"))
|
||||||
CONFIG_MORTAL_START = num;
|
CONFIG_MORTAL_START = num;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
if (!str_cmp(tag, "nameserver_is_slow"))
|
if (!str_cmp(tag, "nameserver_is_slow"))
|
||||||
CONFIG_NS_IS_SLOW = num;
|
CONFIG_NS_IS_SLOW = num;
|
||||||
|
|
@ -3475,7 +3475,7 @@ void load_config( void )
|
||||||
CONFIG_NOEFFECT = strdup(tmp);
|
CONFIG_NOEFFECT = strdup(tmp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'o':
|
case 'o':
|
||||||
if (!str_cmp(tag, "ok")) {
|
if (!str_cmp(tag, "ok")) {
|
||||||
char tmp[READ_SIZE];
|
char tmp[READ_SIZE];
|
||||||
|
|
@ -3485,19 +3485,19 @@ void load_config( void )
|
||||||
CONFIG_OK = strdup(tmp);
|
CONFIG_OK = strdup(tmp);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'p':
|
case 'p':
|
||||||
if (!str_cmp(tag, "pk_allowed"))
|
if (!str_cmp(tag, "pk_allowed"))
|
||||||
CONFIG_PK_ALLOWED = num;
|
CONFIG_PK_ALLOWED = num;
|
||||||
else if (!str_cmp(tag, "pt_allowed"))
|
else if (!str_cmp(tag, "pt_allowed"))
|
||||||
CONFIG_PT_ALLOWED = num;
|
CONFIG_PT_ALLOWED = num;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'r':
|
case 'r':
|
||||||
if (!str_cmp(tag, "rent_file_timeout"))
|
if (!str_cmp(tag, "rent_file_timeout"))
|
||||||
CONFIG_RENT_TIMEOUT = num;
|
CONFIG_RENT_TIMEOUT = num;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
if (!str_cmp(tag, "siteok_everyone"))
|
if (!str_cmp(tag, "siteok_everyone"))
|
||||||
CONFIG_SITEOK_ALL = num;
|
CONFIG_SITEOK_ALL = num;
|
||||||
|
|
@ -3508,21 +3508,21 @@ void load_config( void )
|
||||||
CONFIG_START_MESSG = fread_string(fl, buf);
|
CONFIG_START_MESSG = fread_string(fl, buf);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
if (!str_cmp(tag, "tunnel_size"))
|
if (!str_cmp(tag, "tunnel_size"))
|
||||||
CONFIG_TUNNEL_SIZE = num;
|
CONFIG_TUNNEL_SIZE = num;
|
||||||
else if (!str_cmp(tag, "track_through_doors"))
|
else if (!str_cmp(tag, "track_through_doors"))
|
||||||
CONFIG_TRACK_T_DOORS = num;
|
CONFIG_TRACK_T_DOORS = num;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'u':
|
case 'u':
|
||||||
if (!str_cmp(tag, "use_autowiz"))
|
if (!str_cmp(tag, "use_autowiz"))
|
||||||
CONFIG_USE_AUTOWIZ = num;
|
CONFIG_USE_AUTOWIZ = num;
|
||||||
else if (!str_cmp(tag, "use_new_socials"))
|
else if (!str_cmp(tag, "use_new_socials"))
|
||||||
CONFIG_NEW_SOCIALS = num;
|
CONFIG_NEW_SOCIALS = num;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'w':
|
case 'w':
|
||||||
if (!str_cmp(tag, "welc_messg")) {
|
if (!str_cmp(tag, "welc_messg")) {
|
||||||
strncpy(buf, "Reading welcome message in load_config()", sizeof(buf));
|
strncpy(buf, "Reading welcome message in load_config()", sizeof(buf));
|
||||||
|
|
@ -3531,11 +3531,11 @@ void load_config( void )
|
||||||
CONFIG_WELC_MESSG = fread_string(fl, buf);
|
CONFIG_WELC_MESSG = fread_string(fl, buf);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fl);
|
fclose(fl);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
6
src/db.h
6
src/db.h
|
|
@ -157,7 +157,7 @@ void free_obj(struct obj_data *obj);
|
||||||
struct obj_data *read_object(obj_vnum nr, int type);
|
struct obj_data *read_object(obj_vnum nr, int type);
|
||||||
int vnum_object(char *searchname, struct char_data *ch);
|
int vnum_object(char *searchname, struct char_data *ch);
|
||||||
int vnum_room(char *, struct char_data *);
|
int vnum_room(char *, struct char_data *);
|
||||||
int vnum_trig(char *, struct char_data *);
|
int vnum_trig(char *, struct char_data *);
|
||||||
|
|
||||||
#define REAL 0
|
#define REAL 0
|
||||||
#define VIRTUAL 1
|
#define VIRTUAL 1
|
||||||
|
|
@ -174,7 +174,7 @@ struct reset_com {
|
||||||
char *sarg1; /* string argument */
|
char *sarg1; /* string argument */
|
||||||
char *sarg2; /* string argument */
|
char *sarg2; /* string argument */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Commands: *
|
* Commands: *
|
||||||
* 'M': Read a mobile *
|
* 'M': Read a mobile *
|
||||||
* 'O': Read an object *
|
* 'O': Read an object *
|
||||||
|
|
@ -271,7 +271,7 @@ struct obj_save_data_t {
|
||||||
struct obj_data *obj;
|
struct obj_data *obj;
|
||||||
int locate;
|
int locate;
|
||||||
struct obj_save_data_t *next;
|
struct obj_save_data_t *next;
|
||||||
};
|
};
|
||||||
typedef struct obj_save_data_t obj_save_data;
|
typedef struct obj_save_data_t obj_save_data;
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ char *any_one_name(char *argument, char *first_arg)
|
||||||
|
|
||||||
/* Find first non blank */
|
/* Find first non blank */
|
||||||
while(isspace(*argument))
|
while(isspace(*argument))
|
||||||
argument++;
|
argument++;
|
||||||
|
|
||||||
/* Find length of first word */
|
/* Find length of first word */
|
||||||
for(arg = first_arg ;
|
for(arg = first_arg ;
|
||||||
*argument && !isspace(*argument) &&
|
*argument && !isspace(*argument) &&
|
||||||
|
|
@ -91,7 +91,7 @@ void sub_write_to_char(char_data *ch, char *tokens[],
|
||||||
else
|
else
|
||||||
strcat(sb,HSHR((char_data *) otokens[i]));
|
strcat(sb,HSHR((char_data *) otokens[i]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '&':
|
case '&':
|
||||||
if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
|
if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
|
||||||
strcat(sb,"it");
|
strcat(sb,"it");
|
||||||
|
|
@ -100,7 +100,7 @@ void sub_write_to_char(char_data *ch, char *tokens[],
|
||||||
else
|
else
|
||||||
strcat(sb,HSSH((char_data *) otokens[i]));
|
strcat(sb,HSSH((char_data *) otokens[i]));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '*':
|
case '*':
|
||||||
if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
|
if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
|
||||||
strcat(sb,"it");
|
strcat(sb,"it");
|
||||||
|
|
@ -139,9 +139,9 @@ void sub_write(char *arg, char_data *ch, byte find_invis, int targets)
|
||||||
|
|
||||||
if (!arg)
|
if (!arg)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
tokens[0] = str;
|
tokens[0] = str;
|
||||||
|
|
||||||
for (i = 0, p = arg, s = str; *p;)
|
for (i = 0, p = arg, s = str; *p;)
|
||||||
{
|
{
|
||||||
switch (*p) {
|
switch (*p) {
|
||||||
|
|
@ -158,13 +158,13 @@ void sub_write(char *arg, char_data *ch, byte find_invis, int targets)
|
||||||
find_invis ? (void *)get_char_in_room(&world[IN_ROOM(ch)], name) : (void *)get_char_room_vis(ch, name, NULL);
|
find_invis ? (void *)get_char_in_room(&world[IN_ROOM(ch)], name) : (void *)get_char_room_vis(ch, name, NULL);
|
||||||
tokens[++i] = ++s;
|
tokens[++i] = ++s;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '¨':
|
case '¨':
|
||||||
/* get obj_data, move to next token */
|
/* get obj_data, move to next token */
|
||||||
type[i] = *p;
|
type[i] = *p;
|
||||||
*s = '\0';
|
*s = '\0';
|
||||||
p = any_one_name(++p, name);
|
p = any_one_name(++p, name);
|
||||||
|
|
||||||
if (find_invis) obj = get_obj_in_room(&world[IN_ROOM(ch)], name);
|
if (find_invis) obj = get_obj_in_room(&world[IN_ROOM(ch)], name);
|
||||||
else if (!(obj = get_obj_in_list_vis(ch, name, NULL, world[IN_ROOM(ch)].contents))) ;
|
else if (!(obj = get_obj_in_list_vis(ch, name, NULL, world[IN_ROOM(ch)].contents))) ;
|
||||||
else if (!(obj = get_obj_in_equip_vis(ch, name, &tmp, ch->equipment))) ;
|
else if (!(obj = get_obj_in_equip_vis(ch, name, &tmp, ch->equipment))) ;
|
||||||
|
|
@ -178,7 +178,7 @@ void sub_write(char *arg, char_data *ch, byte find_invis, int targets)
|
||||||
p++;
|
p++;
|
||||||
*s++ = *p++;
|
*s++ = *p++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
*s++ = *p++;
|
*s++ = *p++;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,7 @@ void parse_trigger(FILE *trig_f, int nr)
|
||||||
trig->narg = (k == 3) ? t[0] : 0;
|
trig->narg = (k == 3) ? t[0] : 0;
|
||||||
|
|
||||||
trig->arglist = fread_string(trig_f, errors);
|
trig->arglist = fread_string(trig_f, errors);
|
||||||
|
|
||||||
cmds = s = fread_string(trig_f, errors);
|
cmds = s = fread_string(trig_f, errors);
|
||||||
|
|
||||||
CREATE(trig->cmdlist, struct cmdlist_element, 1);
|
CREATE(trig->cmdlist, struct cmdlist_element, 1);
|
||||||
|
|
@ -116,7 +116,7 @@ void trig_data_init(trig_data *this_data)
|
||||||
this_data->purged = FALSE;
|
this_data->purged = FALSE;
|
||||||
this_data->var_list = NULL;
|
this_data->var_list = NULL;
|
||||||
|
|
||||||
this_data->next = NULL;
|
this_data->next = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -127,7 +127,7 @@ void trig_data_copy(trig_data *this_data, const trig_data *trg)
|
||||||
this_data->nr = trg->nr;
|
this_data->nr = trg->nr;
|
||||||
this_data->attach_type = trg->attach_type;
|
this_data->attach_type = trg->attach_type;
|
||||||
this_data->data_type = trg->data_type;
|
this_data->data_type = trg->data_type;
|
||||||
if (trg->name)
|
if (trg->name)
|
||||||
this_data->name = strdup(trg->name);
|
this_data->name = strdup(trg->name);
|
||||||
else {
|
else {
|
||||||
this_data->name = strdup("unnamed trigger");
|
this_data->name = strdup("unnamed trigger");
|
||||||
|
|
@ -153,7 +153,7 @@ void dg_read_trigger(FILE *fp, void *proto, int type)
|
||||||
count = sscanf(line,"%7s %d",junk,&vnum);
|
count = sscanf(line,"%7s %d",junk,&vnum);
|
||||||
|
|
||||||
if (count != 2) {
|
if (count != 2) {
|
||||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||||
"SYSERR: Error assigning trigger! - Line was\n %s", line);
|
"SYSERR: Error assigning trigger! - Line was\n %s", line);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -162,17 +162,17 @@ void dg_read_trigger(FILE *fp, void *proto, int type)
|
||||||
if (rnum == NOTHING) {
|
if (rnum == NOTHING) {
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case MOB_TRIGGER:
|
case MOB_TRIGGER:
|
||||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||||
"SYSERR: dg_read_trigger: Trigger vnum #%d asked for but non-existant! (mob: %s - %d)",
|
"SYSERR: dg_read_trigger: Trigger vnum #%d asked for but non-existant! (mob: %s - %d)",
|
||||||
vnum, GET_NAME((char_data *)proto), GET_MOB_VNUM((char_data *)proto));
|
vnum, GET_NAME((char_data *)proto), GET_MOB_VNUM((char_data *)proto));
|
||||||
break;
|
break;
|
||||||
case WLD_TRIGGER:
|
case WLD_TRIGGER:
|
||||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||||
"SYSERR: dg_read_trigger: Trigger vnum #%d asked for but non-existant! (room:%d)",
|
"SYSERR: dg_read_trigger: Trigger vnum #%d asked for but non-existant! (room:%d)",
|
||||||
vnum, GET_ROOM_VNUM( ((room_data *)proto)->number ));
|
vnum, GET_ROOM_VNUM( ((room_data *)proto)->number ));
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||||
"SYSERR: dg_read_trigger: Trigger vnum #%d asked for but non-existant! (?)", vnum);
|
"SYSERR: dg_read_trigger: Trigger vnum #%d asked for but non-existant! (?)", vnum);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -190,7 +190,7 @@ void dg_read_trigger(FILE *fp, void *proto, int type)
|
||||||
if (!trg_proto) {
|
if (!trg_proto) {
|
||||||
mob->proto_script = trg_proto = new_trg;
|
mob->proto_script = trg_proto = new_trg;
|
||||||
} else {
|
} else {
|
||||||
while (trg_proto->next)
|
while (trg_proto->next)
|
||||||
trg_proto = trg_proto->next;
|
trg_proto = trg_proto->next;
|
||||||
trg_proto->next = new_trg;
|
trg_proto->next = new_trg;
|
||||||
}
|
}
|
||||||
|
|
@ -214,13 +214,13 @@ void dg_read_trigger(FILE *fp, void *proto, int type)
|
||||||
CREATE(room->script, struct script_data, 1);
|
CREATE(room->script, struct script_data, 1);
|
||||||
add_trigger(SCRIPT(room), read_trigger(rnum), -1);
|
add_trigger(SCRIPT(room), read_trigger(rnum), -1);
|
||||||
} else {
|
} else {
|
||||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||||
"SYSERR: non-existant trigger #%d assigned to room #%d",
|
"SYSERR: non-existant trigger #%d assigned to room #%d",
|
||||||
vnum, room->number);
|
vnum, room->number);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||||
"SYSERR: Trigger vnum #%d assigned to non-mob/obj/room", vnum);
|
"SYSERR: Trigger vnum #%d assigned to non-mob/obj/room", vnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -234,14 +234,14 @@ void dg_obj_trigger(char *line, struct obj_data *obj)
|
||||||
count = sscanf(line,"%s %d",junk,&vnum);
|
count = sscanf(line,"%s %d",junk,&vnum);
|
||||||
|
|
||||||
if (count != 2) {
|
if (count != 2) {
|
||||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||||
"SYSERR: dg_obj_trigger() : Error assigning trigger! - Line was:\n %s", line);
|
"SYSERR: dg_obj_trigger() : Error assigning trigger! - Line was:\n %s", line);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
rnum = real_trigger(vnum);
|
rnum = real_trigger(vnum);
|
||||||
if (rnum==NOTHING) {
|
if (rnum==NOTHING) {
|
||||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||||
"SYSERR: Trigger vnum #%d asked for but non-existant! (Object: %s - %d)",
|
"SYSERR: Trigger vnum #%d asked for but non-existant! (Object: %s - %d)",
|
||||||
vnum, obj->short_description, GET_OBJ_VNUM(obj));
|
vnum, obj->short_description, GET_OBJ_VNUM(obj));
|
||||||
return;
|
return;
|
||||||
|
|
@ -276,7 +276,7 @@ void assign_triggers(void *i, int type)
|
||||||
while (trg_proto) {
|
while (trg_proto) {
|
||||||
rnum = real_trigger(trg_proto->vnum);
|
rnum = real_trigger(trg_proto->vnum);
|
||||||
if (rnum==NOTHING) {
|
if (rnum==NOTHING) {
|
||||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||||
"SYSERR: trigger #%d non-existant, for mob #%d",
|
"SYSERR: trigger #%d non-existant, for mob #%d",
|
||||||
trg_proto->vnum, mob_index[mob->nr].vnum);
|
trg_proto->vnum, mob_index[mob->nr].vnum);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -309,7 +309,7 @@ void assign_triggers(void *i, int type)
|
||||||
while (trg_proto) {
|
while (trg_proto) {
|
||||||
rnum = real_trigger(trg_proto->vnum);
|
rnum = real_trigger(trg_proto->vnum);
|
||||||
if (rnum==NOTHING) {
|
if (rnum==NOTHING) {
|
||||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||||
"SYSERR: trigger #%d non-existant, for room #%d",
|
"SYSERR: trigger #%d non-existant, for room #%d",
|
||||||
trg_proto->vnum, room->number);
|
trg_proto->vnum, room->number);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -321,7 +321,7 @@ void assign_triggers(void *i, int type)
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||||
"SYSERR: unknown type for assign_triggers()");
|
"SYSERR: unknown type for assign_triggers()");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -40,7 +40,7 @@ struct queue *event_q; /* the event queue */
|
||||||
extern long pulse;
|
extern long pulse;
|
||||||
|
|
||||||
/* initializes the event queue */
|
/* initializes the event queue */
|
||||||
void event_init(void)
|
void event_init(void)
|
||||||
{
|
{
|
||||||
event_q = queue_init();
|
event_q = queue_init();
|
||||||
}
|
}
|
||||||
|
|
@ -56,7 +56,7 @@ struct event *event_create(EVENTFUNC(*func), void *event_obj, long when)
|
||||||
|
|
||||||
if (when < 1) /* make sure its in the future */
|
if (when < 1) /* make sure its in the future */
|
||||||
when = 1;
|
when = 1;
|
||||||
|
|
||||||
CREATE(new_event, struct event, 1);
|
CREATE(new_event, struct event, 1);
|
||||||
new_event->func = func;
|
new_event->func = func;
|
||||||
new_event->event_obj = event_obj;
|
new_event->event_obj = event_obj;
|
||||||
|
|
@ -103,7 +103,7 @@ void event_process(void)
|
||||||
** event function.
|
** event function.
|
||||||
*/
|
*/
|
||||||
the_event->q_el = NULL;
|
the_event->q_el = NULL;
|
||||||
|
|
||||||
/* call event func, reenqueue event if retval > 0 */
|
/* call event func, reenqueue event if retval > 0 */
|
||||||
if ((new_time = (the_event->func)(the_event->event_obj)) > 0)
|
if ((new_time = (the_event->func)(the_event->event_obj)) > 0)
|
||||||
the_event->q_el = queue_enq(event_q, the_event, new_time + pulse);
|
the_event->q_el = queue_enq(event_q, the_event, new_time + pulse);
|
||||||
|
|
@ -205,7 +205,7 @@ struct q_element *queue_enq(struct queue *q, void *data, long key)
|
||||||
qe->next->prev = qe;
|
qe->next->prev = qe;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return qe;
|
return qe;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -228,7 +228,7 @@ void queue_deq(struct queue *q, struct q_element *qe)
|
||||||
q->tail[i] = qe->prev;
|
q->tail[i] = qe->prev;
|
||||||
else
|
else
|
||||||
qe->next->prev = qe->prev;
|
qe->next->prev = qe->prev;
|
||||||
|
|
||||||
free(qe);
|
free(qe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -291,5 +291,5 @@ void queue_free(struct queue *q)
|
||||||
|
|
||||||
free(q);
|
free(q);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "sysdep.h"
|
#include "sysdep.h"
|
||||||
|
|
||||||
|
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include "dg_scripts.h"
|
#include "dg_scripts.h"
|
||||||
|
|
@ -69,13 +69,13 @@ int remove_var(struct trig_var_data **var_list, char *name)
|
||||||
free_var_el(i);
|
free_var_el(i);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return memory used by a trigger
|
* Return memory used by a trigger
|
||||||
* The command list is free'd when changed and when
|
* The command list is free'd when changed and when
|
||||||
* shutting down.
|
* shutting down.
|
||||||
|
|
@ -84,7 +84,7 @@ void free_trigger(struct trig_data *trig)
|
||||||
{
|
{
|
||||||
free(trig->name);
|
free(trig->name);
|
||||||
trig->name = NULL;
|
trig->name = NULL;
|
||||||
|
|
||||||
if (trig->arglist) {
|
if (trig->arglist) {
|
||||||
free(trig->arglist);
|
free(trig->arglist);
|
||||||
trig->arglist = NULL;
|
trig->arglist = NULL;
|
||||||
|
|
@ -95,7 +95,7 @@ void free_trigger(struct trig_data *trig)
|
||||||
}
|
}
|
||||||
if (GET_TRIG_WAIT(trig))
|
if (GET_TRIG_WAIT(trig))
|
||||||
event_cancel(GET_TRIG_WAIT(trig));
|
event_cancel(GET_TRIG_WAIT(trig));
|
||||||
|
|
||||||
free(trig);
|
free(trig);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -110,7 +110,7 @@ void extract_trigger(struct trig_data *trig)
|
||||||
GET_TRIG_WAIT(trig) = NULL;
|
GET_TRIG_WAIT(trig) = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
trig_index[trig->nr]->number--;
|
trig_index[trig->nr]->number--;
|
||||||
|
|
||||||
/* walk the trigger list and remove this one */
|
/* walk the trigger list and remove this one */
|
||||||
REMOVE_FROM_LIST(trig, trigger_list, next_in_world);
|
REMOVE_FROM_LIST(trig, trigger_list, next_in_world);
|
||||||
|
|
@ -153,10 +153,10 @@ void extract_script(void *thing, int type)
|
||||||
if (sc) {
|
if (sc) {
|
||||||
for ( ; i ; i = i->next)
|
for ( ; i ; i = i->next)
|
||||||
assert(sc != SCRIPT(i));
|
assert(sc != SCRIPT(i));
|
||||||
|
|
||||||
for ( ; j ; j = j->next)
|
for ( ; j ; j = j->next)
|
||||||
assert(sc != SCRIPT(j));
|
assert(sc != SCRIPT(j));
|
||||||
|
|
||||||
for (k = 0; k < top_of_world; k++)
|
for (k = 0; k < top_of_world; k++)
|
||||||
assert(sc != SCRIPT(&world[k]));
|
assert(sc != SCRIPT(&world[k]));
|
||||||
}
|
}
|
||||||
|
|
@ -167,10 +167,10 @@ void extract_script(void *thing, int type)
|
||||||
extract_trigger(trig);
|
extract_trigger(trig);
|
||||||
}
|
}
|
||||||
TRIGGERS(sc) = NULL;
|
TRIGGERS(sc) = NULL;
|
||||||
|
|
||||||
/* Thanks to James Long for tracking down this memory leak */
|
/* Thanks to James Long for tracking down this memory leak */
|
||||||
free_varlist(sc->global_vars);
|
free_varlist(sc->global_vars);
|
||||||
|
|
||||||
free(sc);
|
free(sc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -186,7 +186,7 @@ void extract_script_mem(struct script_memory *sc)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_proto_script(void *thing, int type)
|
void free_proto_script(void *thing, int type)
|
||||||
{
|
{
|
||||||
struct trig_proto_list *proto = NULL, *fproto;
|
struct trig_proto_list *proto = NULL, *fproto;
|
||||||
char_data *mob;
|
char_data *mob;
|
||||||
|
|
@ -218,10 +218,10 @@ void free_proto_script(void *thing, int type)
|
||||||
if (proto) {
|
if (proto) {
|
||||||
for ( ; i ; i = i->next)
|
for ( ; i ; i = i->next)
|
||||||
assert(proto != i->proto_script);
|
assert(proto != i->proto_script);
|
||||||
|
|
||||||
for ( ; j ; j = j->next)
|
for ( ; j ; j = j->next)
|
||||||
assert(proto != j->proto_script);
|
assert(proto != j->proto_script);
|
||||||
|
|
||||||
for (k = 0; k < top_of_world; k++)
|
for (k = 0; k < top_of_world; k++)
|
||||||
assert(proto != world[k].proto_script);
|
assert(proto != world[k].proto_script);
|
||||||
}
|
}
|
||||||
|
|
@ -249,7 +249,7 @@ void copy_proto_script(void *source, void *dest, int type)
|
||||||
tp_src = ((room_data *)source)->proto_script;
|
tp_src = ((room_data *)source)->proto_script;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tp_src) {
|
if (tp_src) {
|
||||||
CREATE(tp_dst, struct trig_proto_list, 1);
|
CREATE(tp_dst, struct trig_proto_list, 1);
|
||||||
switch (type) {
|
switch (type) {
|
||||||
|
|
@ -263,7 +263,7 @@ void copy_proto_script(void *source, void *dest, int type)
|
||||||
((room_data *)dest)->proto_script = tp_dst;
|
((room_data *)dest)->proto_script = tp_dst;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (tp_src) {
|
while (tp_src) {
|
||||||
tp_dst->vnum = tp_src->vnum;
|
tp_dst->vnum = tp_src->vnum;
|
||||||
tp_src = tp_src->next;
|
tp_src = tp_src->next;
|
||||||
|
|
@ -271,7 +271,7 @@ void copy_proto_script(void *source, void *dest, int type)
|
||||||
CREATE(tp_dst->next, struct trig_proto_list, 1);
|
CREATE(tp_dst->next, struct trig_proto_list, 1);
|
||||||
tp_dst = tp_dst->next;
|
tp_dst = tp_dst->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void delete_variables(const char *charname)
|
void delete_variables(const char *charname)
|
||||||
|
|
@ -288,10 +288,10 @@ void delete_variables(const char *charname)
|
||||||
void update_wait_events(struct room_data *to, struct room_data *from)
|
void update_wait_events(struct room_data *to, struct room_data *from)
|
||||||
{
|
{
|
||||||
struct trig_data *trig;
|
struct trig_data *trig;
|
||||||
|
|
||||||
if (!SCRIPT(from))
|
if (!SCRIPT(from))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (trig = TRIGGERS(SCRIPT(from)); trig; trig = trig->next) {
|
for (trig = TRIGGERS(SCRIPT(from)); trig; trig = trig->next) {
|
||||||
if (!GET_TRIG_WAIT(trig))
|
if (!GET_TRIG_WAIT(trig))
|
||||||
continue;
|
continue;
|
||||||
|
|
|
||||||
|
|
@ -10,7 +10,7 @@
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "sysdep.h"
|
#include "sysdep.h"
|
||||||
|
|
||||||
|
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include "dg_scripts.h"
|
#include "dg_scripts.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
@ -70,7 +70,7 @@ void do_dg_cast(void *go, struct script_data *sc, trig_data *trig,
|
||||||
script_log("dg_do_cast: unknown trigger type!");
|
script_log("dg_do_cast: unknown trigger type!");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
strcpy(orig_cmd, cmd);
|
strcpy(orig_cmd, cmd);
|
||||||
/* get: blank, spell name, target name */
|
/* get: blank, spell name, target name */
|
||||||
s = strtok(cmd, "'");
|
s = strtok(cmd, "'");
|
||||||
|
|
@ -107,7 +107,7 @@ void do_dg_cast(void *go, struct script_data *sc, trig_data *trig,
|
||||||
(IS_SET(SINFO.targets, TAR_CHAR_ROOM) ||
|
(IS_SET(SINFO.targets, TAR_CHAR_ROOM) ||
|
||||||
IS_SET(SINFO.targets, TAR_CHAR_WORLD))) {
|
IS_SET(SINFO.targets, TAR_CHAR_WORLD))) {
|
||||||
if ((tch = get_char(t)) != NULL)
|
if ((tch = get_char(t)) != NULL)
|
||||||
target = TRUE;
|
target = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!target &&
|
if (!target &&
|
||||||
|
|
@ -116,7 +116,7 @@ void do_dg_cast(void *go, struct script_data *sc, trig_data *trig,
|
||||||
IS_SET(SINFO.targets, TAR_OBJ_ROOM) ||
|
IS_SET(SINFO.targets, TAR_OBJ_ROOM) ||
|
||||||
IS_SET(SINFO.targets, TAR_OBJ_WORLD))) {
|
IS_SET(SINFO.targets, TAR_OBJ_WORLD))) {
|
||||||
if ((tobj = get_obj(t)) != NULL)
|
if ((tobj = get_obj(t)) != NULL)
|
||||||
target = TRUE;
|
target = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!target) {
|
if (!target) {
|
||||||
|
|
@ -140,7 +140,7 @@ void do_dg_cast(void *go, struct script_data *sc, trig_data *trig,
|
||||||
}
|
}
|
||||||
/* set the caster's name to that of the object, or the gods.... */
|
/* set the caster's name to that of the object, or the gods.... */
|
||||||
if (type==OBJ_TRIGGER)
|
if (type==OBJ_TRIGGER)
|
||||||
caster->player.short_descr =
|
caster->player.short_descr =
|
||||||
strdup(((struct obj_data *)go)->short_description);
|
strdup(((struct obj_data *)go)->short_description);
|
||||||
else if (type==WLD_TRIGGER)
|
else if (type==WLD_TRIGGER)
|
||||||
caster->player.short_descr = strdup("The gods");
|
caster->player.short_descr = strdup("The gods");
|
||||||
|
|
@ -172,7 +172,7 @@ void do_dg_affect(void *go, struct script_data *sc, trig_data *trig,
|
||||||
int i=0, type=0;
|
int i=0, type=0;
|
||||||
struct affected_type af;
|
struct affected_type af;
|
||||||
|
|
||||||
|
|
||||||
half_chop(cmd, junk, cmd);
|
half_chop(cmd, junk, cmd);
|
||||||
half_chop(cmd, charname, cmd);
|
half_chop(cmd, charname, cmd);
|
||||||
half_chop(cmd, property, cmd);
|
half_chop(cmd, property, cmd);
|
||||||
|
|
@ -236,7 +236,7 @@ void do_dg_affect(void *go, struct script_data *sc, trig_data *trig,
|
||||||
affect_from_char(ch, SPELL_DG_AFFECT);
|
affect_from_char(ch, SPELL_DG_AFFECT);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* add the affect */
|
/* add the affect */
|
||||||
af.type = SPELL_DG_AFFECT;
|
af.type = SPELL_DG_AFFECT;
|
||||||
af.duration = duration;
|
af.duration = duration;
|
||||||
|
|
@ -249,7 +249,7 @@ void do_dg_affect(void *go, struct script_data *sc, trig_data *trig,
|
||||||
af.location = 0;
|
af.location = 0;
|
||||||
af.bitvector = (1<<i);
|
af.bitvector = (1<<i);
|
||||||
}
|
}
|
||||||
|
|
||||||
affect_to_char(ch, &af);
|
affect_to_char(ch, &af);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -283,22 +283,22 @@ void send_char_pos(struct char_data *ch, int dam)
|
||||||
|
|
||||||
|
|
||||||
/* Used throughout the xxxcmds.c files for checking if a char
|
/* Used throughout the xxxcmds.c files for checking if a char
|
||||||
* can be targetted
|
* can be targetted
|
||||||
* - allow_gods is false when called by %force%, for instance,
|
* - allow_gods is false when called by %force%, for instance,
|
||||||
* while true for %teleport%. -- Welcor
|
* while true for %teleport%. -- Welcor
|
||||||
*/
|
*/
|
||||||
int valid_dg_target(struct char_data *ch, int bitvector)
|
int valid_dg_target(struct char_data *ch, int bitvector)
|
||||||
{
|
{
|
||||||
if (IS_NPC(ch))
|
if (IS_NPC(ch))
|
||||||
return TRUE; /* all npcs are allowed as targets */
|
return TRUE; /* all npcs are allowed as targets */
|
||||||
else if (GET_LEVEL(ch) < LVL_IMMORT)
|
else if (GET_LEVEL(ch) < LVL_IMMORT)
|
||||||
return TRUE; /* as well as all mortals */
|
return TRUE; /* as well as all mortals */
|
||||||
else if (!IS_SET(bitvector, DG_ALLOW_GODS) &&
|
else if (!IS_SET(bitvector, DG_ALLOW_GODS) &&
|
||||||
GET_LEVEL(ch) >= LVL_GRGOD) /* LVL_GOD has the advance command. Can't allow them to be forced. */
|
GET_LEVEL(ch) >= LVL_GRGOD) /* LVL_GOD has the advance command. Can't allow them to be forced. */
|
||||||
return FALSE; /* but not always the highest gods */
|
return FALSE; /* but not always the highest gods */
|
||||||
else if (!PRF_FLAGGED(ch, PRF_NOHASSLE))
|
else if (!PRF_FLAGGED(ch, PRF_NOHASSLE))
|
||||||
return TRUE; /* the ones in between as allowed as long as they have no-hassle off. */
|
return TRUE; /* the ones in between as allowed as long as they have no-hassle off. */
|
||||||
else
|
else
|
||||||
return FALSE; /* The rest are gods with nohassle on... */
|
return FALSE; /* The rest are gods with nohassle on... */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -313,15 +313,15 @@ void script_damage(struct char_data *vict, int dam)
|
||||||
|
|
||||||
GET_HIT(vict) -= dam;
|
GET_HIT(vict) -= dam;
|
||||||
GET_HIT(vict) = MIN(GET_HIT(vict), GET_MAX_HIT(vict));
|
GET_HIT(vict) = MIN(GET_HIT(vict), GET_MAX_HIT(vict));
|
||||||
|
|
||||||
update_pos(vict);
|
update_pos(vict);
|
||||||
send_char_pos(vict, dam);
|
send_char_pos(vict, dam);
|
||||||
|
|
||||||
if (GET_POS(vict) == POS_DEAD) {
|
if (GET_POS(vict) == POS_DEAD) {
|
||||||
if (!IS_NPC(vict))
|
if (!IS_NPC(vict))
|
||||||
mudlog( BRF, 0, TRUE, "%s killed by script at %s",
|
mudlog( BRF, 0, TRUE, "%s killed by script at %s",
|
||||||
GET_NAME(vict), world[vict->in_room].name);
|
GET_NAME(vict), world[vict->in_room].name);
|
||||||
die(vict, NULL);
|
die(vict, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
202
src/dg_mobcmd.c
202
src/dg_mobcmd.c
|
|
@ -89,8 +89,8 @@ void mob_log(char_data *mob, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char output[MAX_STRING_LENGTH];
|
char output[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
snprintf(output, sizeof(output), "Mob (%s, VNum %d):: %s",
|
snprintf(output, sizeof(output), "Mob (%s, VNum %d):: %s",
|
||||||
GET_SHORT(mob), GET_MOB_VNUM(mob), format);
|
GET_SHORT(mob), GET_MOB_VNUM(mob), format);
|
||||||
|
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
|
|
@ -111,7 +111,7 @@ ACMD(do_masound)
|
||||||
{
|
{
|
||||||
room_rnum was_in_room;
|
room_rnum was_in_room;
|
||||||
int door;
|
int door;
|
||||||
|
|
||||||
if (!MOB_OR_IMPL(ch))
|
if (!MOB_OR_IMPL(ch))
|
||||||
{
|
{
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
|
|
@ -120,7 +120,7 @@ ACMD(do_masound)
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!*argument)
|
if (!*argument)
|
||||||
{
|
{
|
||||||
mob_log(ch, "masound called with no argument");
|
mob_log(ch, "masound called with no argument");
|
||||||
|
|
@ -128,12 +128,12 @@ ACMD(do_masound)
|
||||||
}
|
}
|
||||||
|
|
||||||
skip_spaces(&argument);
|
skip_spaces(&argument);
|
||||||
|
|
||||||
was_in_room = IN_ROOM(ch);
|
was_in_room = IN_ROOM(ch);
|
||||||
for (door = 0; door < NUM_OF_DIRS; door++)
|
for (door = 0; door < NUM_OF_DIRS; door++)
|
||||||
{
|
{
|
||||||
struct room_direction_data *newexit;
|
struct room_direction_data *newexit;
|
||||||
|
|
||||||
if (((newexit = world[was_in_room].dir_option[door]) != NULL) &&
|
if (((newexit = world[was_in_room].dir_option[door]) != NULL) &&
|
||||||
newexit->to_room != NOWHERE && newexit->to_room != was_in_room)
|
newexit->to_room != NOWHERE && newexit->to_room != was_in_room)
|
||||||
{
|
{
|
||||||
|
|
@ -141,7 +141,7 @@ ACMD(do_masound)
|
||||||
sub_write(argument, ch, TRUE, TO_ROOM);
|
sub_write(argument, ch, TRUE, TO_ROOM);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
IN_ROOM(ch) = was_in_room;
|
IN_ROOM(ch) = was_in_room;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -151,7 +151,7 @@ ACMD(do_mkill)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
char_data *victim;
|
char_data *victim;
|
||||||
|
|
||||||
if (!MOB_OR_IMPL(ch)) {
|
if (!MOB_OR_IMPL(ch)) {
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -159,9 +159,9 @@ ACMD(do_mkill)
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
|
|
||||||
if (!*arg) {
|
if (!*arg) {
|
||||||
mob_log(ch, "mkill called with no argument");
|
mob_log(ch, "mkill called with no argument");
|
||||||
return;
|
return;
|
||||||
|
|
@ -191,7 +191,7 @@ ACMD(do_mkill)
|
||||||
mob_log(ch, "mkill: already fighting");
|
mob_log(ch, "mkill: already fighting");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
hit(ch, victim, TYPE_UNDEFINED);
|
hit(ch, victim, TYPE_UNDEFINED);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -199,7 +199,7 @@ ACMD(do_mkill)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* lets the mobile destroy an object in its inventory
|
* lets the mobile destroy an object in its inventory
|
||||||
* it can also destroy a worn object and it can destroy
|
* it can also destroy a worn object and it can destroy
|
||||||
* items using all.xxxxx or just plain all of them
|
* items using all.xxxxx or just plain all of them
|
||||||
*/
|
*/
|
||||||
ACMD(do_mjunk)
|
ACMD(do_mjunk)
|
||||||
|
|
@ -208,17 +208,17 @@ ACMD(do_mjunk)
|
||||||
int pos, junk_all = 0;
|
int pos, junk_all = 0;
|
||||||
obj_data *obj;
|
obj_data *obj;
|
||||||
obj_data *obj_next;
|
obj_data *obj_next;
|
||||||
|
|
||||||
if (!MOB_OR_IMPL(ch)) {
|
if (!MOB_OR_IMPL(ch)) {
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
|
|
||||||
if (!*arg) {
|
if (!*arg) {
|
||||||
mob_log(ch, "mjunk called with no argument");
|
mob_log(ch, "mjunk called with no argument");
|
||||||
return;
|
return;
|
||||||
|
|
@ -226,7 +226,7 @@ ACMD(do_mjunk)
|
||||||
|
|
||||||
if (!str_cmp(arg, "all")) junk_all = 1;
|
if (!str_cmp(arg, "all")) junk_all = 1;
|
||||||
|
|
||||||
if ((find_all_dots(arg) != FIND_INDIV) && !junk_all) {
|
if ((find_all_dots(arg) != FIND_INDIV) && !junk_all) {
|
||||||
/* Thanks to Carlos Myers for fixing the line below */
|
/* Thanks to Carlos Myers for fixing the line below */
|
||||||
if ((pos = get_obj_pos_in_equip_vis(ch, arg, NULL, ch->equipment)) >= 0) {
|
if ((pos = get_obj_pos_in_equip_vis(ch, arg, NULL, ch->equipment)) >= 0) {
|
||||||
extract_obj(unequip_char(ch, pos));
|
extract_obj(unequip_char(ch, pos));
|
||||||
|
|
@ -261,18 +261,18 @@ ACMD(do_mechoaround)
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p = one_argument(argument, arg);
|
p = one_argument(argument, arg);
|
||||||
skip_spaces(&p);
|
skip_spaces(&p);
|
||||||
|
|
||||||
if (!*arg) {
|
if (!*arg) {
|
||||||
mob_log(ch, "mechoaround called with no argument");
|
mob_log(ch, "mechoaround called with no argument");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*arg == UID_CHAR) {
|
if (*arg == UID_CHAR) {
|
||||||
if (!(victim = get_char(arg))) {
|
if (!(victim = get_char(arg))) {
|
||||||
mob_log(ch, "mechoaround: victim (%s) does not exist",arg);
|
mob_log(ch, "mechoaround: victim (%s) does not exist",arg);
|
||||||
|
|
@ -301,10 +301,10 @@ ACMD(do_msend)
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
p = one_argument(argument, arg);
|
p = one_argument(argument, arg);
|
||||||
skip_spaces(&p);
|
skip_spaces(&p);
|
||||||
|
|
||||||
if (!*arg) {
|
if (!*arg) {
|
||||||
mob_log(ch, "msend called with no argument");
|
mob_log(ch, "msend called with no argument");
|
||||||
return;
|
return;
|
||||||
|
|
@ -319,7 +319,7 @@ ACMD(do_msend)
|
||||||
mob_log(ch, "msend: victim (%s) does not exist",arg);
|
mob_log(ch, "msend: victim (%s) does not exist",arg);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sub_write(p, victim, TRUE, TO_CHAR);
|
sub_write(p, victim, TRUE, TO_CHAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -328,22 +328,22 @@ ACMD(do_msend)
|
||||||
ACMD(do_mecho)
|
ACMD(do_mecho)
|
||||||
{
|
{
|
||||||
char *p;
|
char *p;
|
||||||
|
|
||||||
if (!MOB_OR_IMPL(ch)) {
|
if (!MOB_OR_IMPL(ch)) {
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!*argument) {
|
if (!*argument) {
|
||||||
mob_log(ch, "mecho called with no arguments");
|
mob_log(ch, "mecho called with no arguments");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
p = argument;
|
p = argument;
|
||||||
skip_spaces(&p);
|
skip_spaces(&p);
|
||||||
|
|
||||||
sub_write(p, ch, TRUE, TO_ROOM);
|
sub_write(p, ch, TRUE, TO_ROOM);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -351,7 +351,7 @@ ACMD(do_mzoneecho)
|
||||||
{
|
{
|
||||||
int zone;
|
int zone;
|
||||||
char room_number[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH], *msg;
|
char room_number[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH], *msg;
|
||||||
|
|
||||||
msg = any_one_arg(argument, room_number);
|
msg = any_one_arg(argument, room_number);
|
||||||
skip_spaces(&msg);
|
skip_spaces(&msg);
|
||||||
|
|
||||||
|
|
@ -361,7 +361,7 @@ ACMD(do_mzoneecho)
|
||||||
else if ((zone = real_zone_by_thing(atoi(room_number))) == NOWHERE)
|
else if ((zone = real_zone_by_thing(atoi(room_number))) == NOWHERE)
|
||||||
mob_log(ch, "mzoneecho called for nonexistant zone");
|
mob_log(ch, "mzoneecho called for nonexistant zone");
|
||||||
|
|
||||||
else {
|
else {
|
||||||
sprintf(buf, "%s\r\n", msg);
|
sprintf(buf, "%s\r\n", msg);
|
||||||
send_to_zone(buf, zone);
|
send_to_zone(buf, zone);
|
||||||
}
|
}
|
||||||
|
|
@ -369,7 +369,7 @@ ACMD(do_mzoneecho)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* lets the mobile load an item or mobile. All items
|
* lets the mobile load an item or mobile. All items
|
||||||
* are loaded into inventory, unless it is NO-TAKE.
|
* are loaded into inventory, unless it is NO-TAKE.
|
||||||
*/
|
*/
|
||||||
ACMD(do_mload)
|
ACMD(do_mload)
|
||||||
{
|
{
|
||||||
|
|
@ -381,7 +381,7 @@ ACMD(do_mload)
|
||||||
char_data *tch;
|
char_data *tch;
|
||||||
obj_data *cnt;
|
obj_data *cnt;
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
if (!MOB_OR_IMPL(ch)) {
|
if (!MOB_OR_IMPL(ch)) {
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -392,9 +392,9 @@ ACMD(do_mload)
|
||||||
|
|
||||||
if( ch->desc && GET_LEVEL(ch->desc->original) < LVL_IMPL)
|
if( ch->desc && GET_LEVEL(ch->desc->original) < LVL_IMPL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
target = two_arguments(argument, arg1, arg2);
|
target = two_arguments(argument, arg1, arg2);
|
||||||
|
|
||||||
if (!*arg1 || !*arg2 || !is_number(arg2) || ((number = atoi(arg2)) < 0)) {
|
if (!*arg1 || !*arg2 || !is_number(arg2) || ((number = atoi(arg2)) < 0)) {
|
||||||
mob_log(ch, "mload: bad syntax");
|
mob_log(ch, "mload: bad syntax");
|
||||||
return;
|
return;
|
||||||
|
|
@ -415,7 +415,7 @@ ACMD(do_mload)
|
||||||
if ((mob = read_mobile(number, VIRTUAL)) == NULL) {
|
if ((mob = read_mobile(number, VIRTUAL)) == NULL) {
|
||||||
mob_log(ch, "mload: bad mob vnum");
|
mob_log(ch, "mload: bad mob vnum");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char_to_room(mob, rnum);
|
char_to_room(mob, rnum);
|
||||||
if (SCRIPT(ch)) { // it _should_ have, but it might be detached.
|
if (SCRIPT(ch)) { // it _should_ have, but it might be detached.
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
|
|
@ -467,7 +467,7 @@ ACMD(do_mload)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* neither char nor container found - just dump it in room */
|
/* neither char nor container found - just dump it in room */
|
||||||
obj_to_room(object, IN_ROOM(ch));
|
obj_to_room(object, IN_ROOM(ch));
|
||||||
load_otrigger(object);
|
load_otrigger(object);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -487,25 +487,25 @@ ACMD(do_mpurge)
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
char_data *victim;
|
char_data *victim;
|
||||||
obj_data *obj;
|
obj_data *obj;
|
||||||
|
|
||||||
if (!MOB_OR_IMPL(ch)) {
|
if (!MOB_OR_IMPL(ch)) {
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL))
|
if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
|
|
||||||
if (!*arg) {
|
if (!*arg) {
|
||||||
/* 'purge' */
|
/* 'purge' */
|
||||||
char_data *vnext;
|
char_data *vnext;
|
||||||
obj_data *obj_next;
|
obj_data *obj_next;
|
||||||
|
|
||||||
for (victim = world[IN_ROOM(ch)].people; victim; victim = vnext) {
|
for (victim = world[IN_ROOM(ch)].people; victim; victim = vnext) {
|
||||||
vnext = victim->next_in_room;
|
vnext = victim->next_in_room;
|
||||||
if (IS_NPC(victim) && victim != ch)
|
if (IS_NPC(victim) && victim != ch)
|
||||||
|
|
@ -527,25 +527,25 @@ ACMD(do_mpurge)
|
||||||
if (victim == NULL) {
|
if (victim == NULL) {
|
||||||
if (*arg == UID_CHAR)
|
if (*arg == UID_CHAR)
|
||||||
obj = get_obj(arg);
|
obj = get_obj(arg);
|
||||||
else
|
else
|
||||||
obj = get_obj_vis(ch, arg, NULL);
|
obj = get_obj_vis(ch, arg, NULL);
|
||||||
|
|
||||||
if (obj) {
|
if (obj) {
|
||||||
extract_obj(obj);
|
extract_obj(obj);
|
||||||
obj = NULL;
|
obj = NULL;
|
||||||
} else
|
} else
|
||||||
mob_log(ch, "mpurge: bad argument");
|
mob_log(ch, "mpurge: bad argument");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IS_NPC(victim)) {
|
if (!IS_NPC(victim)) {
|
||||||
mob_log(ch, "mpurge: purging a PC");
|
mob_log(ch, "mpurge: purging a PC");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (victim==ch) dg_owner_purged = 1;
|
if (victim==ch) dg_owner_purged = 1;
|
||||||
|
|
||||||
extract_char(victim);
|
extract_char(victim);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -555,7 +555,7 @@ ACMD(do_mgoto)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
room_rnum location;
|
room_rnum location;
|
||||||
|
|
||||||
if (!MOB_OR_IMPL(ch)) {
|
if (!MOB_OR_IMPL(ch)) {
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -563,22 +563,22 @@ ACMD(do_mgoto)
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
|
|
||||||
if (!*arg) {
|
if (!*arg) {
|
||||||
mob_log(ch, "mgoto called with no argument");
|
mob_log(ch, "mgoto called with no argument");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((location = find_target_room(ch, arg)) == NOWHERE) {
|
if ((location = find_target_room(ch, arg)) == NOWHERE) {
|
||||||
mob_log(ch, "mgoto: invalid location");
|
mob_log(ch, "mgoto: invalid location");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (FIGHTING(ch))
|
if (FIGHTING(ch))
|
||||||
stop_fighting(ch);
|
stop_fighting(ch);
|
||||||
|
|
||||||
char_from_room(ch);
|
char_from_room(ch);
|
||||||
char_to_room(ch, location);
|
char_to_room(ch, location);
|
||||||
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
|
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
|
||||||
|
|
@ -590,32 +590,32 @@ ACMD(do_mat)
|
||||||
{
|
{
|
||||||
char arg[MAX_INPUT_LENGTH];
|
char arg[MAX_INPUT_LENGTH];
|
||||||
room_rnum location, original;
|
room_rnum location, original;
|
||||||
|
|
||||||
if (!MOB_OR_IMPL(ch)) {
|
if (!MOB_OR_IMPL(ch)) {
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
argument = one_argument( argument, arg );
|
argument = one_argument( argument, arg );
|
||||||
|
|
||||||
if (!*arg || !*argument) {
|
if (!*arg || !*argument) {
|
||||||
mob_log(ch, "mat: bad argument");
|
mob_log(ch, "mat: bad argument");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((location = find_target_room(ch, arg)) == NOWHERE) {
|
if ((location = find_target_room(ch, arg)) == NOWHERE) {
|
||||||
mob_log(ch, "mat: invalid location");
|
mob_log(ch, "mat: invalid location");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
original = IN_ROOM(ch);
|
original = IN_ROOM(ch);
|
||||||
char_from_room(ch);
|
char_from_room(ch);
|
||||||
char_to_room(ch, location);
|
char_to_room(ch, location);
|
||||||
command_interpreter(ch, argument);
|
command_interpreter(ch, argument);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* See if 'ch' still exists before continuing!
|
* See if 'ch' still exists before continuing!
|
||||||
* Handles 'at XXXX quit' case.
|
* Handles 'at XXXX quit' case.
|
||||||
|
|
@ -641,12 +641,12 @@ ACMD(do_mteleport)
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
argument = two_arguments(argument, arg1, arg2);
|
argument = two_arguments(argument, arg1, arg2);
|
||||||
|
|
||||||
if (!*arg1 || !*arg2) {
|
if (!*arg1 || !*arg2) {
|
||||||
mob_log(ch, "mteleport: bad syntax");
|
mob_log(ch, "mteleport: bad syntax");
|
||||||
return;
|
return;
|
||||||
|
|
@ -658,7 +658,7 @@ ACMD(do_mteleport)
|
||||||
mob_log(ch, "mteleport target is an invalid room");
|
mob_log(ch, "mteleport target is an invalid room");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!str_cmp(arg1, "all")) {
|
if (!str_cmp(arg1, "all")) {
|
||||||
if (target == IN_ROOM(ch)) {
|
if (target == IN_ROOM(ch)) {
|
||||||
mob_log(ch, "mteleport all target is itself");
|
mob_log(ch, "mteleport all target is itself");
|
||||||
|
|
@ -703,7 +703,7 @@ ACMD(do_mdamage) {
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -740,24 +740,24 @@ ACMD(do_mforce)
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL))
|
if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
argument = one_argument(argument, arg);
|
argument = one_argument(argument, arg);
|
||||||
|
|
||||||
if (!*arg || !*argument) {
|
if (!*arg || !*argument) {
|
||||||
mob_log(ch, "mforce: bad syntax");
|
mob_log(ch, "mforce: bad syntax");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!str_cmp(arg, "all")) {
|
if (!str_cmp(arg, "all")) {
|
||||||
struct descriptor_data *i;
|
struct descriptor_data *i;
|
||||||
char_data *vch;
|
char_data *vch;
|
||||||
|
|
||||||
for (i = descriptor_list; i ; i = i->next) {
|
for (i = descriptor_list; i ; i = i->next) {
|
||||||
if ((i->character != ch) && !i->connected &&
|
if ((i->character != ch) && !i->connected &&
|
||||||
(IN_ROOM(i->character) == IN_ROOM(ch))) {
|
(IN_ROOM(i->character) == IN_ROOM(ch))) {
|
||||||
|
|
@ -770,7 +770,7 @@ ACMD(do_mforce)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
char_data *victim;
|
char_data *victim;
|
||||||
|
|
||||||
if (*arg == UID_CHAR) {
|
if (*arg == UID_CHAR) {
|
||||||
if (!(victim = get_char(arg))) {
|
if (!(victim = get_char(arg))) {
|
||||||
mob_log(ch, "mforce: victim (%s) does not exist",arg);
|
mob_log(ch, "mforce: victim (%s) does not exist",arg);
|
||||||
|
|
@ -780,12 +780,12 @@ ACMD(do_mforce)
|
||||||
mob_log(ch, "mforce: no such victim");
|
mob_log(ch, "mforce: no such victim");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (victim == ch) {
|
if (victim == ch) {
|
||||||
mob_log(ch, "mforce: forcing self");
|
mob_log(ch, "mforce: forcing self");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (valid_dg_target(victim, 0))
|
if (valid_dg_target(victim, 0))
|
||||||
command_interpreter(victim, argument);
|
command_interpreter(victim, argument);
|
||||||
}
|
}
|
||||||
|
|
@ -801,20 +801,20 @@ ACMD(do_mhunt)
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL))
|
if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
|
|
||||||
if (!*arg) {
|
if (!*arg) {
|
||||||
mob_log(ch, "mhunt called with no argument");
|
mob_log(ch, "mhunt called with no argument");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (FIGHTING(ch)) return;
|
if (FIGHTING(ch)) return;
|
||||||
|
|
||||||
|
|
@ -828,7 +828,7 @@ ACMD(do_mhunt)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HUNTING(ch) = victim;
|
HUNTING(ch) = victim;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -844,15 +844,15 @@ ACMD(do_mremember)
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL))
|
if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
argument = one_argument(argument, arg);
|
argument = one_argument(argument, arg);
|
||||||
|
|
||||||
if (!*arg) {
|
if (!*arg) {
|
||||||
mob_log(ch, "mremember: bad syntax");
|
mob_log(ch, "mremember: bad syntax");
|
||||||
return;
|
return;
|
||||||
|
|
@ -896,15 +896,15 @@ ACMD(do_mforget)
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL))
|
if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
|
|
||||||
if (!*arg) {
|
if (!*arg) {
|
||||||
mob_log(ch, "mforget: bad syntax");
|
mob_log(ch, "mforget: bad syntax");
|
||||||
return;
|
return;
|
||||||
|
|
@ -956,15 +956,15 @@ ACMD(do_mtransform)
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (ch->desc) {
|
if (ch->desc) {
|
||||||
send_to_char(ch, "You've got no VNUM to return to, dummy! try 'switch'\r\n");
|
send_to_char(ch, "You've got no VNUM to return to, dummy! try 'switch'\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
|
|
||||||
if (!*arg)
|
if (!*arg)
|
||||||
|
|
@ -1071,10 +1071,10 @@ ACMD(do_mdoor)
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
argument = two_arguments(argument, target, direction);
|
argument = two_arguments(argument, target, direction);
|
||||||
value = one_argument(argument, field);
|
value = one_argument(argument, field);
|
||||||
skip_spaces(&value);
|
skip_spaces(&value);
|
||||||
|
|
@ -1083,12 +1083,12 @@ ACMD(do_mdoor)
|
||||||
mob_log(ch, "mdoor called with too few args");
|
mob_log(ch, "mdoor called with too few args");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rm = get_room(target)) == NULL) {
|
if ((rm = get_room(target)) == NULL) {
|
||||||
mob_log(ch, "mdoor: invalid target");
|
mob_log(ch, "mdoor: invalid target");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dir = search_block(direction, dirs, FALSE)) == -1) {
|
if ((dir = search_block(direction, dirs, FALSE)) == -1) {
|
||||||
mob_log(ch, "mdoor: invalid direction");
|
mob_log(ch, "mdoor: invalid direction");
|
||||||
return;
|
return;
|
||||||
|
|
@ -1116,9 +1116,9 @@ ACMD(do_mdoor)
|
||||||
else {
|
else {
|
||||||
if (!newexit) {
|
if (!newexit) {
|
||||||
CREATE(newexit, struct room_direction_data, 1);
|
CREATE(newexit, struct room_direction_data, 1);
|
||||||
rm->dir_option[dir] = newexit;
|
rm->dir_option[dir] = newexit;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (fd) {
|
switch (fd) {
|
||||||
case 1: /* description */
|
case 1: /* description */
|
||||||
if (newexit->general_description)
|
if (newexit->general_description)
|
||||||
|
|
@ -1159,7 +1159,7 @@ ACMD(do_mfollow)
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -1169,7 +1169,7 @@ ACMD(do_mfollow)
|
||||||
mob_log(ch, "mfollow: bad syntax");
|
mob_log(ch, "mfollow: bad syntax");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*buf == UID_CHAR) {
|
if (*buf == UID_CHAR) {
|
||||||
if (!(leader = get_char(buf))) {
|
if (!(leader = get_char(buf))) {
|
||||||
mob_log(ch, "mfollow: victim (%s) does not exist", buf);
|
mob_log(ch, "mfollow: victim (%s) does not exist", buf);
|
||||||
|
|
@ -1185,7 +1185,7 @@ ACMD(do_mfollow)
|
||||||
|
|
||||||
if (AFF_FLAGGED(ch, AFF_CHARM) && (ch->master)) /* can't override charm */
|
if (AFF_FLAGGED(ch, AFF_CHARM) && (ch->master)) /* can't override charm */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
/* stop following someone else first */
|
/* stop following someone else first */
|
||||||
if (ch->master) {
|
if (ch->master) {
|
||||||
|
|
@ -1195,17 +1195,17 @@ ACMD(do_mfollow)
|
||||||
free(k);
|
free(k);
|
||||||
} else { /* locate follower who is not head of list */
|
} else { /* locate follower who is not head of list */
|
||||||
for (k = ch->master->followers; k->next->follower != ch; k = k->next);
|
for (k = ch->master->followers; k->next->follower != ch; k = k->next);
|
||||||
|
|
||||||
j = k->next;
|
j = k->next;
|
||||||
k->next = j->next;
|
k->next = j->next;
|
||||||
free(j);
|
free(j);
|
||||||
}
|
}
|
||||||
ch->master = NULL;
|
ch->master = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ch == leader)
|
if (ch == leader)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (circle_follow(ch, leader)) {
|
if (circle_follow(ch, leader)) {
|
||||||
mob_log(ch, "mfollow: Following in circles.");
|
mob_log(ch, "mfollow: Following in circles.");
|
||||||
return;
|
return;
|
||||||
|
|
@ -1236,6 +1236,6 @@ ACMD(do_mrecho)
|
||||||
|
|
||||||
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
|
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
|
||||||
mob_log(ch, "mrecho called with too few args");
|
mob_log(ch, "mrecho called with too few args");
|
||||||
else
|
else
|
||||||
send_to_range(atoi(start), atoi(finish), "%s\r\n", msg);
|
send_to_range(atoi(start), atoi(finish), "%s\r\n", msg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
120
src/dg_objcmd.c
120
src/dg_objcmd.c
|
|
@ -27,7 +27,7 @@ void die(struct char_data * ch, struct char_data *killer);
|
||||||
bitvector_t asciiflag_conv(char *flag);
|
bitvector_t asciiflag_conv(char *flag);
|
||||||
zone_rnum real_zone_by_thing(room_vnum vznum);
|
zone_rnum real_zone_by_thing(room_vnum vznum);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Local functions
|
* Local functions
|
||||||
*/
|
*/
|
||||||
#define OCMD(name) \
|
#define OCMD(name) \
|
||||||
|
|
@ -71,7 +71,7 @@ void obj_log(obj_data *obj, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char output[MAX_STRING_LENGTH];
|
char output[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
snprintf(output, sizeof(output), "Obj (%s, VNum %d):: %s", obj->short_description, GET_OBJ_VNUM(obj), format);
|
snprintf(output, sizeof(output), "Obj (%s, VNum %d):: %s", obj->short_description, GET_OBJ_VNUM(obj), format);
|
||||||
|
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
|
|
@ -122,14 +122,14 @@ room_rnum find_obj_target_room(obj_data *obj, char *rawroomstr)
|
||||||
{
|
{
|
||||||
if (IN_ROOM(target_obj) != NOWHERE)
|
if (IN_ROOM(target_obj) != NOWHERE)
|
||||||
location = IN_ROOM(target_obj);
|
location = IN_ROOM(target_obj);
|
||||||
else
|
else
|
||||||
return NOWHERE;
|
return NOWHERE;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return NOWHERE;
|
return NOWHERE;
|
||||||
|
|
||||||
/* a room has been found. Check for permission */
|
/* a room has been found. Check for permission */
|
||||||
if (ROOM_FLAGGED(location, ROOM_GODROOM) ||
|
if (ROOM_FLAGGED(location, ROOM_GODROOM) ||
|
||||||
#ifdef ROOM_IMPROOM
|
#ifdef ROOM_IMPROOM
|
||||||
ROOM_FLAGGED(location, ROOM_IMPROOM) ||
|
ROOM_FLAGGED(location, ROOM_IMPROOM) ||
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -152,8 +152,8 @@ OCMD(do_oecho)
|
||||||
int room;
|
int room;
|
||||||
|
|
||||||
skip_spaces(&argument);
|
skip_spaces(&argument);
|
||||||
|
|
||||||
if (!*argument)
|
if (!*argument)
|
||||||
obj_log(obj, "oecho called with no args");
|
obj_log(obj, "oecho called with no args");
|
||||||
|
|
||||||
else if ((room = obj_room(obj)) != NOWHERE)
|
else if ((room = obj_room(obj)) != NOWHERE)
|
||||||
|
|
@ -161,7 +161,7 @@ OCMD(do_oecho)
|
||||||
if (world[room].people)
|
if (world[room].people)
|
||||||
sub_write(argument, world[room].people, TRUE, TO_ROOM | TO_CHAR);
|
sub_write(argument, world[room].people, TRUE, TO_ROOM | TO_CHAR);
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
obj_log(obj, "oecho called by object in NOWHERE");
|
obj_log(obj, "oecho called by object in NOWHERE");
|
||||||
}
|
}
|
||||||
|
|
@ -174,16 +174,16 @@ OCMD(do_oforce)
|
||||||
char arg1[MAX_INPUT_LENGTH], *line;
|
char arg1[MAX_INPUT_LENGTH], *line;
|
||||||
|
|
||||||
line = one_argument(argument, arg1);
|
line = one_argument(argument, arg1);
|
||||||
|
|
||||||
if (!*arg1 || !*line)
|
if (!*arg1 || !*line)
|
||||||
{
|
{
|
||||||
obj_log(obj, "oforce called with too few args");
|
obj_log(obj, "oforce called with too few args");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!str_cmp(arg1, "all"))
|
if (!str_cmp(arg1, "all"))
|
||||||
{
|
{
|
||||||
if ((room = obj_room(obj)) == NOWHERE)
|
if ((room = obj_room(obj)) == NOWHERE)
|
||||||
obj_log(obj, "oforce called by object in NOWHERE");
|
obj_log(obj, "oforce called by object in NOWHERE");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -195,9 +195,9 @@ OCMD(do_oforce)
|
||||||
command_interpreter(ch, line);
|
command_interpreter(ch, line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((ch = get_char_by_obj(obj, arg1)))
|
if ((ch = get_char_by_obj(obj, arg1)))
|
||||||
|
|
@ -207,7 +207,7 @@ OCMD(do_oforce)
|
||||||
command_interpreter(ch, line);
|
command_interpreter(ch, line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
obj_log(obj, "oforce: no target found");
|
obj_log(obj, "oforce: no target found");
|
||||||
}
|
}
|
||||||
|
|
@ -217,7 +217,7 @@ OCMD(do_ozoneecho)
|
||||||
{
|
{
|
||||||
int zone;
|
int zone;
|
||||||
char room_number[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH], *msg;
|
char room_number[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH], *msg;
|
||||||
|
|
||||||
msg = any_one_arg(argument, room_number);
|
msg = any_one_arg(argument, room_number);
|
||||||
skip_spaces(&msg);
|
skip_spaces(&msg);
|
||||||
|
|
||||||
|
|
@ -227,7 +227,7 @@ OCMD(do_ozoneecho)
|
||||||
else if ((zone = real_zone_by_thing(atoi(room_number))) == NOWHERE)
|
else if ((zone = real_zone_by_thing(atoi(room_number))) == NOWHERE)
|
||||||
obj_log(obj, "ozoneecho called for nonexistant zone");
|
obj_log(obj, "ozoneecho called for nonexistant zone");
|
||||||
|
|
||||||
else {
|
else {
|
||||||
sprintf(buf, "%s\r\n", msg);
|
sprintf(buf, "%s\r\n", msg);
|
||||||
send_to_zone(buf, zone);
|
send_to_zone(buf, zone);
|
||||||
}
|
}
|
||||||
|
|
@ -237,7 +237,7 @@ OCMD(do_osend)
|
||||||
{
|
{
|
||||||
char buf[MAX_INPUT_LENGTH], *msg;
|
char buf[MAX_INPUT_LENGTH], *msg;
|
||||||
char_data *ch;
|
char_data *ch;
|
||||||
|
|
||||||
msg = any_one_arg(argument, buf);
|
msg = any_one_arg(argument, buf);
|
||||||
|
|
||||||
if (!*buf)
|
if (!*buf)
|
||||||
|
|
@ -278,9 +278,9 @@ OCMD(do_orecho)
|
||||||
|
|
||||||
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
|
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
|
||||||
obj_log(obj, "orecho: too few args");
|
obj_log(obj, "orecho: too few args");
|
||||||
else
|
else
|
||||||
send_to_range(atoi(start), atoi(finish), "%s\r\n", msg);
|
send_to_range(atoi(start), atoi(finish), "%s\r\n", msg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -293,7 +293,7 @@ OCMD(do_otimer)
|
||||||
|
|
||||||
if (!*arg)
|
if (!*arg)
|
||||||
obj_log(obj, "otimer: missing argument");
|
obj_log(obj, "otimer: missing argument");
|
||||||
else if (!isdigit(*arg))
|
else if (!isdigit(*arg))
|
||||||
obj_log(obj, "otimer: bad argument");
|
obj_log(obj, "otimer: bad argument");
|
||||||
else
|
else
|
||||||
GET_OBJ_TIMER(obj) = atoi(arg);
|
GET_OBJ_TIMER(obj) = atoi(arg);
|
||||||
|
|
@ -314,7 +314,7 @@ OCMD(do_otransform)
|
||||||
|
|
||||||
if (!*arg)
|
if (!*arg)
|
||||||
obj_log(obj, "otransform: missing argument");
|
obj_log(obj, "otransform: missing argument");
|
||||||
else if (!isdigit(*arg))
|
else if (!isdigit(*arg))
|
||||||
obj_log(obj, "otransform: bad argument");
|
obj_log(obj, "otransform: bad argument");
|
||||||
else {
|
else {
|
||||||
o = read_object(atoi(arg), VIRTUAL);
|
o = read_object(atoi(arg), VIRTUAL);
|
||||||
|
|
@ -362,7 +362,7 @@ OCMD(do_opurge)
|
||||||
int rm;
|
int rm;
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
|
|
||||||
if (!*arg) {
|
if (!*arg) {
|
||||||
/* purge all */
|
/* purge all */
|
||||||
if ((rm = obj_room(obj)) != NOWHERE) {
|
if ((rm = obj_room(obj)) != NOWHERE) {
|
||||||
|
|
@ -371,35 +371,35 @@ OCMD(do_opurge)
|
||||||
if (IS_NPC(ch))
|
if (IS_NPC(ch))
|
||||||
extract_char(ch);
|
extract_char(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (o = world[rm].contents; o; o = next_obj ) {
|
for (o = world[rm].contents; o; o = next_obj ) {
|
||||||
next_obj = o->next_content;
|
next_obj = o->next_content;
|
||||||
if (o != obj)
|
if (o != obj)
|
||||||
extract_obj(o);
|
extract_obj(o);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
} /* no arg */
|
} /* no arg */
|
||||||
|
|
||||||
ch = get_char_by_obj(obj, arg);
|
ch = get_char_by_obj(obj, arg);
|
||||||
if (!ch) {
|
if (!ch) {
|
||||||
o = get_obj_by_obj(obj, arg);
|
o = get_obj_by_obj(obj, arg);
|
||||||
if (o) {
|
if (o) {
|
||||||
if (o==obj)
|
if (o==obj)
|
||||||
dg_owner_purged = 1;
|
dg_owner_purged = 1;
|
||||||
extract_obj(o);
|
extract_obj(o);
|
||||||
} else
|
} else
|
||||||
obj_log(obj, "opurge: bad argument");
|
obj_log(obj, "opurge: bad argument");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IS_NPC(ch)) {
|
if (!IS_NPC(ch)) {
|
||||||
obj_log(obj, "opurge: purging a PC");
|
obj_log(obj, "opurge: purging a PC");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_char(ch);
|
extract_char(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -411,7 +411,7 @@ OCMD(do_oteleport)
|
||||||
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
two_arguments(argument, arg1, arg2);
|
two_arguments(argument, arg1, arg2);
|
||||||
|
|
||||||
if (!*arg1 || !*arg2)
|
if (!*arg1 || !*arg2)
|
||||||
{
|
{
|
||||||
obj_log(obj, "oteleport called with too few args");
|
obj_log(obj, "oteleport called with too few args");
|
||||||
|
|
@ -419,10 +419,10 @@ OCMD(do_oteleport)
|
||||||
}
|
}
|
||||||
|
|
||||||
target = find_obj_target_room(obj, arg2);
|
target = find_obj_target_room(obj, arg2);
|
||||||
|
|
||||||
if (target == NOWHERE)
|
if (target == NOWHERE)
|
||||||
obj_log(obj, "oteleport target is an invalid room");
|
obj_log(obj, "oteleport target is an invalid room");
|
||||||
|
|
||||||
else if (!str_cmp(arg1, "all"))
|
else if (!str_cmp(arg1, "all"))
|
||||||
{
|
{
|
||||||
rm = obj_room(obj);
|
rm = obj_room(obj);
|
||||||
|
|
@ -432,14 +432,14 @@ OCMD(do_oteleport)
|
||||||
for (ch = world[rm].people; ch; ch = next_ch)
|
for (ch = world[rm].people; ch; ch = next_ch)
|
||||||
{
|
{
|
||||||
next_ch = ch->next_in_room;
|
next_ch = ch->next_in_room;
|
||||||
if (!valid_dg_target(ch, DG_ALLOW_GODS))
|
if (!valid_dg_target(ch, DG_ALLOW_GODS))
|
||||||
continue;
|
continue;
|
||||||
char_from_room(ch);
|
char_from_room(ch);
|
||||||
char_to_room(ch, target);
|
char_to_room(ch, target);
|
||||||
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
|
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((ch = get_char_by_obj(obj, arg1))) {
|
if ((ch = get_char_by_obj(obj, arg1))) {
|
||||||
|
|
@ -449,7 +449,7 @@ OCMD(do_oteleport)
|
||||||
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
|
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
obj_log(obj, "oteleport: no target found");
|
obj_log(obj, "oteleport: no target found");
|
||||||
}
|
}
|
||||||
|
|
@ -474,13 +474,13 @@ OCMD(do_dgoload)
|
||||||
obj_log(obj, "oload: bad syntax");
|
obj_log(obj, "oload: bad syntax");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((room = obj_room(obj)) == NOWHERE)
|
if ((room = obj_room(obj)) == NOWHERE)
|
||||||
{
|
{
|
||||||
obj_log(obj, "oload: object in NOWHERE trying to load");
|
obj_log(obj, "oload: object in NOWHERE trying to load");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* load mob to target room - Jamie Nelson, April 13 2004 */
|
/* load mob to target room - Jamie Nelson, April 13 2004 */
|
||||||
if (is_abbrev(arg1, "mob")) {
|
if (is_abbrev(arg1, "mob")) {
|
||||||
room_rnum rnum;
|
room_rnum rnum;
|
||||||
|
|
@ -496,7 +496,7 @@ OCMD(do_dgoload)
|
||||||
if ((mob = read_mobile(number, VIRTUAL)) == NULL) {
|
if ((mob = read_mobile(number, VIRTUAL)) == NULL) {
|
||||||
obj_log(obj, "oload: bad mob vnum");
|
obj_log(obj, "oload: bad mob vnum");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char_to_room(mob, rnum);
|
char_to_room(mob, rnum);
|
||||||
|
|
||||||
if (SCRIPT(obj)) { // it _should_ have, but it might be detached.
|
if (SCRIPT(obj)) { // it _should_ have, but it might be detached.
|
||||||
|
|
@ -519,7 +519,7 @@ OCMD(do_dgoload)
|
||||||
sprintf(buf, "%c%ld", UID_CHAR, GET_ID(object));
|
sprintf(buf, "%c%ld", UID_CHAR, GET_ID(object));
|
||||||
add_var(&(SCRIPT(obj)->global_vars), "lastloaded", buf, 0);
|
add_var(&(SCRIPT(obj)->global_vars), "lastloaded", buf, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* special handling to make objects able to load on a person/in a container/worn etc. */
|
/* special handling to make objects able to load on a person/in a container/worn etc. */
|
||||||
if (!target || !*target) {
|
if (!target || !*target) {
|
||||||
obj_to_room(object, room);
|
obj_to_room(object, room);
|
||||||
|
|
@ -548,11 +548,11 @@ OCMD(do_dgoload)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* neither char nor container found - just dump it in room */
|
/* neither char nor container found - just dump it in room */
|
||||||
obj_to_room(object, room);
|
obj_to_room(object, room);
|
||||||
load_otrigger(object);
|
load_otrigger(object);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
obj_log(obj, "oload: bad type");
|
obj_log(obj, "oload: bad type");
|
||||||
|
|
||||||
|
|
@ -573,9 +573,9 @@ OCMD(do_odamage) {
|
||||||
|
|
||||||
dam = atoi(amount);
|
dam = atoi(amount);
|
||||||
ch = get_char_by_obj(obj, name);
|
ch = get_char_by_obj(obj, name);
|
||||||
|
|
||||||
if (!ch) {
|
if (!ch) {
|
||||||
obj_log(obj, "odamage: target not found");
|
obj_log(obj, "odamage: target not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
script_damage(ch, dam);
|
script_damage(ch, dam);
|
||||||
|
|
@ -593,7 +593,7 @@ OCMD(do_oasound)
|
||||||
obj_log(obj, "oasound called with no args");
|
obj_log(obj, "oasound called with no args");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((room = obj_room(obj)) == NOWHERE) {
|
if ((room = obj_room(obj)) == NOWHERE) {
|
||||||
obj_log(obj, "oecho called by object in NOWHERE");
|
obj_log(obj, "oecho called by object in NOWHERE");
|
||||||
return;
|
return;
|
||||||
|
|
@ -636,12 +636,12 @@ OCMD(do_odoor)
|
||||||
obj_log(obj, "odoor called with too few args");
|
obj_log(obj, "odoor called with too few args");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rm = get_room(target)) == NULL) {
|
if ((rm = get_room(target)) == NULL) {
|
||||||
obj_log(obj, "odoor: invalid target");
|
obj_log(obj, "odoor: invalid target");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dir = search_block(direction, dirs, FALSE)) == -1) {
|
if ((dir = search_block(direction, dirs, FALSE)) == -1) {
|
||||||
obj_log(obj, "odoor: invalid direction");
|
obj_log(obj, "odoor: invalid direction");
|
||||||
return;
|
return;
|
||||||
|
|
@ -669,9 +669,9 @@ OCMD(do_odoor)
|
||||||
else {
|
else {
|
||||||
if (!newexit) {
|
if (!newexit) {
|
||||||
CREATE(newexit, struct room_direction_data, 1);
|
CREATE(newexit, struct room_direction_data, 1);
|
||||||
rm->dir_option[dir] = newexit;
|
rm->dir_option[dir] = newexit;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (fd) {
|
switch (fd) {
|
||||||
case 1: /* description */
|
case 1: /* description */
|
||||||
if (newexit->general_description)
|
if (newexit->general_description)
|
||||||
|
|
@ -724,7 +724,7 @@ OCMD(do_osetval)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* submitted by PurpleOnyx - tkhasi@shadowglen.com*/
|
/* submitted by PurpleOnyx - tkhasi@shadowglen.com*/
|
||||||
OCMD(do_oat)
|
OCMD(do_oat)
|
||||||
{
|
{
|
||||||
char location[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
char location[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
||||||
int vnum = 0, rnum = 0;
|
int vnum = 0, rnum = 0;
|
||||||
|
|
@ -733,13 +733,13 @@ OCMD(do_oat)
|
||||||
half_chop(argument, location, arg2);
|
half_chop(argument, location, arg2);
|
||||||
|
|
||||||
if (!*location || !*arg2 || !isdigit(*location)) {
|
if (!*location || !*arg2 || !isdigit(*location)) {
|
||||||
obj_log(obj, "oat: bad syntax : %s", argument);
|
obj_log(obj, "oat: bad syntax : %s", argument);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
vnum = atoi(location);
|
vnum = atoi(location);
|
||||||
rnum = real_room(vnum);
|
rnum = real_room(vnum);
|
||||||
|
|
||||||
if (rnum == NOWHERE) {
|
if (rnum == NOWHERE) {
|
||||||
obj_log(obj, "oat: location not found");
|
obj_log(obj, "oat: location not found");
|
||||||
return;
|
return;
|
||||||
|
|
@ -748,10 +748,10 @@ OCMD(do_oat)
|
||||||
object = read_object(GET_OBJ_VNUM(obj), VIRTUAL);
|
object = read_object(GET_OBJ_VNUM(obj), VIRTUAL);
|
||||||
if (!object)
|
if (!object)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
obj_to_room(object, rnum);
|
obj_to_room(object, rnum);
|
||||||
obj_command_interpreter(object, arg2);
|
obj_command_interpreter(object, arg2);
|
||||||
|
|
||||||
if (object->in_room == rnum)
|
if (object->in_room == rnum)
|
||||||
extract_obj(object);
|
extract_obj(object);
|
||||||
}
|
}
|
||||||
|
|
@ -775,7 +775,7 @@ const struct obj_command_info obj_cmd_info[] = {
|
||||||
{ "otimer " , do_otimer , 0 },
|
{ "otimer " , do_otimer , 0 },
|
||||||
{ "otransform " , do_otransform, 0 },
|
{ "otransform " , do_otransform, 0 },
|
||||||
{ "ozoneecho " , do_ozoneecho , 0 }, /* fix by Rumble */
|
{ "ozoneecho " , do_ozoneecho , 0 }, /* fix by Rumble */
|
||||||
|
|
||||||
{ "\n", 0, 0 } /* this must be last */
|
{ "\n", 0, 0 } /* this must be last */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -788,9 +788,9 @@ void obj_command_interpreter(obj_data *obj, char *argument)
|
||||||
{
|
{
|
||||||
int cmd, length;
|
int cmd, length;
|
||||||
char *line, arg[MAX_INPUT_LENGTH];
|
char *line, arg[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
skip_spaces(&argument);
|
skip_spaces(&argument);
|
||||||
|
|
||||||
/* just drop to next line for hitting CR */
|
/* just drop to next line for hitting CR */
|
||||||
if (!*argument)
|
if (!*argument)
|
||||||
return;
|
return;
|
||||||
|
|
@ -803,10 +803,10 @@ void obj_command_interpreter(obj_data *obj, char *argument)
|
||||||
*obj_cmd_info[cmd].command != '\n'; cmd++)
|
*obj_cmd_info[cmd].command != '\n'; cmd++)
|
||||||
if (!strncmp(obj_cmd_info[cmd].command, arg, length))
|
if (!strncmp(obj_cmd_info[cmd].command, arg, length))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (*obj_cmd_info[cmd].command == '\n')
|
if (*obj_cmd_info[cmd].command == '\n')
|
||||||
obj_log(obj, "Unknown object cmd: '%s'", argument);
|
obj_log(obj, "Unknown object cmd: '%s'", argument);
|
||||||
else
|
else
|
||||||
((*obj_cmd_info[cmd].command_pointer)
|
((*obj_cmd_info[cmd].command_pointer)
|
||||||
(obj, line, cmd, obj_cmd_info[cmd].subcmd));
|
(obj, line, cmd, obj_cmd_info[cmd].subcmd));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
136
src/dg_olc.c
136
src/dg_olc.c
|
|
@ -40,14 +40,14 @@ void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num);
|
||||||
void trigedit_setup_new(struct descriptor_data *d);
|
void trigedit_setup_new(struct descriptor_data *d);
|
||||||
|
|
||||||
/* ***********************************************************************
|
/* ***********************************************************************
|
||||||
* trigedit
|
* trigedit
|
||||||
* ***********************************************************************/
|
* ***********************************************************************/
|
||||||
|
|
||||||
ACMD(do_oasis_trigedit)
|
ACMD(do_oasis_trigedit)
|
||||||
{
|
{
|
||||||
int number, real_num;
|
int number, real_num;
|
||||||
struct descriptor_data *d;
|
struct descriptor_data *d;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Parse any arguments.
|
* Parse any arguments.
|
||||||
*/
|
*/
|
||||||
|
|
@ -56,11 +56,11 @@ ACMD(do_oasis_trigedit)
|
||||||
send_to_char(ch, "Specify a trigger VNUM to edit.\r\n");
|
send_to_char(ch, "Specify a trigger VNUM to edit.\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
number = atoi(argument);
|
number = atoi(argument);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check that it isn't already being edited.
|
* Check that it isn't already being edited.
|
||||||
*/
|
*/
|
||||||
for (d = descriptor_list; d; d = d->next) {
|
for (d = descriptor_list; d; d = d->next) {
|
||||||
if (STATE(d) == CON_TRIGEDIT) {
|
if (STATE(d) == CON_TRIGEDIT) {
|
||||||
|
|
@ -81,7 +81,7 @@ ACMD(do_oasis_trigedit)
|
||||||
free(d->olc);
|
free(d->olc);
|
||||||
}
|
}
|
||||||
CREATE(d->olc, struct oasis_olc_data, 1);
|
CREATE(d->olc, struct oasis_olc_data, 1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Find the zone.
|
* Find the zone.
|
||||||
*/
|
*/
|
||||||
|
|
@ -91,7 +91,7 @@ ACMD(do_oasis_trigedit)
|
||||||
d->olc = NULL;
|
d->olc = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Everyone but IMPLs can only edit zones they have been assigned.
|
* Everyone but IMPLs can only edit zones they have been assigned.
|
||||||
*/
|
*/
|
||||||
|
|
@ -104,21 +104,21 @@ send_to_char(ch, " You do not have permission to edit zone %d. Try zone %d.\r\n"
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
OLC_NUM(d) = number;
|
OLC_NUM(d) = number;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If this is a new trigger, setup a new one,
|
* If this is a new trigger, setup a new one,
|
||||||
* otherwise, setup the a copy of the existing trigger
|
* otherwise, setup the a copy of the existing trigger
|
||||||
*/
|
*/
|
||||||
if ((real_num = real_trigger(number)) == NOTHING)
|
if ((real_num = real_trigger(number)) == NOTHING)
|
||||||
trigedit_setup_new(d);
|
trigedit_setup_new(d);
|
||||||
else
|
else
|
||||||
trigedit_setup_existing(d, real_num);
|
trigedit_setup_existing(d, real_num);
|
||||||
|
|
||||||
STATE(d) = CON_TRIGEDIT;
|
STATE(d) = CON_TRIGEDIT;
|
||||||
|
|
||||||
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||||
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
||||||
|
|
||||||
mudlog(CMP, LVL_IMMORT, TRUE,"OLC: %s starts editing zone %d [trigger](allowed zone %d)",
|
mudlog(CMP, LVL_IMMORT, TRUE,"OLC: %s starts editing zone %d [trigger](allowed zone %d)",
|
||||||
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
||||||
}
|
}
|
||||||
|
|
@ -151,7 +151,7 @@ void script_save_to_disk(FILE *fp, void *item, int type)
|
||||||
void trigedit_setup_new(struct descriptor_data *d)
|
void trigedit_setup_new(struct descriptor_data *d)
|
||||||
{
|
{
|
||||||
struct trig_data *trig;
|
struct trig_data *trig;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate a scratch trigger structure
|
* Allocate a scratch trigger structure
|
||||||
*/
|
*/
|
||||||
|
|
@ -161,19 +161,19 @@ void trigedit_setup_new(struct descriptor_data *d)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set up some defaults
|
* Set up some defaults
|
||||||
*/
|
*/
|
||||||
trig->name = strdup("new trigger");
|
trig->name = strdup("new trigger");
|
||||||
trig->trigger_type = MTRIG_GREET;
|
trig->trigger_type = MTRIG_GREET;
|
||||||
|
|
||||||
/* cmdlist will be a large char string until the trigger is saved */
|
/* cmdlist will be a large char string until the trigger is saved */
|
||||||
CREATE(OLC_STORAGE(d), char, MAX_CMD_LENGTH);
|
CREATE(OLC_STORAGE(d), char, MAX_CMD_LENGTH);
|
||||||
strncpy(OLC_STORAGE(d),
|
strncpy(OLC_STORAGE(d),
|
||||||
"%echo% This trigger commandlist is not complete!\r\n", MAX_CMD_LENGTH-1);
|
"%echo% This trigger commandlist is not complete!\r\n", MAX_CMD_LENGTH-1);
|
||||||
trig->narg = 100;
|
trig->narg = 100;
|
||||||
|
|
||||||
OLC_TRIG(d) = trig;
|
OLC_TRIG(d) = trig;
|
||||||
OLC_VAL(d) = 0; /* Has changed flag. (It hasn't so far, we just made it.) */
|
OLC_VAL(d) = 0; /* Has changed flag. (It hasn't so far, we just made it.) */
|
||||||
|
|
||||||
trigedit_disp_menu(d);
|
trigedit_disp_menu(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -192,7 +192,7 @@ void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num)
|
||||||
c = trig->cmdlist;
|
c = trig->cmdlist;
|
||||||
CREATE(OLC_STORAGE(d), char, MAX_CMD_LENGTH);
|
CREATE(OLC_STORAGE(d), char, MAX_CMD_LENGTH);
|
||||||
strcpy(OLC_STORAGE(d), "");
|
strcpy(OLC_STORAGE(d), "");
|
||||||
|
|
||||||
while (c)
|
while (c)
|
||||||
{
|
{
|
||||||
strcat(OLC_STORAGE(d), c->cmd);
|
strcat(OLC_STORAGE(d), c->cmd);
|
||||||
|
|
@ -204,7 +204,7 @@ void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num)
|
||||||
|
|
||||||
OLC_TRIG(d) = trig;
|
OLC_TRIG(d) = trig;
|
||||||
OLC_VAL(d) = 0; /* Has changed flag. (It hasn't so far, we just made it.) */
|
OLC_VAL(d) = 0; /* Has changed flag. (It hasn't so far, we just made it.) */
|
||||||
|
|
||||||
trigedit_disp_menu(d);
|
trigedit_disp_menu(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -227,10 +227,10 @@ void trigedit_disp_menu(struct descriptor_data *d)
|
||||||
attach_type = "Mobiles";
|
attach_type = "Mobiles";
|
||||||
sprintbit(GET_TRIG_TYPE(trig), trig_types, trgtypes, sizeof(trgtypes));
|
sprintbit(GET_TRIG_TYPE(trig), trig_types, trgtypes, sizeof(trgtypes));
|
||||||
}
|
}
|
||||||
|
|
||||||
clear_screen(d);
|
clear_screen(d);
|
||||||
|
|
||||||
write_to_output(d,
|
write_to_output(d,
|
||||||
"Trigger Editor [%s%d%s]\r\n\r\n"
|
"Trigger Editor [%s%d%s]\r\n\r\n"
|
||||||
"%s1)%s Name : %s%s\r\n"
|
"%s1)%s Name : %s%s\r\n"
|
||||||
"%s2)%s Intended for : %s%s\r\n"
|
"%s2)%s Intended for : %s%s\r\n"
|
||||||
|
|
@ -258,7 +258,7 @@ void trigedit_disp_types(struct descriptor_data *d)
|
||||||
int i, columns = 0;
|
int i, columns = 0;
|
||||||
const char **types;
|
const char **types;
|
||||||
char bitbuf[MAX_STRING_LENGTH];
|
char bitbuf[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
switch(OLC_TRIG(d)->attach_type)
|
switch(OLC_TRIG(d)->attach_type)
|
||||||
{
|
{
|
||||||
case WLD_TRIGGER:
|
case WLD_TRIGGER:
|
||||||
|
|
@ -283,7 +283,7 @@ void trigedit_disp_types(struct descriptor_data *d)
|
||||||
sprintbit(GET_TRIG_TYPE(OLC_TRIG(d)), types, bitbuf, sizeof(bitbuf));
|
sprintbit(GET_TRIG_TYPE(OLC_TRIG(d)), types, bitbuf, sizeof(bitbuf));
|
||||||
write_to_output(d, "\r\nCurrent types : %s%s%s\r\nEnter type (0 to quit) : ",
|
write_to_output(d, "\r\nCurrent types : %s%s%s\r\nEnter type (0 to quit) : ",
|
||||||
cyn, bitbuf, nrm);
|
cyn, bitbuf, nrm);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void trigedit_parse(struct descriptor_data *d, char *arg)
|
void trigedit_parse(struct descriptor_data *d, char *arg)
|
||||||
|
|
@ -342,7 +342,7 @@ void trigedit_parse(struct descriptor_data *d, char *arg)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case TRIGEDIT_CONFIRM_SAVESTRING:
|
case TRIGEDIT_CONFIRM_SAVESTRING:
|
||||||
switch(tolower(*arg)) {
|
switch(tolower(*arg)) {
|
||||||
case 'y':
|
case 'y':
|
||||||
|
|
@ -425,10 +425,10 @@ void trigedit_save(struct descriptor_data *d)
|
||||||
char buf[MAX_CMD_LENGTH];
|
char buf[MAX_CMD_LENGTH];
|
||||||
char bitBuf[MAX_INPUT_LENGTH];
|
char bitBuf[MAX_INPUT_LENGTH];
|
||||||
char fname[MAX_INPUT_LENGTH];
|
char fname[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
if ((rnum = real_trigger(OLC_NUM(d))) != NOTHING) {
|
if ((rnum = real_trigger(OLC_NUM(d))) != NOTHING) {
|
||||||
proto = trig_index[rnum]->proto;
|
proto = trig_index[rnum]->proto;
|
||||||
for (cmd = proto->cmdlist; cmd; cmd = next_cmd) {
|
for (cmd = proto->cmdlist; cmd; cmd = next_cmd) {
|
||||||
next_cmd = cmd->next;
|
next_cmd = cmd->next;
|
||||||
if (cmd->cmd)
|
if (cmd->cmd)
|
||||||
free(cmd->cmd);
|
free(cmd->cmd);
|
||||||
|
|
@ -441,7 +441,7 @@ void trigedit_save(struct descriptor_data *d)
|
||||||
|
|
||||||
/* Recompile the command list from the new script */
|
/* Recompile the command list from the new script */
|
||||||
s = OLC_STORAGE(d);
|
s = OLC_STORAGE(d);
|
||||||
|
|
||||||
CREATE(trig->cmdlist, struct cmdlist_element, 1);
|
CREATE(trig->cmdlist, struct cmdlist_element, 1);
|
||||||
if (s) {
|
if (s) {
|
||||||
char *t = strtok(s, "\n\r"); /* strtok returns NULL if s is "\r\n" */
|
char *t = strtok(s, "\n\r"); /* strtok returns NULL if s is "\r\n" */
|
||||||
|
|
@ -456,9 +456,9 @@ void trigedit_save(struct descriptor_data *d)
|
||||||
cmd = cmd->next;
|
cmd = cmd->next;
|
||||||
cmd->cmd = strdup(s);
|
cmd->cmd = strdup(s);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
trig->cmdlist->cmd = strdup("* No Script");
|
trig->cmdlist->cmd = strdup("* No Script");
|
||||||
|
|
||||||
/* make the prorotype look like what we have */
|
/* make the prorotype look like what we have */
|
||||||
trig_data_copy(proto, trig);
|
trig_data_copy(proto, trig);
|
||||||
|
|
||||||
|
|
@ -490,7 +490,7 @@ void trigedit_save(struct descriptor_data *d)
|
||||||
free_varlist(live_trig->var_list);
|
free_varlist(live_trig->var_list);
|
||||||
live_trig->var_list=NULL;
|
live_trig->var_list=NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
live_trig->cmdlist = proto->cmdlist;
|
live_trig->cmdlist = proto->cmdlist;
|
||||||
live_trig->curr_state = live_trig->cmdlist;
|
live_trig->curr_state = live_trig->cmdlist;
|
||||||
live_trig->trigger_type = proto->trigger_type;
|
live_trig->trigger_type = proto->trigger_type;
|
||||||
|
|
@ -507,34 +507,34 @@ void trigedit_save(struct descriptor_data *d)
|
||||||
CREATE(new_index, struct index_data *, top_of_trigt + 2);
|
CREATE(new_index, struct index_data *, top_of_trigt + 2);
|
||||||
|
|
||||||
/* Recompile the command list from the new script */
|
/* Recompile the command list from the new script */
|
||||||
|
|
||||||
s = OLC_STORAGE(d);
|
s = OLC_STORAGE(d);
|
||||||
|
|
||||||
CREATE(trig->cmdlist, struct cmdlist_element, 1);
|
CREATE(trig->cmdlist, struct cmdlist_element, 1);
|
||||||
if (s) {
|
if (s) {
|
||||||
/* strtok returns NULL if s is "\r\n" */
|
/* strtok returns NULL if s is "\r\n" */
|
||||||
char *t = strtok(s, "\n\r");
|
char *t = strtok(s, "\n\r");
|
||||||
trig->cmdlist->cmd = strdup(t ? t : "* No script");
|
trig->cmdlist->cmd = strdup(t ? t : "* No script");
|
||||||
cmd = trig->cmdlist;
|
cmd = trig->cmdlist;
|
||||||
|
|
||||||
while ((s = strtok(NULL, "\n\r"))) {
|
while ((s = strtok(NULL, "\n\r"))) {
|
||||||
CREATE(cmd->next, struct cmdlist_element, 1);
|
CREATE(cmd->next, struct cmdlist_element, 1);
|
||||||
cmd = cmd->next;
|
cmd = cmd->next;
|
||||||
cmd->cmd = strdup(s);
|
cmd->cmd = strdup(s);
|
||||||
}
|
}
|
||||||
} else
|
} else
|
||||||
trig->cmdlist->cmd = strdup("* No Script");
|
trig->cmdlist->cmd = strdup("* No Script");
|
||||||
|
|
||||||
for (i = 0; i < top_of_trigt; i++) {
|
for (i = 0; i < top_of_trigt; i++) {
|
||||||
if (!found) {
|
if (!found) {
|
||||||
if (trig_index[i]->vnum > OLC_NUM(d)) {
|
if (trig_index[i]->vnum > OLC_NUM(d)) {
|
||||||
found = TRUE;
|
found = TRUE;
|
||||||
rnum = i;
|
rnum = i;
|
||||||
|
|
||||||
CREATE(new_index[rnum], struct index_data, 1);
|
CREATE(new_index[rnum], struct index_data, 1);
|
||||||
GET_TRIG_RNUM(OLC_TRIG(d)) = rnum;
|
GET_TRIG_RNUM(OLC_TRIG(d)) = rnum;
|
||||||
new_index[rnum]->vnum = OLC_NUM(d);
|
new_index[rnum]->vnum = OLC_NUM(d);
|
||||||
new_index[rnum]->number = 0;
|
new_index[rnum]->number = 0;
|
||||||
new_index[rnum]->func = NULL;
|
new_index[rnum]->func = NULL;
|
||||||
CREATE(proto, struct trig_data, 1);
|
CREATE(proto, struct trig_data, 1);
|
||||||
new_index[rnum]->proto = proto;
|
new_index[rnum]->proto = proto;
|
||||||
|
|
@ -543,7 +543,7 @@ void trigedit_save(struct descriptor_data *d)
|
||||||
if (trig->name)
|
if (trig->name)
|
||||||
proto->name = strdup(trig->name);
|
proto->name = strdup(trig->name);
|
||||||
if (trig->arglist)
|
if (trig->arglist)
|
||||||
proto->arglist = strdup(trig->arglist);
|
proto->arglist = strdup(trig->arglist);
|
||||||
|
|
||||||
new_index[rnum + 1] = trig_index[rnum];
|
new_index[rnum + 1] = trig_index[rnum];
|
||||||
|
|
||||||
|
|
@ -562,11 +562,11 @@ void trigedit_save(struct descriptor_data *d)
|
||||||
if (!found) {
|
if (!found) {
|
||||||
rnum = i;
|
rnum = i;
|
||||||
CREATE(new_index[rnum], struct index_data, 1);
|
CREATE(new_index[rnum], struct index_data, 1);
|
||||||
GET_TRIG_RNUM(OLC_TRIG(d)) = rnum;
|
GET_TRIG_RNUM(OLC_TRIG(d)) = rnum;
|
||||||
new_index[rnum]->vnum = OLC_NUM(d);
|
new_index[rnum]->vnum = OLC_NUM(d);
|
||||||
new_index[rnum]->number = 0;
|
new_index[rnum]->number = 0;
|
||||||
new_index[rnum]->func = NULL;
|
new_index[rnum]->func = NULL;
|
||||||
|
|
||||||
CREATE(proto, struct trig_data, 1);
|
CREATE(proto, struct trig_data, 1);
|
||||||
new_index[rnum]->proto = proto;
|
new_index[rnum]->proto = proto;
|
||||||
trig_data_copy(proto, trig);
|
trig_data_copy(proto, trig);
|
||||||
|
|
@ -574,18 +574,18 @@ void trigedit_save(struct descriptor_data *d)
|
||||||
if (trig->name)
|
if (trig->name)
|
||||||
proto->name = strdup(trig->name);
|
proto->name = strdup(trig->name);
|
||||||
if (trig->arglist)
|
if (trig->arglist)
|
||||||
proto->arglist = strdup(trig->arglist);
|
proto->arglist = strdup(trig->arglist);
|
||||||
}
|
}
|
||||||
|
|
||||||
free(trig_index);
|
free(trig_index);
|
||||||
|
|
||||||
trig_index = new_index;
|
trig_index = new_index;
|
||||||
top_of_trigt++;
|
top_of_trigt++;
|
||||||
|
|
||||||
/* HERE IT HAS TO GO THROUGH AND FIX ALL SCRIPTS/TRIGS OF HIGHER RNUM */
|
/* HERE IT HAS TO GO THROUGH AND FIX ALL SCRIPTS/TRIGS OF HIGHER RNUM */
|
||||||
for (live_trig = trigger_list; live_trig; live_trig = live_trig->next_in_world)
|
for (live_trig = trigger_list; live_trig; live_trig = live_trig->next_in_world)
|
||||||
GET_TRIG_RNUM(live_trig) += (GET_TRIG_RNUM(live_trig) > rnum);
|
GET_TRIG_RNUM(live_trig) += (GET_TRIG_RNUM(live_trig) > rnum);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update other trigs being edited.
|
* Update other trigs being edited.
|
||||||
*/
|
*/
|
||||||
|
|
@ -613,18 +613,18 @@ void trigedit_save(struct descriptor_data *d)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!(trig_file = fopen(fname, "w"))) {
|
if (!(trig_file = fopen(fname, "w"))) {
|
||||||
mudlog(BRF, MAX(LVL_GOD, GET_INVIS_LEV(d->character)), TRUE,
|
mudlog(BRF, MAX(LVL_GOD, GET_INVIS_LEV(d->character)), TRUE,
|
||||||
"SYSERR: OLC: Can't open trig file \"%s\"", fname);
|
"SYSERR: OLC: Can't open trig file \"%s\"", fname);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = zone_table[OLC_ZNUM(d)].bot; i <= top; i++) {
|
for (i = zone_table[OLC_ZNUM(d)].bot; i <= top; i++) {
|
||||||
if ((rnum = real_trigger(i)) != NOTHING) {
|
if ((rnum = real_trigger(i)) != NOTHING) {
|
||||||
trig = trig_index[rnum]->proto;
|
trig = trig_index[rnum]->proto;
|
||||||
|
|
||||||
if (fprintf(trig_file, "#%d\n", i) < 0) {
|
if (fprintf(trig_file, "#%d\n", i) < 0) {
|
||||||
mudlog(BRF, MAX(LVL_GOD, GET_INVIS_LEV(d->character)), TRUE,
|
mudlog(BRF, MAX(LVL_GOD, GET_INVIS_LEV(d->character)), TRUE,
|
||||||
"SYSERR: OLC: Can't write trig file!");
|
"SYSERR: OLC: Can't write trig file!");
|
||||||
fclose(trig_file);
|
fclose(trig_file);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -636,7 +636,7 @@ void trigedit_save(struct descriptor_data *d)
|
||||||
trig->attach_type,
|
trig->attach_type,
|
||||||
*bitBuf ? bitBuf : "0", GET_TRIG_NARG(trig),
|
*bitBuf ? bitBuf : "0", GET_TRIG_NARG(trig),
|
||||||
GET_TRIG_ARG(trig) ? GET_TRIG_ARG(trig) : "", STRING_TERMINATOR);
|
GET_TRIG_ARG(trig) ? GET_TRIG_ARG(trig) : "", STRING_TERMINATOR);
|
||||||
|
|
||||||
/* Build the text for the script */
|
/* Build the text for the script */
|
||||||
strcpy(buf,""); /* strcpy OK for MAX_CMD_LENGTH > 0*/
|
strcpy(buf,""); /* strcpy OK for MAX_CMD_LENGTH > 0*/
|
||||||
for (cmd = trig->cmdlist; cmd; cmd = cmd->next) {
|
for (cmd = trig->cmdlist; cmd; cmd = cmd->next) {
|
||||||
|
|
@ -646,22 +646,22 @@ void trigedit_save(struct descriptor_data *d)
|
||||||
|
|
||||||
if (!buf[0])
|
if (!buf[0])
|
||||||
strcpy(buf, "* Empty script");
|
strcpy(buf, "* Empty script");
|
||||||
|
|
||||||
fprintf(trig_file, "%s%c\n", buf, STRING_TERMINATOR);
|
fprintf(trig_file, "%s%c\n", buf, STRING_TERMINATOR);
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(trig_file, "$%c\n", STRING_TERMINATOR);
|
fprintf(trig_file, "$%c\n", STRING_TERMINATOR);
|
||||||
fclose(trig_file);
|
fclose(trig_file);
|
||||||
|
|
||||||
#ifdef CIRCLE_MAC
|
#ifdef CIRCLE_MAC
|
||||||
snprintf(buf, sizeof(buf), "%s:%d.trg", TRG_PREFIX, zone);
|
snprintf(buf, sizeof(buf), "%s:%d.trg", TRG_PREFIX, zone);
|
||||||
#else
|
#else
|
||||||
snprintf(buf, sizeof(buf), "%s/%d.trg", TRG_PREFIX, zone);
|
snprintf(buf, sizeof(buf), "%s/%d.trg", TRG_PREFIX, zone);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
remove(buf);
|
remove(buf);
|
||||||
rename(fname, buf);
|
rename(fname, buf);
|
||||||
|
|
||||||
write_to_output(d, "Saving Index file\r\n");
|
write_to_output(d, "Saving Index file\r\n");
|
||||||
|
|
@ -758,9 +758,9 @@ void dg_script_menu(struct descriptor_data *d)
|
||||||
write_to_output(d, " Script Editor\r\n\r\n Trigger List:\r\n");
|
write_to_output(d, " Script Editor\r\n\r\n Trigger List:\r\n");
|
||||||
|
|
||||||
editscript = OLC_SCRIPT(d);
|
editscript = OLC_SCRIPT(d);
|
||||||
|
|
||||||
while (editscript) {
|
while (editscript) {
|
||||||
write_to_output(d, " %2d) [%s%d%s] %s%s%s", ++i, cyn,
|
write_to_output(d, " %2d) [%s%d%s] %s%s%s", ++i, cyn,
|
||||||
editscript->vnum, nrm, cyn,
|
editscript->vnum, nrm, cyn,
|
||||||
trig_index[real_trigger(editscript->vnum)]->proto->name, nrm);
|
trig_index[real_trigger(editscript->vnum)]->proto->name, nrm);
|
||||||
if (trig_index[real_trigger(editscript->vnum)]->proto->attach_type != OLC_ITEM_TYPE(d))
|
if (trig_index[real_trigger(editscript->vnum)]->proto->attach_type != OLC_ITEM_TYPE(d))
|
||||||
|
|
@ -770,7 +770,7 @@ void dg_script_menu(struct descriptor_data *d)
|
||||||
|
|
||||||
editscript = editscript->next;
|
editscript = editscript->next;
|
||||||
}
|
}
|
||||||
if (i==0)
|
if (i==0)
|
||||||
write_to_output(d, " <none>\r\n");
|
write_to_output(d, " <none>\r\n");
|
||||||
|
|
||||||
write_to_output(d, "\r\n"
|
write_to_output(d, "\r\n"
|
||||||
|
|
@ -793,18 +793,18 @@ int dg_script_edit_parse(struct descriptor_data *d, char *arg)
|
||||||
/* this was buggy.
|
/* this was buggy.
|
||||||
First we created a copy of a thing, but maintained pointers to scripts,
|
First we created a copy of a thing, but maintained pointers to scripts,
|
||||||
then if we altered the scripts, we freed the pointers and added new ones
|
then if we altered the scripts, we freed the pointers and added new ones
|
||||||
to the OLC_THING. If we then chose _NOT_ to save the changes, the
|
to the OLC_THING. If we then chose _NOT_ to save the changes, the
|
||||||
pointers in the original thing pointed to garbage. If we saved changes
|
pointers in the original thing pointed to garbage. If we saved changes
|
||||||
the pointers were updated correctly.
|
the pointers were updated correctly.
|
||||||
|
|
||||||
Solution:
|
Solution:
|
||||||
Here we just point the working copies to the new proto_scripts
|
Here we just point the working copies to the new proto_scripts
|
||||||
We only update the original when choosing to save internally,
|
We only update the original when choosing to save internally,
|
||||||
then free the unused memory there.
|
then free the unused memory there.
|
||||||
|
|
||||||
Welcor
|
Welcor
|
||||||
|
|
||||||
Thanks to
|
Thanks to
|
||||||
Jeremy Stanley - fungi@yuggoth.org and
|
Jeremy Stanley - fungi@yuggoth.org and
|
||||||
Torgny Bjers - artovil@arcanerealms.org
|
Torgny Bjers - artovil@arcanerealms.org
|
||||||
for the bug report.
|
for the bug report.
|
||||||
|
|
@ -815,7 +815,7 @@ int dg_script_edit_parse(struct descriptor_data *d, char *arg)
|
||||||
OLC_OBJ(d), etc.. are initalized with proto_script = NULL;
|
OLC_OBJ(d), etc.. are initalized with proto_script = NULL;
|
||||||
On save, the saved copy is updated with OLC_SCRIPT(d) as new proto_script (freeing the old one).
|
On save, the saved copy is updated with OLC_SCRIPT(d) as new proto_script (freeing the old one).
|
||||||
On quit/nosave, OLC_SCRIPT is free()'d, and the prototype not touched.
|
On quit/nosave, OLC_SCRIPT is free()'d, and the prototype not touched.
|
||||||
|
|
||||||
*/
|
*/
|
||||||
return 0;
|
return 0;
|
||||||
case 'n':
|
case 'n':
|
||||||
|
|
@ -894,7 +894,7 @@ int dg_script_edit_parse(struct descriptor_data *d, char *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
dg_script_menu(d);
|
dg_script_menu(d);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void trigedit_string_cleanup(struct descriptor_data *d, int terminator)
|
void trigedit_string_cleanup(struct descriptor_data *d, int terminator)
|
||||||
|
|
@ -930,14 +930,14 @@ int format_script(struct descriptor_data *d)
|
||||||
char *sc;
|
char *sc;
|
||||||
size_t len = 0, nlen = 0, llen = 0;
|
size_t len = 0, nlen = 0, llen = 0;
|
||||||
int indent = 0, indent_next = FALSE, found_case = FALSE, i, line_num = 0;
|
int indent = 0, indent_next = FALSE, found_case = FALSE, i, line_num = 0;
|
||||||
|
|
||||||
if (!d->str || !*d->str)
|
if (!d->str || !*d->str)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
sc = strdup(*d->str); /* we work on a copy, because of strtok() */
|
sc = strdup(*d->str); /* we work on a copy, because of strtok() */
|
||||||
t = strtok(sc, "\n\r");
|
t = strtok(sc, "\n\r");
|
||||||
*nsc = '\0';
|
*nsc = '\0';
|
||||||
|
|
||||||
while (t) {
|
while (t) {
|
||||||
line_num++;
|
line_num++;
|
||||||
skip_spaces(&t);
|
skip_spaces(&t);
|
||||||
|
|
@ -997,20 +997,20 @@ int format_script(struct descriptor_data *d)
|
||||||
}
|
}
|
||||||
len = len + nlen + llen;
|
len = len + nlen + llen;
|
||||||
strcat(nsc, line); /* strcat OK, size checked above */
|
strcat(nsc, line); /* strcat OK, size checked above */
|
||||||
|
|
||||||
if (indent_next) {
|
if (indent_next) {
|
||||||
indent++;
|
indent++;
|
||||||
indent_next = FALSE;
|
indent_next = FALSE;
|
||||||
}
|
}
|
||||||
t = strtok(NULL, "\n\r");
|
t = strtok(NULL, "\n\r");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (indent)
|
if (indent)
|
||||||
write_to_output(d, "Unmatched if, while or switch ignored.\r\n");
|
write_to_output(d, "Unmatched if, while or switch ignored.\r\n");
|
||||||
|
|
||||||
free(*d->str);
|
free(*d->str);
|
||||||
*d->str = strdup(nsc);
|
*d->str = strdup(nsc);
|
||||||
free(sc);
|
free(sc);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
528
src/dg_scripts.c
528
src/dg_scripts.c
File diff suppressed because it is too large
Load diff
|
|
@ -18,28 +18,28 @@
|
||||||
/* unless you change this, Puff casts all your dg spells */
|
/* unless you change this, Puff casts all your dg spells */
|
||||||
#define DG_CASTER_PROXY 1
|
#define DG_CASTER_PROXY 1
|
||||||
/* spells cast by objects and rooms use this level */
|
/* spells cast by objects and rooms use this level */
|
||||||
#define DG_SPELL_LEVEL 25
|
#define DG_SPELL_LEVEL 25
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* define this if you don't want wear/remove triggers to fire when
|
* define this if you don't want wear/remove triggers to fire when
|
||||||
* a player is saved.
|
* a player is saved.
|
||||||
*/
|
*/
|
||||||
#define NO_EXTRANEOUS_TRIGGERS
|
#define NO_EXTRANEOUS_TRIGGERS
|
||||||
/*
|
/*
|
||||||
* %actor.room% behaviour :
|
* %actor.room% behaviour :
|
||||||
* Until pl 7 %actor.room% returned a room vnum.
|
* Until pl 7 %actor.room% returned a room vnum.
|
||||||
* Working with this number in scripts was unnecessarily hard,
|
* Working with this number in scripts was unnecessarily hard,
|
||||||
* especially in those situations one needed the id of the room,
|
* especially in those situations one needed the id of the room,
|
||||||
* the items in it, etc. As a result of this, the output
|
* the items in it, etc. As a result of this, the output
|
||||||
* has been changed (as of pl 8) to a room variable.
|
* has been changed (as of pl 8) to a room variable.
|
||||||
* This means old scripts will need a minor adjustment;
|
* This means old scripts will need a minor adjustment;
|
||||||
*
|
*
|
||||||
* Before:
|
* Before:
|
||||||
* if %actor.room%==3001
|
* if %actor.room%==3001
|
||||||
* %echo% You are at the main temple.
|
* %echo% You are at the main temple.
|
||||||
*
|
*
|
||||||
* After:
|
* After:
|
||||||
* eval room %actor.room%
|
* eval room %actor.room%
|
||||||
* if %room.vnum%==3001
|
* if %room.vnum%==3001
|
||||||
* %echo% You are at the main temple.
|
* %echo% You are at the main temple.
|
||||||
*
|
*
|
||||||
|
|
@ -122,7 +122,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* These are slightly off of PULSE_MOBILE so
|
* These are slightly off of PULSE_MOBILE so
|
||||||
* everything isnt happening at the same time
|
* everything isnt happening at the same time
|
||||||
*/
|
*/
|
||||||
#define PULSE_DG_SCRIPT (13 RL_SEC)
|
#define PULSE_DG_SCRIPT (13 RL_SEC)
|
||||||
|
|
||||||
|
|
@ -143,7 +143,7 @@ struct trig_var_data {
|
||||||
char *name; /* name of variable */
|
char *name; /* name of variable */
|
||||||
char *value; /* value of variable */
|
char *value; /* value of variable */
|
||||||
long context; /* 0: global context */
|
long context; /* 0: global context */
|
||||||
|
|
||||||
struct trig_var_data *next;
|
struct trig_var_data *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -163,8 +163,8 @@ struct trig_data {
|
||||||
struct event *wait_event; /* event to pause the trigger */
|
struct event *wait_event; /* event to pause the trigger */
|
||||||
ubyte purged; /* trigger is set to be purged */
|
ubyte purged; /* trigger is set to be purged */
|
||||||
struct trig_var_data *var_list; /* list of local vars for trigger */
|
struct trig_var_data *var_list; /* list of local vars for trigger */
|
||||||
|
|
||||||
struct trig_data *next;
|
struct trig_data *next;
|
||||||
struct trig_data *next_in_world; /* next in the global trigger list */
|
struct trig_data *next_in_world; /* next in the global trigger list */
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -208,7 +208,7 @@ int is_substring(char *sub, char *string);
|
||||||
int word_check(char *str, char *wordlist);
|
int word_check(char *str, char *wordlist);
|
||||||
|
|
||||||
void act_mtrigger(const char_data *ch, char *str,
|
void act_mtrigger(const char_data *ch, char *str,
|
||||||
char_data *actor, char_data *victim, obj_data *object, obj_data *target, char *arg);
|
char_data *actor, char_data *victim, obj_data *object, obj_data *target, char *arg);
|
||||||
void speech_mtrigger(char_data *actor, char *str);
|
void speech_mtrigger(char_data *actor, char *str);
|
||||||
void speech_wtrigger(char_data *actor, char *str);
|
void speech_wtrigger(char_data *actor, char *str);
|
||||||
void greet_memory_mtrigger(char_data *ch);
|
void greet_memory_mtrigger(char_data *ch);
|
||||||
|
|
@ -265,34 +265,34 @@ void time_otrigger(obj_data *obj);
|
||||||
void time_wtrigger(room_data *room);
|
void time_wtrigger(room_data *room);
|
||||||
|
|
||||||
/* function prototypes from dg_scripts.c */
|
/* function prototypes from dg_scripts.c */
|
||||||
char *str_str(char *cs, char *ct);
|
char *str_str(char *cs, char *ct);
|
||||||
int find_eq_pos_script(char *arg);
|
int find_eq_pos_script(char *arg);
|
||||||
int can_wear_on_pos(struct obj_data *obj, int pos);
|
int can_wear_on_pos(struct obj_data *obj, int pos);
|
||||||
struct char_data *find_char(long n);
|
struct char_data *find_char(long n);
|
||||||
char_data *get_char(char *name);
|
char_data *get_char(char *name);
|
||||||
char_data *get_char_near_obj(obj_data *obj, char *name);
|
char_data *get_char_near_obj(obj_data *obj, char *name);
|
||||||
char_data *get_char_in_room(room_data *room, char *name);
|
char_data *get_char_in_room(room_data *room, char *name);
|
||||||
obj_data *get_obj_near_obj(obj_data *obj, char *name);
|
obj_data *get_obj_near_obj(obj_data *obj, char *name);
|
||||||
obj_data *get_obj(char *name);
|
obj_data *get_obj(char *name);
|
||||||
room_data *get_room(char *name);
|
room_data *get_room(char *name);
|
||||||
char_data *get_char_by_obj(obj_data *obj, char *name);
|
char_data *get_char_by_obj(obj_data *obj, char *name);
|
||||||
char_data *get_char_by_room(room_data *room, char *name);
|
char_data *get_char_by_room(room_data *room, char *name);
|
||||||
obj_data *get_obj_by_obj(obj_data *obj, char *name);
|
obj_data *get_obj_by_obj(obj_data *obj, char *name);
|
||||||
obj_data *get_obj_in_room(room_data *room, char *name);
|
obj_data *get_obj_in_room(room_data *room, char *name);
|
||||||
obj_data *get_obj_by_room(room_data *room, char *name);
|
obj_data *get_obj_by_room(room_data *room, char *name);
|
||||||
int trgvar_in_room(room_vnum vnum);
|
int trgvar_in_room(room_vnum vnum);
|
||||||
obj_data *get_obj_in_list(char *name, obj_data *list);
|
obj_data *get_obj_in_list(char *name, obj_data *list);
|
||||||
obj_data *get_object_in_equip(char_data * ch, char *name);
|
obj_data *get_object_in_equip(char_data * ch, char *name);
|
||||||
void script_trigger_check(void);
|
void script_trigger_check(void);
|
||||||
void check_time_triggers(void);
|
void check_time_triggers(void);
|
||||||
void find_uid_name(char *uid, char *name, size_t nlen);
|
void find_uid_name(char *uid, char *name, size_t nlen);
|
||||||
void do_sstat_room(struct char_data * ch);
|
void do_sstat_room(struct char_data * ch);
|
||||||
void do_sstat_object(char_data *ch, obj_data *j);
|
void do_sstat_object(char_data *ch, obj_data *j);
|
||||||
void do_sstat_character(char_data *ch, char_data *k);
|
void do_sstat_character(char_data *ch, char_data *k);
|
||||||
void add_trigger(struct script_data *sc, trig_data *t, int loc);
|
void add_trigger(struct script_data *sc, trig_data *t, int loc);
|
||||||
void script_vlog(const char *format, va_list args);
|
void script_vlog(const char *format, va_list args);
|
||||||
void script_log(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
|
void script_log(const char *format, ...) __attribute__ ((format (printf, 1, 2)));
|
||||||
char *matching_quote(char *p);
|
char *matching_quote(char *p);
|
||||||
struct room_data *dg_room_of_obj(struct obj_data *obj);
|
struct room_data *dg_room_of_obj(struct obj_data *obj);
|
||||||
|
|
||||||
/* To maintain strict-aliasing we'll have to do this trick with a union */
|
/* To maintain strict-aliasing we'll have to do this trick with a union */
|
||||||
|
|
@ -301,8 +301,8 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode);
|
||||||
trig_rnum real_trigger(trig_vnum vnum);
|
trig_rnum real_trigger(trig_vnum vnum);
|
||||||
void process_eval(void *go, struct script_data *sc, trig_data *trig,
|
void process_eval(void *go, struct script_data *sc, trig_data *trig,
|
||||||
int type, char *cmd);
|
int type, char *cmd);
|
||||||
void read_saved_vars(struct char_data *ch);
|
void read_saved_vars(struct char_data *ch);
|
||||||
void save_char_vars(struct char_data *ch);
|
void save_char_vars(struct char_data *ch);
|
||||||
void init_lookup_table(void);
|
void init_lookup_table(void);
|
||||||
void add_to_lookup_table(long uid, void *c);
|
void add_to_lookup_table(long uid, void *c);
|
||||||
void remove_from_lookup_table(long uid);
|
void remove_from_lookup_table(long uid);
|
||||||
|
|
@ -348,9 +348,9 @@ void sub_write(char *arg, char_data *ch, byte find_invis, int targets);
|
||||||
void send_to_zone(char *messg, zone_rnum zone);
|
void send_to_zone(char *messg, zone_rnum zone);
|
||||||
|
|
||||||
/* from dg_misc.c */
|
/* from dg_misc.c */
|
||||||
void do_dg_cast(void *go, struct script_data *sc, trig_data *trig,
|
void do_dg_cast(void *go, struct script_data *sc, trig_data *trig,
|
||||||
int type, char *cmd);
|
int type, char *cmd);
|
||||||
void do_dg_affect(void *go, struct script_data *sc, trig_data *trig,
|
void do_dg_affect(void *go, struct script_data *sc, trig_data *trig,
|
||||||
int type, char *cmd);
|
int type, char *cmd);
|
||||||
void send_char_pos(struct char_data *ch, int dam);
|
void send_char_pos(struct char_data *ch, int dam);
|
||||||
int valid_dg_target(char_data *ch, int bitvector);
|
int valid_dg_target(char_data *ch, int bitvector);
|
||||||
|
|
@ -388,7 +388,7 @@ room_rnum obj_room(obj_data *obj);
|
||||||
#define SCRIPT(o) ((o)->script)
|
#define SCRIPT(o) ((o)->script)
|
||||||
#define SCRIPT_MEM(c) ((c)->memory)
|
#define SCRIPT_MEM(c) ((c)->memory)
|
||||||
|
|
||||||
#define SCRIPT_TYPES(s) ((s)->types)
|
#define SCRIPT_TYPES(s) ((s)->types)
|
||||||
#define TRIGGERS(s) ((s)->trig_list)
|
#define TRIGGERS(s) ((s)->trig_list)
|
||||||
|
|
||||||
#define GET_SHORT(ch) ((ch)->player.short_descr)
|
#define GET_SHORT(ch) ((ch)->player.short_descr)
|
||||||
|
|
|
||||||
|
|
@ -68,7 +68,7 @@ char *one_phrase(char *arg, char *first_arg)
|
||||||
|
|
||||||
s = first_arg;
|
s = first_arg;
|
||||||
p = arg;
|
p = arg;
|
||||||
|
|
||||||
while (*p && !isspace(*p) && *p != '"')
|
while (*p && !isspace(*p) && *p != '"')
|
||||||
*s++ = *p++;
|
*s++ = *p++;
|
||||||
|
|
||||||
|
|
@ -88,7 +88,7 @@ int is_substring(char *sub, char *string)
|
||||||
{
|
{
|
||||||
int len = strlen(string);
|
int len = strlen(string);
|
||||||
int sublen = strlen(sub);
|
int sublen = strlen(sub);
|
||||||
|
|
||||||
/* check front */
|
/* check front */
|
||||||
if ((s == string || isspace(*(s - 1)) || ispunct(*(s - 1))) &&
|
if ((s == string || isspace(*(s - 1)) || ispunct(*(s - 1))) &&
|
||||||
|
|
||||||
|
|
@ -114,7 +114,7 @@ int word_check(char *str, char *wordlist)
|
||||||
if (*wordlist=='*') return 1;
|
if (*wordlist=='*') return 1;
|
||||||
|
|
||||||
strcpy(words, wordlist);
|
strcpy(words, wordlist);
|
||||||
|
|
||||||
for (s = one_phrase(words, phrase); *phrase; s = one_phrase(s, phrase))
|
for (s = one_phrase(words, phrase); *phrase; s = one_phrase(s, phrase))
|
||||||
if (is_substring(phrase, str))
|
if (is_substring(phrase, str))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -122,7 +122,7 @@ int word_check(char *str, char *wordlist)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* mob triggers
|
* mob triggers
|
||||||
|
|
@ -140,7 +140,7 @@ void random_mtrigger(char_data *ch)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||||
if (TRIGGER_CHECK(t, MTRIG_RANDOM) &&
|
if (TRIGGER_CHECK(t, MTRIG_RANDOM) &&
|
||||||
(rand_number(1, 100) <= GET_TRIG_NARG(t))) {
|
(rand_number(1, 100) <= GET_TRIG_NARG(t))) {
|
||||||
script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);
|
script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);
|
||||||
break;
|
break;
|
||||||
|
|
@ -152,7 +152,7 @@ void bribe_mtrigger(char_data *ch, char_data *actor, int amount)
|
||||||
{
|
{
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
if (!SCRIPT_CHECK(ch, MTRIG_BRIBE) || AFF_FLAGGED(ch, AFF_CHARM))
|
if (!SCRIPT_CHECK(ch, MTRIG_BRIBE) || AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -179,7 +179,7 @@ void greet_memory_mtrigger(char_data *actor)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (ch = world[IN_ROOM(actor)].people; ch; ch = ch->next_in_room) {
|
for (ch = world[IN_ROOM(actor)].people; ch; ch = ch->next_in_room) {
|
||||||
if (!SCRIPT_MEM(ch) || !AWAKE(ch) || FIGHTING(ch) || (ch == actor) ||
|
if (!SCRIPT_MEM(ch) || !AWAKE(ch) || FIGHTING(ch) || (ch == actor) ||
|
||||||
AFF_FLAGGED(ch, AFF_CHARM))
|
AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
continue;
|
continue;
|
||||||
/* find memory line with command only */
|
/* find memory line with command only */
|
||||||
|
|
@ -227,19 +227,19 @@ int greet_mtrigger(char_data *actor, int dir)
|
||||||
char_data *ch;
|
char_data *ch;
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
int intermediate, final=TRUE;
|
int intermediate, final=TRUE;
|
||||||
|
|
||||||
if (!valid_dg_target(actor, DG_ALLOW_GODS))
|
if (!valid_dg_target(actor, DG_ALLOW_GODS))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
for (ch = world[IN_ROOM(actor)].people; ch; ch = ch->next_in_room) {
|
for (ch = world[IN_ROOM(actor)].people; ch; ch = ch->next_in_room) {
|
||||||
if (!SCRIPT_CHECK(ch, MTRIG_GREET | MTRIG_GREET_ALL) ||
|
if (!SCRIPT_CHECK(ch, MTRIG_GREET | MTRIG_GREET_ALL) ||
|
||||||
!AWAKE(ch) || FIGHTING(ch) || (ch == actor) ||
|
!AWAKE(ch) || FIGHTING(ch) || (ch == actor) ||
|
||||||
AFF_FLAGGED(ch, AFF_CHARM))
|
AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||||
if (((IS_SET(GET_TRIG_TYPE(t), MTRIG_GREET) && CAN_SEE(ch, actor)) ||
|
if (((IS_SET(GET_TRIG_TYPE(t), MTRIG_GREET) && CAN_SEE(ch, actor)) ||
|
||||||
IS_SET(GET_TRIG_TYPE(t), MTRIG_GREET_ALL)) &&
|
IS_SET(GET_TRIG_TYPE(t), MTRIG_GREET_ALL)) &&
|
||||||
!GET_TRIG_DEPTH(t) && (rand_number(1, 100) <= GET_TRIG_NARG(t))) {
|
!GET_TRIG_DEPTH(t) && (rand_number(1, 100) <= GET_TRIG_NARG(t))) {
|
||||||
if (dir>=0 && dir < NUM_OF_DIRS)
|
if (dir>=0 && dir < NUM_OF_DIRS)
|
||||||
add_var(&GET_TRIG_VARS(t), "direction", (char *)dirs[rev_dir[dir]], 0);
|
add_var(&GET_TRIG_VARS(t), "direction", (char *)dirs[rev_dir[dir]], 0);
|
||||||
|
|
@ -302,10 +302,10 @@ void entry_memory_mtrigger(char_data *ch)
|
||||||
int entry_mtrigger(char_data *ch)
|
int entry_mtrigger(char_data *ch)
|
||||||
{
|
{
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
|
|
||||||
if (!SCRIPT_CHECK(ch, MTRIG_ENTRY) || AFF_FLAGGED(ch, AFF_CHARM))
|
if (!SCRIPT_CHECK(ch, MTRIG_ENTRY) || AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||||
if (TRIGGER_CHECK(t, MTRIG_ENTRY) && (rand_number(1, 100) <= GET_TRIG_NARG(t))){
|
if (TRIGGER_CHECK(t, MTRIG_ENTRY) && (rand_number(1, 100) <= GET_TRIG_NARG(t))){
|
||||||
return script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);
|
return script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);
|
||||||
|
|
@ -325,7 +325,7 @@ int command_mtrigger(char_data *actor, char *cmd, char *argument)
|
||||||
/* prevent people we like from becoming trapped :P */
|
/* prevent people we like from becoming trapped :P */
|
||||||
if (!valid_dg_target(actor, 0))
|
if (!valid_dg_target(actor, 0))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (ch = world[IN_ROOM(actor)].people; ch; ch = ch_next) {
|
for (ch = world[IN_ROOM(actor)].people; ch; ch = ch_next) {
|
||||||
ch_next = ch->next_in_room;
|
ch_next = ch->next_in_room;
|
||||||
|
|
||||||
|
|
@ -334,7 +334,7 @@ int command_mtrigger(char_data *actor, char *cmd, char *argument)
|
||||||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||||
if (!TRIGGER_CHECK(t, MTRIG_COMMAND))
|
if (!TRIGGER_CHECK(t, MTRIG_COMMAND))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (!GET_TRIG_ARG(t) || !*GET_TRIG_ARG(t)) {
|
if (!GET_TRIG_ARG(t) || !*GET_TRIG_ARG(t)) {
|
||||||
mudlog(NRM, LVL_BUILDER, TRUE, "SYSERR: Command Trigger #%d has no text argument!",
|
mudlog(NRM, LVL_BUILDER, TRUE, "SYSERR: Command Trigger #%d has no text argument!",
|
||||||
GET_TRIG_VNUM(t));
|
GET_TRIG_VNUM(t));
|
||||||
|
|
@ -348,7 +348,7 @@ int command_mtrigger(char_data *actor, char *cmd, char *argument)
|
||||||
add_var(&GET_TRIG_VARS(t), "arg", argument, 0);
|
add_var(&GET_TRIG_VARS(t), "arg", argument, 0);
|
||||||
skip_spaces(&cmd);
|
skip_spaces(&cmd);
|
||||||
add_var(&GET_TRIG_VARS(t), "cmd", cmd, 0);
|
add_var(&GET_TRIG_VARS(t), "cmd", cmd, 0);
|
||||||
|
|
||||||
if (script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW))
|
if (script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW))
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
@ -358,7 +358,7 @@ int command_mtrigger(char_data *actor, char *cmd, char *argument)
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void speech_mtrigger(char_data *actor, char *str)
|
void speech_mtrigger(char_data *actor, char *str)
|
||||||
{
|
{
|
||||||
|
|
@ -394,13 +394,13 @@ void speech_mtrigger(char_data *actor, char *str)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void act_mtrigger(const char_data *ch, char *str, char_data *actor,
|
void act_mtrigger(const char_data *ch, char *str, char_data *actor,
|
||||||
char_data *victim, obj_data *object,
|
char_data *victim, obj_data *object,
|
||||||
obj_data *target, char *arg)
|
obj_data *target, char *arg)
|
||||||
{
|
{
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
if (SCRIPT_CHECK(ch, MTRIG_ACT) && !AFF_FLAGGED(ch, AFF_CHARM) &&
|
if (SCRIPT_CHECK(ch, MTRIG_ACT) && !AFF_FLAGGED(ch, AFF_CHARM) &&
|
||||||
(actor!=ch))
|
(actor!=ch))
|
||||||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||||
|
|
@ -430,10 +430,10 @@ void act_mtrigger(const char_data *ch, char *str, char_data *actor,
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
add_var(&GET_TRIG_VARS(t), "arg", nstr, 0);
|
add_var(&GET_TRIG_VARS(t), "arg", nstr, 0);
|
||||||
free(fstr);
|
free(fstr);
|
||||||
}
|
}
|
||||||
script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);
|
script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -443,11 +443,11 @@ void fight_mtrigger(char_data *ch)
|
||||||
struct char_data *actor;
|
struct char_data *actor;
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
if (!SCRIPT_CHECK(ch, MTRIG_FIGHT) || !FIGHTING(ch) ||
|
if (!SCRIPT_CHECK(ch, MTRIG_FIGHT) || !FIGHTING(ch) ||
|
||||||
AFF_FLAGGED(ch, AFF_CHARM))
|
AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||||
if (TRIGGER_CHECK(t, MTRIG_FIGHT) &&
|
if (TRIGGER_CHECK(t, MTRIG_FIGHT) &&
|
||||||
(rand_number(1, 100) <= GET_TRIG_NARG(t))){
|
(rand_number(1, 100) <= GET_TRIG_NARG(t))){
|
||||||
|
|
@ -456,7 +456,7 @@ void fight_mtrigger(char_data *ch)
|
||||||
ADD_UID_VAR(buf, t, actor, "actor", 0);
|
ADD_UID_VAR(buf, t, actor, "actor", 0);
|
||||||
else
|
else
|
||||||
add_var(&GET_TRIG_VARS(t), "actor", "nobody", 0);
|
add_var(&GET_TRIG_VARS(t), "actor", "nobody", 0);
|
||||||
|
|
||||||
script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);
|
script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -469,11 +469,11 @@ void hitprcnt_mtrigger(char_data *ch)
|
||||||
struct char_data *actor;
|
struct char_data *actor;
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
if (!SCRIPT_CHECK(ch, MTRIG_HITPRCNT) || !FIGHTING(ch) ||
|
if (!SCRIPT_CHECK(ch, MTRIG_HITPRCNT) || !FIGHTING(ch) ||
|
||||||
AFF_FLAGGED(ch, AFF_CHARM))
|
AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||||
if (TRIGGER_CHECK(t, MTRIG_HITPRCNT) && GET_MAX_HIT(ch) &&
|
if (TRIGGER_CHECK(t, MTRIG_HITPRCNT) && GET_MAX_HIT(ch) &&
|
||||||
(((GET_HIT(ch) * 100) / GET_MAX_HIT(ch)) <= GET_TRIG_NARG(t))) {
|
(((GET_HIT(ch) * 100) / GET_MAX_HIT(ch)) <= GET_TRIG_NARG(t))) {
|
||||||
|
|
@ -492,10 +492,10 @@ int receive_mtrigger(char_data *ch, char_data *actor, obj_data *obj)
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
int ret_val;
|
int ret_val;
|
||||||
|
|
||||||
if (!SCRIPT_CHECK(ch, MTRIG_RECEIVE) || AFF_FLAGGED(ch, AFF_CHARM))
|
if (!SCRIPT_CHECK(ch, MTRIG_RECEIVE) || AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||||
if (TRIGGER_CHECK(t, MTRIG_RECEIVE) &&
|
if (TRIGGER_CHECK(t, MTRIG_RECEIVE) &&
|
||||||
(rand_number(1, 100) <= GET_TRIG_NARG(t))){
|
(rand_number(1, 100) <= GET_TRIG_NARG(t))){
|
||||||
|
|
@ -518,10 +518,10 @@ int death_mtrigger(char_data *ch, char_data *actor)
|
||||||
{
|
{
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
if (!SCRIPT_CHECK(ch, MTRIG_DEATH) || AFF_FLAGGED(ch, AFF_CHARM))
|
if (!SCRIPT_CHECK(ch, MTRIG_DEATH) || AFF_FLAGGED(ch, AFF_CHARM))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||||
if (TRIGGER_CHECK(t, MTRIG_DEATH) &&
|
if (TRIGGER_CHECK(t, MTRIG_DEATH) &&
|
||||||
(rand_number(1, 100) <= GET_TRIG_NARG(t))){
|
(rand_number(1, 100) <= GET_TRIG_NARG(t))){
|
||||||
|
|
@ -538,12 +538,12 @@ void load_mtrigger(char_data *ch)
|
||||||
{
|
{
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
if (!SCRIPT_CHECK(ch, MTRIG_LOAD))
|
if (!SCRIPT_CHECK(ch, MTRIG_LOAD))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||||
if (TRIGGER_CHECK(t, MTRIG_LOAD) &&
|
if (TRIGGER_CHECK(t, MTRIG_LOAD) &&
|
||||||
(rand_number(1, 100) <= GET_TRIG_NARG(t))) {
|
(rand_number(1, 100) <= GET_TRIG_NARG(t))) {
|
||||||
result = script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);
|
result = script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);
|
||||||
break;
|
break;
|
||||||
|
|
@ -654,7 +654,7 @@ void time_mtrigger(char_data *ch)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||||
if (TRIGGER_CHECK(t, MTRIG_TIME) &&
|
if (TRIGGER_CHECK(t, MTRIG_TIME) &&
|
||||||
(time_info.hours == GET_TRIG_NARG(t))) {
|
(time_info.hours == GET_TRIG_NARG(t))) {
|
||||||
sprintf(buf, "%d", time_info.hours);
|
sprintf(buf, "%d", time_info.hours);
|
||||||
add_var(&GET_TRIG_VARS(t), "time", buf, 0);
|
add_var(&GET_TRIG_VARS(t), "time", buf, 0);
|
||||||
|
|
@ -676,7 +676,7 @@ void random_otrigger(obj_data *obj)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (t = TRIGGERS(SCRIPT(obj)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(obj)); t; t = t->next) {
|
||||||
if (TRIGGER_CHECK(t, OTRIG_RANDOM) &&
|
if (TRIGGER_CHECK(t, OTRIG_RANDOM) &&
|
||||||
(rand_number(1, 100) <= GET_TRIG_NARG(t))) {
|
(rand_number(1, 100) <= GET_TRIG_NARG(t))) {
|
||||||
script_driver(&obj, t, OBJ_TRIGGER, TRIG_NEW);
|
script_driver(&obj, t, OBJ_TRIGGER, TRIG_NEW);
|
||||||
break;
|
break;
|
||||||
|
|
@ -688,16 +688,16 @@ void random_otrigger(obj_data *obj)
|
||||||
void timer_otrigger(struct obj_data *obj)
|
void timer_otrigger(struct obj_data *obj)
|
||||||
{
|
{
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
|
|
||||||
if (!SCRIPT_CHECK(obj, OTRIG_TIMER))
|
if (!SCRIPT_CHECK(obj, OTRIG_TIMER))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (t = TRIGGERS(SCRIPT(obj)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(obj)); t; t = t->next) {
|
||||||
if (TRIGGER_CHECK(t, OTRIG_TIMER)) {
|
if (TRIGGER_CHECK(t, OTRIG_TIMER)) {
|
||||||
script_driver(&obj, t, OBJ_TRIGGER, TRIG_NEW);
|
script_driver(&obj, t, OBJ_TRIGGER, TRIG_NEW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -735,19 +735,19 @@ int cmd_otrig(obj_data *obj, char_data *actor, char *cmd,
|
||||||
{
|
{
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
if (obj && SCRIPT_CHECK(obj, OTRIG_COMMAND))
|
if (obj && SCRIPT_CHECK(obj, OTRIG_COMMAND))
|
||||||
for (t = TRIGGERS(SCRIPT(obj)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(obj)); t; t = t->next) {
|
||||||
if (!TRIGGER_CHECK(t, OTRIG_COMMAND))
|
if (!TRIGGER_CHECK(t, OTRIG_COMMAND))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (IS_SET(GET_TRIG_NARG(t), type) &&
|
if (IS_SET(GET_TRIG_NARG(t), type) &&
|
||||||
(!GET_TRIG_ARG(t) || !*GET_TRIG_ARG(t))) {
|
(!GET_TRIG_ARG(t) || !*GET_TRIG_ARG(t))) {
|
||||||
mudlog(NRM, LVL_BUILDER, TRUE, "SYSERR: O-Command Trigger #%d has no text argument!",
|
mudlog(NRM, LVL_BUILDER, TRUE, "SYSERR: O-Command Trigger #%d has no text argument!",
|
||||||
GET_TRIG_VNUM(t));
|
GET_TRIG_VNUM(t));
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_SET(GET_TRIG_NARG(t), type) &&
|
if (IS_SET(GET_TRIG_NARG(t), type) &&
|
||||||
(*GET_TRIG_ARG(t)=='*' ||
|
(*GET_TRIG_ARG(t)=='*' ||
|
||||||
!strn_cmp(GET_TRIG_ARG(t), cmd, strlen(GET_TRIG_ARG(t))))) {
|
!strn_cmp(GET_TRIG_ARG(t), cmd, strlen(GET_TRIG_ARG(t))))) {
|
||||||
|
|
@ -775,12 +775,12 @@ int command_otrigger(char_data *actor, char *cmd, char *argument)
|
||||||
/* prevent people we like from becoming trapped :P */
|
/* prevent people we like from becoming trapped :P */
|
||||||
if (!valid_dg_target(actor, 0))
|
if (!valid_dg_target(actor, 0))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < NUM_WEARS; i++)
|
for (i = 0; i < NUM_WEARS; i++)
|
||||||
if (GET_EQ(actor, i))
|
if (GET_EQ(actor, i))
|
||||||
if (cmd_otrig(GET_EQ(actor, i), actor, cmd, argument, OCMD_EQUIP))
|
if (cmd_otrig(GET_EQ(actor, i), actor, cmd, argument, OCMD_EQUIP))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (obj = actor->carrying; obj; obj = obj->next_content)
|
for (obj = actor->carrying; obj; obj = obj->next_content)
|
||||||
if (cmd_otrig(obj, actor, cmd, argument, OCMD_INVEN))
|
if (cmd_otrig(obj, actor, cmd, argument, OCMD_INVEN))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
@ -798,7 +798,7 @@ int wear_otrigger(obj_data *obj, char_data *actor, int where)
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
int ret_val;
|
int ret_val;
|
||||||
|
|
||||||
if (!SCRIPT_CHECK(obj, OTRIG_WEAR))
|
if (!SCRIPT_CHECK(obj, OTRIG_WEAR))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
@ -825,7 +825,7 @@ int remove_otrigger(obj_data *obj, char_data *actor)
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
int ret_val;
|
int ret_val;
|
||||||
|
|
||||||
if (!SCRIPT_CHECK(obj, OTRIG_REMOVE))
|
if (!SCRIPT_CHECK(obj, OTRIG_REMOVE))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
@ -852,7 +852,7 @@ int drop_otrigger(obj_data *obj, char_data *actor)
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
int ret_val;
|
int ret_val;
|
||||||
|
|
||||||
if (!SCRIPT_CHECK(obj, OTRIG_DROP))
|
if (!SCRIPT_CHECK(obj, OTRIG_DROP))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
@ -879,7 +879,7 @@ int give_otrigger(obj_data *obj, char_data *actor, char_data *victim)
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
int ret_val;
|
int ret_val;
|
||||||
|
|
||||||
if (!SCRIPT_CHECK(obj, OTRIG_GIVE))
|
if (!SCRIPT_CHECK(obj, OTRIG_GIVE))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
@ -906,12 +906,12 @@ void load_otrigger(obj_data *obj)
|
||||||
{
|
{
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
|
||||||
if (!SCRIPT_CHECK(obj, OTRIG_LOAD))
|
if (!SCRIPT_CHECK(obj, OTRIG_LOAD))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (t = TRIGGERS(SCRIPT(obj)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(obj)); t; t = t->next) {
|
||||||
if (TRIGGER_CHECK(t, OTRIG_LOAD) &&
|
if (TRIGGER_CHECK(t, OTRIG_LOAD) &&
|
||||||
(rand_number(1, 100) <= GET_TRIG_NARG(t))) {
|
(rand_number(1, 100) <= GET_TRIG_NARG(t))) {
|
||||||
result = script_driver(&obj, t, OBJ_TRIGGER, TRIG_NEW);
|
result = script_driver(&obj, t, OBJ_TRIGGER, TRIG_NEW);
|
||||||
break;
|
break;
|
||||||
|
|
@ -960,7 +960,7 @@ int leave_otrigger(room_data *room, char_data *actor, int dir)
|
||||||
|
|
||||||
if (!valid_dg_target(actor, DG_ALLOW_GODS))
|
if (!valid_dg_target(actor, DG_ALLOW_GODS))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (obj = room->contents; obj; obj = obj_next) {
|
for (obj = room->contents; obj; obj = obj_next) {
|
||||||
obj_next = obj->next_content;
|
obj_next = obj->next_content;
|
||||||
if (!SCRIPT_CHECK(obj, OTRIG_LEAVE))
|
if (!SCRIPT_CHECK(obj, OTRIG_LEAVE))
|
||||||
|
|
@ -980,7 +980,7 @@ int leave_otrigger(room_data *room, char_data *actor, int dir)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return final;
|
return final;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -989,7 +989,7 @@ int consume_otrigger(obj_data *obj, char_data *actor, int cmd)
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
int ret_val;
|
int ret_val;
|
||||||
|
|
||||||
if (!SCRIPT_CHECK(obj, OTRIG_CONSUME))
|
if (!SCRIPT_CHECK(obj, OTRIG_CONSUME))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
|
|
@ -1030,7 +1030,7 @@ void time_otrigger(obj_data *obj)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (t = TRIGGERS(SCRIPT(obj)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(obj)); t; t = t->next) {
|
||||||
if (TRIGGER_CHECK(t, OTRIG_TIME) &&
|
if (TRIGGER_CHECK(t, OTRIG_TIME) &&
|
||||||
(time_info.hours == GET_TRIG_NARG(t))) {
|
(time_info.hours == GET_TRIG_NARG(t))) {
|
||||||
sprintf(buf, "%d", time_info.hours);
|
sprintf(buf, "%d", time_info.hours);
|
||||||
add_var(&GET_TRIG_VARS(t), "time", buf, 0);
|
add_var(&GET_TRIG_VARS(t), "time", buf, 0);
|
||||||
|
|
@ -1086,7 +1086,7 @@ int enter_wtrigger(struct room_data *room, char_data *actor, int dir)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
for (t = TRIGGERS(SCRIPT(room)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(room)); t; t = t->next) {
|
||||||
if (TRIGGER_CHECK(t, WTRIG_ENTER) &&
|
if (TRIGGER_CHECK(t, WTRIG_ENTER) &&
|
||||||
(rand_number(1, 100) <= GET_TRIG_NARG(t))) {
|
(rand_number(1, 100) <= GET_TRIG_NARG(t))) {
|
||||||
if (dir>=0 && dir < NUM_OF_DIRS)
|
if (dir>=0 && dir < NUM_OF_DIRS)
|
||||||
add_var(&GET_TRIG_VARS(t), "direction", (char *)dirs[rev_dir[dir]], 0);
|
add_var(&GET_TRIG_VARS(t), "direction", (char *)dirs[rev_dir[dir]], 0);
|
||||||
|
|
@ -1113,7 +1113,7 @@ int command_wtrigger(char_data *actor, char *cmd, char *argument)
|
||||||
/* prevent people we like from becoming trapped :P */
|
/* prevent people we like from becoming trapped :P */
|
||||||
if (!valid_dg_target(actor, 0))
|
if (!valid_dg_target(actor, 0))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
room = &world[IN_ROOM(actor)];
|
room = &world[IN_ROOM(actor)];
|
||||||
for (t = TRIGGERS(SCRIPT(room)); t; t = t->next) {
|
for (t = TRIGGERS(SCRIPT(room)); t; t = t->next) {
|
||||||
if (!TRIGGER_CHECK(t, WTRIG_COMMAND))
|
if (!TRIGGER_CHECK(t, WTRIG_COMMAND))
|
||||||
|
|
@ -1132,11 +1132,11 @@ int command_wtrigger(char_data *actor, char *cmd, char *argument)
|
||||||
add_var(&GET_TRIG_VARS(t), "arg", argument, 0);
|
add_var(&GET_TRIG_VARS(t), "arg", argument, 0);
|
||||||
skip_spaces(&cmd);
|
skip_spaces(&cmd);
|
||||||
add_var(&GET_TRIG_VARS(t), "cmd", cmd, 0);
|
add_var(&GET_TRIG_VARS(t), "cmd", cmd, 0);
|
||||||
|
|
||||||
return script_driver(&room, t, WLD_TRIGGER, TRIG_NEW);
|
return script_driver(&room, t, WLD_TRIGGER, TRIG_NEW);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1178,14 +1178,14 @@ int drop_wtrigger(obj_data *obj, char_data *actor)
|
||||||
trig_data *t;
|
trig_data *t;
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
int ret_val;
|
int ret_val;
|
||||||
|
|
||||||
if (!actor || !SCRIPT_CHECK(&world[IN_ROOM(actor)], WTRIG_DROP))
|
if (!actor || !SCRIPT_CHECK(&world[IN_ROOM(actor)], WTRIG_DROP))
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
room = &world[IN_ROOM(actor)];
|
room = &world[IN_ROOM(actor)];
|
||||||
for (t = TRIGGERS(SCRIPT(room)); t; t = t->next)
|
for (t = TRIGGERS(SCRIPT(room)); t; t = t->next)
|
||||||
if (TRIGGER_CHECK(t, WTRIG_DROP) &&
|
if (TRIGGER_CHECK(t, WTRIG_DROP) &&
|
||||||
(rand_number(1, 100) <= GET_TRIG_NARG(t))) {
|
(rand_number(1, 100) <= GET_TRIG_NARG(t))) {
|
||||||
ADD_UID_VAR(buf, t, actor, "actor", 0);
|
ADD_UID_VAR(buf, t, actor, "actor", 0);
|
||||||
ADD_UID_VAR(buf, t, obj, "object", 0);
|
ADD_UID_VAR(buf, t, obj, "object", 0);
|
||||||
ret_val = script_driver(&room, t, WLD_TRIGGER, TRIG_NEW);
|
ret_val = script_driver(&room, t, WLD_TRIGGER, TRIG_NEW);
|
||||||
|
|
@ -1194,7 +1194,7 @@ int drop_wtrigger(obj_data *obj, char_data *actor)
|
||||||
else
|
else
|
||||||
return ret_val;
|
return ret_val;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -4,14 +4,14 @@
|
||||||
* *
|
* *
|
||||||
* *
|
* *
|
||||||
* $Author: Mark A. Heilpern/egreen/Welcor $ *
|
* $Author: Mark A. Heilpern/egreen/Welcor $ *
|
||||||
* $Date: 2004/10/11 12:07:00 $ *
|
* $Date: 2004/10/11 12:07:00 $ *
|
||||||
* $Revision: 1.0.14 $ *
|
* $Revision: 1.0.14 $ *
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "sysdep.h"
|
#include "sysdep.h"
|
||||||
|
|
||||||
|
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include "dg_scripts.h"
|
#include "dg_scripts.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
|
|
@ -32,19 +32,19 @@ extern struct time_info_data time_info;
|
||||||
/* Utility functions */
|
/* Utility functions */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Thanks to James Long for his assistance in plugging the memory leak
|
* Thanks to James Long for his assistance in plugging the memory leak
|
||||||
* that used to be here. -- Welcor
|
* that used to be here. -- Welcor
|
||||||
*/
|
*/
|
||||||
/* adds a variable with given name and value to trigger */
|
/* adds a variable with given name and value to trigger */
|
||||||
void add_var(struct trig_var_data **var_list, char *name, char *value, long id)
|
void add_var(struct trig_var_data **var_list, char *name, char *value, long id)
|
||||||
{
|
{
|
||||||
struct trig_var_data *vd;
|
struct trig_var_data *vd;
|
||||||
|
|
||||||
if (strchr(name, '.')) {
|
if (strchr(name, '.')) {
|
||||||
log("add_var() : Attempt to add illegal var: %s", name);
|
log("add_var() : Attempt to add illegal var: %s", name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (vd = *var_list; vd && str_cmp(vd->name, name); vd = vd->next);
|
for (vd = *var_list; vd && str_cmp(vd->name, name); vd = vd->next);
|
||||||
|
|
||||||
if (vd && (!vd->context || vd->context==id)) {
|
if (vd && (!vd->context || vd->context==id)) {
|
||||||
|
|
@ -54,10 +54,10 @@ void add_var(struct trig_var_data **var_list, char *name, char *value, long id)
|
||||||
|
|
||||||
else {
|
else {
|
||||||
CREATE(vd, struct trig_var_data, 1);
|
CREATE(vd, struct trig_var_data, 1);
|
||||||
|
|
||||||
CREATE(vd->name, char, strlen(name) + 1);
|
CREATE(vd->name, char, strlen(name) + 1);
|
||||||
strcpy(vd->name, name); /* strcpy: ok*/
|
strcpy(vd->name, name); /* strcpy: ok*/
|
||||||
|
|
||||||
CREATE(vd->value, char, strlen(value) + 1);
|
CREATE(vd->value, char, strlen(value) + 1);
|
||||||
|
|
||||||
vd->next = *var_list;
|
vd->next = *var_list;
|
||||||
|
|
@ -82,20 +82,20 @@ char *skill_percent(struct char_data *ch, char *skill)
|
||||||
return retval;
|
return retval;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
search through all the persons items, including containers
|
search through all the persons items, including containers
|
||||||
and 0 if it doesnt exist, and greater then 0 if it does!
|
and 0 if it doesnt exist, and greater then 0 if it does!
|
||||||
Jamie Nelson (mordecai@timespace.co.nz)
|
Jamie Nelson (mordecai@timespace.co.nz)
|
||||||
MUD -- 4dimensions.org:6000
|
MUD -- 4dimensions.org:6000
|
||||||
|
|
||||||
Now also searches by vnum -- Welcor
|
Now also searches by vnum -- Welcor
|
||||||
Now returns the number of matching objects -- Welcor 02/04
|
Now returns the number of matching objects -- Welcor 02/04
|
||||||
*/
|
*/
|
||||||
|
|
||||||
int item_in_list(char *item, obj_data *list)
|
int item_in_list(char *item, obj_data *list)
|
||||||
{
|
{
|
||||||
obj_data *i;
|
obj_data *i;
|
||||||
int count = 0;
|
int count = 0;
|
||||||
|
|
||||||
if (!item || !*item)
|
if (!item || !*item)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -104,35 +104,35 @@ int item_in_list(char *item, obj_data *list)
|
||||||
long id = atol(item + 1);
|
long id = atol(item + 1);
|
||||||
|
|
||||||
for (i = list; i; i = i->next_content) {
|
for (i = list; i; i = i->next_content) {
|
||||||
if (id == GET_ID(i))
|
if (id == GET_ID(i))
|
||||||
count ++;
|
count ++;
|
||||||
if (GET_OBJ_TYPE(i) == ITEM_CONTAINER)
|
if (GET_OBJ_TYPE(i) == ITEM_CONTAINER)
|
||||||
count += item_in_list(item, i->contains);
|
count += item_in_list(item, i->contains);
|
||||||
}
|
}
|
||||||
} else if (is_number(item)) { /* check for vnum */
|
} else if (is_number(item)) { /* check for vnum */
|
||||||
obj_vnum ovnum = atoi(item);
|
obj_vnum ovnum = atoi(item);
|
||||||
|
|
||||||
for (i = list; i; i = i->next_content) {
|
for (i = list; i; i = i->next_content) {
|
||||||
if (GET_OBJ_VNUM(i) == ovnum)
|
if (GET_OBJ_VNUM(i) == ovnum)
|
||||||
count++;
|
count++;
|
||||||
if (GET_OBJ_TYPE(i) == ITEM_CONTAINER)
|
if (GET_OBJ_TYPE(i) == ITEM_CONTAINER)
|
||||||
count += item_in_list(item, i->contains);
|
count += item_in_list(item, i->contains);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (i = list; i; i = i->next_content) {
|
for (i = list; i; i = i->next_content) {
|
||||||
if (isname(item, i->name))
|
if (isname(item, i->name))
|
||||||
count++;
|
count++;
|
||||||
if (GET_OBJ_TYPE(i) == ITEM_CONTAINER)
|
if (GET_OBJ_TYPE(i) == ITEM_CONTAINER)
|
||||||
count += item_in_list(item, i->contains);
|
count += item_in_list(item, i->contains);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
BOOLEAN return, just check if a player or mob
|
BOOLEAN return, just check if a player or mob
|
||||||
has an item of any sort, searched for by name
|
has an item of any sort, searched for by name
|
||||||
or id.
|
or id.
|
||||||
searching equipment as well as inventory,
|
searching equipment as well as inventory,
|
||||||
and containers.
|
and containers.
|
||||||
Jamie Nelson (mordecai@timespace.co.nz)
|
Jamie Nelson (mordecai@timespace.co.nz)
|
||||||
|
|
@ -143,8 +143,8 @@ int char_has_item(char *item, struct char_data *ch)
|
||||||
{
|
{
|
||||||
|
|
||||||
/* If this works, no more searching needed */
|
/* If this works, no more searching needed */
|
||||||
if (get_object_in_equip(ch, item) != NULL)
|
if (get_object_in_equip(ch, item) != NULL)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
if (item_in_list(item, ch->carrying) == 0)
|
if (item_in_list(item, ch->carrying) == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
@ -157,17 +157,17 @@ int text_processed(char *field, char *subfield, struct trig_var_data *vd,
|
||||||
{
|
{
|
||||||
char *p, *p2;
|
char *p, *p2;
|
||||||
char tmpvar[MAX_STRING_LENGTH];
|
char tmpvar[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
if (!str_cmp(field, "strlen")) { /* strlen */
|
if (!str_cmp(field, "strlen")) { /* strlen */
|
||||||
snprintf(str, slen, "%d", strlen(vd->value));
|
snprintf(str, slen, "%d", strlen(vd->value));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (!str_cmp(field, "trim")) { /* trim */
|
} else if (!str_cmp(field, "trim")) { /* trim */
|
||||||
/* trim whitespace from ends */
|
/* trim whitespace from ends */
|
||||||
snprintf(tmpvar, sizeof(tmpvar)-1 , "%s", vd->value); /* -1 to use later*/
|
snprintf(tmpvar, sizeof(tmpvar)-1 , "%s", vd->value); /* -1 to use later*/
|
||||||
p = tmpvar;
|
p = tmpvar;
|
||||||
p2 = tmpvar + strlen(tmpvar) - 1;
|
p2 = tmpvar + strlen(tmpvar) - 1;
|
||||||
while (*p && isspace(*p)) p++;
|
while (*p && isspace(*p)) p++;
|
||||||
while ((p<=p2) && isspace(*p2)) p2--;
|
while ((p<=p2) && isspace(*p2)) p2--;
|
||||||
if (p>p2) { /* nothing left */
|
if (p>p2) { /* nothing left */
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
@ -178,7 +178,7 @@ int text_processed(char *field, char *subfield, struct trig_var_data *vd,
|
||||||
} else if (!str_cmp(field, "contains")) { /* contains */
|
} else if (!str_cmp(field, "contains")) { /* contains */
|
||||||
if (str_str(vd->value, subfield))
|
if (str_str(vd->value, subfield))
|
||||||
strcpy(str, "1");
|
strcpy(str, "1");
|
||||||
else
|
else
|
||||||
strcpy(str, "0");
|
strcpy(str, "0");
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (!str_cmp(field, "car")) { /* car */
|
} else if (!str_cmp(field, "car")) { /* car */
|
||||||
|
|
@ -187,7 +187,7 @@ int text_processed(char *field, char *subfield, struct trig_var_data *vd,
|
||||||
*str++ = *car++;
|
*str++ = *car++;
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
} else if (!str_cmp(field, "cdr")) { /* cdr */
|
} else if (!str_cmp(field, "cdr")) { /* cdr */
|
||||||
char *cdr = vd->value;
|
char *cdr = vd->value;
|
||||||
while (*cdr && !isspace(*cdr)) cdr++; /* skip 1st field */
|
while (*cdr && !isspace(*cdr)) cdr++; /* skip 1st field */
|
||||||
|
|
@ -200,7 +200,7 @@ int text_processed(char *field, char *subfield, struct trig_var_data *vd,
|
||||||
if (index > len || index < 1)
|
if (index > len || index < 1)
|
||||||
strcpy(str, "");
|
strcpy(str, "");
|
||||||
else
|
else
|
||||||
snprintf(str, slen, "%c", vd->value[index - 1]);
|
snprintf(str, slen, "%c", vd->value[index - 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 */
|
||||||
|
|
@ -214,9 +214,9 @@ int text_processed(char *field, char *subfield, struct trig_var_data *vd,
|
||||||
if (!strncmp(cmd_info[cmd].command, vd->value, length))
|
if (!strncmp(cmd_info[cmd].command, vd->value, length))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (*cmd_info[cmd].command == '\n')
|
if (*cmd_info[cmd].command == '\n')
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
else
|
else
|
||||||
snprintf(str, slen, "%s", cmd_info[cmd].command);
|
snprintf(str, slen, "%s", cmd_info[cmd].command);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -254,19 +254,19 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
||||||
char *recho[] = {"mrecho ", "orecho ", "wrecho " };
|
char *recho[] = {"mrecho ", "orecho ", "wrecho " };
|
||||||
|
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
|
|
||||||
/* X.global() will have a NULL trig */
|
/* X.global() will have a NULL trig */
|
||||||
if (trig)
|
if (trig)
|
||||||
for (vd = GET_TRIG_VARS(trig); vd; vd = vd->next)
|
for (vd = GET_TRIG_VARS(trig); vd; vd = vd->next)
|
||||||
if (!str_cmp(vd->name, var))
|
if (!str_cmp(vd->name, var))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* some evil waitstates could crash the mud if sent here with sc==NULL*/
|
/* some evil waitstates could crash the mud if sent here with sc==NULL*/
|
||||||
if (!vd && sc)
|
if (!vd && sc)
|
||||||
for (vd = sc->global_vars; vd; vd = vd->next)
|
for (vd = sc->global_vars; vd; vd = vd->next)
|
||||||
if (!str_cmp(vd->name, var) &&
|
if (!str_cmp(vd->name, var) &&
|
||||||
(vd->context==0 || vd->context==sc->context))
|
(vd->context==0 || vd->context==sc->context))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (!*field) {
|
if (!*field) {
|
||||||
if (vd)
|
if (vd)
|
||||||
|
|
@ -285,7 +285,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!str_cmp(var, "global")) {
|
else if (!str_cmp(var, "global")) {
|
||||||
/* so "remote varname %global%" will work */
|
/* so "remote varname %global%" will work */
|
||||||
snprintf(str, slen, "%d", ROOM_ID_BASE);
|
snprintf(str, slen, "%d", ROOM_ID_BASE);
|
||||||
return;
|
return;
|
||||||
|
|
@ -367,7 +367,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
||||||
case MOB_TRIGGER:
|
case MOB_TRIGGER:
|
||||||
c = (char_data *) go;
|
c = (char_data *) go;
|
||||||
r = NULL;
|
r = NULL;
|
||||||
o = NULL; /* NULL assignments added to avoid self to always be */
|
o = NULL; /* NULL assignments added to avoid self to always be */
|
||||||
break; /* the room. - Welcor */
|
break; /* the room. - Welcor */
|
||||||
case OBJ_TRIGGER:
|
case OBJ_TRIGGER:
|
||||||
o = (obj_data *) go;
|
o = (obj_data *) go;
|
||||||
|
|
@ -381,7 +381,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!str_cmp(var, "global")) {
|
else if (!str_cmp(var, "global")) {
|
||||||
struct script_data *thescript = SCRIPT(&world[0]);
|
struct script_data *thescript = SCRIPT(&world[0]);
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
|
|
@ -391,15 +391,15 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
||||||
}
|
}
|
||||||
for (vd = thescript->global_vars; vd ; vd = vd->next)
|
for (vd = thescript->global_vars; vd ; vd = vd->next)
|
||||||
if (!str_cmp(vd->name, field))
|
if (!str_cmp(vd->name, field))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (vd)
|
if (vd)
|
||||||
snprintf(str, slen, "%s", vd->value);
|
snprintf(str, slen, "%s", vd->value);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (!str_cmp(var, "people")) {
|
else if (!str_cmp(var, "people")) {
|
||||||
snprintf(str, slen, "%d",((num = atoi(field)) > 0) ? trgvar_in_room(num) : 0);
|
snprintf(str, slen, "%d",((num = atoi(field)) > 0) ? trgvar_in_room(num) : 0);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else if (!str_cmp(var, "time")) {
|
else if (!str_cmp(var, "time")) {
|
||||||
|
|
@ -416,9 +416,9 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
|
||||||
%findobj.<room vnum X>(<object vnum/id/name>)%
|
%findobj.<room vnum X>(<object vnum/id/name>)%
|
||||||
- count number of objects in room X with this name/id/vnum
|
- count number of objects in room X with this name/id/vnum
|
||||||
%findmob.<room vnum X>(<mob vnum Y>)%
|
%findmob.<room vnum X>(<mob vnum Y>)%
|
||||||
- count number of mobs in room X with vnum Y
|
- count number of mobs in room X with vnum Y
|
||||||
|
|
||||||
for example you want to check how many PC's are in room with vnum 1204.
|
for example you want to check how many PC's are in room with vnum 1204.
|
||||||
|
|
@ -427,10 +427,10 @@ you would type:
|
||||||
in any script:
|
in any script:
|
||||||
%echo% players in room 1204: %findmob.1204(-1)%
|
%echo% players in room 1204: %findmob.1204(-1)%
|
||||||
|
|
||||||
Or say you had a bank, and you want a script to check the number of
|
Or say you had a bank, and you want a script to check the number of
|
||||||
bags
|
bags
|
||||||
of gold (vnum: 1234)
|
of gold (vnum: 1234)
|
||||||
in the vault (vnum: 453) now and then. you can just use
|
in the vault (vnum: 453) now and then. you can just use
|
||||||
%findobj.453(1234)% and it will return the number of bags of gold.
|
%findobj.453(1234)% and it will return the number of bags of gold.
|
||||||
|
|
||||||
**/
|
**/
|
||||||
|
|
@ -443,7 +443,7 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
} else {
|
} else {
|
||||||
room_rnum rrnum = real_room(atoi(field));
|
room_rnum rrnum = real_room(atoi(field));
|
||||||
mob_vnum mvnum = atoi(subfield);
|
mob_vnum mvnum = atoi(subfield);
|
||||||
|
|
||||||
if (rrnum == NOWHERE) {
|
if (rrnum == NOWHERE) {
|
||||||
script_log("findmob.vnum(ovnum): No room with vnum %d", atoi(field));
|
script_log("findmob.vnum(ovnum): No room with vnum %d", atoi(field));
|
||||||
strcpy(str, "0");
|
strcpy(str, "0");
|
||||||
|
|
@ -463,7 +463,7 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
strcpy(str, "0");
|
strcpy(str, "0");
|
||||||
} else {
|
} else {
|
||||||
room_rnum rrnum = real_room(atoi(field));
|
room_rnum rrnum = real_room(atoi(field));
|
||||||
|
|
||||||
if (rrnum == NOWHERE) {
|
if (rrnum == NOWHERE) {
|
||||||
script_log("findobj.vnum(ovnum): No room with vnum %d", atoi(field));
|
script_log("findobj.vnum(ovnum): No room with vnum %d", atoi(field));
|
||||||
strcpy(str, "0");
|
strcpy(str, "0");
|
||||||
|
|
@ -488,7 +488,7 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (type == OBJ_TRIGGER) {
|
else if (type == OBJ_TRIGGER) {
|
||||||
for (c = world[obj_room((obj_data *) go)].people; c;
|
for (c = world[obj_room((obj_data *) go)].people; c;
|
||||||
c = c->next_in_room)
|
c = c->next_in_room)
|
||||||
|
|
@ -498,18 +498,18 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (type == WLD_TRIGGER) {
|
else if (type == WLD_TRIGGER) {
|
||||||
for (c = ((struct room_data *) go)->people; c;
|
for (c = ((struct room_data *) go)->people; c;
|
||||||
c = c->next_in_room)
|
c = c->next_in_room)
|
||||||
if (valid_dg_target(c, DG_ALLOW_GODS)) {
|
if (valid_dg_target(c, DG_ALLOW_GODS)) {
|
||||||
|
|
||||||
if (!rand_number(0, count))
|
if (!rand_number(0, count))
|
||||||
rndm = c;
|
rndm = c;
|
||||||
count++;
|
count++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (rndm)
|
if (rndm)
|
||||||
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(rndm));
|
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(rndm));
|
||||||
else
|
else
|
||||||
|
|
@ -518,7 +518,7 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
|
|
||||||
else if (!str_cmp(field, "dir")) {
|
else if (!str_cmp(field, "dir")) {
|
||||||
room_rnum in_room = NOWHERE;
|
room_rnum in_room = NOWHERE;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case WLD_TRIGGER:
|
case WLD_TRIGGER:
|
||||||
in_room = real_room(((struct room_data *) go)->number);
|
in_room = real_room(((struct room_data *) go)->number);
|
||||||
|
|
@ -535,10 +535,10 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
} else {
|
} else {
|
||||||
doors = 0;
|
doors = 0;
|
||||||
room = &world[in_room];
|
room = &world[in_room];
|
||||||
for (i = 0; i < NUM_OF_DIRS ; i++)
|
for (i = 0; i < NUM_OF_DIRS ; i++)
|
||||||
if (R_EXIT(room, i))
|
if (R_EXIT(room, i))
|
||||||
doors++;
|
doors++;
|
||||||
|
|
||||||
if (!doors) {
|
if (!doors) {
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -553,11 +553,11 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
snprintf(str, slen, "%d", ((num = atoi(field)) > 0) ? rand_number(1, num) : 0);
|
snprintf(str, slen, "%d", ((num = atoi(field)) > 0) ? rand_number(1, num) : 0);
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c) {
|
if (c) {
|
||||||
if (text_processed(field, subfield, vd, str, slen)) return;
|
if (text_processed(field, subfield, vd, str, slen)) return;
|
||||||
|
|
||||||
|
|
@ -569,7 +569,7 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
}
|
}
|
||||||
/* set str to some 'non-text' first */
|
/* set str to some 'non-text' first */
|
||||||
*str = '\x1';
|
*str = '\x1';
|
||||||
|
|
||||||
switch (LOWER(*field)) {
|
switch (LOWER(*field)) {
|
||||||
case 'a':
|
case 'a':
|
||||||
if (!str_cmp(field, "alias"))
|
if (!str_cmp(field, "alias"))
|
||||||
|
|
@ -588,7 +588,7 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
int spell = find_skill_num(subfield);
|
int spell = find_skill_num(subfield);
|
||||||
if (affected_by_spell(c, spell))
|
if (affected_by_spell(c, spell))
|
||||||
strcpy(str, "1");
|
strcpy(str, "1");
|
||||||
else
|
else
|
||||||
strcpy(str, "0");
|
strcpy(str, "0");
|
||||||
} else
|
} else
|
||||||
strcpy(str, "0");
|
strcpy(str, "0");
|
||||||
|
|
@ -642,7 +642,7 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
if (!str_cmp(field, "exp")) {
|
if (!str_cmp(field, "exp")) {
|
||||||
if (subfield && *subfield) {
|
if (subfield && *subfield) {
|
||||||
int addition = MIN(atoi(subfield), 1000);
|
int addition = MIN(atoi(subfield), 1000);
|
||||||
|
|
||||||
gain_exp(c, addition);
|
gain_exp(c, addition);
|
||||||
}
|
}
|
||||||
snprintf(str, slen, "%d", GET_EXP(c));
|
snprintf(str, slen, "%d", GET_EXP(c));
|
||||||
|
|
@ -654,7 +654,7 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
else if (*subfield == '*') {
|
else if (*subfield == '*') {
|
||||||
for (i = 0, j = 0; i < NUM_WEARS; i++)
|
for (i = 0, j = 0; i < NUM_WEARS; i++)
|
||||||
if (GET_EQ(c, i)) {
|
if (GET_EQ(c, i)) {
|
||||||
j++;
|
j++;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -672,9 +672,9 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
if (!str_cmp(field, "fighting")) {
|
if (!str_cmp(field, "fighting")) {
|
||||||
if (FIGHTING(c))
|
if (FIGHTING(c))
|
||||||
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(FIGHTING(c)));
|
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(FIGHTING(c)));
|
||||||
else
|
else
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
}
|
}
|
||||||
else if (!str_cmp(field, "follower")) {
|
else if (!str_cmp(field, "follower")) {
|
||||||
if (!c->followers || !c->followers->follower)
|
if (!c->followers || !c->followers->follower)
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
|
|
@ -700,10 +700,10 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
}
|
}
|
||||||
else if (!str_cmp(field, "hisher"))
|
else if (!str_cmp(field, "hisher"))
|
||||||
snprintf(str, slen, "%s", HSHR(c));
|
snprintf(str, slen, "%s", HSHR(c));
|
||||||
|
|
||||||
else if (!str_cmp(field, "heshe"))
|
else if (!str_cmp(field, "heshe"))
|
||||||
snprintf(str, slen, "%s", HSSH(c));
|
snprintf(str, slen, "%s", HSSH(c));
|
||||||
|
|
||||||
else if (!str_cmp(field, "himher"))
|
else if (!str_cmp(field, "himher"))
|
||||||
snprintf(str, slen, "%s", HMHR(c));
|
snprintf(str, slen, "%s", HMHR(c));
|
||||||
|
|
||||||
|
|
@ -759,7 +759,7 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
else
|
else
|
||||||
strcpy(str, "0");
|
strcpy(str, "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!str_cmp(field, "is_thief")) {
|
else if (!str_cmp(field, "is_thief")) {
|
||||||
if (subfield && *subfield) {
|
if (subfield && *subfield) {
|
||||||
if (!str_cmp("on", subfield))
|
if (!str_cmp("on", subfield))
|
||||||
|
|
@ -786,7 +786,7 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
if (!str_cmp(field, "level"))
|
if (!str_cmp(field, "level"))
|
||||||
snprintf(str, slen, "%d", GET_LEVEL(c));
|
snprintf(str, slen, "%d", GET_LEVEL(c));
|
||||||
break;
|
break;
|
||||||
case 'm':
|
case 'm':
|
||||||
if (!str_cmp(field, "maxhitp")) {
|
if (!str_cmp(field, "maxhitp")) {
|
||||||
|
|
@ -811,7 +811,7 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
}
|
}
|
||||||
snprintf(str, slen, "%d", GET_MAX_MANA(c));
|
snprintf(str, slen, "%d", GET_MAX_MANA(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!str_cmp(field, "move")) {
|
else if (!str_cmp(field, "move")) {
|
||||||
if (subfield && *subfield) {
|
if (subfield && *subfield) {
|
||||||
int addition = atoi(subfield);
|
int addition = atoi(subfield);
|
||||||
|
|
@ -819,7 +819,7 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
}
|
}
|
||||||
snprintf(str, slen, "%d", GET_MOVE(c));
|
snprintf(str, slen, "%d", GET_MOVE(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!str_cmp(field, "maxmove")) {
|
else if (!str_cmp(field, "maxmove")) {
|
||||||
if (subfield && *subfield) {
|
if (subfield && *subfield) {
|
||||||
int addition = atoi(subfield);
|
int addition = atoi(subfield);
|
||||||
|
|
@ -827,7 +827,7 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
}
|
}
|
||||||
snprintf(str, slen, "%d", GET_MAX_MOVE(c));
|
snprintf(str, slen, "%d", GET_MAX_MOVE(c));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!str_cmp(field, "master")) {
|
else if (!str_cmp(field, "master")) {
|
||||||
if (!c->master)
|
if (!c->master)
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
|
|
@ -842,12 +842,12 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
else if (!str_cmp(field, "next_in_room")) {
|
else if (!str_cmp(field, "next_in_room")) {
|
||||||
if (c->next_in_room)
|
if (c->next_in_room)
|
||||||
snprintf(str, slen,"%c%ld",UID_CHAR, GET_ID(c->next_in_room));
|
snprintf(str, slen,"%c%ld",UID_CHAR, GET_ID(c->next_in_room));
|
||||||
else
|
else
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'p':
|
case 'p':
|
||||||
/* Thanks to Christian Ejlertsen for this idea
|
/* Thanks to Christian Ejlertsen for this idea
|
||||||
And to Ken Ray for speeding the implementation up :)*/
|
And to Ken Ray for speeding the implementation up :)*/
|
||||||
if (!str_cmp(field, "pos")) {
|
if (!str_cmp(field, "pos")) {
|
||||||
if (subfield && *subfield) {
|
if (subfield && *subfield) {
|
||||||
|
|
@ -873,11 +873,11 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
if (!str_cmp(field, "room")) { /* in NOWHERE, return the void */
|
if (!str_cmp(field, "room")) { /* in NOWHERE, return the void */
|
||||||
/* see note in dg_scripts.h */
|
/* see note in dg_scripts.h */
|
||||||
#ifdef ACTOR_ROOM_IS_UID
|
#ifdef ACTOR_ROOM_IS_UID
|
||||||
snprintf(str, slen, "%c%ld",UID_CHAR,
|
snprintf(str, slen, "%c%ld",UID_CHAR,
|
||||||
(IN_ROOM(c)!= NOWHERE) ? (long) world[IN_ROOM(c)].number + ROOM_ID_BASE : ROOM_ID_BASE);
|
(IN_ROOM(c)!= NOWHERE) ? (long) world[IN_ROOM(c)].number + ROOM_ID_BASE : ROOM_ID_BASE);
|
||||||
#else
|
#else
|
||||||
snprintf(str, slen, "%d", (IN_ROOM(c)!= NOWHERE) ? world[IN_ROOM(c)].number : 0);
|
snprintf(str, slen, "%d", (IN_ROOM(c)!= NOWHERE) ? world[IN_ROOM(c)].number : 0);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef GET_RACE
|
#ifdef GET_RACE
|
||||||
else if (!str_cmp(field, "race")) {
|
else if (!str_cmp(field, "race")) {
|
||||||
|
|
@ -896,7 +896,7 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
else *str = '\0';
|
else *str = '\0';
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef RIDDEN_BY
|
#ifdef RIDDEN_BY
|
||||||
else if (!str_cmp(field, "ridden_by")) {
|
else if (!str_cmp(field, "ridden_by")) {
|
||||||
if (RIDDEN_BY(c))
|
if (RIDDEN_BY(c))
|
||||||
|
|
@ -944,7 +944,7 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
if (skillnum > 0) {
|
if (skillnum > 0) {
|
||||||
int new_value = MAX(0, MIN(100, atoi(amount)));
|
int new_value = MAX(0, MIN(100, atoi(amount)));
|
||||||
SET_SKILL(c, skillnum, new_value);
|
SET_SKILL(c, skillnum, new_value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
*str = '\0'; /* so the parser know we recognize 'skillset' as a field */
|
*str = '\0'; /* so the parser know we recognize 'skillset' as a field */
|
||||||
|
|
@ -990,8 +990,8 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
if (!str_cmp(field, "title")) {
|
if (!str_cmp(field, "title")) {
|
||||||
if (!IS_NPC(c) && subfield && *subfield && valid_dg_target(c, DG_ALLOW_GODS)) {
|
if (!IS_NPC(c) && subfield && *subfield && valid_dg_target(c, DG_ALLOW_GODS)) {
|
||||||
if (GET_TITLE(c)) free(GET_TITLE(c));
|
if (GET_TITLE(c)) free(GET_TITLE(c));
|
||||||
GET_TITLE(c) = strdup(subfield);
|
GET_TITLE(c) = strdup(subfield);
|
||||||
}
|
}
|
||||||
snprintf(str, slen, "%s", IS_NPC(c) ? "" : GET_TITLE(c));
|
snprintf(str, slen, "%s", IS_NPC(c) ? "" : GET_TITLE(c));
|
||||||
}
|
}
|
||||||
case 'v':
|
case 'v':
|
||||||
|
|
@ -1002,14 +1002,14 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
if (IS_NPC(c))
|
if (IS_NPC(c))
|
||||||
snprintf(str, slen, "%d", GET_MOB_VNUM(c));
|
snprintf(str, slen, "%d", GET_MOB_VNUM(c));
|
||||||
else
|
else
|
||||||
/*
|
/*
|
||||||
* for compatibility with unsigned indexes
|
* for compatibility with unsigned indexes
|
||||||
* - this is deprecated - use %actor.is_pc% to check
|
* - this is deprecated - use %actor.is_pc% to check
|
||||||
* instead of %actor.vnum% == -1 --Welcor 09/03
|
* instead of %actor.vnum% == -1 --Welcor 09/03
|
||||||
*/
|
*/
|
||||||
strcpy(str, "-1");
|
strcpy(str, "-1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!str_cmp(field, "varexists")) {
|
else if (!str_cmp(field, "varexists")) {
|
||||||
struct trig_var_data *remote_vd;
|
struct trig_var_data *remote_vd;
|
||||||
|
|
@ -1037,8 +1037,8 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
snprintf(str, slen, "%d", GET_WIS(c));
|
snprintf(str, slen, "%d", GET_WIS(c));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
} /* switch *field */
|
} /* switch *field */
|
||||||
|
|
||||||
if (*str == '\x1') { /* no match found in switch */
|
if (*str == '\x1') { /* no match found in switch */
|
||||||
if (SCRIPT(c)) {
|
if (SCRIPT(c)) {
|
||||||
for (vd = (SCRIPT(c))->global_vars; vd; vd = vd->next)
|
for (vd = (SCRIPT(c))->global_vars; vd; vd = vd->next)
|
||||||
|
|
@ -1072,7 +1072,7 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
}
|
}
|
||||||
snprintf(str, slen, "%d", GET_OBJ_COST(o));
|
snprintf(str, slen, "%d", GET_OBJ_COST(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!str_cmp(field, "cost_per_day")) {
|
else if (!str_cmp(field, "cost_per_day")) {
|
||||||
if (subfield && *subfield) {
|
if (subfield && *subfield) {
|
||||||
int addition = atoi(subfield);
|
int addition = atoi(subfield);
|
||||||
|
|
@ -1080,24 +1080,24 @@ in the vault (vnum: 453) now and then. you can just use
|
||||||
}
|
}
|
||||||
snprintf(str, slen, "%d", GET_OBJ_RENT(o));
|
snprintf(str, slen, "%d", GET_OBJ_RENT(o));
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!str_cmp(field, "carried_by")) {
|
else if (!str_cmp(field, "carried_by")) {
|
||||||
if (o->carried_by)
|
if (o->carried_by)
|
||||||
snprintf(str, slen,"%c%ld",UID_CHAR, GET_ID(o->carried_by));
|
snprintf(str, slen,"%c%ld",UID_CHAR, GET_ID(o->carried_by));
|
||||||
else
|
else
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!str_cmp(field, "contents")) {
|
else if (!str_cmp(field, "contents")) {
|
||||||
if (o->contains)
|
if (o->contains)
|
||||||
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(o->contains));
|
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(o->contains));
|
||||||
else
|
else
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
}
|
}
|
||||||
/* thanks to Jamie Nelson (Mordecai of 4 Dimensions MUD) */
|
/* thanks to Jamie Nelson (Mordecai of 4 Dimensions MUD) */
|
||||||
else if (!str_cmp(field, "count")) {
|
else if (!str_cmp(field, "count")) {
|
||||||
if (GET_OBJ_TYPE(o) == ITEM_CONTAINER)
|
if (GET_OBJ_TYPE(o) == ITEM_CONTAINER)
|
||||||
snprintf(str, slen, "%d", item_in_list(subfield,
|
snprintf(str, slen, "%d", item_in_list(subfield,
|
||||||
o->contains));
|
o->contains));
|
||||||
else
|
else
|
||||||
strcpy(str, "0");
|
strcpy(str, "0");
|
||||||
|
|
@ -1105,9 +1105,9 @@ o->contains));
|
||||||
break;
|
break;
|
||||||
case 'h':
|
case 'h':
|
||||||
/* thanks to Jamie Nelson (Mordecai of 4 Dimensions MUD) */
|
/* thanks to Jamie Nelson (Mordecai of 4 Dimensions MUD) */
|
||||||
if (!str_cmp(field, "has_in")) {
|
if (!str_cmp(field, "has_in")) {
|
||||||
if (GET_OBJ_TYPE(o) == ITEM_CONTAINER)
|
if (GET_OBJ_TYPE(o) == ITEM_CONTAINER)
|
||||||
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");
|
||||||
|
|
@ -1119,7 +1119,7 @@ o->contains) ? "1" : "0"));
|
||||||
|
|
||||||
else if (!str_cmp(field, "is_inroom")) {
|
else if (!str_cmp(field, "is_inroom")) {
|
||||||
if (IN_ROOM(o) != NOWHERE)
|
if (IN_ROOM(o) != NOWHERE)
|
||||||
snprintf(str, slen,"%c%ld",UID_CHAR, (long) world[IN_ROOM(o)].number + ROOM_ID_BASE);
|
snprintf(str, slen,"%c%ld",UID_CHAR, (long) world[IN_ROOM(o)].number + ROOM_ID_BASE);
|
||||||
else
|
else
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
}
|
}
|
||||||
|
|
@ -1127,11 +1127,11 @@ o->contains) ? "1" : "0"));
|
||||||
case 'n':
|
case 'n':
|
||||||
if (!str_cmp(field, "name"))
|
if (!str_cmp(field, "name"))
|
||||||
snprintf(str, slen, "%s", o->name);
|
snprintf(str, slen, "%s", o->name);
|
||||||
|
|
||||||
else if (!str_cmp(field, "next_in_list")) {
|
else if (!str_cmp(field, "next_in_list")) {
|
||||||
if (o->next_content)
|
if (o->next_content)
|
||||||
snprintf(str, slen,"%c%ld",UID_CHAR, GET_ID(o->next_content));
|
snprintf(str, slen,"%c%ld",UID_CHAR, GET_ID(o->next_content));
|
||||||
else
|
else
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1139,7 +1139,7 @@ o->contains) ? "1" : "0"));
|
||||||
if (!str_cmp(field, "room")) {
|
if (!str_cmp(field, "room")) {
|
||||||
if (obj_room(o) != NOWHERE)
|
if (obj_room(o) != NOWHERE)
|
||||||
snprintf(str, slen,"%c%ld",UID_CHAR, (long)world[obj_room(o)].number + ROOM_ID_BASE);
|
snprintf(str, slen,"%c%ld",UID_CHAR, (long)world[obj_room(o)].number + ROOM_ID_BASE);
|
||||||
else
|
else
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1163,13 +1163,13 @@ o->contains) ? "1" : "0"));
|
||||||
}
|
}
|
||||||
else if (!str_cmp(field, "val0"))
|
else if (!str_cmp(field, "val0"))
|
||||||
snprintf(str, slen, "%d", GET_OBJ_VAL(o, 0));
|
snprintf(str, slen, "%d", GET_OBJ_VAL(o, 0));
|
||||||
|
|
||||||
else if (!str_cmp(field, "val1"))
|
else if (!str_cmp(field, "val1"))
|
||||||
snprintf(str, slen, "%d", GET_OBJ_VAL(o, 1));
|
snprintf(str, slen, "%d", GET_OBJ_VAL(o, 1));
|
||||||
|
|
||||||
else if (!str_cmp(field, "val2"))
|
else if (!str_cmp(field, "val2"))
|
||||||
snprintf(str, slen, "%d", GET_OBJ_VAL(o, 2));
|
snprintf(str, slen, "%d", GET_OBJ_VAL(o, 2));
|
||||||
|
|
||||||
else if (!str_cmp(field, "val3"))
|
else if (!str_cmp(field, "val3"))
|
||||||
snprintf(str, slen, "%d", GET_OBJ_VAL(o, 3));
|
snprintf(str, slen, "%d", GET_OBJ_VAL(o, 3));
|
||||||
break;
|
break;
|
||||||
|
|
@ -1185,7 +1185,7 @@ o->contains) ? "1" : "0"));
|
||||||
else if (!str_cmp(field, "worn_by")) {
|
else if (!str_cmp(field, "worn_by")) {
|
||||||
if (o->worn_by)
|
if (o->worn_by)
|
||||||
snprintf(str, slen,"%c%ld",UID_CHAR, GET_ID(o->worn_by));
|
snprintf(str, slen,"%c%ld",UID_CHAR, GET_ID(o->worn_by));
|
||||||
else
|
else
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
@ -1227,29 +1227,29 @@ o->contains) ? "1" : "0"));
|
||||||
break;
|
break;
|
||||||
if (vd)
|
if (vd)
|
||||||
snprintf(str, slen, "%s", vd->value);
|
snprintf(str, slen, "%s", vd->value);
|
||||||
else
|
else
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!str_cmp(field, "name"))
|
else if (!str_cmp(field, "name"))
|
||||||
snprintf(str, slen, "%s", r->name);
|
snprintf(str, slen, "%s", r->name);
|
||||||
|
|
||||||
else if (!str_cmp(field, "sector"))
|
else if (!str_cmp(field, "sector"))
|
||||||
sprinttype(r->sector_type, sector_types, str, slen);
|
sprinttype(r->sector_type, sector_types, str, slen);
|
||||||
|
|
||||||
else if (!str_cmp(field, "vnum")) {
|
else if (!str_cmp(field, "vnum")) {
|
||||||
if (subfield && *subfield) {
|
if (subfield && *subfield) {
|
||||||
snprintf(str, slen, "%d", (int)(r->number == atoi(subfield)));
|
snprintf(str, slen, "%d", (int)(r->number == atoi(subfield)));
|
||||||
} else {
|
} else {
|
||||||
snprintf(str, slen,"%d",r->number);
|
snprintf(str, slen,"%d",r->number);
|
||||||
}
|
}
|
||||||
} else if (!str_cmp(field, "contents")) {
|
} else if (!str_cmp(field, "contents")) {
|
||||||
if (subfield && *subfield) {
|
if (subfield && *subfield) {
|
||||||
for (obj = r->contents; obj; obj = obj->next_content) {
|
for (obj = r->contents; obj; obj = obj->next_content) {
|
||||||
if (GET_OBJ_VNUM(obj) == atoi(subfield)) {
|
if (GET_OBJ_VNUM(obj) == atoi(subfield)) {
|
||||||
/* arg given, found */
|
/* arg given, found */
|
||||||
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(obj));
|
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(obj));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1263,7 +1263,7 @@ o->contains) ? "1" : "0"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (!str_cmp(field, "people")) {
|
else if (!str_cmp(field, "people")) {
|
||||||
if (r->people)
|
if (r->people)
|
||||||
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(r->people));
|
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(r->people));
|
||||||
|
|
@ -1273,10 +1273,10 @@ o->contains) ? "1" : "0"));
|
||||||
else if (!str_cmp(field, "id")) {
|
else if (!str_cmp(field, "id")) {
|
||||||
room_rnum rnum = real_room(r->number);
|
room_rnum rnum = real_room(r->number);
|
||||||
if (rnum != NOWHERE)
|
if (rnum != NOWHERE)
|
||||||
snprintf(str, slen, "%ld", (long) world[rnum].number + ROOM_ID_BASE);
|
snprintf(str, slen, "%ld", (long) world[rnum].number + ROOM_ID_BASE);
|
||||||
else
|
else
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
}
|
}
|
||||||
else if (!str_cmp(field, "weather")) {
|
else if (!str_cmp(field, "weather")) {
|
||||||
const char *sky_look[] = {
|
const char *sky_look[] = {
|
||||||
"sunny",
|
"sunny",
|
||||||
|
|
@ -1301,7 +1301,7 @@ o->contains) ? "1" : "0"));
|
||||||
sprintbit(R_EXIT(r, NORTH)->exit_info ,exit_bits, str, slen);
|
sprintbit(R_EXIT(r, NORTH)->exit_info ,exit_bits, str, slen);
|
||||||
else if (!str_cmp(subfield, "room")) {
|
else if (!str_cmp(subfield, "room")) {
|
||||||
if (R_EXIT(r, NORTH)->to_room != NOWHERE)
|
if (R_EXIT(r, NORTH)->to_room != NOWHERE)
|
||||||
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, NORTH)->to_room].number + ROOM_ID_BASE);
|
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, NORTH)->to_room].number + ROOM_ID_BASE);
|
||||||
else
|
else
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
}
|
}
|
||||||
|
|
@ -1321,7 +1321,7 @@ o->contains) ? "1" : "0"));
|
||||||
sprintbit(R_EXIT(r, EAST)->exit_info ,exit_bits, str, slen);
|
sprintbit(R_EXIT(r, EAST)->exit_info ,exit_bits, str, slen);
|
||||||
else if (!str_cmp(subfield, "room")) {
|
else if (!str_cmp(subfield, "room")) {
|
||||||
if (R_EXIT(r, EAST)->to_room != NOWHERE)
|
if (R_EXIT(r, EAST)->to_room != NOWHERE)
|
||||||
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, EAST)->to_room].number + ROOM_ID_BASE);
|
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, EAST)->to_room].number + ROOM_ID_BASE);
|
||||||
else
|
else
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
}
|
}
|
||||||
|
|
@ -1341,7 +1341,7 @@ o->contains) ? "1" : "0"));
|
||||||
sprintbit(R_EXIT(r, SOUTH)->exit_info ,exit_bits, str, slen);
|
sprintbit(R_EXIT(r, SOUTH)->exit_info ,exit_bits, str, slen);
|
||||||
else if (!str_cmp(subfield, "room")) {
|
else if (!str_cmp(subfield, "room")) {
|
||||||
if (R_EXIT(r, SOUTH)->to_room != NOWHERE)
|
if (R_EXIT(r, SOUTH)->to_room != NOWHERE)
|
||||||
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, SOUTH)->to_room].number + ROOM_ID_BASE);
|
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, SOUTH)->to_room].number + ROOM_ID_BASE);
|
||||||
else
|
else
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
}
|
}
|
||||||
|
|
@ -1361,7 +1361,7 @@ o->contains) ? "1" : "0"));
|
||||||
sprintbit(R_EXIT(r, WEST)->exit_info ,exit_bits, str, slen);
|
sprintbit(R_EXIT(r, WEST)->exit_info ,exit_bits, str, slen);
|
||||||
else if (!str_cmp(subfield, "room")) {
|
else if (!str_cmp(subfield, "room")) {
|
||||||
if (R_EXIT(r, WEST)->to_room != NOWHERE)
|
if (R_EXIT(r, WEST)->to_room != NOWHERE)
|
||||||
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, WEST)->to_room].number + ROOM_ID_BASE);
|
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, WEST)->to_room].number + ROOM_ID_BASE);
|
||||||
else
|
else
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
}
|
}
|
||||||
|
|
@ -1381,7 +1381,7 @@ o->contains) ? "1" : "0"));
|
||||||
sprintbit(R_EXIT(r, UP)->exit_info ,exit_bits, str, slen);
|
sprintbit(R_EXIT(r, UP)->exit_info ,exit_bits, str, slen);
|
||||||
else if (!str_cmp(subfield, "room")) {
|
else if (!str_cmp(subfield, "room")) {
|
||||||
if (R_EXIT(r, UP)->to_room != NOWHERE)
|
if (R_EXIT(r, UP)->to_room != NOWHERE)
|
||||||
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, UP)->to_room].number + ROOM_ID_BASE);
|
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, UP)->to_room].number + ROOM_ID_BASE);
|
||||||
else
|
else
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
}
|
}
|
||||||
|
|
@ -1401,7 +1401,7 @@ o->contains) ? "1" : "0"));
|
||||||
sprintbit(R_EXIT(r, DOWN)->exit_info ,exit_bits, str, slen);
|
sprintbit(R_EXIT(r, DOWN)->exit_info ,exit_bits, str, slen);
|
||||||
else if (!str_cmp(subfield, "room")) {
|
else if (!str_cmp(subfield, "room")) {
|
||||||
if (R_EXIT(r, DOWN)->to_room != NOWHERE)
|
if (R_EXIT(r, DOWN)->to_room != NOWHERE)
|
||||||
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, DOWN)->to_room].number + ROOM_ID_BASE);
|
snprintf(str, slen, "%c%ld", UID_CHAR, (long) world[R_EXIT(r, DOWN)->to_room].number + ROOM_ID_BASE);
|
||||||
else
|
else
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
}
|
}
|
||||||
|
|
@ -1432,7 +1432,7 @@ o->contains) ? "1" : "0"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now automatically checks if the variable has more then one field
|
* Now automatically checks if the variable has more then one field
|
||||||
* in it. And if the field returns a name or a script UID or the like
|
* in it. And if the field returns a name or a script UID or the like
|
||||||
* it can recurse.
|
* it can recurse.
|
||||||
|
|
@ -1446,7 +1446,7 @@ o->contains) ? "1" : "0"));
|
||||||
* will double the actors gold every time its called. etc...
|
* will double the actors gold every time its called. etc...
|
||||||
* - Jamie Nelson 31st Oct 2003 01:24
|
* - Jamie Nelson 31st Oct 2003 01:24
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* substitutes any variables into line and returns it as buf */
|
/* substitutes any variables into line and returns it as buf */
|
||||||
void var_subst(void *go, struct script_data *sc, trig_data *trig,
|
void var_subst(void *go, struct script_data *sc, trig_data *trig,
|
||||||
int type, char *line, char *buf)
|
int type, char *line, char *buf)
|
||||||
|
|
@ -1466,10 +1466,10 @@ void var_subst(void *go, struct script_data *sc, trig_data *trig,
|
||||||
}
|
}
|
||||||
/*lets just empty these to start with*/
|
/*lets just empty these to start with*/
|
||||||
*repl_str = *tmp = *tmp2 = '\0';
|
*repl_str = *tmp = *tmp2 = '\0';
|
||||||
|
|
||||||
p = strcpy(tmp, line);
|
p = strcpy(tmp, line);
|
||||||
subfield_p = subfield;
|
subfield_p = subfield;
|
||||||
|
|
||||||
left = MAX_INPUT_LENGTH - 1;
|
left = MAX_INPUT_LENGTH - 1;
|
||||||
|
|
||||||
while (*p && (left > 0)) {
|
while (*p && (left > 0)) {
|
||||||
|
|
@ -1480,9 +1480,9 @@ void var_subst(void *go, struct script_data *sc, trig_data *trig,
|
||||||
*(buf++) = *(p++);
|
*(buf++) = *(p++);
|
||||||
left--;
|
left--;
|
||||||
}
|
}
|
||||||
|
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
|
|
||||||
/* double % */
|
/* double % */
|
||||||
if (*p && (*(++p) == '%') && (left > 0)) {
|
if (*p && (*(++p) == '%') && (left > 0)) {
|
||||||
*(buf++) = *(p++);
|
*(buf++) = *(p++);
|
||||||
|
|
@ -1493,10 +1493,10 @@ void var_subst(void *go, struct script_data *sc, trig_data *trig,
|
||||||
|
|
||||||
/* so it wasn't double %'s */
|
/* so it wasn't double %'s */
|
||||||
else if (*p && (left > 0)) {
|
else if (*p && (left > 0)) {
|
||||||
|
|
||||||
/* search until end of var or beginning of field */
|
/* search until end of var or beginning of field */
|
||||||
for (var = p; *p && (*p != '%') && (*p != '.'); p++);
|
for (var = p; *p && (*p != '%') && (*p != '.'); p++);
|
||||||
|
|
||||||
field = p;
|
field = p;
|
||||||
if (*p == '.') {
|
if (*p == '.') {
|
||||||
*(p++) = '\0';
|
*(p++) = '\0';
|
||||||
|
|
@ -1505,7 +1505,7 @@ void var_subst(void *go, struct script_data *sc, trig_data *trig,
|
||||||
if (dots > 0) {
|
if (dots > 0) {
|
||||||
*subfield_p = '\0';
|
*subfield_p = '\0';
|
||||||
find_replacement(go, sc, trig, type, var, field, subfield, repl_str, sizeof(repl_str));
|
find_replacement(go, sc, trig, type, var, field, subfield, repl_str, sizeof(repl_str));
|
||||||
if (*repl_str) {
|
if (*repl_str) {
|
||||||
snprintf(tmp2, sizeof(tmp2), "eval tmpvr %s", repl_str); //temp var
|
snprintf(tmp2, sizeof(tmp2), "eval tmpvr %s", repl_str); //temp var
|
||||||
process_eval(go, sc, trig, type, tmp2);
|
process_eval(go, sc, trig, type, tmp2);
|
||||||
strcpy(var, "tmpvr");
|
strcpy(var, "tmpvr");
|
||||||
|
|
@ -1525,24 +1525,24 @@ void var_subst(void *go, struct script_data *sc, trig_data *trig,
|
||||||
} else if (*p=='.') {
|
} else if (*p=='.') {
|
||||||
*p = '\0';
|
*p = '\0';
|
||||||
dots++;
|
dots++;
|
||||||
}
|
}
|
||||||
} /* for (field.. */
|
} /* for (field.. */
|
||||||
} /* if *p == '.' */
|
} /* if *p == '.' */
|
||||||
|
|
||||||
*(p++) = '\0';
|
*(p++) = '\0';
|
||||||
*subfield_p = '\0';
|
*subfield_p = '\0';
|
||||||
|
|
||||||
if (*subfield) {
|
if (*subfield) {
|
||||||
var_subst(go, sc, trig, type, subfield, tmp2);
|
var_subst(go, sc, trig, type, subfield, tmp2);
|
||||||
strcpy(subfield, tmp2);
|
strcpy(subfield, tmp2);
|
||||||
}
|
}
|
||||||
|
|
||||||
find_replacement(go, sc, trig, type, var, field, subfield, repl_str, sizeof(repl_str));
|
find_replacement(go, sc, trig, type, var, field, subfield, repl_str, sizeof(repl_str));
|
||||||
|
|
||||||
strncat(buf, repl_str, left);
|
strncat(buf, repl_str, left);
|
||||||
len = strlen(repl_str);
|
len = strlen(repl_str);
|
||||||
buf += len;
|
buf += len;
|
||||||
left -= len;
|
left -= len;
|
||||||
} /* else if *p .. */
|
} /* else if *p .. */
|
||||||
} /* while *p .. */
|
} /* while *p .. */
|
||||||
}
|
}
|
||||||
|
|
|
||||||
110
src/dg_wldcmd.c
110
src/dg_wldcmd.c
|
|
@ -73,7 +73,7 @@ void wld_log(room_data *room, const char *format, ...)
|
||||||
{
|
{
|
||||||
va_list args;
|
va_list args;
|
||||||
char output[MAX_STRING_LENGTH];
|
char output[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
snprintf(output, sizeof(output), "Room %d :: %s", room->number, format);
|
snprintf(output, sizeof(output), "Room %d :: %s", room->number, format);
|
||||||
|
|
||||||
va_start(args, format);
|
va_start(args, format);
|
||||||
|
|
@ -105,17 +105,17 @@ void act_to_room(char *str, room_data *room)
|
||||||
WCMD(do_wasound)
|
WCMD(do_wasound)
|
||||||
{
|
{
|
||||||
int door;
|
int door;
|
||||||
|
|
||||||
skip_spaces(&argument);
|
skip_spaces(&argument);
|
||||||
|
|
||||||
if (!*argument) {
|
if (!*argument) {
|
||||||
wld_log(room, "wasound called with no argument");
|
wld_log(room, "wasound called with no argument");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (door = 0; door < NUM_OF_DIRS; door++) {
|
for (door = 0; door < NUM_OF_DIRS; door++) {
|
||||||
struct room_direction_data *newexit;
|
struct room_direction_data *newexit;
|
||||||
|
|
||||||
if ((newexit = room->dir_option[door]) && (newexit->to_room != NOWHERE) &&
|
if ((newexit = room->dir_option[door]) && (newexit->to_room != NOWHERE) &&
|
||||||
room != &world[newexit->to_room])
|
room != &world[newexit->to_room])
|
||||||
act_to_room(argument, &world[newexit->to_room]);
|
act_to_room(argument, &world[newexit->to_room]);
|
||||||
|
|
@ -127,10 +127,10 @@ WCMD(do_wecho)
|
||||||
{
|
{
|
||||||
skip_spaces(&argument);
|
skip_spaces(&argument);
|
||||||
|
|
||||||
if (!*argument)
|
if (!*argument)
|
||||||
wld_log(room, "wecho called with no args");
|
wld_log(room, "wecho called with no args");
|
||||||
|
|
||||||
else
|
else
|
||||||
act_to_room(argument, room);
|
act_to_room(argument, room);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -139,7 +139,7 @@ WCMD(do_wsend)
|
||||||
{
|
{
|
||||||
char buf[MAX_INPUT_LENGTH], *msg;
|
char buf[MAX_INPUT_LENGTH], *msg;
|
||||||
char_data *ch;
|
char_data *ch;
|
||||||
|
|
||||||
msg = any_one_arg(argument, buf);
|
msg = any_one_arg(argument, buf);
|
||||||
|
|
||||||
if (!*buf)
|
if (!*buf)
|
||||||
|
|
@ -172,7 +172,7 @@ WCMD(do_wzoneecho)
|
||||||
{
|
{
|
||||||
zone_rnum zone;
|
zone_rnum zone;
|
||||||
char room_num[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH], *msg;
|
char room_num[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH], *msg;
|
||||||
|
|
||||||
msg = any_one_arg(argument, room_num);
|
msg = any_one_arg(argument, room_num);
|
||||||
skip_spaces(&msg);
|
skip_spaces(&msg);
|
||||||
|
|
||||||
|
|
@ -182,7 +182,7 @@ WCMD(do_wzoneecho)
|
||||||
else if ((zone = real_zone_by_thing(atoi(room_num))) == NOWHERE)
|
else if ((zone = real_zone_by_thing(atoi(room_num))) == NOWHERE)
|
||||||
wld_log(room, "wzoneecho called for nonexistant zone");
|
wld_log(room, "wzoneecho called for nonexistant zone");
|
||||||
|
|
||||||
else {
|
else {
|
||||||
sprintf(buf, "%s\r\n", msg);
|
sprintf(buf, "%s\r\n", msg);
|
||||||
send_to_zone(buf, zone);
|
send_to_zone(buf, zone);
|
||||||
}
|
}
|
||||||
|
|
@ -200,9 +200,9 @@ WCMD(do_wrecho)
|
||||||
|
|
||||||
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
|
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
|
||||||
wld_log(room, "wrecho: too few args");
|
wld_log(room, "wrecho: too few args");
|
||||||
else
|
else
|
||||||
send_to_range(atoi(start), atoi(finish), "%s\r\n", msg);
|
send_to_range(atoi(start), atoi(finish), "%s\r\n", msg);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
WCMD(do_wdoor)
|
WCMD(do_wdoor)
|
||||||
|
|
@ -232,12 +232,12 @@ WCMD(do_wdoor)
|
||||||
wld_log(room, "wdoor called with too few args");
|
wld_log(room, "wdoor called with too few args");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((rm = get_room(target)) == NULL) {
|
if ((rm = get_room(target)) == NULL) {
|
||||||
wld_log(room, "wdoor: invalid target");
|
wld_log(room, "wdoor: invalid target");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((dir = search_block(direction, dirs, FALSE)) == -1) {
|
if ((dir = search_block(direction, dirs, FALSE)) == -1) {
|
||||||
wld_log(room, "wdoor: invalid direction");
|
wld_log(room, "wdoor: invalid direction");
|
||||||
return;
|
return;
|
||||||
|
|
@ -265,9 +265,9 @@ WCMD(do_wdoor)
|
||||||
else {
|
else {
|
||||||
if (!newexit) {
|
if (!newexit) {
|
||||||
CREATE(newexit, struct room_direction_data, 1);
|
CREATE(newexit, struct room_direction_data, 1);
|
||||||
rm->dir_option[dir] = newexit;
|
rm->dir_option[dir] = newexit;
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (fd) {
|
switch (fd) {
|
||||||
case 1: /* description */
|
case 1: /* description */
|
||||||
if (newexit->general_description)
|
if (newexit->general_description)
|
||||||
|
|
@ -306,7 +306,7 @@ WCMD(do_wteleport)
|
||||||
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
two_arguments(argument, arg1, arg2);
|
two_arguments(argument, arg1, arg2);
|
||||||
|
|
||||||
if (!*arg1 || !*arg2) {
|
if (!*arg1 || !*arg2) {
|
||||||
wld_log(room, "wteleport called with too few args");
|
wld_log(room, "wteleport called with too few args");
|
||||||
return;
|
return;
|
||||||
|
|
@ -314,10 +314,10 @@ WCMD(do_wteleport)
|
||||||
|
|
||||||
nr = atoi(arg2);
|
nr = atoi(arg2);
|
||||||
target = real_room(nr);
|
target = real_room(nr);
|
||||||
|
|
||||||
if (target == NOWHERE)
|
if (target == NOWHERE)
|
||||||
wld_log(room, "wteleport target is an invalid room");
|
wld_log(room, "wteleport target is an invalid room");
|
||||||
|
|
||||||
else if (!str_cmp(arg1, "all")) {
|
else if (!str_cmp(arg1, "all")) {
|
||||||
if (nr == room->number) {
|
if (nr == room->number) {
|
||||||
wld_log(room, "wteleport all target is itself");
|
wld_log(room, "wteleport all target is itself");
|
||||||
|
|
@ -327,14 +327,14 @@ WCMD(do_wteleport)
|
||||||
for (ch = room->people; ch; ch = next_ch)
|
for (ch = room->people; ch; ch = next_ch)
|
||||||
{
|
{
|
||||||
next_ch = ch->next_in_room;
|
next_ch = ch->next_in_room;
|
||||||
if (!valid_dg_target(ch, DG_ALLOW_GODS))
|
if (!valid_dg_target(ch, DG_ALLOW_GODS))
|
||||||
continue;
|
continue;
|
||||||
char_from_room(ch);
|
char_from_room(ch);
|
||||||
char_to_room(ch, target);
|
char_to_room(ch, target);
|
||||||
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
|
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((ch = get_char_by_room(room, arg1))) {
|
if ((ch = get_char_by_room(room, arg1))) {
|
||||||
|
|
@ -344,7 +344,7 @@ WCMD(do_wteleport)
|
||||||
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
|
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
wld_log(room, "wteleport: no target found");
|
wld_log(room, "wteleport: no target found");
|
||||||
}
|
}
|
||||||
|
|
@ -357,25 +357,25 @@ WCMD(do_wforce)
|
||||||
char arg1[MAX_INPUT_LENGTH], *line;
|
char arg1[MAX_INPUT_LENGTH], *line;
|
||||||
|
|
||||||
line = one_argument(argument, arg1);
|
line = one_argument(argument, arg1);
|
||||||
|
|
||||||
if (!*arg1 || !*line) {
|
if (!*arg1 || !*line) {
|
||||||
wld_log(room, "wforce called with too few args");
|
wld_log(room, "wforce called with too few args");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!str_cmp(arg1, "all"))
|
if (!str_cmp(arg1, "all"))
|
||||||
{
|
{
|
||||||
for (ch = room->people; ch; ch = next_ch)
|
for (ch = room->people; ch; ch = next_ch)
|
||||||
{
|
{
|
||||||
next_ch = ch->next_in_room;
|
next_ch = ch->next_in_room;
|
||||||
|
|
||||||
if (valid_dg_target(ch, 0))
|
if (valid_dg_target(ch, 0))
|
||||||
{
|
{
|
||||||
command_interpreter(ch, line);
|
command_interpreter(ch, line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if ((ch = get_char_by_room(room, arg1)))
|
if ((ch = get_char_by_room(room, arg1)))
|
||||||
|
|
@ -385,7 +385,7 @@ WCMD(do_wforce)
|
||||||
command_interpreter(ch, line);
|
command_interpreter(ch, line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
wld_log(room, "wforce: no target found");
|
wld_log(room, "wforce: no target found");
|
||||||
}
|
}
|
||||||
|
|
@ -400,7 +400,7 @@ WCMD(do_wpurge)
|
||||||
obj_data *obj, *next_obj;
|
obj_data *obj, *next_obj;
|
||||||
|
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
|
|
||||||
if (!*arg) {
|
if (!*arg) {
|
||||||
/* purge all */
|
/* purge all */
|
||||||
for (ch = room->people; ch; ch = next_ch ) {
|
for (ch = room->people; ch; ch = next_ch ) {
|
||||||
|
|
@ -408,39 +408,39 @@ WCMD(do_wpurge)
|
||||||
if (IS_NPC(ch))
|
if (IS_NPC(ch))
|
||||||
extract_char(ch);
|
extract_char(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (obj = room->contents; obj; obj = next_obj ) {
|
for (obj = room->contents; obj; obj = next_obj ) {
|
||||||
next_obj = obj->next_content;
|
next_obj = obj->next_content;
|
||||||
extract_obj(obj);
|
extract_obj(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*arg == UID_CHAR)
|
if (*arg == UID_CHAR)
|
||||||
ch = get_char(arg);
|
ch = get_char(arg);
|
||||||
else
|
else
|
||||||
ch = get_char_in_room(room, arg);
|
ch = get_char_in_room(room, arg);
|
||||||
|
|
||||||
if (!ch) {
|
if (!ch) {
|
||||||
if (*arg == UID_CHAR)
|
if (*arg == UID_CHAR)
|
||||||
obj = get_obj(arg);
|
obj = get_obj(arg);
|
||||||
else
|
else
|
||||||
obj = get_obj_in_room(room, arg);
|
obj = get_obj_in_room(room, arg);
|
||||||
|
|
||||||
if (obj) {
|
if (obj) {
|
||||||
extract_obj(obj);
|
extract_obj(obj);
|
||||||
} else
|
} else
|
||||||
wld_log(room, "wpurge: bad argument");
|
wld_log(room, "wpurge: bad argument");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!IS_NPC(ch)) {
|
if (!IS_NPC(ch)) {
|
||||||
wld_log(room, "wpurge: purging a PC");
|
wld_log(room, "wpurge: purging a PC");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
extract_char(ch);
|
extract_char(ch);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -456,9 +456,9 @@ WCMD(do_wload)
|
||||||
char_data *tch;
|
char_data *tch;
|
||||||
obj_data *cnt;
|
obj_data *cnt;
|
||||||
int pos;
|
int pos;
|
||||||
|
|
||||||
target = two_arguments(argument, arg1, arg2);
|
target = two_arguments(argument, arg1, arg2);
|
||||||
|
|
||||||
if (!*arg1 || !*arg2 || !is_number(arg2) || ((number = atoi(arg2)) < 0)) {
|
if (!*arg1 || !*arg2 || !is_number(arg2) || ((number = atoi(arg2)) < 0)) {
|
||||||
wld_log(room, "wload: bad syntax");
|
wld_log(room, "wload: bad syntax");
|
||||||
return;
|
return;
|
||||||
|
|
@ -478,7 +478,7 @@ WCMD(do_wload)
|
||||||
if ((mob = read_mobile(number, VIRTUAL)) == NULL) {
|
if ((mob = read_mobile(number, VIRTUAL)) == NULL) {
|
||||||
wld_log(room, "mload: bad mob vnum");
|
wld_log(room, "mload: bad mob vnum");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
char_to_room(mob, rnum);
|
char_to_room(mob, rnum);
|
||||||
if (SCRIPT(room)) { // it _should_ have, but it might be detached.
|
if (SCRIPT(room)) { // it _should_ have, but it might be detached.
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
|
|
@ -487,7 +487,7 @@ WCMD(do_wload)
|
||||||
}
|
}
|
||||||
load_mtrigger(mob);
|
load_mtrigger(mob);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (is_abbrev(arg1, "obj")) {
|
else if (is_abbrev(arg1, "obj")) {
|
||||||
if ((object = read_object(number, VIRTUAL)) == NULL) {
|
if ((object = read_object(number, VIRTUAL)) == NULL) {
|
||||||
wld_log(room, "wload: bad object vnum");
|
wld_log(room, "wload: bad object vnum");
|
||||||
|
|
@ -495,7 +495,7 @@ WCMD(do_wload)
|
||||||
}
|
}
|
||||||
/* special handling to make objects able to load on a person/in a container/worn etc. */
|
/* special handling to make objects able to load on a person/in a container/worn etc. */
|
||||||
if (!target || !*target) {
|
if (!target || !*target) {
|
||||||
obj_to_room(object, real_room(room->number));
|
obj_to_room(object, real_room(room->number));
|
||||||
if (SCRIPT(room)) { // it _should_ have, but it might be detached.
|
if (SCRIPT(room)) { // it _should_ have, but it might be detached.
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
sprintf(buf, "%c%ld", UID_CHAR, GET_ID(object));
|
sprintf(buf, "%c%ld", UID_CHAR, GET_ID(object));
|
||||||
|
|
@ -503,8 +503,8 @@ WCMD(do_wload)
|
||||||
}
|
}
|
||||||
load_otrigger(object);
|
load_otrigger(object);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
two_arguments(target, arg1, arg2); /* recycling ... */
|
two_arguments(target, arg1, arg2); /* recycling ... */
|
||||||
tch = get_char_in_room(room, arg1);
|
tch = get_char_in_room(room, arg1);
|
||||||
if (tch) {
|
if (tch) {
|
||||||
|
|
@ -527,7 +527,7 @@ WCMD(do_wload)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/* neither char nor container found - just dump it in room */
|
/* neither char nor container found - just dump it in room */
|
||||||
obj_to_room(object, real_room(room->number));
|
obj_to_room(object, real_room(room->number));
|
||||||
load_otrigger(object);
|
load_otrigger(object);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -551,9 +551,9 @@ WCMD(do_wdamage) {
|
||||||
|
|
||||||
dam = atoi(amount);
|
dam = atoi(amount);
|
||||||
ch = get_char_by_room(room, name);
|
ch = get_char_by_room(room, name);
|
||||||
|
|
||||||
if (!ch) {
|
if (!ch) {
|
||||||
wld_log(room, "wdamage: target not found");
|
wld_log(room, "wdamage: target not found");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -563,9 +563,9 @@ WCMD(do_wdamage) {
|
||||||
|
|
||||||
WCMD(do_wat) {
|
WCMD(do_wat) {
|
||||||
char location[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
char location[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
||||||
int vnum = 0;
|
int vnum = 0;
|
||||||
room_data *r2;
|
room_data *r2;
|
||||||
|
|
||||||
half_chop(argument, location, arg2);
|
half_chop(argument, location, arg2);
|
||||||
|
|
||||||
if (!*location || !*arg2 || !isdigit(*location)) {
|
if (!*location || !*arg2 || !isdigit(*location)) {
|
||||||
|
|
@ -584,7 +584,7 @@ WCMD(do_wat) {
|
||||||
|
|
||||||
const struct wld_command_info wld_cmd_info[] = {
|
const struct wld_command_info wld_cmd_info[] = {
|
||||||
{ "RESERVED", 0, 0 },/* this must be first -- for specprocs */
|
{ "RESERVED", 0, 0 },/* this must be first -- for specprocs */
|
||||||
|
|
||||||
{ "wasound " , do_wasound , 0 },
|
{ "wasound " , do_wasound , 0 },
|
||||||
{ "wdoor " , do_wdoor , 0 },
|
{ "wdoor " , do_wdoor , 0 },
|
||||||
{ "wecho " , do_wecho , 0 },
|
{ "wecho " , do_wecho , 0 },
|
||||||
|
|
@ -609,9 +609,9 @@ void wld_command_interpreter(room_data *room, char *argument)
|
||||||
{
|
{
|
||||||
int cmd, length;
|
int cmd, length;
|
||||||
char *line, arg[MAX_INPUT_LENGTH];
|
char *line, arg[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
skip_spaces(&argument);
|
skip_spaces(&argument);
|
||||||
|
|
||||||
/* just drop to next line for hitting CR */
|
/* just drop to next line for hitting CR */
|
||||||
if (!*argument)
|
if (!*argument)
|
||||||
return;
|
return;
|
||||||
|
|
@ -624,10 +624,10 @@ void wld_command_interpreter(room_data *room, char *argument)
|
||||||
*wld_cmd_info[cmd].command != '\n'; cmd++)
|
*wld_cmd_info[cmd].command != '\n'; cmd++)
|
||||||
if (!strncmp(wld_cmd_info[cmd].command, arg, length))
|
if (!strncmp(wld_cmd_info[cmd].command, arg, length))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (*wld_cmd_info[cmd].command == '\n')
|
if (*wld_cmd_info[cmd].command == '\n')
|
||||||
wld_log(room, "Unknown world cmd: '%s'", argument);
|
wld_log(room, "Unknown world cmd: '%s'", argument);
|
||||||
else
|
else
|
||||||
((*wld_cmd_info[cmd].command_pointer)
|
((*wld_cmd_info[cmd].command_pointer)
|
||||||
(room, line, cmd, wld_cmd_info[cmd].subcmd));
|
(room, line, cmd, wld_cmd_info[cmd].subcmd));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
13
src/fight.c
13
src/fight.c
|
|
@ -11,7 +11,6 @@
|
||||||
#include "conf.h"
|
#include "conf.h"
|
||||||
#include "sysdep.h"
|
#include "sysdep.h"
|
||||||
|
|
||||||
|
|
||||||
#include "structs.h"
|
#include "structs.h"
|
||||||
#include "utils.h"
|
#include "utils.h"
|
||||||
#include "comm.h"
|
#include "comm.h"
|
||||||
|
|
@ -366,15 +365,15 @@ void raw_kill(struct char_data * ch, struct char_data * killer)
|
||||||
while (ch->affected)
|
while (ch->affected)
|
||||||
affect_remove(ch, ch->affected);
|
affect_remove(ch, ch->affected);
|
||||||
|
|
||||||
/* To make ordinary commands work in scripts. welcor*/
|
/* To make ordinary commands work in scripts. welcor*/
|
||||||
GET_POS(ch) = POS_STANDING;
|
GET_POS(ch) = POS_STANDING;
|
||||||
|
|
||||||
if (killer) {
|
if (killer) {
|
||||||
if (death_mtrigger(ch, killer))
|
if (death_mtrigger(ch, killer))
|
||||||
death_cry(ch);
|
death_cry(ch);
|
||||||
} else
|
} else
|
||||||
death_cry(ch);
|
death_cry(ch);
|
||||||
|
|
||||||
update_pos(ch);
|
update_pos(ch);
|
||||||
|
|
||||||
make_corpse(ch);
|
make_corpse(ch);
|
||||||
|
|
@ -706,7 +705,7 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
|
||||||
if (!ok_damage_shopkeeper(ch, victim))
|
if (!ok_damage_shopkeeper(ch, victim))
|
||||||
return (0);
|
return (0);
|
||||||
|
|
||||||
/* You can't damage an immortal! */
|
/* You can't damage an immortal! */
|
||||||
if (!IS_NPC(victim) && (GET_LEVEL(victim) >= LVL_IMMORT))
|
if (!IS_NPC(victim) && (GET_LEVEL(victim) >= LVL_IMMORT))
|
||||||
dam = 0;
|
dam = 0;
|
||||||
|
|
||||||
|
|
@ -757,7 +756,7 @@ int damage(struct char_data *ch, struct char_data *victim, int dam, int attackty
|
||||||
* dam_message just sends a generic "You hit $n extremely hard.".
|
* dam_message just sends a generic "You hit $n extremely hard.".
|
||||||
* skill_message is preferable to dam_message because it is more
|
* skill_message is preferable to dam_message because it is more
|
||||||
* descriptive.
|
* descriptive.
|
||||||
*
|
*
|
||||||
* If we are _not_ attacking with a weapon (i.e. a spell), always use
|
* If we are _not_ attacking with a weapon (i.e. a spell), always use
|
||||||
* skill_message. If we are attacking with a weapon: If this is a miss or a
|
* skill_message. If we are attacking with a weapon: If this is a miss or a
|
||||||
* death blow, send a skill_message if one exists; if not, default to a
|
* death blow, send a skill_message if one exists; if not, default to a
|
||||||
|
|
|
||||||
10
src/genmob.c
10
src/genmob.c
|
|
@ -130,7 +130,7 @@ int delete_mobile(mob_rnum refpt)
|
||||||
int counter, cmd_no;
|
int counter, cmd_no;
|
||||||
mob_vnum vnum;
|
mob_vnum vnum;
|
||||||
zone_rnum zone;
|
zone_rnum zone;
|
||||||
|
|
||||||
#if CIRCLE_UNSIGNED_INDEX
|
#if CIRCLE_UNSIGNED_INDEX
|
||||||
if (refpt == NOBODY || refpt > top_of_mobt) {
|
if (refpt == NOBODY || refpt > top_of_mobt) {
|
||||||
#else
|
#else
|
||||||
|
|
@ -174,8 +174,8 @@ int delete_mobile(mob_rnum refpt)
|
||||||
for (counter = 0; counter <= top_shop - top_shop_offset; counter++)
|
for (counter = 0; counter <= top_shop - top_shop_offset; counter++)
|
||||||
SHOP_KEEPER(counter) -= (SHOP_KEEPER(counter) >= refpt);
|
SHOP_KEEPER(counter) -= (SHOP_KEEPER(counter) >= refpt);
|
||||||
|
|
||||||
save_mobiles(real_zone_by_thing(vnum));
|
save_mobiles(real_zone_by_thing(vnum));
|
||||||
|
|
||||||
return refpt;
|
return refpt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -306,7 +306,7 @@ int save_mobiles(zone_rnum rznum)
|
||||||
snprintf(usedfname, sizeof(usedfname), "%s%d.mob", MOB_PREFIX, vznum);
|
snprintf(usedfname, sizeof(usedfname), "%s%d.mob", MOB_PREFIX, vznum);
|
||||||
remove(usedfname);
|
remove(usedfname);
|
||||||
rename(mobfname, usedfname);
|
rename(mobfname, usedfname);
|
||||||
|
|
||||||
if (in_save_list(vznum, SL_MOB))
|
if (in_save_list(vznum, SL_MOB))
|
||||||
remove_from_save_list(vznum, SL_MOB);
|
remove_from_save_list(vznum, SL_MOB);
|
||||||
log("GenOLC: '%s' saved, %d bytes written.", usedfname, written);
|
log("GenOLC: '%s' saved, %d bytes written.", usedfname, written);
|
||||||
|
|
@ -358,7 +358,7 @@ int write_mobile_espec(mob_vnum mvnum, struct char_data *mob, FILE *fd)
|
||||||
int write_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd)
|
int write_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd)
|
||||||
{
|
{
|
||||||
|
|
||||||
char bit1[64];
|
char bit1[64];
|
||||||
char bit2[64];
|
char bit2[64];
|
||||||
char ldesc[MAX_STRING_LENGTH];
|
char ldesc[MAX_STRING_LENGTH];
|
||||||
char ddesc[MAX_STRING_LENGTH];
|
char ddesc[MAX_STRING_LENGTH];
|
||||||
|
|
|
||||||
110
src/genobj.c
110
src/genobj.c
|
|
@ -267,12 +267,12 @@ int save_objects(zone_rnum zone_num)
|
||||||
);
|
);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do we have script(s) attached ?
|
* Do we have script(s) attached ?
|
||||||
*/
|
*/
|
||||||
script_save_to_disk(fp, obj, OBJ_TRIGGER);
|
script_save_to_disk(fp, obj, OBJ_TRIGGER);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do we have extra descriptions?
|
* Do we have extra descriptions?
|
||||||
*/
|
*/
|
||||||
if (obj->ex_description) { /* Yes, save them too. */
|
if (obj->ex_description) { /* Yes, save them too. */
|
||||||
for (ex_desc = obj->ex_description; ex_desc; ex_desc = ex_desc->next) {
|
for (ex_desc = obj->ex_description; ex_desc; ex_desc = ex_desc->next) {
|
||||||
|
|
@ -291,7 +291,7 @@ int save_objects(zone_rnum zone_num)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Do we have affects?
|
* Do we have affects?
|
||||||
*/
|
*/
|
||||||
for (counter2 = 0; counter2 < MAX_OBJ_AFFECT; counter2++)
|
for (counter2 = 0; counter2 < MAX_OBJ_AFFECT; counter2++)
|
||||||
if (obj->affected[counter2].modifier)
|
if (obj->affected[counter2].modifier)
|
||||||
|
|
@ -401,25 +401,25 @@ int copy_object_main(struct obj_data *to, struct obj_data *from, int free_object
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
int delete_object(obj_rnum rnum)
|
int delete_object(obj_rnum rnum)
|
||||||
{
|
{
|
||||||
obj_rnum i;
|
obj_rnum i;
|
||||||
struct obj_data *obj, *tmp;
|
struct obj_data *obj, *tmp;
|
||||||
int shop, j;
|
int shop, j;
|
||||||
|
|
||||||
if (rnum == NOWHERE || rnum > top_of_objt)
|
if (rnum == NOWHERE || rnum > top_of_objt)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
obj = &obj_proto[rnum];
|
obj = &obj_proto[rnum];
|
||||||
|
|
||||||
zone_rnum zrnum = real_zone_by_thing(GET_OBJ_VNUM(obj));
|
zone_rnum zrnum = real_zone_by_thing(GET_OBJ_VNUM(obj));
|
||||||
|
|
||||||
/* This is something you might want to read about in the logs. */
|
/* This is something you might want to read about in the logs. */
|
||||||
log("GenOLC: delete_object: Deleting object #%d (%s).", GET_OBJ_VNUM(obj), obj->short_description);
|
log("GenOLC: delete_object: Deleting object #%d (%s).", GET_OBJ_VNUM(obj), obj->short_description);
|
||||||
|
|
||||||
for (tmp = object_list; tmp; tmp = tmp->next) {
|
for (tmp = object_list; tmp; tmp = tmp->next) {
|
||||||
if (tmp->item_number != obj->item_number)
|
if (tmp->item_number != obj->item_number)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
// extract_obj() will just axe contents.
|
// extract_obj() will just axe contents.
|
||||||
if (tmp->contains) {
|
if (tmp->contains) {
|
||||||
|
|
@ -444,14 +444,14 @@ int delete_object(obj_rnum rnum)
|
||||||
// remove from object_list, etc. - handles weightchanges, and similar.
|
// remove from object_list, etc. - handles weightchanges, and similar.
|
||||||
extract_obj(tmp);
|
extract_obj(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure all are removed.
|
// make sure all are removed.
|
||||||
assert(obj_index[rnum].number == 0);
|
assert(obj_index[rnum].number == 0);
|
||||||
|
|
||||||
// adjust rnums of all other objects.
|
// adjust rnums of all other objects.
|
||||||
for (tmp = object_list; tmp; tmp = tmp->next) {
|
for (tmp = object_list; tmp; tmp = tmp->next) {
|
||||||
GET_OBJ_RNUM(tmp) -= (GET_OBJ_RNUM(tmp) > rnum);
|
GET_OBJ_RNUM(tmp) -= (GET_OBJ_RNUM(tmp) > rnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = rnum; i < top_of_objt; i++) {
|
for (i = rnum; i < top_of_objt; i++) {
|
||||||
obj_index[i] = obj_index[i + 1];
|
obj_index[i] = obj_index[i + 1];
|
||||||
|
|
@ -463,51 +463,51 @@ int delete_object(obj_rnum rnum)
|
||||||
RECREATE(obj_index, struct index_data, top_of_objt + 1);
|
RECREATE(obj_index, struct index_data, top_of_objt + 1);
|
||||||
RECREATE(obj_proto, struct obj_data, top_of_objt + 1);
|
RECREATE(obj_proto, struct obj_data, top_of_objt + 1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Renumber notice boards.
|
* Renumber notice boards.
|
||||||
*/
|
*/
|
||||||
for (j = 0; j < NUM_OF_BOARDS; j++)
|
for (j = 0; j < NUM_OF_BOARDS; j++)
|
||||||
BOARD_RNUM(j) -= (BOARD_RNUM(j) > rnum);
|
BOARD_RNUM(j) -= (BOARD_RNUM(j) > rnum);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Renumber shop produce;
|
* Renumber shop produce;
|
||||||
*/
|
*/
|
||||||
for (shop = 0; shop <= top_shop - top_shop_offset; shop++)
|
for (shop = 0; shop <= top_shop - top_shop_offset; shop++)
|
||||||
for (j = 0; SHOP_PRODUCT(shop, j) != NOTHING; j++)
|
for (j = 0; SHOP_PRODUCT(shop, j) != NOTHING; j++)
|
||||||
SHOP_PRODUCT(shop, j) -= (SHOP_PRODUCT(shop, j) > rnum);
|
SHOP_PRODUCT(shop, j) -= (SHOP_PRODUCT(shop, j) > rnum);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Renumber zone table.
|
* Renumber zone table.
|
||||||
*/
|
*/
|
||||||
int zone, cmd_no;
|
int zone, cmd_no;
|
||||||
for (zone = 0; zone <= top_of_zone_table; zone++) {
|
for (zone = 0; zone <= top_of_zone_table; zone++) {
|
||||||
for (cmd_no = 0; ZCMD(zone, cmd_no).command != 'S'; cmd_no++) {
|
for (cmd_no = 0; ZCMD(zone, cmd_no).command != 'S'; cmd_no++) {
|
||||||
switch (ZCMD(zone, cmd_no).command) {
|
switch (ZCMD(zone, cmd_no).command) {
|
||||||
case 'P':
|
case 'P':
|
||||||
if (ZCMD(zone, cmd_no).arg3 == rnum) {
|
if (ZCMD(zone, cmd_no).arg3 == rnum) {
|
||||||
delete_zone_command(&zone_table[zone], cmd_no);
|
delete_zone_command(&zone_table[zone], cmd_no);
|
||||||
} else
|
} else
|
||||||
ZCMD(zone, cmd_no).arg3 -= (ZCMD(zone, cmd_no).arg3 > rnum);
|
ZCMD(zone, cmd_no).arg3 -= (ZCMD(zone, cmd_no).arg3 > rnum);
|
||||||
break;
|
break;
|
||||||
case 'O':
|
case 'O':
|
||||||
case 'G':
|
case 'G':
|
||||||
case 'E':
|
case 'E':
|
||||||
if (ZCMD(zone, cmd_no).arg1 == rnum) {
|
if (ZCMD(zone, cmd_no).arg1 == rnum) {
|
||||||
delete_zone_command(&zone_table[zone], cmd_no);
|
delete_zone_command(&zone_table[zone], cmd_no);
|
||||||
} else
|
} else
|
||||||
ZCMD(zone, cmd_no).arg1 -= (ZCMD(zone, cmd_no).arg1 > rnum);
|
ZCMD(zone, cmd_no).arg1 -= (ZCMD(zone, cmd_no).arg1 > rnum);
|
||||||
break;
|
break;
|
||||||
case 'R':
|
case 'R':
|
||||||
if (ZCMD(zone, cmd_no).arg2 == rnum) {
|
if (ZCMD(zone, cmd_no).arg2 == rnum) {
|
||||||
delete_zone_command(&zone_table[zone], cmd_no);
|
delete_zone_command(&zone_table[zone], cmd_no);
|
||||||
} else
|
} else
|
||||||
ZCMD(zone, cmd_no).arg2 -= (ZCMD(zone, cmd_no).arg2 > rnum);
|
ZCMD(zone, cmd_no).arg2 -= (ZCMD(zone, cmd_no).arg2 > rnum);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
save_objects(zrnum);
|
save_objects(zrnum);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -15,5 +15,5 @@ obj_rnum index_object(struct obj_data *obj, obj_vnum ovnum, obj_rnum ornum);
|
||||||
int update_objects(struct obj_data *refobj);
|
int update_objects(struct obj_data *refobj);
|
||||||
obj_rnum add_object(struct obj_data *, obj_vnum ovnum);
|
obj_rnum add_object(struct obj_data *, obj_vnum ovnum);
|
||||||
int copy_object_main(struct obj_data *to, struct obj_data *from, int free_object);
|
int copy_object_main(struct obj_data *to, struct obj_data *from, int free_object);
|
||||||
int delete_object(obj_rnum);
|
int delete_object(obj_rnum);
|
||||||
|
|
||||||
|
|
|
||||||
94
src/genolc.c
94
src/genolc.c
|
|
@ -167,22 +167,22 @@ int add_to_save_list(zone_vnum zone, int type)
|
||||||
{
|
{
|
||||||
struct save_list_data *nitem;
|
struct save_list_data *nitem;
|
||||||
zone_rnum rznum;
|
zone_rnum rznum;
|
||||||
|
|
||||||
if (type == SL_CFG)
|
if (type == SL_CFG)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
rznum = real_zone(zone);
|
rznum = real_zone(zone);
|
||||||
if (rznum == NOWHERE || rznum > top_of_zone_table) {
|
if (rznum == NOWHERE || rznum > top_of_zone_table) {
|
||||||
if (zone != AEDIT_PERMISSION) {
|
if (zone != AEDIT_PERMISSION) {
|
||||||
log("SYSERR: add_to_save_list: Invalid zone number passed. (%d => %d, 0-%d)", zone, rznum, top_of_zone_table);
|
log("SYSERR: add_to_save_list: Invalid zone number passed. (%d => %d, 0-%d)", zone, rznum, top_of_zone_table);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (nitem = save_list; nitem; nitem = nitem->next)
|
for (nitem = save_list; nitem; nitem = nitem->next)
|
||||||
if (nitem->zone == zone && nitem->type == type)
|
if (nitem->zone == zone && nitem->type == type)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
CREATE(nitem, struct save_list_data, 1);
|
CREATE(nitem, struct save_list_data, 1);
|
||||||
nitem->zone = zone;
|
nitem->zone = zone;
|
||||||
nitem->type = type;
|
nitem->type = type;
|
||||||
|
|
@ -196,11 +196,11 @@ int add_to_save_list(zone_vnum zone, int type)
|
||||||
int in_save_list(zone_vnum zone, int type)
|
int in_save_list(zone_vnum zone, int type)
|
||||||
{
|
{
|
||||||
struct save_list_data *nitem;
|
struct save_list_data *nitem;
|
||||||
|
|
||||||
for (nitem = save_list; nitem; nitem = nitem->next)
|
for (nitem = save_list; nitem; nitem = nitem->next)
|
||||||
if (nitem->zone == zone && nitem->type == type)
|
if (nitem->zone == zone && nitem->type == type)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -282,19 +282,19 @@ ACMD(do_export_zone)
|
||||||
char sysbuf[MAX_INPUT_LENGTH];
|
char sysbuf[MAX_INPUT_LENGTH];
|
||||||
char fn[MAX_INPUT_LENGTH], *f;
|
char fn[MAX_INPUT_LENGTH], *f;
|
||||||
void space_to_minus(char *str);
|
void space_to_minus(char *str);
|
||||||
|
|
||||||
if (IS_NPC(ch) || GET_LEVEL(ch) < LVL_IMPL)
|
if (IS_NPC(ch) || GET_LEVEL(ch) < LVL_IMPL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
skip_spaces(&argument);
|
skip_spaces(&argument);
|
||||||
zvnum = atoi(argument);
|
zvnum = atoi(argument);
|
||||||
zrnum = real_zone(zvnum);
|
zrnum = real_zone(zvnum);
|
||||||
|
|
||||||
if (zrnum == NOWHERE) {
|
if (zrnum == NOWHERE) {
|
||||||
send_to_char(ch, "Export which zone?\r\n");
|
send_to_char(ch, "Export which zone?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!export_info_file(zrnum))
|
if (!export_info_file(zrnum))
|
||||||
send_to_char(ch, "Info file not saved!\r\n");
|
send_to_char(ch, "Info file not saved!\r\n");
|
||||||
if (!export_save_shops(zrnum))
|
if (!export_save_shops(zrnum))
|
||||||
|
|
@ -314,8 +314,8 @@ ACMD(do_export_zone)
|
||||||
snprintf(fn, sizeof(fn), "%d_%s.tgz", zvnum, zone_table[zrnum].name);
|
snprintf(fn, sizeof(fn), "%d_%s.tgz", zvnum, zone_table[zrnum].name);
|
||||||
f = fn;
|
f = fn;
|
||||||
space_to_minus(f);
|
space_to_minus(f);
|
||||||
snprintf(sysbuf, sizeof(sysbuf),
|
snprintf(sysbuf, sizeof(sysbuf),
|
||||||
LIB_ETC "export_script.sh %s &",
|
LIB_ETC "export_script.sh %s &",
|
||||||
fn);
|
fn);
|
||||||
system(sysbuf);
|
system(sysbuf);
|
||||||
send_to_char(ch, "Files tar'ed to \"%s\"\r\n", fn);
|
send_to_char(ch, "Files tar'ed to \"%s\"\r\n", fn);
|
||||||
|
|
@ -326,7 +326,7 @@ int export_info_file(zone_rnum zrnum)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
FILE *info_file;
|
FILE *info_file;
|
||||||
|
|
||||||
if (!(info_file = fopen("world/export/qq.info", "w"))) {
|
if (!(info_file = fopen("world/export/qq.info", "w"))) {
|
||||||
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_info_file : Cannot open file!");
|
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_info_file : Cannot open file!");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
@ -335,7 +335,7 @@ int export_info_file(zone_rnum zrnum)
|
||||||
fclose(info_file);
|
fclose(info_file);
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(info_file, "The files accompanying this info file contain the area: %s\n", zone_table[zrnum].name);
|
fprintf(info_file, "The files accompanying this info file contain the area: %s\n", zone_table[zrnum].name);
|
||||||
fprintf(info_file, "It was written by: %s.\n\n", zone_table[zrnum].builders);
|
fprintf(info_file, "It was written by: %s.\n\n", zone_table[zrnum].builders);
|
||||||
fprintf(info_file, "The author has given permission to distribute the area, provided credit is\n");
|
fprintf(info_file, "The author has given permission to distribute the area, provided credit is\n");
|
||||||
|
|
@ -350,24 +350,24 @@ int export_info_file(zone_rnum zrnum)
|
||||||
fprintf(info_file, "2. Exits out of this zone have been ZZ'd. So all doors leading out have ZZ??\n");
|
fprintf(info_file, "2. Exits out of this zone have been ZZ'd. So all doors leading out have ZZ??\n");
|
||||||
fprintf(info_file, " instead of the room vnum (?? are numbers 00 - 99).\n");
|
fprintf(info_file, " instead of the room vnum (?? are numbers 00 - 99).\n");
|
||||||
fprintf(info_file, " In this zone, the exit rooms in question are:\n");
|
fprintf(info_file, " In this zone, the exit rooms in question are:\n");
|
||||||
|
|
||||||
for (i = genolc_zone_bottom(zrnum); i <= zone_table[zrnum].top; i++) {
|
for (i = genolc_zone_bottom(zrnum); i <= zone_table[zrnum].top; i++) {
|
||||||
room_rnum rnum = real_room(i);
|
room_rnum rnum = real_room(i);
|
||||||
struct room_data *room;
|
struct room_data *room;
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
if (rnum == NOWHERE)
|
if (rnum == NOWHERE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
room = &world[rnum];
|
room = &world[rnum];
|
||||||
|
|
||||||
for (j = 0; j < NUM_OF_DIRS; j++) {
|
for (j = 0; j < NUM_OF_DIRS; j++) {
|
||||||
if (!R_EXIT(room, j))
|
if (!R_EXIT(room, j))
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (R_EXIT(room, j)->to_room == NOWHERE || world[R_EXIT(room, j)->to_room].zone == zrnum)
|
if (R_EXIT(room, j)->to_room == NOWHERE || world[R_EXIT(room, j)->to_room].zone == zrnum)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fprintf(info_file, " Room QQ%02d : Exit to the %s\n",
|
fprintf(info_file, " Room QQ%02d : Exit to the %s\n",
|
||||||
room->number%100, dirs[j]);
|
room->number%100, dirs[j]);
|
||||||
}
|
}
|
||||||
|
|
@ -375,9 +375,9 @@ int export_info_file(zone_rnum zrnum)
|
||||||
zone_exits = 0;
|
zone_exits = 0;
|
||||||
} else {
|
} else {
|
||||||
fprintf(info_file, "2. This area doesn't have any exits _out_ of the zone.\n");
|
fprintf(info_file, "2. This area doesn't have any exits _out_ of the zone.\n");
|
||||||
fprintf(info_file, " More info on connections in the zone description room.\n");
|
fprintf(info_file, " More info on connections in the zone description room.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(info_file, "\nAdditional zone information is available in the zone description room QQ00.\n");
|
fprintf(info_file, "\nAdditional zone information is available in the zone description room QQ00.\n");
|
||||||
fprintf(info_file, "The Builder's Academy is maintaining and improving these zones. Any typo or\n");
|
fprintf(info_file, "The Builder's Academy is maintaining and improving these zones. Any typo or\n");
|
||||||
fprintf(info_file, "bug reports should be reported to rumble@builderacademy.net or stop by The Builder Academy\n");
|
fprintf(info_file, "bug reports should be reported to rumble@builderacademy.net or stop by The Builder Academy\n");
|
||||||
|
|
@ -389,7 +389,7 @@ int export_info_file(zone_rnum zrnum)
|
||||||
fprintf(info_file, "Rumble - Admin of TBA\n");
|
fprintf(info_file, "Rumble - Admin of TBA\n");
|
||||||
fprintf(info_file, "Welcor - Coder of TBA\n");
|
fprintf(info_file, "Welcor - Coder of TBA\n");
|
||||||
fprintf(info_file, "\ntelnet://builderacademy.net:9091/\n");
|
fprintf(info_file, "\ntelnet://builderacademy.net:9091/\n");
|
||||||
|
|
||||||
fclose(info_file);
|
fclose(info_file);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
@ -423,7 +423,7 @@ int export_save_shops(zone_rnum zrnum)
|
||||||
if (obj_index[S_PRODUCT(shop, j)].vnum < genolc_zone_bottom(zrnum) ||
|
if (obj_index[S_PRODUCT(shop, j)].vnum < genolc_zone_bottom(zrnum) ||
|
||||||
obj_index[S_PRODUCT(shop, j)].vnum > zone_table[zrnum].top)
|
obj_index[S_PRODUCT(shop, j)].vnum > zone_table[zrnum].top)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fprintf(shop_file, "QQ%02d\n", obj_index[S_PRODUCT(shop, j)].vnum%100);
|
fprintf(shop_file, "QQ%02d\n", obj_index[S_PRODUCT(shop, j)].vnum%100);
|
||||||
}
|
}
|
||||||
fprintf(shop_file, "-1\n");
|
fprintf(shop_file, "-1\n");
|
||||||
|
|
@ -439,8 +439,8 @@ int export_save_shops(zone_rnum zrnum)
|
||||||
/*
|
/*
|
||||||
* Save the buy types and namelists.
|
* Save the buy types and namelists.
|
||||||
*/
|
*/
|
||||||
for (j = 0;S_BUYTYPE(shop, j) != NOTHING; j++)
|
for (j = 0;S_BUYTYPE(shop, j) != NOTHING; j++)
|
||||||
fprintf(shop_file, "%d%s\n",
|
fprintf(shop_file, "%d%s\n",
|
||||||
S_BUYTYPE(shop, j),
|
S_BUYTYPE(shop, j),
|
||||||
S_BUYWORD(shop, j) ? S_BUYWORD(shop, j) : "");
|
S_BUYWORD(shop, j) ? S_BUYWORD(shop, j) : "");
|
||||||
fprintf(shop_file, "-1\n");
|
fprintf(shop_file, "-1\n");
|
||||||
|
|
@ -481,13 +481,13 @@ int export_save_shops(zone_rnum zrnum)
|
||||||
if (S_ROOM(shop, j) < genolc_zone_bottom(zrnum) ||
|
if (S_ROOM(shop, j) < genolc_zone_bottom(zrnum) ||
|
||||||
S_ROOM(shop, j) > zone_table[zrnum].top)
|
S_ROOM(shop, j) > zone_table[zrnum].top)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
fprintf(shop_file, "QQ%02d\n", S_ROOM(shop, j)%100);
|
fprintf(shop_file, "QQ%02d\n", S_ROOM(shop, j)%100);
|
||||||
}
|
}
|
||||||
fprintf(shop_file, "-1\n");
|
fprintf(shop_file, "-1\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Save open/closing times
|
* Save open/closing times
|
||||||
*/
|
*/
|
||||||
fprintf(shop_file, "%d\n%d\n%d\n%d\n", S_OPEN1(shop), S_CLOSE1(shop),
|
fprintf(shop_file, "%d\n%d\n%d\n%d\n", S_OPEN1(shop), S_CLOSE1(shop),
|
||||||
S_OPEN2(shop), S_CLOSE2(shop));
|
S_OPEN2(shop), S_CLOSE2(shop));
|
||||||
|
|
@ -527,7 +527,7 @@ int export_save_mobiles(zone_rnum rznum)
|
||||||
int export_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd)
|
int export_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd)
|
||||||
{
|
{
|
||||||
|
|
||||||
char bit1[64];
|
char bit1[64];
|
||||||
char bit2[64];
|
char bit2[64];
|
||||||
char ldesc[MAX_STRING_LENGTH];
|
char ldesc[MAX_STRING_LENGTH];
|
||||||
char ddesc[MAX_STRING_LENGTH];
|
char ddesc[MAX_STRING_LENGTH];
|
||||||
|
|
@ -577,14 +577,14 @@ int export_save_zone(zone_rnum zrnum)
|
||||||
{
|
{
|
||||||
int subcmd;
|
int subcmd;
|
||||||
FILE *zone_file;
|
FILE *zone_file;
|
||||||
|
|
||||||
if (!(zone_file = fopen("world/export/qq.zon", "w"))) {
|
if (!(zone_file = fopen("world/export/qq.zon", "w"))) {
|
||||||
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_save_zone : Cannot open file!");
|
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_save_zone : Cannot open file!");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Print zone header to file
|
* Print zone header to file
|
||||||
*/
|
*/
|
||||||
fprintf(zone_file, "#QQ\n"
|
fprintf(zone_file, "#QQ\n"
|
||||||
"%s~\n"
|
"%s~\n"
|
||||||
|
|
@ -686,7 +686,7 @@ int export_save_zone(zone_rnum zrnum)
|
||||||
ZCMD(zrnum, subcmd).if_flag,
|
ZCMD(zrnum, subcmd).if_flag,
|
||||||
ZCMD(zrnum, subcmd).arg1,
|
ZCMD(zrnum, subcmd).arg1,
|
||||||
ZCMD(zrnum, subcmd).arg2,
|
ZCMD(zrnum, subcmd).arg2,
|
||||||
world[ZCMD(zrnum, subcmd).arg3].number%100,
|
world[ZCMD(zrnum, subcmd).arg3].number%100,
|
||||||
ZCMD(zrnum, subcmd).sarg1,
|
ZCMD(zrnum, subcmd).sarg1,
|
||||||
ZCMD(zrnum, subcmd).sarg2);
|
ZCMD(zrnum, subcmd).sarg2);
|
||||||
break;
|
break;
|
||||||
|
|
@ -702,7 +702,7 @@ int export_save_zone(zone_rnum zrnum)
|
||||||
}
|
}
|
||||||
fputs("S\n$\n", zone_file);
|
fputs("S\n$\n", zone_file);
|
||||||
fclose(zone_file);
|
fclose(zone_file);
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -749,7 +749,7 @@ int export_save_objects(zone_rnum zrnum)
|
||||||
sprintascii(bit2, GET_OBJ_PERM(obj));
|
sprintascii(bit2, GET_OBJ_PERM(obj));
|
||||||
|
|
||||||
fprintf(obj_file,
|
fprintf(obj_file,
|
||||||
"%d %s %s %s\n",
|
"%d %s %s %s\n",
|
||||||
GET_OBJ_TYPE(obj), buf, bit1, bit2);
|
GET_OBJ_TYPE(obj), buf, bit1, bit2);
|
||||||
|
|
||||||
if (GET_OBJ_TYPE(obj) != ITEM_CONTAINER)
|
if (GET_OBJ_TYPE(obj) != ITEM_CONTAINER)
|
||||||
|
|
@ -764,18 +764,18 @@ int export_save_objects(zone_rnum zrnum)
|
||||||
GET_OBJ_VAL(obj, 2) == -1 ? "" : "QQ", /* key */
|
GET_OBJ_VAL(obj, 2) == -1 ? "" : "QQ", /* key */
|
||||||
GET_OBJ_VAL(obj, 2) == -1 ? -1 : GET_OBJ_VAL(obj, 2)%100,
|
GET_OBJ_VAL(obj, 2) == -1 ? -1 : GET_OBJ_VAL(obj, 2)%100,
|
||||||
GET_OBJ_VAL(obj, 3));
|
GET_OBJ_VAL(obj, 3));
|
||||||
|
|
||||||
fprintf(obj_file,
|
fprintf(obj_file,
|
||||||
"%d %d %d %d\n",
|
"%d %d %d %d\n",
|
||||||
GET_OBJ_WEIGHT(obj), GET_OBJ_COST(obj), GET_OBJ_RENT(obj), GET_OBJ_LEVEL(obj));
|
GET_OBJ_WEIGHT(obj), GET_OBJ_COST(obj), GET_OBJ_RENT(obj), GET_OBJ_LEVEL(obj));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do we have script(s) attached ?
|
* Do we have script(s) attached ?
|
||||||
*/
|
*/
|
||||||
export_script_save_to_disk(obj_file, obj, OBJ_TRIGGER);
|
export_script_save_to_disk(obj_file, obj, OBJ_TRIGGER);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Do we have extra descriptions?
|
* Do we have extra descriptions?
|
||||||
*/
|
*/
|
||||||
if (obj->ex_description) { /* Yes, save them too. */
|
if (obj->ex_description) { /* Yes, save them too. */
|
||||||
for (ex_desc = obj->ex_description; ex_desc; ex_desc = ex_desc->next) {
|
for (ex_desc = obj->ex_description; ex_desc; ex_desc = ex_desc->next) {
|
||||||
|
|
@ -794,12 +794,12 @@ int export_save_objects(zone_rnum zrnum)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Do we have affects?
|
* Do we have affects?
|
||||||
*/
|
*/
|
||||||
for (i = 0; i < MAX_OBJ_AFFECT; i++)
|
for (i = 0; i < MAX_OBJ_AFFECT; i++)
|
||||||
if (obj->affected[i].modifier)
|
if (obj->affected[i].modifier)
|
||||||
fprintf(obj_file, "A\n"
|
fprintf(obj_file, "A\n"
|
||||||
"%d %d\n",
|
"%d %d\n",
|
||||||
obj->affected[i].location,
|
obj->affected[i].location,
|
||||||
obj->affected[i].modifier);
|
obj->affected[i].modifier);
|
||||||
}
|
}
|
||||||
|
|
@ -898,7 +898,7 @@ int export_save_rooms(zone_rnum zrnum)
|
||||||
dflag,
|
dflag,
|
||||||
R_EXIT(room, j)->key == NOTHING ? "" : "QQ",
|
R_EXIT(room, j)->key == NOTHING ? "" : "QQ",
|
||||||
R_EXIT(room, j)->key == NOTHING ? -1 : R_EXIT(room, j)->key % 100 ,
|
R_EXIT(room, j)->key == NOTHING ? -1 : R_EXIT(room, j)->key % 100 ,
|
||||||
R_EXIT(room, j)->to_room == NOTHING ? "" : "QQ",
|
R_EXIT(room, j)->to_room == NOTHING ? "" : "QQ",
|
||||||
R_EXIT(room, j)->to_room != NOTHING ? (world[R_EXIT(room, j)->to_room].number%100) : -1);
|
R_EXIT(room, j)->to_room != NOTHING ? (world[R_EXIT(room, j)->to_room].number%100) : -1);
|
||||||
else {
|
else {
|
||||||
fprintf(room_file,"D%d\n"
|
fprintf(room_file,"D%d\n"
|
||||||
|
|
@ -977,7 +977,7 @@ int export_save_triggers(zone_rnum zrnum)
|
||||||
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_save_triggers : Cannot open file!");
|
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_save_triggers : Cannot open file!");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = genolc_zone_bottom(zrnum); i <= zone_table[zrnum].top; i++) {
|
for (i = genolc_zone_bottom(zrnum); i <= zone_table[zrnum].top; i++) {
|
||||||
trig_rnum rnum;
|
trig_rnum rnum;
|
||||||
|
|
||||||
|
|
@ -994,7 +994,7 @@ int export_save_triggers(zone_rnum zrnum)
|
||||||
trig->attach_type,
|
trig->attach_type,
|
||||||
*bitBuf ? bitBuf : "0", GET_TRIG_NARG(trig),
|
*bitBuf ? bitBuf : "0", GET_TRIG_NARG(trig),
|
||||||
GET_TRIG_ARG(trig) ? GET_TRIG_ARG(trig) : "", STRING_TERMINATOR);
|
GET_TRIG_ARG(trig) ? GET_TRIG_ARG(trig) : "", STRING_TERMINATOR);
|
||||||
|
|
||||||
fprintf(trig_file, "* This trigger has been exported 'as is'. This means that vnums\n"
|
fprintf(trig_file, "* This trigger has been exported 'as is'. This means that vnums\n"
|
||||||
"* in this file are not changed, and will have to be edited by hand.\n"
|
"* in this file are not changed, and will have to be edited by hand.\n"
|
||||||
"* This zone was number %d on The Builder Academy, so you\n"
|
"* This zone was number %d on The Builder Academy, so you\n"
|
||||||
|
|
@ -1006,7 +1006,7 @@ int export_save_triggers(zone_rnum zrnum)
|
||||||
fprintf(trig_file, "%c\n", STRING_TERMINATOR);
|
fprintf(trig_file, "%c\n", STRING_TERMINATOR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(trig_file, "$%c\n", STRING_TERMINATOR);
|
fprintf(trig_file, "$%c\n", STRING_TERMINATOR);
|
||||||
fclose(trig_file);
|
fclose(trig_file);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
||||||
12
src/genshp.c
12
src/genshp.c
|
|
@ -102,7 +102,7 @@ void copy_shop_list(IDXTYPE **tlist, IDXTYPE *flist)
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Copy a -1 terminated (in the type field) shop_buy_data
|
* Copy a -1 terminated (in the type field) shop_buy_data
|
||||||
* array list.
|
* array list.
|
||||||
*/
|
*/
|
||||||
void copy_shop_type_list(struct shop_buy_data **tlist, struct shop_buy_data *flist)
|
void copy_shop_type_list(struct shop_buy_data **tlist, struct shop_buy_data *flist)
|
||||||
|
|
@ -316,7 +316,7 @@ void free_shop(struct shop_data *shop)
|
||||||
|
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
|
|
||||||
/* returns the real number of the shop with given virtual number
|
/* returns the real number of the shop with given virtual number
|
||||||
*
|
*
|
||||||
* We take so good care to keep it sorted - let's use it :) - Welcor
|
* We take so good care to keep it sorted - let's use it :) - Welcor
|
||||||
*/
|
*/
|
||||||
|
|
@ -475,8 +475,8 @@ int save_shops(zone_rnum zone_num)
|
||||||
/*
|
/*
|
||||||
* Save the buy types and namelists.
|
* Save the buy types and namelists.
|
||||||
*/
|
*/
|
||||||
for (j = 0;S_BUYTYPE(shop, j) != NOTHING; j++)
|
for (j = 0;S_BUYTYPE(shop, j) != NOTHING; j++)
|
||||||
fprintf(shop_file, "%d%s\n",
|
fprintf(shop_file, "%d%s\n",
|
||||||
S_BUYTYPE(shop, j),
|
S_BUYTYPE(shop, j),
|
||||||
S_BUYWORD(shop, j) ? S_BUYWORD(shop, j) : "");
|
S_BUYWORD(shop, j) ? S_BUYWORD(shop, j) : "");
|
||||||
fprintf(shop_file, "-1\n");
|
fprintf(shop_file, "-1\n");
|
||||||
|
|
@ -518,12 +518,12 @@ int save_shops(zone_rnum zone_num)
|
||||||
/*
|
/*
|
||||||
* Save the rooms.
|
* Save the rooms.
|
||||||
*/
|
*/
|
||||||
for (j = 0;S_ROOM(shop, j) != NOWHERE; j++)
|
for (j = 0;S_ROOM(shop, j) != NOWHERE; j++)
|
||||||
fprintf(shop_file, "%d\n", S_ROOM(shop, j));
|
fprintf(shop_file, "%d\n", S_ROOM(shop, j));
|
||||||
fprintf(shop_file, "-1\n");
|
fprintf(shop_file, "-1\n");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Save open/closing times
|
* Save open/closing times
|
||||||
*/
|
*/
|
||||||
fprintf(shop_file, "%d\n%d\n%d\n%d\n", S_OPEN1(shop), S_CLOSE1(shop),
|
fprintf(shop_file, "%d\n%d\n%d\n%d\n", S_OPEN1(shop), S_CLOSE1(shop),
|
||||||
S_OPEN2(shop), S_CLOSE2(shop));
|
S_OPEN2(shop), S_CLOSE2(shop));
|
||||||
|
|
|
||||||
16
src/genwld.c
16
src/genwld.c
|
|
@ -33,14 +33,14 @@ room_rnum add_room(struct room_data *room)
|
||||||
struct obj_data *tobj;
|
struct obj_data *tobj;
|
||||||
int j, found = FALSE;
|
int j, found = FALSE;
|
||||||
room_rnum i;
|
room_rnum i;
|
||||||
|
|
||||||
if (room == NULL)
|
if (room == NULL)
|
||||||
return NOWHERE;
|
return NOWHERE;
|
||||||
|
|
||||||
if ((i = real_room(room->number)) != NOWHERE) {
|
if ((i = real_room(room->number)) != NOWHERE) {
|
||||||
if (SCRIPT(&world[i]))
|
if (SCRIPT(&world[i]))
|
||||||
extract_script(&world[i], WLD_TRIGGER);
|
extract_script(&world[i], WLD_TRIGGER);
|
||||||
tch = world[i].people;
|
tch = world[i].people;
|
||||||
tobj = world[i].contents;
|
tobj = world[i].contents;
|
||||||
copy_room(&world[i], room);
|
copy_room(&world[i], room);
|
||||||
world[i].people = tch;
|
world[i].people = tch;
|
||||||
|
|
@ -106,7 +106,7 @@ room_rnum add_room(struct room_data *room)
|
||||||
default:
|
default:
|
||||||
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: GenOLC: add_room: Unknown zone entry found!");
|
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: GenOLC: add_room: Unknown zone entry found!");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update the loadroom table. Adds 1 or 0.
|
* Update the loadroom table. Adds 1 or 0.
|
||||||
*/
|
*/
|
||||||
|
|
@ -208,7 +208,7 @@ int delete_room(room_rnum rnum)
|
||||||
free(W_EXIT(i, j)->general_description);
|
free(W_EXIT(i, j)->general_description);
|
||||||
free(W_EXIT(i, j));
|
free(W_EXIT(i, j));
|
||||||
W_EXIT(i, j) = NULL;
|
W_EXIT(i, j) = NULL;
|
||||||
} else {
|
} else {
|
||||||
/* description is set, just point to nowhere */
|
/* description is set, just point to nowhere */
|
||||||
W_EXIT(i, j)->to_room = NOWHERE;
|
W_EXIT(i, j)->to_room = NOWHERE;
|
||||||
}
|
}
|
||||||
|
|
@ -360,7 +360,7 @@ int save_rooms(zone_rnum rzone)
|
||||||
strncpy(buf1, R_EXIT(room, j)->keyword, sizeof(buf1)-1 );
|
strncpy(buf1, R_EXIT(room, j)->keyword, sizeof(buf1)-1 );
|
||||||
else
|
else
|
||||||
*buf1 = '\0';
|
*buf1 = '\0';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now write the exit to the file.
|
* Now write the exit to the file.
|
||||||
*/
|
*/
|
||||||
|
|
@ -449,7 +449,7 @@ room_rnum duplicate_room(room_vnum dest_vnum, room_rnum orig)
|
||||||
return NOWHERE;
|
return NOWHERE;
|
||||||
}
|
}
|
||||||
|
|
||||||
nroom = world[new_rnum];
|
nroom = world[new_rnum];
|
||||||
nroom.number = dest_vnum;
|
nroom.number = dest_vnum;
|
||||||
nroom.zone = znum;
|
nroom.zone = znum;
|
||||||
|
|
||||||
|
|
@ -513,10 +513,10 @@ int free_room_strings(struct room_data *room)
|
||||||
/* Free exits. */
|
/* Free exits. */
|
||||||
for (i = 0; i < NUM_OF_DIRS; i++) {
|
for (i = 0; i < NUM_OF_DIRS; i++) {
|
||||||
if (room->dir_option[i]) {
|
if (room->dir_option[i]) {
|
||||||
if (room->dir_option[i]->general_description)
|
if (room->dir_option[i]->general_description)
|
||||||
free(room->dir_option[i]->general_description);
|
free(room->dir_option[i]->general_description);
|
||||||
|
|
||||||
if (room->dir_option[i]->keyword)
|
if (room->dir_option[i]->keyword)
|
||||||
free(room->dir_option[i]->keyword);
|
free(room->dir_option[i]->keyword);
|
||||||
|
|
||||||
free(room->dir_option[i]);
|
free(room->dir_option[i]);
|
||||||
|
|
|
||||||
32
src/genzon.c
32
src/genzon.c
|
|
@ -152,7 +152,7 @@ zone_rnum create_new_zone(zone_vnum vzone_num, room_vnum bottom, room_vnum top,
|
||||||
create_world_index(vzone_num, "obj");
|
create_world_index(vzone_num, "obj");
|
||||||
create_world_index(vzone_num, "shp");
|
create_world_index(vzone_num, "shp");
|
||||||
create_world_index(vzone_num, "trg");
|
create_world_index(vzone_num, "trg");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Make a new zone in memory. This was the source of all the zedit new
|
* Make a new zone in memory. This was the source of all the zedit new
|
||||||
* crashes reported to the CircleMUD list. It was happily overwriting
|
* crashes reported to the CircleMUD list. It was happily overwriting
|
||||||
|
|
@ -182,7 +182,7 @@ rznum = i;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ok, insert the new zone here.
|
* Ok, insert the new zone here.
|
||||||
*/
|
*/
|
||||||
zone->name = strdup("New Zone");
|
zone->name = strdup("New Zone");
|
||||||
zone->number = vzone_num;
|
zone->number = vzone_num;
|
||||||
zone->builders = strdup("None");
|
zone->builders = strdup("None");
|
||||||
|
|
@ -234,7 +234,7 @@ void create_world_index(int znum, const char *type)
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/*
|
/*
|
||||||
* Caller messed up
|
* Caller messed up
|
||||||
*/
|
*/
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -253,7 +253,7 @@ void create_world_index(int znum, const char *type)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Index contents must be in order: search through the old file for the
|
* Index contents must be in order: search through the old file for the
|
||||||
* right place, insert the new file, then copy the rest over.
|
* right place, insert the new file, then copy the rest over.
|
||||||
*/
|
*/
|
||||||
snprintf(buf1, sizeof(buf1), "%d.%s", znum, type);
|
snprintf(buf1, sizeof(buf1), "%d.%s", znum, type);
|
||||||
while (get_line(oldfile, buf)) {
|
while (get_line(oldfile, buf)) {
|
||||||
|
|
@ -327,7 +327,7 @@ int save_zone(zone_rnum zone_num)
|
||||||
char fname[128], oldname[128];
|
char fname[128], oldname[128];
|
||||||
const char *comment = NULL;
|
const char *comment = NULL;
|
||||||
FILE *zfile;
|
FILE *zfile;
|
||||||
|
|
||||||
#if CIRCLE_UNSIGNED_INDEX
|
#if CIRCLE_UNSIGNED_INDEX
|
||||||
if (zone_num == NOWHERE || zone_num > top_of_zone_table) {
|
if (zone_num == NOWHERE || zone_num > top_of_zone_table) {
|
||||||
#else
|
#else
|
||||||
|
|
@ -344,7 +344,7 @@ int save_zone(zone_rnum zone_num)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Print zone header to file
|
* Print zone header to file
|
||||||
*/
|
*/
|
||||||
fprintf(zfile, "#%d\n"
|
fprintf(zfile, "#%d\n"
|
||||||
"%s~\n"
|
"%s~\n"
|
||||||
|
|
@ -426,7 +426,7 @@ int save_zone(zone_rnum zone_num)
|
||||||
arg1 = ZCMD(zone_num, subcmd).arg1; /* trigger type */
|
arg1 = ZCMD(zone_num, subcmd).arg1; /* trigger type */
|
||||||
arg2 = trig_index[ZCMD(zone_num, subcmd).arg2]->vnum; /* trigger vnum */
|
arg2 = trig_index[ZCMD(zone_num, subcmd).arg2]->vnum; /* trigger vnum */
|
||||||
arg3 = world[ZCMD(zone_num, subcmd).arg3].number; /* room num */
|
arg3 = world[ZCMD(zone_num, subcmd).arg3].number; /* room num */
|
||||||
comment = GET_TRIG_NAME(trig_index[real_trigger(arg2)]->proto);
|
comment = GET_TRIG_NAME(trig_index[real_trigger(arg2)]->proto);
|
||||||
break;
|
break;
|
||||||
case 'V':
|
case 'V':
|
||||||
arg1 = ZCMD(zone_num, subcmd).arg1; /* trigger type */
|
arg1 = ZCMD(zone_num, subcmd).arg1; /* trigger type */
|
||||||
|
|
@ -447,7 +447,7 @@ int save_zone(zone_rnum zone_num)
|
||||||
ZCMD(zone_num, subcmd).command, ZCMD(zone_num, subcmd).if_flag, arg1, arg2, arg3, comment);
|
ZCMD(zone_num, subcmd).command, ZCMD(zone_num, subcmd).if_flag, arg1, arg2, arg3, comment);
|
||||||
else
|
else
|
||||||
fprintf(zfile, "%c %d %d %d %d %s %s\n",
|
fprintf(zfile, "%c %d %d %d %d %s %s\n",
|
||||||
ZCMD(zone_num, subcmd).command, ZCMD(zone_num, subcmd).if_flag, arg1, arg2, arg3,
|
ZCMD(zone_num, subcmd).command, ZCMD(zone_num, subcmd).if_flag, arg1, arg2, arg3,
|
||||||
ZCMD(zone_num, subcmd).sarg1, ZCMD(zone_num, subcmd).sarg2);
|
ZCMD(zone_num, subcmd).sarg1, ZCMD(zone_num, subcmd).sarg2);
|
||||||
}
|
}
|
||||||
fputs("S\n$\n", zfile);
|
fputs("S\n$\n", zfile);
|
||||||
|
|
@ -455,7 +455,7 @@ int save_zone(zone_rnum zone_num)
|
||||||
snprintf(oldname, sizeof(oldname), "%s/%d.zon", ZON_PREFIX, zone_table[zone_num].number);
|
snprintf(oldname, sizeof(oldname), "%s/%d.zon", ZON_PREFIX, zone_table[zone_num].number);
|
||||||
remove(oldname);
|
remove(oldname);
|
||||||
rename(fname, oldname);
|
rename(fname, oldname);
|
||||||
|
|
||||||
if (in_save_list(zone_table[zone_num].number, SL_ZON))
|
if (in_save_list(zone_table[zone_num].number, SL_ZON))
|
||||||
remove_from_save_list(zone_table[zone_num].number, SL_ZON);
|
remove_from_save_list(zone_table[zone_num].number, SL_ZON);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
@ -524,7 +524,7 @@ void remove_cmd_from_list(struct reset_com **list, int pos)
|
||||||
struct reset_com *newlist;
|
struct reset_com *newlist;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Count number of commands (not including terminator)
|
* Count number of commands (not including terminator)
|
||||||
*/
|
*/
|
||||||
count = count_commands(*list);
|
count = count_commands(*list);
|
||||||
|
|
||||||
|
|
@ -553,7 +553,7 @@ void remove_cmd_from_list(struct reset_com **list, int pos)
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Error check user input and then add new (blank) command
|
* Error check user input and then add new (blank) command
|
||||||
*/
|
*/
|
||||||
int new_command(struct zone_data *zone, int pos)
|
int new_command(struct zone_data *zone, int pos)
|
||||||
{
|
{
|
||||||
|
|
@ -561,7 +561,7 @@ int new_command(struct zone_data *zone, int pos)
|
||||||
struct reset_com *new_com;
|
struct reset_com *new_com;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Error check to ensure users hasn't given too large an index
|
* Error check to ensure users hasn't given too large an index
|
||||||
*/
|
*/
|
||||||
while (zone->cmd[subcmd].command != 'S')
|
while (zone->cmd[subcmd].command != 'S')
|
||||||
subcmd++;
|
subcmd++;
|
||||||
|
|
@ -570,7 +570,7 @@ int new_command(struct zone_data *zone, int pos)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ok, let's add a new (blank) command
|
* Ok, let's add a new (blank) command
|
||||||
*/
|
*/
|
||||||
CREATE(new_com, struct reset_com, 1);
|
CREATE(new_com, struct reset_com, 1);
|
||||||
new_com->command = 'N';
|
new_com->command = 'N';
|
||||||
|
|
@ -581,14 +581,14 @@ int new_command(struct zone_data *zone, int pos)
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Error check user input and then remove command
|
* Error check user input and then remove command
|
||||||
*/
|
*/
|
||||||
void delete_zone_command(struct zone_data *zone, int pos)
|
void delete_zone_command(struct zone_data *zone, int pos)
|
||||||
{
|
{
|
||||||
int subcmd = 0;
|
int subcmd = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Error check to ensure users hasn't given too large an index
|
* Error check to ensure users hasn't given too large an index
|
||||||
*/
|
*/
|
||||||
while (zone->cmd[subcmd].command != 'S')
|
while (zone->cmd[subcmd].command != 'S')
|
||||||
subcmd++;
|
subcmd++;
|
||||||
|
|
@ -597,7 +597,7 @@ void delete_zone_command(struct zone_data *zone, int pos)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Ok, let's zap it
|
* Ok, let's zap it
|
||||||
*/
|
*/
|
||||||
remove_cmd_from_list(&zone->cmd, pos);
|
remove_cmd_from_list(&zone->cmd, pos);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -99,7 +99,7 @@ void bfs_clear_queue(void)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* find_first_step: given a source room and a target room, find the first
|
* find_first_step: given a source room and a target room, find the first
|
||||||
* step on the shortest path from the source to the target.
|
* step on the shortest path from the source to the target.
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -72,7 +72,7 @@ int is_name(const char *str, const char *namelist)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (LOWER(*curstr) != LOWER(*curname))
|
if (LOWER(*curstr) != LOWER(*curname))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* skip to next name */
|
/* skip to next name */
|
||||||
|
|
@ -109,7 +109,7 @@ int isname(const char *str, const char *namelist)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
void affect_modify(struct char_data *ch, byte loc, sbyte mod,
|
void affect_modify(struct char_data *ch, byte loc, sbyte mod,
|
||||||
bitvector_t bitv, bool add)
|
bitvector_t bitv, bool add)
|
||||||
{
|
{
|
||||||
if (add)
|
if (add)
|
||||||
|
|
@ -825,12 +825,12 @@ void extract_obj(struct obj_data *obj)
|
||||||
if (GET_OBJ_RNUM(obj) != NOTHING)
|
if (GET_OBJ_RNUM(obj) != NOTHING)
|
||||||
(obj_index[GET_OBJ_RNUM(obj)].number)--;
|
(obj_index[GET_OBJ_RNUM(obj)].number)--;
|
||||||
|
|
||||||
if (SCRIPT(obj))
|
if (SCRIPT(obj))
|
||||||
extract_script(obj, OBJ_TRIGGER);
|
extract_script(obj, OBJ_TRIGGER);
|
||||||
|
|
||||||
if (GET_OBJ_RNUM(obj) == NOTHING || obj->proto_script != obj_proto[GET_OBJ_RNUM(obj)].proto_script)
|
if (GET_OBJ_RNUM(obj) == NOTHING || obj->proto_script != obj_proto[GET_OBJ_RNUM(obj)].proto_script)
|
||||||
free_proto_script(obj, OBJ_TRIGGER);
|
free_proto_script(obj, OBJ_TRIGGER);
|
||||||
|
|
||||||
free_obj(obj);
|
free_obj(obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -969,7 +969,7 @@ void extract_char_final(struct char_data *ch)
|
||||||
mob_index[GET_MOB_RNUM(ch)].number--;
|
mob_index[GET_MOB_RNUM(ch)].number--;
|
||||||
clearMemory(ch);
|
clearMemory(ch);
|
||||||
|
|
||||||
if (SCRIPT(ch))
|
if (SCRIPT(ch))
|
||||||
extract_script(ch, MOB_TRIGGER);
|
extract_script(ch, MOB_TRIGGER);
|
||||||
|
|
||||||
if (SCRIPT_MEM(ch))
|
if (SCRIPT_MEM(ch))
|
||||||
|
|
|
||||||
158
src/hedit.c
158
src/hedit.c
|
|
@ -83,7 +83,7 @@ void load_help(FILE *fl, char *name)
|
||||||
log("SYSERR: Help entry does not have a min level. %s", key);
|
log("SYSERR: Help entry does not have a min level. %s", key);
|
||||||
el.min_level = 0;
|
el.min_level = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
el.duplicate = 0;
|
el.duplicate = 0;
|
||||||
el.entry = strdup(entry);
|
el.entry = strdup(entry);
|
||||||
scan = one_word(key, next_key);
|
scan = one_word(key, next_key);
|
||||||
|
|
@ -92,10 +92,10 @@ void load_help(FILE *fl, char *name)
|
||||||
help_table[top_of_h_table++] = el;
|
help_table[top_of_h_table++] = el;
|
||||||
el.duplicate++;
|
el.duplicate++;
|
||||||
scan = one_word(scan, next_key);
|
scan = one_word(scan, next_key);
|
||||||
}
|
}
|
||||||
/* get next keyword line (or $) */
|
/* get next keyword line (or $) */
|
||||||
get_one_line(fl, key);
|
get_one_line(fl, key);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int hsort(const void *a, const void *b)
|
int hsort(const void *a, const void *b)
|
||||||
|
|
@ -111,8 +111,8 @@ int hsort(const void *a, const void *b)
|
||||||
ACMD(do_oasis_hedit)
|
ACMD(do_oasis_hedit)
|
||||||
{
|
{
|
||||||
struct descriptor_data *d;
|
struct descriptor_data *d;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!can_edit_zone(ch, HEDIT_PERMISSION)) {
|
if (!can_edit_zone(ch, HEDIT_PERMISSION)) {
|
||||||
send_to_char(ch, "You don't have access to editing Help files.\r\n");
|
send_to_char(ch, "You don't have access to editing Help files.\r\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -125,7 +125,7 @@ ACMD(do_oasis_hedit)
|
||||||
}
|
}
|
||||||
|
|
||||||
skip_spaces(&argument);
|
skip_spaces(&argument);
|
||||||
|
|
||||||
if (!*argument) {
|
if (!*argument) {
|
||||||
send_to_char(ch, "Please specify a help entry to edit.\r\n");
|
send_to_char(ch, "Please specify a help entry to edit.\r\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -140,7 +140,7 @@ ACMD(do_oasis_hedit)
|
||||||
send_to_char(ch, "Done.\r\n");
|
send_to_char(ch, "Done.\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Give descriptor an OLC structure.
|
* Give descriptor an OLC structure.
|
||||||
|
|
@ -155,16 +155,16 @@ ACMD(do_oasis_hedit)
|
||||||
OLC_NUM(d) = 0;
|
OLC_NUM(d) = 0;
|
||||||
OLC_STORAGE(d) = strdup(argument);
|
OLC_STORAGE(d) = strdup(argument);
|
||||||
OLC_ZNUM(d) = search_help(ch, OLC_STORAGE(d));
|
OLC_ZNUM(d) = search_help(ch, OLC_STORAGE(d));
|
||||||
|
|
||||||
for(i = 0; i < (int)strlen(argument); i++)
|
for(i = 0; i < (int)strlen(argument); i++)
|
||||||
argument[i] = toupper(argument[i]);
|
argument[i] = toupper(argument[i]);
|
||||||
|
|
||||||
if (OLC_ZNUM(d) <= 0)
|
if (OLC_ZNUM(d) <= 0)
|
||||||
hedit_setup_new(d, OLC_STORAGE(d));
|
hedit_setup_new(d, OLC_STORAGE(d));
|
||||||
else
|
else
|
||||||
hedit_setup_existing(d, OLC_ZNUM(d));
|
hedit_setup_existing(d, OLC_ZNUM(d));
|
||||||
|
|
||||||
|
|
||||||
STATE(d) = CON_HEDIT;
|
STATE(d) = CON_HEDIT;
|
||||||
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||||
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
||||||
|
|
@ -236,8 +236,8 @@ void hedit_save_to_disk(struct descriptor_data *d)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
char buf1[MAX_STRING_LENGTH], index_name[READ_SIZE], buf[READ_SIZE];
|
char buf1[MAX_STRING_LENGTH], index_name[READ_SIZE], buf[READ_SIZE];
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
snprintf(index_name, sizeof(index_name), "%s%s", HLP_PREFIX, HELP_FILE);
|
snprintf(index_name, sizeof(index_name), "%s%s", HLP_PREFIX, HELP_FILE);
|
||||||
if (!(fp = fopen(index_name, "w"))) {
|
if (!(fp = fopen(index_name, "w"))) {
|
||||||
log("SYSERR: Could not write help index file");
|
log("SYSERR: Could not write help index file");
|
||||||
|
|
@ -249,8 +249,8 @@ void hedit_save_to_disk(struct descriptor_data *d)
|
||||||
continue;
|
continue;
|
||||||
strncpy(buf1, help_table[i].entry ? help_table[i].entry : "Empty\n\r", sizeof(buf1) - 1);
|
strncpy(buf1, help_table[i].entry ? help_table[i].entry : "Empty\n\r", sizeof(buf1) - 1);
|
||||||
strip_cr(buf1);
|
strip_cr(buf1);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Forget making a buffer, lets just write the thing now.
|
* Forget making a buffer, lets just write the thing now.
|
||||||
*/
|
*/
|
||||||
fprintf(fp, "%s" "#%d\n", buf1, help_table[i].min_level);
|
fprintf(fp, "%s" "#%d\n", buf1, help_table[i].min_level);
|
||||||
|
|
@ -264,7 +264,7 @@ void hedit_save_to_disk(struct descriptor_data *d)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Menu functions
|
Menu functions
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -274,9 +274,9 @@ void hedit_disp_menu(struct descriptor_data *d)
|
||||||
{
|
{
|
||||||
clear_screen(d);
|
clear_screen(d);
|
||||||
write_to_output(d,
|
write_to_output(d,
|
||||||
|
|
||||||
"\r\n@c-------------------------------------------------------------------------@n\r\n"
|
"\r\n@c-------------------------------------------------------------------------@n\r\n"
|
||||||
" @CHelpfile Editor@n \r\n"
|
" @CHelpfile Editor@n \r\n"
|
||||||
"@c-------------------------------------------------------------------------@n\r\n"
|
"@c-------------------------------------------------------------------------@n\r\n"
|
||||||
"@g1@n) Keyword [@G%-12s@g]@n\r\n"
|
"@g1@n) Keyword [@G%-12s@g]@n\r\n"
|
||||||
"@g2@n) Entry : \n@y%s\r\n"
|
"@g2@n) Entry : \n@y%s\r\n"
|
||||||
|
|
@ -310,9 +310,9 @@ void hedit_parse(struct descriptor_data *d, char *arg)
|
||||||
snprintf(buf, sizeof(buf), "OLC: %s edits help for %s.", GET_NAME(d->character), OLC_HELP(d)->keywords);
|
snprintf(buf, sizeof(buf), "OLC: %s edits help for %s.", GET_NAME(d->character), OLC_HELP(d)->keywords);
|
||||||
mudlog(TRUE, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), CMP, buf);
|
mudlog(TRUE, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), CMP, buf);
|
||||||
write_to_output(d, "Help files saved to disk.\r\n");
|
write_to_output(d, "Help files saved to disk.\r\n");
|
||||||
hedit_save_internally(d);
|
hedit_save_internally(d);
|
||||||
/*
|
/*
|
||||||
* Do NOT free strings! Just the help structure.
|
* Do NOT free strings! Just the help structure.
|
||||||
*/
|
*/
|
||||||
cleanup_olc(d, CLEANUP_STRUCTS);
|
cleanup_olc(d, CLEANUP_STRUCTS);
|
||||||
break;
|
break;
|
||||||
|
|
@ -419,66 +419,66 @@ void hedit_string_cleanup(struct descriptor_data *d, int terminator)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ACMD(do_helpcheck)
|
ACMD(do_helpcheck)
|
||||||
{
|
{
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
int i, w = 0;
|
int i, w = 0;
|
||||||
char arg[64];
|
char arg[64];
|
||||||
ACMD(do_action);
|
ACMD(do_action);
|
||||||
|
|
||||||
if(!help_table) {
|
if(!help_table) {
|
||||||
send_to_char(ch, "The help_table doesn't exist!\r\n");
|
send_to_char(ch, "The help_table doesn't exist!\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sprintf(buf, "\r\n");
|
sprintf(buf, "\r\n");
|
||||||
strcpy(buf, "Commands without help entries:\r\n");
|
strcpy(buf, "Commands without help entries:\r\n");
|
||||||
strcat(buf, "-------------------------------------------------------------------\r\n");
|
strcat(buf, "-------------------------------------------------------------------\r\n");
|
||||||
|
|
||||||
for(i = 1; *(complete_cmd_info[i].command) != '\n'; i++) {
|
for(i = 1; *(complete_cmd_info[i].command) != '\n'; i++) {
|
||||||
snprintf(arg, sizeof(arg), "%s", complete_cmd_info[i].command);
|
snprintf(arg, sizeof(arg), "%s", complete_cmd_info[i].command);
|
||||||
if(search_help(ch, arg) <= 0) {
|
if(search_help(ch, arg) <= 0) {
|
||||||
if(complete_cmd_info[i].command_pointer == do_action)
|
if(complete_cmd_info[i].command_pointer == do_action)
|
||||||
continue;
|
continue;
|
||||||
w++;
|
w++;
|
||||||
w = w%3;
|
w = w%3;
|
||||||
sprintf(buf + strlen(buf), " %-20.20s%s", complete_cmd_info[i].command, (w ? "|":"\r\n"));
|
sprintf(buf + strlen(buf), " %-20.20s%s", complete_cmd_info[i].command, (w ? "|":"\r\n"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(w)
|
if(w)
|
||||||
strcat(buf, "\r\n");
|
strcat(buf, "\r\n");
|
||||||
|
|
||||||
if(ch->desc)
|
if(ch->desc)
|
||||||
page_string(ch->desc, buf, 1);
|
page_string(ch->desc, buf, 1);
|
||||||
|
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
ACMD(do_hindex)
|
ACMD(do_hindex)
|
||||||
{
|
{
|
||||||
int len, count = 0, i;
|
int len, count = 0, i;
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
skip_spaces(&argument);
|
skip_spaces(&argument);
|
||||||
|
|
||||||
if (!*argument) {
|
if (!*argument) {
|
||||||
send_to_char(ch, "Usage: hindex <string>\r\n");
|
send_to_char(ch, "Usage: hindex <string>\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
len = sprintf(buf, "Help index entries based on '%s':\r\n", argument);
|
len = sprintf(buf, "Help index entries based on '%s':\r\n", argument);
|
||||||
for (i = 0; i <= top_of_h_table; i++)
|
for (i = 0; i <= top_of_h_table; i++)
|
||||||
if (is_abbrev(argument, help_table[i].keywords) && (GET_LEVEL(ch) >= help_table[i].min_level))
|
if (is_abbrev(argument, help_table[i].keywords) && (GET_LEVEL(ch) >= help_table[i].min_level))
|
||||||
len += snprintf(buf + len, sizeof(buf) - len, "%-20.20s%s",
|
len += snprintf(buf + len, sizeof(buf) - len, "%-20.20s%s",
|
||||||
help_table[i].keywords, (++count % 3 ? "" : "\r\n"));
|
help_table[i].keywords, (++count % 3 ? "" : "\r\n"));
|
||||||
|
|
||||||
if (count % 3)
|
if (count % 3)
|
||||||
len += snprintf(buf + len, sizeof(buf) - len, "\r\n");
|
len += snprintf(buf + len, sizeof(buf) - len, "\r\n");
|
||||||
|
|
||||||
if (!count)
|
if (!count)
|
||||||
len += snprintf(buf + len, sizeof(buf) - len, " None.\r\n");
|
len += snprintf(buf + len, sizeof(buf) - len, " None.\r\n");
|
||||||
|
|
||||||
page_string(ch->desc, buf, TRUE);
|
page_string(ch->desc, buf, TRUE);
|
||||||
}
|
}
|
||||||
|
|
||||||
void free_help(struct help_index_element *help)
|
void free_help(struct help_index_element *help)
|
||||||
|
|
@ -496,7 +496,7 @@ void free_help(struct help_index_element *help)
|
||||||
void free_help_table(void)
|
void free_help_table(void)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (help_table) {
|
if (help_table) {
|
||||||
for (i = 0; i <= top_of_h_table; i++) {
|
for (i = 0; i <= top_of_h_table; i++) {
|
||||||
if (help_table[i].keywords)
|
if (help_table[i].keywords)
|
||||||
|
|
|
||||||
36
src/house.c
36
src/house.c
|
|
@ -84,7 +84,7 @@ int House_load(room_vnum vnum)
|
||||||
for (current = loaded; current != NULL; current = current->next)
|
for (current = loaded; current != NULL; current = current->next)
|
||||||
obj_to_room(current->obj, rnum);
|
obj_to_room(current->obj, rnum);
|
||||||
|
|
||||||
/* now it's safe to free the obj_save_data list - all members of it
|
/* now it's safe to free the obj_save_data list - all members of it
|
||||||
* have been put in the correct lists by obj_to_room()
|
* have been put in the correct lists by obj_to_room()
|
||||||
*/
|
*/
|
||||||
while (loaded != NULL) {
|
while (loaded != NULL) {
|
||||||
|
|
@ -197,10 +197,10 @@ void House_listrent(struct char_data *ch, room_vnum vnum)
|
||||||
loaded = objsave_parse_objects(fl);
|
loaded = objsave_parse_objects(fl);
|
||||||
|
|
||||||
for (current = loaded; current != NULL; current = current->next)
|
for (current = loaded; current != NULL; current = current->next)
|
||||||
len += snprintf(buf+len, sizeof(buf)-len, " [%5d] (%5dau) %s\r\n",
|
len += snprintf(buf+len, sizeof(buf)-len, " [%5d] (%5dau) %s\r\n",
|
||||||
GET_OBJ_VNUM(current->obj), GET_OBJ_RENT(current->obj), current->obj->short_description);
|
GET_OBJ_VNUM(current->obj), GET_OBJ_RENT(current->obj), current->obj->short_description);
|
||||||
|
|
||||||
/* now it's safe to free the obj_save_data list - all members of it
|
/* now it's safe to free the obj_save_data list - all members of it
|
||||||
* have been put in the correct lists by obj_to_room()
|
* have been put in the correct lists by obj_to_room()
|
||||||
*/
|
*/
|
||||||
while (loaded != NULL) {
|
while (loaded != NULL) {
|
||||||
|
|
@ -320,12 +320,12 @@ void hcontrol_list_houses(struct char_data *ch, char *arg)
|
||||||
|
|
||||||
if (arg && *arg) {
|
if (arg && *arg) {
|
||||||
room_vnum toshow;
|
room_vnum toshow;
|
||||||
|
|
||||||
if (*arg == '.')
|
if (*arg == '.')
|
||||||
toshow = GET_ROOM_VNUM(IN_ROOM(ch));
|
toshow = GET_ROOM_VNUM(IN_ROOM(ch));
|
||||||
else
|
else
|
||||||
toshow = atoi(arg);
|
toshow = atoi(arg);
|
||||||
|
|
||||||
if ((i = find_house(toshow)) == NOWHERE) {
|
if ((i = find_house(toshow)) == NOWHERE) {
|
||||||
send_to_char(ch, "Unknown house, \"%s\".\r\n", arg);
|
send_to_char(ch, "Unknown house, \"%s\".\r\n", arg);
|
||||||
return;
|
return;
|
||||||
|
|
@ -665,13 +665,13 @@ void House_list_guests(struct char_data *ch, int i, int quiet)
|
||||||
* Welcor *
|
* Welcor *
|
||||||
* ***********************************************************************/
|
* ***********************************************************************/
|
||||||
/*
|
/*
|
||||||
* Code for conversion to ascii house rent files
|
* Code for conversion to ascii house rent files
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void hcontrol_convert_houses(struct char_data *ch)
|
void hcontrol_convert_houses(struct char_data *ch)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (GET_LEVEL(ch) < LVL_IMPL)
|
if (GET_LEVEL(ch) < LVL_IMPL)
|
||||||
{
|
{
|
||||||
send_to_char(ch, "Sorry, but you are not powerful enough to do that.\r\n");
|
send_to_char(ch, "Sorry, but you are not powerful enough to do that.\r\n");
|
||||||
|
|
@ -688,16 +688,16 @@ void hcontrol_convert_houses(struct char_data *ch)
|
||||||
|
|
||||||
for (i = 0; i < num_of_houses; i++) {
|
for (i = 0; i < num_of_houses; i++) {
|
||||||
send_to_char(ch, " %d", house_control[i].vnum);
|
send_to_char(ch, " %d", house_control[i].vnum);
|
||||||
|
|
||||||
if (!ascii_convert_house(ch, house_control[i].vnum))
|
if (!ascii_convert_house(ch, house_control[i].vnum))
|
||||||
{
|
{
|
||||||
// let ascii_convert_house() tell about the error
|
// let ascii_convert_house() tell about the error
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
send_to_char(ch, "...done\r\n");
|
send_to_char(ch, "...done\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
send_to_char(ch, "All done.\r\n");
|
send_to_char(ch, "All done.\r\n");
|
||||||
}
|
}
|
||||||
|
|
@ -709,12 +709,12 @@ int ascii_convert_house(struct char_data *ch, obj_vnum vnum)
|
||||||
char infile[MAX_INPUT_LENGTH], *outfile;
|
char infile[MAX_INPUT_LENGTH], *outfile;
|
||||||
struct obj_data *tmp;
|
struct obj_data *tmp;
|
||||||
int i, j=0;
|
int i, j=0;
|
||||||
|
|
||||||
House_get_filename(vnum, infile, sizeof(infile));
|
House_get_filename(vnum, infile, sizeof(infile));
|
||||||
|
|
||||||
CREATE(outfile, char, strlen(infile)+7);
|
CREATE(outfile, char, strlen(infile)+7);
|
||||||
sprintf(outfile, "%s.ascii", infile);
|
sprintf(outfile, "%s.ascii", infile);
|
||||||
|
|
||||||
if (!(in = fopen(infile, "r+b"))) /* no file found */
|
if (!(in = fopen(infile, "r+b"))) /* no file found */
|
||||||
{
|
{
|
||||||
send_to_char(ch, "...no object file found\r\n");
|
send_to_char(ch, "...no object file found\r\n");
|
||||||
|
|
@ -741,7 +741,7 @@ int ascii_convert_house(struct char_data *ch, obj_vnum vnum)
|
||||||
fclose(out);
|
fclose(out);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
if (!feof(in))
|
if (!feof(in))
|
||||||
{
|
{
|
||||||
tmp = Obj_from_store(object, &i);
|
tmp = Obj_from_store(object, &i);
|
||||||
if (!objsave_save_obj_record(tmp, out, i))
|
if (!objsave_save_obj_record(tmp, out, i))
|
||||||
|
|
@ -755,16 +755,16 @@ int ascii_convert_house(struct char_data *ch, obj_vnum vnum)
|
||||||
j++;
|
j++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fprintf(out, "$~\n");
|
fprintf(out, "$~\n");
|
||||||
|
|
||||||
fclose(in);
|
fclose(in);
|
||||||
fclose(out);
|
fclose(out);
|
||||||
|
|
||||||
// copy the new file over the old one
|
// copy the new file over the old one
|
||||||
// remove(infile);
|
// remove(infile);
|
||||||
// rename(outfile, infile);
|
// rename(outfile, infile);
|
||||||
|
|
||||||
free(outfile);
|
free(outfile);
|
||||||
|
|
||||||
send_to_char(ch, "...%d items", j);
|
send_to_char(ch, "...%d items", j);
|
||||||
|
|
|
||||||
|
|
@ -106,7 +106,7 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d)
|
||||||
|
|
||||||
switch (command) {
|
switch (command) {
|
||||||
case PARSE_HELP:
|
case PARSE_HELP:
|
||||||
write_to_output(d,
|
write_to_output(d,
|
||||||
"Editor command formats: /<letter>\r\n\r\n"
|
"Editor command formats: /<letter>\r\n\r\n"
|
||||||
"/a - aborts editor\r\n"
|
"/a - aborts editor\r\n"
|
||||||
"/c - clears buffer\r\n"
|
"/c - clears buffer\r\n"
|
||||||
|
|
@ -134,7 +134,7 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d)
|
||||||
flags += FORMAT_INDENT;
|
flags += FORMAT_INDENT;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
switch (sscanf((indent ? string + 1 : string), " %d - %d ", &line_low, &line_high))
|
switch (sscanf((indent ? string + 1 : string), " %d - %d ", &line_low, &line_high))
|
||||||
{
|
{
|
||||||
case -1:
|
case -1:
|
||||||
case 0:
|
case 0:
|
||||||
|
|
@ -242,7 +242,7 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d)
|
||||||
case PARSE_LIST_NORM:
|
case PARSE_LIST_NORM:
|
||||||
/*
|
/*
|
||||||
* Note: Rv's buf, buf1, buf2, and arg variables are defined to 32k so
|
* Note: Rv's buf, buf1, buf2, and arg variables are defined to 32k so
|
||||||
* they are probly ok for what to do here.
|
* they are probly ok for what to do here.
|
||||||
*/
|
*/
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
if (*string)
|
if (*string)
|
||||||
|
|
@ -298,13 +298,13 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d)
|
||||||
/*
|
/*
|
||||||
* This is kind of annoying...but some people like it.
|
* This is kind of annoying...but some people like it.
|
||||||
*/
|
*/
|
||||||
sprintf(buf + strlen(buf), "\r\n%d line%sshown.\r\n", total_len, (total_len != 1) ? "s " : " ");
|
sprintf(buf + strlen(buf), "\r\n%d line%sshown.\r\n", total_len, (total_len != 1) ? "s " : " ");
|
||||||
page_string(d, buf, TRUE);
|
page_string(d, buf, TRUE);
|
||||||
break;
|
break;
|
||||||
case PARSE_LIST_NUM:
|
case PARSE_LIST_NUM:
|
||||||
/*
|
/*
|
||||||
* Note: Rv's buf, buf1, buf2, and arg variables are defined to 32k so
|
* Note: Rv's buf, buf1, buf2, and arg variables are defined to 32k so
|
||||||
* they are probly ok for what to do here.
|
* they are probly ok for what to do here.
|
||||||
*/
|
*/
|
||||||
*buf = '\0';
|
*buf = '\0';
|
||||||
if (*string)
|
if (*string)
|
||||||
|
|
@ -469,7 +469,7 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d)
|
||||||
/*
|
/*
|
||||||
* This means that we are at the END of the line, we want out of
|
* This means that we are at the END of the line, we want out of
|
||||||
* there, but we want s to point to the beginning of the line
|
* there, but we want s to point to the beginning of the line
|
||||||
* AFTER the line we want edited
|
* AFTER the line we want edited
|
||||||
*/
|
*/
|
||||||
s++;
|
s++;
|
||||||
/*
|
/*
|
||||||
|
|
@ -507,158 +507,158 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d)
|
||||||
* Re-formats message type formatted char *.
|
* Re-formats message type formatted char *.
|
||||||
* (for strings edited with d->str) (mostly olc and mail)
|
* (for strings edited with d->str) (mostly olc and mail)
|
||||||
*/
|
*/
|
||||||
int format_text(char **ptr_string, int mode, struct descriptor_data *d, unsigned int maxlen, int low, int high)
|
int format_text(char **ptr_string, int mode, struct descriptor_data *d, unsigned int maxlen, int low, int high)
|
||||||
{
|
{
|
||||||
int line_chars, cap_next = TRUE, cap_next_next = FALSE, color_chars = 0, i, pass_line = 0;
|
int line_chars, cap_next = TRUE, cap_next_next = FALSE, color_chars = 0, i, pass_line = 0;
|
||||||
char *flow, *start = NULL, temp;
|
char *flow, *start = NULL, temp;
|
||||||
char formatted[MAX_STRING_LENGTH] = "";
|
char formatted[MAX_STRING_LENGTH] = "";
|
||||||
|
|
||||||
/* Fix memory overrun. */
|
/* Fix memory overrun. */
|
||||||
if (d->max_str > MAX_STRING_LENGTH) {
|
if (d->max_str > MAX_STRING_LENGTH) {
|
||||||
log("SYSERR: format_text: max_str is greater than buffer size.");
|
log("SYSERR: format_text: max_str is greater than buffer size.");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: Want to make sure the string doesn't grow either... */
|
/* XXX: Want to make sure the string doesn't grow either... */
|
||||||
|
|
||||||
if ((flow = *ptr_string) == NULL)
|
if ((flow = *ptr_string) == NULL)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
char str[MAX_STRING_LENGTH];
|
char str[MAX_STRING_LENGTH];
|
||||||
strcpy(str, flow);
|
strcpy(str, flow);
|
||||||
|
|
||||||
for (i = 0; i < low - 1; i++) {
|
for (i = 0; i < low - 1; i++) {
|
||||||
start = strtok(str, "\n");
|
start = strtok(str, "\n");
|
||||||
if (!start) {
|
if (!start) {
|
||||||
write_to_output(d, "There aren't that many lines!\r\n");
|
write_to_output(d, "There aren't that many lines!\r\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
strcat(formatted, strcat(start, "\n"));
|
strcat(formatted, strcat(start, "\n"));
|
||||||
flow = strstr(flow, "\n");
|
flow = strstr(flow, "\n");
|
||||||
strcpy(str, ++flow);
|
strcpy(str, ++flow);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (IS_SET(mode, FORMAT_INDENT)) {
|
if (IS_SET(mode, FORMAT_INDENT)) {
|
||||||
strcat(formatted, " ");
|
strcat(formatted, " ");
|
||||||
line_chars = 3;
|
line_chars = 3;
|
||||||
} else {
|
} else {
|
||||||
line_chars = 0;
|
line_chars = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
while (*flow && i < high) {
|
while (*flow && i < high) {
|
||||||
while (*flow && strchr("\n\r\f\t\v ", *flow)) {
|
while (*flow && strchr("\n\r\f\t\v ", *flow)) {
|
||||||
if (*flow == '\n' && !pass_line)
|
if (*flow == '\n' && !pass_line)
|
||||||
if (i++ >= high) {
|
if (i++ >= high) {
|
||||||
pass_line = 1;
|
pass_line = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
flow++;
|
flow++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*flow) {
|
if (*flow) {
|
||||||
start = flow;
|
start = flow;
|
||||||
while (*flow && !strchr("\n\r\f\t\v .?!", *flow)) {
|
while (*flow && !strchr("\n\r\f\t\v .?!", *flow)) {
|
||||||
if (*flow == '@') {
|
if (*flow == '@') {
|
||||||
if (*(flow + 1) == '@')
|
if (*(flow + 1) == '@')
|
||||||
color_chars++;
|
color_chars++;
|
||||||
else
|
else
|
||||||
color_chars += 2;
|
color_chars += 2;
|
||||||
flow++;
|
flow++;
|
||||||
}
|
}
|
||||||
flow++;
|
flow++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cap_next_next) {
|
if (cap_next_next) {
|
||||||
cap_next_next = FALSE;
|
cap_next_next = FALSE;
|
||||||
cap_next = TRUE;
|
cap_next = TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* This is so that if we stopped on a sentence .. we move off the
|
* This is so that if we stopped on a sentence .. we move off the
|
||||||
* sentence delimiter.
|
* sentence delimiter.
|
||||||
*/
|
*/
|
||||||
while (strchr(".!?", *flow)) {
|
while (strchr(".!?", *flow)) {
|
||||||
cap_next_next = TRUE;
|
cap_next_next = TRUE;
|
||||||
flow++;
|
flow++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* special case: if we're at the end of the last line, and the last
|
* special case: if we're at the end of the last line, and the last
|
||||||
* character is a delimiter, the flow++ above will have *flow pointing
|
* character is a delimiter, the flow++ above will have *flow pointing
|
||||||
* to the \r (or \n) character after the delimiter. Thus *flow will
|
* to the \r (or \n) character after the delimiter. Thus *flow will
|
||||||
* be non-null, and an extra (blank) line might be added erroneously.
|
* be non-null, and an extra (blank) line might be added erroneously.
|
||||||
* We fix it by skipping the newline characters in between.
|
* We fix it by skipping the newline characters in between.
|
||||||
*
|
*
|
||||||
* Welcor 04/04
|
* Welcor 04/04
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if (strchr("\n\r", *flow)) {
|
if (strchr("\n\r", *flow)) {
|
||||||
*flow = '\0'; /* terminate 'start' string */
|
*flow = '\0'; /* terminate 'start' string */
|
||||||
flow++; /* we know this is safe */
|
flow++; /* we know this is safe */
|
||||||
if (*flow == '\n' && i++ >= high)
|
if (*flow == '\n' && i++ >= high)
|
||||||
pass_line = 1;
|
pass_line = 1;
|
||||||
|
|
||||||
while (*flow && strchr("\n\r", *flow) && !pass_line) {
|
while (*flow && strchr("\n\r", *flow) && !pass_line) {
|
||||||
flow++; /* skip to next non-delimiter */
|
flow++; /* skip to next non-delimiter */
|
||||||
if (*flow == '\n' && i++ >= high)
|
if (*flow == '\n' && i++ >= high)
|
||||||
pass_line = 1;
|
pass_line = 1;
|
||||||
}
|
}
|
||||||
temp = *flow; /* save this char */
|
temp = *flow; /* save this char */
|
||||||
} else {
|
} else {
|
||||||
temp = *flow;
|
temp = *flow;
|
||||||
*flow = '\0';
|
*flow = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
if (line_chars + strlen(start) + 1 - color_chars > PAGE_WIDTH) {
|
if (line_chars + strlen(start) + 1 - color_chars > PAGE_WIDTH) {
|
||||||
strcat(formatted, "\r\n");
|
strcat(formatted, "\r\n");
|
||||||
line_chars = 0;
|
line_chars = 0;
|
||||||
color_chars = count_color_chars(start);
|
color_chars = count_color_chars(start);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cap_next) {
|
if (!cap_next) {
|
||||||
if (line_chars > 0) {
|
if (line_chars > 0) {
|
||||||
strcat(formatted, " ");
|
strcat(formatted, " ");
|
||||||
line_chars++;
|
line_chars++;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
cap_next = FALSE;
|
cap_next = FALSE;
|
||||||
CAP(start);
|
CAP(start);
|
||||||
}
|
}
|
||||||
|
|
||||||
line_chars += strlen(start);
|
line_chars += strlen(start);
|
||||||
strcat(formatted, start);
|
strcat(formatted, start);
|
||||||
|
|
||||||
*flow = temp;
|
*flow = temp;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (cap_next_next && *flow) {
|
if (cap_next_next && *flow) {
|
||||||
if (line_chars + 3 - color_chars > PAGE_WIDTH) {
|
if (line_chars + 3 - color_chars > PAGE_WIDTH) {
|
||||||
strcat(formatted, "\r\n");
|
strcat(formatted, "\r\n");
|
||||||
line_chars = 0;
|
line_chars = 0;
|
||||||
color_chars = count_color_chars(start);
|
color_chars = count_color_chars(start);
|
||||||
} else if (*flow == '\"' || *flow == '\'') {
|
} else if (*flow == '\"' || *flow == '\'') {
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
sprintf(buf, "%c ", *flow);
|
sprintf(buf, "%c ", *flow);
|
||||||
strcat(formatted, buf);
|
strcat(formatted, buf);
|
||||||
flow++;
|
flow++;
|
||||||
line_chars++;
|
line_chars++;
|
||||||
} else {
|
} else {
|
||||||
strcat(formatted, " ");
|
strcat(formatted, " ");
|
||||||
line_chars += 2;
|
line_chars += 2;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (*flow)
|
if (*flow)
|
||||||
strcat(formatted, "\r\n");
|
strcat(formatted, "\r\n");
|
||||||
strcat(formatted, flow);
|
strcat(formatted, flow);
|
||||||
if (!*flow)
|
if (!*flow)
|
||||||
strcat(formatted, "\r\n");
|
strcat(formatted, "\r\n");
|
||||||
|
|
||||||
if (strlen(formatted) + 1 > maxlen)
|
if (strlen(formatted) + 1 > maxlen)
|
||||||
formatted[maxlen - 1] = '\0';
|
formatted[maxlen - 1] = '\0';
|
||||||
RECREATE(*ptr_string, char, MIN(maxlen, strlen(formatted) + 1));
|
RECREATE(*ptr_string, char, MIN(maxlen, strlen(formatted) + 1));
|
||||||
strcpy(*ptr_string, formatted);
|
strcpy(*ptr_string, formatted);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int replace_str(char **string, char *pattern, char *replacement, int rep_all, unsigned int max_size)
|
int replace_str(char **string, char *pattern, char *replacement, int rep_all, unsigned int max_size)
|
||||||
|
|
|
||||||
|
|
@ -220,7 +220,7 @@ ACMD(do_mzoneecho);
|
||||||
ACMD(do_mrecho);
|
ACMD(do_mrecho);
|
||||||
ACMD(do_vdelete);
|
ACMD(do_vdelete);
|
||||||
ACMD(do_mfollow);
|
ACMD(do_mfollow);
|
||||||
ACMD(do_tlist);
|
ACMD(do_tlist);
|
||||||
|
|
||||||
/* TBA specifics */
|
/* TBA specifics */
|
||||||
ACMD(do_file);
|
ACMD(do_file);
|
||||||
|
|
@ -256,7 +256,7 @@ cpp_extern const struct command_info cmd_info[] = {
|
||||||
{ "west" , "w" , POS_STANDING, do_move , 0, SCMD_WEST },
|
{ "west" , "w" , POS_STANDING, do_move , 0, SCMD_WEST },
|
||||||
{ "up" , "u" , POS_STANDING, do_move , 0, SCMD_UP },
|
{ "up" , "u" , POS_STANDING, do_move , 0, SCMD_UP },
|
||||||
{ "down" , "d" , POS_STANDING, do_move , 0, SCMD_DOWN },
|
{ "down" , "d" , POS_STANDING, do_move , 0, SCMD_DOWN },
|
||||||
|
|
||||||
/* now, the main list */
|
/* now, the main list */
|
||||||
{ "at" , "at" , POS_DEAD , do_at , LVL_IMMORT, 0 },
|
{ "at" , "at" , POS_DEAD , do_at , LVL_IMMORT, 0 },
|
||||||
{ "advance" , "adv" , POS_DEAD , do_advance , LVL_GOD, 0 },
|
{ "advance" , "adv" , POS_DEAD , do_advance , LVL_GOD, 0 },
|
||||||
|
|
@ -277,7 +277,7 @@ cpp_extern const struct command_info cmd_info[] = {
|
||||||
{ "buildwalk", "buildwalk", POS_STANDING, do_gen_tog, LVL_BUILDER, SCMD_BUILDWALK },
|
{ "buildwalk", "buildwalk", POS_STANDING, do_gen_tog, LVL_BUILDER, SCMD_BUILDWALK },
|
||||||
{ "buy" , "bu" , POS_STANDING, do_not_here , 0, 0 },
|
{ "buy" , "bu" , POS_STANDING, do_not_here , 0, 0 },
|
||||||
{ "bug" , "bug" , POS_DEAD , do_gen_write, 0, SCMD_BUG },
|
{ "bug" , "bug" , POS_DEAD , do_gen_write, 0, SCMD_BUG },
|
||||||
|
|
||||||
{ "cast" , "c" , POS_SITTING , do_cast , 1, 0 },
|
{ "cast" , "c" , POS_SITTING , do_cast , 1, 0 },
|
||||||
{ "cedit" , "cedit" , POS_DEAD , do_oasis , LVL_IMPL, SCMD_OASIS_CEDIT },
|
{ "cedit" , "cedit" , POS_DEAD , do_oasis , LVL_IMPL, SCMD_OASIS_CEDIT },
|
||||||
{ "check" , "ch" , POS_STANDING, do_not_here , 1, 0 },
|
{ "check" , "ch" , POS_STANDING, do_not_here , 1, 0 },
|
||||||
|
|
@ -291,7 +291,7 @@ cpp_extern const struct command_info cmd_info[] = {
|
||||||
{ "compact" , "comp" , POS_DEAD , do_gen_tog , 0, SCMD_COMPACT },
|
{ "compact" , "comp" , POS_DEAD , do_gen_tog , 0, SCMD_COMPACT },
|
||||||
{ "copyover" , "copyover", POS_DEAD , do_copyover , LVL_GRGOD, 0 },
|
{ "copyover" , "copyover", POS_DEAD , do_copyover , LVL_GRGOD, 0 },
|
||||||
{ "credits" , "cred" , POS_DEAD , do_gen_ps , 0, SCMD_CREDITS },
|
{ "credits" , "cred" , POS_DEAD , do_gen_ps , 0, SCMD_CREDITS },
|
||||||
|
|
||||||
{ "date" , "da" , POS_DEAD , do_date , LVL_IMMORT, SCMD_DATE },
|
{ "date" , "da" , POS_DEAD , do_date , LVL_IMMORT, SCMD_DATE },
|
||||||
{ "dc" , "dc" , POS_DEAD , do_dc , LVL_GOD, 0 },
|
{ "dc" , "dc" , POS_DEAD , do_dc , LVL_GOD, 0 },
|
||||||
{ "deposit" , "depo" , POS_STANDING, do_not_here , 1, 0 },
|
{ "deposit" , "depo" , POS_STANDING, do_not_here , 1, 0 },
|
||||||
|
|
@ -301,7 +301,7 @@ cpp_extern const struct command_info cmd_info[] = {
|
||||||
{ "donate" , "don" , POS_RESTING , do_drop , 0, SCMD_DONATE },
|
{ "donate" , "don" , POS_RESTING , do_drop , 0, SCMD_DONATE },
|
||||||
{ "drink" , "dri" , POS_RESTING , do_drink , 0, SCMD_DRINK },
|
{ "drink" , "dri" , POS_RESTING , do_drink , 0, SCMD_DRINK },
|
||||||
{ "drop" , "dro" , POS_RESTING , do_drop , 0, SCMD_DROP },
|
{ "drop" , "dro" , POS_RESTING , do_drop , 0, SCMD_DROP },
|
||||||
|
|
||||||
{ "eat" , "ea" , POS_RESTING , do_eat , 0, SCMD_EAT },
|
{ "eat" , "ea" , POS_RESTING , do_eat , 0, SCMD_EAT },
|
||||||
{ "echo" , "ec" , POS_SLEEPING, do_echo , LVL_IMMORT, SCMD_ECHO },
|
{ "echo" , "ec" , POS_SLEEPING, do_echo , LVL_IMMORT, SCMD_ECHO },
|
||||||
{ "emote" , "em" , POS_RESTING , do_echo , 1, SCMD_EMOTE },
|
{ "emote" , "em" , POS_RESTING , do_echo , 1, SCMD_EMOTE },
|
||||||
|
|
@ -311,14 +311,14 @@ cpp_extern const struct command_info cmd_info[] = {
|
||||||
{ "exits" , "ex" , POS_RESTING , do_exits , 0, 0 },
|
{ "exits" , "ex" , POS_RESTING , do_exits , 0, 0 },
|
||||||
{ "examine" , "exa" , POS_SITTING , do_examine , 0, 0 },
|
{ "examine" , "exa" , POS_SITTING , do_examine , 0, 0 },
|
||||||
{ "export" , "export" , POS_DEAD , do_export_zone, LVL_IMPL, 0 },
|
{ "export" , "export" , POS_DEAD , do_export_zone, LVL_IMPL, 0 },
|
||||||
|
|
||||||
{ "force" , "force" , POS_SLEEPING, do_force , LVL_GOD, 0 },
|
{ "force" , "force" , POS_SLEEPING, do_force , LVL_GOD, 0 },
|
||||||
{ "fill" , "fil" , POS_STANDING, do_pour , 0, SCMD_FILL },
|
{ "fill" , "fil" , POS_STANDING, do_pour , 0, SCMD_FILL },
|
||||||
{ "file" , "file" , POS_SLEEPING, do_file , LVL_GOD, 0 },
|
{ "file" , "file" , POS_SLEEPING, do_file , LVL_GOD, 0 },
|
||||||
{ "flee" , "fl" , POS_FIGHTING, do_flee , 1, 0 },
|
{ "flee" , "fl" , POS_FIGHTING, do_flee , 1, 0 },
|
||||||
{ "follow" , "fol" , POS_RESTING , do_follow , 0, 0 },
|
{ "follow" , "fol" , POS_RESTING , do_follow , 0, 0 },
|
||||||
{ "freeze" , "freeze" , POS_DEAD , do_wizutil , LVL_FREEZE, SCMD_FREEZE },
|
{ "freeze" , "freeze" , POS_DEAD , do_wizutil , LVL_FREEZE, SCMD_FREEZE },
|
||||||
|
|
||||||
{ "get" , "g" , POS_RESTING , do_get , 0, 0 },
|
{ "get" , "g" , POS_RESTING , do_get , 0, 0 },
|
||||||
{ "gecho" , "gecho" , POS_DEAD , do_gecho , LVL_GOD, 0 },
|
{ "gecho" , "gecho" , POS_DEAD , do_gecho , LVL_GOD, 0 },
|
||||||
{ "gemote" , "gem" , POS_SLEEPING, do_gen_comm , 0, SCMD_GEMOTE },
|
{ "gemote" , "gem" , POS_SLEEPING, do_gen_comm , 0, SCMD_GEMOTE },
|
||||||
|
|
@ -331,10 +331,10 @@ cpp_extern const struct command_info cmd_info[] = {
|
||||||
{ "grats" , "grat" , POS_SLEEPING, do_gen_comm , 0, SCMD_GRATZ },
|
{ "grats" , "grat" , POS_SLEEPING, do_gen_comm , 0, SCMD_GRATZ },
|
||||||
{ "gsay" , "gsay" , POS_SLEEPING, do_gsay , 0, 0 },
|
{ "gsay" , "gsay" , POS_SLEEPING, do_gsay , 0, 0 },
|
||||||
{ "gtell" , "gt" , POS_SLEEPING, do_gsay , 0, 0 },
|
{ "gtell" , "gt" , POS_SLEEPING, do_gsay , 0, 0 },
|
||||||
|
|
||||||
{ "help" , "h" , POS_DEAD , do_help , 0, 0 },
|
{ "help" , "h" , POS_DEAD , do_help , 0, 0 },
|
||||||
{ "hedit" , "hedit" , POS_DEAD , do_oasis , LVL_GOD , SCMD_OASIS_HEDIT },
|
{ "hedit" , "hedit" , POS_DEAD , do_oasis , LVL_GOD , SCMD_OASIS_HEDIT },
|
||||||
{ "hindex" , "hind" , POS_DEAD , do_hindex , 0, 0 },
|
{ "hindex" , "hind" , POS_DEAD , do_hindex , 0, 0 },
|
||||||
{ "helpcheck", "helpch" , POS_DEAD , do_helpcheck, LVL_IMPL, 0 },
|
{ "helpcheck", "helpch" , POS_DEAD , do_helpcheck, LVL_IMPL, 0 },
|
||||||
{ "hide" , "hi" , POS_RESTING , do_hide , 1, 0 },
|
{ "hide" , "hi" , POS_RESTING , do_hide , 1, 0 },
|
||||||
{ "handbook" , "handb" , POS_DEAD , do_gen_ps , LVL_IMMORT, SCMD_HANDBOOK },
|
{ "handbook" , "handb" , POS_DEAD , do_gen_ps , LVL_IMMORT, SCMD_HANDBOOK },
|
||||||
|
|
@ -345,7 +345,7 @@ cpp_extern const struct command_info cmd_info[] = {
|
||||||
{ "holler" , "holler" , POS_RESTING , do_gen_comm , 1, SCMD_HOLLER },
|
{ "holler" , "holler" , POS_RESTING , do_gen_comm , 1, SCMD_HOLLER },
|
||||||
{ "holylight", "holy" , POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_HOLYLIGHT },
|
{ "holylight", "holy" , POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_HOLYLIGHT },
|
||||||
{ "house" , "house" , POS_RESTING , do_house , 0, 0 },
|
{ "house" , "house" , POS_RESTING , do_house , 0, 0 },
|
||||||
|
|
||||||
{ "inventory", "i" , POS_DEAD , do_inventory, 0, 0 },
|
{ "inventory", "i" , POS_DEAD , do_inventory, 0, 0 },
|
||||||
{ "idea" , "id" , POS_DEAD , do_gen_write, 0, SCMD_IDEA },
|
{ "idea" , "id" , POS_DEAD , do_gen_write, 0, SCMD_IDEA },
|
||||||
{ "imotd" , "imo" , POS_DEAD , do_gen_ps , LVL_IMMORT, SCMD_IMOTD },
|
{ "imotd" , "imo" , POS_DEAD , do_gen_ps , LVL_IMMORT, SCMD_IMOTD },
|
||||||
|
|
@ -353,27 +353,27 @@ cpp_extern const struct command_info cmd_info[] = {
|
||||||
{ "info" , "info" , POS_SLEEPING, do_gen_ps , 0, SCMD_INFO },
|
{ "info" , "info" , POS_SLEEPING, do_gen_ps , 0, SCMD_INFO },
|
||||||
{ "insult" , "insult" , POS_RESTING , do_insult , 0, 0 },
|
{ "insult" , "insult" , POS_RESTING , do_insult , 0, 0 },
|
||||||
{ "invis" , "invi" , POS_DEAD , do_invis , LVL_IMMORT, 0 },
|
{ "invis" , "invi" , POS_DEAD , do_invis , LVL_IMMORT, 0 },
|
||||||
|
|
||||||
{ "junk" , "j" , POS_RESTING , do_drop , 0, SCMD_JUNK },
|
{ "junk" , "j" , POS_RESTING , do_drop , 0, SCMD_JUNK },
|
||||||
|
|
||||||
{ "kill" , "k" , POS_FIGHTING, do_kill , 0, 0 },
|
{ "kill" , "k" , POS_FIGHTING, do_kill , 0, 0 },
|
||||||
{ "kick" , "ki" , POS_FIGHTING, do_kick , 1, 0 },
|
{ "kick" , "ki" , POS_FIGHTING, do_kick , 1, 0 },
|
||||||
|
|
||||||
{ "look" , "l" , POS_RESTING , do_look , 0, SCMD_LOOK },
|
{ "look" , "l" , POS_RESTING , do_look , 0, SCMD_LOOK },
|
||||||
{ "last" , "last" , POS_DEAD , do_last , LVL_GOD, 0 },
|
{ "last" , "last" , POS_DEAD , do_last , LVL_GOD, 0 },
|
||||||
{ "leave" , "lea" , POS_STANDING, do_leave , 0, 0 },
|
{ "leave" , "lea" , POS_STANDING, do_leave , 0, 0 },
|
||||||
{ "levels" , "lev" , POS_DEAD , do_levels , 0, 0 },
|
{ "levels" , "lev" , POS_DEAD , do_levels , 0, 0 },
|
||||||
{ "list" , "lis" , POS_STANDING, do_not_here , 0, 0 },
|
{ "list" , "lis" , POS_STANDING, do_not_here , 0, 0 },
|
||||||
{ "links" , "lin" , POS_STANDING, do_links , LVL_GOD, 0 },
|
{ "links" , "lin" , POS_STANDING, do_links , LVL_GOD, 0 },
|
||||||
{ "lock" , "loc" , POS_SITTING , do_gen_door , 0, SCMD_LOCK },
|
{ "lock" , "loc" , POS_SITTING , do_gen_door , 0, SCMD_LOCK },
|
||||||
{ "load" , "load" , POS_DEAD , do_load , LVL_BUILDER, 0 },
|
{ "load" , "load" , POS_DEAD , do_load , LVL_BUILDER, 0 },
|
||||||
|
|
||||||
{ "motd" , "motd" , POS_DEAD , do_gen_ps , 0, SCMD_MOTD },
|
{ "motd" , "motd" , POS_DEAD , do_gen_ps , 0, SCMD_MOTD },
|
||||||
{ "mail" , "mail" , POS_STANDING, do_not_here , 1, 0 },
|
{ "mail" , "mail" , POS_STANDING, do_not_here , 1, 0 },
|
||||||
{ "medit" , "med" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_MEDIT },
|
{ "medit" , "med" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_MEDIT },
|
||||||
{ "mlist" , "mlist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_MLIST },
|
{ "mlist" , "mlist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_MLIST },
|
||||||
{ "mute" , "mute" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_SQUELCH },
|
{ "mute" , "mute" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_SQUELCH },
|
||||||
|
|
||||||
{ "news" , "news" , POS_SLEEPING, do_gen_ps , 0, SCMD_NEWS },
|
{ "news" , "news" , POS_SLEEPING, do_gen_ps , 0, SCMD_NEWS },
|
||||||
{ "noauction", "noauction",POS_DEAD , do_gen_tog , 0, SCMD_NOAUCTION },
|
{ "noauction", "noauction",POS_DEAD , do_gen_tog , 0, SCMD_NOAUCTION },
|
||||||
{ "nogossip" , "nogossip", POS_DEAD , do_gen_tog , 0, SCMD_NOGOSSIP },
|
{ "nogossip" , "nogossip", POS_DEAD , do_gen_tog , 0, SCMD_NOGOSSIP },
|
||||||
|
|
@ -385,14 +385,14 @@ cpp_extern const struct command_info cmd_info[] = {
|
||||||
{ "notell" , "notell" , POS_DEAD , do_gen_tog , 1, SCMD_NOTELL },
|
{ "notell" , "notell" , POS_DEAD , do_gen_tog , 1, SCMD_NOTELL },
|
||||||
{ "notitle" , "notitle" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_NOTITLE },
|
{ "notitle" , "notitle" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_NOTITLE },
|
||||||
{ "nowiz" , "nowiz" , POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_NOWIZ },
|
{ "nowiz" , "nowiz" , POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_NOWIZ },
|
||||||
|
|
||||||
{ "open" , "o" , POS_SITTING , do_gen_door , 0, SCMD_OPEN },
|
{ "open" , "o" , POS_SITTING , do_gen_door , 0, SCMD_OPEN },
|
||||||
{ "order" , "ord" , POS_RESTING , do_order , 1, 0 },
|
{ "order" , "ord" , POS_RESTING , do_order , 1, 0 },
|
||||||
{ "offer" , "off" , POS_STANDING, do_not_here , 1, 0 },
|
{ "offer" , "off" , POS_STANDING, do_not_here , 1, 0 },
|
||||||
{ "olc" , "olc" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OLC_SAVEINFO },
|
{ "olc" , "olc" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OLC_SAVEINFO },
|
||||||
{ "olist" , "olist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_OLIST },
|
{ "olist" , "olist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_OLIST },
|
||||||
{ "oedit" , "oedit" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_OEDIT },
|
{ "oedit" , "oedit" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_OEDIT },
|
||||||
|
|
||||||
{ "put" , "p" , POS_RESTING , do_put , 0, 0 },
|
{ "put" , "p" , POS_RESTING , do_put , 0, 0 },
|
||||||
{ "peace" , "pe" , POS_DEAD , do_peace , LVL_BUILDER, 0 },
|
{ "peace" , "pe" , POS_DEAD , do_peace , LVL_BUILDER, 0 },
|
||||||
{ "pick" , "pi" , POS_STANDING, do_gen_door , 1, SCMD_PICK },
|
{ "pick" , "pi" , POS_STANDING, do_gen_door , 1, SCMD_PICK },
|
||||||
|
|
@ -403,14 +403,14 @@ cpp_extern const struct command_info cmd_info[] = {
|
||||||
{ "pour" , "pour" , POS_STANDING, do_pour , 0, SCMD_POUR },
|
{ "pour" , "pour" , POS_STANDING, do_pour , 0, SCMD_POUR },
|
||||||
{ "prompt" , "pro" , POS_DEAD , do_display , 0, 0 },
|
{ "prompt" , "pro" , POS_DEAD , do_display , 0, 0 },
|
||||||
{ "purge" , "purge" , POS_DEAD , do_purge , LVL_BUILDER, 0 },
|
{ "purge" , "purge" , POS_DEAD , do_purge , LVL_BUILDER, 0 },
|
||||||
|
|
||||||
{ "quaff" , "qua" , POS_RESTING , do_use , 0, SCMD_QUAFF },
|
{ "quaff" , "qua" , POS_RESTING , do_use , 0, SCMD_QUAFF },
|
||||||
{ "qecho" , "qec" , POS_DEAD , do_qcomm , LVL_GOD, SCMD_QECHO },
|
{ "qecho" , "qec" , POS_DEAD , do_qcomm , LVL_GOD, SCMD_QECHO },
|
||||||
{ "quest" , "que" , POS_DEAD , do_gen_tog , 0, SCMD_QUEST },
|
{ "quest" , "que" , POS_DEAD , do_gen_tog , 0, SCMD_QUEST },
|
||||||
{ "qui" , "qui" , POS_DEAD , do_quit , 0, 0 },
|
{ "qui" , "qui" , POS_DEAD , do_quit , 0, 0 },
|
||||||
{ "quit" , "quit" , POS_DEAD , do_quit , 0, SCMD_QUIT },
|
{ "quit" , "quit" , POS_DEAD , do_quit , 0, SCMD_QUIT },
|
||||||
{ "qsay" , "qsay" , POS_RESTING , do_qcomm , 0, SCMD_QSAY },
|
{ "qsay" , "qsay" , POS_RESTING , do_qcomm , 0, SCMD_QSAY },
|
||||||
|
|
||||||
{ "reply" , "r" , POS_SLEEPING, do_reply , 0, 0 },
|
{ "reply" , "r" , POS_SLEEPING, do_reply , 0, 0 },
|
||||||
{ "rest" , "res" , POS_RESTING , do_rest , 0, 0 },
|
{ "rest" , "res" , POS_RESTING , do_rest , 0, 0 },
|
||||||
{ "read" , "rea" , POS_RESTING , do_look , 0, SCMD_READ },
|
{ "read" , "rea" , POS_RESTING , do_look , 0, SCMD_READ },
|
||||||
|
|
@ -425,7 +425,7 @@ cpp_extern const struct command_info cmd_info[] = {
|
||||||
{ "restore" , "resto" , POS_DEAD , do_restore , LVL_GOD, 0 },
|
{ "restore" , "resto" , POS_DEAD , do_restore , LVL_GOD, 0 },
|
||||||
{ "return" , "retu" , POS_DEAD , do_return , 0, 0 },
|
{ "return" , "retu" , POS_DEAD , do_return , 0, 0 },
|
||||||
{ "redit" , "redit" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_REDIT },
|
{ "redit" , "redit" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_REDIT },
|
||||||
{ "rlist" , "rlist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_RLIST },
|
{ "rlist" , "rlist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_RLIST },
|
||||||
{ "rclone" , "rclone" , POS_DEAD , do_room_copy, LVL_BUILDER, 0 },
|
{ "rclone" , "rclone" , POS_DEAD , do_room_copy, LVL_BUILDER, 0 },
|
||||||
{ "roomflags", "roomflags", POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_SHOWVNUMS },
|
{ "roomflags", "roomflags", POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_SHOWVNUMS },
|
||||||
|
|
||||||
|
|
@ -455,7 +455,7 @@ cpp_extern const struct command_info cmd_info[] = {
|
||||||
{ "stat" , "stat" , POS_DEAD , do_stat , LVL_IMMORT, 0 },
|
{ "stat" , "stat" , POS_DEAD , do_stat , LVL_IMMORT, 0 },
|
||||||
{ "steal" , "ste" , POS_STANDING, do_steal , 1, 0 },
|
{ "steal" , "ste" , POS_STANDING, do_steal , 1, 0 },
|
||||||
{ "switch" , "switch" , POS_DEAD , do_switch , LVL_GOD, 0 },
|
{ "switch" , "switch" , POS_DEAD , do_switch , LVL_GOD, 0 },
|
||||||
|
|
||||||
{ "tell" , "t" , POS_DEAD , do_tell , 0, 0 },
|
{ "tell" , "t" , POS_DEAD , do_tell , 0, 0 },
|
||||||
{ "take" , "ta" , POS_RESTING , do_get , 0, 0 },
|
{ "take" , "ta" , POS_RESTING , do_get , 0, 0 },
|
||||||
{ "taste" , "tas" , POS_RESTING , do_eat , 0, SCMD_TASTE },
|
{ "taste" , "tas" , POS_RESTING , do_eat , 0, SCMD_TASTE },
|
||||||
|
|
@ -469,7 +469,7 @@ cpp_extern const struct command_info cmd_info[] = {
|
||||||
{ "transfer" , "transfer", POS_SLEEPING, do_trans , LVL_GOD, 0 },
|
{ "transfer" , "transfer", POS_SLEEPING, do_trans , LVL_GOD, 0 },
|
||||||
{ "trigedit" , "trigedit", POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_TRIGEDIT},
|
{ "trigedit" , "trigedit", POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_TRIGEDIT},
|
||||||
{ "typo" , "typo" , POS_DEAD , do_gen_write, 0, SCMD_TYPO },
|
{ "typo" , "typo" , POS_DEAD , do_gen_write, 0, SCMD_TYPO },
|
||||||
|
|
||||||
{ "unlock" , "unlock" , POS_SITTING , do_gen_door , 0, SCMD_UNLOCK },
|
{ "unlock" , "unlock" , POS_SITTING , do_gen_door , 0, SCMD_UNLOCK },
|
||||||
{ "ungroup" , "ungroup" , POS_DEAD , do_ungroup , 0, 0 },
|
{ "ungroup" , "ungroup" , POS_DEAD , do_ungroup , 0, 0 },
|
||||||
{ "unban" , "unban" , POS_DEAD , do_unban , LVL_GRGOD, 0 },
|
{ "unban" , "unban" , POS_DEAD , do_unban , LVL_GRGOD, 0 },
|
||||||
|
|
@ -477,13 +477,13 @@ cpp_extern const struct command_info cmd_info[] = {
|
||||||
{ "uptime" , "uptime" , POS_DEAD , do_date , LVL_GOD, SCMD_UPTIME },
|
{ "uptime" , "uptime" , POS_DEAD , do_date , LVL_GOD, SCMD_UPTIME },
|
||||||
{ "use" , "use" , POS_SITTING , do_use , 1, SCMD_USE },
|
{ "use" , "use" , POS_SITTING , do_use , 1, SCMD_USE },
|
||||||
{ "users" , "users" , POS_DEAD , do_users , LVL_GOD, 0 },
|
{ "users" , "users" , POS_DEAD , do_users , LVL_GOD, 0 },
|
||||||
|
|
||||||
{ "value" , "val" , POS_STANDING, do_not_here , 0, 0 },
|
{ "value" , "val" , POS_STANDING, do_not_here , 0, 0 },
|
||||||
{ "version" , "ver" , POS_DEAD , do_gen_ps , 0, SCMD_VERSION },
|
{ "version" , "ver" , POS_DEAD , do_gen_ps , 0, SCMD_VERSION },
|
||||||
{ "visible" , "vis" , POS_RESTING , do_visible , 1, 0 },
|
{ "visible" , "vis" , POS_RESTING , do_visible , 1, 0 },
|
||||||
{ "vnum" , "vnum" , POS_DEAD , do_vnum , LVL_IMMORT, 0 },
|
{ "vnum" , "vnum" , POS_DEAD , do_vnum , LVL_IMMORT, 0 },
|
||||||
{ "vstat" , "vstat" , POS_DEAD , do_vstat , LVL_IMMORT, 0 },
|
{ "vstat" , "vstat" , POS_DEAD , do_vstat , LVL_IMMORT, 0 },
|
||||||
|
|
||||||
{ "wake" , "wake" , POS_SLEEPING, do_wake , 0, 0 },
|
{ "wake" , "wake" , POS_SLEEPING, do_wake , 0, 0 },
|
||||||
{ "wear" , "wea" , POS_RESTING , do_wear , 0, 0 },
|
{ "wear" , "wea" , POS_RESTING , do_wear , 0, 0 },
|
||||||
{ "weather" , "weather" , POS_RESTING , do_weather , 0, 0 },
|
{ "weather" , "weather" , POS_RESTING , do_weather , 0, 0 },
|
||||||
|
|
@ -499,17 +499,17 @@ cpp_extern const struct command_info cmd_info[] = {
|
||||||
{ "wizlist" , "wizlist" , POS_DEAD , do_gen_ps , 0, SCMD_WIZLIST },
|
{ "wizlist" , "wizlist" , POS_DEAD , do_gen_ps , 0, SCMD_WIZLIST },
|
||||||
{ "wizlock" , "wizlock" , POS_DEAD , do_wizlock , LVL_IMPL, 0 },
|
{ "wizlock" , "wizlock" , POS_DEAD , do_wizlock , LVL_IMPL, 0 },
|
||||||
{ "write" , "write" , POS_STANDING, do_write , 1, 0 },
|
{ "write" , "write" , POS_STANDING, do_write , 1, 0 },
|
||||||
|
|
||||||
{ "zreset" , "zreset" , POS_DEAD , do_zreset , LVL_BUILDER, 0 },
|
{ "zreset" , "zreset" , POS_DEAD , do_zreset , LVL_BUILDER, 0 },
|
||||||
{ "zedit" , "zedit" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_ZEDIT },
|
{ "zedit" , "zedit" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_ZEDIT },
|
||||||
{ "zlist" , "zlist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_ZLIST },
|
{ "zlist" , "zlist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_ZLIST },
|
||||||
{ "zcheck" , "zcheck" , POS_DEAD , do_zcheck , LVL_GOD, 0 },
|
{ "zcheck" , "zcheck" , POS_DEAD , do_zcheck , LVL_GOD, 0 },
|
||||||
{ "zpurge" , "zpurge" , POS_DEAD , do_zpurge , LVL_BUILDER, 0 },
|
{ "zpurge" , "zpurge" , POS_DEAD , do_zpurge , LVL_BUILDER, 0 },
|
||||||
|
|
||||||
/* DG trigger commands */
|
/* DG trigger commands */
|
||||||
{ "attach" , "attach" , POS_DEAD , do_attach , LVL_BUILDER, 0 },
|
{ "attach" , "attach" , POS_DEAD , do_attach , LVL_BUILDER, 0 },
|
||||||
{ "detach" , "detach" , POS_DEAD , do_detach , LVL_BUILDER, 0 },
|
{ "detach" , "detach" , POS_DEAD , do_detach , LVL_BUILDER, 0 },
|
||||||
{ "tlist" , "tlist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_TLIST },
|
{ "tlist" , "tlist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_TLIST },
|
||||||
{ "tstat" , "tstat" , POS_DEAD , do_tstat , LVL_BUILDER, 0 },
|
{ "tstat" , "tstat" , POS_DEAD , do_tstat , LVL_BUILDER, 0 },
|
||||||
{ "masound" , "masound" , POS_DEAD , do_masound , -1, 0 },
|
{ "masound" , "masound" , POS_DEAD , do_masound , -1, 0 },
|
||||||
{ "mkill" , "mkill" , POS_STANDING, do_mkill , -1, 0 },
|
{ "mkill" , "mkill" , POS_STANDING, do_mkill , -1, 0 },
|
||||||
|
|
@ -593,7 +593,7 @@ void command_interpreter(struct char_data *ch, char *argument)
|
||||||
line = any_one_arg(argument, arg);
|
line = any_one_arg(argument, arg);
|
||||||
|
|
||||||
/* Since all command triggers check for valid_dg_target before acting, the levelcheck
|
/* Since all command triggers check for valid_dg_target before acting, the levelcheck
|
||||||
* here has been removed.
|
* here has been removed.
|
||||||
*/
|
*/
|
||||||
/* otherwise, find the command */
|
/* otherwise, find the command */
|
||||||
{
|
{
|
||||||
|
|
@ -603,22 +603,22 @@ void command_interpreter(struct char_data *ch, char *argument)
|
||||||
if (!cont) cont = command_otrigger(ch, arg, line); /* any object triggers ? */
|
if (!cont) cont = command_otrigger(ch, arg, line); /* any object triggers ? */
|
||||||
if (cont) return; /* yes, command trigger took over */
|
if (cont) return; /* yes, command trigger took over */
|
||||||
}
|
}
|
||||||
|
|
||||||
for (length = strlen(arg), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++)
|
for (length = strlen(arg), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++)
|
||||||
if(complete_cmd_info[cmd].command_pointer != do_action &&
|
if(complete_cmd_info[cmd].command_pointer != do_action &&
|
||||||
!strncmp(complete_cmd_info[cmd].command, arg, length))
|
!strncmp(complete_cmd_info[cmd].command, arg, length))
|
||||||
if (GET_LEVEL(ch) >= complete_cmd_info[cmd].minimum_level)
|
if (GET_LEVEL(ch) >= complete_cmd_info[cmd].minimum_level)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* it's not a 'real' command, so it's a social */
|
/* it's not a 'real' command, so it's a social */
|
||||||
|
|
||||||
if(*complete_cmd_info[cmd].command == '\n')
|
if(*complete_cmd_info[cmd].command == '\n')
|
||||||
for (length = strlen(arg), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++)
|
for (length = strlen(arg), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++)
|
||||||
if (complete_cmd_info[cmd].command_pointer == do_action &&
|
if (complete_cmd_info[cmd].command_pointer == do_action &&
|
||||||
!strncmp(complete_cmd_info[cmd].command, arg, length))
|
!strncmp(complete_cmd_info[cmd].command, arg, length))
|
||||||
if (GET_LEVEL(ch) >= complete_cmd_info[cmd].minimum_level)
|
if (GET_LEVEL(ch) >= complete_cmd_info[cmd].minimum_level)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (*complete_cmd_info[cmd].command == '\n')
|
if (*complete_cmd_info[cmd].command == '\n')
|
||||||
send_to_char(ch, "Huh?!?\r\n");
|
send_to_char(ch, "Huh?!?\r\n");
|
||||||
else if (!IS_NPC(ch) && PLR_FLAGGED(ch, PLR_FROZEN) && GET_LEVEL(ch) < LVL_IMPL)
|
else if (!IS_NPC(ch) && PLR_FLAGGED(ch, PLR_FROZEN) && GET_LEVEL(ch) < LVL_IMPL)
|
||||||
|
|
@ -1043,7 +1043,7 @@ char *two_arguments(char *argument, char *first_arg, char *second_arg)
|
||||||
* (now works symmetrically -- JE 7/25/94)
|
* (now works symmetrically -- JE 7/25/94)
|
||||||
*
|
*
|
||||||
* that was dumb. it shouldn't be symmetrical. JE 5/1/95
|
* that was dumb. it shouldn't be symmetrical. JE 5/1/95
|
||||||
*
|
*
|
||||||
* returns 1 if arg1 is an abbreviation of arg2
|
* returns 1 if arg1 is an abbreviation of arg2
|
||||||
*/
|
*/
|
||||||
int is_abbrev(const char *arg1, const char *arg2)
|
int is_abbrev(const char *arg1, const char *arg2)
|
||||||
|
|
@ -1199,7 +1199,7 @@ int perform_dupe_check(struct descriptor_data *d)
|
||||||
} else if (k->character && GET_IDNUM(k->character) == id) {
|
} else if (k->character && GET_IDNUM(k->character) == id) {
|
||||||
/* Character taking over their own body. */
|
/* Character taking over their own body. */
|
||||||
pref_temp=GET_PREF(k->character);
|
pref_temp=GET_PREF(k->character);
|
||||||
|
|
||||||
if (!target && STATE(k) == CON_PLAYING) {
|
if (!target && STATE(k) == CON_PLAYING) {
|
||||||
write_to_output(k, "\r\nThis body has been usurped!\r\n");
|
write_to_output(k, "\r\nThis body has been usurped!\r\n");
|
||||||
target = k->character;
|
target = k->character;
|
||||||
|
|
@ -1259,13 +1259,13 @@ int perform_dupe_check(struct descriptor_data *d)
|
||||||
GET_HOST(d->character)= strdup(d->host);
|
GET_HOST(d->character)= strdup(d->host);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GET_HOST(target)) free(GET_HOST(target));
|
if (GET_HOST(target)) free(GET_HOST(target));
|
||||||
GET_HOST(target) = strdup(d->host);
|
GET_HOST(target) = strdup(d->host);
|
||||||
|
|
||||||
GET_PREF(target) = pref_temp;
|
GET_PREF(target) = pref_temp;
|
||||||
add_llog_entry(target, LAST_RECONNECT);
|
add_llog_entry(target, LAST_RECONNECT);
|
||||||
|
|
||||||
/* Okay, we've found a target. Connect d to target. */
|
/* Okay, we've found a target. Connect d to target. */
|
||||||
free_char(d->character); /* get rid of the old char */
|
free_char(d->character); /* get rid of the old char */
|
||||||
d->character = target;
|
d->character = target;
|
||||||
|
|
@ -1305,17 +1305,17 @@ int enter_player_game (struct descriptor_data *d)
|
||||||
|
|
||||||
int load_result;
|
int load_result;
|
||||||
room_vnum load_room;
|
room_vnum load_room;
|
||||||
|
|
||||||
reset_char(d->character);
|
reset_char(d->character);
|
||||||
/*
|
/*
|
||||||
* See if there might be some aliases in the old alias file.
|
* See if there might be some aliases in the old alias file.
|
||||||
* Only do this if there were no aliases in the pfile.
|
* Only do this if there were no aliases in the pfile.
|
||||||
*/
|
*/
|
||||||
if (GET_ALIASES(d->character) == NULL)
|
if (GET_ALIASES(d->character) == NULL)
|
||||||
{
|
{
|
||||||
read_aliases(d->character);
|
read_aliases(d->character);
|
||||||
// delete the old file - player will be saved in a second.
|
// delete the old file - player will be saved in a second.
|
||||||
delete_aliases(GET_NAME(d->character));
|
delete_aliases(GET_NAME(d->character));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (PLR_FLAGGED(d->character, PLR_INVSTART))
|
if (PLR_FLAGGED(d->character, PLR_INVSTART))
|
||||||
|
|
@ -1560,12 +1560,12 @@ void nanny(struct descriptor_data *d, char *arg)
|
||||||
else
|
else
|
||||||
write_to_output(d, "%s", motd);
|
write_to_output(d, "%s", motd);
|
||||||
|
|
||||||
if (GET_INVIS_LEV(d->character))
|
if (GET_INVIS_LEV(d->character))
|
||||||
mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE,
|
mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE,
|
||||||
"%s [%s] has connected. (invis %d)", GET_NAME(d->character), d->host,
|
"%s [%s] has connected. (invis %d)", GET_NAME(d->character), d->host,
|
||||||
GET_INVIS_LEV(d->character));
|
GET_INVIS_LEV(d->character));
|
||||||
else
|
else
|
||||||
mudlog(BRF, LVL_IMMORT, TRUE,
|
mudlog(BRF, LVL_IMMORT, TRUE,
|
||||||
"%s [%s] has connected.", GET_NAME(d->character), d->host);
|
"%s [%s] has connected.", GET_NAME(d->character), d->host);
|
||||||
|
|
||||||
if (load_result) {
|
if (load_result) {
|
||||||
|
|
@ -1796,7 +1796,7 @@ void nanny(struct descriptor_data *d, char *arg)
|
||||||
SET_BIT(player_table[player_i].flags, PINDEX_SELFDELETE);
|
SET_BIT(player_table[player_i].flags, PINDEX_SELFDELETE);
|
||||||
remove_player(player_i);
|
remove_player(player_i);
|
||||||
}
|
}
|
||||||
|
|
||||||
delete_aliases(GET_NAME(d->character));
|
delete_aliases(GET_NAME(d->character));
|
||||||
delete_variables(GET_NAME(d->character));
|
delete_variables(GET_NAME(d->character));
|
||||||
write_to_output(d, "Character '%s' deleted!\r\n"
|
write_to_output(d, "Character '%s' deleted!\r\n"
|
||||||
|
|
|
||||||
|
|
@ -95,7 +95,7 @@ struct alias_data {
|
||||||
|
|
||||||
/* do_gen_ps */
|
/* do_gen_ps */
|
||||||
#define SCMD_INFO 0
|
#define SCMD_INFO 0
|
||||||
#define SCMD_HANDBOOK 1
|
#define SCMD_HANDBOOK 1
|
||||||
#define SCMD_CREDITS 2
|
#define SCMD_CREDITS 2
|
||||||
#define SCMD_NEWS 3
|
#define SCMD_NEWS 3
|
||||||
#define SCMD_WIZLIST 4
|
#define SCMD_WIZLIST 4
|
||||||
|
|
@ -128,7 +128,7 @@ struct alias_data {
|
||||||
#define SCMD_CLS 17
|
#define SCMD_CLS 17
|
||||||
#define SCMD_BUILDWALK 18
|
#define SCMD_BUILDWALK 18
|
||||||
#define SCMD_AFK 19
|
#define SCMD_AFK 19
|
||||||
#define SCMD_COLOR 20
|
#define SCMD_COLOR 20
|
||||||
#define SCMD_SYSLOG 21
|
#define SCMD_SYSLOG 21
|
||||||
#define SCMD_WIMPY 22
|
#define SCMD_WIMPY 22
|
||||||
#define SCMD_PAGELENGTH 23
|
#define SCMD_PAGELENGTH 23
|
||||||
|
|
|
||||||
|
|
@ -400,11 +400,11 @@ void point_update(void)
|
||||||
/* characters */
|
/* characters */
|
||||||
for (i = character_list; i; i = next_char) {
|
for (i = character_list; i; i = next_char) {
|
||||||
next_char = i->next;
|
next_char = i->next;
|
||||||
|
|
||||||
gain_condition(i, FULL, -1);
|
gain_condition(i, FULL, -1);
|
||||||
gain_condition(i, DRUNK, -1);
|
gain_condition(i, DRUNK, -1);
|
||||||
gain_condition(i, THIRST, -1);
|
gain_condition(i, THIRST, -1);
|
||||||
|
|
||||||
if (GET_POS(i) >= POS_STUNNED) {
|
if (GET_POS(i) >= POS_STUNNED) {
|
||||||
GET_HIT(i) = MIN(GET_HIT(i) + hit_gain(i), GET_MAX_HIT(i));
|
GET_HIT(i) = MIN(GET_HIT(i) + hit_gain(i), GET_MAX_HIT(i));
|
||||||
GET_MANA(i) = MIN(GET_MANA(i) + mana_gain(i), GET_MAX_MANA(i));
|
GET_MANA(i) = MIN(GET_MANA(i) + mana_gain(i), GET_MAX_MANA(i));
|
||||||
|
|
@ -467,7 +467,7 @@ void point_update(void)
|
||||||
/* If the timer is set, count it down and at 0, try the trigger */
|
/* If the timer is set, count it down and at 0, try the trigger */
|
||||||
/* note to .rej hand-patchers: make this last in your point-update() */
|
/* note to .rej hand-patchers: make this last in your point-update() */
|
||||||
else if (GET_OBJ_TIMER(j)>0) {
|
else if (GET_OBJ_TIMER(j)>0) {
|
||||||
GET_OBJ_TIMER(j)--;
|
GET_OBJ_TIMER(j)--;
|
||||||
if (!GET_OBJ_TIMER(j))
|
if (!GET_OBJ_TIMER(j))
|
||||||
timer_otrigger(j);
|
timer_otrigger(j);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -634,7 +634,7 @@ void mag_areas(int level, struct char_data *ch, int spellnum, int savetype)
|
||||||
act(to_char, FALSE, ch, 0, 0, TO_CHAR);
|
act(to_char, FALSE, ch, 0, 0, TO_CHAR);
|
||||||
if (to_room != NULL)
|
if (to_room != NULL)
|
||||||
act(to_room, FALSE, ch, 0, 0, TO_ROOM);
|
act(to_room, FALSE, ch, 0, 0, TO_ROOM);
|
||||||
|
|
||||||
|
|
||||||
for (tch = world[IN_ROOM(ch)].people; tch; tch = next_tch) {
|
for (tch = world[IN_ROOM(ch)].people; tch; tch = next_tch) {
|
||||||
next_tch = tch->next_in_room;
|
next_tch = tch->next_in_room;
|
||||||
|
|
|
||||||
64
src/mail.c
64
src/mail.c
|
|
@ -43,13 +43,13 @@ int mail_recip_ok(const char *name);
|
||||||
void write_mail_record(FILE *mail_file, struct mail_t *record);
|
void write_mail_record(FILE *mail_file, struct mail_t *record);
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
char *decrypt_hex(char *string, size_t len)
|
char *decrypt_hex(char *string, size_t len)
|
||||||
{
|
{
|
||||||
static char output[MAX_STRING_LENGTH];
|
static char output[MAX_STRING_LENGTH];
|
||||||
char *p;
|
char *p;
|
||||||
char *src = string;
|
char *src = string;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
p = output;
|
p = output;
|
||||||
for (i = 0;i<len/2;++i) {
|
for (i = 0;i<len/2;++i) {
|
||||||
unsigned char hi = *src++;
|
unsigned char hi = *src++;
|
||||||
|
|
@ -61,13 +61,13 @@ char *decrypt_hex(char *string, size_t len)
|
||||||
return output;
|
return output;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *encrypt_hex(char *string, size_t len)
|
char *encrypt_hex(char *string, size_t len)
|
||||||
{
|
{
|
||||||
static char output[MAX_STRING_LENGTH];
|
static char output[MAX_STRING_LENGTH];
|
||||||
char *p;
|
char *p;
|
||||||
char *src = string;
|
char *src = string;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return "";
|
return "";
|
||||||
|
|
||||||
|
|
@ -103,29 +103,29 @@ void free_mail_record(struct mail_t *record)
|
||||||
free(record);
|
free(record);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct mail_t *read_mail_record(FILE *mail_file)
|
struct mail_t *read_mail_record(FILE *mail_file)
|
||||||
{
|
{
|
||||||
char line[READ_SIZE];
|
char line[READ_SIZE];
|
||||||
long sender, recipient;
|
long sender, recipient;
|
||||||
time_t sent_time;
|
time_t sent_time;
|
||||||
struct mail_t *record;
|
struct mail_t *record;
|
||||||
|
|
||||||
if (!get_line(mail_file, line))
|
if (!get_line(mail_file, line))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
if (sscanf(line, "### %ld %ld %ld", &recipient, &sender, &sent_time) != 3) {
|
if (sscanf(line, "### %ld %ld %ld", &recipient, &sender, &sent_time) != 3) {
|
||||||
log("Mail system - fatal error - malformed mail header");
|
log("Mail system - fatal error - malformed mail header");
|
||||||
log("Line was: %s", line);
|
log("Line was: %s", line);
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
CREATE(record, struct mail_t, 1);
|
CREATE(record, struct mail_t, 1);
|
||||||
|
|
||||||
record->recipient = recipient;
|
record->recipient = recipient;
|
||||||
record->sender = sender;
|
record->sender = sender;
|
||||||
record->sent_time = sent_time;
|
record->sent_time = sent_time;
|
||||||
record->body = fread_string(mail_file, "read mail record");
|
record->body = fread_string(mail_file, "read mail record");
|
||||||
|
|
||||||
return record;
|
return record;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -138,7 +138,7 @@ void write_mail_record(FILE *mail_file, struct mail_t *record)
|
||||||
record->sent_time,
|
record->sent_time,
|
||||||
record->body );
|
record->body );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* int scan_file(none)
|
* int scan_file(none)
|
||||||
* Returns false if mail file is corrupted or true if everything correct.
|
* Returns false if mail file is corrupted or true if everything correct.
|
||||||
|
|
@ -157,9 +157,9 @@ int scan_file(void)
|
||||||
touch(MAIL_FILE);
|
touch(MAIL_FILE);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
record = read_mail_record(mail_file);
|
record = read_mail_record(mail_file);
|
||||||
|
|
||||||
while (record) {
|
while (record) {
|
||||||
free_mail_record(record);
|
free_mail_record(record);
|
||||||
record = read_mail_record(mail_file);
|
record = read_mail_record(mail_file);
|
||||||
|
|
@ -182,14 +182,14 @@ int has_mail(long recipient)
|
||||||
{
|
{
|
||||||
FILE *mail_file;
|
FILE *mail_file;
|
||||||
struct mail_t *record;
|
struct mail_t *record;
|
||||||
|
|
||||||
if (!(mail_file = fopen(MAIL_FILE, "r"))) {
|
if (!(mail_file = fopen(MAIL_FILE, "r"))) {
|
||||||
perror("read_delete: Mail file not accessible.");
|
perror("read_delete: Mail file not accessible.");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
record = read_mail_record(mail_file);
|
record = read_mail_record(mail_file);
|
||||||
|
|
||||||
while (record) {
|
while (record) {
|
||||||
if (record->recipient == recipient) {
|
if (record->recipient == recipient) {
|
||||||
free_mail_record(record);
|
free_mail_record(record);
|
||||||
|
|
@ -218,13 +218,13 @@ void store_mail(long to, long from, char *message_pointer)
|
||||||
{
|
{
|
||||||
FILE *mail_file;
|
FILE *mail_file;
|
||||||
struct mail_t *record;
|
struct mail_t *record;
|
||||||
|
|
||||||
if (!(mail_file = fopen(MAIL_FILE, "a"))) {
|
if (!(mail_file = fopen(MAIL_FILE, "a"))) {
|
||||||
perror("store_mail: Mail file not accessible.");
|
perror("store_mail: Mail file not accessible.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
CREATE(record, struct mail_t, 1);
|
CREATE(record, struct mail_t, 1);
|
||||||
|
|
||||||
record->recipient = to;
|
record->recipient = to;
|
||||||
record->sender = from;
|
record->sender = from;
|
||||||
record->sent_time = time(0);
|
record->sent_time = time(0);
|
||||||
|
|
@ -235,7 +235,7 @@ void store_mail(long to, long from, char *message_pointer)
|
||||||
fclose(mail_file);
|
fclose(mail_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* char *read_delete(long #1)
|
* char *read_delete(long #1)
|
||||||
* #1 - The id number of the person we're checking mail for.
|
* #1 - The id number of the person we're checking mail for.
|
||||||
|
|
@ -251,7 +251,7 @@ char *read_delete(long recipient)
|
||||||
FILE *mail_file, *new_file;
|
FILE *mail_file, *new_file;
|
||||||
struct mail_t *record, *record_to_keep = NULL;
|
struct mail_t *record, *record_to_keep = NULL;
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
if (!(mail_file = fopen(MAIL_FILE, "r"))) {
|
if (!(mail_file = fopen(MAIL_FILE, "r"))) {
|
||||||
perror("read_delete: Mail file not accessible.");
|
perror("read_delete: Mail file not accessible.");
|
||||||
return strdup("Mail system malfunction - please report this");
|
return strdup("Mail system malfunction - please report this");
|
||||||
|
|
@ -262,9 +262,9 @@ char *read_delete(long recipient)
|
||||||
fclose(mail_file);
|
fclose(mail_file);
|
||||||
return strdup("Mail system malfunction - please report this");
|
return strdup("Mail system malfunction - please report this");
|
||||||
}
|
}
|
||||||
|
|
||||||
record = read_mail_record(mail_file);
|
record = read_mail_record(mail_file);
|
||||||
|
|
||||||
while (record) {
|
while (record) {
|
||||||
if (!record_to_keep && record->recipient == recipient) {
|
if (!record_to_keep && record->recipient == recipient) {
|
||||||
record_to_keep = record;
|
record_to_keep = record;
|
||||||
|
|
@ -275,10 +275,10 @@ char *read_delete(long recipient)
|
||||||
free_mail_record(record);
|
free_mail_record(record);
|
||||||
record = read_mail_record(mail_file);
|
record = read_mail_record(mail_file);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!record_to_keep)
|
if (!record_to_keep)
|
||||||
sprintf(buf, "Mail system error - please report");
|
sprintf(buf, "Mail system error - please report");
|
||||||
else {
|
else {
|
||||||
char *tmstr, *from, *to;
|
char *tmstr, *from, *to;
|
||||||
|
|
||||||
tmstr = asctime(localtime(&record_to_keep->sent_time));
|
tmstr = asctime(localtime(&record_to_keep->sent_time));
|
||||||
|
|
@ -287,27 +287,27 @@ char *read_delete(long recipient)
|
||||||
from = get_name_by_id(record_to_keep->sender);
|
from = get_name_by_id(record_to_keep->sender);
|
||||||
to = get_name_by_id(record_to_keep->recipient);
|
to = get_name_by_id(record_to_keep->recipient);
|
||||||
|
|
||||||
snprintf(buf, sizeof(buf),
|
snprintf(buf, sizeof(buf),
|
||||||
" * * * * Midgaard Mail System * * * *\r\n"
|
" * * * * Midgaard Mail System * * * *\r\n"
|
||||||
"Date: %s\r\n"
|
"Date: %s\r\n"
|
||||||
"To : %s\r\n"
|
"To : %s\r\n"
|
||||||
"From: %s\r\n"
|
"From: %s\r\n"
|
||||||
"\r\n"
|
"\r\n"
|
||||||
"%s",
|
"%s",
|
||||||
|
|
||||||
tmstr,
|
tmstr,
|
||||||
to ? to : "Unknown",
|
to ? to : "Unknown",
|
||||||
from ? from : "Unknown",
|
from ? from : "Unknown",
|
||||||
record_to_keep->body ? record_to_keep->body : "No message" );
|
record_to_keep->body ? record_to_keep->body : "No message" );
|
||||||
|
|
||||||
free_mail_record(record_to_keep);
|
free_mail_record(record_to_keep);
|
||||||
}
|
}
|
||||||
fclose(mail_file);
|
fclose(mail_file);
|
||||||
fclose(new_file);
|
fclose(new_file);
|
||||||
|
|
||||||
remove(MAIL_FILE);
|
remove(MAIL_FILE);
|
||||||
rename(MAIL_FILE_TMP, MAIL_FILE);
|
rename(MAIL_FILE_TMP, MAIL_FILE);
|
||||||
|
|
||||||
return strdup(buf);
|
return strdup(buf);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -380,7 +380,7 @@ void postmaster_send_mail(struct char_data *ch, struct char_data *mailman,
|
||||||
STAMP_PRICE);
|
STAMP_PRICE);
|
||||||
|
|
||||||
act(buf, FALSE, mailman, 0, ch, TO_VICT);
|
act(buf, FALSE, mailman, 0, ch, TO_VICT);
|
||||||
|
|
||||||
if (GET_LEVEL(ch) < LVL_IMMORT)
|
if (GET_LEVEL(ch) < LVL_IMMORT)
|
||||||
GET_GOLD(ch) -= STAMP_PRICE;
|
GET_GOLD(ch) -= STAMP_PRICE;
|
||||||
|
|
||||||
|
|
@ -414,7 +414,7 @@ void postmaster_receive_mail(struct char_data *ch, struct char_data *mailman,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (has_mail(GET_IDNUM(ch))) {
|
while (has_mail(GET_IDNUM(ch))) {
|
||||||
obj = read_object(1, VIRTUAL); /*a pair of wings will work :)*/
|
obj = read_object(1, VIRTUAL); /*a pair of wings will work :)*/
|
||||||
obj->name = strdup("mail paper letter");
|
obj->name = strdup("mail paper letter");
|
||||||
obj->short_description = strdup("a piece of mail");
|
obj->short_description = strdup("a piece of mail");
|
||||||
obj->description = strdup("Someone has left a piece of mail here.");
|
obj->description = strdup("Someone has left a piece of mail here.");
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
/* You can modify the following constants to fit your own MUD. */
|
/* You can modify the following constants to fit your own MUD. */
|
||||||
|
|
||||||
/* minimum level a player must be to send mail */
|
/* minimum level a player must be to send mail */
|
||||||
#define MIN_MAIL_LEVEL 1
|
#define MIN_MAIL_LEVEL 1
|
||||||
|
|
||||||
/* # of gold coins required to send mail */
|
/* # of gold coins required to send mail */
|
||||||
#define STAMP_PRICE 150
|
#define STAMP_PRICE 150
|
||||||
|
|
|
||||||
120
src/medit.c
120
src/medit.c
|
|
@ -56,7 +56,7 @@ void medit_disp_menu(struct descriptor_data *d);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*-------------------------------------------------------------------*\
|
/*-------------------------------------------------------------------*\
|
||||||
utility functions
|
utility functions
|
||||||
\*-------------------------------------------------------------------*/
|
\*-------------------------------------------------------------------*/
|
||||||
|
|
||||||
ACMD(do_oasis_medit)
|
ACMD(do_oasis_medit)
|
||||||
|
|
@ -66,12 +66,12 @@ ACMD(do_oasis_medit)
|
||||||
char *buf3;
|
char *buf3;
|
||||||
char buf1[MAX_STRING_LENGTH];
|
char buf1[MAX_STRING_LENGTH];
|
||||||
char buf2[MAX_STRING_LENGTH];
|
char buf2[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Parse any arguments. **/
|
/** Parse any arguments. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
buf3 = two_arguments(argument, buf1, buf2);
|
buf3 = two_arguments(argument, buf1, buf2);
|
||||||
|
|
||||||
if (!*buf1) {
|
if (!*buf1) {
|
||||||
send_to_char(ch, "Specify a mobile VNUM to edit.\r\n");
|
send_to_char(ch, "Specify a mobile VNUM to edit.\r\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -80,32 +80,32 @@ ACMD(do_oasis_medit)
|
||||||
send_to_char(ch, "Yikes! Stop that, someone will get hurt!\r\n");
|
send_to_char(ch, "Yikes! Stop that, someone will get hurt!\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
save = TRUE;
|
save = TRUE;
|
||||||
|
|
||||||
if (is_number(buf2))
|
if (is_number(buf2))
|
||||||
number = atoi(buf2);
|
number = atoi(buf2);
|
||||||
else if (GET_OLC_ZONE(ch) > 0) {
|
else if (GET_OLC_ZONE(ch) > 0) {
|
||||||
zone_rnum zlok;
|
zone_rnum zlok;
|
||||||
|
|
||||||
if ((zlok = real_zone(GET_OLC_ZONE(ch))) == NOWHERE)
|
if ((zlok = real_zone(GET_OLC_ZONE(ch))) == NOWHERE)
|
||||||
number = NOWHERE;
|
number = NOWHERE;
|
||||||
else
|
else
|
||||||
number = genolc_zone_bottom(zlok);
|
number = genolc_zone_bottom(zlok);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (number == NOWHERE) {
|
if (number == NOWHERE) {
|
||||||
send_to_char(ch, "Save which zone?\r\n");
|
send_to_char(ch, "Save which zone?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** If a numeric argument was given (like a room number), get it. **/
|
/** If a numeric argument was given (like a room number), get it. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
if (number == NOBODY)
|
if (number == NOBODY)
|
||||||
number = atoi(buf1);
|
number = atoi(buf1);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Check that whatever it is isn't already being edited. **/
|
/** Check that whatever it is isn't already being edited. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -118,9 +118,9 @@ ACMD(do_oasis_medit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
d = ch->desc;
|
d = ch->desc;
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Give descriptor an OLC structure. **/
|
/** Give descriptor an OLC structure. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -129,9 +129,9 @@ ACMD(do_oasis_medit)
|
||||||
"SYSERR: do_oasis_medit: Player already had olc structure.");
|
"SYSERR: do_oasis_medit: Player already had olc structure.");
|
||||||
free(d->olc);
|
free(d->olc);
|
||||||
}
|
}
|
||||||
|
|
||||||
CREATE(d->olc, struct oasis_olc_data, 1);
|
CREATE(d->olc, struct oasis_olc_data, 1);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Find the zone. **/
|
/** Find the zone. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -142,7 +142,7 @@ ACMD(do_oasis_medit)
|
||||||
d->olc = NULL;
|
d->olc = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Everyone but IMPLs can only edit zones they have been assigned. **/
|
/** Everyone but IMPLs can only edit zones they have been assigned. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -154,7 +154,7 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
|
||||||
d->olc = NULL;
|
d->olc = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** If save is TRUE, save the mobiles. **/
|
/** If save is TRUE, save the mobiles. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -164,12 +164,12 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
|
||||||
mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE,
|
mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE,
|
||||||
"OLC: %s saves mobile info for zone %d.",
|
"OLC: %s saves mobile info for zone %d.",
|
||||||
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number);
|
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number);
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/** Save the mobiles. **/
|
/** Save the mobiles. **/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
save_mobiles(OLC_ZNUM(d));
|
save_mobiles(OLC_ZNUM(d));
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/** Free the olc structure stored in the descriptor. **/
|
/** Free the olc structure stored in the descriptor. **/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
@ -177,9 +177,9 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
|
||||||
d->olc = NULL;
|
d->olc = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OLC_NUM(d) = number;
|
OLC_NUM(d) = number;
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** If this is a new mobile, setup a new one, otherwise, setup the **/
|
/** If this is a new mobile, setup a new one, otherwise, setup the **/
|
||||||
/** existing mobile. **/
|
/** existing mobile. **/
|
||||||
|
|
@ -188,16 +188,16 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
|
||||||
medit_setup_new(d);
|
medit_setup_new(d);
|
||||||
else
|
else
|
||||||
medit_setup_existing(d, real_num);
|
medit_setup_existing(d, real_num);
|
||||||
|
|
||||||
STATE(d) = CON_MEDIT;
|
STATE(d) = CON_MEDIT;
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Display the OLC messages to the players in the same room as the **/
|
/** Display the OLC messages to the players in the same room as the **/
|
||||||
/** builder and also log it. **/
|
/** builder and also log it. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||||
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
||||||
|
|
||||||
mudlog(CMP, LVL_IMMORT, TRUE,"OLC: %s starts editing zone %d allowed zone %d",
|
mudlog(CMP, LVL_IMMORT, TRUE,"OLC: %s starts editing zone %d allowed zone %d",
|
||||||
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
||||||
}
|
}
|
||||||
|
|
@ -212,7 +212,7 @@ void medit_setup_new(struct descriptor_data *d)
|
||||||
struct char_data *mob;
|
struct char_data *mob;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate a scratch mobile structure.
|
* Allocate a scratch mobile structure.
|
||||||
*/
|
*/
|
||||||
CREATE(mob, struct char_data, 1);
|
CREATE(mob, struct char_data, 1);
|
||||||
|
|
||||||
|
|
@ -232,12 +232,12 @@ void medit_setup_new(struct descriptor_data *d)
|
||||||
#endif
|
#endif
|
||||||
SCRIPT(mob) = NULL;
|
SCRIPT(mob) = NULL;
|
||||||
mob->proto_script = OLC_SCRIPT(d) = NULL;
|
mob->proto_script = OLC_SCRIPT(d) = NULL;
|
||||||
|
|
||||||
OLC_MOB(d) = mob;
|
OLC_MOB(d) = mob;
|
||||||
/* Has changed flag. (It hasn't so far, we just made it.) */
|
/* Has changed flag. (It hasn't so far, we just made it.) */
|
||||||
OLC_VAL(d) = FALSE;
|
OLC_VAL(d) = FALSE;
|
||||||
OLC_ITEM_TYPE(d) = MOB_TRIGGER;
|
OLC_ITEM_TYPE(d) = MOB_TRIGGER;
|
||||||
|
|
||||||
medit_disp_menu(d);
|
medit_disp_menu(d);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -248,7 +248,7 @@ void medit_setup_existing(struct descriptor_data *d, int rmob_num)
|
||||||
struct char_data *mob;
|
struct char_data *mob;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate a scratch mobile structure.
|
* Allocate a scratch mobile structure.
|
||||||
*/
|
*/
|
||||||
CREATE(mob, struct char_data, 1);
|
CREATE(mob, struct char_data, 1);
|
||||||
|
|
||||||
|
|
@ -324,38 +324,38 @@ void medit_save_internally(struct descriptor_data *d)
|
||||||
mob_rnum new_rnum;
|
mob_rnum new_rnum;
|
||||||
struct descriptor_data *dsc;
|
struct descriptor_data *dsc;
|
||||||
struct char_data *mob;
|
struct char_data *mob;
|
||||||
|
|
||||||
i = (real_mobile(OLC_NUM(d)) == NOBODY);
|
i = (real_mobile(OLC_NUM(d)) == NOBODY);
|
||||||
|
|
||||||
if ((new_rnum = add_mobile(OLC_MOB(d), OLC_NUM(d))) == NOBODY) {
|
if ((new_rnum = add_mobile(OLC_MOB(d), OLC_NUM(d))) == NOBODY) {
|
||||||
log("medit_save_internally: add_mobile failed.");
|
log("medit_save_internally: add_mobile failed.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* Update triggers */
|
/* Update triggers */
|
||||||
/* Free old proto list */
|
/* Free old proto list */
|
||||||
if (mob_proto[new_rnum].proto_script &&
|
if (mob_proto[new_rnum].proto_script &&
|
||||||
mob_proto[new_rnum].proto_script != OLC_SCRIPT(d))
|
mob_proto[new_rnum].proto_script != OLC_SCRIPT(d))
|
||||||
free_proto_script(&mob_proto[new_rnum], MOB_TRIGGER);
|
free_proto_script(&mob_proto[new_rnum], MOB_TRIGGER);
|
||||||
|
|
||||||
mob_proto[new_rnum].proto_script = OLC_SCRIPT(d);
|
mob_proto[new_rnum].proto_script = OLC_SCRIPT(d);
|
||||||
|
|
||||||
/* this takes care of the mobs currently in-game */
|
/* this takes care of the mobs currently in-game */
|
||||||
for (mob = character_list; mob; mob = mob->next) {
|
for (mob = character_list; mob; mob = mob->next) {
|
||||||
if (GET_MOB_RNUM(mob) != new_rnum)
|
if (GET_MOB_RNUM(mob) != new_rnum)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
/* remove any old scripts */
|
/* remove any old scripts */
|
||||||
if (SCRIPT(mob))
|
if (SCRIPT(mob))
|
||||||
extract_script(mob, MOB_TRIGGER);
|
extract_script(mob, MOB_TRIGGER);
|
||||||
|
|
||||||
free_proto_script(mob, MOB_TRIGGER);
|
free_proto_script(mob, MOB_TRIGGER);
|
||||||
copy_proto_script(&mob_proto[new_rnum], mob, MOB_TRIGGER);
|
copy_proto_script(&mob_proto[new_rnum], mob, MOB_TRIGGER);
|
||||||
assign_triggers(mob, MOB_TRIGGER);
|
assign_triggers(mob, MOB_TRIGGER);
|
||||||
}
|
}
|
||||||
/* end trigger update */
|
/* end trigger update */
|
||||||
|
|
||||||
if (!i) /* Only renumber on new mobiles. */
|
if (!i) /* Only renumber on new mobiles. */
|
||||||
return;
|
return;
|
||||||
|
|
@ -382,7 +382,7 @@ void medit_save_internally(struct descriptor_data *d)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Menu functions
|
Menu functions
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -535,7 +535,7 @@ void medit_disp_mob_flags(struct descriptor_data *d)
|
||||||
{
|
{
|
||||||
int i, columns = 0;
|
int i, columns = 0;
|
||||||
char flags[MAX_STRING_LENGTH];
|
char flags[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
get_char_colors(d->character);
|
get_char_colors(d->character);
|
||||||
clear_screen(d);
|
clear_screen(d);
|
||||||
for (i = 0; i < NUM_MOB_FLAGS; i++) {
|
for (i = 0; i < NUM_MOB_FLAGS; i++) {
|
||||||
|
|
@ -817,11 +817,11 @@ void medit_parse(struct descriptor_data *d, char *arg)
|
||||||
OLC_MODE(d) = MEDIT_AFF_FLAGS;
|
OLC_MODE(d) = MEDIT_AFF_FLAGS;
|
||||||
medit_disp_aff_flags(d);
|
medit_disp_aff_flags(d);
|
||||||
return;
|
return;
|
||||||
case 'x':
|
case 'x':
|
||||||
case 'X':
|
case 'X':
|
||||||
write_to_output(d, "Are you sure you want to delete this mobile? ");
|
write_to_output(d, "Are you sure you want to delete this mobile? ");
|
||||||
OLC_MODE(d) = MEDIT_DELETE;
|
OLC_MODE(d) = MEDIT_DELETE;
|
||||||
return;
|
return;
|
||||||
#if CONFIG_OASIS_MPROG
|
#if CONFIG_OASIS_MPROG
|
||||||
case 'p':
|
case 'p':
|
||||||
case 'P':
|
case 'P':
|
||||||
|
|
@ -913,7 +913,7 @@ void medit_parse(struct descriptor_data *d, char *arg)
|
||||||
TOGGLE_BIT(AFF_FLAGS(OLC_MOB(d)), 1 << (i - 1));
|
TOGGLE_BIT(AFF_FLAGS(OLC_MOB(d)), 1 << (i - 1));
|
||||||
|
|
||||||
/* Remove unwanted bits right away. */
|
/* Remove unwanted bits right away. */
|
||||||
REMOVE_BIT(AFF_FLAGS(OLC_MOB(d)),
|
REMOVE_BIT(AFF_FLAGS(OLC_MOB(d)),
|
||||||
AFF_CHARM | AFF_POISON | AFF_GROUP | AFF_SLEEP);
|
AFF_CHARM | AFF_POISON | AFF_GROUP | AFF_SLEEP);
|
||||||
medit_disp_aff_flags(d);
|
medit_disp_aff_flags(d);
|
||||||
return;
|
return;
|
||||||
|
|
@ -1091,21 +1091,21 @@ void medit_parse(struct descriptor_data *d, char *arg)
|
||||||
GET_ALIGNMENT(OLC_MOB(d)) = LIMIT(i, -1000, 1000);
|
GET_ALIGNMENT(OLC_MOB(d)) = LIMIT(i, -1000, 1000);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MEDIT_DELETE:
|
case MEDIT_DELETE:
|
||||||
if (*arg == 'y' || *arg == 'Y') {
|
if (*arg == 'y' || *arg == 'Y') {
|
||||||
if (delete_mobile(GET_MOB_RNUM(OLC_MOB(d))))
|
if (delete_mobile(GET_MOB_RNUM(OLC_MOB(d))))
|
||||||
write_to_output(d, "Mobile deleted.\r\n");
|
write_to_output(d, "Mobile deleted.\r\n");
|
||||||
else
|
else
|
||||||
write_to_output(d, "Couldn't delete the mobile!\r\n");
|
write_to_output(d, "Couldn't delete the mobile!\r\n");
|
||||||
|
|
||||||
cleanup_olc(d, CLEANUP_ALL);
|
cleanup_olc(d, CLEANUP_ALL);
|
||||||
return;
|
return;
|
||||||
} else if (*arg == 'n' || *arg == 'N') {
|
} else if (*arg == 'n' || *arg == 'N') {
|
||||||
medit_disp_menu(d);
|
medit_disp_menu(d);
|
||||||
OLC_MODE(d) = MEDIT_MAIN_MENU;
|
OLC_MODE(d) = MEDIT_MAIN_MENU;
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
write_to_output(d, "Please answer 'Y' or 'N': ");
|
write_to_output(d, "Please answer 'Y' or 'N': ");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
|
|
@ -1121,9 +1121,9 @@ void medit_parse(struct descriptor_data *d, char *arg)
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* END OF CASE
|
* END OF CASE
|
||||||
* If we get here, we have probably changed something, and now want to
|
* If we get here, we have probably changed something, and now want to
|
||||||
* return to main menu. Use OLC_VAL as a 'has changed' flag
|
* return to main menu. Use OLC_VAL as a 'has changed' flag
|
||||||
*/
|
*/
|
||||||
|
|
||||||
OLC_VAL(d) = TRUE;
|
OLC_VAL(d) = TRUE;
|
||||||
|
|
|
||||||
38
src/modify.c
38
src/modify.c
|
|
@ -76,7 +76,7 @@ int length[] =
|
||||||
void smash_tilde(char *str)
|
void smash_tilde(char *str)
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* Erase any _line ending_ tildes inserted in the editor.
|
* Erase any _line ending_ tildes inserted in the editor.
|
||||||
* The load mechanism can't handle those, yet.
|
* The load mechanism can't handle those, yet.
|
||||||
* -- Welcor 04/2003
|
* -- Welcor 04/2003
|
||||||
*/
|
*/
|
||||||
|
|
@ -102,7 +102,7 @@ void string_write(struct descriptor_data *d, char **writeto, size_t len, long ma
|
||||||
if (using_improved_editor)
|
if (using_improved_editor)
|
||||||
d->backstr = (char *)data;
|
d->backstr = (char *)data;
|
||||||
else if (data)
|
else if (data)
|
||||||
free(data);
|
free(data);
|
||||||
|
|
||||||
d->str = writeto;
|
d->str = writeto;
|
||||||
d->max_str = len;
|
d->max_str = len;
|
||||||
|
|
@ -123,14 +123,14 @@ void string_add(struct descriptor_data *d, char *str)
|
||||||
delete_doubledollar(str);
|
delete_doubledollar(str);
|
||||||
smash_tilde(str);
|
smash_tilde(str);
|
||||||
|
|
||||||
/* determine if this is the terminal string, and truncate if so */
|
/* determine if this is the terminal string, and truncate if so */
|
||||||
/* changed to only accept '@' at the beginning of line - J. Elson 1/17/94 */
|
/* changed to only accept '@' at the beginning of line - J. Elson 1/17/94 */
|
||||||
/* changed to only accept '@' if it's by itself - fnord 10/15/2004 */
|
/* changed to only accept '@' if it's by itself - fnord 10/15/2004 */
|
||||||
if ((action = (*str == '@' && !str[1])))
|
if ((action = (*str == '@' && !str[1])))
|
||||||
*str = '\0';
|
*str = '\0';
|
||||||
else
|
else
|
||||||
if ((action = improved_editor_execute(d, str)) == STRINGADD_ACTION)
|
if ((action = improved_editor_execute(d, str)) == STRINGADD_ACTION)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (action != STRINGADD_OK)
|
if (action != STRINGADD_OK)
|
||||||
/* Do nothing. */ ;
|
/* Do nothing. */ ;
|
||||||
|
|
@ -141,7 +141,7 @@ void string_add(struct descriptor_data *d, char *str)
|
||||||
CREATE(*d->str, char, d->max_str);
|
CREATE(*d->str, char, d->max_str);
|
||||||
strcpy(*d->str, str); /* strcpy: OK (size checked) */
|
strcpy(*d->str, str); /* strcpy: OK (size checked) */
|
||||||
if (!using_improved_editor)
|
if (!using_improved_editor)
|
||||||
action = STRINGADD_SAVE;
|
action = STRINGADD_SAVE;
|
||||||
} else {
|
} else {
|
||||||
CREATE(*d->str, char, strlen(str) + 3);
|
CREATE(*d->str, char, strlen(str) + 3);
|
||||||
strcpy(*d->str, str); /* strcpy: OK (size checked) */
|
strcpy(*d->str, str); /* strcpy: OK (size checked) */
|
||||||
|
|
@ -150,7 +150,7 @@ void string_add(struct descriptor_data *d, char *str)
|
||||||
if (strlen(str) + strlen(*d->str) + 3 > d->max_str) { /* \r\n\0 */
|
if (strlen(str) + strlen(*d->str) + 3 > d->max_str) { /* \r\n\0 */
|
||||||
send_to_char(d->character, "String too long. Last line skipped.\r\n");
|
send_to_char(d->character, "String too long. Last line skipped.\r\n");
|
||||||
if (!using_improved_editor)
|
if (!using_improved_editor)
|
||||||
action = STRINGADD_SAVE;
|
action = STRINGADD_SAVE;
|
||||||
else if (action == STRINGADD_OK)
|
else if (action == STRINGADD_OK)
|
||||||
action = STRINGADD_ACTION; /* No appending \r\n\0, but still let them save. */
|
action = STRINGADD_ACTION; /* No appending \r\n\0, but still let them save. */
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -256,7 +256,7 @@ void exdesc_string_cleanup(struct descriptor_data *d, int action)
|
||||||
{
|
{
|
||||||
if (action == STRINGADD_ABORT)
|
if (action == STRINGADD_ABORT)
|
||||||
write_to_output(d, "Description aborted.\r\n");
|
write_to_output(d, "Description aborted.\r\n");
|
||||||
|
|
||||||
write_to_output(d, "%s", CONFIG_MENU);
|
write_to_output(d, "%s", CONFIG_MENU);
|
||||||
STATE(d) = CON_MENU;
|
STATE(d) = CON_MENU;
|
||||||
}
|
}
|
||||||
|
|
@ -365,25 +365,25 @@ ACMD(do_skillset)
|
||||||
char *next_page(char *str, struct char_data *ch)
|
char *next_page(char *str, struct char_data *ch)
|
||||||
{
|
{
|
||||||
int col = 1, line = 1;
|
int col = 1, line = 1;
|
||||||
|
|
||||||
for (;; str++) {
|
for (;; str++) {
|
||||||
/* If end of string, return NULL. */
|
/* If end of string, return NULL. */
|
||||||
if (*str == '\0')
|
if (*str == '\0')
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
/* If we're at the start of the next page, return this fact. */
|
/* If we're at the start of the next page, return this fact. */
|
||||||
else if (line > (GET_PAGE_LENGTH(ch) - (PRF_FLAGGED(ch, PRF_COMPACT) ? 1 : 2)))
|
else if (line > (GET_PAGE_LENGTH(ch) - (PRF_FLAGGED(ch, PRF_COMPACT) ? 1 : 2)))
|
||||||
return (str);
|
return (str);
|
||||||
|
|
||||||
/* Check for the begining of an ANSI color code block. */
|
/* Check for the begining of an ANSI color code block. */
|
||||||
else if (*str == '\x1B')
|
else if (*str == '\x1B')
|
||||||
str++;
|
str++;
|
||||||
|
|
||||||
else if (*str == '@') {
|
else if (*str == '@') {
|
||||||
if (*(str + 1) != '@')
|
if (*(str + 1) != '@')
|
||||||
str++;
|
str++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check for everything else. */
|
/* Check for everything else. */
|
||||||
else {
|
else {
|
||||||
/* Carriage return puts us in column one. */
|
/* Carriage return puts us in column one. */
|
||||||
|
|
@ -392,7 +392,7 @@ char *next_page(char *str, struct char_data *ch)
|
||||||
/* Newline puts us on the next line. */
|
/* Newline puts us on the next line. */
|
||||||
else if (*str == '\n')
|
else if (*str == '\n')
|
||||||
line++;
|
line++;
|
||||||
|
|
||||||
/* We need to check here and see if we are over the page width,
|
/* We need to check here and see if we are over the page width,
|
||||||
* and if so, compensate by going to the begining of the next line.
|
* and if so, compensate by going to the begining of the next line.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
58
src/oasis.c
58
src/oasis.c
|
|
@ -72,7 +72,7 @@ void clear_screen(struct descriptor_data *d)
|
||||||
/*
|
/*
|
||||||
* Exported ACMD do_oasis function.
|
* Exported ACMD do_oasis function.
|
||||||
*
|
*
|
||||||
* This function is the OLC interface. It deals with all the
|
* This function is the OLC interface. It deals with all the
|
||||||
* generic OLC stuff, then passes control to the sub-olc sections.
|
* generic OLC stuff, then passes control to the sub-olc sections.
|
||||||
*
|
*
|
||||||
* UPDATE:
|
* UPDATE:
|
||||||
|
|
@ -93,16 +93,16 @@ ACMD(do_oasis)
|
||||||
/*
|
/*
|
||||||
* Prevent forcing people in OLC to edit other stuff.
|
* Prevent forcing people in OLC to edit other stuff.
|
||||||
* 'force' just lets command_interpreter() handle the input,
|
* 'force' just lets command_interpreter() handle the input,
|
||||||
* regardless of the state of the victim.
|
* regardless of the state of the victim.
|
||||||
* This can wreck havoc if people are i OLC already
|
* This can wreck havoc if people are i OLC already
|
||||||
* - ie. their input would have been redirected by nanny(), and
|
* - ie. their input would have been redirected by nanny(), and
|
||||||
* never get to command_interpreter().
|
* never get to command_interpreter().
|
||||||
* -- Welcor 09/03
|
* -- Welcor 09/03
|
||||||
* - thanks to Mark Garringer (zizazat@hotmail.com) for the bug report.
|
* - thanks to Mark Garringer (zizazat@hotmail.com) for the bug report.
|
||||||
*/
|
*/
|
||||||
if (STATE(ch->desc) != CON_PLAYING)
|
if (STATE(ch->desc) != CON_PLAYING)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
switch (subcmd) {
|
switch (subcmd) {
|
||||||
/*
|
/*
|
||||||
* The command to see what needs to be saved, typically 'olc'.
|
* The command to see what needs to be saved, typically 'olc'.
|
||||||
|
|
@ -110,31 +110,31 @@ ACMD(do_oasis)
|
||||||
case SCMD_OLC_SAVEINFO:
|
case SCMD_OLC_SAVEINFO:
|
||||||
do_show_save_list(ch);
|
do_show_save_list(ch);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCMD_OASIS_CEDIT:
|
case SCMD_OASIS_CEDIT:
|
||||||
do_oasis_cedit(ch, argument, cmd, subcmd);
|
do_oasis_cedit(ch, argument, cmd, subcmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCMD_OASIS_ZEDIT:
|
case SCMD_OASIS_ZEDIT:
|
||||||
do_oasis_zedit(ch, argument, cmd, subcmd);
|
do_oasis_zedit(ch, argument, cmd, subcmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCMD_OASIS_REDIT:
|
case SCMD_OASIS_REDIT:
|
||||||
do_oasis_redit(ch, argument, cmd, subcmd);
|
do_oasis_redit(ch, argument, cmd, subcmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCMD_OASIS_OEDIT:
|
case SCMD_OASIS_OEDIT:
|
||||||
do_oasis_oedit(ch, argument, cmd, subcmd);
|
do_oasis_oedit(ch, argument, cmd, subcmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCMD_OASIS_MEDIT:
|
case SCMD_OASIS_MEDIT:
|
||||||
do_oasis_medit(ch, argument, cmd, subcmd);
|
do_oasis_medit(ch, argument, cmd, subcmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCMD_OASIS_SEDIT:
|
case SCMD_OASIS_SEDIT:
|
||||||
do_oasis_sedit(ch, argument, cmd, subcmd);
|
do_oasis_sedit(ch, argument, cmd, subcmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCMD_OASIS_RLIST:
|
case SCMD_OASIS_RLIST:
|
||||||
case SCMD_OASIS_MLIST:
|
case SCMD_OASIS_MLIST:
|
||||||
case SCMD_OASIS_OLIST:
|
case SCMD_OASIS_OLIST:
|
||||||
|
|
@ -155,7 +155,7 @@ ACMD(do_oasis)
|
||||||
case SCMD_OASIS_AEDIT:
|
case SCMD_OASIS_AEDIT:
|
||||||
do_oasis_aedit(ch, argument, cmd, subcmd);
|
do_oasis_aedit(ch, argument, cmd, subcmd);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case SCMD_OASIS_HEDIT:
|
case SCMD_OASIS_HEDIT:
|
||||||
do_oasis_hedit(ch, argument, cmd, subcmd);
|
do_oasis_hedit(ch, argument, cmd, subcmd);
|
||||||
break;
|
break;
|
||||||
|
|
@ -168,12 +168,12 @@ ACMD(do_oasis)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*------------------------------------------------------------*\
|
/*------------------------------------------------------------*\
|
||||||
Exported utilities
|
Exported utilities
|
||||||
\*------------------------------------------------------------*/
|
\*------------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Set the colour string pointers for that which this char will
|
* Set the colour string pointers for that which this char will
|
||||||
* see at color level NRM. Changing the entries here will change
|
* see at color level NRM. Changing the entries here will change
|
||||||
* the colour scheme throughout the OLC.
|
* the colour scheme throughout the OLC.
|
||||||
*/
|
*/
|
||||||
void get_char_colors(struct char_data *ch)
|
void get_char_colors(struct char_data *ch)
|
||||||
|
|
@ -254,7 +254,7 @@ void cleanup_olc(struct descriptor_data *d, byte cleanup_type)
|
||||||
*/
|
*/
|
||||||
if (OLC_SHOP(d))
|
if (OLC_SHOP(d))
|
||||||
free_shop(OLC_SHOP(d));
|
free_shop(OLC_SHOP(d));
|
||||||
|
|
||||||
/*. Check for aedit stuff -- M. Scott */
|
/*. Check for aedit stuff -- M. Scott */
|
||||||
if (OLC_ACTION(d)) {
|
if (OLC_ACTION(d)) {
|
||||||
switch(cleanup_type) {
|
switch(cleanup_type) {
|
||||||
|
|
@ -286,11 +286,11 @@ void cleanup_olc(struct descriptor_data *d, byte cleanup_type)
|
||||||
|
|
||||||
/* free storage if allocated (for tedit and aedit) */
|
/* free storage if allocated (for tedit and aedit) */
|
||||||
/* and Triggers */
|
/* and Triggers */
|
||||||
/*
|
/*
|
||||||
* this is the command list - it's been copied to disk already,
|
* this is the command list - it's been copied to disk already,
|
||||||
* so just free it -- Welcor
|
* so just free it -- Welcor
|
||||||
*/
|
*/
|
||||||
if (OLC_STORAGE(d)) {
|
if (OLC_STORAGE(d)) {
|
||||||
free(OLC_STORAGE(d));
|
free(OLC_STORAGE(d));
|
||||||
OLC_STORAGE(d) = NULL;
|
OLC_STORAGE(d) = NULL;
|
||||||
}
|
}
|
||||||
|
|
@ -307,14 +307,14 @@ void cleanup_olc(struct descriptor_data *d, byte cleanup_type)
|
||||||
* OLC_SCRIPT is always set as trig_proto of OLC_OBJ/MOB/ROOM.
|
* OLC_SCRIPT is always set as trig_proto of OLC_OBJ/MOB/ROOM.
|
||||||
* Therefore it should not be free'd here.
|
* Therefore it should not be free'd here.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Restore descriptor playing status.
|
* Restore descriptor playing status.
|
||||||
*/
|
*/
|
||||||
if (d->character) {
|
if (d->character) {
|
||||||
REMOVE_BIT(PLR_FLAGS(d->character), PLR_WRITING);
|
REMOVE_BIT(PLR_FLAGS(d->character), PLR_WRITING);
|
||||||
act("$n stops using OLC.", TRUE, d->character, NULL, NULL, TO_ROOM);
|
act("$n stops using OLC.", TRUE, d->character, NULL, NULL, TO_ROOM);
|
||||||
|
|
||||||
if (cleanup_type == CLEANUP_CONFIG)
|
if (cleanup_type == CLEANUP_CONFIG)
|
||||||
mudlog(BRF, LVL_IMMORT, TRUE, "OLC: %s stops editing the game configuration", GET_NAME(d->character));
|
mudlog(BRF, LVL_IMMORT, TRUE, "OLC: %s stops editing the game configuration", GET_NAME(d->character));
|
||||||
else if (STATE(d) == CON_TEDIT)
|
else if (STATE(d) == CON_TEDIT)
|
||||||
|
|
@ -339,22 +339,22 @@ void split_argument(char *argument, char *tag)
|
||||||
{
|
{
|
||||||
char *tmp = argument, *ttag = tag, *wrt = argument;
|
char *tmp = argument, *ttag = tag, *wrt = argument;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
for (i = 0; *tmp; tmp++, i++) {
|
for (i = 0; *tmp; tmp++, i++) {
|
||||||
if (*tmp != ' ' && *tmp != '=')
|
if (*tmp != ' ' && *tmp != '=')
|
||||||
*(ttag++) = *tmp;
|
*(ttag++) = *tmp;
|
||||||
else if (*tmp == '=')
|
else if (*tmp == '=')
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
*ttag = '\0';
|
*ttag = '\0';
|
||||||
|
|
||||||
while (*tmp == '=' || *tmp == ' ')
|
while (*tmp == '=' || *tmp == ' ')
|
||||||
tmp++;
|
tmp++;
|
||||||
|
|
||||||
while (*tmp)
|
while (*tmp)
|
||||||
*(wrt++) = *(tmp++);
|
*(wrt++) = *(tmp++);
|
||||||
|
|
||||||
*wrt = '\0';
|
*wrt = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -364,7 +364,7 @@ void free_config(struct config_data *data)
|
||||||
/** Free strings. **/
|
/** Free strings. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
free_strings(data, OASIS_CFG);
|
free_strings(data, OASIS_CFG);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Free the data structure. **/
|
/** Free the data structure. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -400,11 +400,11 @@ int can_edit_zone(struct char_data *ch, zone_rnum rnum)
|
||||||
/* always access if ch is high enough level */
|
/* always access if ch is high enough level */
|
||||||
if (GET_LEVEL(ch) >= LVL_GRGOD)
|
if (GET_LEVEL(ch) >= LVL_GRGOD)
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
|
|
||||||
/* always access if a player helped build the zone in the first place */
|
/* always access if a player helped build the zone in the first place */
|
||||||
if (is_name(GET_NAME(ch), zone_table[rnum].builders))
|
if (is_name(GET_NAME(ch), zone_table[rnum].builders))
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
|
|
||||||
/* no access if you haven't been assigned a zone */
|
/* no access if you haven't been assigned a zone */
|
||||||
if (GET_OLC_ZONE(ch) == NOWHERE) {
|
if (GET_OLC_ZONE(ch) == NOWHERE) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
|
||||||
10
src/oasis.h
10
src/oasis.h
|
|
@ -84,10 +84,10 @@
|
||||||
#define MAX_OBJ_RENT 2000000
|
#define MAX_OBJ_RENT 2000000
|
||||||
#define MAX_CONTAINER_SIZE 10000
|
#define MAX_CONTAINER_SIZE 10000
|
||||||
|
|
||||||
#define MAX_MOB_GOLD 100000
|
#define MAX_MOB_GOLD 100000
|
||||||
#define MAX_MOB_EXP 150000
|
#define MAX_MOB_EXP 150000
|
||||||
/* this is one mud year.. */
|
/* this is one mud year.. */
|
||||||
#define MAX_OBJ_TIMER 1071000
|
#define MAX_OBJ_TIMER 1071000
|
||||||
|
|
||||||
|
|
||||||
/* this defines how much memory is alloacted for 'bit strings' when
|
/* this defines how much memory is alloacted for 'bit strings' when
|
||||||
|
|
@ -144,8 +144,8 @@ struct oasis_olc_data {
|
||||||
struct social_messg *action; /* Aedit uses this one */
|
struct social_messg *action; /* Aedit uses this one */
|
||||||
struct trig_data *trig;
|
struct trig_data *trig;
|
||||||
int script_mode;
|
int script_mode;
|
||||||
int trigger_position;
|
int trigger_position;
|
||||||
int item_type;
|
int item_type;
|
||||||
struct trig_proto_list *script; /* for assigning triggers in [r|o|m]edit*/
|
struct trig_proto_list *script; /* for assigning triggers in [r|o|m]edit*/
|
||||||
struct help_index_element*help; /* Hedit uses this */
|
struct help_index_element*help; /* Hedit uses this */
|
||||||
};
|
};
|
||||||
|
|
@ -371,7 +371,7 @@ extern const char *nrm, *grn, *cyn, *yel;
|
||||||
#define SEDIT_SHOP_FLAGS 35
|
#define SEDIT_SHOP_FLAGS 35
|
||||||
#define SEDIT_NOTRADE 36
|
#define SEDIT_NOTRADE 36
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Submodes of CEDIT connectedness.
|
* Submodes of CEDIT connectedness.
|
||||||
*/
|
*/
|
||||||
#define CEDIT_MAIN_MENU 0
|
#define CEDIT_MAIN_MENU 0
|
||||||
|
|
|
||||||
|
|
@ -41,11 +41,11 @@ ACMD(do_dig)
|
||||||
zone_rnum zone;
|
zone_rnum zone;
|
||||||
int dir = 0, rawvnum;
|
int dir = 0, rawvnum;
|
||||||
struct descriptor_data *d = ch->desc; /* will save us some typing */
|
struct descriptor_data *d = ch->desc; /* will save us some typing */
|
||||||
|
|
||||||
/* Grab the room's name (if available). */
|
/* Grab the room's name (if available). */
|
||||||
new_room_name = two_arguments(argument, sdir, sroom);
|
new_room_name = two_arguments(argument, sdir, sroom);
|
||||||
skip_spaces(&new_room_name);
|
skip_spaces(&new_room_name);
|
||||||
|
|
||||||
/* Can't dig if we don't know where to go. */
|
/* Can't dig if we don't know where to go. */
|
||||||
if (!*sdir || !*sroom) {
|
if (!*sdir || !*sroom) {
|
||||||
send_to_char(ch, "Format: dig <direction> <room> - to create an exit\r\n"
|
send_to_char(ch, "Format: dig <direction> <room> - to create an exit\r\n"
|
||||||
|
|
@ -58,7 +58,7 @@ ACMD(do_dig)
|
||||||
rvnum = NOWHERE;
|
rvnum = NOWHERE;
|
||||||
else
|
else
|
||||||
rvnum = (room_vnum)rawvnum;
|
rvnum = (room_vnum)rawvnum;
|
||||||
rrnum = real_room(rvnum);
|
rrnum = real_room(rvnum);
|
||||||
dir = search_block(sdir, dirs, FALSE);
|
dir = search_block(sdir, dirs, FALSE);
|
||||||
zone = world[IN_ROOM(ch)].zone;
|
zone = world[IN_ROOM(ch)].zone;
|
||||||
|
|
||||||
|
|
@ -72,7 +72,7 @@ ACMD(do_dig)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Lets not allow digging to limbo.
|
* Lets not allow digging to limbo.
|
||||||
* After all, it'd just get us more errors on 'show errors'
|
* After all, it'd just get us more errors on 'show errors'
|
||||||
*/
|
*/
|
||||||
if (rvnum == 0) {
|
if (rvnum == 0) {
|
||||||
|
|
@ -80,9 +80,9 @@ ACMD(do_dig)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* target room == -1 removes the exit
|
* target room == -1 removes the exit
|
||||||
*/
|
*/
|
||||||
if (rvnum == NOTHING) {
|
if (rvnum == NOTHING) {
|
||||||
if (W_EXIT(IN_ROOM(ch), dir)) {
|
if (W_EXIT(IN_ROOM(ch), dir)) {
|
||||||
/* free the old pointers, if any */
|
/* free the old pointers, if any */
|
||||||
if (W_EXIT(IN_ROOM(ch), dir)->general_description)
|
if (W_EXIT(IN_ROOM(ch), dir)->general_description)
|
||||||
|
|
@ -98,17 +98,17 @@ ACMD(do_dig)
|
||||||
send_to_char(ch, "There is no exit to the %s.\r\n"
|
send_to_char(ch, "There is no exit to the %s.\r\n"
|
||||||
"No exit removed.\r\n", dirs[dir]);
|
"No exit removed.\r\n", dirs[dir]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Can't dig in a direction, if it's already a door.
|
* Can't dig in a direction, if it's already a door.
|
||||||
*/
|
*/
|
||||||
if (W_EXIT(IN_ROOM(ch), dir)) {
|
if (W_EXIT(IN_ROOM(ch), dir)) {
|
||||||
send_to_char(ch, "There already is an exit to the %s.\r\n", dirs[dir]);
|
send_to_char(ch, "There already is an exit to the %s.\r\n", dirs[dir]);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Make sure that the builder has access to the zone he's linking to. */
|
/* Make sure that the builder has access to the zone he's linking to. */
|
||||||
zone = real_zone_by_thing(rvnum);
|
zone = real_zone_by_thing(rvnum);
|
||||||
if (zone == NOWHERE) {
|
if (zone == NOWHERE) {
|
||||||
send_to_char(ch, "You cannot link to a non-existing zone!\r\n");
|
send_to_char(ch, "You cannot link to a non-existing zone!\r\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -118,7 +118,7 @@ ACMD(do_dig)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Now we know the builder is allowed to make the link
|
* Now we know the builder is allowed to make the link
|
||||||
*/
|
*/
|
||||||
/* If the room doesn't exist, create it.*/
|
/* If the room doesn't exist, create it.*/
|
||||||
if (rrnum == NOWHERE) {
|
if (rrnum == NOWHERE) {
|
||||||
|
|
@ -134,30 +134,30 @@ ACMD(do_dig)
|
||||||
OLC_ZNUM(d) = zone;
|
OLC_ZNUM(d) = zone;
|
||||||
OLC_NUM(d) = rvnum;
|
OLC_NUM(d) = rvnum;
|
||||||
CREATE(OLC_ROOM(d), struct room_data, 1);
|
CREATE(OLC_ROOM(d), struct room_data, 1);
|
||||||
|
|
||||||
|
|
||||||
/* Copy the room's name. */
|
/* Copy the room's name. */
|
||||||
if (*new_room_name)
|
if (*new_room_name)
|
||||||
OLC_ROOM(d)->name = strdup(new_room_name);
|
OLC_ROOM(d)->name = strdup(new_room_name);
|
||||||
else
|
else
|
||||||
OLC_ROOM(d)->name = strdup("An unfinished room");
|
OLC_ROOM(d)->name = strdup("An unfinished room");
|
||||||
|
|
||||||
/* Copy the room's description.*/
|
/* Copy the room's description.*/
|
||||||
OLC_ROOM(d)->description = strdup("You are in an unfinished room.\r\n");
|
OLC_ROOM(d)->description = strdup("You are in an unfinished room.\r\n");
|
||||||
OLC_ROOM(d)->zone = OLC_ZNUM(d);
|
OLC_ROOM(d)->zone = OLC_ZNUM(d);
|
||||||
OLC_ROOM(d)->number = NOWHERE;
|
OLC_ROOM(d)->number = NOWHERE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Save the new room to memory.
|
* Save the new room to memory.
|
||||||
* redit_save_internally handles adding the room in the right place, etc.
|
* redit_save_internally handles adding the room in the right place, etc.
|
||||||
*/
|
*/
|
||||||
redit_save_internally(d);
|
redit_save_internally(d);
|
||||||
OLC_VAL(d) = 0;
|
OLC_VAL(d) = 0;
|
||||||
|
|
||||||
send_to_char(ch, "New room (%d) created.\r\n", rvnum);
|
send_to_char(ch, "New room (%d) created.\r\n", rvnum);
|
||||||
cleanup_olc(d, CLEANUP_STRUCTS);
|
cleanup_olc(d, CLEANUP_STRUCTS);
|
||||||
/*
|
/*
|
||||||
* update rrnum to the correct room rnum after adding the room
|
* update rrnum to the correct room rnum after adding the room
|
||||||
*/
|
*/
|
||||||
rrnum = real_room(rvnum);
|
rrnum = real_room(rvnum);
|
||||||
}
|
}
|
||||||
|
|
@ -170,14 +170,14 @@ ACMD(do_dig)
|
||||||
W_EXIT(IN_ROOM(ch), dir)->keyword = NULL;
|
W_EXIT(IN_ROOM(ch), dir)->keyword = NULL;
|
||||||
W_EXIT(IN_ROOM(ch), dir)->to_room = rrnum;
|
W_EXIT(IN_ROOM(ch), dir)->to_room = rrnum;
|
||||||
add_to_save_list(zone_table[world[IN_ROOM(ch)].zone].number, SL_WLD);
|
add_to_save_list(zone_table[world[IN_ROOM(ch)].zone].number, SL_WLD);
|
||||||
|
|
||||||
send_to_char(ch, "You make an exit %s to room %d (%s).\r\n",
|
send_to_char(ch, "You make an exit %s to room %d (%s).\r\n",
|
||||||
dirs[dir], rvnum, world[rrnum].name);
|
dirs[dir], rvnum, world[rrnum].name);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* check if we can dig from there to here.
|
* check if we can dig from there to here.
|
||||||
*/
|
*/
|
||||||
if (W_EXIT(rrnum, rev_dir[dir]))
|
if (W_EXIT(rrnum, rev_dir[dir]))
|
||||||
send_to_char(ch, "Can not dig from %d to here. The target room already has an exit to the %s.\r\n",
|
send_to_char(ch, "Can not dig from %d to here. The target room already has an exit to the %s.\r\n",
|
||||||
rvnum, dirs[rev_dir[dir]]);
|
rvnum, dirs[rev_dir[dir]]);
|
||||||
else {
|
else {
|
||||||
|
|
@ -197,14 +197,14 @@ ACMD(do_room_copy)
|
||||||
zone_rnum dst_zone;
|
zone_rnum dst_zone;
|
||||||
struct descriptor_data *dsc;
|
struct descriptor_data *dsc;
|
||||||
char buf[MAX_INPUT_LENGTH];
|
char buf[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
one_argument(argument, buf);
|
one_argument(argument, buf);
|
||||||
|
|
||||||
if (!*buf) {
|
if (!*buf) {
|
||||||
send_to_char(ch, "Usage: rclone <target room>\r\n");
|
send_to_char(ch, "Usage: rclone <target room>\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (real_room((buf_num = atoi(buf))) != NOWHERE) {
|
if (real_room((buf_num = atoi(buf))) != NOWHERE) {
|
||||||
send_to_char(ch, "That room already exist!\r\n");
|
send_to_char(ch, "That room already exist!\r\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -214,24 +214,24 @@ ACMD(do_room_copy)
|
||||||
send_to_char(ch, "Sorry, there is no zone for that number!\r\n");
|
send_to_char(ch, "Sorry, there is no zone for that number!\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!can_edit_zone(ch, dst_zone) ||
|
if (!can_edit_zone(ch, dst_zone) ||
|
||||||
!can_edit_zone(ch, world[IN_ROOM(ch)].zone) ) {
|
!can_edit_zone(ch, world[IN_ROOM(ch)].zone) ) {
|
||||||
send_to_char(ch, "You may only copy rooms within your designated zone(s)!\r\n");
|
send_to_char(ch, "You may only copy rooms within your designated zone(s)!\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
room_src = &world[IN_ROOM(ch)];
|
room_src = &world[IN_ROOM(ch)];
|
||||||
CREATE(room_dst, struct room_data, 1);
|
CREATE(room_dst, struct room_data, 1);
|
||||||
|
|
||||||
room_dst->zone = dst_zone;
|
room_dst->zone = dst_zone;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate space for all strings.
|
* Allocate space for all strings.
|
||||||
*/
|
*/
|
||||||
send_to_char(ch, "Cloning room....\r\n");
|
send_to_char(ch, "Cloning room....\r\n");
|
||||||
|
|
||||||
room_dst->name = str_udup(world[IN_ROOM(ch)].name);
|
room_dst->name = str_udup(world[IN_ROOM(ch)].name);
|
||||||
room_dst->description = str_udup(world[IN_ROOM(ch)].description);
|
room_dst->description = str_udup(world[IN_ROOM(ch)].description);
|
||||||
room_dst->description = str_udup(world[IN_ROOM(ch)].description);
|
room_dst->description = str_udup(world[IN_ROOM(ch)].description);
|
||||||
|
|
@ -242,7 +242,7 @@ ACMD(do_room_copy)
|
||||||
/*
|
/*
|
||||||
* Extra descriptions, if necessary.
|
* Extra descriptions, if necessary.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
send_to_char(ch, "Cloning extra descriptions....\r\n");
|
send_to_char(ch, "Cloning extra descriptions....\r\n");
|
||||||
if (world[IN_ROOM(ch)].ex_description) {
|
if (world[IN_ROOM(ch)].ex_description) {
|
||||||
struct extra_descr_data *tdesc, *temp, *temp2;
|
struct extra_descr_data *tdesc, *temp, *temp2;
|
||||||
|
|
@ -262,9 +262,9 @@ ACMD(do_room_copy)
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Now save the room in the right place:
|
* Now save the room in the right place:
|
||||||
*/
|
*/
|
||||||
send_to_char(ch, "Saving new room...\r\n");
|
send_to_char(ch, "Saving new room...\r\n");
|
||||||
|
|
||||||
if ((room_num = add_room(room_dst)) == NOWHERE) {
|
if ((room_num = add_room(room_dst)) == NOWHERE) {
|
||||||
send_to_char(ch, "Something went wrong...\r\n");
|
send_to_char(ch, "Something went wrong...\r\n");
|
||||||
log("SYSERR: do_room_copy: Something failed! (%d)", room_num);
|
log("SYSERR: do_room_copy: Something failed! (%d)", room_num);
|
||||||
|
|
@ -307,12 +307,12 @@ ACMD(do_room_copy)
|
||||||
****************************************************************************/
|
****************************************************************************/
|
||||||
|
|
||||||
/* For buildwalk. Finds the next free vnum in the zone */
|
/* For buildwalk. Finds the next free vnum in the zone */
|
||||||
room_vnum redit_find_new_vnum(zone_rnum zone)
|
room_vnum redit_find_new_vnum(zone_rnum zone)
|
||||||
{
|
{
|
||||||
room_vnum vnum = genolc_zone_bottom(zone);
|
room_vnum vnum = genolc_zone_bottom(zone);
|
||||||
room_rnum rnum = real_room(vnum);
|
room_rnum rnum = real_room(vnum);
|
||||||
|
|
||||||
if (rnum == NOWHERE)
|
if (rnum == NOWHERE)
|
||||||
return NOWHERE;
|
return NOWHERE;
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
|
|
@ -334,7 +334,7 @@ int buildwalk(struct char_data *ch, int dir)
|
||||||
|
|
||||||
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_BUILDWALK) &&
|
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_BUILDWALK) &&
|
||||||
GET_LEVEL(ch) >= LVL_BUILDER) {
|
GET_LEVEL(ch) >= LVL_BUILDER) {
|
||||||
|
|
||||||
get_char_colors(ch);
|
get_char_colors(ch);
|
||||||
|
|
||||||
if (!can_edit_zone(ch, world[IN_ROOM(ch)].zone)) {
|
if (!can_edit_zone(ch, world[IN_ROOM(ch)].zone)) {
|
||||||
|
|
@ -355,21 +355,21 @@ int buildwalk(struct char_data *ch, int dir)
|
||||||
OLC_ZNUM(d) = world[IN_ROOM(ch)].zone;
|
OLC_ZNUM(d) = world[IN_ROOM(ch)].zone;
|
||||||
OLC_NUM(d) = vnum;
|
OLC_NUM(d) = vnum;
|
||||||
CREATE(OLC_ROOM(d), struct room_data, 1);
|
CREATE(OLC_ROOM(d), struct room_data, 1);
|
||||||
|
|
||||||
OLC_ROOM(d)->name = strdup("New BuildWalk Room");
|
OLC_ROOM(d)->name = strdup("New BuildWalk Room");
|
||||||
|
|
||||||
sprintf(buf, "This unfinished room was created by %s.\r\n", GET_NAME(ch));
|
sprintf(buf, "This unfinished room was created by %s.\r\n", GET_NAME(ch));
|
||||||
OLC_ROOM(d)->description = strdup(buf);
|
OLC_ROOM(d)->description = strdup(buf);
|
||||||
OLC_ROOM(d)->zone = OLC_ZNUM(d);
|
OLC_ROOM(d)->zone = OLC_ZNUM(d);
|
||||||
OLC_ROOM(d)->number = NOWHERE;
|
OLC_ROOM(d)->number = NOWHERE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Save the new room to memory.
|
* Save the new room to memory.
|
||||||
* redit_save_internally handles adding the room in the right place, etc.
|
* redit_save_internally handles adding the room in the right place, etc.
|
||||||
*/
|
*/
|
||||||
redit_save_internally(d);
|
redit_save_internally(d);
|
||||||
OLC_VAL(d) = 0;
|
OLC_VAL(d) = 0;
|
||||||
|
|
||||||
/* Link rooms */
|
/* Link rooms */
|
||||||
rnum = real_room(vnum);
|
rnum = real_room(vnum);
|
||||||
CREATE(EXIT(ch, dir), struct room_direction_data, 1);
|
CREATE(EXIT(ch, dir), struct room_direction_data, 1);
|
||||||
|
|
@ -380,7 +380,7 @@ int buildwalk(struct char_data *ch, int dir)
|
||||||
/* Report room creation to user */
|
/* Report room creation to user */
|
||||||
send_to_char(ch, "%sRoom #%d created by BuildWalk.%s\r\n", yel, vnum, nrm);
|
send_to_char(ch, "%sRoom #%d created by BuildWalk.%s\r\n", yel, vnum, nrm);
|
||||||
cleanup_olc(d, CLEANUP_STRUCTS);
|
cleanup_olc(d, CLEANUP_STRUCTS);
|
||||||
|
|
||||||
return (1);
|
return (1);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -5,8 +5,8 @@
|
||||||
* Copyright 1997-2001 George Greer (greerga@circlemud.org) *
|
* Copyright 1997-2001 George Greer (greerga@circlemud.org) *
|
||||||
* Copyright 2002 Kip Potter [Mythran] (kip_potter@hotmail.com) *
|
* Copyright 2002 Kip Potter [Mythran] (kip_potter@hotmail.com) *
|
||||||
************************************************************************/
|
************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
+-----------------------------------------------------------------------+
|
+-----------------------------------------------------------------------+
|
||||||
| As of right now, all I have made is the ability to delete rooms. |
|
| As of right now, all I have made is the ability to delete rooms. |
|
||||||
| Deleting the rest of the area (objects, zones, mobiles) will be |
|
| Deleting the rest of the area (objects, zones, mobiles) will be |
|
||||||
|
|
@ -15,7 +15,7 @@
|
||||||
| be adding more deletion code after this patch. |
|
| be adding more deletion code after this patch. |
|
||||||
| -- Mythran |
|
| -- Mythran |
|
||||||
+-----------------------------------------------------------------------+
|
+-----------------------------------------------------------------------+
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -48,80 +48,80 @@ int free_strings(void *data, int type)
|
||||||
struct room_data *room;
|
struct room_data *room;
|
||||||
struct config_data *config;
|
struct config_data *config;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case OASIS_WLD:
|
case OASIS_WLD:
|
||||||
room = (struct room_data *) data;
|
room = (struct room_data *) data;
|
||||||
|
|
||||||
/* Free Descriptions */
|
/* Free Descriptions */
|
||||||
if (room->name)
|
if (room->name)
|
||||||
free(room->name);
|
free(room->name);
|
||||||
|
|
||||||
if (room->description)
|
if (room->description)
|
||||||
free(room->description);
|
free(room->description);
|
||||||
|
|
||||||
if (room->ex_description)
|
if (room->ex_description)
|
||||||
free_ex_descriptions(room->ex_description);
|
free_ex_descriptions(room->ex_description);
|
||||||
|
|
||||||
/* Return the return value of free_strings(). */
|
/* Return the return value of free_strings(). */
|
||||||
return (free_strings(room, OASIS_EXI));
|
return (free_strings(room, OASIS_EXI));
|
||||||
|
|
||||||
case OASIS_EXI:
|
case OASIS_EXI:
|
||||||
room = (struct room_data *) data;
|
room = (struct room_data *) data;
|
||||||
|
|
||||||
for (i = 0; i < NUM_OF_DIRS; i++) {
|
for (i = 0; i < NUM_OF_DIRS; i++) {
|
||||||
if (room->dir_option[i]) {
|
if (room->dir_option[i]) {
|
||||||
if (room->dir_option[i]->general_description) {
|
if (room->dir_option[i]->general_description) {
|
||||||
free(room->dir_option[i]->general_description);
|
free(room->dir_option[i]->general_description);
|
||||||
room->dir_option[i]->general_description = NULL;
|
room->dir_option[i]->general_description = NULL;
|
||||||
}
|
}
|
||||||
if (room->dir_option[i]->keyword) {
|
if (room->dir_option[i]->keyword) {
|
||||||
free(room->dir_option[i]->keyword);
|
free(room->dir_option[i]->keyword);
|
||||||
room->dir_option[i]->keyword = NULL;
|
room->dir_option[i]->keyword = NULL;
|
||||||
}
|
}
|
||||||
free(room->dir_option[i]);
|
free(room->dir_option[i]);
|
||||||
room->dir_option[i] = NULL;
|
room->dir_option[i] = NULL;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
|
|
||||||
case OASIS_MOB:
|
case OASIS_MOB:
|
||||||
case OASIS_OBJ:
|
case OASIS_OBJ:
|
||||||
return (FALSE); /* For now... */
|
return (FALSE); /* For now... */
|
||||||
|
|
||||||
case OASIS_CFG:
|
case OASIS_CFG:
|
||||||
config = (struct config_data *) data;
|
config = (struct config_data *) data;
|
||||||
|
|
||||||
if (config->play.OK)
|
if (config->play.OK)
|
||||||
free(config->play.OK);
|
free(config->play.OK);
|
||||||
|
|
||||||
if (config->play.NOPERSON)
|
if (config->play.NOPERSON)
|
||||||
free(config->play.NOPERSON);
|
free(config->play.NOPERSON);
|
||||||
|
|
||||||
if (config->play.NOEFFECT)
|
if (config->play.NOEFFECT)
|
||||||
free(config->play.NOEFFECT);
|
free(config->play.NOEFFECT);
|
||||||
|
|
||||||
if (config->operation.DFLT_IP)
|
if (config->operation.DFLT_IP)
|
||||||
free(config->operation.DFLT_IP);
|
free(config->operation.DFLT_IP);
|
||||||
|
|
||||||
if (config->operation.DFLT_DIR)
|
if (config->operation.DFLT_DIR)
|
||||||
free(config->operation.DFLT_DIR);
|
free(config->operation.DFLT_DIR);
|
||||||
|
|
||||||
if (config->operation.LOGNAME)
|
if (config->operation.LOGNAME)
|
||||||
free(config->operation.LOGNAME);
|
free(config->operation.LOGNAME);
|
||||||
|
|
||||||
if (config->operation.MENU)
|
if (config->operation.MENU)
|
||||||
free(config->operation.MENU);
|
free(config->operation.MENU);
|
||||||
|
|
||||||
if (config->operation.WELC_MESSG)
|
if (config->operation.WELC_MESSG)
|
||||||
free(config->operation.WELC_MESSG);
|
free(config->operation.WELC_MESSG);
|
||||||
|
|
||||||
if (config->operation.START_MESSG)
|
if (config->operation.START_MESSG)
|
||||||
free(config->operation.START_MESSG);
|
free(config->operation.START_MESSG);
|
||||||
|
|
||||||
return (TRUE);
|
return (TRUE);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: oasis_delete.c: free_strings: Invalid type handled (Type %d).", type);
|
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: oasis_delete.c: free_strings: Invalid type handled (Type %d).", type);
|
||||||
return (FALSE);
|
return (FALSE);
|
||||||
|
|
|
||||||
126
src/oasis_list.c
126
src/oasis_list.c
|
|
@ -33,7 +33,7 @@ void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/** Ingame Commands **/
|
/** Ingame Commands **/
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
ACMD(do_oasis_list)
|
ACMD(do_oasis_list)
|
||||||
{
|
{
|
||||||
zone_rnum rzone = NOWHERE;
|
zone_rnum rzone = NOWHERE;
|
||||||
room_rnum vmin = NOWHERE;
|
room_rnum vmin = NOWHERE;
|
||||||
|
|
@ -41,13 +41,13 @@ ACMD(do_oasis_list)
|
||||||
char smin[MAX_INPUT_LENGTH];
|
char smin[MAX_INPUT_LENGTH];
|
||||||
char smax[MAX_INPUT_LENGTH];
|
char smax[MAX_INPUT_LENGTH];
|
||||||
|
|
||||||
two_arguments(argument, smin, smax);
|
two_arguments(argument, smin, smax);
|
||||||
|
|
||||||
if (!*smin || *smin == '.') {
|
if (!*smin || *smin == '.') {
|
||||||
rzone = world[IN_ROOM(ch)].zone;
|
rzone = world[IN_ROOM(ch)].zone;
|
||||||
} else if (!*smax) {
|
} else if (!*smax) {
|
||||||
rzone = real_zone(atoi(smin));
|
rzone = real_zone(atoi(smin));
|
||||||
|
|
||||||
if (rzone == NOWHERE) {
|
if (rzone == NOWHERE) {
|
||||||
send_to_char(ch, "Sorry, there's no zone with that number\r\n");
|
send_to_char(ch, "Sorry, there's no zone with that number\r\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -56,13 +56,13 @@ ACMD(do_oasis_list)
|
||||||
/** Listing by min vnum / max vnum. Retrieve the numeric values. **/
|
/** Listing by min vnum / max vnum. Retrieve the numeric values. **/
|
||||||
vmin = atoi(smin);
|
vmin = atoi(smin);
|
||||||
vmax = atoi(smax);
|
vmax = atoi(smax);
|
||||||
|
|
||||||
if (vmin > vmax) {
|
if (vmin > vmax) {
|
||||||
send_to_char(ch, "List from %d to %d - Aren't we funny today!\r\n", vmin, vmax);
|
send_to_char(ch, "List from %d to %d - Aren't we funny today!\r\n", vmin, vmax);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch (subcmd) {
|
switch (subcmd) {
|
||||||
case SCMD_OASIS_MLIST: list_mobiles(ch, rzone, vmin, vmax); break;
|
case SCMD_OASIS_MLIST: list_mobiles(ch, rzone, vmin, vmax); break;
|
||||||
case SCMD_OASIS_OLIST: list_objects(ch, rzone, vmin, vmax); break;
|
case SCMD_OASIS_OLIST: list_objects(ch, rzone, vmin, vmax); break;
|
||||||
|
|
@ -70,12 +70,12 @@ ACMD(do_oasis_list)
|
||||||
case SCMD_OASIS_TLIST: list_triggers(ch, rzone, vmin, vmax); break;
|
case SCMD_OASIS_TLIST: list_triggers(ch, rzone, vmin, vmax); break;
|
||||||
case SCMD_OASIS_SLIST: list_shops(ch, rzone, vmin, vmax); break;
|
case SCMD_OASIS_SLIST: list_shops(ch, rzone, vmin, vmax); break;
|
||||||
case SCMD_OASIS_ZLIST: list_zones(ch, rzone, vmin, vmax); break;
|
case SCMD_OASIS_ZLIST: list_zones(ch, rzone, vmin, vmax); break;
|
||||||
default:
|
default:
|
||||||
send_to_char(ch, "You can't list that!\r\n");
|
send_to_char(ch, "You can't list that!\r\n");
|
||||||
mudlog(BRF, LVL_IMMORT, TRUE,
|
mudlog(BRF, LVL_IMMORT, TRUE,
|
||||||
"SYSERR: do_oasis_list: Unknown list option: %d", subcmd);
|
"SYSERR: do_oasis_list: Unknown list option: %d", subcmd);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ACMD(do_oasis_links)
|
ACMD(do_oasis_links)
|
||||||
|
|
@ -89,13 +89,13 @@ ACMD(do_oasis_links)
|
||||||
|
|
||||||
skip_spaces(&argument);
|
skip_spaces(&argument);
|
||||||
one_argument(argument, arg);
|
one_argument(argument, arg);
|
||||||
|
|
||||||
if (!arg || !*arg) {
|
if (!arg || !*arg) {
|
||||||
send_to_char(ch,
|
send_to_char(ch,
|
||||||
"Syntax: links <zone_vnum> ('.' for zone you are standing in)\r\n");
|
"Syntax: links <zone_vnum> ('.' for zone you are standing in)\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!strcmp(arg, ".")) {
|
if (!strcmp(arg, ".")) {
|
||||||
zrnum = world[IN_ROOM(ch)].zone;
|
zrnum = world[IN_ROOM(ch)].zone;
|
||||||
zvnum = zone_table[zrnum].number;
|
zvnum = zone_table[zrnum].number;
|
||||||
|
|
@ -103,7 +103,7 @@ ACMD(do_oasis_links)
|
||||||
zvnum = atoi(arg);
|
zvnum = atoi(arg);
|
||||||
zrnum = real_zone(zvnum);
|
zrnum = real_zone(zvnum);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (zrnum == NOWHERE || zvnum == NOWHERE) {
|
if (zrnum == NOWHERE || zvnum == NOWHERE) {
|
||||||
send_to_char(ch, "No zone was found with that number.\n\r");
|
send_to_char(ch, "No zone was found with that number.\n\r");
|
||||||
return;
|
return;
|
||||||
|
|
@ -120,7 +120,7 @@ ACMD(do_oasis_links)
|
||||||
to_room = world[nr].dir_option[j]->to_room;
|
to_room = world[nr].dir_option[j]->to_room;
|
||||||
if (to_room != NOWHERE && (zrnum != world[to_room].zone))
|
if (to_room != NOWHERE && (zrnum != world[to_room].zone))
|
||||||
send_to_char(ch, "%3d %-30s%s at %5d (%-5s) ---> %5d\r\n",
|
send_to_char(ch, "%3d %-30s%s at %5d (%-5s) ---> %5d\r\n",
|
||||||
zone_table[world[to_room].zone].number,
|
zone_table[world[to_room].zone].number,
|
||||||
zone_table[world[to_room].zone].name, QNRM,
|
zone_table[world[to_room].zone].name, QNRM,
|
||||||
GET_ROOM_VNUM(nr), dirs[j], world[to_room].number);
|
GET_ROOM_VNUM(nr), dirs[j], world[to_room].number);
|
||||||
}
|
}
|
||||||
|
|
@ -134,8 +134,8 @@ ACMD(do_oasis_links)
|
||||||
/** Helper Functions **/
|
/** Helper Functions **/
|
||||||
/******************************************************************************/
|
/******************************************************************************/
|
||||||
/*
|
/*
|
||||||
* List all rooms in a zone.
|
* List all rooms in a zone.
|
||||||
*/
|
*/
|
||||||
void list_rooms(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum vmax)
|
void list_rooms(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum vmax)
|
||||||
{
|
{
|
||||||
room_rnum i;
|
room_rnum i;
|
||||||
|
|
@ -143,7 +143,7 @@ void list_rooms(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum
|
||||||
int j, counter = 0;
|
int j, counter = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Expect a minimum / maximum number if the rnum for the zone is NOWHERE.
|
* Expect a minimum / maximum number if the rnum for the zone is NOWHERE.
|
||||||
*/
|
*/
|
||||||
if (rnum != NOWHERE) {
|
if (rnum != NOWHERE) {
|
||||||
bottom = zone_table[rnum].bot;
|
bottom = zone_table[rnum].bot;
|
||||||
|
|
@ -152,19 +152,19 @@ void list_rooms(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum
|
||||||
bottom = vmin;
|
bottom = vmin;
|
||||||
top = vmax;
|
top = vmax;
|
||||||
}
|
}
|
||||||
|
|
||||||
send_to_char (ch,
|
send_to_char (ch,
|
||||||
"Index VNum Room Name Exits\r\n"
|
"Index VNum Room Name Exits\r\n"
|
||||||
"----- ------- ---------------------------------------- -----\r\n");
|
"----- ------- ---------------------------------------- -----\r\n");
|
||||||
|
|
||||||
for (i = 0; i <= top_of_world; i++) {
|
for (i = 0; i <= top_of_world; i++) {
|
||||||
|
|
||||||
/** Check to see if this room is one of the ones needed to be listed. **/
|
/** Check to see if this room is one of the ones needed to be listed. **/
|
||||||
if ((world[i].number >= bottom) && (world[i].number <= top)) {
|
if ((world[i].number >= bottom) && (world[i].number <= top)) {
|
||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
send_to_char(ch, "%4d) [%s%-5d%s] %s%-*s%s %s",
|
send_to_char(ch, "%4d) [%s%-5d%s] %s%-*s%s %s",
|
||||||
counter, QGRN, world[i].number, QNRM,
|
counter, QGRN, world[i].number, QNRM,
|
||||||
QCYN, count_color_chars(world[i].name)+44, world[i].name, QNRM,
|
QCYN, count_color_chars(world[i].name)+44, world[i].name, QNRM,
|
||||||
world[i].proto_script ? "[TRIG] " : ""
|
world[i].proto_script ? "[TRIG] " : ""
|
||||||
);
|
);
|
||||||
|
|
@ -174,30 +174,30 @@ void list_rooms(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum
|
||||||
continue;
|
continue;
|
||||||
if (W_EXIT(i, j)->to_room == NOWHERE)
|
if (W_EXIT(i, j)->to_room == NOWHERE)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (world[W_EXIT(i, j)->to_room].zone != world[i].zone)
|
if (world[W_EXIT(i, j)->to_room].zone != world[i].zone)
|
||||||
send_to_char(ch, "(%s%d%s)", QYEL, world[W_EXIT(i, j)->to_room].number, QNRM);
|
send_to_char(ch, "(%s%d%s)", QYEL, world[W_EXIT(i, j)->to_room].number, QNRM);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
send_to_char(ch, "\r\n");
|
send_to_char(ch, "\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (counter == 0)
|
if (counter == 0)
|
||||||
send_to_char(ch, "No rooms found for zone #%d\r\n", zone_table[rnum].number);
|
send_to_char(ch, "No rooms found for zone #%d\r\n", zone_table[rnum].number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* List all mobiles in a zone.
|
* List all mobiles in a zone.
|
||||||
*/
|
*/
|
||||||
void list_mobiles(struct char_data *ch, zone_rnum rnum, mob_vnum vmin, mob_vnum vmax)
|
void list_mobiles(struct char_data *ch, zone_rnum rnum, mob_vnum vmin, mob_vnum vmax)
|
||||||
{
|
{
|
||||||
mob_rnum i;
|
mob_rnum i;
|
||||||
mob_vnum bottom, top;
|
mob_vnum bottom, top;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
|
||||||
if (rnum != NOWHERE) {
|
if (rnum != NOWHERE) {
|
||||||
bottom = zone_table[rnum].bot;
|
bottom = zone_table[rnum].bot;
|
||||||
top = zone_table[rnum].top;
|
top = zone_table[rnum].top;
|
||||||
|
|
@ -205,37 +205,37 @@ void list_mobiles(struct char_data *ch, zone_rnum rnum, mob_vnum vmin, mob_vnum
|
||||||
bottom = vmin;
|
bottom = vmin;
|
||||||
top = vmax;
|
top = vmax;
|
||||||
}
|
}
|
||||||
|
|
||||||
send_to_char(ch,
|
send_to_char(ch,
|
||||||
"Index VNum Mobile Name Level\r\n"
|
"Index VNum Mobile Name Level\r\n"
|
||||||
"----- ------- --------------------------------------------- -----\r\n");
|
"----- ------- --------------------------------------------- -----\r\n");
|
||||||
|
|
||||||
for (i = 0; i <= top_of_mobt; i++) {
|
for (i = 0; i <= top_of_mobt; i++) {
|
||||||
if (mob_index[i].vnum >= bottom && mob_index[i].vnum <= top) {
|
if (mob_index[i].vnum >= bottom && mob_index[i].vnum <= top) {
|
||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
send_to_char(ch, "%s%4d%s) [%s%-5d%s] %s%-*s %s[%4d]%s%s\r\n",
|
send_to_char(ch, "%s%4d%s) [%s%-5d%s] %s%-*s %s[%4d]%s%s\r\n",
|
||||||
QGRN, counter, QNRM, QGRN, mob_index[i].vnum, QNRM,
|
QGRN, counter, QNRM, QGRN, mob_index[i].vnum, QNRM,
|
||||||
QCYN, count_color_chars(mob_proto[i].player.short_descr)+44, mob_proto[i].player.short_descr,
|
QCYN, count_color_chars(mob_proto[i].player.short_descr)+44, mob_proto[i].player.short_descr,
|
||||||
QYEL, mob_proto[i].player.level, QNRM,
|
QYEL, mob_proto[i].player.level, QNRM,
|
||||||
mob_proto[i].proto_script ? " [TRIG]" : ""
|
mob_proto[i].proto_script ? " [TRIG]" : ""
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (counter == 0)
|
if (counter == 0)
|
||||||
send_to_char(ch, "None found.\r\n");
|
send_to_char(ch, "None found.\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* List all objects in a zone.
|
* List all objects in a zone.
|
||||||
*/
|
*/
|
||||||
void list_objects(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum vmax)
|
void list_objects(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum vmax)
|
||||||
{
|
{
|
||||||
obj_rnum i;
|
obj_rnum i;
|
||||||
obj_vnum bottom, top;
|
obj_vnum bottom, top;
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
|
|
||||||
if (rnum != NOWHERE) {
|
if (rnum != NOWHERE) {
|
||||||
bottom = zone_table[rnum].bot;
|
bottom = zone_table[rnum].bot;
|
||||||
top = zone_table[rnum].top;
|
top = zone_table[rnum].top;
|
||||||
|
|
@ -243,38 +243,38 @@ void list_objects(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnu
|
||||||
bottom = vmin;
|
bottom = vmin;
|
||||||
top = vmax;
|
top = vmax;
|
||||||
}
|
}
|
||||||
|
|
||||||
send_to_char(ch,
|
send_to_char(ch,
|
||||||
"Index VNum Object Name Object Type\r\n"
|
"Index VNum Object Name Object Type\r\n"
|
||||||
"----- ------- -------------------------------------------- ----------------\r\n");
|
"----- ------- -------------------------------------------- ----------------\r\n");
|
||||||
|
|
||||||
for (i = 0; i <= top_of_objt; i++) {
|
for (i = 0; i <= top_of_objt; i++) {
|
||||||
if (obj_index[i].vnum >= bottom && obj_index[i].vnum <= top) {
|
if (obj_index[i].vnum >= bottom && obj_index[i].vnum <= top) {
|
||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
send_to_char(ch, "%s%4d%s) [%s%-5d%s] %s%-*s %s[%s]%s%s\r\n",
|
send_to_char(ch, "%s%4d%s) [%s%-5d%s] %s%-*s %s[%s]%s%s\r\n",
|
||||||
QGRN, counter, QNRM, QGRN, obj_index[i].vnum, QNRM,
|
QGRN, counter, QNRM, QGRN, obj_index[i].vnum, QNRM,
|
||||||
QCYN, count_color_chars(obj_proto[i].short_description)+44, obj_proto[i].short_description, QYEL,
|
QCYN, count_color_chars(obj_proto[i].short_description)+44, obj_proto[i].short_description, QYEL,
|
||||||
item_types[obj_proto[i].obj_flags.type_flag], QNRM,
|
item_types[obj_proto[i].obj_flags.type_flag], QNRM,
|
||||||
obj_proto[i].proto_script ? " [TRIG]" : ""
|
obj_proto[i].proto_script ? " [TRIG]" : ""
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (counter == 0)
|
if (counter == 0)
|
||||||
send_to_char(ch, "None found.\r\n");
|
send_to_char(ch, "None found.\r\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* List all shops in a zone.
|
* List all shops in a zone.
|
||||||
*/
|
*/
|
||||||
void list_shops(struct char_data *ch, zone_rnum rnum, shop_vnum vmin, shop_vnum vmax)
|
void list_shops(struct char_data *ch, zone_rnum rnum, shop_vnum vmin, shop_vnum vmax)
|
||||||
{
|
{
|
||||||
shop_rnum i;
|
shop_rnum i;
|
||||||
shop_vnum bottom, top;
|
shop_vnum bottom, top;
|
||||||
int j, counter = 0;
|
int j, counter = 0;
|
||||||
|
|
||||||
if (rnum != NOWHERE) {
|
if (rnum != NOWHERE) {
|
||||||
bottom = zone_table[rnum].bot;
|
bottom = zone_table[rnum].bot;
|
||||||
top = zone_table[rnum].top;
|
top = zone_table[rnum].top;
|
||||||
|
|
@ -282,44 +282,44 @@ void list_shops(struct char_data *ch, zone_rnum rnum, shop_vnum vmin, shop_vnum
|
||||||
bottom = vmin;
|
bottom = vmin;
|
||||||
top = vmax;
|
top = vmax;
|
||||||
}
|
}
|
||||||
|
|
||||||
send_to_char (ch,
|
send_to_char (ch,
|
||||||
"Index VNum RNum Shop Room(s)\r\n"
|
"Index VNum RNum Shop Room(s)\r\n"
|
||||||
"----- ------- ------- -----------------------------------------\r\n");
|
"----- ------- ------- -----------------------------------------\r\n");
|
||||||
|
|
||||||
for (i = 0; i <= top_shop; i++) {
|
for (i = 0; i <= top_shop; i++) {
|
||||||
if (SHOP_NUM(i) >= bottom && SHOP_NUM(i) <= top) {
|
if (SHOP_NUM(i) >= bottom && SHOP_NUM(i) <= top) {
|
||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
/* the +1 is strange but fits the rest of the shop code */
|
/* the +1 is strange but fits the rest of the shop code */
|
||||||
send_to_char(ch, "%s%4d%s) [%s%-5d%s] [%s%-5d%s]",
|
send_to_char(ch, "%s%4d%s) [%s%-5d%s] [%s%-5d%s]",
|
||||||
QGRN, counter, QNRM, QGRN, SHOP_NUM(i), QNRM, QGRN, i + 1, QNRM);
|
QGRN, counter, QNRM, QGRN, SHOP_NUM(i), QNRM, QGRN, i + 1, QNRM);
|
||||||
|
|
||||||
/* Thanks to Ken Ray (kenr86@hotmail.com) for this display fix -- Welcor*/
|
/* Thanks to Ken Ray (kenr86@hotmail.com) for this display fix -- Welcor*/
|
||||||
for (j = 0; SHOP_ROOM(i, j) != NOWHERE; j++)
|
for (j = 0; SHOP_ROOM(i, j) != NOWHERE; j++)
|
||||||
send_to_char(ch, "%s%s[%s%-5d%s]%s",
|
send_to_char(ch, "%s%s[%s%-5d%s]%s",
|
||||||
((j > 0) && (j % 6 == 0)) ? "\r\n " : " ",
|
((j > 0) && (j % 6 == 0)) ? "\r\n " : " ",
|
||||||
QCYN, QYEL, SHOP_ROOM(i, j), QCYN, QNRM);
|
QCYN, QYEL, SHOP_ROOM(i, j), QCYN, QNRM);
|
||||||
|
|
||||||
if (j == 0)
|
if (j == 0)
|
||||||
send_to_char(ch, "%sNone.%s", QCYN, QNRM);
|
send_to_char(ch, "%sNone.%s", QCYN, QNRM);
|
||||||
|
|
||||||
send_to_char(ch, "\r\n");
|
send_to_char(ch, "\r\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (counter == 0)
|
if (counter == 0)
|
||||||
send_to_char(ch, "None found.\r\n");
|
send_to_char(ch, "None found.\r\n");
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* List all zones in the world (sort of like 'show zones').
|
* List all zones in the world (sort of like 'show zones').
|
||||||
*/
|
*/
|
||||||
void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax)
|
void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum vmax)
|
||||||
{
|
{
|
||||||
int counter = 0;
|
int counter = 0;
|
||||||
zone_rnum i;
|
zone_rnum i;
|
||||||
zone_vnum bottom, top;
|
zone_vnum bottom, top;
|
||||||
|
|
||||||
if (rnum != NOWHERE) {
|
if (rnum != NOWHERE) {
|
||||||
/* Only one parameter was supplied - just list that zone */
|
/* Only one parameter was supplied - just list that zone */
|
||||||
print_zone(ch, zone_table[rnum].number);
|
print_zone(ch, zone_table[rnum].number);
|
||||||
|
|
@ -328,11 +328,11 @@ void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum
|
||||||
bottom = vmin;
|
bottom = vmin;
|
||||||
top = vmax;
|
top = vmax;
|
||||||
}
|
}
|
||||||
|
|
||||||
send_to_char(ch,
|
send_to_char(ch,
|
||||||
"VNum Zone Name Builder(s)\r\n"
|
"VNum Zone Name Builder(s)\r\n"
|
||||||
"----- ------------------------------ --------------------------------------\r\n");
|
"----- ------------------------------ --------------------------------------\r\n");
|
||||||
|
|
||||||
for (i = 0; i <= top_of_zone_table; i++) {
|
for (i = 0; i <= top_of_zone_table; i++) {
|
||||||
if (zone_table[i].number >= bottom && zone_table[i].number <= top) {
|
if (zone_table[i].number >= bottom && zone_table[i].number <= top) {
|
||||||
send_to_char(ch, "[%s%3d%s] %s%-*s %s%-1s%s\r\n",
|
send_to_char(ch, "[%s%3d%s] %s%-*s %s%-1s%s\r\n",
|
||||||
|
|
@ -341,7 +341,7 @@ void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum
|
||||||
counter++;
|
counter++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!counter)
|
if (!counter)
|
||||||
send_to_char(ch, " None found within those parameters.\r\n");
|
send_to_char(ch, " None found within those parameters.\r\n");
|
||||||
}
|
}
|
||||||
|
|
@ -375,7 +375,7 @@ void print_zone(struct char_data *ch, zone_vnum vnum)
|
||||||
largest_table = top_of_objt;
|
largest_table = top_of_objt;
|
||||||
else
|
else
|
||||||
largest_table = top_of_mobt;
|
largest_table = top_of_mobt;
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Initialize some of the variables. **/
|
/** Initialize some of the variables. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -384,21 +384,21 @@ void print_zone(struct char_data *ch, zone_vnum vnum)
|
||||||
size_mobiles = 0;
|
size_mobiles = 0;
|
||||||
top = zone_table[rnum].top;
|
top = zone_table[rnum].top;
|
||||||
bottom = zone_table[rnum].bot;
|
bottom = zone_table[rnum].bot;
|
||||||
|
|
||||||
for (i = 0; i <= largest_table; i++) {
|
for (i = 0; i <= largest_table; i++) {
|
||||||
if (i <= top_of_world)
|
if (i <= top_of_world)
|
||||||
if (world[i].zone == rnum)
|
if (world[i].zone == rnum)
|
||||||
size_rooms++;
|
size_rooms++;
|
||||||
|
|
||||||
if (i <= top_of_objt)
|
if (i <= top_of_objt)
|
||||||
if (obj_index[i].vnum >= bottom && obj_index[i].vnum <= top)
|
if (obj_index[i].vnum >= bottom && obj_index[i].vnum <= top)
|
||||||
size_objects++;
|
size_objects++;
|
||||||
|
|
||||||
if (i <= top_of_mobt)
|
if (i <= top_of_mobt)
|
||||||
if (mob_index[i].vnum >= bottom && mob_index[i].vnum <= top)
|
if (mob_index[i].vnum >= bottom && mob_index[i].vnum <= top)
|
||||||
size_mobiles++;
|
size_mobiles++;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Display all of the zone information at once. **/
|
/** Display all of the zone information at once. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -420,7 +420,7 @@ void print_zone(struct char_data *ch, zone_vnum vnum)
|
||||||
QGRN, QCYN, zone_table[rnum].builders,
|
QGRN, QCYN, zone_table[rnum].builders,
|
||||||
QGRN, QCYN, zone_table[rnum].lifespan,
|
QGRN, QCYN, zone_table[rnum].lifespan,
|
||||||
QGRN, QCYN, zone_table[rnum].age,
|
QGRN, QCYN, zone_table[rnum].age,
|
||||||
QGRN, QCYN, zone_table[rnum].bot,
|
QGRN, QCYN, zone_table[rnum].bot,
|
||||||
QGRN, QCYN, zone_table[rnum].top,
|
QGRN, QCYN, zone_table[rnum].top,
|
||||||
QGRN, QCYN, zone_table[rnum].reset_mode ? ((zone_table[rnum].reset_mode == 1) ?
|
QGRN, QCYN, zone_table[rnum].reset_mode ? ((zone_table[rnum].reset_mode == 1) ?
|
||||||
"Reset when no players are in zone." : "Normal reset.") : "Never reset",
|
"Reset when no players are in zone." : "Normal reset.") : "Never reset",
|
||||||
|
|
|
||||||
104
src/objsave.c
104
src/objsave.c
|
|
@ -1,10 +1,10 @@
|
||||||
/* ************************************************************************
|
/* ************************************************************************
|
||||||
* File: objsave.c Part of CircleMUD *
|
* File: objsave.c Part of CircleMUD *
|
||||||
* Usage: loading/saving player objects for rent and crash-save *
|
* Usage: loading/saving player objects for rent and crash-save *
|
||||||
* *
|
* *
|
||||||
* All rights reserved. See license.doc for complete information. *
|
* All rights reserved. See license.doc for complete information. *
|
||||||
* *
|
* *
|
||||||
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University *
|
* Copyright (C) 1993, 94 by the Trustees of the Johns Hopkins University *
|
||||||
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
|
* CircleMUD is based on DikuMUD, Copyright (C) 1990, 1991. *
|
||||||
************************************************************************ */
|
************************************************************************ */
|
||||||
|
|
||||||
|
|
@ -89,7 +89,7 @@ void strip_string(char *buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Writes one object record to FILE.
|
* Writes one object record to FILE.
|
||||||
* Old name: Obj_to_store()
|
* Old name: Obj_to_store()
|
||||||
*/
|
*/
|
||||||
int objsave_save_obj_record(struct obj_data *obj, FILE *fp, int locate)
|
int objsave_save_obj_record(struct obj_data *obj, FILE *fp, int locate)
|
||||||
|
|
@ -180,7 +180,7 @@ int objsave_save_obj_record(struct obj_data *obj, FILE *fp, int locate)
|
||||||
if (obj->ex_description || temp->ex_description) {
|
if (obj->ex_description || temp->ex_description) {
|
||||||
/* To be reimplemented. Need to handle this case in loading as
|
/* To be reimplemented. Need to handle this case in loading as
|
||||||
well */
|
well */
|
||||||
if ((obj->ex_description && temp->ex_description &&
|
if ((obj->ex_description && temp->ex_description &&
|
||||||
obj->ex_description != temp->ex_description) ||
|
obj->ex_description != temp->ex_description) ||
|
||||||
!obj->ex_description || !temp->ex_description) {
|
!obj->ex_description || !temp->ex_description) {
|
||||||
for (ex_desc = obj->ex_description; ex_desc; ex_desc = ex_desc->next) {
|
for (ex_desc = obj->ex_description; ex_desc; ex_desc = ex_desc->next) {
|
||||||
|
|
@ -344,7 +344,7 @@ int Crash_delete_crashfile(struct char_data *ch)
|
||||||
|
|
||||||
if (!get_filename(fname, sizeof(fname), CRASH_FILE, GET_NAME(ch)))
|
if (!get_filename(fname, sizeof(fname), CRASH_FILE, GET_NAME(ch)))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!(fl = fopen(fname, "r"))) {
|
if (!(fl = fopen(fname, "r"))) {
|
||||||
if (errno != ENOENT) /* if it fails, NOT because of no file */
|
if (errno != ENOENT) /* if it fails, NOT because of no file */
|
||||||
log("SYSERR: checking for crash file %s (3): %s", fname, strerror(errno));
|
log("SYSERR: checking for crash file %s (3): %s", fname, strerror(errno));
|
||||||
|
|
@ -356,7 +356,7 @@ int Crash_delete_crashfile(struct char_data *ch)
|
||||||
if (numread == FALSE)
|
if (numread == FALSE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
sscanf(line,"%d ",&rentcode);
|
sscanf(line,"%d ",&rentcode);
|
||||||
|
|
||||||
if (rentcode == RENT_CRASH)
|
if (rentcode == RENT_CRASH)
|
||||||
Crash_delete_file(GET_NAME(ch));
|
Crash_delete_file(GET_NAME(ch));
|
||||||
|
|
||||||
|
|
@ -389,12 +389,12 @@ int Crash_clean_file(char *name)
|
||||||
fclose(fl);
|
fclose(fl);
|
||||||
if (numread == FALSE)
|
if (numread == FALSE)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
sscanf(line, "%d %d %d %d %d %d",&rentcode,&timed,&netcost,
|
sscanf(line, "%d %d %d %d %d %d",&rentcode,&timed,&netcost,
|
||||||
&gold,&account,&nitems);
|
&gold,&account,&nitems);
|
||||||
|
|
||||||
if ((rentcode == RENT_CRASH) ||
|
if ((rentcode == RENT_CRASH) ||
|
||||||
(rentcode == RENT_FORCED) ||
|
(rentcode == RENT_FORCED) ||
|
||||||
(rentcode == RENT_TIMEDOUT) ) {
|
(rentcode == RENT_TIMEDOUT) ) {
|
||||||
if (timed < time(0) - (crash_file_timeout * SECS_PER_REAL_DAY)) {
|
if (timed < time(0) - (crash_file_timeout * SECS_PER_REAL_DAY)) {
|
||||||
Crash_delete_file(name);
|
Crash_delete_file(name);
|
||||||
|
|
@ -442,16 +442,16 @@ void Crash_listrent(struct char_data *ch, char *name)
|
||||||
char fname[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH], line[READ_SIZE];
|
char fname[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH], line[READ_SIZE];
|
||||||
obj_save_data *loaded, *current;
|
obj_save_data *loaded, *current;
|
||||||
int rentcode,timed,netcost,gold,account,nitems, numread, len;
|
int rentcode,timed,netcost,gold,account,nitems, numread, len;
|
||||||
|
|
||||||
if (!get_filename(fname, sizeof(fname), CRASH_FILE, name))
|
if (!get_filename(fname, sizeof(fname), CRASH_FILE, name))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(fl = fopen(fname, "r"))) {
|
if (!(fl = fopen(fname, "r"))) {
|
||||||
send_to_char(ch, "%s has no rent file.\r\n", name);
|
send_to_char(ch, "%s has no rent file.\r\n", name);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
len = snprintf(buf, sizeof(buf),"%s\r\n", fname);
|
len = snprintf(buf, sizeof(buf),"%s\r\n", fname);
|
||||||
|
|
||||||
numread = get_line(fl, line);
|
numread = get_line(fl, line);
|
||||||
|
|
||||||
/* Oops, can't get the data, punt. */
|
/* Oops, can't get the data, punt. */
|
||||||
|
|
@ -460,7 +460,7 @@ void Crash_listrent(struct char_data *ch, char *name)
|
||||||
fclose(fl);
|
fclose(fl);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
sscanf(line,"%d %d %d %d %d %d",
|
sscanf(line,"%d %d %d %d %d %d",
|
||||||
&rentcode,&timed,&netcost,&gold,&account,&nitems);
|
&rentcode,&timed,&netcost,&gold,&account,&nitems);
|
||||||
|
|
||||||
|
|
@ -484,14 +484,14 @@ void Crash_listrent(struct char_data *ch, char *name)
|
||||||
}
|
}
|
||||||
|
|
||||||
loaded = objsave_parse_objects(fl);
|
loaded = objsave_parse_objects(fl);
|
||||||
|
|
||||||
for (current = loaded; current != NULL; current=current->next)
|
for (current = loaded; current != NULL; current=current->next)
|
||||||
len += snprintf(buf+len, sizeof(buf)-len, "[%5d] (%5dau) %-20s\r\n",
|
len += snprintf(buf+len, sizeof(buf)-len, "[%5d] (%5dau) %-20s\r\n",
|
||||||
GET_OBJ_VNUM(current->obj),
|
GET_OBJ_VNUM(current->obj),
|
||||||
GET_OBJ_RENT(current->obj),
|
GET_OBJ_RENT(current->obj),
|
||||||
current->obj->short_description);
|
current->obj->short_description);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* now it's safe to free the obj_save_data list and the objects on it.
|
* now it's safe to free the obj_save_data list and the objects on it.
|
||||||
*/
|
*/
|
||||||
while (loaded != NULL) {
|
while (loaded != NULL) {
|
||||||
|
|
@ -560,7 +560,7 @@ void Crash_extract_norent_eq(struct char_data *ch)
|
||||||
for (j = 0; j < NUM_WEARS; j++) {
|
for (j = 0; j < NUM_WEARS; j++) {
|
||||||
if (GET_EQ(ch, j) == NULL)
|
if (GET_EQ(ch, j) == NULL)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (Crash_is_unrentable(GET_EQ(ch, j)))
|
if (Crash_is_unrentable(GET_EQ(ch, j)))
|
||||||
obj_to_char(unequip_char(ch, j), ch);
|
obj_to_char(unequip_char(ch, j), ch);
|
||||||
else
|
else
|
||||||
|
|
@ -640,7 +640,7 @@ void Crash_crashsave(struct char_data *ch)
|
||||||
|
|
||||||
if (!get_filename(buf, sizeof(buf), CRASH_FILE, GET_NAME(ch)))
|
if (!get_filename(buf, sizeof(buf), CRASH_FILE, GET_NAME(ch)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(fp = fopen(buf, "w")))
|
if (!(fp = fopen(buf, "w")))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -680,7 +680,7 @@ void Crash_idlesave(struct char_data *ch)
|
||||||
|
|
||||||
if (!get_filename(buf, sizeof(buf), CRASH_FILE, GET_NAME(ch)))
|
if (!get_filename(buf, sizeof(buf), CRASH_FILE, GET_NAME(ch)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(fp = fopen(buf, "w")))
|
if (!(fp = fopen(buf, "w")))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -721,7 +721,7 @@ void Crash_idlesave(struct char_data *ch)
|
||||||
|
|
||||||
if (!objsave_write_rentcode(fp, RENT_TIMEDOUT, cost, ch))
|
if (!objsave_write_rentcode(fp, RENT_TIMEDOUT, cost, ch))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (j = 0; j < NUM_WEARS; j++) {
|
for (j = 0; j < NUM_WEARS; j++) {
|
||||||
if (GET_EQ(ch, j)) {
|
if (GET_EQ(ch, j)) {
|
||||||
if (!Crash_save(GET_EQ(ch, j), fp, j + 1)) {
|
if (!Crash_save(GET_EQ(ch, j), fp, j + 1)) {
|
||||||
|
|
@ -754,7 +754,7 @@ void Crash_rentsave(struct char_data *ch, int cost)
|
||||||
|
|
||||||
if (!get_filename(buf, sizeof(buf), CRASH_FILE, GET_NAME(ch)))
|
if (!get_filename(buf, sizeof(buf), CRASH_FILE, GET_NAME(ch)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(fp = fopen(buf, "w")))
|
if (!(fp = fopen(buf, "w")))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -799,7 +799,7 @@ int objsave_write_rentcode(FILE *fl, int rentcode, int cost_per_day, struct char
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Crash_cryosave(struct char_data *ch, int cost)
|
void Crash_cryosave(struct char_data *ch, int cost)
|
||||||
|
|
@ -813,7 +813,7 @@ void Crash_cryosave(struct char_data *ch, int cost)
|
||||||
|
|
||||||
if (!get_filename(buf, sizeof(buf), CRASH_FILE, GET_NAME(ch)))
|
if (!get_filename(buf, sizeof(buf), CRASH_FILE, GET_NAME(ch)))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!(fp = fopen(buf, "w")))
|
if (!(fp = fopen(buf, "w")))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -847,7 +847,7 @@ void Crash_cryosave(struct char_data *ch, int cost)
|
||||||
|
|
||||||
|
|
||||||
/* ************************************************************************
|
/* ************************************************************************
|
||||||
* Routines used for the receptionist *
|
* Routines used for the receptionist *
|
||||||
************************************************************************* */
|
************************************************************************* */
|
||||||
|
|
||||||
void Crash_rent_deadline(struct char_data *ch, struct char_data *recep,
|
void Crash_rent_deadline(struct char_data *ch, struct char_data *recep,
|
||||||
|
|
@ -855,13 +855,13 @@ void Crash_rent_deadline(struct char_data *ch, struct char_data *recep,
|
||||||
{
|
{
|
||||||
long rent_deadline;
|
long rent_deadline;
|
||||||
char buf[MAX_STRING_LENGTH];
|
char buf[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
if (!cost)
|
if (!cost)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
rent_deadline = ((GET_GOLD(ch) + GET_BANK_GOLD(ch)) / cost);
|
rent_deadline = ((GET_GOLD(ch) + GET_BANK_GOLD(ch)) / cost);
|
||||||
snprintf(buf, sizeof(buf), "$n tells you, 'You can rent for %ld day%s with the gold you have\r\n"
|
snprintf(buf, sizeof(buf), "$n tells you, 'You can rent for %ld day%s with the gold you have\r\n"
|
||||||
"on hand and in the bank.'\r\n", rent_deadline, rent_deadline != 1 ? "s" : "");
|
"on hand and in the bank.'\r\n", rent_deadline, rent_deadline != 1 ? "s" : "");
|
||||||
act(buf, FALSE, recep, 0, ch, TO_VICT);
|
act(buf, FALSE, recep, 0, ch, TO_VICT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -886,7 +886,7 @@ int Crash_report_unrentables(struct char_data *ch, struct char_data *recep,
|
||||||
|
|
||||||
|
|
||||||
void Crash_report_rent(struct char_data *ch, struct char_data *recep,
|
void Crash_report_rent(struct char_data *ch, struct char_data *recep,
|
||||||
struct obj_data *obj, long *cost, long *nitems,
|
struct obj_data *obj, long *cost, long *nitems,
|
||||||
int display, int factor)
|
int display, int factor)
|
||||||
{
|
{
|
||||||
static char buf[256];
|
static char buf[256];
|
||||||
|
|
@ -1078,14 +1078,14 @@ obj_save_data *objsave_parse_objects(FILE *fl)
|
||||||
CREATE(current, obj_save_data, 1);
|
CREATE(current, obj_save_data, 1);
|
||||||
head = current;
|
head = current;
|
||||||
current->locate = 0;
|
current->locate = 0;
|
||||||
|
|
||||||
temp = NULL;
|
temp = NULL;
|
||||||
while (TRUE) {
|
while (TRUE) {
|
||||||
char tag[6];
|
char tag[6];
|
||||||
int num;
|
int num;
|
||||||
|
|
||||||
/* if the file is done, wrap it all up */
|
/* if the file is done, wrap it all up */
|
||||||
if(get_line(fl, line) == FALSE || (*line == '$' && line[1] == '~'))
|
if(get_line(fl, line) == FALSE || (*line == '$' && line[1] == '~'))
|
||||||
{
|
{
|
||||||
if (temp == NULL && current->obj == NULL)
|
if (temp == NULL && current->obj == NULL)
|
||||||
{
|
{
|
||||||
|
|
@ -1102,7 +1102,7 @@ obj_save_data *objsave_parse_objects(FILE *fl)
|
||||||
{
|
{
|
||||||
if (t->next == current)
|
if (t->next == current)
|
||||||
t->next = NULL;
|
t->next = NULL;
|
||||||
|
|
||||||
t = t->next;
|
t = t->next;
|
||||||
}
|
}
|
||||||
free(current);
|
free(current);
|
||||||
|
|
@ -1111,26 +1111,26 @@ obj_save_data *objsave_parse_objects(FILE *fl)
|
||||||
else if (temp != NULL && current->obj == NULL)
|
else if (temp != NULL && current->obj == NULL)
|
||||||
{
|
{
|
||||||
current->obj = temp;
|
current->obj = temp;
|
||||||
}
|
}
|
||||||
else if (temp == NULL && current->obj != NULL)
|
else if (temp == NULL && current->obj != NULL)
|
||||||
{
|
{
|
||||||
// do nothing
|
// do nothing
|
||||||
}
|
}
|
||||||
else if (temp != NULL && current->obj != NULL)
|
else if (temp != NULL && current->obj != NULL)
|
||||||
{
|
{
|
||||||
if (temp != current->obj)
|
if (temp != current->obj)
|
||||||
log("inconsistent object pointers in objsave_parse_objects: %p/%p", temp, current->obj);
|
log("inconsistent object pointers in objsave_parse_objects: %p/%p", temp, current->obj);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* if it's a new record, wrap up the old one, and make space for a new one */
|
/* if it's a new record, wrap up the old one, and make space for a new one */
|
||||||
if (*line == '#') {
|
if (*line == '#') {
|
||||||
/* check for false alarm. */
|
/* check for false alarm. */
|
||||||
if (sscanf(line, "#%d", &nr) == 1)
|
if (sscanf(line, "#%d", &nr) == 1)
|
||||||
{
|
{
|
||||||
if (temp)
|
if (temp)
|
||||||
{
|
{
|
||||||
current->obj = temp;
|
current->obj = temp;
|
||||||
CREATE(current->next, obj_save_data, 1);
|
CREATE(current->next, obj_save_data, 1);
|
||||||
|
|
@ -1151,12 +1151,12 @@ obj_save_data *objsave_parse_objects(FILE *fl)
|
||||||
} else {
|
} else {
|
||||||
if(real_object(nr) != NOTHING) {
|
if(real_object(nr) != NOTHING) {
|
||||||
temp=read_object(nr,VIRTUAL);
|
temp=read_object(nr,VIRTUAL);
|
||||||
// go read next line - nothing more to see here
|
// go read next line - nothing more to see here
|
||||||
} else {
|
} else {
|
||||||
log("Nonexistent object %d found in rent file.", nr);
|
log("Nonexistent object %d found in rent file.", nr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// go read next line - nothing more to see here
|
// go read next line - nothing more to see here
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1189,7 +1189,7 @@ obj_save_data *objsave_parse_objects(FILE *fl)
|
||||||
if(!strcmp(tag, "EDes")) {
|
if(!strcmp(tag, "EDes")) {
|
||||||
struct extra_descr_data *new_desc;
|
struct extra_descr_data *new_desc;
|
||||||
char error[40];
|
char error[40];
|
||||||
snprintf(error, sizeof(error)-1, "rent(Edes): %s", temp->name);
|
snprintf(error, sizeof(error)-1, "rent(Edes): %s", temp->name);
|
||||||
if (temp->item_number != NOTHING && /* Regular object */
|
if (temp->item_number != NOTHING && /* Regular object */
|
||||||
temp->ex_description && /* with ex_desc == prototype */
|
temp->ex_description && /* with ex_desc == prototype */
|
||||||
(temp->ex_description == obj_proto[real_object(temp->item_number)].ex_description))
|
(temp->ex_description == obj_proto[real_object(temp->item_number)].ex_description))
|
||||||
|
|
@ -1245,8 +1245,8 @@ obj_save_data *objsave_parse_objects(FILE *fl)
|
||||||
default:
|
default:
|
||||||
log("Unknown tag in rentfile: %s", tag);
|
log("Unknown tag in rentfile: %s", tag);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return head;
|
return head;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -1289,7 +1289,7 @@ int Crash_load_objs(struct char_data *ch) {
|
||||||
cost = (int) (netcost * num_of_days);
|
cost = (int) (netcost * num_of_days);
|
||||||
if (cost > GET_GOLD(ch) + GET_BANK_GOLD(ch)) {
|
if (cost > GET_GOLD(ch) + GET_BANK_GOLD(ch)) {
|
||||||
fclose(fl);
|
fclose(fl);
|
||||||
mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE,
|
mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE,
|
||||||
"%s entering game, rented equipment lost (no $).", GET_NAME(ch));
|
"%s entering game, rented equipment lost (no $).", GET_NAME(ch));
|
||||||
Crash_crashsave(ch);
|
Crash_crashsave(ch);
|
||||||
return 2;
|
return 2;
|
||||||
|
|
@ -1301,7 +1301,7 @@ int Crash_load_objs(struct char_data *ch) {
|
||||||
}
|
}
|
||||||
switch (orig_rent_code = rentcode) {
|
switch (orig_rent_code = rentcode) {
|
||||||
case RENT_RENTED:
|
case RENT_RENTED:
|
||||||
mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE,
|
mudlog(NRM, MAX(LVL_IMMORT, GET_INVIS_LEV(ch)), TRUE,
|
||||||
"%s un-renting and entering game.", GET_NAME(ch));
|
"%s un-renting and entering game.", GET_NAME(ch));
|
||||||
break;
|
break;
|
||||||
case RENT_CRASH:
|
case RENT_CRASH:
|
||||||
|
|
@ -1327,9 +1327,9 @@ int Crash_load_objs(struct char_data *ch) {
|
||||||
loaded = objsave_parse_objects(fl);
|
loaded = objsave_parse_objects(fl);
|
||||||
for (current = loaded; current != NULL; current=current->next)
|
for (current = loaded; current != NULL; current=current->next)
|
||||||
num_objs += handle_obj(current->obj, ch, current->locate, cont_row);
|
num_objs += handle_obj(current->obj, ch, current->locate, cont_row);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* now it's safe to free the obj_save_data list - all members of it
|
* now it's safe to free the obj_save_data list - all members of it
|
||||||
* have been put in the correct lists by handle_obj()
|
* have been put in the correct lists by handle_obj()
|
||||||
*/
|
*/
|
||||||
while (loaded != NULL) {
|
while (loaded != NULL) {
|
||||||
|
|
@ -1337,9 +1337,9 @@ int Crash_load_objs(struct char_data *ch) {
|
||||||
loaded = loaded->next;
|
loaded = loaded->next;
|
||||||
free(current);
|
free(current);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Little hoarding check. -gg 3/1/98 */
|
/* Little hoarding check. -gg 3/1/98 */
|
||||||
mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "%s (level %d) has %d objects (max %d).",
|
mudlog(NRM, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "%s (level %d) has %d objects (max %d).",
|
||||||
GET_NAME(ch), GET_LEVEL(ch), num_objs, max_obj_save);
|
GET_NAME(ch), GET_LEVEL(ch), num_objs, max_obj_save);
|
||||||
|
|
||||||
fclose(fl);
|
fclose(fl);
|
||||||
|
|
@ -1361,7 +1361,7 @@ int handle_obj(struct obj_data *temp, struct char_data *ch, int locate, struct o
|
||||||
|
|
||||||
auto_equip(ch, temp, locate);
|
auto_equip(ch, temp, locate);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
what to do with a new loaded item:
|
what to do with a new loaded item:
|
||||||
|
|
||||||
if there's a list with <locate> less than 1 below this:
|
if there's a list with <locate> less than 1 below this:
|
||||||
|
|
@ -1418,7 +1418,7 @@ int handle_obj(struct obj_data *temp, struct char_data *ch, int locate, struct o
|
||||||
for (;cont_row[j];cont_row[j] = obj1) {
|
for (;cont_row[j];cont_row[j] = obj1) {
|
||||||
obj1 = cont_row[j]->next_content;
|
obj1 = cont_row[j]->next_content;
|
||||||
obj_to_char(cont_row[j], ch);
|
obj_to_char(cont_row[j], ch);
|
||||||
}
|
}
|
||||||
cont_row[j] = NULL;
|
cont_row[j] = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
130
src/oedit.c
130
src/oedit.c
|
|
@ -64,12 +64,12 @@ ACMD(do_oasis_oedit)
|
||||||
char *buf3;
|
char *buf3;
|
||||||
char buf1[MAX_STRING_LENGTH];
|
char buf1[MAX_STRING_LENGTH];
|
||||||
char buf2[MAX_STRING_LENGTH];
|
char buf2[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Parse any arguments. **/
|
/** Parse any arguments. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
buf3 = two_arguments(argument, buf1, buf2);
|
buf3 = two_arguments(argument, buf1, buf2);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** If there aren't any arguments...well...they can't modify nothing now **/
|
/** If there aren't any arguments...well...they can't modify nothing now **/
|
||||||
/** can they? **/
|
/** can they? **/
|
||||||
|
|
@ -82,32 +82,32 @@ ACMD(do_oasis_oedit)
|
||||||
send_to_char(ch, "Yikes! Stop that, someone will get hurt!\r\n");
|
send_to_char(ch, "Yikes! Stop that, someone will get hurt!\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
save = TRUE;
|
save = TRUE;
|
||||||
|
|
||||||
if (is_number(buf2))
|
if (is_number(buf2))
|
||||||
number = atoi(buf2);
|
number = atoi(buf2);
|
||||||
else if (GET_OLC_ZONE(ch) > 0) {
|
else if (GET_OLC_ZONE(ch) > 0) {
|
||||||
zone_rnum zlok;
|
zone_rnum zlok;
|
||||||
|
|
||||||
if ((zlok = real_zone(GET_OLC_ZONE(ch))) == NOWHERE)
|
if ((zlok = real_zone(GET_OLC_ZONE(ch))) == NOWHERE)
|
||||||
number = NOWHERE;
|
number = NOWHERE;
|
||||||
else
|
else
|
||||||
number = genolc_zone_bottom(zlok);
|
number = genolc_zone_bottom(zlok);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (number == NOWHERE) {
|
if (number == NOWHERE) {
|
||||||
send_to_char(ch, "Save which zone?\r\n");
|
send_to_char(ch, "Save which zone?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** If a numeric argument was given, get it. **/
|
/** If a numeric argument was given, get it. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
if (number == NOWHERE)
|
if (number == NOWHERE)
|
||||||
number = atoi(buf1);
|
number = atoi(buf1);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Check that whatever it is isn't already being edited. **/
|
/** Check that whatever it is isn't already being edited. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -120,12 +120,12 @@ ACMD(do_oasis_oedit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Point d to the builder's descriptor (for easier typing later). **/
|
/** Point d to the builder's descriptor (for easier typing later). **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
d = ch->desc;
|
d = ch->desc;
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Give the descriptor an OLC structure. **/
|
/** Give the descriptor an OLC structure. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -134,16 +134,16 @@ ACMD(do_oasis_oedit)
|
||||||
"SYSERR: do_oasis: Player already had olc structure.");
|
"SYSERR: do_oasis: Player already had olc structure.");
|
||||||
free(d->olc);
|
free(d->olc);
|
||||||
}
|
}
|
||||||
|
|
||||||
CREATE(d->olc, struct oasis_olc_data, 1);
|
CREATE(d->olc, struct oasis_olc_data, 1);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Find the zone. **/
|
/** Find the zone. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number);
|
OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number);
|
||||||
if (OLC_ZNUM(d) == NOWHERE) {
|
if (OLC_ZNUM(d) == NOWHERE) {
|
||||||
send_to_char(ch, "Sorry, there is no zone for that number!\r\n");
|
send_to_char(ch, "Sorry, there is no zone for that number!\r\n");
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/** Free the descriptor's OLC structure. **/
|
/** Free the descriptor's OLC structure. **/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
@ -151,7 +151,7 @@ ACMD(do_oasis_oedit)
|
||||||
d->olc = NULL;
|
d->olc = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Everyone but IMPLs can only edit zones they have been assigned. **/
|
/** Everyone but IMPLs can only edit zones they have been assigned. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -159,7 +159,7 @@ ACMD(do_oasis_oedit)
|
||||||
send_to_char(ch, " You do not have permission to edit zone %d. Try zone %d.\r\n", zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
send_to_char(ch, " You do not have permission to edit zone %d. Try zone %d.\r\n", zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
||||||
mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
|
mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
|
||||||
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/** Free the descriptor's OLC structure. **/
|
/** Free the descriptor's OLC structure. **/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
@ -167,7 +167,7 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
|
||||||
d->olc = NULL;
|
d->olc = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** If we need to save, save the objects. **/
|
/** If we need to save, save the objects. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -177,12 +177,12 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
|
||||||
mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE,
|
mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE,
|
||||||
"OLC: %s saves object info for zone %d.", GET_NAME(ch),
|
"OLC: %s saves object info for zone %d.", GET_NAME(ch),
|
||||||
zone_table[OLC_ZNUM(d)].number);
|
zone_table[OLC_ZNUM(d)].number);
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/** Save the objects in this zone. **/
|
/** Save the objects in this zone. **/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
save_objects(OLC_ZNUM(d));
|
save_objects(OLC_ZNUM(d));
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/** Free the descriptor's OLC structure. **/
|
/** Free the descriptor's OLC structure. **/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
@ -190,9 +190,9 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
|
||||||
d->olc = NULL;
|
d->olc = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OLC_NUM(d) = number;
|
OLC_NUM(d) = number;
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** If this is a new object, setup a new object, otherwise setup the **/
|
/** If this is a new object, setup a new object, otherwise setup the **/
|
||||||
/** existing object. **/
|
/** existing object. **/
|
||||||
|
|
@ -201,15 +201,15 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
|
||||||
oedit_setup_existing(d, real_num);
|
oedit_setup_existing(d, real_num);
|
||||||
else
|
else
|
||||||
oedit_setup_new(d);
|
oedit_setup_new(d);
|
||||||
|
|
||||||
STATE(d) = CON_OEDIT;
|
STATE(d) = CON_OEDIT;
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Send the OLC message to the players in the same room as the builder. **/
|
/** Send the OLC message to the players in the same room as the builder. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||||
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Log the OLC message. **/
|
/** Log the OLC message. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -272,7 +272,7 @@ void oedit_save_internally(struct descriptor_data *d)
|
||||||
obj_rnum robj_num;
|
obj_rnum robj_num;
|
||||||
struct descriptor_data *dsc;
|
struct descriptor_data *dsc;
|
||||||
struct obj_data *obj;
|
struct obj_data *obj;
|
||||||
|
|
||||||
i = (real_object(OLC_NUM(d)) == NOTHING);
|
i = (real_object(OLC_NUM(d)) == NOTHING);
|
||||||
|
|
||||||
if ((robj_num = add_object(OLC_OBJ(d), OLC_NUM(d))) == NOTHING) {
|
if ((robj_num = add_object(OLC_OBJ(d), OLC_NUM(d))) == NOTHING) {
|
||||||
|
|
@ -283,8 +283,8 @@ void oedit_save_internally(struct descriptor_data *d)
|
||||||
/* Update triggers : */
|
/* Update triggers : */
|
||||||
/* Free old proto list */
|
/* Free old proto list */
|
||||||
if (obj_proto[robj_num].proto_script &&
|
if (obj_proto[robj_num].proto_script &&
|
||||||
obj_proto[robj_num].proto_script != OLC_SCRIPT(d))
|
obj_proto[robj_num].proto_script != OLC_SCRIPT(d))
|
||||||
free_proto_script(&obj_proto[robj_num], OBJ_TRIGGER);
|
free_proto_script(&obj_proto[robj_num], OBJ_TRIGGER);
|
||||||
/* this will handle new instances of the object: */
|
/* this will handle new instances of the object: */
|
||||||
obj_proto[robj_num].proto_script = OLC_SCRIPT(d);
|
obj_proto[robj_num].proto_script = OLC_SCRIPT(d);
|
||||||
|
|
||||||
|
|
@ -293,7 +293,7 @@ void oedit_save_internally(struct descriptor_data *d)
|
||||||
if (obj->item_number != robj_num)
|
if (obj->item_number != robj_num)
|
||||||
continue;
|
continue;
|
||||||
/* remove any old scripts */
|
/* remove any old scripts */
|
||||||
if (SCRIPT(obj))
|
if (SCRIPT(obj))
|
||||||
extract_script(obj, OBJ_TRIGGER);
|
extract_script(obj, OBJ_TRIGGER);
|
||||||
|
|
||||||
free_proto_script(obj, OBJ_TRIGGER);
|
free_proto_script(obj, OBJ_TRIGGER);
|
||||||
|
|
@ -301,7 +301,7 @@ void oedit_save_internally(struct descriptor_data *d)
|
||||||
assign_triggers(obj, OBJ_TRIGGER);
|
assign_triggers(obj, OBJ_TRIGGER);
|
||||||
}
|
}
|
||||||
/* end trigger update */
|
/* end trigger update */
|
||||||
|
|
||||||
if (!i) /* If it's not a new object, don't renumber. */
|
if (!i) /* If it's not a new object, don't renumber. */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -344,7 +344,7 @@ void oedit_save_to_disk(int zone_num)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Menu functions
|
Menu functions
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -357,7 +357,7 @@ void oedit_disp_container_flags_menu(struct descriptor_data *d)
|
||||||
clear_screen(d);
|
clear_screen(d);
|
||||||
|
|
||||||
sprintbit(GET_OBJ_VAL(OLC_OBJ(d), 1), container_bits, bits, sizeof(bits));
|
sprintbit(GET_OBJ_VAL(OLC_OBJ(d), 1), container_bits, bits, sizeof(bits));
|
||||||
write_to_output(d,
|
write_to_output(d,
|
||||||
"%s1%s) CLOSEABLE\r\n"
|
"%s1%s) CLOSEABLE\r\n"
|
||||||
"%s2%s) PICKPROOF\r\n"
|
"%s2%s) PICKPROOF\r\n"
|
||||||
"%s3%s) CLOSED\r\n"
|
"%s3%s) CLOSED\r\n"
|
||||||
|
|
@ -494,7 +494,7 @@ void oedit_disp_val1_menu(struct descriptor_data *d)
|
||||||
switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
|
switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
|
||||||
case ITEM_LIGHT:
|
case ITEM_LIGHT:
|
||||||
/*
|
/*
|
||||||
* values 0 and 1 are unused.. jump to 2
|
* values 0 and 1 are unused.. jump to 2
|
||||||
*/
|
*/
|
||||||
oedit_disp_val3_menu(d);
|
oedit_disp_val3_menu(d);
|
||||||
break;
|
break;
|
||||||
|
|
@ -811,7 +811,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
||||||
case 'y':
|
case 'y':
|
||||||
case 'Y':
|
case 'Y':
|
||||||
oedit_save_internally(d);
|
oedit_save_internally(d);
|
||||||
mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE,
|
mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), TRUE,
|
||||||
"OLC: %s edits obj %d", GET_NAME(d->character), OLC_NUM(d));
|
"OLC: %s edits obj %d", GET_NAME(d->character), OLC_NUM(d));
|
||||||
if (CONFIG_OLC_SAVE) {
|
if (CONFIG_OLC_SAVE) {
|
||||||
oedit_save_to_disk(real_zone_by_thing(OLC_NUM(d)));
|
oedit_save_to_disk(real_zone_by_thing(OLC_NUM(d)));
|
||||||
|
|
@ -825,7 +825,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
||||||
cleanup_olc(d, CLEANUP_ALL);
|
cleanup_olc(d, CLEANUP_ALL);
|
||||||
return;
|
return;
|
||||||
case 'a': /* abort quit */
|
case 'a': /* abort quit */
|
||||||
case 'A':
|
case 'A':
|
||||||
oedit_disp_menu(d);
|
oedit_disp_menu(d);
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
|
|
@ -903,7 +903,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
||||||
case 'c':
|
case 'c':
|
||||||
case 'C':
|
case 'C':
|
||||||
/*
|
/*
|
||||||
* Clear any old values
|
* Clear any old values
|
||||||
*/
|
*/
|
||||||
GET_OBJ_VAL(OLC_OBJ(d), 0) = 0;
|
GET_OBJ_VAL(OLC_OBJ(d), 0) = 0;
|
||||||
GET_OBJ_VAL(OLC_OBJ(d), 1) = 0;
|
GET_OBJ_VAL(OLC_OBJ(d), 1) = 0;
|
||||||
|
|
@ -943,17 +943,17 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
||||||
OLC_SCRIPT_EDIT_MODE(d) = SCRIPT_MAIN_MENU;
|
OLC_SCRIPT_EDIT_MODE(d) = SCRIPT_MAIN_MENU;
|
||||||
dg_script_menu(d);
|
dg_script_menu(d);
|
||||||
return;
|
return;
|
||||||
case 'x':
|
case 'x':
|
||||||
case 'X':
|
case 'X':
|
||||||
write_to_output(d, "Are you sure you want to delete this object? ");
|
write_to_output(d, "Are you sure you want to delete this object? ");
|
||||||
OLC_MODE(d) = OEDIT_DELETE;
|
OLC_MODE(d) = OEDIT_DELETE;
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
oedit_disp_menu(d);
|
oedit_disp_menu(d);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return; /*
|
return; /*
|
||||||
* end of OEDIT_MAIN_MENU
|
* end of OEDIT_MAIN_MENU
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case OLC_SCRIPT_EDIT:
|
case OLC_SCRIPT_EDIT:
|
||||||
|
|
@ -992,8 +992,8 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
||||||
} else
|
} else
|
||||||
GET_OBJ_TYPE(OLC_OBJ(d)) = number;
|
GET_OBJ_TYPE(OLC_OBJ(d)) = number;
|
||||||
/* what's the boundschecking worth if we don't do this ? -- Welcor */
|
/* what's the boundschecking worth if we don't do this ? -- Welcor */
|
||||||
GET_OBJ_VAL(OLC_OBJ(d), 0) = GET_OBJ_VAL(OLC_OBJ(d), 1) =
|
GET_OBJ_VAL(OLC_OBJ(d), 0) = GET_OBJ_VAL(OLC_OBJ(d), 1) =
|
||||||
GET_OBJ_VAL(OLC_OBJ(d), 2) = GET_OBJ_VAL(OLC_OBJ(d), 3) = 0;
|
GET_OBJ_VAL(OLC_OBJ(d), 2) = GET_OBJ_VAL(OLC_OBJ(d), 3) = 0;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OEDIT_EXTRAS:
|
case OEDIT_EXTRAS:
|
||||||
|
|
@ -1050,7 +1050,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
||||||
TOGGLE_BIT(GET_OBJ_PERM(OLC_OBJ(d)), 1 << (number - 1));
|
TOGGLE_BIT(GET_OBJ_PERM(OLC_OBJ(d)), 1 << (number - 1));
|
||||||
if (IS_SET(GET_OBJ_PERM(OLC_OBJ(d)), AFF_BLIND | AFF_GROUP | AFF_POISON | AFF_SLEEP | AFF_CHARM)) {
|
if (IS_SET(GET_OBJ_PERM(OLC_OBJ(d)), AFF_BLIND | AFF_GROUP | AFF_POISON | AFF_SLEEP | AFF_CHARM)) {
|
||||||
write_to_output(d, "Illegal bit(s) not set.\r\n");
|
write_to_output(d, "Illegal bit(s) not set.\r\n");
|
||||||
REMOVE_BIT(GET_OBJ_PERM(OLC_OBJ(d)), AFF_BLIND | AFF_GROUP | AFF_POISON | AFF_SLEEP | AFF_CHARM);
|
REMOVE_BIT(GET_OBJ_PERM(OLC_OBJ(d)), AFF_BLIND | AFF_GROUP | AFF_POISON | AFF_SLEEP | AFF_CHARM);
|
||||||
}
|
}
|
||||||
oedit_disp_perm_menu(d);
|
oedit_disp_perm_menu(d);
|
||||||
return;
|
return;
|
||||||
|
|
@ -1058,20 +1058,20 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
||||||
case OEDIT_VALUE_1:
|
case OEDIT_VALUE_1:
|
||||||
/*
|
/*
|
||||||
* Lucky, I don't need to check any of these for out of range values.
|
* Lucky, I don't need to check any of these for out of range values.
|
||||||
* Hmm, I'm not so sure - Rv
|
* Hmm, I'm not so sure - Rv
|
||||||
*/
|
*/
|
||||||
switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
|
switch (GET_OBJ_TYPE(OLC_OBJ(d))) {
|
||||||
case ITEM_WEAPON:
|
case ITEM_WEAPON:
|
||||||
GET_OBJ_VAL(OLC_OBJ(d), 0) = MIN(MAX(atoi(arg), -50), 50);
|
GET_OBJ_VAL(OLC_OBJ(d), 0) = MIN(MAX(atoi(arg), -50), 50);
|
||||||
break;
|
break;
|
||||||
case ITEM_CONTAINER:
|
case ITEM_CONTAINER:
|
||||||
GET_OBJ_VAL(OLC_OBJ(d), 0) = LIMIT(atoi(arg), 0, MAX_CONTAINER_SIZE);
|
GET_OBJ_VAL(OLC_OBJ(d), 0) = LIMIT(atoi(arg), 0, MAX_CONTAINER_SIZE);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
GET_OBJ_VAL(OLC_OBJ(d), 0) = atoi(arg);
|
GET_OBJ_VAL(OLC_OBJ(d), 0) = atoi(arg);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* proceed to menu 2
|
* proceed to menu 2
|
||||||
*/
|
*/
|
||||||
oedit_disp_val2_menu(d);
|
oedit_disp_val2_menu(d);
|
||||||
return;
|
return;
|
||||||
|
|
@ -1085,9 +1085,9 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
||||||
case ITEM_POTION:
|
case ITEM_POTION:
|
||||||
if (number == 0 || number == -1)
|
if (number == 0 || number == -1)
|
||||||
GET_OBJ_VAL(OLC_OBJ(d), 1) = -1;
|
GET_OBJ_VAL(OLC_OBJ(d), 1) = -1;
|
||||||
else
|
else
|
||||||
GET_OBJ_VAL(OLC_OBJ(d), 1) = LIMIT(number, 1, NUM_SPELLS-1);
|
GET_OBJ_VAL(OLC_OBJ(d), 1) = LIMIT(number, 1, NUM_SPELLS-1);
|
||||||
|
|
||||||
oedit_disp_val3_menu(d);
|
oedit_disp_val3_menu(d);
|
||||||
break;
|
break;
|
||||||
case ITEM_CONTAINER:
|
case ITEM_CONTAINER:
|
||||||
|
|
@ -1105,7 +1105,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
||||||
oedit_disp_val3_menu(d);
|
oedit_disp_val3_menu(d);
|
||||||
break;
|
break;
|
||||||
case ITEM_WEAPON:
|
case ITEM_WEAPON:
|
||||||
GET_OBJ_VAL(OLC_OBJ(d), 1) = LIMIT(number, 1, MAX_WEAPON_NDICE);
|
GET_OBJ_VAL(OLC_OBJ(d), 1) = LIMIT(number, 1, MAX_WEAPON_NDICE);
|
||||||
oedit_disp_val3_menu(d);
|
oedit_disp_val3_menu(d);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -1244,14 +1244,14 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
||||||
case 0:
|
case 0:
|
||||||
if (!OLC_DESC(d)->keyword || !OLC_DESC(d)->description) {
|
if (!OLC_DESC(d)->keyword || !OLC_DESC(d)->description) {
|
||||||
struct extra_descr_data *temp;
|
struct extra_descr_data *temp;
|
||||||
|
|
||||||
if (OLC_DESC(d)->keyword)
|
if (OLC_DESC(d)->keyword)
|
||||||
free(OLC_DESC(d)->keyword);
|
free(OLC_DESC(d)->keyword);
|
||||||
if (OLC_DESC(d)->description)
|
if (OLC_DESC(d)->description)
|
||||||
free(OLC_DESC(d)->description);
|
free(OLC_DESC(d)->description);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Clean up pointers
|
* Clean up pointers
|
||||||
*/
|
*/
|
||||||
REMOVE_FROM_LIST(OLC_DESC(d), OLC_OBJ(d)->ex_description, next);
|
REMOVE_FROM_LIST(OLC_DESC(d), OLC_OBJ(d)->ex_description, next);
|
||||||
free(OLC_DESC(d));
|
free(OLC_DESC(d));
|
||||||
|
|
@ -1299,19 +1299,19 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case OEDIT_DELETE:
|
case OEDIT_DELETE:
|
||||||
if (*arg == 'y' || *arg == 'Y') {
|
if (*arg == 'y' || *arg == 'Y') {
|
||||||
if (delete_object(GET_OBJ_RNUM(OLC_OBJ(d))))
|
if (delete_object(GET_OBJ_RNUM(OLC_OBJ(d))))
|
||||||
write_to_output(d, "Object deleted.\r\n");
|
write_to_output(d, "Object deleted.\r\n");
|
||||||
else
|
else
|
||||||
write_to_output(d, "Couldn't delete the object!\r\n");
|
write_to_output(d, "Couldn't delete the object!\r\n");
|
||||||
|
|
||||||
cleanup_olc(d, CLEANUP_ALL);
|
cleanup_olc(d, CLEANUP_ALL);
|
||||||
} else if (*arg == 'n' || *arg == 'N') {
|
} else if (*arg == 'n' || *arg == 'N') {
|
||||||
oedit_disp_menu(d);
|
oedit_disp_menu(d);
|
||||||
OLC_MODE(d) = OEDIT_MAIN_MENU;
|
OLC_MODE(d) = OEDIT_MAIN_MENU;
|
||||||
} else
|
} else
|
||||||
write_to_output(d, "Please answer 'Y' or 'N': ");
|
write_to_output(d, "Please answer 'Y' or 'N': ");
|
||||||
return;
|
return;
|
||||||
default:
|
default:
|
||||||
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: Reached default case in oedit_parse()!");
|
mudlog(BRF, LVL_BUILDER, TRUE, "SYSERR: OLC: Reached default case in oedit_parse()!");
|
||||||
|
|
@ -1320,7 +1320,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If we get here, we have changed something.
|
* If we get here, we have changed something.
|
||||||
*/
|
*/
|
||||||
OLC_VAL(d) = 1;
|
OLC_VAL(d) = 1;
|
||||||
oedit_disp_menu(d);
|
oedit_disp_menu(d);
|
||||||
|
|
|
||||||
|
|
@ -49,7 +49,7 @@
|
||||||
#define PFDEF_HUNGER 0
|
#define PFDEF_HUNGER 0
|
||||||
#define PFDEF_THIRST 0
|
#define PFDEF_THIRST 0
|
||||||
#define PFDEF_DRUNK 0
|
#define PFDEF_DRUNK 0
|
||||||
#define PFDEF_OLC 65535
|
#define PFDEF_OLC 65535
|
||||||
#define PFDEF_PAGELENGTH 22
|
#define PFDEF_PAGELENGTH 22
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -54,7 +54,7 @@ extern struct pclean_criteria_data pclean_criteria[];
|
||||||
|
|
||||||
/* ASCII Player Files - set this FALSE if you don't want poofin/poofout
|
/* ASCII Player Files - set this FALSE if you don't want poofin/poofout
|
||||||
strings saved in the pfiles
|
strings saved in the pfiles
|
||||||
Welcor, 27/12/06 - This was bugged. The check below was #ifdef, not #if,
|
Welcor, 27/12/06 - This was bugged. The check below was #ifdef, not #if,
|
||||||
so poofs were saved regardless of the text. Changed to TRUE to maintain
|
so poofs were saved regardless of the text. Changed to TRUE to maintain
|
||||||
the saved poofs, and altered to #if below.
|
the saved poofs, and altered to #if below.
|
||||||
*/
|
*/
|
||||||
|
|
@ -295,7 +295,7 @@ int load_char(const char *name, struct char_data *ch)
|
||||||
GET_HOST(ch) = NULL;
|
GET_HOST(ch) = NULL;
|
||||||
GET_PAGE_LENGTH(ch) = PFDEF_PAGELENGTH;
|
GET_PAGE_LENGTH(ch) = PFDEF_PAGELENGTH;
|
||||||
GET_ALIASES(ch) = NULL;
|
GET_ALIASES(ch) = NULL;
|
||||||
|
|
||||||
while (get_line(fl, line)) {
|
while (get_line(fl, line)) {
|
||||||
tag_argument(line, tag);
|
tag_argument(line, tag);
|
||||||
|
|
||||||
|
|
@ -538,8 +538,8 @@ void save_char(struct char_data * ch)
|
||||||
if (POOFIN(ch)) fprintf(fl, "PfIn: %s\n", POOFIN(ch));
|
if (POOFIN(ch)) fprintf(fl, "PfIn: %s\n", POOFIN(ch));
|
||||||
if (POOFOUT(ch)) fprintf(fl, "PfOt: %s\n", POOFOUT(ch));
|
if (POOFOUT(ch)) fprintf(fl, "PfOt: %s\n", POOFOUT(ch));
|
||||||
#endif
|
#endif
|
||||||
if (GET_SEX(ch) != PFDEF_SEX) fprintf(fl, "Sex : %d\n", GET_SEX(ch));
|
if (GET_SEX(ch) != PFDEF_SEX) fprintf(fl, "Sex : %d\n", GET_SEX(ch));
|
||||||
if (GET_CLASS(ch) != PFDEF_CLASS) fprintf(fl, "Clas: %d\n", GET_CLASS(ch));
|
if (GET_CLASS(ch) != PFDEF_CLASS) fprintf(fl, "Clas: %d\n", GET_CLASS(ch));
|
||||||
if (GET_LEVEL(ch) != PFDEF_LEVEL) fprintf(fl, "Levl: %d\n", GET_LEVEL(ch));
|
if (GET_LEVEL(ch) != PFDEF_LEVEL) fprintf(fl, "Levl: %d\n", GET_LEVEL(ch));
|
||||||
if (GET_HOME(ch) != PFDEF_HOMETOWN) fprintf(fl, "Home: %d\n", GET_HOME(ch));
|
if (GET_HOME(ch) != PFDEF_HOMETOWN) fprintf(fl, "Home: %d\n", GET_HOME(ch));
|
||||||
|
|
||||||
|
|
@ -586,7 +586,7 @@ void save_char(struct char_data * ch)
|
||||||
if (GET_MOVE(ch) != PFDEF_MOVE || GET_MAX_MOVE(ch) != PFDEF_MAXMOVE) fprintf(fl, "Move: %d/%d\n", GET_MOVE(ch), GET_MAX_MOVE(ch));
|
if (GET_MOVE(ch) != PFDEF_MOVE || GET_MAX_MOVE(ch) != PFDEF_MAXMOVE) fprintf(fl, "Move: %d/%d\n", GET_MOVE(ch), GET_MAX_MOVE(ch));
|
||||||
|
|
||||||
if (GET_STR(ch) != PFDEF_STR || GET_ADD(ch) != PFDEF_STRADD) fprintf(fl, "Str : %d/%d\n", GET_STR(ch), GET_ADD(ch));
|
if (GET_STR(ch) != PFDEF_STR || GET_ADD(ch) != PFDEF_STRADD) fprintf(fl, "Str : %d/%d\n", GET_STR(ch), GET_ADD(ch));
|
||||||
|
|
||||||
|
|
||||||
if (GET_INT(ch) != PFDEF_INT) fprintf(fl, "Int : %d\n", GET_INT(ch));
|
if (GET_INT(ch) != PFDEF_INT) fprintf(fl, "Int : %d\n", GET_INT(ch));
|
||||||
if (GET_WIS(ch) != PFDEF_WIS) fprintf(fl, "Wis : %d\n", GET_WIS(ch));
|
if (GET_WIS(ch) != PFDEF_WIS) fprintf(fl, "Wis : %d\n", GET_WIS(ch));
|
||||||
|
|
@ -627,7 +627,7 @@ void save_char(struct char_data * ch)
|
||||||
|
|
||||||
write_aliases_ascii(fl, ch);
|
write_aliases_ascii(fl, ch);
|
||||||
save_char_vars_ascii(fl, ch);
|
save_char_vars_ascii(fl, ch);
|
||||||
|
|
||||||
fclose(fl);
|
fclose(fl);
|
||||||
|
|
||||||
/* more char_to_store code to restore affects */
|
/* more char_to_store code to restore affects */
|
||||||
|
|
@ -651,7 +651,7 @@ void save_char(struct char_data * ch)
|
||||||
}
|
}
|
||||||
|
|
||||||
/* end char_to_store code */
|
/* end char_to_store code */
|
||||||
|
|
||||||
if ((id = get_ptable_by_name(GET_NAME(ch))) < 0)
|
if ((id = get_ptable_by_name(GET_NAME(ch))) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
@ -692,7 +692,7 @@ void tag_argument(char *argument, char *tag)
|
||||||
for (i = 0; i < 4; i++)
|
for (i = 0; i < 4; i++)
|
||||||
*(ttag++) = *(tmp++);
|
*(ttag++) = *(tmp++);
|
||||||
*ttag = '\0';
|
*ttag = '\0';
|
||||||
|
|
||||||
while (*tmp == ':' || *tmp == ' ')
|
while (*tmp == ':' || *tmp == ' ')
|
||||||
tmp++;
|
tmp++;
|
||||||
|
|
||||||
|
|
@ -709,7 +709,7 @@ void tag_argument(char *argument, char *tag)
|
||||||
* remove_player() removes all files associated with a player who is
|
* remove_player() removes all files associated with a player who is
|
||||||
* self-deleted, deleted by an immortal, or deleted by the auto-wipe
|
* self-deleted, deleted by an immortal, or deleted by the auto-wipe
|
||||||
* system (if enabled).
|
* system (if enabled).
|
||||||
*/
|
*/
|
||||||
void remove_player(int pfilepos)
|
void remove_player(int pfilepos)
|
||||||
{
|
{
|
||||||
char fname[40];
|
char fname[40];
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ unsigned long circle_random(void);
|
||||||
|
|
||||||
void circle_srandom(unsigned long initial_seed)
|
void circle_srandom(unsigned long initial_seed)
|
||||||
{
|
{
|
||||||
seed = initial_seed;
|
seed = initial_seed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
90
src/redit.c
90
src/redit.c
|
|
@ -43,10 +43,10 @@ ACMD(do_oasis_redit)
|
||||||
char buf2[MAX_STRING_LENGTH];
|
char buf2[MAX_STRING_LENGTH];
|
||||||
int number = NOWHERE, save = 0, real_num;
|
int number = NOWHERE, save = 0, real_num;
|
||||||
struct descriptor_data *d;
|
struct descriptor_data *d;
|
||||||
|
|
||||||
/* Parse any arguments. */
|
/* Parse any arguments. */
|
||||||
buf3 = two_arguments(argument, buf1, buf2);
|
buf3 = two_arguments(argument, buf1, buf2);
|
||||||
|
|
||||||
if (!*buf1)
|
if (!*buf1)
|
||||||
number = GET_ROOM_VNUM(IN_ROOM(ch));
|
number = GET_ROOM_VNUM(IN_ROOM(ch));
|
||||||
else if (!isdigit(*buf1)) {
|
else if (!isdigit(*buf1)) {
|
||||||
|
|
@ -54,55 +54,55 @@ ACMD(do_oasis_redit)
|
||||||
send_to_char(ch, "Yikes! Stop that, someone will get hurt!\r\n");
|
send_to_char(ch, "Yikes! Stop that, someone will get hurt!\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
save = TRUE;
|
save = TRUE;
|
||||||
|
|
||||||
if (is_number(buf2))
|
if (is_number(buf2))
|
||||||
number = atoi(buf2);
|
number = atoi(buf2);
|
||||||
else if (GET_OLC_ZONE(ch) != NOWHERE) {
|
else if (GET_OLC_ZONE(ch) != NOWHERE) {
|
||||||
zone_rnum zlok;
|
zone_rnum zlok;
|
||||||
|
|
||||||
if ((zlok = real_zone(GET_OLC_ZONE(ch))) == NOWHERE)
|
if ((zlok = real_zone(GET_OLC_ZONE(ch))) == NOWHERE)
|
||||||
number = NOWHERE;
|
number = NOWHERE;
|
||||||
else
|
else
|
||||||
number = genolc_zone_bottom(zlok);
|
number = genolc_zone_bottom(zlok);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (number == NOWHERE) {
|
if (number == NOWHERE) {
|
||||||
send_to_char(ch, "Save which zone?\r\n");
|
send_to_char(ch, "Save which zone?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If a numeric argument was given (like a room number), get it.
|
* If a numeric argument was given (like a room number), get it.
|
||||||
*/
|
*/
|
||||||
if (number == NOWHERE)
|
if (number == NOWHERE)
|
||||||
number = atoi(buf1);
|
number = atoi(buf1);
|
||||||
|
|
||||||
/* Check to make sure the room isn't already being edited. */
|
/* Check to make sure the room isn't already being edited. */
|
||||||
for (d = descriptor_list; d; d = d->next) {
|
for (d = descriptor_list; d; d = d->next) {
|
||||||
if (STATE(d) == CON_REDIT) {
|
if (STATE(d) == CON_REDIT) {
|
||||||
if (d->olc && OLC_NUM(d) == number) {
|
if (d->olc && OLC_NUM(d) == number) {
|
||||||
send_to_char(ch, "That room is currently being edited by %s.\r\n",
|
send_to_char(ch, "That room is currently being edited by %s.\r\n",
|
||||||
PERS(d->character, ch));
|
PERS(d->character, ch));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Retrieve the player's descriptor. */
|
/* Retrieve the player's descriptor. */
|
||||||
d = ch->desc;
|
d = ch->desc;
|
||||||
|
|
||||||
/* Give the descriptor an OLC structure. */
|
/* Give the descriptor an OLC structure. */
|
||||||
if (d->olc) {
|
if (d->olc) {
|
||||||
mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_oasis_redit: Player already had olc structure.");
|
mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_oasis_redit: Player already had olc structure.");
|
||||||
free(d->olc);
|
free(d->olc);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Create the OLC structure. */
|
/* Create the OLC structure. */
|
||||||
CREATE(d->olc, struct oasis_olc_data, 1);
|
CREATE(d->olc, struct oasis_olc_data, 1);
|
||||||
|
|
||||||
/* Find the zone. */
|
/* Find the zone. */
|
||||||
OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number);
|
OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number);
|
||||||
if (OLC_ZNUM(d) == NOWHERE) {
|
if (OLC_ZNUM(d) == NOWHERE) {
|
||||||
|
|
@ -117,36 +117,36 @@ ACMD(do_oasis_redit)
|
||||||
send_to_char(ch, " You do not have permission to edit zone %d. Try zone %d.\r\n", zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
send_to_char(ch, " You do not have permission to edit zone %d. Try zone %d.\r\n", zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
||||||
mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
|
mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
|
||||||
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
||||||
|
|
||||||
free(d->olc);
|
free(d->olc);
|
||||||
d->olc = NULL;
|
d->olc = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (save) {
|
if (save) {
|
||||||
send_to_char(ch, "Saving all rooms in zone %d.\r\n", zone_table[OLC_ZNUM(d)].number);
|
send_to_char(ch, "Saving all rooms in zone %d.\r\n", zone_table[OLC_ZNUM(d)].number);
|
||||||
mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "OLC: %s saves room info for zone %d.", GET_NAME(ch), zone_table[OLC_ZNUM(d)].number);
|
mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "OLC: %s saves room info for zone %d.", GET_NAME(ch), zone_table[OLC_ZNUM(d)].number);
|
||||||
|
|
||||||
/* Save the rooms. */
|
/* Save the rooms. */
|
||||||
save_rooms(OLC_ZNUM(d));
|
save_rooms(OLC_ZNUM(d));
|
||||||
|
|
||||||
/* Free the olc data from the descriptor. */
|
/* Free the olc data from the descriptor. */
|
||||||
free(d->olc);
|
free(d->olc);
|
||||||
d->olc = NULL;
|
d->olc = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OLC_NUM(d) = number;
|
OLC_NUM(d) = number;
|
||||||
|
|
||||||
if ((real_num = real_room(number)) != NOWHERE)
|
if ((real_num = real_room(number)) != NOWHERE)
|
||||||
redit_setup_existing(d, real_num);
|
redit_setup_existing(d, real_num);
|
||||||
else
|
else
|
||||||
redit_setup_new(d);
|
redit_setup_new(d);
|
||||||
|
|
||||||
STATE(d) = CON_REDIT;
|
STATE(d) = CON_REDIT;
|
||||||
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||||
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
||||||
|
|
||||||
mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s starts editing zone %d allowed zone %d",
|
mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s starts editing zone %d allowed zone %d",
|
||||||
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
||||||
}
|
}
|
||||||
|
|
@ -183,7 +183,7 @@ void redit_setup_existing(struct descriptor_data *d, int real_num)
|
||||||
*/
|
*/
|
||||||
room->name = str_udup(world[real_num].name);
|
room->name = str_udup(world[real_num].name);
|
||||||
room->description = str_udup(world[real_num].description);
|
room->description = str_udup(world[real_num].description);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Exits - We allocate only if necessary.
|
* Exits - We allocate only if necessary.
|
||||||
*/
|
*/
|
||||||
|
|
@ -234,7 +234,7 @@ void redit_setup_existing(struct descriptor_data *d, int real_num)
|
||||||
|
|
||||||
dg_olc_script_copy(d);
|
dg_olc_script_copy(d);
|
||||||
room->proto_script = NULL;
|
room->proto_script = NULL;
|
||||||
SCRIPT(room) = NULL;
|
SCRIPT(room) = NULL;
|
||||||
|
|
||||||
redit_disp_menu(d);
|
redit_disp_menu(d);
|
||||||
}
|
}
|
||||||
|
|
@ -259,15 +259,15 @@ void redit_save_internally(struct descriptor_data *d)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Update triggers */
|
/* Update triggers */
|
||||||
/* Free old proto list */
|
/* Free old proto list */
|
||||||
if (world[room_num].proto_script &&
|
if (world[room_num].proto_script &&
|
||||||
world[room_num].proto_script != OLC_SCRIPT(d))
|
world[room_num].proto_script != OLC_SCRIPT(d))
|
||||||
free_proto_script(&world[room_num], WLD_TRIGGER);
|
free_proto_script(&world[room_num], WLD_TRIGGER);
|
||||||
|
|
||||||
world[room_num].proto_script = OLC_SCRIPT(d);
|
world[room_num].proto_script = OLC_SCRIPT(d);
|
||||||
assign_triggers(&world[room_num], WLD_TRIGGER);
|
assign_triggers(&world[room_num], WLD_TRIGGER);
|
||||||
/* end trigger update */
|
/* end trigger update */
|
||||||
|
|
||||||
/* Don't adjust numbers on a room update. */
|
/* Don't adjust numbers on a room update. */
|
||||||
if (!new_room)
|
if (!new_room)
|
||||||
|
|
@ -316,17 +316,17 @@ void free_room(struct room_data *room)
|
||||||
{
|
{
|
||||||
/* Free the strings (Mythran). */
|
/* Free the strings (Mythran). */
|
||||||
free_room_strings(room);
|
free_room_strings(room);
|
||||||
|
|
||||||
if (SCRIPT(room))
|
if (SCRIPT(room))
|
||||||
extract_script(room, WLD_TRIGGER);
|
extract_script(room, WLD_TRIGGER);
|
||||||
free_proto_script(room, WLD_TRIGGER);
|
free_proto_script(room, WLD_TRIGGER);
|
||||||
|
|
||||||
/* Free the room. */
|
/* Free the room. */
|
||||||
free(room); /* XXX ? */
|
free(room); /* XXX ? */
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Menu functions
|
Menu functions
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
@ -359,14 +359,14 @@ void redit_disp_exit_menu(struct descriptor_data *d)
|
||||||
{
|
{
|
||||||
char door_buf[24];
|
char door_buf[24];
|
||||||
/*
|
/*
|
||||||
* if exit doesn't exist, alloc/create it
|
* if exit doesn't exist, alloc/create it
|
||||||
*/
|
*/
|
||||||
if (OLC_EXIT(d) == NULL) {
|
if (OLC_EXIT(d) == NULL) {
|
||||||
CREATE(OLC_EXIT(d), struct room_direction_data, 1);
|
CREATE(OLC_EXIT(d), struct room_direction_data, 1);
|
||||||
OLC_EXIT(d)->to_room = NOWHERE;
|
OLC_EXIT(d)->to_room = NOWHERE;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Weird door handling!
|
* Weird door handling!
|
||||||
*/
|
*/
|
||||||
if (IS_SET(OLC_EXIT(d)->exit_info, EX_ISDOOR)) {
|
if (IS_SET(OLC_EXIT(d)->exit_info, EX_ISDOOR)) {
|
||||||
if (IS_SET(OLC_EXIT(d)->exit_info, EX_PICKPROOF))
|
if (IS_SET(OLC_EXIT(d)->exit_info, EX_PICKPROOF))
|
||||||
|
|
@ -497,7 +497,7 @@ void redit_disp_menu(struct descriptor_data *d)
|
||||||
room->dir_option[WEST] && room->dir_option[WEST]->to_room != NOWHERE ?
|
room->dir_option[WEST] && room->dir_option[WEST]->to_room != NOWHERE ?
|
||||||
world[room->dir_option[WEST]->to_room].number : -1,
|
world[room->dir_option[WEST]->to_room].number : -1,
|
||||||
grn, nrm, cyn,
|
grn, nrm, cyn,
|
||||||
room->dir_option[UP] && room->dir_option[UP]->to_room != NOWHERE ?
|
room->dir_option[UP] && room->dir_option[UP]->to_room != NOWHERE ?
|
||||||
world[room->dir_option[UP]->to_room].number : -1,
|
world[room->dir_option[UP]->to_room].number : -1,
|
||||||
grn, nrm, cyn,
|
grn, nrm, cyn,
|
||||||
room->dir_option[DOWN] && room->dir_option[DOWN]->to_room != NOWHERE ?
|
room->dir_option[DOWN] && room->dir_option[DOWN]->to_room != NOWHERE ?
|
||||||
|
|
@ -533,7 +533,7 @@ void redit_parse(struct descriptor_data *d, char *arg)
|
||||||
} else
|
} else
|
||||||
write_to_output(d, "Room saved to memory.\r\n");
|
write_to_output(d, "Room saved to memory.\r\n");
|
||||||
/*
|
/*
|
||||||
* Do NOT free strings! Just the room structure.
|
* Do NOT free strings! Just the room structure.
|
||||||
*/
|
*/
|
||||||
cleanup_olc(d, CLEANUP_STRUCTS);
|
cleanup_olc(d, CLEANUP_STRUCTS);
|
||||||
break;
|
break;
|
||||||
|
|
@ -624,7 +624,7 @@ void redit_parse(struct descriptor_data *d, char *arg)
|
||||||
write_to_output(d, "Are you sure you want to delete this room? ");
|
write_to_output(d, "Are you sure you want to delete this room? ");
|
||||||
OLC_MODE(d) = REDIT_DELETE;
|
OLC_MODE(d) = REDIT_DELETE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 's':
|
case 's':
|
||||||
case 'S':
|
case 'S':
|
||||||
OLC_SCRIPT_EDIT_MODE(d) = SCRIPT_MAIN_MENU;
|
OLC_SCRIPT_EDIT_MODE(d) = SCRIPT_MAIN_MENU;
|
||||||
|
|
@ -636,7 +636,7 @@ void redit_parse(struct descriptor_data *d, char *arg)
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
case OLC_SCRIPT_EDIT:
|
case OLC_SCRIPT_EDIT:
|
||||||
if (dg_script_edit_parse(d, arg)) return;
|
if (dg_script_edit_parse(d, arg)) return;
|
||||||
|
|
@ -852,25 +852,25 @@ void redit_parse(struct descriptor_data *d, char *arg)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case REDIT_DELETE:
|
case REDIT_DELETE:
|
||||||
if (*arg == 'y' || *arg == 'Y') {
|
if (*arg == 'y' || *arg == 'Y') {
|
||||||
if (delete_room(real_room(OLC_ROOM(d)->number)))
|
if (delete_room(real_room(OLC_ROOM(d)->number)))
|
||||||
write_to_output(d, "Room deleted.\r\n");
|
write_to_output(d, "Room deleted.\r\n");
|
||||||
else
|
else
|
||||||
write_to_output(d, "Couldn't delete the room!.\r\n");
|
write_to_output(d, "Couldn't delete the room!.\r\n");
|
||||||
|
|
||||||
cleanup_olc(d, CLEANUP_ALL);
|
cleanup_olc(d, CLEANUP_ALL);
|
||||||
return;
|
return;
|
||||||
} else if (*arg == 'n' || *arg == 'N') {
|
} else if (*arg == 'n' || *arg == 'N') {
|
||||||
redit_disp_menu(d);
|
redit_disp_menu(d);
|
||||||
OLC_MODE(d) = REDIT_MAIN_MENU;
|
OLC_MODE(d) = REDIT_MAIN_MENU;
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
write_to_output(d, "Please answer 'Y' or 'N': ");
|
write_to_output(d, "Please answer 'Y' or 'N': ");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
/*
|
/*
|
||||||
* We should never get here.
|
* We should never get here.
|
||||||
|
|
|
||||||
52
src/sedit.c
52
src/sedit.c
|
|
@ -51,7 +51,7 @@ void sedit_save_to_disk(int num)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*-------------------------------------------------------------------*\
|
/*-------------------------------------------------------------------*\
|
||||||
utility functions
|
utility functions
|
||||||
\*-------------------------------------------------------------------*/
|
\*-------------------------------------------------------------------*/
|
||||||
|
|
||||||
ACMD(do_oasis_sedit)
|
ACMD(do_oasis_sedit)
|
||||||
|
|
@ -67,7 +67,7 @@ ACMD(do_oasis_sedit)
|
||||||
/** Parse any arguments. **/
|
/** Parse any arguments. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
buf3 = two_arguments(argument, buf1, buf2);
|
buf3 = two_arguments(argument, buf1, buf2);
|
||||||
|
|
||||||
if (!*buf1) {
|
if (!*buf1) {
|
||||||
send_to_char(ch, "Specify a shop VNUM to edit.\r\n");
|
send_to_char(ch, "Specify a shop VNUM to edit.\r\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -76,32 +76,32 @@ ACMD(do_oasis_sedit)
|
||||||
send_to_char(ch, "Yikes! Stop that, someone will get hurt!\r\n");
|
send_to_char(ch, "Yikes! Stop that, someone will get hurt!\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
save = TRUE;
|
save = TRUE;
|
||||||
|
|
||||||
if (is_number(buf2))
|
if (is_number(buf2))
|
||||||
number = atoi(buf2);
|
number = atoi(buf2);
|
||||||
else if (GET_OLC_ZONE(ch) > 0) {
|
else if (GET_OLC_ZONE(ch) > 0) {
|
||||||
zone_rnum zlok;
|
zone_rnum zlok;
|
||||||
|
|
||||||
if ((zlok = real_zone(GET_OLC_ZONE(ch))) == NOWHERE)
|
if ((zlok = real_zone(GET_OLC_ZONE(ch))) == NOWHERE)
|
||||||
number = NOWHERE;
|
number = NOWHERE;
|
||||||
else
|
else
|
||||||
number = genolc_zone_bottom(zlok);
|
number = genolc_zone_bottom(zlok);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (number == NOWHERE) {
|
if (number == NOWHERE) {
|
||||||
send_to_char(ch, "Save which zone?\r\n");
|
send_to_char(ch, "Save which zone?\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** If a numeric argument was given, get it. **/
|
/** If a numeric argument was given, get it. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
if (number == NOWHERE)
|
if (number == NOWHERE)
|
||||||
number = atoi(buf1);
|
number = atoi(buf1);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Check that the shop isn't already being edited. **/
|
/** Check that the shop isn't already being edited. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -114,12 +114,12 @@ ACMD(do_oasis_sedit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Point d to the builder's descriptor. **/
|
/** Point d to the builder's descriptor. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
d = ch->desc;
|
d = ch->desc;
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Give the descriptor an OLC structure. **/
|
/** Give the descriptor an OLC structure. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -128,9 +128,9 @@ ACMD(do_oasis_sedit)
|
||||||
"SYSERR: do_oasis_sedit: Player already had olc structure.");
|
"SYSERR: do_oasis_sedit: Player already had olc structure.");
|
||||||
free(d->olc);
|
free(d->olc);
|
||||||
}
|
}
|
||||||
|
|
||||||
CREATE(d->olc, struct oasis_olc_data, 1);
|
CREATE(d->olc, struct oasis_olc_data, 1);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Find the zone. **/
|
/** Find the zone. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -141,13 +141,13 @@ ACMD(do_oasis_sedit)
|
||||||
d->olc = NULL;
|
d->olc = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Everyone but IMPLs can only edit zones they have been assigned. **/
|
/** Everyone but IMPLs can only edit zones they have been assigned. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
if (!can_edit_zone(ch, OLC_ZNUM(d))) {
|
if (!can_edit_zone(ch, OLC_ZNUM(d))) {
|
||||||
send_to_char(ch, " You do not have permission to edit zone %d. Try zone %d.\r\n", zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
send_to_char(ch, " You do not have permission to edit zone %d. Try zone %d.\r\n", zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/** Free the OLC structure. **/
|
/** Free the OLC structure. **/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
@ -155,19 +155,19 @@ send_to_char(ch, " You do not have permission to edit zone %d. Try zone %d.\r\n"
|
||||||
d->olc = NULL;
|
d->olc = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (save) {
|
if (save) {
|
||||||
send_to_char(ch, "Saving all shops in zone %d.\r\n",
|
send_to_char(ch, "Saving all shops in zone %d.\r\n",
|
||||||
zone_table[OLC_ZNUM(d)].number);
|
zone_table[OLC_ZNUM(d)].number);
|
||||||
mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE,
|
mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE,
|
||||||
"OLC: %s saves shop info for zone %d.",
|
"OLC: %s saves shop info for zone %d.",
|
||||||
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number);
|
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number);
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/** Save the shops to the shop file. **/
|
/** Save the shops to the shop file. **/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
save_shops(OLC_ZNUM(d));
|
save_shops(OLC_ZNUM(d));
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/** Free the OLC structure. **/
|
/** Free the OLC structure. **/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
@ -175,19 +175,19 @@ send_to_char(ch, " You do not have permission to edit zone %d. Try zone %d.\r\n"
|
||||||
d->olc = NULL;
|
d->olc = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OLC_NUM(d) = number;
|
OLC_NUM(d) = number;
|
||||||
|
|
||||||
if ((real_num = real_shop(number)) != NOTHING)
|
if ((real_num = real_shop(number)) != NOTHING)
|
||||||
sedit_setup_existing(d, real_num);
|
sedit_setup_existing(d, real_num);
|
||||||
else
|
else
|
||||||
sedit_setup_new(d);
|
sedit_setup_new(d);
|
||||||
|
|
||||||
STATE(d) = CON_SEDIT;
|
STATE(d) = CON_SEDIT;
|
||||||
|
|
||||||
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||||
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
||||||
|
|
||||||
mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s starts editing zone %d allowed zone %d",
|
mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s starts editing zone %d allowed zone %d",
|
||||||
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
||||||
}
|
}
|
||||||
|
|
@ -253,7 +253,7 @@ void sedit_setup_existing(struct descriptor_data *d, int rshop_num)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Menu functions
|
Menu functions
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
void sedit_products_menu(struct descriptor_data *d)
|
void sedit_products_menu(struct descriptor_data *d)
|
||||||
|
|
@ -312,7 +312,7 @@ void sedit_rooms_menu(struct descriptor_data *d)
|
||||||
struct shop_data *shop;
|
struct shop_data *shop;
|
||||||
int i;
|
int i;
|
||||||
room_rnum rnum;
|
room_rnum rnum;
|
||||||
|
|
||||||
shop = OLC_SHOP(d);
|
shop = OLC_SHOP(d);
|
||||||
get_char_colors(d->character);
|
get_char_colors(d->character);
|
||||||
|
|
||||||
|
|
@ -322,7 +322,7 @@ void sedit_rooms_menu(struct descriptor_data *d)
|
||||||
rnum = real_room(S_ROOM(shop, i));
|
rnum = real_room(S_ROOM(shop, i));
|
||||||
/* if the room has been deleted, this may crash us otherwise. */
|
/* if the room has been deleted, this may crash us otherwise. */
|
||||||
/* set to 0 to be deletable. -- Welcor 09/04 */
|
/* set to 0 to be deletable. -- Welcor 09/04 */
|
||||||
if (rnum == NOWHERE)
|
if (rnum == NOWHERE)
|
||||||
S_ROOM(shop, i) = rnum = 0;
|
S_ROOM(shop, i) = rnum = 0;
|
||||||
|
|
||||||
write_to_output(d, "%2d - [%s%5d%s] - %s%s%s\r\n", i, cyn, S_ROOM(shop, i), nrm,
|
write_to_output(d, "%2d - [%s%5d%s] - %s%s%s\r\n", i, cyn, S_ROOM(shop, i), nrm,
|
||||||
|
|
@ -839,7 +839,7 @@ void sedit_parse(struct descriptor_data *d, char *arg)
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* END OF CASE
|
* END OF CASE
|
||||||
* If we get here, we have probably changed something, and now want to
|
* If we get here, we have probably changed something, and now want to
|
||||||
* return to main menu. Use OLC_VAL as a 'has changed' flag.
|
* return to main menu. Use OLC_VAL as a 'has changed' flag.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -107,7 +107,7 @@ const char *trade_letters[] = {
|
||||||
const char *shop_bits[] = {
|
const char *shop_bits[] = {
|
||||||
"WILL_FIGHT",
|
"WILL_FIGHT",
|
||||||
"USES_BANK",
|
"USES_BANK",
|
||||||
"UNLIMITED_CASH",
|
"UNLIMITED_CASH",
|
||||||
"\n"
|
"\n"
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -1250,7 +1250,7 @@ void assign_the_shopkeepers(void)
|
||||||
for (cindex = 0; cindex <= top_shop; cindex++) {
|
for (cindex = 0; cindex <= top_shop; cindex++) {
|
||||||
if (SHOP_KEEPER(cindex) == NOBODY)
|
if (SHOP_KEEPER(cindex) == NOBODY)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (SHOP_KEEPER(cindex) > top_of_mobt) {
|
if (SHOP_KEEPER(cindex) > top_of_mobt) {
|
||||||
log ("shop %d had mob out of bounds", cindex);
|
log ("shop %d had mob out of bounds", cindex);
|
||||||
abort();
|
abort();
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,7 @@ struct shop_data {
|
||||||
|
|
||||||
|
|
||||||
/* Whom will we not trade with (bitvector for SHOP_TRADE_WITH()) */
|
/* Whom will we not trade with (bitvector for SHOP_TRADE_WITH()) */
|
||||||
#define TRADE_NOGOOD (1 << 0)
|
#define TRADE_NOGOOD (1 << 0)
|
||||||
#define TRADE_NOEVIL (1 << 1)
|
#define TRADE_NOEVIL (1 << 1)
|
||||||
#define TRADE_NONEUTRAL (1 << 2)
|
#define TRADE_NONEUTRAL (1 << 2)
|
||||||
#define TRADE_NOMAGIC_USER (1 << 3)
|
#define TRADE_NOMAGIC_USER (1 << 3)
|
||||||
|
|
|
||||||
|
|
@ -137,7 +137,7 @@ void assign_mobiles(void)
|
||||||
|
|
||||||
ASSIGNMOB(1200, receptionist);
|
ASSIGNMOB(1200, receptionist);
|
||||||
ASSIGNMOB(3005, receptionist);
|
ASSIGNMOB(3005, receptionist);
|
||||||
ASSIGNMOB(5404, receptionist);
|
ASSIGNMOB(5404, receptionist);
|
||||||
ASSIGNMOB(27713, receptionist);
|
ASSIGNMOB(27713, receptionist);
|
||||||
ASSIGNMOB(27730, receptionist);
|
ASSIGNMOB(27730, receptionist);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ void list_skills(struct char_data *ch)
|
||||||
len = snprintf(buf2, sizeof(buf2), "You have %d practice session%s remaining.\r\n"
|
len = snprintf(buf2, sizeof(buf2), "You have %d practice session%s remaining.\r\n"
|
||||||
"You know of the following %ss:\r\n", GET_PRACTICES(ch),
|
"You know of the following %ss:\r\n", GET_PRACTICES(ch),
|
||||||
GET_PRACTICES(ch) == 1 ? "" : "s", SPLSKL(ch));
|
GET_PRACTICES(ch) == 1 ? "" : "s", SPLSKL(ch));
|
||||||
|
|
||||||
for (sortpos = 1; sortpos <= MAX_SKILLS; sortpos++) {
|
for (sortpos = 1; sortpos <= MAX_SKILLS; sortpos++) {
|
||||||
i = spell_sort_info[sortpos];
|
i = spell_sort_info[sortpos];
|
||||||
if (GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)]) {
|
if (GET_LEVEL(ch) >= spell_info[i].min_level[(int) GET_CLASS(ch)]) {
|
||||||
|
|
|
||||||
|
|
@ -165,7 +165,7 @@ const char *skill_name(int num)
|
||||||
return ("UNDEFINED");
|
return ("UNDEFINED");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int find_skill_num(char *name)
|
int find_skill_num(char *name)
|
||||||
{
|
{
|
||||||
int skindex, ok;
|
int skindex, ok;
|
||||||
|
|
@ -428,7 +428,7 @@ void mag_objectmagic(struct char_data *ch, struct obj_data *obj,
|
||||||
|
|
||||||
if (!consume_otrigger(obj, ch, OCMD_QUAFF)) /* check trigger */
|
if (!consume_otrigger(obj, ch, OCMD_QUAFF)) /* check trigger */
|
||||||
return;
|
return;
|
||||||
|
|
||||||
act("You quaff $p.", FALSE, ch, obj, NULL, TO_CHAR);
|
act("You quaff $p.", FALSE, ch, obj, NULL, TO_CHAR);
|
||||||
if (obj->action_description)
|
if (obj->action_description)
|
||||||
act(obj->action_description, FALSE, ch, obj, NULL, TO_ROOM);
|
act(obj->action_description, FALSE, ch, obj, NULL, TO_ROOM);
|
||||||
|
|
@ -468,7 +468,7 @@ int cast_spell(struct char_data *ch, struct char_data *tch,
|
||||||
TOP_SPELL_DEFINE);
|
TOP_SPELL_DEFINE);
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GET_POS(ch) < SINFO.min_position) {
|
if (GET_POS(ch) < SINFO.min_position) {
|
||||||
switch (GET_POS(ch)) {
|
switch (GET_POS(ch)) {
|
||||||
case POS_SLEEPING:
|
case POS_SLEEPING:
|
||||||
|
|
@ -674,7 +674,7 @@ void spell_level(int spell, int chclass, int level)
|
||||||
bad = 1;
|
bad = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!bad)
|
if (!bad)
|
||||||
spell_info[spell].min_level[chclass] = level;
|
spell_info[spell].min_level[chclass] = level;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -175,7 +175,7 @@ ASPELL(spell_locate_object)
|
||||||
send_to_char(ch, "You sense nothing.\r\n");
|
send_to_char(ch, "You sense nothing.\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
strlcpy(name, fname(obj->name), sizeof(name));
|
strlcpy(name, fname(obj->name), sizeof(name));
|
||||||
j = level / 2;
|
j = level / 2;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -119,8 +119,8 @@
|
||||||
#define SPELL_ACID_BREATH 205
|
#define SPELL_ACID_BREATH 205
|
||||||
#define SPELL_LIGHTNING_BREATH 206
|
#define SPELL_LIGHTNING_BREATH 206
|
||||||
|
|
||||||
|
|
||||||
#define SPELL_DG_AFFECT 298 /* to make an affect induced by dg_affect
|
#define SPELL_DG_AFFECT 298 /* to make an affect induced by dg_affect
|
||||||
* look correct on 'stat' we need to define
|
* look correct on 'stat' we need to define
|
||||||
* it with a 'spellname'.
|
* it with a 'spellname'.
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -274,7 +274,7 @@
|
||||||
#define CON_AEDIT 25 /* OLC mode - social (action) edit */
|
#define CON_AEDIT 25 /* OLC mode - social (action) edit */
|
||||||
#define CON_TRIGEDIT 26 /* OLC mode - trigger edit */
|
#define CON_TRIGEDIT 26 /* OLC mode - trigger edit */
|
||||||
#define CON_HEDIT 27
|
#define CON_HEDIT 27
|
||||||
|
|
||||||
/* Character equipment positions: used as index for char_data.equipment[] */
|
/* Character equipment positions: used as index for char_data.equipment[] */
|
||||||
/* NOTE: Don't confuse these constants with the ITEM_ bitvectors
|
/* NOTE: Don't confuse these constants with the ITEM_ bitvectors
|
||||||
which control the valid places you can wear a piece of equipment */
|
which control the valid places you can wear a piece of equipment */
|
||||||
|
|
@ -513,19 +513,19 @@
|
||||||
#define MAX_INPUT_LENGTH 512 /* Max length per *line* of input */
|
#define MAX_INPUT_LENGTH 512 /* Max length per *line* of input */
|
||||||
#define MAX_RAW_INPUT_LENGTH 512 /* Max size of *raw* input */
|
#define MAX_RAW_INPUT_LENGTH 512 /* Max size of *raw* input */
|
||||||
#define MAX_MESSAGES 60
|
#define MAX_MESSAGES 60
|
||||||
#define MAX_NAME_LENGTH 20
|
#define MAX_NAME_LENGTH 20
|
||||||
/* ** MAX_PWD_LENGTH changed from 10 to 30 for ascii test - Sam ** */
|
/* ** MAX_PWD_LENGTH changed from 10 to 30 for ascii test - Sam ** */
|
||||||
#define MAX_PWD_LENGTH 30
|
#define MAX_PWD_LENGTH 30
|
||||||
#define MAX_TITLE_LENGTH 80
|
#define MAX_TITLE_LENGTH 80
|
||||||
#define HOST_LENGTH 30
|
#define HOST_LENGTH 30
|
||||||
#define PLR_DESC_LENGTH 512
|
#define PLR_DESC_LENGTH 512
|
||||||
#define MAX_TONGUE 3
|
#define MAX_TONGUE 3
|
||||||
#define MAX_SKILLS 200
|
#define MAX_SKILLS 200
|
||||||
#define MAX_AFFECT 32
|
#define MAX_AFFECT 32
|
||||||
#define MAX_OBJ_AFFECT 6 /* Used in obj_file_elem */
|
#define MAX_OBJ_AFFECT 6 /* Used in obj_file_elem */
|
||||||
#define MAX_NOTE_LENGTH 4000 /* arbitrary */
|
#define MAX_NOTE_LENGTH 4000 /* arbitrary */
|
||||||
#define MAX_LAST_ENTRIES 6000 /* arbitrary */
|
#define MAX_LAST_ENTRIES 6000 /* arbitrary */
|
||||||
#define MAX_HELP_KEYWORDS 256
|
#define MAX_HELP_KEYWORDS 256
|
||||||
#define MAX_HELP_ENTRY MAX_STRING_LENGTH
|
#define MAX_HELP_ENTRY MAX_STRING_LENGTH
|
||||||
|
|
||||||
/* define the largest set of commands for as trigger */
|
/* define the largest set of commands for as trigger */
|
||||||
|
|
@ -745,7 +745,7 @@ struct time_data {
|
||||||
struct pclean_criteria_data {
|
struct pclean_criteria_data {
|
||||||
int level; /* max level for this time limit */
|
int level; /* max level for this time limit */
|
||||||
int days; /* time limit in days */
|
int days; /* time limit in days */
|
||||||
};
|
};
|
||||||
|
|
||||||
/* general player-related info, usually PC's and NPC's */
|
/* general player-related info, usually PC's and NPC's */
|
||||||
struct char_player_data {
|
struct char_player_data {
|
||||||
|
|
@ -796,7 +796,7 @@ struct char_point_data {
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* char_special_data_saved: specials which both a PC and an NPC have in
|
* char_special_data_saved: specials which both a PC and an NPC have in
|
||||||
* common, but which must be saved to the players file for PC's.
|
* common, but which must be saved to the players file for PC's.
|
||||||
*/
|
*/
|
||||||
|
|
@ -1114,11 +1114,11 @@ struct guild_info_type {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Config structs
|
* Config structs
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The game configuration structure used for configurating the game play
|
* The game configuration structure used for configurating the game play
|
||||||
* variables.
|
* variables.
|
||||||
*/
|
*/
|
||||||
struct game_data {
|
struct game_data {
|
||||||
|
|
@ -1138,7 +1138,7 @@ struct game_data {
|
||||||
int load_into_inventory;/* Objects load in immortals inventory. */
|
int load_into_inventory;/* Objects load in immortals inventory. */
|
||||||
int track_through_doors;/* Track through doors while closed? */
|
int track_through_doors;/* Track through doors while closed? */
|
||||||
int immort_level_ok; /* Automatically level mortals to imm? */
|
int immort_level_ok; /* Automatically level mortals to imm? */
|
||||||
|
|
||||||
char *OK; /* When player receives 'Okay.' text. */
|
char *OK; /* When player receives 'Okay.' text. */
|
||||||
char *NOPERSON; /* 'No-one by that name here.' */
|
char *NOPERSON; /* 'No-one by that name here.' */
|
||||||
char *NOEFFECT; /* 'Nothing seems to happen.' */
|
char *NOEFFECT; /* 'Nothing seems to happen.' */
|
||||||
|
|
@ -1161,7 +1161,7 @@ struct crash_save_data {
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The room numbers.
|
* The room numbers.
|
||||||
*/
|
*/
|
||||||
struct room_numbers {
|
struct room_numbers {
|
||||||
room_vnum mortal_start_room; /* vnum of room that mortals enter at. */
|
room_vnum mortal_start_room; /* vnum of room that mortals enter at. */
|
||||||
|
|
|
||||||
|
|
@ -200,7 +200,7 @@ extern void abort (), exit ();
|
||||||
|
|
||||||
/* Header files *******************************************************/
|
/* Header files *******************************************************/
|
||||||
|
|
||||||
|
|
||||||
/* Header files common to all source files */
|
/* Header files common to all source files */
|
||||||
|
|
||||||
#ifdef HAVE_LIMITS_H
|
#ifdef HAVE_LIMITS_H
|
||||||
|
|
@ -487,7 +487,7 @@ struct in_addr {
|
||||||
#ifdef NEED_BZERO_PROTO
|
#ifdef NEED_BZERO_PROTO
|
||||||
// void bzero(char *b, int length);
|
// void bzero(char *b, int length);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NEED_CRYPT_PROTO
|
#ifdef NEED_CRYPT_PROTO
|
||||||
char *crypt(const char *key, const char *salt);
|
char *crypt(const char *key, const char *salt);
|
||||||
#endif
|
#endif
|
||||||
|
|
@ -663,7 +663,7 @@ struct in_addr {
|
||||||
|
|
||||||
#ifdef NEED_SELECT_PROTO
|
#ifdef NEED_SELECT_PROTO
|
||||||
int select(int nfds, fd_set *readfds, fd_set *writefds,
|
int select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||||
fd_set *exceptfds, struct timeval *timeout);
|
fd_set *exceptfds, struct timeval *timeout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef NEED_SETITIMER_PROTO
|
#ifdef NEED_SETITIMER_PROTO
|
||||||
|
|
|
||||||
10
src/tedit.c
10
src/tedit.c
|
|
@ -71,7 +71,7 @@ ACMD(do_tedit)
|
||||||
int l, i = 0;
|
int l, i = 0;
|
||||||
char field[MAX_INPUT_LENGTH];
|
char field[MAX_INPUT_LENGTH];
|
||||||
char *backstr = NULL;
|
char *backstr = NULL;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
char *cmd;
|
char *cmd;
|
||||||
char level;
|
char level;
|
||||||
|
|
@ -98,7 +98,7 @@ ACMD(do_tedit)
|
||||||
|
|
||||||
if (ch->desc == NULL)
|
if (ch->desc == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
one_argument(argument, field);
|
one_argument(argument, field);
|
||||||
|
|
||||||
if (!*field) {
|
if (!*field) {
|
||||||
|
|
@ -119,12 +119,12 @@ ACMD(do_tedit)
|
||||||
for (l = 0; *(fields[l].cmd) != '\n'; l++)
|
for (l = 0; *(fields[l].cmd) != '\n'; l++)
|
||||||
if (!strncmp(field, fields[l].cmd, strlen(field)))
|
if (!strncmp(field, fields[l].cmd, strlen(field)))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (*fields[l].cmd == '\n') {
|
if (*fields[l].cmd == '\n') {
|
||||||
send_to_char(ch, "Invalid text editor option.\r\n");
|
send_to_char(ch, "Invalid text editor option.\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GET_LEVEL(ch) < fields[l].level) {
|
if (GET_LEVEL(ch) < fields[l].level) {
|
||||||
send_to_char(ch, "You are not godly enough for that!\r\n");
|
send_to_char(ch, "You are not godly enough for that!\r\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -140,7 +140,7 @@ ACMD(do_tedit)
|
||||||
free(ch->desc->olc);
|
free(ch->desc->olc);
|
||||||
}
|
}
|
||||||
CREATE(ch->desc->olc, struct oasis_olc_data, 1);
|
CREATE(ch->desc->olc, struct oasis_olc_data, 1);
|
||||||
|
|
||||||
if (*fields[l].buffer) {
|
if (*fields[l].buffer) {
|
||||||
send_to_char(ch, "%s", *fields[l].buffer);
|
send_to_char(ch, "%s", *fields[l].buffer);
|
||||||
backstr = strdup(*fields[l].buffer);
|
backstr = strdup(*fields[l].buffer);
|
||||||
|
|
|
||||||
10
src/utils.c
10
src/utils.c
|
|
@ -663,10 +663,10 @@ int count_color_chars(char *string)
|
||||||
{
|
{
|
||||||
int i, len;
|
int i, len;
|
||||||
int num = 0;
|
int num = 0;
|
||||||
|
|
||||||
if (!string || !*string)
|
if (!string || !*string)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
len = strlen(string);
|
len = strlen(string);
|
||||||
for (i = 0; i < len; i++) {
|
for (i = 0; i < len; i++) {
|
||||||
while (string[i] == '@') {
|
while (string[i] == '@') {
|
||||||
|
|
@ -711,12 +711,12 @@ int levenshtein_distance(char *s1, char *s2)
|
||||||
{
|
{
|
||||||
int s1_len = strlen(s1), s2_len = strlen(s2);
|
int s1_len = strlen(s1), s2_len = strlen(s2);
|
||||||
int d[s1_len + 1][s2_len + 1];
|
int d[s1_len + 1][s2_len + 1];
|
||||||
int i, j;
|
int i, j;
|
||||||
|
|
||||||
for (i = 0; i <= s1_len; i++)
|
for (i = 0; i <= s1_len; i++)
|
||||||
d[i][0] = i;
|
d[i][0] = i;
|
||||||
for (j = 0; j <= s2_len; j++)
|
for (j = 0; j <= s2_len; j++)
|
||||||
d[0][j] = j;
|
d[0][j] = j;
|
||||||
|
|
||||||
for (i = 1; i <= s1_len; i++)
|
for (i = 1; i <= s1_len; i++)
|
||||||
for (j = 1; j <= s2_len; j++)
|
for (j = 1; j <= s2_len; j++)
|
||||||
|
|
|
||||||
|
|
@ -104,12 +104,12 @@ void update_pos(struct char_data *victim);
|
||||||
#define CMP 3
|
#define CMP 3
|
||||||
|
|
||||||
/* get_filename() */
|
/* get_filename() */
|
||||||
#define CRASH_FILE 0
|
#define CRASH_FILE 0
|
||||||
#define ETEXT_FILE 1
|
#define ETEXT_FILE 1
|
||||||
#define ALIAS_FILE 2
|
#define ALIAS_FILE 2
|
||||||
#define SCRIPT_VARS_FILE 3
|
#define SCRIPT_VARS_FILE 3
|
||||||
#define PLR_FILE 4
|
#define PLR_FILE 4
|
||||||
#define MAX_FILES 5
|
#define MAX_FILES 5
|
||||||
|
|
||||||
/* breadth-first searching */
|
/* breadth-first searching */
|
||||||
#define BFS_ERROR (-1)
|
#define BFS_ERROR (-1)
|
||||||
|
|
|
||||||
94
src/zedit.c
94
src/zedit.c
|
|
@ -47,12 +47,12 @@ ACMD(do_oasis_zedit)
|
||||||
char *buf3;
|
char *buf3;
|
||||||
char buf1[MAX_STRING_LENGTH];
|
char buf1[MAX_STRING_LENGTH];
|
||||||
char buf2[MAX_STRING_LENGTH];
|
char buf2[MAX_STRING_LENGTH];
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Parse any arguments. **/
|
/** Parse any arguments. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
buf3 = two_arguments(argument, buf1, buf2);
|
buf3 = two_arguments(argument, buf1, buf2);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** If no argument was given, use the zone the builder is standing in. **/
|
/** If no argument was given, use the zone the builder is standing in. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -61,18 +61,18 @@ ACMD(do_oasis_zedit)
|
||||||
else if (!isdigit(*buf1)) {
|
else if (!isdigit(*buf1)) {
|
||||||
if (str_cmp("save", buf1) == 0) {
|
if (str_cmp("save", buf1) == 0) {
|
||||||
save = TRUE;
|
save = TRUE;
|
||||||
|
|
||||||
if (is_number(buf2))
|
if (is_number(buf2))
|
||||||
number = atoi(buf2);
|
number = atoi(buf2);
|
||||||
else if (GET_OLC_ZONE(ch) > 0) {
|
else if (GET_OLC_ZONE(ch) > 0) {
|
||||||
zone_rnum zlok;
|
zone_rnum zlok;
|
||||||
|
|
||||||
if ((zlok = real_zone(GET_OLC_ZONE(ch))) == NOWHERE)
|
if ((zlok = real_zone(GET_OLC_ZONE(ch))) == NOWHERE)
|
||||||
number = NOWHERE;
|
number = NOWHERE;
|
||||||
else
|
else
|
||||||
number = genolc_zone_bottom(zlok);
|
number = genolc_zone_bottom(zlok);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (number == NOWHERE) {
|
if (number == NOWHERE) {
|
||||||
send_to_char(ch, "Save which zone?\r\n");
|
send_to_char(ch, "Save which zone?\r\n");
|
||||||
return;
|
return;
|
||||||
|
|
@ -84,39 +84,39 @@ ACMD(do_oasis_zedit)
|
||||||
else {
|
else {
|
||||||
char sbot[MAX_INPUT_LENGTH], stop[MAX_INPUT_LENGTH];
|
char sbot[MAX_INPUT_LENGTH], stop[MAX_INPUT_LENGTH];
|
||||||
room_vnum bottom, top;
|
room_vnum bottom, top;
|
||||||
|
|
||||||
skip_spaces(&buf3);
|
skip_spaces(&buf3);
|
||||||
two_arguments(buf3, sbot, stop);
|
two_arguments(buf3, sbot, stop);
|
||||||
|
|
||||||
number = atoi(buf2);
|
number = atoi(buf2);
|
||||||
if (number < 0)
|
if (number < 0)
|
||||||
number = NOWHERE;
|
number = NOWHERE;
|
||||||
bottom = atoi(sbot);
|
bottom = atoi(sbot);
|
||||||
top = atoi(stop);
|
top = atoi(stop);
|
||||||
|
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
/** Setup the new zone (displays the menu to the builder). **/
|
/** Setup the new zone (displays the menu to the builder). **/
|
||||||
/**********************************************************************/
|
/**********************************************************************/
|
||||||
zedit_new_zone(ch, number, bottom, top);
|
zedit_new_zone(ch, number, bottom, top);
|
||||||
}
|
}
|
||||||
|
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
/** Done now, exit the function. **/
|
/** Done now, exit the function. **/
|
||||||
/************************************************************************/
|
/************************************************************************/
|
||||||
return;
|
return;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
send_to_char(ch, "Yikes! Stop that, someone will get hurt!\r\n");
|
send_to_char(ch, "Yikes! Stop that, someone will get hurt!\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** If a numeric argumentwas given, retrieve it. **/
|
/** If a numeric argumentwas given, retrieve it. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
if (number == NOWHERE)
|
if (number == NOWHERE)
|
||||||
number = atoi(buf1);
|
number = atoi(buf1);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Check that nobody is currently editing this zone. **/
|
/** Check that nobody is currently editing this zone. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -129,12 +129,12 @@ ACMD(do_oasis_zedit)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Store the builder's descriptor in d. **/
|
/** Store the builder's descriptor in d. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
d = ch->desc;
|
d = ch->desc;
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Give the builder's descriptor an OLC structure. **/
|
/** Give the builder's descriptor an OLC structure. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -143,16 +143,16 @@ ACMD(do_oasis_zedit)
|
||||||
"had olc structure.");
|
"had olc structure.");
|
||||||
free(d->olc);
|
free(d->olc);
|
||||||
}
|
}
|
||||||
|
|
||||||
CREATE(d->olc, struct oasis_olc_data, 1);
|
CREATE(d->olc, struct oasis_olc_data, 1);
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Find the zone. **/
|
/** Find the zone. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number);
|
OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number);
|
||||||
if (OLC_ZNUM(d) == NOWHERE) {
|
if (OLC_ZNUM(d) == NOWHERE) {
|
||||||
send_to_char(ch, "Sorry, there is no zone for that number!\r\n");
|
send_to_char(ch, "Sorry, there is no zone for that number!\r\n");
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/** Free the descriptor's OLC structure. **/
|
/** Free the descriptor's OLC structure. **/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
@ -160,7 +160,7 @@ ACMD(do_oasis_zedit)
|
||||||
d->olc = NULL;
|
d->olc = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
/** Everyone but IMPLs can only edit zones they have been assigned. **/
|
/** Everyone but IMPLs can only edit zones they have been assigned. **/
|
||||||
/****************************************************************************/
|
/****************************************************************************/
|
||||||
|
|
@ -182,12 +182,12 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
|
||||||
mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE,
|
mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE,
|
||||||
"OLC: %s saves zone information for zone %d.", GET_NAME(ch),
|
"OLC: %s saves zone information for zone %d.", GET_NAME(ch),
|
||||||
zone_table[OLC_ZNUM(d)].number);
|
zone_table[OLC_ZNUM(d)].number);
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/** Save the zone information to the zone file. **/
|
/** Save the zone information to the zone file. **/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
save_zone(OLC_ZNUM(d));
|
save_zone(OLC_ZNUM(d));
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/** Free the descriptor's OLC structure. **/
|
/** Free the descriptor's OLC structure. **/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
@ -195,12 +195,12 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
|
||||||
d->olc = NULL;
|
d->olc = NULL;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
OLC_NUM(d) = number;
|
OLC_NUM(d) = number;
|
||||||
|
|
||||||
if ((real_num = real_room(number)) == NOWHERE) {
|
if ((real_num = real_room(number)) == NOWHERE) {
|
||||||
write_to_output(d, "That room does not exist.\r\n");
|
write_to_output(d, "That room does not exist.\r\n");
|
||||||
|
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
/** Free the descriptor's OLC structure. **/
|
/** Free the descriptor's OLC structure. **/
|
||||||
/**************************************************************************/
|
/**************************************************************************/
|
||||||
|
|
@ -211,10 +211,10 @@ mudlog(BRF, LVL_IMPL, TRUE, "OLC: %s tried to edit zone %d allowed zone %d",
|
||||||
|
|
||||||
zedit_setup(d, real_num);
|
zedit_setup(d, real_num);
|
||||||
STATE(d) = CON_ZEDIT;
|
STATE(d) = CON_ZEDIT;
|
||||||
|
|
||||||
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||||
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
||||||
|
|
||||||
mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s starts editing zone %d allowed zone %d",
|
mudlog(CMP, LVL_IMMORT, TRUE, "OLC: %s starts editing zone %d allowed zone %d",
|
||||||
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number, GET_OLC_ZONE(ch));
|
||||||
}
|
}
|
||||||
|
|
@ -225,7 +225,7 @@ void zedit_setup(struct descriptor_data *d, int room_num)
|
||||||
int subcmd = 0, count = 0, cmd_room = NOWHERE;
|
int subcmd = 0, count = 0, cmd_room = NOWHERE;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Allocate one scratch zone structure.
|
* Allocate one scratch zone structure.
|
||||||
*/
|
*/
|
||||||
CREATE(zone, struct zone_data, 1);
|
CREATE(zone, struct zone_data, 1);
|
||||||
|
|
||||||
|
|
@ -240,7 +240,7 @@ void zedit_setup(struct descriptor_data *d, int room_num)
|
||||||
zone->top = zone_table[OLC_ZNUM(d)].top;
|
zone->top = zone_table[OLC_ZNUM(d)].top;
|
||||||
zone->reset_mode = zone_table[OLC_ZNUM(d)].reset_mode;
|
zone->reset_mode = zone_table[OLC_ZNUM(d)].reset_mode;
|
||||||
/*
|
/*
|
||||||
* The remaining fields are used as a 'has been modified' flag
|
* The remaining fields are used as a 'has been modified' flag
|
||||||
*/
|
*/
|
||||||
zone->number = 0; /* Header information has changed. */
|
zone->number = 0; /* Header information has changed. */
|
||||||
zone->age = 0; /* The commands have changed. */
|
zone->age = 0; /* The commands have changed. */
|
||||||
|
|
@ -343,7 +343,7 @@ void zedit_save_internally(struct descriptor_data *d)
|
||||||
remove_room_zone_commands(OLC_ZNUM(d), room_num);
|
remove_room_zone_commands(OLC_ZNUM(d), room_num);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Now add all the entries in the players descriptor list
|
* Now add all the entries in the players descriptor list
|
||||||
*/
|
*/
|
||||||
for (subcmd = 0; MYCMD.command != 'S'; subcmd++) {
|
for (subcmd = 0; MYCMD.command != 'S'; subcmd++) {
|
||||||
/*
|
/*
|
||||||
|
|
@ -383,12 +383,12 @@ void zedit_save_internally(struct descriptor_data *d)
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Finally, if zone headers have been changed, copy over
|
* Finally, if zone headers have been changed, copy over
|
||||||
*/
|
*/
|
||||||
if (OLC_ZONE(d)->number) {
|
if (OLC_ZONE(d)->number) {
|
||||||
free(zone_table[OLC_ZNUM(d)].name);
|
free(zone_table[OLC_ZNUM(d)].name);
|
||||||
free(zone_table[OLC_ZNUM(d)].builders);
|
free(zone_table[OLC_ZNUM(d)].builders);
|
||||||
|
|
||||||
zone_table[OLC_ZNUM(d)].name = strdup(OLC_ZONE(d)->name);
|
zone_table[OLC_ZNUM(d)].name = strdup(OLC_ZONE(d)->name);
|
||||||
zone_table[OLC_ZNUM(d)].builders = strdup(OLC_ZONE(d)->builders);
|
zone_table[OLC_ZNUM(d)].builders = strdup(OLC_ZONE(d)->builders);
|
||||||
zone_table[OLC_ZNUM(d)].bot = OLC_ZONE(d)->bot;
|
zone_table[OLC_ZNUM(d)].bot = OLC_ZONE(d)->bot;
|
||||||
|
|
@ -409,7 +409,7 @@ void zedit_save_to_disk(int zone)
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Error check user input and then setup change
|
* Error check user input and then setup change
|
||||||
*/
|
*/
|
||||||
int start_change_command(struct descriptor_data *d, int pos)
|
int start_change_command(struct descriptor_data *d, int pos)
|
||||||
{
|
{
|
||||||
|
|
@ -424,11 +424,11 @@ int start_change_command(struct descriptor_data *d, int pos)
|
||||||
}
|
}
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
Menu functions
|
Menu functions
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* the main menu
|
* the main menu
|
||||||
*/
|
*/
|
||||||
void zedit_disp_menu(struct descriptor_data *d)
|
void zedit_disp_menu(struct descriptor_data *d)
|
||||||
{
|
{
|
||||||
|
|
@ -439,9 +439,9 @@ void zedit_disp_menu(struct descriptor_data *d)
|
||||||
room = real_room(OLC_NUM(d));
|
room = real_room(OLC_NUM(d));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Menu header
|
* Menu header
|
||||||
*/
|
*/
|
||||||
send_to_char(d->character,
|
send_to_char(d->character,
|
||||||
"Room number: %s%d%s Room zone: %s%d\r\n"
|
"Room number: %s%d%s Room zone: %s%d\r\n"
|
||||||
"%s1%s) Builders : %s%s\r\n"
|
"%s1%s) Builders : %s%s\r\n"
|
||||||
"%sZ%s) Zone name : %s%s\r\n"
|
"%sZ%s) Zone name : %s%s\r\n"
|
||||||
|
|
@ -532,7 +532,7 @@ void zedit_disp_menu(struct descriptor_data *d)
|
||||||
case 'T':
|
case 'T':
|
||||||
write_to_output(d, "%sAttach trigger %s%s%s [%s%d%s] to %s",
|
write_to_output(d, "%sAttach trigger %s%s%s [%s%d%s] to %s",
|
||||||
MYCMD.if_flag ? " then " : "",
|
MYCMD.if_flag ? " then " : "",
|
||||||
cyn, trig_index[MYCMD.arg2]->proto->name, yel,
|
cyn, trig_index[MYCMD.arg2]->proto->name, yel,
|
||||||
cyn, trig_index[MYCMD.arg2]->vnum, yel,
|
cyn, trig_index[MYCMD.arg2]->vnum, yel,
|
||||||
((MYCMD.arg1 == MOB_TRIGGER) ? "mobile" :
|
((MYCMD.arg1 == MOB_TRIGGER) ? "mobile" :
|
||||||
((MYCMD.arg1 == OBJ_TRIGGER) ? "object" :
|
((MYCMD.arg1 == OBJ_TRIGGER) ? "object" :
|
||||||
|
|
@ -555,7 +555,7 @@ void zedit_disp_menu(struct descriptor_data *d)
|
||||||
subcmd++;
|
subcmd++;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
* Finish off menu
|
* Finish off menu
|
||||||
*/
|
*/
|
||||||
write_to_output(d,
|
write_to_output(d,
|
||||||
"%s%d - <END OF LIST>\r\n"
|
"%s%d - <END OF LIST>\r\n"
|
||||||
|
|
@ -572,7 +572,7 @@ void zedit_disp_menu(struct descriptor_data *d)
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Print the command type menu and setup response catch.
|
* Print the command type menu and setup response catch.
|
||||||
*/
|
*/
|
||||||
void zedit_disp_comtype(struct descriptor_data *d)
|
void zedit_disp_comtype(struct descriptor_data *d)
|
||||||
{
|
{
|
||||||
|
|
@ -597,7 +597,7 @@ void zedit_disp_comtype(struct descriptor_data *d)
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Print the appropriate message for the command type for arg1 and set
|
* Print the appropriate message for the command type for arg1 and set
|
||||||
* up the input catch clause
|
* up the input catch clause
|
||||||
*/
|
*/
|
||||||
void zedit_disp_arg1(struct descriptor_data *d)
|
void zedit_disp_arg1(struct descriptor_data *d)
|
||||||
{
|
{
|
||||||
|
|
@ -618,7 +618,7 @@ void zedit_disp_arg1(struct descriptor_data *d)
|
||||||
case 'D':
|
case 'D':
|
||||||
case 'R':
|
case 'R':
|
||||||
/*
|
/*
|
||||||
* Arg1 for these is the room number, skip to arg2
|
* Arg1 for these is the room number, skip to arg2
|
||||||
*/
|
*/
|
||||||
OLC_CMD(d).arg1 = real_room(OLC_NUM(d));
|
OLC_CMD(d).arg1 = real_room(OLC_NUM(d));
|
||||||
zedit_disp_arg2(d);
|
zedit_disp_arg2(d);
|
||||||
|
|
@ -650,7 +650,7 @@ void zedit_disp_arg2(struct descriptor_data *d)
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
write_to_output(d, "\r\n");
|
write_to_output(d, "\r\n");
|
||||||
|
|
||||||
switch (OLC_CMD(d).command) {
|
switch (OLC_CMD(d).command) {
|
||||||
case 'M':
|
case 'M':
|
||||||
case 'O':
|
case 'O':
|
||||||
|
|
@ -921,13 +921,13 @@ void zedit_parse(struct descriptor_data *d, char *arg)
|
||||||
* Parse the input for which line to edit, and goto next quiz.
|
* Parse the input for which line to edit, and goto next quiz.
|
||||||
*/
|
*/
|
||||||
/*
|
/*
|
||||||
* Abort edit, and return to main menu
|
* Abort edit, and return to main menu
|
||||||
* - idea from Mark Garringer zizazat@hotmail.com
|
* - idea from Mark Garringer zizazat@hotmail.com
|
||||||
*/
|
*/
|
||||||
if (toupper(*arg) == 'A') {
|
if (toupper(*arg) == 'A') {
|
||||||
if (OLC_CMD(d).command == 'N') {
|
if (OLC_CMD(d).command == 'N') {
|
||||||
OLC_CMD(d).command = '*';
|
OLC_CMD(d).command = '*';
|
||||||
}
|
}
|
||||||
zedit_disp_menu(d);
|
zedit_disp_menu(d);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1069,7 +1069,7 @@ void zedit_parse(struct descriptor_data *d, char *arg)
|
||||||
case 'T':
|
case 'T':
|
||||||
if (real_trigger(atoi(arg)) != NOTHING) {
|
if (real_trigger(atoi(arg)) != NOTHING) {
|
||||||
OLC_CMD(d).arg2 = real_trigger(atoi(arg)); /* trigger */
|
OLC_CMD(d).arg2 = real_trigger(atoi(arg)); /* trigger */
|
||||||
OLC_CMD(d).arg3 = real_room(OLC_NUM(d));
|
OLC_CMD(d).arg3 = real_room(OLC_NUM(d));
|
||||||
zedit_disp_menu(d);
|
zedit_disp_menu(d);
|
||||||
} else
|
} else
|
||||||
write_to_output(d, "That trigger does not exist, try again : ");
|
write_to_output(d, "That trigger does not exist, try again : ");
|
||||||
|
|
@ -1212,7 +1212,7 @@ void zedit_parse(struct descriptor_data *d, char *arg)
|
||||||
}
|
}
|
||||||
zedit_disp_menu(d);
|
zedit_disp_menu(d);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/*-------------------------------------------------------------------*/
|
/*-------------------------------------------------------------------*/
|
||||||
case ZEDIT_ZONE_RESET:
|
case ZEDIT_ZONE_RESET:
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -4,7 +4,7 @@
|
||||||
** Version 2. added detection for writing off the end or beginning
|
** Version 2. added detection for writing off the end or beginning
|
||||||
** of buffers, freeing the same block multiple times. Also now use the
|
** of buffers, freeing the same block multiple times. Also now use the
|
||||||
** env variable to set the name of a file to write output to.
|
** env variable to set the name of a file to write output to.
|
||||||
**
|
**
|
||||||
**
|
**
|
||||||
** Copyright 1996,1998,1999,2000 Eric Murray, ericm@lne.com
|
** Copyright 1996,1998,1999,2000 Eric Murray, ericm@lne.com
|
||||||
**
|
**
|
||||||
|
|
@ -170,7 +170,7 @@ void zfree_special(int * what, char * file,int line)
|
||||||
pad_check(m);
|
pad_check(m);
|
||||||
|
|
||||||
/* note that we freed the memory */
|
/* note that we freed the memory */
|
||||||
m->frees++;
|
m->frees++;
|
||||||
|
|
||||||
/* check to see if it was freed > once */
|
/* check to see if it was freed > once */
|
||||||
if (m->frees > 1) {
|
if (m->frees > 1) {
|
||||||
|
|
@ -228,7 +228,7 @@ void zfree(int * what, char * file,int line)
|
||||||
pad_check(m);
|
pad_check(m);
|
||||||
|
|
||||||
/* note that we freed the memory */
|
/* note that we freed the memory */
|
||||||
m->frees++;
|
m->frees++;
|
||||||
|
|
||||||
/* check to see if it was freed > once */
|
/* check to see if it was freed > once */
|
||||||
if (m->frees > 1) {
|
if (m->frees > 1) {
|
||||||
|
|
@ -259,7 +259,7 @@ void zfree(int * what, char * file,int line)
|
||||||
char *zstrdup(const char *src, char *file, int line)
|
char *zstrdup(const char *src, char *file, int line)
|
||||||
{
|
{
|
||||||
char *result;
|
char *result;
|
||||||
#ifndef NO_MEMORY_STRDUP
|
#ifndef NO_MEMORY_STRDUP
|
||||||
if (!getzmallocstatus()) {
|
if (!getzmallocstatus()) {
|
||||||
result = (char*)malloc(strlen(src) + 1);
|
result = (char*)malloc(strlen(src) + 1);
|
||||||
if (result == (char*)0)
|
if (result == (char*)0)
|
||||||
|
|
@ -312,7 +312,7 @@ void zmalloc_check()
|
||||||
admonishemnt = "you call yourself a programmer?";
|
admonishemnt = "you call yourself a programmer?";
|
||||||
else if (total_leak > 1000)
|
else if (total_leak > 1000)
|
||||||
admonishemnt = "the X consortium has a job for you...";
|
admonishemnt = "the X consortium has a job for you...";
|
||||||
else
|
else
|
||||||
admonishemnt = "close, but not there yet.";
|
admonishemnt = "close, but not there yet.";
|
||||||
fprintf(zfd,"zmalloc: %d leaks totalling %d bytes... %s\n",num_leaks,total_leak,
|
fprintf(zfd,"zmalloc: %d leaks totalling %d bytes... %s\n",num_leaks,total_leak,
|
||||||
admonishemnt);
|
admonishemnt);
|
||||||
|
|
@ -332,7 +332,7 @@ void pad_check(meminfo *m)
|
||||||
|
|
||||||
/* check the padding: */
|
/* check the padding: */
|
||||||
if (memcmp((int *)(addr - sizeof(beginPad)),
|
if (memcmp((int *)(addr - sizeof(beginPad)),
|
||||||
beginPad, sizeof(beginPad)) != 0)
|
beginPad, sizeof(beginPad)) != 0)
|
||||||
fprintf(zfd," ERR: beginPad was modified!\n");
|
fprintf(zfd," ERR: beginPad was modified!\n");
|
||||||
if (memcmp((int *)(addr + m->size),endPad,
|
if (memcmp((int *)(addr + m->size),endPad,
|
||||||
sizeof(endPad)) != 0)
|
sizeof(endPad)) != 0)
|
||||||
|
|
@ -350,7 +350,7 @@ void zmalloc_free_list(meminfo *m)
|
||||||
free(old);
|
free(old);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef ZTEST
|
#ifdef ZTEST
|
||||||
#undef ZMALLOC_H
|
#undef ZMALLOC_H
|
||||||
|
|
||||||
|
|
@ -365,18 +365,18 @@ main()
|
||||||
printf("Malloc test..");
|
printf("Malloc test..");
|
||||||
printf("You should see no error here.\n");
|
printf("You should see no error here.\n");
|
||||||
tmp = (unsigned char*)malloc(200);
|
tmp = (unsigned char*)malloc(200);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
printf("Free free mem test...\n");
|
printf("Free free mem test...\n");
|
||||||
printf("You should see an ERR: multiple frees here\n");
|
printf("You should see an ERR: multiple frees here\n");
|
||||||
tmp = (unsigned char*)malloc(200);
|
tmp = (unsigned char*)malloc(200);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
fprintf(zfd,"\nFree unallocated mem test \n");
|
fprintf(zfd,"\nFree unallocated mem test \n");
|
||||||
tmp += 4;
|
tmp += 4;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
*/
|
*/
|
||||||
|
|
||||||
printf("Unfreed mem test...\n");
|
printf("Unfreed mem test...\n");
|
||||||
|
|
@ -387,25 +387,25 @@ main()
|
||||||
printf("You should see an ERR:endPad here\n");
|
printf("You should see an ERR:endPad here\n");
|
||||||
tmp = (unsigned char*)malloc(200);
|
tmp = (unsigned char*)malloc(200);
|
||||||
tmp[200] = 0xfa;
|
tmp[200] = 0xfa;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
printf("Buffer overrun test 2...\n");
|
printf("Buffer overrun test 2...\n");
|
||||||
printf("You should see an ERR:endPad here\n");
|
printf("You should see an ERR:endPad here\n");
|
||||||
tmp = (unsigned char*)malloc(200);
|
tmp = (unsigned char*)malloc(200);
|
||||||
tmp[215] = 0xbb;
|
tmp[215] = 0xbb;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
printf("Buffer underrun test 1...\n");
|
printf("Buffer underrun test 1...\n");
|
||||||
printf("You should see an ERR:beginPad here\n");
|
printf("You should see an ERR:beginPad here\n");
|
||||||
tmp = (unsigned char*)malloc(200);
|
tmp = (unsigned char*)malloc(200);
|
||||||
tmp[-10] = 0x0f;
|
tmp[-10] = 0x0f;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
printf("Buffer underrun test 2...\n");
|
printf("Buffer underrun test 2...\n");
|
||||||
printf("You should see an ERR:beginPad here\n");
|
printf("You should see an ERR:beginPad here\n");
|
||||||
tmp = (unsigned char*)malloc(200);
|
tmp = (unsigned char*)malloc(200);
|
||||||
tmp[-1] = 0x00;
|
tmp[-1] = 0x00;
|
||||||
free(tmp);
|
free(tmp);
|
||||||
|
|
||||||
|
|
||||||
zmalloc_check();
|
zmalloc_check();
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue