From b6d6c17727755fe50bbbb02ddc126ab7c887683c Mon Sep 17 00:00:00 2001 From: Strangerke Date: Sat, 5 Oct 2013 14:37:20 +0200 Subject: AVALANCHE: Replace static strings by static char* --- engines/avalanche/avalanche.cpp | 4 ++-- engines/avalanche/avalot.cpp | 31 ++++++++++++++++--------------- engines/avalanche/closing.cpp | 14 +++++++------- engines/avalanche/menu.cpp | 10 +++++----- engines/avalanche/parser.cpp | 9 ++++----- engines/avalanche/parser.h | 2 +- 6 files changed, 35 insertions(+), 35 deletions(-) (limited to 'engines/avalanche') diff --git a/engines/avalanche/avalanche.cpp b/engines/avalanche/avalanche.cpp index 31fd05393c..43943f2632 100644 --- a/engines/avalanche/avalanche.cpp +++ b/engines/avalanche/avalanche.cpp @@ -387,11 +387,11 @@ bool AvalancheEngine::loadGame(const int16 slot) { } Common::String AvalancheEngine::expandDate(int d, int m, int y) { - static const Common::String months[12] = { + static const char months[12][10] = { "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December" }; - Common::String month = months[m]; + Common::String month = Common::String(months[m]); Common::String day = intToStr(d); if (((1 <= d) && (d <= 9)) || ((21 <= d) && (d <= 31))) diff --git a/engines/avalanche/avalot.cpp b/engines/avalanche/avalot.cpp index ad71ce5ee8..f80a915508 100644 --- a/engines/avalanche/avalot.cpp +++ b/engines/avalanche/avalot.cpp @@ -1541,26 +1541,27 @@ bool AvalancheEngine::decreaseMoney(uint16 amount) { } Common::String AvalancheEngine::getName(People whose) { - static const Common::String lads[17] = { - "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", "Friar Tuck", - "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", "Dogfood", - "A trader", "Ibythneth", "Ayles", "Port", "Spurge", "Jacques" + static const char lads[17][20] = { + "Avalot", "Spludwick", "Crapulus", "Dr. Duck", "Malagauche", + "Friar Tuck", "Robin Hood", "Cwytalot", "du Lustie", "the Duke of Cardiff", + "Dogfood", "A trader", "Ibythneth", "Ayles", "Port", + "Spurge", "Jacques" }; - static const Common::String lasses[4] = {"Arkata", "Geida", "\0xB1", "the Wise Woman"}; + static const char lasses[4][15] = {"Arkata", "Geida", "\0xB1", "the Wise Woman"}; if (whose < kPeopleArkata) - return lads[whose - kPeopleAvalot]; + return Common::String(lads[whose - kPeopleAvalot]); else - return lasses[whose - kPeopleArkata]; + return Common::String(lasses[whose - kPeopleArkata]); } Common::String AvalancheEngine::getItem(byte which) { - static const Common::String items[kObjectNum] = { - "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", - "a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom", - "a key", "a bell", "a scroll", "a pen", "some ink", "your clothes", "a habit", - "an onion" + static const char items[kObjectNum][18] = { + "some wine", "your money-bag", "your bodkin", "a potion", "a chastity belt", + "a crossbow bolt", "a crossbow", "a lute", "a pilgrim's badge", "a mushroom", + "a key", "a bell", "a scroll", "a pen", "some ink", + "your clothes", "a habit", "an onion" }; Common::String result; @@ -1573,7 +1574,7 @@ Common::String AvalancheEngine::getItem(byte which) { case 0: case 1: case 4: - result = items[which - 1]; + result = Common::String(items[which - 1]); break; case 3: result = "some vinegar"; @@ -1586,11 +1587,11 @@ Common::String AvalancheEngine::getItem(byte which) { else if (_onionInVinegar) result = "a pickled onion (in the vinegar)"; else - result = items[which - 1]; + result = Common::String(items[which - 1]); break; default: if ((which < kObjectNum) && (which > 0)) - result = items[which - 1]; + result = Common::String(items[which - 1]); else result = ""; } diff --git a/engines/avalanche/closing.cpp b/engines/avalanche/closing.cpp index 93caa029cb..00a75897a2 100644 --- a/engines/avalanche/closing.cpp +++ b/engines/avalanche/closing.cpp @@ -52,14 +52,14 @@ void Closing::putIn(Common::String str, uint16 where) { } void Closing::exitGame() { - static const Common::String nouns[12] = { - "sackbut", "harpsichord", "camel", "conscience", "ice-cream", "serf", - "abacus", "castle", "carrots", "megaphone", "manticore", "drawbridge" + static const char nouns[12][14] = { + "sackbut", "harpsichord", "camel", "conscience", "ice-cream", "serf", + "abacus", "castle", "carrots", "megaphone", "manticore", "drawbridge" }; - static const Common::String verbs[12] = { - "haunt", "daunt", "tickle", "gobble", "erase", "provoke", "surprise", - "ignore", "stare at", "shriek at", "frighten", "quieten" + static const char verbs[12][12] = { + "haunt", "daunt", "tickle", "gobble", "erase", "provoke", + "surprise", "ignore", "stare at", "shriek at", "frighten", "quieten" }; _vm->_sound->stopSound(); @@ -67,7 +67,7 @@ void Closing::exitGame() { getScreen(kScreenNagScreen); byte nounId = _vm->_rnd->getRandomNumber(11); byte verbId = _vm->_rnd->getRandomNumber(11); - Common::String result = nouns[nounId] + " will " + verbs[verbId] + " you"; + Common::String result = Common::String::format("%s will %d you", nouns[nounId], verbs[verbId]); putIn(result, 1628); showScreen(); // No halt- it's already set up. } diff --git a/engines/avalanche/menu.cpp b/engines/avalanche/menu.cpp index 272948d664..1f349d2424 100644 --- a/engines/avalanche/menu.cpp +++ b/engines/avalanche/menu.cpp @@ -795,7 +795,7 @@ byte Menu::getNameChar(People whose) { } Common::String Menu::getThing(byte which) { - static const Common::String things[kObjectNum] = { + static const char things[kObjectNum][20] = { "Wine", "Money-bag", "Bodkin", "Potion", "Chastity belt", "Crossbow bolt", "Crossbow", "Lute", "Pilgrim's badge", "Mushroom", "Key", "Bell", "Scroll", "Pen", "Ink", "Clothes", "Habit", "Onion" @@ -807,7 +807,7 @@ Common::String Menu::getThing(byte which) { switch (_vm->_wineState) { case 1: case 4: - result = things[which - 1]; + result = Common::String(things[which - 1]); break; case 3: result = "Vinegar"; @@ -816,12 +816,12 @@ Common::String Menu::getThing(byte which) { break; case kObjectOnion: if (_vm->_rottenOnion) - result = "rotten onion"; + result = Common::String("rotten onion"); else - result = things[which - 1]; + result = Common::String(things[which - 1]); break; default: - result = things[which - 1]; + result = Common::String(things[which - 1]); } return result; } diff --git a/engines/avalanche/parser.cpp b/engines/avalanche/parser.cpp index 7227550378..28c3b3bdd1 100644 --- a/engines/avalanche/parser.cpp +++ b/engines/avalanche/parser.cpp @@ -525,9 +525,8 @@ Common::String Parser::rank() { }; for (int i = 0; i < 8; i++) { - if ((_vm->_dnascore >= ranks[i]._score) && (_vm->_dnascore < ranks[i + 1]._score)) { - return ranks[i]._title; - } + if ((_vm->_dnascore >= ranks[i]._score) && (_vm->_dnascore < ranks[i + 1]._score)) + return Common::String(ranks[i]._title); } return ""; } @@ -1572,7 +1571,7 @@ void Parser::heyThanks() { * @remarks Originally called 'do_that' */ void Parser::doThat() { - static const Common::String booze[] = {"Bitter", "GIED", "Whisky", "Cider", "", "", "", "Mead"}; + static const char booze[8][8] = {"Bitter", "GIED", "Whisky", "Cider", "", "", "", "Mead"}; static const char kWhat[] = "That's not possible!"; if (_thats == Common::String(kNothing)) { @@ -2052,7 +2051,7 @@ void Parser::doThat() { _vm->incScore(3); _vm->_background->draw(-1, -1, 11); - _vm->_dialogs->displayText(booze[_thing - 51] + ", please." + kControlRegister + '1' + kControlSpeechBubble); + _vm->_dialogs->displayText(Common::String(booze[_thing - 51]) + ", please." + kControlRegister + '1' + kControlSpeechBubble); _vm->_drinking = _thing; _vm->_background->draw(-1, -1, 9); diff --git a/engines/avalanche/parser.h b/engines/avalanche/parser.h index 0375367cc7..892b81e9a3 100644 --- a/engines/avalanche/parser.h +++ b/engines/avalanche/parser.h @@ -99,7 +99,7 @@ private: struct RankType { uint16 _score; - Common::String _title; + char _title[20]; }; static const char *kCopyright; -- cgit v1.2.3