[Scummvm-git-logs] scummvm master -> 994bad735ce076f797900ff3e35216a7f3291ea6

grisenti noreply at scummvm.org
Wed Oct 11 16:00:58 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:
994bad735c HPL1: Use for each instead of index for


Commit: 994bad735ce076f797900ff3e35216a7f3291ea6
    https://github.com/scummvm/scummvm/commit/994bad735ce076f797900ff3e35216a7f3291ea6
Author: grisenti (emanuele at grisenti.net)
Date: 2023-10-11T18:00:39+02:00

Commit Message:
HPL1: Use for each instead of index for

Changed paths:
    engines/hpl1/penumbra-overture/Credits.cpp


diff --git a/engines/hpl1/penumbra-overture/Credits.cpp b/engines/hpl1/penumbra-overture/Credits.cpp
index 4ef03c3a290..96a0b14d94d 100644
--- a/engines/hpl1/penumbra-overture/Credits.cpp
+++ b/engines/hpl1/penumbra-overture/Credits.cpp
@@ -89,12 +89,12 @@ void cCredits::OnPostSceneDraw() {
 void cCredits::OnDraw() {
 	float fSize[2] = {17, 19};
 	float fY = mfYPos;
-	for (size_t i = 0; i < mvTextRows.size(); ++i) {
+	for (const auto &textRow : mvTextRows) {
 		int lSize = 0;
-		if (!mvTextRows[i].empty() && mvTextRows[i][0] == '*') {
+		if (!textRow.empty() && textRow[0] == '*') {
 			lSize = 1;
 		}
-		if (mvTextRows[i].size() <= 1) {
+		if (textRow.size() <= 1) {
 			fY += fSize[lSize];
 		}
 
@@ -108,10 +108,10 @@ void cCredits::OnDraw() {
 
 			if (lSize == 0)
 				mpFont->draw(cVector3f(400, fY, 10), fSize[lSize], cColor(1, fAlpha), eFontAlign_Center,
-							 mvTextRows[i]);
+							 textRow);
 			else
 				mpFont->draw(cVector3f(400, fY, 10), fSize[lSize], cColor(0.8f, fAlpha), eFontAlign_Center,
-							 mvTextRows[i].substr(1));
+							 textRow.substr(1));
 		}
 		fY += fSize[lSize];
 	}
@@ -126,11 +126,11 @@ void cCredits::Update(float afTimeStep) {
 	// Check if the credits are over.
 	float fSize[2] = {17, 19};
 	float fY = mfYPos;
-	for (size_t i = 0; i < mvTextRows.size(); ++i) {
+	for (const auto &textRow : mvTextRows) {
 		int lSize = 0;
-		if (!mvTextRows[i].empty() && mvTextRows[i][0] == '*')
+		if (!textRow.empty() && textRow[0] == '*')
 			lSize = 1;
-		if (mvTextRows[i].size() <= 1)
+		if (textRow.size() <= 1)
 			fY += fSize[lSize];
 		fY += fSize[lSize];
 	}




More information about the Scummvm-git-logs mailing list