More cleaning up after slobs.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2003-03-21 21:26:26 +00:00
parent 5fb8aa07f3
commit 41bfde9cfa
8 changed files with 151 additions and 99 deletions

View file

@ -82,8 +82,8 @@ location_t *
locs_find (const vec3_t target)
{
int i;
i = locs_nearest(target);
if (i == -1)
i = locs_nearest (target);
if (i == -1)
return NULL;
return locations[i];
}
@ -139,7 +139,7 @@ locs_load (const char *filename)
char foundname[MAX_OSPATH];
int templength = 0;
snprintf(tmp,sizeof(tmp), "maps/%s",filename);
snprintf (tmp, sizeof(tmp), "maps/%s", filename);
templength = _QFS_FOpenFile (tmp, &file, foundname, 1);
if (!file) {
Con_Printf ("Couldn't load %s\n", tmp);
@ -156,7 +156,7 @@ locs_load (const char *filename)
if (t2 == t1)
continue;
loc[2] = strtol (t2, &t1, 0) * (1.0 / 8);
if ((t1 == t2) || (strlen(t1) < 2))
if ((t1 == t2) || (strlen (t1) < 2))
continue;
t1++;
t2 = strrchr (t1, '\n');
@ -199,23 +199,21 @@ locs_save (const char *filename, qboolean gz)
char locfile[MAX_OSPATH];
if (gz) {
if (strncmp(filename + strlen(filename) - 3,".gz",3) != 0)
snprintf (locfile, sizeof (locfile), "%s.gz",filename);
if (strncmp (filename + strlen (filename) - 3, ".gz", 3) != 0)
snprintf (locfile, sizeof (locfile), "%s.gz", filename);
else
strcpy(locfile,filename);
strcpy (locfile, filename);
locfd = Qopen (locfile,"z9w+");
} else
locfd = Qopen (filename,"w+");
if (locfd == 0) {
Con_Printf("ERROR: Unable to open %s\n",filename);
Con_Printf ("ERROR: Unable to open %s\n", filename);
return;
}
for (i=0; i < locations_count; i++)
Qprintf(locfd,"%.0f %.0f %.0f %s\n",
locations[i]->loc[0] * 8,
locations[i]->loc[1] * 8,
locations[i]->loc[2] * 8,
locations[i]->name);
Qprintf (locfd, "%.0f %.0f %.0f %s\n", locations[i]->loc[0] * 8,
locations[i]->loc[1] * 8, locations[i]->loc[2] * 8,
locations[i]->name);
Qclose (locfd);
}
@ -275,10 +273,10 @@ map_to_loc (const char *mapname, char *filename)
{
char *t1;
strcpy(filename, mapname);
t1 = strrchr(filename,'.');
strcpy (filename, mapname);
t1 = strrchr (filename, '.');
if (!t1)
Sys_Error ("Can't find .!");
t1++;
strcpy(t1,"loc");
strcpy (t1, "loc");
}