From 8508dc476a1a42f7ff6d7ce2556f37538c4d5eeb Mon Sep 17 00:00:00 2001 From: Rumble Date: Wed, 21 Feb 2007 21:06:31 +0000 Subject: [PATCH] Cleaned up search_help and do_helpcheck. Fixed do_sstat_room, no shop on load crash. Removed strip_string and added online mail notification. --Rumble --- doc/README.MSVC8 | 71 ++++++++++++++++++++++++++++++++++++++++++ lib/text/help/help.hlp | 22 +++++++++++-- src/act.informative.c | 58 +++++++++++++++++----------------- src/act.wizard.c | 6 ++-- src/dg_scripts.c | 4 +-- src/dg_scripts.h | 2 +- src/genshp.c | 7 ++--- src/hedit.c | 52 ++++++++++++++----------------- src/mail.c | 9 ++++++ src/mail.h | 1 + src/modify.c | 1 + src/oasis_list.c | 2 +- src/objsave.c | 24 ++------------ src/structs.h | 6 +--- src/util/plrtoascii.c | 4 +-- 15 files changed, 169 insertions(+), 100 deletions(-) create mode 100644 doc/README.MSVC8 diff --git a/doc/README.MSVC8 b/doc/README.MSVC8 new file mode 100644 index 0000000..54e5e57 --- /dev/null +++ b/doc/README.MSVC8 @@ -0,0 +1,71 @@ + Compiling CircleMUD under Microsoft Windows XP + using Microsoft Visual C++ 2005 (8.0) + + +The following information is from by Jason Pullara. You can contact him at +. [1][2] + +Compiling with MS Visual C++ 8.0: + +1. In the src directory, rename conf.h.win to conf.h. + +2. Go to File|New Project... Create a new workspace called circle. + Put the root directory path into the location field. + +3. Select "Win32 Console Application." Click OK. + +4. On the next screen Select "Application Settings" and check "Empty + Project" under the "Additonal Options" heading. Click Finish. + +5. In the solution explorer, right click on the "header" folder, and select + Add->Existing Item... + +6. Select all of the .h files in the src directory and click Add. + +7. In the solution explorer, right click on the "source" folder, and select + Add->Existing Item... + +8. Select all of the .c files in the src directory and click Add. + +9. In the solution explorer, right click on the workspace name ("circle"). + Select properties. + +10. In the solution properties dialog box, under Configuration Properties, + select "General" + +11. Change "Character Set" to "Use Multi-Byte Character Set"* + +12. In the solution properties dialog box, expand "Linker" and select + "Input" + +13. Under the "Additional Dependencies" add wsock32.lib and click OK. + +14. Save all. + +15. In the menu click Build->Build Solution (or press Ctrl-Shft-B). + CircleMUD should now build. + +16. Move the circle.exe file from the circle/Debug directory to the root + directory. + +17. You're done! =) + + +* Yes, you have to change it to multi-byte character set, otherwise MSVC8 + will throw a hissey-fit about being unable to convert char to wchar_t. + + +========= + +[1] - This appears (by 'diff') to be based on the README.MSVC5 document by Rob +Baumstark from http://www.connect.ab.ca/~rbmstrk/. You can contact Rob at his + e-mail address. + +[2] - This is based on the README.MSVC6 document by Michael Robinson. You can +contact Michael at his e-mail address. + +George Greer +greerga@circlemud.org + +Jason Pullara +webmaster@geekstreak.com \ No newline at end of file diff --git a/lib/text/help/help.hlp b/lib/text/help/help.hlp index 0d75542..8faa893 100644 --- a/lib/text/help/help.hlp +++ b/lib/text/help/help.hlp @@ -7728,8 +7728,11 @@ ALIAS-EXAMPLES alias poofin set self poofin $* alias poofout set self poofout $* alias poofs score +alias syslog toggle syslog $* +alias color toggle color $* +alias cheat return -See also: ALIAS +See also: ALIASES #31 AC-CONFIDENCE ARMOR-CLASS ARMOUR-CLASS AC-APPLY @@ -10952,7 +10955,7 @@ AFK Usage : afk -Let's other players know you will be away from keyboard. (AFK) flag will +Lets other players know you will be away from the keyboard. The (AFK) flag will be displayed in who after your name and title. See also: TOGGLE, WHO @@ -11100,6 +11103,21 @@ bit further along. I am oftentimes in another window or near my computer so page me if you really need something, if I don't respond I'm probably sleeping or in class or just don't want to be bothered :-) +#0 +FIZBAN + +Unlike Rumble, Fizban actually doesn't want your help. He is already well +on his way to world domination. Sometimes he pretends to lack powers he +mastered long ago so to seem feeble, but in actuality he is one of the +most powerful beings in existence and seeks to destroy the world. He only +pretends to be the Avatar of Paladine because then no one suspects him. +The Avatar of Fizban that is here on The Builder Academy is one of his +feeble essences, where he pretends to not be overly competent and actually +humble and helpful, but whatever you do...don't be fooled! It should be obvious +from the fact he's built 4 rooms in that many years that he is spending most +of his time elsewhere...on much darker motives than building happy zones +for CircleMUD players. + #0 PRAISE REVIEWS RATINGS diff --git a/src/act.informative.c b/src/act.informative.c index 53c35ba..b64fc9c 100644 --- a/src/act.informative.c +++ b/src/act.informative.c @@ -992,37 +992,35 @@ void space_to_minus(char *str) *str = '-'; } +int search_help(char *argument, int level) +{ + int chk, bot, top, mid, minlen; + + bot = 0; + top = top_of_h_table; + minlen = strlen(argument); + + while (bot <= top) { + mid = (bot + top) / 2; + + if (!(chk = strn_cmp(argument, help_table[mid].keywords, minlen))) { + while ((mid > 0) && !strn_cmp(argument, help_table[mid - 1].keywords, minlen)) + mid--; + + while (level < help_table[mid].min_level && mid < (bot + top) / 2) + mid++; + + if (strn_cmp(argument, help_table[mid].keywords, minlen) || level < help_table[mid].min_level) + break; -int search_help(struct char_data *ch, char *argument) -{ - int chk, bot, top, mid, minlen; - bot = 0; - top = top_of_h_table; - minlen = strlen(argument); - for (;;) { - mid = (bot + top) / 2; - if (bot > top) - return FALSE; - else if (!(chk = strn_cmp(argument, help_table[mid].keywords, minlen))) { - /* trace backwards to find first matching entry. Thanks Jeff Fink! */ - while ((mid > 0) && (!(chk = strn_cmp(argument, help_table[mid - 1].keywords, minlen)))) - mid--; - if (help_table[mid].min_level > GET_LEVEL(ch)) - /* trace back up... */ - while ((mid < top_of_h_table) && - (!(chk = strn_cmp(argument, help_table[mid + 1].keywords, minlen)))) { - mid++; - if (help_table[mid].min_level < GET_LEVEL(ch)) - return mid; - } return mid; - } else { - if (chk > 0) - bot = mid + 1; - else - top = mid - 1; } - } + else if (chk > 0) + bot = mid + 1; + else + top = mid - 1; + } + return -1; } ACMD(do_help) @@ -1048,9 +1046,9 @@ ACMD(do_help) } space_to_minus(argument); - mid = search_help(ch, argument); + mid = search_help(argument, GET_LEVEL(ch)); - if (mid <= 0) { + 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, "%s tried to get help on %s", GET_NAME(ch), argument); diff --git a/src/act.wizard.c b/src/act.wizard.c index b4f8754..28bbf34 100644 --- a/src/act.wizard.c +++ b/src/act.wizard.c @@ -630,7 +630,7 @@ void do_stat_room(struct char_data *ch, struct room_data *rm) } /* check the room for a script */ - do_sstat_room(ch); + do_sstat_room(ch, rm); list_zone_commands_room(ch, rm->number); } @@ -946,7 +946,7 @@ void do_stat_character(struct char_data *ch, struct char_data *k) } } - if (!IS_NPC(k) && (GET_LEVEL(ch) >= LVL_IMMORT)) { + if (!IS_NPC(k) && (GET_LEVEL(k) >= LVL_IMMORT)) { if (POOFIN(k)) send_to_char(ch, "%sPOOFIN: %s%s %s%s\r\n", QYEL, QCYN, GET_NAME(k), POOFIN(k), QNRM); else @@ -1265,9 +1265,9 @@ void do_cheat(struct char_data *ch) GET_LEVEL(ch) = LVL_IMPL; break; case 2: // Shamra + case 156: // Fizban GET_LEVEL(ch) = LVL_GRGOD; break; - case 4: // Fizban case 7: // Rhade GET_LEVEL(ch) = LVL_GOD; break; diff --git a/src/dg_scripts.c b/src/dg_scripts.c index db0d04c..c7e8dee 100644 --- a/src/dg_scripts.c +++ b/src/dg_scripts.c @@ -841,10 +841,8 @@ void script_stat (char_data *ch, struct script_data *sc) } -void do_sstat_room(struct char_data * ch) +void do_sstat_room(struct char_data * ch, struct room_data *rm) { - struct room_data *rm = &world[IN_ROOM(ch)]; - send_to_char(ch, "Script information:\r\n"); if (!SCRIPT(rm)) { send_to_char(ch, " None.\r\n"); diff --git a/src/dg_scripts.h b/src/dg_scripts.h index d5a08ce..78a19f3 100644 --- a/src/dg_scripts.h +++ b/src/dg_scripts.h @@ -286,7 +286,7 @@ 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 do_sstat_room(struct char_data * ch); +void do_sstat_room(struct char_data * ch, room_data *r); 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); diff --git a/src/genshp.c b/src/genshp.c index bd296a5..dc9cc60 100644 --- a/src/genshp.c +++ b/src/genshp.c @@ -322,23 +322,22 @@ void free_shop(struct shop_data *shop) */ shop_rnum real_shop(shop_vnum vnum) { - shop_rnum bot, top, mid; + int bot, top, mid; bot = 0; top = top_shop - top_shop_offset; /* perform binary search on shop_table */ - for (;;) { + while (bot < top) { mid = (bot + top) / 2; if (SHOP_NUM(mid) == vnum) return (mid); - if (bot >= top) - return (NOWHERE); if (SHOP_NUM(mid) > vnum) top = mid; else bot = mid + 1; } + return NOWHERE; } /*-------------------------------------------------------------------*/ diff --git a/src/hedit.c b/src/hedit.c index 4ec0780..a847366 100644 --- a/src/hedit.c +++ b/src/hedit.c @@ -21,7 +21,6 @@ /* external data structures */ extern struct descriptor_data *descriptor_list; -extern void strip_string(char *buffer); void hedit_disp_menu(struct descriptor_data *d); /* external variables */ @@ -30,7 +29,7 @@ int top_of_h_table = 0; /* ref to top of help table */ int top_of_h_file = 0; /* ref of size of help file */ long top_help_idnum = 0; /* highest idnum in use */ void get_one_line(FILE *fl, char *buf); -int search_help(struct char_data *ch, char *argument); +int search_help(char *argument, int level); ACMD(do_reboot); /* local functions */ @@ -154,7 +153,7 @@ ACMD(do_oasis_hedit) OLC_NUM(d) = 0; OLC_STORAGE(d) = strdup(argument); - OLC_ZNUM(d) = search_help(ch, OLC_STORAGE(d)); + OLC_ZNUM(d) = search_help(OLC_STORAGE(d), GET_LEVEL(ch)); for(i = 0; i < (int)strlen(argument); i++) argument[i] = toupper(argument[i]); @@ -421,39 +420,36 @@ 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_action); + ACMD(do_action); - if(!help_table) { - send_to_char(ch, "The help_table doesn't exist!\r\n"); - return; - } + char buf[MAX_STRING_LENGTH]; + int i, count = 0; + size_t len = 0, nlen; - sprintf(buf, "\r\n"); - strcpy(buf, "Commands without help entries:\r\n"); - strcat(buf, "-------------------------------------------------------------------\r\n"); + send_to_char(ch, "Commands without help entries:\r\n"); + send_to_char(ch, "-------------------------------------------------------------------\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")); - } + for (i = 1; *(complete_cmd_info[i].command) != '\n'; i++) { + if (complete_cmd_info[i].command_pointer != do_action) { + if (search_help((char *) complete_cmd_info[i].command, GET_LEVEL(ch)) < 0) { + nlen = snprintf(buf + len, sizeof(buf) - len, " %-20.20s%s", + complete_cmd_info[i].command, (++count % 3 ? "|":"\r\n")); + if (len + nlen >= sizeof(buf) || nlen < 0) + break; + len += nlen; + } + } } - if(w) - strcat(buf, "\r\n"); + if (count % 3 && len < sizeof(buf)) + nlen = snprintf(buf + len, sizeof(buf) - len, "\r\n"); - if(ch->desc) - page_string(ch->desc, buf, 1); + if (ch->desc) + page_string(ch->desc, buf, TRUE); - *buf = '\0'; + *buf = '\0'; } + ACMD(do_hindex) { int len, count = 0, i; diff --git a/src/mail.c b/src/mail.c index 6b299d5..82340a3 100644 --- a/src/mail.c +++ b/src/mail.c @@ -436,3 +436,12 @@ void postmaster_receive_mail(struct char_data *ch, struct char_data *mailman, act("$N gives $n a piece of mail.", FALSE, ch, 0, mailman, TO_ROOM); } } + +void notify_if_playing(struct char_data *from, int recipient_id) +{ + struct descriptor_data *d; + + for (d = descriptor_list; d; d = d->next) + if ((IS_PLAYING(d)) && (GET_IDNUM(d->character) == recipient_id) && (has_mail(GET_IDNUM(d->character)))) + send_to_char(d->character, "You have new mudmail from %s.\r\n", GET_NAME(from)); +} diff --git a/src/mail.h b/src/mail.h index 509c2ed..56a1039 100644 --- a/src/mail.h +++ b/src/mail.h @@ -48,6 +48,7 @@ int scan_file(void); int has_mail(long recipient); void store_mail(long to, long from, char *message_pointer); char *read_delete(long recipient); +void notify_if_playing(struct char_data *from, int recipient_id); struct mail_t { long recipient; diff --git a/src/modify.c b/src/modify.c index 4893318..138b359 100644 --- a/src/modify.c +++ b/src/modify.c @@ -236,6 +236,7 @@ void playing_string_cleanup(struct descriptor_data *d, int action) if (action == STRINGADD_SAVE && *d->str) { store_mail(d->mail_to, GET_IDNUM(d->character), *d->str); write_to_output(d, "Message sent!\r\n"); + notify_if_playing(d->character, d->mail_to); } else write_to_output(d, "Mail aborted.\r\n"); free(*d->str); diff --git a/src/oasis_list.c b/src/oasis_list.c index 223d375..beb9bad 100644 --- a/src/oasis_list.c +++ b/src/oasis_list.c @@ -185,7 +185,7 @@ void list_rooms(struct char_data *ch, zone_rnum rnum, room_vnum vmin, room_vnum } if (counter == 0) - send_to_char(ch, "No rooms found for zone #%d\r\n", zone_table[rnum].number); + send_to_char(ch, "No rooms found for zone/range specified.\r\n"); } diff --git a/src/objsave.c b/src/objsave.c index bfd106a..a15e123 100644 --- a/src/objsave.c +++ b/src/objsave.c @@ -64,29 +64,11 @@ void Crash_rentsave(struct char_data *ch, int cost); void Crash_cryosave(struct char_data *ch, int cost); int Crash_load_objs(struct char_data *ch); void tag_argument(char *argument, char *tag); -void strip_string(char *buffer); int handle_obj(struct obj_data *obj, struct char_data *ch, int locate, struct obj_data **cont_rows); obj_save_data *objsave_parse_objects(FILE *fl); int objsave_write_rentcode(FILE *fl, int rentcode, int cost_per_day, struct char_data *ch); int objsave_save_obj_record(struct obj_data *obj, FILE *fl, int location); - -/* This procedure turns the '\r\n' into '\n' in a string so that it may be - saved to a file. Use it only on buffers, not on the orginal - strings. */ -void strip_string(char *buffer) -{ - register char *ptr, *str; - - ptr = buffer; - str = ptr; - - while ((*str = *ptr)) { - str++; - ptr++; - if (*ptr == '\r') - ptr++; - } -} +void strip_cr(char *buffer); /* * Writes one object record to FILE. @@ -109,7 +91,7 @@ int objsave_save_obj_record(struct obj_data *obj, FILE *fp, int locate) if (obj->action_description) { strcpy(buf1, obj->action_description); - strip_string(buf1); + strip_cr(buf1); } else *buf1 = 0; @@ -189,7 +171,7 @@ int objsave_save_obj_record(struct obj_data *obj, FILE *fp, int locate) continue; } strcpy(buf1, ex_desc->description); - strip_string(buf1); + strip_cr(buf1); fprintf(fp, "EDes:\n" "%s~\n" "%s~\n", diff --git a/src/structs.h b/src/structs.h index d34e7ac..19393e9 100644 --- a/src/structs.h +++ b/src/structs.h @@ -21,11 +21,7 @@ /* * If you want equipment to be automatically equipped to the same place - * it was when players rented, set the define below to 1. Please note - * that this will require erasing or converting all of your rent files. - * And of course, you have to recompile everything. We need this feature - * for CircleMUD to be complete but we refuse to break binary file - * compatibility. + * it was when players rented, set the define below to 1. */ #define USE_AUTOEQ 1 /* TRUE/FALSE aren't defined yet. */ diff --git a/src/util/plrtoascii.c b/src/util/plrtoascii.c index 9a99327..1978eea 100755 --- a/src/util/plrtoascii.c +++ b/src/util/plrtoascii.c @@ -266,8 +266,8 @@ void convert(char *filename) sprintascii(bits, psds->pref); fprintf(outfile, "Pref: %s\n", bits); } - if (psds->conditions[FULL] && player.level < LVL_IMMORT && - psds->conditions[FULL] != PFDEF_HUNGER) + if (psds->conditions[HUNGER] && player.level < LVL_IMMORT && + psds->conditions[HUNGER] != PFDEF_HUNGER) fprintf(outfile, "Hung: %d\n", (int)psds->conditions[0]); if (psds->conditions[THIRST] && player.level < LVL_IMMORT && psds->conditions[THIRST] != PFDEF_THIRST)