The one moved are supported since a long time/older compiler versions
and from both Clang and GCC, so they can be safely moved.
Also, not having to check them, CMake configuration is a bit faster.
Added different macros, instead of using _MSC_VER. This one is added
even when Clang with MSVC runtime, so it's not viable to check if we're
compiling with MSVC.
- Fixed: ini CommandPrefix being overwritten by data from other ini settings.
- Fixed: function call stack sometimes being subject to a race condition between two writing threads, corrupting it.
- Fixed: lots of memory corruption errors leaving the server unstable when loading a broken save file and recovering by loading a backup save.
- Fixed: CCacheableScriptFile sometimes not reading the last character.
- Fixed: .clang_format.
- Changed: RES_GET_INDEX macro to ResGetIndex function, allowing more integer type safety. Same for RES_GET_TYPE.
- Changed: Renamed THREAD_* macros to MT_*. Split them in always active macros (MT_*) and macros active only when MT_ENGINE is set to 1 (MT_ENGINE_*). There are some situations where we still need a mutex
even if not working with multithreaded script/networking engines (which are NOT complete).
- Changed: Disable signal handlers under Linux if running with ASAN or a debugger.
- Added: NOEXCEPT_DEBUG, it's simply the noexcept specifier, but it's ignored if running in a debug build (useful if we're using DEBUG_ASSERT inside a function which wouldn't otherwise throw an exception).
- Fixed: some undefined behaviors, like signed to unsigned conversion and vice versa.
- Added: additional checks for GCC and Clang ASAN builds.
Fixed: crash when moving a char in an area full of teleporters, or whichever items made the char move multiple times in the same tick.
Fixed: buffer read past the end in CCacheableScriptFile first reading.
Fixed: if a char had the COMM_CRYSTAL flag enabled, it called ::OnHear on every item in range, without checking if the item is actually capable of hearing.
Further optimized distance checks.
Separated the Github workflows into different files, in order to get a different badge for each build platform/type.
Dismissed AppVeyor build.
Added sphere_library/sfastmath.h.
CWorldSearchHolder now uses CSReferenceCount instead of rc_ptr, which is more complex and slightly slower.
Modified some ADDTOCALLSTACK calls for frequently called functions.
Changed some rand val generations in CCharFight to use the fast algorithm.
Inlined some small functions.
Added cdrc external library (reference counted smart pointers, std::shared_ptr is too slow) and new CSReferenceCount sphere library. Cdrc has been slightly modified in order to be used and compiled in a multi-file project. See custom folder.
Added HAS_FLAGS_STRICT and HAS_FLAGS_ANY macros.
Fixed macOS compilation error.
Added #define MT_ENGINES: it doesn't make sense to keep unneeded mutex locks, at least until (if ever) we'll have a fully multithreaded engine.
Some advancement in making ASAN work on Windows with Clang.
Added .cmake-format
This can be useful when using raw IDs (like 01, 0bd1, etc) instead of defnames.
- Improvement: changed the logic behind script files reading and caching, now it will be faster and require less memory.
- Fixed: correct thread name not being shown in the stack trace.
- Renamed ResourceGetID_Advance to ResourceGetID_EatStr, added fCanFail argument.
- Added some string functions, starting from POSIX C getline and getdelim (got the source from NetBSD and renamed to fReadUntilDelimiter), then added some more custom functions to help read from file or string buffers.
Fixed twofish compilation error on Windows. That library wasn't really meant to be used as-is...
Made _GITVERSION define macro available only when enabling git versioning from CMake.
Modernized and fixed MSVC CMake toolchain.
Removed mariadb_version.h from git index.
Windows and OS X not yet tested.
Moved toolchains .inc files to include/ folder.
Renamed folder lib/bin into _bin.
Moved bcrypt and twofish library into lib folder and into new cmake projects. Restored twofish library to the original version.
Fixed some format warnings.
This will allow setting per-project (build) settings and to build/link
Sphere using system-provided library source/headers/precompiled lib
(like the ones provided with -devel packages on Linux) instead of the
ones shipped with the projects.
This is also a necessary step to use git submodules.
Added git branch info into sphere; branch and revision number are not displayed to players/clients (by default).
Fixed some MSVC warnings for WinMain definition and a Clang warning for wrapper_ev.c.
Immediately after server start, the global objects are initialized in spheresvr.cpp. This happens before calling main().
Global objects initialization sometimes requires the allocation of temporary strings and the retrieval of the current thread state data (ThreadHolder class stuff).
Both of those things aren't yet created, so we can write to invalid memory instead of using the expected buffer.
When thread state data is not available, so we can't get a temporary string buffer in a thread-safe way, now it will be used the string buffer allocated for thread-unsafe access (for a minimum example, check Str_GetTemp code).
Also, when the server closes, also the temporary string pool and the thread state data are deleted, but there might be some code still requiring thread state data.
So it was added some code accounting of this special application state, avoiding reading or writing to the thread state data location, which doesn't hold anymore valid data.
Immediately after server start, the global objects are initialized in spheresvr.cpp. This happens before calling main().
Global objects initialization sometimes requires the allocation of temporary strings and the retrieval of the current thread state data (ThreadHolder class stuff).
Both of those things aren't yet created, so we can write to invalid memory instead of using the expected buffer.
When thread state data is not available, so we can't get a temporary string buffer in a thread-safe way, now it will be used the string buffer allocated for thread-unsafe access (for a minimum example, check Str_GetTemp code).
Also, when the server closes, also the temporary string pool and the thread state data are deleted, but there might be some code still requiring thread state data.
So it was added some code accounting of this special application state, avoiding reading or writing to the thread state data location, which doesn't hold anymore valid data.
- Added new "smart" pointer sl::smart_ptr_view, a customized version of the proposed std::observer_ptr. Use this to make clear that you aren't managing the lifetime of the pointer you are using, since it's owned by a unique_ptr or shared_ptr.
- Added new "smart" sl::raw_ptr_view. Same concept of sl::smart_ptr_view, but it wraps a raw/bare pointer (most often it will be used in conjunction with legacy code, which doesn't use smart pointers).
- Renamed CSSortedVector to sl::sorted_vector.
Added: functions to explicitly promote or narrow numeric types.
Changed: Target architecture is precisely reported, instead of giving the number of "bits".