aboutsummaryrefslogtreecommitdiff
path: root/engines/glk
diff options
context:
space:
mode:
authorPaul Gilbert2019-05-11 16:38:31 +1000
committerPaul Gilbert2019-05-11 16:38:31 +1000
commit88b2b3a166333eac02803c0a7231f9f6c9b44c4e (patch)
tree63b954cc84ff46da23cf4e247dc7d882d5073843 /engines/glk
parent96ebd81e5f29e9cde3d83c4af0b9166cd1f40b26 (diff)
downloadscummvm-rg350-88b2b3a166333eac02803c0a7231f9f6c9b44c4e.tar.gz
scummvm-rg350-88b2b3a166333eac02803c0a7231f9f6c9b44c4e.tar.bz2
scummvm-rg350-88b2b3a166333eac02803c0a7231f9f6c9b44c4e.zip
GLK: HUGO: Compilation fixes
Diffstat (limited to 'engines/glk')
-rw-r--r--engines/glk/hugo/hemisc.cpp4
-rw-r--r--engines/glk/hugo/heparse.cpp13
-rw-r--r--engines/glk/hugo/herun.cpp11
-rw-r--r--engines/glk/hugo/hugo.h6
-rw-r--r--engines/glk/hugo/stringfn.cpp6
-rw-r--r--engines/glk/hugo/stringfn.h2
6 files changed, 30 insertions, 12 deletions
diff --git a/engines/glk/hugo/hemisc.cpp b/engines/glk/hugo/hemisc.cpp
index 07800bbcf8..c380fbbe6a 100644
--- a/engines/glk/hugo/hemisc.cpp
+++ b/engines/glk/hugo/hemisc.cpp
@@ -25,6 +25,8 @@
namespace Glk {
namespace Hugo {
+static char EMPTY[1] = { 0 };
+
void Hugo::AP(const char *a) {
char sticky = false, skipspchar = false, startofline = 0;
int i, alen, plen, cwidth;
@@ -461,6 +463,7 @@ int Hugo::CallRoutine(unsigned int addr) {
#endif
arg = 0;
tail_recursion = 0;
+ Common::fill(&temppass[0], &temppass[MAXLOCALS], 0);
/* Pass local variables to routine, if specified */
if (MEM(codeptr)==OPEN_BRACKET_T)
@@ -980,7 +983,6 @@ char *Hugo::GetText(long textaddr) {
char *Hugo::GetWord(unsigned int w) {
char *b;
unsigned short a;
- static char *EMPTY = "";
a = w;
diff --git a/engines/glk/hugo/heparse.cpp b/engines/glk/hugo/heparse.cpp
index 2a70fed89d..0369385398 100644
--- a/engines/glk/hugo/heparse.cpp
+++ b/engines/glk/hugo/heparse.cpp
@@ -27,6 +27,8 @@ namespace Hugo {
#define STARTS_AS_NUMBER(a) (((a[0]>='0' && a[0]<='9') || a[0]=='-')?1:0)
+static char EMPTY[1] = { 0 };
+
void Hugo::AddAllObjects(int loc) {
int i;
@@ -363,7 +365,7 @@ void Hugo::KillWord(int a) {
for (i=a; i<words; i++)
word[i] = word[i+1];
- word[words] = "";
+ word[words] = EMPTY;
RemoveWord(a);
words--;
@@ -371,7 +373,7 @@ void Hugo::KillWord(int a) {
int Hugo::MatchCommand() {
int i, j, flag, a, mw = 0, gotspeaker = 0;
- int wordnum;
+ int wordnum = 0;
int numverbs = 0;
bool nextverb = false;
unsigned int ptr, verbptr, nextgrammar;
@@ -2102,7 +2104,8 @@ NextSyn:
{
if (strcmp(word[i+1], "~and"))
{
- word[i] = "~and";
+ static char *END = "~and";
+ word[i] = END;
wd[i] = FindWord("~and");
}
else
@@ -2112,7 +2115,7 @@ NextSyn:
if (wd[i]==period)
{
wd[i] = 0;
- word[i] = "";
+ word[i] = EMPTY;
}
}
@@ -2331,7 +2334,7 @@ void Hugo::SeparateWords() {
for (i=0; i<MAXWORDS+1; i++)
{
- word[i] = "";
+ word[i] = EMPTY;
wd[i] = 0;
}
word[1] = buffer;
diff --git a/engines/glk/hugo/herun.cpp b/engines/glk/hugo/herun.cpp
index 6466f8829f..8a6d9cd3f7 100644
--- a/engines/glk/hugo/herun.cpp
+++ b/engines/glk/hugo/herun.cpp
@@ -721,7 +721,7 @@ NormalTermination:
#endif
}
-void Hugo::RunIf(char override) {
+void Hugo::RunIf(char ovrride) {
char t, tempinexpr;
long enterptr, skip;
@@ -741,8 +741,7 @@ void Hugo::RunIf(char override) {
codeptr += 2;
/* Check if we've already done an elseif */
- if (override && t==ELSEIF_T)
- {
+ if (ovrride && (t == ELSEIF_T)) {
codeptr = skip+enterptr;
return;
}
@@ -789,7 +788,7 @@ PasstoBlock:
enterptr = codeptr;
codeptr += 2;
- if (override)
+ if (ovrride)
{
codeptr = skip+enterptr;
return;
@@ -2528,7 +2527,7 @@ int Hugo::RunSystem() {
#ifndef NO_STRFTIME
TimeDate td;
g_system->getTimeAndDate(td);
- sprintf(parseerr, "%Y-%m-%d %H:%M:%S", td.tm_year, td.tm_mon, td.tm_mday,
+ sprintf(parseerr, "%d-%.2d-%.2d %d:%.2d:%.2d", td.tm_year, td.tm_mon, td.tm_mday,
td.tm_hour, td.tm_min, td.tm_sec);
#else
hugo_gettimeformatted(parseerr);
@@ -2606,7 +2605,7 @@ void Hugo::RunWindow() {
temp_current_text_y = current_text_y;
tempscript = script;
- script = false;
+ script = nullptr;
restore_default_bgcolor = default_bgcolor;
/* v2.4 is the first version to support proper windowing */
diff --git a/engines/glk/hugo/hugo.h b/engines/glk/hugo/hugo.h
index d022b1f2b0..98fbf9058a 100644
--- a/engines/glk/hugo/hugo.h
+++ b/engines/glk/hugo/hugo.h
@@ -1010,6 +1010,12 @@ private:
return _random.getRandomNumber(0xffffff);
}
+ char *itoa(int value, char *str, int base) {
+ assert(base == 10);
+ sprintf(str, "%d", value);
+ return str;
+ }
+
/**@}*/
private:
/**
diff --git a/engines/glk/hugo/stringfn.cpp b/engines/glk/hugo/stringfn.cpp
index 79886aca87..4e94b3e495 100644
--- a/engines/glk/hugo/stringfn.cpp
+++ b/engines/glk/hugo/stringfn.cpp
@@ -106,5 +106,11 @@ char *StringFunctions::GetTempString() {
return r;
}
+char *StringFunctions::strlwr(char *s) {
+ for (char *sp = s; *sp; ++sp)
+ *sp = tolower(*sp);
+ return s;
+}
+
} // End of namespace Hugo
} // End of namespace Glk
diff --git a/engines/glk/hugo/stringfn.h b/engines/glk/hugo/stringfn.h
index bb339fc047..2ee6e3ed74 100644
--- a/engines/glk/hugo/stringfn.h
+++ b/engines/glk/hugo/stringfn.h
@@ -56,6 +56,8 @@ public:
char *Rtrim(char a[]);
char *hugo_strcpy(char *s, const char *t);
+
+ char *strlwr(char *s);
};