mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Avoid some inefficiencies when handling ItemStack(Metadata)
This commit is contained in:
parent
d884a1624f
commit
a2058f7f3a
7 changed files with 37 additions and 51 deletions
|
@ -88,12 +88,11 @@ void ItemStackMetadata::deSerialize(std::istream &is)
|
|||
void ItemStackMetadata::updateToolCapabilities()
|
||||
{
|
||||
if (contains(TOOLCAP_KEY)) {
|
||||
toolcaps_overridden = true;
|
||||
toolcaps_override = ToolCapabilities();
|
||||
std::istringstream is(getString(TOOLCAP_KEY));
|
||||
toolcaps_override.deserializeJson(is);
|
||||
toolcaps_override->deserializeJson(is);
|
||||
} else {
|
||||
toolcaps_overridden = false;
|
||||
toolcaps_override = std::nullopt;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue