LAB: Make the use of nullptr consistent through the engine

This commit is contained in:
Strangerke 2015-12-16 16:11:06 +01:00 committed by Willem Jan Palenstijn
parent 9c7e372a21
commit 83126e84ee
7 changed files with 27 additions and 28 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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));

View File

@ -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);
}
/**

View File

@ -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;
}
/**

View File

@ -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);

View File

@ -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);