Maybe another patch nobody will adds?

Anyway, this  Patch to add back pick of player names.  (Hit flag 
icon) in MP/skirmish. 

Notes, check physfs if corrects.  It works my end OK, should be OK ?



Index: src/multiint.c
===================================================================
--- src/multiint.c      (revision 1616)
+++ src/multiint.c      (working copy)
@@ -2137,8 +2137,9 @@
                widgDelete(psWScreen,MULTIOP_PLAYERS);
                widgDelete(psWScreen,FRONTEND_SIDETEXT2);                       
                // del text too,
 
-               strcpy(tmp,MultiPlayersPath);
-               strcat(tmp,"*.sta");
+//             strcpy(tmp,MultiPlayersPath);
+//             strcat(tmp,"*.sta");
+               strcpy(tmp,"multiplay\\");// just this directory needs for now.
                addMultiRequest(tmp,MULTIOP_PNAME,0,0);
                break;
 
Index: src/multimenu.c
===================================================================
--- src/multimenu.c     (revision 1616)
+++ src/multimenu.c     (working copy)
@@ -355,6 +355,12 @@
        UDWORD                  count;
        char                    ToFind[255];
 #endif
+       char ** filelist, ** file;              //add for get list of player 
names
+       size_t len;
+       char **path;
+       char newpath[512];
+
+
        char                    sTemp[64];
        static char             tips[NBTIPS][MAX_STR_SIZE];
 
@@ -364,30 +370,12 @@
        current_tech = mapCam;
        current_numplayers = numPlayers;
 
-#ifdef WIN32
-       if(GetCurrentDirectoryA(255,(char*)&ToFind) == 0) // What is this 
doing actually?
-       {
-               return;
-       }
-       strcat(ToFind,ToFindb);
+       path = PHYSFS_getSearchPath();          //I think this is corrects. 
Please
+       strcpy(newpath,*path);                          //check this stuff.
+       strcat(newpath,ToFindb);
+       PHYSFS_addToSearchPath(newpath,0);      // 0 or 1??
+       filelist = PHYSFS_enumerateFiles("players");    //this corrects?
 
-       // count buttons.
-       dir = FindFirstFileA(ToFind,&found);
-       if(dir != INVALID_HANDLE_VALUE)
-       {
-               while( TRUE )
-               {
-                       numButtons++;
-                       if(! FindNextFileA(dir,&found ) )
-                       {
-                               break;
-                       }
-               }
-       }
-       FindClose(dir);
-#endif
-
-
        if(mode == MULTIOP_MAP)                                                 
                // if its a map, also look in the 
predone stuff.
        {
                if(enumerateMultiMaps(tips[0],&players, TRUE,mapCam,numPlayers))
@@ -479,52 +467,23 @@
        sButInit.pUserData      = (void*)0;
        sButInit.pDisplay       = displayRequestOption;
        sButInit.FontID         = WFont;
-
-#ifdef WIN32
-       dir = FindFirstFileA(ToFind,&found);
-       if(dir != INVALID_HANDLE_VALUE)
+       count=0;
+       for ( file = filelist; *file != NULL; ++file )
        {
-               count=0;
-               while( count < (butPerForm*4)  )
-               {
-                       unsigned int tip_index = check_tip_index(sButInit.id-
M_REQUEST_BUT);
+               char filename[255];             //
+               unsigned int tip_index = check_tip_index(sButInit.id-
M_REQUEST_BUT);
 
-                       /* Set the tip and add the button */
-// use MALLOC, and do it dynamically
-                       found.cFileName[strlen(found.cFileName) -4 ] = '\0';    
                // chop 
extension
-                       strcpy(tips[tip_index],found.cFileName);                
//need to store one!
+               len = strlen( *file );
+               if(len <4) continue;    //for safety
 
+               if( count < (butPerForm*4)  )   //so we do not overload form?
+               {
+                       memcpy(filename,*file,len-4);
+                       filename[len-4]='\0';                           // chop 
extension
+                       strcpy(tips[tip_index],filename);       //need to store 
one!
+
                        sButInit.pTip           = tips[tip_index];
                        sButInit.pText          = tips[tip_index];
-
-                       if(mode == MULTIOP_MAP)                                 
                                                // if its a map, set player 
flag.
-                       {
-                               sButInit.pUserData      = (void*)( 
found.cFileName[0]-'0'  );
-
-//                             if(game.type == DMATCH)
-//                             {
-//                                     if( found.cFileName[1] != 'd')
-//                                     {
-//                                             goto nextone;
-//                                     }
-//                             }
-//                             else
-//                             {
-                                       if( found.cFileName[1] != 'c')
-                                       {
-                                               goto nextone;
-                                       }
-//                             }
-
-                               strcpy(sTemp,   strrchr(found.cFileName,'-')+1  
);              //chop off 
description
-
-                               // add number of players to string, choping of 
description
-                       //      sprintf(tips[sButInit.id-M_REQUEST_BUT], 
"%d)%s",
-                       //                                                      
                                sButInit.pUserData,
-                       //                                                      
                                sTemp  );
-                               sprintf(tips[tip_index], "%s", sTemp  );
-                       }
-
                        count++;
                        widgAddButton(psRScreen, &sButInit);
 
@@ -541,18 +500,12 @@
                                sButInit.y = 4;
                                sButInit.majorID += 1;
                        }
+               
+               }//end if count < (butPerForm*4
+       } //end for
+       PHYSFS_freeList( filelist );            //free our filelist.
 
- nextone:
 
-                       if(!FindNextFileA(dir,&found ) )        /* find next 
one*/
-                       {
-                               break;
-                       }
-               }
-       }
-       FindClose(dir);
-#endif
-
        if(mode == MULTIOP_MAP)
        {
                if(enumerateMultiMaps( sTemp,&players,TRUE,mapCam,numPlayers))

--
Click to find great rates on health insurance, save big, shop here
http://tagline.hushmail.com/fc/Ioyw6h4d8cVU1i1B1GikHCnBjI3UimevMbOanky7OaOR5EdW4C8ex4/



_______________________________________________
Warzone-dev mailing list
[email protected]
https://mail.gna.org/listinfo/warzone-dev

Reply via email to