Commit Graph

3299 Commits

Author SHA1 Message Date
Loic Blot 083c8c734e Replace NetworkPacket pointers to references 2015-03-13 22:01:49 +01:00
Loic Blot 74d34da6cb Prepare Protocol v25 init & authentication.
* TOSERVER_INIT and TOCLIENT_INIT renamed to _LEGACY
* TOSERVER_PASSWORD merged from dev-0.5, can use protocol v24 and v25
* TOCLIENT_ACCESS_DENIED merged from dev-0.5, can use protocol v24 and v25, with normalized strings an a custom id for custom errors
* new TOSERVER_INIT packet only send MT version, supported compressions, protocols and serialization, this permit to rework everything later without break the _INIT packet
* new TOSERVER_AUTH packet which auth the client
* new TOCLIENT_HELLO packet which send server serialization version atm
* new TOCLIENT_AUTH_ACCEPTED which is send when TOCLIENT_AUTH was okay. After this packet, the client load datas from servers, like after TOCLIENT_INIT_LEGACY packet
2015-03-13 20:23:03 +01:00
Loic Blot 9f3fc7201b Handle the newly added TOCLIENT_ACCESS_DENIED and TOCLIENT_DELETE_PARTICLESPAWNER
* Rename the handlers from _Legacy to regular, because here we can use same handlers
* Fix some packet names and pseudo handlers
2015-03-13 14:28:20 +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 4e63c977c7 Use the new Player::isDead function when it's the case 2015-03-13 08:57:58 +01:00
Loic Blot afb19f3a1f handleCommand_Breath mustn't update breath is player is dead. A dead player doesn't breath.
Add Player::isDead function to check player is dead
2015-03-12 11:27:28 +01:00
Loic Blot 3067d78216 Don't handle PlayerPos packet coming from client if player is dead 2015-03-12 10:32:16 +01:00
paramat 6ce0985f47 Mgv5/mgv7: Add desert temples if desert stone detected in mapchunk 2015-03-12 02:33:16 +00:00
est31 140245a76f Unescape tooltip texts
Previously, tooltips didn't unescape escaped formspec texts.
Item descriptions that trigger tooltips like inside inventories or for item_image_button
don't need to get unescaped, as they don't get set using formspec, but from lua.
2015-03-11 14:33:07 +01:00
paramat 29e46d6b29 Mgv6: Fix uninitialised heightmap used by cavegen 2015-03-11 06:04:07 +00:00
paramat b2b6bbf3e8 lua_api/l_mapgen: Fix overlapping areas of minetest.generate_ores/decorations 2015-03-11 03:36:39 +00:00
ShadowNinja adfcdc5484 Silence Clang warning 2015-03-10 20:47:52 -04:00
Craig Robbins d4e210ee95 Ensure that heightmap is initialized before use
Without this, cavegen will use values in the heightmap before they are initialized.
2015-03-10 18:46:28 +10:00
Craig Robbins e74b8da54e Stop formspecs closing with double-click in empty area
Behaviour on Android remains the same until other alternatives can be devised (if possible)

See #2425 (and the many other -- now closed -- issues reporting this feature as a bug)
2015-03-09 12:42:25 +10: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
ShadowNinja 969413b9fa Make the dummy backend only look up blocks once 2015-03-08 03:16:40 -04:00
paramat d463000595 Heightmaps: Fix uninitialised values in mgv5/mgv6. findGroundLevel: Return -MAP_GENERATION_LIMIT if surface not found 2015-03-08 03:54:03 +00:00
gregorycu 267c9f4cb4 Optimize Profiler::avg() 2015-03-07 20:04:01 -05:00
ShadowNinja d75a0a7394 Don't use luaL_checkstring to read node names, it's only for arguments
This caused confusing error messages like "argument #4 to set_node is not a string."
2015-03-07 20:04:01 -05:00
ngosang f6e4c5d9cf Respect game mapgen flags and save world noise params 2015-03-07 15:53:39 -05:00
sapier 9da99efca2 Fix RUN_IN_PLACE broken due to invalid usage of assert 2015-03-07 15:22:35 +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
Loic Blot a603a76787 Improve Clouds::render mathematics 2015-03-07 13:27:43 +01:00
Craig Robbins 5698e2baf8 Fix Android text bug (no text displaying) 2015-03-07 20:51:07 +10:00
paramat ffdf8dedb7 Dungeongen: Optionally set ignore to be untouchable to disable floating dungeons 2015-03-07 01:41:53 +00:00
ShadowNinja e9eda2b0d0 Don't start a server for map migration 2015-03-06 00:20:45 -05:00
ShadowNinja 708337dfc2 Clean up database API and save the local map on an interval 2015-03-06 00:20:45 -05:00
paramat c7454d4732 Biome API: Enable decorations placed on water
Add schematic decoration force placement flag
2015-03-06 03:32:15 +00:00
BlockMen b65c7ab4a4 Improve group-based connection between raillike nodes 2015-03-05 23:24:32 +01:00
Loic Blot 40c2c18a3f l_get_modnames: Compare using std::sort instead of a custom function which does same work 2015-03-05 20:12:54 +01:00
Loic Blot c00eed90d3 collisionMoveSimple: use std::vector instead of std::list, this improve the performances 2015-03-05 18:08:19 +01:00
Loic Blot 6c09b34edc ProfilerGraph: Use std::list instead of std::vector 2015-03-05 17:57:47 +01:00
Craig Robbins daa1c30b35 Fix mapgen using unitialised height map values 2015-03-06 01:42:55 +10:00
Loic Blot 3d505b2b5f Use std::queue for HTTPFetchRequest and std::vector for log_output instead of std::list 2015-03-05 16:21:10 +01:00
Loic Blot 9749d9fee6 Fix issue #2441: crash on respawn, since a conversion std::list to std::vector on Environment.cpp
* Also change some std::list to std::vector for ClientMap::renderMap
* Remove disabled code in ClientMap::renderMap, disabled since a long time
2015-03-05 15:36:20 +01:00
Loic Blot 0d1eedcccc Replace std::list to std::vector into tile.cpp (m_texture_trash) and move tile.hpp to src/client/ 2015-03-05 11:59:40 +01:00
Loic Blot aa474e4501 Server.cpp Use std::list instead of std::vector for playSound, fillMediaCache, sendRequestedMedia, sendMediaAnnouncement and related functions 2015-03-05 11:40:04 +01:00
Loic Blot 82482ecd9d Server::AsyncRunStep: buffered_messages now uses std::vector instead of std::list. * sendRemoveNode and sendAddNodes are also converted as a side effect 2015-03-05 11:23:54 +01:00
BlockMen 36e8ba9ce2 Fix some rendering glitches
- Fixes particle draworder
- Fixes nodehighlighting
2015-03-05 10:51:18 +01: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
Craig Robbins 9e67579315 Fix memory leak in MapgenV6 2015-03-05 15:17:37 +10:00
paramat eb7482fd73 Cavegen, mgv5: Cleanup code
Conf.example: Update mgv5 mapgen params
Mgv7: Lava caves only below -256
2015-03-04 23:53:58 +00:00
Loic Blot cd684497c2 Use std::vector instead of std::list in StaticObjectList and MutexedMap::getValues() 2015-03-04 17:22:37 +01:00
Loic Blot 06f328207f ABMHandler and player_collisions use sequential read/write. Switch from std::list to std::vector
* Also remove dead code Map::unloadUnusedData which is dead since a long time
2015-03-04 17:02:36 +01:00
Loic Blot 2066655aae ClientInterface::getClientIDs doesn't need a std::list. Use a std::vector for better perfs 2015-03-04 16:30:24 +01:00
Loic Blot 7e088fdfe3 We always know playerSAO when calling SendInventory. Using it instead of searching it via peer_id 2015-03-04 15:28:33 +01:00
Loic Blot 40bf1d7b5f Send Position packet on event, don't check it at each AsyncRunStep.
* This permit to cleanup the player checking loop
2015-03-04 12:19:26 +01:00
Loic Blot 7f8f9785d7 ASyncRunStep doesn't need to lock when do setTimeOfDaySpeed.
* setTimeOfDaySpeed already lock a mutex when modify the value, we don't need to lock all environment.
* add a fine grain lock for getTimeOfDay and setTimeOfDay to solve environment multithread modifications on this value
2015-03-04 11:46:31 +01:00
Loic Blot 1b2f64473e Send Inventory packet on event, don't check it at each AsyncRunStep.
* Call UpdateCrafting into SendInventory because this functions is only called before SendInventory
* Use Player* instead of peer_id for UpdateCrafting because SendInventory already has the Player* pointer, then don't loop for searching Player* per peer_id
* m_env_mutex don't need to be used with this modification because it's already locked before the calls
2015-03-04 11:29:39 +01:00
Loic Blot 038d3a31df Remove unused m_wielded_item_not_sent 2015-03-03 17:36:54 +01:00
Loic Blot 7e56637ed0 Send Breath packet on event, don't check it at each AsyncRunStep 2015-03-03 16:33:20 +01:00
Loic Blot 64ff966bae Send Player HP when setHP (or a setHP caller) is called instead of looping and testing the state change. 2015-03-03 16:06:04 +01:00
Miguel Almeida 056e8f7839 Fix occlusion 2015-03-02 12:09:02 +01:00
Craig Robbins aefe80769b Fix narrow_to_wide_c (ANDROID)
* Ensure converted string is NUL terminated
* Restore logic to that used prior to 9e2a9b5
2015-03-02 13:16:01 +10:00
paramat 773aa8c57b Mgv6: Add heightmap. Do not make large caves that are entirely above ground 2015-03-02 02:13:43 +00:00
Loic Blot 3b1ac5b889 Revert "Fix particles draworder" (issue #2388)
This reverts commit c09d026f05.
2015-02-27 14:15:24 +01:00
Craig Robbins fdb9140825 Change find_surface_nodes_in_area to find_nodes_in_area_under_air 2015-02-27 21:42:00 +10:00
Loic Blot 0f556d0c7f Add find_surface_nodes_in_area LUA call which permit to only get the nodes which touch air. This permit to massively improve performance for mods like plantlife 2015-02-27 21:34:33 +10:00
Craig Robbins 338e66af5f Fix minor memory leak (Android) 2015-02-27 13:40:27 +10:00
paramat 14f7df980b Biome API: Re-calculate biome at every surface in a mapchunk column 2015-02-26 03:35:25 +00:00
rubenwardy d65a90a86b Add camera smoothing and cinematic mode (F8) 2015-02-25 15:34:33 +01:00
Loic Blot b4acac706d Rename --do-unittests to --run-unittests as @Zeno- and @sfan5 requested 2015-02-24 08:56:52 +01:00
gregorycu 577701cabd Optimise MapBlockMesh related functions
Directely or indirectly optimises the following functions:

* MapBlockMesh::MapBlockMesh
* MapBlockMesh::getTileInfo
* MapBlockMesh::makeFastFace
* MapBlockMesh::getSmoothLightCombined
2015-02-23 23:20:31 +10:00
Craig Robbins 3b6480c5b0 Fix wrapDegrees family of functions
wrapDegrees() (renamed to modulo360f)
wrapDegrees_0_360
wrapDegrees_180

Minor errors were present in previous versions; see issue #2328
2015-02-23 22:50:32 +10:00
Kahrl 38cf080a9c Disallow object:remove() if the object is a player
Rebased by Zeno- (conflict in lua_api.txt)
2015-02-23 16:49:48 +10:00
kaeza c5defe7a11 Add mod.conf file support This new file only permits to specify a mod name for now 2015-02-21 18:18:06 +01:00
Loic Blot 009149a073 Fix some memory leaks on packet sending. 2015-02-21 17:27:31 +01:00
Loic Blot 5a5854ea9d Move hex.h to util/ 2015-02-21 14:32:35 +01:00
BlockMen c09d026f05 Fix particles draworder 2015-02-21 14:11:00 +01:00
Loic Blot 3998a1f8f9 Move sha1.hpp and base64.hpp to util/ 2015-02-21 14:03:27 +01:00
BlockMen aa31e3c7f3 Use skin font for usernames (fixes #2363) 2015-02-21 13:31:42 +01:00
Loic Blot cf4045ff0f Use proper CMakeLists.txt for network and client directories 2015-02-21 11:51:12 +01:00
Loic Blot b3aeba684b Unit tests must be done at integration process.
* Remove --enable-unittests and --disable-unittests and add --do-unittests function
* --do-unittests function will exit 0 on success.
* minetest and minetestserver binaries are launched with --do-unittests in travis build.
2015-02-21 11:04:19 +01:00
paramat 38e6280552 Mgv5: Remove blobgen. Remove crumble and wetness noises
Add large pseudorandom caves below -256
De-link terrain level from water_level
Cavegen: Mgv5 large cave code
2015-02-21 01:43:25 +00:00
Ner'zhul e357577cb2 Typo fix in networkprotocol.h
InventoryAction is in inventorymanager.h
2015-02-19 20:03:22 +01:00
est31 5a0ed780f5 Server: announce MIN/MAX protocol version supported to serverlist. Client: check serverlist
Client now informs about incompatible servers from the list, this permits to prevent the protocol movements.
Server announces its supported protocol versions to master server
2015-02-18 16:09:59 +01:00
BlockMen 8941ea0cc9 Increase default font_size 2015-02-18 12:51:17 +01:00
BlockMen 9a9fcfc9a3 Fix font_size under windows 2015-02-18 12:39:23 +01:00
Perttu Ahola 4d744cf87a Use fixed size for builtin menus on non-android platforms 2015-02-18 12:33:40 +02:00
Loic Blot 27d4e89d32 Fix unused (and so, broken) enable_rollback_recording. This option must be reloaded at server loop but loaded when server starts, for data consistency (not a hot load variable)
ok @ShadowNinja
2015-02-18 09:28:39 +01:00
fz72 0a299fd4e5 Fix map_seed not changed when creating a new world after login to another 2015-02-18 08:57:14 +01:00
Loic Blot 2079462e62 Change many useless std::list into Environment class (m_players), ABMHandler and ActiveBlockList::update
This improve looping performances.
2015-02-17 16:50:03 +01:00
Kahrl 81b9c023c4 Grab GUIChatConsole::m_font, fixes segfault when changing font_size 2015-02-18 00:38:57 +10:00
Loic Blot fd70f4f2f0 Replace std::list by std::vector into ClientMap::updateDrawList, Map::timerUpdate and ServerMap::save().
This will speedup the loop reading into those functions
2015-02-17 15:28:49 +01:00
Loic Blot 3c91ad8fc2 Replace std::list by std::vector into timerUpdate calls 2015-02-17 15:08:37 +01:00
Novatux 24315db6ef Ignore old entities from 0.3. 2015-02-17 15:07:05 +01:00
Loic Blot 54487b3e70 Remove old comment from Network Rework Patch 2/4 2015-02-17 14:49:21 +01:00
Loic Blot 718bcafd51 Replace std::list by std::vector into ServerMap::listAllLoadableBlocks ServerMap::listAllLoadedBlocks and their database backends.
This adds a speedup on database migration and /clearobjects command
2015-02-17 14:35:44 +01:00
Loic Blot c58d49977d SAO: re-add old ActiveObjectTypes for a future migration layer 2015-02-17 11:37:55 +01:00
Loic Blot f8d5af7536 SAO work: ActiveObject types & SAO cleanup * Replace u8 types with ActiveObjectType. * Merge content_object.h into activeobject.h * Remove DummyLoadSAO, it's now unused. * Remove ItemSAO, it's also unused 2015-02-17 09:09:50 +01:00
Yaman 98d80e2012 Add player direction to on-screen debug text
(PR Modified slightly)
2015-02-17 01:56:21 +10:00
Loic Blot 7c8793cbea Performance Improvement: Use a cache which caches result for getFacePositions.
This greatly reduce the number of std::list generated by caching the result, which is always constant for each radius selected.
In the callgrind map, you will see original:
  * 3.3M calls to std::list for 9700 calls to getFacePositions
In the modified version, you will see:
  * 3.3K calls to std::list for 6900 call to getFacePositions
Callgrind map is here: #2321

it's a huge performance improvement to l_find_node_near
2015-02-16 11:27:44 +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
Loic Blot 8aebc31a17 Fix unit test if there isn't a localhost address (for example FreeBSD jails), second part 2015-02-15 14:30:34 +00:00
Loic Blot a3e2b3e404 Fix unit test if there isn't a localhost address (for example FreeBSD jails) 2015-02-15 13:11:03 +01:00
Loic Blot 3b6b9435c5 Only do the IPv6 unit test if IPv6 is enabled 2015-02-15 12:20:37 +01:00
Loic Blot 7880ff74b6 Re-apply 4a6582c13c broken since 146f77fdb7 2015-02-14 09:21:04 +01:00
Craig Robbins d44cb547f2 Suppress CGUITTFONT build warnings 2015-02-13 23:54:05 +10:00