aboutsummaryrefslogtreecommitdiff
path: root/engines/avalanche
diff options
context:
space:
mode:
authorStrangerke2013-09-13 00:18:14 +0200
committerStrangerke2013-09-13 00:18:14 +0200
commit65f39c14c92cf1453c58dd87db1b473f25b4dbd8 (patch)
tree0b1665919386682edfb748354e6b7de657db9d53 /engines/avalanche
parentb936611e030f6748013b5360c8617d44643cb335 (diff)
downloadscummvm-rg350-65f39c14c92cf1453c58dd87db1b473f25b4dbd8.tar.gz
scummvm-rg350-65f39c14c92cf1453c58dd87db1b473f25b4dbd8.tar.bz2
scummvm-rg350-65f39c14c92cf1453c58dd87db1b473f25b4dbd8.zip
AVALANCHE: Remove some verbosity related to excessive use of Common::String in Acci2
Diffstat (limited to 'engines/avalanche')
-rw-r--r--engines/avalanche/acci2.cpp58
-rw-r--r--engines/avalanche/acci2.h2
2 files changed, 26 insertions, 34 deletions
diff --git a/engines/avalanche/acci2.cpp b/engines/avalanche/acci2.cpp
index 74ddad958f..1b6446c09d 100644
--- a/engines/avalanche/acci2.cpp
+++ b/engines/avalanche/acci2.cpp
@@ -848,26 +848,20 @@ void Acci::peopleInRoom() {
if (_vm->_gyro->_whereIs[i] == _vm->_gyro->_dna._room) {
actPerson++;
if (actPerson == 1) // First on the list.
- _vm->_scrolls->displayText(_vm->_gyro->getName(i + 150) + Scrolls::kControlToBuffer);
- else if (actPerson < numPeople) { // The middle...
- tmpStr = Common::String::format(", %s%c", _vm->_gyro->getName(i + 150).c_str(), Scrolls::kControlToBuffer);
- _vm->_scrolls->displayText(tmpStr);
- } else { // The end.
- tmpStr = Common::String::format(" and %s%c", _vm->_gyro->getName(i + 150).c_str(), Scrolls::kControlToBuffer);
- _vm->_scrolls->displayText(tmpStr);
- }
+ tmpStr = _vm->_gyro->getName(i + 150);
+ else if (actPerson < numPeople) // The middle...
+ tmpStr += ", " + _vm->_gyro->getName(i + 150);
+ else // The end.
+ tmpStr += " and " + _vm->_gyro->getName(i + 150);
}
}
- if (numPeople == 1) {
- tmpStr = Common::String::format(" is%c", Scrolls::kControlToBuffer);
- _vm->_scrolls->displayText(tmpStr);
- } else {
- tmpStr = Common::String::format(" are%c", Scrolls::kControlToBuffer);
- _vm->_scrolls->displayText(tmpStr);
- }
+ if (numPeople == 1)
+ tmpStr += " is";
+ else
+ tmpStr += " are";
- _vm->_scrolls->displayText(" here."); // End and display it.
+ _vm->_scrolls->displayText(tmpStr + " here."); // End and display it.
}
void Acci::lookAround() {
@@ -1290,7 +1284,7 @@ void Acci::winSequence() {
_vm->_timer->addTimer(30, Timer::kProcWinning, Timer::kReasonWinning);
}
-void Acci::personSpeaks() {
+Common::String Acci::personSpeaks() {
if ((_person == kPardon) || (_person == 0)) {
if ((_vm->_gyro->_him == kPardon) || (_vm->_gyro->_whereIs[_vm->_gyro->_him - 150] != _vm->_gyro->_dna._room))
_person = _vm->_gyro->_her;
@@ -1299,34 +1293,32 @@ void Acci::personSpeaks() {
}
if (_vm->_gyro->_whereIs[_person - 150] != _vm->_gyro->_dna._room) {
- Common::String tmpStr = Common::String::format("%c1%c", Scrolls::kControlRegister, Scrolls::kControlToBuffer);
- _vm->_scrolls->displayText(tmpStr); // Avvy himself!
- return;
+ return Common::String::format("%c1", Scrolls::kControlRegister); // Avvy himself!
}
bool found = false; // The _person we're looking for's code is in _person.
+ Common::String tmpStr;
for (byte i = 0; i < _vm->_animation->kSpriteNumbMax; i++) {
if (_vm->_animation->_sprites[i]._quick && ((_vm->_animation->_sprites[i]._stat._acciNum + 149) == _person)) {
- Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, '1' + i, Scrolls::kControlToBuffer);
- _vm->_scrolls->displayText(tmpStr);
+ tmpStr += Common::String::format("%c%c", Scrolls::kControlRegister, '1' + i);
found = true;
}
}
if (found)
- return;
+ return tmpStr;
for (byte i = 0; i < 16; i++) {
- if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_dna._room)) {
- Common::String tmpStr = Common::String::format("%c%c%c", Scrolls::kControlRegister, 'A' + i, Scrolls::kControlToBuffer);
- _vm->_scrolls->displayText(tmpStr);
- }
+ if ((_vm->_gyro->kQuasipeds[i]._who == _person) && (_vm->_gyro->kQuasipeds[i]._room == _vm->_gyro->_dna._room))
+ tmpStr += Common::String::format("%c%c", Scrolls::kControlRegister, 'A' + i);
}
+
+ return tmpStr;
}
void Acci::heyThanks() {
- personSpeaks();
- Common::String tmpStr = Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Scrolls::kControlSpeechBubble);
+ Common::String tmpStr = personSpeaks();
+ tmpStr += Common::String::format("Hey, thanks!%c(But now, you've lost it!)", Scrolls::kControlSpeechBubble);
_vm->_scrolls->displayText(tmpStr);
_vm->_gyro->_dna._objects[_thing - 1] = false;
}
@@ -2056,14 +2048,14 @@ void Acci::doThat() {
_vm->_scrolls->displayText("Hey, a verb would be helpful!");
break;
case kVerbCodeHello: {
- personSpeaks();
- Common::String tmpStr = Common::String::format("Hello.%c", Scrolls::kControlSpeechBubble);
+ Common::String tmpStr = personSpeaks();
+ tmpStr += Common::String::format("Hello.%c", Scrolls::kControlSpeechBubble);
_vm->_scrolls->displayText(tmpStr);
}
break;
case kVerbCodeThanks: {
- personSpeaks();
- Common::String tmpStr = Common::String::format("That's OK.%c", Scrolls::kControlSpeechBubble);
+ Common::String tmpStr = personSpeaks();
+ tmpStr += Common::String::format("That's OK.%c", Scrolls::kControlSpeechBubble);
_vm->_scrolls->displayText(tmpStr);
}
break;
diff --git a/engines/avalanche/acci2.h b/engines/avalanche/acci2.h
index 55ad64e65f..dab5371f42 100644
--- a/engines/avalanche/acci2.h
+++ b/engines/avalanche/acci2.h
@@ -124,7 +124,7 @@ private:
void giveGeidaTheLute();
void playHarp();
void winSequence();
- void personSpeaks();
+ Common::String personSpeaks();
void heyThanks();
};