Revert "fix: optimization: Various PVS-Studio warnings"
This commit is contained in:
@@ -46,7 +46,8 @@ Content::Content(
|
||||
}
|
||||
}
|
||||
|
||||
Content::~Content() = default;
|
||||
Content::~Content() {
|
||||
}
|
||||
|
||||
const rigging::SkeletonConfig* Content::getSkeleton(const std::string& id) const {
|
||||
auto found = skeletons.find(id);
|
||||
|
||||
@@ -119,7 +119,7 @@ public:
|
||||
|
||||
static constexpr size_t MISSING = SIZE_MAX;
|
||||
|
||||
void add(const std::string& name, dynamic::Map_sptr map) {
|
||||
void add(std::string name, dynamic::Map_sptr map) {
|
||||
indices[name] = names.size();
|
||||
names.push_back(name);
|
||||
savedData->push_back(map);
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "../objects/rigging.hpp"
|
||||
|
||||
ContentBuilder::~ContentBuilder() = default;
|
||||
ContentBuilder::~ContentBuilder() {}
|
||||
|
||||
void ContentBuilder::add(std::unique_ptr<ContentPackRuntime> pack) {
|
||||
packs[pack->getId()] = std::move(pack);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -142,4 +142,5 @@ ContentPackRuntime::ContentPackRuntime(
|
||||
{
|
||||
}
|
||||
|
||||
ContentPackRuntime::~ContentPackRuntime() = default;
|
||||
ContentPackRuntime::~ContentPackRuntime() {
|
||||
}
|
||||
|
||||
@@ -5,10 +5,11 @@
|
||||
#include <queue>
|
||||
#include <sstream>
|
||||
|
||||
PacksManager::PacksManager() = default;
|
||||
PacksManager::PacksManager() {
|
||||
}
|
||||
|
||||
void PacksManager::setSources(std::vector<fs::path> sources) {
|
||||
this->sources = std::move(sources);
|
||||
this->sources = sources;
|
||||
}
|
||||
|
||||
void PacksManager::scan() {
|
||||
@@ -18,7 +19,7 @@ void PacksManager::scan() {
|
||||
for (auto& folder : sources) {
|
||||
ContentPack::scanFolder(folder, packsList);
|
||||
for (auto& pack : packsList) {
|
||||
packs.try_emplace(pack.id, pack);
|
||||
packs.emplace(pack.id, pack);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user