TONY: Convert more strings to Common::String.

This commit is contained in:
Alyssa Milburn 2012-08-25 00:21:58 +02:00
parent ff9569572a
commit b77306bfcc
4 changed files with 18 additions and 21 deletions

View File

@ -134,11 +134,11 @@ void RMFont::close() {
unload();
}
int RMFont::stringLen(const RMString &text) {
int len, i;
int RMFont::stringLen(const Common::String &text) {
uint len, i;
len = 0;
for (i = 0; i < text.length() - 1; i++)
for (i = 0; i < text.size() - 1; i++)
len += letterLength(text[i], text[i + 1]);
len += letterLength(text[i]);
@ -1901,7 +1901,7 @@ void RMText::writeText(Common::String text, RMFontColor *font, int *time) {
// Measure the length of the line
x = 0;
j = font->stringLen(RMString(line.c_str()));
j = font->stringLen(line);
switch (_aHorType) {
case HLEFT:
@ -2025,15 +2025,15 @@ void RMTextDialog::hide(CORO_PARAM) {
_bShowed = false;
}
void RMTextDialog::writeText(const RMString &text, int font, int *time) {
RMText::writeText(Common::String(text), font, &_time);
void RMTextDialog::writeText(const Common::String &text, int font, int *time) {
RMText::writeText(text, font, &_time);
if (time != NULL)
*time = _time;
}
void RMTextDialog::writeText(const RMString &text, RMFontColor *font, int *time) {
RMText::writeText(Common::String(text), font, &_time);
void RMTextDialog::writeText(const Common::String &text, RMFontColor *font, int *time) {
RMText::writeText(text, font, &_time);
if (time != NULL)
*time = _time;
@ -2230,7 +2230,7 @@ void RMTextItemName::doFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &
uint32 hThread;
CORO_END_CONTEXT(_ctx);
RMString itemName;
Common::String itemName;
CORO_BEGIN_CODE(_ctx);
@ -2249,14 +2249,12 @@ void RMTextItemName::doFrame(CORO_PARAM, RMGfxTargetBuffer &bigBuf, RMLocation &
else
_item = loc.whichItemIsIn(_mpos);
itemName = "";
// If there an item, get its name
if (_item != NULL)
_item->getName(itemName);
// Write it
writeText(Common::String(itemName), 1);
writeText(itemName, 1);
// Handle the change If the selected item is different from the previous one
if (_ctx->lastItem != _item) {
@ -2387,10 +2385,10 @@ void RMDialogChoice::setNumChoices(int num) {
}
}
void RMDialogChoice::addChoice(const RMString &string) {
void RMDialogChoice::addChoice(const Common::String &string) {
// Draw the string
assert(_curAdded < _numChoices);
_drawedStrings[_curAdded++].writeText(Common::String(string), 0);
_drawedStrings[_curAdded++].writeText(string, 0);
}
void RMDialogChoice::prepare(CORO_PARAM) {

View File

@ -100,7 +100,7 @@ public:
RMGfxPrimitive *makeLetterPrimitive(byte bChar, int &nLength);
// Length in pixels of a string with the current font
int stringLen(const RMString &text);
int stringLen(const Common::String &text);
int stringLen(char bChar, char bNext = 0);
};
@ -256,8 +256,8 @@ public:
virtual ~RMTextDialog();
// Write the text
void writeText(const RMString &text, int font, int *time = NULL);
void writeText(const RMString &text, RMFontColor *font, int *time = NULL);
void writeText(const Common::String &text, int font, int *time = NULL);
void writeText(const Common::String &text, RMFontColor *font, int *time = NULL);
// Overloaded function to decide when you delete the object from the OT list
virtual void removeThis(CORO_PARAM, bool &result);
@ -376,7 +376,7 @@ public:
void setNumChoices(int num);
// Adds a string with the choice
void addChoice(const RMString &string);
void addChoice(const Common::String &string);
// Show and hide the selection, with possible animations.
// NOTE: If no parameter is passed to Show(), it is the obligation of

View File

@ -736,7 +736,7 @@ void RMItem::setPattern(int nPattern, bool bPlayP0) {
}
}
bool RMItem::getName(RMString &name) {
bool RMItem::getName(Common::String &name) {
char buf[256];
mpalQueryItemName(_mpalCode, buf);
@ -1818,7 +1818,6 @@ RMGameBoxes::~RMGameBoxes() {
void RMGameBoxes::init() {
int i;
RMString fn;
RMDataStream ds;
// Load boxes from disk

View File

@ -276,7 +276,7 @@ public:
RMPoint hotspot() {
return _hot;
}
bool getName(RMString &name);
bool getName(Common::String &name);
int mpalCode() {
return _mpalCode;
}