aboutsummaryrefslogtreecommitdiff
path: root/engines/cge/text.cpp
diff options
context:
space:
mode:
authorAlyssa Milburn2011-08-20 00:23:45 +0200
committerAlyssa Milburn2011-08-20 00:23:45 +0200
commite4a37322a6678aa3874d96ce131bebbccbdd7a44 (patch)
treec9075b5fbaa7cbefb0fb98df29370ab5c93eb6aa /engines/cge/text.cpp
parentc1807138fbb9dca4ff2d59f8c5ed39385716c6a0 (diff)
downloadscummvm-rg350-e4a37322a6678aa3874d96ce131bebbccbdd7a44.tar.gz
scummvm-rg350-e4a37322a6678aa3874d96ce131bebbccbdd7a44.tar.bz2
scummvm-rg350-e4a37322a6678aa3874d96ce131bebbccbdd7a44.zip
CGE: More misc cleanup.
Diffstat (limited to 'engines/cge/text.cpp')
-rw-r--r--engines/cge/text.cpp78
1 files changed, 38 insertions, 40 deletions
diff --git a/engines/cge/text.cpp b/engines/cge/text.cpp
index 7e58762afa..0e6fc40920 100644
--- a/engines/cge/text.cpp
+++ b/engines/cge/text.cpp
@@ -79,44 +79,44 @@ int Text::find(int ref) {
void Text::preload(int from, int upto) {
INI_FILE tf = _fileName;
- if (!tf._error) {
- Han *CacheLim = _cache + _size;
- char line[kLineMax + 1];
- int n;
-
- while ((n = tf.read((uint8 *)line)) != 0) {
- char *s;
-
- if (line[n - 1] == '\n')
- line[--n] = '\0';
-
- if ((s = strtok(line, " =,;/\t\n")) == NULL)
- continue;
- if (!IsDigit(*s))
- continue;
-
- int ref = atoi(s);
- if (ref && ref >= from && ref < upto) {
- Han *p = &_cache[find(ref)];
-
- if (p < CacheLim) {
- delete[] p->_text;
- p->_text = NULL;
- } else
- p = &_cache[find(0)];
-
- if (p >= CacheLim)
- break;
-
- s += strlen(s);
- if (s < line + n)
- ++s;
- if ((p->_text = new char[strlen(s) + 1]) == NULL)
- break;
-
- p->_ref = ref;
- strcpy(p->_text, s);
- }
+ if (tf._error)
+ return;
+
+ Han *CacheLim = _cache + _size;
+ char line[kLineMax + 1];
+ int n;
+
+ while ((n = tf.read((uint8 *)line)) != 0) {
+ if (line[n - 1] == '\n')
+ line[--n] = '\0';
+
+ char *s;
+ if ((s = strtok(line, " =,;/\t\n")) == NULL)
+ continue;
+ if (!IsDigit(*s))
+ continue;
+
+ int ref = atoi(s);
+ if (ref && ref >= from && ref < upto) {
+ Han *p = &_cache[find(ref)];
+
+ if (p < CacheLim) {
+ delete[] p->_text;
+ p->_text = NULL;
+ } else
+ p = &_cache[find(0)];
+
+ if (p >= CacheLim)
+ break;
+
+ s += strlen(s);
+ if (s < line + n)
+ ++s;
+ if ((p->_text = new char[strlen(s) + 1]) == NULL)
+ break;
+
+ p->_ref = ref;
+ strcpy(p->_text, s);
}
}
}
@@ -161,7 +161,6 @@ char *Text::load(int idx, int ref) {
return NULL;
}
-
char *Text::getText(int ref) {
int i;
if ((i = find(ref)) < _size)
@@ -177,7 +176,6 @@ char *Text::getText(int ref) {
return load(i, ref);
}
-
void Text::say(const char *text, Sprite *spr) {
killText();
_talk = new Talk(_vm, text, kTBRound);