#include "profiler.h"
#include "log.h"
#include "mods.h"
+#if USE_FREETYPE
+#include "xCGUITTFont.h"
+#endif
#include "util/string.h"
#include "subgame.h"
#include "quicktune.h"
+#include "serverlist.h"
/*
Settings.
log_register_thread("main");
- // Set locale. This is for forcing '.' as the decimal point.
- std::locale::global(std::locale("C"));
- // This enables printing all characters in bitmap font
- setlocale(LC_CTYPE, "en_US");
+ // This enables internatonal characters input
+ if( setlocale(LC_ALL, "") == NULL )
+ {
+ fprintf( stderr, "%s: warning: could not set default locale\n", argv[0] );
+ }
+ // Set locale. This is for forcing '.' as the decimal point.
+ try {
+ std::locale::global(std::locale(std::locale(""), "C", std::locale::numeric));
+ setlocale(LC_NUMERIC, "C");
+ } catch (const std::exception& ex) {
+ errorstream<<"Could not set numeric locale to C"<<std::endl;
+ }
/*
Parse command line
*/
// Create user data directory
fs::CreateDir(porting::path_user);
- init_gettext((porting::path_share+DIR_DELIM+".."+DIR_DELIM+"locale").c_str());
+ init_gettext((porting::path_share + DIR_DELIM + "locale").c_str());
// Initialize debug streams
#define DEBUGFILE "debug.txt"
#else
bool run_dedicated_server = cmd_args.getFlag("server");
#endif
+ g_settings->set("server_dedicated", run_dedicated_server ? "true" : "false");
if(run_dedicated_server)
{
DSTACK("Dedicated server branch");
guienv = device->getGUIEnvironment();
gui::IGUISkin* skin = guienv->getSkin();
+ #if USE_FREETYPE
+ std::string font_path = g_settings->get("font_path");
+ u16 font_size = g_settings->getU16("font_size");
+ gui::IGUIFont *font = gui::CGUITTFont::createTTFont(guienv, font_path.c_str(), font_size);
+ #else
gui::IGUIFont* font = guienv->getFont(getTexturePath("fontlucida.png").c_str());
+ #endif
if(font)
skin->setFont(font);
else
skin->setColor(gui::EGDC_3D_SHADOW, video::SColor(255,0,0,0));
skin->setColor(gui::EGDC_HIGH_LIGHT, video::SColor(255,70,100,50));
skin->setColor(gui::EGDC_HIGH_LIGHT_TEXT, video::SColor(255,255,255,255));
-
+
+#if (IRRLICHT_VERSION_MAJOR >= 1 && IRRLICHT_VERSION_MINOR >= 8) || IRRLICHT_VERSION_MAJOR >= 2
+ // Irrlicht 1.8 input colours
+ skin->setColor(gui::EGDC_EDITABLE, video::SColor(255,128,128,128));
+ skin->setColor(gui::EGDC_FOCUSED_EDITABLE, video::SColor(255,96,134,49));
+#endif
+
/*
GUI stuff
*/
menudata.anisotropic_filter = g_settings->getBool("anisotropic_filter");
menudata.bilinear_filter = g_settings->getBool("bilinear_filter");
menudata.trilinear_filter = g_settings->getBool("trilinear_filter");
+ menudata.enable_shaders = g_settings->getS32("enable_shaders");
+ menudata.preload_item_visuals = g_settings->getBool("preload_item_visuals");
+ menudata.enable_particles = g_settings->getBool("enable_particles");
driver->setTextureCreationFlag(video::ETCF_CREATE_MIP_MAPS, menudata.mip_map);
menudata.creative_mode = g_settings->getBool("creative_mode");
menudata.enable_damage = g_settings->getBool("enable_damage");
g_settings->set("bilinear_filter", itos(menudata.bilinear_filter));
g_settings->set("trilinear_filter", itos(menudata.trilinear_filter));
+ g_settings->setS32("enable_shaders", menudata.enable_shaders);
+ g_settings->set("preload_item_visuals", itos(menudata.preload_item_visuals));
+ g_settings->set("enable_particles", itos(menudata.enable_particles));
+
g_settings->set("creative_mode", itos(menudata.creative_mode));
g_settings->set("enable_damage", itos(menudata.enable_damage));
+ g_settings->set("server_announce", itos(menudata.enable_public));
g_settings->set("name", playername);
g_settings->set("address", address);
g_settings->set("port", itos(port));
if(menudata.selected_world != -1)
g_settings->set("selected_world_path",
worldspecs[menudata.selected_world].path);
-
+
// Break out of menu-game loop to shut down cleanly
if(device->run() == false || kill == true)
break;
current_address = "";
current_port = 30011;
}
+ else if (address != "")
+ {
+ ServerListSpec server;
+ server["name"] = menudata.servername;
+ server["address"] = wide_to_narrow(menudata.address);
+ server["port"] = wide_to_narrow(menudata.port);
+ server["description"] = menudata.serverdescription;
+ ServerList::insert(server);
+ }
// Set world path to selected one
if(menudata.selected_world != -1){