summaryrefslogtreecommitdiffstats
path: root/src/CraftingRecipes.cpp (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix debug macro situation (#5114)Tiger Wang2021-01-261-3/+1
| | | Use the standard NDEBUG.
* Replaced cpp14::make_unique<> with std::make_unique<>.Mattes D2020-08-011-2/+2
|
* Introduce recipe book functionality (#4493)Tobias Wilken2020-07-141-5/+90
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Introduce recipe book functionality The recipe book helps especially new players. Missing it gives the impression that cuberite is not as advanced as it is. The handling of the recipe book uses the following functions: - Unlock Recipes (https://wiki.vg/index.php?title=Protocol&oldid=14204#Unlock_Recipes) to make recipes available and show the notification for new recipes. Initialization is done on player login for known ones, the update is done when new items are discovered. - Craft Recipe Request (https://wiki.vg/index.php?title=Protocol&oldid=14204#Craft_Recipe_Request) when the user selects a recipe from the recipe book to fill the slots. Known recipes are initialized on player login via `Unlock Recipes` with `Action` 0. As soon as a new recipe is discovered this is added via `Unlock Recipes` with `Action` 1. To be able to know and recognize new recipes the player class is extended with `KnownItems` and `KnownRecipes`. As soon as a player touches an item this is compared to the list of `KnownItems`, if the item is unknown the recipes are checked for this item and the other ingredients are checked with the list of `KnownItems`. If a full match is discovered the recipe is unlocked with the client and stored in the `KnownRecipes`. To unlock recipes the recipe ID is sent to the client. A mapping file (for protocol 1.12.2) translated the minecraft recipe names to ids. The crafting.txt is extended with and minecraft recipe names is possible. Limitations: Only a single recipe is added to the crafting area. Multiple clicks or shift click does not increase the number of builds. Co-authored-by: peterbell10 <peterbell10@live.co.uk> * Address first issues mentioned by @peterbell10 - Some linting - Extract loading of recipe specific protocol mapping into a function - Build `RecipeNameMap` only once - Use `std::optional` - Extract `LoadRecipe` from `Window` * Start to implement new suggestions * Update with suggestions from @peterbell10 * Some minor cleanup * Update protocol packet IDs * Remove unused include * Include header in cmake * Change a vector to integer counter * Change dromedaryCase method names to PascalCase * Address suggestions from @madmaxoft * Read Protocol subdirectories to load recipe books To load all recipebooks iterate over the `Protocol` subdirectories to find mapping files. Co-authored-by: peterbell10 <peterbell10@live.co.uk>
* Enable some more clang-tidy linter checks (#4738)peterbell102020-05-151-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * 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
* Enable C++17 in buildPeter Bell2020-05-091-7/+3
|
* Pulled the BlockID and BlockInfo headers from Globals.h. (#4591)Mattes D2020-04-031-2/+2
| | | | | | | | | The BlockID.h file was removed from Globals.h and renamed to BlockType.h (main change) The BlockInfo.h file was removed from Globals.h (main change) The ENUM_BLOCK_ID and ENUM_ITEM_ID enum names were replaced with ENUM_BLOCK_TYPE and ENUM_ITEM_TYPE (cosmetics) The various enums, such as eDimension, eDamageType and eExplosionSource were moved from BlockType.h to Defines.h, together with the helper functions for converting between them and strings (StringToDimension et al.) (minor) Many inline functions were moved from headers to their respective cpp files, so that BlockType.h could be included only into the cpp file, rather than the header. That broke our tests a bit, since they pick bits and pieces out of the main code and provide stubs for the rest; they had to be re-stubbed and re-verified. eMonsterType values are no longer tied to E_ITEM_SPAWN_EGG_META_* values
* Don't attempt to give bucket with item count of 0Mat2020-03-231-1/+1
|
* CheckBasicStyle: Check number of empty lines between functions (#4267)peterbell102018-07-261-0/+1
| | | | Add check for number of empty lines between functions and fix the corresponding failures
* Add the fmt library (#4065)peterbell102018-01-031-2/+2
| | | | | | | * 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.
* Bulk clearing of whitespaceLogicParrot2016-02-051-28/+28
|
* Leather Armor can now be dyed.Samuel Barney2015-07-151-0/+192
| | | | * Created new color class to handle dye-related coloring
* Changing the shared_ptr/unique_ptr constructors to the make_shared/make_unique functionsbibo382015-07-121-2/+2
|
* Fixed styleNounours Heureux2015-06-071-1/+1
|
* Cake crafting now give back the bucketNounours Heureux2015-06-071-1/+8
|
* Fixed crafting recipe matching.Mattes D2015-05-311-0/+3
| | | | Fixes #2096.
* Made -Weverything an error.tycho2015-05-241-2/+2
|
* Recipes match zero DamageValue strictly.Mattes D2015-04-161-2/+2
| | | | | To match any DamageValue for the ingredient, an explicit "-1" as the DamageValue must be specified. Fixes #1859.
* Fixed PolishedGranite et al crafting recipes.Mattes D2015-04-161-0/+1
| | | | Fixes #1774. Ref.: #1859
* Fixed the CRAFTING_NO_RECIPE hook call.Mattes D2014-12-041-1/+1
| | | | | It used a pointer-to-pointer-to-cCraftingRecipe, which the Lua bindings didn't know how to handle, and emitted a warning message at runtime. Fixes #1641.
* Replaced auto_ptr with unique_ptr.Mattes D2014-11-271-3/+3
|
* En masse NULL -> nullptr replaceTiger Wang2014-10-231-9/+9
|
* Functions in cPluginManager get references instead of pointers.Mattes D2014-10-151-4/+4
|
* A better hotfix for CraftingRecipiesTiger Wang2014-08-291-1/+1
|
* Hotfixed recipe.txt loading.Hownaer2014-08-291-2/+5
|
* Fixed Integer pasing warnings in CraftingRecipies.cppTycho2014-08-131-4/+2
|
* Fixed type issues in CraftingRecipe.cppTycho2014-08-131-2/+2
|
* Fixed forgotten error checkingTycho2014-08-131-1/+5
|
* Style: Normalized to no spaces before closing parenthesis.madmaxoft2014-07-211-1/+1
|
* Style: Normalized spaces after if, for and while.madmaxoft2014-07-211-1/+1
|
* Normalized comments.madmaxoft2014-07-171-3/+3
| | | | | This was mostly done automatically and then visually inspected for obvious errors. All //-style comments should have a 2-space separation from the code, and 1 space after the comment sign.
* Fixed spaces around single-line comments.madmaxoft2014-07-171-1/+1
| | | | There should be at least two spaces in front and one space after //-style comments.
* Fixed basic whitespace problems.madmaxoft2014-07-171-4/+4
| | | | Indenting by spaces and alignment by spaces, as well as trailing whitespace on non-empty lines.
* Nullify deleted pointers.archshift2014-06-191-0/+1
|
* Merge branch 'master' into fixesTiger Wang2014-04-241-5/+7
|\ | | | | | | | | Conflicts: src/World.h
| * Merge pull request #909 from jfhumann/fixesMattes D2014-04-221-4/+6
| |\ | | | | | | | | | | | | Bug fixes and optimizations. We need to visit the API functions and check that they return only those values expected. `cWorld::CreateProjectile()` seems affected, too, by the same issue of ToLua returning extra values. In the cleanest form, these functions will need moving to ManualBindings.cpp
| | * Did some static analysis, fixed some bugs and optimized a lot of codejfhumann2014-04-181-4/+6
| | |
| * | Fixed a warning in CraftingRecipes.Mattes D2014-04-211-1/+1
| |/
* / Small changesTiger Wang2014-04-231-2/+2
|/
* Added additional macros to support the MSVC size_t format and changed all formats to use the macrosTycho2014-03-121-1/+1
|
* Fixed a load of format string errorsTycho2014-03-111-1/+1
|
* Fixed test assertsTycho2014-03-101-0/+2
|
* Moved firework handler to separate functionTiger Wang2014-03-091-48/+45
| | | | * Also simplified and improved readability of code
* Fix Linux compileTiger Wang2014-03-091-2/+3
|
* Implemented ballistic missiles (fireworks)Tiger Wang2014-02-271-1/+88
| | | | + Added fireworks
* Moved bindings-related to a Bindings subfolder.madmaxoft2013-12-081-1/+1
| | | | Ref.: #407
* Moved source to srcAlexander Harkness2013-11-241-0/+770