Пример #1
0
void FS_LoadBasePak()
{
	Cmd::Args extrapaks(fs_extrapaks.Get());
	for (const auto& x: extrapaks) {
		if (!FS_LoadPak(x.c_str()))
			Com_Error(errorParm_t::ERR_FATAL, "Could not load extra pak '%s'\n", x.c_str());
	}

	if (!FS_LoadPak(fs_basepak.Get().c_str())) {
		Log::Notice("Could not load base pak '%s', falling back to default\n", fs_basepak.Get().c_str());
		if (!FS_LoadPak(DEFAULT_BASE_PAK))
			Com_Error(errorParm_t::ERR_FATAL, "Could not load default base pak '%s'", DEFAULT_BASE_PAK);
	}
}
Пример #2
0
/*
=================
SV_MasterGameStat
=================
*/
void SV_MasterGameStat( const char *data )
{
	netadr_t adr;

	if ( !isLanOnly.Get() )
	{
		return; // only dedicated servers send stats
	}

	Com_Printf( "Resolving %s\n", MASTER_SERVER_NAME );

	switch ( NET_StringToAdr( MASTER_SERVER_NAME, &adr, NA_UNSPEC ) )
	{
		case 0:
			Com_Printf( "Couldn't resolve master address: %s\n", MASTER_SERVER_NAME );
			return;

		case 2:
			adr.port = BigShort( PORT_MASTER );

		default:
			break;
	}

	Com_Printf( "%s resolved to %s\n", MASTER_SERVER_NAME,
	            NET_AdrToStringwPort( adr ) );

	Com_Printf( "Sending gamestat to %s\n", MASTER_SERVER_NAME );
	NET_OutOfBandPrint( NS_SERVER, adr, "gamestat %s", data );
}
Пример #3
0
/*
=================
CM_WriteAreaBits

Writes a bit vector of all the areas
that are in the same flood as the area parameter
Returns the number of bytes needed to hold all the bits.

The bits are OR'd in, so you can CM_WriteAreaBits from multiple
viewpoints and get the union of all visible areas.

This is used to cull non-visible entities from snapshots
=================
*/
int CM_WriteAreaBits( byte *buffer, int area )
{
	int i;
	int floodnum;
	int bytes;

	bytes = ( cm.numAreas + 7 ) >> 3;

	if ( cm_noAreas.Get() || area == -1 )
	{
		// for debugging, send everything
		memset( buffer, 255, bytes );
	}
	else
	{
		floodnum = cm.areas[ area ].floodnum;

		for ( i = 0; i < cm.numAreas; i++ )
		{
			if ( cm.areas[ i ].floodnum == floodnum || area == -1 )
			{
				buffer[ i >> 3 ] |= 1 << ( i & 7 );
			}
		}
	}
Пример #4
0
void BreakpadInit() {
    if (!enableBreakpad.Get()) {
        return;
    }

    if (BreakpadInitInternal()) {
        crashDumpLogs.Notice("Starting crash logging server");
    }
}
Пример #5
0
bool FS_LoadServerPaks(const char* paks, bool isDemo)
{
	Cmd::Args args(paks);
	fs_missingPaks.clear();
	for (auto& x: args) {
		std::string name, version;
		Util::optional<uint32_t> checksum;
		if (!FS::ParsePakName(x.data(), x.data() + x.size(), name, version, checksum)) {
			Com_Error(errorParm_t::ERR_DROP, "Invalid pak reference from server: %s", x.c_str());
		} else if (!checksum) {
			if (isDemo || allowRemotePakDir.Get())
				continue;
			Com_Error(errorParm_t::ERR_DROP, "The server is configured to load game data from a directory which makes it incompatible with remote clients.");
		}

		// Keep track of all missing paks
		const FS::PakInfo* pak = FS::FindPak(name, version, *checksum);
		if (!pak)
			fs_missingPaks.emplace_back(std::move(name), std::move(version), *checksum);
		else {
			try {
				FS::PakPath::LoadPakExplicit(*pak, *checksum);
			} catch (std::system_error&) {
				fs_missingPaks.emplace_back(std::move(name), std::move(version), *checksum);
			}
		}
	}

	// Load extra paks as well for demos
	if (isDemo) {
		Cmd::Args extrapaks(fs_extrapaks.Get());
		for (auto& x: extrapaks) {
			if (!FS_LoadPak(x.c_str()))
				Com_Error(errorParm_t::ERR_FATAL, "Could not load extra pak '%s'\n", x.c_str());
		}
	}

	return fs_missingPaks.empty();
}
Пример #6
0
void SV_MasterHeartbeat( const char *hbname )
{
	int             i;
	int             netenabled;

	netenabled = Cvar_VariableIntegerValue( "net_enabled" );

	if ( isLanOnly.Get() || !( netenabled & ( NET_ENABLEV4 | NET_ENABLEV6 ) ) )
	{
		return; // only dedicated servers send heartbeats
	}

	// if not time yet, don't send anything
	if ( svs.time < svs.nextHeartbeatTime )
	{
		return;
	}

	svs.nextHeartbeatTime = svs.time + HEARTBEAT_MSEC;

	SV_ResolveMasterServers();

	// send to group masters
	for ( i = 0; i < MAX_MASTER_SERVERS; i++ )
	{
		if ( masterServerAddr[ i ].ipv4.type == NA_BAD && masterServerAddr[ i ].ipv6.type == NA_BAD )
		{
			continue;
		}

		Com_Printf( "Sending heartbeat to %s\n", sv_master[ i ]->string );

		// this command should be changed if the server info / status format
		// ever incompatibly changes

		if ( masterServerAddr[ i ].ipv4.type != NA_BAD )
		{
			NET_OutOfBandPrint( NS_SERVER, masterServerAddr[ i ].ipv4, "heartbeat %s\n", hbname );
		}

		if ( masterServerAddr[ i ].ipv6.type != NA_BAD )
		{
			NET_OutOfBandPrint( NS_SERVER, masterServerAddr[ i ].ipv6, "heartbeat %s\n", hbname );
		}
	}
}
Пример #7
0
/*
====================
CM_AreasConnected

====================
*/
bool CM_AreasConnected( int area1, int area2 )
{
	if ( cm_noAreas.Get() )
	{
		return true;
	}

	if ( area1 < 0 || area2 < 0 )
	{
		return false;
	}

	if ( area1 >= cm.numAreas || area2 >= cm.numAreas )
	{
		Sys::Drop( "area >= cm.numAreas" );
	}

	if ( cm.areas[ area1 ].floodnum == cm.areas[ area2 ].floodnum )
	{
		return true;
	}

	return false;
}