version 0.7
[zeRace] / zeRace.c
index b371de4..9277dd3 100644 (file)
--- a/zeRace.c
+++ b/zeRace.c
@@ -1,5 +1,5 @@
 /*
- * zeRace 0.6, a funny retro racing game
+ * zeRace 0.7, a funny retro racing game
  * http://royale.zerezo.com/zerace/
  * 
  * Copyright (C) 2004  Antoine Jacquet <royale@zerezo.com>
@@ -69,7 +69,8 @@ struct _config
   int color;
   SDLKey boss;
   int bynight;
-} config = {"anonymous","",0,0,1,SDLK_UP,SDLK_DOWN,SDLK_LEFT,SDLK_RIGHT,6,SDLK_b,0};
+  int internet;
+} config = {"anonymous","",0,0,1,SDLK_UP,SDLK_DOWN,SDLK_LEFT,SDLK_RIGHT,6,SDLK_b,0,1};
 
 /* full script for a lap */
 struct _record
@@ -142,6 +143,8 @@ void zeRace_check_version()
   char response[1024],*tmp,*version;
   int len,result;
   
+  if (!config.internet) return;
+  
   printf("checking version... ");
   fflush(stdout);
 
@@ -198,6 +201,8 @@ void zeRace_update_tracks()
   int len,result;
   FILE *fic;
   
+  if (!config.internet) return;
+  
   printf("checking version and updating tracks... ");
   fflush(stdout);
 
@@ -249,6 +254,8 @@ void zeRace_download_file(char *file)
   FILE *fic;
   struct stat buf;
 
+  if (!config.internet) return;
+  
   if (stat(file,&buf)<0)
   {
     printf("downloading file \"%s\" : ",file);
@@ -440,6 +447,8 @@ void zeRace_send_time(struct _record *record)
   char *msg9="&bkeys=";
   int len,result;
   
+  if (!config.internet) return;
+  
   /* if the best time is small enought to save all keys, send it */
   if (record->time>=MAXRECORDKEYS) return;
 
@@ -1295,6 +1304,8 @@ void zeRace_internet()
   int active=0;
   #define INTERNET_OPTIONS 11
   
+  if (!config.internet) return;
+  
   printf("dowloading list of servers... ");
   fflush(stdout);
 
@@ -1398,7 +1409,7 @@ void zeRace_config()
 {
   SDL_Event event;
   int active=0;
-  #define CONFIG_OPTIONS 13
+  #define CONFIG_OPTIONS 14
   
   void update()
   {
@@ -1432,6 +1443,8 @@ void zeRace_config()
     print(screen,40+10*strlen("Boss key : "),HEIGHT/(CONFIG_OPTIONS+4)*13,config.boss?SDL_GetKeyName(config.boss):"<press key>");
     print(screen,40,HEIGHT/(CONFIG_OPTIONS+4)*14,"By night : ");
     print(screen,40+10*strlen("By night : "),HEIGHT/(CONFIG_OPTIONS+4)*14,config.bynight?"Yes":"No");
+    print(screen,40,HEIGHT/(CONFIG_OPTIONS+4)*15,"Internet : ");
+    print(screen,40+10*strlen("Internet : "),HEIGHT/(CONFIG_OPTIONS+4)*15,config.internet?"Yes":"No");
     print(screen,40,HEIGHT/(CONFIG_OPTIONS+4)*(CONFIG_OPTIONS+2),"Back to main menu");
     SDL_Flip(screen);
   }
@@ -1486,7 +1499,8 @@ void zeRace_config()
                   break;
                 case 10: config.boss=0; update(); config.boss=read_key(); break;
                 case 11: config.bynight=!config.bynight; break;
-                case 12:
+                case 12: config.internet=!config.internet; break;
+                case 13:
                   return;
               }
               update();