netpanzer-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netPanzer-CVS] netpanzer/src/NetPanzer/Interfaces GameManager.cpp


From: Matthias Braun
Subject: [netPanzer-CVS] netpanzer/src/NetPanzer/Interfaces GameManager.cpp
Date: Sat, 06 Sep 2003 13:46:15 -0400

CVSROOT:        /cvsroot/netpanzer
Module name:    netpanzer
Branch:         
Changes by:     Matthias Braun <address@hidden> 03/09/06 13:46:15

Modified files:
        src/NetPanzer/Interfaces: GameManager.cpp 

Log message:
        reverted gets->fgets change: fgets isn't a 100% replacement for gets, 
because it doesn't remove the trailing newline

Patches:
Index: netpanzer/src/NetPanzer/Interfaces/GameManager.cpp
diff -u netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.16 
netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.17
--- netpanzer/src/NetPanzer/Interfaces/GameManager.cpp:1.16     Sat Sep  6 
13:15:34 2003
+++ netpanzer/src/NetPanzer/Interfaces/GameManager.cpp  Sat Sep  6 13:46:15 2003
@@ -1042,16 +1042,18 @@
                initializeInputDevices();
                initializeDedicatedConsole();
        } catch(Exception e) {
-#ifdef WIN32
-               MessageBox(gapp.hwndApp, e.getMessage(), "Netpanzer", MB_OK);
-#else
                fprintf(stderr, "Initialisation failed:\n%s\n", e.getMessage());
-#endif                                                                         
        
                dedicatedShutdown();
                return false;
        }
-    
-       launchDedicatedServer();
+   
+       try {
+               launchDedicatedServer();
+       } catch(Exception e) {
+               fprintf(stderr, "Serverlaunch failed :\n%s\n", e.getMessage());
+               dedicatedShutdown();
+               return false;
+       }
        return true;
 }
 
@@ -1690,13 +1692,13 @@
   
   printf( "Map Name <%s> : ", GameConfig::getGameMapName() );
   fflush(stdout);
-  fgets(input_str, sizeof(input_str), stdin);
+  gets(input_str);
   if ( strlen(input_str) > 0 )
-   {  GameConfig::setGameMapName( input_str ); } 
+  {  GameConfig::setGameMapName( input_str ); }
 
   printf( "Players <%d> : ", GameConfig::GetNumberPlayers() );
   fflush(stdout);
-  fgets(input_str, sizeof(input_str), stdin);
+  gets(input_str);
   if ( strlen(input_str) > 0 )
    { 
     short players; 
@@ -1706,7 +1708,7 @@
 
   printf( "Units <%d> : ", GameConfig::GetNumberUnits() );
   fflush(stdout);
-  fgets(input_str, sizeof(input_str), stdin);
+  gets(input_str);
   if ( strlen(input_str) > 0 )
    { 
     short units; 
@@ -1724,7 +1726,7 @@
    printf( "(3) Time Limit \n" );
    printf( "Choose : " );
    fflush(stdout);
-   fgets(input_str, sizeof(input_str), stdin);
+   gets(input_str);
    sscanf( input_str, "%d", &game_type ); 
   } while( (game_type < 1) && (game_type > 3) );
  
@@ -1735,7 +1737,7 @@
       GameConfig::SetGameType(_gametype_objective);
       printf( "Outpost Occupation <%.0f %%> : ", 
GameConfig::getObjectiveOccuapationPercentage() );
       fflush(stdout);
-      fgets(input_str, sizeof(input_str), stdin);
+      gets(input_str);
       if ( strlen(input_str) > 0 )
        { 
         float percent; 
@@ -1749,7 +1751,7 @@
       GameConfig::SetGameType(_gametype_fraglimit);
       printf( "Frag Limit <%d> frags : ", GameConfig::GetFragLimit() );
       fflush(stdout);
-      fgets(input_str, sizeof(input_str), stdin);
+      gets(input_str);
       if ( strlen(input_str) > 0 )
        { 
         int frags; 
@@ -1763,7 +1765,7 @@
       GameConfig::SetGameType(_gametype_timelimit);
       printf( "Time Limit <%d> minutes: ", GameConfig::GetTimeLimit() );
       fflush(stdout);
-      fgets(input_str, sizeof(input_str), stdin);
+      gets(input_str);
       if ( strlen(input_str) > 0 )
        { 
         int time_limit; 
@@ -1776,13 +1778,13 @@
     
   printf( "PowerUps <NO> (Y/N) : " );
   fflush(stdout);
-  fgets(input_str, sizeof(input_str), stdin);
+  gets(input_str);
   if ( strcasecmp( "y", input_str ) == 0 )
    { GameConfig::setPowerUpState(true); }
 
   printf( "Server Name <Dedicated Server> :" );
   fflush(stdout);
-  fgets(input_str, sizeof(input_str), stdin);
+  gets(input_str);
   if ( strlen(input_str) > 0 )
    { GameConfig::SetPlayerName( input_str ); }
   else




reply via email to

[Prev in Thread] Current Thread [Next in Thread]