aboutsummaryrefslogtreecommitdiff
path: root/engines/glk/alan2
diff options
context:
space:
mode:
Diffstat (limited to 'engines/glk/alan2')
-rw-r--r--engines/glk/alan2/execute.cpp10
-rw-r--r--engines/glk/alan2/parse.cpp40
-rw-r--r--engines/glk/alan2/parse.h2
-rw-r--r--engines/glk/alan2/saveload.cpp8
4 files changed, 30 insertions, 30 deletions
diff --git a/engines/glk/alan2/execute.cpp b/engines/glk/alan2/execute.cpp
index 8359c47e37..4fc0acb33b 100644
--- a/engines/glk/alan2/execute.cpp
+++ b/engines/glk/alan2/execute.cpp
@@ -234,7 +234,7 @@ bool Execute::confirm(MsgKind msgno) {
#ifdef USE_READLINE
if (!readline(buf)) return true;
#else
- if (gets(buf) == NULL) return true;
+ if (gets(buf) == nullptr) return true;
#endif
#endif
@@ -260,7 +260,7 @@ void Execute::quit() {
#ifdef USE_READLINE
if (!readline(buf)) terminate(0);
#else
- if (gets(buf) == NULL) terminate(0);
+ if (gets(buf) == nullptr) terminate(0);
#endif
#endif
@@ -682,17 +682,17 @@ void Execute::dscrobj(Aword obj) {
void Execute::dscract(Aword act) {
- ScrElem *scr = NULL;
+ ScrElem *scr = nullptr;
if (_acts[act - ACTMIN].script != 0) {
for (scr = (ScrElem *) addrTo(_acts[act - ACTMIN].scradr); !endOfTable(scr); scr++)
if (scr->code == _acts[act - ACTMIN].script)
break;
if (endOfTable(scr))
- scr = NULL;
+ scr = nullptr;
}
- if (scr != NULL && scr->dscr != 0)
+ if (scr != nullptr && scr->dscr != 0)
_vm->_interpreter->interpret(scr->dscr);
else if (_acts[act - ACTMIN].dscr != 0)
_vm->_interpreter->interpret(_acts[act - ACTMIN].dscr);
diff --git a/engines/glk/alan2/parse.cpp b/engines/glk/alan2/parse.cpp
index aac858a062..8e6427d09c 100644
--- a/engines/glk/alan2/parse.cpp
+++ b/engines/glk/alan2/parse.cpp
@@ -75,7 +75,7 @@ char *Parser::gettoken(char *tokenBuffer) {
static char *marker;
static char oldch;
- if (tokenBuffer == NULL)
+ if (tokenBuffer == nullptr)
*marker = oldch;
else
marker = tokenBuffer;
@@ -92,7 +92,7 @@ char *Parser::gettoken(char *tokenBuffer) {
while (*marker != '\"') marker++;
marker++;
} else if (*marker == '\0' || *marker == '\n')
- return NULL;
+ return nullptr;
else
marker++;
@@ -128,7 +128,7 @@ void Parser::agetline() {
quit();
}
#else
- if (fgets(buf, LISTLEN, stdin) == NULL) {
+ if (fgets(buf, LISTLEN, stdin) == nullptr) {
newline();
quit();
}
@@ -148,12 +148,12 @@ void Parser::agetline() {
token = gettoken(isobuf);
- if (token != NULL && strcmp("debug", token) == 0 && _vm->header->debug) {
+ if (token != nullptr && strcmp("debug", token) == 0 && _vm->header->debug) {
dbgflg = true;
debug();
- token = NULL;
+ token = nullptr;
}
- } while (token == NULL);
+ } while (token == nullptr);
eol = false;
lin = 1;
@@ -212,7 +212,7 @@ void Parser::scan() {
unknown(token);
wrds[i] = EOF;
- eol = (token = gettoken(NULL)) == NULL;
+ eol = (token = gettoken(nullptr)) == nullptr;
} while (!eol);
}
@@ -377,10 +377,10 @@ void Parser::unambig(ParamElem plst[]) {
static ParamElem *savlst; // Saved list for backup at EOF
int firstWord, lastWord; // The words the player used
- if (refs == NULL)
+ if (refs == nullptr)
refs = new ParamElem[MAXENTITY + 1];
- if (savlst == NULL)
+ if (savlst == nullptr)
savlst = new ParamElem[MAXENTITY + 1];
if (isLiteral(wrds[wrdidx])) {
@@ -490,12 +490,12 @@ void Parser::unambig(ParamElem plst[]) {
}
void Parser::simple(ParamElem olst[]) {
- static ParamElem *tlst = NULL;
+ static ParamElem *tlst = nullptr;
int savidx = wrdidx;
bool savplur = false;
int i;
- if (tlst == NULL)
+ if (tlst == nullptr)
tlst = new ParamElem[MAXENTITY + 1];
tlst[0].code = (Aword)EOF;
@@ -549,9 +549,9 @@ void Parser::complex(ParamElem olst[]) {
// they work on words.Below all is converted to indices into the
// entity tables.Particularly this goes for literals...
- static ParamElem *alst = NULL;
+ static ParamElem *alst = nullptr;
- if (alst == NULL)
+ if (alst == nullptr)
alst = new ParamElem[MAXENTITY + 1];
if (isAll(wrds[wrdidx])) {
@@ -653,18 +653,18 @@ AltElem *Parser::findalt(Aword vrbsadr, Aword param) {
AltElem *alt;
if (vrbsadr == 0)
- return NULL;
+ return nullptr;
for (vrb = (VrbElem *)addrTo(vrbsadr); !endOfTable(vrb); vrb++) {
if ((int)vrb->code == _vm->cur.vrb) {
for (alt = (AltElem *)addrTo(vrb->alts); !endOfTable(alt); alt++)
if (alt->param == param || alt->param == 0)
return alt;
- return NULL;
+ return nullptr;
}
}
- return NULL;
+ return nullptr;
}
bool Parser::trycheck(Aaddr adr, bool act) {
@@ -732,10 +732,10 @@ void Parser::tryMatch(ParamElem mlstArr[]) {
ClaElem *cla; // Pointer to class definitions
bool anyPlural = false; // Any parameter that was plural?
int i, p;
- static ParamElem *tlst = NULL; // List of params found by complex()
- static bool *checked = NULL; // Corresponding parameter checked?
+ static ParamElem *tlst = nullptr; // List of params found by complex()
+ static bool *checked = nullptr; // Corresponding parameter checked?
- if (tlst == NULL) {
+ if (tlst == nullptr) {
tlst = new ParamElem[MAXENTITY + 1];
checked = new bool[MAXENTITY + 1];
}
@@ -930,7 +930,7 @@ void Parser::action(ParamElem plst[]) {
}
void Parser::parse() {
- if (mlst == NULL) { // Allocate large enough paramlists
+ if (mlst == nullptr) { // Allocate large enough paramlists
mlst = new ParamElem[MAXENTITY + 1];
mlst[0].code = (Aword)EOF;
pmlst = new ParamElem[MAXENTITY + 1];
diff --git a/engines/glk/alan2/parse.h b/engines/glk/alan2/parse.h
index 1e3601c773..c5b223baa0 100644
--- a/engines/glk/alan2/parse.h
+++ b/engines/glk/alan2/parse.h
@@ -71,7 +71,7 @@ private:
int listLength(ParamElem a[]);
/**
- * Compact a list, i.e remove any NULL elements
+ * Compact a list, i.e remove any nullptr elements
*/
void listCompact(ParamElem a[]);
diff --git a/engines/glk/alan2/saveload.cpp b/engines/glk/alan2/saveload.cpp
index 2d92d34591..838c2588a1 100644
--- a/engines/glk/alan2/saveload.cpp
+++ b/engines/glk/alan2/saveload.cpp
@@ -39,7 +39,7 @@ void SaveLoad::save() {
// TODO
#if 0
frefid_t fref = glk_fileref_create_by_prompt(fileusage_SavedGame, filemode_Write, 0);
- if (fref == NULL)
+ if (fref == nullptr)
_vm->printError(M_SAVEFAILED);
strcpy(str, garglk_fileref_get_name(fref));
@@ -53,12 +53,12 @@ void SaveLoad::save() {
// TODO
#if 0
- if ((savfil = fopen(str, READ_MODE)) != NULL)
+ if ((savfil = fopen(str, READ_MODE)) != nullptr)
// It already existed
if (!confirm(M_SAVEOVERWRITE))
_vm->printError(MSGMAX); // Return to player without saying anything
- if ((savfil = fopen(str, WRITE_MODE)) == NULL)
+ if ((savfil = fopen(str, WRITE_MODE)) == nullptr)
_vm->printError(M_SAVEFAILED);
#endif
@@ -124,7 +124,7 @@ void SaveLoad::restore() {
// TODO
#if 0
frefid_t fref = glk_fileref_create_by_prompt(fileusage_SavedGame, filemode_Read, 0);
- if (fref == NULL)
+ if (fref == nullptr)
_vm->printError(M_SAVEFAILED);
strcpy(str, garglk_fileref_get_name(fref));