From 83126e84eefc2493732bb2a158c6c41cae15ece4 Mon Sep 17 00:00:00 2001 From: Strangerke Date: Wed, 16 Dec 2015 16:11:06 +0100 Subject: LAB: Make the use of nullptr consistent through the engine --- engines/lab/anim.cpp | 2 +- engines/lab/dispman.cpp | 4 ++-- engines/lab/eventman.cpp | 4 ++-- engines/lab/image.cpp | 4 ++-- engines/lab/music.cpp | 7 +++---- engines/lab/resource.cpp | 28 ++++++++++++++-------------- engines/lab/special.cpp | 6 +++--- 7 files changed, 27 insertions(+), 28 deletions(-) diff --git a/engines/lab/anim.cpp b/engines/lab/anim.cpp index 04da59e1b7..532b242544 100644 --- a/engines/lab/anim.cpp +++ b/engines/lab/anim.cpp @@ -345,7 +345,7 @@ void Anim::readDiff(byte *buffer, bool playOnce, bool onlyDiffData) { return; for (_header = 0; _header < 8; _header++) - _rawDiffBM._planes[_header] = NULL; + _rawDiffBM._planes[_header] = nullptr; if (_headerdata._fps) _delayMicros = 1000 / _headerdata._fps; diff --git a/engines/lab/dispman.cpp b/engines/lab/dispman.cpp index fd7486e3fa..5eae12da73 100644 --- a/engines/lab/dispman.cpp +++ b/engines/lab/dispman.cpp @@ -310,7 +310,7 @@ int DisplayMan::longDrawMessage(const char *str) { if (!str) return 0; - _vm->_event->attachButtonList(NULL); + _vm->_event->attachButtonList(nullptr); _vm->_event->mouseHide(); char newText[512]; @@ -993,7 +993,7 @@ void DisplayMan::doTransWipe(CloseDataPtr *closePtrList, char *filename) { setPen(0); } // for j - if (filename == NULL) + if (!filename) _vm->_curFileName = _vm->getPictName(closePtrList); else if (filename[0] > ' ') _vm->_curFileName = filename; diff --git a/engines/lab/eventman.cpp b/engines/lab/eventman.cpp index ab33e75654..ba473fc67f 100644 --- a/engines/lab/eventman.cpp +++ b/engines/lab/eventman.cpp @@ -88,7 +88,7 @@ Button *EventManager::checkButtonHit(ButtonList *buttonList, Common::Point pos) } } - return NULL; + return nullptr; } void EventManager::attachButtonList(ButtonList *buttonList) { @@ -129,7 +129,7 @@ EventManager::EventManager(LabEngine *vm) : _vm(vm) { void EventManager::mouseHandler(int flag, Common::Point pos) { if (flag & 0x02) { // Left mouse button click - Button *tmp = NULL; + Button *tmp = nullptr; if (_screenButtonList) tmp = checkButtonHit(_screenButtonList, _vm->_isHiRes ? pos : Common::Point(pos.x / 2, pos.y)); diff --git a/engines/lab/image.cpp b/engines/lab/image.cpp index 23a7f8c4d3..1a0383f9dd 100644 --- a/engines/lab/image.cpp +++ b/engines/lab/image.cpp @@ -106,14 +106,14 @@ void Image::blitBitmap(uint16 xs, uint16 ys, Image *imDest, * Draws an image to the screen. */ void Image::drawImage(uint16 x, uint16 y) { - blitBitmap(0, 0, NULL, x, y, _width, _height, false); + blitBitmap(0, 0, nullptr, x, y, _width, _height, false); } /** * Draws an image to the screen with transparency. */ void Image::drawMaskImage(uint16 x, uint16 y) { - blitBitmap(0, 0, NULL, x, y, _width, _height, true); + blitBitmap(0, 0, nullptr, x, y, _width, _height, true); } /** diff --git a/engines/lab/music.cpp b/engines/lab/music.cpp index b9a3f10873..34b70049fd 100644 --- a/engines/lab/music.cpp +++ b/engines/lab/music.cpp @@ -57,7 +57,7 @@ Music::Music(LabEngine *vm) : _vm(vm) { _musicOn = false; _loopSoundEffect = false; - _queuingAudioStream = NULL; + _queuingAudioStream = nullptr; _lastMusicRoom = 1; _doReset = true; _waitTillFinished = false; @@ -180,12 +180,11 @@ void Music::freeMusic() { _musicOn = false; _vm->_mixer->stopHandle(_musicHandle); - _queuingAudioStream = NULL; - + _queuingAudioStream = nullptr; _vm->_mixer->stopHandle(_sfxHandle); delete _file; - _file = NULL; + _file = nullptr; } /** diff --git a/engines/lab/resource.cpp b/engines/lab/resource.cpp index c09d1a6953..932ed8c4f5 100644 --- a/engines/lab/resource.cpp +++ b/engines/lab/resource.cpp @@ -53,10 +53,10 @@ void Resource::readStaticText() { TextFont *Resource::getFont(const char *fileName) { Common::File *dataFile = openDataFile(fileName, MKTAG('V', 'G', 'A', 'F')); - uint32 headerSize = 4L + 2L + 256 * 3 + 4L; + uint32 headerSize = 4 + 2 + 256 * 3 + 4; uint32 fileSize = dataFile->size(); if (fileSize <= headerSize) - return NULL; + return nullptr; _vm->_music->updateMusic(); @@ -247,9 +247,9 @@ RuleList *Resource::readRule(Common::File *file) { Action *Resource::readAction(Common::File *file) { char c; - Action *action = NULL; - Action *prev = NULL; - Action *head = NULL; + Action *action = nullptr; + Action *prev = nullptr; + Action *head = nullptr; do { c = file->readByte(); @@ -276,7 +276,7 @@ Action *Resource::readAction(Common::File *file) { action->_data = (byte *)readString(file); } - action->_nextAction = NULL; + action->_nextAction = nullptr; prev = action; } } while (c == 1); @@ -286,9 +286,9 @@ Action *Resource::readAction(Common::File *file) { CloseData *Resource::readCloseUps(uint16 depth, Common::File *file) { char c; - CloseData *closeup = NULL; - CloseData *prev = NULL; - CloseData *head = NULL; + CloseData *closeup = nullptr; + CloseData *prev = nullptr; + CloseData *head = nullptr; do { c = file->readByte(); @@ -308,7 +308,7 @@ CloseData *Resource::readCloseUps(uint16 depth, Common::File *file) { closeup->_graphicName = readString(file); closeup->_message = readString(file); closeup->_subCloseUps = readCloseUps(depth + 1, file); - closeup->_nextCloseUp = NULL; + closeup->_nextCloseUp = nullptr; prev = closeup; } } while (c != '\0'); @@ -318,9 +318,9 @@ CloseData *Resource::readCloseUps(uint16 depth, Common::File *file) { ViewData *Resource::readView(Common::File *file) { char c; - ViewData *view = NULL; - ViewData *prev = NULL; - ViewData *head = NULL; + ViewData *view = nullptr; + ViewData *prev = nullptr; + ViewData *head = nullptr; do { c = file->readByte(); @@ -334,7 +334,7 @@ ViewData *Resource::readView(Common::File *file) { view->_condition = readConditions(file); view->_graphicName = readString(file); view->_closeUps = readCloseUps(0, file); - view->_nextCondition = NULL; + view->_nextCondition = nullptr; prev = view; } } while (c == 1); diff --git a/engines/lab/special.cpp b/engines/lab/special.cpp index 02bbdf4c07..1008314d4c 100644 --- a/engines/lab/special.cpp +++ b/engines/lab/special.cpp @@ -312,7 +312,7 @@ void LabEngine::doJournal() { drawJournal(0, true); _event->mouseShow(); processJournal(); - _event->attachButtonList(NULL); + _event->attachButtonList(nullptr); _graphics->fade(false, 0); _event->mouseHide(); @@ -400,7 +400,7 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isIntera while (1) { if (isInteractive) { - if (_closeDataPtr == NULL) + if (!_closeDataPtr) _closeDataPtr = startClosePtr; const char *test; @@ -410,7 +410,7 @@ void LabEngine::processMonitor(char *ntext, TextFont *monitorFont, bool isIntera test = _closeDataPtr->_graphicName; if (strcmp(test, _monitorTextFilename)) { - _monitorPage = 0; + _monitorPage = 0; _monitorTextFilename = test; ntext = _resource->getText(_monitorTextFilename); -- cgit v1.2.3