mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-26 22:01:50 +00:00
changed sv_demodir to callbacks
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@2627 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
43a38c4639
commit
1c41a5c11a
1 changed files with 6 additions and 25 deletions
|
@ -787,11 +787,12 @@ dir_t Sys_listdir (char *path, char *ext, qboolean usesorting)
|
|||
demobuffer->start - demobuffer->end : \
|
||||
demobuffer->maxsize - demobuffer->end)
|
||||
|
||||
static void SV_DemoDir_Callback(struct cvar_s *var, char *oldvalue);
|
||||
|
||||
cvar_t sv_demoUseCache = SCVAR("sv_demoUseCache", "");
|
||||
cvar_t sv_demoCacheSize = SCVAR("sv_demoCacheSize", "");
|
||||
cvar_t sv_demoMaxDirSize = SCVAR("sv_demoMaxDirSize", "102400"); //so ktpro autorecords.
|
||||
cvar_t sv_demoDir = SCVAR("sv_demoDir", "demos");
|
||||
cvar_t sv_demoDir = SCVARC("sv_demoDir", "demos", SV_DemoDir_Callback);
|
||||
cvar_t sv_demofps = SCVAR("sv_demofps", "");
|
||||
cvar_t sv_demoPings = SCVAR("sv_demoPings", "");
|
||||
cvar_t sv_demoNoVis = SCVAR("sv_demoNoVis", "");
|
||||
|
@ -816,22 +817,22 @@ entity_state_t demo_entities[UPDATE_MASK+1][MAX_MVDPACKET_ENTITIES];
|
|||
client_frame_t demo_frames[UPDATE_MASK+1];
|
||||
|
||||
// only one .. is allowed (so we can get to the same dir as the quake exe)
|
||||
static void Check_DemoDir(void)
|
||||
static void SV_DemoDir_Callback(struct cvar_s *var, char *oldvalue)
|
||||
{
|
||||
char *value;
|
||||
|
||||
value = sv_demoDir.string;
|
||||
if (!value[0])
|
||||
value = var->string;
|
||||
if (!value[0] || value[0] == '/' || (value[0] == '\\' && value[1] == '\\'))
|
||||
{
|
||||
Cvar_ForceSet(&sv_demoDir, "demos");
|
||||
return;
|
||||
}
|
||||
|
||||
if (value[0] == '.' && value[1] == '.')
|
||||
value += 2;
|
||||
if (strstr(value,".."))
|
||||
{
|
||||
Cvar_ForceSet(&sv_demoDir, "demos");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1419,8 +1420,6 @@ mvddest_t *SV_InitRecordFile (char *name)
|
|||
}
|
||||
dst->droponmapchange = true;
|
||||
|
||||
Check_DemoDir();
|
||||
|
||||
s = name + strlen(name);
|
||||
while (*s != '/') s--;
|
||||
Q_strncpyz(dst->name, s+1, sizeof(dst->name));
|
||||
|
@ -2016,8 +2015,6 @@ void SV_MVD_Record_f (void)
|
|||
return;
|
||||
}
|
||||
|
||||
Check_DemoDir();
|
||||
|
||||
dir = Sys_listdir(va("%s/%s", com_gamedir, sv_demoDir.string), ".*", SORT_NO);
|
||||
if (sv_demoMaxDirSize.value && dir.size > sv_demoMaxDirSize.value*1024)
|
||||
{
|
||||
|
@ -2252,8 +2249,6 @@ void SV_MVDEasyRecord_f (void)
|
|||
int i;
|
||||
FILE *f;
|
||||
|
||||
Check_DemoDir();
|
||||
|
||||
c = Cmd_Argc();
|
||||
if (c > 2)
|
||||
{
|
||||
|
@ -2463,8 +2458,6 @@ void SV_MVDList_f (void)
|
|||
float f;
|
||||
int i,j,show;
|
||||
|
||||
Check_DemoDir();
|
||||
|
||||
Con_Printf("content of %s/%s/*.mvd\n", com_gamedir,sv_demoDir.string);
|
||||
dir = Sys_listdir(va("%s/%s", com_gamedir,sv_demoDir.string), ".mvd", SORT_BY_DATE);
|
||||
list = dir.files;
|
||||
|
@ -2510,8 +2503,6 @@ char *SV_MVDNum(int num)
|
|||
file_t *list;
|
||||
dir_t dir;
|
||||
|
||||
Check_DemoDir();
|
||||
|
||||
dir = Sys_listdir(va("%s/%s", com_gamedir, sv_demoDir.string), ".mvd", SORT_BY_DATE);
|
||||
list = dir.files;
|
||||
|
||||
|
@ -2556,8 +2547,6 @@ void SV_MVDRemove_f (void)
|
|||
char path[MAX_OSPATH];
|
||||
int i;
|
||||
|
||||
Check_DemoDir();
|
||||
|
||||
if (Cmd_Argc() != 2)
|
||||
{
|
||||
Con_Printf("rmdemo <demoname> - removes the demo\nrmdemo *<token> - removes demo with <token> in the name\nrmdemo * - removes all demos\n");
|
||||
|
@ -2630,8 +2619,6 @@ void SV_MVDRemoveNum_f (void)
|
|||
char *val, *name;
|
||||
char path[MAX_OSPATH];
|
||||
|
||||
Check_DemoDir();
|
||||
|
||||
if (Cmd_Argc() != 2)
|
||||
{
|
||||
Con_Printf("rmdemonum <#>\n");
|
||||
|
@ -2671,8 +2658,6 @@ void SV_MVDInfoAdd_f (void)
|
|||
char *name, *args, path[MAX_OSPATH];
|
||||
FILE *f;
|
||||
|
||||
Check_DemoDir();
|
||||
|
||||
if (Cmd_Argc() < 3) {
|
||||
Con_Printf("usage:MVDInfoAdd <demonum> <info string>\n<demonum> = * for currently recorded demo\n");
|
||||
return;
|
||||
|
@ -2722,8 +2707,6 @@ void SV_MVDInfoRemove_f (void)
|
|||
{
|
||||
char *name, path[MAX_OSPATH];
|
||||
|
||||
Check_DemoDir();
|
||||
|
||||
if (Cmd_Argc() < 2)
|
||||
{
|
||||
Con_Printf("usage:demoInfoRemove <demonum>\n<demonum> = * for currently recorded demo\n");
|
||||
|
@ -2764,8 +2747,6 @@ void SV_MVDInfo_f (void)
|
|||
FILE *f = NULL;
|
||||
char *name, path[MAX_OSPATH];
|
||||
|
||||
Check_DemoDir();
|
||||
|
||||
if (Cmd_Argc() < 2)
|
||||
{
|
||||
Con_Printf("usage:demoinfo <demonum>\n<demonum> = * for currently recorded demo\n");
|
||||
|
|
Loading…
Reference in a new issue