Commit Graph

67 Commits

Author SHA1 Message Date
Muhammad Rifqi Priyo Susanto 9526c68699 Fix issue Minetest crash when custom font path is not exist
We try to use default fallback for both mono and main font when custom font path is not exist. This way, if Minetest is not corrupted, we could avoid crash.
2017-11-08 16:14:00 +01:00
Loïc Blot 7528986e44 Code modernization: src/p*, src/q*, src/r*, src/s* (partial) (#6282)
* Code modernization: src/p*, src/q*, src/r*, src/s* (partial)

* empty function
* default constructor/destructor
* for range-based loops
* use emplace_back instead of push_back
* C++ STL header style
* Spelling: vertice -> vertex
2017-08-19 14:25:35 +02:00
Loïc Blot 921151d97a C++ modernize: Pragma once (#6264)
* Migrate cpp headers to pragma once
2017-08-17 22:19:39 +02:00
Loïc Blot 79f19b8369 [CSM] Add flavour limits controlled by server (#5930)
* [CSM] Add flavour limits controlled by server

Server send flavour limits to client permitting to disable or limit some Lua calls

* Add limits for reading nodedefs and itemdefs

* flavour: Add lookup node limits

* Merge get_node_or_nil into get_node.

Sending fake node doesn't make sense in CSM, just return nil if node is not available for any reason

* Add node range customization when noderange flavour is enabled (default 8 nodes)

* Limit nodes range & disable chat message sending by default

* Bump protocol version
2017-07-18 21:39:55 +02:00
Loïc Blot 1425c6def1 Cpp11 initializers: last src root changeset (#6022)
* Cpp11 initializers: last src root changeset

Finish to migrate all src root folder files to C++11 constructor initializers
2017-06-21 11:51:29 +02:00
Loïc Blot d4c0f91275 Use C++11 mutexes only (remove compat code) (#5922)
* Fix event LINT & remove default constructor/destructors
* remove compat code & modernize autolock header
2017-06-06 16:29:28 +02:00
Loïc Blot a98baef5e4 C++11 patchset 2: remove util/cpp11.h and util/cpp11_container.h (#5821) 2017-06-04 21:00:04 +02:00
Loïc Blot 370354cc87 Fix various performance issues reported by cppcheck (#5628)
* Also remove 1 non declared but defined functions
2017-04-21 10:06:08 +02:00
Loïc Blot 072bbba69a Some performance optimizations (#5424)
* 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
2017-03-22 21:41:02 +01:00
Loic Blot 613797a304 Replace various std::map with UNORDERED_MAP + various cleanups
This is part 2 for 5f084cd98d

Other improvements:

* Use the defined ItemGroupList when used
* make Client::checkPrivilege const
* inline some trivial functions
* Add ActiveObjectMap typedef
* Add SettingsEntries typedef
2016-10-05 10:53:19 +02:00
Loic Blot 5f084cd98d Make some maps unordered to improve performance
* This permit to improve performance on C++11 builds
* use some existing typedefs in tools maps
* minor code style changes
2016-10-05 07:30:32 +02:00
kwolekr 33b874fea3 Settings: Clean up settings changed callback code 2016-06-11 00:11:37 -04:00
ShadowNinja e4bff8be94 Clean up threading
* 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.
2015-08-23 22:04:06 -04:00
est31 cb8978fb1d Settings: pass name to callbacks by reference
Spare some copies.
2015-07-09 08:25:17 +02:00
Craig Robbins 9527984dbc Move globals from main.cpp to more sane locations
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
2015-04-01 23:04:25 +10:00
est31 538036d004 Fix game minetest.conf default settings
This was a regression introduced by f6e4c5d9cf .
2015-03-18 13:03:02 -04:00
gregorycu ed7c9c4cb8 Settings fixes Make the GameGlobalShaderConstantSetter use the settings callback (8% perf improvement in game loop) Ensure variable is set Ensure settings callback is threadsafe 2015-01-25 15:23:37 +10:00
Craig Robbins 2c4a5e1861 Revert "Make the GameGlobalShaderConstantSetter use the settings callback (8% perf improvement in game loop)"
This reverts commit a555e2d9b0.
2015-01-25 01:19:40 +10:00
gregorycu a555e2d9b0 Make the GameGlobalShaderConstantSetter use the settings callback (8% perf improvement in game loop)
Amend the settings callback to support userdata
2015-01-23 21:27:51 -05:00
kwolekr d3dc88fe6b Settings: Fail on invalid sequence and throw exception for LuaSettings 2014-12-12 00:44:17 -05:00
kwolekr b0c4fd6d3f Settings: Sanitize value for multiline terminator tokens 2014-12-11 23:26:13 -05:00
kwolekr 88c28414f4 Settings: Sanitize setting name everywhere, not just LuaSettings 2014-12-09 23:52:13 -05:00
kwolekr f2c18511a4 Settings: Make setting entry group and values mutually exclusive
This greatly reduces the complexity of Settings code.
Additionally, several memory leaks were fixed.
2014-12-09 23:29:34 -05:00
kwolekr f0cd59034c Settings: Various setting group fixes and enhancements
- 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
2014-12-04 03:20:07 -05:00
kwolekr 68c799bf99 Use setting groups for NoiseParams
Add format example to minetest.conf.example
Add Settings::setU16()
Throw exception on attempted access of NULL settings groups
2014-12-02 04:03:37 -05:00
kwolekr 360660947b LuaSettings: Sanitize setting name strings 2014-11-30 19:01:54 -05:00
kwolekr 175b7a28e5 settings: Add setting groups and multiline entries 2014-11-30 16:11:21 -05:00
sapier dceb9f7d60 Implement proper font handling 2014-11-30 17:50:09 +01:00
ShadowNinja 6bc4cad0ed Split settings into seperate source and header files
This also cleans up settings a bit
2014-09-21 14:39:35 -04:00
ShadowNinja 2ae5d3f3ab Fix Settings locking 2014-09-21 14:39:35 -04:00
ShadowNinja cd64a92a8c Use const references for Settings methods
Also check for (this == &other) before locking mutexes.
2014-09-21 14:39:35 -04:00
Craig Robbins b97c9c6577 Make getters of the Settings class const
Also removed 2 unused functions.
2014-09-21 14:39:35 -04:00
sapier eda9214f81 Bunch of small fixes (coding style, very unlikely errors, warning messages) 2014-04-19 11:56:19 +02:00
kwolekr 3570f3e396 Add minetest.set_noiseparam_defaults() Lua API 2014-02-15 19:13:14 -05:00
kwolekr 83bafbe08b Make flag strings clear specified flag with 'no' prefix
Remove flagmask field from set_mapgen_params table
Add small bits of needed documentation
2014-02-08 17:50:59 -05:00
kwolekr 7f743178db Remove blank default values for emergequeue_limit_* settings
Add checks for invalid user input for important settings
Rename Settings::tryGet* to Settings::get*NoEx for consistency
2014-02-05 00:17:53 -05:00
kwolekr c6c5edd73a Revert "Fix settings to honor numeric conversion errors"
This reverts commit 3f376a092e.
2014-02-05 00:05:58 -05:00
sapier 3f376a092e Fix settings to honor numeric conversion errors
Rename try* non exceptioning functions to *NoEx
2014-02-04 22:14:13 -05:00
kwolekr a439343844 Settings: Add no-exception variants of each get method 2014-02-03 22:47:40 -05:00
sapier 04e9a9d541 Cleanup jthread and fix win32 build 2013-12-01 16:25:46 +01:00
kwolekr d308352dbd Always use builtin JThread library 2013-09-15 23:00:01 -04:00
Kahrl 4e1f50035e Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenu 2013-08-14 21:03:33 +02:00
PilzAdam d718b0b34e Dont write directly to files but rather write and copy a tmp file 2013-08-13 22:05:45 +02:00
kwolekr 93474c4218 Remove no virtual dtor warnings, make MapgenParams contain actual NoiseParams 2013-05-19 12:22:20 -04:00
proller 165498cecf initial mapgen indev version with farscale feature and huge caves 2013-03-16 21:48:32 -04:00
Ilya Zhuravlev 6a1670dbc3 Migrate to STL containers/algorithms. 2013-03-11 19:08:39 -04:00
Sfan5 6d0ea26c2d Update Copyright Years 2013-02-24 20:15:24 +01:00
PilzAdam 497ff1ecd6 Change Minetest-c55 to Minetest 2013-02-24 18:49:03 +01:00
kwolekr 97260d09a8 Add flag string settings, flat map option 2013-02-06 16:52:48 -05:00
Jürgen Doser f099861245 Make sure that settings are written to config file when settings are removed.
Previously, settings where only written when a value has changed, and
removal of a setting value didn't count as a change.
2013-01-22 19:05:46 +01:00