Commit Graph

3879 Commits

Author SHA1 Message Date
ASL97 106d4b7d05 Cache disable_anticheat and check it for "interacted_too_far" 2016-01-09 16:24:22 -05:00
Dalai Felinto 9943ae3f1a New 3D Mode: Pageflip
The pageflip mode requires a stereo quadbuffer, and a modern graphic
card. Patch tested with NVidia 3D Vision.

The mini-map is not drawn, but that's what is done for topbottom and
sidebyside modes as well.

Also most of the time the user would prefer the HUD to be off. That's
for the user to decide though, and toggle it manually.

Finally, the interocular distance (aka eye separation) is twice as much
as the "3d_paralax_strength" settings. I find this a strange design
decision. I didn't want to chance this though, since it's how the other
3d modes interpret this settings.
2016-01-09 16:52:29 +01:00
gregorycu 9c77725653 Replace instance of readsome with read in decompressZlib Make decompressZlib more robust 2016-01-09 02:28:35 +00:00
est31 57a461930b Fix redis error reporting
Previously, we assumed that reply->str was NULL
terminated. However, this turned out to be not true,
as users reported crashes in strlen connected to
where reply->str was appended to an std::string.

Use the method recomended by the docs, to read the
length separately.
2016-01-08 15:37:11 +01:00
paramat 0bbbc6e13d Liquids: Flow into and destroy 'floodable' nodes
Add new node property 'floodable', default false
Define "air" as floodable = true in C++ and lua
2016-01-07 05:57:19 +00:00
gregorycu e7e9171f37 Fix for commit 87dcee6 It uses the wrong variable and only covers some use cases. This change covers all use cases. 2016-01-04 07:50:39 +01:00
gregorycu 09a6910dc7 Add MinSizeRel and RelWithDebInfo to MSVCBuildDir check 2016-01-03 15:38:20 +01:00
gregorycu 87dcee6ac2 Prevent technically unsafe access with empty vector 2016-01-03 15:37:49 +01:00
Perttu Ahola 64c060e1f2 filesys: safeWriteToFile(): Remove the target file before rename only on Windows
Removing the target file on other platforms was enabled likely unintentionally
by commit 5f1f1151d3.

This may be the reason why there has been corruption of files on Linux on hard
shutdowns.

Previously I described the problem and this fix in issue #3084.
2016-01-01 18:21:18 +02:00
est31 a142e4f4b2 Fix client crashing when connecting to server
My commit

e2d54c9f92 "shutdown when requested from lua in singleplayer too"

broke minetest's feature to connect to servers. The client crashed
after the connection init was complete.

Thanks to @sofar for reporting the bug.

Fixes #3498.
2015-12-30 00:50:50 +01:00
ShadowNinja 9719aded54 Fix cache path with RUN_IN_PLACE
If an `XDG_CACHE_HOME` can't be found or `RUN_IN_PLACE` is enabled,
`path_cache` is left at its default of `$PATH_USER/cache`
(at a time when `PATH_USER` is `..`), rather than being reset to
`$PATH_USER/cache` after `PATH_USER` has been properly set.
2015-12-30 00:14:30 +01:00
Rogier cb30facda0 Include custom error message in all SQLite3 exceptions.
And replace manual tests for error with SQLOK() where possible.
2015-12-30 00:09:02 +01:00
Rogier c6bb6f99d1 Handle SQLITE_BUSY errors gracefully
This allows other applications (e.g. minetestmapper) to interrogate
the database while minetest is running, without causing an almost
certain minetest crash.
2015-12-30 00:08:56 +01:00
qiukeren 848b050a56 Add macos/freebsd missing endian.h include and add win endianness info 2015-12-29 23:03:30 +01:00
Sapier 1735c20549 Revert "Refactoring and code style fixes in preparation of adding mesh typed items"
This reverts commit f14e7bac54.

Reverted due to missinterpretation of agreement, obvious dislike and me not interested in doing fights for feature I don't actually need
2015-12-29 19:55:50 +01:00
Sapier 25d128da36 Revert "Add support for using arbitrary meshes as items"
This reverts commit 91bafceee6.

Reverted due to missinterpretation of agreement, obvious dislike and me not interested in doing fights for feature I don't actually need
2015-12-29 19:53:38 +01:00
Sapier 61cb4d52a6 Make collisionMoveSimple time overflow message written to log/show up at max once per step 2015-12-29 17:02:17 +01:00
Sapier 91bafceee6 Add support for using arbitrary meshes as items 2015-12-29 16:27:06 +01:00
Sapier f14e7bac54 Refactoring and code style fixes in preparation of adding mesh typed items 2015-12-29 16:27:06 +01:00
est31 e2d54c9f92 shutdown when requested from lua in singleplayer too
Before, minetest.request_shutdown didn't shut down
singleplayer instances or server instances from the server tab.

This commit fixes this. Fixes #3489.
2015-12-29 00:40:22 +01:00
est31 8a46c5df1c Database backends: fix bug, and small speedup
-> Redis backend: break from switch to fix bug
-> Dummy and redis backends: reserve the count so that creating the list is faster
2015-12-29 00:39:42 +01:00
Sapier 5de8e026a3 Fix lua object:get_properties() being broken 2015-12-21 00:27:13 +01:00
est31 f192a5bc43 Fix missing pop
Previous commit

70ea5d552e "Add support for limiting rotation of automatic face movement dir entitys"

by sapier has broken minetest's feature to open worlds. This was due to a
missing stack pop operation.

Thanks to @oleastre for reporting this bug and suggesting the fix.
2015-12-20 03:36:47 +01:00
Sapier 70ea5d552e Add support for limiting rotation of automatic face movement dir entitys 2015-12-19 17:00:36 +01:00
Sapier 06632205d8 Android: Implement Autohiding button bars to cleanup screen 2015-12-18 20:35:54 +01:00
Sapier 6a7e1667f6 Android: Fix pressed buttons not beeing cleared on opening menu 2015-12-17 20:43:25 +01:00
BlockMen 9eee3c3f46 Add option to give every object a nametag
or change the nametag text of players
2015-12-15 23:32:19 +01:00
asl97 19f73e4efc Get movement setting instead of hard coded value 2015-12-15 23:20:15 +01:00
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