[CF-Devel] 'maps' command update

crossfire-devel-admin at archives.real-time.com crossfire-devel-admin at archives.real-time.com
Fri Sep 12 10:56:40 CDT 2003


I made a change to the maps command to accept an optional paramater.  When
going through the list, it uses strstr() to see if the parameter is a
substring in the map path, and only displays it if it is.

So issuing 'maps' works like it does now.
Issuing 'maps itan' would list the Titan Quest maps if they are active.

On servers like Metalforge where there may be hundreds of maps active, this
makes it easy to check to see when a given quest will be ready.

The changes are in server/c_misc.c (and a change in include/sproto.h to reflect
the function change).

Relevant excerpts from:
	 cvs diff -u -r 1.34 -r 1.35 c_misc.c

-void map_info(object *op) {
+void map_info(object *op, char *search) {

@@ -48,6 +48,7 @@
   new_draw_info(NDI_UNIQUE, 0,op,"Path               Pl PlM IM   TO Dif Reset");
   for(m=first_map;m!=NULL;m=m->next) {
 
+    if ( search && strstr(m->path,search)==NULL ) continue; /* Skip unwanted maps */
     /* Print out the last 18 characters of the map name... */
     if (strlen(m->path)<=18) strcpy(map_path, m->path);
     else strcpy(map_path, m->path + strlen(m->path) - 18);

  int command_maps (object *op, char *params)
 {
-    map_info(op);
+    map_info(op,params);
     return 1;
   }


--PC

_______________________________________________
crossfire-devel mailing list
     
     crossfire-devel at lists.real-time.com
     
     
     https://mailman.real-time.com/mailman/listinfo/crossfire-devel
     
     
    


More information about the crossfire mailing list