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

CF: minor bug fixes for god_intervention (gods.c)




Here are some small bug fixes for god_intervention in server/gods.c.
The bugs were:
- in two cases, the function returned early without continuing down to
  the message "You feel rapture".
- the global variable "name" was used instead of the local variable
  "godname" when changing the title of a weapon.  The result was that
  you got a "weapon of crossfire" instead of a "weapon of God" (or
  whatever your god is).

---------- cut here ----------
*** gods.c.orig	Sun Apr 21 07:07:38 1996
--- gods.c	Wed Jul  3 14:42:28 1996
***************
*** 173,180 ****
      if (op->type==PLAYER&&success) {
         new_draw_info(NDI_UNIQUE, 0,op, "You feel like someone is helping you.");
         draw_inventory(op);
      }
-     return;
    }
  
    /* Fix drained stats? */
--- 173,180 ----
      if (op->type==PLAYER&&success) {
         new_draw_info(NDI_UNIQUE, 0,op, "You feel like someone is helping you.");
         draw_inventory(op);
+        return;
      }
    }
  
    /* Fix drained stats? */
***************
*** 233,242 ****
      for(weapon=op->inv;weapon;weapon=weapon->below) 
         if(weapon->type==WEAPON&&QUERY_FLAG(weapon,FLAG_APPLIED)) break;
  
!     if(!weapon) return;
! 
!     /* hallow the weapon to slay enemies */
!     if(!weapon->slaying&&strcmp("none",Gods[godnr].enemy_race)) {
          char buf[MAX_BUF];
  
  	weapon->slaying = add_string(Gods[godnr].enemy_race); 
--- 233,240 ----
      for(weapon=op->inv;weapon;weapon=weapon->below) 
         if(weapon->type==WEAPON&&QUERY_FLAG(weapon,FLAG_APPLIED)) break;
  
!     /* allow the weapon to slay enemies */
!     if(weapon&&weapon->slaying&&strcmp("none",Gods[godnr].enemy_race)) {
          char buf[MAX_BUF];
  
  	weapon->slaying = add_string(Gods[godnr].enemy_race); 
***************
*** 245,251 ****
            new_draw_info_format(NDI_UNIQUE,0,op,
               "Your %s now hungers to slay enemies of your god!",
  	     weapon->name);
! 	  sprintf(buf,"of %s",name);
  	  weapon->title=add_string(buf);
            if(op->type==PLAYER) draw_inventory(op);
  	}
--- 243,249 ----
            new_draw_info_format(NDI_UNIQUE,0,op,
               "Your %s now hungers to slay enemies of your god!",
  	     weapon->name);
! 	  sprintf(buf,"of %s",godname);
  	  weapon->title=add_string(buf);
            if(op->type==PLAYER) draw_inventory(op);
  	}
***************
*** 253,266 ****
      }
   
      /* add the gods attacktype*/
!     if(!(RANDOM()%2)&&!(weapon->attacktype&Gods[godnr].attacktype)) {
          new_draw_info(NDI_UNIQUE,0,op,"Your weapon suddenly glows!");
  	weapon->attacktype=weapon->attacktype|Gods[godnr].attacktype;
  	return;
      }
  
      /* higher magic value */
!     if(!(RANDOM()%2)&&weapon->magic<(level/5)) {
         new_draw_info(NDI_UNIQUE,0,op,
            "A phosphorescent glow envelops your weapon!");
         weapon->magic++;
--- 251,264 ----
      }
   
      /* add the gods attacktype*/
!     if(weapon&&!(RANDOM()%2)&&!(weapon->attacktype&Gods[godnr].attacktype)) {
          new_draw_info(NDI_UNIQUE,0,op,"Your weapon suddenly glows!");
  	weapon->attacktype=weapon->attacktype|Gods[godnr].attacktype;
  	return;
      }
  
      /* higher magic value */
!     if(weapon&&!(RANDOM()%2)&&weapon->magic<(level/5)) {
         new_draw_info(NDI_UNIQUE,0,op,
            "A phosphorescent glow envelops your weapon!");
         weapon->magic++;
***************
*** 275,288 ****
      int spell=0;
  
     /*generate a random rare clerical spell*/  
!     do {
!          do
!            spell=RANDOM()%NROFREALSPELLS;
!          while(spells[spell].books);
!     } while (!spells[spell].cleric);
! 
      while((spells[spell].books!=0)&&!spells[spell].cleric)
-        spell = RANDOM()%NROFREALSPELLS; 
  
     /* The god will only teach the spell if its not against the nature
      * of the cult, the priest is high enough in level *and* the priest
--- 273,281 ----
      int spell=0;
  
     /*generate a random rare clerical spell*/  
!     do
!       spell = RANDOM()%NROFREALSPELLS;
      while((spells[spell].books!=0)&&!spells[spell].cleric)
  
     /* The god will only teach the spell if its not against the nature
      * of the cult, the priest is high enough in level *and* the priest
---------- cut here ----------

-Raphael