aboutsummaryrefslogtreecommitdiff
path: root/src/server.cpp
AgeCommit message (Collapse)Author
2015-10-14Use warningstream for log messages with WARNINGShadowNinja
Remove DTIME macro and its uses, too
2015-10-04Define and use limit constants for Irrlicht fixed-width typeskwolekr
2015-09-29Some map border related fixesest31
1. Check for entity addition success in spawn_item implementation 2. Check for success in item_drop callback, so that the player doesn't lose the item if they are outside bounds and try to drop it. 3. When existing player joins game, check that their position is inside map bounds. If not, set their position to the return value of findSpawnPos(). 4. Make findSpawnPos() respect the border 2 fixes a lua crash if a player drops an item outside map bounds. 3 fixes an assertion crash if a player leaves when being outside map bounds, and then rejoins.
2015-09-19Little optimization on getAdded/Removed activeobjects per player loop.Loic Blot
Use std::queue instead of std::set, we don't need such a heavy container. Don't convert position to int to convert it back to float in the next function.
2015-09-17Send proper block to old clients for swap_node callsest31
The legacy code added in commit d879a539cd19ddd1ee34afec2512fb2238de2822 - "Add minetest.swap_node" for sending the whole mapblock to older clients on the case of a node modification with swap_node, had the problem that the block chosen to be sent to the client was referenced with node coordinates and not with block coordinates, resulting in getting the wrong block sent to the client.
2015-08-25Change i++ to ++iDavid Jones
2015-08-23Clean up threadingShadowNinja
* 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-13Add count based unload limit for mapblocksest31
2015-08-09Fix segfaults caused by the Environment not being initialized yetrubenwardy
2015-08-02Prepend "Lua: " before lua exceptionsBřetislav Štec
src/server.cpp src/emerge.cpp
2015-07-31Small SendableMediaAnnouncement cleanupLoic Blot
-> Remove the SendableMediaAnnouncement struct -> Forge the packet directly in the m_media loop, spare one loop and the construction of a vector -> Use preincrement to spare iterator copies
2015-07-25Cleanup server addparticle(spawner) by merge two identical functions.Loic Blot
2015-07-23Optional reconnect functionalityest31
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-17Server kicks: make messages configurable, cache wstringest31
2015-07-16Kick players when shutting down server and there is a crash due to a Lua ↵nerzhul
stack exception
2015-07-10Fix damage flash when damage disabledkwolekr
2015-07-08Use UTF-8 instead of narrowest31
Use wide_to_utf8 and utf8_to_wide instead of wide_to_narrow and narrow_to_wide at almost all places. Only exceptions: test functions for narrow conversion, and chat, which is done in a separate commit.
2015-07-02Fix code style from recent commits and add misc. optimizationskwolekr
2015-06-29Add Lua errors to error dialogrubenwardy
2015-06-24Return to ignoreest31
2015-06-22Fix bug when craft input isn't replacedTeTpaAka
2015-05-28Add some missing getter functions to the lua APITeTpaAka
ObjectRef: get_properties get_armor_groups get_animation get_attach get_bone_position Players: get_physics_override hud_get_hotbar_itemcount hud_get_hotbar_image hud_get_hotbar_selected_image get_sky get_day_night_ratio get_local_animation get_eye_offset Global: minetest.get_gen_notify minetest.get_noiseparams
2015-05-19Add texture overridingrubenwardy
2015-05-19Lower log level for unexpected behaviourest31
Its a possible mistake to log in to a server with twice the same name. Before, it triggered a server wide error message, now it logs to actionstream.
2015-05-16Add mod securityShadowNinja
Due to compatibility concerns, this is temporarily disabled.
2015-05-11Make early protocol auth mechanism generic, and add SRPest31
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-08Gracefully handle PacketErrorsest31
2015-04-22Protocol 25: wstring -> string for custom access denial reasonsest31
Also fix std::logic_error when server::DenyAccess() is used with only two arguments.
2015-04-16Schematics: Refactor NodeResolver and add NodeResolveMethodkwolekr
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-11Fix a rare crash case un SendPlayerHPNer'zhul
If the player is disconnected while Lua API is doing a l_punch call, for example, the playersao is NULL and the server crash. Fix it.
2015-04-07TOCLIENT_ACTIVE_OBJECT_MESSAGES: channel must be 1 for unreliable messageLoic Blot
2015-04-05TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD can be unreliable, catch PacketError ↵Loic Blot
exception. Also set the packet size at creation not when pushing rawString, no functional change
2015-04-05Crafting speedupest31
This greatly increases crafting performance, especially in worlds with many mods. Approved by @kwolekr. Introduces a hash-type-layered fall-through mechanism, where every layer specifies one hash algorithm, and the "deeper the fall", the more collisions to expect for the algorithm. One Craft definition only resides at one layer, which improves speed for lower layers (and a complete fail), due to most craft definitions residing at high layers. Due to the fall-through design, the undocumented behaviour that later craft recipes override older ones had to be weaked up a bit, but craft recipes with the same hash and layer will still override.
2015-04-03Fix players spawned at (0,0,0) in some rare cases instead of ↵Loic Blot
static_spawnpoint, if set Approved by: @kwoelkr
2015-04-01Move globals from main.cpp to more sane locationsCraig Robbins
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-03-31Connection::Receive(): receive Network Packet instead of SharedBuffer<u8>.Loic Blot
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-27Clean up and tweak build systemShadowNinja
* 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-24Don't send an InventoryAction at each setInventoryModified, we only need one ↵Loic Blot
SendInventory per inventory modification Client doesn't like to receive multiples SendInventory for one action, this can trigger glitches on clients (sometimes due to incorrect UDP packet ordering due to UDP protocol) This fix issue #2544
2015-03-18Fix game minetest.conf default settingsest31
This was a regression introduced by f6e4c5d9cf459e8278a76a2beaee59732e841458 .
2015-03-17Server::step throw is never catched in minetestserverLoic Blot
Replace it with an errorstream + assert for server This throw can be trigger by LuaError exception or ConnectionBindFailed exception in the following functions: * EmergeThread::Thread() * ScriptApiEnv::environment_Step() * ScriptApiEnv::player_event() * ServerThread::Thread()
2015-03-17Fix a little regression on SendActiveObjectMessages which send all ↵Loic Blot
TOCLIENT_ACTIVE_OBJECT_MESSAGES as reliable
2015-03-16Revert "Server::step throw is never catched. Replace it with an errorstream ↵kwolekr
+ assert" This reverts commit 5f8e48c63baf12930430d5d8fc07495021599e61.
2015-03-16Server::step throw is never catched. Replace it with an errorstream + assertLoic Blot
This throw can be trigger by LuaError exception or ConnectionBindFailed exception in the following functions: * EmergeThread::Thread() * ScriptApiEnv::environment_Step() * ScriptApiEnv::player_event() * ServerThread::Thread()
2015-03-16Move TOCLIENT_ACTIVE_OBJECT_REMOVE_ADD and TOCLIENT_ACTIVE_OBJECT_MESSAGES ↵Loic Blot
to private functions
2015-03-15SendPlayerHPOrDie everytime at client connection, damage enabled or not, ↵Loic Blot
this will fix the player which stay dead at connection
2015-03-13Replace NetworkPacket pointers to referencesLoic Blot
2015-03-13Prepare Protocol v25 init & authentication.Loic Blot
* 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-13Rename some packet and handlers to <packet>_Legacy name for compat layer ↵Loic Blot
between new network changes and old network clients
2015-03-13Use the new Player::isDead function when it's the caseLoic Blot
2015-03-07Respect game mapgen flags and save world noise paramsngosang