Load count 0 in itemstring as 1
authorPerttu Ahola <celeron55@gmail.com>
Wed, 30 Nov 2011 22:04:21 +0000 (00:04 +0200)
committerPerttu Ahola <celeron55@gmail.com>
Wed, 30 Nov 2011 22:04:21 +0000 (00:04 +0200)
src/inventory.cpp

index 75603f9115206de460d08038691969b3bd95b450..5523f7c91fd1cc810749c2d63553f8c7a7ff59ed 100644 (file)
@@ -114,6 +114,8 @@ InventoryItem* InventoryItem::deSerialize(std::istream &is, IGameDef *gamedef)
                }
                fnd.skip_over(" ");
                u16 count = stoi(trim(fnd.next("")));
+               if(count == 0)
+                       count = 1;
                return new MaterialItem(gamedef, nodename, count);
        }
        else if(name == "MBOItem")
@@ -140,6 +142,8 @@ InventoryItem* InventoryItem::deSerialize(std::istream &is, IGameDef *gamedef)
                // Then read count
                fnd.skip_over(" ");
                u16 count = stoi(trim(fnd.next("")));
+               if(count == 0)
+                       count = 1;
                return new CraftItem(gamedef, subname, count);
        }
        else if(name == "ToolItem")