]> git.lizzy.rs Git - minetest.git/blobdiff - src/main.cpp
Fix selectionbox not honoring anaglyph mode 3d distortion
[minetest.git] / src / main.cpp
index f495a6ba253f5780e6953b9de3552d1a469f3e91..940580b7a067d563093232733b380bb7c858eec7 100644 (file)
@@ -84,6 +84,7 @@ with this program; if not, write to the Free Software Foundation, Inc.,
 */
 Settings main_settings;
 Settings *g_settings = &main_settings;
+std::string g_settings_path;
 
 // Global profiler
 Profiler main_profiler;
@@ -243,7 +244,7 @@ class MyEventReceiver : public IEventReceiver
                */
                if(noMenuActive() == false)
                {
-                       return false;
+                       return g_menumgr.preprocessEvent(event);
                }
 
                // Remember whether each key is down or up
@@ -913,7 +914,7 @@ int main(int argc, char *argv[])
        */
        
        // Path of configuration file in use
-       std::string configpath = "";
+       g_settings_path = "";
        
        if(cmd_args.exists("config"))
        {
@@ -924,7 +925,7 @@ int main(int argc, char *argv[])
                                        <<cmd_args.get("config")<<"\""<<std::endl;
                        return 1;
                }
-               configpath = cmd_args.get("config");
+               g_settings_path = cmd_args.get("config");
        }
        else
        {
@@ -946,14 +947,14 @@ int main(int argc, char *argv[])
                        bool r = g_settings->readConfigFile(filenames[i].c_str());
                        if(r)
                        {
-                               configpath = filenames[i];
+                               g_settings_path = filenames[i];
                                break;
                        }
                }
                
                // If no path found, use the first one (menu creates the file)
-               if(configpath == "")
-                       configpath = filenames[0];
+               if(g_settings_path == "")
+                       g_settings_path = filenames[0];
        }
        
        // Initialize debug streams
@@ -1193,7 +1194,7 @@ int main(int argc, char *argv[])
                verbosestream<<_("Using gameid")<<" ["<<gamespec.id<<"]"<<std::endl;
 
                // Create server
-               Server server(world_path, configpath, gamespec, false);
+               Server server(world_path, gamespec, false);
                server.start(port);
                
                // Run server
@@ -1287,6 +1288,7 @@ int main(int argc, char *argv[])
                params.Stencilbuffer = false;
                params.Vsync         = vsync;
                params.EventReceiver = &receiver;
+               params.HighPrecisionFPU = g_settings->getBool("high_precision_fpu");
 
                nulldevice = createDeviceEx(params);
 
@@ -1339,6 +1341,7 @@ int main(int argc, char *argv[])
        params.Stencilbuffer = false;
        params.Vsync         = vsync;
        params.EventReceiver = &receiver;
+       params.HighPrecisionFPU = g_settings->getBool("high_precision_fpu");
 
        device = createDeviceEx(params);
 
@@ -1518,7 +1521,6 @@ int main(int argc, char *argv[])
                                
                                // Initialize menu data
                                MainMenuData menudata;
-                               menudata.kill = kill;
                                menudata.address = address;
                                menudata.name = playername;
                                menudata.port = itos(port);
@@ -1564,13 +1566,16 @@ int main(int argc, char *argv[])
                                        }
                                        infostream<<"Waited for other menus"<<std::endl;
 
-                                       GUIEngine* temp = new GUIEngine(device, guiroot, &g_menumgr,smgr,&menudata);
+                                       GUIEngine* temp = new GUIEngine(device, guiroot, &g_menumgr,smgr,&menudata,kill);
                                        
                                        delete temp;
                                        //once finished you'll never end up here
                                        smgr->clear();
-                                       kill = menudata.kill;
+                               }
 
+                               if(menudata.errormessage != ""){
+                                       error_message = narrow_to_wide(menudata.errormessage);
+                                       continue;
                                }
 
                                //update worldspecs (necessary as new world may have been created)
@@ -1675,7 +1680,10 @@ int main(int argc, char *argv[])
 
                        // Break out of menu-game loop to shut down cleanly
                        if(device->run() == false || kill == true) {
-                               g_settings->updateConfigFile(configpath.c_str());
+                               if(g_settings_path != "") {
+                                       g_settings->updateConfigFile(
+                                               g_settings_path.c_str());
+                               }
                                break;
                        }
 
@@ -1694,7 +1702,6 @@ int main(int argc, char *argv[])
                                current_address,
                                current_port,
                                error_message,
-                               configpath,
                                chat_backend,
                                gamespec,
                                simple_singleplayer_mode
@@ -1749,8 +1756,8 @@ int main(int argc, char *argv[])
 #endif // !SERVER
        
        // Update configuration file
-       if(configpath != "")
-               g_settings->updateConfigFile(configpath.c_str());
+       if(g_settings_path != "")
+               g_settings->updateConfigFile(g_settings_path.c_str());
        
        // Print modified quicktune values
        {