mixed *did;
void save_me( void ) {
save_object( "/daemons/data/did_d.o" );
}
void restore_me( void ) {
restore_object( "/daemons/data/did_d.o" );
}
void create( void ) {
did = ({ });
restore_me();
}
void add_entry( string str ) {
object *usr;
int i;
if( !file_exists( wiz_dir( this_user() ) ) ) {
write( "Sorry, only true wizards may add to the did log.\n" );
return;
}
str = capitalize( this_user()->query_name() ) + " " + str;
did += ({ ({ time(), str }) });
save_me();
usr = USER_D->query_users();
for( i = 0; i < sizeof( usr ); i++ ) {
if( SECURE_D->query_wiz( usr[i]->query_player()->query_name() ) > 0 && usr[i] != this_user() ) {
usr[i]->query_player()->message( "** " + str );
}
}
write( "Reported. Thank you!\n" );
}
int start_index( int after ) {
int index;
index = sizeof( did );
while( index > 0 && did[index-1][0] > after )
index--;
return index;
}
string *get_entries(int after)
{
int index;
string *output;
index = start_index(after);
if ( index >= sizeof(did) )
return 0;
output = ({ "Change Log\n",
"**********\n" });
for ( ; index < sizeof(did); index++ ) {
output += ({ ctime(did[index][0]) + ": " +did[index][1] + "\n" });
output += ({ "" });
}
return output;
}