Exemplo n.º 1
0
int
main (int argc, char *argv[])
{
    char* load_filename;

    /* Initialize some global variables */
    initialize_server ();

    /* Set up the paths to certain files and directories */
    init_path_strings ();

#ifndef CS_PROFILE
#ifdef SEED_RAND
    srand (time (0));
#endif
#endif

    init_types ();
    initialize_tax_rates ();

    reset_start_time ();

    load_filename = parse_server_args (argc, argv);
    if (load_filename && file_exists(load_filename)) {
	printf ("Server is trying to load: %s\n", load_filename);
	load_city (load_filename);
	zoom_originx = main_screen_originx;
	zoom_originy = main_screen_originy;
    } else {
	engine_new_city (&zoom_originx, &zoom_originy, 1);
    }

    printf ("Server starting main loop!\n");
    while (1) {
	sniff_packets ();
	engine_do_time_step ();
	get_real_time ();
	send_periodic_messages ();
	if (total_time % 1000 == 0) {
	    debug_print_stats ();
	}
    }

    return 0;
}
Exemplo n.º 2
0
int APIENTRY
WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR cmdLine, int nCmdShow)
{
	char program[8192];
	char iis_home[8192];

	if (! GetModuleFileName(NULL, program, sizeof(program)))
		return -1;

#if defined USE_SHELL_DIRBROWSER
	CoInitialize(NULL);								// For SHBrowseForFolder()
#endif

	get_iis_script_dir(iis_home);
	// On some NT systems, the registry returns "d:\inetpub\scripts,,200"
	for (int i = 0; iis_home[i]; i++) {
		if (iis_home[i] == ',')
			iis_home[i] = 0;
	}

	parse_server_args(__argc, __argv);

	char *apache_home = get_apache_home();
	if (! apache_home)
		apache_home = "";
	char *netscape_home = get_netscape_home();
	if (! netscape_home)
		netscape_home = "";
	char *website_home = get_website_home();
	if (! website_home)
		website_home = "";

	set_setup_value("RESIN_HOME", get_resin_home(0, program));
	set_setup_value("APACHE_HOME", apache_home);
	set_setup_value("IIS_HOME", iis_home);
	set_setup_value("NETSCAPE_HOME", netscape_home);
	set_setup_value("WEBSITE_HOME", website_home);

	DialogBox(hInstance, (LPCTSTR) IDD_SETUP_INIT, NULL, (DLGPROC) SetupAction);

	return FALSE;
}