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

CF: magic/exp patch -- input.c




	Har. After all that searching, (at least part of) this 
	bug turns out to be related to the use of the invoke 
	command. Apparently, the call in command_cast_spell
	to check_skill_to_fire was assuming that the invoked
	spell was *already* in the op->ready_spell slot. It 
	wasnt, AND, thus if you had readied a spell of a different
	type (ie MAGE/PRIEST) then invoked a spell of the 
	opposite type, you would ready the wrong skill, which 
	would result in no exp gain.

	The reason it took me so long to find this problem--
	I never use invoke! So anyway, here is a simple patch
	to input.c.

	Please report if this does/doesnt fix the problem to 
	the list. THanks!

						-b.t.

*** ../../tarfiles/crossfire-0.92.5/server/input.c	Wed Jul 24 03:45:50 1996
--- ./input.c	Fri Aug 30 03:31:39 1996
***************
*** 994,1007 ****
--- 994,1015 ----
  	    if (!strncmp(params, spells[spnum].name, strlen(params))) {
  		    rangetype orig_rangetype=op->contr->shoottype;
  		    op->contr->shoottype=range_magic;
  #ifdef ALLOW_SKILLS 
                      if(op->type==PLAYER&&!QUERY_FLAG(op,FLAG_WIZ)) { 
+ 				 /* if we don't change to the correct spell numb,
+ 				  * check_skill_to_fire will be confused as to which
+ 				  * spell casting skill to ready for the player!
+ 				  * I set the code to change back to the old spellnum
+ 				  * after we check, but is this really needed?? -b.t. */
+                         	 int orig_spn = op->contr->chosen_spell;
+                         	 op->contr->chosen_spell=spnum;
                                   if(!check_skill_to_fire(op)) {  
                                   	op->contr->shoottype=orig_rangetype;
  					return 0; 
  				 }
+                         	 op->contr->chosen_spell=orig_spn;
                      } 
  #endif
  		    if (castnow) { 
  			int value;