summaryrefslogtreecommitdiffstats
path: root/src/BlockEntities/BrewingstandEntity.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/BlockEntities/BrewingstandEntity.cpp')
-rw-r--r--src/BlockEntities/BrewingstandEntity.cpp30
1 files changed, 12 insertions, 18 deletions
diff --git a/src/BlockEntities/BrewingstandEntity.cpp b/src/BlockEntities/BrewingstandEntity.cpp
index 9c43f257f..1c659a3c3 100644
--- a/src/BlockEntities/BrewingstandEntity.cpp
+++ b/src/BlockEntities/BrewingstandEntity.cpp
@@ -54,14 +54,8 @@ void cBrewingstandEntity::CopyFrom(const cBlockEntity & a_Src)
Super::CopyFrom(a_Src);
auto & src = static_cast<const cBrewingstandEntity &>(a_Src);
m_IsBrewing = src.m_IsBrewing;
- for (size_t i = 0; i < ARRAYCOUNT(m_CurrentBrewingRecipes); ++i)
- {
- m_CurrentBrewingRecipes[i] = src.m_CurrentBrewingRecipes[i];
- }
- for (size_t i = 0; i < ARRAYCOUNT(m_Results); ++i)
- {
- m_Results[i] = src.m_Results[i];
- }
+ m_CurrentBrewingRecipes = src.m_CurrentBrewingRecipes;
+ m_Results = src.m_Results;
m_TimeBrewed = src.m_TimeBrewed;
m_RemainingFuel = src.m_RemainingFuel;
}
@@ -130,12 +124,12 @@ bool cBrewingstandEntity::Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk)
const cBrewingRecipes::cRecipe * Recipe = nullptr;
for (int i = 0; i < 3; i++)
{
- if (m_Contents.GetSlot(i).IsEmpty() || (m_CurrentBrewingRecipes[i] == nullptr))
+ if (m_Contents.GetSlot(i).IsEmpty() || (m_CurrentBrewingRecipes[static_cast<size_t>(i)] == nullptr))
{
continue;
}
- Recipe = m_CurrentBrewingRecipes[i];
+ Recipe = m_CurrentBrewingRecipes[static_cast<size_t>(i)];
m_Contents.SetSlot(i, Recipe->Output.CopyOne());
}
@@ -254,14 +248,14 @@ void cBrewingstandEntity::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum)
{
if (GetSlot(i).IsEmpty())
{
- m_CurrentBrewingRecipes[i] = nullptr;
- m_Results[i].Clear();
+ m_CurrentBrewingRecipes[static_cast<size_t>(i)] = nullptr;
+ m_Results[static_cast<size_t>(i)].Clear();
continue;
}
- if (m_CurrentBrewingRecipes[i] != nullptr)
+ if (m_CurrentBrewingRecipes[static_cast<size_t>(i)] != nullptr)
{
- Recipe = m_CurrentBrewingRecipes[i];
+ Recipe = m_CurrentBrewingRecipes[static_cast<size_t>(i)];
if (Recipe->Ingredient.IsEqual(GetSlot(bsIngredient)) && Recipe->Input.IsEqual(GetSlot(i)))
{
Stop = false;
@@ -273,8 +267,8 @@ void cBrewingstandEntity::OnSlotChanged(cItemGrid * a_ItemGrid, int a_SlotNum)
if (Recipe != nullptr)
{
// Found a brewing recipe for the items
- m_CurrentBrewingRecipes[i] = Recipe;
- m_Results[i] = Recipe->Output.CopyOne();
+ m_CurrentBrewingRecipes[static_cast<size_t>(i)] = Recipe;
+ m_Results[static_cast<size_t>(i)] = Recipe->Output.CopyOne();
Stop = false;
}
}
@@ -348,8 +342,8 @@ void cBrewingstandEntity::LoadRecipes(void)
Recipe = BR->GetRecipeFrom(GetSlot(i), GetSlot(bsIngredient));
if (Recipe != nullptr)
{
- m_CurrentBrewingRecipes[i] = Recipe;
- m_Results[i] = Recipe->Output.CopyOne();
+ m_CurrentBrewingRecipes[static_cast<size_t>(i)] = Recipe;
+ m_Results[static_cast<size_t>(i)] = Recipe->Output.CopyOne();
}
}
}