Commit Graph

5251 Commits

Author SHA1 Message Date
Paramat
4ccd18d5ec
Mgv7: Code cleanup (#7299) 2018-05-07 03:31:55 +01:00
SmallJoker
d99a033fd6
Fix builtin inventory list crash when size = 0 (#7297) 2018-05-05 22:37:07 +02:00
Paramat
21c720755b
Cavegen: Allow small RandomWalk caves to generate beyond mapchunk border 2018-05-04 18:22:56 +01:00
Vincent Glize
24b6bd0f67 Fix invisible chat error messages (#7289) 2018-05-01 19:38:37 +02:00
Kuma_jjw
55bb1938c1 nodedef: Delete two unused method definitions (#7288) 2018-04-30 19:15:11 +02:00
JDCodeIt
5862d9e482 Global new() or grab() to be managed in constuctor only (#7235 partial) (#7236)
* g_extrusion_mesh_cache new() and grab() to be managed in constuctor only (#7235 partial)

This global was getting grab()-ed by each call to getItemMesh, incrementing its reference count. What was to be the final drop() in the destructor ended up with > 0 reference count, so memory not freed by Irrlicht.
2018-04-30 19:14:28 +02:00
SmallJoker
ba91624d8c
Allow damage for attached objects, add attach/detach callbacks (#6786)
* Allow right-clicking on attached LuaEntities
2018-04-30 18:43:49 +02:00
rubenwardy
0b5b32b026 MetaDataRef: Add contains() and get() (#7214) 2018-04-30 18:42:51 +02:00
Paramat
54606e103d
Mapgen caves: Re-order generation to fix cavern bug
Previously, caverns confused tunnel generation causing biome top and filler
nodes to appear in caverns.
Split 'generateCaves()' into 2 functions to separate tunnel and large
randomwalk cave generation.
In each mapgen re-order cave generation to generate tunnels before caverns.
2018-04-29 07:20:46 +01:00
paramat
bb3baef30f Biome-defined cave liquids: Use faster biome calculation 2018-04-26 17:28:37 +02:00
paramat
9d7335a99c Biome-defined dungeon nodes: Use faster biome calculation 2018-04-26 17:27:06 +02:00
Paramat
454f80a0f7
Dungeons: Mostly fix missing stair nodes 2018-04-25 00:44:49 +01:00
Paramat
534971ccd0
Mgvalleys: Code cleanup
Split some long lines.
Edit comments.
Remove unnecessary comments and unnecessary commented-out code.
Use std::fmax/fmin instead of MYMAX/MYMIN.
Remove scope-limiting braces.
Consistently define literals as floats, except in noise parameters.
Cleanup literals in noise parameters.
Remove unnecessary 'near_cavern' line.
Reduce max spawn y to be consistent with other mapgens.
2018-04-24 01:34:48 +01:00
rubenwardy
06dd7c051c Move ASCII art to std::cerr, to remove it from logs 2018-04-23 23:04:20 +01:00
Thomas--S
9577a4396a Formspecs: Allow setting alpha value for the box[] element 2018-04-23 18:50:50 +01:00
Paramat
12a8f8826d
Mgvalleys: Use shared tunnel / cavern code instead of internal
Caverns first appeared in mgvalleys and were later added to other
mapgens as shared code. Now this shared code can replace mgvalley's
internal cavern code.
Also use shared tunnel code instead of internal code.

Changes to mapgen that will affect existing worlds (mgvalleys is not
stable):

Single lava and water sources not added in tunnels.
Previous caverns are unchanged but an equal number of new ones are
added at a distance from the previous.
From y = -256 to 192 nodes below, where the caverns taper at their
upper limit, they will have a slightly different shape as the taper
is now linear.
2018-04-21 22:50:36 +01:00
Paramat
5abd0efb90
Cave liquids: Use a more precise point for calculating biome
Use the centre point of the route being carved for a more precise match
between cave liquids and biome.
2018-04-21 20:35:29 +01:00
mazocomp
cb92cdf3a4 Fix i386 bit build at OpenBSD (#7259) 2018-04-21 21:33:38 +02:00
Paramat
0e554706ac
Node resolver: Make error on fallback optional, disable for mapgen aliases 2018-04-20 20:26:30 +01:00
rubenwardy
87ad4d8e7f
Add online content repository
Replaces mods and texture pack tabs with a single content tab
2018-04-19 20:14:53 +01:00
SmallJoker
9877a1a207 Fix wrong channel number representation in logs (#7205) 2018-04-18 21:26:28 +02:00
Ben Deutsch
3eac249464 PlayerSettings struct for player movement code (#7243)
Instead of calling g_settings->getBool("flag") multiple times
during each movement step, the current settings are cached
in a new player object member. Updated via registered callbacks.
2018-04-18 20:56:01 +02:00
Muhammad Rifqi Priyo Susanto
b1e58c9c35 Android: Modify touch screen GUI's buttons (#7240)
* Android: Add zoom, minimap, and toggle chat button
Zoom button is put above jump button.
Minimap and toggle chat button are put in settings bar.
* Jump button is rotated down button
* Move three buttons on the right screen higher
2018-04-18 20:55:42 +02:00
Paramat
cca925377b
Cavegen: Fix variable typo that broke mgvalleys large cave distribution (#7249)
Fix elusive 5 year old bug that caused mgvalleys large caves to be flat and
limited to mapchunk borders.
Error was fixed 2 years ago in 'CavesV6' but not in 'CavesRandomWalk'.
2018-04-17 22:25:59 +01:00
Paramat
28813702d6
FOV: Raise lower limit to avoid zoom-loading of distant world (#7234)
In the client, raise lower limit from 30 to 45 degrees, to avoid server
seeing this as a zoom and loading world beyond the server-set limit.
Add minimum in settingtypes.txt and enforce lower limit when set using
minetest.conf.

In the server, distrust the client-sent FOV if below the heuristic zoom
threshold and use the player object property 'zoom_fov' to check it, to
protect against hacked clients.
2018-04-15 21:56:05 +01:00
Muhammad Rifqi Priyo Susanto
326eeca306 Android: Replace movement buttons with joystick (#7126)
* Android: Replace movement buttons with joystick

Replace movement control buttons (arrows at bottom left screen) with virtual joystick.
Joystick has 8 directions (same as keyboard). Basically, just map it to keyboard input.
Joystick applies only on left 1/3 of screen.
Joystick's position can be fixed by enabling fixed_virtual_joystick setting.
Three new images:
(1) placeholder joystick,
(2) joystick container (background), and
(3) joystick cursor.
Remove unused images: movement control buttons (*_arrow.png).
New data type: touch_gui_joystick_move_id

Joystick's fixed position is spaced one button size from bottom and from left of screen.
Remove unused variable: m_joystick_downlocation
2018-04-10 22:55:17 +02:00
sfan5
22ebbe136a
Fix segfault caused by wrong wgettext() 2018-04-09 16:25:57 +02:00
minduser00
9a06d6aa9f Fix for translating empty strings
Fix for incorrect translation of empty strings

In the key change menu, when a button key not have name an empty string is passed to gettext.
The empty string is reserved for gettext to return de header of the .po file an this is shoved in the button
2018-04-09 15:13:53 +02:00
SmallJoker
d58801ab32 upright_sprite: Fix texture position for players
Fixes #6471
2018-04-09 15:06:40 +02:00
Paramat
af868421da
Sun colour: Undo colour change. Remove double assignment (#7227)
Commit 5070ca2111 changed sun colour by
fixing what seemed to be a code mistake.
Return to the standard colour but comment-out the first assignment of the
double-assignment for performance.
Add a comment to explain.
2018-04-09 02:23:47 +01:00
Paramat
746ca41f58
Biome API / dungeons: Add biome-defined dungeon nodes
Add new biome fields 'node_dungeon', 'node_dungeon_alt', 'node_dungeon_stair'.
If 'node_dungeon' is not defined dungeons fall back to classic behaviour.

Remove messy and imprecise dungeon material code from 'generateBiomes()'.
Code deciding dungeon materials is now in 'generateDungeons()' and uses the
biome at mapchunk centre for more precision.

Remove hardcoded 'MG_STONE' types as long intended.
2018-04-07 22:09:54 +01:00
Vitaliy
460b375cad Fix SAOM (#7200)
* Bugfix
2018-04-06 16:33:43 +02:00
rubenwardy
91615f9588 Add player:get_meta(), deprecate player attributes (#7202)
* Add player:get_meta(), deprecate player attributes
2018-04-06 10:52:29 +02:00
Paramat
7e3f88f539
Mgcarpathian: Fix spawn level calculation (#7212) 2018-04-06 00:10:16 +01:00
Paramat
5701f9e389
Mgcarpathian: Remove insignificant 'base' noise variation (#7209)
Was only +-1 node over a scale of thousands of nodes.
Replace with 'base_level' parameter value.
2018-04-05 21:52:10 +01:00
Paramat
c6975febba
Zoom adjustDist(): Improve variable name (#7208) 2018-04-05 20:15:38 +01:00
Paramat
32d456bd2d
Biome API / cavegen: Add definable cave liquid for a biome (#7192)
Add 'node_cave_liquid' as a new field in biome registration.
If field is absent cave liquids fall back to classic behaviour.
2018-04-05 17:21:41 +01:00
Loïc Blot
077f231111
[clang-tidy] Promote some performance-* as a coding error (#7194)
* Promote performance-type-promotion-in-math-fn as a coding error
* Promote performance-faster-string-find too (which is not problematic currently)
* Same for performance-implicit-cast-in-loop
* Fix remaining tidy points
2018-04-04 20:49:42 +02:00
Loïc Blot
392e80e3f1
Huge LBM lookup performance improvement on mapblock loading (#7195)
* Huge LBM lookup performance improvement on mapblock loading
2018-04-04 10:56:46 +02:00
Loic Blot
5070ca2111
Fix 5 issues reported by PVS studio
* src/sky.cpp  146     warn    V519 The 'suncolor_f.r' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 142, 146.
* src/sky.cpp  147     warn    V519 The 'suncolor_f.g' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 143, 147.
* src/sky.cpp  148     warn    V519 The 'suncolor_f.b' variable is assigned values twice successively. Perhaps this is a mistake. Check lines: 144, 148.
* src/threading/thread.cpp     63      err     V730 Not all members of a class are initialized inside the constructor. Consider inspecting: m_thread_obj.
* src/server.cpp       3243    err     V595 The 'log' pointer was utilized before it was verified against nullptr. Check lines: 3243, 3258.
2018-04-04 08:40:31 +02:00
Loic Blot
8e0b80aa36
Fix last performance-type-promotion-in-math-fn problems 2018-04-04 07:42:40 +02:00
Loïc Blot
a90d27e1e2
Optimize a little bit isBlockInSight, adjustDist & collisions (#7193)
* Use constexpr + unroll some calculations to cache definitively some calculations
* Unroll some calls in collision code & use a constref instead of a copy in one occurence
2018-04-04 00:43:08 +02:00
Loic Blot
05fe3b06c8
Fix last clang-tidy reported problems for performance-type-promotion-in-math-fn
Based on https://travis-ci.org/minetest/minetest/jobs/361810382 output

Also fix 2 missing copyright notices
2018-04-03 23:05:22 +02:00
Loic Blot
4827f754ec
Fix more clang-tidy reported problems for performance-type-promotion-in-math-fn
Based on https://travis-ci.org/minetest/minetest/jobs/361714253 output
2018-04-03 21:58:29 +02:00
Loïc Blot
67a4cb7d8a Fix various clang-tidy reported performance-type-promotion-in-math-fn 2018-04-03 18:16:17 +02:00
SmallJoker
baca933b6b
Selected ItemStack: Reduce black magic (#6520)
* Selected ItemStack: Reduce black magic
Better button variable value naming
2018-04-03 11:15:58 +02:00
Vitaliy
528908a4c3 Optimize entity-entity collision (#6587)
* Add IrrLicht type aliases
* Add hash for IrrLicht vector
* Add object map
2018-04-03 08:23:46 +02:00
Loïc Blot
2481ea27ce
Fix many issues reported by clang-tidy (#7189)
* Fix many issues reported by clang-tidy

We have many issues in code related to some performance to float <-> double.
Clang-tidy reported it in performance-type-promotion-in-math-fn

I fixed many of them. It's not ready for a promote to blocking

Also fix some value which should be const-ref
2018-04-02 23:51:08 +02:00
SmallJoker
e98fd934ce 'fix' LINT, use InventoryLocation== 2018-04-02 17:18:48 +02:00
SmallJoker
9fa547bb80 Run callback in IDropAction, refactor function arguments 2018-04-02 17:18:48 +02:00
SmallJoker
f6eff57f7c Add player inventory callbacks 2018-04-02 17:18:48 +02:00
you
12edb200eb Formspecs: Use mouse wheel to pick up and deposit single items 2018-04-02 15:52:07 +01:00
Loïc Blot
d88c4e1822
LINT: add clang-tidy step (#6295)
* Implement new travis clang-tidy build step

* This step enable some rules and enforce one rule as error
* This permits to have some C++ quality rules based on clang & clang contributor guidelines

* Fix clang-tidy reported problems on push_back -> emplace_back
2018-04-01 23:57:55 +02:00
you
93eb0794d6 ObjectRef: Add add_velocity() (#3208)
Allow changing the velocity of objects relatively to their current velocity
2018-03-31 14:50:17 +02:00
SmallJoker
0a8ca59891 event.h: Fix import GCC warning caused by ce87310 2018-03-31 14:33:54 +02:00
Loïc Blot
ce873108aa
Client eventmanager refactor (#7179)
* Drop EventManager from GameDef & do some client cleanups

* EventManager is only used by Client. Don't expose it on Server & GameDef for nothing
* Drop Client::event() in favor of direct calls to getEventManager
* Cleanup some event put from new + put to put(new)
* MtEvent: add Type(u8) enum
* This will enhance event performance & ensure stricter type
* Drop MtEvent::checkIs (unused)

* clang-tidy reported fixes

* Code style

* Move event_manager.h to the client directory as it's only used by client

Add EventManager unittests + switch to unordered_map as order is not important here

Drop a unused function
2018-03-30 18:32:52 +02:00
Paramat
2c490dddc0
Mgcarpathian: Mapgen loop optimisations. fabs() -> std::fabs()
* Mgcarpathian: ZYX -> ZXY mapgen loop optimisation.

* 'pow(n, 3)' to 'n * n * n' type optimisations.

* fabs() -> std::fabs().
2018-03-29 21:08:42 +01:00
nOOb3167
376ed5cd3c Sound: fix static initialization order dependency by not having one (#7168)
Ensure singleton is reset
2018-03-29 21:43:57 +02:00
stujones11
821e3f7072 Optional alpha channel support for entities 2018-03-29 14:53:12 +01:00
Loic Blot
0396717256
Fix a warning introduced by c5b4e54174 2018-03-29 13:54:44 +02:00
Loic Blot
ef979ee2e9
Fix a warning reported by clang
minetest/src/script/cpp_api/s_player.h:27:1: warning: struct 'PlayerHPChangeReason' was previously declared as a class [-Wmismatched-tags]
struct PlayerHPChangeReason;
2018-03-29 13:37:24 +02:00
Loic Blot
83fc0fd2f1
Fix various Client class functions not marked as override (virtual)
Also switch some of them which are reported by clang-tidy
2018-03-29 13:33:32 +02:00
Andrew Ward
71b2570f09
Load dependencies and description from mod.conf 2018-03-28 22:14:16 +01:00
Andrew Ward
dfc8198349
Add reasons to on_dieplayer and on_hpchange 2018-03-28 16:05:18 +01:00
Andrew Ward
2323842dd3
Add formspec theming using prepended strings 2018-03-28 16:04:41 +01:00
nOOb3167
b0fef16a27 Guard sound manager initialization with "enable_sound" (#7167) 2018-03-26 17:44:40 +02:00
D Tim Cummings
9802e59724 macOS: don't require X11 libraries during compilation (#7149)
The xxf86vm needs to be removed from Apple builds to avoid CMake Error XXF86VM_LIBRARY is NOTFOUND
2018-03-26 17:43:59 +02:00
Paramat
2f280cc672
Mapgen: Remove unused mgv7 code and some unused biometypes 2018-03-26 04:59:49 +01:00
nOOb3167
43f98eb47c Make sounds stop playing when entering game or mainmenu 2018-03-24 16:05:26 +01:00
Loïc Blot
4fd9715876
Cleanup sound manager class (#7158)
* Cleanup sound manager client

* Use some const refs
* Use auto on iterators
* Drop unused parameters
* Move sound_openal.* to client folder
* Move sound.cpp + OnDemandSoundFetcher to client/ folder + reorganize includes properly
2018-03-24 15:45:25 +01:00
you
bcd22fc34c Print the mod loading time (#7137)
* Print the mod loading time
2018-03-24 00:31:33 +01:00
Loic Blot
eab652fd52
Fix some gcc 7.3 reported warnings
```
src/client/joystick_controller.h:85:2: warning: duplicate 'virtual' declaration specifier [-Wduplicate-decl-specifier]
        virtual bool isTriggered(const irr::SEvent::SJoystickEvent &ev) const;
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../include/c++/7.3.1/ext/new_allocator.h:140:22: warning: destructor called on non-final 'JoystickAxisCmb' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
                destroy(_Up* __p) { __p->~_Up(); }
/usr/bin/../lib64/gcc/x86_64-pc-linux-gnu/7.3.1/../../../../include/c++/7.3.1/ext/new_allocator.h:140:22: warning: destructor called on non-final 'JoystickButtonCmb' that has virtual functions but non-virtual destructor [-Wdelete-non-virtual-dtor]
        destroy(_Up* __p) { __p->~_Up(); }
```
2018-03-23 22:12:48 +01:00
nOOb3167
9293d8e271 Global initialization of sound using SoundManagerGlobal (#7063)
* Global initialization of sound using SoundManagerGlobal
2018-03-23 15:31:43 +01:00
Vitaliy
9fcc0c1217 Update mesh collector and move it to a separate file (#6904)
* Update MeshCollector

* Simplify MeshCollector
2018-03-22 20:59:49 +01:00
paramat
cd6bcef6d9 Minetest ASCII art: Move from actionstream to rawstream 2018-03-21 04:31:46 +00:00
Vitaliy
0358ae789a Fix node-nodebox lighting difference in direct sunlight (#7061) 2018-03-17 10:10:16 +01:00
Loic Blot
e800684ead
Fix a crash or random memory leak when reseting saved environment variable in test_servermodmanager.cpp 2018-03-16 19:34:41 +01:00
Loic Blot
478b785bc8
Drop Server::m_enable_rollback_recording it's only used in server constructor 2018-03-16 09:12:39 +01:00
Loic Blot
95ce5583a9
ServerEnvironment::loadDefaultMeta: Loading default meta is only possible for ServerEnv itself 2018-03-16 08:52:42 +01:00
Loic Blot
858c95630f
Forgot to remove obsolete Server::m_mods 2018-03-16 08:44:57 +01:00
Loïc Blot
6c184947c3
Server: delegate mod management & config to ServerModConfiguration (#7131)
* Server: delegate mod management & config to ServerModConfiguration (rename it to ServerModManager)

* Use c++11 range based loops
* Add unittests + experimental/default mod as a test case to permit testing mod loading in future tests
2018-03-16 08:41:33 +01:00
Loic Blot
5e61f64ce2
Fix an alone if to be with a missing else 2018-03-16 08:40:21 +01:00
paramat
19c993bc39 Biomes: Fix vertical biome blend 2018-03-16 02:59:38 +00:00
paramat
7ad6cdd09b Biome API: Add 'get_biome_name(biome_id)' API
Change name of default biome to a more suitable lowercase 'default'.
2018-03-11 23:06:17 +00:00
Loïc Blot
a09a994417
Add Voxelarea unittests (#7121)
* Add voxelarea unittests
2018-03-11 21:16:19 +01:00
Loic Blot
f7938fab9f
Finally fix android build 2018-03-11 17:52:46 +01:00
Loic Blot
a1c5a01142
Fix Android build, but there is a remaining linking issue in guiConfirmRegistration
* Also fix variable name overloading in guiConfirmRegistration
2018-03-11 17:45:58 +01:00
stujones11
22a891a925
Android build fixes for c++11 2018-03-11 16:56:27 +01:00
Vitaliy
cf8d579abc Drop texture file list cache (#6660) 2018-03-10 19:33:37 +01:00
SmallJoker
ee20433425 Fix typo in lighting code since bcdb3d5 2018-03-10 09:37:43 +01:00
paramat
644d0ab2bb Spawn level: Add 'get_spawn_level(x, z)' API
Returns a suitable player spawn y co-ordinate for unmodified terrain.
2018-03-10 03:38:27 +00:00
SmallJoker
473d81f2e2 Formspecs: Unify textarea and field parsing functions, fix wrong fallback text
* textarea[], field[]: Unify function, fix wrong fallback text
* Remove apparently superflous mainmenumanager.h incldue
* intlGUIEditBox.cpp: make read-only boxes really read-only
* Use elseif (trivial)
2018-03-09 23:24:57 +00:00
Loic Blot
12d1e4ff04 VoxelArea: add_{x,y,z,p} must be static
Fix some documentations issues
Use getNodeNoCheck(v3s16, ...) in some cases instead of getNodeNoCheck(x, y, z, ...)
2018-03-09 23:27:26 +01:00
Loic Blot
3b27cf30d9 Drop unused struct ModLicenseInfo & ModAuthorInfo + default constructor in ModMetadata 2018-03-09 23:27:26 +01:00
Loic Blot
2c860a6a42 ServerEnvironment & StaticObject cleanups
* isFreeServerActiveObjectId is now part of ServerEnvironment
* getFreeServerActiveObjectId is now part of ServerEnvironment
* StaticObject constructor now take ServerActiveObject instead of type + string. This permits to remove a big string copy in some code parts
2018-03-09 23:27:26 +01:00
Loic Blot
def46c6cdb Drop unused Server::m_ignore_map_edit_events_peer_id 2018-03-09 23:27:26 +01:00
Loic Blot
bcdb3d56c0 Variable name fix + structure creation unrolling in lighting code 2018-03-09 23:27:26 +01:00
Loic Blot
6036f865cb Drop less performant Server::setBlockNotSent for ClientInterface::markBlockposAsNotSent 2018-03-09 23:27:26 +01:00
paramat
1a88c4b7a5 Getv3intfield: Fix logic of return bool 2018-03-09 03:16:25 +00:00
paramat
cbb9301bea Biomes: Add 'min_pos'/'max_pos' xyz biome limits
'y_min' and 'y_max' are still accepted for compatibility.
2018-03-09 03:16:25 +00:00