AVALANCHE: Rework some more string uses

This commit is contained in:
Strangerke 2013-09-08 22:23:58 +02:00
parent cb66911ed2
commit e77db05208
3 changed files with 18 additions and 22 deletions

View file

@ -53,9 +53,8 @@ void AnimationType::init(byte spritenum, bool doCheck, Animation *anim) {
if (spritenum == 177) if (spritenum == 177)
return; // Already running! return; // Already running!
Common::String filename;
Common::File inf; Common::File inf;
filename = filename.format("sprite%d.avd", spritenum); Common::String filename = Common::String::format("sprite%d.avd", spritenum);
if (!inf.open(filename)) { if (!inf.open(filename)) {
warning("AVALANCHE: Trip: File not found: %s", filename.c_str()); warning("AVALANCHE: Trip: File not found: %s", filename.c_str());
return; return;

View file

@ -190,8 +190,7 @@ Gyro::~Gyro() {
} }
Common::String Gyro::intToStr(int32 num) { Common::String Gyro::intToStr(int32 num) {
Common::String result = Common::String::format("%d", num); return Common::String::format("%d", num);
return result;
} }
void Gyro::newMouse(byte id) { void Gyro::newMouse(byte id) {
@ -427,34 +426,32 @@ Common::String Gyro::getItem(byte which) {
Common::String Gyro::f5Does() { Common::String Gyro::f5Does() {
Common::String f5_does_result;
switch (_dna._room) { switch (_dna._room) {
case r__yours: { case r__yours:
if (!_dna._avvyIsAwake) if (!_dna._avvyIsAwake)
return Common::String(_vm->_acci->kVerbCodeWake) + "WWake up"; return Common::String::format("%cWWake up", Acci::kVerbCodeWake);
else if (_dna._avvyInBed) else if (_dna._avvyInBed)
return Common::String(_vm->_acci->kVerbCodeStand) + "GGet up"; return Common::String::format("%cGGet up", Acci::kVerbCodeStand);
}
break; break;
case r__insidecardiffcastle: case r__insidecardiffcastle:
if (_dna._standingOnDais) if (_dna._standingOnDais)
return Common::String(_vm->_acci->kVerbCodeClimb) + "CClimb down"; return Common::String::format("%cCClimb down", Acci::kVerbCodeClimb);
else else
return Common::String(_vm->_acci->kVerbCodeClimb) + "CClimb up"; return Common::String::format("%cCClimb up", Acci::kVerbCodeClimb);
break; break;
case r__nottspub: case r__nottspub:
if (_dna._sittingInPub) if (_dna._sittingInPub)
return Common::String(_vm->_acci->kVerbCodeStand) + "SStand up"; return Common::String::format("%cSStand up", Acci::kVerbCodeStand);
else else
return Common::String(_vm->_acci->kVerbCodeSit) + "SSit down"; return Common::String::format("%cSSit down", Acci::kVerbCodeSit);
break; break;
case r__musicroom: case r__musicroom:
if (_vm->_animation->inField(7)) if (_vm->_animation->inField(7))
return Common::String(_vm->_acci->kVerbCodePlay) + "PPlay the harp"; return Common::String::format("%cPPlay the harp", Acci::kVerbCodePlay);
break; break;
} }
return Common::String(_vm->_acci->kPardon); // If all else fails... return Common::String::format("%c", _vm->_acci->kPardon); // If all else fails...
} }
void Gyro::loadMouse(byte which) { void Gyro::loadMouse(byte which) {

View file

@ -85,7 +85,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) {
byte lz = z.size(); byte lz = z.size();
bool offset = x % 8 == 4; bool offset = x % 8 == 4;
x = x / 8; x /= 8;
y++; y++;
int16 i = 0; int16 i = 0;
for (byte xx = 0; xx < lz; xx++) { for (byte xx = 0; xx < lz; xx++) {
@ -112,7 +112,7 @@ void Scrolls::say(int16 x, int16 y, Common::String z) {
} }
void Scrolls::scrollModeNormal() { void Scrolls::scrollModeNormal() {
Common::String egg = Common::String(kControlParagraph) + kControlLeftJustified + kControlNegative + kControlBell + kControlBackspace + "***"; Common::String egg = Common::String::format("%c%c%c%c%c***", kControlParagraph, kControlLeftJustified, kControlNegative, kControlBell, kControlBackspace);
Common::String e = "(c) 1994"; Common::String e = "(c) 1994";
setReadyLight(3); setReadyLight(3);
@ -161,7 +161,8 @@ void Scrolls::scrollModeNormal() {
if (aboutscroll) { if (aboutscroll) {
move(e[2 - 1], e[1 - 1], 7); move(e[2 - 1], e[1 - 1], 7);
e[8 - 1] = inchar; e[8 - 1] = inchar;
if (egg == e) easteregg(); if (egg == e)
easteregg();
} }
oktoexit = set::of('\15', '\33', '+', '#', eos).has(inchar); oktoexit = set::of('\15', '\33', '+', '#', eos).has(inchar);
if (! oktoexit) errorled(); if (! oktoexit) errorled();
@ -278,9 +279,8 @@ void Scrolls::getIcon(int16 x, int16 y, byte which) {
void Scrolls::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) { void Scrolls::drawSign(Common::String fn, int16 xl, int16 yl, int16 y) {
Common::File file; Common::File file;
Common::String filename = Common::String::format("%s.avd", fn.c_str());
Common::String filename;
filename = filename.format("%s.avd", fn.c_str());
if (!file.open(filename)) { if (!file.open(filename)) {
warning("AVALANCHE: Scrolls: File not found: %s", filename.c_str()); warning("AVALANCHE: Scrolls: File not found: %s", filename.c_str());
return; return;