From: Gwyn Ciesla Date: Thu, 16 Jun 2011 13:38:03 +0000 (-0500) Subject: Silenced last compiler warnings. X-Git-Tag: 1.06 X-Git-Url: http://git.pulsar-zone.net/?a=commitdiff_plain;h=37583dd819cd25e25660c2aa92f584c0cacde8f5;p=curblaster.git Silenced last compiler warnings. 1.06. --- diff --git a/main.cpp b/main.cpp index b7dd5b3..3ff7e23 100644 --- 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;}; diff --git a/mishaps.cpp b/mishaps.cpp index 8e0a818..e11d1b7 100644 --- a/mishaps.cpp +++ b/mishaps.cpp @@ -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){