diff options
author | Perttu Ahola <celeron55@gmail.com> | 2011-12-01 00:04:21 +0200 |
---|---|---|
committer | Perttu Ahola <celeron55@gmail.com> | 2011-12-01 00:04:21 +0200 |
commit | f6c6c4f9171ba0499cd549b5aac34100fd189f42 (patch) | |
tree | 3d60de826fac78a72f8f3baeda5e3c3e48a0e833 | |
parent | 918c507a66aa5c05422d78a9ea30a455ddd3e124 (diff) | |
download | minetest-f6c6c4f9171ba0499cd549b5aac34100fd189f42.tar.gz minetest-f6c6c4f9171ba0499cd549b5aac34100fd189f42.tar.bz2 minetest-f6c6c4f9171ba0499cd549b5aac34100fd189f42.zip |
Load count 0 in itemstring as 1
-rw-r--r-- | src/inventory.cpp | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/inventory.cpp b/src/inventory.cpp index 75603f911..5523f7c91 100644 --- a/src/inventory.cpp +++ b/src/inventory.cpp @@ -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") |