diff --git a/src/craftdef.cpp b/src/craftdef.cpp index 79761b85..e701a427 100644 --- a/src/craftdef.cpp +++ b/src/craftdef.cpp @@ -114,8 +114,8 @@ public: IGameDef *gamedef) const { if(input_cpi.width > 3){ - errorstream<<"getCraftResult: IGNORING ERROR: " - <<"input_cpi.width > 3"< 3; Failing to craft."<input.dump() - <<" (output=\""<output<<"\")"<output<<"\")"<input, gamedef); - if(spec_cpi.width > 3){ - errorstream<<"getCraftResult: IGNORING ERROR: " - <<"spec_cpi.width > 3"<input, gamedef); + if(spec_cpi.width > 3){ + errorstream<<"getCraftResult: ERROR: " + <<"spec_cpi.width > 3 in recipe " + <dump()<= spec_cpi.width || y >= spec_cpi.height()) + spec_items[i] = NULL; + else + spec_items[i] = spec_cpi.items[y*spec_cpi.width+x]; + } + + bool match = checkItemCombination(input_items, spec_items); + + if(match){ + std::istringstream iss(def->output, std::ios::binary); + return InventoryItem::deSerialize(iss, gamedef); + } } - InventoryItem *spec_items[9]; - for(u32 y=0; y<3; y++) - for(u32 x=0; x<3; x++) + catch(SerializationError &e) { - u32 i=y*3+x; - if(x >= spec_cpi.width || y >= spec_cpi.height()) - spec_items[i] = NULL; - else - spec_items[i] = spec_cpi.items[y*spec_cpi.width+x]; - infostream<<"spec_items["<output, std::ios::binary); - return InventoryItem::deSerialize(iss, gamedef); + errorstream<<"getCraftResult: ERROR: " + <<"Serialization error in recipe " + <dump()<