changeLocation now uses the internal variable _newLocationName instead of an input parameter.

svn-id: r38902
This commit is contained in:
Nicola Mettifogo 2009-02-26 14:42:03 +00:00
parent 868b589af6
commit b76ad3dc4f
4 changed files with 27 additions and 9 deletions

View File

@ -338,7 +338,7 @@ void Parallaction::runGameFrame(int event) {
return;
if (_engineFlags & kEngineChangeLocation) {
changeLocation(_location._name);
changeLocation();
}
_programExec->runScripts(_location._programs.begin(), _location._programs.end());
@ -954,7 +954,7 @@ void Parallaction::beep() {
void Parallaction::scheduleLocationSwitch(const char *location) {
debugC(9, kDebugExec, "scheduleLocationSwitch(%s)\n", location);
strcpy(_location._name, location);
_newLocationName = location;
_engineFlags |= kEngineChangeLocation;
}

View File

@ -291,6 +291,7 @@ public:
char _characterName1[50]; // only used in changeCharacter
ZonePtr _zoneTrap;
ZonePtr _commentZone;
Common::String _newLocationName;
protected:
void runGame();
@ -352,7 +353,7 @@ public:
void closeInventory();
virtual void parseLocation(const char* name) = 0;
virtual void changeLocation(char *location) = 0;
virtual void changeLocation() = 0;
virtual void changeCharacter(const char *name) = 0;
virtual void callFunction(uint index, void* parm) = 0;
virtual void runPendingZones() = 0;
@ -376,7 +377,7 @@ public:
public:
virtual void parseLocation(const char *filename);
virtual void changeLocation(char *location);
virtual void changeLocation();
virtual void changeCharacter(const char *name);
virtual void callFunction(uint index, void* parm);
virtual void runPendingZones();
@ -474,7 +475,7 @@ public:
public:
virtual void parseLocation(const char* name);
virtual void changeLocation(char *location);
virtual void changeLocation();
virtual void changeCharacter(const char *name);
virtual void callFunction(uint index, void* parm);
virtual void runPendingZones();

View File

@ -224,14 +224,20 @@ void Parallaction_br::cleanupGame() {
}
void Parallaction_br::changeLocation(char *location) {
void Parallaction_br::changeLocation() {
if (_newLocationName.empty()) {
return;
}
char location[200];
strcpy(location, _newLocationName.c_str());
char *partStr = strrchr(location, '.');
if (partStr) {
cleanupGame();
int n = partStr - location;
strncpy(_location._name, location, n);
_location._name[n] = '\0';
location[n] = '\0';
_part = atoi(++partStr);
if (getFeatures() & GF_DEMO) {
@ -260,6 +266,7 @@ void Parallaction_br::changeLocation(char *location) {
freeLocation(false);
// load new location
strcpy(_location._name, location);
parseLocation(location);
if (_location._startPosition.x != -1000) {
@ -293,6 +300,7 @@ void Parallaction_br::changeLocation(char *location) {
_cmdExec->run(_location._aCommands);
_engineFlags &= ~kEngineChangeLocation;
_newLocationName.clear();
}
// FIXME: Parallaction_br::parseLocation() is now a verbatim copy of the same routine from Parallaction_ns.

View File

@ -288,7 +288,15 @@ void Parallaction_ns::runPendingZones() {
// changeLocation handles transitions between locations, and is able to display slides
// between one and the other.
//
void Parallaction_ns::changeLocation(char *location) {
void Parallaction_ns::changeLocation() {
if (_newLocationName.empty()) {
return;
}
char location[200];
strcpy(location, _newLocationName.c_str());
strcpy(_location._name, _newLocationName.c_str());
debugC(1, kDebugExec, "changeLocation(%s)", location);
MouseTriState oldMouseState = _input->getMouseState();
@ -368,6 +376,7 @@ void Parallaction_ns::changeLocation(char *location) {
}
debugC(1, kDebugExec, "changeLocation() done");
_newLocationName.clear();
}