#include "config.h"
#include "constants.h"
#include "porting.h"
+#include "util/string.h"
void set_default_settings(Settings *settings)
{
// Client and server
-
+ settings->setDefault("language", "");
settings->setDefault("name", "");
+ settings->setDefault("bind_address", "");
+ settings->setDefault("serverlist_url", "servers.minetest.net");
- // Client stuff
+ // Client
+ settings->setDefault("address", "");
+ settings->setDefault("enable_sound", "true");
+ settings->setDefault("sound_volume", "0.8");
+ settings->setDefault("enable_mesh_cache", "false");
+ settings->setDefault("enable_vbo", "true");
+ settings->setDefault("free_move", "false");
+ settings->setDefault("fast_move", "false");
+ settings->setDefault("noclip", "false");
+ settings->setDefault("screenshot_path", ".");
+ settings->setDefault("screenshot_format", "png");
+ settings->setDefault("screenshot_quality", "0");
+ settings->setDefault("client_unload_unused_data_timeout", "600");
+ settings->setDefault("client_mapblock_limit", "5000");
+ settings->setDefault("enable_build_where_you_stand", "false" );
+ settings->setDefault("send_pre_v25_init", "false");
+ settings->setDefault("curl_timeout", "5000");
+ settings->setDefault("curl_parallel_limit", "8");
+ settings->setDefault("curl_file_download_timeout", "300000");
+ settings->setDefault("curl_verify_cert", "true");
+ settings->setDefault("enable_remote_media_server", "true");
+
+ // Keymap
settings->setDefault("remote_port", "30000");
settings->setDefault("keymap_forward", "KEY_KEY_W");
settings->setDefault("keymap_autorun", "");
settings->setDefault("keymap_fastmove", "KEY_KEY_J");
settings->setDefault("keymap_noclip", "KEY_KEY_H");
settings->setDefault("keymap_cinematic", "");
- settings->setDefault("keymap_screenshot", "KEY_F12");
settings->setDefault("keymap_toggle_hud", "KEY_F1");
settings->setDefault("keymap_toggle_chat", "KEY_F2");
settings->setDefault("keymap_toggle_force_fog_off", "KEY_F3");
- settings->setDefault("keymap_toggle_update_camera",
#if DEBUG
- "KEY_F4");
+ settings->setDefault("keymap_toggle_update_camera", "KEY_F4");
#else
- "");
+ settings->setDefault("keymap_toggle_update_camera", "");
#endif
settings->setDefault("keymap_toggle_debug", "KEY_F5");
settings->setDefault("keymap_toggle_profiler", "KEY_F6");
settings->setDefault("keymap_camera_mode", "KEY_F7");
+ settings->setDefault("keymap_screenshot", "KEY_F12");
settings->setDefault("keymap_increase_viewing_range_min", "+");
settings->setDefault("keymap_decrease_viewing_range_min", "-");
- settings->setDefault("enable_build_where_you_stand", "false" );
- settings->setDefault("3d_mode", "none");
- settings->setDefault("3d_paralax_strength", "0.025");
- settings->setDefault("aux1_descends", "false");
- settings->setDefault("doubletap_jump", "false");
- settings->setDefault("always_fly_fast", "true");
- settings->setDefault("directional_colored_fog", "true");
- settings->setDefault("tooltip_show_delay", "400");
- settings->setDefault("zoom_fov", "15");
-
// Some (temporary) keys for debugging
settings->setDefault("keymap_print_debug_stacks", "KEY_KEY_P");
settings->setDefault("keymap_quicktune_prev", "KEY_HOME");
settings->setDefault("keymap_quicktune_dec", "KEY_NEXT");
settings->setDefault("keymap_quicktune_inc", "KEY_PRIOR");
- // Show debug info by default?
- #ifdef NDEBUG
+ // Visuals
+#ifdef NDEBUG
settings->setDefault("show_debug", "false");
- #else
+#else
settings->setDefault("show_debug", "true");
- #endif
-
+#endif
+ settings->setDefault("fsaa", "0");
+ settings->setDefault("enable_fog", "true");
+ settings->setDefault("fog_start", "0.4");
+ settings->setDefault("3d_mode", "none");
+ settings->setDefault("3d_paralax_strength", "0.025");
+ settings->setDefault("tooltip_show_delay", "400");
+ settings->setDefault("zoom_fov", "15");
settings->setDefault("fps_max", "60");
settings->setDefault("pause_fps_max", "20");
settings->setDefault("viewing_range", "100");
- settings->setDefault("map_generation_limit", "31000");
settings->setDefault("screenW", "800");
settings->setDefault("screenH", "600");
settings->setDefault("fullscreen", "false");
settings->setDefault("fullscreen_bpp", "24");
- settings->setDefault("fsaa", "0");
settings->setDefault("vsync", "false");
- settings->setDefault("address", "");
- settings->setDefault("random_input", "false");
- settings->setDefault("client_unload_unused_data_timeout", "600");
- settings->setDefault("client_mapblock_limit", "5000");
- settings->setDefault("enable_fog", "true");
- settings->setDefault("fog_start", "0.4");
settings->setDefault("fov", "72");
- settings->setDefault("view_bobbing", "true");
settings->setDefault("leaves_style", "fancy");
settings->setDefault("connected_glass", "false");
settings->setDefault("smooth_lighting", "true");
settings->setDefault("texture_path", "");
settings->setDefault("shader_path", "");
settings->setDefault("video_driver", "opengl");
- settings->setDefault("free_move", "false");
- settings->setDefault("noclip", "false");
- settings->setDefault("continuous_forward", "false");
- settings->setDefault("enable_joysticks", "false");
- settings->setDefault("repeat_joystick_button_time", "0.17");
- settings->setDefault("joystick_frustum_sensitivity", "170");
settings->setDefault("cinematic", "false");
settings->setDefault("camera_smoothing", "0");
settings->setDefault("cinematic_camera_smoothing", "0.7");
- settings->setDefault("fast_move", "false");
- settings->setDefault("invert_mouse", "false");
settings->setDefault("enable_clouds", "true");
- settings->setDefault("screenshot_path", ".");
- settings->setDefault("screenshot_format", "png");
- settings->setDefault("screenshot_quality", "0");
settings->setDefault("view_bobbing_amount", "1.0");
settings->setDefault("fall_bobbing_amount", "0.0");
settings->setDefault("enable_3d_clouds", "true");
settings->setDefault("console_alpha", "200");
settings->setDefault("selectionbox_color", "(0,0,0)");
settings->setDefault("selectionbox_width", "2");
- settings->setDefault("inventory_items_animations", "false");
settings->setDefault("node_highlighting", "box");
settings->setDefault("crosshair_color", "(255,255,255)");
settings->setDefault("crosshair_alpha", "255");
settings->setDefault("gui_scaling", "1.0");
settings->setDefault("gui_scaling_filter", "false");
settings->setDefault("gui_scaling_filter_txr2img", "true");
- settings->setDefault("mouse_sensitivity", "0.2");
- settings->setDefault("enable_sound", "true");
- settings->setDefault("sound_volume", "0.8");
settings->setDefault("desynchronize_mapblock_texture_animation", "true");
settings->setDefault("hud_hotbar_max_width", "1.0");
settings->setDefault("enable_local_map_saving", "false");
settings->setDefault("show_entity_selectionbox", "true");
+ settings->setDefault("texture_clean_transparent", "false");
+ settings->setDefault("texture_min_size", "64");
+ settings->setDefault("ambient_occlusion_gamma", "2.2");
+ settings->setDefault("enable_shaders", "true");
+ settings->setDefault("enable_particles", "true");
+
+ settings->setDefault("enable_minimap", "true");
+ settings->setDefault("minimap_shape_round", "true");
+ settings->setDefault("minimap_double_scan_height", "true");
+ // Effects
+ settings->setDefault("directional_colored_fog", "true");
+ settings->setDefault("view_bobbing", "true");
+ settings->setDefault("inventory_items_animations", "false");
settings->setDefault("mip_map", "false");
settings->setDefault("anisotropic_filter", "false");
settings->setDefault("bilinear_filter", "false");
settings->setDefault("trilinear_filter", "false");
- settings->setDefault("texture_clean_transparent", "false");
- settings->setDefault("texture_min_size", "64");
settings->setDefault("tone_mapping", "false");
settings->setDefault("enable_bumpmapping", "false");
settings->setDefault("enable_parallax_occlusion", "false");
settings->setDefault("water_wave_speed", "5.0");
settings->setDefault("enable_waving_leaves", "false");
settings->setDefault("enable_waving_plants", "false");
- settings->setDefault("ambient_occlusion_gamma", "2.2");
- settings->setDefault("enable_shaders", "true");
- settings->setDefault("repeat_rightclick_time", "0.25");
- settings->setDefault("enable_particles", "true");
- settings->setDefault("enable_mesh_cache", "false");
- settings->setDefault("enable_vbo", "true");
-
- settings->setDefault("enable_minimap", "true");
- settings->setDefault("minimap_shape_round", "true");
- settings->setDefault("minimap_double_scan_height", "true");
- settings->setDefault("send_pre_v25_init", "false");
-
- settings->setDefault("curl_timeout", "5000");
- settings->setDefault("curl_parallel_limit", "8");
- settings->setDefault("curl_file_download_timeout", "300000");
- settings->setDefault("curl_verify_cert", "true");
- settings->setDefault("enable_remote_media_server", "true");
+ // Input
+ settings->setDefault("invert_mouse", "false");
+ settings->setDefault("mouse_sensitivity", "0.2");
+ settings->setDefault("repeat_rightclick_time", "0.25");
+ settings->setDefault("random_input", "false");
+ settings->setDefault("aux1_descends", "false");
+ settings->setDefault("doubletap_jump", "false");
+ settings->setDefault("always_fly_fast", "true");
+ settings->setDefault("continuous_forward", "false");
+ settings->setDefault("enable_joysticks", "false");
+ settings->setDefault("repeat_joystick_button_time", "0.17");
+ settings->setDefault("joystick_frustum_sensitivity", "170");
- settings->setDefault("serverlist_url", "servers.minetest.net");
+ // Main menu
+ settings->setDefault("main_menu_path", "");
+ settings->setDefault("main_menu_mod_mgr", "1");
+ settings->setDefault("main_menu_game_mgr", "0");
+ settings->setDefault("modstore_download_url", "https://forum.minetest.net/media/");
+ settings->setDefault("modstore_listmods_url", "https://forum.minetest.net/mmdb/mods/");
+ settings->setDefault("modstore_details_url", "https://forum.minetest.net/mmdb/mod/*/");
settings->setDefault("serverlist_file", "favoriteservers.txt");
- settings->setDefault("server_announce", "false");
- settings->setDefault("server_url", "");
- settings->setDefault("server_address", "");
- settings->setDefault("server_name", "");
- settings->setDefault("server_description", "");
-
- settings->setDefault("disable_escape_sequences", "false");
#if USE_FREETYPE
settings->setDefault("freetype", "true");
settings->setDefault("fallback_font_shadow", "1");
settings->setDefault("fallback_font_shadow_alpha", "128");
- std::stringstream fontsize;
- fontsize << TTF_DEFAULT_FONT_SIZE;
+ std::string font_size_str = std::to_string(TTF_DEFAULT_FONT_SIZE);
- settings->setDefault("font_size", fontsize.str());
- settings->setDefault("mono_font_size", fontsize.str());
- settings->setDefault("fallback_font_size", fontsize.str());
+ settings->setDefault("fallback_font_size", font_size_str);
#else
settings->setDefault("freetype", "false");
settings->setDefault("font_path", porting::getDataPath("fonts" DIR_DELIM "lucida_sans"));
settings->setDefault("mono_font_path", porting::getDataPath("fonts" DIR_DELIM "mono_dejavu_sans"));
- std::stringstream fontsize;
- fontsize << DEFAULT_FONT_SIZE;
-
- settings->setDefault("font_size", fontsize.str());
- settings->setDefault("mono_font_size", fontsize.str());
+ std::string font_size_str = to_string(DEFAULT_FONT_SIZE);
#endif
+ settings->setDefault("font_size", font_size_str);
+ settings->setDefault("mono_font_size", font_size_str);
+
+
+ // Server
+ settings->setDefault("disable_escape_sequences", "false");
- // Server stuff
- // "map-dir" doesn't exist by default.
+ // Network
+ settings->setDefault("enable_ipv6", "true");
+ settings->setDefault("ipv6_server", "false");
settings->setDefault("workaround_window_size","5");
settings->setDefault("max_packets_per_iteration","1024");
settings->setDefault("port", "30000");
- settings->setDefault("bind_address", "");
+ settings->setDefault("strict_protocol_version_checking", "false");
+ settings->setDefault("player_transfer_distance", "0");
+ settings->setDefault("max_simultaneous_block_sends_per_client", "10");
+ settings->setDefault("max_simultaneous_block_sends_server_total", "40");
+ settings->setDefault("time_send_interval", "5");
+
settings->setDefault("default_game", "minetest");
settings->setDefault("motd", "");
settings->setDefault("max_users", "15");
- settings->setDefault("strict_protocol_version_checking", "false");
settings->setDefault("creative_mode", "false");
settings->setDefault("enable_damage", "true");
- settings->setDefault("fixed_map_seed", "");
settings->setDefault("give_initial_stuff", "false");
settings->setDefault("default_password", "");
settings->setDefault("default_privs", "interact, shout");
- settings->setDefault("player_transfer_distance", "0");
settings->setDefault("enable_pvp", "true");
settings->setDefault("disallow_empty_password", "false");
settings->setDefault("disable_anticheat", "false");
settings->setDefault("ask_reconnect_on_crash", "false");
settings->setDefault("profiler_print_interval", "0");
- settings->setDefault("enable_mapgen_debug_info", "false");
settings->setDefault("active_object_send_range_blocks", "3");
settings->setDefault("active_block_range", "3");
//settings->setDefault("max_simultaneous_block_sends_per_client", "1");
// This causes frametime jitter on client side, or does it?
- settings->setDefault("max_simultaneous_block_sends_per_client", "10");
- settings->setDefault("max_simultaneous_block_sends_server_total", "40");
settings->setDefault("max_block_send_distance", "9");
- settings->setDefault("max_block_generate_distance", "7");
settings->setDefault("block_send_optimize_distance", "4");
settings->setDefault("max_clearobjects_extra_loaded_blocks", "4096");
- settings->setDefault("time_send_interval", "5");
settings->setDefault("time_speed", "72");
settings->setDefault("server_unload_unused_data_timeout", "29");
settings->setDefault("max_objects_per_block", "64");
settings->setDefault("secure.trusted_mods", "");
settings->setDefault("secure.http_mods", "");
- // physics stuff
+ // Physics
settings->setDefault("movement_acceleration_default", "3");
settings->setDefault("movement_acceleration_air", "2");
settings->setDefault("movement_acceleration_fast", "10");
settings->setDefault("movement_liquid_sink", "10");
settings->setDefault("movement_gravity", "9.81");
- //liquid stuff
+ // Liquids
settings->setDefault("liquid_loop_max", "100000");
settings->setDefault("liquid_queue_purge_time", "0");
settings->setDefault("liquid_update", "1.0");
- //mapgen stuff
+ // Mapgen
settings->setDefault("mg_name", "v7");
settings->setDefault("water_level", "1");
settings->setDefault("chunksize", "5");
settings->setDefault("mg_flags", "dungeons");
+ settings->setDefault("fixed_map_seed", "");
+ settings->setDefault("map_generation_limit", "31000");
+ settings->setDefault("max_block_generate_distance", "7");
+ settings->setDefault("enable_mapgen_debug_info", "false");
- // IPv6
- settings->setDefault("enable_ipv6", "true");
- settings->setDefault("ipv6_server", "false");
-
- settings->setDefault("main_menu_path", "");
- settings->setDefault("main_menu_mod_mgr", "1");
- settings->setDefault("main_menu_game_mgr", "0");
- settings->setDefault("modstore_download_url", "https://forum.minetest.net/media/");
- settings->setDefault("modstore_listmods_url", "https://forum.minetest.net/mmdb/mods/");
- settings->setDefault("modstore_details_url", "https://forum.minetest.net/mmdb/mod/*/");
+ // Server list announcing
+ settings->setDefault("server_announce", "false");
+ settings->setDefault("server_url", "");
+ settings->setDefault("server_address", "");
+ settings->setDefault("server_name", "");
+ settings->setDefault("server_description", "");
settings->setDefault("high_precision_fpu", "true");
- settings->setDefault("language", "");
-
#ifdef __ANDROID__
settings->setDefault("screenW", "0");
settings->setDefault("screenH", "0");
settings->setDefault("viewing_range", "25");
settings->setDefault("inventory_image_hack", "false");
- //check for device with small screen
+ // Check for a device with a small screen
float x_inches = ((double) porting::getDisplaySize().X /
(160 * porting::getDisplayDensity()));
if (x_inches < 3.5) {
settings->setDefault("hud_scaling", "0.6");
- }
- else if (x_inches < 4.5) {
+ } else if (x_inches < 4.5) {
settings->setDefault("hud_scaling", "0.7");
}
settings->setDefault("curl_verify_cert","false");
void override_default_settings(Settings *settings, Settings *from)
{
std::vector<std::string> names = from->getNames();
- for(size_t i=0; i<names.size(); i++){
+ for (size_t i = 0; i < names.size(); i++) {
const std::string &name = names[i];
settings->setDefault(name, from->get(name));
}