[Scummvm-git-logs] scummvm master -> 782cf05e0f820eec41dc423ddca2f024b07d3e3a

mduggan noreply at scummvm.org
Mon Feb 27 06:37:36 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
782cf05e0f TETRAEDGE: Fix some small coverity-identified issues


Commit: 782cf05e0f820eec41dc423ddca2f024b07d3e3a
    https://github.com/scummvm/scummvm/commit/782cf05e0f820eec41dc423ddca2f024b07d3e3a
Author: Matthew Duggan (mgithub at guarana.org)
Date: 2023-02-27T15:37:28+09:00

Commit Message:
TETRAEDGE: Fix some small coverity-identified issues

Changed paths:
    engines/tetraedge/game/in_game_scene.cpp
    engines/tetraedge/te/te_model.cpp
    engines/tetraedge/te/te_particle.cpp


diff --git a/engines/tetraedge/game/in_game_scene.cpp b/engines/tetraedge/game/in_game_scene.cpp
index 9e87c9fd9d2..8cda3bf8457 100644
--- a/engines/tetraedge/game/in_game_scene.cpp
+++ b/engines/tetraedge/game/in_game_scene.cpp
@@ -440,7 +440,7 @@ void InGameScene::drawMask() {
 	if (!_maskAlpha)
 		rend->colorMask(false, false, false, false);
 
-	for (auto mask : _masks)
+	for (auto &mask : _masks)
 		mask->draw();
 
 	if (!_maskAlpha)
@@ -843,7 +843,7 @@ bool InGameScene::loadXml(const Common::String &zone, const Common::String &scen
 
 	TeMatrix4x4 camMatrix = currentCamera() ?
 		currentCamera()->worldTransformationMatrix() : TeMatrix4x4();
-	for (auto particle : _particles) {
+	for (auto &particle : _particles) {
 		particle->setMatrix(camMatrix);
 		particle->realTimer().start();
 		particle->update(particle->startLoop());
@@ -1806,7 +1806,7 @@ void InGameScene::updateViewport(int ival) {
 							_scrollOffset.getY() * _scrollScale.getY());
 	const TeVector3f32 winSize = g_engine->getApplication()->getMainWindow().size();
 	float aspectRatio = lsize.getX() / lsize.getY();
-	for (auto cam : cameras()) {
+	for (auto &cam : cameras()) {
 		//cam->setSomething(ival);
 		int x = (winSize.x() - lsize.getX()) / 2.0f + offset.getX();
 		int y = (winSize.y() - lsize.getY()) / 2.0f;
@@ -1819,7 +1819,7 @@ void InGameScene::updateViewport(int ival) {
 }
 
 void InGameScene::activateMask(const Common::String &name, bool val) {
-	for (auto mask : _masks) {
+	for (auto &mask : _masks) {
 		if (mask->name() == name) {
 			mask->setVisible(val);
 			return;
diff --git a/engines/tetraedge/te/te_model.cpp b/engines/tetraedge/te/te_model.cpp
index ab33b99d768..22e46373fda 100644
--- a/engines/tetraedge/te/te_model.cpp
+++ b/engines/tetraedge/te/te_model.cpp
@@ -138,7 +138,7 @@ TeTRS TeModel::getBone(TeIntrusivePtr<TeModelAnimation> anim, uint num) {
 }
 
 void TeModel::invertNormals() {
-	for (auto mesh : meshes()) {
+	for (auto &mesh : meshes()) {
 		for (uint i = 0; i < mesh->numIndexes() / 3; i++) {
 			// Swap order of verticies in each triangle.
 			uint idx0 = mesh->index(i);
diff --git a/engines/tetraedge/te/te_particle.cpp b/engines/tetraedge/te/te_particle.cpp
index 8f9bfbe2198..b96f506f29d 100644
--- a/engines/tetraedge/te/te_particle.cpp
+++ b/engines/tetraedge/te/te_particle.cpp
@@ -30,7 +30,8 @@ static const char TE_PARTICLE_RANDOM_TABLE[] = "http://www.arkham-development.co
 
 TeParticle::TeParticle(TeScene *scene) : _scene(scene), _size(0),
 _colorTime(0), _time(0), _period(0), _particlePerPeriod(0),
-_enabled(false), _startLoop(0), _gravity(0), _randomDir(false) {
+_enabled(false), _startLoop(0), _gravity(0), _randomDir(false),
+_lastTime(0) {
 	indexedParticles()->push_back(this);
 	_elementsPending.reserve(32);
 }
@@ -150,7 +151,7 @@ void TeParticle::update(int val) {
 			elem->_elapsedTime = newTime;
 			if (newTime <= _time) {
 				float alpha = _startColor.a();
-				if (newTime < _colorTime) {
+				if (newTime < _colorTime && _colorTime) {
 					alpha = (alpha * newTime) / _colorTime;
 				}
 				float endScale = newTime / _time;




More information about the Scummvm-git-logs mailing list