ldmud-3.3.719/
ldmud-3.3.719/doc/
ldmud-3.3.719/doc/efun.de/
ldmud-3.3.719/doc/efun/
ldmud-3.3.719/doc/man/
ldmud-3.3.719/doc/other/
ldmud-3.3.719/mud/
ldmud-3.3.719/mud/heaven7/
ldmud-3.3.719/mud/lp-245/
ldmud-3.3.719/mud/lp-245/banish/
ldmud-3.3.719/mud/lp-245/doc/
ldmud-3.3.719/mud/lp-245/doc/examples/
ldmud-3.3.719/mud/lp-245/doc/sefun/
ldmud-3.3.719/mud/lp-245/log/
ldmud-3.3.719/mud/lp-245/obj/Go/
ldmud-3.3.719/mud/lp-245/players/lars/
ldmud-3.3.719/mud/lp-245/room/death/
ldmud-3.3.719/mud/lp-245/room/maze1/
ldmud-3.3.719/mud/lp-245/room/sub/
ldmud-3.3.719/mud/lp-245/secure/
ldmud-3.3.719/mud/sticklib/
ldmud-3.3.719/mud/sticklib/src/
ldmud-3.3.719/mudlib/deprecated/
ldmud-3.3.719/mudlib/uni-crasher/
ldmud-3.3.719/pkg/
ldmud-3.3.719/pkg/debugger/
ldmud-3.3.719/pkg/diff/
ldmud-3.3.719/pkg/misc/
ldmud-3.3.719/src/
ldmud-3.3.719/src/autoconf/
ldmud-3.3.719/src/ptmalloc/
ldmud-3.3.719/src/util/
ldmud-3.3.719/src/util/erq/
ldmud-3.3.719/src/util/indent/hosts/next/
ldmud-3.3.719/src/util/xerq/
ldmud-3.3.719/src/util/xerq/lpc/
ldmud-3.3.719/src/util/xerq/lpc/www/
ldmud-3.3.719/test/generic/
ldmud-3.3.719/test/inc/
ldmud-3.3.719/test/t-0000398/
ldmud-3.3.719/test/t-0000548/
ldmud-3.3.719/test/t-030925/
ldmud-3.3.719/test/t-040413/
ldmud-3.3.719/test/t-041124/
ldmud-3.3.719/test/t-language/
#include "/inc/base.inc"

/* These functions are for the clone (the player object). */
void start_client()
{
    net_connect("127.0.0.1", query_mud_port());
    set_heart_beat(1);
}

int logon(int flag)
{
    enable_telnet(0);
    set_prompt("");

    return 1;
}

object connect()
{
   enable_telnet(0);
   set_prompt("");

   return clone_object(this_object());
}

void fun(int* oldtime)
{
    int* now = utime();

    remove_call_out(#'shutdown);

    // Is there a time difference of
    // at least 0.5 seconds?
    if (oldtime[1] < 500000)
        oldtime[1] += 500000;
    else
    {
        oldtime[1] -= 500000;
        oldtime[0] += 1;
    }

    if ((oldtime[0] == now[0])
       ?(oldtime[1] < now[1])
       :(oldtime[0] < now[0]))
    {
        msg("Success\n");
        shutdown(0);
    }
    else
    {
        msg("Failure: call_out from heart_beat within 0.5s.\n");
        shutdown(1);
    }
}

void heart_beat()
{
    call_out("fun", __ALARM_TIME__, utime());
}

void run_test()
{
    int result;

    msg("\nRunning test for #0000375:\n"
        "--------------------------\n");

    call_out("run_test2", 0);
}

void run_test2()
{
    object dummy;
    dummy = clone_object(this_object());
    dummy->start_client();

    call_out(#'shutdown, (__HEART_BEAT_INTERVAL__+__ALARM_TIME__)*2, 1); // Just to make sure.
}

string *epilog(int eflag)
{
    run_test();
    return 0;
}