Commit Graph

163 Commits

Author SHA1 Message Date
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