05 Mar, 2010, Igabod wrote in the 1st comment:
Votes: 0
Alright I was sitting around idle on a smaugfuss and got the following message "You sense a change in the magical forces surrounding you." I was curious what the hell that message was displayed for so I grepped it in the shell and found it in the reboot_check function in update.c on line 2085. I'm not familiar with smaugfuss code at all and not familiar with update.c routines in any muds really so I was hoping someone could explain to me what this function is doing and why I got that message.

void reboot_check( time_t reset )
{
static const char *tmsg[] = { "You feel the ground shake as the end comes near!",
"Lightning crackles in the sky above!",
"Crashes of thunder sound across the land!",
"The sky has suddenly turned midnight black.",
"You notice the life forms around you slowly dwindling away.",
"The seas across the realm have turned frigid.",
"The aura of magic that surrounds the realms seems slightly unstable.",
"You sense a change in the magical forces surrounding you."
};
static const int times[] = { 60, 120, 180, 240, 300, 600, 900, 1800 };
static const int timesize = UMIN( sizeof( times ) / sizeof( *times ), sizeof( tmsg ) / sizeof( *tmsg ) );
char buf[MAX_STRING_LENGTH];
static int trun;
static bool init = FALSE;

if( !init || reset >= current_time )
{
for( trun = timesize - 1; trun >= 0; trun– )
if( reset >= current_time + times[trun] )
break;
init = TRUE;
return;
}

if( new_boot_time_t - boot_time < 60 * 60 * 18 && !set_boot_time->manual )
return;

if( new_boot_time_t <= current_time )
{
CHAR_DATA *vch;

if( auction->item )
{
snprintf( buf, MAX_STRING_LENGTH, "Sale of %s has been stopped by mud.", auction->item->short_descr );
talk_auction( buf );
obj_to_char( auction->item, auction->seller );
auction->item = NULL;
if( auction->buyer && auction->buyer != auction->seller )
{
auction->buyer->gold += auction->bet;
send_to_char( "Your money has been returned.\r\n", auction->buyer );
}
}
echo_to_all( AT_YELLOW, "You are forced from these realms by a strong "
"magical presence\r\nas life here is reconstructed.", ECHOTAR_ALL );
log_string( "Automatic Reboot" );
for( vch = first_char; vch; vch = vch->next )
if( !IS_NPC( vch ) )
save_char_obj( vch );
mud_down = TRUE;
return;
}

if( trun != -1 && new_boot_time_t - current_time <= times[trun] )
{
echo_to_all( AT_YELLOW, tmsg[trun], ECHOTAR_ALL );
if( trun <= 5 )
sysdata.DENY_NEW_PLAYERS = TRUE;
–trun;
return;
}
}
05 Mar, 2010, bbailey wrote in the 2nd comment:
Votes: 0
Igabod said:
Alright I was sitting around idle on a smaugfuss and got the following message "You sense a change in the magical forces surrounding you." I was curious what the hell that message was displayed for so I grepped it in the shell and found it in the reboot_check function in update.c on line 2085. I'm not familiar with smaugfuss code at all and not familiar with update.c routines in any muds really so I was hoping someone could explain to me what this function is doing and why I got that message.


From a cursory glance, it appears that it's possible to set an automatic timer for scheduled reboots, and the various messages are displayed as a warning or other cosmetic flavor as that scheduled time approaches.
05 Mar, 2010, Zeno wrote in the 3rd comment:
Votes: 0
Smaug has messages at intervals before it reboots. This handles that.
05 Mar, 2010, Kayle wrote in the 4th comment:
Votes: 0
BBailey is correct. And so is Zeno.

Basically reboot_check is called once every minute, and a message is displayed to the mud at specific intervals before the automatic daily reboots. The messages are to provide a warning to players that the mud will be rebooting soon. They're listed in the struct in reverse, and start at 1800 seconds before the reboot, and go all the way to 60 seconds before the reboot. And then you get the reboot. It's an old system that most likely was implemented to apply a temporary fix to a memory leak or something similar, and it just became something everyone was used to happening, and so was never removed. It's perfectly safe to remove the automatic reboot stuff, I've done it several times with no issues, but it's also great for an active base, you can develop on one port, and then each night drop your stable Dev code over, and then at 6 or 8am depending on when it happens, the automatic reboot loads the new code in, and players are none the wiser. It's great for stealth adding of systems. :P

A hotboot will generally give away that code changes occured. Automatic Reboots are automatic. So people don't generally assume that anything happens aside from something running automagically.
07 Mar, 2010, kiasyn wrote in the 5th comment:
Votes: 0
you could just do a silent hotboot :P
09 Mar, 2010, Igabod wrote in the 6th comment:
Votes: 0
Thank you for all the answers, I will probably be removing any calls to this function since the whole idea doesn't mesh well with my muds theme.
09 Mar, 2010, Zeno wrote in the 7th comment:
Votes: 0
I removed auto reboots from my MUD. They are pointless now, more or less. Were kind of meant to reboot the MUD because Smaug had mem leaks.
0.0/7