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)
|
||||
send_to_char(ch, "Who do you wish to tell what??\r\n");
|
||||
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 (GET_IDNUM(ch) == last_webster_teller) {
|
||||
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 */
|
||||
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 = '\0';
|
||||
|
||||
|
||||
if (!*word) {
|
||||
send_to_char(ch, "Sorry, only letters and +/- are allowed characters.\r\n");
|
||||
return;
|
||||
|
|
@ -185,7 +185,7 @@ ACMD(do_tell)
|
|||
system(buf);
|
||||
last_webster_teller = GET_IDNUM(ch);
|
||||
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)))
|
||||
send_to_char(ch, "%s", CONFIG_NOPERSON);
|
||||
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
|
||||
* work if someone logs out and back in again.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* XXX: A descriptor list based search would be faster although
|
||||
* 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);
|
||||
else {
|
||||
char *backstr = NULL;
|
||||
|
||||
|
||||
/* Something on it, display it as that's in input buffer. */
|
||||
if (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, "%s", paper->action_description);
|
||||
}
|
||||
|
||||
|
||||
/* we can write - hooray! */
|
||||
act("$n begins to jot down a note.", TRUE, ch, 0, 0, TO_ROOM);
|
||||
send_editor_help(ch->desc);
|
||||
|
|
@ -483,9 +483,9 @@ ACMD(do_gen_comm)
|
|||
do_gmote(ch, argument + 1, 0, 1);
|
||||
else
|
||||
do_gmote(ch, argument, 0, 1);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/* level_can_shout defined in config.c */
|
||||
if (GET_LEVEL(ch) < CONFIG_LEVEL_CAN_SHOUT) {
|
||||
|
|
@ -526,13 +526,13 @@ ACMD(do_gen_comm)
|
|||
/* now send all the strings out */
|
||||
for (i = descriptor_list; i; i = i->next) {
|
||||
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))
|
||||
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;
|
||||
|
||||
|
||||
if (subcmd == SCMD_SHOUT &&
|
||||
((world[IN_ROOM(ch)].zone != world[IN_ROOM(i->character)].zone) ||
|
||||
!AWAKE(i->character)))
|
||||
|
|
@ -595,7 +595,7 @@ void free_hist_messg(struct descriptor_data *d)
|
|||
}
|
||||
d->comms = NULL;
|
||||
}
|
||||
|
||||
|
||||
void new_hist_messg(struct descriptor_data *d, const char *msg)
|
||||
{
|
||||
struct txt_block *tmp = d->comms;
|
||||
|
|
@ -609,10 +609,10 @@ void new_hist_messg(struct descriptor_data *d, const char *msg)
|
|||
tmp = tmp->next;
|
||||
CREATE(tmp->next, struct txt_block, 1);
|
||||
tmp->next->text = strdup(msg);
|
||||
|
||||
|
||||
for (tmp = d->comms; tmp ; tmp= tmp->next)
|
||||
l++;
|
||||
|
||||
|
||||
for (; l > HIST_LENGTH && d->comms; l--) {
|
||||
tmp = d->comms;
|
||||
d->comms = tmp->next;
|
||||
|
|
@ -629,16 +629,16 @@ ACMD(do_list_history)
|
|||
|
||||
if (!d)
|
||||
return;
|
||||
|
||||
|
||||
if (!d->comms) {
|
||||
write_to_output(d, "No communications in history.\r\n");
|
||||
return;
|
||||
}
|
||||
write_to_output(d, "Last %d communications:\r\n", HIST_LENGTH);
|
||||
|
||||
|
||||
for (tmp = d->comms;tmp;tmp = tmp->next)
|
||||
write_to_output(d, "%s%s%s", QWHT, tmp->text, QNRM);
|
||||
|
||||
|
||||
free_hist_messg(d);
|
||||
}
|
||||
|
||||
|
|
@ -647,18 +647,18 @@ void handle_webster_file(void) {
|
|||
struct char_data *ch = find_char(last_webster_teller);
|
||||
char info[MAX_STRING_LENGTH], line[READ_SIZE];
|
||||
size_t len = 0, nlen = 0;
|
||||
|
||||
|
||||
last_webster_teller = -1L;
|
||||
|
||||
if (!ch) /* they quit ? */
|
||||
return;
|
||||
|
||||
|
||||
fl = fopen("websterinfo", "r");
|
||||
if (!fl) {
|
||||
send_to_char(ch, "It seems Merriam-Webster is offline..\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
unlink("websterinfo");
|
||||
|
||||
get_line(fl, line);
|
||||
|
|
@ -669,7 +669,7 @@ void handle_webster_file(void) {
|
|||
len += nlen;
|
||||
get_line(fl, line);
|
||||
}
|
||||
|
||||
|
||||
if (len >= sizeof(info)) {
|
||||
const char *overflow = "\r\n**OVERFLOW**\r\n";
|
||||
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) {
|
||||
case SHOW_OBJ_LONG:
|
||||
/* 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;
|
||||
|
||||
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, "%s", CCGRN(ch, C_NRM));
|
||||
send_to_char(ch, "%s", obj->description);
|
||||
break;
|
||||
|
||||
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, "%s", obj->short_description);
|
||||
break;
|
||||
|
||||
|
|
@ -309,9 +309,9 @@ void list_one_char(struct char_data *i, struct char_data *ch)
|
|||
" 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] " : "");
|
||||
|
||||
|
||||
if (IS_NPC(i) && i->player.long_descr && GET_POS(i) == GET_DEFAULT_POS(i)) {
|
||||
if (AFF_FLAGGED(i, AFF_INVISIBLE))
|
||||
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));
|
||||
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] " : "",
|
||||
world[IN_ROOM(ch)].name, buf);
|
||||
} else
|
||||
|
|
@ -710,8 +710,8 @@ ACMD(do_look)
|
|||
|
||||
for (i = world[IN_ROOM(ch)].ex_description; i; i = i->next) {
|
||||
if (*i->keyword != '.') {
|
||||
send_to_char(ch, "%s%s:\r\n%s",
|
||||
(found ? "\r\n" : ""), i->keyword, i->description);
|
||||
send_to_char(ch, "%s%s:\r\n%s",
|
||||
(found ? "\r\n" : ""), i->keyword, i->description);
|
||||
found = 1;
|
||||
}
|
||||
}
|
||||
|
|
@ -1028,7 +1028,7 @@ int search_help(struct char_data *ch, char *argument)
|
|||
ACMD(do_help)
|
||||
{
|
||||
int mid = 0;
|
||||
|
||||
|
||||
if (!ch->desc)
|
||||
return;
|
||||
|
||||
|
|
@ -1048,14 +1048,14 @@ ACMD(do_help)
|
|||
}
|
||||
|
||||
space_to_minus(argument);
|
||||
mid = search_help(ch, argument);
|
||||
mid = search_help(ch, argument);
|
||||
|
||||
if (mid <= 0) {
|
||||
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);
|
||||
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))
|
||||
continue;
|
||||
/* 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"
|
||||
|
||||
/* Written by Rhade */
|
||||
ACMD(do_who)
|
||||
{
|
||||
struct descriptor_data *d;
|
||||
struct char_data *tch;
|
||||
int i, num_can_see = 0;
|
||||
char name_search[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH];
|
||||
char mode;
|
||||
int low = 0, high = LVL_IMPL, localwho = 0, questwho = 0;
|
||||
int showclass = 0, short_list = 0, outlaws = 0;
|
||||
ACMD(do_who)
|
||||
{
|
||||
struct descriptor_data *d;
|
||||
struct char_data *tch;
|
||||
int i, num_can_see = 0;
|
||||
char name_search[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH];
|
||||
char mode;
|
||||
int low = 0, high = LVL_IMPL, localwho = 0, questwho = 0;
|
||||
int showclass = 0, short_list = 0, outlaws = 0;
|
||||
int who_room = 0, showgroup = 0, showleader = 0;
|
||||
|
||||
skip_spaces(&argument);
|
||||
strcpy(buf, argument); /* strcpy: OK (sizeof: argument == buf) */
|
||||
name_search[0] = '\0';
|
||||
skip_spaces(&argument);
|
||||
strcpy(buf, argument); /* strcpy: OK (sizeof: argument == buf) */
|
||||
name_search[0] = '\0';
|
||||
|
||||
while (*buf) {
|
||||
char arg[MAX_INPUT_LENGTH], buf1[MAX_INPUT_LENGTH];
|
||||
while (*buf) {
|
||||
char arg[MAX_INPUT_LENGTH], buf1[MAX_INPUT_LENGTH];
|
||||
|
||||
half_chop(buf, arg, buf1);
|
||||
if (isdigit(*arg)) {
|
||||
sscanf(arg, "%d-%d", &low, &high);
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
} else if (*arg == '-') {
|
||||
mode = *(arg + 1); /* just in case; we destroy arg in the switch */
|
||||
switch (mode) {
|
||||
case 'k':
|
||||
outlaws = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
case 'z':
|
||||
localwho = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
case 's':
|
||||
short_list = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
case 'q':
|
||||
questwho = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
case 'n':
|
||||
half_chop(buf1, name_search, buf);
|
||||
break;
|
||||
case 'r':
|
||||
who_room = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
case 'c':
|
||||
half_chop(buf1, arg, buf);
|
||||
showclass = find_class_bitvector(arg);
|
||||
break;
|
||||
case 'l':
|
||||
showleader = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
case 'g':
|
||||
showgroup = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
default:
|
||||
send_to_char(ch, "%s", WHO_FORMAT);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
send_to_char(ch, "%s", WHO_FORMAT);
|
||||
return;
|
||||
}
|
||||
}
|
||||
half_chop(buf, arg, buf1);
|
||||
if (isdigit(*arg)) {
|
||||
sscanf(arg, "%d-%d", &low, &high);
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
} else if (*arg == '-') {
|
||||
mode = *(arg + 1); /* just in case; we destroy arg in the switch */
|
||||
switch (mode) {
|
||||
case 'k':
|
||||
outlaws = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
case 'z':
|
||||
localwho = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
case 's':
|
||||
short_list = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
case 'q':
|
||||
questwho = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
case 'n':
|
||||
half_chop(buf1, name_search, buf);
|
||||
break;
|
||||
case 'r':
|
||||
who_room = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
case 'c':
|
||||
half_chop(buf1, arg, buf);
|
||||
showclass = find_class_bitvector(arg);
|
||||
break;
|
||||
case 'l':
|
||||
showleader = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
case 'g':
|
||||
showgroup = 1;
|
||||
strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */
|
||||
break;
|
||||
default:
|
||||
send_to_char(ch, "%s", WHO_FORMAT);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
send_to_char(ch, "%s", WHO_FORMAT);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
struct {
|
||||
char *disp;
|
||||
int min_level;
|
||||
int max_level;
|
||||
int count; /* must always start as 0 */
|
||||
} rank[] = {
|
||||
{ "Immortals\r\n---------\r\n", LVL_IMMORT, LVL_IMPL, 0},
|
||||
{ "Mortals\r\n-------\r\n", 1, LVL_IMMORT - 1, 0 },
|
||||
{ "\n", 0, 0, 0 }
|
||||
};
|
||||
struct {
|
||||
char *disp;
|
||||
int min_level;
|
||||
int max_level;
|
||||
int count; /* must always start as 0 */
|
||||
} rank[] = {
|
||||
{ "Immortals\r\n---------\r\n", LVL_IMMORT, LVL_IMPL, 0},
|
||||
{ "Mortals\r\n-------\r\n", 1, LVL_IMMORT - 1, 0 },
|
||||
{ "\n", 0, 0, 0 }
|
||||
};
|
||||
|
||||
for (d = descriptor_list; d && !short_list; d = d->next) {
|
||||
if (d->original)
|
||||
tch = d->original;
|
||||
else if (!(tch = d->character))
|
||||
continue;
|
||||
for (d = descriptor_list; d && !short_list; d = d->next) {
|
||||
if (d->original)
|
||||
tch = d->original;
|
||||
else if (!(tch = d->character))
|
||||
continue;
|
||||
|
||||
if (CAN_SEE(ch, tch) && IS_PLAYING(d)) {
|
||||
if (*name_search && str_cmp(GET_NAME(tch), name_search) &&
|
||||
!strstr(GET_TITLE(tch), name_search))
|
||||
continue;
|
||||
if (!CAN_SEE(ch, tch) || GET_LEVEL(tch) < low || GET_LEVEL(tch) > high)
|
||||
continue;
|
||||
if (outlaws && !PLR_FLAGGED(tch, PLR_KILLER) && !PLR_FLAGGED(tch, PLR_THIEF))
|
||||
continue;
|
||||
if (questwho && !PRF_FLAGGED(tch, PRF_QUEST))
|
||||
continue;
|
||||
if (localwho && world[IN_ROOM(ch)].zone != world[IN_ROOM(tch)].zone)
|
||||
continue;
|
||||
if (who_room && (IN_ROOM(tch) != IN_ROOM(ch)))
|
||||
continue;
|
||||
if (showclass && !(showclass & (1 << GET_CLASS(tch))))
|
||||
continue;
|
||||
if (showgroup && (!tch->master || !AFF_FLAGGED(tch, AFF_GROUP)))
|
||||
continue;
|
||||
if (showleader && (!tch->followers || !AFF_FLAGGED(tch, AFF_GROUP)))
|
||||
continue;
|
||||
for (i = 0; *rank[i].disp != '\n'; i++)
|
||||
if (GET_LEVEL(tch) >= rank[i].min_level && GET_LEVEL(tch) <= rank[i].max_level)
|
||||
rank[i].count++;
|
||||
}
|
||||
}
|
||||
if (CAN_SEE(ch, tch) && IS_PLAYING(d)) {
|
||||
if (*name_search && str_cmp(GET_NAME(tch), name_search) &&
|
||||
!strstr(GET_TITLE(tch), name_search))
|
||||
continue;
|
||||
if (!CAN_SEE(ch, tch) || GET_LEVEL(tch) < low || GET_LEVEL(tch) > high)
|
||||
continue;
|
||||
if (outlaws && !PLR_FLAGGED(tch, PLR_KILLER) && !PLR_FLAGGED(tch, PLR_THIEF))
|
||||
continue;
|
||||
if (questwho && !PRF_FLAGGED(tch, PRF_QUEST))
|
||||
continue;
|
||||
if (localwho && world[IN_ROOM(ch)].zone != world[IN_ROOM(tch)].zone)
|
||||
continue;
|
||||
if (who_room && (IN_ROOM(tch) != IN_ROOM(ch)))
|
||||
continue;
|
||||
if (showclass && !(showclass & (1 << GET_CLASS(tch))))
|
||||
continue;
|
||||
if (showgroup && (!tch->master || !AFF_FLAGGED(tch, AFF_GROUP)))
|
||||
continue;
|
||||
if (showleader && (!tch->followers || !AFF_FLAGGED(tch, AFF_GROUP)))
|
||||
continue;
|
||||
for (i = 0; *rank[i].disp != '\n'; i++)
|
||||
if (GET_LEVEL(tch) >= rank[i].min_level && GET_LEVEL(tch) <= rank[i].max_level)
|
||||
rank[i].count++;
|
||||
}
|
||||
}
|
||||
|
||||
for (i = 0; *rank[i].disp != '\n'; i++) {
|
||||
if (!rank[i].count && !short_list)
|
||||
continue;
|
||||
for (i = 0; *rank[i].disp != '\n'; i++) {
|
||||
if (!rank[i].count && !short_list)
|
||||
continue;
|
||||
|
||||
if (short_list)
|
||||
send_to_char(ch, "Players\r\n-------\r\n");
|
||||
else
|
||||
send_to_char(ch, rank[i].disp);
|
||||
if (short_list)
|
||||
send_to_char(ch, "Players\r\n-------\r\n");
|
||||
else
|
||||
send_to_char(ch, rank[i].disp);
|
||||
|
||||
for (d = descriptor_list; d; d = d->next) {
|
||||
if (d->original)
|
||||
tch = d->original;
|
||||
else if (!(tch = d->character))
|
||||
continue;
|
||||
for (d = descriptor_list; d; d = d->next) {
|
||||
if (d->original)
|
||||
tch = d->original;
|
||||
else if (!(tch = d->character))
|
||||
continue;
|
||||
|
||||
if ((GET_LEVEL(tch) < rank[i].min_level || GET_LEVEL(tch) > rank[i].max_level) && !short_list)
|
||||
continue;
|
||||
if (!IS_PLAYING(d))
|
||||
continue;
|
||||
if (*name_search && str_cmp(GET_NAME(tch), name_search) &&
|
||||
!strstr(GET_TITLE(tch), name_search))
|
||||
continue;
|
||||
if (!CAN_SEE(ch, tch) || GET_LEVEL(tch) < low || GET_LEVEL(tch) > high)
|
||||
continue;
|
||||
if (outlaws && !PLR_FLAGGED(tch, PLR_KILLER) && !PLR_FLAGGED(tch, PLR_THIEF))
|
||||
continue;
|
||||
if (questwho && !PRF_FLAGGED(tch, PRF_QUEST))
|
||||
continue;
|
||||
if (localwho && world[IN_ROOM(ch)].zone != world[IN_ROOM(tch)].zone)
|
||||
continue;
|
||||
if (who_room && (IN_ROOM(tch) != IN_ROOM(ch)))
|
||||
continue;
|
||||
if (showclass && !(showclass & (1 << GET_CLASS(tch))))
|
||||
continue;
|
||||
if (showgroup && (!tch->master || !AFF_FLAGGED(tch, AFF_GROUP)))
|
||||
continue;
|
||||
if (showleader && (!tch->followers || !AFF_FLAGGED(tch, AFF_GROUP)))
|
||||
continue;
|
||||
if ((GET_LEVEL(tch) < rank[i].min_level || GET_LEVEL(tch) > rank[i].max_level) && !short_list)
|
||||
continue;
|
||||
if (!IS_PLAYING(d))
|
||||
continue;
|
||||
if (*name_search && str_cmp(GET_NAME(tch), name_search) &&
|
||||
!strstr(GET_TITLE(tch), name_search))
|
||||
continue;
|
||||
if (!CAN_SEE(ch, tch) || GET_LEVEL(tch) < low || GET_LEVEL(tch) > high)
|
||||
continue;
|
||||
if (outlaws && !PLR_FLAGGED(tch, PLR_KILLER) && !PLR_FLAGGED(tch, PLR_THIEF))
|
||||
continue;
|
||||
if (questwho && !PRF_FLAGGED(tch, PRF_QUEST))
|
||||
continue;
|
||||
if (localwho && world[IN_ROOM(ch)].zone != world[IN_ROOM(tch)].zone)
|
||||
continue;
|
||||
if (who_room && (IN_ROOM(tch) != IN_ROOM(ch)))
|
||||
continue;
|
||||
if (showclass && !(showclass & (1 << GET_CLASS(tch))))
|
||||
continue;
|
||||
if (showgroup && (!tch->master || !AFF_FLAGGED(tch, AFF_GROUP)))
|
||||
continue;
|
||||
if (showleader && (!tch->followers || !AFF_FLAGGED(tch, AFF_GROUP)))
|
||||
continue;
|
||||
|
||||
if (short_list) {
|
||||
send_to_char(ch, "%s[%2d %s] %-12.12s%s%s",
|
||||
(GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""),
|
||||
GET_LEVEL(tch), CLASS_ABBR(tch), GET_NAME(tch),
|
||||
CCNRM(ch, C_SPR), ((!(++num_can_see % 4)) ? "\r\n" : ""));
|
||||
} else {
|
||||
num_can_see++;
|
||||
send_to_char(ch, "%s[%2d %s] %s%s%s%s",
|
||||
(GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""),
|
||||
GET_LEVEL(tch), CLASS_ABBR(tch),
|
||||
GET_NAME(tch), (*GET_TITLE(tch) ? " " : ""), GET_TITLE(tch),
|
||||
CCNRM(ch, C_SPR));
|
||||
if (short_list) {
|
||||
send_to_char(ch, "%s[%2d %s] %-12.12s%s%s",
|
||||
(GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""),
|
||||
GET_LEVEL(tch), CLASS_ABBR(tch), GET_NAME(tch),
|
||||
CCNRM(ch, C_SPR), ((!(++num_can_see % 4)) ? "\r\n" : ""));
|
||||
} else {
|
||||
num_can_see++;
|
||||
send_to_char(ch, "%s[%2d %s] %s%s%s%s",
|
||||
(GET_LEVEL(tch) >= LVL_IMMORT ? CCYEL(ch, C_SPR) : ""),
|
||||
GET_LEVEL(tch), CLASS_ABBR(tch),
|
||||
GET_NAME(tch), (*GET_TITLE(tch) ? " " : ""), GET_TITLE(tch),
|
||||
CCNRM(ch, C_SPR));
|
||||
|
||||
if (GET_INVIS_LEV(tch))
|
||||
send_to_char(ch, " (i%d)", GET_INVIS_LEV(tch));
|
||||
else if (AFF_FLAGGED(tch, AFF_INVISIBLE))
|
||||
send_to_char(ch, " (invis)");
|
||||
if (GET_INVIS_LEV(tch))
|
||||
send_to_char(ch, " (i%d)", GET_INVIS_LEV(tch));
|
||||
else if (AFF_FLAGGED(tch, AFF_INVISIBLE))
|
||||
send_to_char(ch, " (invis)");
|
||||
|
||||
if (PLR_FLAGGED(tch, PLR_MAILING))
|
||||
send_to_char(ch, " (mailing)");
|
||||
else if (d->olc)
|
||||
send_to_char(ch, " (OLC)");
|
||||
else if (PLR_FLAGGED(tch, PLR_WRITING))
|
||||
send_to_char(ch, " (writing)");
|
||||
if (PLR_FLAGGED(tch, PLR_MAILING))
|
||||
send_to_char(ch, " (mailing)");
|
||||
else if (d->olc)
|
||||
send_to_char(ch, " (OLC)");
|
||||
else if (PLR_FLAGGED(tch, PLR_WRITING))
|
||||
send_to_char(ch, " (writing)");
|
||||
|
||||
if (d->original)
|
||||
send_to_char(ch, " (out of body)");
|
||||
if (d->original)
|
||||
send_to_char(ch, " (out of body)");
|
||||
|
||||
if (d->connected == CON_OEDIT)
|
||||
send_to_char(ch, " (Object Edit)");
|
||||
if (d->connected == CON_MEDIT)
|
||||
send_to_char(ch, " (Mobile Edit)");
|
||||
if (d->connected == CON_ZEDIT)
|
||||
send_to_char(ch, " (Zone Edit)");
|
||||
if (d->connected == CON_SEDIT)
|
||||
send_to_char(ch, " (Shop Edit)");
|
||||
if (d->connected == CON_REDIT)
|
||||
send_to_char(ch, " (Room Edit)");
|
||||
if (d->connected == CON_TEDIT)
|
||||
send_to_char(ch, " (Text Edit)");
|
||||
if (d->connected == CON_TRIGEDIT)
|
||||
send_to_char(ch, " (Trigger Edit)");
|
||||
if (d->connected == CON_AEDIT)
|
||||
send_to_char(ch, " (Social Edit)");
|
||||
if (d->connected == CON_CEDIT)
|
||||
send_to_char(ch, " (Configuration Edit)");
|
||||
if (d->connected == CON_HEDIT)
|
||||
send_to_char(ch, " (Help edit)");
|
||||
if (d->connected == CON_OEDIT)
|
||||
send_to_char(ch, " (Object Edit)");
|
||||
if (d->connected == CON_MEDIT)
|
||||
send_to_char(ch, " (Mobile Edit)");
|
||||
if (d->connected == CON_ZEDIT)
|
||||
send_to_char(ch, " (Zone Edit)");
|
||||
if (d->connected == CON_SEDIT)
|
||||
send_to_char(ch, " (Shop Edit)");
|
||||
if (d->connected == CON_REDIT)
|
||||
send_to_char(ch, " (Room Edit)");
|
||||
if (d->connected == CON_TEDIT)
|
||||
send_to_char(ch, " (Text Edit)");
|
||||
if (d->connected == CON_TRIGEDIT)
|
||||
send_to_char(ch, " (Trigger Edit)");
|
||||
if (d->connected == CON_AEDIT)
|
||||
send_to_char(ch, " (Social Edit)");
|
||||
if (d->connected == CON_CEDIT)
|
||||
send_to_char(ch, " (Configuration Edit)");
|
||||
if (d->connected == CON_HEDIT)
|
||||
send_to_char(ch, " (Help edit)");
|
||||
|
||||
if (PRF_FLAGGED(tch, PRF_BUILDWALK))
|
||||
send_to_char(ch, " (Buildwalking)");
|
||||
if (PRF_FLAGGED(tch, PRF_BUILDWALK))
|
||||
send_to_char(ch, " (Buildwalking)");
|
||||
if (PRF_FLAGGED(tch, PRF_AFK))
|
||||
send_to_char(ch, " (AFK)");
|
||||
if (PRF_FLAGGED(ch, PRF_NOGOSS))
|
||||
send_to_char(ch, " (nogos)");
|
||||
if (PRF_FLAGGED(ch, PRF_NOWIZ))
|
||||
send_to_char(ch, " (nowiz)");
|
||||
if (PRF_FLAGGED(tch, PRF_NOSHOUT))
|
||||
send_to_char(ch, " (noshout)");
|
||||
if (PRF_FLAGGED(tch, PRF_NOTELL))
|
||||
send_to_char(ch, " (notell)");
|
||||
if (PRF_FLAGGED(tch, PRF_QUEST))
|
||||
send_to_char(ch, " (quest)");
|
||||
if (PLR_FLAGGED(tch, PLR_THIEF))
|
||||
send_to_char(ch, " (THIEF)");
|
||||
if (PLR_FLAGGED(tch, PLR_KILLER))
|
||||
send_to_char(ch, " (KILLER)");
|
||||
send_to_char(ch, "\r\n");
|
||||
}
|
||||
}
|
||||
send_to_char(ch, "\r\n");
|
||||
if (short_list)
|
||||
break;
|
||||
}
|
||||
if (short_list && num_can_see % 4)
|
||||
send_to_char(ch, "\r\n");
|
||||
if (!num_can_see)
|
||||
send_to_char(ch, "Nobody at all!\r\n");
|
||||
else if (num_can_see == 1)
|
||||
send_to_char(ch, "One lonely character displayed.\r\n");
|
||||
else
|
||||
send_to_char(ch, "%d characters displayed.\r\n", num_can_see);
|
||||
if (PRF_FLAGGED(ch, PRF_NOGOSS))
|
||||
send_to_char(ch, " (nogos)");
|
||||
if (PRF_FLAGGED(ch, PRF_NOWIZ))
|
||||
send_to_char(ch, " (nowiz)");
|
||||
if (PRF_FLAGGED(tch, PRF_NOSHOUT))
|
||||
send_to_char(ch, " (noshout)");
|
||||
if (PRF_FLAGGED(tch, PRF_NOTELL))
|
||||
send_to_char(ch, " (notell)");
|
||||
if (PRF_FLAGGED(tch, PRF_QUEST))
|
||||
send_to_char(ch, " (quest)");
|
||||
if (PLR_FLAGGED(tch, PLR_THIEF))
|
||||
send_to_char(ch, " (THIEF)");
|
||||
if (PLR_FLAGGED(tch, PLR_KILLER))
|
||||
send_to_char(ch, " (KILLER)");
|
||||
send_to_char(ch, "\r\n");
|
||||
}
|
||||
}
|
||||
send_to_char(ch, "\r\n");
|
||||
if (short_list)
|
||||
break;
|
||||
}
|
||||
if (short_list && num_can_see % 4)
|
||||
send_to_char(ch, "\r\n");
|
||||
if (!num_can_see)
|
||||
send_to_char(ch, "Nobody at all!\r\n");
|
||||
else if (num_can_see == 1)
|
||||
send_to_char(ch, "One lonely character displayed.\r\n");
|
||||
else
|
||||
send_to_char(ch, "%d characters displayed.\r\n", num_can_see);
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -1766,17 +1766,17 @@ ACMD(do_toggle)
|
|||
strcpy(buf2, "OFF"); /* strcpy: OK */
|
||||
else
|
||||
sprintf(buf2, "%-3.3d", GET_WIMP_LEV(ch)); /* sprintf: OK */
|
||||
|
||||
|
||||
if (GET_LEVEL(ch) == LVL_IMPL) {
|
||||
send_to_char(ch,
|
||||
" SlowNameserver: %-3s "
|
||||
" "
|
||||
" Trackthru Doors: %-3s\r\n",
|
||||
" Trackthru Doors: %-3s\r\n",
|
||||
|
||||
ONOFF(CONFIG_NS_IS_SLOW),
|
||||
ONOFF(CONFIG_TRACK_T_DOORS));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (GET_LEVEL(ch) >= LVL_IMMORT) {
|
||||
send_to_char(ch,
|
||||
" Buildwalk: %-3s "
|
||||
|
|
@ -1931,7 +1931,7 @@ ACMD(do_toggle)
|
|||
return;
|
||||
}
|
||||
|
||||
switch (toggle) {
|
||||
switch (toggle) {
|
||||
case SCMD_COLOR:
|
||||
if (!*arg2) {
|
||||
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]);
|
||||
return;
|
||||
case SCMD_SYSLOG:
|
||||
if (!*arg2) {
|
||||
if (!*arg2) {
|
||||
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)]);
|
||||
return;
|
||||
return;
|
||||
}
|
||||
if (((tp = search_block(arg2, types, FALSE)) == -1)) {
|
||||
send_to_char(ch, "Usage: syslog { Off | Brief | Normal | On }\r\n");
|
||||
return;
|
||||
return;
|
||||
}
|
||||
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]);
|
||||
return;
|
||||
case SCMD_SLOWNS:
|
||||
|
|
@ -2020,7 +2020,7 @@ ACMD(do_toggle)
|
|||
else if (is_number(arg2)) {
|
||||
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));
|
||||
} else
|
||||
} else
|
||||
send_to_char(ch, "Please specify a number of lines (5 - 255).\r\n");
|
||||
break;
|
||||
default:
|
||||
|
|
@ -2047,7 +2047,7 @@ ACMD(do_toggle)
|
|||
|
||||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 (IS_CARRYING_N(ch) >= CAN_CARRY_N(ch))
|
||||
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_to_char(obj, ch);
|
||||
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)
|
||||
{
|
||||
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_to_char(obj, ch);
|
||||
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))
|
||||
return 0;
|
||||
|
||||
|
||||
if ((mode == SCMD_DROP) && !drop_wtrigger(obj, ch))
|
||||
return 0;
|
||||
|
||||
|
|
@ -512,7 +512,7 @@ ACMD(do_drop)
|
|||
byte mode = SCMD_DROP;
|
||||
int dotmode, amount = 0, multi, num_don_rooms;
|
||||
const char *sname;
|
||||
|
||||
|
||||
switch (subcmd) {
|
||||
case SCMD_JUNK:
|
||||
sname = "junk";
|
||||
|
|
@ -522,9 +522,9 @@ ACMD(do_drop)
|
|||
sname = "donate";
|
||||
mode = SCMD_DONATE;
|
||||
/* 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_3 != NOWHERE) + 1 ;
|
||||
(CONFIG_DON_ROOM_3 != NOWHERE) + 1 ;
|
||||
switch (rand_number(0, num_don_rooms)) {
|
||||
case 0:
|
||||
mode = SCMD_JUNK;
|
||||
|
|
@ -621,7 +621,7 @@ ACMD(do_drop)
|
|||
void perform_give(struct char_data *ch, struct char_data *vict,
|
||||
struct obj_data *obj)
|
||||
{
|
||||
if (!give_otrigger(obj, ch, vict))
|
||||
if (!give_otrigger(obj, ch, vict))
|
||||
return;
|
||||
if (!receive_mtrigger(vict, ch, obj))
|
||||
return;
|
||||
|
|
@ -716,7 +716,7 @@ ACMD(do_give)
|
|||
send_to_char(ch, "What do you want to give %d of?\r\n", amount);
|
||||
else if (!(vict = give_find_vict(ch, argument)))
|
||||
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);
|
||||
else {
|
||||
while (obj && amount--) {
|
||||
|
|
@ -895,10 +895,10 @@ ACMD(do_drink)
|
|||
send_to_char(ch, "It's empty.\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!consume_otrigger(temp, ch, OCMD_DRINK)) /* check trigger */
|
||||
return;
|
||||
|
||||
|
||||
if (subcmd == SCMD_DRINK) {
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ int has_boat(struct char_data *ch)
|
|||
return (0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* do_simple_move assumes
|
||||
* 1. That there is no master and no followers.
|
||||
|
|
|
|||
|
|
@ -71,7 +71,7 @@ ACMD(do_assist)
|
|||
else if (!CAN_SEE(ch, opponent))
|
||||
act("You can't see who is fighting $M!", FALSE, ch, 0, helpee, TO_CHAR);
|
||||
/* 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,
|
||||
ch, 0, opponent, TO_CHAR);
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -232,7 +232,7 @@ ACMD(do_steal)
|
|||
send_to_char(ch, "Steal the equipment now? Impossible!\r\n");
|
||||
return;
|
||||
} else {
|
||||
if (!give_otrigger(obj, vict, ch) ||
|
||||
if (!give_otrigger(obj, vict, ch) ||
|
||||
!receive_mtrigger(ch, vict, obj) ) {
|
||||
send_to_char(ch, "Impossible!\r\n");
|
||||
return;
|
||||
|
|
@ -253,7 +253,7 @@ ACMD(do_steal)
|
|||
act("$n tries to steal something from $N.", TRUE, ch, 0, vict, TO_NOTVICT);
|
||||
} else { /* Steal the item */
|
||||
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) ) {
|
||||
send_to_char(ch, "Impossible!\r\n");
|
||||
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("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);
|
||||
|
||||
|
||||
if (!AFF_FLAGGED(tch, AFF_CHARM))
|
||||
stop_follower(tch);
|
||||
}
|
||||
|
|
@ -901,12 +901,12 @@ ACMD(do_gen_tog)
|
|||
break;
|
||||
case SCMD_BUILDWALK:
|
||||
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;
|
||||
}
|
||||
result = PRF_TOG_CHK(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));
|
||||
else
|
||||
mudlog(CMP, GET_LEVEL(ch), TRUE,
|
||||
|
|
@ -991,7 +991,7 @@ ACMD(do_file)
|
|||
req_lines = 15; /* default is the last 15 lines */
|
||||
else
|
||||
req_lines = atoi(value);
|
||||
|
||||
|
||||
if (!(req_file=fopen(fields[l].file,"r"))) {
|
||||
mudlog(BRF, LVL_IMPL, TRUE,
|
||||
"SYSERR: Error opening file %s using 'file' command.",
|
||||
|
|
@ -1007,7 +1007,7 @@ ACMD(do_file)
|
|||
rewind(req_file);
|
||||
|
||||
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);
|
||||
|
||||
get_line(req_file,line);
|
||||
|
|
|
|||
|
|
@ -58,7 +58,7 @@ ACMD(do_action)
|
|||
return;
|
||||
}
|
||||
|
||||
if (!action->char_found)
|
||||
if (!action->char_found)
|
||||
*arg = '\0';
|
||||
|
||||
if (action->char_found && argument)
|
||||
|
|
@ -82,8 +82,8 @@ ACMD(do_action)
|
|||
else
|
||||
send_to_char(ch, "I don't see anything by that name here.\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (vict == ch) {
|
||||
if (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.");
|
||||
act(action->others_auto, action->hide, ch, 0, 0, TO_ROOM);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
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);
|
||||
else {
|
||||
|
|
@ -165,7 +165,7 @@ void create_command_list(void)
|
|||
extern struct command_info cmd_info[];
|
||||
|
||||
/* free up old command list */
|
||||
if (complete_cmd_info)
|
||||
if (complete_cmd_info)
|
||||
free_command_list();
|
||||
|
||||
/* re check the sort on the socials */
|
||||
|
|
@ -193,7 +193,7 @@ void create_command_list(void)
|
|||
j = 0;
|
||||
k = 0;
|
||||
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))
|
||||
complete_cmd_info[k++] = cmd_info[i++];
|
||||
else {
|
||||
|
|
@ -215,30 +215,30 @@ void create_command_list(void)
|
|||
log("Command info rebuilt, %d total commands.", k);
|
||||
}
|
||||
|
||||
void free_command_list(void)
|
||||
void free_command_list(void)
|
||||
{
|
||||
int 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].sort_as);
|
||||
free(complete_cmd_info);
|
||||
complete_cmd_info = NULL;
|
||||
}
|
||||
|
||||
void free_social_messages(void)
|
||||
void free_social_messages(void)
|
||||
{
|
||||
struct social_messg *mess;
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0;i <= top_of_socialt;i++) {
|
||||
mess = &soc_mess_list[i];
|
||||
free_action(mess);
|
||||
}
|
||||
free(soc_mess_list);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void free_action(struct social_messg *mess) {
|
||||
if (mess->command) free(mess->command);
|
||||
|
|
@ -303,7 +303,7 @@ ACMD(do_gmote)
|
|||
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");
|
||||
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];
|
||||
struct descriptor_data *d;
|
||||
int i;
|
||||
|
||||
|
||||
if (CONFIG_NEW_SOCIALS == 0) {
|
||||
send_to_char(ch, "Socials cannot be edited at the moment.\r\n");
|
||||
return;
|
||||
|
|
@ -65,7 +65,7 @@ ACMD(do_oasis_aedit)
|
|||
}
|
||||
|
||||
one_argument(argument, arg);
|
||||
|
||||
|
||||
if (!*arg) {
|
||||
send_to_char(ch, "Please specify a social to edit.\r\n");
|
||||
return;
|
||||
|
|
@ -80,7 +80,7 @@ ACMD(do_oasis_aedit)
|
|||
send_to_char(ch, "Done.\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Give descriptor an OLC structure.
|
||||
*/
|
||||
|
|
@ -92,8 +92,8 @@ ACMD(do_oasis_aedit)
|
|||
|
||||
OLC_NUM(d) = 0;
|
||||
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))
|
||||
break;
|
||||
|
||||
|
|
@ -182,11 +182,11 @@ void aedit_setup_existing(struct descriptor_data *d, int real_num) {
|
|||
}
|
||||
|
||||
|
||||
|
||||
|
||||
void aedit_save_internally(struct descriptor_data *d) {
|
||||
struct social_messg *new_soc_mess_list = NULL;
|
||||
int i;
|
||||
|
||||
|
||||
/* add a new social into the list */
|
||||
if (OLC_ZNUM(d) > top_of_socialt) {
|
||||
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].others_obj_found)?soc_mess_list[i].others_obj_found:"#"));
|
||||
}
|
||||
|
||||
|
||||
fprintf(fp, "$\n");
|
||||
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;
|
||||
|
||||
get_char_colors(ch);
|
||||
|
||||
write_to_output(d,
|
||||
|
||||
write_to_output(d,
|
||||
"%s-- Action editor\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"
|
||||
|
|
@ -344,7 +344,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
switch (*arg) {
|
||||
case 'y': case 'Y':
|
||||
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);
|
||||
|
||||
/* 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':
|
||||
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;
|
||||
|
||||
if (OLC_ZNUM(d) > top_of_socialt) {
|
||||
|
|
@ -392,7 +392,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
break;
|
||||
default:
|
||||
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);
|
||||
break;
|
||||
}
|
||||
|
|
@ -408,7 +408,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
break;
|
||||
default:
|
||||
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));
|
||||
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");
|
||||
for (i=POS_DEAD;i<=POS_STANDING;i++)
|
||||
write_to_output(d, " %d) %s\r\n", i, position_types[i]);
|
||||
|
||||
|
||||
write_to_output(d, "Enter choice: ");
|
||||
OLC_MODE(d) = AEDIT_MIN_CHAR_POS;
|
||||
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");
|
||||
for (i=POS_DEAD;i<=POS_STANDING;i++)
|
||||
write_to_output(d, " %d) %s\r\n", i, position_types[i]);
|
||||
|
||||
|
||||
write_to_output(d, "Enter choice: ");
|
||||
OLC_MODE(d) = AEDIT_MIN_VICT_POS;
|
||||
return;
|
||||
|
|
@ -475,7 +475,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
"[OLD]: %s\r\n"
|
||||
"[NEW]: ",
|
||||
((OLC_ACTION(d)->not_found)?OLC_ACTION(d)->not_found:"NULL"));
|
||||
|
||||
|
||||
OLC_MODE(d) = AEDIT_VICT_NOT_FOUND;
|
||||
return;
|
||||
case 'd': case 'D':
|
||||
|
|
@ -483,7 +483,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
"[OLD]: %s\r\n"
|
||||
"[NEW]: ",
|
||||
((OLC_ACTION(d)->char_auto)?OLC_ACTION(d)->char_auto:"NULL"));
|
||||
|
||||
|
||||
OLC_MODE(d) = AEDIT_SELF_CHAR;
|
||||
return;
|
||||
case 'e': case 'E':
|
||||
|
|
@ -491,7 +491,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
"[OLD]: %s\r\n"
|
||||
"[NEW]: ",
|
||||
((OLC_ACTION(d)->others_auto)?OLC_ACTION(d)->others_auto:"NULL"));
|
||||
|
||||
|
||||
OLC_MODE(d) = AEDIT_SELF_OTHERS;
|
||||
return;
|
||||
case 'f': case 'F':
|
||||
|
|
@ -499,7 +499,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
"[OLD]: %s\r\n"
|
||||
"[NEW]: ",
|
||||
((OLC_ACTION(d)->char_found)?OLC_ACTION(d)->char_found:"NULL"));
|
||||
|
||||
|
||||
OLC_MODE(d) = AEDIT_VICT_CHAR_FOUND;
|
||||
return;
|
||||
case 'g': case 'G':
|
||||
|
|
@ -507,7 +507,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
"[OLD]: %s\r\n"
|
||||
"[NEW]: ",
|
||||
((OLC_ACTION(d)->others_found)?OLC_ACTION(d)->others_found:"NULL"));
|
||||
|
||||
|
||||
OLC_MODE(d) = AEDIT_VICT_OTHERS_FOUND;
|
||||
return;
|
||||
case 'h': case 'H':
|
||||
|
|
@ -515,7 +515,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
"[OLD]: %s\r\n"
|
||||
"[NEW]: ",
|
||||
((OLC_ACTION(d)->vict_found)?OLC_ACTION(d)->vict_found:"NULL"));
|
||||
|
||||
|
||||
OLC_MODE(d) = AEDIT_VICT_VICT_FOUND;
|
||||
return;
|
||||
case 'i': case 'I':
|
||||
|
|
@ -523,7 +523,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
"[OLD]: %s\r\n"
|
||||
"[NEW]: ",
|
||||
((OLC_ACTION(d)->char_body_found)?OLC_ACTION(d)->char_body_found:"NULL"));
|
||||
|
||||
|
||||
OLC_MODE(d) = AEDIT_VICT_CHAR_BODY_FOUND;
|
||||
return;
|
||||
case 'j': case 'J':
|
||||
|
|
@ -531,7 +531,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
"[OLD]: %s\r\n"
|
||||
"[NEW]: ",
|
||||
((OLC_ACTION(d)->others_body_found)?OLC_ACTION(d)->others_body_found:"NULL"));
|
||||
|
||||
|
||||
OLC_MODE(d) = AEDIT_VICT_OTHERS_BODY_FOUND;
|
||||
return;
|
||||
case 'k': case 'K':
|
||||
|
|
@ -539,7 +539,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
"[OLD]: %s\r\n"
|
||||
"[NEW]: ",
|
||||
((OLC_ACTION(d)->vict_body_found)?OLC_ACTION(d)->vict_body_found:"NULL"));
|
||||
|
||||
|
||||
OLC_MODE(d) = AEDIT_VICT_VICT_BODY_FOUND;
|
||||
return;
|
||||
case 'l': case 'L':
|
||||
|
|
@ -547,7 +547,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
"[OLD]: %s\r\n"
|
||||
"[NEW]: ",
|
||||
((OLC_ACTION(d)->char_obj_found)?OLC_ACTION(d)->char_obj_found:"NULL"));
|
||||
|
||||
|
||||
OLC_MODE(d) = AEDIT_OBJ_CHAR_FOUND;
|
||||
return;
|
||||
case 'm': case 'M':
|
||||
|
|
@ -555,7 +555,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
"[OLD]: %s\r\n"
|
||||
"[NEW]: ",
|
||||
((OLC_ACTION(d)->others_obj_found)?OLC_ACTION(d)->others_obj_found:"NULL"));
|
||||
|
||||
|
||||
OLC_MODE(d) = AEDIT_OBJ_OTHERS_FOUND;
|
||||
return;
|
||||
default:
|
||||
|
|
@ -563,12 +563,12 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
break;
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
case AEDIT_ACTION_NAME:
|
||||
if (!*arg || strchr(arg,' ')) {
|
||||
aedit_disp_menu(d);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (OLC_ACTION(d)->command)
|
||||
free(OLC_ACTION(d)->command);
|
||||
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)) {
|
||||
aedit_disp_menu(d);
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (OLC_MODE(d) == AEDIT_MIN_CHAR_POS)
|
||||
OLC_ACTION(d)->min_char_position = i;
|
||||
else
|
||||
OLC_ACTION(d)->min_victim_position = i;
|
||||
break;
|
||||
|
||||
|
||||
case AEDIT_MIN_CHAR_LEVEL:
|
||||
if (!*arg) {
|
||||
aedit_disp_menu(d);
|
||||
|
|
@ -622,7 +622,7 @@ void aedit_parse(struct descriptor_data * d, char *arg) {
|
|||
if (*arg) {
|
||||
delete_doubledollar(arg);
|
||||
OLC_ACTION(d)->char_no_arg = strdup(arg);
|
||||
} else
|
||||
} else
|
||||
OLC_ACTION(d)->char_no_arg = NULL;
|
||||
break;
|
||||
|
||||
|
|
@ -782,7 +782,7 @@ ACMD(do_astat)
|
|||
}
|
||||
|
||||
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"
|
||||
"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"
|
||||
|
|
@ -822,13 +822,13 @@ ACMD(do_astat)
|
|||
|
||||
}
|
||||
|
||||
int aedit_find_command(const char *txt)
|
||||
int aedit_find_command(const char *txt)
|
||||
{
|
||||
int cmd;
|
||||
|
||||
for (cmd = 1; *complete_cmd_info[cmd].command != '\n'; cmd++)
|
||||
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 (-1);
|
||||
}
|
||||
|
|
|
|||
34
src/alias.c
34
src/alias.c
|
|
@ -53,12 +53,12 @@ void write_aliases(struct char_data *ch)
|
|||
repllen, temp->replacement + 1,
|
||||
temp->type);
|
||||
}
|
||||
|
||||
|
||||
fclose(file);
|
||||
}
|
||||
|
||||
void read_aliases(struct char_data *ch)
|
||||
{
|
||||
{
|
||||
FILE *file;
|
||||
char xbuf[MAX_STRING_LENGTH];
|
||||
struct alias_data *t2, *prev = NULL;
|
||||
|
|
@ -77,9 +77,9 @@ void read_aliases(struct char_data *ch)
|
|||
}
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
CREATE(GET_ALIASES(ch), struct alias_data, 1);
|
||||
t2 = GET_ALIASES(ch);
|
||||
t2 = GET_ALIASES(ch);
|
||||
|
||||
for (;;) {
|
||||
/* Read the aliased command. */
|
||||
|
|
@ -95,13 +95,13 @@ void read_aliases(struct char_data *ch)
|
|||
|
||||
*xbuf = ' '; /* Doesn't need terminated, fgets() will. */
|
||||
fgets(xbuf + 1, length + 1, file);
|
||||
t2->replacement = strdup(xbuf);
|
||||
t2->replacement = strdup(xbuf);
|
||||
|
||||
/* Figure out the alias type. */
|
||||
if (fscanf(file, "%d\n", &length) != 1)
|
||||
goto read_alias_error;
|
||||
|
||||
t2->type = length;
|
||||
t2->type = length;
|
||||
|
||||
if (feof(file))
|
||||
break;
|
||||
|
|
@ -109,7 +109,7 @@ void read_aliases(struct char_data *ch)
|
|||
CREATE(t2->next, struct alias_data, 1);
|
||||
prev = t2;
|
||||
t2 = t2->next;
|
||||
};
|
||||
};
|
||||
|
||||
fclose(file);
|
||||
return;
|
||||
|
|
@ -121,7 +121,7 @@ read_alias_error:
|
|||
if (prev)
|
||||
prev->next = NULL;
|
||||
fclose(file);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
count++;
|
||||
|
||||
|
||||
fprintf(file, "Alis: %d\n", count);
|
||||
// the +1 thing below is due to alias replacements having
|
||||
// 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 */
|
||||
"%d\n", /* Type */
|
||||
temp->alias,
|
||||
temp->replacement+1,
|
||||
temp->replacement+1,
|
||||
temp->type);
|
||||
}
|
||||
}
|
||||
|
||||
void read_aliases_ascii(FILE *file, struct char_data *ch, int count)
|
||||
{
|
||||
{
|
||||
int i;
|
||||
struct alias_data *temp;
|
||||
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;
|
||||
return; // no aliases in the list
|
||||
}
|
||||
|
||||
|
||||
for (i = 0; i < count; i++) {
|
||||
/* Read the aliased command. */
|
||||
get_line(file, abuf);
|
||||
|
|
@ -185,11 +185,11 @@ void read_aliases_ascii(FILE *file, struct char_data *ch, int count)
|
|||
/* Read the replacement. */
|
||||
get_line(file, tbuf);
|
||||
strcpy(rbuf, " ");
|
||||
strcat(rbuf, tbuf); // strcat: OK
|
||||
|
||||
strcat(rbuf, tbuf); // strcat: OK
|
||||
|
||||
/* read the type */
|
||||
get_line(file, tbuf);
|
||||
|
||||
|
||||
if (abuf && *abuf && tbuf && *tbuf && rbuf && *rbuf)
|
||||
{
|
||||
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);
|
||||
GET_ALIASES(ch) = temp;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -66,9 +66,9 @@
|
|||
* original. Also, there is now a builtin-test, just compile with:
|
||||
* gcc -DTEST_SNPRINTF -o snprintf snprintf.c -lm
|
||||
* and run snprintf for results.
|
||||
*
|
||||
*
|
||||
* 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.
|
||||
*
|
||||
* 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)
|
||||
|
||||
static void
|
||||
static void
|
||||
dopr(char *buffer, size_t maxlen, const char *format, va_list args);
|
||||
|
||||
static void
|
||||
fmtstr(char *buffer, size_t *currlen, size_t maxlen, char *value, int flags,
|
||||
static void
|
||||
fmtstr(char *buffer, size_t *currlen, size_t maxlen, char *value, int flags,
|
||||
int min, int max);
|
||||
|
||||
static void
|
||||
fmtint(char *buffer, size_t *currlen, size_t maxlen, long value, int base,
|
||||
static void
|
||||
fmtint(char *buffer, size_t *currlen, size_t maxlen, long value, int base,
|
||||
int min, int max, int flags);
|
||||
|
||||
static void
|
||||
fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
||||
static void
|
||||
fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
||||
int min, int max, int flags);
|
||||
|
||||
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)
|
||||
|
||||
|
||||
static void
|
||||
static void
|
||||
dopr(char *buffer, size_t maxlen, const char *format, va_list args)
|
||||
{
|
||||
char *strvalue;
|
||||
|
|
@ -162,18 +162,18 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args)
|
|||
int flags = 0;
|
||||
int cflags = 0;
|
||||
size_t currlen = 0;
|
||||
|
||||
|
||||
ch = *format++;
|
||||
|
||||
while (state != DP_S_DONE) {
|
||||
if ((ch == '\0') || (currlen >= maxlen))
|
||||
if ((ch == '\0') || (currlen >= maxlen))
|
||||
state = DP_S_DONE;
|
||||
|
||||
switch(state) {
|
||||
case DP_S_DEFAULT:
|
||||
if (ch == '%')
|
||||
if (ch == '%')
|
||||
state = DP_S_FLAGS;
|
||||
else
|
||||
else
|
||||
dopr_outch(buffer, &currlen, maxlen, ch);
|
||||
ch = *format++;
|
||||
break;
|
||||
|
|
@ -212,14 +212,14 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args)
|
|||
min = va_arg (args, int);
|
||||
ch = *format++;
|
||||
state = DP_S_DOT;
|
||||
} else
|
||||
} else
|
||||
state = DP_S_DOT;
|
||||
break;
|
||||
case DP_S_DOT:
|
||||
if (ch == '.') {
|
||||
state = DP_S_MAX;
|
||||
ch = *format++;
|
||||
} else
|
||||
} else
|
||||
state = DP_S_MOD;
|
||||
break;
|
||||
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);
|
||||
ch = *format++;
|
||||
state = DP_S_MOD;
|
||||
} else
|
||||
} else
|
||||
state = DP_S_MOD;
|
||||
break;
|
||||
case DP_S_MOD:
|
||||
|
|
@ -266,7 +266,7 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args)
|
|||
switch (ch) {
|
||||
case 'd':
|
||||
case 'i':
|
||||
if (cflags == DP_C_SHORT)
|
||||
if (cflags == DP_C_SHORT)
|
||||
value = va_arg(args, int);
|
||||
else if (cflags == DP_C_LONG)
|
||||
value = va_arg(args, long int);
|
||||
|
|
@ -343,7 +343,7 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args)
|
|||
break;
|
||||
case 's':
|
||||
strvalue = va_arg(args, char *);
|
||||
if (max < 0)
|
||||
if (max < 0)
|
||||
max = maxlen; /* ie, no max */
|
||||
fmtstr(buffer, &currlen, maxlen, strvalue, flags, min, max);
|
||||
break;
|
||||
|
|
@ -390,9 +390,9 @@ dopr(char *buffer, size_t maxlen, const char *format, va_list args)
|
|||
break; /* some picky compilers need this */
|
||||
}
|
||||
}
|
||||
if (currlen < maxlen - 1)
|
||||
if (currlen < maxlen - 1)
|
||||
buffer[currlen] = '\0';
|
||||
else
|
||||
else
|
||||
buffer[maxlen - 1] = '\0';
|
||||
}
|
||||
|
||||
|
|
@ -402,15 +402,15 @@ fmtstr(char *buffer, size_t *currlen, size_t maxlen,
|
|||
{
|
||||
int padlen, strln; /* amount to pad */
|
||||
int cnt = 0;
|
||||
|
||||
if (value == 0)
|
||||
|
||||
if (value == 0)
|
||||
value = "<NULL>";
|
||||
|
||||
for (strln = 0; value[strln]; ++strln); /* strlen */
|
||||
padlen = min - strln;
|
||||
if (padlen < 0)
|
||||
if (padlen < 0)
|
||||
padlen = 0;
|
||||
if (flags & DP_F_MINUS)
|
||||
if (flags & DP_F_MINUS)
|
||||
padlen = -padlen; /* Left Justify */
|
||||
|
||||
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) */
|
||||
|
||||
static void
|
||||
static void
|
||||
fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
||||
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 zpadlen = 0; /* amount to zero pad */
|
||||
int caps = 0;
|
||||
|
||||
|
||||
if (max < 0)
|
||||
max = 0;
|
||||
|
||||
|
|
@ -457,8 +457,8 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
|||
else if (flags & DP_F_SPACE)
|
||||
signvalue = ' ';
|
||||
}
|
||||
|
||||
if (flags & DP_F_UP)
|
||||
|
||||
if (flags & DP_F_UP)
|
||||
caps = 1; /* Should characters be upper case? */
|
||||
|
||||
do {
|
||||
|
|
@ -467,7 +467,7 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
|||
[uvalue % (unsigned)base];
|
||||
uvalue = (uvalue / (unsigned)base );
|
||||
} while (uvalue && (place < 20));
|
||||
if (place == 20)
|
||||
if (place == 20)
|
||||
place--;
|
||||
convert[place] = 0;
|
||||
|
||||
|
|
@ -481,7 +481,7 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
|||
zpadlen = MAX(zpadlen, spadlen);
|
||||
spadlen = 0;
|
||||
}
|
||||
if (flags & DP_F_MINUS)
|
||||
if (flags & DP_F_MINUS)
|
||||
spadlen = -spadlen; /* Left Justifty */
|
||||
|
||||
|
||||
|
|
@ -492,7 +492,7 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
|||
}
|
||||
|
||||
/* Sign */
|
||||
if (signvalue)
|
||||
if (signvalue)
|
||||
dopr_outch(buffer, currlen, maxlen, signvalue);
|
||||
|
||||
/* Zeros */
|
||||
|
|
@ -504,9 +504,9 @@ fmtint(char *buffer, size_t *currlen, size_t maxlen,
|
|||
}
|
||||
|
||||
/* Digits */
|
||||
while (place > 0)
|
||||
while (place > 0)
|
||||
dopr_outch(buffer, currlen, maxlen, convert[--place]);
|
||||
|
||||
|
||||
/* Left Justified spaces */
|
||||
while (spadlen < 0) {
|
||||
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)
|
||||
{
|
||||
long double result = 1;
|
||||
|
|
@ -523,11 +523,11 @@ pow10(int exp)
|
|||
result *= 10;
|
||||
exp--;
|
||||
}
|
||||
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
static long
|
||||
static long
|
||||
round(long double value)
|
||||
{
|
||||
long intpart = value;
|
||||
|
|
@ -539,8 +539,8 @@ round(long double value)
|
|||
return intpart;
|
||||
}
|
||||
|
||||
static void
|
||||
fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
||||
static void
|
||||
fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
||||
int min, int max, int flags)
|
||||
{
|
||||
char iconvert[20];
|
||||
|
|
@ -549,13 +549,13 @@ fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
|||
int iplace = 0;
|
||||
int fplace = 0;
|
||||
int padlen = 0; /* amount to pad */
|
||||
int zpadlen = 0;
|
||||
int zpadlen = 0;
|
||||
int caps = 0;
|
||||
long intpart;
|
||||
long fracpart;
|
||||
long double ufvalue;
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
* AIX manpage says the default is 0, but Solaris says the default
|
||||
* 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;
|
||||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
if (max > 9)
|
||||
|
|
@ -596,7 +596,7 @@ fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
|||
(caps? "0123456789ABCDEF":"0123456789abcdef")[intpart % 10];
|
||||
intpart = (intpart / 10);
|
||||
} while(intpart && (iplace < 20));
|
||||
if (iplace == 20)
|
||||
if (iplace == 20)
|
||||
iplace--;
|
||||
iconvert[iplace] = 0;
|
||||
|
||||
|
|
@ -606,18 +606,18 @@ fmtfp(char *buffer, size_t *currlen, size_t maxlen, long double fvalue,
|
|||
(caps? "0123456789ABCDEF":"0123456789abcdef")[fracpart % 10];
|
||||
fracpart = (fracpart / 10);
|
||||
} while(fracpart && (fplace < 20));
|
||||
if (fplace == 20)
|
||||
if (fplace == 20)
|
||||
fplace--;
|
||||
fconvert[fplace] = 0;
|
||||
|
||||
/* -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;
|
||||
if (zpadlen < 0)
|
||||
zpadlen = 0;
|
||||
if (padlen < 0)
|
||||
if (padlen < 0)
|
||||
padlen = 0;
|
||||
if (flags & DP_F_MINUS)
|
||||
if (flags & DP_F_MINUS)
|
||||
padlen = -padlen; /* Left Justifty */
|
||||
|
||||
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, ' ');
|
||||
--padlen;
|
||||
}
|
||||
if (signvalue)
|
||||
if (signvalue)
|
||||
dopr_outch(buffer, currlen, maxlen, signvalue);
|
||||
|
||||
while (iplace > 0)
|
||||
while (iplace > 0)
|
||||
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, '.');
|
||||
|
||||
while (fplace > 0)
|
||||
while (fplace > 0)
|
||||
dopr_outch(buffer, currlen, maxlen, fconvert[--fplace]);
|
||||
|
||||
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)
|
||||
{
|
||||
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) */
|
||||
|
||||
#ifndef HAVE_VSNPRINTF
|
||||
int
|
||||
int
|
||||
vsnprintf(char *str, size_t count, const char *fmt, va_list args)
|
||||
{
|
||||
str[0] = 0;
|
||||
|
|
@ -681,7 +681,7 @@ vsnprintf(char *str, size_t count, const char *fmt, va_list args)
|
|||
#endif /* !HAVE_VSNPRINTF */
|
||||
|
||||
#ifndef HAVE_SNPRINTF
|
||||
int
|
||||
int
|
||||
snprintf(char *str,size_t count,const char *fmt,...)
|
||||
{
|
||||
va_list ap;
|
||||
|
|
@ -694,7 +694,7 @@ snprintf(char *str,size_t count,const char *fmt,...)
|
|||
}
|
||||
|
||||
#ifdef TEST_SNPRINTF
|
||||
int
|
||||
int
|
||||
main(void)
|
||||
{
|
||||
#define LONG_STRING 1024
|
||||
|
|
@ -714,17 +714,17 @@ main(void)
|
|||
"%3.2f",
|
||||
NULL
|
||||
};
|
||||
double fp_nums[] = {
|
||||
-1.5,
|
||||
134.21,
|
||||
91340.2,
|
||||
341.1234,
|
||||
0203.9,
|
||||
0.96,
|
||||
0.996,
|
||||
0.9996,
|
||||
1.996,
|
||||
4.136,
|
||||
double fp_nums[] = {
|
||||
-1.5,
|
||||
134.21,
|
||||
91340.2,
|
||||
341.1234,
|
||||
0203.9,
|
||||
0.96,
|
||||
0.996,
|
||||
0.9996,
|
||||
1.996,
|
||||
4.136,
|
||||
0
|
||||
};
|
||||
char *int_fmt[] = {
|
||||
|
|
@ -754,7 +754,7 @@ main(void)
|
|||
sprintf (buf2, fp_fmt[x], fp_nums[y]);
|
||||
if (strcmp (buf1, buf2)) {
|
||||
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);
|
||||
fail++;
|
||||
}
|
||||
|
|
@ -767,7 +767,7 @@ main(void)
|
|||
sprintf(buf2, int_fmt[x], int_nums[y]);
|
||||
if (strcmp (buf1, buf2)) {
|
||||
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);
|
||||
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
|
||||
* this level, attempts to practice will say "You are already learned in
|
||||
* this area."
|
||||
*
|
||||
*
|
||||
* The second line controls the maximum percent gain in learnedness a
|
||||
* character is allowed per practice -- in other words, if the random
|
||||
* 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
|
||||
* die throw comes out below this number, the gain will be set up to
|
||||
* this number.
|
||||
*
|
||||
*
|
||||
* The fourth line simply sets whether the character knows 'spells'
|
||||
* or 'skills'. This does not affect anything except the message given
|
||||
* 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;
|
||||
default:
|
||||
log("SYSERR: Missing level for warrior paralyzation saving throw.");
|
||||
break;
|
||||
break;
|
||||
}
|
||||
case SAVING_ROD: /* Rods */
|
||||
switch (level) {
|
||||
|
|
@ -1886,7 +1886,7 @@ int level_exp(int chclass, int level)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
/*
|
||||
* Default titles of male characters.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
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;
|
||||
socket_t mother_desc;
|
||||
int log_this_messg;
|
||||
|
||||
|
||||
/* functions in this file */
|
||||
RETSIGTYPE reread_wizlists(int sig);
|
||||
RETSIGTYPE unrestrict_game(int sig);
|
||||
|
|
@ -261,7 +261,7 @@ int main(int argc, char **argv)
|
|||
CONFIG_CONFFILE = strdup(CONFIG_FILE);
|
||||
|
||||
load_config();
|
||||
|
||||
|
||||
port = CONFIG_DFLT_PORT;
|
||||
dir = CONFIG_DFLT_DIR;
|
||||
|
||||
|
|
@ -421,7 +421,7 @@ void copyover_recover()
|
|||
bool fOld;
|
||||
char name[MAX_INPUT_LENGTH];
|
||||
long pref;
|
||||
|
||||
|
||||
log ("Copyover recovery initiated");
|
||||
|
||||
fp = fopen (COPYOVER_FILE, "r");
|
||||
|
|
@ -433,8 +433,8 @@ void copyover_recover()
|
|||
}
|
||||
|
||||
/* In case something crashes - doesn't prevent reading */
|
||||
unlink (COPYOVER_FILE);
|
||||
|
||||
unlink (COPYOVER_FILE);
|
||||
|
||||
/* read boot_time - first line in file */
|
||||
fscanf(fp, "%ld\n", &boot_time);
|
||||
|
||||
|
|
@ -444,7 +444,7 @@ void copyover_recover()
|
|||
if (desc == -1)
|
||||
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) {
|
||||
close (desc); /* nope */
|
||||
continue;
|
||||
|
|
@ -479,7 +479,7 @@ void copyover_recover()
|
|||
/* Player file not found?! */
|
||||
if (!fOld) {
|
||||
write_to_descriptor (desc, "\n\rSomehow, your character was lost in the copyover. Sorry.\n\r");
|
||||
close_socket (d);
|
||||
close_socket (d);
|
||||
} else {
|
||||
write_to_descriptor (desc, "\n\rCopyover recovery complete.\n\r");
|
||||
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
|
||||
* calculate how long we took processing the previous iteration.
|
||||
*/
|
||||
|
||||
|
||||
gettimeofday(&before_sleep, (struct timezone *) 0); /* current 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
|
||||
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;
|
||||
int i;
|
||||
|
||||
|
||||
if (!txt || !strchr(txt, '@')) /* skip out if no color codes */
|
||||
return strlen(txt);
|
||||
|
||||
s = txt;
|
||||
CREATE(d, char, maxlen);
|
||||
p = d;
|
||||
|
||||
|
||||
for( ; *s && (d-p < maxlen); ) {
|
||||
/* no color code - just copy */
|
||||
if (*s != '@') {
|
||||
|
|
@ -1191,17 +1191,17 @@ size_t proc_colors(char *txt, size_t maxlen, int parse)
|
|||
*d++ = '@';
|
||||
}
|
||||
s++; /* skip to next (non-colorcode) char */
|
||||
continue;
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
/* parse the color code */
|
||||
for (i = 0; CCODE[i] != '!'; i++) { /* do we find it ? */
|
||||
if ((*s) == CCODE[i]) { /* if so :*/
|
||||
|
||||
|
||||
/* 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++;
|
||||
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
|
@ -1210,16 +1210,16 @@ size_t proc_colors(char *txt, size_t maxlen, int parse)
|
|||
* - Welcor
|
||||
*/
|
||||
s++;
|
||||
|
||||
|
||||
} /* for loop */
|
||||
|
||||
|
||||
/* make sure txt is NULL - terminated */
|
||||
d = '\0';
|
||||
strncpy(txt, p, maxlen-1);
|
||||
|
||||
|
||||
free(p);
|
||||
|
||||
|
||||
return strlen(txt);
|
||||
}
|
||||
|
||||
|
|
@ -1270,13 +1270,13 @@ char *make_prompt(struct descriptor_data *d)
|
|||
if (count >= 0)
|
||||
len += count;
|
||||
}
|
||||
|
||||
|
||||
if (PRF_FLAGGED(d->character, PRF_DISPMANA) && len < sizeof(prompt)) {
|
||||
count = snprintf(prompt + len, sizeof(prompt) - len, "%dM ", GET_MANA(d->character));
|
||||
if (count >= 0)
|
||||
len += count;
|
||||
}
|
||||
|
||||
|
||||
if (PRF_FLAGGED(d->character, PRF_DISPMOVE) && len < sizeof(prompt)) {
|
||||
count = snprintf(prompt + len, sizeof(prompt) - len, "%dV ", GET_MOVE(d->character));
|
||||
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)
|
||||
{
|
||||
struct txt_block *tmp;
|
||||
|
||||
|
||||
while (bufpool) {
|
||||
tmp = bufpool->next;
|
||||
if (bufpool->text)
|
||||
|
|
@ -1559,7 +1559,7 @@ int set_sendbuf(socket_t s)
|
|||
void init_descriptor (struct descriptor_data *newd, int desc)
|
||||
{
|
||||
static int last_desc = 0; /* last descriptor number */
|
||||
|
||||
|
||||
newd->descriptor = desc;
|
||||
newd->idle_tics = 0;
|
||||
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 */
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* write_to_descriptor takes a descriptor, and text to write to the
|
||||
* 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)
|
||||
{
|
||||
struct descriptor_data *temp;
|
||||
|
||||
|
||||
REMOVE_FROM_LIST(d, descriptor_list, next);
|
||||
CLOSE_SOCKET(d->descriptor);
|
||||
flush_queues(d);
|
||||
|
|
@ -2203,7 +2203,7 @@ void close_socket(struct descriptor_data *d)
|
|||
}
|
||||
|
||||
add_llog_entry(d->character, LAST_DISCONNECT);
|
||||
|
||||
|
||||
if (IS_PLAYING(d) || STATE(d) == CON_DISCONNECT) {
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
free_hist_messg(d);
|
||||
|
||||
|
||||
if (d->showstr_head)
|
||||
free(d->showstr_head);
|
||||
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;
|
||||
va_list args;
|
||||
int j;
|
||||
|
||||
|
||||
if (start > finish) {
|
||||
log("send_to_range passed start room value greater then finish.");
|
||||
return;
|
||||
}
|
||||
if (messg == NULL)
|
||||
return;
|
||||
|
||||
|
||||
for (j = 0; j < top_of_world; j++) {
|
||||
if (GET_ROOM_VNUM(j) >= start && GET_ROOM_VNUM(j) <= finish) {
|
||||
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) {
|
||||
write_to_output(to->desc, "%s", CAP(lbuf));
|
||||
if (log_this_messg)
|
||||
if (log_this_messg)
|
||||
new_hist_messg(to->desc, lbuf);
|
||||
}
|
||||
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.
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* 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.. */
|
||||
log_this_messg = IS_SET(type, LOG_MESSG);
|
||||
if (log_this_messg)
|
||||
REMOVE_BIT(type, LOG_MESSG);
|
||||
|
||||
REMOVE_BIT(type, LOG_MESSG);
|
||||
|
||||
if (type == TO_CHAR) {
|
||||
if (ch && SENDOK(ch))
|
||||
perform_act(str, ch, obj, vict_obj, ch);
|
||||
|
|
|
|||
|
|
@ -307,7 +307,7 @@ int max_bad_pws = 3;
|
|||
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
|
||||
* which is responsible for resolving numeric IP addresses to alphabetic names.
|
||||
* 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;
|
||||
|
||||
/*
|
||||
* 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,
|
||||
* which is in a different format than the stock socials file.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -14,7 +14,7 @@
|
|||
#include "structs.h"
|
||||
#include "interpreter.h" /* alias_data */
|
||||
|
||||
cpp_extern const char *circlemud_version =
|
||||
cpp_extern const char *circlemud_version =
|
||||
"tbaMUD, version 3.51";
|
||||
|
||||
cpp_extern const char *oasisolc_version =
|
||||
|
|
@ -806,7 +806,7 @@ const char *month_name[] = {
|
|||
|
||||
/* mob trigger types */
|
||||
const char *trig_types[] = {
|
||||
"Global",
|
||||
"Global",
|
||||
"Random",
|
||||
"Command",
|
||||
"Speech",
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ int find_context_trigedit(struct descriptor_data *d)
|
|||
{
|
||||
switch (OLC_MODE(d)) {
|
||||
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_NAME: return CONTEXT_TRIGEDIT_NAME;
|
||||
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)
|
||||
{
|
||||
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_DEL_TRIGGER:return CONTEXT_SCRIPT_DEL_TRIGGER;
|
||||
case SCRIPT_DEL_TRIGGER:return CONTEXT_SCRIPT_DEL_TRIGGER;
|
||||
default: return NOTHING;
|
||||
}
|
||||
}
|
||||
|
|
@ -218,13 +218,13 @@ int context_help(struct descriptor_data *d, char *arg)
|
|||
/* skip if context help isn't wanted */
|
||||
if (strncmp(arg, CONTEXT_HELP_STRING, strlen(CONTEXT_HELP_STRING)))
|
||||
return FALSE;
|
||||
|
||||
|
||||
tmp = one_argument(arg, actbuf); /* the totally useless 'help' string.. */
|
||||
skip_spaces(&tmp);
|
||||
|
||||
if (!*tmp)
|
||||
context = find_context(d);
|
||||
|
||||
|
||||
if (context != NOTHING && context < NUM_CONTEXTS && *context_help_list[context]) {
|
||||
if (*context_help_list[context] == FIND_HELP_CHAR) {
|
||||
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]);
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
strncpy(actbuf, tmp, sizeof(actbuf)-1);
|
||||
do_help(d->character, actbuf, 0, 0);
|
||||
return TRUE;
|
||||
|
|
@ -249,8 +249,8 @@ void boot_context_help(void) {
|
|||
/* init to 'no help' string */
|
||||
for (i=0;i < NUM_CONTEXTS;i++)
|
||||
context_help_list[i] = NO_HELP;
|
||||
|
||||
if (!fl) {
|
||||
|
||||
if (!fl) {
|
||||
log("No context help found : %s", strerror(errno));
|
||||
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 */
|
||||
context_help_list[num] = fread_string(fl, "Context sensitive help");
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
rewind(fl);
|
||||
|
||||
|
||||
CREATE(soc_mess_list, struct social_messg, top_of_socialt + 1);
|
||||
|
||||
/* 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].others_auto = fread_action(fl, nr);
|
||||
|
||||
if (CONFIG_NEW_SOCIALS == FALSE)
|
||||
if (CONFIG_NEW_SOCIALS == FALSE)
|
||||
continue;
|
||||
|
||||
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 (file_to_string_alloc(GREETINGS_FILE, &GREETINGS) == 0)
|
||||
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");
|
||||
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");
|
||||
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");
|
||||
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");
|
||||
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");
|
||||
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");
|
||||
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");
|
||||
if (file_to_string_alloc(IHELP_PAGE_FILE, &ihelp) < 0)
|
||||
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");
|
||||
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");
|
||||
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");
|
||||
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");
|
||||
if (help_table) {
|
||||
free_help_table();
|
||||
index_boot(DB_BOOT_HLP);
|
||||
}
|
||||
} 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");
|
||||
} 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");
|
||||
} 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");
|
||||
} 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");
|
||||
} 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");
|
||||
} 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");
|
||||
} 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");
|
||||
} else if (!str_cmp(arg, "ihelp")) {
|
||||
if (file_to_string_alloc(IHELP_PAGE_FILE, &ihelp) < 0)
|
||||
send_to_char(ch, "Can not read help front page\r\n");
|
||||
} 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");
|
||||
} 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");
|
||||
} 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");
|
||||
} 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");
|
||||
} else if (!str_cmp(arg, "greetings")) {
|
||||
if (file_to_string_alloc(GREETINGS_FILE, &GREETINGS) == 0)
|
||||
|
|
@ -542,7 +542,7 @@ void destroy_db(void)
|
|||
extract_script(&world[cnt], WLD_TRIGGER);
|
||||
/* free script proto list */
|
||||
free_proto_script(&world[cnt], WLD_TRIGGER);
|
||||
|
||||
|
||||
for (itr = 0; itr < NUM_OF_DIRS; itr++) {
|
||||
if (!world[cnt].dir_option[itr])
|
||||
continue;
|
||||
|
|
@ -556,7 +556,7 @@ void destroy_db(void)
|
|||
}
|
||||
free(world);
|
||||
top_of_world = 0;
|
||||
|
||||
|
||||
/* Objects */
|
||||
for (cnt = 0; cnt <= top_of_objt; cnt++) {
|
||||
if (obj_proto[cnt].name)
|
||||
|
|
@ -633,9 +633,9 @@ void destroy_db(void)
|
|||
temp = ftemp->next;
|
||||
free(ftemp);
|
||||
ftemp = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Triggers */
|
||||
for (cnt=0; cnt < top_of_trigt; cnt++) {
|
||||
if (trig_index[cnt]->proto) {
|
||||
|
|
@ -657,10 +657,10 @@ void destroy_db(void)
|
|||
free(trig_index[cnt]);
|
||||
}
|
||||
free(trig_index);
|
||||
|
||||
|
||||
/* Events */
|
||||
event_free_all();
|
||||
|
||||
|
||||
/* context sensitive help system */
|
||||
free_context_help();
|
||||
|
||||
|
|
@ -769,7 +769,7 @@ void boot_db(void)
|
|||
{
|
||||
int i;
|
||||
extern SPECIAL(shop_keeper);
|
||||
|
||||
|
||||
for (i = 0 ; i < top_of_objt; i++) {
|
||||
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);
|
||||
|
|
@ -898,7 +898,7 @@ int count_alias_records(FILE *fl)
|
|||
return (total_keywords);
|
||||
|
||||
/* No, they are not evil. -gg 6/24/98 */
|
||||
ackeof:
|
||||
ackeof:
|
||||
log("SYSERR: Unexpected end of help file.");
|
||||
exit(1); /* Some day we hope to handle these things better... */
|
||||
}
|
||||
|
|
@ -1135,7 +1135,7 @@ char fread_letter(FILE *fp)
|
|||
{
|
||||
char c;
|
||||
do {
|
||||
c = getc(fp);
|
||||
c = getc(fp);
|
||||
} while (isspace(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];
|
||||
struct extra_descr_data *new_descr;
|
||||
char letter;
|
||||
|
||||
|
||||
/* This really had better fit or there are other problems. */
|
||||
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);
|
||||
new_descr->keyword = 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
|
||||
* -- Welcor 09/03
|
||||
* -- Welcor 09/03
|
||||
*/
|
||||
{
|
||||
{
|
||||
char *end = strchr(new_descr->description, '\0');
|
||||
if (end > new_descr->description && *(end-1) != '\n') {
|
||||
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") {
|
||||
RANGE(0, 100);
|
||||
mob_proto[i].real_abils.str_add = num_arg;
|
||||
mob_proto[i].real_abils.str_add = num_arg;
|
||||
}
|
||||
|
||||
CASE("Int") {
|
||||
|
|
@ -1567,7 +1567,7 @@ void interpret_espec(const char *keyword, const char *value, int i, int nr)
|
|||
if (!matched) {
|
||||
log("SYSERR: Warning: unrecognized espec keyword %s in mob #%d",
|
||||
keyword, nr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#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_WEAR(obj_proto + i) = asciiflag_conv(f2);
|
||||
GET_OBJ_PERM(obj_proto + i) = asciiflag_conv(f3);
|
||||
|
||||
|
||||
if (!get_line(obj_f, line)) {
|
||||
log("SYSERR: Expecting second numeric line of %s, but file ended!", buf2);
|
||||
exit(1);
|
||||
|
|
@ -1791,12 +1791,12 @@ char *parse_object(FILE *obj_f, int nr)
|
|||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GET_OBJ_WEIGHT(obj_proto + i) = t[0];
|
||||
GET_OBJ_COST(obj_proto + i) = t[1];
|
||||
GET_OBJ_RENT(obj_proto + i) = t[2];
|
||||
GET_OBJ_LEVEL(obj_proto + i) = t[3];
|
||||
|
||||
|
||||
/* check to make sure that weight of containers exceeds curr. quantity */
|
||||
if (GET_OBJ_TYPE(obj_proto + i) == ITEM_DRINKCON ||
|
||||
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];
|
||||
int zone_fix = FALSE;
|
||||
char t1[80], t2[80];
|
||||
|
||||
|
||||
strlcpy(zname, zonename, sizeof(zname));
|
||||
|
||||
/* 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 */
|
||||
*ptr = '\0';
|
||||
Z.builders = strdup(buf);
|
||||
|
||||
|
||||
line_num += get_line(fl, buf);
|
||||
if ((ptr = strchr(buf, '~')) != NULL) /* take off the '~' if it's there */
|
||||
*ptr = '\0';
|
||||
|
|
@ -1952,7 +1952,7 @@ void load_zones(FILE *fl, char *zonename)
|
|||
}
|
||||
} else
|
||||
zone_fix = FALSE;
|
||||
|
||||
|
||||
line_num += tmp;
|
||||
ptr = buf;
|
||||
skip_spaces(&ptr);
|
||||
|
|
@ -2017,7 +2017,7 @@ void get_one_line(FILE *fl, char *buf)
|
|||
|
||||
/*************************************************************************
|
||||
* procedures for resetting, both play-time and boot-time *
|
||||
*************************************************************************/
|
||||
*************************************************************************/
|
||||
|
||||
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++)
|
||||
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,
|
||||
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++)
|
||||
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,
|
||||
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",
|
||||
++found, trig_index[nr]->vnum, trig_index[nr]->proto->name);
|
||||
return (found);
|
||||
}
|
||||
}
|
||||
|
||||
/* create a character, and add it to the char list */
|
||||
struct char_data *create_char(void)
|
||||
|
|
@ -2078,11 +2078,11 @@ struct char_data *create_char(void)
|
|||
clear_char(ch);
|
||||
ch->next = character_list;
|
||||
character_list = ch;
|
||||
|
||||
|
||||
GET_ID(ch) = max_mob_id++;
|
||||
/* find_char helper */
|
||||
add_to_lookup_table(GET_ID(ch), (void *)ch);
|
||||
|
||||
|
||||
return (ch);
|
||||
}
|
||||
|
||||
|
|
@ -2236,7 +2236,7 @@ void zone_update(void)
|
|||
if (zone_table[update_u->zone_to_reset].reset_mode == 2 ||
|
||||
is_empty(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);
|
||||
/* dequeue */
|
||||
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)
|
||||
continue;
|
||||
/*
|
||||
* if an immortal has nohassle off, he counts as present
|
||||
* added for testing zone reset triggers - Welcor
|
||||
* if an immortal has nohassle off, he counts as present
|
||||
* added for testing zone reset triggers - Welcor
|
||||
*/
|
||||
if ((GET_LEVEL(i->character) >= LVL_IMMORT) && (PRF_FLAGGED(i->character, PRF_NOHASSLE)))
|
||||
continue;
|
||||
|
|
@ -2604,7 +2604,7 @@ void free_char(struct char_data *ch)
|
|||
free(ch->player_specials->poofin);
|
||||
if (ch->player_specials->poofout)
|
||||
free(ch->player_specials->poofout);
|
||||
if (GET_HOST(ch))
|
||||
if (GET_HOST(ch))
|
||||
free(GET_HOST(ch));
|
||||
free(ch->player_specials);
|
||||
if (IS_NPC(ch))
|
||||
|
|
@ -2622,10 +2622,10 @@ void free_char(struct char_data *ch)
|
|||
free(ch->player.long_descr);
|
||||
if (ch->player.description)
|
||||
free(ch->player.description);
|
||||
|
||||
|
||||
/* free script proto list */
|
||||
free_proto_script(ch, MOB_TRIGGER);
|
||||
|
||||
|
||||
} else if ((i = GET_MOB_RNUM(ch)) != NOBODY) {
|
||||
/* otherwise, free strings only if the string is not pointing at proto */
|
||||
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 */
|
||||
/*
|
||||
* 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.
|
||||
* 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.
|
||||
*/
|
||||
if (GET_ID(ch) != 0)
|
||||
if (GET_ID(ch) != 0)
|
||||
remove_from_lookup_table(GET_ID(ch));
|
||||
|
||||
free(ch);
|
||||
|
|
@ -3106,7 +3106,7 @@ int check_object(struct obj_data *obj)
|
|||
}
|
||||
next_name = any_one_arg(next_name, onealias);
|
||||
} while (onealias && *onealias);
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -3256,7 +3256,7 @@ void load_default_config( void )
|
|||
CONFIG_NOEFFECT = strdup(NOEFFECT);
|
||||
CONFIG_TRACK_T_DOORS = track_through_doors;
|
||||
CONFIG_IMMORT_LEVEL_OK = immort_level_ok;
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Rent / crashsave options. **/
|
||||
/****************************************************************************/
|
||||
|
|
@ -3267,7 +3267,7 @@ void load_default_config( void )
|
|||
CONFIG_AUTOSAVE_TIME = autosave_time;
|
||||
CONFIG_CRASH_TIMEOUT = crash_file_timeout;
|
||||
CONFIG_RENT_TIMEOUT = rent_file_timeout;
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Room numbers. **/
|
||||
/****************************************************************************/
|
||||
|
|
@ -3277,24 +3277,24 @@ void load_default_config( void )
|
|||
CONFIG_DON_ROOM_1 = donation_room_1;
|
||||
CONFIG_DON_ROOM_2 = donation_room_2;
|
||||
CONFIG_DON_ROOM_3 = donation_room_3;
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/**eration options. **/
|
||||
/****************************************************************************/
|
||||
CONFIG_DFLT_PORT = DFLT_PORT;
|
||||
|
||||
|
||||
if (DFLT_IP)
|
||||
CONFIG_DFLT_IP = strdup(DFLT_IP);
|
||||
else
|
||||
CONFIG_DFLT_IP = NULL;
|
||||
|
||||
|
||||
CONFIG_DFLT_DIR = strdup(DFLT_DIR);
|
||||
|
||||
|
||||
if (LOGNAME)
|
||||
CONFIG_LOGNAME = strdup(LOGNAME);
|
||||
else
|
||||
CONFIG_LOGNAME = NULL;
|
||||
|
||||
|
||||
CONFIG_MAX_PLAYING = max_playing;
|
||||
CONFIG_MAX_FILESIZE = max_filesize;
|
||||
CONFIG_MAX_BAD_PWS = max_bad_pws;
|
||||
|
|
@ -3305,7 +3305,7 @@ void load_default_config( void )
|
|||
CONFIG_MENU = strdup(MENU);
|
||||
CONFIG_WELC_MESSG = strdup(WELC_MESSG);
|
||||
CONFIG_START_MESSG = strdup(START_MESSG);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Autowiz options. **/
|
||||
/****************************************************************************/
|
||||
|
|
@ -3322,21 +3322,21 @@ void load_config( void )
|
|||
char buf[MAX_INPUT_LENGTH];
|
||||
|
||||
load_default_config();
|
||||
|
||||
|
||||
snprintf(buf, sizeof(buf), "%s/%s", DFLT_DIR, CONFIG_CONFFILE);
|
||||
if ( !(fl = fopen(CONFIG_CONFFILE, "r")) && !(fl = fopen(buf, "r")) ) {
|
||||
snprintf(buf, sizeof(buf), "No %s file, using defaults", CONFIG_CONFFILE);
|
||||
perror(buf);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Load the game configuration file. **/
|
||||
/****************************************************************************/
|
||||
while (get_line(fl, line)) {
|
||||
split_argument(line, tag);
|
||||
num = atoi(line);
|
||||
|
||||
|
||||
switch (LOWER(*tag)) {
|
||||
case 'a':
|
||||
if (!str_cmp(tag, "auto_save"))
|
||||
|
|
@ -3346,12 +3346,12 @@ void load_config( void )
|
|||
else if (!str_cmp(tag, "auto_save_olc"))
|
||||
CONFIG_OLC_SAVE = num;
|
||||
break;
|
||||
|
||||
|
||||
case 'c':
|
||||
if (!str_cmp(tag, "crash_file_timeout"))
|
||||
CONFIG_CRASH_TIMEOUT = num;
|
||||
break;
|
||||
|
||||
|
||||
case 'd':
|
||||
if (!str_cmp(tag, "dts_are_dumps"))
|
||||
CONFIG_DTS_ARE_DUMPS = num;
|
||||
|
|
@ -3387,19 +3387,19 @@ void load_config( void )
|
|||
} else if (!str_cmp(tag, "dflt_port"))
|
||||
CONFIG_DFLT_PORT = num;
|
||||
break;
|
||||
|
||||
|
||||
case 'f':
|
||||
if (!str_cmp(tag, "free_rent"))
|
||||
CONFIG_FREE_RENT = num;
|
||||
else if (!str_cmp(tag, "frozen_start_room"))
|
||||
CONFIG_FROZEN_START = num;
|
||||
break;
|
||||
|
||||
|
||||
case 'h':
|
||||
if (!str_cmp(tag, "holler_move_cost"))
|
||||
CONFIG_HOLLER_MOVE_COST = num;
|
||||
break;
|
||||
|
||||
|
||||
case 'i':
|
||||
if (!str_cmp(tag, "idle_void"))
|
||||
CONFIG_IDLE_VOID = num;
|
||||
|
|
@ -3412,7 +3412,7 @@ void load_config( void )
|
|||
else if (!str_cmp(tag, "immort_start_room"))
|
||||
CONFIG_IMMORTAL_START = num;
|
||||
break;
|
||||
|
||||
|
||||
case 'l':
|
||||
if (!str_cmp(tag, "level_can_shout"))
|
||||
CONFIG_LEVEL_CAN_SHOUT = num;
|
||||
|
|
@ -3427,7 +3427,7 @@ void load_config( void )
|
|||
CONFIG_LOGNAME = NULL;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'm':
|
||||
if (!str_cmp(tag, "max_bad_pws"))
|
||||
CONFIG_MAX_BAD_PWS = num;
|
||||
|
|
@ -3457,7 +3457,7 @@ void load_config( void )
|
|||
else if (!str_cmp(tag, "mortal_start_room"))
|
||||
CONFIG_MORTAL_START = num;
|
||||
break;
|
||||
|
||||
|
||||
case 'n':
|
||||
if (!str_cmp(tag, "nameserver_is_slow"))
|
||||
CONFIG_NS_IS_SLOW = num;
|
||||
|
|
@ -3475,7 +3475,7 @@ void load_config( void )
|
|||
CONFIG_NOEFFECT = strdup(tmp);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'o':
|
||||
if (!str_cmp(tag, "ok")) {
|
||||
char tmp[READ_SIZE];
|
||||
|
|
@ -3485,19 +3485,19 @@ void load_config( void )
|
|||
CONFIG_OK = strdup(tmp);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 'p':
|
||||
if (!str_cmp(tag, "pk_allowed"))
|
||||
CONFIG_PK_ALLOWED = num;
|
||||
else if (!str_cmp(tag, "pt_allowed"))
|
||||
CONFIG_PT_ALLOWED = num;
|
||||
break;
|
||||
|
||||
|
||||
case 'r':
|
||||
if (!str_cmp(tag, "rent_file_timeout"))
|
||||
CONFIG_RENT_TIMEOUT = num;
|
||||
break;
|
||||
|
||||
|
||||
case 's':
|
||||
if (!str_cmp(tag, "siteok_everyone"))
|
||||
CONFIG_SITEOK_ALL = num;
|
||||
|
|
@ -3508,21 +3508,21 @@ void load_config( void )
|
|||
CONFIG_START_MESSG = fread_string(fl, buf);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case 't':
|
||||
if (!str_cmp(tag, "tunnel_size"))
|
||||
CONFIG_TUNNEL_SIZE = num;
|
||||
else if (!str_cmp(tag, "track_through_doors"))
|
||||
CONFIG_TRACK_T_DOORS = num;
|
||||
break;
|
||||
|
||||
|
||||
case 'u':
|
||||
if (!str_cmp(tag, "use_autowiz"))
|
||||
CONFIG_USE_AUTOWIZ = num;
|
||||
else if (!str_cmp(tag, "use_new_socials"))
|
||||
else if (!str_cmp(tag, "use_new_socials"))
|
||||
CONFIG_NEW_SOCIALS = num;
|
||||
break;
|
||||
|
||||
|
||||
case 'w':
|
||||
if (!str_cmp(tag, "welc_messg")) {
|
||||
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);
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
int vnum_object(char *searchname, struct char_data *ch);
|
||||
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 VIRTUAL 1
|
||||
|
|
@ -174,7 +174,7 @@ struct reset_com {
|
|||
char *sarg1; /* string argument */
|
||||
char *sarg2; /* string argument */
|
||||
|
||||
/*
|
||||
/*
|
||||
* Commands: *
|
||||
* 'M': Read a mobile *
|
||||
* 'O': Read an object *
|
||||
|
|
@ -271,7 +271,7 @@ struct obj_save_data_t {
|
|||
struct obj_data *obj;
|
||||
int locate;
|
||||
struct obj_save_data_t *next;
|
||||
};
|
||||
};
|
||||
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 */
|
||||
while(isspace(*argument))
|
||||
argument++;
|
||||
|
||||
argument++;
|
||||
|
||||
/* Find length of first word */
|
||||
for(arg = first_arg ;
|
||||
*argument && !isspace(*argument) &&
|
||||
|
|
@ -91,7 +91,7 @@ void sub_write_to_char(char_data *ch, char *tokens[],
|
|||
else
|
||||
strcat(sb,HSHR((char_data *) otokens[i]));
|
||||
break;
|
||||
|
||||
|
||||
case '&':
|
||||
if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
|
||||
strcat(sb,"it");
|
||||
|
|
@ -100,7 +100,7 @@ void sub_write_to_char(char_data *ch, char *tokens[],
|
|||
else
|
||||
strcat(sb,HSSH((char_data *) otokens[i]));
|
||||
break;
|
||||
|
||||
|
||||
case '*':
|
||||
if (!otokens[i] || !CAN_SEE(ch, (char_data *) otokens[i]))
|
||||
strcat(sb,"it");
|
||||
|
|
@ -139,9 +139,9 @@ void sub_write(char *arg, char_data *ch, byte find_invis, int targets)
|
|||
|
||||
if (!arg)
|
||||
return;
|
||||
|
||||
|
||||
tokens[0] = str;
|
||||
|
||||
|
||||
for (i = 0, p = arg, s = str; *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);
|
||||
tokens[++i] = ++s;
|
||||
break;
|
||||
|
||||
|
||||
case '¨':
|
||||
/* get obj_data, move to next token */
|
||||
type[i] = *p;
|
||||
*s = '\0';
|
||||
p = any_one_name(++p, 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_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++;
|
||||
*s++ = *p++;
|
||||
break;
|
||||
|
||||
|
||||
default:
|
||||
*s++ = *p++;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -59,7 +59,7 @@ void parse_trigger(FILE *trig_f, int nr)
|
|||
trig->narg = (k == 3) ? t[0] : 0;
|
||||
|
||||
trig->arglist = fread_string(trig_f, errors);
|
||||
|
||||
|
||||
cmds = s = fread_string(trig_f, errors);
|
||||
|
||||
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->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->attach_type = trg->attach_type;
|
||||
this_data->data_type = trg->data_type;
|
||||
if (trg->name)
|
||||
if (trg->name)
|
||||
this_data->name = strdup(trg->name);
|
||||
else {
|
||||
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);
|
||||
|
||||
if (count != 2) {
|
||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||
"SYSERR: Error assigning trigger! - Line was\n %s", line);
|
||||
return;
|
||||
}
|
||||
|
|
@ -162,17 +162,17 @@ void dg_read_trigger(FILE *fp, void *proto, int type)
|
|||
if (rnum == NOTHING) {
|
||||
switch(type) {
|
||||
case MOB_TRIGGER:
|
||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||
"SYSERR: dg_read_trigger: Trigger vnum #%d asked for but non-existant! (mob: %s - %d)",
|
||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||
"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));
|
||||
break;
|
||||
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)",
|
||||
vnum, GET_ROOM_VNUM( ((room_data *)proto)->number ));
|
||||
break;
|
||||
default:
|
||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||
"SYSERR: dg_read_trigger: Trigger vnum #%d asked for but non-existant! (?)", vnum);
|
||||
break;
|
||||
}
|
||||
|
|
@ -190,7 +190,7 @@ void dg_read_trigger(FILE *fp, void *proto, int type)
|
|||
if (!trg_proto) {
|
||||
mob->proto_script = trg_proto = new_trg;
|
||||
} else {
|
||||
while (trg_proto->next)
|
||||
while (trg_proto->next)
|
||||
trg_proto = trg_proto->next;
|
||||
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);
|
||||
add_trigger(SCRIPT(room), read_trigger(rnum), -1);
|
||||
} else {
|
||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||
"SYSERR: non-existant trigger #%d assigned to room #%d",
|
||||
vnum, room->number);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||
"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);
|
||||
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
rnum = real_trigger(vnum);
|
||||
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)",
|
||||
vnum, obj->short_description, GET_OBJ_VNUM(obj));
|
||||
return;
|
||||
|
|
@ -276,7 +276,7 @@ void assign_triggers(void *i, int type)
|
|||
while (trg_proto) {
|
||||
rnum = real_trigger(trg_proto->vnum);
|
||||
if (rnum==NOTHING) {
|
||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||
"SYSERR: trigger #%d non-existant, for mob #%d",
|
||||
trg_proto->vnum, mob_index[mob->nr].vnum);
|
||||
} else {
|
||||
|
|
@ -309,7 +309,7 @@ void assign_triggers(void *i, int type)
|
|||
while (trg_proto) {
|
||||
rnum = real_trigger(trg_proto->vnum);
|
||||
if (rnum==NOTHING) {
|
||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||
"SYSERR: trigger #%d non-existant, for room #%d",
|
||||
trg_proto->vnum, room->number);
|
||||
} else {
|
||||
|
|
@ -321,7 +321,7 @@ void assign_triggers(void *i, int type)
|
|||
}
|
||||
break;
|
||||
default:
|
||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||
mudlog(BRF, LVL_BUILDER, TRUE,
|
||||
"SYSERR: unknown type for assign_triggers()");
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@ struct queue *event_q; /* the event queue */
|
|||
extern long pulse;
|
||||
|
||||
/* initializes the event queue */
|
||||
void event_init(void)
|
||||
void event_init(void)
|
||||
{
|
||||
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 */
|
||||
when = 1;
|
||||
|
||||
|
||||
CREATE(new_event, struct event, 1);
|
||||
new_event->func = func;
|
||||
new_event->event_obj = event_obj;
|
||||
|
|
@ -103,7 +103,7 @@ void event_process(void)
|
|||
** event function.
|
||||
*/
|
||||
the_event->q_el = NULL;
|
||||
|
||||
|
||||
/* call event func, reenqueue event if retval > 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);
|
||||
|
|
@ -205,7 +205,7 @@ struct q_element *queue_enq(struct queue *q, void *data, long key)
|
|||
qe->next->prev = qe;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return qe;
|
||||
}
|
||||
|
||||
|
|
@ -228,7 +228,7 @@ void queue_deq(struct queue *q, struct q_element *qe)
|
|||
q->tail[i] = qe->prev;
|
||||
else
|
||||
qe->next->prev = qe->prev;
|
||||
|
||||
|
||||
free(qe);
|
||||
}
|
||||
|
||||
|
|
@ -291,5 +291,5 @@ void queue_free(struct queue *q)
|
|||
|
||||
free(q);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -15,7 +15,7 @@
|
|||
|
||||
#include "conf.h"
|
||||
#include "sysdep.h"
|
||||
|
||||
|
||||
|
||||
#include "structs.h"
|
||||
#include "dg_scripts.h"
|
||||
|
|
@ -69,13 +69,13 @@ int remove_var(struct trig_var_data **var_list, char *name)
|
|||
free_var_el(i);
|
||||
}
|
||||
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* Return memory used by a trigger
|
||||
* The command list is free'd when changed and when
|
||||
* shutting down.
|
||||
|
|
@ -84,7 +84,7 @@ void free_trigger(struct trig_data *trig)
|
|||
{
|
||||
free(trig->name);
|
||||
trig->name = NULL;
|
||||
|
||||
|
||||
if (trig->arglist) {
|
||||
free(trig->arglist);
|
||||
trig->arglist = NULL;
|
||||
|
|
@ -95,7 +95,7 @@ void free_trigger(struct trig_data *trig)
|
|||
}
|
||||
if (GET_TRIG_WAIT(trig))
|
||||
event_cancel(GET_TRIG_WAIT(trig));
|
||||
|
||||
|
||||
free(trig);
|
||||
}
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ void extract_trigger(struct trig_data *trig)
|
|||
GET_TRIG_WAIT(trig) = NULL;
|
||||
}
|
||||
|
||||
trig_index[trig->nr]->number--;
|
||||
trig_index[trig->nr]->number--;
|
||||
|
||||
/* walk the trigger list and remove this one */
|
||||
REMOVE_FROM_LIST(trig, trigger_list, next_in_world);
|
||||
|
|
@ -153,10 +153,10 @@ void extract_script(void *thing, int type)
|
|||
if (sc) {
|
||||
for ( ; i ; i = i->next)
|
||||
assert(sc != SCRIPT(i));
|
||||
|
||||
|
||||
for ( ; j ; j = j->next)
|
||||
assert(sc != SCRIPT(j));
|
||||
|
||||
|
||||
for (k = 0; k < top_of_world; k++)
|
||||
assert(sc != SCRIPT(&world[k]));
|
||||
}
|
||||
|
|
@ -167,10 +167,10 @@ void extract_script(void *thing, int type)
|
|||
extract_trigger(trig);
|
||||
}
|
||||
TRIGGERS(sc) = NULL;
|
||||
|
||||
|
||||
/* Thanks to James Long for tracking down this memory leak */
|
||||
free_varlist(sc->global_vars);
|
||||
|
||||
|
||||
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;
|
||||
char_data *mob;
|
||||
|
|
@ -218,10 +218,10 @@ void free_proto_script(void *thing, int type)
|
|||
if (proto) {
|
||||
for ( ; i ; i = i->next)
|
||||
assert(proto != i->proto_script);
|
||||
|
||||
|
||||
for ( ; j ; j = j->next)
|
||||
assert(proto != j->proto_script);
|
||||
|
||||
|
||||
for (k = 0; k < top_of_world; k++)
|
||||
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;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (tp_src) {
|
||||
CREATE(tp_dst, struct trig_proto_list, 1);
|
||||
switch (type) {
|
||||
|
|
@ -263,7 +263,7 @@ void copy_proto_script(void *source, void *dest, int type)
|
|||
((room_data *)dest)->proto_script = tp_dst;
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
while (tp_src) {
|
||||
tp_dst->vnum = tp_src->vnum;
|
||||
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);
|
||||
tp_dst = tp_dst->next;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct trig_data *trig;
|
||||
|
||||
|
||||
if (!SCRIPT(from))
|
||||
return;
|
||||
|
||||
|
||||
for (trig = TRIGGERS(SCRIPT(from)); trig; trig = trig->next) {
|
||||
if (!GET_TRIG_WAIT(trig))
|
||||
continue;
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
#include "conf.h"
|
||||
#include "sysdep.h"
|
||||
|
||||
|
||||
|
||||
#include "structs.h"
|
||||
#include "dg_scripts.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!");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
strcpy(orig_cmd, cmd);
|
||||
/* get: blank, spell name, target name */
|
||||
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_WORLD))) {
|
||||
if ((tch = get_char(t)) != NULL)
|
||||
target = TRUE;
|
||||
target = TRUE;
|
||||
}
|
||||
|
||||
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_WORLD))) {
|
||||
if ((tobj = get_obj(t)) != NULL)
|
||||
target = TRUE;
|
||||
target = TRUE;
|
||||
}
|
||||
|
||||
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.... */
|
||||
if (type==OBJ_TRIGGER)
|
||||
caster->player.short_descr =
|
||||
caster->player.short_descr =
|
||||
strdup(((struct obj_data *)go)->short_description);
|
||||
else if (type==WLD_TRIGGER)
|
||||
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;
|
||||
struct affected_type af;
|
||||
|
||||
|
||||
|
||||
half_chop(cmd, junk, cmd);
|
||||
half_chop(cmd, charname, 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);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* add the affect */
|
||||
af.type = SPELL_DG_AFFECT;
|
||||
af.duration = duration;
|
||||
|
|
@ -249,7 +249,7 @@ void do_dg_affect(void *go, struct script_data *sc, trig_data *trig,
|
|||
af.location = 0;
|
||||
af.bitvector = (1<<i);
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
* can be targetted
|
||||
* can be targetted
|
||||
* - 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)
|
||||
{
|
||||
if (IS_NPC(ch))
|
||||
if (IS_NPC(ch))
|
||||
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 */
|
||||
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. */
|
||||
return FALSE; /* but not always the highest gods */
|
||||
else if (!PRF_FLAGGED(ch, PRF_NOHASSLE))
|
||||
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... */
|
||||
}
|
||||
|
||||
|
|
@ -313,15 +313,15 @@ void script_damage(struct char_data *vict, int dam)
|
|||
|
||||
GET_HIT(vict) -= dam;
|
||||
GET_HIT(vict) = MIN(GET_HIT(vict), GET_MAX_HIT(vict));
|
||||
|
||||
|
||||
update_pos(vict);
|
||||
send_char_pos(vict, dam);
|
||||
|
||||
if (GET_POS(vict) == POS_DEAD) {
|
||||
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);
|
||||
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;
|
||||
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);
|
||||
|
||||
va_start(args, format);
|
||||
|
|
@ -111,7 +111,7 @@ ACMD(do_masound)
|
|||
{
|
||||
room_rnum was_in_room;
|
||||
int door;
|
||||
|
||||
|
||||
if (!MOB_OR_IMPL(ch))
|
||||
{
|
||||
send_to_char(ch, "Huh?!?\r\n");
|
||||
|
|
@ -120,7 +120,7 @@ ACMD(do_masound)
|
|||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
|
||||
if (!*argument)
|
||||
{
|
||||
mob_log(ch, "masound called with no argument");
|
||||
|
|
@ -128,12 +128,12 @@ ACMD(do_masound)
|
|||
}
|
||||
|
||||
skip_spaces(&argument);
|
||||
|
||||
|
||||
was_in_room = IN_ROOM(ch);
|
||||
for (door = 0; door < NUM_OF_DIRS; door++)
|
||||
{
|
||||
struct room_direction_data *newexit;
|
||||
|
||||
|
||||
if (((newexit = world[was_in_room].dir_option[door]) != NULL) &&
|
||||
newexit->to_room != NOWHERE && newexit->to_room != was_in_room)
|
||||
{
|
||||
|
|
@ -141,7 +141,7 @@ ACMD(do_masound)
|
|||
sub_write(argument, ch, TRUE, TO_ROOM);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
IN_ROOM(ch) = was_in_room;
|
||||
}
|
||||
|
||||
|
|
@ -151,7 +151,7 @@ ACMD(do_mkill)
|
|||
{
|
||||
char arg[MAX_INPUT_LENGTH];
|
||||
char_data *victim;
|
||||
|
||||
|
||||
if (!MOB_OR_IMPL(ch)) {
|
||||
send_to_char(ch, "Huh?!?\r\n");
|
||||
return;
|
||||
|
|
@ -159,9 +159,9 @@ ACMD(do_mkill)
|
|||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
|
||||
one_argument(argument, arg);
|
||||
|
||||
|
||||
if (!*arg) {
|
||||
mob_log(ch, "mkill called with no argument");
|
||||
return;
|
||||
|
|
@ -191,7 +191,7 @@ ACMD(do_mkill)
|
|||
mob_log(ch, "mkill: already fighting");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
hit(ch, victim, TYPE_UNDEFINED);
|
||||
return;
|
||||
}
|
||||
|
|
@ -199,7 +199,7 @@ ACMD(do_mkill)
|
|||
|
||||
/*
|
||||
* 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
|
||||
*/
|
||||
ACMD(do_mjunk)
|
||||
|
|
@ -208,17 +208,17 @@ ACMD(do_mjunk)
|
|||
int pos, junk_all = 0;
|
||||
obj_data *obj;
|
||||
obj_data *obj_next;
|
||||
|
||||
|
||||
if (!MOB_OR_IMPL(ch)) {
|
||||
send_to_char(ch, "Huh?!?\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
one_argument(argument, arg);
|
||||
|
||||
|
||||
if (!*arg) {
|
||||
mob_log(ch, "mjunk called with no argument");
|
||||
return;
|
||||
|
|
@ -226,7 +226,7 @@ ACMD(do_mjunk)
|
|||
|
||||
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 */
|
||||
if ((pos = get_obj_pos_in_equip_vis(ch, arg, NULL, ch->equipment)) >= 0) {
|
||||
extract_obj(unequip_char(ch, pos));
|
||||
|
|
@ -261,18 +261,18 @@ ACMD(do_mechoaround)
|
|||
send_to_char(ch, "Huh?!?\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
|
||||
p = one_argument(argument, arg);
|
||||
skip_spaces(&p);
|
||||
|
||||
|
||||
if (!*arg) {
|
||||
mob_log(ch, "mechoaround called with no argument");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (*arg == UID_CHAR) {
|
||||
if (!(victim = get_char(arg))) {
|
||||
mob_log(ch, "mechoaround: victim (%s) does not exist",arg);
|
||||
|
|
@ -301,10 +301,10 @@ ACMD(do_msend)
|
|||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
|
||||
p = one_argument(argument, arg);
|
||||
skip_spaces(&p);
|
||||
|
||||
|
||||
if (!*arg) {
|
||||
mob_log(ch, "msend called with no argument");
|
||||
return;
|
||||
|
|
@ -319,7 +319,7 @@ ACMD(do_msend)
|
|||
mob_log(ch, "msend: victim (%s) does not exist",arg);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
sub_write(p, victim, TRUE, TO_CHAR);
|
||||
}
|
||||
|
||||
|
|
@ -328,22 +328,22 @@ ACMD(do_msend)
|
|||
ACMD(do_mecho)
|
||||
{
|
||||
char *p;
|
||||
|
||||
|
||||
if (!MOB_OR_IMPL(ch)) {
|
||||
send_to_char(ch, "Huh?!?\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
|
||||
if (!*argument) {
|
||||
mob_log(ch, "mecho called with no arguments");
|
||||
return;
|
||||
}
|
||||
p = argument;
|
||||
skip_spaces(&p);
|
||||
|
||||
|
||||
sub_write(p, ch, TRUE, TO_ROOM);
|
||||
}
|
||||
|
||||
|
|
@ -351,7 +351,7 @@ ACMD(do_mzoneecho)
|
|||
{
|
||||
int zone;
|
||||
char room_number[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH], *msg;
|
||||
|
||||
|
||||
msg = any_one_arg(argument, room_number);
|
||||
skip_spaces(&msg);
|
||||
|
||||
|
|
@ -361,7 +361,7 @@ ACMD(do_mzoneecho)
|
|||
else if ((zone = real_zone_by_thing(atoi(room_number))) == NOWHERE)
|
||||
mob_log(ch, "mzoneecho called for nonexistant zone");
|
||||
|
||||
else {
|
||||
else {
|
||||
sprintf(buf, "%s\r\n", msg);
|
||||
send_to_zone(buf, zone);
|
||||
}
|
||||
|
|
@ -369,7 +369,7 @@ ACMD(do_mzoneecho)
|
|||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
|
|
@ -381,7 +381,7 @@ ACMD(do_mload)
|
|||
char_data *tch;
|
||||
obj_data *cnt;
|
||||
int pos;
|
||||
|
||||
|
||||
if (!MOB_OR_IMPL(ch)) {
|
||||
send_to_char(ch, "Huh?!?\r\n");
|
||||
return;
|
||||
|
|
@ -392,9 +392,9 @@ ACMD(do_mload)
|
|||
|
||||
if( ch->desc && GET_LEVEL(ch->desc->original) < LVL_IMPL)
|
||||
return;
|
||||
|
||||
|
||||
target = two_arguments(argument, arg1, arg2);
|
||||
|
||||
|
||||
if (!*arg1 || !*arg2 || !is_number(arg2) || ((number = atoi(arg2)) < 0)) {
|
||||
mob_log(ch, "mload: bad syntax");
|
||||
return;
|
||||
|
|
@ -415,7 +415,7 @@ ACMD(do_mload)
|
|||
if ((mob = read_mobile(number, VIRTUAL)) == NULL) {
|
||||
mob_log(ch, "mload: bad mob vnum");
|
||||
return;
|
||||
}
|
||||
}
|
||||
char_to_room(mob, rnum);
|
||||
if (SCRIPT(ch)) { // it _should_ have, but it might be detached.
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
|
|
@ -467,7 +467,7 @@ ACMD(do_mload)
|
|||
return;
|
||||
}
|
||||
/* 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);
|
||||
return;
|
||||
}
|
||||
|
|
@ -487,25 +487,25 @@ ACMD(do_mpurge)
|
|||
char arg[MAX_INPUT_LENGTH];
|
||||
char_data *victim;
|
||||
obj_data *obj;
|
||||
|
||||
|
||||
if (!MOB_OR_IMPL(ch)) {
|
||||
send_to_char(ch, "Huh?!?\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL))
|
||||
return;
|
||||
|
||||
|
||||
one_argument(argument, arg);
|
||||
|
||||
|
||||
if (!*arg) {
|
||||
/* 'purge' */
|
||||
char_data *vnext;
|
||||
obj_data *obj_next;
|
||||
|
||||
|
||||
for (victim = world[IN_ROOM(ch)].people; victim; victim = vnext) {
|
||||
vnext = victim->next_in_room;
|
||||
if (IS_NPC(victim) && victim != ch)
|
||||
|
|
@ -527,25 +527,25 @@ ACMD(do_mpurge)
|
|||
if (victim == NULL) {
|
||||
if (*arg == UID_CHAR)
|
||||
obj = get_obj(arg);
|
||||
else
|
||||
else
|
||||
obj = get_obj_vis(ch, arg, NULL);
|
||||
|
||||
|
||||
if (obj) {
|
||||
extract_obj(obj);
|
||||
obj = NULL;
|
||||
} else
|
||||
} else
|
||||
mob_log(ch, "mpurge: bad argument");
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!IS_NPC(victim)) {
|
||||
mob_log(ch, "mpurge: purging a PC");
|
||||
return;
|
||||
}
|
||||
|
||||
if (victim==ch) dg_owner_purged = 1;
|
||||
|
||||
|
||||
extract_char(victim);
|
||||
}
|
||||
|
||||
|
|
@ -555,7 +555,7 @@ ACMD(do_mgoto)
|
|||
{
|
||||
char arg[MAX_INPUT_LENGTH];
|
||||
room_rnum location;
|
||||
|
||||
|
||||
if (!MOB_OR_IMPL(ch)) {
|
||||
send_to_char(ch, "Huh?!?\r\n");
|
||||
return;
|
||||
|
|
@ -563,22 +563,22 @@ ACMD(do_mgoto)
|
|||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
|
||||
one_argument(argument, arg);
|
||||
|
||||
if (!*arg) {
|
||||
mob_log(ch, "mgoto called with no argument");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((location = find_target_room(ch, arg)) == NOWHERE) {
|
||||
mob_log(ch, "mgoto: invalid location");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (FIGHTING(ch))
|
||||
stop_fighting(ch);
|
||||
|
||||
|
||||
char_from_room(ch);
|
||||
char_to_room(ch, location);
|
||||
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
|
||||
|
|
@ -590,32 +590,32 @@ ACMD(do_mat)
|
|||
{
|
||||
char arg[MAX_INPUT_LENGTH];
|
||||
room_rnum location, original;
|
||||
|
||||
|
||||
if (!MOB_OR_IMPL(ch)) {
|
||||
send_to_char(ch, "Huh?!?\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
|
||||
argument = one_argument( argument, arg );
|
||||
|
||||
|
||||
if (!*arg || !*argument) {
|
||||
mob_log(ch, "mat: bad argument");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((location = find_target_room(ch, arg)) == NOWHERE) {
|
||||
mob_log(ch, "mat: invalid location");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
original = IN_ROOM(ch);
|
||||
char_from_room(ch);
|
||||
char_to_room(ch, location);
|
||||
command_interpreter(ch, argument);
|
||||
|
||||
|
||||
/*
|
||||
* See if 'ch' still exists before continuing!
|
||||
* Handles 'at XXXX quit' case.
|
||||
|
|
@ -641,12 +641,12 @@ ACMD(do_mteleport)
|
|||
send_to_char(ch, "Huh?!?\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
argument = two_arguments(argument, arg1, arg2);
|
||||
|
||||
|
||||
if (!*arg1 || !*arg2) {
|
||||
mob_log(ch, "mteleport: bad syntax");
|
||||
return;
|
||||
|
|
@ -658,7 +658,7 @@ ACMD(do_mteleport)
|
|||
mob_log(ch, "mteleport target is an invalid room");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!str_cmp(arg1, "all")) {
|
||||
if (target == IN_ROOM(ch)) {
|
||||
mob_log(ch, "mteleport all target is itself");
|
||||
|
|
@ -703,7 +703,7 @@ ACMD(do_mdamage) {
|
|||
send_to_char(ch, "Huh?!?\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
|
|
@ -740,24 +740,24 @@ ACMD(do_mforce)
|
|||
send_to_char(ch, "Huh?!?\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
|
||||
if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL))
|
||||
return;
|
||||
|
||||
|
||||
argument = one_argument(argument, arg);
|
||||
|
||||
|
||||
if (!*arg || !*argument) {
|
||||
mob_log(ch, "mforce: bad syntax");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!str_cmp(arg, "all")) {
|
||||
struct descriptor_data *i;
|
||||
char_data *vch;
|
||||
|
||||
|
||||
for (i = descriptor_list; i ; i = i->next) {
|
||||
if ((i->character != ch) && !i->connected &&
|
||||
(IN_ROOM(i->character) == IN_ROOM(ch))) {
|
||||
|
|
@ -770,7 +770,7 @@ ACMD(do_mforce)
|
|||
}
|
||||
} else {
|
||||
char_data *victim;
|
||||
|
||||
|
||||
if (*arg == UID_CHAR) {
|
||||
if (!(victim = get_char(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");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (victim == ch) {
|
||||
mob_log(ch, "mforce: forcing self");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (valid_dg_target(victim, 0))
|
||||
command_interpreter(victim, argument);
|
||||
}
|
||||
|
|
@ -801,20 +801,20 @@ ACMD(do_mhunt)
|
|||
send_to_char(ch, "Huh?!?\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
|
||||
if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL))
|
||||
return;
|
||||
|
||||
|
||||
one_argument(argument, arg);
|
||||
|
||||
if (!*arg) {
|
||||
mob_log(ch, "mhunt called with no argument");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (FIGHTING(ch)) return;
|
||||
|
||||
|
|
@ -828,7 +828,7 @@ ACMD(do_mhunt)
|
|||
return;
|
||||
}
|
||||
HUNTING(ch) = victim;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
@ -844,15 +844,15 @@ ACMD(do_mremember)
|
|||
send_to_char(ch, "Huh?!?\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
|
||||
if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL))
|
||||
return;
|
||||
|
||||
|
||||
argument = one_argument(argument, arg);
|
||||
|
||||
|
||||
if (!*arg) {
|
||||
mob_log(ch, "mremember: bad syntax");
|
||||
return;
|
||||
|
|
@ -896,15 +896,15 @@ ACMD(do_mforget)
|
|||
send_to_char(ch, "Huh?!?\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
|
||||
if (ch->desc && (GET_LEVEL(ch->desc->original) < LVL_IMPL))
|
||||
return;
|
||||
|
||||
|
||||
one_argument(argument, arg);
|
||||
|
||||
|
||||
if (!*arg) {
|
||||
mob_log(ch, "mforget: bad syntax");
|
||||
return;
|
||||
|
|
@ -956,15 +956,15 @@ ACMD(do_mtransform)
|
|||
send_to_char(ch, "Huh?!?\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
|
||||
if (ch->desc) {
|
||||
send_to_char(ch, "You've got no VNUM to return to, dummy! try 'switch'\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
one_argument(argument, arg);
|
||||
|
||||
if (!*arg)
|
||||
|
|
@ -1071,10 +1071,10 @@ ACMD(do_mdoor)
|
|||
send_to_char(ch, "Huh?!?\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
|
||||
argument = two_arguments(argument, target, direction);
|
||||
value = one_argument(argument, field);
|
||||
skip_spaces(&value);
|
||||
|
|
@ -1083,12 +1083,12 @@ ACMD(do_mdoor)
|
|||
mob_log(ch, "mdoor called with too few args");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((rm = get_room(target)) == NULL) {
|
||||
mob_log(ch, "mdoor: invalid target");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((dir = search_block(direction, dirs, FALSE)) == -1) {
|
||||
mob_log(ch, "mdoor: invalid direction");
|
||||
return;
|
||||
|
|
@ -1116,9 +1116,9 @@ ACMD(do_mdoor)
|
|||
else {
|
||||
if (!newexit) {
|
||||
CREATE(newexit, struct room_direction_data, 1);
|
||||
rm->dir_option[dir] = newexit;
|
||||
rm->dir_option[dir] = newexit;
|
||||
}
|
||||
|
||||
|
||||
switch (fd) {
|
||||
case 1: /* description */
|
||||
if (newexit->general_description)
|
||||
|
|
@ -1159,7 +1159,7 @@ ACMD(do_mfollow)
|
|||
send_to_char(ch, "Huh?!?\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
|
|
@ -1169,7 +1169,7 @@ ACMD(do_mfollow)
|
|||
mob_log(ch, "mfollow: bad syntax");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (*buf == UID_CHAR) {
|
||||
if (!(leader = get_char(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 */
|
||||
return;
|
||||
|
||||
|
||||
|
||||
/* stop following someone else first */
|
||||
if (ch->master) {
|
||||
|
|
@ -1195,17 +1195,17 @@ ACMD(do_mfollow)
|
|||
free(k);
|
||||
} else { /* locate follower who is not head of list */
|
||||
for (k = ch->master->followers; k->next->follower != ch; k = k->next);
|
||||
|
||||
|
||||
j = k->next;
|
||||
k->next = j->next;
|
||||
free(j);
|
||||
}
|
||||
ch->master = NULL;
|
||||
}
|
||||
|
||||
if (ch == leader)
|
||||
|
||||
if (ch == leader)
|
||||
return;
|
||||
|
||||
|
||||
if (circle_follow(ch, leader)) {
|
||||
mob_log(ch, "mfollow: Following in circles.");
|
||||
return;
|
||||
|
|
@ -1236,6 +1236,6 @@ ACMD(do_mrecho)
|
|||
|
||||
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
|
||||
mob_log(ch, "mrecho called with too few args");
|
||||
else
|
||||
else
|
||||
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);
|
||||
zone_rnum real_zone_by_thing(room_vnum vznum);
|
||||
|
||||
/*
|
||||
/*
|
||||
* Local functions
|
||||
*/
|
||||
#define OCMD(name) \
|
||||
|
|
@ -71,7 +71,7 @@ void obj_log(obj_data *obj, const char *format, ...)
|
|||
{
|
||||
va_list args;
|
||||
char output[MAX_STRING_LENGTH];
|
||||
|
||||
|
||||
snprintf(output, sizeof(output), "Obj (%s, VNum %d):: %s", obj->short_description, GET_OBJ_VNUM(obj), 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)
|
||||
location = IN_ROOM(target_obj);
|
||||
else
|
||||
else
|
||||
return NOWHERE;
|
||||
}
|
||||
else
|
||||
return NOWHERE;
|
||||
|
||||
|
||||
/* a room has been found. Check for permission */
|
||||
if (ROOM_FLAGGED(location, ROOM_GODROOM) ||
|
||||
if (ROOM_FLAGGED(location, ROOM_GODROOM) ||
|
||||
#ifdef ROOM_IMPROOM
|
||||
ROOM_FLAGGED(location, ROOM_IMPROOM) ||
|
||||
#endif
|
||||
|
|
@ -152,8 +152,8 @@ OCMD(do_oecho)
|
|||
int room;
|
||||
|
||||
skip_spaces(&argument);
|
||||
|
||||
if (!*argument)
|
||||
|
||||
if (!*argument)
|
||||
obj_log(obj, "oecho called with no args");
|
||||
|
||||
else if ((room = obj_room(obj)) != NOWHERE)
|
||||
|
|
@ -161,7 +161,7 @@ OCMD(do_oecho)
|
|||
if (world[room].people)
|
||||
sub_write(argument, world[room].people, TRUE, TO_ROOM | TO_CHAR);
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
obj_log(obj, "oecho called by object in NOWHERE");
|
||||
}
|
||||
|
|
@ -174,16 +174,16 @@ OCMD(do_oforce)
|
|||
char arg1[MAX_INPUT_LENGTH], *line;
|
||||
|
||||
line = one_argument(argument, arg1);
|
||||
|
||||
|
||||
if (!*arg1 || !*line)
|
||||
{
|
||||
obj_log(obj, "oforce called with too few args");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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");
|
||||
else
|
||||
{
|
||||
|
|
@ -195,9 +195,9 @@ OCMD(do_oforce)
|
|||
command_interpreter(ch, line);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
if ((ch = get_char_by_obj(obj, arg1)))
|
||||
|
|
@ -207,7 +207,7 @@ OCMD(do_oforce)
|
|||
command_interpreter(ch, line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
obj_log(obj, "oforce: no target found");
|
||||
}
|
||||
|
|
@ -217,7 +217,7 @@ OCMD(do_ozoneecho)
|
|||
{
|
||||
int zone;
|
||||
char room_number[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH], *msg;
|
||||
|
||||
|
||||
msg = any_one_arg(argument, room_number);
|
||||
skip_spaces(&msg);
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ OCMD(do_ozoneecho)
|
|||
else if ((zone = real_zone_by_thing(atoi(room_number))) == NOWHERE)
|
||||
obj_log(obj, "ozoneecho called for nonexistant zone");
|
||||
|
||||
else {
|
||||
else {
|
||||
sprintf(buf, "%s\r\n", msg);
|
||||
send_to_zone(buf, zone);
|
||||
}
|
||||
|
|
@ -237,7 +237,7 @@ OCMD(do_osend)
|
|||
{
|
||||
char buf[MAX_INPUT_LENGTH], *msg;
|
||||
char_data *ch;
|
||||
|
||||
|
||||
msg = any_one_arg(argument, buf);
|
||||
|
||||
if (!*buf)
|
||||
|
|
@ -278,9 +278,9 @@ OCMD(do_orecho)
|
|||
|
||||
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
|
||||
obj_log(obj, "orecho: too few args");
|
||||
else
|
||||
else
|
||||
send_to_range(atoi(start), atoi(finish), "%s\r\n", msg);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -293,7 +293,7 @@ OCMD(do_otimer)
|
|||
|
||||
if (!*arg)
|
||||
obj_log(obj, "otimer: missing argument");
|
||||
else if (!isdigit(*arg))
|
||||
else if (!isdigit(*arg))
|
||||
obj_log(obj, "otimer: bad argument");
|
||||
else
|
||||
GET_OBJ_TIMER(obj) = atoi(arg);
|
||||
|
|
@ -314,7 +314,7 @@ OCMD(do_otransform)
|
|||
|
||||
if (!*arg)
|
||||
obj_log(obj, "otransform: missing argument");
|
||||
else if (!isdigit(*arg))
|
||||
else if (!isdigit(*arg))
|
||||
obj_log(obj, "otransform: bad argument");
|
||||
else {
|
||||
o = read_object(atoi(arg), VIRTUAL);
|
||||
|
|
@ -362,7 +362,7 @@ OCMD(do_opurge)
|
|||
int rm;
|
||||
|
||||
one_argument(argument, arg);
|
||||
|
||||
|
||||
if (!*arg) {
|
||||
/* purge all */
|
||||
if ((rm = obj_room(obj)) != NOWHERE) {
|
||||
|
|
@ -371,35 +371,35 @@ OCMD(do_opurge)
|
|||
if (IS_NPC(ch))
|
||||
extract_char(ch);
|
||||
}
|
||||
|
||||
|
||||
for (o = world[rm].contents; o; o = next_obj ) {
|
||||
next_obj = o->next_content;
|
||||
if (o != obj)
|
||||
extract_obj(o);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
} /* no arg */
|
||||
|
||||
|
||||
ch = get_char_by_obj(obj, arg);
|
||||
if (!ch) {
|
||||
o = get_obj_by_obj(obj, arg);
|
||||
if (o) {
|
||||
if (o==obj)
|
||||
if (o==obj)
|
||||
dg_owner_purged = 1;
|
||||
extract_obj(o);
|
||||
} else
|
||||
} else
|
||||
obj_log(obj, "opurge: bad argument");
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!IS_NPC(ch)) {
|
||||
obj_log(obj, "opurge: purging a PC");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
extract_char(ch);
|
||||
}
|
||||
|
||||
|
|
@ -411,7 +411,7 @@ OCMD(do_oteleport)
|
|||
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
||||
|
||||
two_arguments(argument, arg1, arg2);
|
||||
|
||||
|
||||
if (!*arg1 || !*arg2)
|
||||
{
|
||||
obj_log(obj, "oteleport called with too few args");
|
||||
|
|
@ -419,10 +419,10 @@ OCMD(do_oteleport)
|
|||
}
|
||||
|
||||
target = find_obj_target_room(obj, arg2);
|
||||
|
||||
if (target == NOWHERE)
|
||||
|
||||
if (target == NOWHERE)
|
||||
obj_log(obj, "oteleport target is an invalid room");
|
||||
|
||||
|
||||
else if (!str_cmp(arg1, "all"))
|
||||
{
|
||||
rm = obj_room(obj);
|
||||
|
|
@ -432,14 +432,14 @@ OCMD(do_oteleport)
|
|||
for (ch = world[rm].people; ch; ch = next_ch)
|
||||
{
|
||||
next_ch = ch->next_in_room;
|
||||
if (!valid_dg_target(ch, DG_ALLOW_GODS))
|
||||
if (!valid_dg_target(ch, DG_ALLOW_GODS))
|
||||
continue;
|
||||
char_from_room(ch);
|
||||
char_to_room(ch, target);
|
||||
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
if ((ch = get_char_by_obj(obj, arg1))) {
|
||||
|
|
@ -449,7 +449,7 @@ OCMD(do_oteleport)
|
|||
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
obj_log(obj, "oteleport: no target found");
|
||||
}
|
||||
|
|
@ -474,13 +474,13 @@ OCMD(do_dgoload)
|
|||
obj_log(obj, "oload: bad syntax");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((room = obj_room(obj)) == NOWHERE)
|
||||
{
|
||||
obj_log(obj, "oload: object in NOWHERE trying to load");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* load mob to target room - Jamie Nelson, April 13 2004 */
|
||||
if (is_abbrev(arg1, "mob")) {
|
||||
room_rnum rnum;
|
||||
|
|
@ -496,7 +496,7 @@ OCMD(do_dgoload)
|
|||
if ((mob = read_mobile(number, VIRTUAL)) == NULL) {
|
||||
obj_log(obj, "oload: bad mob vnum");
|
||||
return;
|
||||
}
|
||||
}
|
||||
char_to_room(mob, rnum);
|
||||
|
||||
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));
|
||||
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. */
|
||||
if (!target || !*target) {
|
||||
obj_to_room(object, room);
|
||||
|
|
@ -548,11 +548,11 @@ OCMD(do_dgoload)
|
|||
return;
|
||||
}
|
||||
/* neither char nor container found - just dump it in room */
|
||||
obj_to_room(object, room);
|
||||
obj_to_room(object, room);
|
||||
load_otrigger(object);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
obj_log(obj, "oload: bad type");
|
||||
|
||||
|
|
@ -573,9 +573,9 @@ OCMD(do_odamage) {
|
|||
|
||||
dam = atoi(amount);
|
||||
ch = get_char_by_obj(obj, name);
|
||||
|
||||
|
||||
if (!ch) {
|
||||
obj_log(obj, "odamage: target not found");
|
||||
obj_log(obj, "odamage: target not found");
|
||||
return;
|
||||
}
|
||||
script_damage(ch, dam);
|
||||
|
|
@ -593,7 +593,7 @@ OCMD(do_oasound)
|
|||
obj_log(obj, "oasound called with no args");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((room = obj_room(obj)) == NOWHERE) {
|
||||
obj_log(obj, "oecho called by object in NOWHERE");
|
||||
return;
|
||||
|
|
@ -636,12 +636,12 @@ OCMD(do_odoor)
|
|||
obj_log(obj, "odoor called with too few args");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((rm = get_room(target)) == NULL) {
|
||||
obj_log(obj, "odoor: invalid target");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((dir = search_block(direction, dirs, FALSE)) == -1) {
|
||||
obj_log(obj, "odoor: invalid direction");
|
||||
return;
|
||||
|
|
@ -669,9 +669,9 @@ OCMD(do_odoor)
|
|||
else {
|
||||
if (!newexit) {
|
||||
CREATE(newexit, struct room_direction_data, 1);
|
||||
rm->dir_option[dir] = newexit;
|
||||
rm->dir_option[dir] = newexit;
|
||||
}
|
||||
|
||||
|
||||
switch (fd) {
|
||||
case 1: /* description */
|
||||
if (newexit->general_description)
|
||||
|
|
@ -724,7 +724,7 @@ OCMD(do_osetval)
|
|||
}
|
||||
|
||||
/* submitted by PurpleOnyx - tkhasi@shadowglen.com*/
|
||||
OCMD(do_oat)
|
||||
OCMD(do_oat)
|
||||
{
|
||||
char location[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
||||
int vnum = 0, rnum = 0;
|
||||
|
|
@ -733,13 +733,13 @@ OCMD(do_oat)
|
|||
half_chop(argument, location, arg2);
|
||||
|
||||
if (!*location || !*arg2 || !isdigit(*location)) {
|
||||
obj_log(obj, "oat: bad syntax : %s", argument);
|
||||
obj_log(obj, "oat: bad syntax : %s", argument);
|
||||
return;
|
||||
}
|
||||
|
||||
vnum = atoi(location);
|
||||
rnum = real_room(vnum);
|
||||
|
||||
|
||||
if (rnum == NOWHERE) {
|
||||
obj_log(obj, "oat: location not found");
|
||||
return;
|
||||
|
|
@ -748,10 +748,10 @@ OCMD(do_oat)
|
|||
object = read_object(GET_OBJ_VNUM(obj), VIRTUAL);
|
||||
if (!object)
|
||||
return;
|
||||
|
||||
|
||||
obj_to_room(object, rnum);
|
||||
obj_command_interpreter(object, arg2);
|
||||
|
||||
|
||||
if (object->in_room == rnum)
|
||||
extract_obj(object);
|
||||
}
|
||||
|
|
@ -775,7 +775,7 @@ const struct obj_command_info obj_cmd_info[] = {
|
|||
{ "otimer " , do_otimer , 0 },
|
||||
{ "otransform " , do_otransform, 0 },
|
||||
{ "ozoneecho " , do_ozoneecho , 0 }, /* fix by Rumble */
|
||||
|
||||
|
||||
{ "\n", 0, 0 } /* this must be last */
|
||||
};
|
||||
|
||||
|
|
@ -788,9 +788,9 @@ void obj_command_interpreter(obj_data *obj, char *argument)
|
|||
{
|
||||
int cmd, length;
|
||||
char *line, arg[MAX_INPUT_LENGTH];
|
||||
|
||||
|
||||
skip_spaces(&argument);
|
||||
|
||||
|
||||
/* just drop to next line for hitting CR */
|
||||
if (!*argument)
|
||||
return;
|
||||
|
|
@ -803,10 +803,10 @@ void obj_command_interpreter(obj_data *obj, char *argument)
|
|||
*obj_cmd_info[cmd].command != '\n'; cmd++)
|
||||
if (!strncmp(obj_cmd_info[cmd].command, arg, length))
|
||||
break;
|
||||
|
||||
|
||||
if (*obj_cmd_info[cmd].command == '\n')
|
||||
obj_log(obj, "Unknown object cmd: '%s'", argument);
|
||||
else
|
||||
((*obj_cmd_info[cmd].command_pointer)
|
||||
((*obj_cmd_info[cmd].command_pointer)
|
||||
(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);
|
||||
|
||||
/* ***********************************************************************
|
||||
* trigedit
|
||||
* trigedit
|
||||
* ***********************************************************************/
|
||||
|
||||
ACMD(do_oasis_trigedit)
|
||||
{
|
||||
int number, real_num;
|
||||
struct descriptor_data *d;
|
||||
|
||||
|
||||
/*
|
||||
* Parse any arguments.
|
||||
*/
|
||||
|
|
@ -56,11 +56,11 @@ ACMD(do_oasis_trigedit)
|
|||
send_to_char(ch, "Specify a trigger VNUM to edit.\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
if (STATE(d) == CON_TRIGEDIT) {
|
||||
|
|
@ -81,7 +81,7 @@ ACMD(do_oasis_trigedit)
|
|||
free(d->olc);
|
||||
}
|
||||
CREATE(d->olc, struct oasis_olc_data, 1);
|
||||
|
||||
|
||||
/*
|
||||
* Find the zone.
|
||||
*/
|
||||
|
|
@ -91,7 +91,7 @@ ACMD(do_oasis_trigedit)
|
|||
d->olc = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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;
|
||||
}
|
||||
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
|
||||
*/
|
||||
if ((real_num = real_trigger(number)) == NOTHING)
|
||||
trigedit_setup_new(d);
|
||||
else
|
||||
trigedit_setup_existing(d, real_num);
|
||||
|
||||
|
||||
STATE(d) = CON_TRIGEDIT;
|
||||
|
||||
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
||||
|
||||
|
||||
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));
|
||||
}
|
||||
|
|
@ -151,7 +151,7 @@ void script_save_to_disk(FILE *fp, void *item, int type)
|
|||
void trigedit_setup_new(struct descriptor_data *d)
|
||||
{
|
||||
struct trig_data *trig;
|
||||
|
||||
|
||||
/*
|
||||
* Allocate a scratch trigger structure
|
||||
*/
|
||||
|
|
@ -161,19 +161,19 @@ void trigedit_setup_new(struct descriptor_data *d)
|
|||
|
||||
/*
|
||||
* Set up some defaults
|
||||
*/
|
||||
*/
|
||||
trig->name = strdup("new trigger");
|
||||
trig->trigger_type = MTRIG_GREET;
|
||||
|
||||
/* cmdlist will be a large char string until the trigger is saved */
|
||||
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);
|
||||
trig->narg = 100;
|
||||
|
||||
OLC_TRIG(d) = trig;
|
||||
OLC_VAL(d) = 0; /* Has changed flag. (It hasn't so far, we just made it.) */
|
||||
|
||||
|
||||
trigedit_disp_menu(d);
|
||||
}
|
||||
|
||||
|
|
@ -192,7 +192,7 @@ void trigedit_setup_existing(struct descriptor_data *d, int rtrg_num)
|
|||
c = trig->cmdlist;
|
||||
CREATE(OLC_STORAGE(d), char, MAX_CMD_LENGTH);
|
||||
strcpy(OLC_STORAGE(d), "");
|
||||
|
||||
|
||||
while (c)
|
||||
{
|
||||
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_VAL(d) = 0; /* Has changed flag. (It hasn't so far, we just made it.) */
|
||||
|
||||
|
||||
trigedit_disp_menu(d);
|
||||
}
|
||||
|
||||
|
|
@ -227,10 +227,10 @@ void trigedit_disp_menu(struct descriptor_data *d)
|
|||
attach_type = "Mobiles";
|
||||
sprintbit(GET_TRIG_TYPE(trig), trig_types, trgtypes, sizeof(trgtypes));
|
||||
}
|
||||
|
||||
|
||||
clear_screen(d);
|
||||
|
||||
write_to_output(d,
|
||||
write_to_output(d,
|
||||
"Trigger Editor [%s%d%s]\r\n\r\n"
|
||||
"%s1)%s Name : %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;
|
||||
const char **types;
|
||||
char bitbuf[MAX_STRING_LENGTH];
|
||||
|
||||
|
||||
switch(OLC_TRIG(d)->attach_type)
|
||||
{
|
||||
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));
|
||||
write_to_output(d, "\r\nCurrent types : %s%s%s\r\nEnter type (0 to quit) : ",
|
||||
cyn, bitbuf, nrm);
|
||||
|
||||
|
||||
}
|
||||
|
||||
void trigedit_parse(struct descriptor_data *d, char *arg)
|
||||
|
|
@ -342,7 +342,7 @@ void trigedit_parse(struct descriptor_data *d, char *arg)
|
|||
return;
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
case TRIGEDIT_CONFIRM_SAVESTRING:
|
||||
switch(tolower(*arg)) {
|
||||
case 'y':
|
||||
|
|
@ -425,10 +425,10 @@ void trigedit_save(struct descriptor_data *d)
|
|||
char buf[MAX_CMD_LENGTH];
|
||||
char bitBuf[MAX_INPUT_LENGTH];
|
||||
char fname[MAX_INPUT_LENGTH];
|
||||
|
||||
|
||||
if ((rnum = real_trigger(OLC_NUM(d))) != NOTHING) {
|
||||
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;
|
||||
if (cmd->cmd)
|
||||
free(cmd->cmd);
|
||||
|
|
@ -441,7 +441,7 @@ void trigedit_save(struct descriptor_data *d)
|
|||
|
||||
/* Recompile the command list from the new script */
|
||||
s = OLC_STORAGE(d);
|
||||
|
||||
|
||||
CREATE(trig->cmdlist, struct cmdlist_element, 1);
|
||||
if (s) {
|
||||
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 = strdup(s);
|
||||
}
|
||||
} else
|
||||
} else
|
||||
trig->cmdlist->cmd = strdup("* No Script");
|
||||
|
||||
|
||||
/* make the prorotype look like what we have */
|
||||
trig_data_copy(proto, trig);
|
||||
|
||||
|
|
@ -490,7 +490,7 @@ void trigedit_save(struct descriptor_data *d)
|
|||
free_varlist(live_trig->var_list);
|
||||
live_trig->var_list=NULL;
|
||||
}
|
||||
|
||||
|
||||
live_trig->cmdlist = proto->cmdlist;
|
||||
live_trig->curr_state = live_trig->cmdlist;
|
||||
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);
|
||||
|
||||
/* Recompile the command list from the new script */
|
||||
|
||||
|
||||
s = OLC_STORAGE(d);
|
||||
|
||||
CREATE(trig->cmdlist, struct cmdlist_element, 1);
|
||||
if (s) {
|
||||
if (s) {
|
||||
/* 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");
|
||||
cmd = trig->cmdlist;
|
||||
|
||||
|
||||
while ((s = strtok(NULL, "\n\r"))) {
|
||||
CREATE(cmd->next, struct cmdlist_element, 1);
|
||||
cmd = cmd->next;
|
||||
cmd->cmd = strdup(s);
|
||||
}
|
||||
} else
|
||||
} else
|
||||
trig->cmdlist->cmd = strdup("* No Script");
|
||||
|
||||
|
||||
for (i = 0; i < top_of_trigt; i++) {
|
||||
if (!found) {
|
||||
if (trig_index[i]->vnum > OLC_NUM(d)) {
|
||||
found = TRUE;
|
||||
rnum = i;
|
||||
|
||||
|
||||
CREATE(new_index[rnum], struct index_data, 1);
|
||||
GET_TRIG_RNUM(OLC_TRIG(d)) = rnum;
|
||||
new_index[rnum]->vnum = OLC_NUM(d);
|
||||
new_index[rnum]->number = 0;
|
||||
new_index[rnum]->number = 0;
|
||||
new_index[rnum]->func = NULL;
|
||||
CREATE(proto, struct trig_data, 1);
|
||||
new_index[rnum]->proto = proto;
|
||||
|
|
@ -543,7 +543,7 @@ void trigedit_save(struct descriptor_data *d)
|
|||
if (trig->name)
|
||||
proto->name = strdup(trig->name);
|
||||
if (trig->arglist)
|
||||
proto->arglist = strdup(trig->arglist);
|
||||
proto->arglist = strdup(trig->arglist);
|
||||
|
||||
new_index[rnum + 1] = trig_index[rnum];
|
||||
|
||||
|
|
@ -562,11 +562,11 @@ void trigedit_save(struct descriptor_data *d)
|
|||
if (!found) {
|
||||
rnum = i;
|
||||
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]->number = 0;
|
||||
new_index[rnum]->func = NULL;
|
||||
|
||||
|
||||
CREATE(proto, struct trig_data, 1);
|
||||
new_index[rnum]->proto = proto;
|
||||
trig_data_copy(proto, trig);
|
||||
|
|
@ -574,18 +574,18 @@ void trigedit_save(struct descriptor_data *d)
|
|||
if (trig->name)
|
||||
proto->name = strdup(trig->name);
|
||||
if (trig->arglist)
|
||||
proto->arglist = strdup(trig->arglist);
|
||||
proto->arglist = strdup(trig->arglist);
|
||||
}
|
||||
|
||||
|
||||
free(trig_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 */
|
||||
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);
|
||||
|
||||
|
||||
/*
|
||||
* Update other trigs being edited.
|
||||
*/
|
||||
|
|
@ -613,18 +613,18 @@ void trigedit_save(struct descriptor_data *d)
|
|||
#endif
|
||||
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (i = zone_table[OLC_ZNUM(d)].bot; i <= top; i++) {
|
||||
if ((rnum = real_trigger(i)) != NOTHING) {
|
||||
trig = trig_index[rnum]->proto;
|
||||
|
||||
if (fprintf(trig_file, "#%d\n", i) < 0) {
|
||||
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);
|
||||
return;
|
||||
}
|
||||
|
|
@ -636,7 +636,7 @@ void trigedit_save(struct descriptor_data *d)
|
|||
trig->attach_type,
|
||||
*bitBuf ? bitBuf : "0", GET_TRIG_NARG(trig),
|
||||
GET_TRIG_ARG(trig) ? GET_TRIG_ARG(trig) : "", STRING_TERMINATOR);
|
||||
|
||||
|
||||
/* Build the text for the script */
|
||||
strcpy(buf,""); /* strcpy OK for MAX_CMD_LENGTH > 0*/
|
||||
for (cmd = trig->cmdlist; cmd; cmd = cmd->next) {
|
||||
|
|
@ -646,22 +646,22 @@ void trigedit_save(struct descriptor_data *d)
|
|||
|
||||
if (!buf[0])
|
||||
strcpy(buf, "* Empty script");
|
||||
|
||||
|
||||
fprintf(trig_file, "%s%c\n", buf, STRING_TERMINATOR);
|
||||
*buf = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fprintf(trig_file, "$%c\n", STRING_TERMINATOR);
|
||||
fclose(trig_file);
|
||||
|
||||
|
||||
#ifdef CIRCLE_MAC
|
||||
snprintf(buf, sizeof(buf), "%s:%d.trg", TRG_PREFIX, zone);
|
||||
#else
|
||||
snprintf(buf, sizeof(buf), "%s/%d.trg", TRG_PREFIX, zone);
|
||||
#endif
|
||||
|
||||
remove(buf);
|
||||
remove(buf);
|
||||
rename(fname, buf);
|
||||
|
||||
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");
|
||||
|
||||
editscript = OLC_SCRIPT(d);
|
||||
|
||||
|
||||
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,
|
||||
trig_index[real_trigger(editscript->vnum)]->proto->name, nrm);
|
||||
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;
|
||||
}
|
||||
if (i==0)
|
||||
if (i==0)
|
||||
write_to_output(d, " <none>\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.
|
||||
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
|
||||
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
|
||||
the pointers were updated correctly.
|
||||
|
||||
|
||||
Solution:
|
||||
Here we just point the working copies to the new proto_scripts
|
||||
We only update the original when choosing to save internally,
|
||||
then free the unused memory there.
|
||||
|
||||
Welcor
|
||||
|
||||
Thanks to
|
||||
|
||||
Thanks to
|
||||
Jeremy Stanley - fungi@yuggoth.org and
|
||||
Torgny Bjers - artovil@arcanerealms.org
|
||||
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;
|
||||
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.
|
||||
|
||||
|
||||
*/
|
||||
return 0;
|
||||
case 'n':
|
||||
|
|
@ -894,7 +894,7 @@ int dg_script_edit_parse(struct descriptor_data *d, char *arg)
|
|||
}
|
||||
|
||||
dg_script_menu(d);
|
||||
return 1;
|
||||
return 1;
|
||||
}
|
||||
|
||||
void trigedit_string_cleanup(struct descriptor_data *d, int terminator)
|
||||
|
|
@ -930,14 +930,14 @@ int format_script(struct descriptor_data *d)
|
|||
char *sc;
|
||||
size_t len = 0, nlen = 0, llen = 0;
|
||||
int indent = 0, indent_next = FALSE, found_case = FALSE, i, line_num = 0;
|
||||
|
||||
|
||||
if (!d->str || !*d->str)
|
||||
return FALSE;
|
||||
|
||||
|
||||
sc = strdup(*d->str); /* we work on a copy, because of strtok() */
|
||||
t = strtok(sc, "\n\r");
|
||||
*nsc = '\0';
|
||||
|
||||
|
||||
while (t) {
|
||||
line_num++;
|
||||
skip_spaces(&t);
|
||||
|
|
@ -997,20 +997,20 @@ int format_script(struct descriptor_data *d)
|
|||
}
|
||||
len = len + nlen + llen;
|
||||
strcat(nsc, line); /* strcat OK, size checked above */
|
||||
|
||||
|
||||
if (indent_next) {
|
||||
indent++;
|
||||
indent_next = FALSE;
|
||||
}
|
||||
t = strtok(NULL, "\n\r");
|
||||
}
|
||||
}
|
||||
|
||||
if (indent)
|
||||
if (indent)
|
||||
write_to_output(d, "Unmatched if, while or switch ignored.\r\n");
|
||||
|
||||
free(*d->str);
|
||||
*d->str = strdup(nsc);
|
||||
free(sc);
|
||||
|
||||
|
||||
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 */
|
||||
#define DG_CASTER_PROXY 1
|
||||
/* 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
|
||||
* a player is saved.
|
||||
*/
|
||||
#define NO_EXTRANEOUS_TRIGGERS
|
||||
/*
|
||||
/*
|
||||
* %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,
|
||||
* especially in those situations one needed the id of the room,
|
||||
* the items in it, etc. As a result of this, the output
|
||||
* has been changed (as of pl 8) to a room variable.
|
||||
* This means old scripts will need a minor adjustment;
|
||||
*
|
||||
*
|
||||
* Before:
|
||||
* if %actor.room%==3001
|
||||
* %echo% You are at the main temple.
|
||||
*
|
||||
* After:
|
||||
* eval room %actor.room%
|
||||
* eval room %actor.room%
|
||||
* if %room.vnum%==3001
|
||||
* %echo% You are at the main temple.
|
||||
*
|
||||
|
|
@ -122,7 +122,7 @@
|
|||
|
||||
/*
|
||||
* 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)
|
||||
|
||||
|
|
@ -143,7 +143,7 @@ struct trig_var_data {
|
|||
char *name; /* name of variable */
|
||||
char *value; /* value of variable */
|
||||
long context; /* 0: global context */
|
||||
|
||||
|
||||
struct trig_var_data *next;
|
||||
};
|
||||
|
||||
|
|
@ -163,8 +163,8 @@ struct trig_data {
|
|||
struct event *wait_event; /* event to pause the trigger */
|
||||
ubyte purged; /* trigger is set to be purged */
|
||||
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 */
|
||||
};
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ int is_substring(char *sub, char *string);
|
|||
int word_check(char *str, char *wordlist);
|
||||
|
||||
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_wtrigger(char_data *actor, char *str);
|
||||
void greet_memory_mtrigger(char_data *ch);
|
||||
|
|
@ -265,34 +265,34 @@ void time_otrigger(obj_data *obj);
|
|||
void time_wtrigger(room_data *room);
|
||||
|
||||
/* 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 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_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(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_room(room_data *room, 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_by_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);
|
||||
int trgvar_in_room(room_vnum vnum);
|
||||
obj_data *get_obj_in_list(char *name, obj_data *list);
|
||||
obj_data *get_object_in_equip(char_data * ch, char *name);
|
||||
void script_trigger_check(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_object(char_data *ch, obj_data *j);
|
||||
void do_sstat_character(char_data *ch, char_data *k);
|
||||
void add_trigger(struct script_data *sc, trig_data *t, int loc);
|
||||
void script_vlog(const char *format, va_list args);
|
||||
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);
|
||||
|
||||
/* 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);
|
||||
void process_eval(void *go, struct script_data *sc, trig_data *trig,
|
||||
int type, char *cmd);
|
||||
void read_saved_vars(struct char_data *ch);
|
||||
void save_char_vars(struct char_data *ch);
|
||||
void read_saved_vars(struct char_data *ch);
|
||||
void save_char_vars(struct char_data *ch);
|
||||
void init_lookup_table(void);
|
||||
void add_to_lookup_table(long uid, void *c);
|
||||
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);
|
||||
|
||||
/* 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);
|
||||
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);
|
||||
void send_char_pos(struct char_data *ch, int dam);
|
||||
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_MEM(c) ((c)->memory)
|
||||
|
||||
#define SCRIPT_TYPES(s) ((s)->types)
|
||||
#define SCRIPT_TYPES(s) ((s)->types)
|
||||
#define TRIGGERS(s) ((s)->trig_list)
|
||||
|
||||
#define GET_SHORT(ch) ((ch)->player.short_descr)
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ char *one_phrase(char *arg, char *first_arg)
|
|||
|
||||
s = first_arg;
|
||||
p = arg;
|
||||
|
||||
|
||||
while (*p && !isspace(*p) && *p != '"')
|
||||
*s++ = *p++;
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ int is_substring(char *sub, char *string)
|
|||
{
|
||||
int len = strlen(string);
|
||||
int sublen = strlen(sub);
|
||||
|
||||
|
||||
/* check front */
|
||||
if ((s == string || isspace(*(s - 1)) || ispunct(*(s - 1))) &&
|
||||
|
||||
|
|
@ -114,7 +114,7 @@ int word_check(char *str, char *wordlist)
|
|||
if (*wordlist=='*') return 1;
|
||||
|
||||
strcpy(words, wordlist);
|
||||
|
||||
|
||||
for (s = one_phrase(words, phrase); *phrase; s = one_phrase(s, phrase))
|
||||
if (is_substring(phrase, str))
|
||||
return 1;
|
||||
|
|
@ -122,7 +122,7 @@ int word_check(char *str, char *wordlist)
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* mob triggers
|
||||
|
|
@ -140,7 +140,7 @@ void random_mtrigger(char_data *ch)
|
|||
return;
|
||||
|
||||
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))) {
|
||||
script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);
|
||||
break;
|
||||
|
|
@ -152,7 +152,7 @@ void bribe_mtrigger(char_data *ch, char_data *actor, int amount)
|
|||
{
|
||||
trig_data *t;
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
|
||||
|
||||
if (!SCRIPT_CHECK(ch, MTRIG_BRIBE) || AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
|
|
@ -179,7 +179,7 @@ void greet_memory_mtrigger(char_data *actor)
|
|||
return;
|
||||
|
||||
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))
|
||||
continue;
|
||||
/* find memory line with command only */
|
||||
|
|
@ -227,19 +227,19 @@ int greet_mtrigger(char_data *actor, int dir)
|
|||
char_data *ch;
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
int intermediate, final=TRUE;
|
||||
|
||||
|
||||
if (!valid_dg_target(actor, DG_ALLOW_GODS))
|
||||
return TRUE;
|
||||
|
||||
for (ch = world[IN_ROOM(actor)].people; ch; ch = ch->next_in_room) {
|
||||
if (!SCRIPT_CHECK(ch, MTRIG_GREET | MTRIG_GREET_ALL) ||
|
||||
!AWAKE(ch) || FIGHTING(ch) || (ch == actor) ||
|
||||
if (!SCRIPT_CHECK(ch, MTRIG_GREET | MTRIG_GREET_ALL) ||
|
||||
!AWAKE(ch) || FIGHTING(ch) || (ch == actor) ||
|
||||
AFF_FLAGGED(ch, AFF_CHARM))
|
||||
continue;
|
||||
|
||||
|
||||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||
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))) {
|
||||
if (dir>=0 && dir < NUM_OF_DIRS)
|
||||
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)
|
||||
{
|
||||
trig_data *t;
|
||||
|
||||
|
||||
if (!SCRIPT_CHECK(ch, MTRIG_ENTRY) || AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return 1;
|
||||
|
||||
|
||||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||
if (TRIGGER_CHECK(t, MTRIG_ENTRY) && (rand_number(1, 100) <= GET_TRIG_NARG(t))){
|
||||
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 */
|
||||
if (!valid_dg_target(actor, 0))
|
||||
return 0;
|
||||
|
||||
|
||||
for (ch = world[IN_ROOM(actor)].people; ch; ch = ch_next) {
|
||||
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) {
|
||||
if (!TRIGGER_CHECK(t, MTRIG_COMMAND))
|
||||
continue;
|
||||
|
||||
|
||||
if (!GET_TRIG_ARG(t) || !*GET_TRIG_ARG(t)) {
|
||||
mudlog(NRM, LVL_BUILDER, TRUE, "SYSERR: Command Trigger #%d has no text argument!",
|
||||
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);
|
||||
skip_spaces(&cmd);
|
||||
add_var(&GET_TRIG_VARS(t), "cmd", cmd, 0);
|
||||
|
||||
|
||||
if (script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW))
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -358,7 +358,7 @@ int command_mtrigger(char_data *actor, char *cmd, char *argument)
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
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,
|
||||
obj_data *target, char *arg)
|
||||
{
|
||||
trig_data *t;
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
|
||||
|
||||
if (SCRIPT_CHECK(ch, MTRIG_ACT) && !AFF_FLAGGED(ch, AFF_CHARM) &&
|
||||
(actor!=ch))
|
||||
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';
|
||||
add_var(&GET_TRIG_VARS(t), "arg", nstr, 0);
|
||||
free(fstr);
|
||||
}
|
||||
}
|
||||
script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -443,11 +443,11 @@ void fight_mtrigger(char_data *ch)
|
|||
struct char_data *actor;
|
||||
trig_data *t;
|
||||
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))
|
||||
return;
|
||||
|
||||
|
||||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||
if (TRIGGER_CHECK(t, MTRIG_FIGHT) &&
|
||||
(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);
|
||||
else
|
||||
add_var(&GET_TRIG_VARS(t), "actor", "nobody", 0);
|
||||
|
||||
|
||||
script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);
|
||||
break;
|
||||
}
|
||||
|
|
@ -469,11 +469,11 @@ void hitprcnt_mtrigger(char_data *ch)
|
|||
struct char_data *actor;
|
||||
trig_data *t;
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
|
||||
|
||||
if (!SCRIPT_CHECK(ch, MTRIG_HITPRCNT) || !FIGHTING(ch) ||
|
||||
AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return;
|
||||
|
||||
|
||||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||
if (TRIGGER_CHECK(t, MTRIG_HITPRCNT) && GET_MAX_HIT(ch) &&
|
||||
(((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;
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
int ret_val;
|
||||
|
||||
|
||||
if (!SCRIPT_CHECK(ch, MTRIG_RECEIVE) || AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return 1;
|
||||
|
||||
|
||||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||
if (TRIGGER_CHECK(t, MTRIG_RECEIVE) &&
|
||||
(rand_number(1, 100) <= GET_TRIG_NARG(t))){
|
||||
|
|
@ -518,10 +518,10 @@ int death_mtrigger(char_data *ch, char_data *actor)
|
|||
{
|
||||
trig_data *t;
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
|
||||
|
||||
if (!SCRIPT_CHECK(ch, MTRIG_DEATH) || AFF_FLAGGED(ch, AFF_CHARM))
|
||||
return 1;
|
||||
|
||||
|
||||
for (t = TRIGGERS(SCRIPT(ch)); t; t = t->next) {
|
||||
if (TRIGGER_CHECK(t, MTRIG_DEATH) &&
|
||||
(rand_number(1, 100) <= GET_TRIG_NARG(t))){
|
||||
|
|
@ -538,12 +538,12 @@ void load_mtrigger(char_data *ch)
|
|||
{
|
||||
trig_data *t;
|
||||
int result = 0;
|
||||
|
||||
|
||||
if (!SCRIPT_CHECK(ch, MTRIG_LOAD))
|
||||
return;
|
||||
|
||||
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))) {
|
||||
result = script_driver(&ch, t, MOB_TRIGGER, TRIG_NEW);
|
||||
break;
|
||||
|
|
@ -654,7 +654,7 @@ void time_mtrigger(char_data *ch)
|
|||
return;
|
||||
|
||||
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))) {
|
||||
sprintf(buf, "%d", time_info.hours);
|
||||
add_var(&GET_TRIG_VARS(t), "time", buf, 0);
|
||||
|
|
@ -676,7 +676,7 @@ void random_otrigger(obj_data *obj)
|
|||
return;
|
||||
|
||||
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))) {
|
||||
script_driver(&obj, t, OBJ_TRIGGER, TRIG_NEW);
|
||||
break;
|
||||
|
|
@ -688,16 +688,16 @@ void random_otrigger(obj_data *obj)
|
|||
void timer_otrigger(struct obj_data *obj)
|
||||
{
|
||||
trig_data *t;
|
||||
|
||||
|
||||
if (!SCRIPT_CHECK(obj, OTRIG_TIMER))
|
||||
return;
|
||||
|
||||
|
||||
for (t = TRIGGERS(SCRIPT(obj)); t; t = t->next) {
|
||||
if (TRIGGER_CHECK(t, OTRIG_TIMER)) {
|
||||
script_driver(&obj, t, OBJ_TRIGGER, TRIG_NEW);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -735,19 +735,19 @@ int cmd_otrig(obj_data *obj, char_data *actor, char *cmd,
|
|||
{
|
||||
trig_data *t;
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
|
||||
|
||||
if (obj && SCRIPT_CHECK(obj, OTRIG_COMMAND))
|
||||
for (t = TRIGGERS(SCRIPT(obj)); t; t = t->next) {
|
||||
if (!TRIGGER_CHECK(t, OTRIG_COMMAND))
|
||||
continue;
|
||||
|
||||
|
||||
if (IS_SET(GET_TRIG_NARG(t), type) &&
|
||||
(!GET_TRIG_ARG(t) || !*GET_TRIG_ARG(t))) {
|
||||
mudlog(NRM, LVL_BUILDER, TRUE, "SYSERR: O-Command Trigger #%d has no text argument!",
|
||||
GET_TRIG_VNUM(t));
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
if (IS_SET(GET_TRIG_NARG(t), type) &&
|
||||
(*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 */
|
||||
if (!valid_dg_target(actor, 0))
|
||||
return 0;
|
||||
|
||||
|
||||
for (i = 0; i < NUM_WEARS; i++)
|
||||
if (GET_EQ(actor, i))
|
||||
if (cmd_otrig(GET_EQ(actor, i), actor, cmd, argument, OCMD_EQUIP))
|
||||
return 1;
|
||||
|
||||
|
||||
for (obj = actor->carrying; obj; obj = obj->next_content)
|
||||
if (cmd_otrig(obj, actor, cmd, argument, OCMD_INVEN))
|
||||
return 1;
|
||||
|
|
@ -798,7 +798,7 @@ int wear_otrigger(obj_data *obj, char_data *actor, int where)
|
|||
trig_data *t;
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
int ret_val;
|
||||
|
||||
|
||||
if (!SCRIPT_CHECK(obj, OTRIG_WEAR))
|
||||
return 1;
|
||||
|
||||
|
|
@ -825,7 +825,7 @@ int remove_otrigger(obj_data *obj, char_data *actor)
|
|||
trig_data *t;
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
int ret_val;
|
||||
|
||||
|
||||
if (!SCRIPT_CHECK(obj, OTRIG_REMOVE))
|
||||
return 1;
|
||||
|
||||
|
|
@ -852,7 +852,7 @@ int drop_otrigger(obj_data *obj, char_data *actor)
|
|||
trig_data *t;
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
int ret_val;
|
||||
|
||||
|
||||
if (!SCRIPT_CHECK(obj, OTRIG_DROP))
|
||||
return 1;
|
||||
|
||||
|
|
@ -879,7 +879,7 @@ int give_otrigger(obj_data *obj, char_data *actor, char_data *victim)
|
|||
trig_data *t;
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
int ret_val;
|
||||
|
||||
|
||||
if (!SCRIPT_CHECK(obj, OTRIG_GIVE))
|
||||
return 1;
|
||||
|
||||
|
|
@ -906,12 +906,12 @@ void load_otrigger(obj_data *obj)
|
|||
{
|
||||
trig_data *t;
|
||||
int result = 0;
|
||||
|
||||
|
||||
if (!SCRIPT_CHECK(obj, OTRIG_LOAD))
|
||||
return;
|
||||
|
||||
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))) {
|
||||
result = script_driver(&obj, t, OBJ_TRIGGER, TRIG_NEW);
|
||||
break;
|
||||
|
|
@ -960,7 +960,7 @@ int leave_otrigger(room_data *room, char_data *actor, int dir)
|
|||
|
||||
if (!valid_dg_target(actor, DG_ALLOW_GODS))
|
||||
return 1;
|
||||
|
||||
|
||||
for (obj = room->contents; obj; obj = obj_next) {
|
||||
obj_next = obj->next_content;
|
||||
if (!SCRIPT_CHECK(obj, OTRIG_LEAVE))
|
||||
|
|
@ -980,7 +980,7 @@ int leave_otrigger(room_data *room, char_data *actor, int dir)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return final;
|
||||
}
|
||||
|
||||
|
|
@ -989,7 +989,7 @@ int consume_otrigger(obj_data *obj, char_data *actor, int cmd)
|
|||
trig_data *t;
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
int ret_val;
|
||||
|
||||
|
||||
if (!SCRIPT_CHECK(obj, OTRIG_CONSUME))
|
||||
return 1;
|
||||
|
||||
|
|
@ -1030,7 +1030,7 @@ void time_otrigger(obj_data *obj)
|
|||
return;
|
||||
|
||||
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))) {
|
||||
sprintf(buf, "%d", time_info.hours);
|
||||
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;
|
||||
|
||||
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))) {
|
||||
if (dir>=0 && dir < NUM_OF_DIRS)
|
||||
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 */
|
||||
if (!valid_dg_target(actor, 0))
|
||||
return 0;
|
||||
|
||||
|
||||
room = &world[IN_ROOM(actor)];
|
||||
for (t = TRIGGERS(SCRIPT(room)); t; t = t->next) {
|
||||
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);
|
||||
skip_spaces(&cmd);
|
||||
add_var(&GET_TRIG_VARS(t), "cmd", cmd, 0);
|
||||
|
||||
|
||||
return script_driver(&room, t, WLD_TRIGGER, TRIG_NEW);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -1178,14 +1178,14 @@ int drop_wtrigger(obj_data *obj, char_data *actor)
|
|||
trig_data *t;
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
int ret_val;
|
||||
|
||||
|
||||
if (!actor || !SCRIPT_CHECK(&world[IN_ROOM(actor)], WTRIG_DROP))
|
||||
return 1;
|
||||
|
||||
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) &&
|
||||
(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, obj, "object", 0);
|
||||
ret_val = script_driver(&room, t, WLD_TRIGGER, TRIG_NEW);
|
||||
|
|
@ -1194,7 +1194,7 @@ int drop_wtrigger(obj_data *obj, char_data *actor)
|
|||
else
|
||||
return ret_val;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -4,14 +4,14 @@
|
|||
* *
|
||||
* *
|
||||
* $Author: Mark A. Heilpern/egreen/Welcor $ *
|
||||
* $Date: 2004/10/11 12:07:00 $ *
|
||||
* $Date: 2004/10/11 12:07:00 $ *
|
||||
* $Revision: 1.0.14 $ *
|
||||
**************************************************************************/
|
||||
|
||||
#include "conf.h"
|
||||
#include "sysdep.h"
|
||||
|
||||
|
||||
|
||||
#include "structs.h"
|
||||
#include "dg_scripts.h"
|
||||
#include "utils.h"
|
||||
|
|
@ -32,19 +32,19 @@ extern struct time_info_data time_info;
|
|||
/* 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
|
||||
*/
|
||||
/* 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)
|
||||
{
|
||||
struct trig_var_data *vd;
|
||||
|
||||
|
||||
if (strchr(name, '.')) {
|
||||
log("add_var() : Attempt to add illegal var: %s", name);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (vd = *var_list; vd && str_cmp(vd->name, name); vd = vd->next);
|
||||
|
||||
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 {
|
||||
CREATE(vd, struct trig_var_data, 1);
|
||||
|
||||
|
||||
CREATE(vd->name, char, strlen(name) + 1);
|
||||
strcpy(vd->name, name); /* strcpy: ok*/
|
||||
|
||||
|
||||
CREATE(vd->value, char, strlen(value) + 1);
|
||||
|
||||
vd->next = *var_list;
|
||||
|
|
@ -82,20 +82,20 @@ char *skill_percent(struct char_data *ch, char *skill)
|
|||
return retval;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
search through all the persons items, including containers
|
||||
and 0 if it doesnt exist, and greater then 0 if it does!
|
||||
Jamie Nelson (mordecai@timespace.co.nz)
|
||||
MUD -- 4dimensions.org:6000
|
||||
|
||||
|
||||
Now also searches by vnum -- Welcor
|
||||
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;
|
||||
int count = 0;
|
||||
int count = 0;
|
||||
|
||||
if (!item || !*item)
|
||||
return 0;
|
||||
|
|
@ -104,35 +104,35 @@ int item_in_list(char *item, obj_data *list)
|
|||
long id = atol(item + 1);
|
||||
|
||||
for (i = list; i; i = i->next_content) {
|
||||
if (id == GET_ID(i))
|
||||
if (id == GET_ID(i))
|
||||
count ++;
|
||||
if (GET_OBJ_TYPE(i) == ITEM_CONTAINER)
|
||||
if (GET_OBJ_TYPE(i) == ITEM_CONTAINER)
|
||||
count += item_in_list(item, i->contains);
|
||||
}
|
||||
} else if (is_number(item)) { /* check for vnum */
|
||||
obj_vnum ovnum = atoi(item);
|
||||
|
||||
|
||||
for (i = list; i; i = i->next_content) {
|
||||
if (GET_OBJ_VNUM(i) == ovnum)
|
||||
if (GET_OBJ_VNUM(i) == ovnum)
|
||||
count++;
|
||||
if (GET_OBJ_TYPE(i) == ITEM_CONTAINER)
|
||||
if (GET_OBJ_TYPE(i) == ITEM_CONTAINER)
|
||||
count += item_in_list(item, i->contains);
|
||||
}
|
||||
} else {
|
||||
for (i = list; i; i = i->next_content) {
|
||||
if (isname(item, i->name))
|
||||
if (isname(item, i->name))
|
||||
count++;
|
||||
if (GET_OBJ_TYPE(i) == ITEM_CONTAINER)
|
||||
if (GET_OBJ_TYPE(i) == ITEM_CONTAINER)
|
||||
count += item_in_list(item, i->contains);
|
||||
}
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
BOOLEAN return, just check if a player or mob
|
||||
has an item of any sort, searched for by name
|
||||
or id.
|
||||
or id.
|
||||
searching equipment as well as inventory,
|
||||
and containers.
|
||||
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 (get_object_in_equip(ch, item) != NULL)
|
||||
return 1;
|
||||
if (get_object_in_equip(ch, item) != NULL)
|
||||
return 1;
|
||||
|
||||
if (item_in_list(item, ch->carrying) == 0)
|
||||
return 0;
|
||||
|
|
@ -157,17 +157,17 @@ int text_processed(char *field, char *subfield, struct trig_var_data *vd,
|
|||
{
|
||||
char *p, *p2;
|
||||
char tmpvar[MAX_STRING_LENGTH];
|
||||
|
||||
|
||||
if (!str_cmp(field, "strlen")) { /* strlen */
|
||||
snprintf(str, slen, "%d", strlen(vd->value));
|
||||
return TRUE;
|
||||
} else if (!str_cmp(field, "trim")) { /* trim */
|
||||
/* trim whitespace from ends */
|
||||
snprintf(tmpvar, sizeof(tmpvar)-1 , "%s", vd->value); /* -1 to use later*/
|
||||
p = tmpvar;
|
||||
p2 = tmpvar + strlen(tmpvar) - 1;
|
||||
while (*p && isspace(*p)) p++;
|
||||
while ((p<=p2) && isspace(*p2)) p2--;
|
||||
p = tmpvar;
|
||||
p2 = tmpvar + strlen(tmpvar) - 1;
|
||||
while (*p && isspace(*p)) p++;
|
||||
while ((p<=p2) && isspace(*p2)) p2--;
|
||||
if (p>p2) { /* nothing left */
|
||||
*str = '\0';
|
||||
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 */
|
||||
if (str_str(vd->value, subfield))
|
||||
strcpy(str, "1");
|
||||
else
|
||||
else
|
||||
strcpy(str, "0");
|
||||
return TRUE;
|
||||
} 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 = '\0';
|
||||
return TRUE;
|
||||
|
||||
|
||||
} else if (!str_cmp(field, "cdr")) { /* cdr */
|
||||
char *cdr = vd->value;
|
||||
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)
|
||||
strcpy(str, "");
|
||||
else
|
||||
snprintf(str, slen, "%c", vd->value[index - 1]);
|
||||
snprintf(str, slen, "%c", vd->value[index - 1]);
|
||||
return TRUE;
|
||||
} else if (!str_cmp(field, "mudcommand")) {
|
||||
/* 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))
|
||||
break;
|
||||
|
||||
if (*cmd_info[cmd].command == '\n')
|
||||
if (*cmd_info[cmd].command == '\n')
|
||||
*str = '\0';
|
||||
else
|
||||
else
|
||||
snprintf(str, slen, "%s", cmd_info[cmd].command);
|
||||
return TRUE;
|
||||
}
|
||||
|
|
@ -254,19 +254,19 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
|||
char *recho[] = {"mrecho ", "orecho ", "wrecho " };
|
||||
|
||||
*str = '\0';
|
||||
|
||||
|
||||
/* X.global() will have a NULL trig */
|
||||
if (trig)
|
||||
for (vd = GET_TRIG_VARS(trig); vd; vd = vd->next)
|
||||
if (!str_cmp(vd->name, var))
|
||||
break;
|
||||
|
||||
|
||||
/* 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)
|
||||
if (!str_cmp(vd->name, var) &&
|
||||
(vd->context==0 || vd->context==sc->context))
|
||||
break;
|
||||
break;
|
||||
|
||||
if (!*field) {
|
||||
if (vd)
|
||||
|
|
@ -285,7 +285,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
|||
break;
|
||||
}
|
||||
}
|
||||
else if (!str_cmp(var, "global")) {
|
||||
else if (!str_cmp(var, "global")) {
|
||||
/* so "remote varname %global%" will work */
|
||||
snprintf(str, slen, "%d", ROOM_ID_BASE);
|
||||
return;
|
||||
|
|
@ -367,7 +367,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
|||
case MOB_TRIGGER:
|
||||
c = (char_data *) go;
|
||||
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 */
|
||||
case OBJ_TRIGGER:
|
||||
o = (obj_data *) go;
|
||||
|
|
@ -381,7 +381,7 @@ void find_replacement(void *go, struct script_data *sc, trig_data *trig,
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else if (!str_cmp(var, "global")) {
|
||||
struct script_data *thescript = SCRIPT(&world[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)
|
||||
if (!str_cmp(vd->name, field))
|
||||
break;
|
||||
|
||||
break;
|
||||
|
||||
if (vd)
|
||||
snprintf(str, slen, "%s", vd->value);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
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;
|
||||
}
|
||||
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
|
||||
%findmob.<room vnum X>(<mob vnum Y>)%
|
||||
%findmob.<room vnum X>(<mob 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.
|
||||
|
|
@ -427,10 +427,10 @@ you would type:
|
|||
in any script:
|
||||
%echo% players in room 1204: %findmob.1204(-1)%
|
||||
|
||||
Or say you had a bank, and you want a script to check the number of
|
||||
bags
|
||||
Or say you had a bank, and you want a script to check the number of
|
||||
bags
|
||||
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.
|
||||
|
||||
**/
|
||||
|
|
@ -443,7 +443,7 @@ in the vault (vnum: 453) now and then. you can just use
|
|||
} else {
|
||||
room_rnum rrnum = real_room(atoi(field));
|
||||
mob_vnum mvnum = atoi(subfield);
|
||||
|
||||
|
||||
if (rrnum == NOWHERE) {
|
||||
script_log("findmob.vnum(ovnum): No room with vnum %d", atoi(field));
|
||||
strcpy(str, "0");
|
||||
|
|
@ -463,7 +463,7 @@ in the vault (vnum: 453) now and then. you can just use
|
|||
strcpy(str, "0");
|
||||
} else {
|
||||
room_rnum rrnum = real_room(atoi(field));
|
||||
|
||||
|
||||
if (rrnum == NOWHERE) {
|
||||
script_log("findobj.vnum(ovnum): No room with vnum %d", atoi(field));
|
||||
strcpy(str, "0");
|
||||
|
|
@ -488,7 +488,7 @@ in the vault (vnum: 453) now and then. you can just use
|
|||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else if (type == OBJ_TRIGGER) {
|
||||
for (c = world[obj_room((obj_data *) go)].people; c;
|
||||
c = c->next_in_room)
|
||||
|
|
@ -498,18 +498,18 @@ in the vault (vnum: 453) now and then. you can just use
|
|||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else if (type == WLD_TRIGGER) {
|
||||
for (c = ((struct room_data *) go)->people; c;
|
||||
c = c->next_in_room)
|
||||
if (valid_dg_target(c, DG_ALLOW_GODS)) {
|
||||
|
||||
|
||||
if (!rand_number(0, count))
|
||||
rndm = c;
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (rndm)
|
||||
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(rndm));
|
||||
else
|
||||
|
|
@ -518,7 +518,7 @@ in the vault (vnum: 453) now and then. you can just use
|
|||
|
||||
else if (!str_cmp(field, "dir")) {
|
||||
room_rnum in_room = NOWHERE;
|
||||
|
||||
|
||||
switch (type) {
|
||||
case WLD_TRIGGER:
|
||||
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 {
|
||||
doors = 0;
|
||||
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))
|
||||
doors++;
|
||||
|
||||
|
||||
if (!doors) {
|
||||
*str = '\0';
|
||||
} else {
|
||||
|
|
@ -553,11 +553,11 @@ in the vault (vnum: 453) now and then. you can just use
|
|||
}
|
||||
else
|
||||
snprintf(str, slen, "%d", ((num = atoi(field)) > 0) ? rand_number(1, num) : 0);
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (c) {
|
||||
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 */
|
||||
*str = '\x1';
|
||||
|
||||
|
||||
switch (LOWER(*field)) {
|
||||
case 'a':
|
||||
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);
|
||||
if (affected_by_spell(c, spell))
|
||||
strcpy(str, "1");
|
||||
else
|
||||
else
|
||||
strcpy(str, "0");
|
||||
} else
|
||||
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 (subfield && *subfield) {
|
||||
int addition = MIN(atoi(subfield), 1000);
|
||||
|
||||
|
||||
gain_exp(c, addition);
|
||||
}
|
||||
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';
|
||||
else if (*subfield == '*') {
|
||||
for (i = 0, j = 0; i < NUM_WEARS; i++)
|
||||
if (GET_EQ(c, i)) {
|
||||
if (GET_EQ(c, i)) {
|
||||
j++;
|
||||
break;
|
||||
}
|
||||
|
|
@ -672,9 +672,9 @@ in the vault (vnum: 453) now and then. you can just use
|
|||
if (!str_cmp(field, "fighting")) {
|
||||
if (FIGHTING(c))
|
||||
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(FIGHTING(c)));
|
||||
else
|
||||
else
|
||||
*str = '\0';
|
||||
}
|
||||
}
|
||||
else if (!str_cmp(field, "follower")) {
|
||||
if (!c->followers || !c->followers->follower)
|
||||
*str = '\0';
|
||||
|
|
@ -700,10 +700,10 @@ in the vault (vnum: 453) now and then. you can just use
|
|||
}
|
||||
else if (!str_cmp(field, "hisher"))
|
||||
snprintf(str, slen, "%s", HSHR(c));
|
||||
|
||||
|
||||
else if (!str_cmp(field, "heshe"))
|
||||
snprintf(str, slen, "%s", HSSH(c));
|
||||
|
||||
|
||||
else if (!str_cmp(field, "himher"))
|
||||
snprintf(str, slen, "%s", HMHR(c));
|
||||
|
||||
|
|
@ -759,7 +759,7 @@ in the vault (vnum: 453) now and then. you can just use
|
|||
else
|
||||
strcpy(str, "0");
|
||||
}
|
||||
|
||||
|
||||
else if (!str_cmp(field, "is_thief")) {
|
||||
if (subfield && *subfield) {
|
||||
if (!str_cmp("on", subfield))
|
||||
|
|
@ -786,7 +786,7 @@ in the vault (vnum: 453) now and then. you can just use
|
|||
break;
|
||||
case 'l':
|
||||
if (!str_cmp(field, "level"))
|
||||
snprintf(str, slen, "%d", GET_LEVEL(c));
|
||||
snprintf(str, slen, "%d", GET_LEVEL(c));
|
||||
break;
|
||||
case 'm':
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
else if (!str_cmp(field, "move")) {
|
||||
if (subfield && *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));
|
||||
}
|
||||
|
||||
|
||||
else if (!str_cmp(field, "maxmove")) {
|
||||
if (subfield && *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));
|
||||
}
|
||||
|
||||
|
||||
else if (!str_cmp(field, "master")) {
|
||||
if (!c->master)
|
||||
*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")) {
|
||||
if (c->next_in_room)
|
||||
snprintf(str, slen,"%c%ld",UID_CHAR, GET_ID(c->next_in_room));
|
||||
else
|
||||
else
|
||||
*str = '\0';
|
||||
}
|
||||
break;
|
||||
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 :)*/
|
||||
if (!str_cmp(field, "pos")) {
|
||||
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 */
|
||||
/* see note in dg_scripts.h */
|
||||
#ifdef ACTOR_ROOM_IS_UID
|
||||
snprintf(str, slen, "%c%ld",UID_CHAR,
|
||||
(IN_ROOM(c)!= NOWHERE) ? (long) world[IN_ROOM(c)].number + ROOM_ID_BASE : ROOM_ID_BASE);
|
||||
#else
|
||||
snprintf(str, slen, "%c%ld",UID_CHAR,
|
||||
(IN_ROOM(c)!= NOWHERE) ? (long) world[IN_ROOM(c)].number + ROOM_ID_BASE : ROOM_ID_BASE);
|
||||
#else
|
||||
snprintf(str, slen, "%d", (IN_ROOM(c)!= NOWHERE) ? world[IN_ROOM(c)].number : 0);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#ifdef GET_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';
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef RIDDEN_BY
|
||||
else if (!str_cmp(field, "ridden_by")) {
|
||||
if (RIDDEN_BY(c))
|
||||
|
|
@ -944,7 +944,7 @@ in the vault (vnum: 453) now and then. you can just use
|
|||
if (skillnum > 0) {
|
||||
int new_value = MAX(0, MIN(100, atoi(amount)));
|
||||
SET_SKILL(c, skillnum, new_value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*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 (!IS_NPC(c) && subfield && *subfield && valid_dg_target(c, DG_ALLOW_GODS)) {
|
||||
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));
|
||||
}
|
||||
case 'v':
|
||||
|
|
@ -1002,14 +1002,14 @@ in the vault (vnum: 453) now and then. you can just use
|
|||
if (IS_NPC(c))
|
||||
snprintf(str, slen, "%d", GET_MOB_VNUM(c));
|
||||
else
|
||||
/*
|
||||
* for compatibility with unsigned indexes
|
||||
* - this is deprecated - use %actor.is_pc% to check
|
||||
/*
|
||||
* for compatibility with unsigned indexes
|
||||
* - this is deprecated - use %actor.is_pc% to check
|
||||
* instead of %actor.vnum% == -1 --Welcor 09/03
|
||||
*/
|
||||
strcpy(str, "-1");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
else if (!str_cmp(field, "varexists")) {
|
||||
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));
|
||||
}
|
||||
break;
|
||||
} /* switch *field */
|
||||
|
||||
} /* switch *field */
|
||||
|
||||
if (*str == '\x1') { /* no match found in switch */
|
||||
if (SCRIPT(c)) {
|
||||
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));
|
||||
}
|
||||
|
||||
|
||||
else if (!str_cmp(field, "cost_per_day")) {
|
||||
if (subfield && *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));
|
||||
}
|
||||
|
||||
|
||||
else if (!str_cmp(field, "carried_by")) {
|
||||
if (o->carried_by)
|
||||
snprintf(str, slen,"%c%ld",UID_CHAR, GET_ID(o->carried_by));
|
||||
else
|
||||
else
|
||||
*str = '\0';
|
||||
}
|
||||
|
||||
|
||||
else if (!str_cmp(field, "contents")) {
|
||||
if (o->contains)
|
||||
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(o->contains));
|
||||
else
|
||||
else
|
||||
*str = '\0';
|
||||
}
|
||||
/* thanks to Jamie Nelson (Mordecai of 4 Dimensions MUD) */
|
||||
else if (!str_cmp(field, "count")) {
|
||||
if (GET_OBJ_TYPE(o) == ITEM_CONTAINER)
|
||||
snprintf(str, slen, "%d", item_in_list(subfield,
|
||||
if (GET_OBJ_TYPE(o) == ITEM_CONTAINER)
|
||||
snprintf(str, slen, "%d", item_in_list(subfield,
|
||||
o->contains));
|
||||
else
|
||||
strcpy(str, "0");
|
||||
|
|
@ -1105,9 +1105,9 @@ o->contains));
|
|||
break;
|
||||
case 'h':
|
||||
/* thanks to Jamie Nelson (Mordecai of 4 Dimensions MUD) */
|
||||
if (!str_cmp(field, "has_in")) {
|
||||
if (GET_OBJ_TYPE(o) == ITEM_CONTAINER)
|
||||
snprintf(str, slen, "%s", (item_in_list(subfield,
|
||||
if (!str_cmp(field, "has_in")) {
|
||||
if (GET_OBJ_TYPE(o) == ITEM_CONTAINER)
|
||||
snprintf(str, slen, "%s", (item_in_list(subfield,
|
||||
o->contains) ? "1" : "0"));
|
||||
else
|
||||
strcpy(str, "0");
|
||||
|
|
@ -1119,7 +1119,7 @@ o->contains) ? "1" : "0"));
|
|||
|
||||
else if (!str_cmp(field, "is_inroom")) {
|
||||
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
|
||||
*str = '\0';
|
||||
}
|
||||
|
|
@ -1127,11 +1127,11 @@ o->contains) ? "1" : "0"));
|
|||
case 'n':
|
||||
if (!str_cmp(field, "name"))
|
||||
snprintf(str, slen, "%s", o->name);
|
||||
|
||||
|
||||
else if (!str_cmp(field, "next_in_list")) {
|
||||
if (o->next_content)
|
||||
snprintf(str, slen,"%c%ld",UID_CHAR, GET_ID(o->next_content));
|
||||
else
|
||||
else
|
||||
*str = '\0';
|
||||
}
|
||||
break;
|
||||
|
|
@ -1139,7 +1139,7 @@ o->contains) ? "1" : "0"));
|
|||
if (!str_cmp(field, "room")) {
|
||||
if (obj_room(o) != NOWHERE)
|
||||
snprintf(str, slen,"%c%ld",UID_CHAR, (long)world[obj_room(o)].number + ROOM_ID_BASE);
|
||||
else
|
||||
else
|
||||
*str = '\0';
|
||||
}
|
||||
break;
|
||||
|
|
@ -1163,13 +1163,13 @@ o->contains) ? "1" : "0"));
|
|||
}
|
||||
else if (!str_cmp(field, "val0"))
|
||||
snprintf(str, slen, "%d", GET_OBJ_VAL(o, 0));
|
||||
|
||||
|
||||
else if (!str_cmp(field, "val1"))
|
||||
snprintf(str, slen, "%d", GET_OBJ_VAL(o, 1));
|
||||
|
||||
|
||||
else if (!str_cmp(field, "val2"))
|
||||
snprintf(str, slen, "%d", GET_OBJ_VAL(o, 2));
|
||||
|
||||
|
||||
else if (!str_cmp(field, "val3"))
|
||||
snprintf(str, slen, "%d", GET_OBJ_VAL(o, 3));
|
||||
break;
|
||||
|
|
@ -1185,7 +1185,7 @@ o->contains) ? "1" : "0"));
|
|||
else if (!str_cmp(field, "worn_by")) {
|
||||
if (o->worn_by)
|
||||
snprintf(str, slen,"%c%ld",UID_CHAR, GET_ID(o->worn_by));
|
||||
else
|
||||
else
|
||||
*str = '\0';
|
||||
}
|
||||
break;
|
||||
|
|
@ -1227,29 +1227,29 @@ o->contains) ? "1" : "0"));
|
|||
break;
|
||||
if (vd)
|
||||
snprintf(str, slen, "%s", vd->value);
|
||||
else
|
||||
else
|
||||
*str = '\0';
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
else if (!str_cmp(field, "name"))
|
||||
snprintf(str, slen, "%s", r->name);
|
||||
|
||||
else if (!str_cmp(field, "sector"))
|
||||
sprinttype(r->sector_type, sector_types, str, slen);
|
||||
|
||||
|
||||
else if (!str_cmp(field, "vnum")) {
|
||||
if (subfield && *subfield) {
|
||||
snprintf(str, slen, "%d", (int)(r->number == atoi(subfield)));
|
||||
} else {
|
||||
snprintf(str, slen,"%d",r->number);
|
||||
}
|
||||
snprintf(str, slen,"%d",r->number);
|
||||
}
|
||||
} else if (!str_cmp(field, "contents")) {
|
||||
if (subfield && *subfield) {
|
||||
for (obj = r->contents; obj; obj = obj->next_content) {
|
||||
if (GET_OBJ_VNUM(obj) == atoi(subfield)) {
|
||||
/* arg given, found */
|
||||
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(obj));
|
||||
snprintf(str, slen, "%c%ld", UID_CHAR, GET_ID(obj));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
|
@ -1263,7 +1263,7 @@ o->contains) ? "1" : "0"));
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else if (!str_cmp(field, "people")) {
|
||||
if (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")) {
|
||||
room_rnum rnum = real_room(r->number);
|
||||
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
|
||||
*str = '\0';
|
||||
}
|
||||
}
|
||||
else if (!str_cmp(field, "weather")) {
|
||||
const char *sky_look[] = {
|
||||
"sunny",
|
||||
|
|
@ -1301,7 +1301,7 @@ o->contains) ? "1" : "0"));
|
|||
sprintbit(R_EXIT(r, NORTH)->exit_info ,exit_bits, str, slen);
|
||||
else if (!str_cmp(subfield, "room")) {
|
||||
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
|
||||
*str = '\0';
|
||||
}
|
||||
|
|
@ -1321,7 +1321,7 @@ o->contains) ? "1" : "0"));
|
|||
sprintbit(R_EXIT(r, EAST)->exit_info ,exit_bits, str, slen);
|
||||
else if (!str_cmp(subfield, "room")) {
|
||||
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
|
||||
*str = '\0';
|
||||
}
|
||||
|
|
@ -1341,7 +1341,7 @@ o->contains) ? "1" : "0"));
|
|||
sprintbit(R_EXIT(r, SOUTH)->exit_info ,exit_bits, str, slen);
|
||||
else if (!str_cmp(subfield, "room")) {
|
||||
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
|
||||
*str = '\0';
|
||||
}
|
||||
|
|
@ -1361,7 +1361,7 @@ o->contains) ? "1" : "0"));
|
|||
sprintbit(R_EXIT(r, WEST)->exit_info ,exit_bits, str, slen);
|
||||
else if (!str_cmp(subfield, "room")) {
|
||||
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
|
||||
*str = '\0';
|
||||
}
|
||||
|
|
@ -1381,7 +1381,7 @@ o->contains) ? "1" : "0"));
|
|||
sprintbit(R_EXIT(r, UP)->exit_info ,exit_bits, str, slen);
|
||||
else if (!str_cmp(subfield, "room")) {
|
||||
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
|
||||
*str = '\0';
|
||||
}
|
||||
|
|
@ -1401,7 +1401,7 @@ o->contains) ? "1" : "0"));
|
|||
sprintbit(R_EXIT(r, DOWN)->exit_info ,exit_bits, str, slen);
|
||||
else if (!str_cmp(subfield, "room")) {
|
||||
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
|
||||
*str = '\0';
|
||||
}
|
||||
|
|
@ -1432,7 +1432,7 @@ o->contains) ? "1" : "0"));
|
|||
}
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* 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
|
||||
* it can recurse.
|
||||
|
|
@ -1446,7 +1446,7 @@ o->contains) ? "1" : "0"));
|
|||
* will double the actors gold every time its called. etc...
|
||||
* - Jamie Nelson 31st Oct 2003 01:24
|
||||
*/
|
||||
|
||||
|
||||
/* substitutes any variables into line and returns it as buf */
|
||||
void var_subst(void *go, struct script_data *sc, trig_data *trig,
|
||||
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*/
|
||||
*repl_str = *tmp = *tmp2 = '\0';
|
||||
|
||||
|
||||
p = strcpy(tmp, line);
|
||||
subfield_p = subfield;
|
||||
|
||||
|
||||
left = MAX_INPUT_LENGTH - 1;
|
||||
|
||||
while (*p && (left > 0)) {
|
||||
|
|
@ -1480,9 +1480,9 @@ void var_subst(void *go, struct script_data *sc, trig_data *trig,
|
|||
*(buf++) = *(p++);
|
||||
left--;
|
||||
}
|
||||
|
||||
|
||||
*buf = '\0';
|
||||
|
||||
|
||||
/* double % */
|
||||
if (*p && (*(++p) == '%') && (left > 0)) {
|
||||
*(buf++) = *(p++);
|
||||
|
|
@ -1493,10 +1493,10 @@ void var_subst(void *go, struct script_data *sc, trig_data *trig,
|
|||
|
||||
/* so it wasn't double %'s */
|
||||
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++);
|
||||
|
||||
|
||||
field = p;
|
||||
if (*p == '.') {
|
||||
*(p++) = '\0';
|
||||
|
|
@ -1505,7 +1505,7 @@ void var_subst(void *go, struct script_data *sc, trig_data *trig,
|
|||
if (dots > 0) {
|
||||
*subfield_p = '\0';
|
||||
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
|
||||
process_eval(go, sc, trig, type, tmp2);
|
||||
strcpy(var, "tmpvr");
|
||||
|
|
@ -1525,24 +1525,24 @@ void var_subst(void *go, struct script_data *sc, trig_data *trig,
|
|||
} else if (*p=='.') {
|
||||
*p = '\0';
|
||||
dots++;
|
||||
}
|
||||
}
|
||||
} /* for (field.. */
|
||||
} /* if *p == '.' */
|
||||
|
||||
|
||||
*(p++) = '\0';
|
||||
*subfield_p = '\0';
|
||||
|
||||
|
||||
if (*subfield) {
|
||||
var_subst(go, sc, trig, type, subfield, tmp2);
|
||||
strcpy(subfield, tmp2);
|
||||
}
|
||||
|
||||
find_replacement(go, sc, trig, type, var, field, subfield, repl_str, sizeof(repl_str));
|
||||
|
||||
|
||||
strncat(buf, repl_str, left);
|
||||
len = strlen(repl_str);
|
||||
buf += len;
|
||||
left -= len;
|
||||
} /* 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;
|
||||
char output[MAX_STRING_LENGTH];
|
||||
|
||||
|
||||
snprintf(output, sizeof(output), "Room %d :: %s", room->number, format);
|
||||
|
||||
va_start(args, format);
|
||||
|
|
@ -105,17 +105,17 @@ void act_to_room(char *str, room_data *room)
|
|||
WCMD(do_wasound)
|
||||
{
|
||||
int door;
|
||||
|
||||
|
||||
skip_spaces(&argument);
|
||||
|
||||
if (!*argument) {
|
||||
wld_log(room, "wasound called with no argument");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
for (door = 0; door < NUM_OF_DIRS; door++) {
|
||||
struct room_direction_data *newexit;
|
||||
|
||||
|
||||
if ((newexit = room->dir_option[door]) && (newexit->to_room != NOWHERE) &&
|
||||
room != &world[newexit->to_room])
|
||||
act_to_room(argument, &world[newexit->to_room]);
|
||||
|
|
@ -127,10 +127,10 @@ WCMD(do_wecho)
|
|||
{
|
||||
skip_spaces(&argument);
|
||||
|
||||
if (!*argument)
|
||||
if (!*argument)
|
||||
wld_log(room, "wecho called with no args");
|
||||
|
||||
else
|
||||
else
|
||||
act_to_room(argument, room);
|
||||
}
|
||||
|
||||
|
|
@ -139,7 +139,7 @@ WCMD(do_wsend)
|
|||
{
|
||||
char buf[MAX_INPUT_LENGTH], *msg;
|
||||
char_data *ch;
|
||||
|
||||
|
||||
msg = any_one_arg(argument, buf);
|
||||
|
||||
if (!*buf)
|
||||
|
|
@ -172,7 +172,7 @@ WCMD(do_wzoneecho)
|
|||
{
|
||||
zone_rnum zone;
|
||||
char room_num[MAX_INPUT_LENGTH], buf[MAX_INPUT_LENGTH], *msg;
|
||||
|
||||
|
||||
msg = any_one_arg(argument, room_num);
|
||||
skip_spaces(&msg);
|
||||
|
||||
|
|
@ -182,7 +182,7 @@ WCMD(do_wzoneecho)
|
|||
else if ((zone = real_zone_by_thing(atoi(room_num))) == NOWHERE)
|
||||
wld_log(room, "wzoneecho called for nonexistant zone");
|
||||
|
||||
else {
|
||||
else {
|
||||
sprintf(buf, "%s\r\n", msg);
|
||||
send_to_zone(buf, zone);
|
||||
}
|
||||
|
|
@ -200,9 +200,9 @@ WCMD(do_wrecho)
|
|||
|
||||
if (!*msg || !*start || !*finish || !is_number(start) || !is_number(finish))
|
||||
wld_log(room, "wrecho: too few args");
|
||||
else
|
||||
else
|
||||
send_to_range(atoi(start), atoi(finish), "%s\r\n", msg);
|
||||
|
||||
|
||||
}
|
||||
|
||||
WCMD(do_wdoor)
|
||||
|
|
@ -232,12 +232,12 @@ WCMD(do_wdoor)
|
|||
wld_log(room, "wdoor called with too few args");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((rm = get_room(target)) == NULL) {
|
||||
wld_log(room, "wdoor: invalid target");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if ((dir = search_block(direction, dirs, FALSE)) == -1) {
|
||||
wld_log(room, "wdoor: invalid direction");
|
||||
return;
|
||||
|
|
@ -265,9 +265,9 @@ WCMD(do_wdoor)
|
|||
else {
|
||||
if (!newexit) {
|
||||
CREATE(newexit, struct room_direction_data, 1);
|
||||
rm->dir_option[dir] = newexit;
|
||||
rm->dir_option[dir] = newexit;
|
||||
}
|
||||
|
||||
|
||||
switch (fd) {
|
||||
case 1: /* description */
|
||||
if (newexit->general_description)
|
||||
|
|
@ -306,7 +306,7 @@ WCMD(do_wteleport)
|
|||
char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
||||
|
||||
two_arguments(argument, arg1, arg2);
|
||||
|
||||
|
||||
if (!*arg1 || !*arg2) {
|
||||
wld_log(room, "wteleport called with too few args");
|
||||
return;
|
||||
|
|
@ -314,10 +314,10 @@ WCMD(do_wteleport)
|
|||
|
||||
nr = atoi(arg2);
|
||||
target = real_room(nr);
|
||||
|
||||
if (target == NOWHERE)
|
||||
|
||||
if (target == NOWHERE)
|
||||
wld_log(room, "wteleport target is an invalid room");
|
||||
|
||||
|
||||
else if (!str_cmp(arg1, "all")) {
|
||||
if (nr == room->number) {
|
||||
wld_log(room, "wteleport all target is itself");
|
||||
|
|
@ -327,14 +327,14 @@ WCMD(do_wteleport)
|
|||
for (ch = room->people; ch; ch = next_ch)
|
||||
{
|
||||
next_ch = ch->next_in_room;
|
||||
if (!valid_dg_target(ch, DG_ALLOW_GODS))
|
||||
if (!valid_dg_target(ch, DG_ALLOW_GODS))
|
||||
continue;
|
||||
char_from_room(ch);
|
||||
char_to_room(ch, target);
|
||||
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
if ((ch = get_char_by_room(room, arg1))) {
|
||||
|
|
@ -344,7 +344,7 @@ WCMD(do_wteleport)
|
|||
enter_wtrigger(&world[IN_ROOM(ch)], ch, -1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
wld_log(room, "wteleport: no target found");
|
||||
}
|
||||
|
|
@ -357,25 +357,25 @@ WCMD(do_wforce)
|
|||
char arg1[MAX_INPUT_LENGTH], *line;
|
||||
|
||||
line = one_argument(argument, arg1);
|
||||
|
||||
|
||||
if (!*arg1 || !*line) {
|
||||
wld_log(room, "wforce called with too few args");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!str_cmp(arg1, "all"))
|
||||
{
|
||||
for (ch = room->people; ch; ch = next_ch)
|
||||
{
|
||||
next_ch = ch->next_in_room;
|
||||
|
||||
|
||||
if (valid_dg_target(ch, 0))
|
||||
{
|
||||
command_interpreter(ch, line);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
{
|
||||
if ((ch = get_char_by_room(room, arg1)))
|
||||
|
|
@ -385,7 +385,7 @@ WCMD(do_wforce)
|
|||
command_interpreter(ch, line);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
else
|
||||
wld_log(room, "wforce: no target found");
|
||||
}
|
||||
|
|
@ -400,7 +400,7 @@ WCMD(do_wpurge)
|
|||
obj_data *obj, *next_obj;
|
||||
|
||||
one_argument(argument, arg);
|
||||
|
||||
|
||||
if (!*arg) {
|
||||
/* purge all */
|
||||
for (ch = room->people; ch; ch = next_ch ) {
|
||||
|
|
@ -408,39 +408,39 @@ WCMD(do_wpurge)
|
|||
if (IS_NPC(ch))
|
||||
extract_char(ch);
|
||||
}
|
||||
|
||||
|
||||
for (obj = room->contents; obj; obj = next_obj ) {
|
||||
next_obj = obj->next_content;
|
||||
extract_obj(obj);
|
||||
}
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (*arg == UID_CHAR)
|
||||
ch = get_char(arg);
|
||||
else
|
||||
else
|
||||
ch = get_char_in_room(room, arg);
|
||||
|
||||
if (!ch) {
|
||||
if (*arg == UID_CHAR)
|
||||
obj = get_obj(arg);
|
||||
else
|
||||
else
|
||||
obj = get_obj_in_room(room, arg);
|
||||
|
||||
|
||||
if (obj) {
|
||||
extract_obj(obj);
|
||||
} else
|
||||
} else
|
||||
wld_log(room, "wpurge: bad argument");
|
||||
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!IS_NPC(ch)) {
|
||||
wld_log(room, "wpurge: purging a PC");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
extract_char(ch);
|
||||
}
|
||||
|
||||
|
|
@ -456,9 +456,9 @@ WCMD(do_wload)
|
|||
char_data *tch;
|
||||
obj_data *cnt;
|
||||
int pos;
|
||||
|
||||
|
||||
target = two_arguments(argument, arg1, arg2);
|
||||
|
||||
|
||||
if (!*arg1 || !*arg2 || !is_number(arg2) || ((number = atoi(arg2)) < 0)) {
|
||||
wld_log(room, "wload: bad syntax");
|
||||
return;
|
||||
|
|
@ -478,7 +478,7 @@ WCMD(do_wload)
|
|||
if ((mob = read_mobile(number, VIRTUAL)) == NULL) {
|
||||
wld_log(room, "mload: bad mob vnum");
|
||||
return;
|
||||
}
|
||||
}
|
||||
char_to_room(mob, rnum);
|
||||
if (SCRIPT(room)) { // it _should_ have, but it might be detached.
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
|
|
@ -487,7 +487,7 @@ WCMD(do_wload)
|
|||
}
|
||||
load_mtrigger(mob);
|
||||
}
|
||||
|
||||
|
||||
else if (is_abbrev(arg1, "obj")) {
|
||||
if ((object = read_object(number, VIRTUAL)) == NULL) {
|
||||
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. */
|
||||
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.
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
sprintf(buf, "%c%ld", UID_CHAR, GET_ID(object));
|
||||
|
|
@ -503,8 +503,8 @@ WCMD(do_wload)
|
|||
}
|
||||
load_otrigger(object);
|
||||
return;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
two_arguments(target, arg1, arg2); /* recycling ... */
|
||||
tch = get_char_in_room(room, arg1);
|
||||
if (tch) {
|
||||
|
|
@ -527,7 +527,7 @@ WCMD(do_wload)
|
|||
return;
|
||||
}
|
||||
/* 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);
|
||||
return;
|
||||
}
|
||||
|
|
@ -551,9 +551,9 @@ WCMD(do_wdamage) {
|
|||
|
||||
dam = atoi(amount);
|
||||
ch = get_char_by_room(room, name);
|
||||
|
||||
|
||||
if (!ch) {
|
||||
wld_log(room, "wdamage: target not found");
|
||||
wld_log(room, "wdamage: target not found");
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -563,9 +563,9 @@ WCMD(do_wdamage) {
|
|||
|
||||
WCMD(do_wat) {
|
||||
char location[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH];
|
||||
int vnum = 0;
|
||||
int vnum = 0;
|
||||
room_data *r2;
|
||||
|
||||
|
||||
half_chop(argument, location, arg2);
|
||||
|
||||
if (!*location || !*arg2 || !isdigit(*location)) {
|
||||
|
|
@ -584,7 +584,7 @@ WCMD(do_wat) {
|
|||
|
||||
const struct wld_command_info wld_cmd_info[] = {
|
||||
{ "RESERVED", 0, 0 },/* this must be first -- for specprocs */
|
||||
|
||||
|
||||
{ "wasound " , do_wasound , 0 },
|
||||
{ "wdoor " , do_wdoor , 0 },
|
||||
{ "wecho " , do_wecho , 0 },
|
||||
|
|
@ -609,9 +609,9 @@ void wld_command_interpreter(room_data *room, char *argument)
|
|||
{
|
||||
int cmd, length;
|
||||
char *line, arg[MAX_INPUT_LENGTH];
|
||||
|
||||
|
||||
skip_spaces(&argument);
|
||||
|
||||
|
||||
/* just drop to next line for hitting CR */
|
||||
if (!*argument)
|
||||
return;
|
||||
|
|
@ -624,10 +624,10 @@ void wld_command_interpreter(room_data *room, char *argument)
|
|||
*wld_cmd_info[cmd].command != '\n'; cmd++)
|
||||
if (!strncmp(wld_cmd_info[cmd].command, arg, length))
|
||||
break;
|
||||
|
||||
|
||||
if (*wld_cmd_info[cmd].command == '\n')
|
||||
wld_log(room, "Unknown world cmd: '%s'", argument);
|
||||
else
|
||||
((*wld_cmd_info[cmd].command_pointer)
|
||||
((*wld_cmd_info[cmd].command_pointer)
|
||||
(room, line, cmd, wld_cmd_info[cmd].subcmd));
|
||||
}
|
||||
|
|
|
|||
13
src/fight.c
13
src/fight.c
|
|
@ -11,7 +11,6 @@
|
|||
#include "conf.h"
|
||||
#include "sysdep.h"
|
||||
|
||||
|
||||
#include "structs.h"
|
||||
#include "utils.h"
|
||||
#include "comm.h"
|
||||
|
|
@ -366,15 +365,15 @@ void raw_kill(struct char_data * ch, struct char_data * killer)
|
|||
while (ch->affected)
|
||||
affect_remove(ch, ch->affected);
|
||||
|
||||
/* To make ordinary commands work in scripts. welcor*/
|
||||
GET_POS(ch) = POS_STANDING;
|
||||
|
||||
/* To make ordinary commands work in scripts. welcor*/
|
||||
GET_POS(ch) = POS_STANDING;
|
||||
|
||||
if (killer) {
|
||||
if (death_mtrigger(ch, killer))
|
||||
death_cry(ch);
|
||||
} else
|
||||
death_cry(ch);
|
||||
|
||||
|
||||
update_pos(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))
|
||||
return (0);
|
||||
|
||||
/* You can't damage an immortal! */
|
||||
/* You can't damage an immortal! */
|
||||
if (!IS_NPC(victim) && (GET_LEVEL(victim) >= LVL_IMMORT))
|
||||
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.".
|
||||
* skill_message is preferable to dam_message because it is more
|
||||
* descriptive.
|
||||
*
|
||||
*
|
||||
* 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
|
||||
* 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;
|
||||
mob_vnum vnum;
|
||||
zone_rnum zone;
|
||||
|
||||
|
||||
#if CIRCLE_UNSIGNED_INDEX
|
||||
if (refpt == NOBODY || refpt > top_of_mobt) {
|
||||
#else
|
||||
|
|
@ -174,8 +174,8 @@ int delete_mobile(mob_rnum refpt)
|
|||
for (counter = 0; counter <= top_shop - top_shop_offset; counter++)
|
||||
SHOP_KEEPER(counter) -= (SHOP_KEEPER(counter) >= refpt);
|
||||
|
||||
save_mobiles(real_zone_by_thing(vnum));
|
||||
|
||||
save_mobiles(real_zone_by_thing(vnum));
|
||||
|
||||
return refpt;
|
||||
}
|
||||
|
||||
|
|
@ -306,7 +306,7 @@ int save_mobiles(zone_rnum rznum)
|
|||
snprintf(usedfname, sizeof(usedfname), "%s%d.mob", MOB_PREFIX, vznum);
|
||||
remove(usedfname);
|
||||
rename(mobfname, usedfname);
|
||||
|
||||
|
||||
if (in_save_list(vznum, SL_MOB))
|
||||
remove_from_save_list(vznum, SL_MOB);
|
||||
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)
|
||||
{
|
||||
|
||||
char bit1[64];
|
||||
char bit1[64];
|
||||
char bit2[64];
|
||||
char ldesc[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);
|
||||
|
||||
|
||||
/*
|
||||
* Do we have extra descriptions?
|
||||
* Do we have extra descriptions?
|
||||
*/
|
||||
if (obj->ex_description) { /* Yes, save them too. */
|
||||
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++)
|
||||
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;
|
||||
}
|
||||
|
||||
int delete_object(obj_rnum rnum)
|
||||
{
|
||||
obj_rnum i;
|
||||
struct obj_data *obj, *tmp;
|
||||
int shop, j;
|
||||
int delete_object(obj_rnum rnum)
|
||||
{
|
||||
obj_rnum i;
|
||||
struct obj_data *obj, *tmp;
|
||||
int shop, j;
|
||||
|
||||
if (rnum == NOWHERE || rnum > top_of_objt)
|
||||
return FALSE;
|
||||
if (rnum == NOWHERE || rnum > top_of_objt)
|
||||
return FALSE;
|
||||
|
||||
obj = &obj_proto[rnum];
|
||||
obj = &obj_proto[rnum];
|
||||
|
||||
zone_rnum zrnum = real_zone_by_thing(GET_OBJ_VNUM(obj));
|
||||
|
||||
/* 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);
|
||||
/* 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);
|
||||
|
||||
for (tmp = object_list; tmp; tmp = tmp->next) {
|
||||
if (tmp->item_number != obj->item_number)
|
||||
continue;
|
||||
for (tmp = object_list; tmp; tmp = tmp->next) {
|
||||
if (tmp->item_number != obj->item_number)
|
||||
continue;
|
||||
|
||||
// extract_obj() will just axe contents.
|
||||
if (tmp->contains) {
|
||||
|
|
@ -444,14 +444,14 @@ int delete_object(obj_rnum rnum)
|
|||
// remove from object_list, etc. - handles weightchanges, and similar.
|
||||
extract_obj(tmp);
|
||||
}
|
||||
|
||||
|
||||
// make sure all are removed.
|
||||
assert(obj_index[rnum].number == 0);
|
||||
|
||||
// adjust rnums of all other objects.
|
||||
for (tmp = object_list; tmp; tmp = tmp->next) {
|
||||
GET_OBJ_RNUM(tmp) -= (GET_OBJ_RNUM(tmp) > rnum);
|
||||
}
|
||||
for (tmp = object_list; tmp; tmp = tmp->next) {
|
||||
GET_OBJ_RNUM(tmp) -= (GET_OBJ_RNUM(tmp) > rnum);
|
||||
}
|
||||
|
||||
for (i = rnum; i < top_of_objt; i++) {
|
||||
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_proto, struct obj_data, top_of_objt + 1);
|
||||
|
||||
/*
|
||||
* Renumber notice boards.
|
||||
*/
|
||||
for (j = 0; j < NUM_OF_BOARDS; j++)
|
||||
BOARD_RNUM(j) -= (BOARD_RNUM(j) > rnum);
|
||||
/*
|
||||
* Renumber notice boards.
|
||||
*/
|
||||
for (j = 0; j < NUM_OF_BOARDS; j++)
|
||||
BOARD_RNUM(j) -= (BOARD_RNUM(j) > rnum);
|
||||
|
||||
/*
|
||||
* Renumber shop produce;
|
||||
*/
|
||||
for (shop = 0; shop <= top_shop - top_shop_offset; shop++)
|
||||
for (j = 0; SHOP_PRODUCT(shop, j) != NOTHING; j++)
|
||||
SHOP_PRODUCT(shop, j) -= (SHOP_PRODUCT(shop, j) > rnum);
|
||||
/*
|
||||
* Renumber shop produce;
|
||||
*/
|
||||
for (shop = 0; shop <= top_shop - top_shop_offset; shop++)
|
||||
for (j = 0; SHOP_PRODUCT(shop, j) != NOTHING; j++)
|
||||
SHOP_PRODUCT(shop, j) -= (SHOP_PRODUCT(shop, j) > rnum);
|
||||
|
||||
/*
|
||||
* Renumber zone table.
|
||||
*/
|
||||
int zone, cmd_no;
|
||||
for (zone = 0; zone <= top_of_zone_table; zone++) {
|
||||
for (cmd_no = 0; ZCMD(zone, cmd_no).command != 'S'; cmd_no++) {
|
||||
switch (ZCMD(zone, cmd_no).command) {
|
||||
case 'P':
|
||||
/*
|
||||
* Renumber zone table.
|
||||
*/
|
||||
int zone, cmd_no;
|
||||
for (zone = 0; zone <= top_of_zone_table; zone++) {
|
||||
for (cmd_no = 0; ZCMD(zone, cmd_no).command != 'S'; cmd_no++) {
|
||||
switch (ZCMD(zone, cmd_no).command) {
|
||||
case 'P':
|
||||
if (ZCMD(zone, cmd_no).arg3 == rnum) {
|
||||
delete_zone_command(&zone_table[zone], cmd_no);
|
||||
delete_zone_command(&zone_table[zone], cmd_no);
|
||||
} else
|
||||
ZCMD(zone, cmd_no).arg3 -= (ZCMD(zone, cmd_no).arg3 > rnum);
|
||||
break;
|
||||
case 'O':
|
||||
case 'G':
|
||||
case 'E':
|
||||
break;
|
||||
case 'O':
|
||||
case 'G':
|
||||
case 'E':
|
||||
if (ZCMD(zone, cmd_no).arg1 == rnum) {
|
||||
delete_zone_command(&zone_table[zone], cmd_no);
|
||||
delete_zone_command(&zone_table[zone], cmd_no);
|
||||
} else
|
||||
ZCMD(zone, cmd_no).arg1 -= (ZCMD(zone, cmd_no).arg1 > rnum);
|
||||
break;
|
||||
case 'R':
|
||||
break;
|
||||
case 'R':
|
||||
if (ZCMD(zone, cmd_no).arg2 == rnum) {
|
||||
delete_zone_command(&zone_table[zone], cmd_no);
|
||||
delete_zone_command(&zone_table[zone], cmd_no);
|
||||
} else
|
||||
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);
|
||||
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 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;
|
||||
zone_rnum rznum;
|
||||
|
||||
|
||||
if (type == SL_CFG)
|
||||
return FALSE;
|
||||
|
||||
return FALSE;
|
||||
|
||||
rznum = real_zone(zone);
|
||||
if (rznum == NOWHERE || rznum > top_of_zone_table) {
|
||||
if (zone != AEDIT_PERMISSION) {
|
||||
log("SYSERR: add_to_save_list: Invalid zone number passed. (%d => %d, 0-%d)", zone, rznum, top_of_zone_table);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
for (nitem = save_list; nitem; nitem = nitem->next)
|
||||
if (nitem->zone == zone && nitem->type == type)
|
||||
return FALSE;
|
||||
|
||||
|
||||
CREATE(nitem, struct save_list_data, 1);
|
||||
nitem->zone = zone;
|
||||
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)
|
||||
{
|
||||
struct save_list_data *nitem;
|
||||
|
||||
|
||||
for (nitem = save_list; nitem; nitem = nitem->next)
|
||||
if (nitem->zone == zone && nitem->type == type)
|
||||
return TRUE;
|
||||
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
|
@ -282,19 +282,19 @@ ACMD(do_export_zone)
|
|||
char sysbuf[MAX_INPUT_LENGTH];
|
||||
char fn[MAX_INPUT_LENGTH], *f;
|
||||
void space_to_minus(char *str);
|
||||
|
||||
|
||||
if (IS_NPC(ch) || GET_LEVEL(ch) < LVL_IMPL)
|
||||
return;
|
||||
|
||||
skip_spaces(&argument);
|
||||
zvnum = atoi(argument);
|
||||
zrnum = real_zone(zvnum);
|
||||
|
||||
|
||||
if (zrnum == NOWHERE) {
|
||||
send_to_char(ch, "Export which zone?\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!export_info_file(zrnum))
|
||||
send_to_char(ch, "Info file not saved!\r\n");
|
||||
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);
|
||||
f = fn;
|
||||
space_to_minus(f);
|
||||
snprintf(sysbuf, sizeof(sysbuf),
|
||||
LIB_ETC "export_script.sh %s &",
|
||||
snprintf(sysbuf, sizeof(sysbuf),
|
||||
LIB_ETC "export_script.sh %s &",
|
||||
fn);
|
||||
system(sysbuf);
|
||||
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;
|
||||
FILE *info_file;
|
||||
|
||||
|
||||
if (!(info_file = fopen("world/export/qq.info", "w"))) {
|
||||
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_info_file : Cannot open file!");
|
||||
return FALSE;
|
||||
|
|
@ -335,7 +335,7 @@ int export_info_file(zone_rnum zrnum)
|
|||
fclose(info_file);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
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, "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, " instead of the room vnum (?? are numbers 00 - 99).\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++) {
|
||||
room_rnum rnum = real_room(i);
|
||||
struct room_data *room;
|
||||
int j;
|
||||
|
||||
if (rnum == NOWHERE)
|
||||
|
||||
if (rnum == NOWHERE)
|
||||
continue;
|
||||
|
||||
|
||||
room = &world[rnum];
|
||||
|
||||
|
||||
for (j = 0; j < NUM_OF_DIRS; j++) {
|
||||
if (!R_EXIT(room, j))
|
||||
continue;
|
||||
|
||||
|
||||
if (R_EXIT(room, j)->to_room == NOWHERE || world[R_EXIT(room, j)->to_room].zone == zrnum)
|
||||
continue;
|
||||
|
||||
|
||||
fprintf(info_file, " Room QQ%02d : Exit to the %s\n",
|
||||
room->number%100, dirs[j]);
|
||||
}
|
||||
|
|
@ -375,9 +375,9 @@ int export_info_file(zone_rnum zrnum)
|
|||
zone_exits = 0;
|
||||
} else {
|
||||
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, "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");
|
||||
|
|
@ -389,7 +389,7 @@ int export_info_file(zone_rnum zrnum)
|
|||
fprintf(info_file, "Rumble - Admin of TBA\n");
|
||||
fprintf(info_file, "Welcor - Coder of TBA\n");
|
||||
fprintf(info_file, "\ntelnet://builderacademy.net:9091/\n");
|
||||
|
||||
|
||||
fclose(info_file);
|
||||
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) ||
|
||||
obj_index[S_PRODUCT(shop, j)].vnum > zone_table[zrnum].top)
|
||||
continue;
|
||||
|
||||
|
||||
fprintf(shop_file, "QQ%02d\n", obj_index[S_PRODUCT(shop, j)].vnum%100);
|
||||
}
|
||||
fprintf(shop_file, "-1\n");
|
||||
|
|
@ -439,8 +439,8 @@ int export_save_shops(zone_rnum zrnum)
|
|||
/*
|
||||
* Save the buy types and namelists.
|
||||
*/
|
||||
for (j = 0;S_BUYTYPE(shop, j) != NOTHING; j++)
|
||||
fprintf(shop_file, "%d%s\n",
|
||||
for (j = 0;S_BUYTYPE(shop, j) != NOTHING; j++)
|
||||
fprintf(shop_file, "%d%s\n",
|
||||
S_BUYTYPE(shop, j),
|
||||
S_BUYWORD(shop, j) ? S_BUYWORD(shop, j) : "");
|
||||
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) ||
|
||||
S_ROOM(shop, j) > zone_table[zrnum].top)
|
||||
continue;
|
||||
|
||||
|
||||
fprintf(shop_file, "QQ%02d\n", S_ROOM(shop, j)%100);
|
||||
}
|
||||
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),
|
||||
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)
|
||||
{
|
||||
|
||||
char bit1[64];
|
||||
char bit1[64];
|
||||
char bit2[64];
|
||||
char ldesc[MAX_STRING_LENGTH];
|
||||
char ddesc[MAX_STRING_LENGTH];
|
||||
|
|
@ -577,14 +577,14 @@ int export_save_zone(zone_rnum zrnum)
|
|||
{
|
||||
int subcmd;
|
||||
FILE *zone_file;
|
||||
|
||||
|
||||
if (!(zone_file = fopen("world/export/qq.zon", "w"))) {
|
||||
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: export_save_zone : Cannot open file!");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*
|
||||
* Print zone header to file
|
||||
* Print zone header to file
|
||||
*/
|
||||
fprintf(zone_file, "#QQ\n"
|
||||
"%s~\n"
|
||||
|
|
@ -686,7 +686,7 @@ int export_save_zone(zone_rnum zrnum)
|
|||
ZCMD(zrnum, subcmd).if_flag,
|
||||
ZCMD(zrnum, subcmd).arg1,
|
||||
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).sarg2);
|
||||
break;
|
||||
|
|
@ -702,7 +702,7 @@ int export_save_zone(zone_rnum zrnum)
|
|||
}
|
||||
fputs("S\n$\n", zone_file);
|
||||
fclose(zone_file);
|
||||
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
|
@ -749,7 +749,7 @@ int export_save_objects(zone_rnum zrnum)
|
|||
sprintascii(bit2, GET_OBJ_PERM(obj));
|
||||
|
||||
fprintf(obj_file,
|
||||
"%d %s %s %s\n",
|
||||
"%d %s %s %s\n",
|
||||
GET_OBJ_TYPE(obj), buf, bit1, bit2);
|
||||
|
||||
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 ? -1 : GET_OBJ_VAL(obj, 2)%100,
|
||||
GET_OBJ_VAL(obj, 3));
|
||||
|
||||
|
||||
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));
|
||||
|
||||
/*
|
||||
* Do we have script(s) attached ?
|
||||
* Do we have script(s) attached ?
|
||||
*/
|
||||
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. */
|
||||
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++)
|
||||
if (obj->affected[i].modifier)
|
||||
fprintf(obj_file, "A\n"
|
||||
"%d %d\n",
|
||||
"%d %d\n",
|
||||
obj->affected[i].location,
|
||||
obj->affected[i].modifier);
|
||||
}
|
||||
|
|
@ -898,7 +898,7 @@ int export_save_rooms(zone_rnum zrnum)
|
|||
dflag,
|
||||
R_EXIT(room, j)->key == NOTHING ? "" : "QQ",
|
||||
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);
|
||||
else {
|
||||
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!");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
for (i = genolc_zone_bottom(zrnum); i <= zone_table[zrnum].top; i++) {
|
||||
trig_rnum rnum;
|
||||
|
||||
|
|
@ -994,7 +994,7 @@ int export_save_triggers(zone_rnum zrnum)
|
|||
trig->attach_type,
|
||||
*bitBuf ? bitBuf : "0", GET_TRIG_NARG(trig),
|
||||
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"
|
||||
"* 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"
|
||||
|
|
@ -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);
|
||||
fclose(trig_file);
|
||||
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.
|
||||
*/
|
||||
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
|
||||
*/
|
||||
|
|
@ -475,8 +475,8 @@ int save_shops(zone_rnum zone_num)
|
|||
/*
|
||||
* Save the buy types and namelists.
|
||||
*/
|
||||
for (j = 0;S_BUYTYPE(shop, j) != NOTHING; j++)
|
||||
fprintf(shop_file, "%d%s\n",
|
||||
for (j = 0;S_BUYTYPE(shop, j) != NOTHING; j++)
|
||||
fprintf(shop_file, "%d%s\n",
|
||||
S_BUYTYPE(shop, j),
|
||||
S_BUYWORD(shop, j) ? S_BUYWORD(shop, j) : "");
|
||||
fprintf(shop_file, "-1\n");
|
||||
|
|
@ -518,12 +518,12 @@ int save_shops(zone_rnum zone_num)
|
|||
/*
|
||||
* 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, "-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),
|
||||
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;
|
||||
int j, found = FALSE;
|
||||
room_rnum i;
|
||||
|
||||
|
||||
if (room == NULL)
|
||||
return NOWHERE;
|
||||
|
||||
if ((i = real_room(room->number)) != NOWHERE) {
|
||||
if (SCRIPT(&world[i]))
|
||||
extract_script(&world[i], WLD_TRIGGER);
|
||||
tch = world[i].people;
|
||||
tch = world[i].people;
|
||||
tobj = world[i].contents;
|
||||
copy_room(&world[i], room);
|
||||
world[i].people = tch;
|
||||
|
|
@ -106,7 +106,7 @@ room_rnum add_room(struct room_data *room)
|
|||
default:
|
||||
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: GenOLC: add_room: Unknown zone entry found!");
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* 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));
|
||||
W_EXIT(i, j) = NULL;
|
||||
} else {
|
||||
} else {
|
||||
/* description is set, just point to 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 );
|
||||
else
|
||||
*buf1 = '\0';
|
||||
|
||||
|
||||
/*
|
||||
* Now write the exit to the file.
|
||||
*/
|
||||
|
|
@ -449,7 +449,7 @@ room_rnum duplicate_room(room_vnum dest_vnum, room_rnum orig)
|
|||
return NOWHERE;
|
||||
}
|
||||
|
||||
nroom = world[new_rnum];
|
||||
nroom = world[new_rnum];
|
||||
nroom.number = dest_vnum;
|
||||
nroom.zone = znum;
|
||||
|
||||
|
|
@ -513,10 +513,10 @@ int free_room_strings(struct room_data *room)
|
|||
/* Free exits. */
|
||||
for (i = 0; i < NUM_OF_DIRS; 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);
|
||||
|
||||
if (room->dir_option[i]->keyword)
|
||||
if (room->dir_option[i]->keyword)
|
||||
free(room->dir_option[i]->keyword);
|
||||
|
||||
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, "shp");
|
||||
create_world_index(vzone_num, "trg");
|
||||
|
||||
|
||||
/*
|
||||
* 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
|
||||
|
|
@ -182,7 +182,7 @@ rznum = i;
|
|||
|
||||
/*
|
||||
* Ok, insert the new zone here.
|
||||
*/
|
||||
*/
|
||||
zone->name = strdup("New Zone");
|
||||
zone->number = vzone_num;
|
||||
zone->builders = strdup("None");
|
||||
|
|
@ -234,7 +234,7 @@ void create_world_index(int znum, const char *type)
|
|||
break;
|
||||
default:
|
||||
/*
|
||||
* Caller messed up
|
||||
* Caller messed up
|
||||
*/
|
||||
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
|
||||
* 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);
|
||||
while (get_line(oldfile, buf)) {
|
||||
|
|
@ -327,7 +327,7 @@ int save_zone(zone_rnum zone_num)
|
|||
char fname[128], oldname[128];
|
||||
const char *comment = NULL;
|
||||
FILE *zfile;
|
||||
|
||||
|
||||
#if CIRCLE_UNSIGNED_INDEX
|
||||
if (zone_num == NOWHERE || zone_num > top_of_zone_table) {
|
||||
#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"
|
||||
"%s~\n"
|
||||
|
|
@ -426,7 +426,7 @@ int save_zone(zone_rnum zone_num)
|
|||
arg1 = ZCMD(zone_num, subcmd).arg1; /* trigger type */
|
||||
arg2 = trig_index[ZCMD(zone_num, subcmd).arg2]->vnum; /* trigger vnum */
|
||||
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;
|
||||
case 'V':
|
||||
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);
|
||||
else
|
||||
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);
|
||||
}
|
||||
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);
|
||||
remove(oldname);
|
||||
rename(fname, oldname);
|
||||
|
||||
|
||||
if (in_save_list(zone_table[zone_num].number, SL_ZON))
|
||||
remove_from_save_list(zone_table[zone_num].number, SL_ZON);
|
||||
return TRUE;
|
||||
|
|
@ -524,7 +524,7 @@ void remove_cmd_from_list(struct reset_com **list, int pos)
|
|||
struct reset_com *newlist;
|
||||
|
||||
/*
|
||||
* Count number of commands (not including terminator)
|
||||
* Count number of commands (not including terminator)
|
||||
*/
|
||||
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)
|
||||
{
|
||||
|
|
@ -561,7 +561,7 @@ int new_command(struct zone_data *zone, int pos)
|
|||
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')
|
||||
subcmd++;
|
||||
|
|
@ -570,7 +570,7 @@ int new_command(struct zone_data *zone, int pos)
|
|||
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);
|
||||
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)
|
||||
{
|
||||
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')
|
||||
subcmd++;
|
||||
|
|
@ -597,7 +597,7 @@ void delete_zone_command(struct zone_data *zone, int pos)
|
|||
return;
|
||||
|
||||
/*
|
||||
* Ok, let's zap it
|
||||
* Ok, let's zap it
|
||||
*/
|
||||
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
|
||||
* 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;
|
||||
|
||||
if (LOWER(*curstr) != LOWER(*curname))
|
||||
break;
|
||||
break;
|
||||
}
|
||||
|
||||
/* 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)
|
||||
{
|
||||
if (add)
|
||||
|
|
@ -825,12 +825,12 @@ void extract_obj(struct obj_data *obj)
|
|||
if (GET_OBJ_RNUM(obj) != NOTHING)
|
||||
(obj_index[GET_OBJ_RNUM(obj)].number)--;
|
||||
|
||||
if (SCRIPT(obj))
|
||||
if (SCRIPT(obj))
|
||||
extract_script(obj, OBJ_TRIGGER);
|
||||
|
||||
|
||||
if (GET_OBJ_RNUM(obj) == NOTHING || obj->proto_script != obj_proto[GET_OBJ_RNUM(obj)].proto_script)
|
||||
free_proto_script(obj, OBJ_TRIGGER);
|
||||
|
||||
|
||||
free_obj(obj);
|
||||
}
|
||||
|
||||
|
|
@ -969,7 +969,7 @@ void extract_char_final(struct char_data *ch)
|
|||
mob_index[GET_MOB_RNUM(ch)].number--;
|
||||
clearMemory(ch);
|
||||
|
||||
if (SCRIPT(ch))
|
||||
if (SCRIPT(ch))
|
||||
extract_script(ch, MOB_TRIGGER);
|
||||
|
||||
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);
|
||||
el.min_level = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
el.duplicate = 0;
|
||||
el.entry = strdup(entry);
|
||||
scan = one_word(key, next_key);
|
||||
|
|
@ -92,10 +92,10 @@ void load_help(FILE *fl, char *name)
|
|||
help_table[top_of_h_table++] = el;
|
||||
el.duplicate++;
|
||||
scan = one_word(scan, next_key);
|
||||
}
|
||||
}
|
||||
/* get next keyword line (or $) */
|
||||
get_one_line(fl, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int hsort(const void *a, const void *b)
|
||||
|
|
@ -111,8 +111,8 @@ int hsort(const void *a, const void *b)
|
|||
ACMD(do_oasis_hedit)
|
||||
{
|
||||
struct descriptor_data *d;
|
||||
int i;
|
||||
|
||||
int i;
|
||||
|
||||
if (!can_edit_zone(ch, HEDIT_PERMISSION)) {
|
||||
send_to_char(ch, "You don't have access to editing Help files.\r\n");
|
||||
return;
|
||||
|
|
@ -125,7 +125,7 @@ ACMD(do_oasis_hedit)
|
|||
}
|
||||
|
||||
skip_spaces(&argument);
|
||||
|
||||
|
||||
if (!*argument) {
|
||||
send_to_char(ch, "Please specify a help entry to edit.\r\n");
|
||||
return;
|
||||
|
|
@ -140,7 +140,7 @@ ACMD(do_oasis_hedit)
|
|||
send_to_char(ch, "Done.\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Give descriptor an OLC structure.
|
||||
|
|
@ -155,16 +155,16 @@ ACMD(do_oasis_hedit)
|
|||
OLC_NUM(d) = 0;
|
||||
OLC_STORAGE(d) = strdup(argument);
|
||||
OLC_ZNUM(d) = search_help(ch, OLC_STORAGE(d));
|
||||
|
||||
|
||||
for(i = 0; i < (int)strlen(argument); i++)
|
||||
argument[i] = toupper(argument[i]);
|
||||
|
||||
if (OLC_ZNUM(d) <= 0)
|
||||
|
||||
if (OLC_ZNUM(d) <= 0)
|
||||
hedit_setup_new(d, OLC_STORAGE(d));
|
||||
else
|
||||
else
|
||||
hedit_setup_existing(d, OLC_ZNUM(d));
|
||||
|
||||
|
||||
|
||||
|
||||
STATE(d) = CON_HEDIT;
|
||||
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
||||
|
|
@ -236,8 +236,8 @@ void hedit_save_to_disk(struct descriptor_data *d)
|
|||
{
|
||||
FILE *fp;
|
||||
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);
|
||||
if (!(fp = fopen(index_name, "w"))) {
|
||||
log("SYSERR: Could not write help index file");
|
||||
|
|
@ -249,8 +249,8 @@ void hedit_save_to_disk(struct descriptor_data *d)
|
|||
continue;
|
||||
strncpy(buf1, help_table[i].entry ? help_table[i].entry : "Empty\n\r", sizeof(buf1) - 1);
|
||||
strip_cr(buf1);
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
* Forget making a buffer, lets just write the thing now.
|
||||
*/
|
||||
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);
|
||||
write_to_output(d,
|
||||
|
||||
|
||||
"\r\n@c-------------------------------------------------------------------------@n\r\n"
|
||||
" @CHelpfile Editor@n \r\n"
|
||||
" @CHelpfile Editor@n \r\n"
|
||||
"@c-------------------------------------------------------------------------@n\r\n"
|
||||
"@g1@n) Keyword [@G%-12s@g]@n\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);
|
||||
mudlog(TRUE, MAX(LVL_BUILDER, GET_INVIS_LEV(d->character)), CMP, buf);
|
||||
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);
|
||||
break;
|
||||
|
|
@ -419,66 +419,66 @@ void hedit_string_cleanup(struct descriptor_data *d, int terminator)
|
|||
}
|
||||
}
|
||||
|
||||
ACMD(do_helpcheck)
|
||||
{
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
int i, w = 0;
|
||||
char arg[64];
|
||||
ACMD(do_helpcheck)
|
||||
{
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
int i, w = 0;
|
||||
char arg[64];
|
||||
ACMD(do_action);
|
||||
|
||||
if(!help_table) {
|
||||
send_to_char(ch, "The help_table doesn't exist!\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(buf, "\r\n");
|
||||
strcpy(buf, "Commands without help entries:\r\n");
|
||||
strcat(buf, "-------------------------------------------------------------------\r\n");
|
||||
|
||||
for(i = 1; *(complete_cmd_info[i].command) != '\n'; i++) {
|
||||
|
||||
if(!help_table) {
|
||||
send_to_char(ch, "The help_table doesn't exist!\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
sprintf(buf, "\r\n");
|
||||
strcpy(buf, "Commands without help entries:\r\n");
|
||||
strcat(buf, "-------------------------------------------------------------------\r\n");
|
||||
|
||||
for(i = 1; *(complete_cmd_info[i].command) != '\n'; i++) {
|
||||
snprintf(arg, sizeof(arg), "%s", complete_cmd_info[i].command);
|
||||
if(search_help(ch, arg) <= 0) {
|
||||
if(complete_cmd_info[i].command_pointer == do_action)
|
||||
continue;
|
||||
w++;
|
||||
w = w%3;
|
||||
sprintf(buf + strlen(buf), " %-20.20s%s", complete_cmd_info[i].command, (w ? "|":"\r\n"));
|
||||
if(search_help(ch, arg) <= 0) {
|
||||
if(complete_cmd_info[i].command_pointer == do_action)
|
||||
continue;
|
||||
w++;
|
||||
w = w%3;
|
||||
sprintf(buf + strlen(buf), " %-20.20s%s", complete_cmd_info[i].command, (w ? "|":"\r\n"));
|
||||
}
|
||||
}
|
||||
if(w)
|
||||
strcat(buf, "\r\n");
|
||||
|
||||
if(ch->desc)
|
||||
page_string(ch->desc, buf, 1);
|
||||
|
||||
*buf = '\0';
|
||||
}
|
||||
|
||||
ACMD(do_hindex)
|
||||
{
|
||||
int len, count = 0, i;
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
|
||||
skip_spaces(&argument);
|
||||
|
||||
if (!*argument) {
|
||||
send_to_char(ch, "Usage: hindex <string>\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
len = sprintf(buf, "Help index entries based on '%s':\r\n", argument);
|
||||
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))
|
||||
len += snprintf(buf + len, sizeof(buf) - len, "%-20.20s%s",
|
||||
help_table[i].keywords, (++count % 3 ? "" : "\r\n"));
|
||||
|
||||
if (count % 3)
|
||||
len += snprintf(buf + len, sizeof(buf) - len, "\r\n");
|
||||
|
||||
if (!count)
|
||||
len += snprintf(buf + len, sizeof(buf) - len, " None.\r\n");
|
||||
|
||||
page_string(ch->desc, buf, TRUE);
|
||||
if(w)
|
||||
strcat(buf, "\r\n");
|
||||
|
||||
if(ch->desc)
|
||||
page_string(ch->desc, buf, 1);
|
||||
|
||||
*buf = '\0';
|
||||
}
|
||||
|
||||
ACMD(do_hindex)
|
||||
{
|
||||
int len, count = 0, i;
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
|
||||
skip_spaces(&argument);
|
||||
|
||||
if (!*argument) {
|
||||
send_to_char(ch, "Usage: hindex <string>\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
len = sprintf(buf, "Help index entries based on '%s':\r\n", argument);
|
||||
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))
|
||||
len += snprintf(buf + len, sizeof(buf) - len, "%-20.20s%s",
|
||||
help_table[i].keywords, (++count % 3 ? "" : "\r\n"));
|
||||
|
||||
if (count % 3)
|
||||
len += snprintf(buf + len, sizeof(buf) - len, "\r\n");
|
||||
|
||||
if (!count)
|
||||
len += snprintf(buf + len, sizeof(buf) - len, " None.\r\n");
|
||||
|
||||
page_string(ch->desc, buf, TRUE);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
if (help_table) {
|
||||
for (i = 0; i <= top_of_h_table; i++) {
|
||||
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)
|
||||
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()
|
||||
*/
|
||||
while (loaded != NULL) {
|
||||
|
|
@ -197,10 +197,10 @@ void House_listrent(struct char_data *ch, room_vnum vnum)
|
|||
loaded = objsave_parse_objects(fl);
|
||||
|
||||
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);
|
||||
|
||||
/* 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()
|
||||
*/
|
||||
while (loaded != NULL) {
|
||||
|
|
@ -320,12 +320,12 @@ void hcontrol_list_houses(struct char_data *ch, char *arg)
|
|||
|
||||
if (arg && *arg) {
|
||||
room_vnum toshow;
|
||||
|
||||
|
||||
if (*arg == '.')
|
||||
toshow = GET_ROOM_VNUM(IN_ROOM(ch));
|
||||
else
|
||||
toshow = atoi(arg);
|
||||
|
||||
|
||||
if ((i = find_house(toshow)) == NOWHERE) {
|
||||
send_to_char(ch, "Unknown house, \"%s\".\r\n", arg);
|
||||
return;
|
||||
|
|
@ -665,13 +665,13 @@ void House_list_guests(struct char_data *ch, int i, int quiet)
|
|||
* 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)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
||||
if (GET_LEVEL(ch) < LVL_IMPL)
|
||||
{
|
||||
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++) {
|
||||
send_to_char(ch, " %d", house_control[i].vnum);
|
||||
|
||||
|
||||
if (!ascii_convert_house(ch, house_control[i].vnum))
|
||||
{
|
||||
{
|
||||
// let ascii_convert_house() tell about the error
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
send_to_char(ch, "...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;
|
||||
struct obj_data *tmp;
|
||||
int i, j=0;
|
||||
|
||||
House_get_filename(vnum, infile, sizeof(infile));
|
||||
|
||||
|
||||
House_get_filename(vnum, infile, sizeof(infile));
|
||||
|
||||
CREATE(outfile, char, strlen(infile)+7);
|
||||
sprintf(outfile, "%s.ascii", infile);
|
||||
|
||||
|
||||
if (!(in = fopen(infile, "r+b"))) /* no file found */
|
||||
{
|
||||
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);
|
||||
return (0);
|
||||
}
|
||||
if (!feof(in))
|
||||
if (!feof(in))
|
||||
{
|
||||
tmp = Obj_from_store(object, &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++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
fprintf(out, "$~\n");
|
||||
|
||||
fclose(in);
|
||||
fclose(out);
|
||||
|
||||
|
||||
// copy the new file over the old one
|
||||
// remove(infile);
|
||||
// rename(outfile, infile);
|
||||
|
||||
|
||||
free(outfile);
|
||||
|
||||
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) {
|
||||
case PARSE_HELP:
|
||||
write_to_output(d,
|
||||
write_to_output(d,
|
||||
"Editor command formats: /<letter>\r\n\r\n"
|
||||
"/a - aborts editor\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;
|
||||
}
|
||||
}
|
||||
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 0:
|
||||
|
|
@ -242,7 +242,7 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d)
|
|||
case PARSE_LIST_NORM:
|
||||
/*
|
||||
* 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';
|
||||
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.
|
||||
*/
|
||||
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);
|
||||
break;
|
||||
case PARSE_LIST_NUM:
|
||||
/*
|
||||
* 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';
|
||||
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
|
||||
* 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++;
|
||||
/*
|
||||
|
|
@ -507,158 +507,158 @@ void parse_edit_action(int command, char *string, struct descriptor_data *d)
|
|||
* Re-formats message type formatted char *.
|
||||
* (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 line_chars, cap_next = TRUE, cap_next_next = FALSE, color_chars = 0, i, pass_line = 0;
|
||||
char *flow, *start = NULL, temp;
|
||||
char formatted[MAX_STRING_LENGTH] = "";
|
||||
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;
|
||||
char *flow, *start = NULL, temp;
|
||||
char formatted[MAX_STRING_LENGTH] = "";
|
||||
|
||||
/* Fix memory overrun. */
|
||||
if (d->max_str > MAX_STRING_LENGTH) {
|
||||
log("SYSERR: format_text: max_str is greater than buffer size.");
|
||||
return 0;
|
||||
}
|
||||
/* Fix memory overrun. */
|
||||
if (d->max_str > MAX_STRING_LENGTH) {
|
||||
log("SYSERR: format_text: max_str is greater than buffer size.");
|
||||
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)
|
||||
return 0;
|
||||
if ((flow = *ptr_string) == NULL)
|
||||
return 0;
|
||||
|
||||
char str[MAX_STRING_LENGTH];
|
||||
strcpy(str, flow);
|
||||
char str[MAX_STRING_LENGTH];
|
||||
strcpy(str, flow);
|
||||
|
||||
for (i = 0; i < low - 1; i++) {
|
||||
start = strtok(str, "\n");
|
||||
if (!start) {
|
||||
write_to_output(d, "There aren't that many lines!\r\n");
|
||||
return 0;
|
||||
}
|
||||
strcat(formatted, strcat(start, "\n"));
|
||||
flow = strstr(flow, "\n");
|
||||
strcpy(str, ++flow);
|
||||
}
|
||||
for (i = 0; i < low - 1; i++) {
|
||||
start = strtok(str, "\n");
|
||||
if (!start) {
|
||||
write_to_output(d, "There aren't that many lines!\r\n");
|
||||
return 0;
|
||||
}
|
||||
strcat(formatted, strcat(start, "\n"));
|
||||
flow = strstr(flow, "\n");
|
||||
strcpy(str, ++flow);
|
||||
}
|
||||
|
||||
if (IS_SET(mode, FORMAT_INDENT)) {
|
||||
strcat(formatted, " ");
|
||||
line_chars = 3;
|
||||
} else {
|
||||
line_chars = 0;
|
||||
}
|
||||
if (IS_SET(mode, FORMAT_INDENT)) {
|
||||
strcat(formatted, " ");
|
||||
line_chars = 3;
|
||||
} else {
|
||||
line_chars = 0;
|
||||
}
|
||||
|
||||
while (*flow && i < high) {
|
||||
while (*flow && strchr("\n\r\f\t\v ", *flow)) {
|
||||
if (*flow == '\n' && !pass_line)
|
||||
while (*flow && i < high) {
|
||||
while (*flow && strchr("\n\r\f\t\v ", *flow)) {
|
||||
if (*flow == '\n' && !pass_line)
|
||||
if (i++ >= high) {
|
||||
pass_line = 1;
|
||||
pass_line = 1;
|
||||
break;
|
||||
}
|
||||
flow++;
|
||||
}
|
||||
}
|
||||
flow++;
|
||||
}
|
||||
|
||||
if (*flow) {
|
||||
start = flow;
|
||||
while (*flow && !strchr("\n\r\f\t\v .?!", *flow)) {
|
||||
if (*flow == '@') {
|
||||
if (*(flow + 1) == '@')
|
||||
color_chars++;
|
||||
else
|
||||
color_chars += 2;
|
||||
flow++;
|
||||
}
|
||||
flow++;
|
||||
}
|
||||
if (*flow) {
|
||||
start = flow;
|
||||
while (*flow && !strchr("\n\r\f\t\v .?!", *flow)) {
|
||||
if (*flow == '@') {
|
||||
if (*(flow + 1) == '@')
|
||||
color_chars++;
|
||||
else
|
||||
color_chars += 2;
|
||||
flow++;
|
||||
}
|
||||
flow++;
|
||||
}
|
||||
|
||||
if (cap_next_next) {
|
||||
cap_next_next = FALSE;
|
||||
cap_next = TRUE;
|
||||
}
|
||||
if (cap_next_next) {
|
||||
cap_next_next = FALSE;
|
||||
cap_next = TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
* This is so that if we stopped on a sentence .. we move off the
|
||||
* sentence delimiter.
|
||||
*/
|
||||
while (strchr(".!?", *flow)) {
|
||||
cap_next_next = TRUE;
|
||||
flow++;
|
||||
}
|
||||
/*
|
||||
* This is so that if we stopped on a sentence .. we move off the
|
||||
* sentence delimiter.
|
||||
*/
|
||||
while (strchr(".!?", *flow)) {
|
||||
cap_next_next = TRUE;
|
||||
flow++;
|
||||
}
|
||||
|
||||
/*
|
||||
* 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
|
||||
* to the \r (or \n) character after the delimiter. Thus *flow will
|
||||
* be non-null, and an extra (blank) line might be added erroneously.
|
||||
* We fix it by skipping the newline characters in between.
|
||||
*
|
||||
* Welcor 04/04
|
||||
*/
|
||||
/*
|
||||
* 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
|
||||
* to the \r (or \n) character after the delimiter. Thus *flow will
|
||||
* be non-null, and an extra (blank) line might be added erroneously.
|
||||
* We fix it by skipping the newline characters in between.
|
||||
*
|
||||
* Welcor 04/04
|
||||
*/
|
||||
|
||||
if (strchr("\n\r", *flow)) {
|
||||
*flow = '\0'; /* terminate 'start' string */
|
||||
flow++; /* we know this is safe */
|
||||
if (*flow == '\n' && i++ >= high)
|
||||
pass_line = 1;
|
||||
if (strchr("\n\r", *flow)) {
|
||||
*flow = '\0'; /* terminate 'start' string */
|
||||
flow++; /* we know this is safe */
|
||||
if (*flow == '\n' && i++ >= high)
|
||||
pass_line = 1;
|
||||
|
||||
while (*flow && strchr("\n\r", *flow) && !pass_line) {
|
||||
flow++; /* skip to next non-delimiter */
|
||||
if (*flow == '\n' && i++ >= high)
|
||||
pass_line = 1;
|
||||
}
|
||||
temp = *flow; /* save this char */
|
||||
} else {
|
||||
temp = *flow;
|
||||
*flow = '\0';
|
||||
}
|
||||
while (*flow && strchr("\n\r", *flow) && !pass_line) {
|
||||
flow++; /* skip to next non-delimiter */
|
||||
if (*flow == '\n' && i++ >= high)
|
||||
pass_line = 1;
|
||||
}
|
||||
temp = *flow; /* save this char */
|
||||
} else {
|
||||
temp = *flow;
|
||||
*flow = '\0';
|
||||
}
|
||||
|
||||
if (line_chars + strlen(start) + 1 - color_chars > PAGE_WIDTH) {
|
||||
strcat(formatted, "\r\n");
|
||||
line_chars = 0;
|
||||
color_chars = count_color_chars(start);
|
||||
}
|
||||
if (line_chars + strlen(start) + 1 - color_chars > PAGE_WIDTH) {
|
||||
strcat(formatted, "\r\n");
|
||||
line_chars = 0;
|
||||
color_chars = count_color_chars(start);
|
||||
}
|
||||
|
||||
if (!cap_next) {
|
||||
if (line_chars > 0) {
|
||||
strcat(formatted, " ");
|
||||
line_chars++;
|
||||
}
|
||||
} else {
|
||||
cap_next = FALSE;
|
||||
CAP(start);
|
||||
}
|
||||
if (!cap_next) {
|
||||
if (line_chars > 0) {
|
||||
strcat(formatted, " ");
|
||||
line_chars++;
|
||||
}
|
||||
} else {
|
||||
cap_next = FALSE;
|
||||
CAP(start);
|
||||
}
|
||||
|
||||
line_chars += strlen(start);
|
||||
strcat(formatted, start);
|
||||
line_chars += strlen(start);
|
||||
strcat(formatted, start);
|
||||
|
||||
*flow = temp;
|
||||
}
|
||||
*flow = temp;
|
||||
}
|
||||
|
||||
if (cap_next_next && *flow) {
|
||||
if (line_chars + 3 - color_chars > PAGE_WIDTH) {
|
||||
strcat(formatted, "\r\n");
|
||||
line_chars = 0;
|
||||
color_chars = count_color_chars(start);
|
||||
} else if (*flow == '\"' || *flow == '\'') {
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
sprintf(buf, "%c ", *flow);
|
||||
strcat(formatted, buf);
|
||||
flow++;
|
||||
line_chars++;
|
||||
} else {
|
||||
strcat(formatted, " ");
|
||||
line_chars += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (*flow)
|
||||
strcat(formatted, "\r\n");
|
||||
strcat(formatted, flow);
|
||||
if (!*flow)
|
||||
strcat(formatted, "\r\n");
|
||||
if (cap_next_next && *flow) {
|
||||
if (line_chars + 3 - color_chars > PAGE_WIDTH) {
|
||||
strcat(formatted, "\r\n");
|
||||
line_chars = 0;
|
||||
color_chars = count_color_chars(start);
|
||||
} else if (*flow == '\"' || *flow == '\'') {
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
sprintf(buf, "%c ", *flow);
|
||||
strcat(formatted, buf);
|
||||
flow++;
|
||||
line_chars++;
|
||||
} else {
|
||||
strcat(formatted, " ");
|
||||
line_chars += 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (*flow)
|
||||
strcat(formatted, "\r\n");
|
||||
strcat(formatted, flow);
|
||||
if (!*flow)
|
||||
strcat(formatted, "\r\n");
|
||||
|
||||
if (strlen(formatted) + 1 > maxlen)
|
||||
formatted[maxlen - 1] = '\0';
|
||||
RECREATE(*ptr_string, char, MIN(maxlen, strlen(formatted) + 1));
|
||||
strcpy(*ptr_string, formatted);
|
||||
return 1;
|
||||
if (strlen(formatted) + 1 > maxlen)
|
||||
formatted[maxlen - 1] = '\0';
|
||||
RECREATE(*ptr_string, char, MIN(maxlen, strlen(formatted) + 1));
|
||||
strcpy(*ptr_string, formatted);
|
||||
return 1;
|
||||
}
|
||||
|
||||
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_vdelete);
|
||||
ACMD(do_mfollow);
|
||||
ACMD(do_tlist);
|
||||
ACMD(do_tlist);
|
||||
|
||||
/* TBA specifics */
|
||||
ACMD(do_file);
|
||||
|
|
@ -256,7 +256,7 @@ cpp_extern const struct command_info cmd_info[] = {
|
|||
{ "west" , "w" , POS_STANDING, do_move , 0, SCMD_WEST },
|
||||
{ "up" , "u" , POS_STANDING, do_move , 0, SCMD_UP },
|
||||
{ "down" , "d" , POS_STANDING, do_move , 0, SCMD_DOWN },
|
||||
|
||||
|
||||
/* now, the main list */
|
||||
{ "at" , "at" , POS_DEAD , do_at , LVL_IMMORT, 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 },
|
||||
{ "buy" , "bu" , POS_STANDING, do_not_here , 0, 0 },
|
||||
{ "bug" , "bug" , POS_DEAD , do_gen_write, 0, SCMD_BUG },
|
||||
|
||||
|
||||
{ "cast" , "c" , POS_SITTING , do_cast , 1, 0 },
|
||||
{ "cedit" , "cedit" , POS_DEAD , do_oasis , LVL_IMPL, SCMD_OASIS_CEDIT },
|
||||
{ "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 },
|
||||
{ "copyover" , "copyover", POS_DEAD , do_copyover , LVL_GRGOD, 0 },
|
||||
{ "credits" , "cred" , POS_DEAD , do_gen_ps , 0, SCMD_CREDITS },
|
||||
|
||||
|
||||
{ "date" , "da" , POS_DEAD , do_date , LVL_IMMORT, SCMD_DATE },
|
||||
{ "dc" , "dc" , POS_DEAD , do_dc , LVL_GOD, 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 },
|
||||
{ "drink" , "dri" , POS_RESTING , do_drink , 0, SCMD_DRINK },
|
||||
{ "drop" , "dro" , POS_RESTING , do_drop , 0, SCMD_DROP },
|
||||
|
||||
|
||||
{ "eat" , "ea" , POS_RESTING , do_eat , 0, SCMD_EAT },
|
||||
{ "echo" , "ec" , POS_SLEEPING, do_echo , LVL_IMMORT, SCMD_ECHO },
|
||||
{ "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 },
|
||||
{ "examine" , "exa" , POS_SITTING , do_examine , 0, 0 },
|
||||
{ "export" , "export" , POS_DEAD , do_export_zone, LVL_IMPL, 0 },
|
||||
|
||||
|
||||
{ "force" , "force" , POS_SLEEPING, do_force , LVL_GOD, 0 },
|
||||
{ "fill" , "fil" , POS_STANDING, do_pour , 0, SCMD_FILL },
|
||||
{ "file" , "file" , POS_SLEEPING, do_file , LVL_GOD, 0 },
|
||||
{ "flee" , "fl" , POS_FIGHTING, do_flee , 1, 0 },
|
||||
{ "follow" , "fol" , POS_RESTING , do_follow , 0, 0 },
|
||||
{ "freeze" , "freeze" , POS_DEAD , do_wizutil , LVL_FREEZE, SCMD_FREEZE },
|
||||
|
||||
|
||||
{ "get" , "g" , POS_RESTING , do_get , 0, 0 },
|
||||
{ "gecho" , "gecho" , POS_DEAD , do_gecho , LVL_GOD, 0 },
|
||||
{ "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 },
|
||||
{ "gsay" , "gsay" , POS_SLEEPING, do_gsay , 0, 0 },
|
||||
{ "gtell" , "gt" , POS_SLEEPING, do_gsay , 0, 0 },
|
||||
|
||||
|
||||
{ "help" , "h" , POS_DEAD , do_help , 0, 0 },
|
||||
{ "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 },
|
||||
{ "hide" , "hi" , POS_RESTING , do_hide , 1, 0 },
|
||||
{ "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 },
|
||||
{ "holylight", "holy" , POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_HOLYLIGHT },
|
||||
{ "house" , "house" , POS_RESTING , do_house , 0, 0 },
|
||||
|
||||
|
||||
{ "inventory", "i" , POS_DEAD , do_inventory, 0, 0 },
|
||||
{ "idea" , "id" , POS_DEAD , do_gen_write, 0, SCMD_IDEA },
|
||||
{ "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 },
|
||||
{ "insult" , "insult" , POS_RESTING , do_insult , 0, 0 },
|
||||
{ "invis" , "invi" , POS_DEAD , do_invis , LVL_IMMORT, 0 },
|
||||
|
||||
|
||||
{ "junk" , "j" , POS_RESTING , do_drop , 0, SCMD_JUNK },
|
||||
|
||||
|
||||
{ "kill" , "k" , POS_FIGHTING, do_kill , 0, 0 },
|
||||
{ "kick" , "ki" , POS_FIGHTING, do_kick , 1, 0 },
|
||||
|
||||
|
||||
{ "look" , "l" , POS_RESTING , do_look , 0, SCMD_LOOK },
|
||||
{ "last" , "last" , POS_DEAD , do_last , LVL_GOD, 0 },
|
||||
{ "leave" , "lea" , POS_STANDING, do_leave , 0, 0 },
|
||||
{ "levels" , "lev" , POS_DEAD , do_levels , 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 },
|
||||
{ "load" , "load" , POS_DEAD , do_load , LVL_BUILDER, 0 },
|
||||
|
||||
|
||||
{ "motd" , "motd" , POS_DEAD , do_gen_ps , 0, SCMD_MOTD },
|
||||
{ "mail" , "mail" , POS_STANDING, do_not_here , 1, 0 },
|
||||
{ "medit" , "med" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_MEDIT },
|
||||
{ "mlist" , "mlist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_MLIST },
|
||||
{ "mute" , "mute" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_SQUELCH },
|
||||
|
||||
|
||||
{ "news" , "news" , POS_SLEEPING, do_gen_ps , 0, SCMD_NEWS },
|
||||
{ "noauction", "noauction",POS_DEAD , do_gen_tog , 0, SCMD_NOAUCTION },
|
||||
{ "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 },
|
||||
{ "notitle" , "notitle" , POS_DEAD , do_wizutil , LVL_GOD, SCMD_NOTITLE },
|
||||
{ "nowiz" , "nowiz" , POS_DEAD , do_gen_tog , LVL_IMMORT, SCMD_NOWIZ },
|
||||
|
||||
|
||||
{ "open" , "o" , POS_SITTING , do_gen_door , 0, SCMD_OPEN },
|
||||
{ "order" , "ord" , POS_RESTING , do_order , 1, 0 },
|
||||
{ "offer" , "off" , POS_STANDING, do_not_here , 1, 0 },
|
||||
{ "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 },
|
||||
|
||||
|
||||
{ "put" , "p" , POS_RESTING , do_put , 0, 0 },
|
||||
{ "peace" , "pe" , POS_DEAD , do_peace , LVL_BUILDER, 0 },
|
||||
{ "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 },
|
||||
{ "prompt" , "pro" , POS_DEAD , do_display , 0, 0 },
|
||||
{ "purge" , "purge" , POS_DEAD , do_purge , LVL_BUILDER, 0 },
|
||||
|
||||
|
||||
{ "quaff" , "qua" , POS_RESTING , do_use , 0, SCMD_QUAFF },
|
||||
{ "qecho" , "qec" , POS_DEAD , do_qcomm , LVL_GOD, SCMD_QECHO },
|
||||
{ "quest" , "que" , POS_DEAD , do_gen_tog , 0, SCMD_QUEST },
|
||||
{ "qui" , "qui" , POS_DEAD , do_quit , 0, 0 },
|
||||
{ "quit" , "quit" , POS_DEAD , do_quit , 0, SCMD_QUIT },
|
||||
{ "qsay" , "qsay" , POS_RESTING , do_qcomm , 0, SCMD_QSAY },
|
||||
|
||||
|
||||
{ "reply" , "r" , POS_SLEEPING, do_reply , 0, 0 },
|
||||
{ "rest" , "res" , POS_RESTING , do_rest , 0, 0 },
|
||||
{ "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 },
|
||||
{ "return" , "retu" , POS_DEAD , do_return , 0, 0 },
|
||||
{ "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 },
|
||||
{ "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 },
|
||||
{ "steal" , "ste" , POS_STANDING, do_steal , 1, 0 },
|
||||
{ "switch" , "switch" , POS_DEAD , do_switch , LVL_GOD, 0 },
|
||||
|
||||
|
||||
{ "tell" , "t" , POS_DEAD , do_tell , 0, 0 },
|
||||
{ "take" , "ta" , POS_RESTING , do_get , 0, 0 },
|
||||
{ "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 },
|
||||
{ "trigedit" , "trigedit", POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_TRIGEDIT},
|
||||
{ "typo" , "typo" , POS_DEAD , do_gen_write, 0, SCMD_TYPO },
|
||||
|
||||
|
||||
{ "unlock" , "unlock" , POS_SITTING , do_gen_door , 0, SCMD_UNLOCK },
|
||||
{ "ungroup" , "ungroup" , POS_DEAD , do_ungroup , 0, 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 },
|
||||
{ "use" , "use" , POS_SITTING , do_use , 1, SCMD_USE },
|
||||
{ "users" , "users" , POS_DEAD , do_users , LVL_GOD, 0 },
|
||||
|
||||
|
||||
{ "value" , "val" , POS_STANDING, do_not_here , 0, 0 },
|
||||
{ "version" , "ver" , POS_DEAD , do_gen_ps , 0, SCMD_VERSION },
|
||||
{ "visible" , "vis" , POS_RESTING , do_visible , 1, 0 },
|
||||
{ "vnum" , "vnum" , POS_DEAD , do_vnum , LVL_IMMORT, 0 },
|
||||
{ "vstat" , "vstat" , POS_DEAD , do_vstat , LVL_IMMORT, 0 },
|
||||
|
||||
|
||||
{ "wake" , "wake" , POS_SLEEPING, do_wake , 0, 0 },
|
||||
{ "wear" , "wea" , POS_RESTING , do_wear , 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 },
|
||||
{ "wizlock" , "wizlock" , POS_DEAD , do_wizlock , LVL_IMPL, 0 },
|
||||
{ "write" , "write" , POS_STANDING, do_write , 1, 0 },
|
||||
|
||||
|
||||
{ "zreset" , "zreset" , POS_DEAD , do_zreset , LVL_BUILDER, 0 },
|
||||
{ "zedit" , "zedit" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_ZEDIT },
|
||||
{ "zlist" , "zlist" , POS_DEAD , do_oasis , LVL_BUILDER, SCMD_OASIS_ZLIST },
|
||||
{ "zcheck" , "zcheck" , POS_DEAD , do_zcheck , LVL_GOD, 0 },
|
||||
{ "zpurge" , "zpurge" , POS_DEAD , do_zpurge , LVL_BUILDER, 0 },
|
||||
|
||||
|
||||
/* DG trigger commands */
|
||||
{ "attach" , "attach" , POS_DEAD , do_attach , 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 },
|
||||
{ "masound" , "masound" , POS_DEAD , do_masound , -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);
|
||||
|
||||
/* 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 */
|
||||
{
|
||||
|
|
@ -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) return; /* yes, command trigger took over */
|
||||
}
|
||||
|
||||
for (length = strlen(arg), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++)
|
||||
if(complete_cmd_info[cmd].command_pointer != do_action &&
|
||||
!strncmp(complete_cmd_info[cmd].command, arg, length))
|
||||
|
||||
for (length = strlen(arg), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++)
|
||||
if(complete_cmd_info[cmd].command_pointer != do_action &&
|
||||
!strncmp(complete_cmd_info[cmd].command, arg, length))
|
||||
if (GET_LEVEL(ch) >= complete_cmd_info[cmd].minimum_level)
|
||||
break;
|
||||
|
||||
/* it's not a 'real' command, so it's a social */
|
||||
|
||||
if(*complete_cmd_info[cmd].command == '\n')
|
||||
for (length = strlen(arg), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++)
|
||||
if (complete_cmd_info[cmd].command_pointer == do_action &&
|
||||
!strncmp(complete_cmd_info[cmd].command, arg, length))
|
||||
if (GET_LEVEL(ch) >= complete_cmd_info[cmd].minimum_level)
|
||||
break;
|
||||
|
||||
|
||||
/* it's not a 'real' command, so it's a social */
|
||||
|
||||
if(*complete_cmd_info[cmd].command == '\n')
|
||||
for (length = strlen(arg), cmd = 0; *complete_cmd_info[cmd].command != '\n'; cmd++)
|
||||
if (complete_cmd_info[cmd].command_pointer == do_action &&
|
||||
!strncmp(complete_cmd_info[cmd].command, arg, length))
|
||||
if (GET_LEVEL(ch) >= complete_cmd_info[cmd].minimum_level)
|
||||
break;
|
||||
|
||||
if (*complete_cmd_info[cmd].command == '\n')
|
||||
send_to_char(ch, "Huh?!?\r\n");
|
||||
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)
|
||||
*
|
||||
* that was dumb. it shouldn't be symmetrical. JE 5/1/95
|
||||
*
|
||||
*
|
||||
* returns 1 if arg1 is an abbreviation of 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) {
|
||||
/* Character taking over their own body. */
|
||||
pref_temp=GET_PREF(k->character);
|
||||
|
||||
|
||||
if (!target && STATE(k) == CON_PLAYING) {
|
||||
write_to_output(k, "\r\nThis body has been usurped!\r\n");
|
||||
target = k->character;
|
||||
|
|
@ -1259,13 +1259,13 @@ int perform_dupe_check(struct descriptor_data *d)
|
|||
GET_HOST(d->character)= strdup(d->host);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
if (GET_HOST(target)) free(GET_HOST(target));
|
||||
GET_HOST(target) = strdup(d->host);
|
||||
|
||||
|
||||
GET_PREF(target) = pref_temp;
|
||||
add_llog_entry(target, LAST_RECONNECT);
|
||||
|
||||
|
||||
/* Okay, we've found a target. Connect d to target. */
|
||||
free_char(d->character); /* get rid of the old char */
|
||||
d->character = target;
|
||||
|
|
@ -1305,17 +1305,17 @@ int enter_player_game (struct descriptor_data *d)
|
|||
|
||||
int load_result;
|
||||
room_vnum load_room;
|
||||
|
||||
|
||||
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.
|
||||
*/
|
||||
if (GET_ALIASES(d->character) == NULL)
|
||||
if (GET_ALIASES(d->character) == NULL)
|
||||
{
|
||||
read_aliases(d->character);
|
||||
// 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))
|
||||
|
|
@ -1560,12 +1560,12 @@ void nanny(struct descriptor_data *d, char *arg)
|
|||
else
|
||||
write_to_output(d, "%s", motd);
|
||||
|
||||
if (GET_INVIS_LEV(d->character))
|
||||
mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE,
|
||||
"%s [%s] has connected. (invis %d)", GET_NAME(d->character), d->host,
|
||||
if (GET_INVIS_LEV(d->character))
|
||||
mudlog(BRF, MAX(LVL_IMMORT, GET_INVIS_LEV(d->character)), TRUE,
|
||||
"%s [%s] has connected. (invis %d)", GET_NAME(d->character), d->host,
|
||||
GET_INVIS_LEV(d->character));
|
||||
else
|
||||
mudlog(BRF, LVL_IMMORT, TRUE,
|
||||
mudlog(BRF, LVL_IMMORT, TRUE,
|
||||
"%s [%s] has connected.", GET_NAME(d->character), d->host);
|
||||
|
||||
if (load_result) {
|
||||
|
|
@ -1796,7 +1796,7 @@ void nanny(struct descriptor_data *d, char *arg)
|
|||
SET_BIT(player_table[player_i].flags, PINDEX_SELFDELETE);
|
||||
remove_player(player_i);
|
||||
}
|
||||
|
||||
|
||||
delete_aliases(GET_NAME(d->character));
|
||||
delete_variables(GET_NAME(d->character));
|
||||
write_to_output(d, "Character '%s' deleted!\r\n"
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ struct alias_data {
|
|||
|
||||
/* do_gen_ps */
|
||||
#define SCMD_INFO 0
|
||||
#define SCMD_HANDBOOK 1
|
||||
#define SCMD_HANDBOOK 1
|
||||
#define SCMD_CREDITS 2
|
||||
#define SCMD_NEWS 3
|
||||
#define SCMD_WIZLIST 4
|
||||
|
|
@ -128,7 +128,7 @@ struct alias_data {
|
|||
#define SCMD_CLS 17
|
||||
#define SCMD_BUILDWALK 18
|
||||
#define SCMD_AFK 19
|
||||
#define SCMD_COLOR 20
|
||||
#define SCMD_COLOR 20
|
||||
#define SCMD_SYSLOG 21
|
||||
#define SCMD_WIMPY 22
|
||||
#define SCMD_PAGELENGTH 23
|
||||
|
|
|
|||
|
|
@ -400,11 +400,11 @@ void point_update(void)
|
|||
/* characters */
|
||||
for (i = character_list; i; i = next_char) {
|
||||
next_char = i->next;
|
||||
|
||||
|
||||
gain_condition(i, FULL, -1);
|
||||
gain_condition(i, DRUNK, -1);
|
||||
gain_condition(i, THIRST, -1);
|
||||
|
||||
|
||||
if (GET_POS(i) >= POS_STUNNED) {
|
||||
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));
|
||||
|
|
@ -467,7 +467,7 @@ void point_update(void)
|
|||
/* 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() */
|
||||
else if (GET_OBJ_TIMER(j)>0) {
|
||||
GET_OBJ_TIMER(j)--;
|
||||
GET_OBJ_TIMER(j)--;
|
||||
if (!GET_OBJ_TIMER(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);
|
||||
if (to_room != NULL)
|
||||
act(to_room, FALSE, ch, 0, 0, TO_ROOM);
|
||||
|
||||
|
||||
|
||||
for (tch = world[IN_ROOM(ch)].people; tch; tch = next_tch) {
|
||||
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);
|
||||
|
||||
/* -------------------------------------------------------------------------- */
|
||||
char *decrypt_hex(char *string, size_t len)
|
||||
char *decrypt_hex(char *string, size_t len)
|
||||
{
|
||||
static char output[MAX_STRING_LENGTH];
|
||||
char *p;
|
||||
char *src = string;
|
||||
int i;
|
||||
|
||||
|
||||
p = output;
|
||||
for (i = 0;i<len/2;++i) {
|
||||
unsigned char hi = *src++;
|
||||
|
|
@ -61,13 +61,13 @@ char *decrypt_hex(char *string, size_t len)
|
|||
return output;
|
||||
}
|
||||
|
||||
char *encrypt_hex(char *string, size_t len)
|
||||
char *encrypt_hex(char *string, size_t len)
|
||||
{
|
||||
static char output[MAX_STRING_LENGTH];
|
||||
char *p;
|
||||
char *src = string;
|
||||
int i;
|
||||
|
||||
|
||||
if (len == 0)
|
||||
return "";
|
||||
|
||||
|
|
@ -103,29 +103,29 @@ void free_mail_record(struct mail_t *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];
|
||||
long sender, recipient;
|
||||
time_t sent_time;
|
||||
struct mail_t *record;
|
||||
|
||||
|
||||
if (!get_line(mail_file, line))
|
||||
return NULL;
|
||||
|
||||
|
||||
if (sscanf(line, "### %ld %ld %ld", &recipient, &sender, &sent_time) != 3) {
|
||||
log("Mail system - fatal error - malformed mail header");
|
||||
log("Line was: %s", line);
|
||||
return NULL;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
|
||||
CREATE(record, struct mail_t, 1);
|
||||
|
||||
|
||||
record->recipient = recipient;
|
||||
record->sender = sender;
|
||||
record->sent_time = sent_time;
|
||||
record->body = fread_string(mail_file, "read mail record");
|
||||
|
||||
|
||||
return record;
|
||||
}
|
||||
|
||||
|
|
@ -138,7 +138,7 @@ void write_mail_record(FILE *mail_file, struct mail_t *record)
|
|||
record->sent_time,
|
||||
record->body );
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* int scan_file(none)
|
||||
* Returns false if mail file is corrupted or true if everything correct.
|
||||
|
|
@ -157,9 +157,9 @@ int scan_file(void)
|
|||
touch(MAIL_FILE);
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
record = read_mail_record(mail_file);
|
||||
|
||||
|
||||
while (record) {
|
||||
free_mail_record(record);
|
||||
record = read_mail_record(mail_file);
|
||||
|
|
@ -182,14 +182,14 @@ int has_mail(long recipient)
|
|||
{
|
||||
FILE *mail_file;
|
||||
struct mail_t *record;
|
||||
|
||||
|
||||
if (!(mail_file = fopen(MAIL_FILE, "r"))) {
|
||||
perror("read_delete: Mail file not accessible.");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
record = read_mail_record(mail_file);
|
||||
|
||||
|
||||
while (record) {
|
||||
if (record->recipient == recipient) {
|
||||
free_mail_record(record);
|
||||
|
|
@ -218,13 +218,13 @@ void store_mail(long to, long from, char *message_pointer)
|
|||
{
|
||||
FILE *mail_file;
|
||||
struct mail_t *record;
|
||||
|
||||
|
||||
if (!(mail_file = fopen(MAIL_FILE, "a"))) {
|
||||
perror("store_mail: Mail file not accessible.");
|
||||
return;
|
||||
}
|
||||
CREATE(record, struct mail_t, 1);
|
||||
|
||||
|
||||
record->recipient = to;
|
||||
record->sender = from;
|
||||
record->sent_time = time(0);
|
||||
|
|
@ -235,7 +235,7 @@ void store_mail(long to, long from, char *message_pointer)
|
|||
fclose(mail_file);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* char *read_delete(long #1)
|
||||
* #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;
|
||||
struct mail_t *record, *record_to_keep = NULL;
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
|
||||
|
||||
if (!(mail_file = fopen(MAIL_FILE, "r"))) {
|
||||
perror("read_delete: Mail file not accessible.");
|
||||
return strdup("Mail system malfunction - please report this");
|
||||
|
|
@ -262,9 +262,9 @@ char *read_delete(long recipient)
|
|||
fclose(mail_file);
|
||||
return strdup("Mail system malfunction - please report this");
|
||||
}
|
||||
|
||||
|
||||
record = read_mail_record(mail_file);
|
||||
|
||||
|
||||
while (record) {
|
||||
if (!record_to_keep && record->recipient == recipient) {
|
||||
record_to_keep = record;
|
||||
|
|
@ -275,10 +275,10 @@ char *read_delete(long recipient)
|
|||
free_mail_record(record);
|
||||
record = read_mail_record(mail_file);
|
||||
}
|
||||
|
||||
|
||||
if (!record_to_keep)
|
||||
sprintf(buf, "Mail system error - please report");
|
||||
else {
|
||||
else {
|
||||
char *tmstr, *from, *to;
|
||||
|
||||
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);
|
||||
to = get_name_by_id(record_to_keep->recipient);
|
||||
|
||||
snprintf(buf, sizeof(buf),
|
||||
snprintf(buf, sizeof(buf),
|
||||
" * * * * Midgaard Mail System * * * *\r\n"
|
||||
"Date: %s\r\n"
|
||||
"To : %s\r\n"
|
||||
"From: %s\r\n"
|
||||
"\r\n"
|
||||
"%s",
|
||||
|
||||
|
||||
tmstr,
|
||||
to ? to : "Unknown",
|
||||
from ? from : "Unknown",
|
||||
record_to_keep->body ? record_to_keep->body : "No message" );
|
||||
|
||||
|
||||
free_mail_record(record_to_keep);
|
||||
}
|
||||
}
|
||||
fclose(mail_file);
|
||||
fclose(new_file);
|
||||
|
||||
remove(MAIL_FILE);
|
||||
rename(MAIL_FILE_TMP, MAIL_FILE);
|
||||
|
||||
|
||||
return strdup(buf);
|
||||
}
|
||||
|
||||
|
|
@ -380,7 +380,7 @@ void postmaster_send_mail(struct char_data *ch, struct char_data *mailman,
|
|||
STAMP_PRICE);
|
||||
|
||||
act(buf, FALSE, mailman, 0, ch, TO_VICT);
|
||||
|
||||
|
||||
if (GET_LEVEL(ch) < LVL_IMMORT)
|
||||
GET_GOLD(ch) -= STAMP_PRICE;
|
||||
|
||||
|
|
@ -414,7 +414,7 @@ void postmaster_receive_mail(struct char_data *ch, struct char_data *mailman,
|
|||
return;
|
||||
}
|
||||
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->short_description = strdup("a piece of mail");
|
||||
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. */
|
||||
|
||||
/* 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 */
|
||||
#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
|
||||
|
||||
/*-------------------------------------------------------------------*\
|
||||
utility functions
|
||||
utility functions
|
||||
\*-------------------------------------------------------------------*/
|
||||
|
||||
ACMD(do_oasis_medit)
|
||||
|
|
@ -66,12 +66,12 @@ ACMD(do_oasis_medit)
|
|||
char *buf3;
|
||||
char buf1[MAX_STRING_LENGTH];
|
||||
char buf2[MAX_STRING_LENGTH];
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Parse any arguments. **/
|
||||
/****************************************************************************/
|
||||
buf3 = two_arguments(argument, buf1, buf2);
|
||||
|
||||
|
||||
if (!*buf1) {
|
||||
send_to_char(ch, "Specify a mobile VNUM to edit.\r\n");
|
||||
return;
|
||||
|
|
@ -80,32 +80,32 @@ ACMD(do_oasis_medit)
|
|||
send_to_char(ch, "Yikes! Stop that, someone will get hurt!\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
save = TRUE;
|
||||
|
||||
|
||||
if (is_number(buf2))
|
||||
number = atoi(buf2);
|
||||
else if (GET_OLC_ZONE(ch) > 0) {
|
||||
zone_rnum zlok;
|
||||
|
||||
|
||||
if ((zlok = real_zone(GET_OLC_ZONE(ch))) == NOWHERE)
|
||||
number = NOWHERE;
|
||||
else
|
||||
number = genolc_zone_bottom(zlok);
|
||||
}
|
||||
|
||||
|
||||
if (number == NOWHERE) {
|
||||
send_to_char(ch, "Save which zone?\r\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** If a numeric argument was given (like a room number), get it. **/
|
||||
/****************************************************************************/
|
||||
if (number == NOBODY)
|
||||
number = atoi(buf1);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Check that whatever it is isn't already being edited. **/
|
||||
/****************************************************************************/
|
||||
|
|
@ -118,9 +118,9 @@ ACMD(do_oasis_medit)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
d = ch->desc;
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Give descriptor an OLC structure. **/
|
||||
/****************************************************************************/
|
||||
|
|
@ -129,9 +129,9 @@ ACMD(do_oasis_medit)
|
|||
"SYSERR: do_oasis_medit: Player already had olc structure.");
|
||||
free(d->olc);
|
||||
}
|
||||
|
||||
|
||||
CREATE(d->olc, struct oasis_olc_data, 1);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Find the zone. **/
|
||||
/****************************************************************************/
|
||||
|
|
@ -142,7 +142,7 @@ ACMD(do_oasis_medit)
|
|||
d->olc = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** 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;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** 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,
|
||||
"OLC: %s saves mobile info for zone %d.",
|
||||
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number);
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/** Save the mobiles. **/
|
||||
/**************************************************************************/
|
||||
save_mobiles(OLC_ZNUM(d));
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/** 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;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
OLC_NUM(d) = number;
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** If this is a new mobile, setup a new one, otherwise, setup the **/
|
||||
/** 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);
|
||||
else
|
||||
medit_setup_existing(d, real_num);
|
||||
|
||||
|
||||
STATE(d) = CON_MEDIT;
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Display the OLC messages to the players in the same room as the **/
|
||||
/** builder and also log it. **/
|
||||
/****************************************************************************/
|
||||
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
||||
|
||||
|
||||
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));
|
||||
}
|
||||
|
|
@ -212,7 +212,7 @@ void medit_setup_new(struct descriptor_data *d)
|
|||
struct char_data *mob;
|
||||
|
||||
/*
|
||||
* Allocate a scratch mobile structure.
|
||||
* Allocate a scratch mobile structure.
|
||||
*/
|
||||
CREATE(mob, struct char_data, 1);
|
||||
|
||||
|
|
@ -232,12 +232,12 @@ void medit_setup_new(struct descriptor_data *d)
|
|||
#endif
|
||||
SCRIPT(mob) = NULL;
|
||||
mob->proto_script = OLC_SCRIPT(d) = NULL;
|
||||
|
||||
|
||||
OLC_MOB(d) = mob;
|
||||
/* Has changed flag. (It hasn't so far, we just made it.) */
|
||||
OLC_VAL(d) = FALSE;
|
||||
OLC_ITEM_TYPE(d) = MOB_TRIGGER;
|
||||
|
||||
|
||||
medit_disp_menu(d);
|
||||
}
|
||||
|
||||
|
|
@ -248,7 +248,7 @@ void medit_setup_existing(struct descriptor_data *d, int rmob_num)
|
|||
struct char_data *mob;
|
||||
|
||||
/*
|
||||
* Allocate a scratch mobile structure.
|
||||
* Allocate a scratch mobile structure.
|
||||
*/
|
||||
CREATE(mob, struct char_data, 1);
|
||||
|
||||
|
|
@ -324,38 +324,38 @@ void medit_save_internally(struct descriptor_data *d)
|
|||
mob_rnum new_rnum;
|
||||
struct descriptor_data *dsc;
|
||||
struct char_data *mob;
|
||||
|
||||
|
||||
i = (real_mobile(OLC_NUM(d)) == NOBODY);
|
||||
|
||||
|
||||
if ((new_rnum = add_mobile(OLC_MOB(d), OLC_NUM(d))) == NOBODY) {
|
||||
log("medit_save_internally: add_mobile failed.");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/* Update triggers */
|
||||
/* Free old proto list */
|
||||
if (mob_proto[new_rnum].proto_script &&
|
||||
mob_proto[new_rnum].proto_script != OLC_SCRIPT(d))
|
||||
free_proto_script(&mob_proto[new_rnum], MOB_TRIGGER);
|
||||
mob_proto[new_rnum].proto_script != OLC_SCRIPT(d))
|
||||
free_proto_script(&mob_proto[new_rnum], MOB_TRIGGER);
|
||||
|
||||
mob_proto[new_rnum].proto_script = OLC_SCRIPT(d);
|
||||
|
||||
/* this takes care of the mobs currently in-game */
|
||||
for (mob = character_list; mob; mob = mob->next) {
|
||||
if (GET_MOB_RNUM(mob) != new_rnum)
|
||||
if (GET_MOB_RNUM(mob) != new_rnum)
|
||||
continue;
|
||||
|
||||
|
||||
/* remove any old scripts */
|
||||
if (SCRIPT(mob))
|
||||
if (SCRIPT(mob))
|
||||
extract_script(mob, MOB_TRIGGER);
|
||||
|
||||
free_proto_script(mob, MOB_TRIGGER);
|
||||
copy_proto_script(&mob_proto[new_rnum], mob, MOB_TRIGGER);
|
||||
assign_triggers(mob, MOB_TRIGGER);
|
||||
}
|
||||
/* end trigger update */
|
||||
/* end trigger update */
|
||||
|
||||
if (!i) /* Only renumber on new mobiles. */
|
||||
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;
|
||||
char flags[MAX_STRING_LENGTH];
|
||||
|
||||
|
||||
get_char_colors(d->character);
|
||||
clear_screen(d);
|
||||
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;
|
||||
medit_disp_aff_flags(d);
|
||||
return;
|
||||
case 'x':
|
||||
case 'X':
|
||||
write_to_output(d, "Are you sure you want to delete this mobile? ");
|
||||
OLC_MODE(d) = MEDIT_DELETE;
|
||||
return;
|
||||
case 'x':
|
||||
case 'X':
|
||||
write_to_output(d, "Are you sure you want to delete this mobile? ");
|
||||
OLC_MODE(d) = MEDIT_DELETE;
|
||||
return;
|
||||
#if CONFIG_OASIS_MPROG
|
||||
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));
|
||||
|
||||
/* 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);
|
||||
medit_disp_aff_flags(d);
|
||||
return;
|
||||
|
|
@ -1091,21 +1091,21 @@ void medit_parse(struct descriptor_data *d, char *arg)
|
|||
GET_ALIGNMENT(OLC_MOB(d)) = LIMIT(i, -1000, 1000);
|
||||
break;
|
||||
|
||||
case MEDIT_DELETE:
|
||||
if (*arg == 'y' || *arg == 'Y') {
|
||||
if (delete_mobile(GET_MOB_RNUM(OLC_MOB(d))))
|
||||
write_to_output(d, "Mobile deleted.\r\n");
|
||||
else
|
||||
write_to_output(d, "Couldn't delete the mobile!\r\n");
|
||||
|
||||
cleanup_olc(d, CLEANUP_ALL);
|
||||
return;
|
||||
} else if (*arg == 'n' || *arg == 'N') {
|
||||
medit_disp_menu(d);
|
||||
OLC_MODE(d) = MEDIT_MAIN_MENU;
|
||||
return;
|
||||
} else
|
||||
write_to_output(d, "Please answer 'Y' or 'N': ");
|
||||
case MEDIT_DELETE:
|
||||
if (*arg == 'y' || *arg == 'Y') {
|
||||
if (delete_mobile(GET_MOB_RNUM(OLC_MOB(d))))
|
||||
write_to_output(d, "Mobile deleted.\r\n");
|
||||
else
|
||||
write_to_output(d, "Couldn't delete the mobile!\r\n");
|
||||
|
||||
cleanup_olc(d, CLEANUP_ALL);
|
||||
return;
|
||||
} else if (*arg == 'n' || *arg == 'N') {
|
||||
medit_disp_menu(d);
|
||||
OLC_MODE(d) = MEDIT_MAIN_MENU;
|
||||
return;
|
||||
} else
|
||||
write_to_output(d, "Please answer 'Y' or 'N': ");
|
||||
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
|
||||
* 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;
|
||||
|
|
|
|||
38
src/modify.c
38
src/modify.c
|
|
@ -76,7 +76,7 @@ int length[] =
|
|||
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.
|
||||
* -- 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)
|
||||
d->backstr = (char *)data;
|
||||
else if (data)
|
||||
free(data);
|
||||
free(data);
|
||||
|
||||
d->str = writeto;
|
||||
d->max_str = len;
|
||||
|
|
@ -123,14 +123,14 @@ void string_add(struct descriptor_data *d, char *str)
|
|||
delete_doubledollar(str);
|
||||
smash_tilde(str);
|
||||
|
||||
/* 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 '@' if it's by itself - fnord 10/15/2004 */
|
||||
if ((action = (*str == '@' && !str[1])))
|
||||
*str = '\0';
|
||||
else
|
||||
if ((action = improved_editor_execute(d, str)) == STRINGADD_ACTION)
|
||||
return;
|
||||
/* 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 '@' if it's by itself - fnord 10/15/2004 */
|
||||
if ((action = (*str == '@' && !str[1])))
|
||||
*str = '\0';
|
||||
else
|
||||
if ((action = improved_editor_execute(d, str)) == STRINGADD_ACTION)
|
||||
return;
|
||||
|
||||
if (action != STRINGADD_OK)
|
||||
/* Do nothing. */ ;
|
||||
|
|
@ -141,7 +141,7 @@ void string_add(struct descriptor_data *d, char *str)
|
|||
CREATE(*d->str, char, d->max_str);
|
||||
strcpy(*d->str, str); /* strcpy: OK (size checked) */
|
||||
if (!using_improved_editor)
|
||||
action = STRINGADD_SAVE;
|
||||
action = STRINGADD_SAVE;
|
||||
} else {
|
||||
CREATE(*d->str, char, strlen(str) + 3);
|
||||
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 */
|
||||
send_to_char(d->character, "String too long. Last line skipped.\r\n");
|
||||
if (!using_improved_editor)
|
||||
action = STRINGADD_SAVE;
|
||||
action = STRINGADD_SAVE;
|
||||
else if (action == STRINGADD_OK)
|
||||
action = STRINGADD_ACTION; /* No appending \r\n\0, but still let them save. */
|
||||
} else {
|
||||
|
|
@ -256,7 +256,7 @@ void exdesc_string_cleanup(struct descriptor_data *d, int action)
|
|||
{
|
||||
if (action == STRINGADD_ABORT)
|
||||
write_to_output(d, "Description aborted.\r\n");
|
||||
|
||||
|
||||
write_to_output(d, "%s", CONFIG_MENU);
|
||||
STATE(d) = CON_MENU;
|
||||
}
|
||||
|
|
@ -365,25 +365,25 @@ ACMD(do_skillset)
|
|||
char *next_page(char *str, struct char_data *ch)
|
||||
{
|
||||
int col = 1, line = 1;
|
||||
|
||||
|
||||
for (;; str++) {
|
||||
/* If end of string, return NULL. */
|
||||
if (*str == '\0')
|
||||
return (NULL);
|
||||
|
||||
|
||||
/* 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)))
|
||||
return (str);
|
||||
|
||||
|
||||
/* Check for the begining of an ANSI color code block. */
|
||||
else if (*str == '\x1B')
|
||||
str++;
|
||||
|
||||
|
||||
else if (*str == '@') {
|
||||
if (*(str + 1) != '@')
|
||||
str++;
|
||||
}
|
||||
|
||||
|
||||
/* Check for everything else. */
|
||||
else {
|
||||
/* 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. */
|
||||
else if (*str == '\n')
|
||||
line++;
|
||||
|
||||
|
||||
/* 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.
|
||||
*/
|
||||
|
|
|
|||
58
src/oasis.c
58
src/oasis.c
|
|
@ -72,7 +72,7 @@ void clear_screen(struct descriptor_data *d)
|
|||
/*
|
||||
* 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.
|
||||
*
|
||||
* UPDATE:
|
||||
|
|
@ -93,16 +93,16 @@ ACMD(do_oasis)
|
|||
/*
|
||||
* Prevent forcing people in OLC to edit other stuff.
|
||||
* 'force' just lets command_interpreter() handle the input,
|
||||
* regardless of the state of the victim.
|
||||
* This can wreck havoc if people are i OLC already
|
||||
* regardless of the state of the victim.
|
||||
* This can wreck havoc if people are i OLC already
|
||||
* - ie. their input would have been redirected by nanny(), and
|
||||
* never get to command_interpreter().
|
||||
* -- Welcor 09/03
|
||||
* -- Welcor 09/03
|
||||
* - thanks to Mark Garringer (zizazat@hotmail.com) for the bug report.
|
||||
*/
|
||||
if (STATE(ch->desc) != CON_PLAYING)
|
||||
if (STATE(ch->desc) != CON_PLAYING)
|
||||
return;
|
||||
|
||||
|
||||
switch (subcmd) {
|
||||
/*
|
||||
* The command to see what needs to be saved, typically 'olc'.
|
||||
|
|
@ -110,31 +110,31 @@ ACMD(do_oasis)
|
|||
case SCMD_OLC_SAVEINFO:
|
||||
do_show_save_list(ch);
|
||||
break;
|
||||
|
||||
|
||||
case SCMD_OASIS_CEDIT:
|
||||
do_oasis_cedit(ch, argument, cmd, subcmd);
|
||||
break;
|
||||
|
||||
|
||||
case SCMD_OASIS_ZEDIT:
|
||||
do_oasis_zedit(ch, argument, cmd, subcmd);
|
||||
break;
|
||||
|
||||
|
||||
case SCMD_OASIS_REDIT:
|
||||
do_oasis_redit(ch, argument, cmd, subcmd);
|
||||
break;
|
||||
|
||||
|
||||
case SCMD_OASIS_OEDIT:
|
||||
do_oasis_oedit(ch, argument, cmd, subcmd);
|
||||
break;
|
||||
|
||||
|
||||
case SCMD_OASIS_MEDIT:
|
||||
do_oasis_medit(ch, argument, cmd, subcmd);
|
||||
break;
|
||||
|
||||
|
||||
case SCMD_OASIS_SEDIT:
|
||||
do_oasis_sedit(ch, argument, cmd, subcmd);
|
||||
break;
|
||||
|
||||
|
||||
case SCMD_OASIS_RLIST:
|
||||
case SCMD_OASIS_MLIST:
|
||||
case SCMD_OASIS_OLIST:
|
||||
|
|
@ -155,7 +155,7 @@ ACMD(do_oasis)
|
|||
case SCMD_OASIS_AEDIT:
|
||||
do_oasis_aedit(ch, argument, cmd, subcmd);
|
||||
break;
|
||||
|
||||
|
||||
case SCMD_OASIS_HEDIT:
|
||||
do_oasis_hedit(ch, argument, cmd, subcmd);
|
||||
break;
|
||||
|
|
@ -168,12 +168,12 @@ ACMD(do_oasis)
|
|||
}
|
||||
|
||||
/*------------------------------------------------------------*\
|
||||
Exported utilities
|
||||
Exported utilities
|
||||
\*------------------------------------------------------------*/
|
||||
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
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))
|
||||
free_shop(OLC_SHOP(d));
|
||||
|
||||
|
||||
/*. Check for aedit stuff -- M. Scott */
|
||||
if (OLC_ACTION(d)) {
|
||||
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) */
|
||||
/* and Triggers */
|
||||
/*
|
||||
/*
|
||||
* this is the command list - it's been copied to disk already,
|
||||
* so just free it -- Welcor
|
||||
*/
|
||||
if (OLC_STORAGE(d)) {
|
||||
if (OLC_STORAGE(d)) {
|
||||
free(OLC_STORAGE(d));
|
||||
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.
|
||||
* Therefore it should not be free'd here.
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* Restore descriptor playing status.
|
||||
*/
|
||||
if (d->character) {
|
||||
REMOVE_BIT(PLR_FLAGS(d->character), PLR_WRITING);
|
||||
act("$n stops using OLC.", TRUE, d->character, NULL, NULL, TO_ROOM);
|
||||
|
||||
|
||||
if (cleanup_type == CLEANUP_CONFIG)
|
||||
mudlog(BRF, LVL_IMMORT, TRUE, "OLC: %s stops editing the game configuration", GET_NAME(d->character));
|
||||
else if (STATE(d) == CON_TEDIT)
|
||||
|
|
@ -339,22 +339,22 @@ void split_argument(char *argument, char *tag)
|
|||
{
|
||||
char *tmp = argument, *ttag = tag, *wrt = argument;
|
||||
int i;
|
||||
|
||||
|
||||
for (i = 0; *tmp; tmp++, i++) {
|
||||
if (*tmp != ' ' && *tmp != '=')
|
||||
*(ttag++) = *tmp;
|
||||
else if (*tmp == '=')
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
*ttag = '\0';
|
||||
|
||||
|
||||
while (*tmp == '=' || *tmp == ' ')
|
||||
tmp++;
|
||||
|
||||
|
||||
while (*tmp)
|
||||
*(wrt++) = *(tmp++);
|
||||
|
||||
|
||||
*wrt = '\0';
|
||||
}
|
||||
|
||||
|
|
@ -364,7 +364,7 @@ void free_config(struct config_data *data)
|
|||
/** Free strings. **/
|
||||
/****************************************************************************/
|
||||
free_strings(data, OASIS_CFG);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** 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 */
|
||||
if (GET_LEVEL(ch) >= LVL_GRGOD)
|
||||
return (TRUE);
|
||||
|
||||
|
||||
/* always access if a player helped build the zone in the first place */
|
||||
if (is_name(GET_NAME(ch), zone_table[rnum].builders))
|
||||
return (TRUE);
|
||||
|
||||
|
||||
/* no access if you haven't been assigned a zone */
|
||||
if (GET_OLC_ZONE(ch) == NOWHERE) {
|
||||
return FALSE;
|
||||
|
|
|
|||
10
src/oasis.h
10
src/oasis.h
|
|
@ -84,10 +84,10 @@
|
|||
#define MAX_OBJ_RENT 2000000
|
||||
#define MAX_CONTAINER_SIZE 10000
|
||||
|
||||
#define MAX_MOB_GOLD 100000
|
||||
#define MAX_MOB_GOLD 100000
|
||||
#define MAX_MOB_EXP 150000
|
||||
/* 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
|
||||
|
|
@ -144,8 +144,8 @@ struct oasis_olc_data {
|
|||
struct social_messg *action; /* Aedit uses this one */
|
||||
struct trig_data *trig;
|
||||
int script_mode;
|
||||
int trigger_position;
|
||||
int item_type;
|
||||
int trigger_position;
|
||||
int item_type;
|
||||
struct trig_proto_list *script; /* for assigning triggers in [r|o|m]edit*/
|
||||
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_NOTRADE 36
|
||||
|
||||
/*
|
||||
/*
|
||||
* Submodes of CEDIT connectedness.
|
||||
*/
|
||||
#define CEDIT_MAIN_MENU 0
|
||||
|
|
|
|||
|
|
@ -41,11 +41,11 @@ ACMD(do_dig)
|
|||
zone_rnum zone;
|
||||
int dir = 0, rawvnum;
|
||||
struct descriptor_data *d = ch->desc; /* will save us some typing */
|
||||
|
||||
|
||||
/* Grab the room's name (if available). */
|
||||
new_room_name = two_arguments(argument, sdir, sroom);
|
||||
skip_spaces(&new_room_name);
|
||||
|
||||
|
||||
/* Can't dig if we don't know where to go. */
|
||||
if (!*sdir || !*sroom) {
|
||||
send_to_char(ch, "Format: dig <direction> <room> - to create an exit\r\n"
|
||||
|
|
@ -58,7 +58,7 @@ ACMD(do_dig)
|
|||
rvnum = NOWHERE;
|
||||
else
|
||||
rvnum = (room_vnum)rawvnum;
|
||||
rrnum = real_room(rvnum);
|
||||
rrnum = real_room(rvnum);
|
||||
dir = search_block(sdir, dirs, FALSE);
|
||||
zone = world[IN_ROOM(ch)].zone;
|
||||
|
||||
|
|
@ -72,7 +72,7 @@ ACMD(do_dig)
|
|||
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'
|
||||
*/
|
||||
if (rvnum == 0) {
|
||||
|
|
@ -80,9 +80,9 @@ ACMD(do_dig)
|
|||
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)) {
|
||||
/* free the old pointers, if any */
|
||||
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"
|
||||
"No exit removed.\r\n", dirs[dir]);
|
||||
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)) {
|
||||
send_to_char(ch, "There already is an exit to the %s.\r\n", dirs[dir]);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/* 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) {
|
||||
send_to_char(ch, "You cannot link to a non-existing zone!\r\n");
|
||||
return;
|
||||
|
|
@ -118,7 +118,7 @@ ACMD(do_dig)
|
|||
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 (rrnum == NOWHERE) {
|
||||
|
|
@ -134,30 +134,30 @@ ACMD(do_dig)
|
|||
OLC_ZNUM(d) = zone;
|
||||
OLC_NUM(d) = rvnum;
|
||||
CREATE(OLC_ROOM(d), struct room_data, 1);
|
||||
|
||||
|
||||
|
||||
|
||||
/* Copy the room's name. */
|
||||
if (*new_room_name)
|
||||
OLC_ROOM(d)->name = strdup(new_room_name);
|
||||
else
|
||||
OLC_ROOM(d)->name = strdup("An unfinished room");
|
||||
|
||||
|
||||
/* Copy the room's description.*/
|
||||
OLC_ROOM(d)->description = strdup("You are in an unfinished room.\r\n");
|
||||
OLC_ROOM(d)->zone = OLC_ZNUM(d);
|
||||
OLC_ROOM(d)->number = NOWHERE;
|
||||
|
||||
|
||||
/*
|
||||
* Save the new room to memory.
|
||||
* redit_save_internally handles adding the room in the right place, etc.
|
||||
*/
|
||||
redit_save_internally(d);
|
||||
OLC_VAL(d) = 0;
|
||||
|
||||
|
||||
send_to_char(ch, "New room (%d) created.\r\n", rvnum);
|
||||
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);
|
||||
}
|
||||
|
|
@ -170,14 +170,14 @@ ACMD(do_dig)
|
|||
W_EXIT(IN_ROOM(ch), dir)->keyword = NULL;
|
||||
W_EXIT(IN_ROOM(ch), dir)->to_room = rrnum;
|
||||
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);
|
||||
|
||||
/*
|
||||
* 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",
|
||||
rvnum, dirs[rev_dir[dir]]);
|
||||
else {
|
||||
|
|
@ -197,14 +197,14 @@ ACMD(do_room_copy)
|
|||
zone_rnum dst_zone;
|
||||
struct descriptor_data *dsc;
|
||||
char buf[MAX_INPUT_LENGTH];
|
||||
|
||||
|
||||
one_argument(argument, buf);
|
||||
|
||||
|
||||
if (!*buf) {
|
||||
send_to_char(ch, "Usage: rclone <target room>\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (real_room((buf_num = atoi(buf))) != NOWHERE) {
|
||||
send_to_char(ch, "That room already exist!\r\n");
|
||||
return;
|
||||
|
|
@ -214,24 +214,24 @@ ACMD(do_room_copy)
|
|||
send_to_char(ch, "Sorry, there is no zone for that number!\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!can_edit_zone(ch, dst_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");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
room_src = &world[IN_ROOM(ch)];
|
||||
CREATE(room_dst, struct room_data, 1);
|
||||
|
||||
room_dst->zone = dst_zone;
|
||||
|
||||
|
||||
/*
|
||||
* Allocate space for all strings.
|
||||
*/
|
||||
send_to_char(ch, "Cloning room....\r\n");
|
||||
|
||||
|
||||
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);
|
||||
|
|
@ -242,7 +242,7 @@ ACMD(do_room_copy)
|
|||
/*
|
||||
* Extra descriptions, if necessary.
|
||||
*/
|
||||
|
||||
|
||||
send_to_char(ch, "Cloning extra descriptions....\r\n");
|
||||
if (world[IN_ROOM(ch)].ex_description) {
|
||||
struct extra_descr_data *tdesc, *temp, *temp2;
|
||||
|
|
@ -262,9 +262,9 @@ ACMD(do_room_copy)
|
|||
}
|
||||
/*
|
||||
* Now save the room in the right place:
|
||||
*/
|
||||
*/
|
||||
send_to_char(ch, "Saving new room...\r\n");
|
||||
|
||||
|
||||
if ((room_num = add_room(room_dst)) == NOWHERE) {
|
||||
send_to_char(ch, "Something went wrong...\r\n");
|
||||
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 */
|
||||
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_rnum rnum = real_room(vnum);
|
||||
|
||||
if (rnum == NOWHERE)
|
||||
if (rnum == NOWHERE)
|
||||
return NOWHERE;
|
||||
|
||||
for(;;) {
|
||||
|
|
@ -334,7 +334,7 @@ int buildwalk(struct char_data *ch, int dir)
|
|||
|
||||
if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_BUILDWALK) &&
|
||||
GET_LEVEL(ch) >= LVL_BUILDER) {
|
||||
|
||||
|
||||
get_char_colors(ch);
|
||||
|
||||
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_NUM(d) = vnum;
|
||||
CREATE(OLC_ROOM(d), struct room_data, 1);
|
||||
|
||||
|
||||
OLC_ROOM(d)->name = strdup("New BuildWalk Room");
|
||||
|
||||
|
||||
sprintf(buf, "This unfinished room was created by %s.\r\n", GET_NAME(ch));
|
||||
OLC_ROOM(d)->description = strdup(buf);
|
||||
OLC_ROOM(d)->zone = OLC_ZNUM(d);
|
||||
OLC_ROOM(d)->number = NOWHERE;
|
||||
|
||||
|
||||
/*
|
||||
* Save the new room to memory.
|
||||
* redit_save_internally handles adding the room in the right place, etc.
|
||||
*/
|
||||
redit_save_internally(d);
|
||||
OLC_VAL(d) = 0;
|
||||
|
||||
|
||||
/* Link rooms */
|
||||
rnum = real_room(vnum);
|
||||
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 */
|
||||
send_to_char(ch, "%sRoom #%d created by BuildWalk.%s\r\n", yel, vnum, nrm);
|
||||
cleanup_olc(d, CLEANUP_STRUCTS);
|
||||
|
||||
|
||||
return (1);
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,8 +5,8 @@
|
|||
* Copyright 1997-2001 George Greer (greerga@circlemud.org) *
|
||||
* Copyright 2002 Kip Potter [Mythran] (kip_potter@hotmail.com) *
|
||||
************************************************************************/
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
+-----------------------------------------------------------------------+
|
||||
| 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 |
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
| be adding more deletion code after this patch. |
|
||||
| -- Mythran |
|
||||
+-----------------------------------------------------------------------+
|
||||
*/
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
|
@ -48,80 +48,80 @@ int free_strings(void *data, int type)
|
|||
struct room_data *room;
|
||||
struct config_data *config;
|
||||
int i;
|
||||
|
||||
|
||||
switch (type) {
|
||||
case OASIS_WLD:
|
||||
room = (struct room_data *) data;
|
||||
|
||||
|
||||
/* Free Descriptions */
|
||||
if (room->name)
|
||||
free(room->name);
|
||||
|
||||
if (room->description)
|
||||
if (room->description)
|
||||
free(room->description);
|
||||
|
||||
if (room->ex_description)
|
||||
if (room->ex_description)
|
||||
free_ex_descriptions(room->ex_description);
|
||||
|
||||
/* Return the return value of free_strings(). */
|
||||
return (free_strings(room, OASIS_EXI));
|
||||
|
||||
|
||||
case OASIS_EXI:
|
||||
room = (struct room_data *) data;
|
||||
|
||||
|
||||
for (i = 0; i < NUM_OF_DIRS; i++) {
|
||||
if (room->dir_option[i]) {
|
||||
if (room->dir_option[i]->general_description) {
|
||||
free(room->dir_option[i]->general_description);
|
||||
room->dir_option[i]->general_description = NULL;
|
||||
}
|
||||
if (room->dir_option[i]->keyword) {
|
||||
free(room->dir_option[i]->keyword);
|
||||
room->dir_option[i]->keyword = NULL;
|
||||
}
|
||||
if (room->dir_option[i]->general_description) {
|
||||
free(room->dir_option[i]->general_description);
|
||||
room->dir_option[i]->general_description = NULL;
|
||||
}
|
||||
if (room->dir_option[i]->keyword) {
|
||||
free(room->dir_option[i]->keyword);
|
||||
room->dir_option[i]->keyword = NULL;
|
||||
}
|
||||
free(room->dir_option[i]);
|
||||
room->dir_option[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return (TRUE);
|
||||
|
||||
|
||||
case OASIS_MOB:
|
||||
case OASIS_OBJ:
|
||||
return (FALSE); /* For now... */
|
||||
|
||||
|
||||
case OASIS_CFG:
|
||||
config = (struct config_data *) data;
|
||||
|
||||
|
||||
if (config->play.OK)
|
||||
free(config->play.OK);
|
||||
|
||||
|
||||
if (config->play.NOPERSON)
|
||||
free(config->play.NOPERSON);
|
||||
|
||||
|
||||
if (config->play.NOEFFECT)
|
||||
free(config->play.NOEFFECT);
|
||||
|
||||
|
||||
if (config->operation.DFLT_IP)
|
||||
free(config->operation.DFLT_IP);
|
||||
|
||||
|
||||
if (config->operation.DFLT_DIR)
|
||||
free(config->operation.DFLT_DIR);
|
||||
|
||||
|
||||
if (config->operation.LOGNAME)
|
||||
free(config->operation.LOGNAME);
|
||||
|
||||
|
||||
if (config->operation.MENU)
|
||||
free(config->operation.MENU);
|
||||
|
||||
|
||||
if (config->operation.WELC_MESSG)
|
||||
free(config->operation.WELC_MESSG);
|
||||
|
||||
|
||||
if (config->operation.START_MESSG)
|
||||
free(config->operation.START_MESSG);
|
||||
|
||||
|
||||
return (TRUE);
|
||||
|
||||
|
||||
default:
|
||||
mudlog(BRF, LVL_GOD, TRUE, "SYSERR: oasis_delete.c: free_strings: Invalid type handled (Type %d).", type);
|
||||
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 **/
|
||||
/******************************************************************************/
|
||||
ACMD(do_oasis_list)
|
||||
ACMD(do_oasis_list)
|
||||
{
|
||||
zone_rnum rzone = NOWHERE;
|
||||
room_rnum vmin = NOWHERE;
|
||||
|
|
@ -41,13 +41,13 @@ ACMD(do_oasis_list)
|
|||
char smin[MAX_INPUT_LENGTH];
|
||||
char smax[MAX_INPUT_LENGTH];
|
||||
|
||||
two_arguments(argument, smin, smax);
|
||||
two_arguments(argument, smin, smax);
|
||||
|
||||
if (!*smin || *smin == '.') {
|
||||
rzone = world[IN_ROOM(ch)].zone;
|
||||
} else if (!*smax) {
|
||||
rzone = real_zone(atoi(smin));
|
||||
|
||||
|
||||
if (rzone == NOWHERE) {
|
||||
send_to_char(ch, "Sorry, there's no zone with that number\r\n");
|
||||
return;
|
||||
|
|
@ -56,13 +56,13 @@ ACMD(do_oasis_list)
|
|||
/** Listing by min vnum / max vnum. Retrieve the numeric values. **/
|
||||
vmin = atoi(smin);
|
||||
vmax = atoi(smax);
|
||||
|
||||
|
||||
if (vmin > vmax) {
|
||||
send_to_char(ch, "List from %d to %d - Aren't we funny today!\r\n", vmin, vmax);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
switch (subcmd) {
|
||||
case SCMD_OASIS_MLIST: list_mobiles(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_SLIST: list_shops(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");
|
||||
mudlog(BRF, LVL_IMMORT, TRUE,
|
||||
mudlog(BRF, LVL_IMMORT, TRUE,
|
||||
"SYSERR: do_oasis_list: Unknown list option: %d", subcmd);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ACMD(do_oasis_links)
|
||||
|
|
@ -89,13 +89,13 @@ ACMD(do_oasis_links)
|
|||
|
||||
skip_spaces(&argument);
|
||||
one_argument(argument, arg);
|
||||
|
||||
|
||||
if (!arg || !*arg) {
|
||||
send_to_char(ch,
|
||||
"Syntax: links <zone_vnum> ('.' for zone you are standing in)\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (!strcmp(arg, ".")) {
|
||||
zrnum = world[IN_ROOM(ch)].zone;
|
||||
zvnum = zone_table[zrnum].number;
|
||||
|
|
@ -103,7 +103,7 @@ ACMD(do_oasis_links)
|
|||
zvnum = atoi(arg);
|
||||
zrnum = real_zone(zvnum);
|
||||
}
|
||||
|
||||
|
||||
if (zrnum == NOWHERE || zvnum == NOWHERE) {
|
||||
send_to_char(ch, "No zone was found with that number.\n\r");
|
||||
return;
|
||||
|
|
@ -120,7 +120,7 @@ ACMD(do_oasis_links)
|
|||
to_room = world[nr].dir_option[j]->to_room;
|
||||
if (to_room != NOWHERE && (zrnum != world[to_room].zone))
|
||||
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,
|
||||
GET_ROOM_VNUM(nr), dirs[j], world[to_room].number);
|
||||
}
|
||||
|
|
@ -134,8 +134,8 @@ ACMD(do_oasis_links)
|
|||
/** 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)
|
||||
{
|
||||
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;
|
||||
|
||||
/*
|
||||
* 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) {
|
||||
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;
|
||||
top = vmax;
|
||||
}
|
||||
|
||||
|
||||
send_to_char (ch,
|
||||
"Index VNum Room Name Exits\r\n"
|
||||
"----- ------- ---------------------------------------- -----\r\n");
|
||||
|
||||
|
||||
for (i = 0; i <= top_of_world; i++) {
|
||||
|
||||
|
||||
/** Check to see if this room is one of the ones needed to be listed. **/
|
||||
if ((world[i].number >= bottom) && (world[i].number <= top)) {
|
||||
counter++;
|
||||
|
||||
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,
|
||||
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;
|
||||
if (W_EXIT(i, j)->to_room == NOWHERE)
|
||||
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, "\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (counter == 0)
|
||||
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)
|
||||
{
|
||||
mob_rnum i;
|
||||
mob_vnum bottom, top;
|
||||
int counter = 0;
|
||||
|
||||
|
||||
if (rnum != NOWHERE) {
|
||||
bottom = zone_table[rnum].bot;
|
||||
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;
|
||||
top = vmax;
|
||||
}
|
||||
|
||||
|
||||
send_to_char(ch,
|
||||
"Index VNum Mobile Name Level\r\n"
|
||||
"----- ------- --------------------------------------------- -----\r\n");
|
||||
|
||||
|
||||
for (i = 0; i <= top_of_mobt; i++) {
|
||||
if (mob_index[i].vnum >= bottom && mob_index[i].vnum <= top) {
|
||||
counter++;
|
||||
|
||||
|
||||
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,
|
||||
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,
|
||||
mob_proto[i].proto_script ? " [TRIG]" : ""
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (counter == 0)
|
||||
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)
|
||||
{
|
||||
obj_rnum i;
|
||||
obj_vnum bottom, top;
|
||||
int counter = 0;
|
||||
|
||||
|
||||
if (rnum != NOWHERE) {
|
||||
bottom = zone_table[rnum].bot;
|
||||
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;
|
||||
top = vmax;
|
||||
}
|
||||
|
||||
|
||||
send_to_char(ch,
|
||||
"Index VNum Object Name Object Type\r\n"
|
||||
"----- ------- -------------------------------------------- ----------------\r\n");
|
||||
|
||||
|
||||
for (i = 0; i <= top_of_objt; i++) {
|
||||
if (obj_index[i].vnum >= bottom && obj_index[i].vnum <= top) {
|
||||
counter++;
|
||||
|
||||
|
||||
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,
|
||||
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,
|
||||
obj_proto[i].proto_script ? " [TRIG]" : ""
|
||||
);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (counter == 0)
|
||||
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)
|
||||
{
|
||||
shop_rnum i;
|
||||
shop_vnum bottom, top;
|
||||
int j, counter = 0;
|
||||
|
||||
|
||||
if (rnum != NOWHERE) {
|
||||
bottom = zone_table[rnum].bot;
|
||||
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;
|
||||
top = vmax;
|
||||
}
|
||||
|
||||
|
||||
send_to_char (ch,
|
||||
"Index VNum RNum Shop Room(s)\r\n"
|
||||
"----- ------- ------- -----------------------------------------\r\n");
|
||||
|
||||
|
||||
for (i = 0; i <= top_shop; i++) {
|
||||
if (SHOP_NUM(i) >= bottom && SHOP_NUM(i) <= top) {
|
||||
counter++;
|
||||
|
||||
|
||||
/* 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]",
|
||||
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++)
|
||||
send_to_char(ch, "%s%s[%s%-5d%s]%s",
|
||||
((j > 0) && (j % 6 == 0)) ? "\r\n " : " ",
|
||||
QCYN, QYEL, SHOP_ROOM(i, j), QCYN, QNRM);
|
||||
|
||||
|
||||
if (j == 0)
|
||||
send_to_char(ch, "%sNone.%s", QCYN, QNRM);
|
||||
|
||||
|
||||
send_to_char(ch, "\r\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (counter == 0)
|
||||
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)
|
||||
{
|
||||
int counter = 0;
|
||||
zone_rnum i;
|
||||
zone_vnum bottom, top;
|
||||
|
||||
|
||||
if (rnum != NOWHERE) {
|
||||
/* Only one parameter was supplied - just list that zone */
|
||||
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;
|
||||
top = vmax;
|
||||
}
|
||||
|
||||
|
||||
send_to_char(ch,
|
||||
"VNum Zone Name Builder(s)\r\n"
|
||||
"----- ------------------------------ --------------------------------------\r\n");
|
||||
|
||||
|
||||
for (i = 0; i <= top_of_zone_table; i++) {
|
||||
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",
|
||||
|
|
@ -341,7 +341,7 @@ void list_zones(struct char_data *ch, zone_rnum rnum, zone_vnum vmin, zone_vnum
|
|||
counter++;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (!counter)
|
||||
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;
|
||||
else
|
||||
largest_table = top_of_mobt;
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Initialize some of the variables. **/
|
||||
/****************************************************************************/
|
||||
|
|
@ -384,21 +384,21 @@ void print_zone(struct char_data *ch, zone_vnum vnum)
|
|||
size_mobiles = 0;
|
||||
top = zone_table[rnum].top;
|
||||
bottom = zone_table[rnum].bot;
|
||||
|
||||
|
||||
for (i = 0; i <= largest_table; i++) {
|
||||
if (i <= top_of_world)
|
||||
if (world[i].zone == rnum)
|
||||
size_rooms++;
|
||||
|
||||
|
||||
if (i <= top_of_objt)
|
||||
if (obj_index[i].vnum >= bottom && obj_index[i].vnum <= top)
|
||||
size_objects++;
|
||||
|
||||
|
||||
if (i <= top_of_mobt)
|
||||
if (mob_index[i].vnum >= bottom && mob_index[i].vnum <= top)
|
||||
size_mobiles++;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** 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].lifespan,
|
||||
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].reset_mode ? ((zone_table[rnum].reset_mode == 1) ?
|
||||
"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 *
|
||||
* Usage: loading/saving player objects for rent and crash-save *
|
||||
* *
|
||||
* *
|
||||
* 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. *
|
||||
************************************************************************ */
|
||||
|
||||
|
|
@ -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()
|
||||
*/
|
||||
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) {
|
||||
/* To be reimplemented. Need to handle this case in loading as
|
||||
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) {
|
||||
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)))
|
||||
return FALSE;
|
||||
|
||||
|
||||
if (!(fl = fopen(fname, "r"))) {
|
||||
if (errno != ENOENT) /* if it fails, NOT because of no file */
|
||||
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)
|
||||
return FALSE;
|
||||
sscanf(line,"%d ",&rentcode);
|
||||
|
||||
|
||||
if (rentcode == RENT_CRASH)
|
||||
Crash_delete_file(GET_NAME(ch));
|
||||
|
||||
|
|
@ -389,12 +389,12 @@ int Crash_clean_file(char *name)
|
|||
fclose(fl);
|
||||
if (numread == FALSE)
|
||||
return FALSE;
|
||||
|
||||
|
||||
sscanf(line, "%d %d %d %d %d %d",&rentcode,&timed,&netcost,
|
||||
&gold,&account,&nitems);
|
||||
|
||||
if ((rentcode == RENT_CRASH) ||
|
||||
(rentcode == RENT_FORCED) ||
|
||||
(rentcode == RENT_FORCED) ||
|
||||
(rentcode == RENT_TIMEDOUT) ) {
|
||||
if (timed < time(0) - (crash_file_timeout * SECS_PER_REAL_DAY)) {
|
||||
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];
|
||||
obj_save_data *loaded, *current;
|
||||
int rentcode,timed,netcost,gold,account,nitems, numread, len;
|
||||
|
||||
|
||||
if (!get_filename(fname, sizeof(fname), CRASH_FILE, name))
|
||||
return;
|
||||
|
||||
|
||||
if (!(fl = fopen(fname, "r"))) {
|
||||
send_to_char(ch, "%s has no rent file.\r\n", name);
|
||||
return;
|
||||
}
|
||||
len = snprintf(buf, sizeof(buf),"%s\r\n", fname);
|
||||
|
||||
|
||||
numread = get_line(fl, line);
|
||||
|
||||
/* Oops, can't get the data, punt. */
|
||||
|
|
@ -460,7 +460,7 @@ void Crash_listrent(struct char_data *ch, char *name)
|
|||
fclose(fl);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
sscanf(line,"%d %d %d %d %d %d",
|
||||
&rentcode,&timed,&netcost,&gold,&account,&nitems);
|
||||
|
||||
|
|
@ -484,14 +484,14 @@ void Crash_listrent(struct char_data *ch, char *name)
|
|||
}
|
||||
|
||||
loaded = objsave_parse_objects(fl);
|
||||
|
||||
|
||||
for (current = loaded; current != NULL; current=current->next)
|
||||
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),
|
||||
current->obj->short_description);
|
||||
|
||||
/*
|
||||
|
||||
/*
|
||||
* now it's safe to free the obj_save_data list and the objects on it.
|
||||
*/
|
||||
while (loaded != NULL) {
|
||||
|
|
@ -560,7 +560,7 @@ void Crash_extract_norent_eq(struct char_data *ch)
|
|||
for (j = 0; j < NUM_WEARS; j++) {
|
||||
if (GET_EQ(ch, j) == NULL)
|
||||
continue;
|
||||
|
||||
|
||||
if (Crash_is_unrentable(GET_EQ(ch, j)))
|
||||
obj_to_char(unequip_char(ch, j), ch);
|
||||
else
|
||||
|
|
@ -640,7 +640,7 @@ void Crash_crashsave(struct char_data *ch)
|
|||
|
||||
if (!get_filename(buf, sizeof(buf), CRASH_FILE, GET_NAME(ch)))
|
||||
return;
|
||||
|
||||
|
||||
if (!(fp = fopen(buf, "w")))
|
||||
return;
|
||||
|
||||
|
|
@ -680,7 +680,7 @@ void Crash_idlesave(struct char_data *ch)
|
|||
|
||||
if (!get_filename(buf, sizeof(buf), CRASH_FILE, GET_NAME(ch)))
|
||||
return;
|
||||
|
||||
|
||||
if (!(fp = fopen(buf, "w")))
|
||||
return;
|
||||
|
||||
|
|
@ -721,7 +721,7 @@ void Crash_idlesave(struct char_data *ch)
|
|||
|
||||
if (!objsave_write_rentcode(fp, RENT_TIMEDOUT, cost, ch))
|
||||
return;
|
||||
|
||||
|
||||
for (j = 0; j < NUM_WEARS; j++) {
|
||||
if (GET_EQ(ch, j)) {
|
||||
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)))
|
||||
return;
|
||||
|
||||
|
||||
if (!(fp = fopen(buf, "w")))
|
||||
return;
|
||||
|
||||
|
|
@ -799,7 +799,7 @@ int objsave_write_rentcode(FILE *fl, int rentcode, int cost_per_day, struct char
|
|||
return FALSE;
|
||||
}
|
||||
return TRUE;
|
||||
|
||||
|
||||
}
|
||||
|
||||
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)))
|
||||
return;
|
||||
|
||||
|
||||
if (!(fp = fopen(buf, "w")))
|
||||
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,
|
||||
|
|
@ -855,13 +855,13 @@ void Crash_rent_deadline(struct char_data *ch, struct char_data *recep,
|
|||
{
|
||||
long rent_deadline;
|
||||
char buf[MAX_STRING_LENGTH];
|
||||
|
||||
|
||||
if (!cost)
|
||||
return;
|
||||
|
||||
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"
|
||||
"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);
|
||||
}
|
||||
|
||||
|
|
@ -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,
|
||||
struct obj_data *obj, long *cost, long *nitems,
|
||||
struct obj_data *obj, long *cost, long *nitems,
|
||||
int display, int factor)
|
||||
{
|
||||
static char buf[256];
|
||||
|
|
@ -1078,14 +1078,14 @@ obj_save_data *objsave_parse_objects(FILE *fl)
|
|||
CREATE(current, obj_save_data, 1);
|
||||
head = current;
|
||||
current->locate = 0;
|
||||
|
||||
|
||||
temp = NULL;
|
||||
while (TRUE) {
|
||||
char tag[6];
|
||||
int num;
|
||||
|
||||
|
||||
/* 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)
|
||||
{
|
||||
|
|
@ -1102,7 +1102,7 @@ obj_save_data *objsave_parse_objects(FILE *fl)
|
|||
{
|
||||
if (t->next == current)
|
||||
t->next = NULL;
|
||||
|
||||
|
||||
t = t->next;
|
||||
}
|
||||
free(current);
|
||||
|
|
@ -1111,26 +1111,26 @@ obj_save_data *objsave_parse_objects(FILE *fl)
|
|||
else if (temp != NULL && current->obj == NULL)
|
||||
{
|
||||
current->obj = temp;
|
||||
}
|
||||
}
|
||||
else if (temp == NULL && current->obj != NULL)
|
||||
{
|
||||
// do nothing
|
||||
}
|
||||
}
|
||||
else if (temp != NULL && current->obj != NULL)
|
||||
{
|
||||
if (temp != current->obj)
|
||||
log("inconsistent object pointers in objsave_parse_objects: %p/%p", temp, current->obj);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
/* if it's a new record, wrap up the old one, and make space for a new one */
|
||||
if (*line == '#') {
|
||||
/* check for false alarm. */
|
||||
if (sscanf(line, "#%d", &nr) == 1)
|
||||
if (sscanf(line, "#%d", &nr) == 1)
|
||||
{
|
||||
if (temp)
|
||||
if (temp)
|
||||
{
|
||||
current->obj = temp;
|
||||
CREATE(current->next, obj_save_data, 1);
|
||||
|
|
@ -1151,12 +1151,12 @@ obj_save_data *objsave_parse_objects(FILE *fl)
|
|||
} else {
|
||||
if(real_object(nr) != NOTHING) {
|
||||
temp=read_object(nr,VIRTUAL);
|
||||
// go read next line - nothing more to see here
|
||||
// go read next line - nothing more to see here
|
||||
} else {
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -1189,7 +1189,7 @@ obj_save_data *objsave_parse_objects(FILE *fl)
|
|||
if(!strcmp(tag, "EDes")) {
|
||||
struct extra_descr_data *new_desc;
|
||||
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 */
|
||||
temp->ex_description && /* with ex_desc == prototype */
|
||||
(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:
|
||||
log("Unknown tag in rentfile: %s", tag);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
return head;
|
||||
}
|
||||
|
||||
|
|
@ -1289,7 +1289,7 @@ int Crash_load_objs(struct char_data *ch) {
|
|||
cost = (int) (netcost * num_of_days);
|
||||
if (cost > GET_GOLD(ch) + GET_BANK_GOLD(ch)) {
|
||||
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));
|
||||
Crash_crashsave(ch);
|
||||
return 2;
|
||||
|
|
@ -1301,7 +1301,7 @@ int Crash_load_objs(struct char_data *ch) {
|
|||
}
|
||||
switch (orig_rent_code = rentcode) {
|
||||
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));
|
||||
break;
|
||||
case RENT_CRASH:
|
||||
|
|
@ -1327,9 +1327,9 @@ int Crash_load_objs(struct char_data *ch) {
|
|||
loaded = objsave_parse_objects(fl);
|
||||
for (current = loaded; current != NULL; current=current->next)
|
||||
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()
|
||||
*/
|
||||
while (loaded != NULL) {
|
||||
|
|
@ -1337,9 +1337,9 @@ int Crash_load_objs(struct char_data *ch) {
|
|||
loaded = loaded->next;
|
||||
free(current);
|
||||
}
|
||||
|
||||
|
||||
/* 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);
|
||||
|
||||
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);
|
||||
|
||||
/*
|
||||
/*
|
||||
what to do with a new loaded item:
|
||||
|
||||
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) {
|
||||
obj1 = cont_row[j]->next_content;
|
||||
obj_to_char(cont_row[j], ch);
|
||||
}
|
||||
}
|
||||
cont_row[j] = NULL;
|
||||
}
|
||||
|
||||
|
|
|
|||
130
src/oedit.c
130
src/oedit.c
|
|
@ -64,12 +64,12 @@ ACMD(do_oasis_oedit)
|
|||
char *buf3;
|
||||
char buf1[MAX_STRING_LENGTH];
|
||||
char buf2[MAX_STRING_LENGTH];
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Parse any arguments. **/
|
||||
/****************************************************************************/
|
||||
buf3 = two_arguments(argument, buf1, buf2);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** If there aren't any arguments...well...they can't modify nothing now **/
|
||||
/** can they? **/
|
||||
|
|
@ -82,32 +82,32 @@ ACMD(do_oasis_oedit)
|
|||
send_to_char(ch, "Yikes! Stop that, someone will get hurt!\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
save = TRUE;
|
||||
|
||||
|
||||
if (is_number(buf2))
|
||||
number = atoi(buf2);
|
||||
else if (GET_OLC_ZONE(ch) > 0) {
|
||||
zone_rnum zlok;
|
||||
|
||||
|
||||
if ((zlok = real_zone(GET_OLC_ZONE(ch))) == NOWHERE)
|
||||
number = NOWHERE;
|
||||
else
|
||||
number = genolc_zone_bottom(zlok);
|
||||
}
|
||||
|
||||
|
||||
if (number == NOWHERE) {
|
||||
send_to_char(ch, "Save which zone?\r\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** If a numeric argument was given, get it. **/
|
||||
/****************************************************************************/
|
||||
if (number == NOWHERE)
|
||||
number = atoi(buf1);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** 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). **/
|
||||
/****************************************************************************/
|
||||
d = ch->desc;
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Give the descriptor an OLC structure. **/
|
||||
/****************************************************************************/
|
||||
|
|
@ -134,16 +134,16 @@ ACMD(do_oasis_oedit)
|
|||
"SYSERR: do_oasis: Player already had olc structure.");
|
||||
free(d->olc);
|
||||
}
|
||||
|
||||
|
||||
CREATE(d->olc, struct oasis_olc_data, 1);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Find the zone. **/
|
||||
/****************************************************************************/
|
||||
OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number);
|
||||
if (OLC_ZNUM(d) == NOWHERE) {
|
||||
send_to_char(ch, "Sorry, there is no zone for that number!\r\n");
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/** Free the descriptor's OLC structure. **/
|
||||
/**************************************************************************/
|
||||
|
|
@ -151,7 +151,7 @@ ACMD(do_oasis_oedit)
|
|||
d->olc = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** 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));
|
||||
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));
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/** 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;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** 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,
|
||||
"OLC: %s saves object info for zone %d.", GET_NAME(ch),
|
||||
zone_table[OLC_ZNUM(d)].number);
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/** Save the objects in this zone. **/
|
||||
/**************************************************************************/
|
||||
save_objects(OLC_ZNUM(d));
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/** 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;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
OLC_NUM(d) = number;
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** If this is a new object, setup a new object, otherwise setup the **/
|
||||
/** 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);
|
||||
else
|
||||
oedit_setup_new(d);
|
||||
|
||||
|
||||
STATE(d) = CON_OEDIT;
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** 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);
|
||||
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Log the OLC message. **/
|
||||
/****************************************************************************/
|
||||
|
|
@ -272,7 +272,7 @@ void oedit_save_internally(struct descriptor_data *d)
|
|||
obj_rnum robj_num;
|
||||
struct descriptor_data *dsc;
|
||||
struct obj_data *obj;
|
||||
|
||||
|
||||
i = (real_object(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 : */
|
||||
/* Free old proto list */
|
||||
if (obj_proto[robj_num].proto_script &&
|
||||
obj_proto[robj_num].proto_script != OLC_SCRIPT(d))
|
||||
free_proto_script(&obj_proto[robj_num], OBJ_TRIGGER);
|
||||
obj_proto[robj_num].proto_script != OLC_SCRIPT(d))
|
||||
free_proto_script(&obj_proto[robj_num], OBJ_TRIGGER);
|
||||
/* this will handle new instances of the object: */
|
||||
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)
|
||||
continue;
|
||||
/* remove any old scripts */
|
||||
if (SCRIPT(obj))
|
||||
if (SCRIPT(obj))
|
||||
extract_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);
|
||||
}
|
||||
/* end trigger update */
|
||||
|
||||
|
||||
if (!i) /* If it's not a new object, don't renumber. */
|
||||
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);
|
||||
|
||||
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"
|
||||
"%s2%s) PICKPROOF\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))) {
|
||||
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);
|
||||
break;
|
||||
|
|
@ -811,7 +811,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
|||
case 'y':
|
||||
case 'Y':
|
||||
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));
|
||||
if (CONFIG_OLC_SAVE) {
|
||||
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);
|
||||
return;
|
||||
case 'a': /* abort quit */
|
||||
case 'A':
|
||||
case 'A':
|
||||
oedit_disp_menu(d);
|
||||
return;
|
||||
default:
|
||||
|
|
@ -903,7 +903,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
|||
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), 1) = 0;
|
||||
|
|
@ -943,17 +943,17 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
|||
OLC_SCRIPT_EDIT_MODE(d) = SCRIPT_MAIN_MENU;
|
||||
dg_script_menu(d);
|
||||
return;
|
||||
case 'x':
|
||||
case 'X':
|
||||
write_to_output(d, "Are you sure you want to delete this object? ");
|
||||
OLC_MODE(d) = OEDIT_DELETE;
|
||||
case 'x':
|
||||
case 'X':
|
||||
write_to_output(d, "Are you sure you want to delete this object? ");
|
||||
OLC_MODE(d) = OEDIT_DELETE;
|
||||
break;
|
||||
default:
|
||||
oedit_disp_menu(d);
|
||||
break;
|
||||
}
|
||||
return; /*
|
||||
* end of OEDIT_MAIN_MENU
|
||||
* end of OEDIT_MAIN_MENU
|
||||
*/
|
||||
|
||||
case OLC_SCRIPT_EDIT:
|
||||
|
|
@ -992,8 +992,8 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
|||
} else
|
||||
GET_OBJ_TYPE(OLC_OBJ(d)) = number;
|
||||
/* 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), 2) = GET_OBJ_VAL(OLC_OBJ(d), 3) = 0;
|
||||
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;
|
||||
break;
|
||||
|
||||
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));
|
||||
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");
|
||||
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);
|
||||
return;
|
||||
|
|
@ -1058,20 +1058,20 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
|||
case OEDIT_VALUE_1:
|
||||
/*
|
||||
* 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))) {
|
||||
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;
|
||||
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;
|
||||
default:
|
||||
GET_OBJ_VAL(OLC_OBJ(d), 0) = atoi(arg);
|
||||
}
|
||||
/*
|
||||
* proceed to menu 2
|
||||
* proceed to menu 2
|
||||
*/
|
||||
oedit_disp_val2_menu(d);
|
||||
return;
|
||||
|
|
@ -1085,9 +1085,9 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
|||
case ITEM_POTION:
|
||||
if (number == 0 || number == -1)
|
||||
GET_OBJ_VAL(OLC_OBJ(d), 1) = -1;
|
||||
else
|
||||
else
|
||||
GET_OBJ_VAL(OLC_OBJ(d), 1) = LIMIT(number, 1, NUM_SPELLS-1);
|
||||
|
||||
|
||||
oedit_disp_val3_menu(d);
|
||||
break;
|
||||
case ITEM_CONTAINER:
|
||||
|
|
@ -1105,7 +1105,7 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
|||
oedit_disp_val3_menu(d);
|
||||
break;
|
||||
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);
|
||||
break;
|
||||
|
||||
|
|
@ -1244,14 +1244,14 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
|||
case 0:
|
||||
if (!OLC_DESC(d)->keyword || !OLC_DESC(d)->description) {
|
||||
struct extra_descr_data *temp;
|
||||
|
||||
|
||||
if (OLC_DESC(d)->keyword)
|
||||
free(OLC_DESC(d)->keyword);
|
||||
if (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);
|
||||
free(OLC_DESC(d));
|
||||
|
|
@ -1299,19 +1299,19 @@ void oedit_parse(struct descriptor_data *d, char *arg)
|
|||
return;
|
||||
}
|
||||
break;
|
||||
case OEDIT_DELETE:
|
||||
if (*arg == 'y' || *arg == 'Y') {
|
||||
if (delete_object(GET_OBJ_RNUM(OLC_OBJ(d))))
|
||||
write_to_output(d, "Object deleted.\r\n");
|
||||
else
|
||||
write_to_output(d, "Couldn't delete the object!\r\n");
|
||||
|
||||
cleanup_olc(d, CLEANUP_ALL);
|
||||
} else if (*arg == 'n' || *arg == 'N') {
|
||||
oedit_disp_menu(d);
|
||||
OLC_MODE(d) = OEDIT_MAIN_MENU;
|
||||
} else
|
||||
write_to_output(d, "Please answer 'Y' or 'N': ");
|
||||
case OEDIT_DELETE:
|
||||
if (*arg == 'y' || *arg == 'Y') {
|
||||
if (delete_object(GET_OBJ_RNUM(OLC_OBJ(d))))
|
||||
write_to_output(d, "Object deleted.\r\n");
|
||||
else
|
||||
write_to_output(d, "Couldn't delete the object!\r\n");
|
||||
|
||||
cleanup_olc(d, CLEANUP_ALL);
|
||||
} else if (*arg == 'n' || *arg == 'N') {
|
||||
oedit_disp_menu(d);
|
||||
OLC_MODE(d) = OEDIT_MAIN_MENU;
|
||||
} else
|
||||
write_to_output(d, "Please answer 'Y' or 'N': ");
|
||||
return;
|
||||
default:
|
||||
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;
|
||||
oedit_disp_menu(d);
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@
|
|||
#define PFDEF_HUNGER 0
|
||||
#define PFDEF_THIRST 0
|
||||
#define PFDEF_DRUNK 0
|
||||
#define PFDEF_OLC 65535
|
||||
#define PFDEF_OLC 65535
|
||||
#define PFDEF_PAGELENGTH 22
|
||||
|
||||
#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
|
||||
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
|
||||
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_PAGE_LENGTH(ch) = PFDEF_PAGELENGTH;
|
||||
GET_ALIASES(ch) = NULL;
|
||||
|
||||
|
||||
while (get_line(fl, line)) {
|
||||
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 (POOFOUT(ch)) fprintf(fl, "PfOt: %s\n", POOFOUT(ch));
|
||||
#endif
|
||||
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_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_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));
|
||||
|
||||
|
|
@ -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_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_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);
|
||||
save_char_vars_ascii(fl, ch);
|
||||
|
||||
|
||||
fclose(fl);
|
||||
|
||||
/* more char_to_store code to restore affects */
|
||||
|
|
@ -651,7 +651,7 @@ void save_char(struct char_data * ch)
|
|||
}
|
||||
|
||||
/* end char_to_store code */
|
||||
|
||||
|
||||
if ((id = get_ptable_by_name(GET_NAME(ch))) < 0)
|
||||
return;
|
||||
|
||||
|
|
@ -692,7 +692,7 @@ void tag_argument(char *argument, char *tag)
|
|||
for (i = 0; i < 4; i++)
|
||||
*(ttag++) = *(tmp++);
|
||||
*ttag = '\0';
|
||||
|
||||
|
||||
while (*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
|
||||
* self-deleted, deleted by an immortal, or deleted by the auto-wipe
|
||||
* system (if enabled).
|
||||
*/
|
||||
*/
|
||||
void remove_player(int pfilepos)
|
||||
{
|
||||
char fname[40];
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ unsigned long circle_random(void);
|
|||
|
||||
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];
|
||||
int number = NOWHERE, save = 0, real_num;
|
||||
struct descriptor_data *d;
|
||||
|
||||
|
||||
/* Parse any arguments. */
|
||||
buf3 = two_arguments(argument, buf1, buf2);
|
||||
|
||||
|
||||
if (!*buf1)
|
||||
number = GET_ROOM_VNUM(IN_ROOM(ch));
|
||||
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");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
save = TRUE;
|
||||
|
||||
|
||||
if (is_number(buf2))
|
||||
number = atoi(buf2);
|
||||
else if (GET_OLC_ZONE(ch) != NOWHERE) {
|
||||
zone_rnum zlok;
|
||||
|
||||
|
||||
if ((zlok = real_zone(GET_OLC_ZONE(ch))) == NOWHERE)
|
||||
number = NOWHERE;
|
||||
else
|
||||
number = genolc_zone_bottom(zlok);
|
||||
}
|
||||
|
||||
|
||||
if (number == NOWHERE) {
|
||||
send_to_char(ch, "Save which zone?\r\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* If a numeric argument was given (like a room number), get it.
|
||||
*/
|
||||
if (number == NOWHERE)
|
||||
number = atoi(buf1);
|
||||
|
||||
|
||||
/* Check to make sure the room isn't already being edited. */
|
||||
for (d = descriptor_list; d; d = d->next) {
|
||||
if (STATE(d) == CON_REDIT) {
|
||||
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));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/* Retrieve the player's descriptor. */
|
||||
d = ch->desc;
|
||||
|
||||
|
||||
/* Give the descriptor an OLC structure. */
|
||||
if (d->olc) {
|
||||
mudlog(BRF, LVL_IMMORT, TRUE, "SYSERR: do_oasis_redit: Player already had olc structure.");
|
||||
free(d->olc);
|
||||
}
|
||||
|
||||
|
||||
/* Create the OLC structure. */
|
||||
CREATE(d->olc, struct oasis_olc_data, 1);
|
||||
|
||||
|
||||
/* Find the zone. */
|
||||
OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number);
|
||||
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));
|
||||
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));
|
||||
|
||||
|
||||
free(d->olc);
|
||||
d->olc = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (save) {
|
||||
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);
|
||||
|
||||
|
||||
/* Save the rooms. */
|
||||
save_rooms(OLC_ZNUM(d));
|
||||
|
||||
|
||||
/* Free the olc data from the descriptor. */
|
||||
free(d->olc);
|
||||
d->olc = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
OLC_NUM(d) = number;
|
||||
|
||||
|
||||
if ((real_num = real_room(number)) != NOWHERE)
|
||||
redit_setup_existing(d, real_num);
|
||||
else
|
||||
redit_setup_new(d);
|
||||
|
||||
|
||||
STATE(d) = CON_REDIT;
|
||||
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
||||
|
||||
|
||||
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));
|
||||
}
|
||||
|
|
@ -183,7 +183,7 @@ void redit_setup_existing(struct descriptor_data *d, int real_num)
|
|||
*/
|
||||
room->name = str_udup(world[real_num].name);
|
||||
room->description = str_udup(world[real_num].description);
|
||||
|
||||
|
||||
/*
|
||||
* 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);
|
||||
room->proto_script = NULL;
|
||||
SCRIPT(room) = NULL;
|
||||
SCRIPT(room) = NULL;
|
||||
|
||||
redit_disp_menu(d);
|
||||
}
|
||||
|
|
@ -259,15 +259,15 @@ void redit_save_internally(struct descriptor_data *d)
|
|||
return;
|
||||
}
|
||||
|
||||
/* Update triggers */
|
||||
/* Update triggers */
|
||||
/* Free old proto list */
|
||||
if (world[room_num].proto_script &&
|
||||
world[room_num].proto_script != OLC_SCRIPT(d))
|
||||
free_proto_script(&world[room_num], WLD_TRIGGER);
|
||||
|
||||
world[room_num].proto_script != OLC_SCRIPT(d))
|
||||
free_proto_script(&world[room_num], WLD_TRIGGER);
|
||||
|
||||
world[room_num].proto_script = OLC_SCRIPT(d);
|
||||
assign_triggers(&world[room_num], WLD_TRIGGER);
|
||||
/* end trigger update */
|
||||
/* end trigger update */
|
||||
|
||||
/* Don't adjust numbers on a room update. */
|
||||
if (!new_room)
|
||||
|
|
@ -316,17 +316,17 @@ void free_room(struct room_data *room)
|
|||
{
|
||||
/* Free the strings (Mythran). */
|
||||
free_room_strings(room);
|
||||
|
||||
|
||||
if (SCRIPT(room))
|
||||
extract_script(room, WLD_TRIGGER);
|
||||
free_proto_script(room, WLD_TRIGGER);
|
||||
|
||||
free_proto_script(room, WLD_TRIGGER);
|
||||
|
||||
/* Free the room. */
|
||||
free(room); /* XXX ? */
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
Menu functions
|
||||
Menu functions
|
||||
**************************************************************************/
|
||||
|
||||
/*
|
||||
|
|
@ -359,14 +359,14 @@ void redit_disp_exit_menu(struct descriptor_data *d)
|
|||
{
|
||||
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) {
|
||||
CREATE(OLC_EXIT(d), struct room_direction_data, 1);
|
||||
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_PICKPROOF))
|
||||
|
|
@ -497,7 +497,7 @@ void redit_disp_menu(struct descriptor_data *d)
|
|||
room->dir_option[WEST] && room->dir_option[WEST]->to_room != NOWHERE ?
|
||||
world[room->dir_option[WEST]->to_room].number : -1,
|
||||
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,
|
||||
grn, nrm, cyn,
|
||||
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
|
||||
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);
|
||||
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? ");
|
||||
OLC_MODE(d) = REDIT_DELETE;
|
||||
break;
|
||||
|
||||
|
||||
case 's':
|
||||
case 'S':
|
||||
OLC_SCRIPT_EDIT_MODE(d) = SCRIPT_MAIN_MENU;
|
||||
|
|
@ -636,7 +636,7 @@ void redit_parse(struct descriptor_data *d, char *arg)
|
|||
break;
|
||||
}
|
||||
return;
|
||||
|
||||
|
||||
|
||||
case OLC_SCRIPT_EDIT:
|
||||
if (dg_script_edit_parse(d, arg)) return;
|
||||
|
|
@ -852,25 +852,25 @@ void redit_parse(struct descriptor_data *d, char *arg)
|
|||
return;
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
case REDIT_DELETE:
|
||||
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");
|
||||
else
|
||||
write_to_output(d, "Couldn't delete the room!.\r\n");
|
||||
|
||||
|
||||
cleanup_olc(d, CLEANUP_ALL);
|
||||
return;
|
||||
} else if (*arg == 'n' || *arg == 'N') {
|
||||
redit_disp_menu(d);
|
||||
OLC_MODE(d) = REDIT_MAIN_MENU;
|
||||
OLC_MODE(d) = REDIT_MAIN_MENU;
|
||||
return;
|
||||
} else
|
||||
write_to_output(d, "Please answer 'Y' or 'N': ");
|
||||
|
||||
break;
|
||||
|
||||
|
||||
break;
|
||||
|
||||
default:
|
||||
/*
|
||||
* 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)
|
||||
|
|
@ -67,7 +67,7 @@ ACMD(do_oasis_sedit)
|
|||
/** Parse any arguments. **/
|
||||
/****************************************************************************/
|
||||
buf3 = two_arguments(argument, buf1, buf2);
|
||||
|
||||
|
||||
if (!*buf1) {
|
||||
send_to_char(ch, "Specify a shop VNUM to edit.\r\n");
|
||||
return;
|
||||
|
|
@ -76,32 +76,32 @@ ACMD(do_oasis_sedit)
|
|||
send_to_char(ch, "Yikes! Stop that, someone will get hurt!\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
save = TRUE;
|
||||
|
||||
|
||||
if (is_number(buf2))
|
||||
number = atoi(buf2);
|
||||
else if (GET_OLC_ZONE(ch) > 0) {
|
||||
zone_rnum zlok;
|
||||
|
||||
|
||||
if ((zlok = real_zone(GET_OLC_ZONE(ch))) == NOWHERE)
|
||||
number = NOWHERE;
|
||||
else
|
||||
number = genolc_zone_bottom(zlok);
|
||||
}
|
||||
|
||||
|
||||
if (number == NOWHERE) {
|
||||
send_to_char(ch, "Save which zone?\r\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** If a numeric argument was given, get it. **/
|
||||
/****************************************************************************/
|
||||
if (number == NOWHERE)
|
||||
number = atoi(buf1);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Check that the shop isn't already being edited. **/
|
||||
/****************************************************************************/
|
||||
|
|
@ -114,12 +114,12 @@ ACMD(do_oasis_sedit)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Point d to the builder's descriptor. **/
|
||||
/****************************************************************************/
|
||||
d = ch->desc;
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Give the descriptor an OLC structure. **/
|
||||
/****************************************************************************/
|
||||
|
|
@ -128,9 +128,9 @@ ACMD(do_oasis_sedit)
|
|||
"SYSERR: do_oasis_sedit: Player already had olc structure.");
|
||||
free(d->olc);
|
||||
}
|
||||
|
||||
|
||||
CREATE(d->olc, struct oasis_olc_data, 1);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Find the zone. **/
|
||||
/****************************************************************************/
|
||||
|
|
@ -141,13 +141,13 @@ ACMD(do_oasis_sedit)
|
|||
d->olc = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Everyone but IMPLs can only edit zones they have been assigned. **/
|
||||
/****************************************************************************/
|
||||
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));
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/** 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;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (save) {
|
||||
send_to_char(ch, "Saving all shops in zone %d.\r\n",
|
||||
zone_table[OLC_ZNUM(d)].number);
|
||||
mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE,
|
||||
"OLC: %s saves shop info for zone %d.",
|
||||
GET_NAME(ch), zone_table[OLC_ZNUM(d)].number);
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/** Save the shops to the shop file. **/
|
||||
/**************************************************************************/
|
||||
save_shops(OLC_ZNUM(d));
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/** 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;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
OLC_NUM(d) = number;
|
||||
|
||||
|
||||
if ((real_num = real_shop(number)) != NOTHING)
|
||||
sedit_setup_existing(d, real_num);
|
||||
else
|
||||
sedit_setup_new(d);
|
||||
|
||||
|
||||
STATE(d) = CON_SEDIT;
|
||||
|
||||
|
||||
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
||||
|
||||
|
||||
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));
|
||||
}
|
||||
|
|
@ -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)
|
||||
|
|
@ -312,7 +312,7 @@ void sedit_rooms_menu(struct descriptor_data *d)
|
|||
struct shop_data *shop;
|
||||
int i;
|
||||
room_rnum rnum;
|
||||
|
||||
|
||||
shop = OLC_SHOP(d);
|
||||
get_char_colors(d->character);
|
||||
|
||||
|
|
@ -322,7 +322,7 @@ void sedit_rooms_menu(struct descriptor_data *d)
|
|||
rnum = real_room(S_ROOM(shop, i));
|
||||
/* if the room has been deleted, this may crash us otherwise. */
|
||||
/* set to 0 to be deletable. -- Welcor 09/04 */
|
||||
if (rnum == NOWHERE)
|
||||
if (rnum == NOWHERE)
|
||||
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,
|
||||
|
|
@ -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
|
||||
* return to main menu. Use OLC_VAL as a 'has changed' flag.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ const char *trade_letters[] = {
|
|||
const char *shop_bits[] = {
|
||||
"WILL_FIGHT",
|
||||
"USES_BANK",
|
||||
"UNLIMITED_CASH",
|
||||
"UNLIMITED_CASH",
|
||||
"\n"
|
||||
};
|
||||
|
||||
|
|
@ -1250,7 +1250,7 @@ void assign_the_shopkeepers(void)
|
|||
for (cindex = 0; cindex <= top_shop; cindex++) {
|
||||
if (SHOP_KEEPER(cindex) == NOBODY)
|
||||
continue;
|
||||
|
||||
|
||||
if (SHOP_KEEPER(cindex) > top_of_mobt) {
|
||||
log ("shop %d had mob out of bounds", cindex);
|
||||
abort();
|
||||
|
|
|
|||
|
|
@ -69,7 +69,7 @@ struct shop_data {
|
|||
|
||||
|
||||
/* 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_NONEUTRAL (1 << 2)
|
||||
#define TRADE_NOMAGIC_USER (1 << 3)
|
||||
|
|
|
|||
|
|
@ -137,7 +137,7 @@ void assign_mobiles(void)
|
|||
|
||||
ASSIGNMOB(1200, receptionist);
|
||||
ASSIGNMOB(3005, receptionist);
|
||||
ASSIGNMOB(5404, receptionist);
|
||||
ASSIGNMOB(5404, receptionist);
|
||||
ASSIGNMOB(27713, 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"
|
||||
"You know of the following %ss:\r\n", GET_PRACTICES(ch),
|
||||
GET_PRACTICES(ch) == 1 ? "" : "s", SPLSKL(ch));
|
||||
|
||||
|
||||
for (sortpos = 1; sortpos <= MAX_SKILLS; sortpos++) {
|
||||
i = spell_sort_info[sortpos];
|
||||
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");
|
||||
}
|
||||
|
||||
|
||||
|
||||
int find_skill_num(char *name)
|
||||
{
|
||||
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 */
|
||||
return;
|
||||
|
||||
|
||||
act("You quaff $p.", FALSE, ch, obj, NULL, TO_CHAR);
|
||||
if (obj->action_description)
|
||||
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);
|
||||
return (0);
|
||||
}
|
||||
|
||||
|
||||
if (GET_POS(ch) < SINFO.min_position) {
|
||||
switch (GET_POS(ch)) {
|
||||
case POS_SLEEPING:
|
||||
|
|
@ -674,7 +674,7 @@ void spell_level(int spell, int chclass, int level)
|
|||
bad = 1;
|
||||
}
|
||||
|
||||
if (!bad)
|
||||
if (!bad)
|
||||
spell_info[spell].min_level[chclass] = level;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -175,7 +175,7 @@ ASPELL(spell_locate_object)
|
|||
send_to_char(ch, "You sense nothing.\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
strlcpy(name, fname(obj->name), sizeof(name));
|
||||
j = level / 2;
|
||||
|
||||
|
|
|
|||
|
|
@ -119,8 +119,8 @@
|
|||
#define SPELL_ACID_BREATH 205
|
||||
#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
|
||||
* it with a 'spellname'.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -274,7 +274,7 @@
|
|||
#define CON_AEDIT 25 /* OLC mode - social (action) edit */
|
||||
#define CON_TRIGEDIT 26 /* OLC mode - trigger edit */
|
||||
#define CON_HEDIT 27
|
||||
|
||||
|
||||
/* Character equipment positions: used as index for char_data.equipment[] */
|
||||
/* NOTE: Don't confuse these constants with the ITEM_ bitvectors
|
||||
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_RAW_INPUT_LENGTH 512 /* Max size of *raw* input */
|
||||
#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 ** */
|
||||
#define MAX_PWD_LENGTH 30
|
||||
#define MAX_TITLE_LENGTH 80
|
||||
#define MAX_TITLE_LENGTH 80
|
||||
#define HOST_LENGTH 30
|
||||
#define PLR_DESC_LENGTH 512
|
||||
#define MAX_TONGUE 3
|
||||
#define MAX_SKILLS 200
|
||||
#define MAX_AFFECT 32
|
||||
#define MAX_TONGUE 3
|
||||
#define MAX_SKILLS 200
|
||||
#define MAX_AFFECT 32
|
||||
#define MAX_OBJ_AFFECT 6 /* Used in obj_file_elem */
|
||||
#define MAX_NOTE_LENGTH 4000 /* 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 the largest set of commands for as trigger */
|
||||
|
|
@ -745,7 +745,7 @@ struct time_data {
|
|||
struct pclean_criteria_data {
|
||||
int level; /* max level for this time limit */
|
||||
int days; /* time limit in days */
|
||||
};
|
||||
};
|
||||
|
||||
/* general player-related info, usually PC's and NPC's */
|
||||
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
|
||||
* common, but which must be saved to the players file for PC's.
|
||||
*/
|
||||
|
|
@ -1114,11 +1114,11 @@ struct guild_info_type {
|
|||
|
||||
/*
|
||||
* Config structs
|
||||
*
|
||||
*
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
* The game configuration structure used for configurating the game play
|
||||
* The game configuration structure used for configurating the game play
|
||||
* variables.
|
||||
*/
|
||||
struct game_data {
|
||||
|
|
@ -1138,7 +1138,7 @@ struct game_data {
|
|||
int load_into_inventory;/* Objects load in immortals inventory. */
|
||||
int track_through_doors;/* Track through doors while closed? */
|
||||
int immort_level_ok; /* Automatically level mortals to imm? */
|
||||
|
||||
|
||||
char *OK; /* When player receives 'Okay.' text. */
|
||||
char *NOPERSON; /* 'No-one by that name here.' */
|
||||
char *NOEFFECT; /* 'Nothing seems to happen.' */
|
||||
|
|
@ -1161,7 +1161,7 @@ struct crash_save_data {
|
|||
|
||||
|
||||
/*
|
||||
* The room numbers.
|
||||
* The room numbers.
|
||||
*/
|
||||
struct room_numbers {
|
||||
room_vnum mortal_start_room; /* vnum of room that mortals enter at. */
|
||||
|
|
|
|||
|
|
@ -200,7 +200,7 @@ extern void abort (), exit ();
|
|||
|
||||
/* Header files *******************************************************/
|
||||
|
||||
|
||||
|
||||
/* Header files common to all source files */
|
||||
|
||||
#ifdef HAVE_LIMITS_H
|
||||
|
|
@ -487,7 +487,7 @@ struct in_addr {
|
|||
#ifdef NEED_BZERO_PROTO
|
||||
// void bzero(char *b, int length);
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef NEED_CRYPT_PROTO
|
||||
char *crypt(const char *key, const char *salt);
|
||||
#endif
|
||||
|
|
@ -663,7 +663,7 @@ struct in_addr {
|
|||
|
||||
#ifdef NEED_SELECT_PROTO
|
||||
int select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout);
|
||||
fd_set *exceptfds, struct timeval *timeout);
|
||||
#endif
|
||||
|
||||
#ifdef NEED_SETITIMER_PROTO
|
||||
|
|
|
|||
10
src/tedit.c
10
src/tedit.c
|
|
@ -71,7 +71,7 @@ ACMD(do_tedit)
|
|||
int l, i = 0;
|
||||
char field[MAX_INPUT_LENGTH];
|
||||
char *backstr = NULL;
|
||||
|
||||
|
||||
struct {
|
||||
char *cmd;
|
||||
char level;
|
||||
|
|
@ -98,7 +98,7 @@ ACMD(do_tedit)
|
|||
|
||||
if (ch->desc == NULL)
|
||||
return;
|
||||
|
||||
|
||||
one_argument(argument, field);
|
||||
|
||||
if (!*field) {
|
||||
|
|
@ -119,12 +119,12 @@ ACMD(do_tedit)
|
|||
for (l = 0; *(fields[l].cmd) != '\n'; l++)
|
||||
if (!strncmp(field, fields[l].cmd, strlen(field)))
|
||||
break;
|
||||
|
||||
|
||||
if (*fields[l].cmd == '\n') {
|
||||
send_to_char(ch, "Invalid text editor option.\r\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
if (GET_LEVEL(ch) < fields[l].level) {
|
||||
send_to_char(ch, "You are not godly enough for that!\r\n");
|
||||
return;
|
||||
|
|
@ -140,7 +140,7 @@ ACMD(do_tedit)
|
|||
free(ch->desc->olc);
|
||||
}
|
||||
CREATE(ch->desc->olc, struct oasis_olc_data, 1);
|
||||
|
||||
|
||||
if (*fields[l].buffer) {
|
||||
send_to_char(ch, "%s", *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 num = 0;
|
||||
|
||||
|
||||
if (!string || !*string)
|
||||
return 0;
|
||||
|
||||
|
||||
len = strlen(string);
|
||||
for (i = 0; i < len; 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 d[s1_len + 1][s2_len + 1];
|
||||
int i, j;
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i <= s1_len; i++)
|
||||
d[i][0] = i;
|
||||
d[i][0] = i;
|
||||
for (j = 0; j <= s2_len; j++)
|
||||
d[0][j] = j;
|
||||
d[0][j] = j;
|
||||
|
||||
for (i = 1; i <= s1_len; i++)
|
||||
for (j = 1; j <= s2_len; j++)
|
||||
|
|
|
|||
|
|
@ -104,12 +104,12 @@ void update_pos(struct char_data *victim);
|
|||
#define CMP 3
|
||||
|
||||
/* get_filename() */
|
||||
#define CRASH_FILE 0
|
||||
#define CRASH_FILE 0
|
||||
#define ETEXT_FILE 1
|
||||
#define ALIAS_FILE 2
|
||||
#define SCRIPT_VARS_FILE 3
|
||||
#define PLR_FILE 4
|
||||
#define MAX_FILES 5
|
||||
#define PLR_FILE 4
|
||||
#define MAX_FILES 5
|
||||
|
||||
/* breadth-first searching */
|
||||
#define BFS_ERROR (-1)
|
||||
|
|
|
|||
94
src/zedit.c
94
src/zedit.c
|
|
@ -47,12 +47,12 @@ ACMD(do_oasis_zedit)
|
|||
char *buf3;
|
||||
char buf1[MAX_STRING_LENGTH];
|
||||
char buf2[MAX_STRING_LENGTH];
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Parse any arguments. **/
|
||||
/****************************************************************************/
|
||||
buf3 = two_arguments(argument, buf1, buf2);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** 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)) {
|
||||
if (str_cmp("save", buf1) == 0) {
|
||||
save = TRUE;
|
||||
|
||||
|
||||
if (is_number(buf2))
|
||||
number = atoi(buf2);
|
||||
else if (GET_OLC_ZONE(ch) > 0) {
|
||||
zone_rnum zlok;
|
||||
|
||||
|
||||
if ((zlok = real_zone(GET_OLC_ZONE(ch))) == NOWHERE)
|
||||
number = NOWHERE;
|
||||
else
|
||||
number = genolc_zone_bottom(zlok);
|
||||
}
|
||||
|
||||
|
||||
if (number == NOWHERE) {
|
||||
send_to_char(ch, "Save which zone?\r\n");
|
||||
return;
|
||||
|
|
@ -84,39 +84,39 @@ ACMD(do_oasis_zedit)
|
|||
else {
|
||||
char sbot[MAX_INPUT_LENGTH], stop[MAX_INPUT_LENGTH];
|
||||
room_vnum bottom, top;
|
||||
|
||||
|
||||
skip_spaces(&buf3);
|
||||
two_arguments(buf3, sbot, stop);
|
||||
|
||||
|
||||
number = atoi(buf2);
|
||||
if (number < 0)
|
||||
number = NOWHERE;
|
||||
bottom = atoi(sbot);
|
||||
top = atoi(stop);
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
/** Setup the new zone (displays the menu to the builder). **/
|
||||
/**********************************************************************/
|
||||
zedit_new_zone(ch, number, bottom, top);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************************/
|
||||
/** Done now, exit the function. **/
|
||||
/************************************************************************/
|
||||
return;
|
||||
|
||||
|
||||
} else {
|
||||
send_to_char(ch, "Yikes! Stop that, someone will get hurt!\r\n");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** If a numeric argumentwas given, retrieve it. **/
|
||||
/****************************************************************************/
|
||||
if (number == NOWHERE)
|
||||
number = atoi(buf1);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Check that nobody is currently editing this zone. **/
|
||||
/****************************************************************************/
|
||||
|
|
@ -129,12 +129,12 @@ ACMD(do_oasis_zedit)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Store the builder's descriptor in d. **/
|
||||
/****************************************************************************/
|
||||
d = ch->desc;
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Give the builder's descriptor an OLC structure. **/
|
||||
/****************************************************************************/
|
||||
|
|
@ -143,16 +143,16 @@ ACMD(do_oasis_zedit)
|
|||
"had olc structure.");
|
||||
free(d->olc);
|
||||
}
|
||||
|
||||
|
||||
CREATE(d->olc, struct oasis_olc_data, 1);
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** Find the zone. **/
|
||||
/****************************************************************************/
|
||||
OLC_ZNUM(d) = save ? real_zone(number) : real_zone_by_thing(number);
|
||||
if (OLC_ZNUM(d) == NOWHERE) {
|
||||
send_to_char(ch, "Sorry, there is no zone for that number!\r\n");
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/** Free the descriptor's OLC structure. **/
|
||||
/**************************************************************************/
|
||||
|
|
@ -160,7 +160,7 @@ ACMD(do_oasis_zedit)
|
|||
d->olc = NULL;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
/****************************************************************************/
|
||||
/** 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,
|
||||
"OLC: %s saves zone information for zone %d.", GET_NAME(ch),
|
||||
zone_table[OLC_ZNUM(d)].number);
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/** Save the zone information to the zone file. **/
|
||||
/**************************************************************************/
|
||||
save_zone(OLC_ZNUM(d));
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/** 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;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
OLC_NUM(d) = number;
|
||||
|
||||
|
||||
if ((real_num = real_room(number)) == NOWHERE) {
|
||||
write_to_output(d, "That room does not exist.\r\n");
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/** 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);
|
||||
STATE(d) = CON_ZEDIT;
|
||||
|
||||
|
||||
act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM);
|
||||
SET_BIT(PLR_FLAGS(ch), PLR_WRITING);
|
||||
|
||||
|
||||
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));
|
||||
}
|
||||
|
|
@ -225,7 +225,7 @@ void zedit_setup(struct descriptor_data *d, int room_num)
|
|||
int subcmd = 0, count = 0, cmd_room = NOWHERE;
|
||||
|
||||
/*
|
||||
* Allocate one scratch zone structure.
|
||||
* Allocate one scratch zone structure.
|
||||
*/
|
||||
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->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->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);
|
||||
|
||||
/*
|
||||
* 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++) {
|
||||
/*
|
||||
|
|
@ -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) {
|
||||
free(zone_table[OLC_ZNUM(d)].name);
|
||||
free(zone_table[OLC_ZNUM(d)].builders);
|
||||
|
||||
|
||||
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)].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)
|
||||
{
|
||||
|
|
@ -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)
|
||||
{
|
||||
|
|
@ -439,9 +439,9 @@ void zedit_disp_menu(struct descriptor_data *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"
|
||||
"%s1%s) Builders : %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':
|
||||
write_to_output(d, "%sAttach trigger %s%s%s [%s%d%s] to %s",
|
||||
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,
|
||||
((MYCMD.arg1 == MOB_TRIGGER) ? "mobile" :
|
||||
((MYCMD.arg1 == OBJ_TRIGGER) ? "object" :
|
||||
|
|
@ -555,7 +555,7 @@ void zedit_disp_menu(struct descriptor_data *d)
|
|||
subcmd++;
|
||||
}
|
||||
/*
|
||||
* Finish off menu
|
||||
* Finish off menu
|
||||
*/
|
||||
write_to_output(d,
|
||||
"%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)
|
||||
{
|
||||
|
|
@ -597,7 +597,7 @@ void zedit_disp_comtype(struct descriptor_data *d)
|
|||
|
||||
/*
|
||||
* 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)
|
||||
{
|
||||
|
|
@ -618,7 +618,7 @@ void zedit_disp_arg1(struct descriptor_data *d)
|
|||
case 'D':
|
||||
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));
|
||||
zedit_disp_arg2(d);
|
||||
|
|
@ -650,7 +650,7 @@ void zedit_disp_arg2(struct descriptor_data *d)
|
|||
int i;
|
||||
|
||||
write_to_output(d, "\r\n");
|
||||
|
||||
|
||||
switch (OLC_CMD(d).command) {
|
||||
case 'M':
|
||||
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.
|
||||
*/
|
||||
/*
|
||||
* Abort edit, and return to main menu
|
||||
* Abort edit, and return to main menu
|
||||
* - idea from Mark Garringer zizazat@hotmail.com
|
||||
*/
|
||||
if (toupper(*arg) == 'A') {
|
||||
if (OLC_CMD(d).command == 'N') {
|
||||
if (toupper(*arg) == 'A') {
|
||||
if (OLC_CMD(d).command == 'N') {
|
||||
OLC_CMD(d).command = '*';
|
||||
}
|
||||
}
|
||||
zedit_disp_menu(d);
|
||||
break;
|
||||
}
|
||||
|
|
@ -1069,7 +1069,7 @@ void zedit_parse(struct descriptor_data *d, char *arg)
|
|||
case 'T':
|
||||
if (real_trigger(atoi(arg)) != NOTHING) {
|
||||
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);
|
||||
} else
|
||||
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);
|
||||
break;
|
||||
|
||||
|
||||
/*-------------------------------------------------------------------*/
|
||||
case ZEDIT_ZONE_RESET:
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@
|
|||
** Version 2. added detection for writing off the end or beginning
|
||||
** 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.
|
||||
**
|
||||
**
|
||||
**
|
||||
** 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);
|
||||
|
||||
/* note that we freed the memory */
|
||||
m->frees++;
|
||||
m->frees++;
|
||||
|
||||
/* check to see if it was freed > once */
|
||||
if (m->frees > 1) {
|
||||
|
|
@ -228,7 +228,7 @@ void zfree(int * what, char * file,int line)
|
|||
pad_check(m);
|
||||
|
||||
/* note that we freed the memory */
|
||||
m->frees++;
|
||||
m->frees++;
|
||||
|
||||
/* check to see if it was freed > once */
|
||||
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 *result;
|
||||
#ifndef NO_MEMORY_STRDUP
|
||||
#ifndef NO_MEMORY_STRDUP
|
||||
if (!getzmallocstatus()) {
|
||||
result = (char*)malloc(strlen(src) + 1);
|
||||
if (result == (char*)0)
|
||||
|
|
@ -312,7 +312,7 @@ void zmalloc_check()
|
|||
admonishemnt = "you call yourself a programmer?";
|
||||
else if (total_leak > 1000)
|
||||
admonishemnt = "the X consortium has a job for you...";
|
||||
else
|
||||
else
|
||||
admonishemnt = "close, but not there yet.";
|
||||
fprintf(zfd,"zmalloc: %d leaks totalling %d bytes... %s\n",num_leaks,total_leak,
|
||||
admonishemnt);
|
||||
|
|
@ -332,7 +332,7 @@ void pad_check(meminfo *m)
|
|||
|
||||
/* check the padding: */
|
||||
if (memcmp((int *)(addr - sizeof(beginPad)),
|
||||
beginPad, sizeof(beginPad)) != 0)
|
||||
beginPad, sizeof(beginPad)) != 0)
|
||||
fprintf(zfd," ERR: beginPad was modified!\n");
|
||||
if (memcmp((int *)(addr + m->size),endPad,
|
||||
sizeof(endPad)) != 0)
|
||||
|
|
@ -350,7 +350,7 @@ void zmalloc_free_list(meminfo *m)
|
|||
free(old);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#ifdef ZTEST
|
||||
#undef ZMALLOC_H
|
||||
|
||||
|
|
@ -365,18 +365,18 @@ main()
|
|||
printf("Malloc test..");
|
||||
printf("You should see no error here.\n");
|
||||
tmp = (unsigned char*)malloc(200);
|
||||
free(tmp);
|
||||
free(tmp);
|
||||
|
||||
printf("Free free mem test...\n");
|
||||
printf("You should see an ERR: multiple frees here\n");
|
||||
tmp = (unsigned char*)malloc(200);
|
||||
free(tmp);
|
||||
free(tmp);
|
||||
free(tmp);
|
||||
free(tmp);
|
||||
|
||||
/*
|
||||
fprintf(zfd,"\nFree unallocated mem test \n");
|
||||
tmp += 4;
|
||||
free(tmp);
|
||||
free(tmp);
|
||||
*/
|
||||
|
||||
printf("Unfreed mem test...\n");
|
||||
|
|
@ -387,25 +387,25 @@ main()
|
|||
printf("You should see an ERR:endPad here\n");
|
||||
tmp = (unsigned char*)malloc(200);
|
||||
tmp[200] = 0xfa;
|
||||
free(tmp);
|
||||
free(tmp);
|
||||
|
||||
printf("Buffer overrun test 2...\n");
|
||||
printf("You should see an ERR:endPad here\n");
|
||||
tmp = (unsigned char*)malloc(200);
|
||||
tmp[215] = 0xbb;
|
||||
free(tmp);
|
||||
free(tmp);
|
||||
|
||||
printf("Buffer underrun test 1...\n");
|
||||
printf("You should see an ERR:beginPad here\n");
|
||||
tmp = (unsigned char*)malloc(200);
|
||||
tmp[-10] = 0x0f;
|
||||
free(tmp);
|
||||
free(tmp);
|
||||
|
||||
printf("Buffer underrun test 2...\n");
|
||||
printf("You should see an ERR:beginPad here\n");
|
||||
tmp = (unsigned char*)malloc(200);
|
||||
tmp[-1] = 0x00;
|
||||
free(tmp);
|
||||
free(tmp);
|
||||
|
||||
|
||||
zmalloc_check();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue