예제 #1
0
void CServerRemoteAccess::SetValue(const char *variable, const char *value)
{
	FileHandle_t f;
	struct cvar_s *var;

	if (!Q_stricmp(variable, "map"))
	{
		Cbuf_AddText("changelevel ");
		Cbuf_AddText((char*)value);
		Cbuf_AddText("\n");
		Cbuf_Execute();
	}
	else if (!Q_stricmp(variable, "mapcycle"))
	{
		f = FS_Open(mapcyclefile.string, "wt");
		if (!f)
		{
			Con_Printf("Couldn't write to read-only file %s, using file _dev_mapcycle.txt instead.\n", mapcyclefile.string);
			Cvar_DirectSet(&mapcyclefile, "_temp_mapcycle.txt");
			f = FS_Open(mapcyclefile.string, "wt");
		}

		if (f)
		{
			FS_Write(value, Q_strlen(value) + 1, 1, f);
			FS_Close(f);
		}
	}
	else
	{
		var = Cvar_FindVar(variable);
		if (var)
			Cvar_DirectSet(var, value);
	}
}
예제 #2
0
/* <eda83> ../engine/sv_steam3.cpp:874 */
void CSteam3Client::OnGameServerChangeRequested(GameServerChangeRequested_t *pGameServerChangeRequested) /* linkage=_ZN13CSteam3Client27OnGameServerChangeRequestedEP27GameServerChangeRequested_t */
{
#ifndef SWDS
    char *cmd;

    Cvar_DirectSet(&password, pGameServerChangeRequested->m_rgchPassword);
    Con_Printf("Connecting to %s\n", pGameServerChangeRequested->m_rgchServer);
    cmd = va("connect %s\n", pGameServerChangeRequested->m_rgchServer);
    Cbuf_AddText(cmd);
#endif
}
예제 #3
0
파일: cvar.cpp 프로젝트: Adidasman1/rehlds
/* <188e9> ../engine/cvar.c:347 */
void Cvar_Set(const char *var_name, const char *value)
{
	cvar_t *var = Cvar_FindVar(var_name);

	if (!var)
	{
		Con_DPrintf(__FUNCTION__ ": variable \"%s\" not found\n", var_name);
		return;
	}

	Cvar_DirectSet(var, value);
}
예제 #4
0
/* <2af4b> ../engine/hashpak.c:1678 */
void HPAK_CheckSize(char *pakname)
{
	char fullname[MAX_PATH];
	float maxSize;
	float actualSize;
	FileHandle_t hfile;

	maxSize = hpk_maxsize.value;
	if (!maxSize || pakname == NULL)
		return;

	if (maxSize < 0.0f)
	{
		Con_Printf("hpk_maxsize < 0, setting to 0\n");
		Cvar_DirectSet(&hpk_maxsize, "0");
		return;
	}

	Q_snprintf(fullname, ARRAYSIZE(fullname), "%s", pakname);
#ifdef REHLDS_FIXES
	fullname[ARRAYSIZE(fullname) - 1] = 0;
#endif // REHLDS_FIXES

	COM_DefaultExtension(fullname, HASHPAK_EXTENSION);
	COM_FixSlashes(fullname);

	actualSize = 0.0f;
	maxSize *= 1000000.0f;

	hfile = FS_Open(fullname, "rb");
	if (hfile)
	{
		actualSize = (float)FS_Size(hfile);
		FS_Close(hfile);
	}
	if (actualSize >= maxSize)
	{
		Con_Printf("Server: Size of %s > %f MB, deleting.\n", fullname, hpk_maxsize.value);
		Log_Printf("Server: Size of %s > %f MB, deleting.\n", fullname, hpk_maxsize.value);
		FS_RemoveFile(fullname, 0);
	}
}