diff options
author | Filippos Karapetis | 2008-06-06 19:52:09 +0000 |
---|---|---|
committer | Filippos Karapetis | 2008-06-06 19:52:09 +0000 |
commit | fbf319dbfb09868a9e6b1e989bb88315defe38d4 (patch) | |
tree | aed018209322b26ed280f27208693889c2c9cf7f /engines | |
parent | 00dba1cebce8ab3ab4e7b3fdd4257488a0483525 (diff) | |
download | scummvm-rg350-fbf319dbfb09868a9e6b1e989bb88315defe38d4.tar.gz scummvm-rg350-fbf319dbfb09868a9e6b1e989bb88315defe38d4.tar.bz2 scummvm-rg350-fbf319dbfb09868a9e6b1e989bb88315defe38d4.zip |
Partially reverted the changes to for loops in my last commit. It's not wise to call strlen() on each loop iteration...
svn-id: r32584
Diffstat (limited to 'engines')
-rw-r--r-- | engines/drascula/drascula.cpp | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/engines/drascula/drascula.cpp b/engines/drascula/drascula.cpp index 6b561d4853..cc292e0dd4 100644 --- a/engines/drascula/drascula.cpp +++ b/engines/drascula/drascula.cpp @@ -1421,8 +1421,9 @@ bool DrasculaEngine::saveLoadScreen() { 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(const char *said, int screenX, int screenY) { 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 @@ void DrasculaEngine::converse(int index) { int used2 = 0; int used3 = 0; char buffer[256]; + uint len; breakOut = 0; @@ -3061,19 +3064,23 @@ void DrasculaEngine::converse(int index) { 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] = ' '; |