aboutsummaryrefslogtreecommitdiff
path: root/src/settings.h
Commit message (Collapse)AuthorAge
* Fix various performance issues reported by cppcheck (#5628)Loïc Blot2017-04-21
| | | * Also remove 1 non declared but defined functions
* Some performance optimizations (#5424)Loïc Blot2017-03-22
| | | | | | | | | | | | | | | | | | | * Some performance optimizations This is globally removing some memory useless copy * use a const ref return on std::string Settings::get to prevent data copy on getters which doesn't need to copy it * pass some stack created strings to static const as they are not modified anywhere * Camera: return nametags per const ref instead of a list pointer, we only need to read it * INodeDefManager: getAll should be a result ref writer instead of a return copy * INodeDefManager: getAlias should return a const std::string ref * Minimap: unroll a Scolor creation in blitMinimapPixersToImageRadar to prvent many variable construct/destruct which are unneeded (we rewrite the content in the loop) * CNodeDefManager::updateAliases: prevent a idef getall copy * Profiler: constness * rollback_interface: create real_name later, and use const ref * MapBlockMesh updateFastFaceRow: unroll TileSpec next_tile, which has a cost of 1.8% CPU due to variable allocation/destruction, * MapBlockMesh updateFastFaceRow: copy next_tile to tile only if it's a different tilespec * MapBlockMesh updateFastFaceRow: use memcpy to copy next_lights to lights to do it in a single cpu operation
* Replace various std::map with UNORDERED_MAP + various cleanupsLoic Blot2016-10-05
| | | | | | | | | | | | This is part 2 for 5f084cd98d7b3326b51320455364337539710efd Other improvements: * Use the defined ItemGroupList when used * make Client::checkPrivilege const * inline some trivial functions * Add ActiveObjectMap typedef * Add SettingsEntries typedef
* Make some maps unordered to improve performanceLoic Blot2016-10-05
| | | | | | * This permit to improve performance on C++11 builds * use some existing typedefs in tools maps * minor code style changes
* Settings: Clean up settings changed callback codekwolekr2016-06-11
|
* Clean up threadingShadowNinja2015-08-23
| | | | | | | | | | | | | | | | | | | | * Rename everything. * Strip J prefix. * Change UpperCamelCase functions to lowerCamelCase. * Remove global (!) semaphore count mutex on OSX. * Remove semaphore count getter (unused, unsafe, depended on internal API functions on Windows, and used a hack on OSX). * Add `Atomic<type>`. * Make `Thread` handle thread names. * Add support for C++11 multi-threading. * Combine pthread and win32 sources. * Remove `ThreadStarted` (unused, unneeded). * Move some includes from the headers to the sources. * Move all of `Event` into its header (allows inlining with no new includes). * Make `Event` use `Semaphore` (except on Windows). * Move some porting functions into `Thread`. * Integrate logging with `Thread`. * Add threading test.
* Settings: pass name to callbacks by referenceest312015-07-09
| | | | Spare some copies.
* Move globals from main.cpp to more sane locationsCraig Robbins2015-04-01
| | | | | | | | | | | | Move debug streams to log.cpp|h Move GUI-related globals to clientlauncher Move g_settings and g_settings_path to settings.cpp|h Move g_menuclouds to clouds.cpp|h Move g_profiler to profiler.cpp|h
* Fix game minetest.conf default settingsest312015-03-18
| | | | This was a regression introduced by f6e4c5d9cf459e8278a76a2beaee59732e841458 .
* Settings fixes Make the GameGlobalShaderConstantSetter use the settings ↵gregorycu2015-01-25
| | | | callback (8% perf improvement in game loop) Ensure variable is set Ensure settings callback is threadsafe
* Revert "Make the GameGlobalShaderConstantSetter use the settings callback ↵Craig Robbins2015-01-25
| | | | | | (8% perf improvement in game loop)" This reverts commit a555e2d9b0ccee452996381a44677b8bec210036.
* Make the GameGlobalShaderConstantSetter use the settings callback (8% perf ↵gregorycu2015-01-23
| | | | | | improvement in game loop) Amend the settings callback to support userdata
* Settings: Fail on invalid sequence and throw exception for LuaSettingskwolekr2014-12-12
|
* Settings: Sanitize value for multiline terminator tokenskwolekr2014-12-11
|
* Settings: Sanitize setting name everywhere, not just LuaSettingskwolekr2014-12-09
|
* Settings: Make setting entry group and values mutually exclusivekwolekr2014-12-09
| | | | | This greatly reduces the complexity of Settings code. Additionally, several memory leaks were fixed.
* Settings: Various setting group fixes and enhancementskwolekr2014-12-04
| | | | | | | | - Remove blank setting values when setting has a group - Pair setting values with groups in file when possible - Preserve user-set whitespace in setting objects - Delete setting value when setting NoiseParams group - Delete overwritten groups outside of lock
* Use setting groups for NoiseParamskwolekr2014-12-02
| | | | | | Add format example to minetest.conf.example Add Settings::setU16() Throw exception on attempted access of NULL settings groups
* LuaSettings: Sanitize setting name stringskwolekr2014-11-30
|
* settings: Add setting groups and multiline entrieskwolekr2014-11-30
|
* Implement proper font handlingsapier2014-11-30
|
* Split settings into seperate source and header filesShadowNinja2014-09-21
| | | | This also cleans up settings a bit
* Fix Settings lockingShadowNinja2014-09-21
|
* Use const references for Settings methodsShadowNinja2014-09-21
| | | | Also check for (this == &other) before locking mutexes.
* Make getters of the Settings class constCraig Robbins2014-09-21
| | | | Also removed 2 unused functions.
* Bunch of small fixes (coding style, very unlikely errors, warning messages)sapier2014-04-19
|
* Add minetest.set_noiseparam_defaults() Lua APIkwolekr2014-02-15
|
* Make flag strings clear specified flag with 'no' prefixkwolekr2014-02-08
| | | | | Remove flagmask field from set_mapgen_params table Add small bits of needed documentation
* Remove blank default values for emergequeue_limit_* settingskwolekr2014-02-05
| | | | | Add checks for invalid user input for important settings Rename Settings::tryGet* to Settings::get*NoEx for consistency
* Revert "Fix settings to honor numeric conversion errors"kwolekr2014-02-05
| | | | This reverts commit 3f376a092e1c16429fb52f24736e9da98aff4cd5.
* Fix settings to honor numeric conversion errorssapier2014-02-04
| | | | Rename try* non exceptioning functions to *NoEx
* Settings: Add no-exception variants of each get methodkwolekr2014-02-03
|
* Cleanup jthread and fix win32 buildsapier2013-12-01
|
* Always use builtin JThread librarykwolekr2013-09-15
|
* Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenuKahrl2013-08-14
|
* Dont write directly to files but rather write and copy a tmp filePilzAdam2013-08-13
|
* Remove no virtual dtor warnings, make MapgenParams contain actual NoiseParamskwolekr2013-05-19
|
* initial mapgen indev version with farscale feature and huge cavesproller2013-03-16
|
* Migrate to STL containers/algorithms.Ilya Zhuravlev2013-03-11
|
* Update Copyright YearsSfan52013-02-24
|
* Change Minetest-c55 to MinetestPilzAdam2013-02-24
|
* Add flag string settings, flat map optionkwolekr2013-02-06
|
* Make sure that settings are written to config file when settings are removed.Jürgen Doser2013-01-22
| | | | | Previously, settings where only written when a value has changed, and removal of a setting value didn't count as a change.
* Last set of minor cleanupskwolekr2013-01-21
|
* Finish and clean up mapgen configurationkwolekr2013-01-21
|
* Add Settings::getStruct and Settings::setStructkwolekr2013-01-21
|
* The new mapgen, noise functions, et al.kwolekr2013-01-21
|
* Basic support for configuring which mods to load for each worldJürgen Doser2013-01-21
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | settings.h: added function to return all keys used in settings, and a function to remove a setting mods.{h,cpp}: added class ModConfiguration that represents a subset of the installed mods. server.{h,cpp}: server does not load add-on mods that are disabled in the world.mt file. mods are disabled by a setting of the form "load_mod_<modname> = false". if no load_mod_<modname> = ... setting is found, the mod is loaded anyways for backwards compatibilty. server also complains to errorstream about mods with unstatisfied dependencies and about mods that are not installed. guiConfigureWorld.{h,cpp}: shows a treeview of installed add-on mods and modpacks with little icons in front of their name indicating their status: a checkmark for enabled mods, a cross for disabled mods, a question mark for "new" mods Mods can be enabled/disabled by a checkbox. Mods also show a list of dependencies and reverse dependencies. double-click on a mod in dependency or reverse dependency listbox selects the corresponding mod. Enabling a mod also enables all its dependencies. Disabling a mod also disables all its reverse dependencies. For modpacks, show buttons to enable/disable all mods (recursively, including their dependencies) in it. Button "Save" saves the current settings to the world.mt file and returns to the main menu. Button "Cancel" returns to main menu without saving. basic keyboard controls (if the proper widget has keyboard focus): up/down: scroll through tree of mods left/right: collaps/expand a modpack space: enable/disable the selected mod
* Optimize headersPerttu Ahola2012-06-17
|
* Properly and efficiently use split utility headersPerttu Ahola2012-06-17
|
wc">LuaAreaStore::l_reserve(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaAreaStore *o = checkobject(L, 1); AreaStore *ast = o->as; size_t count = luaL_checknumber(L, 2); ast->reserve(count); return 0; } // remove_area(id) int LuaAreaStore::l_remove_area(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaAreaStore *o = checkobject(L, 1); AreaStore *ast = o->as; u32 id = luaL_checknumber(L, 2); bool success = ast->removeArea(id); lua_pushboolean(L, success); return 1; } // set_cache_params(params) int LuaAreaStore::l_set_cache_params(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaAreaStore *o = checkobject(L, 1); AreaStore *ast = o->as; luaL_checktype(L, 2, LUA_TTABLE); bool enabled = getboolfield_default(L, 2, "enabled", true); u8 block_radius = getintfield_default(L, 2, "block_radius", 64); size_t limit = getintfield_default(L, 2, "block_radius", 1000); ast->setCacheParams(enabled, block_radius, limit); return 0; } // to_string() int LuaAreaStore::l_to_string(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaAreaStore *o = checkobject(L, 1); std::ostringstream os(std::ios_base::binary); o->as->serialize(os); std::string str = os.str(); lua_pushlstring(L, str.c_str(), str.length()); return 1; } // to_file(filename) int LuaAreaStore::l_to_file(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaAreaStore *o = checkobject(L, 1); AreaStore *ast = o->as; const char *filename = luaL_checkstring(L, 2); CHECK_SECURE_PATH_OPTIONAL(L, filename); std::ostringstream os(std::ios_base::binary); ast->serialize(os); lua_pushboolean(L, fs::safeWriteToFile(filename, os.str())); return 1; } // from_string(str) int LuaAreaStore::l_from_string(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaAreaStore *o = checkobject(L, 1); size_t len; const char *str = luaL_checklstring(L, 2, &len); std::istringstream is(std::string(str, len), std::ios::binary); return deserialization_helper(L, o->as, is); } // from_file(filename) int LuaAreaStore::l_from_file(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaAreaStore *o = checkobject(L, 1); const char *filename = luaL_checkstring(L, 2); CHECK_SECURE_PATH_OPTIONAL(L, filename); std::ifstream is(filename, std::ios::binary); return deserialization_helper(L, o->as, is); } LuaAreaStore::LuaAreaStore() { this->as = AreaStore::getOptimalImplementation(); } LuaAreaStore::LuaAreaStore(const std::string &type) { #if USE_SPATIAL if (type == "LibSpatial") { this->as = new SpatialAreaStore(); } else #endif { this->as = new VectorAreaStore(); } } LuaAreaStore::~LuaAreaStore() { delete as; } // LuaAreaStore() // Creates an LuaAreaStore and leaves it on top of stack int LuaAreaStore::create_object(lua_State *L) { NO_MAP_LOCK_REQUIRED; LuaAreaStore *o = (lua_isstring(L, 1)) ? new LuaAreaStore(lua_tostring(L, 1)) : new LuaAreaStore(); *(void **)(lua_newuserdata(L, sizeof(void *))) = o; luaL_getmetatable(L, className); lua_setmetatable(L, -2); return 1; } LuaAreaStore *LuaAreaStore::checkobject(lua_State *L, int narg) { NO_MAP_LOCK_REQUIRED; luaL_checktype(L, narg, LUA_TUSERDATA); void *ud = luaL_checkudata(L, narg, className); if (!ud) luaL_typerror(L, narg, className); return *(LuaAreaStore **)ud; // unbox pointer } void LuaAreaStore::Register(lua_State *L) { lua_newtable(L); int methodtable = lua_gettop(L); luaL_newmetatable(L, className); int metatable = lua_gettop(L); lua_pushliteral(L, "__metatable"); lua_pushvalue(L, methodtable); lua_settable(L, metatable); // hide metatable from Lua getmetatable() lua_pushliteral(L, "__index"); lua_pushvalue(L, methodtable); lua_settable(L, metatable); lua_pushliteral(L, "__gc"); lua_pushcfunction(L, gc_object); lua_settable(L, metatable); lua_pop(L, 1); // drop metatable luaL_openlib(L, 0, methods, 0); // fill methodtable lua_pop(L, 1); // drop methodtable // Can be created from Lua (AreaStore()) lua_register(L, className, create_object); } const char LuaAreaStore::className[] = "AreaStore"; const luaL_reg LuaAreaStore::methods[] = { luamethod(LuaAreaStore, get_area), luamethod(LuaAreaStore, get_areas_for_pos), luamethod(LuaAreaStore, get_areas_in_area), luamethod(LuaAreaStore, insert_area), luamethod(LuaAreaStore, reserve), luamethod(LuaAreaStore, remove_area), luamethod(LuaAreaStore, set_cache_params), luamethod(LuaAreaStore, to_string), luamethod(LuaAreaStore, to_file), luamethod(LuaAreaStore, from_string), luamethod(LuaAreaStore, from_file), {0,0} };