Silenced last compiler warnings. 1.06
authorGwyn Ciesla <limb@jcomserv.net>
Thu, 16 Jun 2011 13:38:03 +0000 (08:38 -0500)
committerGwyn Ciesla <limb@jcomserv.net>
Thu, 16 Jun 2011 13:38:03 +0000 (08:38 -0500)
1.06.

main.cpp
mishaps.cpp

index b7dd5b3..3ff7e23 100644 (file)
--- a/main.cpp
+++ b/main.cpp
@@ -48,7 +48,7 @@ const int landershotmax = 10;
 const int landermax = 12;
 const int crawlermax = 6;
 const int missilemax = 3;
-const float version = 1.05;
+const float version = 1.06;
 
 int score;
 int lives;
@@ -533,8 +533,9 @@ int main(int argc, char *argv[]){
   
   if(FILE *scorefile = fopen(home, "r")){
     char workchara[6];
-    fgets(workchara, 6, scorefile);
-    hscore = atoi(workchara);
+    if(fgets(workchara, 6, scorefile) != NULL){
+      hscore = atoi(workchara);
+    };
     fclose(scorefile);
   } else {
     FILE *scorefile = fopen(home, "w");
@@ -1646,7 +1647,7 @@ int main(int argc, char *argv[]){
          //Smart bomb
          if(smartbombs<=3){smartbombs++;};
          //regen landers
-          int landerlimit;
+          int landerlimit = 0;
           if(level<=4){landerlimit=8;};
           if(level>4&&level<=12){landerlimit=6;};
           if(level>12&&level<=16){landerlimit=8;};
@@ -1659,7 +1660,7 @@ int main(int argc, char *argv[]){
            };
          };
          //regen crawlers
-         int crawlerlimit;
+         int crawlerlimit = 0;
           if(level<=8){crawlerlimit=2;};
           if(level>8&&level<=16){crawlerlimit=4;};
           if(level>16){crawlerlimit=6;};                    
index 8e0a818..e11d1b7 100644 (file)
@@ -87,8 +87,9 @@ void life_loss(int lives, int score){
     
     FILE *scorefile = fopen(home, "r");
     char workchara[6];
-    fgets(workchara, 6, scorefile);
-    hscore = atoi(workchara);
+    if(fgets(workchara, 6, scorefile) != NULL){
+      hscore = atoi(workchara);
+    };
     fclose(scorefile);
     
     if(score>hscore){