<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">[PATCH] gl_mesh cleanups

Cleanup path handling in gl_mesh.c.

diff -urN b/common/gl_mesh.c head/common/gl_mesh.c
--- b/common/gl_mesh.c	2004-07-25 15:59:59.000000000 +0930
+++ head/common/gl_mesh.c	2005-12-28 12:24:00.000000000 +1030
@@ -289,7 +289,7 @@
     int i, j;
     int *cmds;
     trivertx_t *verts;
-    char cache[MAX_QPATH], fullpath[MAX_OSPATH];
+    char cache[MAX_QPATH];
     FILE *f;
 
     aliasmodel = m;
@@ -298,12 +298,11 @@
     //
     // look for a cached version
     //
-    strcpy(cache, "glquake/");
-    COM_StripExtension(m-&gt;name + strlen("progs/"),
-		       cache + strlen("glquake/"));
+    sprintf(cache, "%s/glquake/", com_gamedir);
+    COM_StripExtension(m-&gt;name + strlen("progs/"), cache + strlen(cache));
     strcat(cache, ".ms2");
 
-    COM_FOpenFile(cache, &amp;f);
+    f = fopen(cache, "rb");
     if (f) {
 	fread(&amp;numcommands, 4, 1, f);
 	fread(&amp;numorder, 4, 1, f);
@@ -314,22 +313,21 @@
 	//
 	// build it from scratch
 	//
-	Con_Printf("meshing %s...\n", m-&gt;name);
+	Con_DPrintf("meshing %s...\n", m-&gt;name);
 
 	BuildTris();		// trifans or lists
 
 	//
 	// save out the cached version
 	//
-	sprintf(fullpath, "%s/%s", com_gamedir, cache);
-	f = fopen(fullpath, "wb");
+	f = fopen(cache, "wb");
 	if (!f) {
 	    // Maybe the directory wasn't present, try again
 	    char gldir[MAX_OSPATH];
 
 	    sprintf(gldir, "%s/glquake", com_gamedir);
 	    Sys_mkdir(gldir);
-	    f = fopen(fullpath, "wb");
+	    f = fopen(cache, "wb");
 	}
 
 	if (f) {
</pre></body></html>