Revert "fix: optimization: Various PVS-Studio warnings"
This commit is contained in:
@@ -85,7 +85,7 @@ bool ContentLoader::fixPackIndices(
|
||||
indexed.push_back(name);
|
||||
}
|
||||
}
|
||||
for (const auto &name : detected) {
|
||||
for (auto name : detected) {
|
||||
if (!util::contains(indexed, name)) {
|
||||
arr->put(name);
|
||||
modified = true;
|
||||
@@ -176,10 +176,9 @@ void ContentLoader::loadBlock(Block& def, const std::string& name, const fs::pat
|
||||
def.hitboxes.resize(boxarr->size());
|
||||
for (uint i = 0; i < boxarr->size(); i++) {
|
||||
auto box = boxarr->list(i);
|
||||
auto& hitboxesIndex = def.hitboxes[i];
|
||||
hitboxesIndex.a = glm::vec3(box->num(0), box->num(1), box->num(2));
|
||||
hitboxesIndex.b = glm::vec3(box->num(3), box->num(4), box->num(5));
|
||||
hitboxesIndex.b += hitboxesIndex.a;
|
||||
def.hitboxes[i].a = glm::vec3(box->num(0), box->num(1), box->num(2));
|
||||
def.hitboxes[i].b = glm::vec3(box->num(3), box->num(4), box->num(5));
|
||||
def.hitboxes[i].b += def.hitboxes[i].a;
|
||||
}
|
||||
} else if ((boxarr = root->list("hitbox"))){
|
||||
AABB aabb;
|
||||
@@ -252,11 +251,11 @@ void ContentLoader::loadCustomBlockModel(Block& def, dynamic::Map* primitives) {
|
||||
|
||||
if (boxarr->size() == 7)
|
||||
for (uint j = 6; j < 12; j++) {
|
||||
def.modelTextures.emplace_back(boxarr->str(6));
|
||||
def.modelTextures.push_back(boxarr->str(6));
|
||||
}
|
||||
else if (boxarr->size() == 12)
|
||||
for (uint j = 6; j < 12; j++) {
|
||||
def.modelTextures.emplace_back(boxarr->str(j));
|
||||
def.modelTextures.push_back(boxarr->str(j));
|
||||
}
|
||||
else
|
||||
for (uint j = 6; j < 12; j++) {
|
||||
@@ -277,7 +276,7 @@ void ContentLoader::loadCustomBlockModel(Block& def, dynamic::Map* primitives) {
|
||||
def.modelExtraPoints.push_back(p1+xw+yh);
|
||||
def.modelExtraPoints.push_back(p1+yh);
|
||||
|
||||
def.modelTextures.emplace_back(tgonobj->str(9));
|
||||
def.modelTextures.push_back(tgonobj->str(9));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -314,7 +313,7 @@ void ContentLoader::loadEntity(EntityDef& def, const std::string& name, const fs
|
||||
auto root = files::read_json(file);
|
||||
if (auto componentsarr = root->list("components")) {
|
||||
for (size_t i = 0; i < componentsarr->size(); i++) {
|
||||
def.components.emplace_back(componentsarr->str(i));
|
||||
def.components.push_back(componentsarr->str(i));
|
||||
}
|
||||
}
|
||||
if (auto boxarr = root->list("hitbox")) {
|
||||
@@ -325,12 +324,12 @@ void ContentLoader::loadEntity(EntityDef& def, const std::string& name, const fs
|
||||
if (auto sensorarr = sensorsarr->list(i)) {
|
||||
auto sensorType = sensorarr->str(0);
|
||||
if (sensorType == "aabb") {
|
||||
def.boxSensors.emplace_back(i, AABB{
|
||||
def.boxSensors.push_back({i, {
|
||||
{sensorarr->num(1), sensorarr->num(2), sensorarr->num(3)},
|
||||
{sensorarr->num(4), sensorarr->num(5), sensorarr->num(6)}
|
||||
});
|
||||
}});
|
||||
} else if (sensorType == "radius") {
|
||||
def.radialSensors.emplace_back(i, sensorarr->num(1));
|
||||
def.radialSensors.push_back({i, sensorarr->num(1)});
|
||||
} else {
|
||||
logger.error() << name << ": sensor #" << i << " - unknown type "
|
||||
<< util::quote(sensorType);
|
||||
|
||||
Reference in New Issue
Block a user