From a2031d64e2e80d0db0e70b07f2d67a39fb3e0c1d Mon Sep 17 00:00:00 2001 From: Rumble Date: Tue, 23 Jan 2007 03:07:23 +0000 Subject: [PATCH] Removed all whitespace (tabs and spaces) from EOL's. How did we get so many? --Rumble --- src/act.comm.c | 48 ++-- src/act.informative.c | 482 +++++++++++++++++++------------------- src/act.item.c | 20 +- src/act.movement.c | 2 +- src/act.offensive.c | 2 +- src/act.other.c | 14 +- src/act.social.c | 30 +-- src/act.wizard.c | 372 ++++++++++++++--------------- src/aedit.c | 72 +++--- src/alias.c | 34 +-- src/bsd-snprintf.c | 138 +++++------ src/cedit.c | 448 +++++++++++++++++------------------ src/class.c | 10 +- src/comm.c | 68 +++--- src/config.c | 4 +- src/constants.c | 4 +- src/context_help.c | 18 +- src/db.c | 180 +++++++------- src/db.h | 6 +- src/dg_comm.c | 18 +- src/dg_db_scripts.c | 32 +-- src/dg_event.c | 14 +- src/dg_handler.c | 38 +-- src/dg_misc.c | 34 +-- src/dg_mobcmd.c | 202 ++++++++-------- src/dg_objcmd.c | 120 +++++----- src/dg_olc.c | 136 +++++------ src/dg_scripts.c | 528 +++++++++++++++++++++--------------------- src/dg_scripts.h | 46 ++-- src/dg_triggers.c | 126 +++++----- src/dg_variables.c | 276 +++++++++++----------- src/dg_wldcmd.c | 110 ++++----- src/fight.c | 13 +- src/genmob.c | 10 +- src/genobj.c | 110 ++++----- src/genobj.h | 2 +- src/genolc.c | 94 ++++---- src/genshp.c | 12 +- src/genwld.c | 16 +- src/genzon.c | 32 +-- src/graph.c | 2 +- src/handler.c | 12 +- src/hedit.c | 158 ++++++------- src/house.c | 36 +-- src/improved-edit.c | 274 +++++++++++----------- src/interpreter.c | 118 +++++----- src/interpreter.h | 4 +- src/limits.c | 6 +- src/magic.c | 2 +- src/mail.c | 64 ++--- src/mail.h | 2 +- src/medit.c | 120 +++++----- src/modify.c | 38 +-- src/oasis.c | 58 ++--- src/oasis.h | 10 +- src/oasis_copy.c | 84 +++---- src/oasis_delete.c | 62 ++--- src/oasis_list.c | 126 +++++----- src/objsave.c | 104 ++++----- src/oedit.c | 130 +++++------ src/pfdefaults.h | 2 +- src/players.c | 18 +- src/random.c | 2 +- src/redit.c | 90 +++---- src/sedit.c | 52 ++--- src/shop.c | 4 +- src/shop.h | 2 +- src/spec_assign.c | 2 +- src/spec_procs.c | 2 +- src/spell_parser.c | 8 +- src/spells.c | 2 +- src/spells.h | 4 +- src/structs.h | 28 +-- src/sysdep.h | 6 +- src/tedit.c | 10 +- src/utils.c | 10 +- src/utils.h | 6 +- src/zedit.c | 94 ++++---- src/zmalloc.c | 30 +-- 79 files changed, 2851 insertions(+), 2852 deletions(-) diff --git a/src/act.comm.c b/src/act.comm.c index 1f1540d..311121c 100644 --- a/src/act.comm.c +++ b/src/act.comm.c @@ -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 */ diff --git a/src/act.informative.c b/src/act.informative.c index 8ed4217..02c8d76 100644 --- a/src/act.informative.c +++ b/src/act.informative.c @@ -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); } diff --git a/src/act.item.c b/src/act.item.c index c14b89d..01c3180 100644 --- a/src/act.item.c +++ b/src/act.item.c @@ -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]; diff --git a/src/act.movement.c b/src/act.movement.c index a520e2e..3cff728 100644 --- a/src/act.movement.c +++ b/src/act.movement.c @@ -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. diff --git a/src/act.offensive.c b/src/act.offensive.c index b6972d0..6eaa65c 100644 --- a/src/act.offensive.c +++ b/src/act.offensive.c @@ -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 { diff --git a/src/act.other.c b/src/act.other.c index a217978..fa6c721 100644 --- a/src/act.other.c +++ b/src/act.other.c @@ -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); diff --git a/src/act.social.c b/src/act.social.c index 01e144b..6862883 100644 --- a/src/act.social.c +++ b/src/act.social.c @@ -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; } diff --git a/src/act.wizard.c b/src/act.wizard.c index 313ac78..d5b6d13 100644 --- a/src/act.wizard.c +++ b/src/act.wizard.c @@ -121,30 +121,30 @@ int purge_room(room_rnum room) { int j; struct char_data *vict; - + if (room == NOWHERE || room > top_of_world) return 0; - + for (vict = world[room].people; vict; vict = vict->next_in_room) { if (!IS_NPC(vict)) - continue; - + continue; + /* Dump inventory. */ while (vict->carrying) - extract_obj(vict->carrying); - + extract_obj(vict->carrying); + /* Dump equipment. */ - for (j = 0; j < NUM_WEARS; j++) + for (j = 0; j < NUM_WEARS; j++) if (GET_EQ(vict, j)) extract_obj(GET_EQ(vict, j)); - + /* Dump character. */ extract_char(vict); } - + /* Clear the ground. */ while (world[room].contents) extract_obj(world[room].contents); - + return 1; } @@ -164,7 +164,7 @@ ACMD(do_echo) mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "(GC) %s echoed: %s", GET_NAME(ch), buf); } act(buf, FALSE, ch, 0, 0, TO_ROOM); - + if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_NOREPEAT)) send_to_char(ch, "%s", CONFIG_OK); else @@ -316,7 +316,7 @@ ACMD(do_goto) snprintf(buf, sizeof(buf), "$n %s", POOFIN(ch) ? POOFIN(ch) : "appears with an ear-splitting bang."); act(buf, TRUE, ch, 0, 0, TO_ROOM); - + look_at_room(ch, 0); enter_wtrigger(&world[IN_ROOM(ch)], ch, -1); } @@ -348,7 +348,7 @@ ACMD(do_trans) act("$n arrives from a puff of smoke.", FALSE, victim, 0, 0, TO_ROOM); act("$n has transferred you!", FALSE, ch, 0, victim, TO_VICT); look_at_room(victim, 0); - + enter_wtrigger(&world[IN_ROOM(victim)], victim, -1); } } else { /* Trans All */ @@ -430,14 +430,14 @@ ACMD(do_vnum) if (is_abbrev(buf, "room") && (good_arg = 1)) if (!vnum_room(buf2, ch)) send_to_char(ch, "No rooms by that name.\r\n"); - + if (is_abbrev(buf, "trig") && (good_arg = 1)) if (!vnum_trig(buf2, ch)) send_to_char(ch, "No triggers by that name.\r\n"); if (!good_arg) send_to_char(ch, "Usage: vnum { obj | mob | room | trig } \r\n"); - + } #define ZOCMD zone_table[zrnum].cmd[subcmd] @@ -447,7 +447,7 @@ void list_zone_commands_room(struct char_data *ch, room_vnum rvnum) zone_rnum zrnum = real_zone_by_thing(rvnum); room_rnum rrnum = real_room(rvnum), cmd_room = NOWHERE; int subcmd = 0, count = 0; - + if (zrnum == NOWHERE || rrnum == NOWHERE) { send_to_char(ch, "No zone information available.\r\n"); return; @@ -534,7 +534,7 @@ void list_zone_commands_room(struct char_data *ch, room_vnum rvnum) case 'T': send_to_char(ch, "%sAttach trigger %s%s%s [%s%d%s] to %s\r\n", ZOCMD.if_flag ? " then " : "", - cyn, trig_index[ZOCMD.arg2]->proto->name, yel, + cyn, trig_index[ZOCMD.arg2]->proto->name, yel, cyn, trig_index[ZOCMD.arg2]->vnum, yel, ((ZOCMD.arg1 == MOB_TRIGGER) ? "mobile" : ((ZOCMD.arg1 == OBJ_TRIGGER) ? "object" : @@ -553,11 +553,11 @@ void list_zone_commands_room(struct char_data *ch, room_vnum rvnum) send_to_char(ch, "\r\n"); break; } - } - subcmd++; + } + subcmd++; } send_to_char(ch, nrm); - if (!count) + if (!count) send_to_char(ch, "None!\r\n"); } @@ -638,7 +638,7 @@ void do_stat_room(struct char_data *ch, struct room_data *rm) sprintbit(rm->dir_option[i]->exit_info, exit_bits, buf2, sizeof(buf2)); send_to_char(ch, "Exit %s%-5s%s: To: [%s], Key: [%5d], Keywords: %s, Type: %s\r\n%s", - CCCYN(ch, C_NRM), dirs[i], CCNRM(ch, C_NRM), buf1, + CCCYN(ch, C_NRM), dirs[i], CCNRM(ch, C_NRM), buf1, rm->dir_option[i]->key == NOTHING ? -1 : rm->dir_option[i]->key, rm->dir_option[i]->keyword ? rm->dir_option[i]->keyword : "None", buf2, rm->dir_option[i]->general_description ? rm->dir_option[i]->general_description : " No exit description.\r\n"); @@ -646,7 +646,7 @@ void do_stat_room(struct char_data *ch, struct room_data *rm) /* check the room for a script */ do_sstat_room(ch); - + list_zone_commands_room(ch, rm->number); } @@ -987,9 +987,9 @@ void do_stat_character(struct char_data *ch, struct char_data *k) if (!mc) send_to_char(ch, " ** Corrupted!\r\n"); else { - if (mem->cmd) + if (mem->cmd) send_to_char(ch, " %-20.20s%s\r\n",GET_NAME(mc),mem->cmd); - else + else send_to_char(ch, " %-20.20s \r\n",GET_NAME(mc)); } mem = mem->next; @@ -1269,7 +1269,7 @@ ACMD(do_switch) send_to_char(ch, "That's private property -- no trespassing!\r\n"); else { send_to_char(ch, "%s", CONFIG_OK); - mudlog(CMP, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s Switched into: %s", GET_NAME(ch), GET_NAME(victim)); + mudlog(CMP, MAX(LVL_GOD, GET_INVIS_LEV(ch)), TRUE, "(GC) %s Switched into: %s", GET_NAME(ch), GET_NAME(victim)); ch->desc->character = victim; ch->desc->original = ch; @@ -1304,7 +1304,7 @@ void do_cheat(struct char_data *ch) ACMD(do_return) { if (!IS_NPC(ch) && !ch->desc->original) { - do_cheat(ch); + do_cheat(ch); } if (ch->desc && ch->desc->original) { @@ -1398,7 +1398,7 @@ ACMD(do_vstat) int r_num; ACMD(do_tstat); - + two_arguments(argument, buf, buf2); if (!*buf || !*buf2 || !isdigit(*buf2)) { @@ -1625,7 +1625,7 @@ void perform_immort_vis(struct char_data *ch) send_to_char(ch, "You are already fully visible.\r\n"); return; } - + GET_INVIS_LEV(ch) = 0; appear(ch); send_to_char(ch, "You are now fully visible.\r\n"); @@ -1650,7 +1650,7 @@ void perform_immort_invis(struct char_data *ch, int level) GET_INVIS_LEV(ch) = level; send_to_char(ch, "Your invisibility level is %d.\r\n", level); } - + ACMD(do_invis) { @@ -1940,7 +1940,7 @@ void add_llog_entry(struct char_data *ch, int type) { if(GET_PREF(ch) <= 0) { return; } - + /* See if we have a login stored */ llast = find_llog_entry(GET_PREF(ch), GET_IDNUM(ch)); @@ -1973,14 +1973,14 @@ void clean_llog_entries(void) { FILE *ofp, *nfp; struct last_entry mlast; int recs; - - if(!(ofp=fopen(LAST_FILE,"r"))) + + if(!(ofp=fopen(LAST_FILE,"r"))) return; /* no file, no gripe */ - + fseek(ofp,0L,SEEK_END); recs=ftell(ofp)/sizeof(struct last_entry); rewind(ofp); - + if (recs < MAX_LAST_ENTRIES) { fclose(ofp); return; @@ -1991,10 +1991,10 @@ void clean_llog_entries(void) { fclose(ofp); return; } - + /* skip first entries */ fseek(ofp,(recs-MAX_LAST_ENTRIES)* (sizeof(struct last_entry)),SEEK_CUR); - + /* copy the rest */ while (!feof(ofp)) { fread(&mlast,sizeof(struct last_entry),1,ofp); @@ -2002,7 +2002,7 @@ void clean_llog_entries(void) { } fclose(ofp); fclose(nfp); - + remove(LAST_FILE); rename("etc/nlast", LAST_FILE); } @@ -2020,7 +2020,7 @@ ACMD(do_list_llog_entries) { fread(&llast, sizeof(struct last_entry), 1, fp); while(!feof(fp)) { - send_to_char(ch, + send_to_char(ch, "%10s\t%d\t%s\t%s", llast.username, llast.punique, @@ -2050,7 +2050,7 @@ ACMD(do_last) FILE *fp; time_t delta; struct last_entry mlast; - + *name = '\0'; if (*argument) { /* parse it */ @@ -2062,12 +2062,12 @@ ACMD(do_last) } if (isdigit(*arg)) { num = atoi(arg); - if (num < 0) + if (num < 0) num = 0; - } else + } else strncpy(name, arg, sizeof(name)-1); half_chop(argument, arg, argument); - } + } } if (*name && !num) { @@ -2121,7 +2121,7 @@ ACMD(do_last) send_to_char(ch, "(%5.5s) ",asctime(gmtime(&delta))+11); send_to_char(ch, "%s", last_array[mlast.close_type]); } - + send_to_char(ch, "\r\n"); num--; } @@ -2258,7 +2258,7 @@ ACMD(do_wiznet) for (d = descriptor_list; d; d = d->next) { if ((STATE(d) == CON_PLAYING) && (GET_LEVEL(d->character) >= level) && - (!PRF_FLAGGED(d->character, PRF_NOWIZ)) + (!PRF_FLAGGED(d->character, PRF_NOWIZ)) && (d != ch->desc || !(PRF_FLAGGED(d->character, PRF_NOREPEAT)))) { send_to_char(d->character, "%s", CCCYN(d->character, C_NRM)); send_to_char(d->character, "%s", buf1); @@ -2280,7 +2280,7 @@ ACMD(do_zreset) zone_vnum j; one_argument(argument, arg); - + if (*arg == '*') { if (GET_LEVEL(ch) < LVL_GOD){ send_to_char(ch, "You do not have permission to reset the entire world.\r\n"); @@ -2422,7 +2422,7 @@ ACMD(do_wizutil) size_t print_zone_to_buf(char *bufptr, size_t left, zone_rnum zone, int listall) { size_t tmp; - + if (listall) { int i, j, k, l, m, n; @@ -2433,7 +2433,7 @@ size_t print_zone_to_buf(char *bufptr, size_t left, zone_rnum zone, int listall) zone_table[zone].reset_mode, zone_table[zone].bot, zone_table[zone].top); i = j = k = l = m = n = 0; - + for (i = 0; i < top_of_world; i++) if (world[i].number >= zone_table[zone].bot && world[i].number <= zone_table[zone].top) j++; @@ -2441,14 +2441,14 @@ size_t print_zone_to_buf(char *bufptr, size_t left, zone_rnum zone, int listall) for (i = 0; i < top_of_objt; i++) if (obj_index[i].vnum >= zone_table[zone].bot && obj_index[i].vnum <= zone_table[zone].top) k++; - + for (i = 0; i < top_of_mobt; i++) if (mob_index[i].vnum >= zone_table[zone].bot && mob_index[i].vnum <= zone_table[zone].top) l++; for (i = 0; i<= top_shop; i++) if (SHOP_NUM(i) >= zone_table[zone].bot && SHOP_NUM(i) <= zone_table[zone].top) - m++; + m++; for (i = 0; i < top_of_trigt; i++) if (trig_index[i]->vnum >= zone_table[zone].bot && trig_index[i]->vnum <= zone_table[zone].top) @@ -2461,15 +2461,15 @@ size_t print_zone_to_buf(char *bufptr, size_t left, zone_rnum zone, int listall) " Objects: %2d\r\n" " Mobiles: %2d\r\n" " Shops: %2d\r\n" - " Triggers: %2d\r\n", + " Triggers: %2d\r\n", j, k, l, m, n); - + return tmp; - } - - return snprintf(bufptr, left, - "%3d %-*s%s By: %-10.10s%s Range: %5d-%5d\r\n", zone_table[zone].number, - count_color_chars(zone_table[zone].name)+30, zone_table[zone].name, KNRM, + } + + return snprintf(bufptr, left, + "%3d %-*s%s By: %-10.10s%s Range: %5d-%5d\r\n", zone_table[zone].number, + count_color_chars(zone_table[zone].name)+30, zone_table[zone].name, KNRM, zone_table[zone].builders, KNRM, zone_table[zone].bot, zone_table[zone].top); } @@ -2486,7 +2486,7 @@ ACMD(do_show) struct descriptor_data *d; char field[MAX_INPUT_LENGTH], value[MAX_INPUT_LENGTH], arg[MAX_INPUT_LENGTH], buf[MAX_STRING_LENGTH]; - + struct show_struct { const char *cmd; const char level; @@ -2552,11 +2552,11 @@ ACMD(do_show) while (buf2) { if (!str_cmp(buf2, value)) break; - buf2 = strtok(NULL, " "); + buf2 = strtok(NULL, " "); } - if (!buf2) + if (!buf2) continue; - } + } nlen = print_zone_to_buf(buf + len, sizeof(buf) - len, zrn, 0); if (len + nlen >= sizeof(buf) || nlen < 0) break; @@ -2565,7 +2565,7 @@ ACMD(do_show) } page_string(ch->desc, buf, TRUE); break; - + /* show player */ case 2: if (!*value) { @@ -2587,7 +2587,7 @@ ACMD(do_show) send_to_char(ch, "Au: %-8d Bal: %-8d Exp: %-8d Align: %-5d Lessons: %-3d\r\n", GET_GOLD(vict), GET_BANK_GOLD(vict), GET_EXP(vict), GET_ALIGNMENT(vict), GET_PRACTICES(vict)); - + /* ctime() uses static buffer: do not combine. */ send_to_char(ch, "Started: %-20.16s ", ctime(&vict->player.time.birth)); send_to_char(ch, "Last: %-20.16s Played: %3dh %2dm\r\n", @@ -3132,11 +3132,11 @@ int perform_set(struct char_data *ch, struct char_data *vict, int mode, break; case 51: - if (is_abbrev(val_arg, "socials") || is_abbrev(val_arg, "actions") || is_abbrev(val_arg, "aedit")) + if (is_abbrev(val_arg, "socials") || is_abbrev(val_arg, "actions") || is_abbrev(val_arg, "aedit")) GET_OLC_ZONE(vict) = AEDIT_PERMISSION; else if (is_abbrev(val_arg, "hedit")) GET_OLC_ZONE(vict) = HEDIT_PERMISSION; - else if (is_abbrev(val_arg, "off")) + else if (is_abbrev(val_arg, "off")) GET_OLC_ZONE(vict) = NOWHERE; else if (!is_number(val_arg)) { send_to_char(ch, "Value must be either 'aedit', 'hedit', 'off' or a zone number.\r\n"); @@ -3158,7 +3158,7 @@ int perform_set(struct char_data *ch, struct char_data *vict, int mode, POOFIN(vict) = strdup(val_arg); } break; - + case 54: if ((vict == ch) || (GET_LEVEL(ch) == LVL_IMPL)) { skip_spaces(&val_arg); @@ -3172,7 +3172,7 @@ int perform_set(struct char_data *ch, struct char_data *vict, int mode, case 55: SET_OR_REMOVE(PRF_FLAGS(vict), PRF_AFK); break; - + default: send_to_char(ch, "Can't set that!\r\n"); return (0); @@ -3314,9 +3314,9 @@ ACMD(do_links) if (world[nr].dir_option[j]) { to_room = world[nr].dir_option[j]->to_room; if (to_room != NOWHERE && (zrnum != world[to_room].zone)) - send_to_char(ch, "%3d %-30s at %5d (%-5s) ---> %5d\r\n", - zone_table[world[to_room].zone].number, - zone_table[world[to_room].zone].name, + send_to_char(ch, "%3d %-30s at %5d (%-5s) ---> %5d\r\n", + zone_table[world[to_room].zone].number, + zone_table[world[to_room].zone].name, GET_ROOM_VNUM(nr), dirs[j], world[to_room].number); } } @@ -3333,7 +3333,7 @@ ACMD(do_links) #define MAX_HITROLL_ALLOWED MAX(GET_LEVEL(mob)/3, 1) #define MAX_GOLD_ALLOWED GET_LEVEL(mob)*3000 #define MAX_EXP_ALLOWED GET_LEVEL(mob)*GET_LEVEL(mob) * 120 -#define MAX_LEVEL_ALLOWED LVL_IMPL +#define MAX_LEVEL_ALLOWED LVL_IMPL #define GET_OBJ_AVG_DAM(obj) (((GET_OBJ_VAL(obj, 2) + 1) / 2.0) * GET_OBJ_VAL(obj, 1)) /* arbitrary limit for per round dam */ #define MAX_MOB_DAM_ALLOWED 500 @@ -3342,7 +3342,7 @@ ACMD(do_links) /*item limits*/ #define MAX_DAM_ALLOWED 50 /* for weapons - avg. dam*/ -#define MAX_AFFECTS_ALLOWED 3 +#define MAX_AFFECTS_ALLOWED 3 /* Armor class limits*/ #define TOTAL_WEAR_CHECKS (NUM_ITEM_WEARS-2) /*minus Wield and Take*/ @@ -3422,7 +3422,7 @@ const int offlimit_zones[] = {0,12,13,14,-1}; /*what zones can no room connect ACMD (do_zcheck) -{ +{ zone_rnum zrnum; struct obj_data *obj; struct char_data *mob = NULL; @@ -3433,16 +3433,16 @@ ACMD (do_zcheck) char buf[MAX_STRING_LENGTH]; float avg_dam; size_t len = 0; - struct extra_descr_data *ext, *ext2; + struct extra_descr_data *ext, *ext2; one_argument(argument, buf); - if (!buf || !*buf || !strcmp(buf, ".")) - zrnum = world[IN_ROOM(ch)].zone; - else - zrnum = real_zone(atoi(buf)); - + if (!buf || !*buf || !strcmp(buf, ".")) + zrnum = world[IN_ROOM(ch)].zone; + else + zrnum = real_zone(atoi(buf)); + if (zrnum == NOWHERE) { - send_to_char(ch, "Check what zone ?\r\n"); + send_to_char(ch, "Check what zone ?\r\n"); return; } else send_to_char(ch, "Checking zone %d!\r\n", zone_table[zrnum].number); @@ -3451,7 +3451,7 @@ ACMD (do_zcheck) send_to_char(ch, "Checking Mobs for limits...\r\n"); /*check mobs first*/ - for (i=0; iplayer.name, "mob unfinished") && (found=1)) @@ -3459,24 +3459,24 @@ ACMD (do_zcheck) "- Alias hasn't been set.\r\n"); if (!strcmp(mob->player.short_descr, "the unfinished mob") && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, + len += snprintf(buf + len, sizeof(buf) - len, "- Short description hasn't been set.\r\n"); if (!strncmp(mob->player.long_descr, "An unfinished mob stands here.", 30) && (found=1)) len += snprintf(buf + len, sizeof(buf) - len, "- Long description hasn't been set.\r\n"); - if (mob->player.description && *mob->player.description) { + if (mob->player.description && *mob->player.description) { if (!strncmp(mob->player.description, "It looks unfinished.", 20) && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, + len += snprintf(buf + len, sizeof(buf) - len, "- Description hasn't been set.\r\n"); else if (strncmp(mob->player.description, " ", 3) && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, + len += snprintf(buf + len, sizeof(buf) - len, "- Description hasn't been formatted. (/fi)\r\n"); } - + if (GET_LEVEL(mob)>MAX_LEVEL_ALLOWED && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, + len += snprintf(buf + len, sizeof(buf) - len, "- Is level %d (limit: 1-%d)\r\n", GET_LEVEL(mob), MAX_LEVEL_ALLOWED); @@ -3486,33 +3486,33 @@ ACMD (do_zcheck) GET_DAMROLL(mob), MAX_DAMROLL_ALLOWED); if (GET_HITROLL(mob)>MAX_HITROLL_ALLOWED && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, + len += snprintf(buf + len, sizeof(buf) - len, "- Hitroll of %d is too high (limit: %d)\r\n", GET_HITROLL(mob), MAX_HITROLL_ALLOWED); /* avg. dam including damroll per round of combat */ avg_dam = (((mob->mob_specials.damsizedice / 2.0) * mob->mob_specials.damnodice)+GET_DAMROLL(mob)); if (avg_dam>MAX_MOB_DAM_ALLOWED && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, + len += snprintf(buf + len, sizeof(buf) - len, "- average damage of %4.1f is too high (limit: %d)\r\n", avg_dam, MAX_MOB_DAM_ALLOWED); if (mob->mob_specials.damsizedice == 1 && mob->mob_specials.damnodice == 1 && - GET_LEVEL(mob) == 0 && + GET_LEVEL(mob) == 0 && (found=1)) len += snprintf(buf + len, sizeof(buf) - len, "- Needs to be fixed - %sAutogenerate!%s\r\n", CCYEL(ch, C_NRM), CCNRM(ch, C_NRM)); - - if (MOB_FLAGGED(mob, MOB_AGGRESSIVE) && + + if (MOB_FLAGGED(mob, MOB_AGGRESSIVE) && MOB_FLAGGED(mob, MOB_AGGR_GOOD | MOB_AGGR_EVIL | MOB_AGGR_NEUTRAL) && (found=1)) len += snprintf(buf + len, sizeof(buf) - len, - "- Both aggresive and agressive to align.\r\n"); - + "- Both aggresive and agressive to align.\r\n"); + if ((GET_GOLD(mob) > MAX_GOLD_ALLOWED) && (found=1)) len += snprintf(buf + len, sizeof(buf) - len, "- Set to %d Gold (limit : %d).\r\n", - GET_GOLD(mob), + GET_GOLD(mob), MAX_GOLD_ALLOWED); if (GET_EXP(mob)>MAX_EXP_ALLOWED && (found=1)) @@ -3525,10 +3525,10 @@ ACMD (do_zcheck) AFF_FLAGGED(mob, AFF_GROUP) ? "GROUP" : "", AFF_FLAGGED(mob, AFF_CHARM) ? "CHARM" : "", AFF_FLAGGED(mob, AFF_POISON) ? "POISON" : ""); - + if (!MOB_FLAGGED(mob, MOB_SENTINEL) && !MOB_FLAGGED(mob, MOB_STAY_ZONE) && (found = 1)) - len += snprintf(buf + len, sizeof(buf) - len, + len += snprintf(buf + len, sizeof(buf) - len, "- Neither SENTINEL nor STAY_ZONE bits set.\r\n"); if (MOB_FLAGGED(mob, MOB_SPEC) && (found = 1)) @@ -3537,10 +3537,10 @@ ACMD (do_zcheck) /*****ADDITIONAL MOB CHECKS HERE*****/ if (found) { - send_to_char(ch, - "%s[%5d]%s %-30s: %s\r\n", + send_to_char(ch, + "%s[%5d]%s %-30s: %s\r\n", CCCYN(ch, C_NRM), GET_MOB_VNUM(mob), - CCYEL(ch, C_NRM), GET_NAME(mob), + CCYEL(ch, C_NRM), GET_NAME(mob), CCNRM(ch, C_NRM)); send_to_char(ch, buf); } @@ -3549,28 +3549,28 @@ ACMD (do_zcheck) found = 0; len = 0; } /*mob is in zone*/ - } /*check mobs*/ + } /*check mobs*/ /************** Check objects *****************/ send_to_char(ch, "\r\nChecking Objects for limits...\r\n"); for (i=0; iMAX_GOLD_ALLOWED && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, + len += snprintf(buf + len, sizeof(buf) - len, "- Is worth %d (money limit %d coins).\r\n", value, MAX_GOLD_ALLOWED); - break; + break; case ITEM_WEAPON: if (GET_OBJ_VAL(obj, 3) >= NUM_ATTACK_TYPES && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, + len += snprintf(buf + len, sizeof(buf) - len, "- has out of range attack type %d.\r\n", GET_OBJ_VAL(obj, 3)); - + if (GET_OBJ_AVG_DAM(obj)>MAX_DAM_ALLOWED && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, + len += snprintf(buf + len, sizeof(buf) - len, "- Damroll is %2.1f (limit %d)\r\n", GET_OBJ_AVG_DAM(obj), MAX_DAM_ALLOWED); if (!CAN_WEAR_WEAPONS) { @@ -3583,43 +3583,43 @@ ACMD (do_zcheck) if (tmp && (found=1)) /*any bits still on?*/ len += snprintf(buf + len, sizeof(buf) - len, "- Weapons cannot be worn as armor.\r\n"); - } /*wear weapons*/ + } /*wear weapons*/ break; case ITEM_ARMOR: ac=GET_OBJ_VAL(obj,0); for (j=0; jzarmor[j].ac_allowed) && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, + len += snprintf(buf + len, sizeof(buf) - len, "- Has AC %d (%s limit is %d)\r\n", ac, zarmor[j].message, zarmor[j].ac_allowed); } - break; - + break; + } /*switch on Item_Type*/ if (!CAN_WEAR(obj, ITEM_WEAR_TAKE)) { if ((GET_OBJ_COST(obj) || (GET_OBJ_WEIGHT(obj) && GET_OBJ_TYPE(obj) != ITEM_FOUNTAIN) || GET_OBJ_RENT(obj)) && (found = 1)) - len += snprintf(buf + len, sizeof(buf) - len, + len += snprintf(buf + len, sizeof(buf) - len, "- is NO_TAKE, but has cost (%d) weight (%d) or rent (%d) set.\r\n", GET_OBJ_COST(obj), GET_OBJ_WEIGHT(obj), GET_OBJ_RENT(obj)); } else { - if (GET_OBJ_COST(obj) == 0 && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, + if (GET_OBJ_COST(obj) == 0 && (found=1)) + len += snprintf(buf + len, sizeof(buf) - len, "- has 0 cost (min. 1).\r\n"); - if (GET_OBJ_WEIGHT(obj) == 0 && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, + if (GET_OBJ_WEIGHT(obj) == 0 && (found=1)) + len += snprintf(buf + len, sizeof(buf) - len, "- has 0 weight (min. 1).\r\n"); - if (GET_OBJ_WEIGHT(obj) > MAX_OBJ_WEIGHT && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - " Weight is too high: %d (limit %d).\r\n", + if (GET_OBJ_WEIGHT(obj) > MAX_OBJ_WEIGHT && (found=1)) + len += snprintf(buf + len, sizeof(buf) - len, + " Weight is too high: %d (limit %d).\r\n", GET_OBJ_WEIGHT(obj), MAX_OBJ_WEIGHT); - if (GET_OBJ_COST(obj) > MAX_OBJ_COST && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, + if (GET_OBJ_COST(obj) > MAX_OBJ_COST && (found=1)) + len += snprintf(buf + len, sizeof(buf) - len, "- has %d cost (max %d).\r\n", GET_OBJ_COST(obj), MAX_OBJ_COST); } @@ -3636,7 +3636,7 @@ ACMD (do_zcheck) GET_OBJ_TYPE(obj) != ITEM_NOTE && (found=1)) len += snprintf(buf + len, sizeof(buf) - len, "- has action_description set, but is inappropriate type.\r\n"); - + /*first check for over-all affections*/ for (affs=0, j = 0; j < MAX_OBJ_AFFECT; j++) if (obj->affected[j].modifier) affs++; @@ -3645,19 +3645,19 @@ ACMD (do_zcheck) len += snprintf(buf + len, sizeof(buf) - len, "- has %d affects (limit %d).\r\n", affs, MAX_AFFECTS_ALLOWED); - + /*check for out of range affections. */ for (j=0;jaffected[j].location].max_aff != -99 && /* only care if a range is set */ (obj->affected[j].modifier > zaffs[(int)obj->affected[j].location].max_aff || obj->affected[j].modifier < zaffs[(int)obj->affected[j].location].min_aff || zaffs[(int)obj->affected[j].location].min_aff == zaffs[(int)obj->affected[j].location].max_aff) && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, + len += snprintf(buf + len, sizeof(buf) - len, "- apply to %s is %d (limit %d - %d).\r\n", zaffs[(int)obj->affected[j].location].message, obj->affected[j].modifier, zaffs[(int)obj->affected[j].location].min_aff, - zaffs[(int)obj->affected[j].location].max_aff); + zaffs[(int)obj->affected[j].location].max_aff); /* special handling of +hit and +dam because of +hit_n_dam */ for (todam=0, tohit=0, j=0;jaffected[j].location == APPLY_DAMROLL) todam += obj->affected[j].modifier; } - if (abs(todam) > MAX_APPLY_DAMROLL_TOTAL && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- total damroll %d out of range (limit +/-%d.\r\n", + if (abs(todam) > MAX_APPLY_DAMROLL_TOTAL && (found=1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- total damroll %d out of range (limit +/-%d.\r\n", todam, MAX_APPLY_DAMROLL_TOTAL); - if (abs(tohit) > MAX_APPLY_HITROLL_TOTAL && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, - "- total hitroll %d out of range (limit +/-%d).\r\n", + if (abs(tohit) > MAX_APPLY_HITROLL_TOTAL && (found=1)) + len += snprintf(buf + len, sizeof(buf) - len, + "- total hitroll %d out of range (limit +/-%d).\r\n", tohit, MAX_APPLY_HITROLL_TOTAL); - - + + for (ext2 = NULL, ext = obj->ex_description; ext; ext = ext->next) if (strncmp(ext->description, " ", 3)) ext2 = ext; - + if (ext2 && (found = 1)) - len += snprintf(buf + len, sizeof(buf) - len, + len += snprintf(buf + len, sizeof(buf) - len, "- has unformatted extra description\r\n"); /*****ADDITIONAL OBJ CHECKS HERE*****/ if (found) { @@ -3705,7 +3705,7 @@ ACMD (do_zcheck) exroom=world[i].dir_option[j]->to_room; if (exroom==NOWHERE) continue; - if (world[exroom].zone == zrnum) + if (world[exroom].zone == zrnum) continue; if (world[exroom].zone == world[i].zone) continue; @@ -3716,7 +3716,7 @@ ACMD (do_zcheck) "- Exit %s cannot connect to %d (zone off limits).\r\n", dirs[j], world[exroom].number); } /* for (k.. */ - } /* cycle directions */ + } /* cycle directions */ if (ROOM_FLAGGED(i, ROOM_ATRIUM | ROOM_HOUSE | ROOM_HOUSE_CRASH | ROOM_OLC | ROOM_BFS_MARK)) len += snprintf(buf + len, sizeof(buf) - len, @@ -3727,54 +3727,54 @@ ACMD (do_zcheck) ROOM_FLAGGED(i, ROOM_OLC) ? "OLC" : "", ROOM_FLAGGED(i, ROOM_BFS_MARK) ? "*" : ""); - if ((MIN_ROOM_DESC_LENGTH) && strlen(world[i].description)MAX_COLOUMN_WIDTH) && (found=1)) - len += snprintf(buf + len, sizeof(buf) - len, + len += snprintf(buf + len, sizeof(buf) - len, "- Room description not wrapped at %d chars (/fi in the editor).\r\n", MAX_COLOUMN_WIDTH); - + for (ext2 = NULL, ext = world[i].ex_description; ext; ext = ext->next) if (strncmp(ext->description, " ", 3)) ext2 = ext; if (ext2 && (found = 1)) - len += snprintf(buf + len, sizeof(buf) - len, + len += snprintf(buf + len, sizeof(buf) - len, "- has unformatted extra description\r\n"); if (found) { - send_to_char(ch, "[%5d] %-30s: \r\n", + send_to_char(ch, "[%5d] %-30s: \r\n", world[i].number, world[i].name ? world[i].name : "An unnamed room"); send_to_char(ch, buf); strcpy(buf, ""); len = 0; found = 0; - } + } } /*is room in this zone?*/ - } /*checking rooms*/ + } /*checking rooms*/ for (i=0; i m) + if (l * 3 > m) send_to_char(ch, "More than 1/3 of the rooms are not linked.\r\n"); - + } /**********************************************************************************/ @@ -3783,16 +3783,16 @@ void mob_checkload(struct char_data *ch, mob_vnum mvnum) int cmd_no; zone_rnum zone; mob_rnum mrnum = real_mobile(mvnum); - + if (mrnum == NOBODY) { send_to_char(ch, "That mob does not exist.\r\n"); return; } - send_to_char(ch, "Checking load info for the mob %s...\r\n", + send_to_char(ch, "Checking load info for the mob %s...\r\n", mob_proto[mrnum].player.short_descr); - for (zone=0; zone <= top_of_zone_table; zone++) { + for (zone=0; zone <= top_of_zone_table; zone++) { for (cmd_no = 0; ZCMD2.command != 'S'; cmd_no++) { if (ZCMD2.command != 'M') continue; @@ -3821,11 +3821,11 @@ void obj_checkload(struct char_data *ch, obj_vnum ovnum) send_to_char(ch, "That object does not exist.\r\n"); return; } - - send_to_char(ch, "Checking load info for the obj %s...\r\n", + + send_to_char(ch, "Checking load info for the obj %s...\r\n", obj_proto[ornum].short_description); - for (zone=0; zone <= top_of_zone_table; zone++) { + for (zone=0; zone <= top_of_zone_table; zone++) { for (cmd_no = 0; ZCMD2.command != 'S'; cmd_no++) { switch (ZCMD2.command) { case 'M': @@ -3836,9 +3836,9 @@ void obj_checkload(struct char_data *ch, obj_vnum ovnum) case 'O': /* read an object */ lastroom_v = world[ZCMD2.arg3].number; lastroom_r = ZCMD2.arg3; - if (ZCMD2.arg1 == ornum) + if (ZCMD2.arg1 == ornum) send_to_char(ch, " [%5d] %s (%d Max)\r\n", - lastroom_v, + lastroom_v, world[lastroom_r].name, ZCMD2.arg2); break; @@ -3873,7 +3873,7 @@ void obj_checkload(struct char_data *ch, obj_vnum ovnum) if (ZCMD2.arg2 == ornum) send_to_char(ch, " [%5d] %s (Removed from room)\r\n", lastroom_v, - world[lastroom_r].name); + world[lastroom_r].name); break; }/* switch */ } /*for cmd_no......*/ @@ -3890,18 +3890,18 @@ void trg_checkload(struct char_data *ch, trig_vnum tvnum) mob_rnum lastmob_r = 0, i; obj_rnum lastobj_r = 0, j; struct trig_proto_list *tpl; - + if (trnum == NOTHING) { send_to_char(ch, "That trigger does not exist.\r\n"); return; } - - send_to_char(ch, "Checking load info for the %s trigger '%s':\r\n", + + send_to_char(ch, "Checking load info for the %s trigger '%s':\r\n", trig_index[trnum]->proto->attach_type == MOB_TRIGGER ? "mobile" : - (trig_index[trnum]->proto->attach_type == OBJ_TRIGGER ? "object" : "room"), + (trig_index[trnum]->proto->attach_type == OBJ_TRIGGER ? "object" : "room"), trig_index[trnum]->proto->name); - for (zone=0; zone <= top_of_zone_table; zone++) { + for (zone=0; zone <= top_of_zone_table; zone++) { for (cmd_no = 0; ZCMD2.command != 'S'; cmd_no++) { switch (ZCMD2.command) { case 'M': @@ -3935,29 +3935,29 @@ void trg_checkload(struct char_data *ch, trig_vnum tvnum) send_to_char(ch, "mob [%5d] %-60s (zedit room %5d)\r\n", mob_index[lastmob_r].vnum, mob_proto[lastmob_r].player.short_descr, - lastroom_v); + lastroom_v); found = 1; } else if (ZCMD2.arg1 == OBJ_TRIGGER) { send_to_char(ch, "obj [%5d] %-60s (zedit room %d)\r\n", obj_index[lastobj_r].vnum, obj_proto[lastobj_r].short_description, - lastroom_v); + lastroom_v); found = 1; } else if (ZCMD2.arg1==WLD_TRIGGER) { send_to_char(ch, "room [%5d] %-60s (zedit)\r\n", lastroom_v, - world[lastroom_r].name); + world[lastroom_r].name); found = 1; } break; } /* switch */ } /*for cmd_no......*/ } /*for zone...*/ - + for (i = 0; i < top_of_mobt; i++) { if (!mob_proto[i].proto_script) continue; - + for (tpl = mob_proto[i].proto_script;tpl;tpl = tpl->next) if (tpl->vnum == tvnum) { send_to_char(ch, "mob [%5d] %s\r\n", @@ -3965,13 +3965,13 @@ void trg_checkload(struct char_data *ch, trig_vnum tvnum) mob_proto[i].player.short_descr); found = 1; } - + } - + for (j = 0; j < top_of_objt; j++) { if (!obj_proto[j].proto_script) continue; - + for (tpl = obj_proto[j].proto_script;tpl;tpl = tpl->next) if (tpl->vnum == tvnum) { send_to_char(ch, "obj [%5d] %s\r\n", @@ -3979,9 +3979,9 @@ void trg_checkload(struct char_data *ch, trig_vnum tvnum) obj_proto[j].short_description); found = 1; } - + } - + for (k = 0;k < top_of_world; k++) { if (!world[k].proto_script) continue; @@ -4000,7 +4000,7 @@ void trg_checkload(struct char_data *ch, trig_vnum tvnum) } ACMD(do_checkloadstatus) -{ +{ char buf1[MAX_INPUT_LENGTH], buf2[MAX_INPUT_LENGTH]; two_arguments(argument, buf1, buf2); @@ -4008,19 +4008,19 @@ ACMD(do_checkloadstatus) if ((!*buf1) || (!*buf2) || (!isdigit(*buf2))) { send_to_char(ch, "Checkload \r\n"); return; - } + } - if (LOWER(*buf1) == 'm') { + if (LOWER(*buf1) == 'm') { mob_checkload(ch, atoi(buf2)); return; } - - if (LOWER(*buf1) == 'o') { + + if (LOWER(*buf1) == 'o') { obj_checkload(ch, atoi(buf2)); return; } - if (LOWER(*buf1) == 't') { + if (LOWER(*buf1) == 't') { trg_checkload(ch, atoi(buf2)); return; } @@ -4036,14 +4036,14 @@ ACMD(do_copyover) FILE *fp; struct descriptor_data *d, *d_next; char buf [100], buf2[100]; - + fp = fopen (COPYOVER_FILE, "w"); if (!fp) { send_to_char (ch, "Copyover file not writeable, aborted.\n\r"); return; } - /* + /* * Uncomment if you use OasisOLC2.0, this saves all OLC modules: save_all(); * @@ -4052,7 +4052,7 @@ ACMD(do_copyover) /* write boot_time as first line in file */ fprintf(fp, "%ld\n", boot_time); - + /* For each playing descriptor, save its state */ for (d = descriptor_list; d ; d = d_next) { struct char_data * och = d->character; @@ -4092,7 +4092,7 @@ ACMD(do_copyover) exit (1); /* too much trouble to try to recover! */ } -ACMD(do_peace) +ACMD(do_peace) { struct char_data *vict, *next_v; @@ -4114,7 +4114,7 @@ ACMD(do_zpurge) char arg[MAX_INPUT_LENGTH]; int purge_all = FALSE; one_argument(argument, arg); - if (*arg == '.' || !*arg) { + if (*arg == '.' || !*arg) { zone = world[IN_ROOM(ch)].zone; vzone = zone_table[zone].number; } @@ -4131,13 +4131,13 @@ ACMD(do_zpurge) } else { send_to_char(ch, "That isn't a valid zone number!\r\n"); - return; + return; } if (GET_LEVEL(ch) < LVL_GOD && !can_edit_zone(ch, zone)) { send_to_char(ch, "You can only purge your own zone!\r\n"); return; } - if (!purge_all) { + if (!purge_all) { for (vroom = zone_table[zone].bot; vroom <= zone_table[zone].top; vroom++) { purge_room(real_room(vroom)); } diff --git a/src/aedit.c b/src/aedit.c index de632a3..effdb2d 100644 --- a/src/aedit.c +++ b/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); } diff --git a/src/alias.c b/src/alias.c index 4a206a4..a23788f 100644 --- a/src/alias.c +++ b/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; } - } - + } + } diff --git a/src/bsd-snprintf.c b/src/bsd-snprintf.c index cd9f236..0cba71c 100644 --- a/src/bsd-snprintf.c +++ b/src/bsd-snprintf.c @@ -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 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 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 = ""; 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++; } diff --git a/src/cedit.c b/src/cedit.c index 2d252d1..4920cd3 100644 --- a/src/cedit.c +++ b/src/cedit.c @@ -40,19 +40,19 @@ ACMD(do_oasis_cedit) { struct descriptor_data *d; char buf1[MAX_STRING_LENGTH]; - + /****************************************************************************/ /** Parse any arguments. **/ /****************************************************************************/ one_argument(argument, buf1); - + if (GET_LEVEL(ch) < LVL_IMPL) { send_to_char(ch, "You can't modify the game configuration.\r\n"); return; } - + d = ch->desc; - + if (!*buf1) { CREATE(d->olc, struct oasis_olc_data, 1); OLC_ZONE(d) = 0; @@ -60,19 +60,19 @@ ACMD(do_oasis_cedit) STATE(d) = CON_CEDIT; act("$n starts using OLC.", TRUE, d->character, 0, 0, TO_ROOM); SET_BIT(PLR_FLAGS(ch), PLR_WRITING); - - mudlog(BRF, LVL_IMMORT, TRUE, + + mudlog(BRF, LVL_IMMORT, TRUE, "OLC: %s starts editing the game configuration.", GET_NAME(ch)); return; } else if (str_cmp("save", buf1) != 0) { send_to_char(ch, "Yikes! Stop that, someone will get hurt!\r\n"); return; } - + send_to_char(ch, "Saving the game configuration.\r\n"); - mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, + mudlog(CMP, MAX(LVL_BUILDER, GET_INVIS_LEV(ch)), TRUE, "OLC: %s saves the game configuration.", GET_NAME(ch)); - + cedit_save_to_disk(); } @@ -84,7 +84,7 @@ void cedit_setup(struct descriptor_data *d) /** Create the config_data struct. **/ /****************************************************************************/ CREATE(OLC_CONFIG(d), struct config_data, 1); - + /****************************************************************************/ /** Copy the current configuration from the config_info to this one. **/ /****************************************************************************/ @@ -107,7 +107,7 @@ void cedit_setup(struct descriptor_data *d) OLC_CONFIG(d)->play.load_into_inventory = CONFIG_LOAD_INVENTORY; OLC_CONFIG(d)->play.track_through_doors = CONFIG_TRACK_T_DOORS; OLC_CONFIG(d)->play.immort_level_ok = CONFIG_IMMORT_LEVEL_OK; - + /****************************************************************************/ /** Crash Saves **/ /****************************************************************************/ @@ -118,7 +118,7 @@ void cedit_setup(struct descriptor_data *d) OLC_CONFIG(d)->csd.autosave_time = CONFIG_AUTOSAVE_TIME; OLC_CONFIG(d)->csd.crash_file_timeout = CONFIG_CRASH_TIMEOUT; OLC_CONFIG(d)->csd.rent_file_timeout = CONFIG_RENT_TIMEOUT; - + /****************************************************************************/ /** Room Numbers **/ /****************************************************************************/ @@ -128,7 +128,7 @@ void cedit_setup(struct descriptor_data *d) OLC_CONFIG(d)->room_nums.donation_room_1 = CONFIG_DON_ROOM_1; OLC_CONFIG(d)->room_nums.donation_room_2 = CONFIG_DON_ROOM_2; OLC_CONFIG(d)->room_nums.donation_room_3 = CONFIG_DON_ROOM_3; - + /****************************************************************************/ /** Game Operation **/ /****************************************************************************/ @@ -140,26 +140,26 @@ void cedit_setup(struct descriptor_data *d) OLC_CONFIG(d)->operation.use_new_socials = CONFIG_NEW_SOCIALS; OLC_CONFIG(d)->operation.auto_save_olc = CONFIG_OLC_SAVE; OLC_CONFIG(d)->operation.nameserver_is_slow = CONFIG_NS_IS_SLOW; - + /****************************************************************************/ /** Autowiz **/ /****************************************************************************/ OLC_CONFIG(d)->autowiz.use_autowiz = CONFIG_USE_AUTOWIZ; OLC_CONFIG(d)->autowiz.min_wizlist_lev = CONFIG_MIN_WIZLIST_LEV; - - + + /****************************************************************************/ /** Allocate space for the strings. **/ /****************************************************************************/ OLC_CONFIG(d)->play.OK = str_udup(CONFIG_OK); OLC_CONFIG(d)->play.NOPERSON = str_udup(CONFIG_NOPERSON); OLC_CONFIG(d)->play.NOEFFECT = str_udup(CONFIG_NOEFFECT); - + if (CONFIG_DFLT_IP) OLC_CONFIG(d)->operation.DFLT_IP = strdup(CONFIG_DFLT_IP); else OLC_CONFIG(d)->operation.DFLT_IP = NULL; - + if (CONFIG_DFLT_DIR) OLC_CONFIG(d)->operation.DFLT_DIR = strdup(CONFIG_DFLT_DIR); else @@ -169,22 +169,22 @@ void cedit_setup(struct descriptor_data *d) OLC_CONFIG(d)->operation.LOGNAME = strdup(CONFIG_LOGNAME); else OLC_CONFIG(d)->operation.LOGNAME = NULL; - + if (CONFIG_MENU) OLC_CONFIG(d)->operation.MENU = strdup(CONFIG_MENU); else OLC_CONFIG(d)->operation.MENU = NULL; - + if (CONFIG_WELC_MESSG) OLC_CONFIG(d)->operation.WELC_MESSG = strdup(CONFIG_WELC_MESSG); else OLC_CONFIG(d)->operation.WELC_MESSG = NULL; - + if (CONFIG_START_MESSG) OLC_CONFIG(d)->operation.START_MESSG = strdup(CONFIG_START_MESSG); else OLC_CONFIG(d)->operation.START_MESSG = NULL; - + cedit_disp_menu(d); } @@ -213,7 +213,7 @@ void cedit_save_internally(struct descriptor_data *d) CONFIG_LOAD_INVENTORY = OLC_CONFIG(d)->play.load_into_inventory; CONFIG_TRACK_T_DOORS = OLC_CONFIG(d)->play.track_through_doors; CONFIG_IMMORT_LEVEL_OK = OLC_CONFIG(d)->play.immort_level_ok; - + /****************************************************************************/ /** Crash Saves **/ /****************************************************************************/ @@ -224,7 +224,7 @@ void cedit_save_internally(struct descriptor_data *d) CONFIG_AUTOSAVE_TIME = OLC_CONFIG(d)->csd.autosave_time; CONFIG_CRASH_TIMEOUT = OLC_CONFIG(d)->csd.crash_file_timeout; CONFIG_RENT_TIMEOUT = OLC_CONFIG(d)->csd.rent_file_timeout; - + /****************************************************************************/ /** Room Numbers **/ /****************************************************************************/ @@ -234,7 +234,7 @@ void cedit_save_internally(struct descriptor_data *d) CONFIG_DON_ROOM_1 = OLC_CONFIG(d)->room_nums.donation_room_1; CONFIG_DON_ROOM_2 = OLC_CONFIG(d)->room_nums.donation_room_2; CONFIG_DON_ROOM_3 = OLC_CONFIG(d)->room_nums.donation_room_3; - + /****************************************************************************/ /** Game Operation **/ /****************************************************************************/ @@ -243,39 +243,39 @@ void cedit_save_internally(struct descriptor_data *d) CONFIG_MAX_FILESIZE = OLC_CONFIG(d)->operation.max_filesize; CONFIG_MAX_BAD_PWS = OLC_CONFIG(d)->operation.max_bad_pws; CONFIG_SITEOK_ALL = OLC_CONFIG(d)->operation.siteok_everyone; - CONFIG_NEW_SOCIALS = OLC_CONFIG(d)->operation.use_new_socials; + CONFIG_NEW_SOCIALS = OLC_CONFIG(d)->operation.use_new_socials; CONFIG_NS_IS_SLOW = OLC_CONFIG(d)->operation.nameserver_is_slow; CONFIG_OLC_SAVE = OLC_CONFIG(d)->operation.auto_save_olc; - + /****************************************************************************/ /** Autowiz **/ /****************************************************************************/ CONFIG_USE_AUTOWIZ = OLC_CONFIG(d)->autowiz.use_autowiz; CONFIG_MIN_WIZLIST_LEV = OLC_CONFIG(d)->autowiz.min_wizlist_lev; - + /****************************************************************************/ /** Allocate space for the strings. **/ /****************************************************************************/ if (CONFIG_OK) free(CONFIG_OK); CONFIG_OK = str_udup(OLC_CONFIG(d)->play.OK); - + if (CONFIG_NOPERSON) free(CONFIG_NOPERSON); CONFIG_NOPERSON = str_udup(OLC_CONFIG(d)->play.NOPERSON); - + if (CONFIG_NOEFFECT) free(CONFIG_NOEFFECT); CONFIG_NOEFFECT = str_udup(OLC_CONFIG(d)->play.NOEFFECT); - + if (CONFIG_DFLT_IP) free(CONFIG_DFLT_IP); if (OLC_CONFIG(d)->operation.DFLT_IP) CONFIG_DFLT_IP = strdup(OLC_CONFIG(d)->operation.DFLT_IP); else CONFIG_DFLT_IP = NULL; - - + + if (CONFIG_DFLT_DIR) free(CONFIG_DFLT_DIR); if (OLC_CONFIG(d)->operation.DFLT_DIR) @@ -289,28 +289,28 @@ void cedit_save_internally(struct descriptor_data *d) CONFIG_LOGNAME = strdup(OLC_CONFIG(d)->operation.LOGNAME); else CONFIG_LOGNAME = NULL; - + if (CONFIG_MENU) free(CONFIG_MENU); if (OLC_CONFIG(d)->operation.MENU) CONFIG_MENU = strdup(OLC_CONFIG(d)->operation.MENU); else CONFIG_MENU = NULL; - + if (CONFIG_WELC_MESSG) free(CONFIG_WELC_MESSG); if (OLC_CONFIG(d)->operation.WELC_MESSG) CONFIG_WELC_MESSG = strdup(OLC_CONFIG(d)->operation.WELC_MESSG); else CONFIG_WELC_MESSG = NULL; - + if (CONFIG_START_MESSG) free(CONFIG_START_MESSG); if (OLC_CONFIG(d)->operation.START_MESSG) CONFIG_START_MESSG = strdup(OLC_CONFIG(d)->operation.START_MESSG); else CONFIG_START_MESSG = NULL; - + /* if we changed the dts to/from dumps, reassign - Welcor */ if (reassign) reassign_rooms(); @@ -334,13 +334,13 @@ int save_config( IDXTYPE nowhere ) { FILE *fl; char buf[MAX_STRING_LENGTH]; - + if (!(fl = fopen(CONFIG_CONFFILE, "w"))) { perror("SYSERR: save_config"); return (FALSE); } - - fprintf(fl, + + fprintf(fl, "* This file is autogenerated by OasisOLC (CEdit).\n" "* Please note the following information about this file's format.\n" "*\n" @@ -353,7 +353,7 @@ int save_config( IDXTYPE nowhere ) "* -----------------------------------------------------------------------\n\n" "* [ Game Play Options ]\n" ); - + fprintf(fl, "* Is player killing allowed on the mud?\n" "pk_allowed = %d\n\n", CONFIG_PK_ALLOWED); fprintf(fl, "* Is player thieving allowed on the mud?\n" @@ -386,63 +386,63 @@ int save_config( IDXTYPE nowhere ) "track_through_doors = %d\n\n", CONFIG_TRACK_T_DOORS); fprintf(fl, "* Should players who reach enough exp automatically level to immortal?\n" "immort_level_ok = %d\n\n", CONFIG_IMMORT_LEVEL_OK); - + strcpy(buf, CONFIG_OK); strip_cr(buf); - + fprintf(fl, "* Text sent to players when OK is all that is needed.\n" "ok = %s\n\n", buf); - + strcpy(buf, CONFIG_NOPERSON); - strip_cr(buf); - + strip_cr(buf); + fprintf(fl, "* Text sent to players when noone is available.\n" "noperson = %s\n\n", buf); - + strcpy(buf, CONFIG_NOEFFECT); strip_cr(buf); - + fprintf(fl, "* Text sent to players when an effect fails.\n" "noeffect = %s\n", buf); - - - + + + /************************************************************************ ** RENT / CRASHSAVE OPTIONS ** ************************************************************************/ fprintf(fl, "\n\n\n* [ Rent/Crashsave Options ]\n"); - + fprintf(fl, "* Should the MUD allow you to 'rent' for free? (i.e. if you just quit,\n" "* your objects are saved at no cost, as in Merc-type MUDs.)\n" "free_rent = %d\n\n", CONFIG_FREE_RENT); - + fprintf(fl, "* Maximum number of items players are allowed to rent.\n" "max_obj_save = %d\n\n", CONFIG_MAX_OBJ_SAVE); - + fprintf(fl, "* Should the game automatically save people?\n" "auto_save = %d\n\n", CONFIG_AUTO_SAVE); - + fprintf(fl, "* If auto_save = 1, how often (in minutes) should the game save people's objects?\n" "autosave_time = %d\n\n", CONFIG_AUTOSAVE_TIME); - + fprintf(fl, "* Lifetime of crashfiles and force-rent (idlesave) files in days.\n" "crash_file_timeout = %d\n\n", CONFIG_CRASH_TIMEOUT); - + fprintf(fl, "* Lifetime of normal rent files in days.\n" "rent_file_timeout = %d\n\n", CONFIG_RENT_TIMEOUT); - - + + /************************************************************************ ** ROOM NUMBERS ** ************************************************************************/ fprintf(fl, "\n\n\n* [ Room Numbers ]\n"); - + fprintf(fl, "* The virtual number of the room that mortals should enter at.\n" "mortal_start_room = %d\n\n", CONFIG_MORTAL_START); - + fprintf(fl, "* The virtual number of the room that immorts should enter at.\n" "immort_start_room = %d\n\n", CONFIG_IMMORTAL_START); - + fprintf(fl, "* The virtual number of the room that frozen people should enter at.\n" "frozen_start_room = %d\n\n", CONFIG_FROZEN_START); @@ -455,10 +455,10 @@ int save_config( IDXTYPE nowhere ) CONFIG_DON_ROOM_1 != NOWHERE ? CONFIG_DON_ROOM_1 : -1, CONFIG_DON_ROOM_2 != NOWHERE ? CONFIG_DON_ROOM_2 : -1, CONFIG_DON_ROOM_3 != NOWHERE ? CONFIG_DON_ROOM_3 : -1); - - + + fprintf(fl, "\n\n\n* [ Game Operation Options ]\n"); - + fprintf(fl, "* This is the default port on which the game should run if no port is\n" "* given on the command-line. NOTE WELL: If you're using the\n" "* 'autorun' script, the port number there will override this setting.\n" @@ -466,46 +466,46 @@ int save_config( IDXTYPE nowhere ) "* changing this.\n" "DFLT_PORT = %d\n\n", CONFIG_DFLT_PORT); - + if (CONFIG_DFLT_IP) { strcpy(buf, CONFIG_DFLT_IP); strip_cr(buf); - + fprintf(fl, "* IP address to which the MUD should bind.\nDFLT_IP = %s\n\n", buf); } - + if (CONFIG_DFLT_DIR) { strcpy(buf, CONFIG_DFLT_DIR); strip_cr(buf); - + fprintf(fl, "* default directory to use as data directory.\n" "DFLT_DIR = %s\n\n", buf); } - + if (CONFIG_LOGNAME) { strcpy(buf, CONFIG_LOGNAME); strip_cr(buf); - + fprintf(fl, "* What file to log messages to (ex: 'log/syslog').\n" "LOGNAME = %s\n\n", buf); } - + fprintf(fl, "* Maximum number of players allowed before game starts to turn people away.\n" "max_playing = %d\n\n", CONFIG_MAX_PLAYING); - + fprintf(fl, "* Maximum size of bug, typo, and idea files in bytes (to prevent bombing).\n" "max_filesize = %d\n\n", CONFIG_MAX_FILESIZE); - + fprintf(fl, "* Maximum number of password attempts before disconnection.\n" "max_bad_pws = %d\n\n", CONFIG_MAX_BAD_PWS); - + fprintf(fl, "* Is the site ok for everyone except those that are banned?\n" "siteok_everyone = %d\n\n", CONFIG_SITEOK_ALL); - + fprintf(fl, "* If you want to use the original social file format\n" "* and disable Aedit, set to 0, otherwise, 1.\n" "use_new_socials = %d\n\n", @@ -514,7 +514,7 @@ int save_config( IDXTYPE nowhere ) fprintf(fl, "* If the nameserver is fast, set to 0, otherwise, 1.\n" "nameserver_is_slow = %d\n\n", CONFIG_NS_IS_SLOW); - + fprintf(fl, "* Should OLC autosave to disk (1) or save internally (0).\n" "auto_save_olc = %d\n\n", CONFIG_OLC_SAVE); @@ -522,52 +522,52 @@ int save_config( IDXTYPE nowhere ) if (CONFIG_MENU) { strcpy(buf, CONFIG_MENU); strip_cr(buf); - + fprintf(fl, "* The entrance/exit menu.\n" "MENU = \n%s~\n\n", buf); } - + if (CONFIG_WELC_MESSG) { strcpy(buf, CONFIG_WELC_MESSG); strip_cr(buf); - + fprintf(fl, "* The welcome message.\nWELC_MESSG = \n%s~\n\n", buf); } - + if (CONFIG_START_MESSG) { strcpy(buf, CONFIG_START_MESSG); strip_cr(buf); - + fprintf(fl, "* NEWBIE start message.\n" "START_MESSG = \n%s~\n\n", buf); } - + fprintf(fl, "\n\n\n* [ Autowiz Options ]\n"); - + fprintf(fl, "* Should the game automatically create a new wizlist/immlist every time\n" "* someone immorts, or is promoted to a higher (or lower) god level?\n" "use_autowiz = %d\n\n", CONFIG_USE_AUTOWIZ); - + fprintf(fl, "* If yes, what is the lowest level which should be on the wizlist?\n" "min_wizlist_lev = %d\n\n", CONFIG_MIN_WIZLIST_LEV); - - + + fclose(fl); - + if (in_save_list(NOWHERE, SL_CFG)) remove_from_save_list(NOWHERE, SL_CFG); - + return (TRUE); } /************************************************************************** - Menu functions + Menu functions **************************************************************************/ /* - * the main menu + * the main menu */ void cedit_disp_menu(struct descriptor_data *d) { @@ -577,7 +577,7 @@ void cedit_disp_menu(struct descriptor_data *d) /* * Menu header */ - write_to_output(d, + write_to_output(d, "OasisOLC MUD Configuration Editor\r\n" "%sG%s) Game Play Options\r\n" "%sC%s) Crashsave/Rent Options\r\n" @@ -586,7 +586,7 @@ void cedit_disp_menu(struct descriptor_data *d) "%sA%s) Autowiz Options\r\n" "%sQ%s) Quit\r\n" "Enter your choice : ", - + grn, nrm, grn, nrm, grn, nrm, @@ -603,7 +603,7 @@ void cedit_disp_game_play_options(struct descriptor_data *d) { get_char_colors(d->character); clear_screen(d); - + write_to_output(d, "\r\n\r\n" "%sA%s) Player Killing Allowed : %s%s\r\n" "%sB%s) Player Thieving Allowed : %s%s\r\n" @@ -643,11 +643,11 @@ void cedit_disp_game_play_options(struct descriptor_data *d) grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.load_into_inventory), grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.track_through_doors), grn, nrm, cyn, CHECK_VAR(OLC_CONFIG(d)->play.immort_level_ok), - + grn, nrm, cyn, OLC_CONFIG(d)->play.OK, grn, nrm, cyn, OLC_CONFIG(d)->play.NOPERSON, grn, nrm, cyn, OLC_CONFIG(d)->play.NOEFFECT, - + grn, nrm ); @@ -660,7 +660,7 @@ void cedit_disp_crash_save_options(struct descriptor_data *d) { get_char_colors(d->character); clear_screen(d); - + write_to_output(d, "\r\n\r\n" "%sA%s) Free Rent : %s%s\r\n" "%sB%s) Max Objects Saved : %s%d\r\n" @@ -680,7 +680,7 @@ void cedit_disp_crash_save_options(struct descriptor_data *d) grn, nrm, cyn, OLC_CONFIG(d)->csd.rent_file_timeout, grn, nrm ); - + OLC_MODE(d) = CEDIT_CRASHSAVE_OPTIONS_MENU; } @@ -690,7 +690,7 @@ void cedit_disp_room_numbers(struct descriptor_data *d) { get_char_colors(d->character); clear_screen(d); - + write_to_output(d, "\r\n\r\n" "%sA%s) Mortal Start Room : %s%d\r\n" "%sB%s) Immortal Start Room : %s%d\r\n" @@ -708,7 +708,7 @@ void cedit_disp_room_numbers(struct descriptor_data *d) grn, nrm, cyn, OLC_CONFIG(d)->room_nums.donation_room_3, grn, nrm ); - + OLC_MODE(d) = CEDIT_ROOM_NUMBERS_MENU; } @@ -719,7 +719,7 @@ void cedit_disp_operation_options(struct descriptor_data *d) { get_char_colors(d->character); clear_screen(d); - + write_to_output(d, "\r\n\r\n" "%sA%s) Default Port : %s%d\r\n" "%sB%s) Default IP : %s%s\r\n" @@ -753,10 +753,10 @@ void cedit_disp_operation_options(struct descriptor_data *d) grn, nrm, cyn, OLC_CONFIG(d)->operation.START_MESSG ? OLC_CONFIG(d)->operation.START_MESSG : "", grn, nrm ); - + OLC_MODE(d) = CEDIT_OPERATION_OPTIONS_MENU; } - + /*-------------------------------------------------------------------*/ @@ -764,7 +764,7 @@ void cedit_disp_autowiz_options(struct descriptor_data *d) { get_char_colors(d->character); clear_screen(d); - + write_to_output(d, "\r\n\r\n" "%sA%s) Use the autowiz : %s%s\r\n" "%sB%s) Minimum wizlist level : %s%d\r\n" @@ -774,7 +774,7 @@ void cedit_disp_autowiz_options(struct descriptor_data *d) grn, nrm, cyn, OLC_CONFIG(d)->autowiz.min_wizlist_lev, grn, nrm ); - + OLC_MODE(d) = CEDIT_AUTOWIZ_OPTIONS_MENU; } @@ -787,14 +787,14 @@ void cedit_disp_autowiz_options(struct descriptor_data *d) void cedit_parse(struct descriptor_data *d, char *arg) { char *oldtext = NULL; - + switch (OLC_MODE(d)) { case CEDIT_CONFIRM_SAVESTRING: switch (*arg) { case 'y': case 'Y': cedit_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 modifies the game configuration.", GET_NAME(d->character)); cleanup_olc(d, CLEANUP_CONFIG); if (CONFIG_AUTO_SAVE) { @@ -813,9 +813,9 @@ void cedit_parse(struct descriptor_data *d, char *arg) write_to_output(d, "Do you wish to save the configuration? (y/n) : "); return; } - + /*-------------------------------------------------------------------*/ - + case CEDIT_MAIN_MENU: switch (*arg) { case 'g': @@ -823,44 +823,44 @@ void cedit_parse(struct descriptor_data *d, char *arg) cedit_disp_game_play_options(d); OLC_MODE(d) = CEDIT_GAME_OPTIONS_MENU; break; - + case 'c': case 'C': cedit_disp_crash_save_options(d); OLC_MODE(d) = CEDIT_CRASHSAVE_OPTIONS_MENU; break; - + case 'r': case 'R': cedit_disp_room_numbers(d); OLC_MODE(d) = CEDIT_ROOM_NUMBERS_MENU; break; - + case 'o': case 'O': cedit_disp_operation_options(d); OLC_MODE(d) = CEDIT_OPERATION_OPTIONS_MENU; break; - + case 'a': case 'A': cedit_disp_autowiz_options(d); OLC_MODE(d) = CEDIT_AUTOWIZ_OPTIONS_MENU; break; - + case 'q': case 'Q': write_to_output(d, "Do you wish to save the configuration? (y/n) : "); OLC_MODE(d) = CEDIT_CONFIRM_SAVESTRING; break; - + default: write_to_output(d, "That is an invalid choice!\r\n"); cedit_disp_menu(d); break; } break; - + /*-------------------------------------------------------------------*/ @@ -870,178 +870,178 @@ void cedit_parse(struct descriptor_data *d, char *arg) case 'A': TOGGLE_VAR(OLC_CONFIG(d)->play.pk_allowed); break; - + case 'b': case 'B': TOGGLE_VAR(OLC_CONFIG(d)->play.pt_allowed); break; - + case 'c': case 'C': write_to_output(d, "Enter the minimum level a player must be to shout, gossip, etc : "); OLC_MODE(d) = CEDIT_LEVEL_CAN_SHOUT; return; - + case 'd': case 'D': write_to_output(d, "Enter the amount it costs (in move points) to holler : "); OLC_MODE(d) = CEDIT_HOLLER_MOVE_COST; return; - + case 'e': case 'E': write_to_output(d, "Enter the maximum number of people allowed in a tunnel : "); OLC_MODE(d) = CEDIT_TUNNEL_SIZE; return; - + case 'f': case 'F': write_to_output(d, "Enter the maximum gain of experience per kill for players : "); OLC_MODE(d) = CEDIT_MAX_EXP_GAIN; return; - + case 'g': case 'G': write_to_output(d, "Enter the maximum loss of experience per death for players : "); OLC_MODE(d) = CEDIT_MAX_EXP_LOSS; return; - + case 'h': case 'H': write_to_output(d, "Enter the number of tics before NPC corpses decompose : "); OLC_MODE(d) = CEDIT_MAX_NPC_CORPSE_TIME; return; - + case 'i': case 'I': write_to_output(d, "Enter the number of tics before PC corpses decompose : "); OLC_MODE(d) = CEDIT_MAX_PC_CORPSE_TIME; return; - + case 'j': case 'J': write_to_output(d, "Enter the number of tics before PC's are sent to the void (idle) : "); OLC_MODE(d) = CEDIT_IDLE_VOID; return; - + case 'k': case 'K': write_to_output(d, "Enter the number of tics before PC's are automatically rented and forced to quit : "); OLC_MODE(d) = CEDIT_IDLE_RENT_TIME; return; - + case 'l': case 'L': write_to_output(d, "Enter the level a player must be to become immune to IDLE : "); OLC_MODE(d) = CEDIT_IDLE_MAX_LEVEL; return; - + case 'm': case 'M': TOGGLE_VAR(OLC_CONFIG(d)->play.dts_are_dumps); break; - + case 'n': case 'N': TOGGLE_VAR(OLC_CONFIG(d)->play.load_into_inventory); break; - + case 'o': case 'O': TOGGLE_VAR(OLC_CONFIG(d)->play.track_through_doors); break; - + case 'p': case 'P': TOGGLE_VAR(OLC_CONFIG(d)->play.immort_level_ok); break; - + case '1': write_to_output(d, "Enter the OK message : "); OLC_MODE(d) = CEDIT_OK; return; - + case '2': write_to_output(d, "Enter the NOPERSON message : "); OLC_MODE(d) = CEDIT_NOPERSON; return; - + case '3': write_to_output(d, "Enter the NOEFFECT message : "); OLC_MODE(d) = CEDIT_NOEFFECT; return; - + case 'q': case 'Q': cedit_disp_menu(d); return; - + default: write_to_output(d, "\r\nThat is an invalid choice!\r\n"); cedit_disp_game_play_options(d); } - + cedit_disp_game_play_options(d); return; - + /*-------------------------------------------------------------------*/ - + case CEDIT_CRASHSAVE_OPTIONS_MENU: switch (*arg) { case 'a': case 'A': TOGGLE_VAR(OLC_CONFIG(d)->csd.free_rent); break; - + case 'b': case 'B': write_to_output(d, "Enter the maximum number of items players can rent : "); OLC_MODE(d) = CEDIT_MAX_OBJ_SAVE; return; - + case 'c': case 'C': write_to_output(d, "Enter the surcharge on top of item costs : "); OLC_MODE(d) = CEDIT_MIN_RENT_COST; return; - + case 'd': case 'D': TOGGLE_VAR(OLC_CONFIG(d)->csd.auto_save); break; - + case 'e': case 'E': write_to_output(d, "Enter how often (in minutes) should the MUD save players : "); OLC_MODE(d) = CEDIT_AUTOSAVE_TIME; return; - + case 'f': case 'F': write_to_output(d, "Enter the lifetime of crash and idlesave files (days) : "); OLC_MODE(d) = CEDIT_CRASH_FILE_TIMEOUT; return; - + case 'g': case 'G': write_to_output(d, "Enter the lifetime of normal rent files (days) : "); OLC_MODE(d) = CEDIT_RENT_FILE_TIMEOUT; return; - + case 'q': case 'Q': cedit_disp_menu(d); return; - + default: write_to_output(d, "\r\nThat is an invalid choice!\r\n"); } - + cedit_disp_crash_save_options(d); return; - + /*-------------------------------------------------------------------*/ - + case CEDIT_ROOM_NUMBERS_MENU: switch (*arg) { case 'a': @@ -1049,48 +1049,48 @@ void cedit_parse(struct descriptor_data *d, char *arg) write_to_output(d, "Enter the room's vnum where mortals should load into : "); OLC_MODE(d) = CEDIT_MORTAL_START_ROOM; return; - + case 'b': case 'B': write_to_output(d, "Enter the room's vnum where immortals should load into : "); OLC_MODE(d) = CEDIT_IMMORT_START_ROOM; return; - + case 'c': case 'C': write_to_output(d, "Enter the room's vnum where frozen people should load into : "); OLC_MODE(d) = CEDIT_FROZEN_START_ROOM; return; - + case '1': write_to_output(d, "Enter the vnum for donation room #1 : "); OLC_MODE(d) = CEDIT_DONATION_ROOM_1; return; - + case '2': write_to_output(d, "Enter the vnum for donation room #2 : "); OLC_MODE(d) = CEDIT_DONATION_ROOM_2; return; - + case '3': write_to_output(d, "Enter the vnum for donation room #3 : "); OLC_MODE(d) = CEDIT_DONATION_ROOM_3; return; - + case 'q': case 'Q': cedit_disp_menu(d); return; - + default: write_to_output(d, "\r\nThat is an invalid choice!\r\n"); } - + cedit_disp_room_numbers(d); return; - + /*-------------------------------------------------------------------*/ - + case CEDIT_OPERATION_OPTIONS_MENU: switch (*arg) { case 'a': @@ -1098,57 +1098,57 @@ void cedit_parse(struct descriptor_data *d, char *arg) write_to_output(d, "Enter the default port number : "); OLC_MODE(d) = CEDIT_DFLT_PORT; return; - + case 'b': case 'B': write_to_output(d, "Enter the default IP Address : "); OLC_MODE(d) = CEDIT_DFLT_IP; return; - + case 'c': case 'C': write_to_output(d, "Enter the default directory : "); OLC_MODE(d) = CEDIT_DFLT_DIR; return; - + case 'd': case 'D': write_to_output(d, "Enter the name of the logfile : "); OLC_MODE(d) = CEDIT_LOGNAME; return; - + case 'e': case 'E': write_to_output(d, "Enter the maximum number of players : "); OLC_MODE(d) = CEDIT_MAX_PLAYING; return; - + case 'f': case 'F': write_to_output(d, "Enter the maximum size of the logs : "); OLC_MODE(d) = CEDIT_MAX_FILESIZE; return; - + case 'g': case 'G': write_to_output(d, "Enter the maximum number of password attempts : "); OLC_MODE(d) = CEDIT_MAX_BAD_PWS; return; - + case 'h': case 'H': TOGGLE_VAR(OLC_CONFIG(d)->operation.siteok_everyone); break; - + case 'i': case 'I': TOGGLE_VAR(OLC_CONFIG(d)->operation.nameserver_is_slow); break; - + case 'j': case 'J': TOGGLE_VAR(OLC_CONFIG(d)->operation.use_new_socials); - send_to_char(d->character, + send_to_char(d->character, "Please note that using the stock social file will disable AEDIT.\r\n"); break; @@ -1163,84 +1163,84 @@ void cedit_parse(struct descriptor_data *d, char *arg) clear_screen(d); send_editor_help(d); write_to_output(d, "Enter the new MENU :\r\n\r\n"); - + if (OLC_CONFIG(d)->operation.MENU) { write_to_output(d, "%s", OLC_CONFIG(d)->operation.MENU); oldtext = strdup(OLC_CONFIG(d)->operation.MENU); } - + string_write(d, &OLC_CONFIG(d)->operation.MENU, MAX_INPUT_LENGTH, 0, oldtext); return; - + case 'm': case 'M': OLC_MODE(d) = CEDIT_WELC_MESSG; clear_screen(d); send_editor_help(d); write_to_output(d, "Enter the new welcome message :\r\n\r\n"); - + if (OLC_CONFIG(d)->operation.WELC_MESSG) { write_to_output(d, "%s", OLC_CONFIG(d)->operation.WELC_MESSG); oldtext = str_udup(OLC_CONFIG(d)->operation.WELC_MESSG); } - + string_write(d, &OLC_CONFIG(d)->operation.WELC_MESSG, MAX_INPUT_LENGTH, 0, oldtext); return; - + case 'n': case 'N': OLC_MODE(d) = CEDIT_START_MESSG; clear_screen(d); send_editor_help(d); write_to_output(d, "Enter the new newbie start message :\r\n\r\n"); - + if (OLC_CONFIG(d)->operation.START_MESSG) { write_to_output(d, "%s", OLC_CONFIG(d)->operation.START_MESSG); oldtext = strdup(OLC_CONFIG(d)->operation.START_MESSG); } - + string_write(d, &OLC_CONFIG(d)->operation.START_MESSG, MAX_INPUT_LENGTH, 0, oldtext); return; - + case 'q': case 'Q': cedit_disp_menu(d); return; - + default: write_to_output(d, "\r\nThat is an invalid choice!\r\n"); } - + cedit_disp_operation_options(d); return; - + /*-------------------------------------------------------------------*/ - + case CEDIT_AUTOWIZ_OPTIONS_MENU: switch (*arg) { case 'a': case 'A': TOGGLE_VAR(OLC_CONFIG(d)->autowiz.use_autowiz); break; - + case 'b': case 'B': write_to_output(d, "Enter the minimum level for players to appear on the wizlist : "); OLC_MODE(d) = CEDIT_MIN_WIZLIST_LEV; return; - + case 'q': case 'Q': cedit_disp_menu(d); return; - + default: write_to_output(d, "\r\nThat is an invalid choice!\r\n"); } - + cedit_disp_autowiz_options(d); return; - + /*-------------------------------------------------------------------*/ case CEDIT_LEVEL_CAN_SHOUT: @@ -1253,7 +1253,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) cedit_disp_game_play_options(d); } break; - + /*-------------------------------------------------------------------*/ case CEDIT_HOLLER_MOVE_COST: @@ -1266,7 +1266,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) cedit_disp_game_play_options(d); } break; - + /*-------------------------------------------------------------------*/ case CEDIT_TUNNEL_SIZE: @@ -1279,13 +1279,13 @@ void cedit_parse(struct descriptor_data *d, char *arg) cedit_disp_game_play_options(d); } break; - + /*-------------------------------------------------------------------*/ case CEDIT_MAX_EXP_GAIN: if (*arg) OLC_CONFIG(d)->play.max_exp_gain = atoi(arg); - + cedit_disp_game_play_options(d); break; @@ -1294,7 +1294,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) case CEDIT_MAX_EXP_LOSS: if (*arg) OLC_CONFIG(d)->play.max_exp_loss = atoi(arg); - + cedit_disp_game_play_options(d); break; @@ -1350,9 +1350,9 @@ void cedit_parse(struct descriptor_data *d, char *arg) cedit_disp_game_play_options(d); } break; - + /*-------------------------------------------------------------------*/ - + case CEDIT_IDLE_MAX_LEVEL: if (!*arg) { write_to_output(d, @@ -1363,34 +1363,34 @@ void cedit_parse(struct descriptor_data *d, char *arg) cedit_disp_game_play_options(d); } break; - + /*-------------------------------------------------------------------*/ case CEDIT_OK: if (!genolc_checkstring(d, arg)) break; - + if (OLC_CONFIG(d)->play.OK) free(OLC_CONFIG(d)->play.OK); - + OLC_CONFIG(d)->play.OK = str_udup(arg); strcat(OLC_CONFIG(d)->play.OK, "\r\n"); - + cedit_disp_game_play_options(d); break; - + /*-------------------------------------------------------------------*/ - + case CEDIT_NOPERSON: if (!genolc_checkstring(d, arg)) break; - + if (OLC_CONFIG(d)->play.NOPERSON) free(OLC_CONFIG(d)->play.NOPERSON); - + OLC_CONFIG(d)->play.NOPERSON = str_udup(arg); strcat(OLC_CONFIG(d)->play.NOPERSON, "\r\n"); - + cedit_disp_game_play_options(d); break; @@ -1399,13 +1399,13 @@ void cedit_parse(struct descriptor_data *d, char *arg) case CEDIT_NOEFFECT: if (!genolc_checkstring(d, arg)) break; - + if (OLC_CONFIG(d)->play.NOEFFECT) free(OLC_CONFIG(d)->play.NOEFFECT); - + OLC_CONFIG(d)->play.NOEFFECT = str_udup(arg); strcat(OLC_CONFIG(d)->play.NOEFFECT, "\r\n"); - + cedit_disp_game_play_options(d); break; @@ -1423,7 +1423,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) break; /*-------------------------------------------------------------------*/ - + case CEDIT_MIN_RENT_COST: if (!*arg) { write_to_output(d, @@ -1434,7 +1434,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) cedit_disp_crash_save_options(d); } break; - + /*-------------------------------------------------------------------*/ case CEDIT_AUTOSAVE_TIME: @@ -1447,7 +1447,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) cedit_disp_crash_save_options(d); } break; - + /*-------------------------------------------------------------------*/ case CEDIT_CRASH_FILE_TIMEOUT: @@ -1475,7 +1475,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) break; /*-------------------------------------------------------------------*/ - + case CEDIT_MORTAL_START_ROOM: if (!*arg) { write_to_output(d, @@ -1490,7 +1490,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) cedit_disp_room_numbers(d); } break; - + /*-------------------------------------------------------------------*/ case CEDIT_IMMORT_START_ROOM: @@ -1507,7 +1507,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) cedit_disp_room_numbers(d); } break; - + /*-------------------------------------------------------------------*/ case CEDIT_FROZEN_START_ROOM: @@ -1526,7 +1526,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) break; /*-------------------------------------------------------------------*/ - + case CEDIT_DONATION_ROOM_1: if (!*arg) { write_to_output(d, @@ -1543,7 +1543,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) break; /*-------------------------------------------------------------------*/ - + case CEDIT_DONATION_ROOM_2: if (!*arg) { write_to_output(d, @@ -1560,7 +1560,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) break; /*-------------------------------------------------------------------*/ - + case CEDIT_DONATION_ROOM_3: if (!*arg) { write_to_output(d, @@ -1575,9 +1575,9 @@ void cedit_parse(struct descriptor_data *d, char *arg) cedit_disp_room_numbers(d); } break; - + /*-------------------------------------------------------------------*/ - + case CEDIT_DFLT_PORT: OLC_CONFIG(d)->operation.DFLT_PORT = atoi(arg); cedit_disp_operation_options(d); @@ -1597,7 +1597,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) break; /*-------------------------------------------------------------------*/ - + case CEDIT_DFLT_DIR: if (!*arg) { write_to_output(d, @@ -1608,7 +1608,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) cedit_disp_operation_options(d); } break; - + /*-------------------------------------------------------------------*/ case CEDIT_LOGNAME: @@ -1647,7 +1647,7 @@ void cedit_parse(struct descriptor_data *d, char *arg) case CEDIT_MIN_WIZLIST_LEV: if (atoi(arg) > LVL_IMPL) { - write_to_output(d, + write_to_output(d, "The minimum wizlist level can't be greater than %d.\r\n" "Enter the minimum level for players to appear on the wizlist : ", LVL_IMPL); } else { @@ -1670,17 +1670,17 @@ void cedit_parse(struct descriptor_data *d, char *arg) } /* - * End of parse_cedit() + * End of parse_cedit() */ void reassign_rooms(void) -{ +{ void assign_rooms(void); int i; /* remove old funcs */ for (i = 0; i < top_of_world; i++) world[i].func = NULL; - + /* reassign spec_procs */ assign_rooms(); } diff --git a/src/class.c b/src/class.c index 24f0f99..554f29d 100644 --- a/src/class.c +++ b/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) diff --git a/src/comm.c b/src/comm.c index 9e97221..282ac73 100644 --- a/src/comm.c +++ b/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); diff --git a/src/config.c b/src/config.c index d1224e2..605ca43 100644 --- a/src/config.c +++ b/src/config.c @@ -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. */ diff --git a/src/constants.c b/src/constants.c index a04b794..9caeebb 100644 --- a/src/constants.c +++ b/src/constants.c @@ -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", diff --git a/src/context_help.c b/src/context_help.c index 6cf8c0c..6d7da24 100644 --- a/src/context_help.c +++ b/src/context_help.c @@ -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); } diff --git a/src/db.c b/src/db.c index 791d040..a06f728 100644 --- a/src/db.c +++ b/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); } diff --git a/src/db.h b/src/db.h index 2798a30..1371bf7 100644 --- a/src/db.h +++ b/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; diff --git a/src/dg_comm.c b/src/dg_comm.c index bd797ba..b6d0f24 100644 --- a/src/dg_comm.c +++ b/src/dg_comm.c @@ -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++; } diff --git a/src/dg_db_scripts.c b/src/dg_db_scripts.c index a6b9bb8..5ff74bd 100644 --- a/src/dg_db_scripts.c +++ b/src/dg_db_scripts.c @@ -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; } diff --git a/src/dg_event.c b/src/dg_event.c index 1daa378..140625a 100644 --- a/src/dg_event.c +++ b/src/dg_event.c @@ -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); } - - + + diff --git a/src/dg_handler.c b/src/dg_handler.c index 7b17952..891470e 100644 --- a/src/dg_handler.c +++ b/src/dg_handler.c @@ -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; diff --git a/src/dg_misc.c b/src/dg_misc.c index 90ff22d..7e80d14 100644 --- a/src/dg_misc.c +++ b/src/dg_misc.c @@ -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<= 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); } -} - +} + diff --git a/src/dg_mobcmd.c b/src/dg_mobcmd.c index bf6cb18..3dbd879 100644 --- a/src/dg_mobcmd.c +++ b/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); } diff --git a/src/dg_objcmd.c b/src/dg_objcmd.c index d3a6a2a..3b66bf0 100644 --- a/src/dg_objcmd.c +++ b/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)); } diff --git a/src/dg_olc.c b/src/dg_olc.c index 04b9448..cf939f7 100644 --- a/src/dg_olc.c +++ b/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, " \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; } diff --git a/src/dg_scripts.c b/src/dg_scripts.c index ece7a4c..db0d04c 100644 --- a/src/dg_scripts.c +++ b/src/dg_scripts.c @@ -11,7 +11,7 @@ #include "conf.h" #include "sysdep.h" - + #include "structs.h" #include "dg_scripts.h" #include "utils.h" @@ -101,9 +101,9 @@ char *str_str(char *cs, char *ct) while (*cs && (LOWER(*cs) != LOWER(*t))) cs++; - + s = cs; - + while (*t && *cs && (LOWER(*cs) == LOWER(*t))) { t++; cs++; @@ -137,10 +137,10 @@ obj_data *get_obj_in_list(char *name, obj_data *list) { obj_data *i; long id; - + if (*name == UID_CHAR){ id = atoi(name + 1); - + for (i = list; i; i = i->next_content) if (id == GET_ID(i)) return i; @@ -149,7 +149,7 @@ obj_data *get_obj_in_list(char *name, obj_data *list) if (isname(name, i->name)) return i; } - + return NULL; } @@ -158,12 +158,12 @@ obj_data *get_object_in_equip(char_data * ch, char *name) int j, n = 0, number; obj_data *obj; char tmpname[MAX_INPUT_LENGTH]; - char *tmp = tmpname; + char *tmp = tmpname; long id; if (*name == UID_CHAR) { id = atoi(name + 1); - + for (j = 0; j < NUM_WEARS; j++) if ((obj = GET_EQ(ch, j))) if (id == GET_ID(obj)) @@ -185,7 +185,7 @@ obj_data *get_object_in_equip(char_data * ch, char *name) if (++n == number) return (obj); } - + return NULL; } @@ -219,10 +219,10 @@ int find_eq_pos_script(char *arg) {"lwrist", WEAR_WRIST_L}, {"none", -1} }; - + if (is_number(arg) && (i = atoi(arg)) >= 0 && i < NUM_WEARS) return i; - + for (i = 0;eq_pos[i].where != -1;i++) { if (!str_cmp(eq_pos[i].pos, arg)) return eq_pos[i].where; @@ -236,9 +236,9 @@ int can_wear_on_pos(struct obj_data *obj, int pos) case WEAR_HOLD: case WEAR_LIGHT: return CAN_WEAR(obj, ITEM_WEAR_HOLD); case WEAR_WIELD: return CAN_WEAR(obj, ITEM_WEAR_WIELD); - case WEAR_FINGER_R: + case WEAR_FINGER_R: case WEAR_FINGER_L: return CAN_WEAR(obj, ITEM_WEAR_FINGER); - case WEAR_NECK_1: + case WEAR_NECK_1: case WEAR_NECK_2: return CAN_WEAR(obj, ITEM_WEAR_NECK); case WEAR_BODY: return CAN_WEAR(obj, ITEM_WEAR_BODY); case WEAR_HEAD: return CAN_WEAR(obj, ITEM_WEAR_HEAD); @@ -253,12 +253,12 @@ int can_wear_on_pos(struct obj_data *obj, int pos) case WEAR_WRIST_L: return CAN_WEAR(obj, ITEM_WEAR_WRIST); default: return FALSE; } -} +} /************************************************************ * search by number routines ************************************************************/ - + /* return char with UID n */ struct char_data *find_char(long n) { @@ -274,7 +274,7 @@ obj_data *find_obj(long n) { if (n < OBJ_ID_BASE) /* see note in dg_scripts.h */ return NULL; - + return find_obj_by_uid_in_lookup_table(n); } @@ -282,11 +282,11 @@ obj_data *find_obj(long n) room_data *find_room(long n) { room_rnum rnum; - + n -= ROOM_ID_BASE; - if (n<0) + if (n<0) return NULL; - rnum = real_room((room_vnum)n); + rnum = real_room((room_vnum)n); if (rnum != NOWHERE) return &world[rnum]; @@ -324,36 +324,36 @@ char_data *get_char(char *name) char_data *get_char_near_obj(obj_data *obj, char *name) { char_data *ch; - + if (*name == UID_CHAR) { ch = find_char(atoi(name + 1)); - + if (ch && valid_dg_target(ch, DG_ALLOW_GODS)) return ch; } else { room_rnum num; if ((num = obj_room(obj)) != NOWHERE) - for (ch = world[num].people; ch; ch = ch->next_in_room) + for (ch = world[num].people; ch; ch = ch->next_in_room) if (isname(name, ch->player.name) && valid_dg_target(ch, DG_ALLOW_GODS)) return ch; } - + return NULL; } - - + + /* * returns a pointer to the first character in world by name name, * or NULL if none found. Starts searching in room room first */ char_data *get_char_in_room(room_data *room, char *name) -{ +{ char_data *ch; if (*name == UID_CHAR) { ch = find_char(atoi(name + 1)); - + if (ch && valid_dg_target(ch, DG_ALLOW_GODS)) return ch; } else { @@ -362,7 +362,7 @@ char_data *get_char_in_room(room_data *room, char *name) valid_dg_target(ch, DG_ALLOW_GODS)) return ch; } - + return NULL; } @@ -370,28 +370,28 @@ char_data *get_char_in_room(room_data *room, char *name) obj_data *get_obj_near_obj(obj_data *obj, char *name) { - obj_data *i = NULL; + obj_data *i = NULL; char_data *ch; int rm; long id; if (!str_cmp(name, "self") || !str_cmp(name, "me")) return obj; - + /* is it inside ? */ if (obj->contains && (i = get_obj_in_list(name, obj->contains))) return i; - + /* or outside ? */ if (obj->in_obj) { if (*name == UID_CHAR) { id = atoi(name + 1); - + if (id == GET_ID(obj->in_obj)) return obj->in_obj; } else if (isname(name, obj->in_obj->name)) return obj->in_obj; - } + } /* or worn ?*/ else if (obj->worn_by && (i = get_object_in_equip(obj->worn_by, name))) return i; @@ -403,20 +403,20 @@ obj_data *get_obj_near_obj(obj_data *obj, char *name) /* check the floor */ if ((i = get_obj_in_list(name, world[rm].contents))) return i; - + /* check peoples' inventory */ for (ch = world[rm].people;ch ; ch = ch->next_in_room) if ((i = get_object_in_equip(ch, name))) return i; } return NULL; -} +} /* returns the object in the world with name name, or NULL if not found */ -obj_data *get_obj(char *name) +obj_data *get_obj(char *name) { obj_data *obj; - + if (*name == UID_CHAR) return find_obj(atoi(name + 1)); else { @@ -427,12 +427,12 @@ obj_data *get_obj(char *name) return NULL; } - + /* finds room by id or vnum. returns NULL if not found */ room_data *get_room(char *name) { - room_rnum nr; + room_rnum nr; if (*name == UID_CHAR) return find_room(atoi(name + 1)); @@ -453,7 +453,7 @@ char_data *get_char_by_obj(obj_data *obj, char *name) if (*name == UID_CHAR) { ch = find_char(atoi(name + 1)); - + if (ch && valid_dg_target(ch, DG_ALLOW_GODS)) return ch; } else { @@ -461,33 +461,33 @@ char_data *get_char_by_obj(obj_data *obj, char *name) isname(name, obj->carried_by->player.name) && valid_dg_target(obj->carried_by, DG_ALLOW_GODS)) return obj->carried_by; - + if (obj->worn_by && isname(name, obj->worn_by->player.name) && valid_dg_target(obj->worn_by, DG_ALLOW_GODS)) return obj->worn_by; - + for (ch = character_list; ch; ch = ch->next) if (isname(name, ch->player.name) && valid_dg_target(ch, DG_ALLOW_GODS)) return ch; } - + return NULL; } - - + + /* * returns a pointer to the first character in world by name name, * or NULL if none found. Starts searching in room room first */ char_data *get_char_by_room(room_data *room, char *name) -{ +{ char_data *ch; if (*name == UID_CHAR) { ch = find_char(atoi(name + 1)); - + if (ch && valid_dg_target(ch, DG_ALLOW_GODS)) return ch; } else { @@ -495,13 +495,13 @@ char_data *get_char_by_room(room_data *room, char *name) if (isname(name, ch->player.name) && valid_dg_target(ch, DG_ALLOW_GODS)) return ch; - + for (ch = character_list; ch; ch = ch->next) if (isname(name, ch->player.name) && valid_dg_target(ch, DG_ALLOW_GODS)) return ch; } - + return NULL; } @@ -509,27 +509,27 @@ char_data *get_char_by_room(room_data *room, char *name) /* * returns the object in the world with name name, or NULL if not found * search based on obj - */ + */ obj_data *get_obj_by_obj(obj_data *obj, char *name) { - obj_data *i = NULL; + obj_data *i = NULL; int rm; - if (*name == UID_CHAR) + if (*name == UID_CHAR) return find_obj(atoi(name + 1)); if (!str_cmp(name, "self") || !str_cmp(name, "me")) return obj; - + if (obj->contains && (i = get_obj_in_list(name, obj->contains))) return i; - + if (obj->in_obj && isname(name, obj->in_obj->name)) return obj->in_obj; if (obj->worn_by && (i = get_object_in_equip(obj->worn_by, name))) return i; - + if (obj->carried_by && (i = get_obj_in_list(name, obj->carried_by->carrying))) return i; @@ -537,46 +537,46 @@ obj_data *get_obj_by_obj(obj_data *obj, char *name) if (((rm = obj_room(obj)) != NOWHERE) && (i = get_obj_in_list(name, world[rm].contents))) return i; - + return get_obj(name); -} +} /* only searches the room */ obj_data *get_obj_in_room(room_data *room, char *name) { obj_data *obj; long id; - + if (*name == UID_CHAR) { id = atoi(name + 1); for (obj = room->contents; obj; obj = obj->next_content) - if (id == GET_ID(obj)) + if (id == GET_ID(obj)) return obj; } else { for (obj = room->contents; obj; obj = obj->next_content) if (isname(name, obj->name)) return obj; - } - + } + return NULL; } - + /* returns obj with name - searches room, then world */ obj_data *get_obj_by_room(room_data *room, char *name) { obj_data *obj; - - if (*name == UID_CHAR) + + if (*name == UID_CHAR) return find_obj(atoi(name+1)); for (obj = room->contents; obj; obj = obj->next_content) if (isname(name, obj->name)) return obj; - + for (obj = object_list; obj; obj = obj->next) if (isname(name, obj->name)) return obj; - + return NULL; } @@ -599,7 +599,7 @@ void script_trigger_check(void) random_mtrigger(ch); } } - + for (obj = object_list; obj; obj = obj->next) { if (SCRIPT(obj)) { sc = SCRIPT(obj); @@ -613,7 +613,7 @@ void script_trigger_check(void) if (SCRIPT(&world[nr])) { room = &world[nr]; sc = SCRIPT(room); - + if (IS_SET(SCRIPT_TYPES(sc), WTRIG_RANDOM) && (!is_empty(room->zone) || IS_SET(SCRIPT_TYPES(sc), WTRIG_GLOBAL))) @@ -622,7 +622,7 @@ void script_trigger_check(void) } } -void check_time_triggers(void) +void check_time_triggers(void) { char_data *ch; obj_data *obj; @@ -640,7 +640,7 @@ void check_time_triggers(void) time_mtrigger(ch); } } - + for (obj = object_list; obj; obj = obj->next) { if (SCRIPT(obj)) { sc = SCRIPT(obj); @@ -654,7 +654,7 @@ void check_time_triggers(void) if (SCRIPT(&world[nr])) { room = &world[nr]; sc = SCRIPT(room); - + if (IS_SET(SCRIPT_TYPES(sc), WTRIG_TIME) && (!is_empty(room->zone) || IS_SET(SCRIPT_TYPES(sc), WTRIG_GLOBAL))) @@ -675,7 +675,7 @@ EVENTFUNC(trig_wait_event) go = wait_event_obj->go; type = wait_event_obj->type; - free(wait_event_obj); + free(wait_event_obj); GET_TRIG_WAIT(trig) = NULL; #if 1 /* debugging */ @@ -693,7 +693,7 @@ EVENTFUNC(trig_wait_event) found = TRUE; } else { room_rnum i; - for (i = 0;inr]->number); //script_log("Trigger restart attempt on unknown entity."); return 0; - } + } } #endif script_driver(&go, trig, type, TRIG_RESTART); - + /* Do not reenqueue*/ return 0; } @@ -719,7 +719,7 @@ void do_stat_trigger(struct char_data *ch, trig_data *trig) struct cmdlist_element *cmd_list; char sb[MAX_STRING_LENGTH], buf[MAX_STRING_LENGTH]; int len = 0; - + if (!trig) { log("SYSERR: NULL trigger passed to do_stat_trigger."); @@ -741,13 +741,13 @@ void do_stat_trigger(struct char_data *ch, trig_data *trig) len += snprintf(sb + len, sizeof(sb)-len, "Trigger Intended Assignment: Mobiles\r\n"); sprintbit(GET_TRIG_TYPE(trig), trig_types, buf, sizeof(buf)); } - + len += snprintf(sb + len, sizeof(sb)-len, "Trigger Type: %s, Numeric Arg: %d, Arg list: %s\r\n", - buf, GET_TRIG_NARG(trig), + buf, GET_TRIG_NARG(trig), ((GET_TRIG_ARG(trig) && *GET_TRIG_ARG(trig)) ? GET_TRIG_ARG(trig) : "None")); - len += snprintf(sb + len, sizeof(sb)-len, "Commands:\r\n"); + len += snprintf(sb + len, sizeof(sb)-len, "Commands:\r\n"); cmd_list = trig->cmdlist; while (cmd_list) { @@ -791,13 +791,13 @@ void script_stat (char_data *ch, struct script_data *sc) send_to_char(ch, "Global Variables: %s\r\n", sc->global_vars ? "" : "None"); send_to_char(ch, "Global context: %ld\r\n", sc->context); - + for (tv = sc->global_vars; tv; tv = tv->next) { snprintf(namebuf, sizeof(namebuf), "%s:%ld", tv->name, tv->context); if (*(tv->value) == UID_CHAR) { find_uid_name(tv->value, name, sizeof(name)); send_to_char(ch, " %15s: %s\r\n", tv->context?namebuf:tv->name, name); - } else + } else send_to_char(ch, " %15s: %s\r\n", tv->context?namebuf:tv->name, tv->value); } @@ -817,15 +817,15 @@ void script_stat (char_data *ch, struct script_data *sc) send_to_char(ch, " Trigger Intended Assignment: Mobiles\r\n"); sprintbit(GET_TRIG_TYPE(t), trig_types, buf1, sizeof(buf1)); } - - send_to_char(ch, " Trigger Type: %s, Numeric Arg: %d, Arg list: %s\r\n", - buf1, GET_TRIG_NARG(t), + + send_to_char(ch, " Trigger Type: %s, Numeric Arg: %d, Arg list: %s\r\n", + buf1, GET_TRIG_NARG(t), ((GET_TRIG_ARG(t) && *GET_TRIG_ARG(t)) ? GET_TRIG_ARG(t) : "None")); if (GET_TRIG_WAIT(t)) { send_to_char(ch, " Wait: %ld, Current line: %s\r\n", - event_time(GET_TRIG_WAIT(t)), + event_time(GET_TRIG_WAIT(t)), t->curr_state ? t->curr_state->cmd : "End of Script"); send_to_char(ch, " Variables: %s\r\n", GET_TRIG_VARS(t) ? "" : "None"); @@ -833,11 +833,11 @@ void script_stat (char_data *ch, struct script_data *sc) if (*(tv->value) == UID_CHAR) { find_uid_name(tv->value, name, sizeof(name)); send_to_char(ch, " %15s: %s\r\n", tv->name, name); - } else + } else send_to_char(ch, " %15s: %s\r\n", tv->name, tv->value); } } - } + } } @@ -874,7 +874,7 @@ void do_sstat_character(char_data *ch, char_data *k) send_to_char(ch, " None.\r\n"); return; } - + script_stat(ch, SCRIPT(k)); } @@ -907,7 +907,7 @@ void add_trigger(struct script_data *sc, trig_data *t, int loc) } -ACMD(do_attach) +ACMD(do_attach) { char_data *victim; obj_data *object; @@ -925,15 +925,15 @@ ACMD(do_attach) send_to_char(ch, "Usage: attach { mob | obj | room } { trigger } { name } [ location ]\r\n"); return; } - + num_arg = atoi(targ_name); tn = atoi(trig_name); loc = (*loc_name) ? atoi(loc_name) : -1; - + if (is_abbrev(arg, "mobile") || is_abbrev(arg, "mtr")) { victim = get_char_vis(ch, targ_name, NULL, FIND_CHAR_WORLD); if (!victim) { /* search room for one with this vnum */ - for (victim = world[IN_ROOM(ch)].people;victim;victim=victim->next_in_room) + for (victim = world[IN_ROOM(ch)].people;victim;victim=victim->next_in_room) if (GET_MOB_VNUM(victim) == num_arg) break; @@ -956,11 +956,11 @@ ACMD(do_attach) send_to_char(ch, "That trigger does not exist.\r\n"); return; } - + if (!SCRIPT(victim)) CREATE(SCRIPT(victim), struct script_data, 1); add_trigger(SCRIPT(victim), trig, loc); - + send_to_char(ch, "Trigger %d (%s) attached to %s [%d].\r\n", tn, GET_TRIG_NAME(trig), GET_SHORT(victim), GET_MOB_VNUM(victim)); } @@ -968,15 +968,15 @@ ACMD(do_attach) else if (is_abbrev(arg, "object") || is_abbrev(arg, "otr")) { object = get_obj_vis(ch, targ_name, NULL); if (!object) { /* search room for one with this vnum */ - for (object = world[IN_ROOM(ch)].contents;object;object=object->next_content) + for (object = world[IN_ROOM(ch)].contents;object;object=object->next_content) if (GET_OBJ_VNUM(object) == num_arg) break; - + if (!object) { /* search inventory for one with this vnum */ - for (object = ch->carrying;object;object=object->next_content) + for (object = ch->carrying;object;object=object->next_content) if (GET_OBJ_VNUM(object) == num_arg) break; - + if (!object) { send_to_char(ch, "That object does not exist.\r\n"); return; @@ -998,9 +998,9 @@ ACMD(do_attach) if (!SCRIPT(object)) CREATE(SCRIPT(object), struct script_data, 1); add_trigger(SCRIPT(object), trig, loc); - + send_to_char(ch, "Trigger %d (%s) attached to %s [%d].\r\n", - tn, GET_TRIG_NAME(trig), + tn, GET_TRIG_NAME(trig), (object->short_description ? object->short_description : object->name), GET_OBJ_VNUM(object)); @@ -1009,15 +1009,15 @@ ACMD(do_attach) else if (is_abbrev(arg, "room") || is_abbrev(arg, "wtr")) { if (strchr(targ_name, '.')) rnum = IN_ROOM(ch); - else if (isdigit(*targ_name)) + else if (isdigit(*targ_name)) rnum = find_target_room(ch, targ_name); else rnum = NOWHERE; - + if (rnum == NOWHERE) { send_to_char(ch, "You need to supply a room number or . for current room.\r\n"); return; - } + } if (!can_edit_zone(ch, world[rnum].zone)) { send_to_char(ch, "You can only attach triggers in your own zone\r\n"); @@ -1035,7 +1035,7 @@ ACMD(do_attach) if (!SCRIPT(room)) CREATE(SCRIPT(room), struct script_data, 1); add_trigger(SCRIPT(room), trig, loc); - + send_to_char(ch, "Trigger %d (%s) attached to room %d.\r\n", tn, GET_TRIG_NAME(trig), world[rnum].number); } @@ -1058,8 +1058,8 @@ int remove_trigger(struct script_data *sc, char *name) trig_data *i, *j; int num = 0, string = FALSE, n; char *cname; - - + + if (!sc) return 0; @@ -1072,7 +1072,7 @@ int remove_trigger(struct script_data *sc, char *name) } } else num = atoi(name); - + for (n = 0, j = NULL, i = TRIGGERS(sc); i; j = i, i = i->next) { if (string) { if (isname(name, GET_TRIG_NAME(i))) @@ -1088,41 +1088,41 @@ int remove_trigger(struct script_data *sc, char *name) else if (trig_index[i->nr]->vnum == num) break; } - + if (i) { if (j) { j->next = i->next; extract_trigger(i); } - + /* this was the first trigger */ else { TRIGGERS(sc) = i->next; extract_trigger(i); } - + /* update the script type bitvector */ SCRIPT_TYPES(sc) = 0; for (i = TRIGGERS(sc); i; i = i->next) SCRIPT_TYPES(sc) |= GET_TRIG_TYPE(i); - + return 1; } else - return 0; -} + return 0; +} ACMD(do_detach) -{ +{ char_data *victim = NULL; obj_data *object = NULL; struct room_data *room; char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH], arg3[MAX_INPUT_LENGTH]; - char *trigger = 0; + char *trigger = 0; int num_arg; - + argument = two_arguments(argument, arg1, arg2); one_argument(argument, arg3); - + if (!*arg1 || !*arg2) { send_to_char(ch, "Usage: detach [ mob | object | room ] { target } { trigger |" " 'all' }\r\n"); @@ -1151,12 +1151,12 @@ ACMD(do_detach) } else send_to_char(ch, "That trigger was not found.\r\n"); } - + else { if (is_abbrev(arg1, "mobile") || !str_cmp(arg1, "mtr")) { victim = get_char_vis(ch, arg2, NULL, FIND_CHAR_WORLD); if (!victim) { /* search room for one with this vnum */ - for (victim = world[IN_ROOM(ch)].people;victim;victim=victim->next_in_room) + for (victim = world[IN_ROOM(ch)].people;victim;victim=victim->next_in_room) if (GET_MOB_VNUM(victim) == num_arg) break; @@ -1165,25 +1165,25 @@ ACMD(do_detach) return; } } - + if (!arg3 || !*arg3) send_to_char(ch, "You must specify a trigger to remove.\r\n"); else trigger = arg3; } - + else if (is_abbrev(arg1, "object") || !str_cmp(arg1, "otr")) { object = get_obj_vis(ch, arg2, NULL); if (!object) { /* search room for one with this vnum */ - for (object = world[IN_ROOM(ch)].contents;object;object=object->next_content) + for (object = world[IN_ROOM(ch)].contents;object;object=object->next_content) if (GET_OBJ_VNUM(object) == num_arg) break; - + if (!object) { /* search inventory for one with this vnum */ - for (object = ch->carrying;object;object=object->next_content) + for (object = ch->carrying;object;object=object->next_content) if (GET_OBJ_VNUM(object) == num_arg) break; - + if (!object) { /* give up */ send_to_char(ch, "No such object around.\r\n"); return; @@ -1206,14 +1206,14 @@ ACMD(do_detach) else if ((object = get_obj_vis(ch, arg1, NULL))); else send_to_char(ch, "Nothing around by that name.\r\n"); - + trigger = arg2; } - + if (victim) { if (!IS_NPC(victim)) send_to_char(ch, "Players don't have triggers.\r\n"); - + else if (!SCRIPT(victim)) send_to_char(ch, "That mob doesn't have any triggers.\r\n"); else if (!can_edit_zone(ch, real_zone_by_thing(GET_MOB_VNUM(victim)))) { @@ -1224,7 +1224,7 @@ ACMD(do_detach) extract_script(victim, MOB_TRIGGER); send_to_char(ch, "All triggers removed from %s.\r\n", GET_SHORT(victim)); } - + else if (trigger && remove_trigger(SCRIPT(victim), trigger)) { send_to_char(ch, "Trigger removed.\r\n"); if (!TRIGGERS(SCRIPT(victim))) { @@ -1233,11 +1233,11 @@ ACMD(do_detach) } else send_to_char(ch, "That trigger was not found.\r\n"); } - + else if (object) { if (!SCRIPT(object)) send_to_char(ch, "That object doesn't have any triggers.\r\n"); - + else if (!can_edit_zone(ch, real_zone_by_thing(GET_OBJ_VNUM(object)))) { send_to_char(ch, "You can only detach triggers in your own zone\r\n"); return; @@ -1248,7 +1248,7 @@ ACMD(do_detach) object->short_description ? object->short_description : object->name); } - + else if (remove_trigger(SCRIPT(object), trigger)) { send_to_char(ch, "Trigger removed.\r\n"); if (!TRIGGERS(SCRIPT(object))) { @@ -1257,22 +1257,22 @@ ACMD(do_detach) } else send_to_char(ch, "That trigger was not found.\r\n"); } - } -} + } +} -/* +/* * Logs any errors caused by scripts to the system log. * Will eventually allow on-line view of script errors. */ -void script_vlog(const char *format, va_list args) +void script_vlog(const char *format, va_list args) { char output[MAX_STRING_LENGTH]; struct descriptor_data *i; - + snprintf(output, sizeof(output), "SCRIPT ERR: %s", format); - + basic_mud_vlog(output, args); - + /* the rest is mostly a rip from basic_mud_log() */ strcpy(output, "[ "); /* strcpy: OK */ vsnprintf(output + 2, sizeof(output) - 6, format, args); @@ -1296,7 +1296,7 @@ void script_vlog(const char *format, va_list args) void script_log(const char *format, ...) { va_list args; - + va_start(args, format); script_vlog(format, args); va_end(args); @@ -1306,19 +1306,19 @@ void script_log(const char *format, ...) /* bugfixed - would have returned true on num="------" */ int is_num(char *arg) { - if (*arg == '\0') - return FALSE; + if (*arg == '\0') + return FALSE; - if (*arg == '+' || *arg == '-') - arg++; + if (*arg == '+' || *arg == '-') + arg++; - for (; *arg != '\0'; arg++) - { - if (!isdigit(*arg)) - return FALSE; - } + for (; *arg != '\0'; arg++) + { + if (!isdigit(*arg)) + return FALSE; + } - return TRUE; + return TRUE; } @@ -1330,15 +1330,15 @@ void eval_op(char *op, char *lhs, char *rhs, char *result, void *go, int n; /* strip off extra spaces at begin and end */ - while (*lhs && isspace(*lhs)) + while (*lhs && isspace(*lhs)) lhs++; while (*rhs && isspace(*rhs)) rhs++; - + for (p = (unsigned char *) lhs; *p; p++); for (--p; isspace(*p) && ((char *)p > lhs); *p-- = '\0'); for (p = (unsigned char *) rhs; *p; p++); - for (--p; isspace(*p) && ((char *)p > rhs); *p-- = '\0'); + for (--p; isspace(*p) && ((char *)p > rhs); *p-- = '\0'); /* find the op, and figure out the value */ @@ -1361,14 +1361,14 @@ void eval_op(char *op, char *lhs, char *rhs, char *result, void *go, sprintf(result, "%d", atoi(lhs) == atoi(rhs)); else sprintf(result, "%d", !str_cmp(lhs, rhs)); - } + } else if (!strcmp("!=", op)) { if (is_num(lhs) && is_num(rhs)) sprintf(result, "%d", atoi(lhs) != atoi(rhs)); else sprintf(result, "%d", str_cmp(lhs, rhs)); - } + } else if (!strcmp("<=", op)) { if (is_num(lhs) && is_num(rhs)) @@ -1403,11 +1403,11 @@ void eval_op(char *op, char *lhs, char *rhs, char *result, void *go, else if (!strcmp("*", op)) sprintf(result, "%d", atoi(lhs) * atoi(rhs)); - + else if (!strcmp("/", op)) sprintf(result, "%d", (n = atoi(rhs)) ? (atoi(lhs) / n) : 0); - else if (!strcmp("+", op)) + else if (!strcmp("+", op)) sprintf(result, "%d", atoi(lhs) + atoi(rhs)); else if (!strcmp("-", op)) @@ -1468,7 +1468,7 @@ void eval_expr(char *line, char *result, void *go, struct script_data *sc, while (*line && isspace(*line)) line++; - + if (eval_lhs_op_rhs(line, result, go, sc, trig, type)); else if (*line == '(') { @@ -1493,7 +1493,7 @@ int eval_lhs_op_rhs(char *expr, char *result, void *go, struct script_data *sc, char *p, *tokens[MAX_INPUT_LENGTH]; char line[MAX_INPUT_LENGTH], lhr[MAX_INPUT_LENGTH], rhr[MAX_INPUT_LENGTH]; int i, j; - + /* * valid operands, in order of priority * each must also be defined in eval_op() @@ -1560,7 +1560,7 @@ int process_if(char *cond, void *go, struct script_data *sc, char result[MAX_INPUT_LENGTH], *p; eval_expr(cond, result, go, sc, trig, type); - + p = result; skip_spaces(&p); @@ -1581,26 +1581,26 @@ struct cmdlist_element *find_end(trig_data *trig, struct cmdlist_element *cl) struct cmdlist_element *c; char *p; - if (!(cl->next)) { //rryan: if this is the last line, theres no end + if (!(cl->next)) { //rryan: if this is the last line, theres no end script_log("Trigger VNum %d has 'if' without 'end'. (error 1)", GET_TRIG_VNUM(trig)); return cl; } - + for (c = cl->next; c && c->next; c = c?c->next:NULL) { for (p = c->cmd; *p && isspace(*p); p++); if (!strn_cmp("if ", p, 3)) - c = find_end(trig, c); + c = find_end(trig, c); else if (!strn_cmp("end", p, 3)) return c; - + /* thanks to Russell Ryan for this fix */ if(!c->next) { //rryan: this is the last line, we didn't find an end script_log("Trigger VNum %d has 'if' without 'end'. (error 2)", GET_TRIG_VNUM(trig)); return c; } } - + //rryan: we didn't find an end //script_log("Trigger VNum %d has 'if' without 'end'. (error 3)", GET_TRIG_VNUM(trig)); return c; @@ -1633,7 +1633,7 @@ struct cmdlist_element *find_else_end(trig_data *trig, return c; } } - + else if (!strn_cmp("else", p, 4)) { GET_TRIG_DEPTH(trig)++; return c; @@ -1668,7 +1668,7 @@ void process_wait(void *go, trig_data *trig, int type, char *cmd, arg = any_one_arg(cmd, buf); skip_spaces(&arg); - + if (!*arg) { script_log("Trigger: %s, VNum %d. wait w/o an arg: '%s'", GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), cl->cmd); @@ -1689,7 +1689,7 @@ void process_wait(void *go, trig_data *trig, int type, char *cmd, /* calculate pulse of day of current time */ when = (pulse % (SECS_PER_MUD_HOUR * PASSES_PER_SEC)) + (time_info.hours * SECS_PER_MUD_HOUR * PASSES_PER_SEC); - + if (when >= ntime) /* adjust for next day */ when = (SECS_PER_MUD_DAY * PASSES_PER_SEC) - when + ntime; else @@ -1719,7 +1719,7 @@ void process_wait(void *go, trig_data *trig, int type, char *cmd, void process_set(struct script_data *sc, trig_data *trig, char *cmd) { char arg[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH], *value; - + value = two_arguments(cmd, arg, name); skip_spaces(&value); @@ -1740,7 +1740,7 @@ void process_eval(void *go, struct script_data *sc, trig_data *trig, { char arg[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH]; char result[MAX_INPUT_LENGTH], *expr; - + expr = one_argument(cmd, arg); /* cut off 'eval' */ expr = one_argument(expr, name); /* cut off name */ @@ -1823,21 +1823,21 @@ void process_attach(void *go, struct script_data *sc, trig_data *trig, add_trigger(SCRIPT(c), newtrig, -1); return; } - + if (o) { if (!SCRIPT(o)) CREATE(SCRIPT(o), struct script_data, 1); add_trigger(SCRIPT(o), newtrig, -1); return; } - + if (r) { if (!SCRIPT(r)) CREATE(SCRIPT(r), struct script_data, 1); add_trigger(SCRIPT(r), newtrig, -1); return; } - + } @@ -1900,7 +1900,7 @@ void process_detach(void *go, struct script_data *sc, trig_data *trig, } return; } - + if (o && SCRIPT(o)) { if (!strcmp(trignum_s, "all")) { extract_script(o, OBJ_TRIGGER); @@ -1913,7 +1913,7 @@ void process_detach(void *go, struct script_data *sc, trig_data *trig, } return; } - + if (r && SCRIPT(r)) { if (!strcmp(trignum_s, "all")) { extract_script(r, WLD_TRIGGER); @@ -1926,7 +1926,7 @@ void process_detach(void *go, struct script_data *sc, trig_data *trig, } return; } - + } struct room_data *dg_room_of_obj(struct obj_data *obj) @@ -1946,7 +1946,7 @@ void makeuid_var(void *go, struct script_data *sc, trig_data *trig, char junk[MAX_INPUT_LENGTH], varname[MAX_INPUT_LENGTH]; char arg[MAX_INPUT_LENGTH], name[MAX_INPUT_LENGTH]; char uid[MAX_INPUT_LENGTH]; - + *uid = '\0'; half_chop(cmd, junk, cmd); /* makeuid */ half_chop(cmd, varname, cmd); /* variable name */ @@ -1977,7 +1977,7 @@ void makeuid_var(void *go, struct script_data *sc, trig_data *trig, GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), cmd); return; } - + if (is_abbrev(arg, "mob")) { struct char_data *c = NULL; switch (type) { @@ -1991,7 +1991,7 @@ void makeuid_var(void *go, struct script_data *sc, trig_data *trig, c = get_char_room_vis((struct char_data *)go, name, NULL); break; } - if (c) + if (c) snprintf(uid, sizeof(uid), "%c%ld", UID_CHAR, GET_ID(c)); } else if (is_abbrev(arg, "obj")) { struct obj_data *o = NULL; @@ -2003,9 +2003,9 @@ void makeuid_var(void *go, struct script_data *sc, trig_data *trig, o = get_obj_near_obj((struct obj_data *)go, name); break; case MOB_TRIGGER: - if ((o = get_obj_in_list_vis((struct char_data *)go, name, NULL, + if ((o = get_obj_in_list_vis((struct char_data *)go, name, NULL, ((struct char_data *)go)->carrying)) == NULL) - o = get_obj_in_list_vis((struct char_data *)go, name, NULL, + o = get_obj_in_list_vis((struct char_data *)go, name, NULL, world[IN_ROOM((struct char_data *)go)].contents); break; } @@ -2024,12 +2024,12 @@ void makeuid_var(void *go, struct script_data *sc, trig_data *trig, r = IN_ROOM((struct char_data *)go); break; } - if (r != NOWHERE) + if (r != NOWHERE) snprintf(uid, sizeof(uid), "%c%ld", UID_CHAR, (long)world[r].number+ROOM_ID_BASE); } else { script_log("Trigger: %s, VNum %d. makeuid syntax error: '%s'", GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), cmd); - + return; } } @@ -2044,9 +2044,9 @@ void makeuid_var(void *go, struct script_data *sc, trig_data *trig, int process_return(trig_data *trig, char *cmd) { char arg1[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; - + two_arguments(cmd, arg1, arg2); - + if (!*arg2) { script_log("Trigger: %s, VNum %d. return w/o an arg: '%s'", GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), cmd); @@ -2102,7 +2102,7 @@ void process_remote(struct script_data *sc, trig_data *trig, char *cmd) uid_p = buf2; skip_spaces(&var); skip_spaces(&uid_p); - + if (!*buf || !*buf2) { script_log("Trigger: %s, VNum %d. remote: invalid arguments '%s'", @@ -2119,13 +2119,13 @@ void process_remote(struct script_data *sc, trig_data *trig, char *cmd) 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 (!vd) { script_log("Trigger: %s, VNum %d. local var '%s' not found in remote call", GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), buf); return; - } + } /* find the target script from the uid number */ uid = atoi(buf2); if (uid<=0) { @@ -2227,7 +2227,7 @@ ACMD(do_vdelete) send_to_char(ch, "All variables deleted from that id.\r\n"); return; } - + /* find the global */ for (vd = sc_remote->global_vars; vd; vd_prev = vd, vd = vd->next) if (!str_cmp(vd->name, var)) @@ -2251,24 +2251,24 @@ ACMD(do_vdelete) } /* - * Called from do_set - return 0 for failure, 1 for success. - * ch and vict are verified + * Called from do_set - return 0 for failure, 1 for success. + * ch and vict are verified */ int perform_set_dg_var(struct char_data *ch, struct char_data *vict, char *val_arg) { char var_name[MAX_INPUT_LENGTH], *var_value; - + var_value = any_one_arg(val_arg, var_name); - + if (!var_name || !*var_name || !var_value || !*var_value) { send_to_char(ch, "Usage: set \r\n"); return 0; } - if (!SCRIPT(vict)) + if (!SCRIPT(vict)) CREATE(SCRIPT(vict), struct script_data, 1); - + add_var(&(SCRIPT(vict)->global_vars), var_name, var_value, 0); - return 1; + return 1; } /* @@ -2371,7 +2371,7 @@ void process_global(struct script_data *sc, trig_data *trig, char *cmd, long id) script_log("Trigger: %s, VNum %d. local var '%s' not found in global call", GET_TRIG_NAME(trig), GET_TRIG_VNUM(trig), var); return; - } + } add_var(&(sc->global_vars), vd->name, vd->value, id); remove_var(&GET_TRIG_VARS(trig), vd->name); @@ -2382,7 +2382,7 @@ void process_global(struct script_data *sc, trig_data *trig, char *cmd, long id) void process_context(struct script_data *sc, trig_data *trig, char *cmd) { char arg[MAX_INPUT_LENGTH], *var; - + var = any_one_arg(cmd, arg); skip_spaces(&var); @@ -2423,19 +2423,19 @@ void extract_value(struct script_data *sc, trig_data *trig, char *cmd) add_var(&GET_TRIG_VARS(trig), to, buf, sc ? sc->context : 0); } -/* - Thanks to Jamie Nelson for 4 dimensions for this addition - - Syntax : +/* + Thanks to Jamie Nelson for 4 dimensions for this addition + + Syntax : dg_letter - - ie: + + ie: set string L337-String dg_letter var1 4 %string% dg_letter var2 11 %string% - + now %var1% == 7 and %var2% == g - + Note that the index starts at 1. */ @@ -2468,7 +2468,7 @@ void dg_letter_value(struct script_data *sc, trig_data *trig, char *cmd) script_log("Trigger #%d : dg_letter number > strlen!", GET_TRIG_VNUM(trig)); return; } - + *junk = string[num-1]; *(junk+1) = '\0'; add_var(&GET_TRIG_VARS(trig), varname, junk, sc->context); @@ -2476,17 +2476,17 @@ void dg_letter_value(struct script_data *sc, trig_data *trig, char *cmd) /* This is the core driver for scripts. */ /* Arguments: - void *go_adress + void *go_adress A pointer to a pointer to the entity running the script. The reason for this approcah is that we want to be able to see from the calling function, if the entity has been free'd. - - trig_data *trig + + trig_data *trig A pointer to the current running trigger. - + int type MOB_TRIGGER, OBJ_TRIGGER or WLD_TRIGGER, respectively. - + int mode TRIG_NEW just started from dg_triggers.c TRIG_RESTART restarted after a 'wait' @@ -2506,7 +2506,7 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode) void wld_command_interpreter(struct room_data *room, char *argument); switch (type) { - case MOB_TRIGGER: + case MOB_TRIGGER: go = *(char_data **)go_adress; sc = SCRIPT((char_data *) go); break; @@ -2524,32 +2524,32 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode) script_log("Trigger %d recursed beyond maximum allowed depth.", GET_TRIG_VNUM(trig)); switch (type) { case MOB_TRIGGER: - script_log("It was attached to %s [%d]", + script_log("It was attached to %s [%d]", GET_NAME((char_data *) go), GET_MOB_VNUM((char_data *) go)); break; case OBJ_TRIGGER: - script_log("It was attached to %s [%d]", + script_log("It was attached to %s [%d]", ((obj_data *) go)->short_description, GET_OBJ_VNUM((obj_data *) go)); break; case WLD_TRIGGER: - script_log("It was attached to %s [%d]", + script_log("It was attached to %s [%d]", ((room_data *) go)->name, ((room_data *) go)->number); break; - } + } extract_script(go, type); - /* + /* extract_script() works on rooms, but on mobiles and objects, - it will be called again if the - caller is load_mtrigger or load_otrigger - if it is one of these, we must make sure the script - is not just reloaded on the next mob - + it will be called again if the + caller is load_mtrigger or load_otrigger + if it is one of these, we must make sure the script + is not just reloaded on the next mob + We make the calling code decide how to handle it, so it doesn't - get totally removed unless it's a load_xtrigger(). + get totally removed unless it's a load_xtrigger(). */ - + return SCRIPT_ERROR_CODE; } @@ -2562,7 +2562,7 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode) } dg_owner_purged = 0; - + for (cl = (mode == TRIG_NEW) ? trig->cmdlist : trig->curr_state; cl && GET_TRIG_DEPTH(trig); cl = cl ? cl->next : NULL) { for (p = cl->cmd; *p && isspace(*p); p++); @@ -2576,23 +2576,23 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode) else cl = find_else_end(trig, cl, go, sc, type); } - + else if (!strn_cmp("elseif ", p, 7) || !strn_cmp("else", p, 4)) { /* * if not in an if-block, ignore the extra 'else[if]' and warn about it */ - if (GET_TRIG_DEPTH(trig) == 1) { - script_log("Trigger VNum %d has 'else' without 'if'.", + if (GET_TRIG_DEPTH(trig) == 1) { + script_log("Trigger VNum %d has 'else' without 'if'.", GET_TRIG_VNUM(trig)); - continue; + continue; } cl = find_end(trig, cl); GET_TRIG_DEPTH(trig)--; } else if (!strn_cmp("while ", p, 6)) { temp = find_done(cl); if (!temp) { - script_log("Trigger VNum %d has 'while' without 'done'.", + script_log("Trigger VNum %d has 'while' without 'done'.", GET_TRIG_VNUM(trig)); return ret_val; } @@ -2604,14 +2604,14 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode) } } else if (!strn_cmp("switch ", p, 7)) { cl = find_case(trig, cl, go, sc, type, p + 7); - } else if (!strn_cmp("end", p, 3)) { + } else if (!strn_cmp("end", p, 3)) { /* * if not in an if-block, ignore the extra 'end' and warn about it. */ - if (GET_TRIG_DEPTH(trig) == 1) { - script_log("Trigger VNum %d has 'end' without 'if'.", + if (GET_TRIG_DEPTH(trig) == 1) { + script_log("Trigger VNum %d has 'end' without 'if'.", GET_TRIG_VNUM(trig)); - continue; + continue; } GET_TRIG_DEPTH(trig)--; } else if (!strn_cmp("done", p, 4)) { @@ -2622,7 +2622,7 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode) if (cl->original && process_if(orig_cmd + 6, go, sc, trig, type)) { cl = cl->original; - loops++; + loops++; GET_TRIG_LOOPS(trig)++; if (loops == 30) { process_wait(go, trig, type, "wait 1", cl); @@ -2640,13 +2640,13 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode) } } else if (!strn_cmp("break", p, 5)) { cl = find_done(cl); - } else if (!strn_cmp("case", p, 4)) { + } else if (!strn_cmp("case", p, 4)) { /* Do nothing, this allows multiple cases to a single instance */ } - - + + else { - + var_subst(go, sc, trig, type, p, cmd); if (!strn_cmp(cmd, "eval ", 5)) @@ -2686,13 +2686,13 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode) else if (!strn_cmp(cmd, "return ", 7)) ret_val = process_return(trig, cmd); - + else if (!strn_cmp(cmd, "set ", 4)) process_set(sc, trig, cmd); - + else if (!strn_cmp(cmd, "unset ", 6)) process_unset(sc, trig, cmd); - + else if (!strn_cmp(cmd, "wait ", 5)) { process_wait(go, trig, type, cmd, cl); depth--; @@ -2701,13 +2701,13 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode) else if (!strn_cmp(cmd, "attach ", 7)) process_attach(go, sc, trig, type, cmd); - + else if (!strn_cmp(cmd, "detach ", 7)) process_detach(go, sc, trig, type, cmd); - + else if (!strn_cmp(cmd, "version", 7)) mudlog(NRM, LVL_GOD, TRUE, "%s", DG_SCRIPT_VERSION); - + else { switch (type) { case MOB_TRIGGER: @@ -2722,7 +2722,7 @@ int script_driver(void *go_adress, trig_data *trig, int type, int mode) } if (dg_owner_purged) { depth--; - if (type == OBJ_TRIGGER) + if (type == OBJ_TRIGGER) *(obj_data **)go_adress = NULL; return ret_val; } @@ -2783,7 +2783,7 @@ ACMD(do_tstat) } do_stat_trigger(ch, trig_index[rnum]->proto); - } else + } else send_to_char(ch, "Usage: tstat \r\n"); } @@ -2801,13 +2801,13 @@ find_case(struct trig_data *trig, struct cmdlist_element *cl, char *p, *buf; eval_expr(cond, result, go, sc, trig, type); - + if (!(cl->next)) - return cl; - + return cl; + for (c = cl->next; c->next; c = c->next) { for (p = c->cmd; *p && isspace(*p); p++); - + if (!strn_cmp("while ", p, 6) || !strn_cmp("switch", p, 6)) c = find_done(c); else if (!strn_cmp("case ", p, 5)) { @@ -2820,14 +2820,14 @@ find_case(struct trig_data *trig, struct cmdlist_element *cl, free(buf); } else if (!strn_cmp("default", p, 7)) return c; - else if (!strn_cmp("done", p, 3)) + else if (!strn_cmp("done", p, 3)) return c; } return c; -} - +} + /* -* scans for end of while/switch-blocks. +* scans for end of while/switch-blocks. * returns the line containg 'end', or the last * line of the trigger if not found. * Malformed scripts may cause NULL to be returned. @@ -2836,7 +2836,7 @@ struct cmdlist_element *find_done(struct cmdlist_element *cl) { struct cmdlist_element *c; char *p; - + if (!cl || !(cl->next)) return cl; @@ -2848,7 +2848,7 @@ struct cmdlist_element *find_done(struct cmdlist_element *cl) else if (!strn_cmp("done", p, 3)) return c; } - + return c; } @@ -2900,7 +2900,7 @@ void read_saved_vars(struct char_data *ch) /* if we failed to open the file, return */ if( !file ) { - log("%s had no variable file", GET_NAME(ch)); + log("%s had no variable file", GET_NAME(ch)); return; } /* walk through each line in the file parsing variables */ @@ -2944,7 +2944,7 @@ void save_char_vars(struct char_data *ch) file = fopen(fn,"wt"); if (!file) { - mudlog( NRM, LVL_GOD, TRUE, + mudlog( NRM, LVL_GOD, TRUE, "SYSERR: Could not open player variable file %s for writing.:%s", fn, strerror(errno)); return; @@ -3017,10 +3017,10 @@ void save_char_vars_ascii(FILE *file, struct char_data *ch) for (vars = ch->script->global_vars;vars;vars = vars->next) if (*vars->name != '-') count++; - + if (count != 0) { fprintf(file, "Vars: %d\n", count); - + for (vars = ch->script->global_vars;vars;vars = vars->next) if (*vars->name != '-') /* don't save if it begins with - */ fprintf(file, "%s %ld %s\n", vars->name, vars->context, vars->value); @@ -3036,7 +3036,7 @@ void save_char_vars_ascii(FILE *file, struct char_data *ch) struct lookup_table_t { long uid; - void * c; + void * c; struct lookup_table_t *next; }; struct lookup_table_t lookup_table[BUCKET_COUNT]; @@ -3103,7 +3103,7 @@ void remove_from_lookup_table(long uid) /* * This is not supposed to happen. UID 0 is not used. * However, while I'm debugging the issue, let's just return right away. - * + * * Welcor 02/04 */ if (uid == 0) diff --git a/src/dg_scripts.h b/src/dg_scripts.h index d879ab0..d5a08ce 100644 --- a/src/dg_scripts.h +++ b/src/dg_scripts.h @@ -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) diff --git a/src/dg_triggers.c b/src/dg_triggers.c index 4f469d2..c3f0a3c 100644 --- a/src/dg_triggers.c +++ b/src/dg_triggers.c @@ -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; } diff --git a/src/dg_variables.c b/src/dg_variables.c index 1031f26..adf1b74 100644 --- a/src/dg_variables.c +++ b/src/dg_variables.c @@ -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.()% + %findobj.()% - count number of objects in room X with this name/id/vnum - %findmob.()% + %findmob.()% - 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 .. */ } diff --git a/src/dg_wldcmd.c b/src/dg_wldcmd.c index 6cb9f74..d8585b9 100644 --- a/src/dg_wldcmd.c +++ b/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)); } diff --git a/src/fight.c b/src/fight.c index 84a896e..019a96e 100644 --- a/src/fight.c +++ b/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 diff --git a/src/genmob.c b/src/genmob.c index c7d6f98..ac2fb20 100644 --- a/src/genmob.c +++ b/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]; diff --git a/src/genobj.c b/src/genobj.c index d59ec1e..f05b38b 100644 --- a/src/genobj.c +++ b/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; } diff --git a/src/genobj.h b/src/genobj.h index f82e4e8..67b9bfd 100644 --- a/src/genobj.h +++ b/src/genobj.h @@ -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); diff --git a/src/genolc.c b/src/genolc.c index e2d8c03..9a3cce2 100644 --- a/src/genolc.c +++ b/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; diff --git a/src/genshp.c b/src/genshp.c index 380b72c..bd296a5 100644 --- a/src/genshp.c +++ b/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)); diff --git a/src/genwld.c b/src/genwld.c index c666eb6..5c8aa64 100644 --- a/src/genwld.c +++ b/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]); diff --git a/src/genzon.c b/src/genzon.c index 63c00e6..dada93e 100644 --- a/src/genzon.c +++ b/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); } diff --git a/src/graph.c b/src/graph.c index f92163e..cbd8fa5 100644 --- a/src/graph.c +++ b/src/graph.c @@ -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. * diff --git a/src/handler.c b/src/handler.c index aa143c1..72dadd1 100644 --- a/src/handler.c +++ b/src/handler.c @@ -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)) diff --git a/src/hedit.c b/src/hedit.c index a5a3e3b..4ec0780 100644 --- a/src/hedit.c +++ b/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 \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 \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) diff --git a/src/house.c b/src/house.c index 77ccd78..888aed9 100644 --- a/src/house.c +++ b/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); diff --git a/src/improved-edit.c b/src/improved-edit.c index 0335c89..26527c0 100644 --- a/src/improved-edit.c +++ b/src/improved-edit.c @@ -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: /\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) diff --git a/src/interpreter.c b/src/interpreter.c index 3dde9d0..efad8fa 100644 --- a/src/interpreter.c +++ b/src/interpreter.c @@ -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" diff --git a/src/interpreter.h b/src/interpreter.h index 7eabc0a..0c8bf2a 100644 --- a/src/interpreter.h +++ b/src/interpreter.h @@ -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 diff --git a/src/limits.c b/src/limits.c index 7a35fd9..48be78f 100644 --- a/src/limits.c +++ b/src/limits.c @@ -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); } diff --git a/src/magic.c b/src/magic.c index 3e6bec9..dffb4f7 100644 --- a/src/magic.c +++ b/src/magic.c @@ -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; diff --git a/src/mail.c b/src/mail.c index 5200731..6b299d5 100644 --- a/src/mail.c +++ b/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;irecipient = 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."); diff --git a/src/mail.h b/src/mail.h index 394261f..509c2ed 100644 --- a/src/mail.h +++ b/src/mail.h @@ -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 diff --git a/src/medit.c b/src/medit.c index 6f1ca2c..ea442b6 100644 --- a/src/medit.c +++ b/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; diff --git a/src/modify.c b/src/modify.c index 7101084..4893318 100644 --- a/src/modify.c +++ b/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. */ diff --git a/src/oasis.c b/src/oasis.c index ac28b74..1666c58 100644 --- a/src/oasis.c +++ b/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; diff --git a/src/oasis.h b/src/oasis.h index eab6413..0d1be47 100644 --- a/src/oasis.h +++ b/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 diff --git a/src/oasis_copy.c b/src/oasis_copy.c index f8ebdc6..1507489 100644 --- a/src/oasis_copy.c +++ b/src/oasis_copy.c @@ -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 - 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 \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); } diff --git a/src/oasis_delete.c b/src/oasis_delete.c index f690368..fb80566 100644 --- a/src/oasis_delete.c +++ b/src/oasis_delete.c @@ -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); diff --git a/src/oasis_list.c b/src/oasis_list.c index 968beda..223d375 100644 --- a/src/oasis_list.c +++ b/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 ('.' 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", diff --git a/src/objsave.c b/src/objsave.c index baeedec..bfd106a 100644 --- a/src/objsave.c +++ b/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 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; } diff --git a/src/oedit.c b/src/oedit.c index cb4c111..b36aba0 100644 --- a/src/oedit.c +++ b/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); diff --git a/src/pfdefaults.h b/src/pfdefaults.h index 1930961..0084aea 100644 --- a/src/pfdefaults.h +++ b/src/pfdefaults.h @@ -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 diff --git a/src/players.c b/src/players.c index 8331616..73615b3 100644 --- a/src/players.c +++ b/src/players.c @@ -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]; diff --git a/src/random.c b/src/random.c index a7ec777..1de6de8 100644 --- a/src/random.c +++ b/src/random.c @@ -69,7 +69,7 @@ unsigned long circle_random(void); void circle_srandom(unsigned long initial_seed) { - seed = initial_seed; + seed = initial_seed; } diff --git a/src/redit.c b/src/redit.c index 7d43e51..27f9ada 100644 --- a/src/redit.c +++ b/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. diff --git a/src/sedit.c b/src/sedit.c index dcfdddc..8013091 100644 --- a/src/sedit.c +++ b/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. */ diff --git a/src/shop.c b/src/shop.c index 350be55..75a4947 100644 --- a/src/shop.c +++ b/src/shop.c @@ -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(); diff --git a/src/shop.h b/src/shop.h index 3d5c8f4..eeb7805 100644 --- a/src/shop.h +++ b/src/shop.h @@ -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) diff --git a/src/spec_assign.c b/src/spec_assign.c index 99e8080..eb14f0c 100644 --- a/src/spec_assign.c +++ b/src/spec_assign.c @@ -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); } diff --git a/src/spec_procs.c b/src/spec_procs.c index d5c486a..485b5f7 100644 --- a/src/spec_procs.c +++ b/src/spec_procs.c @@ -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)]) { diff --git a/src/spell_parser.c b/src/spell_parser.c index a6a5eb6..1e95d01 100644 --- a/src/spell_parser.c +++ b/src/spell_parser.c @@ -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; } diff --git a/src/spells.c b/src/spells.c index efaf23c..65967d1 100644 --- a/src/spells.c +++ b/src/spells.c @@ -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; diff --git a/src/spells.h b/src/spells.h index ad98148..57c4aeb 100644 --- a/src/spells.h +++ b/src/spells.h @@ -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'. */ diff --git a/src/structs.h b/src/structs.h index 8a8ff0e..0be83df 100644 --- a/src/structs.h +++ b/src/structs.h @@ -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. */ diff --git a/src/sysdep.h b/src/sysdep.h index 8ac823c..2a25e14 100644 --- a/src/sysdep.h +++ b/src/sysdep.h @@ -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 diff --git a/src/tedit.c b/src/tedit.c index da8465c..8759514 100644 --- a/src/tedit.c +++ b/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); diff --git a/src/utils.c b/src/utils.c index 77be200..cbd042e 100644 --- a/src/utils.c +++ b/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++) diff --git a/src/utils.h b/src/utils.h index 4e2f85e..393c407 100644 --- a/src/utils.h +++ b/src/utils.h @@ -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) diff --git a/src/zedit.c b/src/zedit.c index cebe373..09507dc 100644 --- a/src/zedit.c +++ b/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 - \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: /* diff --git a/src/zmalloc.c b/src/zmalloc.c index dfbc7e5..38c8cab 100644 --- a/src/zmalloc.c +++ b/src/zmalloc.c @@ -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();