chore: Fix Coverity Scan issues
This commit is contained in:
parent
cabad2d231
commit
8d8329a3f9
13 changed files with 26 additions and 22 deletions
|
@ -339,7 +339,7 @@ void CharacterGeneration::setCharacter(StaticCreatureBlueprint character) {
|
|||
int currentAppearance = _character ? _character->appearance() : -1;
|
||||
Gender currentGender = _character ? _character->gender() : Gender::None;
|
||||
|
||||
_character = make_unique<StaticCreatureBlueprint>(character);
|
||||
_character = make_unique<StaticCreatureBlueprint>(move(character));
|
||||
|
||||
if (currentAppearance != character.appearance()) {
|
||||
loadCharacterModel();
|
||||
|
|
|
@ -209,7 +209,7 @@ void PortraitSelection::onClick(const string &control) {
|
|||
} else if (control == "BTN_ACCEPT") {
|
||||
StaticCreatureBlueprint character(_charGen->character());
|
||||
character.setAppearance(getAppearanceFromCurrentPortrait());
|
||||
_charGen->setCharacter(character);
|
||||
_charGen->setCharacter(move(character));
|
||||
_charGen->goToNextStep();
|
||||
_charGen->openSteps();
|
||||
|
||||
|
|
|
@ -50,11 +50,11 @@ void ListBox::clearItems() {
|
|||
_hilightedIndex = -1;
|
||||
}
|
||||
|
||||
void ListBox::addItem(Item item) {
|
||||
void ListBox::addItem(Item &&item) {
|
||||
if (!_protoItem) return;
|
||||
|
||||
item._textLines = breakText(item.text, *_protoItem->text().font, _protoItem->extent().width);
|
||||
_items.push_back(move(item));
|
||||
_items.push_back(item);
|
||||
|
||||
updateItemSlots();
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
ListBox(GUI *gui);
|
||||
|
||||
void clearItems();
|
||||
void addItem(Item item);
|
||||
void addItem(Item &&item);
|
||||
void addTextLinesAsItems(const std::string &text);
|
||||
|
||||
void clearSelection();
|
||||
|
|
|
@ -368,9 +368,11 @@ Control &GUI::getControl(const string &tag) const {
|
|||
auto it = find_if(
|
||||
_controls.begin(),
|
||||
_controls.end(),
|
||||
[&tag](const unique_ptr<Control> &ctrl) { return ctrl->tag() == tag; });
|
||||
[&tag](auto &ctrl) { return ctrl->tag() == tag; });
|
||||
|
||||
return **it;
|
||||
if (it != _controls.end()) return **it;
|
||||
|
||||
throw runtime_error("Control not found: " + tag);
|
||||
}
|
||||
|
||||
void GUI::onClick(const string &control) {
|
||||
|
|
|
@ -41,7 +41,7 @@ private:
|
|||
std::shared_ptr<std::istream> _mdx;
|
||||
std::unique_ptr<StreamReader> _mdxReader;
|
||||
std::string _name;
|
||||
Model::Classification _classification;
|
||||
Model::Classification _classification { Model::Classification::Other };
|
||||
int _nodeIndex { 0 };
|
||||
std::vector<std::string> _nodeNames;
|
||||
std::shared_ptr<render::Model> _model;
|
||||
|
|
|
@ -146,13 +146,13 @@ public:
|
|||
|
||||
private:
|
||||
std::string _name;
|
||||
int _width;
|
||||
int _height;
|
||||
Properties _properties;
|
||||
|
||||
bool _inited { false };
|
||||
uint32_t _textureId { 0 };
|
||||
|
||||
int _width { 0 };
|
||||
int _height { 0 };
|
||||
PixelFormat _pixelFormat { PixelFormat::BGR };
|
||||
std::vector<Layer> _layers; /**< either one for 2D textures, or six for cube maps */
|
||||
Features _features;
|
||||
|
|
|
@ -61,9 +61,11 @@ void PEFile::doLoad() {
|
|||
loadSection();
|
||||
}
|
||||
|
||||
auto resSection = find_if(_sections.begin(), _sections.end(), [](const Section &s) { return s.name == ".rsrc"; });
|
||||
seek(resSection->offset);
|
||||
loadResourceDir(*resSection, 0);
|
||||
auto maybeSection = find_if(_sections.begin(), _sections.end(), [](auto &s) { return s.name == ".rsrc"; });
|
||||
if (maybeSection != _sections.end()) {
|
||||
seek(maybeSection->offset);
|
||||
loadResourceDir(*maybeSection, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void PEFile::loadHeader() {
|
||||
|
|
|
@ -31,8 +31,8 @@ GffStruct::Field::Field(FieldType type, string label) : type(type), label(move(l
|
|||
GffStruct::GffStruct(uint32_t type) : _type(type) {
|
||||
}
|
||||
|
||||
void GffStruct::add(Field field) {
|
||||
_fields.push_back(move(field));
|
||||
void GffStruct::add(Field &&field) {
|
||||
_fields.push_back(field);
|
||||
}
|
||||
|
||||
bool GffStruct::getBool(const string &name, bool defValue) const {
|
||||
|
|
|
@ -60,8 +60,8 @@ public:
|
|||
FieldType type { FieldType::Int };
|
||||
std::string label;
|
||||
std::string strValue; /**< covers CExoString and ResRef */
|
||||
glm::vec3 vecValue;
|
||||
glm::quat quatValue;
|
||||
glm::vec3 vecValue { 0.0f };
|
||||
glm::quat quatValue { 1.0f, 0.0f, 0.0f, 0.0f };
|
||||
ByteArray data;
|
||||
std::vector<std::shared_ptr<GffStruct>> children;
|
||||
|
||||
|
@ -80,7 +80,7 @@ public:
|
|||
|
||||
GffStruct(uint32_t type);
|
||||
|
||||
void add(Field field);
|
||||
void add(Field &&field);
|
||||
|
||||
bool getBool(const std::string &name, bool defValue = false) const;
|
||||
int getInt(const std::string &name, int defValue = 0) const;
|
||||
|
|
|
@ -109,7 +109,7 @@ private:
|
|||
float _alpha { 1.0f };
|
||||
std::vector<LightSceneNode *> _lightsAffectedBy;
|
||||
bool _lightingDirty { true };
|
||||
float _projectileSpeed;
|
||||
float _projectileSpeed { 0.0f };
|
||||
|
||||
void initModelNodes();
|
||||
void updateAbsoluteTransform() override;
|
||||
|
|
|
@ -297,8 +297,8 @@ void SceneGraph::setAmbientLightColor(const glm::vec3 &color) {
|
|||
_ambientLightColor = color;
|
||||
}
|
||||
|
||||
void SceneGraph::setUniformsPrototype(ShaderUniforms uniforms) {
|
||||
_uniformsPrototype = move(uniforms);
|
||||
void SceneGraph::setUniformsPrototype(ShaderUniforms &&uniforms) {
|
||||
_uniformsPrototype = uniforms;
|
||||
}
|
||||
|
||||
void SceneGraph::setExposure(float exposure) {
|
||||
|
|
|
@ -66,7 +66,7 @@ public:
|
|||
void setActiveCamera(const std::shared_ptr<CameraSceneNode> &camera);
|
||||
void setShadowReference(const std::shared_ptr<SceneNode> &reference);
|
||||
void setUpdate(bool update);
|
||||
void setUniformsPrototype(render::ShaderUniforms uniforms);
|
||||
void setUniformsPrototype(render::ShaderUniforms &&uniforms);
|
||||
void setExposure(float exposure);
|
||||
|
||||
// Lights and shadows
|
||||
|
|
Loading…
Reference in a new issue