Crossfire Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

CF: patch to server/apply.c to get "marked" item identified first




This patch is for the server, v0.95.1 .

*** apply.c.orig	Fri Dec  4 11:41:57 1998
--- apply.c	Fri Dec  4 12:17:24 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,90 ----
  	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 */
+ 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=1;
+       /* If no more money, might as well quit now */
+       if (!check_altar_sacrifice(altar)) success|=0x02;
+     }
+     else {
+       LOG(llevError,"check_id_altar:  Couldn't do sacrifice when we should have been able to\n");
+       success=2;
+     }
+   }
+ 
+   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;
  }
  
--- 99,115 ----
  	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 & 0x02)
! 	break;
      }
!     if (! (success & 0x01)) new_draw_info(NDI_UNIQUE, 0,pl,"You have nothing that needs identifying");
! 
      return 1;
  }
  

-- 
M$: Our software of tommorrow will make                  Maciej Kalisiak
sure that on your hardware of tomorrow               
everything will work at the usual speed.           
                                               www.eecg.utoronto.ca/~mac