More fixes for the loc code.

This commit is contained in:
Zephaniah E. Hull 2001-01-23 14:48:05 +00:00
parent 712b655c1b
commit f6b12b12e3
3 changed files with 10 additions and 13 deletions

View file

@ -42,9 +42,9 @@ void locs_load(char *filename);
void locs_reset(); void locs_reset();
void locs_add(vec3_t location, char *name); void locs_add(vec3_t location, char *name);
void map_to_loc (char *mapname, char *filename); void map_to_loc (char *mapname, char *filename);
void locs_del (char *filename, vec3_t loc); void locs_del (vec3_t loc);
void locs_edit (char *filename, vec3_t loc, char *desc); void locs_edit (vec3_t loc, char *desc);
void locs_mark (char *filename, vec3_t loc, char *desc); void locs_mark (vec3_t loc, char *desc);
void locs_save (char *filename, qboolean gz); void locs_save (char *filename, qboolean gz);
int locs_nearest (vec3_t loc); int locs_nearest (vec3_t loc);
#endif // __locs_h #endif // __locs_h

View file

@ -213,10 +213,9 @@ locs_save (char *filename, qboolean gz)
} }
void void
locs_mark (char *filename, vec3_t loc, char *desc) locs_mark (vec3_t loc, char *desc)
{ {
locs_add (loc,desc); locs_add (loc,desc);
locs_save (filename);
Con_Printf ("Marked current location: %s\n",desc); Con_Printf ("Marked current location: %s\n",desc);
} }
@ -227,7 +226,7 @@ locs_mark (char *filename, vec3_t loc, char *desc)
*/ */
void void
locs_edit (char *filename, vec3_t loc, char *desc) locs_edit (vec3_t loc, char *desc)
{ {
int i; int i;
if (locations_count) { if (locations_count) {
@ -242,13 +241,12 @@ locs_edit (char *filename, vec3_t loc, char *desc)
Con_Printf ("Changing location description to %s\n", Con_Printf ("Changing location description to %s\n",
locations[i]->name); locations[i]->name);
} }
locs_save (filename);
} else } else
Con_Printf ("Error: No location markers to modify!\n"); Con_Printf ("Error: No location markers to modify!\n");
} }
void void
locs_del (char *filename, vec3_t loc) locs_del (vec3_t loc)
{ {
int i; int i;
if (locations_count) { if (locations_count) {
@ -261,7 +259,6 @@ locs_del (char *filename, vec3_t loc)
for (; i < locations_count; i++) for (; i < locations_count; i++)
locations[i] = locations[i+1]; locations[i] = locations[i+1];
locations[locations_count] = NULL; locations[locations_count] = NULL;
locs_save(filename);
} else } else
Con_Printf ("Error: No location markers to remove\n"); Con_Printf ("Error: No location markers to remove\n");
} }

View file

@ -381,28 +381,28 @@ locs_loc (void)
if (stricmp(Cmd_Argv(1),"add") == 0) { if (stricmp(Cmd_Argv(1),"add") == 0) {
if (Cmd_Argc () >= 3) if (Cmd_Argc () >= 3)
locs_mark(locfile,cl.simorg,desc); locs_mark(cl.simorg,desc);
else else
Con_Printf("loc add <description> :marks the current location with the description and records the information into a loc file.\n"); Con_Printf("loc add <description> :marks the current location with the description and records the information into a loc file.\n");
} }
if (stricmp(Cmd_Argv(1),"rename") == 0) { if (stricmp(Cmd_Argv(1),"rename") == 0) {
if (Cmd_Argc () >= 3) if (Cmd_Argc () >= 3)
locs_edit(locfile,cl.simorg,desc); locs_edit(cl.simorg,desc);
else else
Con_Printf("loc rename <description> :changes the description of the nearest location marker\n"); Con_Printf("loc rename <description> :changes the description of the nearest location marker\n");
} }
if (stricmp(Cmd_Argv(1),"delete") == 0) { if (stricmp(Cmd_Argv(1),"delete") == 0) {
if (Cmd_Argc () == 2) if (Cmd_Argc () == 2)
locs_del(locfile,cl.simorg); locs_del(cl.simorg);
else else
Con_Printf("loc delete :removes nearest location marker\n"); Con_Printf("loc delete :removes nearest location marker\n");
} }
if (stricmp(Cmd_Argv(1),"move") == 0) { if (stricmp(Cmd_Argv(1),"move") == 0) {
if (Cmd_Argc () == 2) if (Cmd_Argc () == 2)
locs_edit(locfile,cl.simorg,NULL); locs_edit(cl.simorg,NULL);
else else
Con_Printf("loc move :moves the nearest location marker to your current location\n"); Con_Printf("loc move :moves the nearest location marker to your current location\n");
} }