Crossfire Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
CF: "less magic" identify marked first patch :)
Here's the same patch (with no "magic" this time :) to have the marked
item be identified first:
*** apply.c.orig Fri Dec 4 11:41:57 1998
--- apply.c Sun Dec 6 01:55:03 1998
***************
*** 51,59 ****
query_name(find));
}
int apply_id_altar(object *money, object *altar)
{
! object *id, *pl;
int success=0;
/* Check for MONEY type is a special hack - it prevents 'nothing needs
--- 51,93 ----
query_name(find));
}
+ /* return code with the LSbit set signifies that an identification has been */
+ /* made; return code with the second least significant bit set signifies */
+ /* that there should be no more identifications made at this time */
+ #define APPLY_SUCCEEDED 0x01
+ #define STOP_APPLYING 0x02
+ int apply_id_altar_once(object *money, object *altar, object *pl, object *id)
+ {
+ int success=0;
+
+ if (!QUERY_FLAG(id, FLAG_IDENTIFIED) && !id->invisible &&
+ need_identify(id)) {
+ if (check_altar(altar)) {
+ identify(id);
+ new_draw_info_format(NDI_UNIQUE, 0, pl,
+ "You have %s.", long_desc(id));
+ if (id->msg) {
+ new_draw_info(NDI_UNIQUE, 0,pl, "The item has a story:");
+ new_draw_info(NDI_UNIQUE, 0,pl, id->msg);
+ }
+ success|=APPLY_SUCCEEDED;
+ /* If no more money, might as well quit now */
+ if (!check_altar_sacrifice(altar))
+ success|=STOP_APPLYING;
+ }
+ else {
+ LOG(llevError,"check_id_altar: Couldn't do sacrifice when we should have been able to\n");
+ success=STOP_APPLYING;
+ }
+ }
+
+ return success;
+ }
+
+
int apply_id_altar(object *money, object *altar)
{
! object *id, *pl, *marked;
int success=0;
/* Check for MONEY type is a special hack - it prevents 'nothing needs
***************
*** 68,95 ****
LOG(llevError,"Identify Altar: Can't find player!.\n");
return 0;
}
for (id=pl->inv; id; id=id->below) {
! if (!QUERY_FLAG(id, FLAG_IDENTIFIED) && !id->invisible &&
! need_identify(id)) {
! if (check_altar(altar)) {
! identify(id);
! new_draw_info_format(NDI_UNIQUE, 0, pl,
! "You have %s.", long_desc(id));
! if (id->msg) {
! new_draw_info(NDI_UNIQUE, 0,pl, "The item has a story:");
! new_draw_info(NDI_UNIQUE, 0,pl, id->msg);
! }
! success=1;
! /* If no more money, might as well quit now */
! if (!check_altar_sacrifice(altar)) break;
! }
! else {
! LOG(llevError,"check_id_altar: Couldn't do sacrifice when we should have been able to\n");
! break;
! }
! }
}
! if (!success) new_draw_info(NDI_UNIQUE, 0,pl,"You have nothing that needs identifying");
return 1;
}
--- 102,119 ----
LOG(llevError,"Identify Altar: Can't find player!.\n");
return 0;
}
+ marked=find_marked_object(pl);
+ if (marked)
+ success |= apply_id_altar_once(money, altar, pl, marked);
+
for (id=pl->inv; id; id=id->below) {
! success |= apply_id_altar_once(money, altar, pl, id);
! if (success & STOP_APPLYING)
! break;
}
! if (!(success & APPLY_SUCCEEDED))
! new_draw_info(NDI_UNIQUE, 0,pl,"You have nothing that needs identifying");
!
return 1;
}
--
Maciej Kalisiak
"Linux. Where do you want to go mac@dgp.utoronto.ca
tomorrow?" mac@elecom97.mail.net
www.eecg.utoronto.ca/~mac