blenderplayer commandline argument fixes (for -f and -w)
authorDalai Felinto <dfelinto@gmail.com>
Mon, 13 Sep 2010 04:52:20 +0000 (04:52 +0000)
committerDalai Felinto <dfelinto@gmail.com>
Mon, 13 Sep 2010 04:52:20 +0000 (04:52 +0000)
argc always include the filename, therefore all the optional parameters should check for < argc instead of <=argc.

E.g. That was causing "blenderplayer -f 800 600 myfile.blend" to play in a wrong  Bpp (since it was trying to parse the filename to fullScreenBpp).

Bug introduced on rev. 16448 (in 2.49) and merged to 2.5 in rev. 19323

source/gameengine/GamePlayer/ghost/GPG_ghost.cpp

index 9cdee2a340c88268b85927706973f37535530150..5981855b6f78bf44c275c54178b0bbbca422863c 100644 (file)
@@ -479,14 +479,14 @@ int main(int argc, char** argv)
                                i++;
                                fullScreen = true;
                                fullScreenParFound = true;
-                               if ((i + 2) <= argc && argv[i][0] != '-' && argv[i+1][0] != '-')
+                               if ((i + 2) < argc && argv[i][0] != '-' && argv[i+1][0] != '-')
                                {
                                        fullScreenWidth = atoi(argv[i++]);
                                        fullScreenHeight = atoi(argv[i++]);
-                                       if ((i + 1) <= argc && argv[i][0] != '-')
+                                       if ((i + 1) < argc && argv[i][0] != '-')
                                        {
                                                fullScreenBpp = atoi(argv[i++]);
-                                               if ((i + 1) <= argc && argv[i][0] != '-')
+                                               if ((i + 1) < argc && argv[i][0] != '-')
                                                        fullScreenFrequency = atoi(argv[i++]);
                                        }
                                }
@@ -497,11 +497,11 @@ int main(int argc, char** argv)
                                fullScreen = false;
                                windowParFound = true;
 
-                               if ((i + 2) <= argc && argv[i][0] != '-' && argv[i+1][0] != '-')
+                               if ((i + 2) < argc && argv[i][0] != '-' && argv[i+1][0] != '-')
                                {
                                        windowWidth = atoi(argv[i++]);
                                        windowHeight = atoi(argv[i++]);
-                                       if ((i +2) <= argc && argv[i][0] != '-' && argv[i+1][0] != '-')
+                                       if ((i + 2) < argc && argv[i][0] != '-' && argv[i+1][0] != '-')
                                        {
                                                windowLeft = atoi(argv[i++]);
                                                windowTop = atoi(argv[i++]);