BURIED: Make more consistent use of nullptr

This commit is contained in:
Strangerke 2021-03-17 23:04:12 +01:00 committed by Eugene Sandulenko
parent d1373e8691
commit e798795cee
17 changed files with 79 additions and 78 deletions

View File

@ -44,7 +44,7 @@ namespace Buried {
BioChipRightWindow::BioChipRightWindow(BuriedEngine *vm, Window *parent) : Window(vm, parent) {
_curBioChip = kItemBioChipInterface;
_status = 0;
_bioChipViewWindow = 0;
_bioChipViewWindow = nullptr;
_forceHelp = false;
_forceComment = false;
_jumpInProgress = false;
@ -103,7 +103,7 @@ bool BioChipRightWindow::destroyBioChipViewWindow() {
_vm->_sound->timerCallback();
delete _bioChipViewWindow;
_bioChipViewWindow = 0;
_bioChipViewWindow = nullptr;
_vm->_sound->timerCallback();
((GameUIWindow *)_parent)->_sceneViewWindow->bioChipWindowDisplayed(false);

View File

@ -49,15 +49,15 @@
namespace Buried {
BuriedEngine::BuriedEngine(OSystem *syst, const ADGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc) {
_gfx = 0;
_mainEXE = 0;
_library = 0;
_sound = 0;
_gfx = nullptr;
_mainEXE = nullptr;
_library = nullptr;
_sound = nullptr;
_timerSeed = 0;
_mainWindow = 0;
_focusedWindow = 0;
_captureWindow = 0;
_console = 0;
_mainWindow = nullptr;
_focusedWindow = nullptr;
_captureWindow = nullptr;
_console = nullptr;
_pauseStartTime = 0;
_yielding = false;

View File

@ -57,9 +57,9 @@ CompletionWindow::CompletionWindow(BuriedEngine *vm, Window *parent, GlobalFlags
_vm->_sound->setAmbientSound();
_status = 0;
_background = 0;
_background = nullptr;
_currentSoundEffectID = -1;
_gageVideo = 0;
_gageVideo = nullptr;
_rect = Common::Rect(0, 0, 640, 480);
@ -238,7 +238,7 @@ void CompletionWindow::onTimer(uint timer) {
case 2:
if (!_gageVideo || _gageVideo->getMode() == VideoWindow::kModeStopped) {
delete _gageVideo;
_gageVideo = 0;
_gageVideo = nullptr;
_status = 3;
_background = _vm->_gfx->getBitmap(_vm->isTrueColor() ? "BITDATA/FUTAPT/ENDING24.BTS" : "BITDATA/FUTAPT/ENDING8.BTS");
@ -259,7 +259,7 @@ void CompletionWindow::onLButtonUp(const Common::Point &point, uint flags) {
if (_background) {
_background->free();
delete _background;
_background = 0;
_background = nullptr;
}
invalidateWindow(false);
@ -277,7 +277,7 @@ void CompletionWindow::onLButtonUp(const Common::Point &point, uint flags) {
case 2:
if (!_gageVideo || _gageVideo->getMode() == VideoWindow::kModeStopped) {
delete _gageVideo;
_gageVideo = 0;
_gageVideo = nullptr;
_status = 4;
_background = _vm->_gfx->getBitmap(_vm->isTrueColor() ? "BITDATA/FUTAPT/ENDING24.BTS" : "BITDATA/FUTAPT/ENDING8.BTS");

View File

@ -514,7 +514,7 @@ TransporterControls::~TransporterControls() {
void TransporterControls::preDestructor() {
delete _textFont;
_textFont = 0;
_textFont = nullptr;
}
int TransporterControls::postExitRoom(Window *viewWindow, const Location &newLocation) {

View File

@ -1052,7 +1052,7 @@ ScienceWingPanelInterface::~ScienceWingPanelInterface() {
void ScienceWingPanelInterface::preDestructor() {
delete _textFont;
_textFont = 0;
_textFont = nullptr;
}
int ScienceWingPanelInterface::mouseUp(Window *viewWindow, const Common::Point &pointLocation) {
@ -2065,7 +2065,7 @@ CapacitancePanelInterface::~CapacitancePanelInterface() {
void CapacitancePanelInterface::preDestructor() {
delete _textFont;
_textFont = 0;
_textFont = nullptr;
}
int CapacitancePanelInterface::mouseUp(Window *viewWindow, const Common::Point &pointLocation) {
@ -2947,7 +2947,7 @@ ScanningRoomNexusDoorCodePad::~ScanningRoomNexusDoorCodePad() {
void ScanningRoomNexusDoorCodePad::preDestructor() {
delete _textFont;
_textFont = 0;
_textFont = nullptr;
}
int ScanningRoomNexusDoorCodePad::postEnterRoom(Window *viewWindow, const Location &priorLocation) {

View File

@ -1753,7 +1753,7 @@ AimBallistaAwayFromTower::~AimBallistaAwayFromTower() {
void AimBallistaAwayFromTower::preDestructor() {
delete _viewFrameExtractor;
_viewFrameExtractor = 0;
_viewFrameExtractor = nullptr;
}
int AimBallistaAwayFromTower::paint(Window *viewWindow, Graphics::Surface *preBuffer) {
@ -2130,7 +2130,7 @@ AimBallistaToTower::~AimBallistaToTower() {
void AimBallistaToTower::preDestructor() {
delete _viewFrameExtractor;
_viewFrameExtractor = 0;
_viewFrameExtractor = nullptr;
}
int AimBallistaToTower::paint(Window *viewWindow, Graphics::Surface *preBuffer) {

View File

@ -301,7 +301,7 @@ KitchenUnitAutoChef::~KitchenUnitAutoChef() {
void KitchenUnitAutoChef::preDestructor() {
delete _textFont;
_textFont = 0;
_textFont = nullptr;
}
int KitchenUnitAutoChef::mouseUp(Window *viewWindow, const Common::Point &pointLocation) {
@ -400,7 +400,7 @@ KitchenUnitShopNet::~KitchenUnitShopNet() {
void KitchenUnitShopNet::preDestructor() {
delete _textFont;
_textFont = 0;
_textFont = nullptr;
}
int KitchenUnitShopNet::mouseUp(Window *viewWindow, const Common::Point &pointLocation) {
@ -672,7 +672,7 @@ KitchenUnitPostBox::~KitchenUnitPostBox() {
void KitchenUnitPostBox::preDestructor() {
delete _textFont;
_textFont = 0;
_textFont = nullptr;
}
int KitchenUnitPostBox::mouseUp(Window *viewWindow, const Common::Point &pointLocation) {

View File

@ -41,7 +41,7 @@ SceneBase::SceneBase(BuriedEngine *vm, Window *viewWindow, const LocationStaticD
}
int SceneBase::paint(Window *viewWindow, Graphics::Surface *preBuffer) {
const Graphics::Surface *newFrame = 0;
const Graphics::Surface *newFrame = nullptr;
if (_frameCycleCount >= 0) {
newFrame = ((SceneViewWindow *)viewWindow)->getCycleFrame(_frameCycleCount);

View File

@ -52,7 +52,7 @@ namespace Buried {
FrameWindow::FrameWindow(BuriedEngine *vm) : Window(vm, 0) {
// Initialize member variables
_mainChildWindow = 0;
_mainChildWindow = nullptr;
_controlDown = false;
_cacheFrames = false;
_cycleDefault = true;
@ -132,7 +132,7 @@ bool FrameWindow::showMainMenu() {
// If we still have a child window, delete it now
delete _mainChildWindow;
_mainChildWindow = 0;
_mainChildWindow = nullptr;
_vm->_sound->restart();
@ -161,7 +161,7 @@ bool FrameWindow::returnToMainMenu() {
// If we still have a child window, delete it now
delete _mainChildWindow;
_mainChildWindow = 0;
_mainChildWindow = nullptr;
// Create and show the main menu window
if (_vm->isDemo()) {
@ -205,7 +205,7 @@ bool FrameWindow::showClosingScreen() {
// If we still have a child window, delete it now
delete _mainChildWindow;
_mainChildWindow = 0;
_mainChildWindow = nullptr;
// Create the window
_mainChildWindow = new TitleSequenceWindow(_vm, this);

View File

@ -62,7 +62,7 @@ GraphicsManager::GraphicsManager(BuriedEngine *vm) : _vm(vm) {
if (_vm->isTrueColor()) {
// No palette to deal with
_palette = 0;
_palette = nullptr;
} else {
// Grab the palette from our EXE bitmap
_palette = createDefaultPalette();
@ -199,7 +199,7 @@ Graphics::Font *GraphicsManager::createArialFont(int size, bool bold) const {
// Enable code page mapping only if we don't have iconv. Otherwise, we'll
// let that handle mapping for us.
#ifdef USE_ICONV
static const uint32 *codePageMapping = 0;
static const uint32 *codePageMapping = nullptr;
#else
static const uint32 *codePageMapping = s_codePage1252;
#endif
@ -232,8 +232,8 @@ Cursor GraphicsManager::setCursor(Cursor newCursor) {
return _curCursor;
Cursor oldCursor = _curCursor;
Graphics::Cursor *cursor = 0;
Graphics::WinCursorGroup *cursorGroup = 0;
Graphics::Cursor *cursor = nullptr;
Graphics::WinCursorGroup *cursorGroup = nullptr;
if (newCursor == kCursorArrow) {
cursor = Graphics::makeDefaultWinCursor();
@ -602,10 +602,11 @@ Graphics::Surface *GraphicsManager::remapPalettedFrame(const Graphics::Surface *
Graphics::Surface *convertedSurface = new Graphics::Surface();
convertedSurface->create(frame->w, frame->h, frame->format);
for (int y = 0; y < frame->h; y++)
for (int y = 0; y < frame->h; y++) {
for (int x = 0; x < frame->w; x++)
*((byte *)convertedSurface->getBasePtr(x, y)) = palMap[*((const byte *)frame->getBasePtr(x, y))];
}
return convertedSurface;
}
@ -732,7 +733,7 @@ void GraphicsManager::drawEllipse(const Common::Rect &rect, uint32 color) {
static const int rows12[12] = { 7, 11, 13, 13, 15, 15, 15, 15, 13, 13, 11, 7 };
static const int rows15[15] = { 5, 9, 11, 13, 13, 15, 15, 15, 15, 15, 13, 13, 11, 9, 5 };
const int *table = 0;
const int *table = nullptr;
switch (rect.height()) {
case 7:
table = rows7;

View File

@ -133,7 +133,7 @@ BurnedLetterViewWindow::BurnedLetterViewWindow(BuriedEngine *vm, Window *parent,
_curView = 0;
_translatedTextResourceID = IDBD_BLETTER_TRANS_TEXT_BASE;
_curLineIndex = -1;
_preBuffer = 0;
_preBuffer = nullptr;
_rect = Common::Rect(0, 0, 432, 189);

View File

@ -43,7 +43,7 @@
namespace Buried {
InventoryWindow::InventoryWindow(BuriedEngine *vm, Window *parent) : Window(vm, parent) {
_background = 0;
_background = nullptr;
_magSelected = false;
_upSelected = false;
_downSelected = false;
@ -51,7 +51,7 @@ InventoryWindow::InventoryWindow(BuriedEngine *vm, Window *parent) : Window(vm,
_itemComesFromInventory = false;
_draggingObject = false;
_draggingItemID = -1;
_draggingItemSpriteData.image = 0;
_draggingItemSpriteData.image = nullptr;
_draggingIconIndex = 0;
_draggingItemInInventory = false;
@ -71,8 +71,8 @@ InventoryWindow::InventoryWindow(BuriedEngine *vm, Window *parent) : Window(vm,
_curItem = 0;
_infoWindow = 0;
_letterViewWindow = 0;
_infoWindow = nullptr;
_letterViewWindow = nullptr;
_scrollTimer = 0;
@ -285,7 +285,7 @@ bool InventoryWindow::destroyBurnedLetterWindow() {
return false;
delete _letterViewWindow;
_letterViewWindow = 0;
_letterViewWindow = nullptr;
((GameUIWindow *)_parent)->_sceneViewWindow->burnedLetterWindowDisplayed(false);
@ -589,7 +589,7 @@ void InventoryWindow::onLButtonUp(const Common::Point &point, uint flags) {
addItem(_draggingItemID);
}
_draggingItemSpriteData.image = 0;
_draggingItemSpriteData.image = nullptr;
((GameUIWindow *)getParent())->_sceneViewWindow->updatePrebufferWithSprite(_draggingItemSpriteData);
_itemComesFromInventory = false;
@ -758,7 +758,7 @@ bool InventoryWindow::destroyInfoWindow() {
return false;
delete _infoWindow;
_infoWindow = 0;
_infoWindow = nullptr;
((GameUIWindow *)_parent)->_sceneViewWindow->infoWindowDisplayed(false);

View File

@ -35,7 +35,7 @@
namespace Buried {
OverviewWindow::OverviewWindow(BuriedEngine *vm, Window *parent) : Window(vm, parent) {
_currentImage = 0;
_currentImage = nullptr;
_currentStatus = -1;
_timer = 0xFFFFFFFF;
@ -119,7 +119,7 @@ void OverviewWindow::onTimer(uint timer) {
if (_currentImage) {
_currentImage->free();
delete _currentImage;
_currentImage = 0;
_currentImage = nullptr;
}
// Switch on the current status in order to determine which action to take next

View File

@ -46,17 +46,17 @@
namespace Buried {
SceneViewWindow::SceneViewWindow(BuriedEngine *vm, Window *parent) : Window(vm, parent) {
_currentScene = 0;
_preBuffer = 0;
_walkMovie = 0;
_currentScene = nullptr;
_preBuffer = nullptr;
_walkMovie = nullptr;
_useScenePaint = true;
_timer = 0;
_currentSprite.image = 0;
_currentSprite.image = nullptr;
_useSprite = true;
_infoWindowDisplayed = false;
_bioChipWindowDisplayed = false;
_burnedLetterDisplayed = false;
_asyncMovie = 0;
_asyncMovie = nullptr;
_asyncMovieStartFrame = 0;
_loopAsyncMovie = false;
_paused = false;
@ -370,7 +370,7 @@ bool SceneViewWindow::jumpToScene(const Location &newLocation) {
if (_currentScene) {
_currentScene->preDestructor();
delete _currentScene;
_currentScene = 0;
_currentScene = nullptr;
}
if (newLocation.timeZone != oldLocation.timeZone || newLocation.environment != oldLocation.environment || oldLocation.timeZone < 0)
@ -450,7 +450,7 @@ bool SceneViewWindow::jumpToSceneRestore(const Location &newLocation) {
if (_currentScene) {
_currentScene->preDestructor();
delete _currentScene;
_currentScene = 0;
_currentScene = nullptr;
}
// Change the ambient music
@ -1045,7 +1045,7 @@ bool SceneViewWindow::videoTransition(const Location &location, DestinationScene
changeStillFrameMovie(_vm->getFilePath(destinationStaticData.location.timeZone, destinationStaticData.location.environment, SF_STILLS));
Graphics::Surface *newBackground = 0;
Graphics::Surface *newBackground = nullptr;
if (destinationStaticData.navFrameIndex >= 0)
newBackground = getStillFrameCopy(navFrame);
@ -1090,7 +1090,7 @@ bool SceneViewWindow::videoTransition(const Location &location, DestinationScene
bool SceneViewWindow::walkTransition(const Location &location, const DestinationScene &destinationData, int navFrame) {
_paused = true;
TempCursorChange cursorChange(kCursorWait);
Graphics::Surface *newBackground = 0;
Graphics::Surface *newBackground = nullptr;
if (navFrame >= 0) {
changeStillFrameMovie(_vm->getFilePath(destinationData.destinationScene.timeZone, destinationData.destinationScene.environment, SF_STILLS));
@ -1771,7 +1771,7 @@ bool SceneViewWindow::stopAsynchronousAnimation() {
_currentScene->movieCallback(this, _asyncMovie, 0, MOVIE_STOPPED);
delete _asyncMovie;
_asyncMovie = 0;
_asyncMovie = nullptr;
_asyncMovieFileName.clear();
_asyncMovieStartFrame = 0;
_asyncMovieFrameCount = 0;
@ -1828,7 +1828,7 @@ bool SceneViewWindow::startPlacedAsynchronousAnimation(int left, int top, int wi
if (_walkMovie) {
delete _walkMovie;
_walkMovie = 0;
_walkMovie = nullptr;
_walkMovieFileName.clear();
}
@ -1837,7 +1837,7 @@ bool SceneViewWindow::startPlacedAsynchronousAnimation(int left, int top, int wi
if (animDatabase.empty())
return false;
const AnimEvent *animData = 0;
const AnimEvent *animData = nullptr;
for (uint i = 0; i < animDatabase.size() && !animData; i++)
if (animDatabase[i].animationID == animationID)
@ -1887,7 +1887,7 @@ bool SceneViewWindow::startPlacedAsynchronousAnimation(int left, int top, int wi
if (_walkMovie) {
delete _walkMovie;
_walkMovie = 0;
_walkMovie = nullptr;
_walkMovieFileName.clear();
}
@ -1932,7 +1932,7 @@ bool SceneViewWindow::startPlacedAsynchronousAnimationExtern(int left, int top,
if (_walkMovie) {
delete _walkMovie;
_walkMovie = 0;
_walkMovie = nullptr;
_walkMovieFileName.clear();
}
@ -2315,7 +2315,7 @@ bool SceneViewWindow::checkForAIComment(const Location &commentLocation, int com
bool SceneViewWindow::infoWindowDisplayed(bool flag) {
if (flag && !_walkMovie) {
delete _walkMovie;
_walkMovie = 0;
_walkMovie = nullptr;
_walkMovieFileName.clear();
changeCycleFrameMovie();
}
@ -2337,7 +2337,7 @@ bool SceneViewWindow::infoWindowDisplayed(bool flag) {
bool SceneViewWindow::bioChipWindowDisplayed(bool flag) {
if (flag && !_walkMovie) {
delete _walkMovie;
_walkMovie = 0;
_walkMovie = nullptr;
_walkMovieFileName.clear();
changeCycleFrameMovie();
}
@ -2359,7 +2359,7 @@ bool SceneViewWindow::bioChipWindowDisplayed(bool flag) {
bool SceneViewWindow::burnedLetterWindowDisplayed(bool flag) {
if (flag && !_walkMovie) {
delete _walkMovie;
_walkMovie = 0;
_walkMovie = nullptr;
_walkMovieFileName.clear();
changeCycleFrameMovie();
}

View File

@ -680,8 +680,8 @@ void SoundManager::timerCallback() {
}
SoundManager::Sound::Sound() {
_soundData = 0;
_handle = 0;
_soundData = nullptr;
_handle = nullptr;
_volume = 127;
_loop = false;
@ -749,7 +749,7 @@ bool SoundManager::Sound::stop() {
g_system->getMixer()->stopHandle(*_handle);
delete _handle;
_handle = 0;
_handle = nullptr;
return true;
}

View File

@ -36,8 +36,8 @@ namespace Buried {
TitleSequenceWindow::TitleSequenceWindow(BuriedEngine *vm, Window *parent) : Window(vm, parent) {
// Initialize member variables
_currentBackground = 0;
_currentMovie = 0;
_currentBackground = nullptr;
_currentMovie = nullptr;
_exitNow = false;
_currentAnimation = 0;
@ -72,7 +72,7 @@ bool TitleSequenceWindow::playTitleSequence() {
if (!_currentMovie->openVideo(_vm->getFilePath(IDS_TITLE_SW_LOGO_FILENAME))) {
delete _currentMovie;
_currentMovie = 0;
_currentMovie = nullptr;
((FrameWindow *)_parent)->returnToMainMenu();
return false;
}
@ -91,7 +91,7 @@ bool TitleSequenceWindow::playTitleSequence() {
if (!_currentMovie->openVideo(_vm->getFilePath(IDS_TITLE_PRESTO_LOGO_FILENAME))) {
delete _currentMovie;
_currentMovie = 0;
_currentMovie = nullptr;
((FrameWindow *)_parent)->returnToMainMenu();
return false;
}
@ -109,7 +109,7 @@ bool TitleSequenceWindow::playTitleSequence() {
if (!_currentMovie->openVideo(_vm->getFilePath(IDS_TITLE_MOVIE_FILENAME))) {
delete _currentMovie;
_currentMovie = 0;
_currentMovie = nullptr;
((FrameWindow *)_parent)->returnToMainMenu();
return false;
}
@ -161,11 +161,11 @@ void TitleSequenceWindow::onTimer(uint timer) {
if (_currentBackground) {
_currentBackground->free();
delete _currentBackground;
_currentBackground = 0;
_currentBackground = nullptr;
}
delete _currentMovie;
_currentMovie = 0;
_currentMovie = nullptr;
// Clean out the input queue
_exitNow = false;

View File

@ -33,7 +33,7 @@ namespace Buried {
VideoWindow::VideoWindow(BuriedEngine *vm, Window *parent) : Window(vm, parent), _video(0), _mode(kModeClosed), _lastFrame(0) {
_vm->addVideo(this);
_needsPalConversion = false;
_ownedFrame = 0;
_ownedFrame = nullptr;
}
VideoWindow::~VideoWindow() {
@ -125,14 +125,14 @@ bool VideoWindow::openVideo(const Common::String &fileName) {
void VideoWindow::closeVideo() {
if (_video) {
delete _video;
_video = 0;
_video = nullptr;
_mode = kModeClosed;
_lastFrame = 0;
_lastFrame = nullptr;
if (_ownedFrame) {
_ownedFrame->free();
delete _ownedFrame;
_ownedFrame = 0;
_ownedFrame = nullptr;
}
}
}
@ -146,7 +146,7 @@ void VideoWindow::updateVideo() {
if (_ownedFrame) {
_ownedFrame->free();
delete _ownedFrame;
_ownedFrame = 0;
_ownedFrame = nullptr;
}
if (_vm->isTrueColor()) {