Commit Graph

4818 Commits

Author SHA1 Message Date
Vincent Glize c772e0e18c C++11 cleanup inventorymanager (#6077)
* C++11 cleanup inventorymanager
2017-07-01 14:07:40 +02:00
stujones11 6e5588c8e1 Tile material: Add 'TILE_MATERIAL_OPAQUE', use for drawtype 'NDT_NORMAL'
Prevents normal drawtype nodes having transparency.
Avoids clients cheating by using 'x-ray' texture packs with transparent textures.
2017-07-01 04:43:55 +01:00
red-001 f3ad75691a Create a filesystem abstraction layer for CSM and only allow accessing files that are scanned into it. (#5965)
* Load client-side mods into memory before executing them.

This removes the remaining filesystem access that client-sided mods had and it will hopefully make then more secure.

* Lua Virtual filesystem: don't load the files into memory just scan the filenames into memory.

* Fix the issues with backtrace

* fix most of the issues

* fix code style.

* add a comment
2017-06-30 20:14:39 +02:00
Paramat 2e53801fc0 Mapgen: Remove unnecessary 'this->' from constructors (#6069) 2017-06-30 15:32:35 +02:00
paramat 6d2833a887 Mgv7: Fix undefined 'float_mount_height'
Commit cad10ce3b7 altered the parameter
'float_mount_height' but was missing the necessary line in the constructor
to get the altered value from 'params'.

Fixes 3D floatland terrain generating everywhere.
2017-06-28 11:48:17 +01:00
Jesse McDonald 85d7b18d85 Fix for empty key/value when reading item string with wear but no metadata (#6058) 2017-06-27 12:34:11 +02:00
adrido d7343b6c93 Fix msvc annoyances (#5963)
* MSVC: Fix '/std:c++11' is not a valid compiler option

* MSVC/MINGW: Define 'WIN32_LEAN_AND_MEAN' for the whole project

In some obscure cases 'Windows.h" got includet before that definition, which leaded to compilation warnings+errors

* MSVC: '/arch:SSE' is only available for x86

* MSVC: Fix float conversation

* MSVC/MINGW: use winthreads on Windows

* MSVC: 'USE_CMAKE_CONFIG' might be already definied by CMake build system

* MSVC: Use all available cpu cores for compiling

* Add missing include ctime and use std::time_t
2017-06-27 11:54:40 +02:00
kilbith 48cd217e3b Fix arm inertia limit case 2017-06-27 11:26:37 +02:00
Loic Blot 53a6b5439e
Fix undefined behaviour in arm movement when dividing by zero 2017-06-26 23:22:42 +02:00
Loïc Blot b3a36f7378 Isolate irrlicht references and use a singleton (#6041)
* Add Device3D class which will contain IrrlichtDevice interface

move getSupportedVideoDrivers to Device3D

Add Device3D singleton & use it in various places

Rename Device3D to Rendering engine & add helper functions to various device pointers

More singleton work

RenderingEngine owns draw_load_screen

move draw functions to RenderingEngine

Reduce IrrlichtDevice exposure and guienvironment

RenderingEngine: Expose get_timer_time() to remove device from guiEngine

Make irrlichtdevice & scene manager less exposed

* Code style fixes

* Move porting::getVideoDriverName, getVideoDriverFriendlyName, getDisplayDensity, getDisplaySize to RenderingEngine

Fix XORG_USED macro -> RenderingEngine + create_engine_device from RenderingEngine constructor directly

* enum paralax => enum parallax
2017-06-26 20:11:17 +02:00
Loic Blot a8650e785d
Fix Camera::add_arm_inertia -> addArmInertia 2017-06-26 20:10:11 +02:00
kilbith 1d1d922a7a Add Arm Inertia (#6050) 2017-06-26 20:03:48 +02:00
paramat 936d67dad4 Ores: Make 'absheight' flag non-functional
The 'absheight' flag was added years ago for the floatlands of 'indev'
mapgen (now deleted). The feature mirrored all ore placement around y = 0
to place ores in floatlands.

In MTG we now use dedicated ore registrations for floatlands.

The feature is crude, inflexible, problematic and very rarely used, it
also makes ore vertical range code more complex.
Minetest 0.5 is a good chance to remove the feature.

The flag itself remains to not break flag values.
2017-06-26 04:38:36 +01:00
Loic Blot 1237206d4b
Revert "Ores: Make 'absheight' flag non-functional"
This reverts commit 90ed6fc732.
2017-06-25 23:08:31 +02:00
SmallJoker c08cc0533f Inventory: Fix wrong stack size behaviour and item loss (#6039)
Also fix itemFits and remove constness-nonsense
2017-06-25 11:39:39 +02:00
paramat cad10ce3b7 Mgv7: Clean up divide-by-zero fix 2017-06-25 05:01:50 +01:00
paramat 90ed6fc732 Ores: Make 'absheight' flag non-functional
The 'absheight' flag was added years ago for the floatlands of 'indev'
mapgen (now deleted). The feature mirrored all ore placement around y = 0
to place ores in floatlands.

In MTG we now use dedicated ore registrations for floatlands.

The feature is crude, inflexible, problematic and very rarely used, it
also makes ore vertical range code more complex.
Minetest 0.5 is a good chance to remove the feature.

The flag itself remains to not break flag values.
2017-06-25 05:01:42 +01:00
Dániel Juhász c2df1a0835 Emit liquid sound if the player walks in liquid (#6040) 2017-06-24 20:15:00 +02:00
Vincent Glize 9da5fb1583 C++11 cleanup on constructors guiEngine (#6036)
* C++11 cleanup on constructors guiEngine
2017-06-24 13:41:30 +02:00
Loic Blot 8a84e89922
Game::showOverlayMessage: securise function
Do wgettext call directly in the function instead of caller, as we destroy wstd inside it
2017-06-24 11:43:17 +02:00
paramat 34e8e0e5ce Mgv7: Avoid divide-by-zero errors
Some settings of paramters can cause mgv7 variables to be -inf, nan or -nan.
This can cause massive vertical columns of water to appear above sea level.
2017-06-24 01:48:29 +01:00
paramat 9a77397fbf Mgvalleys: Use existing 'lava_max_height' value in CavesRandomWalk
Now that lava depth in large caves is variable we can use the already
present 'lava_max_height' value to set the lava depth in them.
2017-06-24 01:48:20 +01:00
Wuzzy 08f57e1e38 Show param1 and param2 in debug screen (#6031)
* Show param1 and param2 in debug screen

* Add units and some formatting to debug screen

* Minor refactor of param1/param2 debug display
2017-06-23 13:31:01 +02:00
Loïc Blot 8dd548c0b4 LINT fix 2017-06-22 13:20:20 +02:00
red-001 8b9f40d12f Fix CSM crash caused by move to C++11. (#6027) 2017-06-22 13:18:58 +02:00
paramat 2652d8db19 CavesRandomWalk: Make 'lava_depth' a mapgen parameter
As with 'large_cave_depth', lava depth was previously a fixed y value and
therefore incompatible with the ability to shift terrain vertically.

Add 'lava_depth' mapgen parameter to mgflat, mgfractal, mgv5, mgv7.
2017-06-22 03:14:56 +01:00
Loïc Blot 1425c6def1 Cpp11 initializers: last src root changeset (#6022)
* Cpp11 initializers: last src root changeset

Finish to migrate all src root folder files to C++11 constructor initializers
2017-06-21 11:51:29 +02:00
Dániel Juhász 12aad731ad Fix render order of overlays (#6008)
* Fix render order of overlays

* Use C++11 loops

* Fix time_t
2017-06-21 10:47:31 +02:00
Vincent Glize 8daf5b5338 C++11 cleanup on constructors dir network (#6021)
* C++11 cleanup on constructors dir network
2017-06-21 08:28:57 +02:00
Vincent Glize af3badf7a9 C++11 cleanup on constructors dir client (#6012)
* C++11 cleanup on constructors dir client
2017-06-21 08:04:45 +02:00
Ezhh 76074ad81a Fix console resize issue when maximising game window (#6023) 2017-06-21 07:50:57 +02:00
paramat b8237099b2 Mgv5/v7/fractal: Add 'large_cave_depth' parameter to replace fixed value
The value cannot be fixed because we can shift terrain vertically.
This also makes these mapgens consistent with mgflat and mgvalleys which
have 'large_cave_depth' parameters.
2017-06-21 01:58:04 +01:00
Jesse McDonald e6a9e6066a Inventory: Make addItem for empty ItemStacks respect max stack size
When adding items to an empty ItemStack, limit the number of items taken
based on the maximum stack size in the item description.
Likewise, when checking whether items will fit into an empty ItemStack,
only absorb as many items as are allowed in a single stack and return the rest.
2017-06-21 01:53:57 +01:00
Loïc Blot 16938adfc0 Merge cguittfont lib in irrlicht change folder. (#6016)
* Merge cguittfont lib in irrlicht change folder.

This remove hack and static lib for FreeType
2017-06-20 17:18:34 +02:00
Zeno- 318106223f Fix console not being properly resized after window size changed (#6020) 2017-06-20 12:36:58 +02:00
Dániel Juhász 0fcaf9fb1b Automatic item and node colorization (#5640)
* Automatic item and node colorization

Now nodes with a palette yield colored item stacks, and colored items
place colored nodes by default. The client predicts the colorization.

* Backwards compatibility

* Use nil

* Style fixes

* Fix code style

* Document changes
2017-06-20 11:19:56 +02:00
Loic Blot b2977e7691
Fix 1 more warning reported by GCC
We don't write in correct buffer size in analyze_block
2017-06-20 00:19:29 +02:00
Loic Blot b32f36bf34
Fix 2 warnings reported by GCC
* ClientEnvironment::m_irr is not used anymore since a recent cleanup
* l_vmanip constructor ordering
2017-06-20 00:04:18 +02:00
Vincent Glize 4a5e8ad343 C++11 cleanup on constructors (#6000)
* C++11 cleanup on constructors dir script
2017-06-19 23:54:58 +02:00
Loïc Blot 4a78949083 Remove IrrlichtDevice unused pointer from ClientActiveObject class & childs (#6010) 2017-06-19 16:49:34 +02:00
SmallJoker 6eb03c135f find_nodes_in_area: Extend maximal count to U32_MAX (#5277)
Extend documentation, limit area volume
Remove u16 count limitation

* Prevent integer overflow, replace minp/maxp with pos1/pos2
2017-06-19 16:30:26 +02:00
Loïc Blot 071736ba3f hud.h: add missing false default state on use_hotbar_selected_image 2017-06-19 15:41:33 +02:00
Loïc Blot 53acc32bee hud.cpp: fix wrong indent in drawItem 2017-06-19 15:20:30 +02:00
Loïc Blot 4dcc5985df Verify HudSetParams input when hotbar textures are set (#6013)
* Verify HudSetParams input when hotbar textures are set

This fix #6011
2017-06-19 14:10:30 +02:00
paramat 0c429bd164 Mgv7: Do not limit river generation if no floatlands
Previously, the carving of rivers was disabled above 'shadow_limit' even if
floatlands were disabled. This caused rivers to be unnecessarily disabled if
mapgen was customised to have surface level above y = 1024.
2017-06-19 02:20:14 +01:00
paramat ea4d407082 Mgv7 spawn search: Cope with extreme custom terrain and biome 'dust'
Previously, maximum spawn level was set to 'water_level + 16'. This would result
in spawn search failing if terrain had been customised to be much higher than
'water_level' at all points.

Also raise spawn level by 1 node to avoid spawning half-buried in a biome 'dust'
node such as 'default:snowblock'.
2017-06-19 02:20:04 +01:00
Loic Blot 8f2e60a961
Client::makeScreenshot: remove device param
We already have the device param as class member
2017-06-19 00:00:55 +02:00
Loïc Blot 4faaadc8d5 Cpp11 patchset 11: continue working on constructor style migration (#6004) 2017-06-18 19:55:15 +02:00
Loïc Blot 8f7785771b Cpp11 initializers 2 (#5999)
* C++11 patchset 10: continue cleanup on constructors

* Drop obsolete bool MainMenuData::enable_public (setting is called with cURL in server loop)

* More classes cleanup

* More classes cleanup + change NULL tests to boolean tests
2017-06-17 19:11:28 +02:00
Loïc Blot 76be103a91 C++11 patchset 9: move hardcoded init parameters to class definitions (part 1) (#5984)
* C++11 patchset 9: move hardcoded init parameters to class definitions

C++11 introduced the possibility to define the default values directly in class definitions, do it on current code

Also remove some unused attributes

* CollisionInfo::bouncy
* collisionMoveResult::collides_xy
* collisionMoveResult::standing_on_unloaded
* Clouds::speed

* More constructor cleanups + some variables removal

* remove only write guiFormSpecMenu::m_old_tooltip
* move header included inside defintions in genericobject.h
* remove some unused since years exception classes
* remove unused & empty debug_stacks_init
* remove unused & empty content_nodemeta_serialize_legacy
* remove forgotten useless bool (bouncy) in collision.cpp code
2017-06-16 11:25:52 +02:00
Rui 49d6e5f4ab Fix deserialization of ItemDefinition (#5995) 2017-06-16 07:17:30 +02:00
paramat 212945c7a3 Mgv6 mudflow: Also check for 'ignore' nodes
Previously, when removing decorations we searched upwards and removed until we
found air or water. However, the node above the decoration can be 'ignore' if
a stacked decoration extends into the volume above the mapchunk. The result
could be a problematic column of air placed in the volume of 'ignore'. The
unnecessary placing of air also slows the function.

Add a check for 'ignore' nodes when removing decorations.
2017-06-16 02:17:25 +01:00
paramat f55816f93a Mgv6 mudflow: Avoid partially removed stacked decorations
Recently we started to remove decorations if the dirt below was flowed away,
but this did not check for stacked decorations, causing them to have only
their lowest node removed.
Also, placed mud could partially bury stacked decorations.

Remove 'old_is_water' bool which on testing is never true.
Add new function 'moveMud()' to reduce indentation.
Remove stacked decoration nodes above a removed decoration.
Remove stacked decorations partially buried in placed mud.
2017-06-15 00:38:08 +01:00
Rui bbe3dd9a7a Fix no sound bug (#5968) 2017-06-14 17:21:08 +02:00
Loïc Blot ddcd026344 Remove legacy content_abm.{cpp,h} 2017-06-14 16:23:08 +02:00
Rui 683ab3a154 Fix the serialization error by ff73c7a (#5964) 2017-06-11 21:20:50 +02:00
Loïc Blot 65819f3b9f Use thread_local instead from some static settings (#5955)
thread_local permits to limit variable lifetime to thread duration. Use it on each setting place which uses static to cache variable result only for thread lifetime. This permits to keep the same performance level & reconfigure server from MT gui in those various variables places.

Add thread_local to undersampling calculation too.
2017-06-11 13:58:43 +02:00
Rui ff73c7a5da Sound: Add pitch option (#5960)
* Sound: Add pitch option
2017-06-11 13:58:26 +02:00
red-001 26e2eb019a Improve the path select GUI (#5852)
- Allow lua to chose whatever directories or files can be selected
- Fix selecting directories
- Rename dialog to `guiPathSelectMenu` from `guiFileSelectMenu`
- Rename lua function for opening the menu from `show_file_open_dialog` to `show_path_select_dialog`
- Remove duplicate code and fix code style.

Related changes
- fix `clang-format` whitelist.
- Regenerate minetest.conf.example
2017-06-11 09:43:31 +02:00
ShadowNinja 6c5e5e2023 Remove threads.h and replace its definitions with their C++11 equivalents (#5957)
This also changes threadProc's signature, since C++11 supports arbitrary
thread function signatures.
2017-06-11 09:43:05 +02:00
QrchackOfficial 5cc8ad946e Remove superfluous pointer null checks 2017-06-10 21:04:47 -04:00
number Zero 7bfd53ba58 Plantlike meshoptions: Fix inverted random vertical offset 2017-06-11 02:12:33 +01:00
paramat 842acbfad2 (Re)spawn players within 'mapgen_limit'
Previously, findSpawnPos() did not take the 'mapgen_limit' setting into account,
a small limit often resulted in a spawn out in the void.
Use the recently added 'calcMapgenEdges()' to get max spawn range through a new
mapgenParams function 'getSpawnRangeMax()'.

Previously, when a player respawned into a world, 'objectpos_over_limit()' was
used as a check, which was inaccurate.
Use the recently added 'saoPosOverLimit()' to get exact mapgen edges.

Also fix default value of 'm_sao_limit_min'.
2017-06-11 02:11:08 +01:00
red-001 25ae0739ed Add a server-sided way to remove color codes from incoming chat messages (#5948)
These code be generated by CSM, a modded client or just copy and pasted by the player.

Changes
- Update configuration example and setting translation file.
- Remove colour codes before logging chat.
- Add setting to remove colour codes before processing the chat.
2017-06-10 13:49:44 +02:00
Loïc Blot ab128e03ff C++11 patchset 6: forbid object copy using assigment/copy function deleters (#5945)
C++11 implement function deleting, it's generally used to prevent some object copy
In script API use this function removal on ScriptApiBase instead of ScriptApiClient/Server/MainMenu, this affect all ScriptApis
Move DISABLE_CLASS_COPY with constructor, the deleted function permit to replace function in its original place
2017-06-10 13:49:15 +02:00
Thomas--S 9c497aa71f Order es_DrawType exactly like enum NodeDrawType in nodedef.h (#5946)
This will help to avoid some strange bugs.
2017-06-10 13:24:05 +02:00
red-001 740b4bec07 Fix sending color codes to clients that don't support them. (#5950)
Also remove `disable_escape_sequences` since it's not needed anymore.
2017-06-09 21:39:25 +02:00
DS 44495ea719 CSM: Fix documentation error for register_on_*_chat_messages (#5917) 2017-06-09 15:48:04 +02:00
red-001 4221c1b441 Have the server send the player list to the client (#5924)
* Have the server send the player list to the client

Currently the client generates the player list based on the Client active object list, the issue with this is that we can't be sure all player active objects will be sent to the client, so this could result in players showing up when someone run `/status` but auto complete not working with their nick and CSM not being aware of the player
2017-06-08 15:30:09 +02:00
Loïc Blot 5bd33a1586 C++11 patchset 5: use std::threads and remove old compat layer (#5928)
* C++11 patchset 5: use std::threads and remove old compat layer

* use pragma once in modified headers
* use C++11 function delete for object copy
2017-06-08 10:40:11 +02:00
Paramat 0a5c3c2852 Autorun: Change to 'autoforward' (#5926)
Minetest does not have 'run'.
Automatic forwards is very often used while flying or swimming, so a general
word is more suitable.
2017-06-08 09:57:00 +02:00
red-001 47bcf2f7ac Use a settings object when generating world.mt and set player_backend to sqlite. (#5940)
* Use a settings object when generating world.mt and set player_backend to sqlite.

* Update subgame.cpp
2017-06-08 09:50:51 +02:00
red-001 c91a8c7061 [CSM] Add function to get player privileges (#5933)
* [CSM] Add function to get player privileges + move related help functions to common

* Added @Zeno- const
2017-06-07 09:09:06 +02:00
Loic Blot 6c55874417
DragonflyBSD & NetBSD build fix 2017-06-06 23:02:03 +02:00
Loïc Blot d4c0f91275 Use C++11 mutexes only (remove compat code) (#5922)
* Fix event LINT & remove default constructor/destructors
* remove compat code & modernize autolock header
2017-06-06 16:29:28 +02:00
Loïc Blot 8bdde45895 Revert "Remove deprecated code segments (#5891)"
This reverts commit 599e13e95e.
2017-06-06 16:19:04 +02:00
Elijah Duffy fee5171298 Main Menu: Add get_clientmodpath API (#5912)
Add `core.get_clientmodpath` to main menu API (also possible in async calls).
2017-06-06 14:34:31 +02:00
Loïc Blot b3dfe5332c C++11 patchset 3: remove Atomic/GenericAtomic and use std::atomic (#5906) 2017-06-06 14:34:14 +02:00
red-001 a6678d6e5a Remove old network code (#5921) 2017-06-06 07:57:35 +02:00
Loic Blot 718121df91
Remove SharedPtr, it's not used and will be never used, we use C++11 2017-06-05 09:36:13 +02:00
Thomas--S 599e13e95e Remove deprecated code segments (#5891) 2017-06-04 21:42:32 +02:00
Loïc Blot a98baef5e4 C++11 patchset 2: remove util/cpp11.h and util/cpp11_container.h (#5821) 2017-06-04 21:00:04 +02:00
Loic Blot bf6569b570 Minetest for C++11 (CMakeLists + Travis)
* Move GCC to GCC 6 & GCC 7
* Move Clang to Clang 3.6 & Clang 4.0
* LINT moves from Clang 3.9 to Clang 4.0
* Move XCode 7.3 to 8.0
* Use more travis tricks to install compilers instead of adding complexity to our build script
* Clang format fixes on checked files (compat Cpp11 instead of Cpp03)
* Mingw GCC update from 4.8.4 to 5.3 (Ubuntu Xenial)
* Drop mingw cmake generated files and add them to gitignore
2017-06-04 09:57:08 +02:00
Casimir 0e58168fe5 Mapgen v6: Use snow blocks in tundra and remove them from taiga (#5827)
* Mapgen v6: Use snow blocks in tundra and remove them from taiga

* Use snowblocks in tundra above dirt with snow
2017-06-04 09:37:30 +02:00
ShadowNinja 7786521f15 Fix segmentation fault with tool capabilities (#5899) 2017-06-03 23:59:17 +02:00
Vincent Glize dd0a058e1f Snake case for screen options in minetest.conf (#5792) 2017-06-03 22:02:07 +02:00
Loïc Blot c6d5441105 Properly remove SAO when worldedges are overtaken (#5889)
* LuaEntitySAO: Remove beyond outermost mapchunk edges

Based on a commit by, and with help from, nerzhul.
Add 2 functions to class Mapgen:
A function to calculate actual mapgen edges, called from the Mapgen constructor.
A function called indirectly from content_sao.cpp per entity step to check SAO
position is within mapgen edges.

* Calculate borders from params not mapgen, which is not available everytime
2017-06-03 19:57:02 +02:00
SmallJoker 7a2b9df970 Tooltips: Unify the tooltip[] and list[] description tooltip display functions (#5848)
* Tooltips: Unify the tooltip[] and list[] description tooltip display functions
2017-06-03 08:55:26 +02:00
Dániel Juhász 001de6ffba Do not shade inventory items with textures (#5869)
This commit restores the old behavior: if an inventory item has an own
inventory texture, it will not be shaded.
2017-06-01 23:18:55 +02:00
Loïc Blot 1c69476d9f Show singlenode mapgen to menu (#5868)
Fix #5867
2017-06-01 23:18:24 +02:00
red-001 a7787bb9d2 Fix dropdown menu selection (#5847)
This fixes a bug that occurred when the selection list of a drop down menu was changed but the name was still the same.
2017-06-01 08:00:26 +02:00
red-001 6444963fb1 Nametag: remove colour codes before calculating alignment. (#5862) 2017-05-31 20:07:33 +02:00
stujones11 1681a009bc Don't add damage flash while punch texture modifier is active (#5767) 2017-05-29 23:26:25 +02:00
Loïc Blot ef152428ef guiVolumeChange: prevent wrong value position by using 1 label instead of 2 (#5839)
* Use only one label instead of two for the soundText, this permit to ensure both label & values are aligned
* Add '%' character too, to reflect it's a percentage volume
* Remove rect on regenerateGui (upper part) which shadows outer part and which is not needed outside of the DesiredRect affectation

Fix issue #5837
2017-05-28 15:23:30 +02:00
paramat 210a339dce Mapgen files: Update and correct copyright credits 2017-05-26 20:46:03 +01:00
SmallJoker d99b6fed55 Time: Change old `u32` timestamps to 64-bit (#5818)
MacOSX build fix + cleanups
2017-05-26 14:03:36 +02:00
Loïc Blot 4d5ce8478c Enhance ABM performance a little bit by removing two std::set copy (#5815)
* Enhance ABM performance a little bit by removing two std::set copy

* ActiveBlockModifier::getTriggerContents now returns a const ref
* ActiveBlockModifier::getRequiredNeighbors now returns a const ref
* ActiveBlockModifier::getRequiredNeighbors is now purely virtual

* Little code style fix
2017-05-25 16:43:55 +02:00
Paramat 5b338638e0 Mgv6 mudflow: Remove decoration if 'dirt with grass' below flows away (#5798)
Mudflow of a neighbouring mapchunk extends into a mapchunk's edge, and could
remove 'dirt with grass' from under a decoration, creating unsupported
decorations.

Remove any decoration above if a 'dirt with grass' node is removed by mudflow.
2017-05-25 12:46:34 +02:00
red-001 2f291e6685 Close formspec on client shutdown. (#5811)
This ensures the shutting down progress bar is correctly rendered. This fixes #3050.
2017-05-25 12:46:24 +02:00
Loïc Blot 099624a513 Revert 1469424 and fix wrong char position when doing mouse selection on intlGUIEditBox (#5806)
* Revert 1469424075 and fix wrong char position when doing mouse selection on intlGUIEditBox

position should look at current line not the whole text and shift 1 character on the last line (due to \0 string delimiter)

* Finish the fix and prevent values under zero for getCursorPos which crash the program if found

* Forget to remove old comment

* fix zero to NULL

* Fix typo
2017-05-24 08:56:40 +02:00
Loic Blot c445a3d958
Fix wrong return value in get_sky Lua call since ad9fcf859e
Fix #5803
2017-05-23 19:59:47 +02:00
Paramat 9ff5302c8b Client crashfix: load meta after digging (#5801)
Fixes a crash caused in MTGame by breaking and right-clicking a chest.

If loading meta, digging, node can disappear and we looked at meta, which is wrong because meta became NULL.

Pointer is invalidated and we read wrong memory area
2017-05-23 19:54:37 +02:00
Loic Blot 05309229b8
LINT fix & check all files with clang-format
Seems the diff mode doesn't work well, PR are detected as working whereas in master it's shown it's problematic (and really problematic). Use same check everywhere
2017-05-22 07:28:35 +02:00
Pierre-Adrien Langrognet 39f4a2f607 [CSM] Add send_chat_message and run_server_chatcommand API functions (#5747)
* [CSM] Add send_chat_message and run_server_chatcommand API functions

* Add client-side chat message rate limiting

* Limit out chat queue size

* [CSM] Add minetest.clear_out_chat_queue API function and .clear_chat_queue chatcommand

* Last fixes/cleanups before merge
2017-05-21 23:06:51 +02:00
Loic Blot de840fe271
Fix LINT broken by dfa0c15ce0 2017-05-21 17:30:00 +02:00
bigfoot547 dfa0c15ce0 [CSM] Add function to get the definition of items (#5732)
Add node def and item def documentation.

Please be ready for merge!
2017-05-21 14:40:55 +02:00
red-001 ae483f1bd0 Prevent fall damage from overflowing when falling from a large height. (#5791) 2017-05-21 11:18:38 +02:00
Loïc Blot 90808a4f34 Real control fix (#5787)
* Allow enabling and disabling mods.

* Re-fix 605599b6f1

This breaks some chars like € in chat.

Instead verify is char is a non control char -> iswcntrl
2017-05-20 22:29:15 +02:00
you 358074b296 Fix instant digging (#5785)
Use runData.dig_time_complete instead of params.time to find out whether it's instant digging.
runData.dig_time_complete is set to something very big if the node can't be dug, whereas param.time is 0 when digging is impossible or it's instant digging. So not using param.time fixes #5728.
2017-05-20 20:43:13 +02:00
Loic Blot a2bb776ea8
Fix wchar_t type on 605599b6f1
event.KeyInput.Char is a wchar_t, iswprint should be used
2017-05-20 20:13:29 +02:00
Paramat 60baf8120c Particle spawner: Do not spawn particles distant from player (#5766)
Previously, every particle was rendered by (even if not actually visible to)
the client regardless of distance. This significantly reduced client FPS.

Acts clientside, particle spawners are always sent to clients, but each
particle is checked for distance from the player.
As with 'add particle' the distance limit is set to 'max block send distance'
as this determines how far a client can see.
2017-05-20 16:46:35 +02:00
SmallJoker af2f02552f [CSM] Correct the log destination of print() (#5784) 2017-05-20 16:46:12 +02:00
red-001 772944daf6 Fix CSM crash (#5779)
Caused by dc5bc6c and them made worse by 5ebf8f9
2017-05-20 16:45:49 +02:00
Loïc Blot 8797a0aa4b chat.cpp fix wchar_t isspace -> iswspace & wrong isspace on an index (#5783) 2017-05-20 12:56:02 +02:00
numberZero 7779bac3a5 Cleanup in content_mapblock (#5746)
NDT_LIQUID is being drawn by MapBlockMesh since a long time ago...
2017-05-20 12:29:54 +02:00
red-001 1ff5ee0b69 Improve password change menu (#5757)
- Fix the GUI getting messed up when resizing
- Save the input when resizing
2017-05-20 12:29:44 +02:00
Craig Davison 605599b6f1 Fix shift key producing space in console (#5777)
* Fix shift key producing space in console
2017-05-20 12:29:31 +02:00
red-001 00972d42d7 this might fix #5661, needs testing (#5775) 2017-05-20 10:48:44 +02:00
Loic Blot 1469424075
Fix input regression introduced by a4a377ecad
Fix #5776
2017-05-20 10:12:54 +02:00
Zeno- d176dabeb4 Fix mem leak in mesh cache (#5781) 2017-05-20 08:16:16 +02:00
Loïc Blot ce9802266e Various code cleanup & little performance improvement on HTTP download (#5772)
* Disable or remove unused enum members/functions
* Tiny code style fixes
* Make some functions const
* Replace ClientMediaDownloader std::unordered_map with std::map
2017-05-20 08:15:56 +02:00
you 35267406aa Do not create dummy normalmaps (#4180)
fixes #1811
2017-05-19 08:08:12 +02:00
you a4a377ecad Fix textarea bug: clicking right of the end of a line caused the cursor to be in one of the next lines (#3474) 2017-05-19 07:57:21 +02:00
Dániel Juhász 75c393c915 Fix alpha for liquid nodes (#5494) 2017-05-19 07:46:10 +02:00
SmallJoker 674400523e Mainmenu: Fix issues while trying to enable all mods (#5770) 2017-05-19 07:45:47 +02:00
Loïc Blot e25a38e3fb When minimap is disabled in configuration, really disable it (#5771)
* When minimap is disabled in configuration, really disable it
2017-05-19 07:25:27 +02:00
Loic Blot 1c6d2f596d
Fix a warning pointed by GCC 7.1
lua_tonumber overflow in snprintf (12 bytes and only 10 can be written)
2017-05-18 20:55:27 +02:00
Paramat 0443620c5e Particles: Do not send single particles to distant clients (#5760)
Previously, every individual particle on a server is sent to, and rendered by
(even if not actually visible), every client regardless of distance. This
significantly reduces client FPS and creates unnecessary network traffic.
Maximum distance is set by 'max block send distance' as this determines how far
a client is able to see.
2017-05-17 10:37:28 +02:00
paramat fd32005b0f Caverns: Remove unnecessary liquid excavation
Also disable CavesRandomWalk at a safer distance from caverns.

Excavating liquids in cavern code is unnecessary as in practice we are already
successfully disabling the generation of liquid caves that could intersect
with caverns and cause excessive amounts of spreading liquids in caverns.

However to be safer this commit now disables liquid caves at a larger distance
from caverns, to compensate for liquid caves being able to generate up to a
mapblock beyond a mapchunk border.

Not excavating liquids in cavern code also allows a feature i am working on in
experimental new core mapgens, but also allows for more flexibility in future.
2017-05-16 21:56:51 +01:00
Loic Blot 582ee15d8e
Fix a memleak pointed by @Zeno- in MeshUpdateQueue
This leak was introduced when added cache to MeshUpdateQueue and only occurs when leaving world.
2017-05-16 08:27:18 +02:00
Zeno- 1bf9b25fb4 Fix uninitalised variable in event.cpp (#5764) 2017-05-15 20:10:29 +10:00
ezhh 018217f6b2 Add option to use neither node highlighting nor outlining 2017-05-15 19:51:40 +10:00
SmallJoker febd07fc0d No cursor lock when window inactive (#5754) 2017-05-13 17:42:42 +02:00
Loïc Blot 6673aff685 Limit properly the sound setting at updateSound runtime step (#5753)
* Limit properly the sound setting at updateSound runtime step

Fix #5026

* Add a comment
2017-05-13 12:03:11 +02:00
Loïc Blot 9b8ca3a746 Move KeyList & InputHandler from game.h to client/inputhandler.h (#5752)
* Move KeyList & InputHandler from game.h to client/inputhandler.h

We have a header for inputs, move inputhandler class & related keylist object to it

Also introduce a cpp file for MyEventReceiver::OnEvent function in inputhandler.h because a so huge function doesn't needs to be inlined

* Pass clang-format on inputhandler.{cpp,h} (compatible)
2017-05-13 11:05:16 +02:00
Loic Blot 5cb7f6a9b7
Android build fix 2017-05-13 09:10:43 +02:00
red-001 98327a59c4 Minor pause/escape menu improvements (#5751)
- Split movement keys into separate entries.
- Increase buffer size due to the above change.
- Change capitalisation.
- Remove code-style violating white spaces.
2017-05-13 08:50:19 +02:00
red-001 0e0c824ea7 Rework escape/pause menu (#5719)
* Rework escape/pause menu

- Remove build information
- Use current controls instead of default controls
- Add information about the current server in place of the build information
- Add text saying the game is paused to if in singleplayer mode.
rework pause/escape menu

* improve consistency + display server_name
2017-05-11 10:39:37 +02:00
sfan5 071e114ffa Private nodemeta (#5702)
* Private node metadata that isn't sent to the client
2017-05-10 15:29:21 +02:00
red-001 8729e7daec Add cancel button to password change menu. (#5720)
* Add cancel button to password change menu.
2017-05-09 11:04:45 +02:00
paramat da88a18676 Revert custom player collision box and step height commits
These caused inability to pass through 2 node high spaces or step up onto slabs
or steps when a new client connected to an older server.
2017-05-09 03:52:28 +01:00
Loïc Blot c07c642ab0 read_schematic_replacements: ensure fields are strings (#5726)
* read_schematic_replacements: ensure fields are strings

add a type check before reading strings on read_schematic_replacements deserializer

* throw LuaError instead of asserting the whole client
2017-05-08 20:43:03 +02:00
paramat 5e04f1a335 Custom step height: Fix implementation
Recent commit 45ab62d6a3 had a coding error that
made climbing out of water difficult due to an incorrect value of the step height
when not 'touching ground'.
It also incorrectly multiplied the custom stepheight by BS, resulting in being
able to step-up 2 nodes if set to the default of 0.6, or even 0.3.
Also the implementation was wrong because it customised the step height when
not 'touching ground', this step height is for a slight rise when catching the
edge of a node during a jump, and should always remain at 0.2 * BS.
2017-05-08 05:59:19 +01:00
paramat 3342dcc4bc Shaders: Remove unused water surface shader
Also remove hardcoded MTGame node.

The 'water surface shader' was duplicated shader code in preparation for
intended new water surface shaders. For development purposes the MTGame node
'default:water_source' had it's top tile assigned to 'water surface shader'.
Due to shader duplication this commit does not cause any change to shader
behaviour.
2017-05-08 05:58:59 +01:00
Loïc Blot c1b3ed4180 Player attrs: permits to remove an attribute by setting value to nil (#5716)
* Player attrs: permits to remove an attribute by setting value to nil

When doing player:set_attribute("attr", nil) remove attribute

Also remove a useless check on C++ API part (already done by checkplayer)

Fix #5709
2017-05-07 12:13:15 +02:00
Loic Blot 0d7c37943b
LINT fix since d067894816 2017-05-07 11:07:17 +02:00
paramat 2d5bd7f414 Player properties: Set correct default collisionbox
Recent commit b6f4a9c7e1 removed a hardcoded
player collisionbox which resulted on falling back to an incorrect default.
This stopped players walking through 2-node high spaces and made the player
slightly wider.

Improve docs for custom player collisionbox feature and reformat nearby lines.
2017-05-07 06:10:13 +01:00
T0ny2 d067894816 Replace occurrence of luaL_reg in l_camera.cpp
Related to commit 41c5483. Replace an occurrence of luaL_reg in
src/script/lua_api/l_camera.cpp (added by commit de028fc).
2017-05-07 06:09:30 +01:00
ShadowNinja c6e96c645b Fix myfloor(0.0) 2017-05-06 16:10:03 -04:00
ShadowNinja 77597c4ff3 Clean up numeric.h and split FacePositionCache from it
I also optiized FacePositionCache a bit: I removed a map
lookup and vector copy from both branches of getFacePosition.
2017-05-06 16:09:45 -04:00