Ejemplo n.º 1
0
Archivo: net_host.c Proyecto: rzel/dim3
void net_host_join_multiplayer_bots(void)
{
	int				n;
	char			deny_reason[256],err_str[256];
	obj_type		*obj;
	
	for (n=0;n!=max_obj_list;n++) {
		obj=server.obj_list.objs[n];
		if (obj==NULL) continue;

			// can this bot join the game?

		if (obj->type!=object_type_bot_multiplayer) continue;
		if (!net_host_player_add_ok(obj->name,deny_reason)) {
			snprintf(err_str,256,"%s: %s",obj->name,deny_reason);
			err_str[255]=0x0;
			console_add(err_str);
			continue;
		}

			// add bot

		obj->remote.net_uid=net_host_player_add_bot(obj);
	}
}
Ejemplo n.º 2
0
JSBool js_interface_console_write_func(JSContext *cx,JSObject *j_obj,uintN argc,jsval *argv,jsval *rval)
{
	char			txt[256];
	
	script_value_to_string(argv[0],txt,256);
	console_add(txt);
	
	return(JS_TRUE);
}
Ejemplo n.º 3
0
Archivo: app.c Proyecto: rzel/dim3
bool app_run_dedicated_host(char *err_str)
{
	char			str[256];

		// launch directly into hosting
		// setup hosting flags and IPs
		
	host_game_setup();
	net_host_game_setup();

	net_setup.mode=net_mode_host;
	net_setup.client.latency=0;
	net_setup.client.host_addr.ip=0;
	net_setup.client.host_addr.port=0;
	
	net_create_project_hash();

		// setup map
		
	map.info.name[0]=0x0;
	strcpy(map.info.host_name,setup.network.map_list.maps[net_setup.host.current_map_idx].name);
	
		// start game
	
	if (!game_start(FALSE,skill_medium,0,0,err_str)) {
		net_host_game_end();
		return(FALSE);
	}
	
		// add any multiplayer bots
		
	if (!game_multiplayer_bots_create(err_str)) {
		game_end();
		net_host_game_end();
		return(FALSE);
	}
	
		// start the map
		
	if (!map_start(FALSE,TRUE,err_str)) {
		game_end();
		net_host_game_end();
		return(FALSE);
	}

		// start hosting

	if (!net_host_game_start(err_str)) {
		map_end();
		game_end();
		net_host_game_end();
		return(FALSE);
	}

		// dedicated hosting, no local
		// player to add, only add
		// multiplayer bots to host

	net_host_join_multiplayer_bots();

		// game is running

	sprintf(str,"Running on %s...",net_setup.host.ip_resolve);
	console_add(str);
	
	server.next_state=gs_running;

	return(TRUE);
}