auth problems

Posted by Rhayne on Sat 15 Sep 2012 11:19 PM — 4 posts, 16,225 views.

#0
I'm wanting to make it so that players don't have to wait for authorization in order to start leveling, but also for them to pass through newgate.are in order to get the starting equipment and choose whether they'll pkill. In order to do this, here's what I've done.

Waitforauth changed to 1

Added a room prog at 122 (where you pull the rope) to transfer the player to 10300 (academy start). In order to get the room prog to work I had to comment out the following in transfer_char:

   if( IS_NPC( ch ) && NOT_AUTHED( victim ) && location->area != victim->in_room->area )
   {
      char buf[MAX_STRING_LENGTH];

      snprintf( buf, MAX_STRING_LENGTH, "Mptransfer - unauthed char (%s)", victim->name );
      progbug( buf, ch );
      return;
   }


I also changed a line in get_waiting_desc:

   for( d = first_descriptor; d; d = d->next )
   {
      if( d->character && ( !str_prefix( name, d->character->name ) ) 
	&& ( IS_WAITING_FOR_AUTH( d->character ) || NOT_AUTHED( d->character ) ) )
      {
         if( ++number_of_hits > 1 )
         {
            ch_printf( ch, "%s does not uniquely identify a char.\r\n", name );
            return NULL;
         }
         ret_char = d->character;   /* return current char on exit */
      }
   }

(added the NOT_AUTHED statement)

When auth is given to players before they pass through the gates, everything works great. If players pass through before auth is given they show on the waiting for auth list but authorizing at that point does not remove the unauth flag. The message is sent to both imm and player that they're authorized, but the flag still stays. Any ideas on what would fix this?
#1
Ok so I found a snippet that will accomplish what I'm wanting to do which also goes into a lot more depth than what I was trying. The problem I'm running into now is compile errors. Normally I can discern and fix these, but have no clue what's going on with the errors I'm getting now.



new_auth.c: In function ‘AUTH_LIST* fread_auth(FILE*)’:
new_auth.c:174:50: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
new_auth.c:184:13: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
new_auth.c:188:13: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
new_auth.c:200:13: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
new_auth.c: In function ‘void add_to_auth(CHAR_DATA*)’:
new_auth.c:358:24: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
new_auth.c: In function ‘void check_auth_state(CHAR_DATA*)’:
new_auth.c:385:40: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
new_auth.c: In function ‘void do_authorize(CHAR_DATA*, const char*)’:
new_auth.c:450:40: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
new_auth.c:564:31: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
new_auth.c:587:31: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
new_auth.c:647:31: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
new_auth.c: In function ‘void do_name(CHAR_DATA*, const char*)’:
new_auth.c:695:18: error: assignment of read-only location ‘* argument’
new_auth.c:697:42: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
new_auth.c:46:6: error:   initializing argument 1 of ‘bool check_parse_name(char*, bool)’ [-fpermissive]
new_auth.c:737:22: error: invalid conversion from ‘const char*’ to ‘char*’ [-fpermissive]
new_auth.c: In function ‘void do_mpapplyb(CHAR_DATA*, const char*)’:
new_auth.c:757:40: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
new_auth.c: In function ‘void auth_update()’:
new_auth.c:819:40: warning: deprecated conversion from string constant to ‘char*’ [-Wwrite-strings]
make[1]: *** [o/new_auth.o] Error 1
make: *** [all] Error 2


Code sections to follow due to length.
#2

AUTH_LIST *fread_auth( FILE * fp )
{
   AUTH_LIST *new_auth;
   bool fMatch;
   char *word;

   CREATE( new_auth, AUTH_LIST, 1 );

   new_auth->authed_by = NULL;
   new_auth->change_by = NULL;

   for( ;; )
   {
      word = feof( fp ) ? "End" : fread_word( fp );<-- error
      fMatch = FALSE;
      switch ( UPPER( word[0] ) )
      {
         case '*':
            fMatch = TRUE;
            fread_to_eol( fp );
            break;

         case 'A':
            KEY( "AuthedBy", new_auth->authed_by, fread_string( fp ) );<-- error
            break;

         case 'C':
            KEY( "Change", new_auth->change_by, fread_string( fp ) );<-- error
            break;

         case 'E':
            if( !str_cmp( word, "End" ) )
            {
               LINK( new_auth, first_auth_name, last_auth_name, next, prev );
               return new_auth;
            }
            break;

         case 'N':
            KEY( "Name", new_auth->name, fread_string( fp )<--error );
            break;

         case 'S':
            if( !str_cmp( word, "State" ) )
            {
               new_auth->state = fread_number( fp );
               /*
                * Crash proofing. Can't be online when 
                */
               /*
                * booting up. Would suck for do_auth   
                */
               if( new_auth->state == AUTH_ONLINE || new_auth->state == AUTH_LINK_DEAD )
                  new_auth->state = AUTH_OFFLINE;
               fMatch = TRUE;
               break;
            }
            break;
      }
      if( !fMatch )
         bug( "%s: no match: %s", __FUNCTION__, word );
   }
}
#3

void check_auth_state( CHAR_DATA * ch )
{
   AUTH_LIST *old_auth;
   CMDTYPE *command;
   int level = LEVEL_IMMORTAL;

   command = find_command( "authorize" );<-- error
   if( !command )
      level = LEVEL_IMMORTAL;
   else
      level = command->level;

   old_auth = get_auth_name( ch->name );
   if( old_auth == NULL )
      return;

   if( old_auth->state == AUTH_OFFLINE /* checking as they enter the game */
       || old_auth->state == AUTH_LINK_DEAD )
   {
      old_auth->state = AUTH_ONLINE;
      save_auth_list(  );
   }
   else if( old_auth->state == AUTH_CHANGE_NAME )
   {
      ch_printf_color( ch,
                       "&R\r\nThe MUD Administrators have found the name %s\r\n"
                       "to be unacceptable. You must choose a new one.\r\n"
                       "The name you choose must be medieval and original.\r\n"
                       "No titles, descriptive words, or names close to any existing\r\n"
                       "Immortal's name. See 'help name'.\r\n", ch->name );
   }
   else if( old_auth->state == AUTH_AUTHED )
   {
      if( ch->pcdata->authed_by )
         STRFREE( ch->pcdata->authed_by );
      if( old_auth->authed_by )
      {
         ch->pcdata->authed_by = QUICKLINK( old_auth->authed_by );
         STRFREE( old_auth->authed_by );
      }
      else
         ch->pcdata->authed_by = STRALLOC( "The Code" );

      ch_printf_color( ch,
                       "\r\n&GThe MUD Administrators have accepted the name %s.\r\n"
                       "You are now free to roam the %s.\r\n", ch->name, sysdata.mud_name );
      REMOVE_BIT( ch->pcdata->flags, PCFLAG_UNAUTHED );
      remove_from_auth( ch->name );
      return;
   }
   return;
}


And to save thread length, the rest of the errors are quite similar to this and the last post.