aboutsummaryrefslogtreecommitdiff
path: root/engines/wintermute/Base
diff options
context:
space:
mode:
authorEinar Johan Trøan Sømåen2012-07-08 22:18:18 +0200
committerEinar Johan Trøan Sømåen2012-07-08 22:18:18 +0200
commit595f140cd82b06346dbfa668cdfa672fc402a9a9 (patch)
treeda8bfe6f3641c6d4a13d5692134a606b4ec9b0a2 /engines/wintermute/Base
parent5f7b45de34d4f34c543d47e1feead84c79654965 (diff)
downloadscummvm-rg350-595f140cd82b06346dbfa668cdfa672fc402a9a9.tar.gz
scummvm-rg350-595f140cd82b06346dbfa668cdfa672fc402a9a9.tar.bz2
scummvm-rg350-595f140cd82b06346dbfa668cdfa672fc402a9a9.zip
WINTERMUTE: Rename FuncName/VarName -> funcName/varName in BStringTable
Diffstat (limited to 'engines/wintermute/Base')
-rw-r--r--engines/wintermute/Base/BGame.cpp2
-rw-r--r--engines/wintermute/Base/BObject.cpp16
-rw-r--r--engines/wintermute/Base/BStringTable.cpp100
-rw-r--r--engines/wintermute/Base/BStringTable.h10
4 files changed, 64 insertions, 64 deletions
diff --git a/engines/wintermute/Base/BGame.cpp b/engines/wintermute/Base/BGame.cpp
index 088aebe4a3..7f24352b5e 100644
--- a/engines/wintermute/Base/BGame.cpp
+++ b/engines/wintermute/Base/BGame.cpp
@@ -1118,7 +1118,7 @@ HRESULT CBGame::scCallMethod(CScScript *script, CScStack *stack, CScStack *thisS
CScValue *val = stack->pop();
char *str = new char[strlen(val->getString()) + 1];
strcpy(str, val->getString());
- _stringTable->Expand(&str);
+ _stringTable->expand(&str);
stack->pushString(str);
delete [] str;
return S_OK;
diff --git a/engines/wintermute/Base/BObject.cpp b/engines/wintermute/Base/BObject.cpp
index 49c4a19fcc..6b4b0f5da2 100644
--- a/engines/wintermute/Base/BObject.cpp
+++ b/engines/wintermute/Base/BObject.cpp
@@ -137,16 +137,16 @@ HRESULT CBObject::cleanup() {
//////////////////////////////////////////////////////////////////////////
-void CBObject::setCaption(const char *caption, int Case) { // TODO: rename Case to something usefull
- if (Case == 0) Case = 1;
- if (Case < 1 || Case > 7)
+void CBObject::setCaption(const char *caption, int caseVal) { // TODO: rename Case to something usefull
+ if (caseVal == 0) caseVal = 1;
+ if (caseVal < 1 || caseVal > 7)
return;
- delete[] _caption[Case - 1];
- _caption[Case - 1] = new char[strlen(caption) + 1];
- if (_caption[Case - 1]) {
- strcpy(_caption[Case - 1], caption);
- Game->_stringTable->Expand(&_caption[Case - 1]);
+ delete[] _caption[caseVal - 1];
+ _caption[caseVal - 1] = new char[strlen(caption) + 1];
+ if (_caption[caseVal - 1]) {
+ strcpy(_caption[caseVal - 1], caption);
+ Game->_stringTable->expand(&_caption[caseVal - 1]);
}
}
diff --git a/engines/wintermute/Base/BStringTable.cpp b/engines/wintermute/Base/BStringTable.cpp
index 72b5535714..ed33e4d776 100644
--- a/engines/wintermute/Base/BStringTable.cpp
+++ b/engines/wintermute/Base/BStringTable.cpp
@@ -50,35 +50,35 @@ CBStringTable::~CBStringTable() {
//////////////////////////////////////////////////////////////////////////
-HRESULT CBStringTable::AddString(const char *Key, const char *Val, bool ReportDuplicities) {
- if (Key == NULL || Val == NULL) return E_FAIL;
+HRESULT CBStringTable::addString(const char *key, const char *val, bool reportDuplicities) {
+ if (key == NULL || val == NULL) return E_FAIL;
- if (scumm_stricmp(Key, "@right-to-left") == 0) {
+ if (scumm_stricmp(key, "@right-to-left") == 0) {
Game->_textRTL = true;
return S_OK;
}
- Common::String final_key = Key;
+ Common::String final_key = key;
StringUtil::toLowerCase(final_key);
_stringsIter = _strings.find(final_key);
- if (_stringsIter != _strings.end() && ReportDuplicities) Game->LOG(0, " Warning: Duplicate definition of string '%s'.", final_key.c_str());
+ if (_stringsIter != _strings.end() && reportDuplicities) Game->LOG(0, " Warning: Duplicate definition of string '%s'.", final_key.c_str());
- _strings[final_key] = Val;
+ _strings[final_key] = val;
return S_OK;
}
//////////////////////////////////////////////////////////////////////////
-char *CBStringTable::GetKey(const char *Str) {
- if (Str == NULL || Str[0] != '/') return NULL;
+char *CBStringTable::getKey(const char *str) {
+ if (str == NULL || str[0] != '/') return NULL;
- const char *value = strchr(Str + 1, '/');
+ const char *value = strchr(str + 1, '/');
if (value == NULL) return NULL;
- char *key = new char[value - Str];
- strncpy(key, Str + 1, value - Str - 1);
- key[value - Str - 1] = '\0';
+ char *key = new char[value - str];
+ strncpy(key, str + 1, value - str - 1);
+ key[value - str - 1] = '\0';
CBPlatform::strlwr(key);
char *new_str;
@@ -89,7 +89,7 @@ char *CBStringTable::GetKey(const char *Str) {
strcpy(new_str, _stringsIter->_value.c_str());
if (strlen(new_str) > 0 && new_str[0] == '/' && strchr(new_str + 1, '/')) {
delete [] key;
- char *Ret = GetKey(new_str);
+ char *Ret = getKey(new_str);
delete [] new_str;
return Ret;
} else {
@@ -102,17 +102,17 @@ char *CBStringTable::GetKey(const char *Str) {
}
//////////////////////////////////////////////////////////////////////////
-void CBStringTable::Expand(char **Str, bool ForceExpand) {
- if (Game->_doNotExpandStrings && !ForceExpand) return;
+void CBStringTable::expand(char **str, bool forceExpand) {
+ if (Game->_doNotExpandStrings && !forceExpand) return;
- if (Str == NULL || *Str == NULL || *Str[0] != '/') return;
+ if (str == NULL || *str == NULL || *str[0] != '/') return;
- char *value = strchr(*Str + 1, '/');
+ char *value = strchr(*str + 1, '/');
if (value == NULL) return;
- char *key = new char[value - *Str];
- strncpy(key, *Str + 1, value - *Str - 1);
- key[value - *Str - 1] = '\0';
+ char *key = new char[value - *str];
+ strncpy(key, *str + 1, value - *str - 1);
+ key[value - *str - 1] = '\0';
CBPlatform::strlwr(key);
value++;
@@ -129,25 +129,25 @@ void CBStringTable::Expand(char **Str, bool ForceExpand) {
}
delete [] key;
- delete [] *Str;
- *Str = new_str;
+ delete [] *str;
+ *str = new_str;
- if (strlen(*Str) > 0 && *Str[0] == '/') Expand(Str, ForceExpand);
+ if (strlen(*str) > 0 && *str[0] == '/') expand(str, forceExpand);
}
//////////////////////////////////////////////////////////////////////////
-const char *CBStringTable::ExpandStatic(const char *String, bool ForceExpand) {
- if (Game->_doNotExpandStrings && !ForceExpand) return String;
+const char *CBStringTable::expandStatic(const char *string, bool forceExpand) {
+ if (Game->_doNotExpandStrings && !forceExpand) return string;
- if (String == NULL || String[0] == '\0' || String[0] != '/') return String;
+ if (string == NULL || string[0] == '\0' || string[0] != '/') return string;
- const char *value = strchr(String + 1, '/');
- if (value == NULL) return String;
+ const char *value = strchr(string + 1, '/');
+ if (value == NULL) return string;
- char *key = new char[value - String];
- strncpy(key, String + 1, value - String - 1);
- key[value - String - 1] = '\0';
+ char *key = new char[value - string];
+ strncpy(key, string + 1, value - string - 1);
+ key[value - string - 1] = '\0';
CBPlatform::strlwr(key);
value++;
@@ -163,28 +163,28 @@ const char *CBStringTable::ExpandStatic(const char *String, bool ForceExpand) {
delete [] key;
- if (strlen(new_str) > 0 && new_str[0] == '/') return ExpandStatic(new_str, ForceExpand);
+ if (strlen(new_str) > 0 && new_str[0] == '/') return expandStatic(new_str, forceExpand);
else return new_str;
}
//////////////////////////////////////////////////////////////////////////
-HRESULT CBStringTable::loadFile(const char *filename, bool ClearOld) {
+HRESULT CBStringTable::loadFile(const char *filename, bool clearOld) {
Game->LOG(0, "Loading string table...");
- if (ClearOld) _strings.clear();
+ if (clearOld) _strings.clear();
- uint32 Size;
- byte *buffer = Game->_fileManager->readWholeFile(filename, &Size);
+ uint32 size;
+ byte *buffer = Game->_fileManager->readWholeFile(filename, &size);
if (buffer == NULL) {
Game->LOG(0, "CBStringTable::LoadFile failed for file '%s'", filename);
return E_FAIL;
}
- int Pos = 0;
+ int pos = 0;
- if (Size > 3 && buffer[0] == 0xEF && buffer[1] == 0xBB && buffer[2] == 0xBF) {
- Pos += 3;
+ if (size > 3 && buffer[0] == 0xEF && buffer[1] == 0xBB && buffer[2] == 0xBF) {
+ pos += 3;
if (Game->_textEncoding != TEXT_UTF8) {
Game->_textEncoding = TEXT_UTF8;
//Game->_textEncoding = TEXT_ANSI;
@@ -192,15 +192,15 @@ HRESULT CBStringTable::loadFile(const char *filename, bool ClearOld) {
}
} else Game->_textEncoding = TEXT_ANSI;
- int LineLength = 0;
- while (Pos < Size) {
- LineLength = 0;
- while (Pos + LineLength < Size && buffer[Pos + LineLength] != '\n' && buffer[Pos + LineLength] != '\0') LineLength++;
+ int lineLength = 0;
+ while (pos < size) {
+ lineLength = 0;
+ while (pos + lineLength < size && buffer[pos + lineLength] != '\n' && buffer[pos + lineLength] != '\0') lineLength++;
- int RealLength = LineLength - (Pos + LineLength >= Size ? 0 : 1);
- char *line = new char[RealLength + 1];
- strncpy(line, (char *)&buffer[Pos], RealLength);
- line[RealLength] = '\0';
+ int realLength = lineLength - (pos + lineLength >= size ? 0 : 1);
+ char *line = new char[realLength + 1];
+ strncpy(line, (char *)&buffer[pos], realLength);
+ line[realLength] = '\0';
char *value = strchr(line, '\t');
if (value == NULL) value = strchr(line, ' ');
@@ -211,12 +211,12 @@ HRESULT CBStringTable::loadFile(const char *filename, bool ClearOld) {
for (int i = 0; i < strlen(value); i++) {
if (value[i] == '|') value[i] = '\n';
}
- AddString(line, value, ClearOld);
- } else if (line[0] != '\0') AddString(line, "", ClearOld);
+ addString(line, value, clearOld);
+ } else if (line[0] != '\0') addString(line, "", clearOld);
}
delete [] line;
- Pos += LineLength + 1;
+ pos += lineLength + 1;
}
delete [] buffer;
diff --git a/engines/wintermute/Base/BStringTable.h b/engines/wintermute/Base/BStringTable.h
index ea35cf817b..059ff6fec0 100644
--- a/engines/wintermute/Base/BStringTable.h
+++ b/engines/wintermute/Base/BStringTable.h
@@ -37,14 +37,14 @@ namespace WinterMute {
class CBStringTable : public CBBase {
public:
- const char *ExpandStatic(const char *String, bool ForceExpand = false);
- HRESULT loadFile(const char *filename, bool DeleteAll = true);
- void Expand(char **Str, bool ForceExpand = false);
- HRESULT AddString(const char *Key, const char *Val, bool ReportDuplicities = true);
+ const char *expandStatic(const char *string, bool forceExpand = false);
+ HRESULT loadFile(const char *filename, bool deleteAll = true);
+ void expand(char **str, bool forceExpand = false);
+ HRESULT addString(const char *key, const char *val, bool reportDuplicities = true);
CBStringTable(CBGame *inGame);
virtual ~CBStringTable();
Common::HashMap<Common::String, Common::String> _strings;
- char *GetKey(const char *Str);
+ char *getKey(const char *str);
private:
Common::HashMap<Common::String, Common::String>::iterator _stringsIter;