]> git.jsancho.org Git - lugaru.git/blobdiff - Source/GameTick.cpp
optimizing LoadLevel(int which)
[lugaru.git] / Source / GameTick.cpp
index d5ddeb41c1145626da341555137d53462c034cec..4aead8d5b959ea169e0828e75fc82e2e23af1d1f 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"
@@ -495,7 +496,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;
@@ -1405,14 +1406,14 @@ void Game::Loadlevel(int which){
        stealthloading=0;
        whichlevel=which;
 
-       if (which == -1) {
+       if(which == -1){
            tutoriallevel = -1;
            Loadlevel("tutorial");
-       } else if (which >= 0 && which <= 15) {
+       }else if(which >= 0 && which <= 15){
            char buf[32];
            snprintf(buf, 32, "map%d", which + 1);
            Loadlevel(buf);
-       } else
+       }else
            Loadlevel("mapsave");
 }