Paul Ouellette
395b1b3346
Initialize priority in CraftDefinition constructors
...
The priority is used by getCraftResult, which may be used before
initHash is called.
2019-07-27 14:42:41 +02:00
HybridDog
12e3d3d12f
Prioritise craft recipes
...
When multiple recipes are applicable, the recipes are prioritised in this order:
toolrepair < shapeless with groups < shapeless < shaped with groups < shaped
For cooking and fuel, items are prioritised over item groups
2019-05-20 20:59:51 +02:00
HybridDog
1604b949fd
Test crafting hash type only once for a recipe
2019-05-20 20:59:36 +02:00
HybridDog
ab322fc5aa
Use unordered_map instead of map for craft definitions ( #8432 )
2019-03-31 19:26:17 +02:00
Jozef Behran
a51909bb64
Speed up the craft definition handling ( #8097 )
...
The craft definition handling code that collects the names of
the craftable nodes suffers from vector reallocation
performance hits, slowing down instances with lots of
crafting recipes (VanessaE's DreamBuilder and most public
server some to my mind when thinking about this). As in each
instance the size of the resulting vector is already known,
add a reserve() call before the offending loops to allocate
the needed chunk of memory within the result vector in one
go, getting rid of the overhead.
2019-01-13 15:11:47 +01:00
Wuzzy
40ab3e011d
Add disable_repair group to prevent tool repair ( #7381 )
2018-10-16 05:25:34 +01:00
Esteban I. RM
90e7d42375
Don't try to craft a non-existent item
2017-10-16 10:13:45 +02:00
Loïc Blot
ae9b5e0098
Modernize code: very last fixes ( #6290 )
...
Last modernization fixes
2017-08-20 19:37:29 +02:00
Loïc Blot
13e995b811
Modernize src/c* src/d* and src/e* files ( #6263 )
...
* Modernize src/c* src/d* and src/e* files
* default operator
* redundant init
* delete default constructors on CraftDefinition childs (never used)
* fix some missing init values
* const ref fix reported by clang-tidy
* ranged-based for loops
* simple conditions & returns
* empty stl function instead of size
* emplace_back stl function instead of push_back + construct temp obj
* auto for some iterators
* code style fixes
* c++ stl headers instead of C stl headers (stdio.h -> cstdio)
2017-08-17 23:02:50 +02:00
rubenwardy
f2aa2c6a98
Add ItemStack key-value meta storage
2017-02-04 22:07:55 +00:00
Foghrye4
281e9f39fd
Adding minetest.clear_craft
...
Modifications by est31: grammar fixes in doc + error messages and
a little style fix, no functional change.
2016-07-05 21:40:13 +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
TeTpaAka
3f8eb5e0d0
Allow craft replacements to use groups
2015-11-15 13:41:38 +01:00
David Jones
34b7a147dc
Change i++ to ++i
2015-08-25 18:33:52 -04:00
est31
64dc053209
Fix endless loop since grandparent commit
2015-07-04 19:43:46 +02:00
est31
96989e0a6a
Craftdef: Use numbers instead of iterators
...
Use numbers instead of iterators to traverse various vectors.
2015-07-04 16:28:21 +02:00
TeTpaAka
87b9cdab07
Fix missing check for 0 in craft replacements
2015-07-04 14:33:49 +02:00
TeTpaAka
17ba584fe2
Fix bug when craft input isn't replaced
2015-06-22 19:30:35 +02:00
est31
0310123bc9
Fix release build warning
2015-05-08 07:23:41 +02:00
est31
27e3a353d8
Remove craftdef serialisation
...
It isn't needed anymore, sending ICraftDefManager over the network has been obsoleted
by protocol version 7.
2015-04-26 21:30:52 +02:00
est31
4f851faa91
Craftdef refactor
...
Fix style, refactor assert, use '"' instead of "\"",
replace code duplicating craftGetItemName, rename iterators.
2015-04-26 21:28:40 +02:00
Loic Blot
ed3ebd633d
craftdef.cpp: Return 0 after assert to make Clang happy
2015-04-05 11:16:12 +02:00
est31
334e70455b
Crafting speedup
...
This greatly increases crafting performance, especially in worlds with many mods.
Approved by @kwolekr.
Introduces a hash-type-layered fall-through mechanism, where every layer specifies one hash algorithm,
and the "deeper the fall", the more collisions to expect for the algorithm. One Craft definition
only resides at one layer, which improves speed for lower layers (and a complete fail), due to most
craft definitions residing at high layers.
Due to the fall-through design, the undocumented behaviour that later craft recipes
override older ones had to be weaked up a bit, but craft recipes with the same hash and layer
will still override.
2015-04-05 09:25:46 +02:00
gregorycu
03e0dd33a8
Optimize minetest.get_(all)_craft_recipe(s)
...
Signed off by: ShadowNinja, kwolekr
2015-03-20 21:41:18 -04:00
Loic Blot
368496b612
Craftdef.cpp: Improve loop and mathematics for CraftDefinitionShaped::check
2015-02-10 14:16:28 +01:00
sapier
d902bd31c4
Fix getCraftRecipe returing wrong reciep due to way to unspecific output matching
2015-02-02 21:32:23 +01:00
Kahrl
fead7a27ca
Fix aliases not working in shapeless crafting recipes
2013-08-25 18:14:26 +02:00
Kahrl
4e1f50035e
Omnicleanup: header cleanup, add ModApiUtil shared between game and mainmenu
2013-08-14 21:03:33 +02:00
RealBadAngel
5af8acfa6e
Added method to get all registered recipes for item(node)
2013-03-05 23:32:33 -05: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
0c91a0d59d
Working group-shapeless and multigroup recipes
2012-07-26 13:49:13 +03:00
darkrose
38580fbee7
Add minetest.get_craft_recipe()
2012-07-21 02:33:22 +03:00
Perttu Ahola
d0ea6f9920
Properly and efficiently use split utility headers
2012-06-17 02:40:36 +03:00
Perttu Ahola
a435cfcd82
Allow groups in crafting recipes
2012-06-06 23:39:17 +03:00
Kahrl
e070f1e525
Allow replacements in cooking and fuel recipes
2012-06-06 00:22:34 +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
Perttu Ahola
f1d9880006
Clean up log messages everywhere
2012-03-11 04:15:45 +02:00
Kahrl
6a76c226e1
The huge item definition and item namespace unification patch (itemdef), see http://c55.me/minetest/wiki/doku.php?id=changes:itemdef
2012-01-12 06:10:39 +01:00
Perttu Ahola
103173fc9b
Add InvRef and InvStack (currently untested and unusable)
2012-01-02 01:49:38 +02:00
Perttu Ahola
cebbaf1664
Catch SerializationError in CCraftDefManager::getCraftResult()
2011-11-29 19:13:48 +02:00
Perttu Ahola
9d5b458479
Crafting definition in scripts
2011-11-29 19:13:48 +02:00