Esempio n. 1
0
void do_tests() {
    x = 0;
    set_heart_beat(0);
    ASSERT(!query_heart_beat(this_object()));
    set_heart_beat(1);
    ASSERT(query_heart_beat(this_object()) == 1);
}
Esempio n. 2
0
File: info.c Progetto: abzde/dock9
int main(string args)
{
    int i;
    object targetob, *roominv, *playerinv;
    playerinv = all_inventory(this_player());
    roominv = all_inventory(environment(this_player()));

    if(!args) return(notify_fail("SYNTAX: info <thing>\n"));
    if(args == ("here"||"room")) targetob = environment(this_player());
    if(args == ("me"||"self")) targetob = this_player();
    else{
        for(i=0;i < sizeof(roominv); i++) if(roominv[i]->id(args))
          targetob = roominv[i];
        for(i=0;i < sizeof(playerinv); i++) if(playerinv[i]->id(args))
          targetob = playerinv[i];
    }
    if(targetob){
        write(
          "Path: "+file_name(targetob)+"\n"
          "Launchpad: http://bazaar.launchpad.net/~dock9/dock9/trunk/annotate/head%3A/lib"
             +file_name(targetob)+".c\n" //This should try to see the extension, not assume .c
          "Short name: "+targetob->query_short()+"\n"
          "Heartbeat "+query_heart_beat(targetob)+"\n"
        );
        return 1;
    }
    else return(notify_fail("SYNTAX: info <thing>\n\n"+args+" is not a valid thing.\n"));
}
Esempio n. 3
0
int cmd_mudstatus() {
    int utime=uptime(), mem=memory_info(), i=0, ct=0;
    object *o;

    if(!archp(this_player())) return 0;
    write("%^BLUE%^+=+=+=+( %^BOLD%^%^WHITE%^Mud Status%^RESET%^%^BLUE%^ )+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=%^RESET%^");

    write("    The mud has been online for "+query_time(uptime())+"");
    write("    The mud will reboot in "+query_time((EVENTS_D->query_next_reboot())-time())+"");
    write("    Number of Objects Loaded:  "+i=sizeof(o=objects()));
    write("    "+add_commas(mem)+" bytes of memory is loaded.");
    while(i--) if(query_heart_beat(o[i])) ct++;
    write("    Number of objects with heartbeats: "+ct+".");
    write("    Number of callouts: "+sizeof(call_out_info())+".");
    write("    Processing "+query_load_average()+".");
    if(find_object("/d/nopk/standard/freezer"))
        write("    Number of link-dead players: "+
              sizeof( all_inventory( find_object( "/d/nopk/standard/freezer" ) ) ) );
    write("    Number of players online: "+(string)sizeof(users()));
    write("%^BLUE%^+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+=+%^RESET%^\n");
    return 1;
}
Esempio n. 4
0
void heart_beat() {
    x++;
    switch (x) {
    case 1:
	ASSERT(query_heart_beat(this_object()) == 1);
	set_heart_beat(2);
	ASSERT(query_heart_beat(this_object()) == 2);
	break;
    case 1:
	ASSERT(query_heart_beat(this_object()) == 2);
	set_heart_beat(-1);
	ASSERT(query_heart_beat(this_object()) == 2);
	break;
    case 2:
	ASSERT(query_heart_beat(this_object()) == 2);
	set_heart_beat(0);
	ASSERT(query_heart_beat(this_object()) == 0);
	break;
    default:
	ASSERT(0);
    }
}
Esempio n. 5
0
void init(){
        ::init();
        if( !query_heart_beat(this_object()) ) {
                set_heart_beat(1); 
        }
}