1
0

Hotfixed recipe.txt loading.

This commit is contained in:
Hownaer 2014-08-29 00:42:33 +02:00
parent 4470ebffd7
commit c4d7f7996b
3 changed files with 8 additions and 5 deletions

View File

@ -1,4 +1,4 @@

// CraftingRecipes.cpp // CraftingRecipes.cpp
// Interfaces to the cCraftingRecipes class representing the storage of crafting recipes // Interfaces to the cCraftingRecipes class representing the storage of crafting recipes
@ -366,7 +366,10 @@ void cCraftingRecipes::ClearRecipes(void)
void cCraftingRecipes::AddRecipeLine(int a_LineNum, const AString & a_RecipeLine) void cCraftingRecipes::AddRecipeLine(int a_LineNum, const AString & a_RecipeLine)
{ {
AStringVector Sides = StringSplit(a_RecipeLine, "="); AString RecipeLine(a_RecipeLine);
RecipeLine.erase(std::remove(RecipeLine.begin(), RecipeLine.end(), ' '), RecipeLine.end());
AStringVector Sides = StringSplit(RecipeLine, "=");
if (Sides.size() != 2) if (Sides.size() != 2)
{ {
LOGWARNING("crafting.txt: line %d: A single '=' was expected, got %d", a_LineNum, (int)Sides.size() - 1); LOGWARNING("crafting.txt: line %d: A single '=' was expected, got %d", a_LineNum, (int)Sides.size() - 1);

View File

@ -119,7 +119,7 @@ bool StringToInteger(const AString& a_str, T& a_Num)
{ {
for (size_t size = a_str.size(); i < size; i++) for (size_t size = a_str.size(); i < size; i++)
{ {
if ((a_str[i] <= '0') || (a_str[i] >= '9')) if ((a_str[i] < '0') || (a_str[i] > '9'))
{ {
return false; return false;
} }
@ -140,7 +140,7 @@ bool StringToInteger(const AString& a_str, T& a_Num)
{ {
for (size_t size = a_str.size(); i < size; i++) for (size_t size = a_str.size(); i < size; i++)
{ {
if ((a_str[i] <= '0') || (a_str[i] >= '9')) if ((a_str[i] < '0') || (a_str[i] > '9'))
{ {
return false; return false;
} }