[CODE] ' less spell casting

From: OmegaMud (omega@ciholding.com)
Date: 01/24/97


just incase the attachment was not allowed here is the piece of code I am
trying to get working but keep getting segfaults

please assst me here...
(this is all 3.0 code)

 *
 * do_cast is the entry point for PC-casted spells.  It parses the arguments,
 * determines the spell number and finds a target, throws the die to see if
 * the spell can be cast, checks for sufficient mana and subtracts it, and
 * passes control to cast_spell().
 */


ACMD(do_cast)
{
  struct char_data *tch = NULL;
  struct obj_data *tobj = NULL;
  char *s,*s1, *s2, *t, *temps = " ";
  int mana, spellnum, i, tempc, target = 0;

  s  = strtok(argument, " "); //w1   protection   dispel
  s1 = strtok(NULL, " ");     //w2   from         evil
  s2 = strtok(NULL, "\0");     //w3   evil         <target>
  strcpy (temps, argument);
  
  if (s == NULL) 
  {
    send_to_char("Cast what where?\r\n", ch);
    return;
  }
  else if (s1 == NULL)
  {
    tempc = 1;
  }
  else if (s2 == NULL)
  {
    tempc = 2;
  }
  else
  {
    tempc = 0;
  }


  sprintf(temps, "%s", s);

  while (!(spellnum = find_skill_num(temps)) && tempc > 0)
  {
    switch (tempc)
    {
      case 1:
      {
       sprintf(temps, " ");
       sprintf(temps, "%s" s1);
       sprintf(t, "%s", s2);
       break;
      }
      case 2:
      {
       sprintf(temps, " ");
       sprintf(temps, "%s", s2);      
       sprintf(t, "%c" NULL);
       break;
      }
      default:
      {
       tempc = 0;
       break;
      }
    } //endswitch
  
    tempc--;
  } //endwhile

   
  if ((spellnum < 1) || (spellnum > MAX_SPELLS)) {
    send_to_char("Cast what?!?\r\n", ch);
    return;
  }
... rest of do_cast is same as in 3.0 spell_parser.c
remember this segfualts my mud whenever someone tries to cast.

+-----------------------------------------------------------+
| Ensure that you have read the CircleMUD Mailing List FAQ: |
|   http://cspo.queensu.ca/~fletcher/Circle/list_faq.html   |
+-----------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/18/00 PST