1
0
Fork 0
forked from fte/fteqw

Fix a few annoying bugs.

git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6078 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
Spoike 2021-10-09 07:58:27 +00:00
parent 23437fff01
commit 00cd084bb8
5 changed files with 47 additions and 5 deletions

View file

@ -2565,7 +2565,8 @@ void DL_Abort(qdownload_t *dl, enum qdlabort aborttype)
} }
} }
#ifdef PACKAGEMANAGER #ifdef PACKAGEMANAGER
PM_FileInstalled(dl->localname, dl->fsroot, NULL, true); if (!strncmp(dl->localname, "package/", 8) && dl->fsroot == FS_ROOT)
PM_FileInstalled(dl->localname+8, dl->fsroot, NULL, false);
#endif #endif
} }
else else

View file

@ -1787,6 +1787,10 @@ void *PM_GeneratePackageFromMeta(vfsfile_t *file, char *fname, size_t fnamesize,
static qboolean PM_FileInstalled_Internal(const char *package, const char *category, const char *title, const char *filename, enum fs_relative fsroot, unsigned pkgflags, void *metainfo, qboolean enable) static qboolean PM_FileInstalled_Internal(const char *package, const char *category, const char *title, const char *filename, enum fs_relative fsroot, unsigned pkgflags, void *metainfo, qboolean enable)
{ {
package_t *p; package_t *p;
char *dlcache, *end;
if (!*filename)
return false; //wtf?
if (metainfo) if (metainfo)
{ {
@ -1808,7 +1812,41 @@ static qboolean PM_FileInstalled_Internal(const char *package, const char *categ
p->deps = Z_Malloc(sizeof(*p->deps) + strlen(filename)); p->deps = Z_Malloc(sizeof(*p->deps) + strlen(filename));
p->deps->dtype = DEP_FILE; p->deps->dtype = DEP_FILE;
strcpy(p->deps->name, filename); strcpy(p->deps->name, filename);
p->fsroot = fsroot;
dlcache = strstr(p->deps->name+1, "/dlcache/");
if (dlcache)
{
memmove(dlcache+1, dlcache+9, strlen(dlcache+9)+1);
dlcache = (char*)(COM_GetFileExtension(p->deps->name, NULL));
if (dlcache[0] == '.' && dlcache[1] && *COM_GetFileExtension(p->deps->name, dlcache))
{
unsigned int qhash = strtoul(dlcache+1, &end, 16);
if (!*end) //reached the end of the name?...
{
p->qhash = Z_StrDupf("%#x", qhash); //that looks like a qhash!
*dlcache = 0; //strip it from the name.
}
}
}
if (fsroot == FS_PUBGAMEONLY)
{
Q_strncpyz(p->gamedir, FS_GetGamedir(true), sizeof(p->gamedir));
p->fsroot = FS_ROOT;
}
else if (fsroot == FS_ROOT && pkgflags)
{
dlcache = strchr(p->deps->name+1, '/');
if (dlcache)
{
*dlcache++ = 0;
Q_strncpyz(p->gamedir, p->deps->name, sizeof(p->gamedir));
memmove(p->deps->name, dlcache, strlen(dlcache)+1);
}
p->fsroot = FS_ROOT;
}
else
p->fsroot = fsroot;
if (pkgflags&DPF_PLUGIN) if (pkgflags&DPF_PLUGIN)
{ {

View file

@ -1628,7 +1628,8 @@ TRACE(("dbg: R_ApplyRenderer: isDedicated = true\n"));
CL_Disconnect("Graphics rendering disabled"); CL_Disconnect("Graphics rendering disabled");
sv.state = os; sv.state = os;
} }
Sys_InitTerminal(); if (!Sys_InitTerminal())
return false;
Con_PrintToSys(); Con_PrintToSys();
#endif #endif
} }

View file

@ -86,7 +86,7 @@ static void Sys_InitClock(void);
qboolean Sys_InitTerminal (void) //we either have one or we don't. qboolean Sys_InitTerminal (void) //we either have one or we don't.
{ {
return true; return isatty(STDIN_FILENO);
} }
void Sys_CloseTerminal (void) void Sys_CloseTerminal (void)
{ {

View file

@ -1087,6 +1087,8 @@ void Cvar_ForceCheatVars(qboolean semicheats, qboolean absolutecheats)
{ {
if (!(var->flags & (CVAR_CHEAT|CVAR_SEMICHEAT))) if (!(var->flags & (CVAR_CHEAT|CVAR_SEMICHEAT)))
continue; continue;
if (var->flags & CVAR_SERVEROVERRIDE) //server has control over it. don't force it away.
continue;
latch = var->latched_string; latch = var->latched_string;
var->latched_string = NULL; var->latched_string = NULL;
@ -1105,7 +1107,7 @@ void Cvar_ForceCheatVars(qboolean semicheats, qboolean absolutecheats)
else else
Cvar_ForceSet(var, latch); Cvar_ForceSet(var, latch);
} }
if (var->flags & CVAR_SEMICHEAT) else if (var->flags & CVAR_SEMICHEAT)
{ {
if (var->flags & CVAR_RULESETLATCH) if (var->flags & CVAR_RULESETLATCH)
; //this is too problematic. the ruleset should cover it. ; //this is too problematic. the ruleset should cover it.