Login
User Name:

Password:



Register
Forgot your password?
Vote for Us!
tintin++ ogg sound player script for linux
Author: Robert Smith
Submitted by: Vladaar
6Dragons ogg Soundpack
Author: Vladaar
Submitted by: Vladaar
6Dragons 4.4
Author: Vladaar
Submitted by: Vladaar
LoP 1.46
Author: Remcon
Submitted by: Remcon
LOP 1.45
Author: Remcon
Submitted by: Remcon
Users Online
CommonCrawl, Yandex, DotBot, Google

Members: 0
Guests: 11
Stats
Files
Topics
Posts
Members
Newest Member
481
3,734
19,366
618
Micheal64X
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » setclass issues with mtitle a...
Forum Rules | Mark all | Recent Posts

setclass issues with mtitle and ftitle
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Nov 7, 2005, 10:45 am   Last edited Nov 7, 2005, 11:34 am by Remcon
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,873
JoinedJul 26, 2005

act_wiz.c function do_setclass
find
   if( !str_cmp( arg2, "mtitle" ) )
   {
      char arg3[MAX_INPUT_LENGTH];
      int x;

      argument = one_argument( argument, arg3 );
      if( arg3[0] == '\0' || argument[0] == '\0' )
      {
         send_to_char( "Syntax: setclass <class> mtitle <level> <title>\n\r", ch );
         return;
      }
      if( ( x = atoi( arg3 ) ) < 0 || x > MAX_LEVEL )
      {
         send_to_char( "Invalid level.\n\r", ch );
         return;
      }
      STRFREE( title_table[cl][x][SEX_MALE] );
      title_table[cl][x][SEX_MALE] = STRALLOC( argument );
      send_to_char( "Done.\n\r", ch );
      write_class_file( cl );
      return;
   }
   if( !str_cmp( arg2, "ftitle" ) )
   {
      char arg3[MAX_INPUT_LENGTH];
      int x;

      argument = one_argument( argument, arg3 );
      argument = one_argument( argument, arg4 );
      if( arg3[0] == '\0' || argument[0] == '\0' )
      {
         send_to_char( "Syntax: setclass <class> ftitle <level> <title>\n\r", ch );
         return;
      }
      if( ( x = atoi( arg4 ) ) < 0 || x > MAX_LEVEL )
      {
         send_to_char( "Invalid level.\n\r", ch );
         return;
      }
      STRFREE( title_table[cl][x][SEX_FEMALE] );
      /*
       * Bug fix below -Shaddai
       */
      title_table[cl][x][SEX_FEMALE] = STRALLOC( argument );
      send_to_char( "Done\n\r", ch );
      write_class_file( cl );
      return;
   }

change that to this
   if( !str_cmp( arg2, "mtitle" ) )
   {
      char arg3[MAX_INPUT_LENGTH];
      int x;

      argument = one_argument( argument, arg3 );
      if( arg3[0] == '\0' || argument[0] == '\0' )
      {
         send_to_char( "Syntax: setclass <class> mtitle <level> <title>\n\r", ch );
         return;
      }
      if( ( x = atoi( arg3 ) ) < 0 || x > MAX_LEVEL )
      {
         send_to_char( "Invalid level.\n\r", ch );
         return;
      }
      DISPOSE( title_table[cl][x][0] );
      title_table[cl][x][0] = str_dup( argument );
      send_to_char( "Done.\n\r", ch );
      write_class_file( cl );
      return;
   }
   if( !str_cmp( arg2, "ftitle" ) )
   {
      char arg3[MAX_INPUT_LENGTH], arg4[MAX_INPUT_LENGTH];
      int x;

      argument = one_argument( argument, arg3 );
      if( arg3[0] == '\0' || argument[0] == '\0' )
      {
         send_to_char( "Syntax: setclass <class> ftitle <level> <title>\n\r", ch );
         return;
      }
      if( ( x = atoi( arg3 ) ) < 0 || x > MAX_LEVEL )
      {
         send_to_char( "Invalid level.\n\r", ch );
         return;
      }
      DISPOSE( title_table[cl][x][1] );
      /*
       * Bug fix below -Shaddai
       */
      title_table[cl][x][1] = str_dup( argument );
      send_to_char( "Done\n\r", ch );
      write_class_file( cl );
      return;
   }

There were a few little issues.
It used SEX_MALE (which is 1 in mud.h) when in title_table 0 is male.
It used SEX_FEMALE (which is 2 in mud.h) when in title_table 1 is female.
In the ftitle it used atoi( arg4 ) when it should have used atoi( arg3 ).
In the ftitle it didnt need to get an arg4 from argument.
It was using STRFREE/STRALLOC when the title_table uses DISPOSE/str_dup everywhere else.

*Updated*
       
Post is unread #2 Nov 7, 2005, 2:06 pm   Last edited Nov 7, 2005, 2:06 pm by Conner
Go to the top of the page
Go to the bottom of the page

Conner
Sorcerer
GroupMembers
Posts870
JoinedMay 8, 2005

One minor change to the above, in ftitle change:
char arg3[MAX_INPUT_LENGTH], arg4[MAX_INPUT_LENGTH];
to:
char arg3[MAX_INPUT_LENGTH];

       
Pages:<< prev 1 next >>