Added Field to spell_info struct

From: Gicker (gicker42@hotmail.com)
Date: 06/30/02


Hi, I added a new field to the spell_info struct and now it won't set the
name properly.

Example

I type practice and I see:

*************************************************************************
*                                 SKILLS                                *
*************************************************************************
* !UNUSED!                      100 * !UNUSED!                      100 *
* !UNUSED!                      100 * !UNUSED!                      100 *
* !UNUSED!                      100 * !UNUSED!                      100 *
* !UNUSED!                      100 * !UNUSED!                      100 *
* !UNUSED!                      100 * !UNUSED!                      100 *
* !UNUSED!                      100 *                                   *
*************************************************************************
* Skill Points: 0000                                                    *
*************************************************************************

Here are some snippets from my code:

struct spell_info_type {
   byte min_position; /* Position for caster  */
   int mana_min; /* Min amount of mana used by a spell (highest lev) */
   int mana_max; /* Max amount of mana used by a spell (lowest lev) */
   int mana_change; /* Change in mana used by spell from lev to lev */

   int min_level[NUM_CLASSES];
   int routines;
   byte violent;
   int targets;         /* See below for use with TAR_XXX  */
   const char *name;
   int use_untrained;
};

void spello(int spl, const char *name, int max_mana, int min_mana,
 int mana_change, int minpos, int targets, int violent, int routines, int
use_untrained)
// prototype is the same as above
{
  int i;

  for (i = 0; i < NUM_CLASSES; i++)
    spell_info[spl].min_level[i] = LVL_IMMORT;
  spell_info[spl].mana_max = max_mana;
  spell_info[spl].mana_min = min_mana;
  spell_info[spl].mana_change = mana_change;
  spell_info[spl].min_position = minpos;
  spell_info[spl].targets = targets;
  spell_info[spl].violent = violent;
  spell_info[spl].routines = routines;
  spell_info[spl].name = name;
  spell_info[spl].use_untrained = use_untrained;
}

#define skillo(skill, name, use_untrained) spello(skill, name, 0, 0, 0, 0,
0, 0, 0, use_untrained);

void mag_assign_spells(void)
{
  int i;

  /* Do not change the loop below. */
  for (i = 0; i <= TOP_SPELL_DEFINE; i++)
    unused_spell(i);
  /* Do not change the loop above. */

  spello(SPELL_ANIMATE_DEAD, "animate dead", 35, 10, 3, POS_STANDING,
 TAR_OBJ_ROOM, FALSE, MAG_SUMMONS, FALSE);

// ...

  skillo(SKILL_BACKSTAB, "backstab", FALSE);
  skillo(SKILL_BASH, "bash", TRUE);

}

void list_skills(struct char_data * ch) // Reconstructed by Jason Yarber
{
  int i, sortpos, pracs, side = 0;

  strcpy(buf, "\n");
  sprintf(buf,
"&y*************************************************************************
&n\r\n");
  sprintf(buf, "%s&y*                                 &WSKILLS
&y*&n\r\n", buf);
  sprintf(buf,
"%s&y***********************************************************************
**&n\r\n", buf);

  strcpy(buf2, buf);

  for (sortpos = MAX_SPELLS + 1; sortpos <= SKILLS_IN; sortpos++) {
    i = spell_sort_info[sortpos];
    if (strlen(buf2) >= MAX_STRING_LENGTH - 32) {
      strcat(buf2, "**OVERFLOW**\r\n");
      break;
    }
    if (GET_SKILL(ch, i) >= 0) {
      if(side == 0) {
        sprintf(buf, "&y* &C%-20.20s  &c%11d ", spell_info[i].name,
GET_SKILL(ch, i));
        strcat(buf2, buf); // The above, ^ should always be safe to do.
        side++;
      }
      else {
        sprintf(buf, "&y* &C%-20.20s  &c%11d &y*&n\r\n", spell_info[i].name,
GET_SKILL(ch, i));
        strcat(buf2, buf);
        side = 0;
      }
    }
  }

  if(side == 1) {
    sprintf(buf, "&y*                                   *&n\r\n");
    strcat(buf2, buf);
  }
  if (!GET_SKILL_POINTS(ch))
    pracs = 0;
  else
    pracs = GET_SKILL_POINTS(ch);
  sprintf(buf,
"&y*************************************************************************
&n\r\n");
  sprintf(buf, "%s&y* &WSkill Points: &w%-4.4d
&y*&n\r\n", buf, pracs);
  sprintf(buf,
"%s&y***********************************************************************
**&n\r\n", buf);
  strcat(buf2, buf);
  page_string(ch->desc, buf2, 1);
}

Any help would be much appreciated

Steve Squires

--
   +---------------------------------------------------------------+
   | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html |
   | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html |
   | Newbie List:  http://groups.yahoo.com/group/circle-newbies/   |
   +---------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 06/25/03 PDT