Commit Graph

121 Commits

Author SHA1 Message Date
SmallJoker
ecc6f4ba25
Remove a few unused functions reported by callcatcher () 2021-10-12 20:12:20 +02:00
SmallJoker
d51d0f3a5a
Various code improvements
* Camera: Fix division by 0 after view bobbing
* Remove ignored constness
* Connection: Improve window size range limits
2021-09-27 17:45:44 +02:00
sfan5
75bf9b75ca
Make sure relevant std::stringstreams are set to binary 2021-09-11 21:06:57 +02:00
SmallJoker
f2fd443262
Inventory: Make addList() consistent ()
Fixes list clearing for inv:set_list() using same size, since 2db6b07.
addList() now clears the list in all cases. Use setSize() to resize without clearing.
2021-06-30 20:39:38 +02:00
sfan5
f0bad0e2ba
Reserve vectors before pushing and other code quality changes () 2021-04-05 13:38:31 +02:00
DS
f3ae45b2b2
Add a short_description to be used by mods () 2020-10-09 19:11:21 +01:00
Lars Müller
050964bed6
Fix inventory swapping not calling all callbacks ()
"Predicts" whether something will be swapped for allow callbacks, then calls callbacks a second time with swapped properties.

Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com>
2020-09-04 20:49:07 +02:00
Paul Ouellette
b16f841756
LuaItemStack: Add __tostring metamethod ()
* LuaItemStack: Add __tostring metamethod

* Clean up LuaItemStack::checkobject
2020-06-09 19:37:25 +02:00
SmallJoker
94a5df795c
Inventory: Properly revert client predictions ()
Caused by incremental inventory sending
Previously everything was overwritten by serializing the entire inventory
2019-09-18 18:47:09 +02:00
sfan5
4582691104 Fix Inventory::moveItemSomewhere() 2019-09-03 20:16:36 +02:00
SmallJoker
f3acdd3914
Inventory: Handle removeItem leftovers () 2019-09-02 19:30:36 +02:00
SmallJoker
1d3f5af7c0 Inventory: Fix missing setModified calls
Previously inv:remove_item and inv:set_list did not trigger an inventory update
2019-08-25 09:46:54 +02:00
SmallJoker
0b4f424f41
Inventory: Send dirty lists where appropriate ()
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.
2019-08-24 19:07:38 +02:00
Paul Ouellette
008b80fe1c Add ItemStack:get_description() to get tooltip () 2019-08-24 18:38:02 +02:00
ANAND ︻气デ═一
568694122c Revert "Inventory: Make addItem for empty ItemStacks respect max stack size" ()
Revert commit e6a9e60
2019-05-12 18:07:15 +01:00
ANAND ︻气デ═一
8e3b63bd28 Define operators == and != for ItemStack 2019-05-11 18:48:27 +02:00
SmallJoker
220ec79e4a
Inv deSerialize(): Prevent infinite loop, error on failure ()
Throws an error about potentially damaged player inventories but proceeds converting the rest of them
2018-09-14 20:29:21 +02:00
Loïc Blot
bd6b90359c Remove DSTACK support ()
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.
2017-08-30 08:09:41 +02:00
Loic Blot
1d086aee7c
Modernize various files (part 2)
* range-based for loops
* emplace_back instead of push_back
* code style
* C++ headers instead of C headers
* Default operators
* empty stl function
2017-08-18 08:07:59 +02:00
SmallJoker
c08cc0533f Inventory: Fix wrong stack size behaviour and item loss ()
Also fix itemFits and remove constness-nonsense
2017-06-25 11:39:39 +02:00
Jesse McDonald
e6a9e6066a Inventory: Make addItem for empty ItemStacks respect max stack size
When adding items to an empty ItemStack, limit the number of items taken
based on the maximum stack size in the item description.
Likewise, when checking whether items will fit into an empty ItemStack,
only absorb as many items as are allowed in a single stack and return the rest.
2017-06-21 01:53:57 +01:00
Dániel Juhász
0fcaf9fb1b Automatic item and node colorization ()
* Automatic item and node colorization

Now nodes with a palette yield colored item stacks, and colored items
place colored nodes by default. The client predicts the colorization.

* Backwards compatibility

* Use nil

* Style fixes

* Fix code style

* Document changes
2017-06-20 11:19:56 +02:00
Loïc Blot
8f7785771b Cpp11 initializers 2 ()
* C++11 patchset 10: continue cleanup on constructors

* Drop obsolete bool MainMenuData::enable_public (setting is called with cURL in server loop)

* More classes cleanup

* More classes cleanup + change NULL tests to boolean tests
2017-06-17 19:11:28 +02:00
Loïc Blot
8bdde45895 Revert "Remove deprecated code segments ()"
This reverts commit 599e13e95e81aadb959c9f3715aec9b425ede084.
2017-06-06 16:19:04 +02:00
Thomas--S
599e13e95e Remove deprecated code segments () 2017-06-04 21:42:32 +02:00
Loïc Blot
f3fe62a0bf Fix various copy instead of const ref reported by cppcheck ()
* Also remove InventoryList::peekItem unused function
* Fix some post increment to preincrement reported by cppcheck
2017-04-19 23:02:07 +02:00
rubenwardy
f2aa2c6a98 Add ItemStack key-value meta storage 2017-02-04 22:07:55 +00:00
Xunto
ae7fb9b5be Inventory: Make ItemStack with different metadata not stackable 2016-04-26 10:16:20 +01: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
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
David Jones
34b7a147dc Change i++ to ++i 2015-08-25 18:33:52 -04:00
est31
1fadf7f21e Fix inventory replace bug 2015-08-19 03:42:00 +02:00
est31
3376d2e114 Remove compile warning
Thanks @TeTpaAka for pointing this out.
2015-06-25 15:50:31 +02:00
est31
2c1fd29884 Add MoveSomewhere inventory action
Improve shift+click experience
2015-06-23 20:18:41 +02: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
ShadowNinja
b1965ac209 Clean up rollback 2014-11-19 16:21:59 -05:00
ShadowNinja
e9c9b66ae9 Make players check inventory modification properly 2014-10-01 18:44:36 -04:00
ShadowNinja
c061bdd37f Fix locking bugs and make inventory deserialization errors more specific 2014-09-21 14:39:36 -04:00
Kahrl
6f6f289db4 Compare values instead of pointers in Inventory::operator== 2014-01-11 19:47:16 +01:00
Kahrl
51e6feb17c Add operator!= to Inventory(List), make operator== a const method 2014-01-11 19:46:37 +01:00
sapier
90e7832408 Fix invalid listname and listsize not handled correctly in set_size 2013-11-16 15:52:41 +01:00
Kahrl
112dbba7c4 Change ContentFeatures array to a vector 2013-07-14 23:06:31 +02:00
PilzAdam
280946ba83 Dont write player files all the time 2013-06-28 14:15:48 +00:00
kwolekr
d01b74d00a Prevent infinite loop with invalid Inventory format 2013-03-27 23:27:31 -04:00
Sfan5
6d0ea26c2d Update Copyright Years 2013-02-24 20:15:24 +01:00
PilzAdam
497ff1ecd6 Change Minetest-c55 to Minetest 2013-02-24 18:49:03 +01:00
Perttu Ahola
60932d2bd7 Remove "Unknown inventory identifier" deserialization errors, because they can break forward compatibility 2012-09-04 23:02:56 +03:00
Ilya Zhuravlev
6a16075912 Add InventoryList width property & allow custom crafting grids. 2012-09-01 10:01:41 +03:00
Perttu Ahola
d0ea6f9920 Properly and efficiently use split utility headers 2012-06-17 02:40:36 +03:00
Perttu Ahola
037b259197 Switch the license to be LGPLv2/later, with small parts still remaining as GPLv2/later, by agreement of major contributors 2012-06-05 18:54:07 +03:00