diff options
author | Paul Gilbert | 2019-05-11 16:15:07 +1000 |
---|---|---|
committer | Paul Gilbert | 2019-05-11 16:15:07 +1000 |
commit | 96ebd81e5f29e9cde3d83c4af0b9166cd1f40b26 (patch) | |
tree | e98af72cbb3ca116434f5edd2d2ccd0c745e1161 /engines/glk/hugo | |
parent | 34122d2f47b4a80a26ea4361a35cba50b5ab5cc0 (diff) | |
download | scummvm-rg350-96ebd81e5f29e9cde3d83c4af0b9166cd1f40b26.tar.gz scummvm-rg350-96ebd81e5f29e9cde3d83c4af0b9166cd1f40b26.tar.bz2 scummvm-rg350-96ebd81e5f29e9cde3d83c4af0b9166cd1f40b26.zip |
GLK: HUGO: NULL to nullptr, Amiga compilation fix
Diffstat (limited to 'engines/glk/hugo')
-rw-r--r-- | engines/glk/hugo/heglk.cpp | 38 | ||||
-rw-r--r-- | engines/glk/hugo/hemisc.cpp | 50 | ||||
-rw-r--r-- | engines/glk/hugo/herun.cpp | 36 |
3 files changed, 62 insertions, 62 deletions
diff --git a/engines/glk/hugo/heglk.cpp b/engines/glk/hugo/heglk.cpp index 4884d0f8cf..f6f40814f5 100644 --- a/engines/glk/hugo/heglk.cpp +++ b/engines/glk/hugo/heglk.cpp @@ -52,7 +52,7 @@ void Hugo::hugo_getline(const char *prmpt) { window that hasn't been created, switch as a failsafe to mainwin */ - if (currentwin == NULL) + if (currentwin == nullptr) glk_set_window(currentwin = mainwin); /* Print prompt */ @@ -97,7 +97,7 @@ int Hugo::hugo_waitforkey() { window that hasn't been created, switch as a failsafe to mainwin */ - if (currentwin == NULL) + if (currentwin == nullptr) glk_set_window(currentwin = mainwin); #if defined (NO_KEYPRESS_CURSOR) @@ -211,7 +211,7 @@ void Hugo::hugo_clearwindow() { not really a window */ if (inwindow && currentwin == mainwin) return; - if (currentwin == NULL) return; + if (currentwin == nullptr) return; glk_window_clear(currentwin); @@ -227,7 +227,7 @@ void Hugo::hugo_clearwindow() { stream_result_t sr; glk_window_close(auxwin, &sr); - auxwin = NULL; + auxwin = nullptr; glk_set_window(currentwin = mainwin); } @@ -256,11 +256,11 @@ void Hugo::hugo_settextwindow(int left, int top, int right, int bottom) { in_valid_window = false; /* Glk-illegal floating window; setting currentwin - to NULL will tell hugo_print() not to print in it: + to nullptr will tell hugo_print() not to print in it: */ if (bottom<physical_windowbottom / FIXEDLINEHEIGHT + 1) { - currentwin = NULL; + currentwin = nullptr; glk_set_window(mainwin); return; } @@ -313,7 +313,7 @@ void Hugo::hugo_settextwindow(int left, int top, int right, int bottom) { } else { - currentwin = NULL; + currentwin = nullptr; glk_set_window(mainwin); secondwin_bottom = 0; return; @@ -329,37 +329,37 @@ void Hugo::hugo_settextwindow(int left, int top, int right, int bottom) { } int Hugo::heglk_get_linelength() { - static uint32 width; + static uint width; // Try to use whatever fixed-width linelength is available if (secondwin) - glk_window_get_size(secondwin, &width, NULL); + glk_window_get_size(secondwin, &width, nullptr); else if (auxwin) - glk_window_get_size(auxwin, &width, NULL); + glk_window_get_size(auxwin, &width, nullptr); // Otherwise try to approximate it by the proportionally spaced linelength else - glk_window_get_size(mainwin, &width, NULL); + glk_window_get_size(mainwin, &width, nullptr); // -1 to override automatic line wrapping return width - 1; } int Hugo::heglk_get_screenheight() { - static uint32 height = 0, mainheight = 0; + static uint height = 0, mainheight = 0; if (secondwin) - glk_window_get_size(secondwin, NULL, &height); + glk_window_get_size(secondwin, nullptr, &height); else if (auxwin) - glk_window_get_size(auxwin, NULL, &height); + glk_window_get_size(auxwin, nullptr, &height); - glk_window_get_size(mainwin, NULL, &mainheight); + glk_window_get_size(mainwin, nullptr, &mainheight); return height + mainheight; } void Hugo::hugo_settextpos(int x, int y) { - if (currentwin == NULL) return; + if (currentwin == nullptr) return; // Try to determine if we're trying to position fixed-width text in the main window, // as in a menu, for example @@ -374,7 +374,7 @@ void Hugo::hugo_settextpos(int x, int y) { /* If not, create it, making it 100% of mainwin's height */ - if (auxwin == NULL) + if (auxwin == nullptr) { auxwin = glk_window_open(mainwin, winmethod_Below | winmethod_Proportional, @@ -398,7 +398,7 @@ void Hugo::hugo_settextpos(int x, int y) { /* Close auxwin */ glk_window_close(auxwin, &sr); - auxwin = NULL; + auxwin = nullptr; /* Clear the screen (both windows) */ glk_window_clear(mainwin); @@ -425,7 +425,7 @@ void Hugo::hugo_print(const char *a) { /* Can't print in a Glk-illegal window since it hasn't been created */ - if (currentwin == NULL) return; + if (currentwin == nullptr) return; /* In lieu of colors, in case we're highlighting something such as a menu selection: diff --git a/engines/glk/hugo/hemisc.cpp b/engines/glk/hugo/hemisc.cpp index 4a2ea2557a..07800bbcf8 100644 --- a/engines/glk/hugo/hemisc.cpp +++ b/engines/glk/hugo/hemisc.cpp @@ -734,7 +734,7 @@ if (n==UNKNOWN_OP_E || n==ILLEGAL_OP_E || n==EXPECT_VAL_E || n==OVERFLOW_E) hugo_closefiles(); hugo_blockfree(mem); - mem = NULL; + mem = nullptr; error("Error code: %d", (int)n); } @@ -786,16 +786,16 @@ void Hugo::FileIO() { { #if !defined (GLK) /* stdio implementation */ - if ((io = HUGO_FOPEN(fileiopath, "wb"))==NULL) goto LeaveFileIO; + if ((io = HUGO_FOPEN(fileiopath, "wb"))==nullptr) goto LeaveFileIO; #else /* Glk implementation */ - frefid_t fref = NULL; + frefid_t fref = nullptr; fref = glk_fileref_create_by_name(fileusage_Data | fileusage_BinaryMode, fileiopath, 0); io = glk_stream_open_file(fref, filemode_Write, 0); glk_fileref_destroy(fref); - if (io==NULL) goto LeaveFileIO; + if (io==nullptr) goto LeaveFileIO; #endif ioblock = 1; } @@ -803,16 +803,16 @@ void Hugo::FileIO() { { #if !defined (GLK) /* stdio implementation */ - if ((io = HUGO_FOPEN(fileiopath, "rb"))==NULL) goto LeaveFileIO; + if ((io = HUGO_FOPEN(fileiopath, "rb"))==nullptr) goto LeaveFileIO; #else /* Glk implementation */ - frefid_t fref = NULL; + frefid_t fref = nullptr; fref = glk_fileref_create_by_name(fileusage_Data | fileusage_BinaryMode, fileiopath, 0); io = glk_stream_open_file(fref, filemode_Read, 0); glk_fileref_destroy(fref); - if (io==NULL) goto LeaveFileIO; + if (io==nullptr) goto LeaveFileIO; #endif ioblock = 2; } @@ -834,7 +834,7 @@ void Hugo::FileIO() { if (ioerror) retflag = 0; hugo_fclose(io); - io = NULL; + io = nullptr; ioblock = 0; LeaveFileIO: @@ -1098,16 +1098,16 @@ void Hugo::LoadGame() { #if defined (DEBUGGER) if (!strcmp(gamefile, "")) { - game = NULL; + game = nullptr; strcpy(gamefile, "(no file)"); return; } #endif #if !defined (GLK) /* since in Glk the game stream is always open */ - if ((game = TrytoOpen(gamefile, "rb", "games"))==NULL) + if ((game = TrytoOpen(gamefile, "rb", "games"))==nullptr) { - if ((game = TrytoOpen(gamefile, "rb", "object"))==NULL) + if ((game = TrytoOpen(gamefile, "rb", "object"))==nullptr) FatalError(OPEN_E); } #endif @@ -1154,7 +1154,7 @@ void Hugo::LoadGame() { #endif hugo_closefiles(); hugo_blockfree(mem); - mem = NULL; + mem = nullptr; hugo_exit(line); } @@ -1173,7 +1173,7 @@ void Hugo::LoadGame() { #endif hugo_closefiles(); hugo_blockfree(mem); - mem = NULL; + mem = nullptr; hugo_exit(line); /* ditto */ } @@ -1198,10 +1198,10 @@ void Hugo::LoadGame() { #ifndef LOADGAMEDATA_REPLACED /* Allocate as much memory as is required */ - if ((!loaded_in_memory) || (mem = (unsigned char *)hugo_blockalloc(filelength))==NULL) + if ((!loaded_in_memory) || (mem = (unsigned char *)hugo_blockalloc(filelength))==nullptr) { loaded_in_memory = 0; - if ((mem = (unsigned char *)hugo_blockalloc(codeend))==NULL) + if ((mem = (unsigned char *)hugo_blockalloc(codeend))==nullptr) FatalError(MEMORY_E); } @@ -1321,7 +1321,7 @@ signed char def_slbgcolor = DEF_SLBGCOLOR; void ParseCommandLine(int argc, char *argv[]) { char drive[MAXDRIVE], dir[MAXDIR], fname[MAXFILENAME], ext[MAXEXT]; - char* game_file_arg = NULL; + char* game_file_arg = nullptr; #if defined(GCC_UNIX) && defined(DO_COLOR) int ch; @@ -1345,7 +1345,7 @@ void ParseCommandLine(int argc, char *argv[]) default: Banner(); if (mem) hugo_blockfree(mem); - mem = NULL; + mem = nullptr; exit(0); } } @@ -1358,11 +1358,11 @@ void ParseCommandLine(int argc, char *argv[]) } #endif - if (game_file_arg==NULL) + if (game_file_arg==nullptr) { Banner(); if (mem) hugo_blockfree(mem); - mem = NULL; + mem = nullptr; exit(0); } @@ -1617,7 +1617,7 @@ void Hugo::Printout(char *a, int no_scrollback_linebreak) { hugo_setbackcolor(bgcolor); } -#if defined (AMIGA) +#if defined (AMIGA) && !defined (GLK) else { if (currentpos + l >= physical_windowwidth) @@ -1750,7 +1750,7 @@ void Hugo::PromptMore() { { if (hugo_fclose(playback)) FatalError(READ_E); - playback = NULL; + playback = nullptr; } else if (playback && k=='+') skipping_more = true; @@ -1802,7 +1802,7 @@ int Hugo::RecordCommands() { strcpy(recordfile, line); #else /* Glk implementation */ - frefid_t fref = NULL; + frefid_t fref = nullptr; fref = glk_fileref_create_by_prompt(fileusage_Transcript | fileusage_TextMode, filemode_Write, 0); @@ -1824,7 +1824,7 @@ int Hugo::RecordCommands() { { if (hugo_fclose(record)) return (0); - record = NULL; + record = nullptr; return 1; } break; @@ -1844,7 +1844,7 @@ int Hugo::RecordCommands() { strcpy(recordfile, line); #else /* Glk implementation */ - frefid_t fref = NULL; + frefid_t fref = nullptr; fref = glk_fileref_create_by_prompt(fileusage_InputRecord | fileusage_TextMode, filemode_Read, 0); @@ -2173,7 +2173,7 @@ HUGO_FILE TrytoOpen(char *f, char *p, char *d) } } - return NULL; /* return NULL if not openable */ + return nullptr; /* return nullptr if not openable */ } #endif /* GLK */ diff --git a/engines/glk/hugo/herun.cpp b/engines/glk/hugo/herun.cpp index 43837977d5..6466f8829f 100644 --- a/engines/glk/hugo/herun.cpp +++ b/engines/glk/hugo/herun.cpp @@ -163,7 +163,7 @@ RestartDebugger: /* If no gamefile is loaded, jump immediately to the debugger interrupt function. */ - if (game==NULL) Debugger(); + if (game==nullptr) Debugger(); #endif stack_depth = RESET_STACK_DEPTH; @@ -271,7 +271,7 @@ FreshInput: { if (hugo_fclose(playback)) FatalError(READ_E); - playback = NULL; + playback = nullptr; GetCommand(); } else @@ -635,7 +635,7 @@ EndofCommand: if (playback) { if (hugo_fclose(playback)) FatalError(READ_E); - playback = NULL; + playback = nullptr; } Flushpbuffer(); @@ -702,7 +702,7 @@ NormalTermination: debugger_collapsing = false; - if ((game!=NULL) && !RunRestart()) + if ((game!=nullptr) && !RunRestart()) DebugMessageBox("Restart Error", "Unable to restart"); SwitchtoGame(); @@ -1115,7 +1115,7 @@ int Hugo::RunRestart() { { if (hugo_fclose(playback)) FatalError(READ_E); - playback = NULL; + playback = nullptr; } if (active_screen!=DEBUGGER) @@ -1169,7 +1169,7 @@ int Hugo::RestoreGameData() { { AP("Incorrect save file."); if (hugo_fclose(save)) FatalError(READ_E); - save = NULL; + save = nullptr; return 0; } @@ -1179,7 +1179,7 @@ int Hugo::RestoreGameData() { { AP("Save file created by different version."); if (hugo_fclose(save)) FatalError(READ_E); - save = NULL; + save = nullptr; return 0; } @@ -1258,7 +1258,7 @@ RestoreError: int Hugo::RunRestore() { #if !defined (GLK) - save = NULL; + save = nullptr; /* stdio implementation */ hugo_getfilename("to restore", savefile); @@ -1273,7 +1273,7 @@ int Hugo::RunRestore() { /* Glk implementation */ frefid_t savefile; - save = NULL; + save = nullptr; savefile = glk_fileref_create_by_prompt(fileusage_SavedGame | fileusage_BinaryMode, filemode_Read, 0); @@ -1281,7 +1281,7 @@ int Hugo::RunRestore() { if (glk_fileref_does_file_exist(savefile)) save = glk_stream_open_file(savefile, filemode_Read, 0); else - save = NULL; + save = nullptr; glk_fileref_destroy(savefile); if (!save) return 0; @@ -1290,7 +1290,7 @@ int Hugo::RunRestore() { if (!RestoreGameData()) goto RestoreError; if (hugo_fclose(save)) FatalError(READ_E); - save = NULL; + save = nullptr; #if !defined (GLK) strcpy(savefile, line); @@ -1302,7 +1302,7 @@ int Hugo::RunRestore() { RestoreError: if ((save) && hugo_fclose(save)) FatalError(READ_E); - save = NULL; + save = nullptr; game_reset = false; return 0; } @@ -1413,7 +1413,7 @@ void Hugo::RunRoutine(long addr) { } /* If not object.property or an event */ - if (strchr(debug_line, '.')==NULL && strstr(debug_line, "vent ")==NULL) + if (strchr(debug_line, '.')==nullptr && strstr(debug_line, "vent ")==nullptr) { strcat(debug_line, "("); for (i=0; i<arguments_passed; i++) @@ -2302,7 +2302,7 @@ int Hugo::RunSave() { #endif #if !defined (GLK) - save = NULL; + save = nullptr; /* stdio implementation */ hugo_getfilename("to save", savefile); @@ -2319,7 +2319,7 @@ int Hugo::RunSave() { /* Glk implementation */ frefid_t savefile; - save = NULL; + save = nullptr; savefile = glk_fileref_create_by_prompt(fileusage_SavedGame | fileusage_BinaryMode, filemode_Write, 0); @@ -2333,7 +2333,7 @@ int Hugo::RunSave() { if (!SaveGameData()) goto SaveError; if (hugo_fclose(save)) FatalError(WRITE_E); - save = NULL; + save = nullptr; #if !defined (GLK) strcpy(savefile, line); @@ -2343,7 +2343,7 @@ int Hugo::RunSave() { SaveError: if ((save) && hugo_fclose(save)) FatalError(WRITE_E); - save = NULL; + save = nullptr; return 0; } @@ -2388,7 +2388,7 @@ int Hugo::RunScriptSet() { if (script) { if (hugo_fclose(script)) return (0); - script = NULL; + script = nullptr; return 1; } break; |