From cde4b84be16b4f81daa7af777a954a9025183b8d Mon Sep 17 00:00:00 2001 From: Thomas Arp <357770+welcor@users.noreply.github.com> Date: Sat, 8 Jun 2024 12:12:54 +0200 Subject: [PATCH 1/4] Update FAQ.txt (#130) Added info about generated maps for the areas on tbaMUD --- doc/FAQ.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/FAQ.txt b/doc/FAQ.txt index ac1321d..3b28a08 100644 --- a/doc/FAQ.txt +++ b/doc/FAQ.txt @@ -257,6 +257,9 @@ http://tbamud.com All donated areas have been added to the latest version of tbaMUD. If you wish to donate some of your own work stop by the Builder Academy. +https://github.com/rds1983 has generated maps of all the existing areas, +and they can be found here: https://mudmapbuilder.github.io/ + 2.3. I have questions about tbaMUD. Where should I go? Stop by The Builder Academy at tbamud.com 9091 or the website at: From ac711ffff8b768e102bf4cb015457cdb47f2706f Mon Sep 17 00:00:00 2001 From: Dan Danese Date: Tue, 18 Jun 2024 14:56:13 -0400 Subject: [PATCH 2/4] Update wld2html.c (#131) Triggers on elements of the room break this utility. Added code to toss them since we don't need them. Can add handling that pulls the trigger info later if desired, but too time consuming to index them before building the room for this simple tool. --- src/util/wld2html.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/util/wld2html.c b/src/util/wld2html.c index 9afc9c8..ac3c111 100755 --- a/src/util/wld2html.c +++ b/src/util/wld2html.c @@ -257,6 +257,9 @@ void discrete_load(FILE * fl) fprintf(stderr, "Format error after room #%d\n", nr); exit(1); } + if (*line == 'T') //Toss triggers. THey currently break this util. + return; + if (*line == '$') return; From 317286d051d667918aede914b2834d5d222ba494 Mon Sep 17 00:00:00 2001 From: Thomas Arp <357770+welcor@users.noreply.github.com> Date: Thu, 20 Jun 2024 19:31:20 +0200 Subject: [PATCH 3/4] Ignore project files on commit, and fix the automap bug showing two (#133) descriptions --- .gitignore | 73 +++++++++- src/act.informative.c | 329 +++++++++++++++++++++--------------------- 2 files changed, 238 insertions(+), 164 deletions(-) diff --git a/.gitignore b/.gitignore index e8e8f46..29a5738 100644 --- a/.gitignore +++ b/.gitignore @@ -12,4 +12,75 @@ src/depend src/util/depend build/* !build/create_solution.bat -!build/README.md \ No newline at end of file +!build/README.md + +# Do not commit files from players +lib/plrfiles/A-E/* +lib/plrfiles/F-J/* +lib/plrfiles/K-O/* +lib/plrfiles/P-T/* +lib/plrfiles/U-Z/* +lib/plrfiles/ZZZ/* +lib/plrfiles/index + +# but do commit the placeholders +!lib/plrfiles/A-E/00 +!lib/plrfiles/F-J/00 +!lib/plrfiles/K-O/00 +!lib/plrfiles/P-T/00 +!lib/plrfiles/U-Z/00 +!lib/plrfiles/ZZZ/00 + +# or vars +lib/plrvars/A-E/* +lib/plrvars/F-J/* +lib/plrvars/K-O/* +lib/plrvars/P-T/* +lib/plrvars/U-Z/* +lib/plrvars/ZZZ/* +lib/plrvars/index + +# except the placeholders +!lib/plrvars/A-E/00 +!lib/plrvars/F-J/00 +!lib/plrvars/K-O/00 +!lib/plrvars/P-T/00 +!lib/plrvars/U-Z/00 +!lib/plrvars/ZZZ/00 + +# or objects +lib/plrobjs/A-E/* +lib/plrobjs/F-J/* +lib/plrobjs/K-O/* +lib/plrobjs/P-T/* +lib/plrobjs/U-Z/* +lib/plrobjs/ZZZ/* +lib/plrobjs/index + +# except the placeholders +!lib/plrobjs/A-E/00 +!lib/plrobjs/F-J/00 +!lib/plrobjs/K-O/00 +!lib/plrobjs/P-T/00 +!lib/plrobjs/U-Z/00 +!lib/plrobjs/ZZZ/00 + +# also not autogenerated config file +/lib/etc/config +# or the list of last logins +/lib/etc/last +# or mail +lib/etc/plrmail + +# test object files, etc +src/test/depend +src/test/*.o +src/test/testfile + + +# ide etc. +.vscode +.project +.settings + +.cproject \ No newline at end of file diff --git a/src/act.informative.c b/src/act.informative.c index 79705f3..5298e1c 100644 --- a/src/act.informative.c +++ b/src/act.informative.c @@ -51,7 +51,7 @@ static void perform_mortal_where(struct char_data *ch, char *arg); static void print_object_location(int num, struct obj_data *obj, struct char_data *ch, int recur); /* Subcommands */ -/* For show_obj_to_char 'mode'. /-- arbitrary */ +/* For show_obj_to_char 'mode'. /-- arbitrary */ #define SHOW_OBJ_LONG 0 #define SHOW_OBJ_SHORT 1 #define SHOW_OBJ_ACTION 2 @@ -125,7 +125,7 @@ static void show_obj_to_char(struct obj_data *obj, struct char_data *ch, int mod snprintf(notebuf, sizeof(notebuf), "There is something written on it:\r\n\r\n%s", obj->action_description); page_string(ch->desc, notebuf, TRUE); } else - send_to_char(ch, "It's blank.\r\n"); + send_to_char(ch, "It's blank.\r\n"); return; case ITEM_DRINKCON: @@ -225,14 +225,14 @@ static void diag_char_to_char(struct char_data *i, struct char_data *ch) byte percent; const char *text; } diagnosis[] = { - { 100, "is in excellent condition." }, - { 90, "has a few scratches." }, - { 75, "has some small wounds and bruises." }, - { 50, "has quite a few wounds." }, - { 30, "has some big nasty wounds and scratches." }, - { 15, "looks pretty hurt." }, - { 0, "is in awful condition." }, - { -1, "is bleeding awfully from big wounds." }, + { 100, "is in excellent condition." }, + { 90, "has a few scratches." }, + { 75, "has some small wounds and bruises." }, + { 50, "has quite a few wounds." }, + { 30, "has some big nasty wounds and scratches." }, + { 15, "looks pretty hurt." }, + { 0, "is in awful condition." }, + { -1, "is bleeding awfully from big wounds." }, }; int percent, ar_index; const char *pers = PERS(i, ch); @@ -240,7 +240,7 @@ static void diag_char_to_char(struct char_data *i, struct char_data *ch) if (GET_MAX_HIT(i) > 0) percent = (100 * GET_HIT(i)) / GET_MAX_HIT(i); else - percent = -1; /* How could MAX_HIT be < 1?? */ + percent = -1; /* How could MAX_HIT be < 1?? */ for (ar_index = 0; diagnosis[ar_index].percent >= 0; ar_index++) if (percent >= diagnosis[ar_index].percent) @@ -269,12 +269,12 @@ static void look_at_char(struct char_data *i, struct char_data *ch) found = TRUE; if (found) { - send_to_char(ch, "\r\n"); /* act() does capitalization. */ + send_to_char(ch, "\r\n"); /* act() does capitalization. */ act("$n is using:", FALSE, i, 0, ch, TO_VICT); for (j = 0; j < NUM_WEARS; j++) if (GET_EQ(i, j) && CAN_SEE_OBJ(ch, GET_EQ(i, j))) { - send_to_char(ch, "%s", wear_where[j]); - show_obj_to_char(GET_EQ(i, j), ch, SHOW_OBJ_SHORT); + send_to_char(ch, "%s", wear_where[j]); + show_obj_to_char(GET_EQ(i, j), ch, SHOW_OBJ_SHORT); } } if (ch != i && (IS_THIEF(ch) || GET_LEVEL(ch) >= LVL_IMMORT)) { @@ -300,7 +300,7 @@ static void list_one_char(struct char_data *i, struct char_data *ch) if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_SHOWVNUMS)) { if (IS_NPC(i)) - send_to_char(ch, "[%d] ", GET_MOB_VNUM(i)); + send_to_char(ch, "[%d] ", GET_MOB_VNUM(i)); if (SCRIPT(i) && TRIGGERS(SCRIPT(i))) { if (!TRIGGERS(SCRIPT(i))->next) send_to_char(ch, "[T%d] ", GET_TRIG_VNUM(TRIGGERS(SCRIPT(i)))); @@ -312,12 +312,12 @@ static void list_one_char(struct char_data *i, struct char_data *ch) if (GROUP(i)) { if (GROUP(i) == GROUP(ch)) send_to_char(ch, "(%s%s%s) ", CBGRN(ch, C_NRM), - GROUP_LEADER(GROUP(i)) == i ? "leader" : "group", - CCNRM(ch, C_NRM)); + GROUP_LEADER(GROUP(i)) == i ? "leader" : "group", + CCNRM(ch, C_NRM)); else send_to_char(ch, "(%s%s%s) ", CBRED(ch, C_NRM), - GROUP_LEADER(GROUP(i)) == i ? "leader" : "group", - CCNRM(ch, C_NRM)); + GROUP_LEADER(GROUP(i)) == i ? "leader" : "group", + CCNRM(ch, C_NRM)); } if (IS_NPC(i) && i->player.long_descr && GET_POS(i) == GET_DEFAULT_POS(i)) { @@ -326,9 +326,9 @@ static void list_one_char(struct char_data *i, struct char_data *ch) if (AFF_FLAGGED(ch, AFF_DETECT_ALIGN)) { if (IS_EVIL(i)) - send_to_char(ch, "(Red Aura) "); + send_to_char(ch, "(Red Aura) "); else if (IS_GOOD(i)) - send_to_char(ch, "(Blue Aura) "); + send_to_char(ch, "(Blue Aura) "); } send_to_char(ch, "%s", i->player.long_descr); @@ -361,24 +361,24 @@ static void list_one_char(struct char_data *i, struct char_data *ch) if (GET_POS(i) != POS_FIGHTING) { if (!SITTING(i)) send_to_char(ch, "%s", positions[(int) GET_POS(i)]); - else { - furniture = SITTING(i); - send_to_char(ch, " is %s upon %s.", (GET_POS(i) == POS_SLEEPING ? + else { + furniture = SITTING(i); + send_to_char(ch, " is %s upon %s.", (GET_POS(i) == POS_SLEEPING ? "sleeping" : (GET_POS(i) == POS_RESTING ? "resting" : "sitting")), OBJS(furniture, ch)); - } + } } else { if (FIGHTING(i)) { send_to_char(ch, " is here, fighting "); if (FIGHTING(i) == ch) - send_to_char(ch, "YOU!"); + send_to_char(ch, "YOU!"); else { - if (IN_ROOM(i) == IN_ROOM(FIGHTING(i))) - send_to_char(ch, "%s!", PERS(FIGHTING(i), ch)); - else - send_to_char(ch, "someone who has already left!"); + if (IN_ROOM(i) == IN_ROOM(FIGHTING(i))) + send_to_char(ch, "%s!", PERS(FIGHTING(i), ch)); + else + send_to_char(ch, "someone who has already left!"); } - } else /* NIL fighting pointer */ + } else /* NIL fighting pointer */ send_to_char(ch, " is here struggling with thin air."); } @@ -402,13 +402,13 @@ static void list_char_to_char(struct char_data *list, struct char_data *ch) if (ch != i) { /* hide npcs whose description starts with a '.' from non-holylighted people - Idea from Elaseth of TBA */ if (!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_HOLYLIGHT) && - IS_NPC(i) && i->player.long_descr && *i->player.long_descr == '.') + IS_NPC(i) && i->player.long_descr && *i->player.long_descr == '.') continue; send_to_char(ch, "%s", CCYEL(ch, C_NRM)); if (CAN_SEE(ch, i)) list_one_char(i, ch); else if (IS_DARK(IN_ROOM(ch)) && !CAN_SEE_IN_DARK(ch) && - AFF_FLAGGED(i, AFF_INFRAVISION)) + AFF_FLAGGED(i, AFF_INFRAVISION)) send_to_char(ch, "You see a pair of glowing red eyes looking your way.\r\n"); send_to_char(ch, "%s", CCNRM(ch, C_NRM)); } @@ -425,12 +425,12 @@ static void do_auto_exits(struct char_data *ch) continue; if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED) && !CONFIG_DISP_CLOSED_DOORS) continue; - if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) && !PRF_FLAGGED(ch, PRF_HOLYLIGHT)) - continue; + if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) && !PRF_FLAGGED(ch, PRF_HOLYLIGHT)) + continue; if (EXIT_FLAGGED(EXIT(ch, door), EX_CLOSED)) - send_to_char(ch, "%s(%s)%s ", EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? CCWHT(ch, C_NRM) : CCRED(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM)); - else if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN)) - send_to_char(ch, "%s%s%s ", CCWHT(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM)); + send_to_char(ch, "%s(%s)%s ", EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN) ? CCWHT(ch, C_NRM) : CCRED(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM)); + else if (EXIT_FLAGGED(EXIT(ch, door), EX_HIDDEN)) + send_to_char(ch, "%s%s%s ", CCWHT(ch, C_NRM), autoexits[door], CCCYN(ch, C_NRM)); else send_to_char(ch, "\t(%s\t) ", autoexits[door]); slen++; @@ -521,23 +521,25 @@ void look_at_room(struct char_data *ch, int ignore_brief) } else send_to_char(ch, "%s", world[IN_ROOM(ch)].name); - send_to_char(ch, "%s\r\n", CCNRM(ch, C_NRM)); - if ((!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_BRIEF)) || ignore_brief || - ROOM_FLAGGED(IN_ROOM(ch), ROOM_DEATH)) { - if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOMAP) && can_see_map(ch)) - str_and_map(world[target_room].description, ch, target_room); - } + send_to_char(ch, "%s\r\n", CCNRM(ch, C_NRM)); - send_to_char(ch, "%s", world[IN_ROOM(ch)].description); + if ((!IS_NPC(ch) && !PRF_FLAGGED(ch, PRF_BRIEF)) || ignore_brief || + ROOM_FLAGGED(IN_ROOM(ch), ROOM_DEATH)) { + if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOMAP) && can_see_map(ch)) + str_and_map(world[target_room].description, ch, target_room); + else + send_to_char(ch, "%s", world[IN_ROOM(ch)].description); + } - /*autoexits */ - if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOEXIT)) - do_auto_exits(ch); - /*now list characters &objects */ - list_obj_to_char(world[IN_ROOM(ch)].contents, ch, SHOW_OBJ_LONG, FALSE); - list_char_to_char(world[IN_ROOM(ch)].people, ch); + /*autoexits */ + if (!IS_NPC(ch) && PRF_FLAGGED(ch, PRF_AUTOEXIT)) + do_auto_exits(ch); + + /*now list characters &objects */ + list_obj_to_char(world[IN_ROOM(ch)].contents, ch, SHOW_OBJ_LONG, FALSE); + list_char_to_char(world[IN_ROOM(ch)].people, ch); } static void look_in_direction(struct char_data *ch, int dir) @@ -565,35 +567,35 @@ static void look_in_obj(struct char_data *ch, char *arg) if (!*arg) send_to_char(ch, "Look in what?\r\n"); else if (!(bits = generic_find(arg, FIND_OBJ_INV | FIND_OBJ_ROOM | - FIND_OBJ_EQUIP, ch, &dummy, &obj))) { + FIND_OBJ_EQUIP, ch, &dummy, &obj))) { send_to_char(ch, "There doesn't seem to be %s %s here.\r\n", AN(arg), arg); } else if ((GET_OBJ_TYPE(obj) != ITEM_DRINKCON) && - (GET_OBJ_TYPE(obj) != ITEM_FOUNTAIN) && - (GET_OBJ_TYPE(obj) != ITEM_CONTAINER)) + (GET_OBJ_TYPE(obj) != ITEM_FOUNTAIN) && + (GET_OBJ_TYPE(obj) != ITEM_CONTAINER)) send_to_char(ch, "There's nothing inside that!\r\n"); else { if (GET_OBJ_TYPE(obj) == ITEM_CONTAINER) { if (OBJVAL_FLAGGED(obj, CONT_CLOSED) && (GET_LEVEL(ch) < LVL_IMMORT || !PRF_FLAGGED(ch, PRF_NOHASSLE))) - send_to_char(ch, "It is closed.\r\n"); + send_to_char(ch, "It is closed.\r\n"); else { - send_to_char(ch, "%s", fname(obj->name)); - switch (bits) { - case FIND_OBJ_INV: - send_to_char(ch, " (carried): \r\n"); - break; - case FIND_OBJ_ROOM: - send_to_char(ch, " (here): \r\n"); - break; - case FIND_OBJ_EQUIP: - send_to_char(ch, " (used): \r\n"); - break; - } + send_to_char(ch, "%s", fname(obj->name)); + switch (bits) { + case FIND_OBJ_INV: + send_to_char(ch, " (carried): \r\n"); + break; + case FIND_OBJ_ROOM: + send_to_char(ch, " (here): \r\n"); + break; + case FIND_OBJ_EQUIP: + send_to_char(ch, " (used): \r\n"); + break; + } - list_obj_to_char(obj->contains, ch, SHOW_OBJ_SHORT, TRUE); + list_obj_to_char(obj->contains, ch, SHOW_OBJ_SHORT, TRUE); } - } else { /* item must be a fountain or drink container */ + } else { /* item must be a fountain or drink container */ if ((GET_OBJ_VAL(obj, 1) == 0) && (GET_OBJ_VAL(obj, 0) != -1)) - send_to_char(ch, "It is empty.\r\n"); + send_to_char(ch, "It is empty.\r\n"); else { if (GET_OBJ_VAL(obj, 0) < 0) { @@ -601,14 +603,15 @@ static void look_in_obj(struct char_data *ch, char *arg) sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2)); send_to_char(ch, "It's full of a %s liquid.\r\n", buf2); } - else if (GET_OBJ_VAL(obj,1)>GET_OBJ_VAL(obj,0)) + else if (GET_OBJ_VAL(obj,1)>GET_OBJ_VAL(obj,0)) send_to_char(ch, "Its contents seem somewhat murky.\r\n"); /* BUG */ - else { + else + { char buf2[MAX_STRING_LENGTH]; - amt = (GET_OBJ_VAL(obj, 1) * 3) / GET_OBJ_VAL(obj, 0); - sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2)); - send_to_char(ch, "It's %sfull of a %s liquid.\r\n", fullness[amt], buf2); - } + amt = (GET_OBJ_VAL(obj, 1) * 3) / GET_OBJ_VAL(obj, 0); + sprinttype(GET_OBJ_VAL(obj, 2), color_liquid, buf2, sizeof(buf2)); + send_to_char(ch, "It's %sfull of a %s liquid.\r\n", fullness[amt], buf2); + } } } } @@ -645,14 +648,14 @@ static void look_at_target(struct char_data *ch, char *arg) } bits = generic_find(arg, FIND_OBJ_INV | FIND_OBJ_ROOM | FIND_OBJ_EQUIP | - FIND_CHAR_ROOM, ch, &found_char, &found_obj); + FIND_CHAR_ROOM, ch, &found_char, &found_obj); /* Is the target a character? */ if (found_char != NULL) { look_at_char(found_char, ch); if (ch != found_char) { if (CAN_SEE(found_char, ch)) - act("$n looks at you.", TRUE, ch, 0, found_char, TO_VICT); + act("$n looks at you.", TRUE, ch, 0, found_char, TO_VICT); act("$n looks at $N.", TRUE, ch, 0, found_char, TO_NOTVICT); } return; @@ -674,16 +677,16 @@ static void look_at_target(struct char_data *ch, char *arg) for (j = 0; j < NUM_WEARS && !found; j++) if (GET_EQ(ch, j) && CAN_SEE_OBJ(ch, GET_EQ(ch, j))) if ((desc = find_exdesc(arg, GET_EQ(ch, j)->ex_description)) != NULL && ++i == fnum) { - send_to_char(ch, "%s", desc); - found = TRUE; + send_to_char(ch, "%s", desc); + found = TRUE; } /* Does the argument match an extra desc in the char's inventory? */ for (obj = ch->carrying; obj && !found; obj = obj->next_content) { if (CAN_SEE_OBJ(ch, obj)) if ((desc = find_exdesc(arg, obj->ex_description)) != NULL && ++i == fnum) { - send_to_char(ch, "%s", desc); - found = TRUE; + send_to_char(ch, "%s", desc); + found = TRUE; } } @@ -691,8 +694,8 @@ static void look_at_target(struct char_data *ch, char *arg) for (obj = world[IN_ROOM(ch)].contents; obj && !found; obj = obj->next_content) if (CAN_SEE_OBJ(ch, obj)) if ((desc = find_exdesc(arg, obj->ex_description)) != NULL && ++i == fnum) { - send_to_char(ch, "%s", desc); - found = TRUE; + send_to_char(ch, "%s", desc); + found = TRUE; } /* If an object was found back in generic_find */ @@ -722,7 +725,7 @@ ACMD(do_look) send_to_char(ch, "You can't see a damned thing, you're blind!\r\n"); else if (IS_DARK(IN_ROOM(ch)) && !CAN_SEE_IN_DARK(ch)) { send_to_char(ch, "It is pitch black...\r\n"); - list_char_to_char(world[IN_ROOM(ch)].people, ch); /* glowing red eyes */ + list_char_to_char(world[IN_ROOM(ch)].people, ch); /* glowing red eyes */ } else { char arg[MAX_INPUT_LENGTH], arg2[MAX_INPUT_LENGTH]; @@ -730,12 +733,12 @@ ACMD(do_look) if (subcmd == SCMD_READ) { if (!*arg) - send_to_char(ch, "Read what?\r\n"); + send_to_char(ch, "Read what?\r\n"); else - look_at_target(ch, strcpy(tempsave, arg)); + look_at_target(ch, strcpy(tempsave, arg)); return; } - if (!*arg) /* "look" alone, without an argument at all */ + if (!*arg) /* "look" alone, without an argument at all */ look_at_room(ch, 1); else if (is_abbrev(arg, "in")) look_in_obj(ch, arg2); @@ -775,15 +778,15 @@ ACMD(do_examine) } /* look_at_target() eats the number. */ - look_at_target(ch, strcpy(tempsave, arg)); /* strcpy: OK */ + look_at_target(ch, strcpy(tempsave, arg)); /* strcpy: OK */ generic_find(arg, FIND_OBJ_INV | FIND_OBJ_ROOM | FIND_CHAR_ROOM | - FIND_OBJ_EQUIP, ch, &tmp_char, &tmp_object); + FIND_OBJ_EQUIP, ch, &tmp_char, &tmp_object); if (tmp_object) { if ((GET_OBJ_TYPE(tmp_object) == ITEM_DRINKCON) || - (GET_OBJ_TYPE(tmp_object) == ITEM_FOUNTAIN) || - (GET_OBJ_TYPE(tmp_object) == ITEM_CONTAINER)) { + (GET_OBJ_TYPE(tmp_object) == ITEM_FOUNTAIN) || + (GET_OBJ_TYPE(tmp_object) == ITEM_CONTAINER)) { send_to_char(ch, "When you look inside, you see:\r\n"); look_in_obj(ch, arg); } @@ -815,18 +818,18 @@ ACMD(do_score) send_to_char(ch, "\r\n"); send_to_char(ch, "You have %d(%d) hit, %d(%d) mana and %d(%d) movement points.\r\n", - GET_HIT(ch), GET_MAX_HIT(ch), GET_MANA(ch), GET_MAX_MANA(ch), - GET_MOVE(ch), GET_MAX_MOVE(ch)); + GET_HIT(ch), GET_MAX_HIT(ch), GET_MANA(ch), GET_MAX_MANA(ch), + GET_MOVE(ch), GET_MAX_MOVE(ch)); send_to_char(ch, "Your armor class is %d/10, and your alignment is %d.\r\n", - compute_armor_class(ch), GET_ALIGNMENT(ch)); + compute_armor_class(ch), GET_ALIGNMENT(ch)); send_to_char(ch, "You have %d exp, %d gold coins, and %d questpoints.\r\n", - GET_EXP(ch), GET_GOLD(ch), GET_QUESTPOINTS(ch)); + GET_EXP(ch), GET_GOLD(ch), GET_QUESTPOINTS(ch)); if (GET_LEVEL(ch) < LVL_IMMORT) send_to_char(ch, "You need %d exp to reach your next level.\r\n", - level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 1) - GET_EXP(ch)); + level_exp(GET_CLASS(ch), GET_LEVEL(ch) + 1) - GET_EXP(ch)); send_to_char(ch, "You have earned %d quest points.\r\n", GET_QUESTPOINTS(ch)); send_to_char(ch, "You have completed %d quest%s, ", @@ -845,13 +848,13 @@ ACMD(do_score) } playing_time = *real_time_passed((time(0) - ch->player.time.logon) + - ch->player.time.played, 0); + ch->player.time.played, 0); send_to_char(ch, "You have been playing for %d day%s and %d hour%s.\r\n", playing_time.day, playing_time.day == 1 ? "" : "s", playing_time.hours, playing_time.hours == 1 ? "" : "s"); send_to_char(ch, "This ranks you as %s %s (level %d).\r\n", - GET_NAME(ch), GET_TITLE(ch), GET_LEVEL(ch)); + GET_NAME(ch), GET_TITLE(ch), GET_LEVEL(ch)); switch (GET_POS(ch)) { case POS_DEAD: @@ -982,8 +985,8 @@ ACMD(do_time) weekday = ((35 * time_info.month) + day) % 7; send_to_char(ch, "It is %d o'clock %s, on %s.\r\n", - (time_info.hours % 12 == 0) ? 12 : (time_info.hours % 12), - time_info.hours >= 12 ? "pm" : "am", weekdays[weekday]); + (time_info.hours % 12 == 0) ? 12 : (time_info.hours % 12), + time_info.hours >= 12 ? "pm" : "am", weekdays[weekday]); /* Peter Ajamian supplied the following as a fix for a bug introduced in the * ordinal display that caused 11, 12, and 13 to be incorrectly displayed as @@ -1005,7 +1008,7 @@ ACMD(do_time) } } send_to_char(ch, "The %d%s Day of the %s, Year %d.\r\n", - day, suf, month_name[time_info.month], time_info.year); + day, suf, month_name[time_info.month], time_info.year); } ACMD(do_weather) @@ -1020,8 +1023,8 @@ ACMD(do_weather) if (OUTSIDE(ch)) { send_to_char(ch, "The sky is %s and %s.\r\n", sky_look[weather_info.sky], - weather_info.change >= 0 ? "you feel a warm wind from south" : - "your foot tells you bad weather is due"); + weather_info.change >= 0 ? "you feel a warm wind from south" : + "your foot tells you bad weather is due"); if (GET_LEVEL(ch) >= LVL_GOD) send_to_char(ch, "Pressure: %d (change: %d), Sky: %d (%s)\r\n", weather_info.pressure, @@ -1379,7 +1382,7 @@ ACMD(do_users) host_search[0] = name_search[0] = '\0'; - strcpy(buf, argument); /* strcpy: OK (sizeof: argument == buf) */ + strcpy(buf, argument); /* strcpy: OK (sizeof: argument == buf) */ while (*buf) { char buf1[MAX_INPUT_LENGTH]; @@ -1389,49 +1392,49 @@ ACMD(do_users) switch (mode) { case 'o': case 'k': - outlaws = 1; - playing = 1; - strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ - break; + outlaws = 1; + playing = 1; + strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ + break; case 'p': - playing = 1; - strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ - break; + playing = 1; + strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ + break; case 'd': - deadweight = 1; - strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ - break; + deadweight = 1; + strcpy(buf, buf1); /* strcpy: OK (sizeof: buf1 == buf) */ + break; case 'l': - playing = 1; - half_chop(buf1, arg, buf); - sscanf(arg, "%d-%d", &low, &high); - break; + playing = 1; + half_chop(buf1, arg, buf); + sscanf(arg, "%d-%d", &low, &high); + break; case 'n': - playing = 1; - half_chop(buf1, name_search, buf); - break; + playing = 1; + half_chop(buf1, name_search, buf); + break; case 'h': - playing = 1; - half_chop(buf1, host_search, buf); - break; + playing = 1; + half_chop(buf1, host_search, buf); + break; case 'c': - playing = 1; - half_chop(buf1, arg, buf); - showclass = find_class_bitvector(arg); - break; + playing = 1; + half_chop(buf1, arg, buf); + showclass = find_class_bitvector(arg); + break; default: - send_to_char(ch, "%s", USERS_FORMAT); - return; - } /* end of switch */ + send_to_char(ch, "%s", USERS_FORMAT); + return; + } /* end of switch */ - } else { /* endif */ + } else { /* endif */ send_to_char(ch, "%s", USERS_FORMAT); return; } - } /* end while (parser) */ + } /* end while (parser) */ send_to_char(ch, - "Num Class Name State Idl Login\t* Site\r\n" - "--- ------- ------------ -------------- ----- -------- ------------------------\r\n"); + "Num Class Name State Idl Login\t* Site\r\n" + "--- ------- ------------ -------------- ----- -------- ------------------------\r\n"); one_argument(argument, arg); @@ -1453,7 +1456,7 @@ ACMD(do_users) 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)) + !PLR_FLAGGED(tch, PLR_THIEF)) continue; if (showclass && !(showclass & (1 << GET_CLASS(tch)))) continue; @@ -1461,11 +1464,11 @@ ACMD(do_users) continue; if (d->original) - sprintf(classname, "[%2d %s]", GET_LEVEL(d->original), - CLASS_ABBR(d->original)); + sprintf(classname, "[%2d %s]", GET_LEVEL(d->original), + CLASS_ABBR(d->original)); else - sprintf(classname, "[%2d %s]", GET_LEVEL(d->character), - CLASS_ABBR(d->character)); + sprintf(classname, "[%2d %s]", GET_LEVEL(d->character), + CLASS_ABBR(d->character)); } else strcpy(classname, " - "); @@ -1478,15 +1481,15 @@ ACMD(do_users) if (d->character && STATE(d) == CON_PLAYING) sprintf(idletime, "%5d", d->character->char_specials.timer * - SECS_PER_MUD_HOUR / SECS_PER_REAL_MIN); + SECS_PER_MUD_HOUR / SECS_PER_REAL_MIN); else strcpy(idletime, " "); sprintf(line, "%3d %-7s %-12s %-14s %-3s %-8s ", d->desc_num, classname, - d->original && d->original->player.name ? d->original->player.name : - d->character && d->character->player.name ? d->character->player.name : - "UNDEFINED", - state, idletime, timestr); + d->original && d->original->player.name ? d->original->player.name : + d->character && d->character->player.name ? d->character->player.name : + "UNDEFINED", + state, idletime, timestr); if (*d->host) sprintf(line + strlen(line), "[%s]\r\n", d->host); @@ -1576,23 +1579,23 @@ static void perform_mortal_where(struct char_data *ch, char *arg) send_to_char(ch, "Players in %s\tn.\r\n--------------------\r\n", zone_table[j].name); for (d = descriptor_list; d; d = d->next) { if (STATE(d) != CON_PLAYING || d->character == ch) - continue; + continue; if ((i = (d->original ? d->original : d->character)) == NULL) - continue; + continue; if (IN_ROOM(i) == NOWHERE || !CAN_SEE(ch, i)) - continue; + continue; if (world[IN_ROOM(ch)].zone != world[IN_ROOM(i)].zone) - continue; + continue; send_to_char(ch, "%-20s%s - %s%s\r\n", GET_NAME(i), QNRM, world[IN_ROOM(i)].name, QNRM); } - } else { /* print only FIRST char, not all. */ + } else { /* print only FIRST char, not all. */ for (i = character_list; i; i = i->next) { if (IN_ROOM(i) == NOWHERE || i == ch) - continue; + continue; if (!CAN_SEE(ch, i) || world[IN_ROOM(i)].zone != world[IN_ROOM(ch)].zone) - continue; + continue; if (!isname(arg, i->player.name)) - continue; + continue; send_to_char(ch, "%-25s%s - %s%s\r\n", GET_NAME(i), QNRM, world[IN_ROOM(i)].name, QNRM); return; } @@ -1601,7 +1604,7 @@ static void perform_mortal_where(struct char_data *ch, char *arg) } static void print_object_location(int num, struct obj_data *obj, struct char_data *ch, - int recur) + int recur) { if (num > 0) send_to_char(ch, "O%3d. %-25s%s - ", num, obj->short_description, QNRM); @@ -1666,7 +1669,7 @@ static void perform_immort_where(struct char_data *ch, char *arg) else send_to_char(ch, "[TRIGS] "); } - send_to_char(ch, "%s\r\n", QNRM); + send_to_char(ch, "%s\r\n", QNRM); } for (num = 0, k = object_list; k; k = k->next) if (CAN_SEE_OBJ(ch, k) && isname(arg, k->name)) { @@ -1735,7 +1738,7 @@ ACMD(do_levels) for (i = min_lev; i < max_lev; i++) { nlen = snprintf(buf + len, sizeof(buf) - len, "[%2d] %8d-%-8d : ", (int)i, - level_exp(GET_CLASS(ch), i), level_exp(GET_CLASS(ch), i + 1) - 1); + level_exp(GET_CLASS(ch), i), level_exp(GET_CLASS(ch), i + 1) - 1); if (len + nlen >= sizeof(buf)) break; len += nlen; @@ -1759,7 +1762,7 @@ ACMD(do_levels) if (len < sizeof(buf) && max_lev == LVL_IMMORT) snprintf(buf + len, sizeof(buf) - len, "[%2d] %8d : Immortality\r\n", - LVL_IMMORT, level_exp(GET_CLASS(ch), LVL_IMMORT)); + LVL_IMMORT, level_exp(GET_CLASS(ch), LVL_IMMORT)); page_string(ch->desc, buf, TRUE); } @@ -1949,14 +1952,14 @@ ACMD(do_toggle) else sprintf(buf2, "%-3.3d", GET_WIMP_LEV(ch)); /* sprintf: OK */ - if (GET_LEVEL(ch) == LVL_IMPL) { + if (GET_LEVEL(ch) == LVL_IMPL) { send_to_char(ch, " SlowNameserver: %-3s " - " " - " Trackthru Doors: %-3s\r\n", + " " + " Trackthru Doors: %-3s\r\n", - ONOFF(CONFIG_NS_IS_SLOW), - ONOFF(CONFIG_TRACK_T_DOORS)); + ONOFF(CONFIG_NS_IS_SLOW), + ONOFF(CONFIG_TRACK_T_DOORS)); } if (GET_LEVEL(ch) >= LVL_IMMORT) { From 762cb77c60cbe7c9ade0fe7e0ad3c2bcaea96907 Mon Sep 17 00:00:00 2001 From: Dan Danese Date: Thu, 20 Jun 2024 13:56:51 -0400 Subject: [PATCH 4/4] Fix a bug with the prior commit for handling triggers. It should have (#132) continued the loop, not returned since it isn't likely to be the end of the wld file. Added the ability to specify multiple files on the command line. This will load all files passed before processing into html files. This is to fix the 'missing exits' from the output html files. The prior version only worked on a single zone or wld file and generated incomplete output. The record count was moved global to enable proper tracking of the entire world. The index_boot function was modified to scan the files first, get a record count, then start over and load the room records. example usage: wld2html *.wld This command will generate the entire world as one html file per room. Fixed room number roll over. The original was using a short int which is a 16bit int and rolls at 32k. Fixed an issue where the html files would get negative names due to integer rollover. It had something to do with sprintf an int using %d, but only if you passed that to fopen. Casting the int (room number) to a long before using sprintf with %ld fixed the issue. Added the missing four directions from the dir_names array and defines. Co-authored-by: Dan Danese --- src/util/wld2html.c | 149 +++++++++++++++++++++++--------------------- 1 file changed, 77 insertions(+), 72 deletions(-) diff --git a/src/util/wld2html.c b/src/util/wld2html.c index ac3c111..410d0bc 100755 --- a/src/util/wld2html.c +++ b/src/util/wld2html.c @@ -12,7 +12,6 @@ #include "conf.h" #include "sysdep.h" - #define NOWHERE -1 /* nil reference for room-database */ /* The cardinal directions: used as index to room_data.dir_option[] */ @@ -22,14 +21,17 @@ #define WEST 3 #define UP 4 #define DOWN 5 +#define NORTHWEST 6 +#define NORTHEAST 7 +#define SOUTHEAST 8 +#define SOUTHWEST 9 -#define NUM_OF_DIRS 6 +#define NUM_OF_DIRS 10 #define CREATE(result, type, number) do {\ if (!((result) = (type *) calloc ((number), sizeof(type))))\ { perror("malloc failure"); abort(); } } while(0) - /* Exit info: used in room_data.dir_option.exit_info */ #define EX_ISDOOR (1 << 0) /* Exit is a door */ #define EX_CLOSED (1 << 1) /* The door is closed */ @@ -45,7 +47,7 @@ typedef unsigned short int ush_int; typedef char bool; typedef char byte; -typedef sh_int room_num; +typedef int room_num; typedef sh_int obj_num; @@ -133,13 +135,14 @@ struct room_data { struct room_data *world = NULL; /* array of rooms */ int top_of_world = 0; /* ref to top element of world */ +int rec_count = 0; /* local functions */ char *fread_string(FILE * fl, char *error); void setup_dir(FILE * fl, int room, int dir); -void index_boot(char *name); +void index_boot(int cnt, char **name); void discrete_load(FILE * fl); void parse_room(FILE * fl, int virtual_nr); void parse_mobile(FILE * mob_f, int nr); @@ -150,7 +153,7 @@ void write_output(void); char *dir_names[] = -{"North", "East", "South", "West", "Up", "Down"}; +{"North", "East", "South", "West", "Up", "Down","North West","North East","South East","South West"}; /************************************************************************* @@ -160,14 +163,12 @@ char *dir_names[] = /* body of the booting system */ int main(int argc, char **argv) { - if (argc != 2) { - fprintf(stderr, "Usage: %s \n", argv[0]); + if (argc < 2) { + fprintf(stderr, "Usage: %s \n", argv[0]); exit(1); } - index_boot(argv[1]); - log("Renumbering rooms."); - renum_world(); + index_boot(argc,argv); log("Writing output."); write_output(); @@ -176,6 +177,21 @@ int main(int argc, char **argv) return (0); } +/* Since the world is loaded into memory by index + * and not room number, we need to search through + * all rooms and return the correct one. This is + * used to generate door information (ie: the name) + */ +struct room_data* findRoom(int nr) +{ + int i; + + for (i=0;ito_room != NOWHERE) { - found = 1; - fprintf(fl, " %s to %s

\n", - world[world[i].dir_option[door]->to_room].number, - dir_names[door], - world[world[i].dir_option[door]->to_room].name); + world[i].dir_option[door]->to_room != NOWHERE) { + found = 1; + //this call gets a pointer to the room referenced by the to_room for the door. + //This fixes a lot of issues introduced with the whole 'renumbering rooms' call + //and the binary search that didn't work well. + struct room_data* to_room = findRoom(world[i].dir_option[door]->to_room); + fprintf(fl, " %s to %s

\n", + to_room->number, + dir_names[door], + to_room->name); } if (!found) fprintf(fl, "None!"); fclose(fl); } -} +} /* function to count how many hash-mark delimited records exist in a file */ int count_hash_records(FILE * fl) @@ -231,19 +262,35 @@ int count_hash_records(FILE * fl) -void index_boot(char *name) +void index_boot(int cnt, char **names) { FILE *db_file; - int rec_count = 0; - if (!(db_file = fopen(name, "r"))) { - perror("error opening world file"); - exit(1); + //throw first entry away as that is the executable. + for (int i=1;ito_room != NOWHERE) - world[room].dir_option[door]->to_room = - real_room(world[room].dir_option[door]->to_room, - world[room].number); -} - - - /************************************************************************* * procedures for resetting, both play-time and boot-time * *********************************************************************** */ @@ -467,32 +498,6 @@ char *fread_string(FILE * fl, char *error) -/* returns the real number of the room with given virtual number */ -int real_room(int virtual, int reference) -{ - int bot, top, mid; - - bot = 0; - top = top_of_world; - - /* perform binary search on world-table */ - for (;;) { - mid = (bot + top) / 2; - - if ((world + mid)->number == virtual) - return (mid); - if (bot >= top) { - fprintf(stderr, "Room %d does not exist in database (referenced in room %d)\n", virtual, reference); - return (-1); - } - if ((world + mid)->number > virtual) - top = mid - 1; - else - bot = mid + 1; - } -} - - /* get_line reads the next non-blank line off of the input stream. * The newline character is removed from the input. Lines which begin * with '*' are considered to be comments.