[Scummvm-cvs-logs] SF.net SVN: scummvm: [32584] scummvm/trunk/engines/drascula/drascula.cpp

thebluegr at users.sourceforge.net thebluegr at users.sourceforge.net
Fri Jun 6 21:52:09 CEST 2008


Revision: 32584
          http://scummvm.svn.sourceforge.net/scummvm/?rev=32584&view=rev
Author:   thebluegr
Date:     2008-06-06 12:52:09 -0700 (Fri, 06 Jun 2008)

Log Message:
-----------
Partially reverted the changes to for loops in my last commit. It's not wise to call strlen() on each loop iteration...

Modified Paths:
--------------
    scummvm/trunk/engines/drascula/drascula.cpp

Modified: scummvm/trunk/engines/drascula/drascula.cpp
===================================================================
--- scummvm/trunk/engines/drascula/drascula.cpp	2008-06-06 19:37:36 UTC (rev 32583)
+++ scummvm/trunk/engines/drascula/drascula.cpp	2008-06-06 19:52:09 UTC (rev 32584)
@@ -1421,8 +1421,9 @@
 void DrasculaEngine::print_abc(const char *said, int screenX, int screenY) {
 	int textPos[8];
 	int letterY = 0, letterX = 0, c, i;
+	uint len = strlen(said);
 
-	for (uint h = 0; h < strlen(said); h++) {
+	for (uint h = 0; h < len; h++) {
 		c = toupper(said[h]);
 
 		for (i = 0; i < CHARMAP_SIZE; i++) {
@@ -1464,8 +1465,9 @@
 void DrasculaEngine::print_abc_opc(const char *said, int screenX, int screenY, int game) {
 	int textPos[6];
 	int signY, letterY, letterX = 0;
+	uint len = strlen(said);
 
-	for (uint h = 0; h < strlen(said); h++) {
+	for (uint h = 0; h < len; h++) {
 		if (game == 1) {
 			letterY = 6;
 			signY = 15;
@@ -3017,6 +3019,7 @@
 	int used2 = 0;
 	int used3 = 0;
 	char buffer[256];
+	uint len;
 
 	breakOut = 0;
 
@@ -3061,19 +3064,23 @@
 		answer3 = 15;
 	}
 
-	for (h = 0; h < strlen(phrase1); h++)
+	len = strlen(phrase1);
+	for (h = 0; h < len; h++)
 		if (phrase1[h] == (char)0xa7)
 			phrase1[h] = ' ';
 
-	for (h = 0; h < strlen(phrase2); h++)
+	len = strlen(phrase2);
+	for (h = 0; h < len; h++)
 		if (phrase2[h] == (char)0xa7)
 			phrase2[h] = ' ';
 
-	for (h = 0; h < strlen(phrase3); h++)
+	len = strlen(phrase3);
+	for (h = 0; h < len; h++)
 		if (phrase3[h] == (char)0xa7)
 			phrase3[h] = ' ';
 
-	for (h = 0; h < strlen(phrase4); h++)
+	len = strlen(phrase4);
+	for (h = 0; h < len; h++)
 		if (phrase4[h] == (char)0xa7)
 			phrase4[h] = ' ';
 


This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.




More information about the Scummvm-git-logs mailing list