Re: Hometown suggestions?

From: Daniel Koepke (dkoepke@CALIFORNIA.COM)
Date: 09/07/97


On Sun, 7 Sep 1997, David Kasprzyk wrote:

-+You get the the idea.

I get the idea, but what's the question?  I suspect your question
is how to make the menu appear differently for each race.  This is a
simple matter of,

  const char *hometown_names[NUM_HOMETOWNS] = {
    "Midgaard",
    .
    .
    .
  };

  const bool hometown_races[NUM_HOMETOWNS][NUM_RACES] = {
  /*  Hum  Dwa  Elf */
    {   1,   1,   1 }, /* Midgaard */
    .
    .
    .
  };

  void DisplayHometownMenu(struct char_data *ch)
  {
    int race = GET_RACE(ch), i, j = 0;

    for (i = 0; i < NUM_HOMETOWNS; i++)
      if (hometown_races[i][race])
        sprintf(buf, "%c) %s\r\n", i+'a', hometown_names[i]);
  }

  int CheckHometownEntry(struct char_data *ch, int i)
  {
    int h = i-'a';
    if (hometown_races[h][GET_RACE(ch)])
      return 1;
    return 0;
  }

You can handle the CON_ state stuff for yourself.  Uhm, this is assuming
that this is what you wanted to know.  And it's important to ntoe that
it assigns a constant letter to each hometown.  For instance, say you have
the hometowns "Midgaard", "Riaven Falls", and "Varlai".  These would be
'a', 'b', 'c'.  Now say you have a race that cannot start in Riaven
Falls.  The menu would look like:

  a) Midgaard
  c) Varlai

No 'b' is shown or accepted.  This is to simplify the code.  If you want
to make it letter/number relative to the actual cities availible...well,
it shouldn't be too difficult. :)

This is all assuming that your question was in fact this.  If it isn't,
uhm, perhaps you could shed some light on what you want to know? :)


--
Daniel Koepke -:- dkoepke@california.com -:-  [Shadowlord/Nether]
Think.


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



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