aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorMax Horn2011-03-24 16:46:37 +0100
committerMax Horn2011-03-24 16:46:49 +0100
commit9a646cde46c1d61ab14c057a0142e851e9ec3a91 (patch)
tree927587ef3453e544a4adbdf0078502a6840866bd /engines
parent06b5432e94d2bb102852f404dfe53ec6ceb154e7 (diff)
downloadscummvm-rg350-9a646cde46c1d61ab14c057a0142e851e9ec3a91.tar.gz
scummvm-rg350-9a646cde46c1d61ab14c057a0142e851e9ec3a91.tar.bz2
scummvm-rg350-9a646cde46c1d61ab14c057a0142e851e9ec3a91.zip
HUGO: Turn FileManager::getBootCypher into a const static variable
Diffstat (limited to 'engines')
-rw-r--r--engines/hugo/file.cpp16
-rw-r--r--engines/hugo/file.h1
2 files changed, 9 insertions, 8 deletions
diff --git a/engines/hugo/file.cpp b/engines/hugo/file.cpp
index 214390c604..b0ef2d1988 100644
--- a/engines/hugo/file.cpp
+++ b/engines/hugo/file.cpp
@@ -46,6 +46,13 @@
#include "hugo/mouse.h"
namespace Hugo {
+
+namespace {
+static const char *s_bootCyper = "Copyright 1992, David P Gray, Gray Design Associates";
+static const int s_bootCyperLen = sizeof(s_bootCyper) - 1;
+}
+
+
FileManager::FileManager(HugoEngine *vm) : _vm(vm) {
has_read_header = false;
firstUIFFl = true;
@@ -523,7 +530,6 @@ bool FileManager::restoreGame(const int16 slot) {
*/
void FileManager::printBootText() {
debugC(1, kDebugFile, "printBootText()");
- static const char *cypher = getBootCypher();
Common::File ofp;
if (!ofp.open(getBootFilename())) {
@@ -547,7 +553,7 @@ void FileManager::printBootText() {
// Decrypt the exit text, using CRYPT substring
int i;
for (i = 0; i < _vm->_boot.exit_len; i++)
- buf[i] ^= cypher[i % strlen(cypher)];
+ buf[i] ^= s_bootCyper[i % s_bootCyperLen];
buf[i] = '\0';
Utils::notifyBox(buf);
@@ -563,7 +569,6 @@ void FileManager::printBootText() {
*/
void FileManager::readBootFile() {
debugC(1, kDebugFile, "readBootFile()");
- static const char *cypher = getBootCypher();
Common::File ofp;
if (!ofp.open(getBootFilename())) {
@@ -592,7 +597,7 @@ void FileManager::readBootFile() {
byte checksum = 0;
for (uint32 i = 0; i < sizeof(_vm->_boot); i++) {
checksum ^= p[i];
- p[i] ^= cypher[i % strlen(cypher)];
+ p[i] ^= s_bootCyper[i % s_bootCyperLen];
}
ofp.close();
@@ -669,8 +674,5 @@ void FileManager::readUIFImages() {
readUIFItem(UIF_IMAGES, _vm->_screen->getGUIBuffer()); // Read all uif images
}
-const char *FileManager::getBootCypher() const {
- return "Copyright 1992, David P Gray, Gray Design Associates";
-}
} // End of namespace Hugo
diff --git a/engines/hugo/file.h b/engines/hugo/file.h
index 77c6811df1..0e131348f9 100644
--- a/engines/hugo/file.h
+++ b/engines/hugo/file.h
@@ -118,7 +118,6 @@ protected:
PCC_header_t PCC_header;
seq_t *readPCX(Common::ReadStream &f, seq_t *seqPtr, byte *imagePtr, const bool firstFl, const char *name);
- const char *getBootCypher() const;
// If this is the first call, read the lookup table
bool has_read_header;