Commit Graph

4707 Commits

Author SHA1 Message Date
Xunto
0b0075e6ad Move on join and on leave messages to lua (#4460) 2016-08-22 20:21:48 +02:00
kahrl
cafa400fa5 gettext.h: include <locale> before defining the gettext macro (#4452)
Fixes #4446: a syntax error that happens if something else (such as
<iomanip> or <locale> in certain libstdc++ versions) includes
<libintl.h> later, which contains a function declaration for gettext
that gets mangled by the macro.

See the added comment in gettext.h and the discussion in #4446/#4452
for details.
2016-08-21 02:40:23 +02:00
est31
f092dac979 Also support X11 icon for minetest copies installed via make install (#4407)
Fixes #4323.
2016-08-20 21:26:44 +02:00
Tim
6590140260 Tidy up generate_from_settingtypes.lua a bit.
* Multiline strings
* Table-concat instead of String-concats
* string.rep instead of loop-concat
* string.format %q instead of manual quotation by gsub
* Assert writeable files
* Generate new settings_translation_file
2016-08-20 15:48:47 +02:00
obneq
7f4c6f32da Mapblock mesh: Fix updateFastFaceRow tiling issue
Increase maximum length of tiled node rows from 2 to mapblock size.
2016-08-18 20:45:18 +01:00
SmallJoker
5c0e659516 Script API: Make the craft recipe field 'method' consistent 2016-08-18 20:43:49 +01:00
Thomas--S
f21dae6339 Add an [opacity:<r> texture modifier. Makes the base image transparent according to the given ratio. r must be between 0 and 255. 0 means totally transparent. 255 means totally opaque. Useful for texture overlaying. 2016-08-12 15:20:30 +02:00
Rogier-5
b11720af45 Use the standard to_string() functions for C++11 (#4279)
If compiling according to a C++ version before C++11, then define
std::to_string ourselves.

Add a to_wstring version as well

As std::to_string() for floating point types uses %.6f as floating
point format converter, instead of %G, it needs special care.

To preserve ftos() behavior (which is expected to use the %G format
converter), it no longer uses to_string().
2016-08-11 19:22:40 +02:00
Rogier-5
35f47e5461 Add infotext containing entity type (e.g. mobs:cow) to unknown entities (#4431)
If a mod is disabled, or upgraded without sufficient backward compatibility,
then entities it has put into the world become unknown, and continue moving
around, but are completely unrecognisable.

This change allows the player to see their type, and therefore which mod is
or was responsible.
2016-08-11 00:22:32 +02:00
David Carlier
48b3bb980d couple of memory leaks fixes. 2016-08-10 16:59:32 +02:00
Ben Deutsch
82494b8cc1 Zooming the camera requires the 'zoom' privilege 2016-08-10 12:18:25 +02:00
Esteban I. Ruiz Moreno
2c31b79235 Add zoom, tweakable with zoom_fov, default key: Z (like optifine) 2016-08-10 12:18:25 +02:00
Tomas
c013c73f33 Lua->C getintfield() use lua_tointeger (#4408)
previously function used tonumber which returned float
this caused errors in large numbers and resulted in
obj-def-handlers being invalid when retrived from lua tables in c
2016-08-10 12:17:48 +02:00
Rogier-5
4503b5097f Fixes for compiling with a newer (system) jsoncpp (#4429)
* Move included json code to jsoncpp subdirectory

This is needed to avoid having to specify the minetest src directory
as a system include when fixing the json includes.

* Fix json includes

They used "", so that the compiler searches the project's directory
first. The result was that when compiling with a system jsoncpp,
the project's own version of json.h was still included, instead of
the system version.

The includes now use <>, so a system location, or one specified with
'-Ilocation' is searched only.

* Fix for jsoncpp deprecated function warning

When compiling with a newer version of jsoncpp (and
ENABLE_SYSTEM_JSONCPP=true), jsoncpp emits a warning
about a deprecated function that minetest uses.
2016-08-10 12:10:00 +02:00
Ner'zhul
058a869b70 Permit usage of std::unordered_map & std::unorderered_set on c++11 compilers (#4430)
This fallback to std::map & std::set for older compilers

Use UNORDERED_SET as an example in decoration and ore biome sets

Use UNORDERED_MAP as an example in nameidmapping
2016-08-10 12:08:05 +02:00
paramat
b6d845adb4 Decorations: Fix decoration height check errors
Fix height check comparison from '>=' to '>'.
Fix getHeight() for schematic decorations to account for
'deco place center y' flag and for how normal placement
sinks schematic 1 node into the ground.

Jungletrees were not being placed at y = 46, y = 47 despite
having an acceptable 16 nodes of height above ground surface.
2016-08-05 11:48:40 +01:00
paramat
ea12da939f Mapgen: Remove unused 'flat' and 'trees' flags from mg_flags
When the 'flat' and 'trees' flags were moved into mgv6_spflags they
were left in mg_flags in an attempt to support old mgv6 worlds. However
their appearence in mg_flags causes confusion, also, later, old-world
support was found to be broken for mgv6 worlds with 'notrees'.

This commit cleans up the mess and comes a month after a thread warning
of the change, and explaining the required action, was posted in the
news subforum. Only old mgv6 worlds with 'flat' or 'notrees' are
affected, a small minority of worlds, the required action being
correctly setting these flags in mgv6_spflags.

Disable a section of the 'map settings manager' unit test which is to
be changed as it is causing problems for pull requests.
2016-08-04 06:58:42 +01:00
Dorian Wouters
fca8e53842 Fix l_request_insecure_environment not ignoring all whitespace (#4395)
l_request_insecure_environment didn't ignore all whitespace in the
secure.trusted_mods config option.

Replaces std::remove with std::remove_if and the isspace function.
2016-08-04 00:41:54 +02:00
est31
4ec6671909 test_map_settings_manager: Fix Wunused-result warning 2016-08-04 00:29:06 +02:00
est31
9edc984b09 Porting: Fix endless loop if image format is not recognized 2016-08-03 23:33:04 +02:00
SmallJoker
8a98cbda84 Upright sprite objects: Horizontally flip the front image
For consistent horizontal sprite structure when seen from front and back
Fix code style
2016-07-27 22:21:41 +01:00
est31
f833159a68 Update minetest.conf.example and the settings translation file 2016-07-24 17:41:36 +02:00
paramat
2ba8ad1dfe Mgvalleys / cavegen: Place riverbed nodes under river water
When a CavesNoiseIntersection tunnel intersects a river place biome
'riverbed' nodes in tunnel entrance instead of biome 'top' nodes.
2016-07-21 05:01:18 +01:00
paramat
91f68e7d11 Treegen: Improve use of signed vs. unsigned integers
To fix GCC 6.1.1 compilation warning:
'assuming signed overflow does not occur when assuming
that (X - c) > X is always false'
2016-07-12 20:22:26 +01:00
est31
24ca754bd5 Update minetest.conf.example, and settings_translation_file.cpp 2016-07-12 20:49:33 +02:00
Snipie
4c530dea1a Fix typos (#4298) 2016-07-10 00:00:14 +10:00
est31
9db78dc4c4 Fix -Wterminate warnings in rollback.cpp as well
Fix #4137 for rollback.cpp as well.
2016-07-08 07:27:49 +02:00
est31
483cca78a1 Fix -Wterminate warning on GCC 6
Fixes #4137
2016-07-08 07:08:33 +02:00
Jay Arndt
795f1c75cb Fix warning in porting::setXorgWindowIcon when building without X11 (#4288) 2016-07-07 03:15:36 +02:00
Foghrye4
281e9f39fd Adding minetest.clear_craft
Modifications by est31: grammar fixes in doc + error messages and
a little style fix, no functional change.
2016-07-05 21:40:13 +02:00
sfan5
7a532056e2 Use mathematical function to determine yaw direction 2016-07-05 20:36:05 +02:00
Snipie
6014e7257e Fix for cropped text "Toggle Cinematic" 2016-07-05 20:29:41 +02:00
rubenwardy
538af97d8d Remove cinematic toggle on F8
Also update cinematic mode's description to include mouse
2016-07-05 19:50:30 +02:00
est31
5d4d3f8366 Finally set a window icon on X11
Since the creation of minetest, it had no window icon on X11.
Now we have one.

The misc/minetest-xorg-icon-128.png file is a rendering of the
misc/minetest.svg file with inkscape, created with something like:

inkscape -z -e misc/minetest-xorg-icon-128.png -w 128 -h 128 misc/minetest.svg
2016-07-05 17:02:06 +02:00
est31
c1bdb552bc Temporarily disable "testStartStopWait" Threading unit test on mac
The "testStartStopWait" unit test is unreliably failing on mac,
for some time already. See bug #3786.

Having the unittest fail unreliably doesn't help anybody but mostly
inhibits the main feature of travis builds: to test PRs for regressions.

Therefore, disable the specific unit test for until bug #3786
is fixed.
2016-07-04 22:46:52 +02:00
Rogier-5
1dfd977ec4 Fix & make linux conditionals uniform (#4278)
The source used a hodge-podge of different combinations of different
macros to check for linux: 'linux', '__linux', '__linux__'.

As '__linux__' is standard (Posix), and the others are not, the source
now uniformly uses __linux__. If either linux or __linux are defined,
it is made sure that __linux__ is defined as well.
2016-07-04 21:00:57 +02:00
est31
f649147080 Disable joysticks per default for now
It seems that various different devices register as
Joysticks on linux, and their presence has caused
lots of confusion amongst minetest users.

Therefore, disable the joystick feature.

Closes #4261
Closes #4221
2016-07-04 20:49:13 +02:00
est31
e1aa98fe07 Remove top left minetest watermark
Move version information into the window caption.

On popular player request.

Fixes #4209.
2016-07-03 21:49:33 +02:00
kwolekr
3c63c3044d Add MapSettingsManager and new mapgen setting script API functions
This commit refactors the majority of the Mapgen settings system.
- MapgenParams is now owned by MapSettingsManager, itself a part of ServerMap,
  instead of the EmergeManager.
- New Script API functions added:
    core.get_mapgen_setting
    core.get_mapgen_setting_noiseparams,
    core.set_mapgen_setting, and
    core.set_mapgen_setting_noiseparams.
- minetest.get/set_mapgen_params are deprecated by the above new functions.
- It is now possible to view and modify any arbitrary mapgen setting from a mod,
  rather than the base MapgenParams structure.
- MapgenSpecificParams has been removed.
2016-07-03 15:38:36 -04:00
kwolekr
92705306bf Mapgen: Refactor mapgen creation and management
- Move mapgen creation logic out of EmergeManager and into Mapgen
- Internally represent mapgen type as an enum value, instead of a string
- Remove the need for a MapgenFactory per mapgen
2016-07-03 14:04:11 -04:00
David Carlier
b6eef1c0c2 openbsd's port fix for non Linux systems w/o libRT
X11 headers are not always in expected locations, add them to include list.

Modifications by est31: indentation fixes, commit message improved
2016-07-03 13:01:49 +02:00
est31
ab7a5c4ff1 Also shut down when SIGTERM was received
Fixes #4251
2016-06-24 20:43:29 +02:00
paramat
9997e2030c Mgflat/fractal/v7/valleys: Denser 3D noise tunnels
Reduce spread from 96 to primes 61 and 67 (either side of 64)
Prime spreads help to keep 3D noise periodic features unaligned
'cave width' 0.2 to preserve tunnel width
Reduce octaves to 3 to improve network structure
2016-06-24 02:17:51 +01:00
raymoo
fa0bbbf96d Player: New get_look, set_look API
Deprecate get_look / set_look pitch / yaw
2016-06-24 02:13:09 +01:00
paramat
04fb10914c Dungeons: Generalise use, add capabilities, various modifications
- Generalise node names to c_wall and c_alt_wall
- Remove 'mossratio' and instead disable alt_wall loop if
  c_alt_wall == CONTENT_IGNORE
- Use one generalised 3D noise for alternative wall nodes and in
  mgv6 create moss distribution similar to the previous

- Rename rarity noise to density noise and enable the option of multiple
  dungeons per chunk determined by the value. Recreate previous distribution
- Add parameters for min and max rooms per dungeon
- Add dungeon y limits

- Integrate river water properly

Generalisation is needed now that we have sandstone and desert stone
dungeons by default and can choose any node for alternative structure.
The current code is based around cobble dungeons with mossycobble
alternative nodes, the 2 noises controlling the alternative nodes
are based on wetness.

Enabling multiple dungeons per chunk with definable number of rooms
allows the option of very dense and complex underground structures
that could interconnect to create megastructures.
Y limits are added to be consistent with other mapgen elements, and
enable locaton of dungeon or megastructure realms as part of our
'stacked realms' philosophy.
2016-06-17 04:42:42 +01:00
Yutao Yuan
1b8dbf072a Move unknown node message when applying texture overrides to infostream (#4218)
Texture packs have no way to know what nodes are available, so this shouldn't be a error message.
2016-06-14 00:29:15 +02:00
paramat
a39d536282 Sky.cpp: Improve code style. Define sky colours as SColor 2016-06-11 23:35:38 +01:00
Ekdohibs
559dd99469 Make node timers more efficient 2016-06-11 23:35:17 +01:00
kwolekr
27aff22a9b Random misc. warning fixes and cleanups
- Fix unused c_sand member warning in Valleys Mapgen
 - Fix some code style
 - Make some std::string params const ref
2016-06-11 03:23:53 -04:00
kwolekr
33b874fea3 Settings: Clean up settings changed callback code 2016-06-11 00:11:37 -04:00
Diego Martinez
dac40af6ee Server: Add reason for leave to on_leaveplayer callbacks 2016-06-11 04:17:04 +01:00
paramat
b24d21d1ae Sky: Darker, bluer sky and improved horizon haze at night
Add new colours 'skycolour_bright_night', 'bgcolour_bright_night'
and enable these between sunset end and sunrise start
Night sky has same hue as day sky but is darker and more saturated
Night horizon haze (bgcolour) is slightly less saturated and
slightly brighter than night sky, to be consistent with daytime
horizon haze
2016-06-09 01:50:52 +01:00
Paramat
3ef71edd81 Sky: Fix sunrisebg texture motion (#4199)
Top of texture no longer shows above horizon during night and day
2016-06-08 16:43:27 +10:00
kwolekr
d4457ef420 Mapgen: Optimize biomemap creation by combining with generateBiomes 2016-06-05 13:30:02 -04:00
paramat
d24f384174 Biome API: Add per-biome riverbed material and depth
Mgvalleys: Remove riverbed sand placement from base terrain generation
Riverbed material placement moved to MapgenBasic::generateBiomes()
Document fields and add note that the biome API is still unstable
2016-06-05 16:37:02 +01:00
MillersMan
7841f1c509 Mapgen: Performance improvement and fixes for updateLiquid (#4065)
- Adds only ~100 nodes per chunk to trans_liquid with similar processing time
- Adds liquid nodes themselves instead of potential solid nodes below them
- CONTENT_IGNORE nodes are interpreted as if they continue their neighborhood
- This allows liquid columns to span multiple chunks without being interrupted
- NOTE: Expects an one-node border in generation chunk without liquid changes
2016-06-04 19:32:54 -04:00
kwolekr
109c7e3349 Biomes: Define and use biome_t for biome IDs 2016-06-04 03:00:45 -04:00
kwolekr
8ed467d438 PcgRandom: Fix/improve documentation 2016-06-04 02:16:06 -04:00
kwolekr
dfbdb5bcd7 Change internal type for seeds to s32
This fixes value truncation (and therefore incompatibility) on platforms
with an LP32 data model, such as VAX or MS-DOS.
2016-06-04 01:51:44 -04:00
est31
2060fd9cbe Initial Gamepad support
Adds initial ingame gamepad support to minetest.

Full Formspec support is not implemented yet and
can be added by a later change.
2016-06-03 19:42:57 +02:00
est31
1e86c89f36 Input related generalisations
* Move key types into own file
* Use Generalized input methods in game.cpp
2016-06-03 19:42:57 +02:00
Robert Kiraly
7ea4a03c83 Sapier's fix for the RESEND RELIABLE problem (#4170) 2016-06-03 17:50:21 +10:00
paramat
569998011e Mgv7: Always carve river channels in mountain terrain
Previously, rivers were sometimes blocked by vertical walls
of mountain terrain due to river carving being disabled
when base terrain height was below water_level - 16
Remove now unused base terrain heightmap created in
generateTerrain()
2016-06-02 07:31:01 +01:00
Ekdohibs
14ef2b445a Add colored text (not only colored chat).
Add documentation, move files to a proper place and avoid memory leaks.
Make it work with most kind of texts, and allow backgrounds too.
2016-05-31 17:34:29 +02:00
TriBlade9
1d40385d4a Colored chat working as expected for both freetype and non-freetype builds. @nerzhul improvements * Add unit tests * Fix coding style * move guiChatConsole.hpp to client/ 2016-05-31 17:34:29 +02:00
est31
27db929252 Add minetest.check_password_entry callback
Gives a convenient way to check a player's password.

This entirely bypasses the SRP protocol, so should be used
with great care.

This function is not intended to be used
in-game, but solely by external protocols, where no
authentication of the minetest engine is provided, and
also only for protocols, in which the user already gives the
server the plaintext password.

Examples for good use are the classical http form, or irc,
an example for a bad use is a password change dialog inside
formspec.

Users should be aware that they lose the advantages of the SRP
protocol if they enter their passwords for servers outside the
normal entry box, like in in-game formspec menus,
or through irc /msg s,

This patch also fixes an auth.h mistake which has mixed up the
order of params inside the decode_srp_verifier_and_salt function.

Zeno-: Added errorstream message for invalid format when I committed
2016-05-30 23:28:08 +10:00
Zeno-
a9bc7dc405 Remove unused code in s_security.cpp (#4172)
Note that the macro CHECK_FILE_ERR implements the code removed
2016-05-30 22:37:40 +10:00
Auke Kok
d499ec4838 Particles: Add option to remove particles on collision
Adds the particle option `collision_removal = bool`

Some particles are hard to use right now since they either go through
solid blocks (without collision detection), and with collision
detection enabled they (e.g. raindrops) would just stop dead on the
floor and sit there until they expire, or worse, scrape along a wall
or ceiling.

We can solve the problem by adding a boolean flag that tells the
particle to be removed if it ever collides with something. This will
make it easier to add rain that doesn't fall through your roof or stick
on the top of it. Or clouds and smoke that don't go through trees.

Particles that collide with this flag are marked expired
unconditionally, causing them to be treated like normal expired
particles and cleaned up normally.

Documentation is adjusted accordingly.

An added bonus of this patch is that particles can potentially collide
many times with nodes, and this reduces the amount of collisions to 1
(max), which may end up reducing particle load on the client.
2016-05-28 00:08:23 -04:00
red-001
62d15ac7c1 Add base64 encoding and decoding to the lua api. (#3919) 2016-05-27 23:37:28 -04:00
kwolekr
c4e083f7e1 Disallow external linkage for default Cavegen NoiseParams 2016-05-27 23:23:58 -04:00
kwolekr
c8fd232678 Dungeongen: Remove dependency on Mapgen 2016-05-27 23:23:58 -04:00
kwolekr
fd0efb21c3 Mapgen: Combine dungeon generation code 2016-05-27 23:23:58 -04:00
kwolekr
0810901766 Mapgen: Deduplicate common constructor code 2016-05-27 23:23:58 -04:00
kwolekr
0df5c01a8c Mapgen: Remove calculateNoise from most mapgens
This commit moves noise calculation to the functions where the noise is
actually required, increasing the separation of concerns and level of
interdependency for each mapgen method.  Valleys Mapgen is left unmodified.
2016-05-27 23:23:58 -04:00
kwolekr
c5968049bb Mapgen V7: Remove now-unused ridge heightmap 2016-05-27 23:23:58 -04:00
kwolekr
548d99bb45 Cavegen: Move V5-style caves to CavesNoiseIntersection 2016-05-27 23:23:58 -04:00
kwolekr
6151f7bc4b Cavegen: Minor misc. fixes
- Convert instances of numeric literal doubles to floats
- Move dswitchint to a local variable now that being a member is unnecessary
- Improve const correctness
- Indentation fixes
2016-05-27 23:23:58 -04:00
kwolekr
b1eb757e60 Fix undefined evaluation order when constructing random vectors
MSVC and GCC evaluate parameters in right-to-left order, whereas Clang
evaluates in left-to-right order, and of course, an optimization could
leave the order of evaluation completely indeterminate.

This commit fixes all instances of the error by explicitly assigning the
results of expressions that use PseudoRandom::next() or range() to their
respective vector components.

The right-to-left evaluation behavior is preserved since Clang is much less
commonly used to compile Minetest than GCC and MSVC combined, and would
therefore cause the least harm.
2016-05-27 23:23:58 -04:00
kwolekr
5b05f75a27 Cavegen: Re-add small caves to CavesRandomWalk 2016-05-27 23:23:58 -04:00
kwolekr
db1b4dc890 Cavegen: Remove CavesRandomWalk dependency on Mapgen 2016-05-27 23:23:58 -04:00
kwolekr
68b1cd8d1b Cavegen: Merge instances of repetitive surface level-finding code 2016-05-27 23:23:58 -04:00
kwolekr
a605d69092 Cavegen: Remove CavesV6 dependency on Mapgen 2016-05-27 23:23:58 -04:00
kwolekr
bf25837617 Cavegen: Rename CaveV6 to CavesV6
- Add comment explaining why it exists
- Remove unused 'flooded' variable
- Rename shadowed variable
- Fix some code style
2016-05-27 23:23:58 -04:00
kwolekr
1bb5eb1da2 Cavegen: Merge CaveV5 and CaveV7 into CavesRandomWalk 2016-05-27 23:23:58 -04:00
kwolekr
9b5c492be5 Fix MgStoneType and BiomeType enum names 2016-05-27 23:23:58 -04:00
kwolekr
87bc39dca7 Mapgen: Combine generateBiomes, dustTopNodes, and generateCaves
This commit condenses the above methods into a single implementation used by
V7, V5, Flat, Fractal, and Valleys mapgens and introduces MapgenBasic.
2016-05-27 23:23:58 -04:00
kwolekr
76f4856479 Move biome calculation to BiomeGen
BiomeGen defines an interface that, given a set of BiomeParams, computes biomes
for a given area using the algorithm implemented by that specific BiomeGen.
This abstracts away the old system where each mapgen supplied the noises
required for biome generation.
2016-05-27 23:23:58 -04:00
est31
fa6b21a15b Tell irrlicht if we handle a key or not.
We can remove the function in MtNativeActivity now
as it serves precisely that purpose: to tell irrlicht
that we handled the esc key.

TODO for later:
 * Perhaps try to find a more performant container than KeyList
2016-05-26 20:33:33 +02:00
ShadowNinja
ef100f12a1 Fix rollback.txt migration
Broken by b1965ac209.
This also prepares the begin and commit statements only once.
2016-05-23 11:48:30 -04:00
Craig Robbins
22f78ea38e Fix irrlicht version checking macro for tooltip_height calculation 2016-05-24 00:27:11 +10:00
Ekdohibs
725edc78b2 Move updateTextures and fillTileAttribs to ContentFeatures 2016-05-23 12:46:45 +02:00
est31
423d8c1b0d Tolerate packet reordering in the early init process
Fixes a bug where packet reordering made the server give the
client two peer ids instead of one. This in turn confused
reliable packet sending and made connecting to the server fail.

The client usually sends three packets at init: one "dummy"
packet consisting of two 0 bytes, and the init packet as well as
its legacy counterpart. The last one can be turned off since commit
af30183124, but this is of lower
relevance for the bug. The relevant part here is that network
packet reorder (which is a normal occurence) can make the packets
reach the server in different order.

If reorder puts the dummy packet further behind, the following
would happen before the patch:

1. The server will get one of the init packets on channel 1 and
   assign the client a peer id, as the packet will have zero as
   peer id.

2. The server sends a CONTROLTYPE_SET_PEER_ID packet to inform
   the client of the peer id.

3. The next packet from the client will contain the peer id set by
   the server.

4. The server sets the m_has_sent_with_id member for the client's
   peer structure to true.

5. Now the dummy packet arrives. It has a peer id of zero, therefore
   the server searches whether it already has a peer id for the
   address the packet was sent from. The search fails because
   m_has_sent_with_id was set to true and the server only searched
   for peers with m_has_sent_with_id set to false.

6. In a working setup, the server would assign the dummy packet to
   the correct peer id. However the server instead now assigns a
   second peer id and peer structure to the peer, and assign the
   packet to that new peer.

7. In order to inform the peer of its peer id, the server sends a
   CONTROLTYPE_SET_PEER_ID command packet, reliably, to the peer.
   This packet uses the new peer id.

8. The client sends an ack to that packet, not with the new peer id
   but with the peer id sent in 2.

9. This packet reaches the server, but it drops the ACK as the peer
   id does not map to any un-ACK-ed packets with that seqnum. The
   same time, the server still waits for an ACK with the new peer
   id, which of course won't come. This causes the server to
   periodically re-try sending that packet, and the client ACKing it
   each time.

Steps 7-9 cause annoyances and erroneous output, but don't cause
the connection failure itself.
The actual mistake that causes the connection failure happens in 6:
The server does not assign the dummy packet to the correct peer, but
to a newly created one.
Therefore, all further packets sent by the client on channel 0 are
now buffered by the server as it waits for the dummy packet to reach
the peer, which of course doesn't happen as the server assigned
that packet to the second peer it created for the client.
This makes the connection code indefinitely buffer the
TOSERVER_CLIENT_READY packet, not passing it to higher level code,
which stalls the continuation of the further init process
indefinitely and causes the actual bug.

Maybe this can be caused by reordered init packets as well, the only
studied case was where network has reliably reordered the dummy
packet to get sent after the init packets.

The patch fixes the bug by not ignoring peers where
m_has_sent_with_id has been set anymore. The other changes of the
patch are just cleanups of unused methods and fields and additional
explanatory comments.

One could think of alternate ways to fix the bug:

* The client could simply take the new peer id and continue
  communicating with that. This is however worse than the fix as
  it requires the peer id set command to be sent reliably (which
  currently happens, but it cant be changed anymore). Also, such a
  change would require both server and client to be patched in order
  for the bug to be fixed, as right now the client ignores peer id
  set commands after the peer id is different from
  PEER_ID_INEXISTENT and the server requires modification too to
  change the peer id internally.
  And, most importantly, right now we guarantee higher level server
  code that the peer id for a certain peer does not change. This
  guarantee would have to be broken, and it would require much
  larger changes to the server than this patch means.

* One could stop sending the dummy packet. One may be unsure whether
  this is a good idea, as the meaning of the dummy packet is not
  known (it might be there for something important), and as it is
  possible that the init packets may cause this problem as well
  (although it may be possible too that they can't cause this).

Thanks to @auouymous who had originally reported this bug and who
has helped patiently in finding its cause.
2016-05-22 15:56:54 +02:00
Loic Blot
f64a6259b2 Fix a m_camera not used warning fix pointed by clang 2016-05-22 13:31:41 +02:00
Loic Blot
ce42ff9cf7 Implement a PostgreSQL backend 2016-05-22 11:34:47 +02:00
Craig Robbins
88acda0256 Fix tooltip height for versions of irrlicht < 1.8.2
Version 1.8.2 of irrlicht changed the way that IGUIStaticText::getTextHeight() works and since that release properly deals with newlines.

From irrlicht changes.txt for 1.8.2, "IGUIStaticText::getTextHeight returns now the correct height for texts with newlines even WordWrap is not set."
2016-05-21 00:26:04 +10:00
nerzhul
8ba6d9f227 Implement DatabaseException for databases 2016-05-17 14:36:51 +02:00
Loic Blot
143401451c DB::loadBlock copy removal & DB backend cleanup
* Remove the copy from db::loadBlock by using a pointer to the destination
* cleanup db backend, the child backend doesn't have to set their functions as virtual
2016-05-17 06:52:16 +02:00
Craig Robbins
8bb9e467d6 Fix typo in the info printed by --version 2016-05-11 23:20:20 +10:00
Craig Robbins
58b54cf9a9 Add platform name to --version information 2016-05-11 17:15:41 +10:00
kwolekr
ebe638c32d Mapgen V6: Synchronize spflags with defaultsettings
This fixes an issue where trees are omitted from Mapgen V6 maps on
configurations that explicitly defined the mgv6_spflags setting.
2016-05-10 22:44:18 -04:00
SmallJoker
53e9587861 Add [resize texture modifier Resizes the texture to the given dimensions. 2016-05-09 20:48:42 +02:00
paramat
1db499dc6d Defaultsettings/Android: Increase 'max block generate distance' to 3 2016-05-08 22:08:29 +01:00
gregorycu
b8aed9dfc2 Fixes #4098 ce8a9ed didn't quite go far enough, and left this bug in 2016-05-08 19:03:09 +10:00
Kahrl
2cdd9b4ab6 Chat: Keep scroll position constant in ChatBuffer::deleteOldest() 2016-05-08 02:51:23 +01:00
Maksim Gamarnik
0f6e4a0913 Optimize default settings for Android build 2016-05-07 21:09:07 +10:00
Ekdohibs
4d9dbceb39 Run unescape_enriched *after* unescape_string.
Doing it the other way round was a mistake, since it breaks
minetest.formspec_escape with escape sequences that contain
special characters.
2016-05-07 08:33:21 +02:00
Ekdohibs
d5c3db9c41 Make dropdowns show the string that was their argument.
This makes it work even if it contains escape sequences,
which didn't work before.
2016-05-07 08:33:21 +02:00
Maksim Gamarnik
bb925479a5 Android: Increase player_stepheight for thicker snow nodebox 2016-05-06 00:32:35 +01:00
est31
063be8a126 Update settings translation file and minetest.conf.example 2016-05-05 16:12:58 +02:00
Craig Robbins
d864c13333 Fix holding down F10 (open console) causing GUI to freeze 2016-05-04 21:31:23 +10:00
paramat
b22de6470b Settings_translation_file: Update mapgen with cave width parameter 2016-05-03 00:44:34 +01:00
Craig Robbins
c92cff5d52 Fix Windows build
Fixes the issue introduced by c1a0ebb (Fix use of uninitialised variable
in class Event) causing Windows builds to fail
2016-05-02 15:01:17 +10:00
Kahrl
8fe753c3d9 FileSelectMenu: Fix formspec parsing broken by Irrlicht file-chooser 2016-05-01 16:32:12 +02:00
Auke Kok
aa8c88cf4a find_path: consider walkable instead of CONTENT_AIR
The path finding code works fairly well except that it considers
anythin not CONTENT_AIR to be "above the surface". This results in
paths that are unwalkable for entities since e.g. plants are not
walkable. The path would force them to jump on top of grass plants,
etc..

The obvious solution is not to use CONTENT_AIR as a criteria, but
instead distinguish between walkable and non-walkable nodes. This
results in paths that properly walk through grass nodes.

This was extensively tested by a flock of electric sheep.

Note that for underwater purposes this changes the behaviour from
"the surface is walkable" to "ignore water entirely" making the
path go across the water bottom, and pathing fail likely from the
water surface. This is intentional.
2016-05-01 15:32:03 +02:00
est31
9aec701a4c Pathfinder: improve GridNode storage
Before, the GridNodes were stored in vector<vector<vector<T>>>,
and initialized in advance. Putting three vectors inside each other
puts lots of unneccessary stress onto the allocator, costs more memory,
and has worse cache locality than a flat vector<T>.

For larger search distances, an the array getting initialized means
essentially O(distance^3) complexity in both time and memory,
which makes the current path search a joke. In order to really
profit from the dijkstra/A* algorithms, other data structures
need to be used for larger distances.

For shorter distances, a map based GridNode storage may be slow as
it requires lots of levels of indirection, which is bad for things like
cache locality, and an array based storage may be faster.

This commit does:

1. remove the vector<vector<vector<T>>> based GridNodes storage that
	is allocated and initialized in advance and for the whole
	possible area.

2. Add a vector<T> based GridNodes storage that is allocated and
	initialized in advance for the whole possible area.

3. Add a map<P,T> based GridNodes storage whose elements are
	allocated and initialized, when the path search code
	demands it.

4. Add code to decide between approach 2 and 3,
	based on the length of the path.

5. Remove the unused "surfaces" member of the PathGridnode class.
	Setting this isn't as easy anymore for the
	map based GridNodes storage.
2016-05-01 15:32:03 +02:00
est31
f0de237de7 Pathfinder: use core::aabbox3d instead of own type
There is no need to reinvent the wheel here, we have
great classes from irrlicht.
2016-05-01 15:32:03 +02:00
est31
ac8bb457aa Pathfinder: Fix style
* Fix naming style for methods and classes:
	Use camelCase for methods and PascalCase for classes as
	code style demands it. And use sneak_case for methods that
	are not member of a class.
* Replace "* " with " *" for Pointers
* Same for references
* Put function body opening braces on new line
* Other misc minor non functional style improvements
2016-05-01 15:32:02 +02:00
est31
46e5ef4e9a Move pathfinder classes to cpp file
There is no need to put them into the header, they are solely used
inside the pathfinder.

Another advantage of this change is that only the pathfinder.cpp has
to be compiled if PATHFINDER_DEBUG gets defined or undefined, not
all files including the .h.

This commit moves the pathfinder classes to the cpp file without
modifications.
Also, the PATHFINDER_DEBUG macro gets moved to the cpp file and
the PATHFINDER_CALC_TIME macro gets moved to a plce where it
actually does work.
2016-05-01 15:32:02 +02:00
Craig Robbins
c1a0ebb725 Fix use of uninitialised variable in class Event 2016-05-01 17:32:00 +10:00
gregorycu
c95734654c Use MoveFileEx to rename files on Windows (not rename) 2016-05-01 17:28:16 +10:00
ShadowNinja
a53357d291 Fix POSIX C++11 build
I broke this in 46fd114e9a.
2016-04-30 13:41:04 -04:00
Craig Robbins
ae75073944 Fix prepreprocessor error in thread.h (related to C++11 threads) 2016-04-30 12:29:52 +10:00
paramat
8b1f8e99cf Mapgen: Make 3D noise tunnels' width settable
Correct parameter names mg_valleys to mgvalleys
Remove biome NoiseParams from MapgenValleysParams
Improve format of parameter code
2016-04-28 23:36:19 -04:00
ShadowNinja
46fd114e9a Fix race on thread creation
This often broke the threading tests on OSX.
2016-04-28 13:21:46 -04:00
SmallJoker
30083d1e00 Mainmenu: Standardize the menu button order and sizes 2016-04-28 07:16:58 +01:00
obneq
6278da296b Handle particle spawners in env and delete expired ids
Rebased by Zeno (2016-04-2016)
2016-04-28 02:09:36 +10:00
Xunto
ae7fb9b5be Inventory: Make ItemStack with different metadata not stackable 2016-04-26 10:16:20 +01:00
SmallJoker
31c1fca6fd tile.cpp: Automatically upscale lower resolution texture 2016-04-25 06:39:32 +01:00
gregorycu
46da0e8b3b Make GUIEngine use pause_fps_max not fps_max 2016-04-24 17:40:16 +10:00
Ekdohibs
48939df9a5 Escape more strings: formspecs, item descriptions, infotexts...
Also, change the escape character to the more standard \x1b
Thus, it can be used in the future for translation or colored text,
for example.
2016-04-24 03:54:11 +10:00
Xunto
21079cc8eb Fix bug that was leading to oversized tooltips containing multiline text when it have multiple lines 2016-04-23 21:12:53 +10:00
Ekdohibs
c350cfb50b Make logging use a fixed-length buffer to avoid race conditions.
Previously, race conditions occurred inside logging, that caused
segfaults because a thread was trying to use an old pointer that
was freed when the string was reallocated. Using a fixed-length buffer
avoids this, at the cost of cutting too long messages over seveal lines.
2016-04-21 10:15:17 +01:00
paramat
5c32c5e945 Biomes: Make dust fallback 'ignore' to fix y = 63 lighting
The shadow bug at y = 63 was caused by dark air being placed as dust,
when the biome dust was unspecified it was falling back to 'air'
In dustTopNodes only dust == 'ignore' will disable dust placement
2016-04-21 10:15:12 +01:00
paramat
fed5dd3b5d Mgv7: Combine mountain terrain generation with base terrain generation
Previous mountain terrain generation was by necessity placing
stone in air, this was removing air from any overgenerated
structures such as tunnels, dungeons and large caves
Moving it into the base terrain generation loop ensures that
only 'ignore' is replaced

generateRidgeTerrain: only return if node_max.Y < water_level - 16
Previously, if water level was set a few nodes above a mapchunk
border the river channel was only partially excavated
2016-04-20 06:51:20 +01:00
TriBlade9
6530ed4dd8 Add option to disable entity selectionboxes. (#3992)
Setting only loaded once, default value is to enable them.
2016-04-14 11:20:11 +02:00
rubenwardy
b5f6d41eed Fix inventory hud scaling 2016-04-12 23:10:28 +10:00
paramat
4fdf66bbf4 Mgv7, mgflat, mgfractal: Tunnel generation code optimisation 2016-04-12 06:58:04 +01:00
paramat
e661d8b32c Mgv5: Optimise tunnels, add biome material in entrances
Place biome top node on tunnel entrance floor
Instead of doing nothing at node_max.Y + 1 use 1-down
overgeneration for tunnel generation and noisemaps
2016-04-12 04:16:15 +01:00
paramat
fe349d401d Mgvalleys: Don't let cavegen place biome nodes everywhere
Fix use of 'air_above' bool so that biome
nodes are only placed in tunnel floors
Minor code improvements
'Continue' when massive cave air is placed
2016-04-12 04:16:08 +01:00
PilzAdam
73d4538d94 Fix hotbar placement on displays with low screen density 2016-04-11 23:04:42 +02:00
kwolekr
2eeb62057a Hud: Cache hud_scaling, fix minor style issues 2016-04-10 23:54:34 -04:00
rubenwardy
eae33951ad Hud: Fix offset being ignored by inventory bar 2016-04-10 23:54:23 -04:00
est31
9a04dfd0f5 Update CSRP-GMP to commit deaa11a7c29a73008
Backports 10 commits, with 8 commits
actually affecting source code:

695822e45d...deaa11a7c2
2016-04-10 14:56:54 +02:00
paramat
465bb6f5d1 Mapgen: Optimise cave noises and tunnel excavation
Instead of doing nothing at node_max.Y + 1 use 1-down
overgeneration for tunnel generation and noisemaps
Move some old unused code in mgv7 to end of file
2016-04-08 03:14:36 +01:00
kwolekr
c3993f6604 Re-add and disable blit_with_interpolate_overlay 2016-04-07 04:01:43 -04:00
Nathanaël Courant
15e1dcc020 Fix #3955 (player dying on login).
It was caused by player not moving because fall was prevented, but their
velocity still increasing, causing fatal fall damage when world was
finally loaded. This commit fixes it by setting player velocity to zero
when the world around them is not loaded.
2016-04-06 01:11:36 +02:00
Samuel Sieb
24b32ab09d Fix compiler warnings from "Add an option to colorize to respect the destination alpha"
Fix warnings added by commit 01ae43c480

Fixes #3952
2016-04-06 00:36:24 +02:00
Samuel Sieb
01ae43c480 Add an option to colorize to respect the destination alpha
Also, rework the colorizing code to be more efficient.
2016-04-03 04:24:28 -04:00
kinokoio
66af984e0e Dungeongen: Update disabled torch placement code 2016-04-03 04:12:07 -04:00
est31
b8ac7b80e6 Fix nametag hiding
Commit

c3b279750e "Move object nametags to camera"

has added a regression to still display
a shadow if their alpha got set to 0.
2016-04-02 02:02:19 +02:00
gregorycu
f9a90383e1 Remove expensive copy of ContentFeatures 2016-03-30 11:38:42 -04:00
Loic Blot
e082c7766a ParticleManager::handleParticleEvent: use switch
Use a proper switch with breaks.
2016-03-30 17:20:24 +02:00
est31
0aac1b7403 mg_schematic: fix leak in lua API, and small cleanup
* Fix leak like behaviour if you load multiple schematics in a loop.

* Cleanup check in for, fixing theoretical out of bounds read if
	Schematic::deserializeFromMts reduced the number of elements
	in m_nodenames. A != check may need an overflow of the counter
	before it hits, if origsize is larger than m_nodenames.size().

* Fix function name passed to errorstream: it was wrong. Also use
	__FUNCTION__ instead of manually using the method name at other
	places in the function.

* Don't shadow the name member in the loop.
2016-03-30 16:26:05 +02:00
kwolekr
0115da1d63 Mapgen: Don't spread light of nodes outside the desired area
This fixes #3935, a regression from 0338c2e.
An 'optimization' was performed where an index for the VoxelManip being
operated on was mistakenly used for bounds checking within the incorrect
VoxelArea, namely, the area wherein light should be spread.
2016-03-30 00:19:03 -04:00
paramat
630f453da4 Mgv7: Decrease cliff steepness 2016-03-30 01:53:14 +01:00
kwolekr
0338c2eb91 Mapgen: Spread both night and day light banks in spreadLight 2016-03-29 16:32:30 -04:00
sfan5
8f43aaf6ae Fix small formatting issue in SRP debug output
Writing an u8 to verbosestream writes a char, not it's numeric value.
2016-03-29 19:59:14 +02:00
Auke Kok
80cec4702d Fix connected nodes' selection boxes.
This allows the player to more easily target and punch connected
nodeboxes, especially if they have a fixed nodebox that is very
small, like technic cabling, or xpanes. Tried it on fences and
my xpane conversion, and happy with the result.
2016-03-21 17:42:20 +00:00
paramat
493a298c0c Mgv7/flat/fractal: Stop tunnel-floor biome nodes being placed everywhere
A bool for 'in or under tunnel' was missing
1-node-deep stone ledges were being
replaced with biome surface material
2016-03-21 17:42:13 +00:00
ShadowNinja
93887043d9 Clean up Strfnd
Changes:
  * Fix indentation.
  * Pass strings by const reference.
  * Merge Strfnd and WStrfnd into one class instead of copying them.
  * Remove trailing spaces.
  * Fix variable names.
  * Move to util.
  * Other miscellaneous style fixes.
2016-03-19 21:27:57 -04:00
paramat
f1aea6b4ff Mgv7: Limit pseudorandom caves to surface mapchunk or below
To avoid bright caves at mapchunk borders when generating mapchunks upwards
2016-03-19 17:56:35 +00:00
Auke Kok
c5c727d627 Allow NodeTimer, ABM and block mgmt interval changes.
ABM's are hardcoded to run every 1.0s, NodeTimers are hard coded to
run at every 1.0s. Block mgmt is running every 2.0sec.

However, these timers can be better tuned for both higher and lower
values by server owners. Some server owners want to, and have the
resources to send more packets per second to clients, and so they
may wish to send smaller updates sooner. Right now all ABM's are
coalesced into 1.0 second intervals, resulting in large send queues
to all clients. By reducing the amount of possible timers, one can
get a far better response rate and lower the perception of lag.

On the other side of the camp, some servers may want to increase
these values, which again isn't easily doable.

The global settings abm_interval and nodetimer_interval are set to
current values by default. I've tested with 0.2/0.5 type values
and noticed a greatly improved response and better scattering of
nodetimers, as well as enjoying not faceplanting into doors with
pressure plates anymore.
2016-03-19 17:56:26 +00:00
Ekdohibs
095f623fa7 Remove chat escape sequences from chat messages, for future colored chat. 2016-03-15 17:33:15 +01:00
est31
af30183124 Add option to not send pre v25 init packet
The legacy init packet (pre v25) sends information about the client's
password that a server could use to log in to other servers if the
username and password are the same. All the other benefits of SRP of
protocol v25 are missed if the legacy init packet is still sent during
connection creation.

This patch adds an option to not send the v25 init packet. Not sending
the v25 packet means breaking compat with pre v25 servers, but as the
option is not enabled by default, no servers are affected unless the
user explicitly flips the switch. More than 90% of the servers on the
serverlist support post v25 protocols.

The patch also fixes a bug with greying out of non compliant servers
being done wrongly, the min and max params were mixed.
2016-03-15 17:20:09 +01:00
est31
2607b97b4f Fix two reconnect bugs
Fix two bugs related to the reconnect feature
introduced by commit

3b50b2766a "Optional reconnect functionality"

1. Set the password to the stored one

Before, we have done the reconnect attempt with a
cleared password, so using the feature would only
work if you had an empty password.
Thanks to @orwell96 for reporting the bug.

2. Reset the reconnect_requested flag after its use

the_game only writes to the reconect_requested flag
if it sets it to true. It never sets it to false.
If the flag is not reset after its use, all "reset"s
to the main menu will look like the server had
requested a reconnect.
2016-03-15 08:55:45 +01:00
est31
e0151d1054 Much better API for auth.{cpp, h}
* No function overloading
* Adhere coding style and with method names following
  lowercase_underscore_style
* Use std::string in external API, handling these is
  much more fun
2016-03-15 05:55:49 +01:00
paramat
bb2ee54d3b Mapgen: Fix light in tunnels at mapchunk borders
Don't excavate the overgenerated stone at node_max.Y + 1,
this creates a 'roof' over the tunnel, preventing light in
tunnels at mapchunk borders when generating mapchunks upwards.
2016-03-14 08:45:01 +00:00
HybridDog
c0b6986e38 Fix player teleportation bug whilst sneaking
Only set back position when sneaking if player wasn't teleported by adding and using a bool "got_teleported" to player
it fixes #2876
2016-03-14 08:44:28 +00:00
Auke Kok
5a40a7dad8 Connected nodes: fix 2 minor bugs
1. Copy-paste error: properly test for back-connection.

In the case of two different connected nodebox types, we want to
assure that if A connects to B, that B also connects to A. This test
was accidentally not implemented correctly.

2. Clear the connects_to_ids before deserializing.

With each new connected node, the deserialization code added more
and more targets to the map, since the map wasn't cleared in between
deserialization steps. This caused e.g. wall blocks to connect to
things in the fence connects_to map.
2016-03-14 05:05:04 +01:00
Jeija
089f9bbe81 Resend blocks when modified while sending to client 2016-03-12 23:59:44 +01:00
Diego Martinez
2c72f6da7b Add options for screenshot format and quality 2016-03-12 17:12:43 -05:00
Auke Kok
37b4f0d34c Allow nodes to specify which sides to connect to.
NDT_CONNECTED attempts to connect to any side of nodes that it can
connect to, which is troublesome for FACEDIR type nodes that generally
may only have one usable face, and can be rotated.

We introduce a node parameter `connect_sides` that is valid for
any node type. If specified, it lists faces of the node (in "top",
"bottom", "front", "left", "back", "right", form, as array) that
connecting nodeboxes can connect to. "front" corresponds to the south
facing side of a node with facedir = 0.

If the node is rotatable using *simple* FACEDIR, then the attached
face is properly rotated before checking. This allows e.g. a chest
to be attached to only from the rear side.
2016-03-12 12:08:17 -05:00
Auke Kok
e737b1c271 Nodebox: Allow nodeboxes to "connect"
We introduce a new nodebox type "connected", and allow these nodes to
have optional nodeboxes that connect it to other connecting nodeboxes.

This is all done at scenedraw time in the client. The client will
inspect the surrounding nodes and if they are to be connected to,
it will draw the appropriate connecting nodeboxes to make those
connections.

In the node_box definition, we have to specify separate nodeboxes for
each valid connection. This allows us to make nodes that connect only
horizontally (the common case) by providing optional nodeboxes for +x,
-x, +z, -z directions. Or this allows us to make wires that can connect
up and down, by providing nodeboxes that connect it up and down (+y,
-y) as well.

The optional nodeboxes can be arrays. They are named "connect_top,
"connect_bottom", "connect_front", "connect_left", "connect_back" and
"connect_right". Here, "front" means the south facing side of the node
that has facedir = 0.

Additionally, a "fixed" nodebox list present will always be drawn,
so one can make a central post, for instance. This "fixed" nodebox
can be omitted, or it can be an array of nodeboxes.

Collision boxes are also updated in exactly the same fashion, which
allows you to walk over the upper extremities of the individual
node boxes, or stand really close to them. You can also walk up
node noxes that are small in height, all as expected, and unlike the
NDT_FENCELIKE nodes.

I've posted a screenshot demonstrating the flexibility at
    http://i.imgur.com/zaJq8jo.png
In the screenshot, all connecting nodes are of this new subtype.

Transparent textures render incorrectly, Which I don't think is
related to this text, as other nodeboxes also have issues with this.

A protocol bump is performed in order to be able to send older clients
a nodeblock that is usable for them. In order to avoid abuse of users
we send older clients a "full-size" node, so that it's impossible for
them to try and walk through a fence or wall that's created in this
fashion. This was tested with a pre-bump client connected against a
server running the new protocol.

These nodes connect to other nodes, and you can select which ones
those are by specifying node names (or group names) in the
connects_to string array:
      connects_to = { "group:fence", "default:wood" }
By default, nodes do not connect to anything, allowing you to create
nodes that always have to be paired in order to connect. lua_api.txt
is updated to reflect the extension to the node_box API.

Example lua code needed to generate these nodes can be found here:
    https://gist.github.com/sofar/b381c8c192c8e53e6062
2016-03-12 12:08:17 -05:00
ShadowNinja
8c951cae5b Fix chat console not opening after formspec opened over it
The MainMenuManager set the console invisible when a
formspec opened over it, but didn't properly close it,
and the chat console never set itself visible again.
2016-03-12 12:01:40 -05:00
paramat
20312fda18 Documentation: Auto-update conf.example and settings_translation_file.cpp 2016-03-12 04:03:43 +00:00
orwell96
0d2df732e5 Fix ask_reconnect_on_crash option being ignored
Since commit

3b50b2766a "Optional reconnect functionality"

there is a config option named ask_reconnect_on_crash.
It asks the client to reconnect to the server if the server crashed.
It has been implemeted and works, but due to a function parameter not
being passed it never showed effect. This patch adds the parameter
and fixes the bug.

Also fixes the `reconnect` option of minetest.request_shutdown being ignored.
2016-03-11 23:43:37 +01:00
Auke Kok
dc8bf4e928 Avoid try/catch for settings.
We can just test for the presence of these settings nicely here,
no need to use a try / catch construct.
2016-03-09 01:45:23 +01:00
Auke Kok
4e59fcf5c1 Add consistent monotonic day counter - get_day_count()
I've written several experimental bits of code that revolve around the
need for a consistent calendar, but implementing one is extremely hard
in mods due to time changes and mods overriding core.get_timeofday(),
which will conflict.

The second part of the problem is that doing this from a mod requires
constant maintenance of a settings file.

An implementation in core is trivial, however, and solves all of
these problems at virtually no cost: No extra branches in server
steps, and a single branch when minetest.set_time_of_day(), which is
entirely reasonable.

We store the day_count value in env_meta.txt.

The use case is obvious: This change allows mods to create an actual
virtual calendar, or properly account for seasonal changes, etc..

We add a "/days" chatcommand that displays the current day count. No
permissions are needed. It can only retrieve the day count, not
modify it.
2016-03-09 01:45:23 +01:00
ShadowNinja
3ce6642a26 Add AreaStore custom ID API 2016-03-07 16:33:20 -05:00
ShadowNinja
821551a266 Implement AreaStore serialization 2016-03-07 16:33:20 -05:00
ShadowNinja
c4b7afed7e Fix SpatialAreaStore not freeing removed areas 2016-03-07 16:33:20 -05:00
ShadowNinja
8ae1e1f4d2 Add basic AreaStore method documentation 2016-03-07 16:33:20 -05:00
ShadowNinja
6e9d71342a Sort AreaStore header 2016-03-07 16:33:20 -05:00
ShadowNinja
5641da43d6 Clean up VectorAreaStore 2016-03-07 16:33:20 -05:00
ShadowNinja
2e74e9ee20 Move AreaStore container selection logic into getOptimalImplementation 2016-03-07 16:33:20 -05:00
ShadowNinja
0079887b64 Move AreaStore to util 2016-03-07 16:33:20 -05:00
ShadowNinja
f021db7243 Make AreaStore cache setting private 2016-03-07 16:33:20 -05:00
ShadowNinja
095db16990 Simplify AreaStore ID management 2016-03-07 16:33:20 -05:00
est31
725cb4eb07 s_env.{cpp, h} cleanups
* Replace string by-val passing with const reference
* Fix code style
* Remove redundant `int table` definition and indentation level
2016-03-07 19:54:26 +01:00
est31
d494733839 Add minetest.register_lbm() to run code on block load only 2016-03-07 19:54:26 +01:00
ShadowNinja
88fbe7ca1e Use LuaErrors in security check macros
Throwing a LuaError calls destructors as it propagates up the stack,
wheres lua_error just executes a longjmp.
2016-03-07 13:37:15 -05:00
Duane Robertson
af714c7ade Mgvalleys: Correct spawn problems
Increase maximum spawn altitude to reduce spawn issues.
2016-03-04 02:39:04 +00:00
paramat
48a718e715 Decoration API: Allow force_placement of simple decorations 2016-03-04 02:38:55 +00:00
Jeija
1100a5d614 Require minetest.request_http_api to be called from the mod's main scope
Fixes #3764
2016-03-03 22:42:00 +01:00
ShadowNinja
7bcbc0105b Fix main menu being unable to set secure settings 2016-03-03 00:57:19 -05:00
ShadowNinja
abd4a79acb Remove debug.getupvalue from the Lua sandbox whitelist
This function could be used to steal insecure environments from trusted mods.
2016-03-03 00:09:05 -05:00
ShadowNinja
8b006a154b Add support for non-ASCII characters to chat console
This still only supports 256 characters, but that's because
Irrlicht's clipboard handlers don't support wide characters.
2016-03-02 23:23:31 -05:00
ShadowNinja
9dd38cf968 Add Android chat form 2016-03-02 23:23:31 -05:00
ShadowNinja
430929e75a Add text selection and copying to console 2016-03-02 23:23:31 -05:00
ShadowNinja
3edb7575a1 Unlock cursor when opening console 2016-03-02 23:23:31 -05:00
Esteban I. Ruiz Moreno
effa24737d Use the console instead of a dedicated window when pressing keymap_chat/cmd
keymap_console opens a full window for chat history browsing.
2016-03-02 23:23:31 -05:00
nerzhul
ee50341297 Revert "Fix jumping at node edge"
This reverts commit 60dc01dc25.

This fixes issue #3773
2016-03-01 11:15:14 +01:00
paramat
6359ff9a87 Nodedef: Restore smooth lighting to water 2016-02-27 21:27:42 +00:00
Duane Robertson
6969dd4224 Mgvalleys: Add Dry Riverbeds
Lower water table where base humidity is low.
Alter heat and humidity to compensate for river humidity and altitude
chill.
Correct misuse of surface_max_y in generateTerrain.
Remove sand trails in the water at river mouths.
Remove river water below water_level.
Correct heat/humidity calculations where noises are less than zero.
Correct heightmap errors as much as possible.
Make humidity calculations more readable.
2016-02-27 21:27:32 +00:00
est31
158bd76e87 Update po files, minetest.conf.example and settings_translation_file.cpp 2016-02-27 05:50:42 +01:00
Jeija
033a510cf3 Fix minetest.request_insecure_environment() always returning nil
Fixes #3765
2016-02-26 06:36:48 +01:00
RealBadAngel
f9d727764f Mapblock mesh: Allow to use VBO 2016-02-26 00:51:01 +00:00
RealBadAngel
8eb7ddb0a2 Remove new_style_water 2016-02-26 00:50:46 +00:00
rubenwardy
4efb7eb734 Cache some settings 2016-02-26 00:50:39 +00:00
paramat
8591713405 Sheet Ore: Eliminate crash caused by PcgRandom range max < min
In the calculation of y_start,
when 'column height max' was large it caused
nmin.Y + max_height > nmax.Y - max_height
Now, in this situation y_start is set to the
midpoint between nmin.Y and nmax.Y

Limit y0 and y1 to between nmin.Y and nmax.Y,
otherwise index calculation, which has no checks for limits,
places them at unwanted locations in the voxelmanip
2016-02-23 23:51:29 +00:00
nerzhul
147425483a GOTBLOCKS & DELETEBLOCKS: test packet size only once 2016-02-23 14:24:21 +01:00
orwell96
e17fbb31d6 Reset block send timer when invoking setBlock(s)NotSent()
As stated in this forum thread [1], I noticed that there is a
2 second interval in which inventory changes are shown on the
client. @yyt16384 found the source of these 2 seconds:
m_nothing_to_send_pause_timer is set to 2.0 every time there
are no changes to make, but this timer is not reset when
SetBlockNotSent or setBlocksNotSent are invoked. So in worst
case, the changed block will be sent over 2 seconds too late.

With this change, changed inventories are updated almost
immediately, but it causes additional connection load.
2016-02-22 19:59:56 +01:00
RealBadAngel
9961185550 Fix getting pointed node
Fixes #3719
Closes #3753
2016-02-22 15:54:32 +01:00
Jeija
31e0667a4a Add Lua interface to HTTPFetchRequest
This allows mods to perform both asynchronous and synchronous HTTP
requests. Mods are only granted access to HTTP APIs if either mod
security is disabled or if they are whitelisted in any of the
the secure.http_mods and secure.trusted_mods settings.

Adds httpfetch_caller_alloc_secure to generate random, non-predictable
caller IDs so that lua mods cannot spy on each others HTTP queries.
2016-02-22 15:39:41 +01:00
Jeija
a3892f5a66 Fix HTTPFetchRequest performing a GET request if post_data is supplied
Instead, perform a POST request with post_data.
2016-02-22 15:39:19 +01:00
RealBadAngel
b2aabdfe07 Camera: remove auto tune FPS, single view range setting 2016-02-21 18:18:13 +01:00
RealBadAngel
2f4cf0bcca Remove preload_item_visuals code
Closes #3748
2016-02-21 17:46:50 +01:00
RealBadAngel
354635f9fb Dont make fastface if tile is not seamless
Fixes #3378
Closes #3751
2016-02-21 17:30:16 +01:00
Loic Blot
c6d7d2097c Little collision.cpp cleanups 2016-02-20 09:44:22 +01:00
gregorycu
60dc01dc25 Fix jumping at node edge 2016-02-19 20:05:58 -05:00
ShadowNinja
a44393e43a Don't print locale directory error message when GetText is disabled
Also, downgrade the error to a warning.
2016-02-19 19:56:34 -05:00
Jeija
1b9aef43c9 Ignore spaces in secure.trusted_mods setting 2016-02-19 18:50:42 -05:00
RealBadAngel
5f4ed94d90 Minimap: show player markers 2016-02-19 21:31:22 +01:00
RealBadAngel
5dbaa68967 Camera: Don't count camera offset twice for Nametagged CAOs 2016-02-19 14:52:19 +00:00
ShadowNinja
4827ee1258 Require request_insecure_environment to be called from the mod's main scope
Previously you could steal a secure environment from a trusted mod by wrapping
request_insecure_environment with some code like this:

local rie_cp = minetest.request_insecure_environment
local stolen_ie
function minetest.request_insecure_environment()
	local ie = rie_cp()
	stolen_ie = stolen_ie or ie
	return ie
end
2016-02-19 14:52:10 +00:00
paramat
997be666e3 Clientmap: Define p_nodes_min/max as v3s32 instead of v3s16
'cam_pos_nodes -/+ box_nodes_d' can exceed the range of v3s16
when a player is near the world edge using a large view range
This previously caused world to disappear
Create new function getBlocksInViewRange() called from
updateDrawList() and renderMap()
Correct code style throughout updateDrawList() and renderMap()
2016-02-19 14:51:41 +00:00
RealBadAngel
1ec1a605d6 HOTFIX: fix too agressive block culling 2016-02-18 18:07:28 +01:00
RealBadAngel
c3b279750e Move object nametags to camera 2016-02-18 16:43:29 +01:00
est31
4c654557ec Clientiface: remove "value is dummy" from docs
Commit

6a1670dbc3 "Migrate to STL containers/algorithms."

has replaced core::map<T, bool> with std::set<T>, but didn't update
the accompanying comment saying "value is dummy". This happened at
two places.
2016-02-16 23:58:30 +01:00
RealBadAngel
08517244f7 Mapblock mesh: Eliminate meshgen lags 2016-02-16 08:23:32 +00:00
RealBadAngel
7ea40e45b1 Use vertices with tangents only when its needed. 2016-02-15 06:05:39 +00:00
Loic Blot
3a74b84007 Player::accelerateHorizontal/Vertical should be member of LocalPlayer 2016-02-14 17:52:10 +01:00
RealBadAngel
cfc8e44759 Use proper variable types for uniform sampler layers 2016-02-14 10:01:30 +01:00
RealBadAngel
c17c40a0f5 Formspec: fix broken irrlicht 1.7 build
Fixes #3701.
2016-02-13 22:19:01 +01:00
RealBadAngel
5ca48a35a6 Formspec: recreate item_image_button pressed state for its image and label 2016-02-13 02:35:52 +01:00
est31
bd43933828 Remove unused 'm_selection_active' field
Thanks @ExcaliburZero for noticing. Fixes #3698.
2016-02-13 01:46:12 +01:00
nerzhul
fefa148d69 v2d & aabbox3d<f32> & sky cleanups
* Sky: rename Box => m_box and inline getBoundingBox
* Uniformize aabbox3d<f32> to aabb3f
2016-02-11 16:55:15 +01:00
Loic Blot
24b312cc08 Drop luaentity_common.h which is not included anywhere 2016-02-11 14:34:34 +01:00
RealBadAngel
9357294cfc Use single box for halo mesh 2016-02-11 13:11:25 +01:00
RealBadAngel
c1044b9a4a Set proper GLSL pixel shader version 2016-02-11 09:47:25 +01:00
RealBadAngel
f253ff9f1a Dump shader programs on compile errors 2016-02-11 07:13:07 +01:00
Kahrl
b1428ab4bb Add '/clearobjects quick' 2016-02-11 04:22:58 +00:00
Auke Kok
47464c9344 Fix backface culling when connecting to new servers.
Introduce a new contentfeatures version (8). When clients
connect using v27 protocol version, they can assume that
the tiledef.backface_culling is trustable, but if clients
connect to servers providing contentfeatures version 7,
then the v27 clients know that backface culling settings
provided by the server in tiledefs are bogus for mesh,
plantlike, firelike or liquid drawtype nodes.

thanks to hmmmm, est31, nerzhul.

Tested on new client - new server, new client - old server
old client - new server.
2016-02-10 00:10:51 +01:00
Loic Blot
ba8fa9e889 Fix inverted conditions in shader.cpp 2016-02-09 23:50:37 +01:00
Loic Blot
4e3fe460e3 shader.cpp: don't test twice if shader programs are present
Also use string::empty method, it is better than comparing with empty strings.
2016-02-09 23:19:19 +01:00
RealBadAngel
baa7c8f8ad FormSpec: Add StaticTextSpec and superimpose over item image buttons 2016-02-09 03:03:55 -05:00
RealBadAngel
eb3840a3f8 Filmic HDR tone mapping 2016-02-09 02:55:59 -05:00
Kahrl
180893e79d Remove ClientMap::m_camera_mutex
All places that lock this mutex are only called by the main thread:
ClientMap::updateCamera(), ClientMap::updateDrawList(), ClientMap::renderMap(), ClientMap::renderPostFx().
2016-02-09 07:16:00 +00:00
paramat
4adbd69a37 FindSpawnPos: Let mapgens decide what spawn altitude is suitable
To avoid spawn search failing in new specialised mapgens
Increase spawn search range to 4000 nodes
Add getSpawnLevelAtPoint() functions to EmergeManager, class Mapgen
and all mapgens
Remove getGroundLevelAtPoint() functions from all mapgens except mgv6
(possibly to be re-added later in the correct form to return actual
ground level)
Make mgvalleys flag names consistent with other mapgens
Remove now unused 'vertical spawn range' setting
2016-02-09 07:14:45 +00:00
RealBadAngel
38e7122600 Use inventory_image in the first place for inventory item mesh 2016-02-08 23:13:19 +01:00
RealBadAngel
b44da4916a Cleanup selection mesh code, add shaders for halo and selection boxes 2016-02-08 03:57:42 -05:00
est31
16c7008771 small drawItemStack cleanup
-> Replace the three bool params with an enum
-> Add struct for the static content, leads to less repetition
-> cache enable_animations setting
2016-02-08 00:35:24 +01:00
RealBadAngel
6cd2b3b445 Use meshes to display inventory items 2016-02-07 19:51:55 +01:00
RealBadAngel
bf884e37a0 Use tangent space meshes only when shaders are enabled 2016-02-07 04:12:49 +00:00
Duane Robertson
99c905c563 Mgvalleys: fix riverbeds below sea level
Stop riverbeds from forming plateaus under sea. Minor corrections to
random lava/water placement.
2016-02-02 06:37:22 +00:00
paramat
0a8af88147 Mgv5/v7/flat/fractal: Move tunnel noise calculation into generateCaves
Tunnel 3D noises are only calculated when solid terrain is present
in mapchunk, avoiding large amounts of unnecessary calculations
Change 'int' to 's16' in calculateNoise
Change 'i' to 'vi' for voxelmanip indexes for consistency
Keep 'u32 index3d' local to a smaller part of tunnel code
Mgv7: Don't call CaveV7 if no solid terrain in mapchunk
Give 'open' bool a more descriptive name
2016-02-02 06:37:01 +00:00
Duane Robertson
80c7612e76 Mgvalleys: use standard caves
Replace simple caves with V5 caves, adding unpredictable water and lava
settings and massive caves based on subterrain. Remove fast terrain mode
and accompanying settings. Remove superfluous temperature/humidity
settings. Remove lava/water height setting. Fix errors in humidity
handling and remove humidity_break_point setting. Move cave noises to
generateCaves. Fix minor formatting/naming issues and use
MYMAX/MYMIN/myround.
2016-01-31 22:31:25 +00:00
Pavel Puchkin
83583aa2d5 Fix OSX building issue caused by ad884f2 2016-01-29 10:54:50 -05:00
est31
4e93ba06a7 Don't pass non-const references to collision methods
Non const references cause a lot of confusion with behaviour of code,
and are disallowed by minetest style guide.
2016-01-29 15:53:54 +01:00
Auke Kok
4ac1e9bccb Clocksource: use a better clock if available.
clock_gettime() is a far better clock than gettimeofday().

Even better than clock_gettime() is that you can select either
CLOCK_MONOTONIC, or even CLOCK_MONOTONIC_RAW. These clocks offer
high precision time. And the _RAW variant will never roll back
due to NTP drift or daylight savings, or otherwise.

I've adjusted this code to select the right clock method auto-
matically based on what's available in the OS. This means that
if you're running a very old linux version, MacOS or other,
you will automatically get the best clocksource available.

I've tested all Linux clocksources by selectively compiling and
running a 10k+ timer test suite. In all cases I confirmed that
the 3 POSIX Linux clocksources worked properly, and were
selected properly.

I've modified the OS X compile path to use the high-res clock
source for all time functions, but I can't confirm it works or
that it compiles.

As for WIN32, I confirmed that the used clocksource is indeed
a Monotonic clocksource, so good news: that code section appears
to be exactly what it should be.
2016-01-29 00:58:08 -05:00
est31
860d70bd0e Don't print whole json data buffer to errorstream on error
`errorstream` must not be overly verbose as clientside it is directly printed
onto the ingame chat window. These days, the serverlist can contain > 200k bytes,
so better print it to warningstream if the data buffer is too long.
2016-01-28 23:53:58 +01:00
Auke Kok
735e3b7059 Backface culling: Ignore setting in tiledef from old servers.
Outdated servers are always sending tiledefs with culling
enabled no matter what, as the value was previously entirely
ignored.

To compensate, we must (1) detect that we're running against
an old server with a new client, and (2) disable culling for
mesh, plantlike, firelike and liquid draw types no matter what
the server is telling us.

In order to achieve this, we need to bump the protocol version
since we cannot rely on the tiledef version, and test for it
being older. I've bumped the protocol version, although that
should have likely happened in the actual change that introduced
the new backface_culling PR #3578. Fortunately that's only 2
commits back at this point.

We also explicitly test for the drawtype to assure we are not
changing the culling value for other nodes, where it should
remain enabled.

This was tested against various pub servers, including 0.4.13 and
0.4.12.

Fixes #3598
2016-01-23 16:33:24 +01:00
RealBadAngel
52eea79928 Fix texture tear issue 2016-01-23 06:01:57 +01:00
est31
e50c784e2c Fix C++11 compilability
Previous commits broke it... :(
2016-01-23 05:45:29 +01:00
paramat
0459eca8eb Liquid flow: Prevent water spreading on ignore 2016-01-20 00:37:00 +00:00
Auke Kok
882a89d65a Allow per-tiles culling.
Backface culling is enabled by default for all tiles, as this
is how the lua parser initializes each tiledef. We revert to
always using the value from the tiledef since it is always
read and serialized.

Mods that wish to enable culling for e.g. mesh nodes, now can
specify the following to enable backface culling:

    tiles = {{ name = "tex.png", backface_culling = true }},

Note the double '{' and use of 'name' key here! In the same
fashion, backface_culling can be disabled for any node now.

I've tested this against the new door models and this properly
allows me to disable culling per node. I've also tested this
against my crops mod which uses mesh nodes where culling needs
to be disabled, and tested also with plantlike drawtype nodes
where we want this to continue to be disabled.

No default setting has changed. The defaults are just migrated
from nodedef.cpp to c_content.cpp.
2016-01-20 00:36:48 +00:00
kwolekr
9f988e3b96 EmergeManager: Do not queue duplicate block requests 2016-01-19 04:18:06 -05:00
Kahrl
b67eab3b00 Fix Settings::remove() always returning true 2016-01-19 10:15:01 +01:00
RealBadAngel
87291ea44a Show infotext with description for item entities 2016-01-18 17:21:41 +00:00
Duane Robertson
eb6e2c11b1 Correct overflowing rivers in Valleys mapgen. 2016-01-18 17:21:13 +00:00
RealBadAngel
13e7589fec Fix wield item glitch 2016-01-18 17:20:53 +00:00
Duane Robertson
752d820206 Prevent spawning in rivers with valleys mapgen. Remove unecessary whitespace. 2016-01-16 13:05:03 +00:00
sfan5
a58c0f458d Make ItemStack:set_count(0) clear the item stack
fixes minetest/minetest_game#786
2016-01-15 13:44:45 +01:00
Kahrl
da686160c3 Make all mesh manipulators in mesh.cpp work with any vertex type
cloneMesh() has to use a switch in order to create a different
mesh buffer type depending on vertex type. (Credit: the new cloneMesh
was written by RealBadAngel.)

To avoid repetitive code, all other methods use getVertexPitchFromType()
to automatically adapt the indexing to the vertex type at runtime.
2016-01-15 04:18:32 +01:00
Duane Robertson
3c6b2ffb10 Add Valleys mapgen. 2016-01-14 05:04:29 +00:00
paramat
b4cbcaea26 Mgv7/flat/fractal: Place biome top node on tunnel entrance floor 2016-01-14 04:43:50 +00:00
paramat
8fc8cb819b Mapgen: Various fixes and improvements
Lua_api.txt: Document 'minetest.registered_biomes'
Minimal: Remove 'mapgen_air' alias
Cavegen: Add fallback node for 'mapgen_ice'
Dungeongen: Add fallback node for 'mapgen_river_water_source'
Mgv5: Remove unnecessary '#include util/directiontables.h'
Add missing 'this->'s in makeChunk()
Mgv6: Edit empty line formatting
Remove leading spaces in makeChunk()
Add missing spaces after 'for' and 'if'
Mgv7: Edit empty line formatting
2016-01-11 01:32:20 +00:00
paramat
3e0ea3c6ed Mgflat: Set blank default spflags. Unhide 2016-01-10 04:07:47 +00:00
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
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
paramat
7a6e4dc54a Cavegen V6: Make all caves consistent with 0.4.12 stable
When tunnels entirely above ground were avoided, the
missing pseudorandom calls changed the allowed caves.
Now, above ground tunnels are not placed while
still running all previous pseudorandom calls.
2015-08-03 06:39:23 +01:00
paramat
cf77e0333d Biome API: Make fallback biome stone and water, disable filler 2015-08-03 02:34:32 +01:00
Břetislav Štec
abe6c072d6 src/util/numeric.{cpp,h}: Fix FacePositionCache data race 2015-08-02 19:42:22 +02:00
Miner59
060e56b24c Fix "bouncy" blocks
Before players "bounced" too high. Now, while still allowing to bounce, higher speed bounces are throttled.
2015-08-02 19:40:23 +02:00
Břetislav Štec
868a1a5c13 src/client/tile.cpp: Fix reference counting 2015-08-02 19:26:15 +02:00
rubenwardy
ec796b8e81 Add map limit config option 2015-08-02 14:27:04 +02:00
Břetislav Štec
a5e5aa5be9 Prepend "Lua: " before lua exceptions
src/server.cpp
src/emerge.cpp
2015-08-02 02:17:37 -04:00
Břetislav Štec
c4287a0d68 src/wieldmesh.cpp: Fix mesh extrusion memory leak 2015-08-02 02:16:30 -04:00
Břetislav Štec
ebe7b31538 src/client.cpp: Fix mapper memory leak 2015-08-02 02:15:38 -04:00
kwolekr
42cf5e972d Improve accuracy and safety of float serialization
Multiplying by a factor of 1/1000.f (rather than dividing by 1000.f) directly
introduces an error of 1 ULP.  With this patch, an exact comparison of a
floating point literal with the deserialized F1000 form representing it is now
guaranteed to be successful.
In addition, the maxmium and minimum safely representible floating point
numbers are now well-defined as constants.
2015-08-01 19:30:08 -04:00
kwolekr
bf991bde45 Clean up util/serialization.{cpp,h} and add unit tests 2015-08-01 19:24:46 -04:00
Břetislav Štec
67997af67f src/environment.cpp: Fix NULL pointer dereference 2015-08-01 20:44:18 +02:00
Břetislav Štec
79e2647556 src/network/connection.h: Fix race condition 2015-08-01 20:44:17 +02:00
est31
c39a85a88d Android: Add githash header to spare rebuilds after new commits
Before, android_version.h got changed at every new commit. Now, we
only change it with new minetest releases. Analogous to how cmake
does it,  we add an android_version_githash.h file that communicates
the git hash to C++ code.

Also, unify VERS_MAJOR, VERS_MINOR and VERS_PATCH variable
calculation inside the whole makefile.
2015-08-01 20:42:07 +02:00
kwolekr
7919318be7 tests: Log exceptions thrown inside of unit tests 2015-07-31 23:30:25 -04:00
paramat
cfed682d04 Dungeon generation: Fix code style issues in dungeongen.cpp 2015-08-01 00:37:26 +01:00
Loic Blot
05fe9ab2d4 Small SendableMediaAnnouncement cleanup
-> Remove the SendableMediaAnnouncement struct
-> Forge the packet directly in the m_media loop, spare one loop and the construction of a vector
-> Use preincrement to spare iterator copies
2015-07-31 01:01:00 +02:00
est31
eb3aac20c8 Android: fix horrible libiconv build
Before, our libiconv build was a joke. We first called configure for our own build host system,
then called make, before we executed a Android.mk script we provided as patch. The first "native make"
always failed, and the LIBICONV_LIB file setting in our Makefile didn't match the built one,
resulting in an always-rebuild of iconv.

This commit cleans up this total mess, removes the double-build, and the Android.mk, and properly calls
./configure with the according target platform, and uses a built toolchain.

As we have to deal with the android bug "NDK: Support for prebuild libs with full sonames"
https://code.google.com/p/android/issues/detail?id=55868
as the 2013 patch
https://lists.gnu.org/archive/html/libtool-patches/2013-06/msg00002.html
by Google's David Turner wasn't inside the 2011 libtool, we pass -avoid-version to
libtool.

Thanks to the proper build, wide_to_utf8 works for android now, removing us of the need to disable it.
2015-07-29 15:59:06 +02:00
nerzhul
ca63f7f10d Precalculate mapblock relative size. This permit to remove many s16 calculs on runtime 2015-07-29 11:45:44 +02:00
Břetislav Štec
88a6b9f52d Fixed minimap memory leak 2015-07-27 11:06:46 -04:00
est31
f336d3ffb6 Fix srp.cpp:815 leak
Thanks @Zeno-
2015-07-27 08:15:39 +02:00
est31
c30a2d6854 Add AreaStore data structure 2015-07-27 06:42:56 +02:00
SmallJoker
454a290370 Fix MSVC number conversion warning 2015-07-25 17:38:04 +02:00
est31
fa1096ec49 Fix minetest.get_(all)_craft_recipe(s) regression
Since 03e0dd33a8 the calls didn't return an output count
for the recipes.
2015-07-25 17:33:41 +02:00
Loic Blot
4e6971e593 Cleanup server addparticle(spawner) by merge two identical functions. 2015-07-25 12:24:28 +02:00
est31
288302a1f0 Fix documentation of dedicated_server_loop 2015-07-24 23:11:19 +02:00
est31
5bde7798e9 Check output of mpz_set_str and fix leak on error condition
Also add static identifier as upstream did
2015-07-24 22:42:54 +02:00
Loic Blot
aab7c83d02 Remove some old dead code. Fix some Clang warnings in SRP (ng->N... will
always evaluate to true.
2015-07-24 21:48:02 +02:00
est31
2eb329cc63 Bump protocol to 26
This was needed due to the TileDef serialisation changes. Originally it has been planned
to also add utf-8 based chat to 26, but chat changes aren't final yet, so they are done
in one change, after the release, and not two small ones, causing us having to be compliant
to three versions of the packet.
2015-07-24 20:32:26 +02:00
est31
3b50b2766a Optional reconnect functionality
Enable the server to request the client to reconnect.

This can be done with the now extended minetest.request_shutdown([reason], [reconnect]) setting.
2015-07-23 07:38:13 +02:00
RealBadAngel
1e0e85f82e Fix issues with light of attached CAOs 2015-07-23 04:35:13 +02:00
paramat
d569c91f48 Mgv7: Use density noise + density gradient for mountain terrain
Tune and optimise noise parameters
2015-07-21 23:16:14 +01:00
RealBadAngel
60350699c7 Add wielded (and CAOs) shader 2015-07-21 23:56:41 +02:00
est31
254dbe7abd Clarify docs for auth.cpp method 2015-07-21 18:14:39 +02:00
est31
a57d83b46a Ask auth handler to create auth when a default password is set
-> Fix server crash with protocol >=25 if a default password is set.
-> Remove some useless and possibly confusion causing code for the TOCLIENT_FIRST_SRP packet handler
2015-07-21 18:12:28 +02:00
Loic Blot
fa7fe510d9 Remove profiler.h include where it's not needed. Remove some unreachable and very old code 2015-07-21 08:10:43 +02:00
Elia Argentieri
5ebb4237e2 Added get_player_velocity() method. Fixes #1176 2015-07-20 05:40:44 +02:00
est31
7bbb9b066a MoveItemSomewhere double bugfix
-> Fix bug where MoveSomewhere from an infinite source would fill the destination inventory with copies of itself.
-> Fix bug where MoveSomewhere would needlessly call callbacks.
-> Remove trailing whitespaces
2015-07-19 06:23:41 +02:00
paramat
4046f3e302 Cavegen: Mgv6: No small caves entirely above ground
Mgv5/mgv7: Remove 'should make cave hole' feature
Remove ravine code
2015-07-19 02:47:11 +01:00
TeTpaAka
e47f390e0d Refactor particle code to remove the while loops
Replaces while loops with proper getfield calls
2015-07-18 14:54:07 +02:00
TeTpaAka
dd2e08e117 Make acc and vel deprecated in add_particle and search for acceleration and velocity instead
The doc and the actual behaviour differed.
2015-07-18 07:57:20 +02:00
TeTpaAka
8d03301138 Fix invisible player when the attached entity is removed 2015-07-18 07:41:43 +02:00
Kahrl
9c76f379ac Display an access denied message when client detects a server timeout 2015-07-17 12:06:30 +02:00
est31
bf7174f3f9 Server kicks: make messages configurable, cache wstring 2015-07-17 06:37:16 +02:00
nerzhul
f9dbec6edf Kick players when shutting down server and there is a crash due to a Lua stack exception 2015-07-16 20:27:42 +02:00
RealBadAngel
655fc6010f Fix relief mapping issues 2015-07-16 15:36:48 +02:00
Kahrl
b30e8d8ec6 Make serialization error message translatable
Also don't show "probably running a different version" message in simple singleplayer mode
2015-07-14 19:01:33 +02:00
Loic Blot
8ac0cf500f connection.cpp: remove unused constructor 2015-07-14 18:33:20 +02:00
kwolekr
515e7028ac Increase limit of serialized long strings 2015-07-14 03:22:16 -04:00
kwolekr
5006ce8260 Remove raw message output on AOM deserialization failure
Improve TOCLIENT_ACTIVE_OBJECT_MESSAGES robustness for handling invalid data
2015-07-13 23:29:29 -04:00
kwolekr
6f07f79c2f Add more robust error checking to deSerialize*String routines
Add serializeHexString()
Clean up util/serialize.cpp
2015-07-13 22:38:01 -04:00
paramat
66ea356e68 Mgv6/treegen: (Re)Add fallback nodes for compatibility with subgames 2015-07-13 19:41:26 +01:00
kwolekr
1a1774a105 Fix damage flash when damage disabled 2015-07-10 15:58:57 -04:00
kwolekr
8eb272cea3 Misc. minor fixes 2015-07-10 15:58:57 -04:00
Loic Blot
e6f0178e83 Little coding style fix on porting.h 2015-07-10 19:04:05 +02:00
est31
cb8978fb1d Settings: pass name to callbacks by reference
Spare some copies.
2015-07-09 08:25:17 +02:00
est31
4ece2b9e32 Update clouds enable_3d_clouds when setting changed 2015-07-09 08:24:51 +02:00
Diego Martinez
13e100e1d8 Windows: Fix some warnings. 2015-07-09 01:52:28 +02:00
paramat
b51738177e Biome API decorations: 'spawnby' searches a 3D neighbourhood
The neighbours checked are the 8 nodes horizontally surrounding the decoration base
and the 8 nodes horizontally surrounding the ground node below the decoration
2015-07-08 22:44:10 +01:00
RealBadAngel
39439cbd3d Add new leaves style - simple (glasslike drawtype) 2015-07-08 11:20:07 +02:00
est31
b0784ba871 Use UTF-8 instead of narrow
Use wide_to_utf8 and utf8_to_wide instead of wide_to_narrow and narrow_to_wide at almost all places.
Only exceptions: test functions for narrow conversion, and chat, which is done in a separate commit.
2015-07-08 10:12:44 +02:00
kwolekr
e234d8b378 Clean-up Minimap code
- Fixed race conditions
- Fixed null dereference
- Fixed out-of-bounds array access
- MinimapMapblock is now allocated and added to update queue only when enabled
- Removed dependency on LocalPlayer
- Fixed code style
- Simplified expressions and program logic
- Cleaned minimap object interfaces
2015-07-08 01:50:31 -04:00
paramat
ba15c98e4d Mgv7: Auto-set lowest mountain generation level
Lowest level of base terrain determines mountain generation in mapchunk
Change some positional function arguments from int to s16
2015-07-08 00:49:04 +01:00
est31
d92d376148 Client: better m_proto_ver initialisation
Previously, m_proto_ver was set to the serialisation version
inside the legacy init packet.

Now, if the server doesn't send a protocol version (protocols < 25),
we set m_proto_ver to some value < 25 and > 0.
2015-07-07 17:03:26 +02:00
ShadowNinja
a93838707a Use minetest logging facilities for irrlicht log output 2015-07-05 01:05:24 +02:00
paramat
d786a272c0 Mgv7: Lower base of mountain generation to -112 and define constant 2015-07-04 20:21:19 +01:00
est31
64dc053209 Fix endless loop since grandparent commit 2015-07-04 19:43:46 +02:00
est31
96989e0a6a Craftdef: Use numbers instead of iterators
Use numbers instead of iterators to traverse various vectors.
2015-07-04 16:28:21 +02:00
TeTpaAka
87b9cdab07 Fix missing check for 0 in craft replacements 2015-07-04 14:33:49 +02:00
kwolekr
7b171ea2be Fix code style from recent commits and add misc. optimizations 2015-07-02 23:14:30 -04:00
RealBadAngel
8a85e5e58d Shaders fixes and cleanup relief mapping code. 2015-07-02 21:36:45 +02:00
est31
2e44873ac9 Inventory manager style cleanup and further checks 2015-07-01 17:03:02 +02:00
est31
b2160bcecd Disable mesh cache by default 2015-07-01 13:50:25 +02:00
paramat
c0dafa1c10 Cavegen: Cleanup code. Define constant for MGV7_LAVA_DEPTH 2015-07-01 06:21:13 +01:00
est31
9e3e6dc5ec Make m_blocks_cache private
@RealBadAngel has removed all outside access of the cache.
2015-06-30 21:34:23 +02:00
est31
370a33686a Defer minimap update when shape changed 2015-06-30 21:14:28 +02:00
est31
842579eb8c Close keybind settings menu with esc 2015-06-30 21:04:06 +02:00
paramat
91f95fd4df Biome API: Increase heat and humidity noise spreads to 1000 2015-06-30 07:04:18 +01:00
est31
29dda9f356 Add UpdateThread and use it for minimap and mesh threads 2015-06-29 15:00:19 +02:00
kwolekr
4e28c8d3c8 Fix *BSD build with GNU iconv 2015-06-29 12:32:01 +02:00
rubenwardy
0d65ee878c Add Lua errors to error dialog 2015-06-29 04:47:35 +02:00
RealBadAngel
0a90fedabc Bugfix: minimap was updated only with loading new blocks, allow forced updates with changing player pos 2015-06-28 14:45:47 +02:00
RealBadAngel
b160f8dfe7 Minimap update 2015-06-28 12:17:36 +02:00
est31
420125debd Remove busy polling inside minimap thread 2015-06-27 19:20:25 +02:00
paramat
36163d9653 Mgv5/mgv7 caves: Remove sand found in underground tunnels
Add missing check for max_stone_y to mgv5 cavegen
Tunnels now carve through sand below water_level
2015-06-27 03:36:40 +01:00
RealBadAngel
ffd16e3fec Add minimap feature 2015-06-27 03:42:01 +02:00
est31
3376d2e114 Remove compile warning
Thanks @TeTpaAka for pointing this out.
2015-06-25 15:50:31 +02:00
est31
3d43df99f1 Return to ignore 2015-06-24 22:47:41 +02:00
Loic Blot
c6766b275f Typo fix on previous @est31 commit 2015-06-23 23:17:47 +02:00
est31
3a89e25fe0 Small TOCLIENT_HELLO logging fix
Fix grammar error and missing number conversion for version.
Also add deployed protocol to log line.
2015-06-23 21:14:48 +02:00
est31
2c1fd29884 Add MoveSomewhere inventory action
Improve shift+click experience
2015-06-23 20:18:41 +02:00
Craig Davison
bc55ef337c Use actionstream instead of errorstream when failing to emerge player 2015-06-23 19:25:06 +02:00
est31
6f8bdda90e Fix string conversion error message 2015-06-23 15:04:14 +02:00
TeTpaAka
17ba584fe2 Fix bug when craft input isn't replaced 2015-06-22 19:30:35 +02:00
MirceaKitsune
660fa516bf Fix some issues with animations, and allow non-looped animations to be defined 2015-06-22 01:53:38 +02:00
paramat
622918d8a8 Mgv7: Edit noise parameters. Fewer octaves, larger spreads. 2015-06-21 04:34:19 +01:00
est31
14f4cd0ef9 Small CAO improvements
-> remove the old parent as @kahrl suggested
-> use indices no iterator as @kwolekr suggested
2015-06-20 06:58:07 +02:00
paramat
70da8a940b Mapgen objects: Enable heatmap and humidmap for all biome api mapgens 2015-06-20 04:16:17 +01:00
figec
d7190df07e More correct wrap_rows implementation 2015-06-20 03:41:51 +02:00
est31
dd91b3d6fb Generic CAO cleanups and renames for clarification
* Use enum for GENERIC_CMD_*
* Rename m_attachements to attachement_parent_ids (public member and clearer name)
* Rename GENERIC_CMD_SET_ATTACHMENT to GENERIC_CMD_ATTACH_TO
* USHRT_MAX + 1 buffer sizes to prevent overflows as @kahrl suggested
* Remove unneccessary m_id from GenericCAO (shadowing protected superclass member for no reason) as @kahrl suggested
2015-06-20 03:37:30 +02:00
est31
40226e5274 Make attached objects visible in 3rd person view 2015-06-20 02:59:53 +02:00
figec
3b65a6a36c Fix wrap_rows at inner byte of multibyte sequence
Also fix UTF-8 inner byte bounds and make unittest for case this fixes.
2015-06-18 23:39:23 +02:00
paramat
e45ecad3ab Biome API: Add noise defined biome blend 2015-06-18 07:05:22 +01:00
paramat
2da1503780 Mgv6: Don't create air gap in tundra at y = 48 in custom high terrain 2015-06-18 04:18:15 +01:00
est31
ea1b17b88f Don't print an error for valid listring[] formspec 2015-06-18 04:25:11 +02:00
est31
43dab2ffc8 Make wrap_rows not wrap inside utf-8 multibyte sequences
Also count multibyte sequences as "one" character.
Adds unittest for the bug reporter's case.
Fixes #2796.
2015-06-17 22:22:15 +02:00
est31
6dcf549ba9 Fail iconv call gracefully
No freezing when inbuf_size doesn't decrease over time.
2015-06-17 19:03:58 +02:00
est31
7a90b31b30 GUIFormSpecMenu::OnEvent code style update and small refactor
* Make method (more) consistent with current code stlye
* Move index into loop constructor after @rubenwardy's suggestion
* Cache inv_s->getList(s.listname), which removes a possibly bad scenario
of inv_s being null.
* Properly check for validity
2015-06-16 20:33:07 +02:00
est31
c977fbd928 Add list-rings
Adds list-rings, a method to implement item sending between inventories via shift-click.
Nice insider feature: a ring consisting of a single inventory list serves as nice clean-up method.
Also adds them to minimal game, and the standard inventory.
Craft output slots are not supported.
2015-06-16 14:51:26 +02:00
Nathaniel Olsen
3ae8b92be6 Remove unneccessary space for tab completion 2015-06-16 07:16:22 +02:00
paramat
38482d2656 Biome API: Enable biome generation to lower world limit
Decorations: Remove lower limit of water level for placement
2015-06-15 02:07:38 +01:00
SmallJoker
bb5f830d16 Ignore punches with no damage in the actionstream 2015-06-15 00:10:13 +02:00
est31
ee38bcd307 Automated whitespace error fix for last commit 2015-06-14 23:15:20 +02:00
RealBadAngel
43fcfbfe05 Improved parallax mapping. Generate heightmaps on the fly. 2015-06-14 21:13:36 +02:00
est31
d105bf27dd Add UTF and other utility unit tests 2015-06-14 12:07:51 +02:00
est31
60f31ad523 Android: bypass broken wide_to_utf8 with wide_to_narrow
While utf8_to_wide works well, wide_to_utf8 is quite broken
on android, for some reason.
2015-06-14 08:25:21 +02:00
Ilya Zhuravlev
b6387b4e0f Use utf-8 in formspecs 2015-06-13 19:49:55 +02:00
est31
572990dcd3 Add utf-8 conversion utilities and re-add intlGUIEditBox 2015-06-13 19:49:55 +02:00
TeTpaAka
aa13baa30a Add minetest.register_on_player_hpchange 2015-06-13 19:40:31 +02:00
TeTpaAka
e50aa4ed06 Add return list of individual counts to find_node_in_area 2015-06-13 19:39:18 +02:00
est31
502e40a649 dofile error reporting for syntax errors
According to doc, dofile() raises an error when parsing failed due to syntax errors.
Fixes #2775
2015-06-12 20:23:31 +02:00
paramat
0b187ede4b Minimal: Add snow biome and jungleleaves nodes. Add mapgen aliases
Treegen: Remove alias checks from jungletree generation for speed
2015-06-12 08:20:19 +01:00
paramat
74d8b341bc Mgv5/mgv7: Trigger biome recalculation at underwater surfaces 2015-06-03 06:37:10 +01:00
est31
ba3ff5ef39 Fix uninitialized variable error
If you run minetest with valgrind, you'll quickly notice uninitialized jump
depend error messages that point to s_base.cpp:131. This commit fixes those.
2015-06-02 13:55:02 +02:00
est31
617a3d426f Make split method static 2015-06-01 17:04:21 +02:00
est31
06a2eee692 Mapblock: nodecount refactor
Spare direct multoplication, use constant MapBlock::nodecount instead of
local nodecount variables.

Also use strides at one place instead of multiplications.
2015-05-31 06:24:41 +02:00
SmallJoker
b4dfaa3a7a Only retrieve always_fly_fast setting once 2015-05-30 22:29:36 +02:00
Craig Robbins
addf3ee165 (Android) Only simulate holding down fast key if fast_move is toggled to true 2015-05-29 22:59:21 +10:00
kwolekr
522acf920f Make get_biome_list() error message more helpful 2015-05-28 20:04:50 -04:00
Kahrl
0f15488eae Fix typo in variable name 2015-05-28 20:47:15 +02:00
TeTpaAka
c0335f7d13 Add some missing getter functions to the lua API
ObjectRef:
get_properties
get_armor_groups
get_animation
get_attach
get_bone_position

Players:
get_physics_override
hud_get_hotbar_itemcount
hud_get_hotbar_image
hud_get_hotbar_selected_image
get_sky
get_day_night_ratio
get_local_animation
get_eye_offset

Global:
minetest.get_gen_notify
minetest.get_noiseparams
2015-05-28 16:46:35 +02:00
est31
990a96578f Consistent const string params
Parent commit broke behaviour.
Thanks @TeTpaAka for testing the fix.
2015-05-27 13:23:09 +02:00
est31
21878c9d5c Spare some string copies 2015-05-27 11:45:40 +02:00
paramat
f16ebbfecf Mgv6: Enable snowbiomes by default. Double biome noise spread. 3 octaves, 0.5 persistence for humidity 2015-05-26 02:08:06 +01:00
est31
6b7fb591cb Small clientiface ASCII art improvements
Use v arrows except where there is only one line between two boxes,
and other improvements
(Yea could use ↓ but its an ASCII art not an Unicode art).
2015-05-24 16:33:22 +02:00
paramat
774e5d17c4 Biome API, mgv7: Increase heat/humidity spreads. Improve mgv7 noise parameters 2015-05-24 04:33:09 +01:00
paramat
3dba6d1f90 Mgv5/v7: Fix generateBiomes biome recalculation logic Biomegen down to y = -192 for mgv5 deep oceans. Improve code 2015-05-23 02:18:30 +01:00
SmallJoker
39869aaa25 Fix Windows build, clean up included headers
Also fix a startup error caused by s_security.cpp
2015-05-22 20:37:59 +02:00
est31
e13d2bafc6 Deny empty username early in the protocol
Thanks to @UltimateNate for pointing this out :)
2015-05-22 20:24:39 +02:00
est31
9facb40738 Don't ignore nametag attribute change message for newer versions
This allows newer versions to add additional information that isn't
read by us, but still in a backwards compatible manner.
2015-05-21 19:01:46 +02:00
kwolekr
da34a2b33e Replace instances of std::map<std::string, std::string> with StringMap
Also, clean up surrounding code style
Replace by-value parameter passing with const refs when possible
Fix post-increment of iterators
2015-05-19 16:10:49 -04:00
rubenwardy
603297cc35 Add texture overriding 2015-05-19 21:27:07 +02:00
kwolekr
43702ec6ac Fix build with libstdc++
libstdc++ doesn't include <cstring> inside of <string>, unlike libc++.
2015-05-19 02:38:48 -04:00
kwolekr
6c5a6967ec Split ObjDef/ObjDefManager out to objdef.cpp 2015-05-18 22:30:25 -04:00