mirror of
https://github.com/libretro/scummvm.git
synced 2024-12-14 21:59:17 +00:00
CGE2: Rework EncryptedStream::readLine().
This commit is contained in:
parent
43ce991b84
commit
62e36f9279
@ -116,11 +116,10 @@ void CGE2Engine::loadSprite(const char *fname, int ref, int scene, V3D &pos) {
|
||||
Common::String line;
|
||||
|
||||
for (line = sprf.readLine(); !sprf.eos(); line = sprf.readLine()){
|
||||
int len = line.size();
|
||||
Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
|
||||
if (len == 0 || *tmpStr == ';')
|
||||
if (line.size() == 0)
|
||||
continue;
|
||||
|
||||
Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
|
||||
|
||||
char *p;
|
||||
p = token(tmpStr);
|
||||
if (*p == '@') {
|
||||
@ -260,13 +259,14 @@ void CGE2Engine::loadScript(const char *fname) {
|
||||
Common::String line;
|
||||
|
||||
for (line = scrf.readLine(); !scrf.eos(); line = scrf.readLine()) {
|
||||
if (line.size() == 0)
|
||||
continue;
|
||||
|
||||
char *p;
|
||||
|
||||
lcnt++;
|
||||
Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
|
||||
if ((line.size() == 0) || (*tmpStr == ';')) // Comments start with ';' - don't bother with them.
|
||||
continue;
|
||||
|
||||
|
||||
ok = false; // not OK if break
|
||||
|
||||
V3D P;
|
||||
|
@ -242,7 +242,10 @@ bool EncryptedStream::seek(int32 offset) {
|
||||
|
||||
Common::String EncryptedStream::readLine() {
|
||||
_lineCount++;
|
||||
return _readStream->readLine();
|
||||
Common::String line = _readStream->readLine();
|
||||
if (!line.empty() && (line[0] == ';' || line[0] == '.' || line[0] == '*'))
|
||||
line.clear(); // Returns an empty string, if the line is invalid.
|
||||
return line;
|
||||
}
|
||||
|
||||
int32 EncryptedStream::size() {
|
||||
|
@ -105,6 +105,7 @@ public:
|
||||
bool exist(const char *name);
|
||||
};
|
||||
|
||||
// TODO: Revise the whole class!
|
||||
class EncryptedStream {
|
||||
private:
|
||||
CGE2Engine *_vm;
|
||||
|
@ -278,10 +278,9 @@ Sprite *Sprite::expand() {
|
||||
char tmpStr[kLineMax + 1];
|
||||
|
||||
for (line = sprf.readLine(); !sprf.eos(); line = sprf.readLine()){
|
||||
int len = line.size();
|
||||
Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
|
||||
if (len == 0 || *tmpStr == ';')
|
||||
if (line.size() == 0)
|
||||
continue;
|
||||
Common::strlcpy(tmpStr, line.c_str(), sizeof(tmpStr));
|
||||
|
||||
char *p = _vm->token(tmpStr);
|
||||
if (*p == '@') {
|
||||
|
Loading…
Reference in New Issue
Block a user