Skip to content

Commit

Permalink
CGE2: Implement EncryptedStream::ident().
Browse files Browse the repository at this point in the history
  • Loading branch information
uruk committed May 8, 2014
1 parent d12e25c commit 9ffdff5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 1 deletion.
14 changes: 13 additions & 1 deletion engines/cge2/fileio.cpp
Expand Up @@ -245,6 +245,17 @@ char *EncryptedStream::token(char *s) {
return strtok(s, " =\t,;/()");
}

ID EncryptedStream::ident(const char *s) {
if (s) {
for (const char **e = kIdTab; *e; e++) {
if (scumm_stricmp(s, *e) == 0) {
return ID(e - kIdTab);
}
}
}
return kIdNone;
}

int32 EncryptedStream::size() {
return _readStream->size();
}
Expand All @@ -261,6 +272,7 @@ const char *EncryptedStream::kIdTab[] = {
"[near]", "[mtake]", "[ftake]", "[phase]", "[seq]",
"Name", "Type", "Front", "East",
"Portable", "Transparent",
NULL };
NULL
};

} // End of namespace CGE2
8 changes: 8 additions & 0 deletions engines/cge2/fileio.h
Expand Up @@ -45,6 +45,13 @@ class CGE2Engine;
#define kDatName "VOL.DAT"
#define kCryptSeed 0xA5

enum ID {
kIdNear, kIdMTake, kIdFTake, kIdPhase, kIdSeq,
kIdName, kIdType, kIdFront, kIdEast,
kIdPortable, kIdTransparent,
kIdNone
};

struct BtKeypack {
char _key[kBtKeySize];
uint32 _pos;
Expand Down Expand Up @@ -119,6 +126,7 @@ class EncryptedStream {
Common::String readLine();
static int number(char *s);
static char *token(char *s);
static ID ident(const char *s);
int getLineCount() { return _lineCount; }
};

Expand Down

0 comments on commit 9ffdff5

Please sign in to comment.