mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Code optimizations / refactor (#12704)
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com> Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
parent
ff6dcfea82
commit
038da00e79
38 changed files with 84 additions and 94 deletions
11
src/tool.cpp
11
src/tool.cpp
|
@ -35,7 +35,7 @@ void ToolGroupCap::toJson(Json::Value &object) const
|
|||
Json::Value times_object;
|
||||
for (auto time : times)
|
||||
times_object[time.first] = time.second;
|
||||
object["times"] = times_object;
|
||||
object["times"] = std::move(times_object);
|
||||
}
|
||||
|
||||
void ToolGroupCap::fromJson(const Json::Value &json)
|
||||
|
@ -134,14 +134,13 @@ void ToolCapabilities::serializeJson(std::ostream &os) const
|
|||
for (const auto &groupcap : groupcaps) {
|
||||
groupcap.second.toJson(groupcaps_object[groupcap.first]);
|
||||
}
|
||||
root["groupcaps"] = groupcaps_object;
|
||||
root["groupcaps"] = std::move(groupcaps_object);
|
||||
|
||||
Json::Value damage_groups_object;
|
||||
DamageGroup::const_iterator dgiter;
|
||||
for (dgiter = damageGroups.begin(); dgiter != damageGroups.end(); ++dgiter) {
|
||||
damage_groups_object[dgiter->first] = dgiter->second;
|
||||
for (const auto &damagegroup : damageGroups) {
|
||||
damage_groups_object[damagegroup.first] = damagegroup.second;
|
||||
}
|
||||
root["damage_groups"] = damage_groups_object;
|
||||
root["damage_groups"] = std::move(damage_groups_object);
|
||||
|
||||
fastWriteJson(root, os);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue