summaryrefslogtreecommitdiffstats
path: root/src/CraftingRecipes.cpp
diff options
context:
space:
mode:
authorTycho <work.tycho+git@gmail.com>2014-08-13 14:03:56 +0200
committerTycho <work.tycho+git@gmail.com>2014-08-13 14:03:56 +0200
commit781e1e6264794ec0fddccd37a76f7a78a3fa8b09 (patch)
tree694dabff0db889d7326e2cb3e7febae4271b788f /src/CraftingRecipes.cpp
parentFixed type issues in CraftingRecipe.cpp (diff)
downloadcuberite-781e1e6264794ec0fddccd37a76f7a78a3fa8b09.tar
cuberite-781e1e6264794ec0fddccd37a76f7a78a3fa8b09.tar.gz
cuberite-781e1e6264794ec0fddccd37a76f7a78a3fa8b09.tar.bz2
cuberite-781e1e6264794ec0fddccd37a76f7a78a3fa8b09.tar.lz
cuberite-781e1e6264794ec0fddccd37a76f7a78a3fa8b09.tar.xz
cuberite-781e1e6264794ec0fddccd37a76f7a78a3fa8b09.tar.zst
cuberite-781e1e6264794ec0fddccd37a76f7a78a3fa8b09.zip
Diffstat (limited to 'src/CraftingRecipes.cpp')
-rw-r--r--src/CraftingRecipes.cpp6
1 files changed, 2 insertions, 4 deletions
diff --git a/src/CraftingRecipes.cpp b/src/CraftingRecipes.cpp
index 48178eecb..2d80ecaf8 100644
--- a/src/CraftingRecipes.cpp
+++ b/src/CraftingRecipes.cpp
@@ -392,8 +392,7 @@ void cCraftingRecipes::AddRecipeLine(int a_LineNum, const AString & a_RecipeLine
}
if (ResultSplit.size() > 1)
{
- Recipe->m_Result.m_ItemCount = atoi(ResultSplit[1].c_str());
- if (Recipe->m_Result.m_ItemCount == 0)
+ if (!StringToInteger<char>(ResultSplit[1].c_str(), Recipe->m_Result.m_ItemCount))
{
LOGWARNING("crafting.txt: line %d: Cannot parse result count, ignoring the recipe.", a_LineNum);
LOGINFO("Offending line: \"%s\"", a_RecipeLine.c_str());
@@ -445,8 +444,7 @@ bool cCraftingRecipes::ParseItem(const AString & a_String, cItem & a_Item)
if (Split.size() > 1)
{
AString Damage = TrimString(Split[1]);
- a_Item.m_ItemDamage = atoi(Damage.c_str());
- if ((a_Item.m_ItemDamage == 0) && (Damage.compare("0") != 0))
+ if (!StringToInteger<short>(Damage.c_str(), a_Item.m_ItemDamage))
{
// Parsing the number failed
return false;