Skip to content

Commit e6990db

Browse files
committed
Client: Fix incorrect ItemVisuals caching
Previously, if 'inventory_image' or 'inventory_overlay' where specified, items with the same images (but possibly other drawtype) were drawn incorrectly. Reason is that the item name part of 'std::ostringstream' was overwritten.
1 parent 5932c17 commit e6990db

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/client/item_visuals_manager.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,11 @@ ItemVisualsManager::ItemVisuals *ItemVisualsManager::createItemVisuals( const It
5050

5151
// Key only consists of item name + image name,
5252
// because animation currently cannot be overridden by meta
53-
std::ostringstream os(def.name);
53+
std::string cache_key = def.name;
5454
if (!inventory_image.name.empty())
55-
os << "/" << inventory_image.name;
55+
cache_key.append("/").append(inventory_image.name);
5656
if (!inventory_overlay.name.empty())
57-
os << ":" << inventory_overlay.name;
58-
std::string cache_key = os.str();
57+
cache_key.append(":").append(inventory_overlay.name);
5958

6059

6160
// Skip if already in cache

0 commit comments

Comments
 (0)