]> git.jsancho.org Git - lugaru.git/blobdiff - Source/GameTick.cpp
fixed menu clicks carrying over
[lugaru.git] / Source / GameTick.cpp
index 7e231e0a03f508604dec7a56b2936c002da850e2..a47edc9d765065e911bae8ee0b04ca6262d07d65 100644 (file)
@@ -27,6 +27,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include <direct.h>
 #endif
 
+#include <limits>
 #include <ctime>
 #include "Game.h"
 #include "openal_wrapper.h"
@@ -106,7 +107,6 @@ extern bool texttoggle;
 extern bool alwaysblur;
 extern float gamespeed;
 extern bool decals;
-extern bool vblsync;
 extern bool immediate;
 extern bool velocityblur;
 extern float tintr,tintg,tintb;
@@ -432,7 +432,7 @@ static void ch_size(Game *game, const char *args)
 static int find_closest()
 {
   int closest = 0;
-  float closestdist = 1.0/0.0;
+  float closestdist = std::numeric_limits<float>::max();
 
   for (int i = 1; i < numplayers; i++) {
     float distance;
@@ -2372,7 +2372,7 @@ void      Game::Tick()
                                }
                        }
                }
-               if(mainmenu==3){
+               else if(mainmenu==3){
                        if(Input::Button()&&!oldbutton&&selected!=-1){
                                fireSound();
                        }
@@ -2508,7 +2508,7 @@ void      Game::Tick()
                                if(mainmenu==3&&!gameon)mainmenu=1;
                        }
                }
-               if(mainmenu==4){
+               else if(mainmenu==4){
                        if(Input::Button()&&!oldbutton&&selected!=-1&&!waiting){
                                fireSound();
                                if(selected<9&&keyselect==-1)
@@ -2530,7 +2530,7 @@ void      Game::Tick()
                        }
                }
 
-               if(mainmenu==5){
+               else if(mainmenu==5){
 
                        if(endgame==2){
                                accountactive->endGame();
@@ -2639,7 +2639,7 @@ void      Game::Tick()
                                mainmenu=5;
                        }
                }
-               if(mainmenu==10){
+               else if(mainmenu==10){
                        endgame=2;
                        if(Input::Button()&&!oldbutton&&selected==3){
                                fireSound();
@@ -2650,7 +2650,7 @@ void      Game::Tick()
                        }
                }
 
-               if(mainmenu==6){
+               else if(mainmenu==6){
                        if(Input::Button()&&!oldbutton) {
                                if(selected>-1){
                                        fireSound();
@@ -2665,7 +2665,7 @@ void      Game::Tick()
                                }
                        }
                }
-               if(mainmenu==7){
+               else if(mainmenu==7){
                        if(Input::Button()&&!oldbutton) {
                                if(selected!=-1){
                                        fireSound();
@@ -2690,7 +2690,7 @@ void      Game::Tick()
                                }
                        }
                }
-               if(mainmenu==8){
+               else if(mainmenu==8){
                        if(Input::Button()&&!oldbutton&&selected>-1){
                                fireSound();
 
@@ -2703,7 +2703,7 @@ void      Game::Tick()
 
                        }
                }
-               if (mainmenu==18) {                     
+               else if (mainmenu==18) {                        
                        if(Input::Button()&&!oldbutton&&selected==0) {
                                newstereomode = (StereoMode)(newstereomode + 1);
                                while(!CanInitStereo(newstereomode)) {