From: Perttu Ahola Date: Wed, 30 Nov 2011 22:04:21 +0000 (+0200) Subject: Load count 0 in itemstring as 1 X-Git-Url: http://81.2.79.47:8989/gitweb/?a=commitdiff_plain;h=f6c6c4f9171ba0499cd549b5aac34100fd189f42;p=zefram%2Fminetest%2Fminetest_engine.git Load count 0 in itemstring as 1 --- diff --git a/src/inventory.cpp b/src/inventory.cpp index 75603f91..5523f7c9 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")