|
Disabling the Auto-Disconnect
|
Reply to this subject
Start a new subject
 
Refresh page
| Posted by |
Zune
(76 posts) bio
|
| Date |
Fri 12 May 2006 12:09 AM (UTC) [ quote
] |
| Message |
Hey guys. Long time no bug.
Looking to turn off the autodisconnect in SMAUG. I'd prefer to enact it just for immortals, but I'll settle for all players. Any directions from you almighty C magnates? | top |
|
| Posted by |
David Haley
USA (3,881 posts) bio
Moderator |
| Date |
Reply #1 on Fri 12 May 2006 12:16 AM (UTC) [ quote
] |
| Message |
There's an idle counter that's incremented every tick, and reset to zero when the user types something.
To find the counter, search for "Idle timeout... disconnecting" in the code (it should be in comm.c). There you'll see the logic that controls kicking people out.
You would either not increment the counter for immortals, or not disconnect a connection if it belongs to an immortal.
It should be fairly simple; something like:
if ( !IS_IMMORTAL(d->character) )
{
/* proceed with disconnect */
}
else
{
/* don't disconnect */
}
|
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | top |
|
| Posted by |
Robert Powell
Australia (349 posts) bio
|
| Date |
Reply #2 on Fri 12 May 2006 02:42 AM (UTC) [ quote
] |
| Message |
There is a thead on these boards that tackles this very issue, and i beleive it was Nick who provided a solution that looked something like this:
else if( ( ( !d->character && d->idle > 1200 ) /* 5 mins */
|| ( d->connected != CON_PLAYING && d->idle > 2400 ) /* 10 mins */
|| d->idle > 57600 ) /* 4 hrs */
&& !( d->character && d->character->level >= LEVEL_IMMORTAL ) )
{
you should be able to find that in comm.c. |
EldhaMUD Game Developments
The_Fury: Lead Developer, Head Coder
http://fury.eldhamud2.org
| top |
|
| Posted by |
Samson
USA (683 posts) bio
|
| Date |
Reply #3 on Fri 12 May 2006 05:24 PM (UTC) [ quote
] |
| Message |
else if( ( ( !d->character && d->idle > 1200 ) /* 5 mins */
|| ( d->connected != CON_PLAYING && d->idle > 2400 ) /* 10 mins */
|| d->idle > 57600 ) /* 4 hrs */
&& !( d->character && d->character->level >= LEVEL_IMMORTAL ) )
{
Should be pointed out that the main reason this works to keep imms from getting booted is because d->idle is being compared to 57600. d->idle by default is a short int, which maxes out at 32767 before rolling over negative. In effect, because it never hits 57600, this lets the imm stay on forever. If someone were to later change the type for d->idle to an unsigned short, an int, or anything else that goes beyond the current limit then it would in fact kick them after 4 hours. |
SmaugMuds.org: http://www.smaugmuds.org - The Smaug MUDs Community Center
"The past was erased, the erasure was forgotten, the lie became truth." -- George Orwell, 1984 | top |
|
| Posted by |
David Haley
USA (3,881 posts) bio
Moderator |
| Date |
Reply #4 on Fri 12 May 2006 06:57 PM (UTC) [ quote
] |
| Message |
Actually the imm check is on a different boolean branch from the idle-check part of the expression; the second part of the check (after the &&) is true, not negated it's false, which stops the whole check.
It should be pointed out though that it's rather unsafe practice to be comparing numbers of different sizes. |
David Haley aka Ksilyan
Head Programmer,
Legends of the Darkstone
http://david.the-haleys.org | top |
|
| Posted by |
Robert Powell
Australia (349 posts) bio
|
| Date |
Reply #5 on Fri 12 May 2006 11:33 PM (UTC) [ quote
] |
| Message |
| The type for idle was changed sometime ago in my code, after noticing that it was busting the bounds of a short, so yes if you were to stick that into an unmodified base then it could perfrom inconsistantly. |
EldhaMUD Game Developments
The_Fury: Lead Developer, Head Coder
http://fury.eldhamud2.org
| 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.
2,835 views.
Reply to this subject
Start a new subject
 
Refresh page
top
Comments to:
Gammon Software support
Forum RSS feed ( http://www.gammon.com.au/rss/forum.xml )