From c9c7ed9e7a343843f09b0cdd35b30e322253ce0d Mon Sep 17 00:00:00 2001 From: Rumble Date: Sat, 24 Jan 2009 19:11:02 +0000 Subject: [PATCH] [Jan 24 2009] - Rumble Fixed command queue cancelling "--" from cancelling the next command. (thanks Fren ze/Ogdin) Fixed object timer values from not saving. (thanks Stoneheart) Fixed latest GCC warnings in the /utils. (thanks Jamdog) Fixed violent area spells so they would not harm group members. (thanks Nhilar) Changed usage of qm->nr to GET_MOB_VNUM(qm). (thanks Tails) --- changelog | 6 ++++++ lib/misc/typos | 0 src/comm.c | 2 +- src/db.c | 10 +++++++--- src/genobj.c | 4 ++-- src/magic.c | 6 +++++- src/quest.c | 4 ++-- src/util/autowiz.c | 4 ++-- src/util/plrtoascii.c | 4 ++-- src/util/shopconv.c | 23 ++++++++++++----------- src/util/wld2html.c | 4 ++-- 11 files changed, 41 insertions(+), 26 deletions(-) delete mode 100644 lib/misc/typos diff --git a/changelog b/changelog index 2ca0fde..ce8d7fb 100644 --- a/changelog +++ b/changelog @@ -35,6 +35,12 @@ export (QQ's a zone into a tarball)t Xlist (mlist, olist, rlist, zlist, slist, tlist, qlist) (lots of major bugfixes too) tbaMUD 3.59 +[Jan 24 2009] - Rumble + Fixed command queue cancelling "--" from cancelling the next command. (thanks Frenze/Ogdin) + Fixed object timer values from not saving. (thanks Stoneheart) + Fixed latest GCC warnings in the /utils. (thanks Jamdog) + Fixed violent area spells so they would not harm group members. (thanks Nhilar) + Changed usage of qm->nr to GET_MOB_VNUM(qm). (thanks Tails) [Jan 21 2009] - Jamdog Added trigedit variable %move% to teleport objects. Fixed memory leak in generic_complete_quest. diff --git a/lib/misc/typos b/lib/misc/typos deleted file mode 100644 index e69de29..0000000 diff --git a/src/comm.c b/src/comm.c index 4f5e21b..4f3c1ae 100644 --- a/src/comm.c +++ b/src/comm.c @@ -1968,7 +1968,7 @@ static int process_input(struct descriptor_data *t) { write_to_output(t, "All queued commands cancelled.\r\n"); flush_queues(t); /* Flush the command queue */ - return (1); /* No need to process the -- command any further, so quit back out */ + failed_subst = 1; /* Allow the read point to be moved, but don't add to queue */ } if (!failed_subst) diff --git a/src/db.c b/src/db.c index 9bafb97..408a100 100644 --- a/src/db.c +++ b/src/db.c @@ -1863,11 +1863,14 @@ char *parse_object(FILE *obj_f, int nr) log("SYSERR: Expecting third numeric line of %s, but file ended!", buf2); exit(1); } - if ((retval = sscanf(line, "%d %d %d %d", t, t + 1, t + 2, t + 3)) != 4) { - if (retval == 3) + if ((retval = sscanf(line, "%d %d %d %d %d", t, t + 1, t + 2, t + 3, t + 4)) != 5) { + if (retval == 3) { t[3] = 0; + t[4] = 0; + } else if (retval == 4) + t[4] = 0; else { - log("SYSERR: Format error in third numeric line (expecting 4 args, got %d), %s", retval, buf2); + log("SYSERR: Format error in third numeric line (expecting 5 args, got %d), %s", retval, buf2); exit(1); } } @@ -1876,6 +1879,7 @@ char *parse_object(FILE *obj_f, int nr) GET_OBJ_COST(obj_proto + i) = t[1]; GET_OBJ_RENT(obj_proto + i) = t[2]; GET_OBJ_LEVEL(obj_proto + i) = t[3]; + GET_OBJ_TIMER(obj_proto + i) = t[4]; obj_proto[i].sitting_here = NULL; diff --git a/src/genobj.c b/src/genobj.c index 25c6a0b..9129989 100644 --- a/src/genobj.c +++ b/src/genobj.c @@ -237,7 +237,7 @@ int save_objects(zone_rnum zone_num) fprintf(fp, "%d %s %s %s %s %s %s %s %s %s %s %s %s\n" "%d %d %d %d\n" - "%d %d %d %d\n", + "%d %d %d %d %d\n", GET_OBJ_TYPE(obj), ebuf1, ebuf2, ebuf3, ebuf4, @@ -246,7 +246,7 @@ int save_objects(zone_rnum zone_num) GET_OBJ_VAL(obj, 0), GET_OBJ_VAL(obj, 1), GET_OBJ_VAL(obj, 2), GET_OBJ_VAL(obj, 3), GET_OBJ_WEIGHT(obj), GET_OBJ_COST(obj), - GET_OBJ_RENT(obj), GET_OBJ_LEVEL(obj) + GET_OBJ_RENT(obj), GET_OBJ_LEVEL(obj), GET_OBJ_TIMER(obj) ); /* Do we have script(s) attached? */ diff --git a/src/magic.c b/src/magic.c index 896da22..f6ba9c1 100644 --- a/src/magic.c +++ b/src/magic.c @@ -641,7 +641,8 @@ void mag_areas(int level, struct char_data *ch, int spellnum, int savetype) /* The skips: 1: the caster * 2: immortals * 3: if no pk on this mud, skips over all players - * 4: pets (charmed NPCs) */ + * 4: pets (charmed NPCs) + * 5: other players in the same group (if the spell is 'violent') */ if (tch == ch) continue; if (!IS_NPC(tch) && GET_LEVEL(tch) >= LVL_IMMORT) @@ -650,6 +651,9 @@ void mag_areas(int level, struct char_data *ch, int spellnum, int savetype) continue; if (!IS_NPC(ch) && IS_NPC(tch) && AFF_FLAGGED(tch, AFF_CHARM)) continue; + if (!IS_NPC(tch) && spell_info[spellnum].violent && AFF_FLAGGED(tch, AFF_GROUP) && AFF_FLAGGED(ch, AFF_GROUP) && + ( ((ch->master == NULL) ? ch : ch->master) == ((tch->master == NULL) ? tch : tch->master) ) ) + continue; /* Doesn't matter if they die here so we don't check. -gg 6/24/98 */ mag_damage(level, ch, tch, spellnum, 1); diff --git a/src/quest.c b/src/quest.c index 5658927..403a251 100644 --- a/src/quest.c +++ b/src/quest.c @@ -481,7 +481,7 @@ void quest_join(struct char_data *ch, struct char_data *qm, char argument[MAX_IN else if (GET_QUEST(ch) != NOTHING) snprintf(buf, sizeof(buf), "%s But you are already part of a quest!", GET_NAME(ch)); - else if((vnum = find_quest_by_qmnum(ch, qm->nr, atoi(argument))) == NOTHING) + else if((vnum = find_quest_by_qmnum(ch, GET_MOB_VNUM(qm), atoi(argument))) == NOTHING) snprintf(buf, sizeof(buf), "%s I don't know of such a quest!", GET_NAME(ch)); else if ((rnum = real_quest(vnum)) == NOTHING) @@ -532,7 +532,7 @@ void quest_list(struct char_data *ch, struct char_data *qm, char argument[MAX_IN qst_vnum vnum; qst_rnum rnum; - if ((vnum = find_quest_by_qmnum(ch, qm->nr, atoi(argument))) == NOTHING) + if ((vnum = find_quest_by_qmnum(ch, GET_MOB_VNUM(qm), atoi(argument))) == NOTHING) send_to_char(ch, "That is not a valid quest!\r\n"); else if ((rnum = real_quest(vnum)) == NOTHING) send_to_char(ch, "That is not a valid quest!\r\n"); diff --git a/src/util/autowiz.c b/src/util/autowiz.c index e908ab0..f5f0209 100755 --- a/src/util/autowiz.c +++ b/src/util/autowiz.c @@ -259,11 +259,11 @@ char *CAP(char *txt) * file. */ int get_line(FILE * fl, char *buf) { - char temp[256]; + char temp[256], *buf2; int lines = 0; do { - fgets(temp, 256, fl); + buf2 = fgets(temp, 256, fl); if (feof(fl)) return (0); lines++; diff --git a/src/util/plrtoascii.c b/src/util/plrtoascii.c index 173453c..87a354f 100755 --- a/src/util/plrtoascii.c +++ b/src/util/plrtoascii.c @@ -158,7 +158,7 @@ void convert(char *filename) FILE *fl, *outfile, *index_file; struct char_file_u_plrtoascii player; char index_name[40], outname[40], bits[127]; - int i; + int i, j; struct char_special_data_saved_plrtoascii *csds; struct player_special_data_saved_plrtoascii *psds; struct char_ability_data_plrtoascii *cad; @@ -175,7 +175,7 @@ void convert(char *filename) exit(1); } for (;;) { - fread(&player, sizeof(struct char_file_u_plrtoascii), 1, fl); + j = fread(&player, sizeof(struct char_file_u_plrtoascii), 1, fl); if (feof(fl)) { fclose(fl); fclose(index_file); diff --git a/src/util/shopconv.c b/src/util/shopconv.c index a5dff2c..6f71c6b 100755 --- a/src/util/shopconv.c +++ b/src/util/shopconv.c @@ -58,12 +58,12 @@ char *fread_string(FILE * fl, const char *error) void do_list(FILE * shop_f, FILE * newshop_f, int max) { - int count, temp; - char buf[MAX_STRING_LENGTH]; + int count, temp, i; + char buf[MAX_STRING_LENGTH], *buf2; for (count = 0; count < max; count++) { - fscanf(shop_f, "%d", &temp); - fgets(buf, MAX_STRING_LENGTH - 1, shop_f); + i = fscanf(shop_f, "%d", &temp); + buf2 = fgets(buf, MAX_STRING_LENGTH - 1, shop_f); if (temp > 0) fprintf(newshop_f, "%d%s", temp, buf); } @@ -76,8 +76,9 @@ void do_float(FILE * shop_f, FILE * newshop_f) { float f; char str[20]; + int i; - fscanf(shop_f, "%f \n", &f); + i = fscanf(shop_f, "%f \n", &f); sprintf(str, "%f", f); while ((str[strlen(str) - 1] == '0') && (str[strlen(str) - 2] != '.')) str[strlen(str) - 1] = 0; @@ -87,9 +88,9 @@ void do_float(FILE * shop_f, FILE * newshop_f) void do_int(FILE * shop_f, FILE * newshop_f) { - int i; + int i, j; - fscanf(shop_f, "%d \n", &i); + j = fscanf(shop_f, "%d \n", &i); fprintf(newshop_f, "%d \n", i); } @@ -155,7 +156,7 @@ int main(int argc, char *argv[]) { FILE *sfp, *nsfp; char fn[256], part[256]; - int result, index; + int result, index, i; if (argc < 2) { printf("Usage: shopconv [file2] [file3] ...\n"); @@ -164,7 +165,7 @@ int main(int argc, char *argv[]) for (index = 1; index < argc; index++) { sprintf(fn, "%s", argv[index]); sprintf(part, "mv %s %s.tmp", fn, fn); - system(part); + i = system(part); sprintf(part, "%s.tmp", fn); sfp = fopen(part, "r"); if (sfp == NULL) { @@ -181,10 +182,10 @@ int main(int argc, char *argv[]) fclose(sfp); if (result) { sprintf(part, "mv %s.tmp %s", fn, fn); - system(part); + i = system(part); } else { sprintf(part, "mv %s.tmp %s.bak", fn, fn); - system(part); + i = system(part); printf("Done!\n"); } } diff --git a/src/util/wld2html.c b/src/util/wld2html.c index 27674c8..9afc9c8 100755 --- a/src/util/wld2html.c +++ b/src/util/wld2html.c @@ -496,10 +496,10 @@ int real_room(int virtual, int reference) */ int get_line(FILE * fl, char *buf) { - char temp[256]; + char temp[256], *buf2; do { - fgets(temp, 256, fl); + buf2 = fgets(temp, 256, fl); if (*temp) temp[strlen(temp) - 1] = '\0'; } while (!feof(fl) && (*temp == '*' || !*temp));