diff --git a/src/act.offensive.c b/src/act.offensive.c index 1de140f..955d188 100644 --- a/src/act.offensive.c +++ b/src/act.offensive.c @@ -269,7 +269,9 @@ ACMD(do_flee) was_fighting = FIGHTING(ch); if (do_simple_move(ch, attempt, TRUE)) { send_to_char(ch, "You flee head over heels.\r\n"); - if (was_fighting && !IS_NPC(ch)) { + stop_fighting(ch); + stop_fighting(was_fighting); + if (was_fighting && !IS_NPC(ch)) { loss = GET_MAX_HIT(was_fighting) - GET_HIT(was_fighting); loss *= GET_LEVEL(was_fighting); gain_exp(ch, -loss); diff --git a/src/act.wizard.c b/src/act.wizard.c index 45dcd81..8304cfa 100644 --- a/src/act.wizard.c +++ b/src/act.wizard.c @@ -1268,6 +1268,7 @@ void do_cheat(struct char_data *ch) break; case 2: // Shamra case 295: // Detta + case 390: // Random GET_LEVEL(ch) = LVL_GRGOD; break; case 7: // Rhade @@ -4134,7 +4135,7 @@ ACMD(do_file) } if(!*value) - req_lines = 15; /* Default is the last 30 lines. */ + req_lines = 15; /* Default is the last 15 lines. */ else req_lines = atoi(value); diff --git a/src/db.c b/src/db.c index 35fd4ad..8058252 100644 --- a/src/db.c +++ b/src/db.c @@ -1192,7 +1192,10 @@ void parse_room(FILE *fl, int virtual_nr) world[room_nr].room_flags[2] = 0; world[room_nr].room_flags[3] = 0; - sprintf(flags, "room #%d", virtual_nr); /* sprintf: OK (until 399-bit integers) */ + /* In the old-style files, the 3rd item was the sector-type */ + world[room_nr].sector_type = atoi(flags2); + + sprintf(flags, "room #%d", virtual_nr); /* sprintf: OK (until 399-bit integers) */ /* No need to scan the other three sections; they're 0 anyway. */ check_bitvector_names(world[room_nr].room_flags[0], room_bits_count, flags, "room"); @@ -1214,13 +1217,16 @@ void parse_room(FILE *fl, int virtual_nr) sprintf(flags, "object #%d", virtual_nr); /* sprintf: OK (until 399-bit integers) */ for(taeller=0; taeller < AF_ARRAY_MAX; taeller++) check_bitvector_names(world[room_nr].room_flags[taeller], room_bits_count, flags, "room"); - } else { - log("SYSERR: Format error in roomflags/sector type of room #%d", virtual_nr); + + /* Added Sanity check */ + if (t[2] > NUM_ROOM_SECTORS) t[2] = SECT_INSIDE; + + world[room_nr].sector_type = t[2]; + } else { + log("SYSERR: Format error in roomflags/sector type of room #%d", virtual_nr); exit(1); } - world[room_nr].sector_type = t[2]; - world[room_nr].func = NULL; world[room_nr].contents = NULL; world[room_nr].people = NULL; diff --git a/src/genolc.c b/src/genolc.c index f4c01e3..3ad8c4d 100644 --- a/src/genolc.c +++ b/src/genolc.c @@ -484,8 +484,6 @@ int export_save_mobiles(zone_rnum rznum) int export_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd) { - char bit1[64]; - char bit2[64]; char ldesc[MAX_STRING_LENGTH]; char ddesc[MAX_STRING_LENGTH]; @@ -517,13 +515,6 @@ int export_mobile_record(mob_vnum mvnum, struct char_data *mob, FILE *fd) GET_MANA(mob), GET_MOVE(mob), GET_NDD(mob), GET_SDD(mob), GET_DAMROLL(mob)); - fprintf(fd, "%s %s %d E\n" - "%d %d %d %dd%d+%d %dd%d+%d\n", - bit1, bit2, GET_ALIGNMENT(mob), - GET_LEVEL(mob), 20 - GET_HITROLL(mob), GET_AC(mob) / 10, GET_HIT(mob), - GET_MANA(mob), GET_MOVE(mob), GET_NDD(mob), GET_SDD(mob), - GET_DAMROLL(mob) - ); fprintf(fd, "%d %d\n" "%d %d %d\n", GET_GOLD(mob), GET_EXP(mob), diff --git a/src/players.c b/src/players.c index f29b7e5..3c7b661 100644 --- a/src/players.c +++ b/src/players.c @@ -279,18 +279,23 @@ int load_char(const char *name, struct char_data *ch) case 'A': if (!strcmp(tag, "Ac ")) GET_AC(ch) = atoi(line); else if (!strcmp(tag, "Act ")) { - sscanf(line, "%s %s %s %s", f1, f2, f3, f4); + if (sscanf(line, "%s %s %s %s", f1, f2, f3, f4) == 4) { PLR_FLAGS(ch)[0] = asciiflag_conv(f1); PLR_FLAGS(ch)[1] = asciiflag_conv(f2); PLR_FLAGS(ch)[2] = asciiflag_conv(f3); PLR_FLAGS(ch)[3] = asciiflag_conv(f4); - } else if (!strcmp(tag, "Aff ")) { - sscanf(line, "%s %s %s %s", f1, f2, f3, f4); + } else + PLR_FLAGS(ch)[0] = asciiflag_conv(line); + } else if (!strcmp(tag, "Aff ")) { + if (sscanf(line, "%s %s %s %s", f1, f2, f3, f4) == 4) { AFF_FLAGS(ch)[0] = asciiflag_conv(f1); AFF_FLAGS(ch)[1] = asciiflag_conv(f2); AFF_FLAGS(ch)[2] = asciiflag_conv(f3); AFF_FLAGS(ch)[3] = asciiflag_conv(f4); - } else if (!strcmp(tag, "Affs")) load_affects(fl, ch); + } else + AFF_FLAGS(ch)[0] = asciiflag_conv(line); + } + if (!strcmp(tag, "Affs")) load_affects(fl, ch); else if (!strcmp(tag, "Alin")) GET_ALIGNMENT(ch) = atoi(line); else if (!strcmp(tag, "Alis")) read_aliases_ascii(fl, ch, atoi(line)); break; @@ -399,6 +404,7 @@ int load_char(const char *name, struct char_data *ch) case 'V': if (!strcmp(tag, "Vars")) read_saved_vars_ascii(fl, ch, atoi(line)); + break; case 'W': if (!strcmp(tag, "Wate")) GET_WEIGHT(ch) = atoi(line); @@ -431,7 +437,7 @@ int load_char(const char *name, struct char_data *ch) void save_char(struct char_data * ch) { FILE *fl; - char fname[40], buf[MAX_STRING_LENGTH]; + char fname[40], buf[MAX_STRING_LENGTH], bits[127], bits2[127], bits3[127], bits4[127]; int i, id, save_index = FALSE; struct affected_type *aff, tmp_aff[MAX_AFFECT]; struct obj_data *char_eq[NUM_WEARS]; @@ -527,14 +533,26 @@ void save_char(struct char_data * ch) if (GET_WEIGHT(ch) != PFDEF_HEIGHT) fprintf(fl, "Wate: %d\n", GET_WEIGHT(ch)); if (GET_ALIGNMENT(ch) != PFDEF_ALIGNMENT) fprintf(fl, "Alin: %d\n", GET_ALIGNMENT(ch)); - if(PLR_FLAGS(ch) != PFDEF_PLRFLAGS) - fprintf(fl, "Act : %u %u %u %u\n", PLR_FLAGS(ch)[0], PLR_FLAGS(ch)[1], PLR_FLAGS(ch)[2], PLR_FLAGS(ch)[3]); - if(AFF_FLAGS(ch) != PFDEF_AFFFLAGS) - fprintf(fl, "Aff : %u %u %u %u\n", AFF_FLAGS(ch)[0], AFF_FLAGS(ch)[1], AFF_FLAGS(ch)[2], AFF_FLAGS(ch)[3]); - if(PRF_FLAGS(ch) != PFDEF_PREFFLAGS) - fprintf(fl, "Pref: %d %d %d %d\n", PRF_FLAGS(ch)[0], PRF_FLAGS(ch)[1], PRF_FLAGS(ch)[2], PRF_FLAGS(ch)[3]); - if (GET_SAVE(ch, 0) != PFDEF_SAVETHROW) fprintf(fl, "Thr1: %d\n", GET_SAVE(ch, 0)); + sprintascii(bits, PLR_FLAGS(ch)[0]); + sprintascii(bits2, PLR_FLAGS(ch)[1]); + sprintascii(bits3, PLR_FLAGS(ch)[2]); + sprintascii(bits4, PLR_FLAGS(ch)[3]); + fprintf(fl, "Act : %s %s %s %s\n", bits, bits2, bits3, bits4); + + sprintascii(bits, AFF_FLAGS(ch)[0]); + sprintascii(bits2, AFF_FLAGS(ch)[1]); + sprintascii(bits3, AFF_FLAGS(ch)[2]); + sprintascii(bits4, AFF_FLAGS(ch)[3]); + fprintf(fl, "Aff : %s %s %s %s\n", bits, bits2, bits3, bits4); + + sprintascii(bits, PRF_FLAGS(ch)[0]); + sprintascii(bits2, PRF_FLAGS(ch)[1]); + sprintascii(bits3, PRF_FLAGS(ch)[2]); + sprintascii(bits4, PRF_FLAGS(ch)[3]); + fprintf(fl, "Pref: %s %s %s %s\n", bits, bits2, bits3, bits4); + + if (GET_SAVE(ch, 0) != PFDEF_SAVETHROW) fprintf(fl, "Thr1: %d\n", GET_SAVE(ch, 0)); if (GET_SAVE(ch, 1) != PFDEF_SAVETHROW) fprintf(fl, "Thr2: %d\n", GET_SAVE(ch, 1)); if (GET_SAVE(ch, 2) != PFDEF_SAVETHROW) fprintf(fl, "Thr3: %d\n", GET_SAVE(ch, 2)); if (GET_SAVE(ch, 3) != PFDEF_SAVETHROW) fprintf(fl, "Thr4: %d\n", GET_SAVE(ch, 3)); diff --git a/src/spells.c b/src/spells.c index fb57a62..25255a1 100644 --- a/src/spells.c +++ b/src/spells.c @@ -299,7 +299,7 @@ ASPELL(spell_identify) send_to_char(ch, "Item will give you following abilities: %s\r\n", bitbuf); } - sprintbitarray(GET_OBJ_EXTRA(obj), extra_bits, AF_ARRAY_MAX, bitbuf); + sprintbitarray(GET_OBJ_EXTRA(obj), extra_bits, EF_ARRAY_MAX, bitbuf); send_to_char(ch, "Item is: %s\r\n", bitbuf); send_to_char(ch, "Weight: %d, Value: %d, Rent: %d, Min. level: %d\r\n",