Commit Graph

3951 Commits

Author SHA1 Message Date
paramat c26eb87aec Mgfractal: Add 3D and 4D fractals
3D Mandelbrot/Mandelbar
3D Christmas Tree
3D Mandelbulb
3D Cosine Mandelbulb
4D Mandelbulb
Plus corresponding julia set for each
Add credits for formulas
Rename parameter 'formula' to 'fractal'
Speed optimisations
2015-12-15 04:18:19 +00:00
BlockMen aed10765f2 Fix events on Windows 2015-12-11 23:08:14 +01:00
est31 8e3602f694 Fix some setting documentation
* Horizontal and vertical are used wrongly. Use height and width because
	horizontal/vertical describes different things. Thanks @kilbith for pointing out.
* Update minetest.conf.example and settings_translation_file.cpp
* Correct maximum/minimum copy paste mistake.
2015-12-10 19:08:03 +01:00
ShadowNinja 696148e298 Fix Event implementation
On non-windows platforms this just used a semaphore,
which meant that multiple calls to signal() would
result in wait() returning multiple times.
2015-12-07 13:53:56 -05:00
ShadowNinja ea2964f5a1 Add seperate cache path
This is set to the XDG cache path where possible.
It's set to the app's cache path on Android.
2015-12-07 13:51:41 -05:00
est31 51e8c2b277 Fix threshold type
Fix the type of the threshold value for mapgen.
The commit

a78dd7f2b6 "Fix spelling of noise_threshold"

has changed it to be read as int, but it can have non-integral values too.

Thanks to @kwolekr for pointing this out.
2015-12-07 09:57:45 +01:00
paramat 49073ba2c3 Mapgen: Add propagate_shadow bool to calcLighting
To terminate unwanted shadows from floatlands or realms above
Also add to LuaVoxelManip calc_lighting for use in mapgen mods
Remove the 2 argument calcLighting, mapgens now use the 5
argument form to specify the volumes for propagateSunlight and
spreadLight
In mgsinglenode replace calcLighting with setLighting and
clean-up use of tabs and spaces
2015-12-07 03:18:24 +00:00
Jun Zhang a78dd7f2b6 Fix spelling of noise_threshold 2015-12-06 11:38:03 +01:00
Ferdinand Thiessen 70ece71ee4 Improve LuaJIT detection
On openSUSE luajit is not detected correctly.
This is because openSUSE is using a lua version suffix, like other Linux distributions do it also.
So the include directory is:
include/luajit-5_1-2.0
2015-12-05 23:31:09 +01:00
Ferdinand Thiessen d8975eabf9 Fix build if BUILD_SHARED_LIBS defaults to "ON"
openSUSE sets that option to ON.

Fixes #3420.
2015-12-03 21:35:22 +01:00
paramat e51ea66bd0 Mgv5/v7/flat/fractal: More large pseudorandom caves
Mgv7/flat/fractal: Reduce tunnel noise spreads to 96
2015-12-02 02:19:52 +00:00
Alex Ford 97908cc656 Add on_secondary_use when right clicking an item in the air 2015-12-02 02:18:44 +00:00
paramat 57b429574e Dungeongen: Fix rarely triggered segfault
A segfault exposed a missing 'vm->m_area.contains()'
check in makeCorridor that allowed the calculation
of vm index for a node outside the vm area. The huge
and invalid index number caused getContent to fail
2015-12-01 00:36:38 +00:00
Jay Arndt 6fead2818a Remove unused OpenALSoundManager::m_can_vorbis and EXT_vorbis check 2015-12-01 00:36:11 +00:00
paramat 452c88308c Dungeongen: Also preserve river water nodes
For future river mapgens
Dungeons will not generate in river water, to
avoid dungeons filling and blocking river channels
2015-11-29 21:55:43 +00:00
Aaron Suen 900db31063 Re-enable texture pre-filters on wielditems, fixing #3178. 2015-11-24 03:22:31 +01:00
paramat c24f3b0a65 Mgfractal: Move julia set selection into formula parameter
Improve default parameters
Update and improve documentation
Unhide mapgen, but is still unstable
2015-11-23 00:34:09 +00:00
est31 a4e3ed0136 Update HUD flags on server like on client
Fixes bug for which commit

6c37e89f08 "Fix old client showing duplicated health bar on new server"
by @sapier

laid the groundwork, where the server has
updated its copy of the hud flags without
respecting the mask.

Fixes #3395.
2015-11-22 16:49:20 +01:00
paramat d7bbe81726 Mapgen: Add global 'decorations' flag
Flag is set by default in MapgenParams
The global 'trees' flag remains but is now
undocumented and unset by default in MapgenParams
Add mgv6_spflag 'trees' set by default in
defaultsettings.cpp to affect new worlds only
This is automatically backwards
compatible for existing worlds
2015-11-21 00:10:08 +00:00
Amaz e664abeb88 Add a status text for autorun 2015-11-15 13:42:31 +01:00
TeTpaAka 3f8eb5e0d0 Allow craft replacements to use groups 2015-11-15 13:41:38 +01:00
paramat cb7da90138 Mgfractal: Revert unnecessary duplication of parameters 2015-11-15 08:13:36 +00:00
est31 bdfb761dd0 sound_openal.cpp: remove unused header 2015-11-15 08:17:32 +01:00
est31 395ef21c86 Load sound from memory
* Remove trailing lines from src/sound_openal.cpp
* Don't do a horribly ugly copy of the file's path, allocating and deallocating a
	10 kb buffer in the process. This copy was needed for backwards compatibility
	with libvorbis 1.3.1 and earlier, as the removed comment explains.
	However, even Ubuntu precise has 1.3.2 already. Dropping support and sparing
	the ugly copy can therefore be considered safe.
* Actually load sounds from the memory, not caching them at the disk first,
	removing the old hack. This is the main motivation for the commit.
2015-11-14 18:17:32 +01:00
paramat fc89f46700 Decoration API: Fix missing low density decorations
For a decoration count between 0 and 1 calculate a chance for 1
2015-11-14 07:54:03 +00:00
paramat 987d6a82f6 Mgfractal: Create a choice of 4 mandelbrot formulas 2015-11-14 04:25:47 +00:00
paramat 4434498367 Mgv6: Move global mapgen flag 'flat' into mgv6 spflags
Add mgv6 spflag 'flat'
Global flag is kept for backwards compatibility but is now undocumented
2015-11-13 04:25:08 +00:00
est31 657a16d90c Only allow players with shout to chat
Fix regression of commit

5e507c9829 "Add server side ncurses terminal"

which allowed all players, even those without a shout priv, to chat.

Fixes #3362.
2015-11-13 02:35:02 +01:00
BlockMen 36855522a5 Fix scrollbars 2015-11-12 17:38:15 +01:00
paramat 76c9abe4c8 Mapgen: Add flat mapgen in hidden form 2015-11-11 09:37:54 +00:00
kwolekr f3ac2517ea Convert usages of PseudoRandom to PcgRandom for ore and deco placement
In addition to being a better random, this fixes #3228
2015-11-09 01:32:39 -05:00
paramat c3e179f256 Cavegen: Make mgfractal use mgv5 cavegen
Remove CaveFractal
Add a lava depth constant to CaveV5 to make it universal
2015-11-09 05:29:42 +00:00
est31 63e7137e3b Put ChatEvent handler into own function
Comply with line limit.
2015-11-09 06:04:24 +01:00
kwolekr 889f893ff3 Abort compile when attempting to build client with Irrlicht 1.8.2 2015-11-08 23:13:47 -05:00
kwolekr 88a3977954 Add errno to socket creation failed exception 2015-11-08 18:16:02 -05:00
est31 4ae6e509ff Write new line character sequence at end of print()
Fix regression of commit

5e507c9829 "Add server side ncurses terminal"

where no line termination character was printed after a
lua print outside of terminal mode.

Fixes #3350.
2015-11-08 22:56:56 +01:00
kwolekr 6f95bb1ef3 Fix misc. MinGW and Valgrind warnings 2015-11-08 16:34:56 -05:00
est31 ad5ac39d8d Add LuaSecureRandom 2015-11-08 15:57:15 -05:00
est31 78caafbd43 Update minetest.conf.example and src/settings_translation_file.cpp 2015-11-08 21:23:09 +01:00
est31 337c02c0f0 Don't compile pcgrandom on Windows
There it isn't needed.
2015-11-08 18:26:20 +01:00
BlockMen 2a12579fab Add support for audio feedback if placing node failed 2015-11-07 13:23:38 +01:00
est31 5e507c9829 Add server side ncurses terminal
This adds a chat console the server owner can use for administration
or to talk with players.
It runs in its own thread, which makes the user interface immune to
the server's lag, behaving just like a client, except timeout.
As it uses the same console code as the f10 console, things like nick
completion or a scroll buffer basically come for free.
The terminal itself is written in a general way so that adding a
client version later on is just about implementing an interface.

Fatal errors are printed after the console exists and the ncurses
terminal buffer gets cleaned up with endwin(), so that the error still
remains visible.

The server owner can chose their username their entered text will
have in chat and where players can send PMs to.
Once the username is secured with a password to prevent anybody to
take over the server, the owner can execute admin tasks over the
console.

This change includes a contribution by @kahrl who has improved ncurses
library detection.
2015-11-06 08:51:14 +01:00
kwolekr 1384108f8c Schematics: Add core.place_schematic_on_vmanip API
Fix memory leak in minetest.place_schematic
Slightly refactor Schematic code
2015-11-05 01:18:32 -05:00
est31 c75ab52115 Fix time progressing too fast
Before, time progressed wrongly. This was due to a mistake in how m_time_of_day_f was calculated,
and a regression of the last two commits.
2015-11-04 07:12:02 +01:00
est31 8f03995604 Time: use locks again
The Atomic implementation was only partially correct, and was very complex.
Use locks for sake of simplicity, following KISS principle.
Only remaining atomic operation use is time of day speed, because that
really is only read + written.

Also fixes a bug with m_time_conversion_skew only being decremented, never
incremented (Regresion from previous commit).

atomic.h changes:
	* Add GenericAtomic<T> class for non-integral types like floats.

	* Remove some last remainders from atomic.h of the volatile use.
2015-11-04 03:44:09 +01:00
est31 f9b09368f0 Time: Remove serverside getter, and use atomic operations
It isn't possible to use atomic operations for floats, so don't use them there.

Having a lock is good out of other reasons too, because this way the float time
and the integer time both match, and can't get different values in a race,
e.g. when two setTimeofDay() get executed simultaneously.
2015-11-03 19:07:45 +01:00
est31 abc354a5d0 Atomic: cleanup and add more operations
Cleanup:
	* Remove volatile keyword, it is of no use at all. [1]
	* Remove the enable_if stuff. It had no use either.
	  The most likely explanation why the enable_if stuff was there is that it
	  was used as something like a STATIC_ASSERT to verify that sizeof(T) is not larger
	  than sizeof(void *). This check however is not just misplaced in a place where we
	  already use a lock, it isn't needed at all, as gcc will just generate a call to
	  to the runtime if it compiles for platforms that don't support atomic instructions.
	  The runtime will then most likely use locks.

Code style fixes:
	* Prefix name of the mutex
	* Line everything up nicely, where it makes things look nice
	* Filling \ continuations with spaces is code style rule

Added operations on the atomic var:
	* Compare and swap
	* Swap

The second point of the cleanup also fixes the Android build of the next commit.

[1]: http://stackoverflow.com/q/2484980
2015-11-03 19:07:39 +01:00
est31 1550ab3c5d Only go fast in autorun if fast move is enabled 2015-11-03 15:40:47 +01:00
kwolekr 6ba4f3775e Silence 'unused typedef' warning for STATIC_ASSERT() 2015-11-03 01:03:33 -05:00
kwolekr c2b5da735e Add callback parameter for core.emerge_area() 2015-11-02 18:43:09 -05:00
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
kwolekr 1a5b4b38f3 Add BufReader and vector-based serialization methods 2015-10-15 01:31:31 -04:00
ShadowNinja e067ceacb8 Clean up gettext initialization 2015-10-15 01:16:10 -04:00
ShadowNinja 7b8d372947 Use warningstream for deprecated field messages and refactor log_deprecated 2015-10-15 01:14:38 -04:00
ShadowNinja 659922fd30 Remove explicit syslog printing for uncaught exceptions on Android
All log operations are now added to the syslog implicitly.
Also, pass along mutable string to argument vector for main().
2015-10-15 00:47:43 -04:00
ShadowNinja 6f2d785d0f Rename macros with two leading underscores
These names are reserved for the compiler/library implementations.
2015-10-14 02:39:37 -04:00
ShadowNinja 6f4d6cb574 Always use errorstream for DEBUG_EXCEPTION_HANDLER 2015-10-14 02:33:30 -04:00
ShadowNinja 4236792b87 Lower log level for benign socket errors 2015-10-14 02:22:04 -04:00
ShadowNinja 96cc5b34fe Use warningstream for log messages with WARNING
Remove DTIME macro and its uses, too
2015-10-14 01:36:48 -04:00
ShadowNinja 2139d7d45f Refactor logging
- Add warning log level
- Change debug_log_level setting to enumeration string
- Map Irrlicht log events to MT log events
- Encapsulate log_* functions and global variables into a class, Logger
- Unify dstream with standard logging mechanism
- Unify core.debug() with standard core.log() script API
2015-10-14 01:03:54 -04:00
Kahrl e0b57c1140 Fix how address is logged when a wrong password is supplied
- SRP: print the address only once, not twice
- Legacy: previously the address was not printed at all
- Make both messages structurally the same, to facilitate log analyzers
2015-10-12 21:47:56 +02:00
paramat bda2f56503 Mgfractal: Independant offset and slice params for mandelbrot and julia
Player now spawns on julia set due to julia offset
Add commented-out '#include profiler.h' for timetaker use
Use v3fs to reduce number of parameters
Tune tunnel width to match mgv7
2015-10-11 23:59:57 +01:00
paramat 3a4bcf35a1 Fractal mapgen: Fix mysterious bug 2015-10-10 21:27:44 +01:00
est31 41d896d5c2 Clear list rings when loading a new formspec
Fixes a bug where the old list ring remained when a new formspec
was displayed over the old one. This created the list-ring of the new formspec
to be partly ignored.

Thanks to @VanessaE to report the bug, and @DonBatman to produce the code that
exposed it.
2015-10-10 17:10:52 +02:00
paramat 7504cdcfbf Mapgen: Use mapgen-specific names for constants in headers
Update copyright years in all mapgens
Add myself to copyright notices in mgv5 and mgv7
2015-10-09 05:51:47 +01:00
paramat 706e7cebea Fractal mapgen: Add seabed and large pseudorandom caves 2015-10-07 06:43:46 +01:00
paramat e62eac49d5 Mapgen: Add 4D fractal mapgen 2015-10-06 06:43:04 +01:00
paramat ce1a70c703 Mgv5: getGroundLevelAtPoint searches a larger range 2015-10-05 02:03:50 +01:00
est31 b0523adc5f Add new ContentParamType2 "CPT2_DEGROTATE"
This might break some mods, but it is important for all uses of the param2 to
be documented.

This doesn't need a serialisation version or network protocol version change,
as old clients will still work on new servers, and it is bearable to have
new clients getting non rotated plants on old servers.
2015-10-04 23:59:41 +02:00
kwolekr 5130dbce7b Allow setting chunksize in core.set_mapgen_params 2015-10-04 17:26:08 -04:00
kwolekr 9f25aba6c2 Hide mapgens from main menu not intended for end users 2015-10-04 17:11:41 -04:00
kwolekr 0850d3bb93 Add emerge completion callback mechanism
Major refactor of emerge.cpp and Map::init/finishBlockMake
2015-10-04 16:27:50 -04:00
kwolekr 7b01b94c6b Remove redundant code in player interact handler 2015-10-04 04:06:26 -04:00
kwolekr f0cd5da687 Define and use limit constants for Irrlicht fixed-width types 2015-10-04 04:00:16 -04:00
ShadowNinja 20405edb06 Fix MinGW 32-bit build 2015-10-03 13:20:43 -04:00
Duane Robertson a5bdfb6b3c Add get_biome_id(biome_name) callback
It returns the index used in mg->biomemap for a given biome name.
The biomemap is useless without this unless you re-register all existing biomes,
which could cause problems for anyone else trying to use biomemap.
With this, you can quickly create a lookup table of ids and names.
2015-10-02 22:49:31 +02:00
SmallJoker 21944a0d3c Add environment variable MINETEST_WORLD_PATH
Also add PATH_DELIM for Windows compatibility.
2015-10-02 22:47:13 +02:00
paramat 8aaae7db05 Mapnode: Replace rotateAlongYAxis with improved version
Get facedir by using lowest 5 bits of param2 and limiting to 23
More robust, frees up higher param2 bits for other uses
Change lookup table and table index to u8
2015-10-02 06:03:36 +01:00
est31 0bf1984d2c Fix some SRP issues
-> Remove memory allocation bugs
-> Merge changes from upstream, enabling customizeable memory allocation
2015-09-30 09:19:40 +02:00
est31 2a7d01b833 Some map border related fixes
1. Check for entity addition success in spawn_item implementation
2. Check for success in item_drop callback, so that the player
doesn't lose the item if they are outside bounds and try to drop it.
3. When existing player joins game, check that their position is inside
map bounds. If not, set their position to the return value of findSpawnPos().
4. Make findSpawnPos() respect the border

2 fixes a lua crash if a player drops an item outside map bounds.
3 fixes an assertion crash if a player leaves when being outside map bounds,
and then rejoins.
2015-09-29 23:06:15 +02:00
Kahrl 0cde03254a Don't serialize StaticObjectList with > 65535 objects
Because the count is serialized as u16, this would cause overflow.

If minetest later deserialized a mapblock with an incorrect
static object count, it would be unable to find the NameIdMapping
(which comes after the StaticObjectList) and abort with an error
such as "Invalid block data in database: unsupported NameIdMapping
version" (issue #2610).
2015-09-29 01:55:12 +02:00
paramat ffe291cb78 Decorations: Remove error message 'chunksize not divisable by sidelen'
Sidelen larger than 16 is essential for low density decorations
With sidelen > 16 chunksize may not be divisable by sidelen if
chunksize is changed, in this situation setting sidelen = chunksize
is desirable and should not create error messages.
2015-09-26 23:58:56 +01:00
est31 e7282816ff Abort at uncatched exceptions
Change a remaining assert(0) call to FATAL_ERROR(msg).
There was a regression since commit

ced6d20295 "For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives"

where when an "uncatched" exception is thrown inside a "side thread",
the program doesn't abort anymore.

This led to the problem @netinetwalker experienced where the emergethread
got an unhandled exception for loading a mapblock while redis was loading,
(see #3196) and then jmped outside its loop to work down its queue.
This resulted in the server not doing any emerges anymore.
2015-09-27 00:27:36 +02:00
est31 4338f100f8 Fix redis erroring on non found blocks
Thanks to @netinetwalker for spotting the error, proposing a fix, and testing it.

Error due to @est31's merging changes to PR #3202 to add more error reporting for invalid reply types, commit:

524a7656e3 "redis: throw error if block request failed"

Now we branch out on the valid reply type "not found".
2015-09-26 23:42:55 +02:00
Christof Kaufmann 8787d2e7e9 Fix falling through nodes on world load (fixes #2784)
On world load the collision code can not see node boxes, since the
nodes have not been loaded. Thus it collided only at the next full
node. However, standing on a slab on world load leaded to sinking into
it until the world finished loading. Then one maybe fell further, if
the node below was not walkable.

Now, with this commit, when no node around the player has been loaded
it simply does not move the player.
2015-09-26 21:40:45 +02:00
netinetwalker 524a7656e3 redis: throw error if block request failed
Fixes #3196. Before, we didn't throw an error, and the engine thought the
block isn't occupied. But in fact it might be that redis is still loading,
and the block does exist in the database. The result was a cheesy map.
2015-09-26 17:36:59 +02:00
kwolekr f062bbd7a1 Add /emergeblocks command and core.emerge_area() Lua API 2015-09-23 15:56:24 -04:00
Loic Blot 596484da4f Save and remove player by pointer
Why doing things simple ? Use pointer instead of strings to save players and remove them.
Saving players by name does a lookup to find pointer we already have ! Idem with removePlayer
Also remove unused removePlayer(peer_id), it's never called
2015-09-23 19:37:05 +02:00
paramat a56aedb4ea Mapnode: Add rotateAlongYAxisFull supporting 24 facedirs 2015-09-22 20:54:25 +01:00
est31 452df1c723 Various style cleanups + unused code removal
-> Don't pass pointer to whole IGameDef to NodeMetadata constructors
	and deserializers, but only to IItemDefManager, which is needed
-> Remove the unused content_mapnode_get_new_name() method
-> Fix style for MapBlock::deSerialize and MapBlock::deSerialize_pre22,
	improving accuracy of error messages a bit
-> Fix style at other serialisation methods too
-> Improve accuracy of some comments
2015-09-19 20:57:29 +02:00
Loic Blot 9c635f28ac Little optimization on getAdded/Removed activeobjects per player loop.
Use std::queue instead of std::set, we don't need such a heavy container.
Don't convert position to int to convert it back to float in the next function.
2015-09-19 20:57:07 +02:00
paramat fe994946b7 Mgv5/6/7: Re-add #include profiler.h as commented-out option 2015-09-19 02:27:21 +01:00
paramat 795db97fe3 Blob ore: Fix partial blobs 2015-09-19 02:27:00 +01:00
est31 94f1e5d9bd Send proper block to old clients for swap_node calls
The legacy code added in commit

d879a539cd - "Add minetest.swap_node"

for sending the whole mapblock to older clients on the case of a node
modification with swap_node, had the problem that the block chosen to be
sent to the client was referenced with node coordinates and not with
block coordinates, resulting in getting the wrong block sent to the client.
2015-09-17 20:23:31 +02:00
kwolekr dcbb95338a Ore: Add puff ore type 2015-09-17 03:04:50 -04:00
est31 6c81be51ff Fix object position border checking
Borders have to be converted into BS format in order to be accurately comparable to
object positions.
2015-09-16 17:39:49 +02:00
est31 f61f817b9c Disallow placing entities outside safe boundaries
Entity positions are serialized as F1000. Disallow placing
entities outside safe borders with the minetest.add_entity
call.

Note that this patch only enforces those boundaries for
placing entities, moving entities that move outside boundaries
aren't affected.

Thanks to @nanepiwo for pointing this out.
2015-09-15 19:45:17 +02:00
paramat 8e9c9e305a Firelike drawtype: Improve code
Remove unusable fine rotation by param2
Remove unused and redundant code
Fix code style issues
2015-09-14 08:04:01 +01:00
est31 283bf97a1c Serialisation: documentation fixes, clarifying renames and whitespace fixes
1. Do two renames:
	* SER_FMT_CLIENT_VER_LOWEST -> SER_FMT_VER_LOWEST_WRITE
	* SER_FMT_VER_LOWEST -> SER_FMT_VER_LOWEST_READ
Now the two define values are consistently named with the _WRITE defines
SER_FMT_VER_{HIGHEST,LOWEST}_WRITE, and to better point out what the two
serialisation versions actually are for.

2. wrap some lines in doc/worldformat.txt, and point out that the node
timers are serialized at a later point, as this can cause confusion about
what now happens (if one doesn't strictly read the if block's conditions).

3. some whitespace fixes in NodeTimerList::serialize, and one new comment.
2015-09-14 07:02:15 +02:00
kwolekr beba969413 Ore: Add ore sheet column height range selection
Modders are now able to select the range of ore column height,
and the midpoint at which they 'grow' starting from.
This commit adds three new parameters for the 'sheet' ore type:
column_height_min, column_height_max, and column_midpoint_factor.
clust_size is now deprecated for this ore type.
2015-09-13 00:11:50 -04:00
est31 64a5eec1bd networkprotocol.h: remove "u16 command" from doc
Its obvious that "u16 command" is inside every packet, therefore this
commit removes all mentions of the command, if non-array like notation
is used. We already didn't add "u16 command" to new packets or removed
it at packet changes, so now we remove it from existing packets.
2015-09-10 10:26:00 +02:00
est31 2a9da62b21 Improve locale directory detection
Use in-place locale directory if that exists, and
static one (RUN_IN_PLACE or CUSTOM_LOCALEDIR) doesn't exist.
Report to errorstream if neither static nor in-place locale
dirs exist, and report successfully found paths to infostreem.

Fixes two bugs:

-> Regression of commit [1] where if we use RUN_IN_PLACE=false,
	but don't make install, locales aren't found. One might
	think this is no regression, as its no bug, but all other
	paths (mainmenu, etc.) are detected properly.
-> Regression of commit [1] where locales don't work on windows.

References:
[1]: Commit 645e208673 "Use CUSTOM_LOCALEDIR if specified" by @ShadowNinja
2015-09-10 08:32:58 +02:00
Loic Blot 1f1e14ab7f Change m_client_event_queue's type to std::queue
As indicated in its name, m_client_event_queue should be a queue.
Change std::list to std::queue to improve the queue's performance.
2015-09-08 21:23:09 +02:00
paramat 4967e483b6 Mgv5/mgv7 biomes: Reduce heat and humidity noise spreads to former value of 750 2015-09-07 02:56:20 +01:00
ShadowNinja 645e208673 Use CUSTOM_LOCALEDIR if specified 2015-09-06 11:21:26 +02:00
Pavel Puchkin 588f0c1fb0 Fix building on OSX, broken since "Clean up threading"
Commit

e4bff8be94 - Clean up threading

by @ShadowNinja has broken the OSX build.

Including things inside a namespace isn't good.

Also fixes #3124.
2015-09-06 05:34:02 +02:00
est31 2035bfc3a6 Areastore: fix "attempt to index a number value"
Before, calling get_areas_in_area for an areastore with both
include_borders and include_data would result in a lua error,
if there was at least one area as result:
attempt to index a number value in function 'get_areas_in_area'
2015-09-03 06:17:02 +02:00
ShadowNinja e511282d78 Warn when building without cURL 2015-09-01 14:43:59 -04:00
ShadowNinja 7419504079 Enable server build when no builds are enabled 2015-09-01 14:43:59 -04:00
est31 0903190ba2 Hide minimap if it has been disabled by server 2015-09-01 19:00:33 +02:00
jh10001 dce9468925 gettext.cpp: Fix syntax error when using MSVC
Also remove trailing whitespaces from the file
2015-09-01 00:26:11 +02:00
est31 2c637ce1c2 Make ClientInterface::statenames consistent with the state enum again
Fixes minetest.get_player_information segfault due
to out of bounds access problems, when compiled as debug build.
2015-08-31 13:31:29 +02:00
est31 9c44aace4f l_mainmenu.h: remove unused l_get_dirlist function
The commit
8f9af57314 "Add core.get_dir_list" by @ShadowNinja
has removed the implementation of the l_get_dirlist function and all its usages
from the l_mainmenu.cpp file, but hasn't removed it from the header file.

The reason why this hasn't been detected earlier is that C++ has this interesting
feature to still make it possible to create instances of classes whose never used
private methods are declared but not defined.
2015-08-30 01:17:03 +02:00
Gael-de-Sailly 18973f9af1 Ores: change ore chance in clusters to better respect clust_num_ores for dense clusters 2015-08-29 23:30:17 +01:00
paramat 17b7b7c85f Dungeongen: Remove floating frames
Preserves the rare unbroken protruding dungeons
Fix random range for first room roomplace
Fix checked volume for first room 'fits' bool
and check for 'untouchable' flag instead of 'inside'
Remove 'enable floating dungeons' setting
2015-08-29 06:27:29 +01:00
Kahrl 3304e1e517 Push error handler afresh each time lua_pcall is used
Fixes "double fault" / "error in error handling" messages
(issue #1423) and instead shows a complete backtrace.
2015-08-27 01:56:06 +02:00
Kahrl 8658c8d9b5 Use numeric indices and raw table access with LUA_REGISTRYINDEX 2015-08-27 01:56:06 +02:00
David Jones 34b7a147dc Change i++ to ++i 2015-08-25 18:33:52 -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
RealBadAngel 980d095e32 tileable flags are needed also without shaders because of filters 2015-08-20 03:42:22 +02:00
RealBadAngel 8b8d17b22b Remove use of engine sent texture tiling flags - theyre no longer needed 2015-08-20 02:41:40 +02:00
Rui 3a2bfd4548 Fix indianred and indigo of color-string 2015-08-19 19:49:45 +02:00
est31 457d42c599 Android: bypass broken wide_to_utf8 with wide_to_narrow (again)
This bypass had to be re-enabled as some users reported issues,
even after the iconv build fix.

While utf8_to_wide works well, wide_to_utf8 is quite broken
on android, for some reason, and some devices (unrelated from build
configuration).
2015-08-19 18:38:00 +02:00
est31 1fadf7f21e Fix inventory replace bug 2015-08-19 03:42:00 +02:00
kwolekr c2d23ff9cc SAPI: Disable unlockable time profiling 2015-08-18 01:26:11 -04:00
kwolekr bcf38a2ad1 SEnv: Remove static_exists from ActiveObjects in deleted blocks 2015-08-16 15:55:07 -04:00
onkrot 5556ba168f Remove unused functions. 2015-08-16 14:29:33 +02:00
paramat ee6cad1546 Defaultsettings: Increase client_mapblock_limit to 5000 2015-08-15 20:29:30 +01:00
kwolekr 0ba1cf8203 Rollback: Fail on bad precondition instead of causing assertion error 2015-08-15 14:51:38 -04:00
BlockMen 7238df4c59 Fix sneaking (fixes #665 and #3045) 2015-08-15 20:36:45 +02:00
nerzhul c4b5561b3f Remove unused function from connection.{cpp,h} 2015-08-15 08:48:20 +02:00
kwolekr be9024a397 minimap: Add ability to disable from server 2015-08-13 15:05:48 -04:00
est31 a670ecfde4 game.cpp: Update cached settings 2015-08-13 20:05:53 +02:00
Perttu Ahola def274a583 Fix segfault caused by a8e238ed06 2015-08-13 19:02:48 +03:00
est31 a8e238ed06 Add count based unload limit for mapblocks 2015-08-13 07:56:07 +02:00
kwolekr 2b04ab874d SAPI: Track last executed mod and include in error messages 2015-08-12 23:56:12 -04:00
est31 738fbc66d0 Fix Lua PcgRandom
Before, this lua code led to a crash:

local pcg = PcgRandom(42)
local value = pcg:next()

This was because if you called s32 PcgRandom::range(min, max) with the
minimum and maximum possible values for s32 integers (which the lua
binding code did), u32 PcgRandom::range(bound) got called with 0 as the
bound. The bound however is one above the maximum value, so 0 is a "special"
value to pass to this function. This commit fixes the lua crash by
assigning the RNG's full range to the bound 0, which is also fits to the
"maximum is bound - 1" principle, as (u32)-1 is the maximum value in the
u32 range.
2015-08-12 11:36:22 +02:00
paramat f0b325254f Treegen: Rename pine tree mapgen alias 2015-08-10 09:50:58 +01:00
Kahrl 6c0c27f662 Fix intlGUIEditBox leak and uninitialized value in Mapper (reported by valgrind) 2015-08-10 08:41:45 +02:00
kwolekr 1c408c4f1d Make NetworkPacket respect serialized string size limits 2015-08-10 02:16:55 -04:00
kwolekr 18cfd89a86 Display Lua memory usage at the time of Out-of-Memory error
Also misc. minor cleanups
2015-08-10 01:38:09 -04:00
rubenwardy a953ff4dfc Fix segfaults caused by the Environment not being initialized yet 2015-08-09 23:36:55 +02:00
Loic Blot 35cc90b086 Remove unused file 2015-08-09 13:27:42 +02:00
Kahrl 63b12f1f04 Fix camera updates being toggled by N key in release mode (#2762) 2015-08-07 06:02:06 +02:00
gregorycu 5c3c965c1a Fix detection of sneaking node
This fixes bug 1551
2015-08-06 03:14:56 -04:00
kwolekr 8560ece02e Fix BufferedPacket race condition (fixes #2983)
This was caused by the use the non-threadsafe SharedBuffer in a
threaded context.
2015-08-06 02:25:35 -04:00
kwolekr bd0b469d3d Fix critical vulnerabilities and bugs with NetworkPacket 2015-08-06 00:10:57 -04:00
est31 49cf66d785 Initialize random for verification key generation too 2015-08-06 05:48:07 +02:00
kwolekr bcf47bc67c Improve Script CPP API diagnostics 2015-08-05 21:13:03 -04:00
kwolekr 3183d5a403 connection: Make assertions non-fatal for received data 2015-08-05 21:01:13 -04:00
RealBadAngel 3295f3c401 Fix tiling issues for PLANTLIKE and FIRELIKE with FSAA 2015-08-05 22:52:32 +02:00