1
0
Fork 0
Commit Graph

138 Commits

Author SHA1 Message Date
Tiger Wang ecc8ffbd80 Compile the entire Lua stack as C++
* Fixes #5216
2021-06-25 10:17:53 +01:00
x12xx12x cc9f7c06b3
Add optional prefix parameter to LOG functions (#5229)
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2021-06-22 23:09:06 +01:00
nshah25 8be1dd54bb
Add player statistics to API (#5193)
* Fixed issue #5166

Co-authored-by: 12xx12 <44411062+12xx12@users.noreply.github.com>
Co-authored-by: Tiger Wang <ziwei.tiger@outlook.com>
2021-05-03 21:07:09 +01:00
Tiger Wang 50a94f972d
Fix debug macro situation (#5114)
Use the standard NDEBUG.
2021-01-26 09:41:55 +00:00
Tiger Wang eeb63b8901
zlib -> libdeflate (#5085)
+ Use libdeflate
+ Use std::byte
* Fix passing temporary to string_view
+ Emulate make_unique_for_overwrite
2021-01-11 16:39:43 +00:00
Tiger Wang f9ac6543ab C++17 stuff 2020-09-30 22:05:17 +01:00
Mattes D 46398f4671 Replaced cpp14::make_unique<> with std::make_unique<>. 2020-08-01 20:04:31 +01:00
peterbell10 13144a08e4
Enable some more clang-tidy linter checks (#4738)
* Avoid inefficient AString -> c_str() -> AString round trip

* Avoid redundant string init expressions

* Avoid unnecessary return, continue, etc.

* Add .clang-format to help with clang-tidy fix-its

* Avoid unnecessary passing by value

* Avoid unnecessary local copying

* Avoid copying in range-for loops

* Avoid over-complicated boolean expressions

* Some violations missed by my local clang-tidy

* Allow unnecessary continue statements

* Add brackets

* Another expression missed locally

* Move BindingsProcessor call into clang-tidy.sh and add space

* Fix pushd not found error

* Different grouping of CheckBlockInteractionRate
2020-05-14 22:15:35 +00:00
peterbell10 57952505e5
Update fmt to 6.2.0 (#4718)
* Update fmt to 6.2.0
2020-05-05 22:52:14 +01:00
Mattes D f84bab3bc2
Fixed Lua Vector unification. (#4652) 2020-04-15 00:23:24 +01:00
Mattes D c9a9b3c9d0
Bindings: Allow coercion between Vector3 subtypes. (#4646)
In manually bound functions, allows one to use any Vector3<T> value, as well as a {x, y, z} table, in Lua as any Vector3<T> parameter.
Has example in Debuggers' /vector command.
Unfortunately doesn't work in auto-bindings.
2020-04-14 16:43:21 +02:00
Max Luchterhand 4f60eaabca
Wrong overload of function push() got called when pushing a cEntity*. (#4512)
* Now having two funcs, Push(cEntity* ..) and Push(const cEntity* ...).
For now, the const function just casts away the const qualifier and
passes to the other.

Co-authored-by: mluchterhand <mluchterhand@max.de>
2020-03-21 16:00:26 +00:00
peterbell10 4727ed2084 Add a formatting function for Vector3 (#4282)
* Vector3: Add custom fmt compatible formatter.

* cLuaState: Add fmt version of ApiParamError

* Use vector formatting in manual bindings

* Always log vectors with FLOG
2018-09-24 21:33:39 +01:00
peterbell10 950aeffff8
CheckBasicStyle: Check number of empty lines between functions (#4267)
Add check for number of empty lines between functions and fix the corresponding failures
2018-07-26 22:24:36 +01:00
peterbell10 a4dbb5c582
Prefer static_cast to reinterpret_cast (#4223)
* Change reinterpret_cast -> static_cast wherever possible
* Remove more unnecessary `const_cast`s.

reinterpret_casts should be avoided for the same reason as c-style casts - they don't do any type-checking. reinterpret_cast was mainly being used for down-casting in inheritance hierarchies but static_cast works just as well while also making sure that there is actually an inheritance relationship there.
2018-05-02 08:50:36 +01:00
peterbell10 d3c1c626f5
Deal with covered switches consistently (#4161)
* Fixes a number of "<function>: not all control paths return a value" warnings on MSVC.

* Introduces the UNREACHABLE global macro and uses it instead of conditionally compiled switch defaults.

* Move cNBTParseErrorCategory from FastNBT.h into FastNBT.cpp to prevent bad calls to message()
2018-02-04 23:07:12 +00:00
peterbell10 757231cc6e
Add the fmt library (#4065)
* Replaces AppendVPrintf with fmt::sprintf
* fmt::ArgList now used as a type safe alternative to varargs.
* Removed SIZE_T_FMT compatibility macros. fmt::sprintf is fully portable and supports %zu.
* Adds FLOG functions to log with fmt's native formatting style.
2018-01-03 17:41:16 +00:00
peterbell10 177273006e
cLuaState: Update `Push` for entities. (#4128)
Fixes #4127

Some classes were exported but were only pushed as a cEntity
meaning exported functions were inaccessible.
This brings cLuaState::Push(cEntity *) up to date with all exported entities.
2018-01-03 11:38:00 +00:00
bibo38 532731e6f4 Fixed Clang 5.0 compile errors (#4085)
* Fixed Clang 5.0 compile errors

* Fixed wrong comment

* Only disable warnings in Clang 5 or higher

* Added a CMake condition for the Clang 5 no-zero-as-null-pointer-constant warning

* Now using the use_nullptr branch of the Cuberite specific SQLiteCpp fork
2017-12-21 11:36:58 +00:00
peterbell10 e225b7f826 Replace ItemCallbacks with lambdas (#3993) 2017-09-11 23:20:49 +02:00
LogicParrot 49c443896d Revert "Replace ItemCallbacks with lambdas (#3948)"
This reverts commit 496c337cdf.
2017-09-02 08:50:23 +01:00
peterbell10 496c337cdf Replace ItemCallbacks with lambdas (#3948) 2017-09-01 13:04:50 +02:00
peterbell10 f4f2fc7c3d Add cUUID class (#3871) 2017-08-25 13:43:18 +01:00
Pablo Beltrán b18f6637b6 Fully implemented leashes (#3798) 2017-08-21 10:46:41 +02:00
peterbell10 b8dda388e0 Represent cItem::m_Lore as an AStringVector (#3882)
* Replace cItem::m_Lore with AStringVector

* Reword deprecation warning

* Fix lua bindings
2017-08-18 11:29:54 +01:00
Lane Kolbly 1ec85a2b2c Add cLuaWindow OnClicked Callback (#3901) 2017-08-17 16:27:43 +02:00
Mattes D e05ca49459 Moved ApiParamError into cLuaState. 2017-06-26 10:52:59 +02:00
Mattes D fe42538349 cBlockArea supports block entities. (#3795) 2017-06-24 11:58:06 +02:00
Mattes D 3c4e443ddc Fixed handling Lua errors in nested callbacks (#3755) 2017-06-09 12:16:31 +02:00
Mattes D 3d5ee3e5c7 Fixed Lua bindings for const objects. 2017-05-09 14:10:53 +02:00
Mattes D 7cc3fb098d DeadlockDetect now lists some tracked CS's stats. 2017-01-18 09:03:05 +01:00
Mattes D e9547101b1 LuaState: Fixed untracking references.
One thread may untrack a ref while another thread was closing the LuaState, which had emptied the tracked refs.
2017-01-15 12:54:58 +01:00
Mattes D fb0fc07579 Fixed race conditions and forgotten clear in Lua ref tracking. (#3530)
This fixes occasional crashes on plugin reload.
2017-01-13 10:31:05 +01:00
Mattes D f62711f97c LuaState: Fixed race condition in ref tracking. (#3529) 2017-01-09 15:56:16 +01:00
Mattes D 9af17f7c39 LuaState: Fixed stack balance when calling functions (#3428) 2016-11-10 16:46:31 +01:00
Mattes D 5ca371bb9a cUrlClient: Exported to Lua API. 2016-08-23 13:20:43 +02:00
Mattes D 11682d1386 cLuaState: Moved function param counting to PushCallPop() template.
The Push() functions can be used not only for function params, but also returns or temporaries, so it doesn't make sense to count the params there.
2016-08-22 20:10:48 +02:00
Mattes D 9493488e48 cLuaState: Added direct support for pushing a nil constant. 2016-08-22 20:09:56 +02:00
Mattes D 89c9c6fe46 cLuaState: Added support for optional params and AStringMap values. 2016-08-22 20:01:23 +02:00
Mattes D 0f51f7e358 Fixed cWorld:ChunkStay bindings. (#3319)
Introduced new cLuaState::cOptionalCallback for representing optional callbacks (nil from Lua side).
Introduced new cLuaState::cStackTable class for easy access to Lua table's elements.

Fixes #3305.
2016-08-14 16:26:31 +02:00
Mattes D 2d58789d66 Converted cLuaState::cTableRef to use cTrackedRef.
This makes the table-based callbacks resistent to LuaState unloads and safer to use.
2016-08-13 21:16:21 +02:00
Mattes D ec235e7120 Removed debug log message.
Ref.: #3308
2016-08-11 21:15:54 +02:00
Mattes D c4578db4df Fixed LuaAPI library registrations. (#3308)
lsqlite3 didn't clean up the stack properly.
lxp didn't register itself properly.
2016-08-11 21:04:29 +02:00
Mattes D d1dee3c909 Fixed RasPi builds of unit tests.
On RasPi with gcc 4.8.2, the asserts wouldn't compile when tests were enabled.
Enforced the assumption that ASSERT code is generated only in Debug builds.
2016-08-04 20:47:53 +02:00
Mattes D bf88312a16 Converted cLuaState::cCallbackPtr into a UniquePtr. 2016-06-27 20:51:53 +02:00
Mattes D 7a6670d1d1 Removed dead code related to callbacks. 2016-06-27 20:51:52 +02:00
Mattes D 257c5a1a54 cPluginManager: Use a callback for command handler registration. 2016-06-27 20:51:52 +02:00
Mattes D 24853397ef LuaState: Implemented proper locking for cCallback. 2016-06-27 20:51:51 +02:00
Mattes D fb4c3fc4d9 Changed cLuaWindow callbacks to use cLuaState::cCallback. 2016-06-27 20:51:50 +02:00
Mattes D 4489a89fde Changed plugin hook registrations to use cLuaState::cCallback. 2016-06-27 20:51:49 +02:00