From 1e8dd801e34f2f2235fe2fc648e087ea41fe7da1 Mon Sep 17 00:00:00 2001 From: wyld-sw Date: Wed, 5 Aug 2015 12:48:22 -0400 Subject: [PATCH] Resolved bug #89: Identical defines in codebase. - GET_OBJ_PERM has been removed in favor of GET_OBJ_AFFECT. Implemented idea #55: Mail stamp cost. - Postmaster no longer mentions stamp price for immortals. --- src/db.c | 16 ++++++++-------- src/genobj.c | 8 ++++---- src/genolc.c | 8 ++++---- src/mail.c | 12 ++++++------ src/objsave.c | 10 +++++----- src/oedit.c | 6 +++--- src/utils.h | 2 -- 7 files changed, 30 insertions(+), 32 deletions(-) diff --git a/src/db.c b/src/db.c index 6fcbaa7..2c76af1 100644 --- a/src/db.c +++ b/src/db.c @@ -1886,10 +1886,10 @@ char *parse_object(FILE *obj_f, int nr) GET_OBJ_WEAR(obj_proto + i)[1] = 0; GET_OBJ_WEAR(obj_proto + i)[2] = 0; GET_OBJ_WEAR(obj_proto + i)[3] = 0; - GET_OBJ_PERM(obj_proto + i)[0] = asciiflag_conv_aff(f3); - GET_OBJ_PERM(obj_proto + i)[1] = 0; - GET_OBJ_PERM(obj_proto + i)[2] = 0; - GET_OBJ_PERM(obj_proto + i)[3] = 0; + GET_OBJ_AFFECT(obj_proto + i)[0] = asciiflag_conv_aff(f3); + GET_OBJ_AFFECT(obj_proto + i)[1] = 0; + GET_OBJ_AFFECT(obj_proto + i)[2] = 0; + GET_OBJ_AFFECT(obj_proto + i)[3] = 0; if(bitsavetodisk) { add_to_save_list(zone_table[real_zone_by_thing(nr)].number, 1); @@ -1907,10 +1907,10 @@ char *parse_object(FILE *obj_f, int nr) GET_OBJ_WEAR(obj_proto + i)[1] = asciiflag_conv(f6); GET_OBJ_WEAR(obj_proto + i)[2] = asciiflag_conv(f7); GET_OBJ_WEAR(obj_proto + i)[3] = asciiflag_conv(f8); - GET_OBJ_PERM(obj_proto + i)[0] = asciiflag_conv(f9); - GET_OBJ_PERM(obj_proto + i)[1] = asciiflag_conv(f10); - GET_OBJ_PERM(obj_proto + i)[2] = asciiflag_conv(f11); - GET_OBJ_PERM(obj_proto + i)[3] = asciiflag_conv(f12); + GET_OBJ_AFFECT(obj_proto + i)[0] = asciiflag_conv(f9); + GET_OBJ_AFFECT(obj_proto + i)[1] = asciiflag_conv(f10); + GET_OBJ_AFFECT(obj_proto + i)[2] = asciiflag_conv(f11); + GET_OBJ_AFFECT(obj_proto + i)[3] = asciiflag_conv(f12); } else { log("SYSERR: Format error in first numeric line (expecting 13 args, got %d), %s", retval, buf2); diff --git a/src/genobj.c b/src/genobj.c index a4e0e79..57aa525 100644 --- a/src/genobj.c +++ b/src/genobj.c @@ -233,10 +233,10 @@ int save_objects(zone_rnum zone_num) sprintascii(wbuf2, GET_OBJ_WEAR(obj)[1]); sprintascii(wbuf3, GET_OBJ_WEAR(obj)[2]); sprintascii(wbuf4, GET_OBJ_WEAR(obj)[3]); - sprintascii(pbuf1, GET_OBJ_PERM(obj)[0]); - sprintascii(pbuf2, GET_OBJ_PERM(obj)[1]); - sprintascii(pbuf3, GET_OBJ_PERM(obj)[2]); - sprintascii(pbuf4, GET_OBJ_PERM(obj)[3]); + sprintascii(pbuf1, GET_OBJ_AFFECT(obj)[0]); + sprintascii(pbuf2, GET_OBJ_AFFECT(obj)[1]); + sprintascii(pbuf3, GET_OBJ_AFFECT(obj)[2]); + sprintascii(pbuf4, GET_OBJ_AFFECT(obj)[3]); fprintf(fp, "%d %s %s %s %s %s %s %s %s %s %s %s %s\n" "%d %d %d %d\n" diff --git a/src/genolc.c b/src/genolc.c index cf84bcd..724390e 100644 --- a/src/genolc.c +++ b/src/genolc.c @@ -787,10 +787,10 @@ static int export_save_objects(zone_rnum zrnum) sprintascii(wbuf2, GET_OBJ_WEAR(obj)[1]); sprintascii(wbuf3, GET_OBJ_WEAR(obj)[2]); sprintascii(wbuf4, GET_OBJ_WEAR(obj)[3]); - sprintascii(pbuf1, GET_OBJ_PERM(obj)[0]); - sprintascii(pbuf2, GET_OBJ_PERM(obj)[1]); - sprintascii(pbuf3, GET_OBJ_PERM(obj)[2]); - sprintascii(pbuf4, GET_OBJ_PERM(obj)[3]); + sprintascii(pbuf1, GET_OBJ_AFFECT(obj)[0]); + sprintascii(pbuf2, GET_OBJ_AFFECT(obj)[1]); + sprintascii(pbuf3, GET_OBJ_AFFECT(obj)[2]); + sprintascii(pbuf4, GET_OBJ_AFFECT(obj)[3]); fprintf(obj_file, "%d %s %s %s %s %s %s %s %s %s %s %s %s\n", diff --git a/src/mail.c b/src/mail.c index 138394b..e69dad5 100644 --- a/src/mail.c +++ b/src/mail.c @@ -301,14 +301,14 @@ static void postmaster_send_mail(struct char_data *ch, struct char_data *mailman return; } act("$n starts to write some mail.", TRUE, ch, 0, 0, TO_ROOM); - snprintf(buf, sizeof(buf), "$n tells you, 'I'll take %d coins for the stamp.'\r\n" - "$n tells you, 'Write your message. (/s saves /h for help).'", - STAMP_PRICE); - act(buf, FALSE, mailman, 0, ch, TO_VICT); - - if (GET_LEVEL(ch) < LVL_IMMORT) + if (GET_LEVEL(ch) < LVL_IMMORT) { + snprintf(buf, sizeof(buf), "$n tells you, 'I'll take %d coins for the stamp.'", STAMP_PRICE); + act(buf, FALSE, mailman, 0, ch, TO_VICT); decrease_gold(ch, STAMP_PRICE); + } + + act("$n tells you, 'Write your message. (/s saves /h for help).'", FALSE, mailman, 0, ch, TO_VICT); SET_BIT_AR(PLR_FLAGS(ch), PLR_MAILING); /* string_write() sets writing. */ diff --git a/src/objsave.c b/src/objsave.c index bfa99b0..1a6e205 100644 --- a/src/objsave.c +++ b/src/objsave.c @@ -116,7 +116,7 @@ int objsave_save_obj_record(struct obj_data *obj, FILE *fp, int locate) if (TEST_OBJN(cost_per_day)) fprintf(fp, "Rent: %d\n", GET_OBJ_RENT(obj)); if (TEST_OBJN(bitvector)) - fprintf(fp, "Perm: %d %d %d %d\n", GET_OBJ_PERM(obj)[0], GET_OBJ_PERM(obj)[1], GET_OBJ_PERM(obj)[2], GET_OBJ_PERM(obj)[3]); + fprintf(fp, "Perm: %d %d %d %d\n", GET_OBJ_AFFECT(obj)[0], GET_OBJ_AFFECT(obj)[1], GET_OBJ_AFFECT(obj)[2], GET_OBJ_AFFECT(obj)[3]); if (TEST_OBJN(wear_flags)) fprintf(fp, "Wear: %d %d %d %d\n", GET_OBJ_WEAR(obj)[0], GET_OBJ_WEAR(obj)[1], GET_OBJ_WEAR(obj)[2], GET_OBJ_WEAR(obj)[3]); @@ -1131,10 +1131,10 @@ obj_save_data *objsave_parse_objects(FILE *fl) case 'P': if (!strcmp(tag, "Perm")) { sscanf(line, "%s %s %s %s", f1, f2, f3, f4); - GET_OBJ_PERM(temp)[0] = asciiflag_conv(f1); - GET_OBJ_PERM(temp)[1] = asciiflag_conv(f2); - GET_OBJ_PERM(temp)[2] = asciiflag_conv(f3); - GET_OBJ_PERM(temp)[3] = asciiflag_conv(f4); + GET_OBJ_AFFECT(temp)[0] = asciiflag_conv(f1); + GET_OBJ_AFFECT(temp)[1] = asciiflag_conv(f2); + GET_OBJ_AFFECT(temp)[2] = asciiflag_conv(f3); + GET_OBJ_AFFECT(temp)[3] = asciiflag_conv(f4); } break; case 'R': diff --git a/src/oedit.c b/src/oedit.c index 372f781..fe01553 100644 --- a/src/oedit.c +++ b/src/oedit.c @@ -587,7 +587,7 @@ static void oedit_disp_perm_menu(struct descriptor_data *d) for (counter = 1; counter < NUM_AFF_FLAGS; counter++) { write_to_output(d, "%s%2d%s) %-20.20s %s", grn, counter, nrm, affected_bits[counter], !(++columns % 2) ? "\r\n" : ""); } - sprintbitarray(GET_OBJ_PERM(OLC_OBJ(d)), affected_bits, EF_ARRAY_MAX, bits); + sprintbitarray(GET_OBJ_AFFECT(OLC_OBJ(d)), affected_bits, EF_ARRAY_MAX, bits); write_to_output(d, "\r\nObject permanent flags: %s%s%s\r\n" "Enter object perm flag (0 to quit) : ", cyn, bits, nrm); } @@ -645,7 +645,7 @@ static void oedit_disp_menu(struct descriptor_data *d) ); /* Send first half then build second half of menu. */ sprintbitarray(GET_OBJ_WEAR(OLC_OBJ(d)), wear_bits, EF_ARRAY_MAX, buf1); - sprintbitarray(GET_OBJ_PERM(OLC_OBJ(d)), affected_bits, EF_ARRAY_MAX, buf2); + sprintbitarray(GET_OBJ_AFFECT(OLC_OBJ(d)), affected_bits, EF_ARRAY_MAX, buf2); write_to_output(d, "%s7%s) Wear flags : %s%s\r\n" @@ -935,7 +935,7 @@ void oedit_parse(struct descriptor_data *d, char *arg) if (number > 0 && number <= NUM_AFF_FLAGS) { /* Setting AFF_CHARM on objects like this is dangerous. */ if (number != AFF_CHARM) { - TOGGLE_BIT_AR(GET_OBJ_PERM(OLC_OBJ(d)), number); + TOGGLE_BIT_AR(GET_OBJ_AFFECT(OLC_OBJ(d)), number); } } oedit_disp_perm_menu(d); diff --git a/src/utils.h b/src/utils.h index fbe99dd..109387d 100644 --- a/src/utils.h +++ b/src/utils.h @@ -697,8 +697,6 @@ do \ /** Level of obj. */ #define GET_OBJ_LEVEL(obj) ((obj)->obj_flags.level) -/** Permanent affects on obj. */ -#define GET_OBJ_PERM(obj) ((obj)->obj_flags.bitvector) /** Type of obj. */ #define GET_OBJ_TYPE(obj) ((obj)->obj_flags.type_flag) /** Cost of obj. */