summaryrefslogtreecommitdiff
path: root/src/unittest
Commit message (Collapse)AuthorAge
* Fix AreaStore's IDs persistence (#8888)SmallJoker2019-09-21
| | | | | Improve documentation Read old formats Fix free ID function. Return first gap in map
* Inventory: Send dirty lists where appropriate (#8742)SmallJoker2019-08-24
| | | | | This change reduces the amount of sent data towards clients. Inventory lists that are already known to the player are skipped, saving quite some data over time. Raises protocol version to 38 to ensure correct backwards-compatible code.
* Fix compare between pointer and 0 in unittestsJozef Behran2019-08-13
| | | | | | Pointers shall be set to nullptr, not 0, according to the coding standards. By implication they shall be compared with nullptr, not 0, too. Fix this code to match that.
* Optimize string (mis)handling (#8128)Jozef Behran2019-05-18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Optimize statbar drawing The texture name of the statbar is a string passed by value. That slows down the client and creates litter in the heap as the content of the string is allocated there. Convert the offending parameter to a const reference to avoid the performance hit. * Optimize texture cache There is an unnecessary temporary created when the texture path is being generated. This slows down the cache each time a new texture is encountered and it needs to be loaded into the cache. Additionally, the heap litter created by this unnecessary temporary is particularly troublesome here as the following code then piles another string (the resulting full path of the texture) on top of it, followed by the texture itself, which both are quite long term objects as they are subsequently inserted into the cache where they can remain for quite a while (especially if the texture turns out to be a common one like dirt, grass or stone). Use std::string.append to get rid of the temporary which solves both issues (speed and heap fragmentation). * Optimize animations in client Each time an animated node is updated, an unnecessary copy of the texture name is created, littering the heap with lots of fragments. This can be specifically troublesome when looking at oceans or large lava lakes as both of these nodes are usually animated (the lava animation is pretty visible). Convert the parameter of GenericCAO::updateTextures to a const reference to get rid of the unnecessary copy. There is a comment stating "std::string copy is mandatory as mod can be a class member and there is a swap on those class members ... do NOT pass by reference", reinforcing the belief that the unnecessary copy is in fact necessary. However one of the first things the code of the method does is to assign the parameter to its class member, creating another copy. By rearranging the code a little bit this "another copy" can then be used by the subsequent code, getting rid of the need to pass the parameter by value and thus saving that copying effort. * Optimize chat console history handling The GUIChatConsole::replaceAndAddToHistory was getting the line to work on by value which turns out to be unnecessary. Get rid of that unnecessary copy by converting the parameter to a const reference. * Optimize gui texture setting The code used to set the texture for GUI components was getting the name of the texture by value, creating unnecessary performance bottleneck for mods/games with heavily textured GUIs. Get rid of the bottleneck by passing the texture name as a const reference. * Optimize sound playing code in GUIEngine The GUIEngine's code receives the specification of the sound to be played by value, which turns out to be most likely a mistake as the underlying sound manager interface receives the same thing by reference. Convert the offending parameter to a const reference to get rid of the rather bulky copying effort and the associated performance hit. * Silence CLANG TIDY warnings for unit tests Change "std::string" to "const std::string &" to avoid an unnecessary local value copy, silencing the CLANG TIDY process. * Optimize formspec handling The "formspec prepend" parameter was passed to the formspec handling code by value, creating unnecessary copy of std::string and slowing down the game if mods add things like textured backgrounds for the player inventory and/or other forms. Get rid of that performance bottleneck by converting the parameter to a const reference. * Optimize hotbar image handling The code that sets the background images for the hotbar is getting the name of the image by value, creating an unnecessary std::string copying effort. Fix that by converting the relevant parameters to const references. * Optimize inventory deserialization The inventory manager deserialization code gets the serialized version of the inventory by value, slowing the server and the client down when there are inventory updates. This can get particularly troublesome with pipeworks which adds nodes that can mess around with inventories automatically or with mods that have mobs with inventories that actively use them. * Optimize texture scaling cache There is an io::path parameter passed by value in the procedure used to add images converted from textures, leading to slowdown when the image is not yet created and the conversion is thus needed. The performance hit is quite significant as io::path is similar to std::string so convert the parameter to a const reference to get rid of it. * Optimize translation file loader Use "std::string::append" when calculating the final index for the translation table to avoid unnecessary temporary strings. This speeds the translation file loader up significantly as std::string uses heap allocation which tends to be rather slow. Additionally, the heap is no longer being littered by these unnecessary string temporaries, increasing performance of code that gets executed after the translation file loader finishes. * Optimize server map saving When the directory structure for the world data is created during server map saving, an unnecessary value passing of the directory name slows things down. Remove that overhead by converting the offending parameter to a const reference.
* Add Irrlicht-specific smart pointer (#6814)Vitaliy2019-04-12
|
* LINT fixLoïc Blot2019-02-15
|
* Fix Address::isLocalhost algorithmLoic Blot2019-02-09
|
* Use true pitch/yaw/roll rotations without loss of precision by pgimeno (#8019)Paul Ouellette2019-02-07
| | | | | Store the rotation in the node as a 4x4 transformation matrix internally (through IDummyTransformationSceneNode), which allows more manipulations without losing precision or having gimbal lock issues. Network rotation is still transmitted as Eulers, though, not as matrix. But it will stay this way in 5.0.
* Proselytize the network. Use IEEE F32 (#8030)SmallJoker2019-01-03
| | | | | * Proselytize the network. Use IEEE F32 * Remove unused V2F1000 functions
* Fix the part of the float test that requires IEC559/IEEE754 compliancePedro Gimeno2018-12-18
| | | | GCC and CLang compilers fail to support full IEC559 compliance required for the test, when certain compiler flags are active. This patch implements a heuristic that checks for the most common flag in GCC and CLang, plues an extra check which GCC disables when it's not compliant, to hopefully catch most cases where it can't run.
* Add an activeobject manager to hold active objects (#7939)Loïc Blot2018-12-13
| | | | * Add an activeobject manager to hold active objects * Add unittests
* Network: Send IEEE floats (#7768)SmallJoker2018-12-13
|
* Add testWrapDegrees_0_360_v3f unittestsLoïc Blot2018-12-04
|
* Move client-specific files to 'src/client' (#7902)Quentin Bazin2018-11-28
| | | | | Update Android.mk Remove 'src/client' from include_directories
* Fix temporary path crash in TestAuthDatabase (#7753)SmallJoker2018-09-28
| | | The constructor of TestAuthDatabase was called immediately, at a time when the settings weren't initialized properly yet.
* Replace auth.txt with SQLite auth database (#7279)Ben Deutsch2018-08-05
| | | | * Replace auth.txt with SQLite auth database
* Add a MSVC / Windows compatible snprintf function (#7353)nOOb31672018-07-22
| | | Use sizeof where applicable for mt_snprintf
* Revert 6587 - Optimize entity-entity collision (#7539)lhofhansl2018-07-08
|
* Server: move shutdown parts to a specific shutdown state object (#7437)Loïc Blot2018-06-13
| | | | * Server: move shutdown parts to a specific shutdown state object
* LINT fixLoic Blot2018-05-29
|
* Fix GameUI flag value regression introduced by ↵Loic Blot2018-05-29
| | | | | | a78659ed0529226ad937f5e241ad72ba93702959 Added more strong unittests on that part to prevent future regression
* Fix i386 bit build at OpenBSD (#7259)mazocomp2018-04-21
|
* Add online content repositoryrubenwardy2018-04-19
| | | | Replaces mods and texture pack tabs with a single content tab
* Fix various clang-tidy reported performance-type-promotion-in-math-fnLoïc Blot2018-04-03
|
* Optimize entity-entity collision (#6587)Vitaliy2018-04-03
| | | | | | * Add IrrLicht type aliases * Add hash for IrrLicht vector * Add object map
* Fix many issues reported by clang-tidy (#7189)Loïc Blot2018-04-02
| | | | | | | | | | | * 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
* Client eventmanager refactor (#7179)Loïc Blot2018-03-30
| | | | | | | | | | | | | | | | | | | | | * 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
* Cleanup sound manager class (#7158)Loïc Blot2018-03-24
| | | | | | | | | | * 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
* Fix a crash or random memory leak when reseting saved environment variable ↵Loic Blot2018-03-16
| | | | in test_servermodmanager.cpp
* Server: delegate mod management & config to ServerModConfiguration (#7131)Loïc Blot2018-03-16
| | | | | | | | * 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
* Add Voxelarea unittests (#7121)Loïc Blot2018-03-11
| | | | * Add voxelarea unittests
* Node definition manager refactor (#7016)Dániel Juhász2018-02-10
| | | | | | | | | * Rename IWritableNodeDefManager to NodeDefManager * Make INodeDefManager functions const * Use "const *NodeDefManager" instead of "*INodeDefManager" * Remove unused INodeDefManager class * Merge NodeDefManager and CNodeDefManager * Document NodeDefManager
* Remove unused light updating codeDániel Juhász2018-02-04
| | | Also remove the unit test that tests the removed algorithms.
* GameUI refactor (part 4/X): Move Game::guitext_status, Game::m_statustext, ↵Loic Blot2018-01-05
| | | | | | | | GameRunData::statustext_time to GameUI class Other enhancements: * Simplify setStatusText to showStatusText, as it shows the label too (preventing almost every setStatusText to call setStatusTextTime(0) * Add unittests
* GameUI refactor (part 3/X): Move Game::guitext2, Game::guitext_info, ↵Loic Blot2018-01-05
| | | | | | | | Game::infotext to GameUI class Other enhancements: * Drop unused GameRunData::time_of_day * Little GameUI::update code path optimizations
* GameUI refactor (part 2/X): Move Game::guitext to GameUI + enhancements on ↵Loic Blot2018-01-05
| | | | | | | StaticText Other enhancements: * C++ friendlyness for addStaticText() -> move to static StaticText::add()
* GameUI refactor (part 1/X): GameUI object creation + GameUIFlags move to GameUILoic Blot2018-01-05
| | | | | | | | | | Game class is too huge and has too specialization on various subjects, like UI, formspecs, client, renderer. Start to move UI related things to GameUI object and cleanup them Other improvements: * updateChat: more performance on error messages by remove string copies * Initialize all game class members in definition instead of constructor (with nullptr instead of NULL) * Drop unused Client::show{GameChat,GameHud,Profiler,GameFog} * Add GameUI unittests
* Add unittests on ActiveObject and BanManager class (#6866)Loïc Blot2018-01-01
| | | | | | * Add unittests on ActiveObject and BanManager class This also permit to fix a bug in ban manager setting bans modified when no modification occurs
* Move files to subdirectories (#6599)Vitaliy2017-11-08
| | | | * Move files around
* Add session_t typedef + remove unused functions (#6470)Loïc Blot2017-09-27
| | | | | | * Add session_t typedef + remove unused functions u16 peer_id is used everywhere, to be more consistent and permit some evolutions on this type in the future (i'm working on a PoC), uniformize u16 peer_id to SessionId peer_id
* Implement mod communication channels (#6351)Loïc Blot2017-09-26
| | | | | | | | | | Implement network communication for channels * Implement ModChannel manager server side to route incoming messages from clients to other clients * Add signal handler switch on client & ModChannelMgr on client to handle channels * Add Lua API bindings + client packet sending + unittests * Implement server message sending * Add callback from received message handler to Lua API using registration method
* Remove DSTACK support (#6346)Loïc Blot2017-08-30
| | | Debugstacks is not useful, we don't really use it, the DebugStack is not pertinent, gdb and lldb are better if we really want to debug.
* Network proto handlers/container fixes (#6334)Loïc Blot2017-08-29
| | | | | | | | | | * Fix HP transport + some double <-> float problems TOCLIENT_HP transport u16 hp as a u8, use u16 HP, this prevent HP over 255 to overflow across network * Fix more double/float problem in serverpackethandler & remove implicit struct type for TileAnimationParams * Fix connection unittests container
* Network cleanup (#6310)Loïc Blot2017-08-25
| | | | | | | | | | | | | | * Move Connection threads to dedicated files + various cleanups * ConnectionReceiveThread::processPacket now uses function pointer table to route MT packet types * Various code style fixes * Code style with clang-format * Various SharedBuffer copy removal * SharedBuffer cannot be copied anymore using Buffer * Fix many SharedBuffer copy (thanks to delete operator)
* Network cleanup (#6302)Loïc Blot2017-08-24
| | | | | | | | | | | | | | | | | | | | | | | * Cleanup network headers * Move peerhandler to a specific header to reduce compilation times * Move socket.cpp/h to network folder * More work * Network code cleanups * Move socket.{cpp,h} to network folder * Move Address object to network/address.{cpp,h} * Move network exceptions to network/networkexceptions.h * Client: use unique_ptr for Connection * Server/ClientIface: use shared_ptr for Connection * Format fixes * Remove socket.cpp socket.h from clang-format whitelist * Also fix NetworkPacket code style & make it under clang-format
* Modernize source code: last part (#6285)Loïc Blot2017-08-20
| | | | | | | | | | | * Modernize source code: last par * Use empty when needed * Use emplace_back instead of push_back when needed * For range-based loops * Initializers fixes * constructors, destructors default * c++ C stl includes
* Code modernization: subfolders (#6283)Loïc Blot2017-08-19
| | | | | | | | | | | | | * Code modernization: subfolders Modernize various code on subfolders client, network, script, threading, unittests, util * empty function * default constructor/destructor * for range-based loops * use emplace_back instead of push_back * C++ STL header style * Make connection.cpp readable in a pointed place + typo
* C++ modernize: Pragma once (#6264)Loïc Blot2017-08-17
| | | | * Migrate cpp headers to pragma once
* Cleanup various headers to reduce compilation times (#6255)Loïc Blot2017-08-16
| | | | * Cleanup various headers to reduce compilation times
* C++11 cleanup on constructors (#6000)Vincent Glize2017-06-19
| | | | * C++11 cleanup on constructors dir script