From f6c6c4f9171ba0499cd549b5aac34100fd189f42 Mon Sep 17 00:00:00 2001 From: Perttu Ahola Date: Thu, 1 Dec 2011 00:04:21 +0200 Subject: [PATCH] Load count 0 in itemstring as 1 --- src/inventory.cpp | 4 ++++ 1 file changed, 4 insertions(+) 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") -- 2.30.2