Merge pull request #909 from jfhumann/fixes
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
This commit is contained in:
@@ -485,6 +485,7 @@ void cSlotAreaCrafting::ClickedResult(cPlayer & a_Player)
|
||||
|
||||
// Get the current recipe:
|
||||
cCraftingRecipe & Recipe = GetRecipeForPlayer(a_Player);
|
||||
const cItem & Result = Recipe.GetResult();
|
||||
|
||||
cItem * PlayerSlots = GetPlayerSlots(a_Player) + 1;
|
||||
cCraftingGrid Grid(PlayerSlots, m_GridSize, m_GridSize);
|
||||
@@ -492,16 +493,16 @@ void cSlotAreaCrafting::ClickedResult(cPlayer & a_Player)
|
||||
// If possible, craft:
|
||||
if (DraggingItem.IsEmpty())
|
||||
{
|
||||
DraggingItem = Recipe.GetResult();
|
||||
DraggingItem = Result;
|
||||
Recipe.ConsumeIngredients(Grid);
|
||||
Grid.CopyToItems(PlayerSlots);
|
||||
}
|
||||
else if (DraggingItem.IsEqual(Recipe.GetResult()))
|
||||
else if (DraggingItem.IsEqual(Result))
|
||||
{
|
||||
cItemHandler * Handler = ItemHandler(Recipe.GetResult().m_ItemType);
|
||||
if (DraggingItem.m_ItemCount + Recipe.GetResult().m_ItemCount <= Handler->GetMaxStackSize())
|
||||
cItemHandler * Handler = ItemHandler(Result.m_ItemType);
|
||||
if (DraggingItem.m_ItemCount + Result.m_ItemCount <= Handler->GetMaxStackSize())
|
||||
{
|
||||
DraggingItem.m_ItemCount += Recipe.GetResult().m_ItemCount;
|
||||
DraggingItem.m_ItemCount += Result.m_ItemCount;
|
||||
Recipe.ConsumeIngredients(Grid);
|
||||
Grid.CopyToItems(PlayerSlots);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user