Commit Graph

395 Commits (b41251ac770b47dbc2b99a98120ff06ac375fbc2)

Author SHA1 Message Date
Brandon a8dc572ecd Merge remote-tracking branch 'minetest/master' 2016-12-17 13:15:35 -06:00
Rogier 02112f84e2 View range: Set maximum to 4000 nodes
The network protocol does not support larger than 255 mapblocks.
2016-12-12 07:20:50 +00:00
Rogier-5 60772071e9 Fix computation of viewing range (in blocks) sent to server (#4882)
Fixes #4878

Also remove an artificial viewing range reduction that
(presumably) was added to compensate for miscomputed
viewing ranges, and that doesn't seem to be needed any
more (thanks to lhofhansl).
2016-12-11 19:49:49 +01:00
Lars Hofhansl 8a7dc838a8 Optimize block sent: Fix rendering issue 2016-12-03 02:34:45 +00:00
Brandon 68d51292ff Merge remote-tracking branch 'minetest/master' 2016-11-30 07:56:23 -06:00
lhofhansl 5dc6198878 Optimize/adjust blocks/ActiveObjects sent at the server based on client settings. (#4811)
Optimize/adjust blocks and active blocks sent at the server based on client settings.
2016-11-30 18:13:14 +10:00
Brandon 694766f4a7 Merge remote-tracking branch 'minetest/master' 2016-11-22 20:22:07 -06:00
raymoo e4031156f1 Add control information to player interacts (#4685) 2016-11-12 17:22:39 +10:00
Brandon 4cb44572a5 Merge remote-tracking branch 'minetest/master'
Conflicts:
	doc/lua_api.txt
	src/client.h
	src/content_sao.cpp
	src/environment.cpp
	src/environment.h
	src/keycode.cpp
	src/map.cpp
	src/network/clientpackethandler.cpp
	src/particles.cpp
	src/particles.h
	src/script/lua_api/l_particles.cpp
	src/server.cpp
	src/server.h
	src/serverobject.cpp
	src/serverobject.h
	src/threading/thread.h
2016-10-29 15:09:28 -05:00
Loic Blot 70f104be07 Environment cleanup
* Move client list to ServerEnvironment and use RemotePlayer members instead of Player
* ClientEnvironment only use setLocalPlayer to specify the current player
* Remove ClientEnvironment dead code on player list (in fact other players are CAO not Player objects)
* Drop LocalPlayer::getPlayer(xxx) functions which aren't used.
* Improve a little bit performance by using const ref list for ClientEnvironment::getPlayerNames() & Client::getConnectedPlayerNames()
* Drop isLocal() function from (Local)Player which is not needed anymore because of previous changes

This change permits to cleanup shared client list which is very old code.
ClientEnvironment doesn't use player list anymore, it only contains the local player, as addPlayer is only called from Client constructor client side.
Clients are only CAO on client side, this cleanup permit to remove confusion about player list.
2016-10-09 15:17:10 +02:00
Loic Blot fd5a130b86 More code cleanup (UNORDERED + RemotePlayer/LocalPlayer)
* ClientEnvironment now uses UNORDERED MAP for active objects
* Use RemotePlayer and LocalPlayer everywhere it's possible
* Minor code style fixes
* Drop Client::getBreath() unused function
2016-10-08 22:27:44 +02:00
Loic Blot 656faf7373 Player/LocalPlayer/RemotePlayer inheritance cleanup (part 2 on X)
* Server/Client Environments now have an helper to cast Player object in the right type to use it
* Server: use RemotePlayer everywhere and remove previous added casts
* Client: use LocalPlayer where needed
* Environment: remove unused functions (getPlayers(), getRandomConnectedPlayer(), getNearestConnectedPlayer())
2016-10-08 15:57:50 +02:00
Loic Blot 667975fe3a Use more unordered_maps to improve performance in c++11 builds 2016-10-06 12:33:35 +02:00
Loic Blot 613797a304 Replace various std::map with UNORDERED_MAP + various cleanups
This is part 2 for 5f084cd98d

Other improvements:

* Use the defined ItemGroupList when used
* make Client::checkPrivilege const
* inline some trivial functions
* Add ActiveObjectMap typedef
* Add SettingsEntries typedef
2016-10-05 10:53:19 +02:00
Brandon f440ae1b2c Merge remote-tracking branch 'minetest/master'
Conflicts:
	src/guiKeyChangeMenu.cpp
2016-08-30 16:33:41 -05: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
Brandon 5d740fcfa9 Add the ability to fade sounds in and out 2016-07-09 23:25:24 -05:00
Brandon 2b8a3729c0 Merge remote-tracking branch 'minetest/master'
Conflicts:
	builtin/game/misc.lua
	builtin/settingtypes.txt
	doc/lua_api.txt
	minetest.conf.example
	src/client.cpp
	src/defaultsettings.cpp
	src/environment.cpp
	src/guiFormSpecMenu.cpp
	src/guiFormSpecMenu.h
	src/hud.cpp
	src/hud.h
	src/itemdef.cpp
	src/pathfinder.cpp
	src/script/lua_api/l_util.cpp
	src/server.h
	src/wieldmesh.cpp
	src/wieldmesh.h
2016-05-04 22:29:15 -05:00
kwolekr 2eeb62057a Hud: Cache hud_scaling, fix minor style issues 2016-04-10 23:54:34 -04: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 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
Diego Martinez 2c72f6da7b Add options for screenshot format and quality 2016-03-12 17:12:43 -05:00
RealBadAngel 2f4cf0bcca Remove preload_item_visuals code
Closes #3748
2016-02-21 17:46:50 +01:00
RealBadAngel c3b279750e Move object nametags to camera 2016-02-18 16:43:29 +01:00
RealBadAngel 7ea40e45b1 Use vertices with tangents only when its needed. 2016-02-15 06:05:39 +00: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
RealBadAngel b44da4916a Cleanup selection mesh code, add shaders for halo and selection boxes 2016-02-08 03:57:42 -05:00
Brandon 01410109f5 Revert "Fall back to legacy init"
This reverts commit d6539f9490.
2016-02-04 13:31:42 -06:00
Brandon 50929077a0 Revert "Revert changes"
This reverts commit 582d3e47cb.
2016-02-04 13:31:07 -06:00
Brandon 582d3e47cb Revert changes 2016-02-03 22:29:14 -06:00
Brandon d6539f9490 Fall back to legacy init 2016-02-03 21:52:45 -06:00
Brandon 4b7dc459e1 Merge remote-tracking branch 'minetest/master' 2015-12-05 15:10:51 -06:00
Alex Ford 97908cc656 Add on_secondary_use when right clicking an item in the air 2015-12-02 02:18:44 +00:00
Brandon 2fb801ff9e Merge remote-tracking branch 'minetest/master' 2015-11-28 15:24:17 -06: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
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 0903190ba2 Hide minimap if it has been disabled by server 2015-09-01 19:00:33 +02:00
Brandon 4c69477ee5 Merge remote-tracking branch 'minetest/master' 2015-08-31 11:29:54 -05: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
Brandon 2a18106c9d Merge remote-tracking branch 'minetest/master' 2015-08-15 21:17:24 -05:00
est31 a8e238ed06 Add count based unload limit for mapblocks 2015-08-13 07:56:07 +02:00
Brandon 8ec1f8fec3 Merge remote-tracking branch 'minetest/master' 2015-08-02 21:40:28 -05:00
Břetislav Štec ebe7b31538 src/client.cpp: Fix mapper memory leak 2015-08-02 02:15:38 -04:00
Brandon 2b90bf6435 Merge remote-tracking branch 'minetest/master' 2015-07-29 12:47:36 -05: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
Brandon 1a56fa6aba Merge remote-tracking branch 'minetest/master' 2015-07-24 09:34:17 -05: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
Kahrl 9c76f379ac Display an access denied message when client detects a server timeout 2015-07-17 12:06:30 +02:00
Brandon 4e232c2378 Merge remote-tracking branch 'minetest/master' 2015-07-16 16:39:35 -05: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
Brandon 21d2a36257 Merge remote-tracking branch 'minetest/master' into adventuretest 2015-07-07 14:03:02 -05: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
Brandon 861b011f51 Merge remote-tracking branch 'upstream/master' into client-side-ambience 2015-07-02 18:38:37 -05:00
Brandon 027f4d83cb Add client side ambience 2015-07-02 18:38:12 -05:00
est31 29dda9f356 Add UpdateThread and use it for minimap and mesh threads 2015-06-29 15:00:19 +02:00
RealBadAngel ffd16e3fec Add minimap feature 2015-06-27 03:42:01 +02:00
est31 3d43df99f1 Return to ignore 2015-06-24 22:47:41 +02:00
Brandon 6d94cd3edf Client side ambiance 2015-06-18 13:15:06 -05: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
est31 8dbf683313 Finalize init packets and enable protocol v25
This enables srp.
2015-05-16 21:17:28 +02:00
est31 82e35edff5 Make early protocol auth mechanism generic, and add SRP
Adds everything needed for SRP (and everything works too),
but still deactivated, as protocol v25 init packets aren't final yet.
Can be activated by changing the LATEST_PROTOCOL_VERSION header to 25
inside networkprotocol.h.
2015-05-11 18:40:27 +02:00
est31 f0a1379e5a Refactor around translatePassword
Change types for passed password from wstring to string, which removes converting
back and forth in most cases. Move the narrow_to_wide conversion, where its neccessary,
closer to irrlicht. Remove trailing spaces in guiPasswordChange.cpp. Make parameters for
translatePassword passed as const reference.
2015-04-17 06:10:30 +02:00
kwolekr 479f38973e Schematics: Refactor NodeResolver and add NodeResolveMethod
NodeResolver name lists now belong to the NodeResolver object instead of
the associated NodeDefManager.  In addition to minimizing unnecessary
abstraction and overhead, this move permits NodeResolvers to look up nodes
that they had previously set pending for resolution.  So far, this
functionality has been used in the case of schematics for
serialization/deserialization.
2015-04-16 16:27:05 -04:00
est31 f81759792e Make comments consistent with TOSERVER_INIT -> TOSERVER_INIT_LEGACY rename 2015-04-07 00:15:15 +02:00
Craig Robbins 43aab618e5 Change screenshot filename to one likely to work on all modern filesystems
Fixes #2603
2015-04-06 11:07:51 +10:00
Craig Robbins 9527984dbc Move globals from main.cpp to more sane locations
Move debug streams to log.cpp|h

Move GUI-related globals to clientlauncher

Move g_settings and g_settings_path to settings.cpp|h

Move g_menuclouds to clouds.cpp|h

Move g_profiler to profiler.cpp|h
2015-04-01 23:04:25 +10:00
Aaron Suen 6d61375cc7 Clean scaling pre-filter for formspec/HUD. 2015-04-01 00:01:05 -04:00
Loic Blot 1fe4256462 Connection::Receive(): receive Network Packet instead of SharedBuffer<u8>.
Because we get a Buffer<u8> from ConnectionEvent, don't convert it to SharedBuffer<u8> and return it to Server/Client::Receive which will convert it to NetworkPacket
Instead, put the Buffer<u8> directly to NetworkPacket and return it to packet processing
This remove a long existing memory copy
Also check the packet size directly into Connection::Receive instead of packet processing
2015-03-31 11:01:08 +02:00
Craig Robbins 862d4ea328 Change format of screenshot names
Filename screenshot_ + ISO 8601 format + [-serial]

i.e. screenshot_YYYY-MM-DDTHH::MM::SS[-serial].png

Serial is added if the filename + timestamp already exists and is in the range 1 to 999
2015-03-31 16:24:25 +10:00
ShadowNinja 93fcab952b Clean up and tweak build system
* Combine client and server man pages.
  * Update unit test options and available databases in man page.
  * Add `--worldname` to man page.
  * Fix a bunch of places where `"Minetest"` was used directly instead of `PROJECT_NAME`.
  * Disable server build by default on all operating systems.
  * Make `ENABLE_FREETYPE` not fail if FreeType isn't found.
  * Enable LevelDB, Redis, and FreeType detection by default.
  * Remove the `VERSION_PATCH_ORIG` hack.
  * Add option to search for and use system JSONCPP.
  * Remove broken LuaJIT version detection.
  * Rename `DISABLE_LUAJIT` to `ENABLE_LUAJIT`.
  * Rename `minetest_*` variables in `version.{h,cpp}` to `g_*`.
  * Clean up style of CMake files.
2015-03-27 15:00:48 -04:00
Craig Robbins 4fbcfac6cf Change filename of screenshots to something more human readable 2015-03-25 02:55:28 +10:00
Loic Blot d63df4ecb1 Move client packet generators to dedicated functions for:
* TOSERVER_INIT_LEGACY
* TOSERVER_DELETEDBLOCKS
* TOSERVER_GOTBLOCKS
* TOSERVER_REMOVED_SOUNDS
Also use a std::vector instead of std::set for TOSERVER_REMOVED_SOUNDS
2015-03-16 12:39:27 +01:00
est31 e4f7c92cff Finer progress bar updates when initializing nodes
The bar is only drawn when the user will notice a change, which prevents time overheads that this commit would cause, resulting from useless draws.
2015-03-15 22:01:52 +10:00
Loic Blot 0e93eefb8f client.cpp: typo fix and break; fix to make some compilers happy 2015-03-13 22:08:48 +01:00
Loic Blot 083c8c734e Replace NetworkPacket pointers to references 2015-03-13 22:01:49 +01:00
Loic Blot 126f36c2e6 Rename some packet and handlers to <packet>_Legacy name for compat layer between new network changes and old network clients 2015-03-13 13:40:48 +01:00
Loic Blot 3ae16f1c17 Fix memleak pointed by issue #2439.
Also change bzero to memset. bzero doesn't work on windows
2015-03-08 18:13:27 +01:00
Loic Blot 57d86cf574 Fix unitialized data when creating TOSERVER_INIT packet 2015-03-08 18:03:43 +01:00
Craig Robbins ced6d20295 For usages of assert() that are meant to persist in Release builds (when NDEBUG is defined), replace those usages with persistent alternatives 2015-03-07 22:41:47 +10:00
ShadowNinja 708337dfc2 Clean up database API and save the local map on an interval 2015-03-06 00:20:45 -05:00
Loic Blot 365e4ae0fa Performance improvement: Use std::list instead of std::vector for request_media, Server::getModNames, Environment::m_simple_objects.
* Also remove unused Server::m_modspaths
2015-03-05 10:44:48 +01:00
Loic Blot b214cde5b4 Remove Queue class which uses std::list and use native std::queue 2015-03-05 16:49:51 +10:00
Loic Blot 009149a073 Fix some memory leaks on packet sending. 2015-02-21 17:27:31 +01:00
Loic Blot 3c91ad8fc2 Replace std::list by std::vector into timerUpdate calls 2015-02-17 15:08:37 +01:00
Loic Blot 54487b3e70 Remove old comment from Network Rework Patch 2/4 2015-02-17 14:49:21 +01:00
Loic Blot ed04e8e9e4 [Patch 2/4] Network rework: packet writing, sending and cleanups
NetworkPacket.cpp:
* Remove some deprecated functions, we must use streaming interface
* m_data converted from u8* to std::vector<u8>
* Add an exporter to forge packet to Connection object
* implement operator << std::wstring. n
* implement operator << std::string
* dynamic resize when write packet content.
* fix string writing and performances.
* create ServerCommandFactory, used by client to get useful informations about packet processing (sending).
  * Reliability
  * Transmit channel
* Implement putRawString for some ugly char (_INIT packet), and use it.
* Many packet read and write migrated
* Implement oldForgePacket to interface writing with current connection
* fix U8/char/bool writing
* fix string writing and performances.
* add some missing functions
* Use v3s16 read instead of reading x,y,z separately
* Add irr::video::SColor support into packets
* Add some missing handlers
* Add a template function to increase offset
* Throw a serialization error on packet reading (must be improved)

PacketFactories:
* Create ServerCommandFactory, used by client to get useful informations about packet processing (sending).
* Create ClientCommandFactory, used by server to get useful informations about packet processing (sending).

Client.cpp:
* implement NetworkPacket ::Send interface.
* Move packet handlers to a dedicated file
* Remove Client::Send(SharedBuffer)

Server.cpp:
* implement NetworkPacket ::Send interface.
* Rewrite all packets using NetworkPacket
* Move packet handlers to a dedicated file
* Remove Server::Send(SharedBuffer)

ClientIface.cpp:
* Remove sendToAll(SharedBuffer<u8>)

Connection.hpp rework:
* Remove duplicate include
* Remove duplicate negation
* Remove a useless variable
* Improve code performance by using a m_peers_list instead of scanning m_peers map
* Remove Connection::Send(SharedBuffer)
* Fix useafterfree into NetworkPacket Sending
* Remove unused Connection::sendToAll

Test.cpp:
* Remove dead code
* Update tests to use NetworkPackets

Misc:
* add new wrappers to Send packets in client, using NetworkPacket
* Add NetworkPacket methods for Connection
* coding style fix
* dead code since changes cleanup
* Use v3s16 read instead of reading x,y,z separately in some packets
* Use different files to handle packets received by client and server
* Cleanup: Remove useless includes

ok @Zeno-
Tested by @Zeno- @VanessaE and @nerzhul on running servers
2015-02-16 11:00:55 +01:00
Craig Robbins c8f60bd224 Remove workaround in itemdef.cpp to enable/disable/enable "enable_shaders" setting
* Increase performance (client)
* Avoid changing a global value to solve a local problem
2015-02-11 17:45:49 +10:00
Craig Robbins f824866686 Revert "Remove workaround in itemdef.cpp to enable/disable/enable "enable_shaders" setting"
This reverts commit d25ff8fd25.
2015-02-11 17:01:19 +10:00
Craig Robbins d25ff8fd25 Remove workaround in itemdef.cpp to enable/disable/enable "enable_shaders" setting
* Increase performance (client)
* Avoid changing a global value to solve a local problem
2015-02-11 16:02:16 +10:00
Loic Blot a704c04f00 Network Layer 7 rework (Packet handling)
* Move networkcode to a dedicated directory
* Rename clientserver.h to network/networkprotocol.h (Better name) and sanitize some includes
* Create object NetworkPacket
  * It stores command (opcode) and data separated
  * It also stores peer_id
  * Data reading can be done by using a streaming interface
* Change packet routing analysis
  * Remove old conditional analysis
  * Now uses function pointed analysis and add connection state ({Client,Server}::handlers)
  * Connection state permit to categorize condition to handle before analyze packets
  * Create a handler for depreciated messages, instead of duplicating code
2015-02-10 20:04:08 +10:00
ShadowNinja 9e2a9b55e1 Reduce gettext wide/narrow and string/char* conversions 2015-02-05 03:24:22 -05:00
Craig Robbins 38561023b4 Fix local map saving when joining a local server from the server tab
Disables local map saving for all local server types

See: https://github.com/minetest/minetest/issues/2024
2015-01-31 00:42:08 +10:00
sapier 63867b1a37 Fix memory leaks due to messed up memory handling for particles as well as their spawners 2015-01-09 15:23:49 +01:00
kwolekr cd4d213ae0 NodeResolver: Perform callback immediately if node registration phase finished
Also add NodeResolver callbacks on the client
2015-01-04 16:32:31 -05:00
sapier 0db73bd83e More consistent progress bar from 0-100 on startup 2015-01-02 17:53:42 +01:00
ShadowNinja 8af9d8b6ac Fix missing call to std::ostringstream::str 2014-12-12 16:32:11 -05:00
Anton 10e0cf8b2c Use std::string::empty() instead of size() where applicable 2014-12-12 15:16:24 -05:00