Example #1
0
File: callout.c Project: xxx/cdlib
/*
 * Function name: remove_call_out
 * Description:   Locate and remove a call_out to a named function
 * Arguments:     func - name of function the call_out is for
 * Returns:       -1 if not found, time that remained before trigger
 *                would be done if found
 */
int
remove_call_out(string func)
{
    mixed *calls = get_all_alarms();
    int i;
    
    for (i = 0; i < sizeof(calls); i++)
	if (calls[i][1] == func)
	{
	    remove_alarm(calls[i][0]);
	    return ftoi(calls[i][2]);
	}
    return -1;
}
Example #2
0
/*
 * Function name: write_info
 * Description  : This function will display the next line of the application
 *                process to the player and input the next line. If the
 *                player is done, the message will be inserted in the
 *                application board.
 */
void
write_info()
{
    string *part, epz, whom, ip, in;
    object ob;

    remove_alarm(time_out_alarm);

    if (pos >= sizeof(info))
    {
	catch(LOAD_ERR(APPLICATION_BOARD_LOC));
	ob = present("application board", find_object(APPLICATION_BOARD_LOC));

	if (!objectp(ob))
	{
	    write_socket("\nThe application could not be saved. Please try " +
		"again at a later date when the bug has been found and " +
		"fixed. If you know someone with access to the game, ask " +
		"him or to mention the problem to the administration.\n");
	}
	else
	{
	    whom = query_ip_ident(this_object());
	    whom = strlen(whom) > 0 ? whom : "Unknown";
	    in = query_ip_name(this_object());
	    ip = query_ip_number(this_object());
	    whom += "@" + (in == ip ? in : in + " (" + ip + ")");
	    ob->new_msg(whom);
	    result = "Application from " + whom +
		" at " + ctime(time()) + "\n" + result + "\n";
	    ob->done_editing(result);
	    write_socket("\nYour application has been filed.\n");
	}

	destruct();
	return;
    }

    part = explode(info[pos++], "&&");

    write_socket(part[2] + "\nApplication entry> ");

    if ((epz = explode(part[0], "\n")[0]) == "")
    {
	epz = explode(part[0], "\n")[1];
    }

    if (epz == "m")
    {
	time_out_alarm = set_alarm(MULTI_TIME_OUT, 0.0, time_out);
	result += explode(part[1], "\n")[1];
	input_to(get_mline);
    }
    else if (epz == "-")
    {
	time_out_alarm = set_alarm(SINGLE_TIME_OUT, 0.0, time_out);
	input_to(get_nline);
    }
    else
    {
	time_out_alarm = set_alarm(SINGLE_TIME_OUT, 0.0, time_out);
	result += explode(part[1], "\n")[1];
	input_to(get_sline);
    }
}