Commit Graph

3751 Commits

Author SHA1 Message Date
gregorycu 5c3546e459 Speed up saving of profiling data by 27x
On Windows Release x64 bit build this changes:

ProfilerGraph::put
1.68% -> 0.061%

ProfilerGraph::draw
12% -> 17.%

So yes, there is a tradeoff between saving profiling data
(executed always) and drawing the profiler graph (executed very rarely).
But usually you don't have the profiler graph open.
2015-11-02 13:25:21 +01:00
est31 eabfe091b5 Rename and move basicmacros.h to util/basic_macros.h 2015-11-02 04:57:55 +01:00
Kahrl 8f49358153 Print --videomodes response to standard output, too 2015-11-02 02:46:36 +01:00
Perttu Ahola 3285bf73b9 Print direct command line responses to standard output instead of using the log system
Using logging for these just makes them bloated and hard to read and overally just not neat at all.
2015-11-02 00:11:20 +02:00
kwolekr 52e5b513ed Fix Lua scripting synchronization
For several years now, the lua script lock has been completely broken.
This commit fixes the main issue (creation of a temporary rather than
scoped object), and fixes a subsequent deadlock issue caused by
nested script API calls by adding support for recursive mutexes.
2015-11-01 11:32:05 -05:00
kwolekr d198e420ec Fix Noise compiled under clang >= 3.7.x with -O2 or higher
When compiled with optimizations, the most recent versions of clang seem
to 'optimize' out a crucial "and %reg, 0x7FFFFFFF" instruction in noise2d(),
probably because it somehow assumed the variable n would never become greater
than that amount.
Indeed, signed integer underflow is undefined behavior in C and C++, so while
this optimization is "correct" in that sense, it breaks lots of existing code.
Solved by changing n to an unsigned type, making behavior well-defined.
2015-11-01 11:16:18 -05:00
ShadowNinja 9269a0ecc7 Fix server crashing on Lua errors
Previously, the server called FATAL_ERROR when a Lua error occured.
This caused a (mostly useless) core dump.
The server now simply throws an exception, which is caught and printed before
exiting with a non-zero return value.
This also fixes a number of instances where errors were logged multiple times.
2015-10-31 13:28:58 -04:00
ShadowNinja b872df6ef6 Fix clang warning 2015-10-31 13:28:58 -04:00
kwolekr fdede60034 Fix C++11 compatibility 2015-10-31 02:38:23 -04:00
Duane Robertson b6dfae0221 WoW-style Autorun
This allows the player to toggle continuous forward with a key (F by default),
so we don't have to hold down the forward key endlessly.
2015-10-29 21:48:57 +01:00
paramat c0a7c670a4 findSpawnPos: Add setting for max height above water level
Increase default from 6 to 16 to help with mgv7 and mgfractal
Large-scale or alternative mapgens can result in a lowland spawn point not
being found, causing a spawn at (0, 0, 0) possibly buried underground
The max height is now settable to allow correct player spawn
in any mapgen or when using custom noise parameters
2015-10-29 20:03:15 +00:00
paramat 182b3fd283 Mgfractal: Add filler depth noise 2015-10-29 20:02:57 +00:00
kwolekr 688556a5d1 Add STATIC_ASSERT() macro and use it 2015-10-27 22:27:32 -04:00
kwolekr c56d7fe0eb Add DISABLE_CLASS_COPY macro (and use it)
Use this macro to disallow copying of an object using the assignment
operator or copy constructor.  This catches otherwise silent-but-deadly
mistakes such as "ServerMap map = env->getMap();" at compile time.

If so desired, it is still possible to copy a class, but it now requires
an explicit call to memcpy or std::copy.
2015-10-27 22:05:08 -04:00
est31 ca8e56c15a Environment: Time of day fixes and add serverside getter
-> Put access to time variables under the time lock.
-> Merge both time locks, there is no point to have two locks.
-> Fix the lock being released too early in Environment::setTimeOfDay
-> Add serverside getter so that you don't have to get
	the environment if you only have the server
2015-10-27 23:19:17 +01:00
PilzAdam c406438b95 Fix missing #include 2015-10-27 15:55:34 +01:00
kwolekr 27eed1389b Move basic, non-numeric macros from util/numeric.h to basicmacros.h 2015-10-27 01:53:45 -04:00
BlockMen 8a6e921cb8 Fix jittering sounds on entities (fixes #2974) 2015-10-26 19:40:26 +01:00
BlockMen 2c25107c31 Fix typo 2015-10-26 15:14:22 +01:00
kwolekr bc0318d2fc SAPI: Fix seed parameter truncation for LuaPseudoRandom constructor
Also fix a potential seed truncation issue on platforms where the
range of ptrdiff_t (the underlying type of lua_Integer) is too small.
2015-10-26 04:04:52 -04:00
kwolekr 306b067091 SAPI: Move core.get_us_time() to Util module 2015-10-26 03:46:36 -04:00
est31 5f342aa015 Remove some abort() calls
abort() doesn't benefit from the high level abstractions from FATAL_ERROR.
2015-10-26 04:45:00 +01:00
kwolekr d69ef6acd3 SAPI: Throw runtime error instead of if l_get_mapgen_object called in incorrect thread 2015-10-25 23:15:57 -04:00
kwolekr 54f1267c2c SAPI: Mark all Lua API functions requiring envlock 2015-10-25 23:06:48 -04:00
est31 3936a5e3f7 Correct comment in l_util.cpp
Remove outdated loglevel list from a l_util.cpp comment,
and rather point to the updated code.
2015-10-26 00:32:48 +01:00
BlockMen 50ba7e114d Add option to disable backface culling for models
- Disabled by default (except players)
- Fixes #2984
2015-10-25 12:06:08 +01:00
PilzAdam 6907c3e40a Escape " in generated settings_translation_file.cpp 2015-10-25 10:56:58 +01:00
est31 1f76808e4f Fix out of bounds vector write in Logger::addOutput(ILogOutput *out)
Previously, the invocation of Logger::addOutput(ILogOutput *out) led to
an out of bounds write of the m_outputs vector, resulting in the
m_silenced_levels array being modified.

Fortunately, the only caller of that method was android system logging,
and only since a few commits ago.
2015-10-25 00:13:01 +02:00
paramat e2fc8f7dda Mgfractal: Independent iterations and scale parameters
Complete set of parameters for each of mandelbrot and julia sets
The julia set structure often needs different iterations and scale
2015-10-24 21:18:40 +01:00
est31 2f19abd704 Small logging refactor and additional options
-> Get rid of Logger::logToSystem and use normal downstream output system for android instead

-> Give the downstream output system more information: enrich the log function of ILogOutput
	with information and add ICombinedLogOutput for easier use.

-> Make Logger::getLevelLabel() static and public so that it can be used by downstream log output.

-> Add g_ and m_ prefixes where required
2015-10-24 19:59:39 +02:00
PilzAdam 6f2d9de769 Improve Lua settings menu
* Add key settings to setting table and ignore them later
  This way they are added to the auto-generated minetest.conf.example
* Add flags type
* Add input validation for int, float and flags
* Break in-game graphic settings into multiple sections
* Parse settingtpes.txt in mods and games
* Improve description for a lot of settings
* Fix typos and wording in settingtypes.txt
* Convert language setting to an enum
2015-10-24 19:39:15 +02:00
kwolekr 2d207afe8e Fix compilation under MSVC and remove unnecessary conditional function prototype
Thanks to SmallJoker for pointing this out.
2015-10-24 13:34:49 -04:00
BlockMen 127b9aed09 Fix on_rightclick() being called directly after placing node
fixes https://github.com/minetest/minetest_game/issues/537
2015-10-24 12:18:57 +02:00
cheapie 380e1504eb Improve rollback database indexing
Index more columns in the action table of the rollback DB to improve the performance of /rollback_check
2015-10-24 08:45:38 +02:00
est31 f9eb31f317 Flush rollback log more often
Flushes the buffer of rollback actions that wait to get saved in two more situations:

1. Flushes in the destructor of the rollback. This makes the server not
forget the last < 500 rollback entries when it shuts down.

2. Flushes the rollback when /rollback_check is invoked. This is neccessary
as otherwise it leads to confusion if users want to test the rollback functionality
by placing a node and then executing the check on it, or if the actions were
very recent out of other reasons.
2015-10-24 08:45:13 +02:00
kwolekr 964be640cb Fix some threading things and add additional thread unittests
- Fix thread name reset on start()
- Fully reset thread state on kill()
- Add unittests to check for correct object states under various circumstances
2015-10-24 02:31:23 -04:00
paramat 59fa117d13 Decoration API: Add flag for placement on liquid surface
Add findLiquidSurface() function to mapgen.cpp
Update lua_api.txt
2015-10-23 21:30:20 +01:00
Jun Zhang df80b1ae5a init_log_streams: check if log_filename is empty.
Fixes #3262.
2015-10-19 12:14:05 +02:00
paramat 3b9f99e0d6 ABMs: Make catch-up behaviour optional
Default is true for backwards compatibility
Update lua_api.txt
2015-10-18 16:42:59 +01:00
Kahrl 2364449d7a Settings tab: double click opens/closes trees 2015-10-18 11:03:59 +02:00
Kahrl ba9d7215ec Settings tab: don't autoscroll when toggling "Show technical names" 2015-10-18 10:42:44 +02:00
est31 6b0cae5a9d Remove wstrgettext
Everywhere where wstrgettext was used, its output was converted back
to utf8. As wstrgettext internally converts the return value
from utf8 to wstring, it has been a waste. Remove the function, and
use strgettext instead.
2015-10-18 02:29:06 +02:00
Kahrl c4d1862344 Fix GUITable selection issues with trees
- setOpenedTrees(): this internal function was calling setSelected()
  to update m_selected. Since setSelected() calls autoScroll(),
  this caused the scrollbar to scroll back to the selected row
  in some cases when that shouldn't be done.

  For example, clicking the "+" to open a tree caused autoscroll.

  Fix this by making setOpenedTrees() modify m_selected directly.

- setDynamicData(): set scrollbar position after calling
  setSelected(), not before. This avoids setSelected()'s autoscroll
  messing up the scrollbar position again.

- setSelected(): If an invisible row is selected, open all parents
  of the selected row in order to make the selected row visible.

  This fixes the issue where all the trees are closed again whenever
  you return from the setting edit dialog to the settings tab.
2015-10-17 23:57:28 +02:00
PilzAdam 006ef5b4a5 New settings tab contain all possible settings
Settings are automatically parsed from builtin/settingtypes.txt
The edit dialog automatically adjust based on the type of setting
2015-10-17 22:06:29 +02:00
Rui 06e5d0f5c5 Fix == to = 2015-10-17 17:20:58 +01:00
kwolekr 6ba9d6545d Fix missing include on AIX 2015-10-17 01:16:17 -04:00
kwolekr 765a834cd0 Refactor Thread class to improve readability and portability
- Fix some incompatibilities with obscure platforms (AIX and WinCE)
- Clean up Thread class interface
- Add m_ prefix to private member variables
- Simplify platform-dependent logic, reducing preprocessor
  conditional clauses and improving readibility
- Add Thread class documentation
2015-10-16 23:43:29 -04:00
kwolekr 6be74d17df Refactor thread utility interface
- Add "thr_" prefix to thread utility functions
- Compare threadid_ts in a portable manner, where possible
2015-10-16 22:20:24 -04:00
est31 836486a98e Fix crash regression when invsize formspec gets used
The invsize formspec element is outdated. Even though,
it is still supported, only a deprecation warning is shown,
introduced by commit [1]. The lua context passed to the
log_deprecated method added by commit [1] is NULL for the
invsize deprecation warning, as its run on the client and not
the server.

Commit [1] has removed checks for NULL inside the log_deprecated
method, resulting in a crash when a formspec with an invsize
element is parsed. This commit puts the check back.

Fixes #3260.

Referenced commits:

[1]: b5acec0a3c "Add proper lua api deprecated handling"

[2]: 7b8d372947 "Use warningstream for deprecated field messages and refactor log_deprecated"
2015-10-17 01:29:05 +02:00
est31 b600bc30a9 Fix enforcing of nametag hiding
Commit

d2ca662569 "Enforce hiding nametag"

didn't fix the issue for "client" instances, where the nametag update
was received before the object was added to the scene. This resulted
in the grey shadow on the nametag that commit tried to fix.

Thanks to @neoascetic for pointing out that there still is a shadow.
2015-10-15 23:46:03 +02:00