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

CF: bug fix for server/gods.c (mea culpa!)



Last month, I sent a patch for server/gods.c in 0.92.4.  Well,
nobody's perfect...  I introduced a new bug with this patch.  So here
is a new patch that fixes this bug.  In addition, it makes the code
more efficient by avoiding multiple calls to RANDOM(), so you have an
additional reason to apply it.  :-)

If you want to know what was wrong, look at the condition of the
"while" statement.  The gods could be a bit too generous, giving away
some spells such as "charging", "polymorph" or "hellfire"...  Oops!

I still have other patches in progress.  One of them is related to the
"wonder" spell.  If you want to crash the game, set your pickup mode
to "all items", then run into a room in which someone is casting that
spell.  Result: you will pick up some flowers as the spell propagates,
and the game will crash because these flowers will be "out of the map"
for the propagation of the cone spell.  Fix: I am changing the
archetype "flowers" so that it has "no_pick 1", but I also have to
change the spell so that it clears this flag when the spell has
finished propagating.  If I remember correctly, I first saw this bug
in Crossfire 0.88.x and it has been there since then.  Patch coming
soon...

---------- cut here ---------- cut here ---------- cut here ----------
*** server/gods.c~	Wed Jul 24 09:45:50 1996
--- server/gods.c	Thu Aug  8 13:14:18 1996
***************
*** 272,286 ****
   /* If they qualify, grant the priest use of a special spell */
   
    if(op->stats.Wis&&op->stats.Wis>25) { 
      int spell=0;
  
!    /*generate a random rare clerical spell*/  
!     do {
! 	spell=RANDOM()%NROFREALSPELLS;
!     } while(spells[spell].books && !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
      * doesnt already know it */
     /* Also, there are some spells which can really disturb playbalance,
--- 272,289 ----
   /* If they qualify, grant the priest use of a special spell */
   
    if(op->stats.Wis&&op->stats.Wis>25) { 
      int spell=0;
  
!     /*generate a random rare clerical spell*/  
!     spell=RANDOM()%NROFREALSPELLS;
!     while (spells[spell].books || !spells[spell].cleric)
!       {
!         spell++;
!         if (spell >= NROFREALSPELLS)
!           spell = 0;
!       }
  
     /* 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
      * doesnt already know it */
     /* Also, there are some spells which can really disturb playbalance,