mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-22 20:21:06 +00:00
Fixed signature of GetString method - it is a destination character passed, not the current action. Also added a new method to return a decoded string with the correct definite article prefix (a/an/the)
svn-id: r23689
This commit is contained in:
parent
bdff0ae58a
commit
ba32b91688
@ -22,6 +22,7 @@
|
||||
|
||||
#include "lure/strings.h"
|
||||
#include "lure/disk.h"
|
||||
#include "lure/res.h"
|
||||
#include "lure/room.h"
|
||||
#include "common/endian.h"
|
||||
|
||||
@ -261,9 +262,13 @@ char StringData::readCharacter() {
|
||||
}
|
||||
|
||||
void StringData::getString(uint16 stringId, char *dest, const char *hotspotName,
|
||||
const char *actionName) {
|
||||
const char *characterName) {
|
||||
char ch;
|
||||
strcpy(dest, "");
|
||||
char *destPos = dest;
|
||||
stringId &= 0x1fff; // Strip off any article identifier
|
||||
if (stringId == 0) return;
|
||||
|
||||
initPosition(stringId);
|
||||
|
||||
ch = readCharacter();
|
||||
@ -271,7 +276,7 @@ void StringData::getString(uint16 stringId, char *dest, const char *hotspotName,
|
||||
if (ch == '%') {
|
||||
// Copy over hotspot or action
|
||||
ch = readCharacter();
|
||||
const char *p = (ch == '1') ? hotspotName : actionName;
|
||||
const char *p = (ch == '1') ? hotspotName : characterName;
|
||||
strcpy(destPos, p);
|
||||
destPos += strlen(p);
|
||||
} else if ((uint8) ch >= 0xa0) {
|
||||
@ -300,4 +305,13 @@ char *StringData::getName(uint8 nameIndex) {
|
||||
return (char *) (_names->data() + nameStart);
|
||||
}
|
||||
|
||||
// getStringWithArticle
|
||||
// Fills a buffer with the string specified by a given string Id with a definite article prefix
|
||||
|
||||
void StringData::getStringWithArticle(uint16 stringId, char *dest) {
|
||||
const char *articles[4] = {"the ", "a ", "an ", ""};
|
||||
strcpy(dest, articles[stringId >> 14]);
|
||||
getString(stringId, dest + strlen(dest));
|
||||
}
|
||||
|
||||
} // namespace Lure
|
||||
|
@ -58,10 +58,11 @@ public:
|
||||
~StringData();
|
||||
static StringData &getReference();
|
||||
|
||||
void getString(uint16 stringId, char *dest, const char *hotspotName, const char *actionName);
|
||||
void getString(uint16 stringId, char *dest, const char *hotspotName, const char *characterName);
|
||||
void getString(uint16 stringId, char *dest) {
|
||||
getString(stringId, dest, NULL, NULL);
|
||||
}
|
||||
void getStringWithArticle(uint16 stringId, char *dest);
|
||||
char *getName(uint8 nameIndex);
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user