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

Members: 0
Guests: 16
Stats
Files
Topics
Posts
Members
Newest Member
481
3,740
19,396
629
DarrenPayn
Today's Birthdays
There are no member birthdays today.
Related Links
» SmaugMuds.org » Codebases » SmaugFUSS » Making use of PULSE_PER_SECOND
Forum Rules | Mark all | Recent Posts

Making use of PULSE_PER_SECOND
< Newer Topic :: Older Topic >

Pages:<< prev 1 next >>
Post is unread #1 Jul 31, 2006, 6:42 am
Go to the top of the page
Go to the bottom of the page

Remcon
Geomancer
GroupAdministrators
Posts1,874
JoinedJul 26, 2005

in act_wiz.c
function do_users
find
      if( !argument || argument[0] == '\0' )
      {
         if( get_trust( ch ) >= LEVEL_ASCENDANT || ( d->character && can_see( ch, d->character ) ) )
         {
            count++;
            pager_printf( ch, " %3d| %-17s |%4d| %-12s | %s \r\n", d->descriptor, st, d->idle / 4,
                          d->original ? d->original->name : d->character ? d->character->name : "(None!)", d->host );
         }
      }
      else
      {
         if( ( get_trust( ch ) >= LEVEL_SUPREME || ( d->character && can_see( ch, d->character ) ) )
             && ( !str_prefix( argument, d->host ) || ( d->character && !str_prefix( argument, d->character->name ) ) ) )
         {
            count++;
            pager_printf( ch, " %3d| %2d|%4d| %-12s | %s \r\n", d->descriptor, d->connected, d->idle / 4,
                          d->original ? d->original->name : d->character ? d->character->name : "(None!)", d->host );
         }
      }

change it to this
      if( !argument || argument[0] == '\0' )
      {
         if( get_trust( ch ) >= LEVEL_ASCENDANT || ( d->character && can_see( ch, d->character ) ) )
         {
            count++;
            pager_printf( ch, " %3d| %-17s |%4d| %-12s | %s \r\n", d->descriptor, st, d->idle / PULSE_PER_SECOND,
                          d->original ? d->original->name : d->character ? d->character->name : "(None!)", d->host );
         }
      }
      else
      {
         if( ( get_trust( ch ) >= LEVEL_SUPREME || ( d->character && can_see( ch, d->character ) ) )
             && ( !str_prefix( argument, d->host ) || ( d->character && !str_prefix( argument, d->character->name ) ) ) )
         {
            count++;
            pager_printf( ch, " %3d| %2d|%4d| %-12s | %s \r\n", d->descriptor, d->connected, d->idle / PULSE_PER_SECOND,
                          d->original ? d->original->name : d->character ? d->character->name : "(None!)", d->host );
         }
      }

function do_ipcompare
change
               snprintf( buf, MAX_STRING_LENGTH,
                         " %3d| %2d|%4d|%6d| %-12s", hmm->descriptor, hmm->connected, hmm->idle / 4, hmm->port, hmm->name );

to
               snprintf( buf, MAX_STRING_LENGTH,
                         " %3d| %2d|%4d|%6d| %-12s", hmm->descriptor, hmm->connected, hmm->idle / PULSE_PER_SECOND, hmm->port, hmm->name );

change
            snprintf( buf, MAX_STRING_LENGTH,
                      " %3d| %2d|%4d|%6d| %-12s",
                      d->descriptor,
                      d->connected,
                      d->idle / 4, d->port, d->original ? d->original->name : d->character ? d->character->name : "(none)" );

to
            snprintf( buf, MAX_STRING_LENGTH,
                      " %3d| %2d|%4d|%6d| %-12s",
                      d->descriptor,
                      d->connected,
                      d->idle / PULSE_PER_SECOND, d->port, d->original ? d->original->name : d->character ? d->character->name : "(none)" );

change
         snprintf( buf, MAX_STRING_LENGTH,
                   " %3d| %2d|%4d|%6d| %-12s",
                   d->descriptor,
                   d->connected,
                   d->idle / 4, d->port, d->original ? d->original->name : d->character ? d->character->name : "(none)" );

to
         snprintf( buf, MAX_STRING_LENGTH,
                   " %3d| %2d|%4d|%6d| %-12s",
                   d->descriptor,
                   d->connected,
                   d->idle / PULSE_PER_SECOND, d->port, d->original ? d->original->name : d->character ? d->character->name : "(none)" );

comm.c
function game_loop
change
         else if( ( !d->character && d->idle > 360 )  /* 2 mins */
                  || ( d->connected != CON_PLAYING && d->idle > 1200 )  /* 5 mins */
                  || d->idle > 28800 ) /* 2 hrs  */
         {
            write_to_descriptor( d, "Idle timeout... disconnecting.\r\n", 0 );
            d->outtop = 0;
            close_socket( d, TRUE );
            continue;
         }

to
         else if( ( !d->character && d->idle > ( 120 * PULSE_PER_SECOND ) )  /* 2 mins */
                  || ( d->connected != CON_PLAYING && d->idle > ( 300 * PULSE_PER_SECOND ) )  /* 5 mins */
                  || d->idle > ( 7200 * PULSE_PER_SECOND ) ) /* 2 hrs  */
         {
            write_to_descriptor( d, "Idle timeout... disconnecting.\r\n", 0 );
            d->outtop = 0;
            close_socket( d, TRUE );
            continue;
         }

While since PULSE_PER_SECOND is actually 4 its not to big of an issue.
The only bug with 4 as PULSE_PER_SECOND is in comm.c where it has d->idle > 360 /* 2 mins */, d->idle > 480 /* 2 mins /* would be correct. Going ahead though and making it use PULSE_PER_SECOND is a good idea. You could of course drop it all to use d->idle and use a temp value and only increase d->idle once the new temp value is >= PULSE_PER_SECOND; Just my personal opinion on that one.
       
Pages:<< prev 1 next >>