[Home] [Downloads] [Search] [Help/forum]

Gammon Forum

See www.mushclient.com/spam for dealing with forum spam. Please read the MUSHclient FAQ!

[Folder]  Entire forum
-> [Folder]  SMAUG
. -> [Folder]  SMAUG coding
. . -> [Subject]  People having problems with max class and max race
Home  |  Users  |  Search  |  FAQ
Username:
Register forum user name
Password:
Forgotten password?

People having problems with max class and max race

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page


Posted by Tseris   (98 posts)  [Biography] bio
Date Fri 06 Nov 2009 05:11 PM (UTC)
Message
Ive seen on the forums alot of ppl having issues when creating new races and classes when they use up all of their race/class slots as defined by MAX_RACE in mud.h. The problem being that the last race or class added doesnt seem to appear anywhere.

I believe the issue may be linked to language throughout the code such as this one in void do_showrace in act_wiz.c:


for( i = 0; i < MAX_RACE; i++ )


Its taking only those entries less than max race, when it should be <=. So if your max race is 20, and your new Tiefling race is number 20, it wont show.
[Go to top] top

Posted by Tseris   (98 posts)  [Biography] bio
Date Reply #1 on Fri 06 Nov 2009 05:31 PM (UTC)
Message
Also, it might be helpful for those starting out putting in new classes to add the following little snippet in act_wiz.c

This will allow you to view the list of classes so you can keep track.

Where it says:


void do_showclass( CHAR_DATA* ch, const char* argument)
{
   char arg1[MAX_INPUT_LENGTH];
   char arg2[MAX_INPUT_LENGTH];
   struct class_type *Class;
   int cl, low, hi;

   set_pager_color( AT_PLAIN, ch );

   argument = one_argument( argument, arg1 );
   argument = one_argument( argument, arg2 );
   if( arg1[0] == '\0' )
   {
      send_to_char( "Syntax: showclass <class> [level range]\r\n", ch );
      return;
   }
   if( is_number( arg1 ) && ( cl = atoi( arg1 ) ) >= 0 && cl < MAX_CLASS )
      Class = class_table[cl];


Change it to:


void do_showclass( CHAR_DATA* ch, const char* argument)
{
   char arg1[MAX_INPUT_LENGTH];
   char arg2[MAX_INPUT_LENGTH];
   struct class_type *Class;
   int cl, low, hi, ct, i;

   set_pager_color( AT_PLAIN, ch );

   argument = one_argument( argument, arg1 );
   argument = one_argument( argument, arg2 );
   
   if( arg1[0] == '\0' )
   {
      send_to_char( "Syntax: showclass <class> [level range]\r\n", ch );
      /* show classes addition by Tseris */
      ct = 0;
      for( i = 0; i < MAX_CLASS; i++ )
      {
         ++ct;
         pager_printf( ch, "%2d> %-11s", i, class_table->who_name );
         if( ct % 5 == 0 )
            send_to_pager( "\r\n", ch );
      }

      send_to_pager( "\r\n", ch );
      return;
   }
   
   if( is_number( arg1 ) && ( cl = atoi( arg1 ) ) >= 0 && cl < MAX_CLASS )
      Class = class_table[cl];
[Go to top] top

Posted by David Haley   USA  (3,881 posts)  [Biography] bio
Date Reply #2 on Sat 07 Nov 2009 03:23 AM (UTC)
Message
The more correct solution would be to increase MAX_RACE, not to change the comparison operator. Better yet would be to rename MAX_RACE to NUM_RACES, which is a more accurate description of what it represents.

(You would indeed loop up to and including the highest number, but you would loop up to but excluding the number of races.)

(Also, be careful with [i] in code.)

David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone

http://david.the-haleys.org
[Go to top] top

The dates and times for posts above are shown in Universal Co-ordinated Time (UTC).

To show them in your local time you can join the forum, and then set the 'time correction' field in your profile to the number of hours difference between your location and UTC time.


3,369 views.

It is now over 60 days since the last post. This thread is closed.     [Refresh] Refresh page

Go to topic:           Search the forum


[Go to top] top

Quick links: MUSHclient. MUSHclient help. Forum shortcuts. Posting templates. Lua modules. Lua documentation.

Information and images on this site are licensed under the Creative Commons Attribution 3.0 Australia License unless stated otherwise.

[Home]


Written by Nick Gammon - 5K   profile for Nick Gammon on Stack Exchange, a network of free, community-driven Q&A sites   Marriage equality

Comments to: Gammon Software support
[RH click to get RSS URL] Forum RSS feed ( https://gammon.com.au/rss/forum.xml )

[Best viewed with any browser - 2K]    [Hosted at FutureQuest]