aboutsummaryrefslogtreecommitdiff
path: root/engines/parallaction
diff options
context:
space:
mode:
authorNicola Mettifogo2007-03-11 13:43:17 +0000
committerNicola Mettifogo2007-03-11 13:43:17 +0000
commit981d11dcfdae5efc03f1139523faa451375f7b25 (patch)
treea731cb2d979ba2713dc01fa182fd70ec706c610d /engines/parallaction
parent06434f6eef88850f3a67e12b044af52225d5c72f (diff)
downloadscummvm-rg350-981d11dcfdae5efc03f1139523faa451375f7b25.tar.gz
scummvm-rg350-981d11dcfdae5efc03f1139523faa451375f7b25.tar.bz2
scummvm-rg350-981d11dcfdae5efc03f1139523faa451375f7b25.zip
changed changeLocation to use StringList instead of multiple nested if's
svn-id: r26084
Diffstat (limited to 'engines/parallaction')
-rw-r--r--engines/parallaction/location.cpp43
1 files changed, 21 insertions, 22 deletions
diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp
index 086670a331..b8ca1e1892 100644
--- a/engines/parallaction/location.cpp
+++ b/engines/parallaction/location.cpp
@@ -351,39 +351,38 @@ void Parallaction::changeLocation(char *location) {
char buf[100];
strcpy(buf, location);
- char *tmp = strchr(buf, '.'); // tmp = ".slide.[L].[C]" or tmp = ".[C]" or tmp = NULL
- if (tmp) {
- *tmp = '\0';
-
- if (!scumm_strnicmp(tmp+1, "slide", 5)) {
- showSlide(buf);
+ Common::StringList list;
+ char *tok = strtok(location, ".");
+ while (tok) {
+ list.push_back(tok);
+ tok = strtok(NULL, ".");
+ }
- tmp = strchr(tmp+1, '.');
- strcpy(buf, tmp+1);
- tmp = strchr(buf, '.');
+ if (list.size() < 1 || list.size() > 4)
+ error("changeLocation: ill-formed location string '%s'", location);
- if (tmp) {
- *tmp = '\0';
- changeCharacter(tmp+1);
- strcpy(_characterName, tmp+1);
- }
-
- } else {
- changeCharacter(tmp+1);
- strcpy(_characterName, tmp+1);
+ if (list.size() > 1) {
+ if (list[1] == "slide") {
+ showSlide(list[0].c_str());
+ list.remove_at(0); // removes slide name
+ list.remove_at(1); // removes 'slide'
}
- debugC(2, kDebugLocation, "changeLocation: character changed to '%s'", _characterName);
+ // list is now only [L].{[C]} (see above comment)
+ if (list.size() == 2) {
+ changeCharacter(list[1].c_str());
+ strcpy(_characterName, list[1].c_str());
+ }
}
addNode(&_animations, &_yourself._zone._node);
debugC(2, kDebugLocation, "changeLocation: new character added to the animation list");
- strcpy(_saveData1, buf);
+ strcpy(_saveData1, list[0].c_str());
+ parseLocation(list[0].c_str());
- parseLocation(buf);
_graphics->copyScreen(Graphics::kBitBack, Graphics::kBit2);
- debugC(1, kDebugLocation, "changeLocation: new location '%s' parsed", buf);
+ debugC(1, kDebugLocation, "changeLocation: new location '%s' parsed", _saveData1);
_yourself._zone.pos._oldposition._x = -1000;
_yourself._zone.pos._oldposition._y = -1000;