Commit Graph

297 Commits (master)

Author SHA1 Message Date
Loïc Blot 88b436e6a9 Code modernization: subfolders (#6283)
* 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
2017-08-19 22:23:47 +02:00
Loic Blot b5f7249a7e
Code modernization: src/m* (part 2)
* empty function
* default constructor/destructor
* remove unused Map::emergeSector(a,b)
* for range-based loops
* migrate a dirs[7] table to direction tables
* remove various old unused function
2017-08-19 09:12:54 +02:00
Loïc Blot 921151d97a C++ modernize: Pragma once (#6264)
* Migrate cpp headers to pragma once
2017-08-17 22:19:39 +02:00
Dániel Juhász 3caad3f3c9 Expose getPointedThing to Lua
This commit introduces Raycast, a Lua user object, which can be
used to perform a raycast on the map. The ray is continuable, so one can
also get hidden nodes (for example to see trough glass).
2017-07-07 22:28:23 +01:00
Vincent Glize 4a5e8ad343 C++11 cleanup on constructors (#6000)
* C++11 cleanup on constructors dir script
2017-06-19 23:54:58 +02:00
QrchackOfficial 5cc8ad946e Remove superfluous pointer null checks 2017-06-10 21:04:47 -04:00
Loïc Blot ab128e03ff C++11 patchset 6: forbid object copy using assigment/copy function deleters (#5945)
C++11 implement function deleting, it's generally used to prevent some object copy
In script API use this function removal on ScriptApiBase instead of ScriptApiClient/Server/MainMenu, this affect all ScriptApis
Move DISABLE_CLASS_COPY with constructor, the deleted function permit to replace function in its original place
2017-06-10 13:49:15 +02:00
Loïc Blot d4c0f91275 Use C++11 mutexes only (remove compat code) (#5922)
* Fix event LINT & remove default constructor/destructors
* remove compat code & modernize autolock header
2017-06-06 16:29:28 +02:00
Loic Blot 718121df91
Remove SharedPtr, it's not used and will be never used, we use C++11 2017-06-05 09:36:13 +02:00
Loïc Blot a98baef5e4 C++11 patchset 2: remove util/cpp11.h and util/cpp11_container.h (#5821) 2017-06-04 21:00:04 +02:00
SmallJoker d99b6fed55 Time: Change old `u32` timestamps to 64-bit (#5818)
MacOSX build fix + cleanups
2017-05-26 14:03:36 +02:00
red-001 0e0c824ea7 Rework escape/pause menu (#5719)
* Rework escape/pause menu

- Remove build information
- Use current controls instead of default controls
- Add information about the current server in place of the build information
- Add text saying the game is paused to if in singleplayer mode.
rework pause/escape menu

* improve consistency + display server_name
2017-05-11 10:39:37 +02:00
ShadowNinja c6e96c645b Fix myfloor(0.0) 2017-05-06 16:10:03 -04:00
ShadowNinja 77597c4ff3 Clean up numeric.h and split FacePositionCache from it
I also optiized FacePositionCache a bit: I removed a map
lookup and vector copy from both branches of getFacePosition.
2017-05-06 16:09:45 -04:00
ShadowNinja b662a4577d Clean up getTime helpers
This increases size of the getTime return values to 64 bits.
It also removes the TimeGetter classes since the getTime functions
are now very precise.
2017-04-28 14:43:18 -04:00
Loïc Blot a7e131f53e Fix various points reported by cppcheck (#5656)
* Fix various performance issues reported by cppcheck + code style (CI)

* Make CI happy with code style on master
* guiFileSelectMenu: remove useless includes
* some performance fixes pointed by cppcheck
* remove some useless casts
* TextDest: remove unused setFormSpec function

* Fix various iterator post-increment reported by cppcheck
2017-04-25 10:21:42 +02:00
Loïc Blot f98bbe193e Fix various copy instead of const ref reported by cppcheck (part 3) (#5616)
* Also remove 2 non declared but defined functions
* Make some functions around const ref changes const
2017-04-20 00:12:52 +02:00
SmallJoker 6120251320 Fix MSVC build broken by 34d32ce
`round` -> `myround`
Remove superflous `floor` calls
2017-04-17 14:02:26 +02:00
Perttu Ahola 4323ad163f Include container.h in util/thread.h. util/thread.h doesn't compile without it 2017-04-17 14:58:29 +03:00
Loïc Blot 34d32ce55a Implement delayed server shutdown with cancelation (#4664) 2017-04-15 23:19:18 +02:00
Loic Blot 1399678ffd
Fix fips_cipher_abort warning and other duplicate macros 2017-04-12 09:06:26 +02:00
Loic Blot 4af99b75cf
Pass clang-format on 14 trivial header files fixes
Also remove them from whitelist
2017-04-07 23:22:00 +02:00
Loic Blot f7088f69ab
Clang-format: fix some header files and remove them from whitelist 2017-04-07 08:50:17 +02:00
Loïc Blot 86b1542181 Update embedded jsoncpp from unk version to 0.10.6 + move libs to lib/ instead of src/ (#5473)
* Update embedded jsoncpp from unk version to 0.10.6

0.10.6 is last release without c++11

* Make jsoncpp more compliant with its amalgamate

Jsoncpp cpp file should be upper, make the library like it does in amalgamate

* Reorganization: move minetest embedded libs outside of source tree to /lib

* Fix a dead grep in LINT
2017-04-02 10:51:50 +02:00
Loïc Blot b605b95749 Add CPP11 header to define nullptr & constexpr (#5471)
This header permit to use nullptr & constexpr keywords in portable code segments and benefit from nullptr & constexpr when using C++11 and greater
2017-03-29 13:34:57 +02:00
number Zero d4e0c0f9b8 Content_mapblock.cpp: Refactor 2017-03-20 20:28:22 +00:00
number Zero 25a24c0cdf Minimap: Optimise 2017-03-11 02:15:21 +00:00
rubenwardy f2aa2c6a98 Add ItemStack key-value meta storage 2017-02-04 22:07:55 +00:00
red-001 0dada51a55 Remove `mathconstants.h` and use the correct way to get `M_PI` in MSVC. (#5072) 2017-01-20 23:19:41 +01:00
sapier d03b4fb627 Add color names from web page referenced in luaapi doc 2017-01-15 02:03:51 +00:00
sfan5 ce106a4113 Revert "Extend minetest.is_yes()"
This reverts commit c435eabf3f.
2017-01-07 11:05:05 +01:00
red-001 c435eabf3f Extend minetest.is_yes() 2017-01-07 09:54:51 +01:00
Dániel Juhász 3f8261830e Improve getPointedThing() (#4346)
* Improved getPointedThing()

The new algorithm checks every node exactly once.
Now the point and normal vector of the collision is also returned in the
PointedThing (currently they are not used outside of the function).
Now the CNodeDefManager keeps the union of all possible nodeboxes, so
the raycast won't miss any nodes. Also if there are only small
nodeboxes, getPointedThing() is exceptionally fast.
Also adds unit test for VoxelLineIterator.

* Cleanup, code move

This commit moves getPointedThing() and
Client::getSelectedActiveObject() to ClientEnvironment.
The map nodes now can decide which neighbors they are connecting to
(MapNode::getNeighbors()).
2017-01-04 19:18:40 +01:00
Rogier 4d4b8bb8a4 Move PP() and PP2() macros to basic_macros.h
Instead of redefining them everywhere.
2016-12-24 00:32:50 +00:00
Rogier-5 b98f98b367 Fix incorrect distance computation for visible blocks (#4765)
The client would not compute the distance from the camera to
to a mapblock correctly. The result was that blocks that were in
view (i.e. not beyond the fog limit) would not be rendered.

With the improved distance computation, a range adjustment that
existed in clientiface.cpp is no longer required.
2016-11-11 18:30:37 +10:00
SmallJoker 0baea8c25c Ensure std::unordered_ be used on MSVC 2010 too (#4600) 2016-10-09 00:25:34 +10:00
gregorycu 3de9ae4e60 Ensure std::unordered_ will be used on supported MSVC compilers 2016-10-08 15:05:36 +02:00
Loic Blot 155288ee98 use unordered containers where possible (patch 4 on X)
Also remove some unused parameters/functions
2016-10-06 22:37:26 +02:00
Loic Blot 667975fe3a Use more unordered_maps to improve performance in c++11 builds 2016-10-06 12:33:35 +02: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
David Carlier 48b3bb980d couple of memory leaks fixes. 2016-08-10 16:59:32 +02:00
Ner'zhul 058a869b70 Permit usage of std::unordered_map & std::unorderered_set on c++11 compilers (#4430)
This fallback to std::map & std::set for older compilers

Use UNORDERED_SET as an example in decoration and ore biome sets

Use UNORDERED_MAP as an example in nameidmapping
2016-08-10 12:08:05 +02:00
kwolekr 27aff22a9b Random misc. warning fixes and cleanups
- Fix unused c_sand member warning in Valleys Mapgen
 - Fix some code style
 - Make some std::string params const ref
2016-06-11 03:23:53 -04:00
Ekdohibs 14ef2b445a Add colored text (not only colored chat).
Add documentation, move files to a proper place and avoid memory leaks.
Make it work with most kind of texts, and allow backgrounds too.
2016-05-31 17:34:29 +02:00
TriBlade9 1d40385d4a Colored chat working as expected for both freetype and non-freetype builds. @nerzhul improvements * Add unit tests * Fix coding style * move guiChatConsole.hpp to client/ 2016-05-31 17:34:29 +02:00
est31 27db929252 Add minetest.check_password_entry callback
Gives a convenient way to check a player's password.

This entirely bypasses the SRP protocol, so should be used
with great care.

This function is not intended to be used
in-game, but solely by external protocols, where no
authentication of the minetest engine is provided, and
also only for protocols, in which the user already gives the
server the plaintext password.

Examples for good use are the classical http form, or irc,
an example for a bad use is a password change dialog inside
formspec.

Users should be aware that they lose the advantages of the SRP
protocol if they enter their passwords for servers outside the
normal entry box, like in in-game formspec menus,
or through irc /msg s,

This patch also fixes an auth.h mistake which has mixed up the
order of params inside the decode_srp_verifier_and_salt function.

Zeno-: Added errorstream message for invalid format when I committed
2016-05-30 23:28:08 +10:00
Ekdohibs 48939df9a5 Escape more strings: formspecs, item descriptions, infotexts...
Also, change the escape character to the more standard \x1b
Thus, it can be used in the future for translation or colored text,
for example.
2016-04-24 03:54:11 +10:00
est31 9a04dfd0f5 Update CSRP-GMP to commit deaa11a7c29a73008
Backports 10 commits, with 8 commits
actually affecting source code:

695822e45d...deaa11a7c2
2016-04-10 14:56:54 +02:00
ShadowNinja 93887043d9 Clean up Strfnd
Changes:
  * Fix indentation.
  * Pass strings by const reference.
  * Merge Strfnd and WStrfnd into one class instead of copying them.
  * Remove trailing spaces.
  * Fix variable names.
  * Move to util.
  * Other miscellaneous style fixes.
2016-03-19 21:27:57 -04:00
Ekdohibs 095f623fa7 Remove chat escape sequences from chat messages, for future colored chat. 2016-03-15 17:33:15 +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
ShadowNinja 3ce6642a26 Add AreaStore custom ID API 2016-03-07 16:33:20 -05:00
ShadowNinja 821551a266 Implement AreaStore serialization 2016-03-07 16:33:20 -05:00
ShadowNinja c4b7afed7e Fix SpatialAreaStore not freeing removed areas 2016-03-07 16:33:20 -05:00
ShadowNinja 8ae1e1f4d2 Add basic AreaStore method documentation 2016-03-07 16:33:20 -05:00
ShadowNinja 6e9d71342a Sort AreaStore header 2016-03-07 16:33:20 -05:00
ShadowNinja 5641da43d6 Clean up VectorAreaStore 2016-03-07 16:33:20 -05:00
ShadowNinja 2e74e9ee20 Move AreaStore container selection logic into getOptimalImplementation 2016-03-07 16:33:20 -05:00
ShadowNinja 0079887b64 Move AreaStore to util 2016-03-07 16:33:20 -05:00
est31 d494733839 Add minetest.register_lbm() to run code on block load only 2016-03-07 19:54:26 +01:00
RealBadAngel 1ec1a605d6 HOTFIX: fix too agressive block culling 2016-02-18 18:07:28 +01: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
qiukeren 848b050a56 Add macos/freebsd missing endian.h include and add win endianness info 2015-12-29 23:03:30 +01:00
kwolekr 6f95bb1ef3 Fix misc. MinGW and Valgrind warnings 2015-11-08 16:34:56 -05:00
est31 337c02c0f0 Don't compile pcgrandom on Windows
There it isn't needed.
2015-11-08 18:26:20 +01:00
est31 5e507c9829 Add server side ncurses terminal
This adds a chat console the server owner can use for administration
or to talk with players.
It runs in its own thread, which makes the user interface immune to
the server's lag, behaving just like a client, except timeout.
As it uses the same console code as the f10 console, things like nick
completion or a scroll buffer basically come for free.
The terminal itself is written in a general way so that adding a
client version later on is just about implementing an interface.

Fatal errors are printed after the console exists and the ncurses
terminal buffer gets cleaned up with endwin(), so that the error still
remains visible.

The server owner can chose their username their entered text will
have in chat and where players can send PMs to.
Once the username is secured with a password to prevent anybody to
take over the server, the owner can execute admin tasks over the
console.

This change includes a contribution by @kahrl who has improved ncurses
library detection.
2015-11-06 08:51:14 +01:00
kwolekr 6ba4f3775e Silence 'unused typedef' warning for STATIC_ASSERT() 2015-11-03 01:03:33 -05:00
est31 eabfe091b5 Rename and move basicmacros.h to util/basic_macros.h 2015-11-02 04:57:55 +01:00
kwolekr 27eed1389b Move basic, non-numeric macros from util/numeric.h to basicmacros.h 2015-10-27 01:53:45 -04:00
kwolekr 1a5b4b38f3 Add BufReader and vector-based serialization methods 2015-10-15 01:31:31 -04: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
ShadowNinja 6f4d6cb574 Always use errorstream for DEBUG_EXCEPTION_HANDLER 2015-10-14 02:33:30 -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
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
Rui 3a2bfd4548 Fix indianred and indigo of color-string 2015-08-19 19:49:45 +02:00
est31 457d42c599 Android: bypass broken wide_to_utf8 with wide_to_narrow (again)
This bypass had to be re-enabled as some users reported issues,
even after the iconv build fix.

While utf8_to_wide works well, wide_to_utf8 is quite broken
on android, for some reason, and some devices (unrelated from build
configuration).
2015-08-19 18:38:00 +02:00
kwolekr 8560ece02e Fix BufferedPacket race condition (fixes #2983)
This was caused by the use the non-threadsafe SharedBuffer in a
threaded context.
2015-08-06 02:25:35 -04:00
est31 49cf66d785 Initialize random for verification key generation too 2015-08-06 05:48:07 +02:00
Břetislav Štec abe6c072d6 src/util/numeric.{cpp,h}: Fix FacePositionCache data race 2015-08-02 19:42:22 +02:00
kwolekr 42cf5e972d Improve accuracy and safety of float serialization
Multiplying by a factor of 1/1000.f (rather than dividing by 1000.f) directly
introduces an error of 1 ULP.  With this patch, an exact comparison of a
floating point literal with the deserialized F1000 form representing it is now
guaranteed to be successful.
In addition, the maxmium and minimum safely representible floating point
numbers are now well-defined as constants.
2015-08-01 19:30:08 -04:00
kwolekr bf991bde45 Clean up util/serialization.{cpp,h} and add unit tests 2015-08-01 19:24:46 -04:00
est31 eb3aac20c8 Android: fix horrible libiconv build
Before, our libiconv build was a joke. We first called configure for our own build host system,
then called make, before we executed a Android.mk script we provided as patch. The first "native make"
always failed, and the LIBICONV_LIB file setting in our Makefile didn't match the built one,
resulting in an always-rebuild of iconv.

This commit cleans up this total mess, removes the double-build, and the Android.mk, and properly calls
./configure with the according target platform, and uses a built toolchain.

As we have to deal with the android bug "NDK: Support for prebuild libs with full sonames"
https://code.google.com/p/android/issues/detail?id=55868
as the 2013 patch
https://lists.gnu.org/archive/html/libtool-patches/2013-06/msg00002.html
by Google's David Turner wasn't inside the 2011 libtool, we pass -avoid-version to
libtool.

Thanks to the proper build, wide_to_utf8 works for android now, removing us of the need to disable it.
2015-07-29 15:59:06 +02:00
est31 c30a2d6854 Add AreaStore data structure 2015-07-27 06:42:56 +02:00
est31 5bde7798e9 Check output of mpz_set_str and fix leak on error condition
Also add static identifier as upstream did
2015-07-24 22:42:54 +02:00
Loic Blot aab7c83d02 Remove some old dead code. Fix some Clang warnings in SRP (ng->N... will
always evaluate to true.
2015-07-24 21:48:02 +02:00
est31 254dbe7abd Clarify docs for auth.cpp method 2015-07-21 18:14:39 +02:00
kwolekr 515e7028ac Increase limit of serialized long strings 2015-07-14 03:22:16 -04:00
kwolekr 6f07f79c2f Add more robust error checking to deSerialize*String routines
Add serializeHexString()
Clean up util/serialize.cpp
2015-07-13 22:38:01 -04:00
kwolekr 8eb272cea3 Misc. minor fixes 2015-07-10 15:58:57 -04:00
est31 b0784ba871 Use UTF-8 instead of narrow
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-08 10:12:44 +02:00
est31 29dda9f356 Add UpdateThread and use it for minimap and mesh threads 2015-06-29 15:00:19 +02:00
kwolekr 4e28c8d3c8 Fix *BSD build with GNU iconv 2015-06-29 12:32:01 +02:00
est31 6f8bdda90e Fix string conversion error message 2015-06-23 15:04:14 +02:00
figec d7190df07e More correct wrap_rows implementation 2015-06-20 03:41:51 +02:00
figec 3b65a6a36c Fix wrap_rows at inner byte of multibyte sequence
Also fix UTF-8 inner byte bounds and make unittest for case this fixes.
2015-06-18 23:39:23 +02:00
est31 43dab2ffc8 Make wrap_rows not wrap inside utf-8 multibyte sequences
Also count multibyte sequences as "one" character.
Adds unittest for the bug reporter's case.
Fixes #2796.
2015-06-17 22:22:15 +02:00
est31 6dcf549ba9 Fail iconv call gracefully
No freezing when inbuf_size doesn't decrease over time.
2015-06-17 19:03:58 +02:00
est31 60f31ad523 Android: bypass broken wide_to_utf8 with wide_to_narrow
While utf8_to_wide works well, wide_to_utf8 is quite broken
on android, for some reason.
2015-06-14 08:25:21 +02:00
est31 572990dcd3 Add utf-8 conversion utilities and re-add intlGUIEditBox 2015-06-13 19:49:55 +02:00
kwolekr 6c5a6967ec Split ObjDef/ObjDefManager out to objdef.cpp 2015-05-18 22:30:25 -04: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
SmallJoker 6626a3f72f Fix several MSVC issues numeric.h
-> Round negative numbers correctly CMakeLists.txt
-> Link Json with the static run-time library
2015-05-01 07:34:51 +02:00
Aaron Suen 1fb3d1156c Fix fast leaves with texture_clean_transparent enabled. 2015-04-26 23:39:40 +10: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
Aaron Suen 6d61375cc7 Clean scaling pre-filter for formspec/HUD. 2015-04-01 00:01:05 -04:00
kwolekr 699e066bea Fix set_bits 2015-03-31 23:30:44 -04:00
kwolekr ed10005d38 GenElementManager: Pass opaque handles to Lua and rename to ObjDefManager
Add core.clear_registered_schematics() and refactor schematics somewhat
2015-03-31 01:11:51 -04: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
kwolekr 3993093f51 Add support for the PCG32 PRNG algo (and associated script APIs) 2015-03-22 00:48:08 -04:00
Loic Blot 2f0107f4a7 MutexedQueue inherits must use std::deque instead of std::list 2015-03-17 17:12:20 +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
Craig Robbins 5698e2baf8 Fix Android text bug (no text displaying) 2015-03-07 20:51:07 +10: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 cd684497c2 Use std::vector instead of std::list in StaticObjectList and MutexedMap::getValues() 2015-03-04 17:22:37 +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
Craig Robbins 338e66af5f Fix minor memory leak (Android) 2015-02-27 13:40:27 +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
Loic Blot 5a5854ea9d Move hex.h to util/ 2015-02-21 14:32:35 +01:00
Loic Blot 3998a1f8f9 Move sha1.hpp and base64.hpp to util/ 2015-02-21 14:03:27 +01: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
BlockMen d302629392 Fix gettext on MSVC 2015-02-12 16:03:55 +01:00
ShadowNinja 98b37e3e0d Fix Android build of narrow_to_wide 2015-02-11 02:28:22 -05:00
ShadowNinja 9e2a9b55e1 Reduce gettext wide/narrow and string/char* conversions 2015-02-05 03:24:22 -05:00
gregorycu db3466dbe8 Water fixes
Change must_reflow to a deque
Add overload for MapBlock::raiseModified that takes a const char*. This is a speed improvement.
Comment out unused variable
Optimisations to block offset calculations
2015-01-18 20:30:33 +10:00
Craig Robbins 5481e38d0b Make minor style change(unescape_string()) 2015-01-16 21:05:44 +10:00
ShadowNinja 77e20a0c21 Fix unescape_string removing all backslashes 2015-01-15 16:16:41 -05:00
unknown bd0d786590 Change UniqueQueue to use a queue and a set. 2015-01-15 21:08:35 +10:00
ShadowNinja 3c3887bb19 Deduplicate code and use stdlib in string functions 2015-01-03 14:50:16 -05:00
KodexKy 5413ed1195 Fixes for Android build errors. Enable sensor landscape rotation.
Fix typo in Android Makefile ndk path.
Fix touchscreen parts of game.cpp to work after Zeno's refactor.
Fix isdigit and isspace overload conflict with Android Irrlicht in string.h
Enable sensor landscape rotation in Android Manifiest.
Add mapgen v5 to Android build.
Fix Makefile not checking leveldb.

Signed-off-by: Craig Robbins <kde.psych@gmail.com>
2014-11-25 13:28:51 +10:00
Rafael Reilova f7d65091f8 serialize.h: use machine native byte swapping if available, fall-back to previous generic method if not (supported for GCC using endian.h, detection done in cmake) write/readARGB8() - just write 32-bit color in one op, instead of 4 1-byte ops cleanup: removed unneeded buffer init for some serialize-out functions use a #define for the fixed point factor in read/writeF1000()
nodemetadata.cpp, nodetimer.cpp
	optimzation: simpler deserialize node position method

staticobject.cpp:
	cleanup: use util/serialize.h inlines instead of its own de/serialization

serialize.cpp:
	minor optimization/cleanup: avoid generation of unneeded string temporary

CMakeLists.txt, cmake_config.h.in: detection of endian.h

config.h: added HAVE_ENDIAN_H

Commits due to feedback squashed

Signed-off-by: Craig Robbins <kde.psych@gmail.com>
2014-11-21 22:33:48 +10:00
Kahrl 55e4c35eaf Remove unused rangelim function (the macro still exists) 2014-11-19 10:19:52 +01:00
Kahrl 9b551d5cbc Implement WieldMeshSceneNode which improves wield mesh rendering
- Don't create and cache an extruded mesh for every (non-node) item.
  Instead use a single one per image resolution.

- For cubic nodes reuse a single wield mesh too

- Improve lighting of the wielded item

- Increase far value of wield mesh scene camera, fixes #1770

- Also includes some minor refactorings of Camera and GenericCAO.
2014-11-08 23:11:57 +01:00
Craig Robbins 43bf4324d5 Cleanup and (mostly) document util/string.h and (very) minor refactoring
Updated: Incorporated feedback from 'kahrl'
Updated: Moved MinetestApp::boolToCStr() from game.cpp into string.h renaming it bool_to_cstr()
2014-11-02 18:07:20 +01:00
Craig Robbins 6c9bbb0360 Fix bug introduced by me (Zeno) 2014-10-29 08:54:16 +01:00
Craig Robbins 813c088c1c Added names colours and refactored parseColorString() 2014-10-29 03:10:59 -04:00
kwolekr 1cb6ea6346 Refactor decoration-related code
Split up ModApiMapgen::l_register_decoration()
Define and make use of CONTAINS() and ARRLEN() macros
2014-10-29 01:56:37 -04:00
Kahrl 26495da94a Fix unit reported by TimeTaker (was always ms) 2014-10-09 11:15:03 +02:00
BlockMen 28438bba27 Add [colorize modifier 2014-10-05 16:49:52 +02:00
kwolekr 37d3c3d328 Fix misc. style issues 2014-10-03 03:49:06 -04:00
BlockMen 61ed56f916 Standardize tooltip row detection 2014-09-28 10:10:43 +02:00
ShadowNinja cd64a92a8c Use const references for Settings methods
Also check for (this == &other) before locking mutexes.
2014-09-21 14:39:35 -04:00
sapier 1cc40c0a7c Add support for Android 2.3+
There have been plenty of ppl involved in creating this version.
I don't wanna mention names as I'm sure I'd forget someone so I
just tell where help has been done:
- The partial android versions done by various ppl
- Testing on different android devices
- reviewing code (especially the in core changes)
- testing controls
- reviewing texts

A big thank you to everyone helping this to be completed!
2014-06-29 18:17:56 +02:00
sapier ee7af21e41 Fix msvc2012 build 2014-06-29 16:57:50 +02:00
sapier ebf7ea5019 Add formspec api versioning 2014-06-29 12:13:55 +02:00
sapier eda9214f81 Bunch of small fixes (coding style, very unlikely errors, warning messages) 2014-04-19 11:56:19 +02:00
BlockMen e149d1ad9a Fix write and read S32 vectors 2014-04-12 17:39:51 +02:00
ShadowNinja 5fefc4bbf6 Fix serializing of signed numbers in serializeStructToString 2014-03-21 05:22:21 -04:00
ShadowNinja 23be6450a1 Make serializeStructToString use an ostringstream 2014-03-15 15:13:02 -04:00
ShadowNinja d753d352f1 Revert "Use fixed-width format specifiers in serializeStructToString"
This reverts commit 875f1327a4.
Fixed width format specifiers are only officially availale in C99 and C++11.
2014-03-14 12:13:30 -04:00
ShadowNinja 875f1327a4 Use fixed-width format specifiers in serializeStructToString 2014-03-13 17:30:15 -04:00