[Scummvm-cvs-logs] SF.net SVN: scummvm:[55894] scummvm/trunk/engines/hugo

strangerke at users.sourceforge.net strangerke at users.sourceforge.net
Sat Feb 12 15:38:00 CET 2011


Revision: 55894
          http://scummvm.svn.sourceforge.net/scummvm/?rev=55894&view=rev
Author:   strangerke
Date:     2011-02-12 14:37:59 +0000 (Sat, 12 Feb 2011)

Log Message:
-----------
HUGO: little optimization in decodeString(), cleanup

Modified Paths:
--------------
    scummvm/trunk/engines/hugo/display.h
    scummvm/trunk/engines/hugo/schedule.cpp

Modified: scummvm/trunk/engines/hugo/display.h
===================================================================
--- scummvm/trunk/engines/hugo/display.h	2011-02-12 11:35:33 UTC (rev 55893)
+++ scummvm/trunk/engines/hugo/display.h	2011-02-12 14:37:59 UTC (rev 55894)
@@ -36,18 +36,18 @@
 namespace Hugo {
 enum overlayState_t {kOvlUndef, kOvlForeground, kOvlBackground}; // Overlay state
 
-struct rect_t {                                     // Rectangle used in Display list
-	int16 x;                                        // Position in dib
-	int16 y;                                        // Position in dib
-	int16 dx;                                       // width
-	int16 dy;                                       // height
-};
-
 static const int kCenter = -1;                      // Used to center text in x
 
 
 class Screen {
 public:
+	struct rect_t {                                 // Rectangle used in Display list
+		int16 x;                                    // Position in dib
+		int16 y;                                    // Position in dib
+		int16 dx;                                   // width
+		int16 dy;                                   // height
+	};
+
 	Screen(HugoEngine *vm);
 	virtual ~Screen();
 

Modified: scummvm/trunk/engines/hugo/schedule.cpp
===================================================================
--- scummvm/trunk/engines/hugo/schedule.cpp	2011-02-12 11:35:33 UTC (rev 55893)
+++ scummvm/trunk/engines/hugo/schedule.cpp	2011-02-12 14:37:59 UTC (rev 55894)
@@ -1427,10 +1427,11 @@
 void Scheduler_v1d::decodeString(char *line) {
 	debugC(1, kDebugSchedule, "decodeString(%s)", line);
 
-	static const char *cypher = getCypher();
+	static const Common::String cypher = getCypher();
 
-	for(uint16 i = 0; i < strlen(line); i++) {
-		line[i] = (line[i] + cypher[i]) % '~';
+	uint16 linelength = strlen(line);
+	for(uint16 i = 0; i < linelength; i++) {
+		line[i] = (line[i] + cypher.c_str()[i % cypher.size()]) % '~';
 		if (line[i] < ' ')
 			line[i] += ' ';
 	}
@@ -1479,10 +1480,11 @@
 void Scheduler_v2d::decodeString(char *line) {
 	debugC(1, kDebugSchedule, "decodeString(%s)", line);
 
-	static const char *cypher = getCypher();
+	static const Common::String cypher = getCypher();
 
-	for (uint16 i = 0; i < strlen(line); i++)
-		line[i] -= cypher[i % strlen(cypher)];
+	int16 lineLength = strlen(line);
+	for (uint16 i = 0; i < lineLength; i++)
+		line[i] -= cypher.c_str()[i % cypher.size()];
 	debugC(1, kDebugSchedule, "result : %s", line);
 }
 


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