1
0
mirror of https://github.com/luanti-org/luanti.git synced 2025-10-13 00:25:19 +02: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:
Herman Semenov
2022-09-06 13:21:09 +03:00
committed by GitHub
parent ff6dcfea82
commit 038da00e79
38 changed files with 84 additions and 94 deletions

View File

@@ -354,12 +354,12 @@ void ContentFeatures::reset()
NOTE: Most of this is always overridden by the default values given
in builtin.lua
*/
name = "";
name.clear();
groups.clear();
// Unknown nodes can be dug
groups["dig_immediate"] = 2;
drawtype = NDT_NORMAL;
mesh = "";
mesh.clear();
#ifndef SERVER
for (auto &i : mesh_ptr)
i = NULL;
@@ -387,9 +387,9 @@ void ContentFeatures::reset()
leveled = 0;
leveled_max = LEVELED_MAX;
liquid_type = LIQUID_NONE;
liquid_alternative_flowing = "";
liquid_alternative_flowing.clear();
liquid_alternative_flowing_id = CONTENT_IGNORE;
liquid_alternative_source = "";
liquid_alternative_source.clear();
liquid_alternative_source_id = CONTENT_IGNORE;
liquid_viscosity = 0;
liquid_renewable = true;
@@ -410,7 +410,7 @@ void ContentFeatures::reset()
connects_to_ids.clear();
connect_sides = 0;
color = video::SColor(0xFFFFFFFF);
palette_name = "";
palette_name.clear();
palette = NULL;
node_dig_prediction = "air";
move_resistance = 0;
@@ -1355,7 +1355,7 @@ void NodeDefManager::eraseIdFromGroups(content_t id)
content_t NodeDefManager::set(const std::string &name, const ContentFeatures &def)
{
// Pre-conditions
assert(name != "");
assert(!name.empty());
assert(name != "ignore");
assert(name == def.name);
@@ -1395,7 +1395,7 @@ content_t NodeDefManager::set(const std::string &name, const ContentFeatures &de
content_t NodeDefManager::allocateDummy(const std::string &name)
{
assert(name != ""); // Pre-condition
assert(!name.empty()); // Pre-condition
ContentFeatures f;
f.name = name;
return set(name, f);
@@ -1405,7 +1405,7 @@ content_t NodeDefManager::allocateDummy(const std::string &name)
void NodeDefManager::removeNode(const std::string &name)
{
// Pre-condition
assert(name != "");
assert(!name.empty());
// Erase name from name ID mapping
content_t id = CONTENT_IGNORE;