diff --git a/apps/launcher/advancedpage.hpp b/apps/launcher/advancedpage.hpp index bdf5af0c8..ef2f4740f 100644 --- a/apps/launcher/advancedpage.hpp +++ b/apps/launcher/advancedpage.hpp @@ -20,7 +20,7 @@ namespace Launcher public: AdvancedPage(Files::ConfigurationManager &cfg, Config::GameSettings &gameSettings, - Settings::Manager &engineSettings, QWidget *parent = 0); + Settings::Manager &engineSettings, QWidget *parent = nullptr); bool loadSettings(); void saveSettings(); diff --git a/apps/launcher/datafilespage.hpp b/apps/launcher/datafilespage.hpp index af54fe75e..92984847e 100644 --- a/apps/launcher/datafilespage.hpp +++ b/apps/launcher/datafilespage.hpp @@ -32,7 +32,7 @@ namespace Launcher public: explicit DataFilesPage (Files::ConfigurationManager &cfg, Config::GameSettings &gameSettings, - Config::LauncherSettings &launcherSettings, QWidget *parent = 0); + Config::LauncherSettings &launcherSettings, QWidget *parent = nullptr); QAbstractItemModel* profilesModel() const; diff --git a/apps/launcher/graphicspage.hpp b/apps/launcher/graphicspage.hpp index 3b03a72bd..55178e0d7 100644 --- a/apps/launcher/graphicspage.hpp +++ b/apps/launcher/graphicspage.hpp @@ -20,7 +20,7 @@ namespace Launcher Q_OBJECT public: - GraphicsPage(Files::ConfigurationManager &cfg, Settings::Manager &engineSettings, QWidget *parent = 0); + GraphicsPage(Files::ConfigurationManager &cfg, Settings::Manager &engineSettings, QWidget *parent = nullptr); void saveSettings(); bool loadSettings(); diff --git a/apps/launcher/maindialog.hpp b/apps/launcher/maindialog.hpp index 214d31dd4..de7423330 100644 --- a/apps/launcher/maindialog.hpp +++ b/apps/launcher/maindialog.hpp @@ -48,7 +48,7 @@ namespace Launcher Q_OBJECT public: - explicit MainDialog(QWidget *parent = 0); + explicit MainDialog(QWidget *parent = nullptr); ~MainDialog(); FirstRunDialogResult showFirstRunDialog(); diff --git a/apps/launcher/playpage.hpp b/apps/launcher/playpage.hpp index 1dc5bb0fe..b0bd3ee27 100644 --- a/apps/launcher/playpage.hpp +++ b/apps/launcher/playpage.hpp @@ -16,7 +16,7 @@ namespace Launcher Q_OBJECT public: - PlayPage(QWidget *parent = 0); + PlayPage(QWidget *parent = nullptr); void setProfilesModel(QAbstractItemModel *model); signals: diff --git a/apps/launcher/settingspage.hpp b/apps/launcher/settingspage.hpp index ccc2061dd..97b099dd6 100644 --- a/apps/launcher/settingspage.hpp +++ b/apps/launcher/settingspage.hpp @@ -24,7 +24,7 @@ namespace Launcher public: SettingsPage(Files::ConfigurationManager &cfg, Config::GameSettings &gameSettings, - Config::LauncherSettings &launcherSettings, MainDialog *parent = 0); + Config::LauncherSettings &launcherSettings, MainDialog *parent = nullptr); ~SettingsPage(); void saveSettings(); diff --git a/apps/launcher/utils/lineedit.hpp b/apps/launcher/utils/lineedit.hpp index 50da73045..da28e858c 100644 --- a/apps/launcher/utils/lineedit.hpp +++ b/apps/launcher/utils/lineedit.hpp @@ -24,7 +24,7 @@ class LineEdit : public QLineEdit QString mPlaceholderText; public: - LineEdit(QWidget *parent = 0); + LineEdit(QWidget *parent = nullptr); protected: void resizeEvent(QResizeEvent *) override; diff --git a/apps/launcher/utils/profilescombobox.cpp b/apps/launcher/utils/profilescombobox.cpp index 7df89098e..462c2ebc2 100644 --- a/apps/launcher/utils/profilescombobox.cpp +++ b/apps/launcher/utils/profilescombobox.cpp @@ -33,7 +33,7 @@ void ProfilesComboBox::setEditEnabled(bool editable) ComboBoxLineEdit *edit = new ComboBoxLineEdit(this); setLineEdit(edit); - setCompleter(0); + setCompleter(nullptr); connect(lineEdit(), SIGNAL(editingFinished()), this, SLOT(slotEditingFinished())); diff --git a/apps/launcher/utils/profilescombobox.hpp b/apps/launcher/utils/profilescombobox.hpp index 7b83c41b2..065682f3d 100644 --- a/apps/launcher/utils/profilescombobox.hpp +++ b/apps/launcher/utils/profilescombobox.hpp @@ -16,12 +16,12 @@ public: class ComboBoxLineEdit : public LineEdit { public: - explicit ComboBoxLineEdit (QWidget *parent = 0); + explicit ComboBoxLineEdit (QWidget *parent = nullptr); }; public: - explicit ProfilesComboBox(QWidget *parent = 0); + explicit ProfilesComboBox(QWidget *parent = nullptr); void setEditEnabled(bool editable); void setCurrentProfile(int index) { diff --git a/apps/launcher/utils/textinputdialog.cpp b/apps/launcher/utils/textinputdialog.cpp index 385d086fd..70b827596 100644 --- a/apps/launcher/utils/textinputdialog.cpp +++ b/apps/launcher/utils/textinputdialog.cpp @@ -23,7 +23,7 @@ Launcher::TextInputDialog::TextInputDialog(const QString& title, const QString & QValidator *validator = new QRegExpValidator(QRegExp("^[a-zA-Z0-9_]*$"), this); // Alpha-numeric + underscore mLineEdit = new LineEdit(this); mLineEdit->setValidator(validator); - mLineEdit->setCompleter(0); + mLineEdit->setCompleter(nullptr); QVBoxLayout *dialogLayout = new QVBoxLayout(this); dialogLayout->addWidget(label); diff --git a/apps/launcher/utils/textinputdialog.hpp b/apps/launcher/utils/textinputdialog.hpp index a9353956a..de0659963 100644 --- a/apps/launcher/utils/textinputdialog.hpp +++ b/apps/launcher/utils/textinputdialog.hpp @@ -15,7 +15,7 @@ namespace Launcher public: - explicit TextInputDialog(const QString& title, const QString &text, QWidget *parent = 0); + explicit TextInputDialog(const QString& title, const QString &text, QWidget *parent = nullptr); ~TextInputDialog (); inline LineEdit *lineEdit() { return mLineEdit; } diff --git a/apps/opencs/model/doc/operationholder.hpp b/apps/opencs/model/doc/operationholder.hpp index b73d61dab..69af6ed66 100644 --- a/apps/opencs/model/doc/operationholder.hpp +++ b/apps/opencs/model/doc/operationholder.hpp @@ -25,7 +25,7 @@ namespace CSMDoc public: - OperationHolder (Operation *operation = 0); + OperationHolder (Operation *operation = nullptr); void setOperation (Operation *operation); diff --git a/apps/opencs/model/doc/runner.cpp b/apps/opencs/model/doc/runner.cpp index 84bc61a9a..ccdff1444 100644 --- a/apps/opencs/model/doc/runner.cpp +++ b/apps/opencs/model/doc/runner.cpp @@ -8,7 +8,7 @@ #include "operationholder.hpp" CSMDoc::Runner::Runner (const boost::filesystem::path& projectPath) -: mRunning (false), mStartup (0), mProjectPath (projectPath) +: mRunning (false), mStartup (nullptr), mProjectPath (projectPath) { connect (&mProcess, SIGNAL (finished (int, QProcess::ExitStatus)), this, SLOT (finished (int, QProcess::ExitStatus))); @@ -25,7 +25,7 @@ CSMDoc::Runner::~Runner() { if (mRunning) { - disconnect (&mProcess, 0, this, 0); + disconnect (&mProcess, nullptr, this, nullptr); mProcess.kill(); mProcess.waitForFinished(); } @@ -36,7 +36,7 @@ void CSMDoc::Runner::start (bool delayed) if (mStartup) { delete mStartup; - mStartup = 0; + mStartup = nullptr; } if (!delayed) @@ -102,7 +102,7 @@ void CSMDoc::Runner::start (bool delayed) void CSMDoc::Runner::stop() { delete mStartup; - mStartup = 0; + mStartup = nullptr; if (mProcess.state()==QProcess::NotRunning) { diff --git a/apps/opencs/model/prefs/boolsetting.cpp b/apps/opencs/model/prefs/boolsetting.cpp index 6431dc6af..005875349 100644 --- a/apps/opencs/model/prefs/boolsetting.cpp +++ b/apps/opencs/model/prefs/boolsetting.cpp @@ -11,7 +11,7 @@ CSMPrefs::BoolSetting::BoolSetting (Category *parent, Settings::Manager *values, QMutex *mutex, const std::string& key, const std::string& label, bool default_) -: Setting (parent, values, mutex, key, label), mDefault (default_), mWidget(0) +: Setting (parent, values, mutex, key, label), mDefault (default_), mWidget(nullptr) {} CSMPrefs::BoolSetting& CSMPrefs::BoolSetting::setTooltip (const std::string& tooltip) @@ -33,7 +33,7 @@ std::pair CSMPrefs::BoolSetting::makeWidgets (QWidget *par connect (mWidget, SIGNAL (stateChanged (int)), this, SLOT (valueChanged (int))); - return std::make_pair (static_cast (0), mWidget); + return std::make_pair (static_cast (nullptr), mWidget); } void CSMPrefs::BoolSetting::updateWidget() diff --git a/apps/opencs/model/prefs/coloursetting.cpp b/apps/opencs/model/prefs/coloursetting.cpp index 1a41621da..e676ad91c 100644 --- a/apps/opencs/model/prefs/coloursetting.cpp +++ b/apps/opencs/model/prefs/coloursetting.cpp @@ -14,7 +14,7 @@ CSMPrefs::ColourSetting::ColourSetting (Category *parent, Settings::Manager *values, QMutex *mutex, const std::string& key, const std::string& label, QColor default_) -: Setting (parent, values, mutex, key, label), mDefault (default_), mWidget(0) +: Setting (parent, values, mutex, key, label), mDefault (default_), mWidget(nullptr) {} CSMPrefs::ColourSetting& CSMPrefs::ColourSetting::setTooltip (const std::string& tooltip) diff --git a/apps/opencs/model/prefs/doublesetting.cpp b/apps/opencs/model/prefs/doublesetting.cpp index 8ae6f4818..757b67389 100644 --- a/apps/opencs/model/prefs/doublesetting.cpp +++ b/apps/opencs/model/prefs/doublesetting.cpp @@ -16,7 +16,7 @@ CSMPrefs::DoubleSetting::DoubleSetting (Category *parent, Settings::Manager *val QMutex *mutex, const std::string& key, const std::string& label, double default_) : Setting (parent, values, mutex, key, label), mPrecision(2), mMin (0), mMax (std::numeric_limits::max()), - mDefault (default_), mWidget(0) + mDefault (default_), mWidget(nullptr) {} CSMPrefs::DoubleSetting& CSMPrefs::DoubleSetting::setPrecision(int precision) diff --git a/apps/opencs/model/prefs/enumsetting.cpp b/apps/opencs/model/prefs/enumsetting.cpp index 62cac062a..ec3fca328 100644 --- a/apps/opencs/model/prefs/enumsetting.cpp +++ b/apps/opencs/model/prefs/enumsetting.cpp @@ -42,7 +42,7 @@ CSMPrefs::EnumValues& CSMPrefs::EnumValues::add (const std::string& value, const CSMPrefs::EnumSetting::EnumSetting (Category *parent, Settings::Manager *values, QMutex *mutex, const std::string& key, const std::string& label, const EnumValue& default_) -: Setting (parent, values, mutex, key, label), mDefault (default_), mWidget(0) +: Setting (parent, values, mutex, key, label), mDefault (default_), mWidget(nullptr) {} CSMPrefs::EnumSetting& CSMPrefs::EnumSetting::setTooltip (const std::string& tooltip) diff --git a/apps/opencs/model/prefs/intsetting.cpp b/apps/opencs/model/prefs/intsetting.cpp index 25dbf78c2..407ed11f0 100644 --- a/apps/opencs/model/prefs/intsetting.cpp +++ b/apps/opencs/model/prefs/intsetting.cpp @@ -15,7 +15,7 @@ CSMPrefs::IntSetting::IntSetting (Category *parent, Settings::Manager *values, QMutex *mutex, const std::string& key, const std::string& label, int default_) : Setting (parent, values, mutex, key, label), mMin (0), mMax (std::numeric_limits::max()), - mDefault (default_), mWidget(0) + mDefault (default_), mWidget(nullptr) {} CSMPrefs::IntSetting& CSMPrefs::IntSetting::setRange (int min, int max) diff --git a/apps/opencs/model/prefs/modifiersetting.cpp b/apps/opencs/model/prefs/modifiersetting.cpp index da6b2ccdd..288926d00 100644 --- a/apps/opencs/model/prefs/modifiersetting.cpp +++ b/apps/opencs/model/prefs/modifiersetting.cpp @@ -15,7 +15,7 @@ namespace CSMPrefs ModifierSetting::ModifierSetting(Category* parent, Settings::Manager* values, QMutex* mutex, const std::string& key, const std::string& label) : Setting(parent, values, mutex, key, label) - , mButton(0) + , mButton(nullptr) , mEditorActive(false) { } diff --git a/apps/opencs/model/prefs/shortcut.cpp b/apps/opencs/model/prefs/shortcut.cpp index 924b9535e..ff7b949a4 100644 --- a/apps/opencs/model/prefs/shortcut.cpp +++ b/apps/opencs/model/prefs/shortcut.cpp @@ -23,7 +23,7 @@ namespace CSMPrefs , mLastPos(0) , mActivationStatus(AS_Inactive) , mModifierStatus(false) - , mAction(0) + , mAction(nullptr) { assert (parent); @@ -42,7 +42,7 @@ namespace CSMPrefs , mLastPos(0) , mActivationStatus(AS_Inactive) , mModifierStatus(false) - , mAction(0) + , mAction(nullptr) { assert (parent); @@ -62,7 +62,7 @@ namespace CSMPrefs , mLastPos(0) , mActivationStatus(AS_Inactive) , mModifierStatus(false) - , mAction(0) + , mAction(nullptr) { assert (parent); @@ -218,6 +218,6 @@ namespace CSMPrefs void Shortcut::actionDeleted() { - mAction = 0; + mAction = nullptr; } } diff --git a/apps/opencs/model/prefs/shortcutmanager.cpp b/apps/opencs/model/prefs/shortcutmanager.cpp index f39492c6c..781ad4de3 100644 --- a/apps/opencs/model/prefs/shortcutmanager.cpp +++ b/apps/opencs/model/prefs/shortcutmanager.cpp @@ -781,7 +781,7 @@ namespace CSMPrefs std::make_pair((int)Qt::Key_LastNumberRedial , "LastNumberRedial"), std::make_pair((int)Qt::Key_Camera , "Camera"), std::make_pair((int)Qt::Key_CameraFocus , "CameraFocus"), - std::make_pair(0 , (const char*) 0) + std::make_pair(0 , (const char*) nullptr) }; } diff --git a/apps/opencs/model/prefs/shortcutsetting.cpp b/apps/opencs/model/prefs/shortcutsetting.cpp index de495b9fc..1c065f7da 100644 --- a/apps/opencs/model/prefs/shortcutsetting.cpp +++ b/apps/opencs/model/prefs/shortcutsetting.cpp @@ -18,7 +18,7 @@ namespace CSMPrefs ShortcutSetting::ShortcutSetting(Category* parent, Settings::Manager* values, QMutex* mutex, const std::string& key, const std::string& label) : Setting(parent, values, mutex, key, label) - , mButton(0) + , mButton(nullptr) , mEditorActive(false) , mEditorPos(0) { diff --git a/apps/opencs/model/prefs/state.cpp b/apps/opencs/model/prefs/state.cpp index abd1ddfc8..39aae48bd 100644 --- a/apps/opencs/model/prefs/state.cpp +++ b/apps/opencs/model/prefs/state.cpp @@ -12,7 +12,7 @@ #include "shortcutsetting.hpp" #include "modifiersetting.hpp" -CSMPrefs::State *CSMPrefs::State::sThis = 0; +CSMPrefs::State *CSMPrefs::State::sThis = nullptr; void CSMPrefs::State::load() { @@ -599,7 +599,7 @@ CSMPrefs::State::State (const Files::ConfigurationManager& configurationManager) CSMPrefs::State::~State() { - sThis = 0; + sThis = nullptr; } void CSMPrefs::State::save() diff --git a/apps/opencs/model/tools/mergestages.cpp b/apps/opencs/model/tools/mergestages.cpp index 897c3329c..016e2da39 100644 --- a/apps/opencs/model/tools/mergestages.cpp +++ b/apps/opencs/model/tools/mergestages.cpp @@ -104,7 +104,7 @@ void CSMTools::MergeReferencesStage::perform (int stage, CSMDoc::Messages& messa ref.mNew = false; CSMWorld::Record newRecord ( - CSMWorld::RecordBase::State_ModifiedOnly, 0, &ref); + CSMWorld::RecordBase::State_ModifiedOnly, nullptr, &ref); mState.mTarget->getData().getReferences().appendRecord (newRecord); } diff --git a/apps/opencs/model/tools/mergestages.hpp b/apps/opencs/model/tools/mergestages.hpp index bcb3fe2ad..a6b6de58f 100644 --- a/apps/opencs/model/tools/mergestages.hpp +++ b/apps/opencs/model/tools/mergestages.hpp @@ -82,7 +82,7 @@ namespace CSMTools const CSMWorld::Record& record = source.getRecord (stage); if (!record.isDeleted()) - target.appendRecord (CSMWorld::Record (CSMWorld::RecordBase::State_ModifiedOnly, 0, &record.get())); + target.appendRecord (CSMWorld::Record (CSMWorld::RecordBase::State_ModifiedOnly, nullptr, &record.get())); } class MergeRefIdsStage : public CSMDoc::Stage diff --git a/apps/opencs/model/tools/scriptcheck.cpp b/apps/opencs/model/tools/scriptcheck.cpp index 952127edf..46a74362b 100644 --- a/apps/opencs/model/tools/scriptcheck.cpp +++ b/apps/opencs/model/tools/scriptcheck.cpp @@ -50,7 +50,7 @@ void CSMTools::ScriptCheckStage::report (const std::string& message, Type type) } CSMTools::ScriptCheckStage::ScriptCheckStage (const CSMDoc::Document& document) -: mDocument (document), mContext (document.getData()), mMessages (0), mWarningMode (Mode_Ignore) +: mDocument (document), mContext (document.getData()), mMessages (nullptr), mWarningMode (Mode_Ignore) { /// \todo add an option to configure warning mode setWarningsMode (0); @@ -73,7 +73,7 @@ int CSMTools::ScriptCheckStage::setup() mWarningMode = Mode_Strict; mContext.clear(); - mMessages = 0; + mMessages = nullptr; mId.clear(); Compiler::ErrorHandler::reset(); @@ -130,5 +130,5 @@ void CSMTools::ScriptCheckStage::perform (int stage, CSMDoc::Messages& messages) messages.add (id, stream.str(), "", CSMDoc::Message::Severity_SeriousError); } - mMessages = 0; + mMessages = nullptr; } diff --git a/apps/opencs/model/tools/searchstage.cpp b/apps/opencs/model/tools/searchstage.cpp index 3db10b0c3..7cd3f4924 100644 --- a/apps/opencs/model/tools/searchstage.cpp +++ b/apps/opencs/model/tools/searchstage.cpp @@ -5,7 +5,7 @@ #include "searchoperation.hpp" CSMTools::SearchStage::SearchStage (const CSMWorld::IdTableBase *model) -: mModel (model), mOperation (0) +: mModel (model), mOperation (nullptr) {} int CSMTools::SearchStage::setup() diff --git a/apps/opencs/model/tools/tools.cpp b/apps/opencs/model/tools/tools.cpp index 07a721e8e..a3d7db497 100644 --- a/apps/opencs/model/tools/tools.cpp +++ b/apps/opencs/model/tools/tools.cpp @@ -43,7 +43,7 @@ CSMDoc::OperationHolder *CSMTools::Tools::get (int type) case CSMDoc::State_Merging: return &mMerge; } - return 0; + return nullptr; } const CSMDoc::OperationHolder *CSMTools::Tools::get (int type) const @@ -138,8 +138,8 @@ CSMDoc::OperationHolder *CSMTools::Tools::getVerifier() } CSMTools::Tools::Tools (CSMDoc::Document& document, ToUTF8::FromType encoding) -: mDocument (document), mData (document.getData()), mVerifierOperation (0), - mSearchOperation (0), mMergeOperation (0), mNextReportNumber (0), mEncoding (encoding) +: mDocument (document), mData (document.getData()), mVerifierOperation (nullptr), + mSearchOperation (nullptr), mMergeOperation (nullptr), mNextReportNumber (0), mEncoding (encoding) { // index 0: load error log mReports.insert (std::make_pair (mNextReportNumber++, new ReportModel)); diff --git a/apps/opencs/model/world/columnimp.hpp b/apps/opencs/model/world/columnimp.hpp index c69ca1d84..17518937c 100644 --- a/apps/opencs/model/world/columnimp.hpp +++ b/apps/opencs/model/world/columnimp.hpp @@ -2254,7 +2254,7 @@ namespace CSMWorld QVariant get (const Record& record) const override { - const std::string *string = 0; + const std::string *string = nullptr; switch (this->mColumnId) { @@ -2272,7 +2272,7 @@ namespace CSMWorld void set (Record& record, const QVariant& data) override { - std::string *string = 0; + std::string *string = nullptr; ESXRecordT record2 = record.get(); @@ -2312,7 +2312,7 @@ namespace CSMWorld QVariant get (const Record& record) const override { - const std::string *string = 0; + const std::string *string = nullptr; switch (this->mColumnId) { @@ -2330,7 +2330,7 @@ namespace CSMWorld void set (Record& record, const QVariant& data) override { - std::string *string = 0; + std::string *string = nullptr; ESXRecordT record2 = record.get(); diff --git a/apps/opencs/model/world/commanddispatcher.hpp b/apps/opencs/model/world/commanddispatcher.hpp index 1d29e48c1..538fd7f18 100644 --- a/apps/opencs/model/world/commanddispatcher.hpp +++ b/apps/opencs/model/world/commanddispatcher.hpp @@ -34,7 +34,7 @@ namespace CSMWorld public: CommandDispatcher (CSMDoc::Document& document, const CSMWorld::UniversalId& id, - QObject *parent = 0); + QObject *parent = nullptr); ///< \param id ID of the table the commands should operate on primarily. void setEditLock (bool locked); diff --git a/apps/opencs/model/world/commands.cpp b/apps/opencs/model/world/commands.cpp index e9682d7c9..e33be1139 100644 --- a/apps/opencs/model/world/commands.cpp +++ b/apps/opencs/model/world/commands.cpp @@ -290,7 +290,7 @@ void CSMWorld::CreateCommand::undo() } CSMWorld::RevertCommand::RevertCommand (IdTable& model, const std::string& id, QUndoCommand* parent) -: QUndoCommand (parent), mModel (model), mId (id), mOld (0) +: QUndoCommand (parent), mModel (model), mId (id), mOld (nullptr) { setText (("Revert record " + id).c_str()); @@ -326,7 +326,7 @@ void CSMWorld::RevertCommand::undo() CSMWorld::DeleteCommand::DeleteCommand (IdTable& model, const std::string& id, CSMWorld::UniversalId::Type type, QUndoCommand* parent) -: QUndoCommand (parent), mModel (model), mId (id), mOld (0), mType(type) +: QUndoCommand (parent), mModel (model), mId (id), mOld (nullptr), mType(type) { setText (("Delete record " + id).c_str()); diff --git a/apps/opencs/model/world/commands.hpp b/apps/opencs/model/world/commands.hpp index 88af32636..5776cae36 100644 --- a/apps/opencs/model/world/commands.hpp +++ b/apps/opencs/model/world/commands.hpp @@ -140,7 +140,7 @@ namespace CSMWorld public: ModifyCommand (QAbstractItemModel& model, const QModelIndex& index, const QVariant& new_, - QUndoCommand *parent = 0); + QUndoCommand *parent = nullptr); void redo() override; @@ -167,7 +167,7 @@ namespace CSMWorld public: - CreateCommand (IdTable& model, const std::string& id, QUndoCommand *parent = 0); + CreateCommand (IdTable& model, const std::string& id, QUndoCommand *parent = nullptr); void setType (UniversalId::Type type); @@ -189,7 +189,7 @@ namespace CSMWorld CloneCommand (IdTable& model, const std::string& idOrigin, const std::string& IdDestination, const UniversalId::Type type, - QUndoCommand* parent = 0); + QUndoCommand* parent = nullptr); void redo() override; @@ -208,7 +208,7 @@ namespace CSMWorld public: - RevertCommand (IdTable& model, const std::string& id, QUndoCommand *parent = 0); + RevertCommand (IdTable& model, const std::string& id, QUndoCommand *parent = nullptr); virtual ~RevertCommand(); @@ -231,7 +231,7 @@ namespace CSMWorld public: DeleteCommand (IdTable& model, const std::string& id, - UniversalId::Type type = UniversalId::Type_None, QUndoCommand *parent = 0); + UniversalId::Type type = UniversalId::Type_None, QUndoCommand *parent = nullptr); virtual ~DeleteCommand(); @@ -259,7 +259,7 @@ namespace CSMWorld { public: - CreatePathgridCommand(IdTable& model, const std::string& id, QUndoCommand *parent = 0); + CreatePathgridCommand(IdTable& model, const std::string& id, QUndoCommand *parent = nullptr); void redo() override; }; @@ -279,7 +279,7 @@ namespace CSMWorld public: - UpdateCellCommand (IdTable& model, int row, QUndoCommand *parent = 0); + UpdateCellCommand (IdTable& model, int row, QUndoCommand *parent = nullptr); void redo() override; @@ -316,7 +316,7 @@ namespace CSMWorld public: - DeleteNestedCommand (IdTree& model, const std::string& id, int nestedRow, int parentColumn, QUndoCommand* parent = 0); + DeleteNestedCommand (IdTree& model, const std::string& id, int nestedRow, int parentColumn, QUndoCommand* parent = nullptr); void redo() override; @@ -338,7 +338,7 @@ namespace CSMWorld public: - AddNestedCommand(IdTree& model, const std::string& id, int nestedRow, int parentColumn, QUndoCommand* parent = 0); + AddNestedCommand(IdTree& model, const std::string& id, int nestedRow, int parentColumn, QUndoCommand* parent = nullptr); void redo() override; diff --git a/apps/opencs/model/world/data.cpp b/apps/opencs/model/world/data.cpp index 23720a99a..70c496e3f 100644 --- a/apps/opencs/model/world/data.cpp +++ b/apps/opencs/model/world/data.cpp @@ -68,7 +68,7 @@ int CSMWorld::Data::count (RecordBase::State state, const CollectionBase& collec CSMWorld::Data::Data (ToUTF8::FromType encoding, bool fsStrict, const Files::PathContainer& dataPaths, const std::vector& archives, const boost::filesystem::path& resDir) : mEncoder (encoding), mPathgrids (mCells), mRefs (mCells), - mReader (0), mDialogue (0), mReaderIndex(1), + mReader (nullptr), mDialogue (nullptr), mReaderIndex(1), mFsStrict(fsStrict), mDataPaths(dataPaths), mArchives(archives) { mVFS.reset(new VFS::Manager(mFsStrict)); @@ -916,7 +916,7 @@ const CSMWorld::MetaData& CSMWorld::Data::getMetaData() const void CSMWorld::Data::setMetaData (const MetaData& metaData) { - Record record (RecordBase::State_ModifiedOnly, 0, &metaData); + Record record (RecordBase::State_ModifiedOnly, nullptr, &metaData); mMetaData.setRecord (0, record); } @@ -932,7 +932,7 @@ QAbstractItemModel *CSMWorld::Data::getTableModel (const CSMWorld::UniversalId& // construction of the ESX data where no update signals are available. if (id.getType()==UniversalId::Type_RegionMap) { - RegionMap *table = 0; + RegionMap *table = nullptr; addModel (table = new RegionMap (*this), UniversalId::Type_RegionMap, false); return table; } @@ -962,9 +962,9 @@ int CSMWorld::Data::startLoading (const boost::filesystem::path& path, bool base // Don't delete the Reader yet. Some record types store a reference to the Reader to handle on-demand loading std::shared_ptr ptr(mReader); mReaders.push_back(ptr); - mReader = 0; + mReader = nullptr; - mDialogue = 0; + mDialogue = nullptr; mReader = new ESM::ESMReader; mReader->setEncoder (&mEncoder); @@ -982,7 +982,7 @@ int CSMWorld::Data::startLoading (const boost::filesystem::path& path, bool base metaData.mId = "sys::meta"; metaData.load (*mReader); - mMetaData.setRecord (0, Record (RecordBase::State_ModifiedOnly, 0, &metaData)); + mMetaData.setRecord (0, Record (RecordBase::State_ModifiedOnly, nullptr, &metaData)); } // Fix uninitialized master data index @@ -1064,9 +1064,9 @@ bool CSMWorld::Data::continueLoading (CSMDoc::Messages& messages) else delete mReader; - mReader = 0; + mReader = nullptr; - mDialogue = 0; + mDialogue = nullptr; loadFallbackEntries(); @@ -1151,7 +1151,7 @@ bool CSMWorld::Data::continueLoading (CSMDoc::Messages& messages) if (isDeleted) { // record vector can be shuffled around which would make pointer to record invalid - mDialogue = 0; + mDialogue = nullptr; if (mJournals.tryDelete (record.mId)) { diff --git a/apps/opencs/model/world/idtableproxymodel.hpp b/apps/opencs/model/world/idtableproxymodel.hpp index 14d705792..7e0563834 100644 --- a/apps/opencs/model/world/idtableproxymodel.hpp +++ b/apps/opencs/model/world/idtableproxymodel.hpp @@ -35,7 +35,7 @@ namespace CSMWorld public: - IdTableProxyModel (QObject *parent = 0); + IdTableProxyModel (QObject *parent = nullptr); virtual QModelIndex getModelIndex (const std::string& id, int column) const; diff --git a/apps/opencs/model/world/infotableproxymodel.hpp b/apps/opencs/model/world/infotableproxymodel.hpp index 6a8e66b4f..92afdabdc 100644 --- a/apps/opencs/model/world/infotableproxymodel.hpp +++ b/apps/opencs/model/world/infotableproxymodel.hpp @@ -28,7 +28,7 @@ namespace CSMWorld ///< \a currentRow is a row of the source model. public: - InfoTableProxyModel(UniversalId::Type type, QObject *parent = 0); + InfoTableProxyModel(UniversalId::Type type, QObject *parent = nullptr); void setSourceModel(QAbstractItemModel *sourceModel) override; diff --git a/apps/opencs/model/world/record.hpp b/apps/opencs/model/world/record.hpp index 82f2abe77..5f67a93b1 100644 --- a/apps/opencs/model/world/record.hpp +++ b/apps/opencs/model/world/record.hpp @@ -87,7 +87,7 @@ namespace CSMWorld template RecordBase *Record::modifiedCopy() const { - return new Record (State_ModifiedOnly, 0, &(this->get())); + return new Record (State_ModifiedOnly, nullptr, &(this->get())); } template diff --git a/apps/opencs/model/world/refidcollection.cpp b/apps/opencs/model/world/refidcollection.cpp index 535a31ddd..cd2dd89df 100644 --- a/apps/opencs/model/world/refidcollection.cpp +++ b/apps/opencs/model/world/refidcollection.cpp @@ -350,7 +350,7 @@ CSMWorld::RefIdCollection::RefIdCollection() }; // for re-use in NPC records - const RefIdColumn *essential = 0; + const RefIdColumn *essential = nullptr; for (int i=0; sCreatureFlagTable[i].mName!=-1; ++i) { diff --git a/apps/opencs/model/world/resources.hpp b/apps/opencs/model/world/resources.hpp index 5e9872ea8..c217b793d 100644 --- a/apps/opencs/model/world/resources.hpp +++ b/apps/opencs/model/world/resources.hpp @@ -25,9 +25,9 @@ namespace CSMWorld /// \param type Type of resources in this table. Resources (const VFS::Manager* vfs, const std::string& baseDirectory, UniversalId::Type type, - const char * const *extensions = 0); + const char * const *extensions = nullptr); - void recreate(const VFS::Manager* vfs, const char * const *extensions = 0); + void recreate(const VFS::Manager* vfs, const char * const *extensions = nullptr); int getSize() const; diff --git a/apps/opencs/view/doc/adjusterwidget.hpp b/apps/opencs/view/doc/adjusterwidget.hpp index 91e308236..cec9ca229 100644 --- a/apps/opencs/view/doc/adjusterwidget.hpp +++ b/apps/opencs/view/doc/adjusterwidget.hpp @@ -32,7 +32,7 @@ namespace CSVDoc public: - AdjusterWidget (QWidget *parent = 0); + AdjusterWidget (QWidget *parent = nullptr); void setLocalData (const boost::filesystem::path& localData); void setAction (ContentAction action); diff --git a/apps/opencs/view/doc/filedialog.cpp b/apps/opencs/view/doc/filedialog.cpp index 7a3fe398f..69490edca 100644 --- a/apps/opencs/view/doc/filedialog.cpp +++ b/apps/opencs/view/doc/filedialog.cpp @@ -18,7 +18,7 @@ #include "adjusterwidget.hpp" CSVDoc::FileDialog::FileDialog(QWidget *parent) : - QDialog(parent), mSelector (0), mAction(ContentAction_Undefined), mFileWidget (0), mAdjusterWidget (0), mDialogBuilt(false) + QDialog(parent), mSelector (nullptr), mAction(ContentAction_Undefined), mFileWidget (nullptr), mAdjusterWidget (nullptr), mDialogBuilt(false) { ui.setupUi (this); resize(400, 400); diff --git a/apps/opencs/view/doc/filedialog.hpp b/apps/opencs/view/doc/filedialog.hpp index bec2c6869..6c48fa78b 100644 --- a/apps/opencs/view/doc/filedialog.hpp +++ b/apps/opencs/view/doc/filedialog.hpp @@ -42,7 +42,7 @@ namespace CSVDoc public: - explicit FileDialog(QWidget *parent = 0); + explicit FileDialog(QWidget *parent = nullptr); void showDialog (ContentAction action); void addFiles (const QString &path); diff --git a/apps/opencs/view/doc/filewidget.hpp b/apps/opencs/view/doc/filewidget.hpp index ab06f37f1..626b8d77d 100644 --- a/apps/opencs/view/doc/filewidget.hpp +++ b/apps/opencs/view/doc/filewidget.hpp @@ -23,7 +23,7 @@ namespace CSVDoc public: - FileWidget (QWidget *parent = 0); + FileWidget (QWidget *parent = nullptr); void setType (bool addon); diff --git a/apps/opencs/view/doc/globaldebugprofilemenu.cpp b/apps/opencs/view/doc/globaldebugprofilemenu.cpp index f0d9655dd..c898b819c 100644 --- a/apps/opencs/view/doc/globaldebugprofilemenu.cpp +++ b/apps/opencs/view/doc/globaldebugprofilemenu.cpp @@ -13,7 +13,7 @@ void CSVDoc::GlobalDebugProfileMenu::rebuild() clear(); delete mActions; - mActions = 0; + mActions = nullptr; int idColumn = mDebugProfiles->findColumnIndex (CSMWorld::Columns::ColumnId_Id); int stateColumn = mDebugProfiles->findColumnIndex (CSMWorld::Columns::ColumnId_Modification); @@ -48,7 +48,7 @@ void CSVDoc::GlobalDebugProfileMenu::rebuild() CSVDoc::GlobalDebugProfileMenu::GlobalDebugProfileMenu (CSMWorld::IdTable *debugProfiles, QWidget *parent) -: QMenu (parent), mDebugProfiles (debugProfiles), mActions (0) +: QMenu (parent), mDebugProfiles (debugProfiles), mActions (nullptr) { rebuild(); diff --git a/apps/opencs/view/doc/globaldebugprofilemenu.hpp b/apps/opencs/view/doc/globaldebugprofilemenu.hpp index 0d7906cce..e12ee306a 100644 --- a/apps/opencs/view/doc/globaldebugprofilemenu.hpp +++ b/apps/opencs/view/doc/globaldebugprofilemenu.hpp @@ -26,7 +26,7 @@ namespace CSVDoc public: - GlobalDebugProfileMenu (CSMWorld::IdTable *debugProfiles, QWidget *parent = 0); + GlobalDebugProfileMenu (CSMWorld::IdTable *debugProfiles, QWidget *parent = nullptr); void updateActions (bool running); diff --git a/apps/opencs/view/doc/loader.cpp b/apps/opencs/view/doc/loader.cpp index 49a53e179..1cdfc0173 100644 --- a/apps/opencs/view/doc/loader.cpp +++ b/apps/opencs/view/doc/loader.cpp @@ -17,7 +17,7 @@ void CSVDoc::LoadingDocument::closeEvent (QCloseEvent *event) } CSVDoc::LoadingDocument::LoadingDocument (CSMDoc::Document *document) -: mDocument (document), mAborted (false), mMessages (0), mTotalRecords (0) +: mDocument (document), mAborted (false), mMessages (nullptr), mTotalRecords (0) { setWindowTitle (QString::fromUtf8((std::string("Opening ") + document->getSavePath().filename().string()).c_str())); diff --git a/apps/opencs/view/doc/sizehint.hpp b/apps/opencs/view/doc/sizehint.hpp index 1b3c52eb8..14ec7b186 100644 --- a/apps/opencs/view/doc/sizehint.hpp +++ b/apps/opencs/view/doc/sizehint.hpp @@ -11,7 +11,7 @@ namespace CSVDoc QSize mSize; public: - SizeHintWidget(QWidget *parent = 0); + SizeHintWidget(QWidget *parent = nullptr); ~SizeHintWidget(); QSize sizeHint() const override; diff --git a/apps/opencs/view/doc/view.cpp b/apps/opencs/view/doc/view.cpp index ac7c8ebf9..be3fe5142 100644 --- a/apps/opencs/view/doc/view.cpp +++ b/apps/opencs/view/doc/view.cpp @@ -733,7 +733,7 @@ void CSVDoc::View::infoAbout() #endif // Get current year - time_t now = time(NULL); + time_t now = time(nullptr); struct tm tstruct; char copyrightInfo[40]; tstruct = *localtime(&now); diff --git a/apps/opencs/view/doc/viewmanager.hpp b/apps/opencs/view/doc/viewmanager.hpp index 70431107f..8424be6f8 100644 --- a/apps/opencs/view/doc/viewmanager.hpp +++ b/apps/opencs/view/doc/viewmanager.hpp @@ -43,7 +43,7 @@ namespace CSVDoc ViewManager& operator= (const ViewManager&); void updateIndices(); - bool notifySaveOnClose (View *view = 0); + bool notifySaveOnClose (View *view = nullptr); bool showModifiedDocumentMessageBox (View *view); bool showSaveInProgressMessageBox (View *view); bool removeDocument(View *view); diff --git a/apps/opencs/view/filter/editwidget.hpp b/apps/opencs/view/filter/editwidget.hpp index b47a884a3..f933ec92e 100644 --- a/apps/opencs/view/filter/editwidget.hpp +++ b/apps/opencs/view/filter/editwidget.hpp @@ -30,7 +30,7 @@ namespace CSVFilter public: - EditWidget (CSMWorld::Data& data, QWidget *parent = 0); + EditWidget (CSMWorld::Data& data, QWidget *parent = nullptr); void createFilterRequest(std::vector > >& filterSource, Qt::DropAction action); diff --git a/apps/opencs/view/filter/filterbox.hpp b/apps/opencs/view/filter/filterbox.hpp index 94aa80b84..94b5fced3 100644 --- a/apps/opencs/view/filter/filterbox.hpp +++ b/apps/opencs/view/filter/filterbox.hpp @@ -25,7 +25,7 @@ namespace CSVFilter RecordFilterBox *mRecordFilterBox; public: - FilterBox (CSMWorld::Data& data, QWidget *parent = 0); + FilterBox (CSMWorld::Data& data, QWidget *parent = nullptr); void setRecordFilter (const std::string& filter); diff --git a/apps/opencs/view/filter/recordfilterbox.hpp b/apps/opencs/view/filter/recordfilterbox.hpp index 77a07c92b..3bcd7c57b 100644 --- a/apps/opencs/view/filter/recordfilterbox.hpp +++ b/apps/opencs/view/filter/recordfilterbox.hpp @@ -25,7 +25,7 @@ namespace CSVFilter public: - RecordFilterBox (CSMWorld::Data& data, QWidget *parent = 0); + RecordFilterBox (CSMWorld::Data& data, QWidget *parent = nullptr); void setFilter (const std::string& filter); diff --git a/apps/opencs/view/prefs/keybindingpage.cpp b/apps/opencs/view/prefs/keybindingpage.cpp index eed5c0eb8..39c9f78ec 100644 --- a/apps/opencs/view/prefs/keybindingpage.cpp +++ b/apps/opencs/view/prefs/keybindingpage.cpp @@ -16,9 +16,9 @@ namespace CSVPrefs { KeyBindingPage::KeyBindingPage(CSMPrefs::Category& category, QWidget* parent) : PageBase(category, parent) - , mStackedLayout(0) - , mPageLayout(0) - , mPageSelector(0) + , mStackedLayout(nullptr) + , mPageLayout(nullptr) + , mPageSelector(nullptr) { // Need one widget for scroll area QWidget* topWidget = new QWidget(); diff --git a/apps/opencs/view/render/cell.cpp b/apps/opencs/view/render/cell.cpp index 23b5aa91e..75d83cf63 100644 --- a/apps/opencs/view/render/cell.cpp +++ b/apps/opencs/view/render/cell.cpp @@ -504,12 +504,12 @@ void CSVRender::Cell::setCellArrows (int mask) bool enable = mask & direction; - if (enable!=(mCellArrows[i].get()!=0)) + if (enable!=(mCellArrows[i].get()!=nullptr)) { if (enable) mCellArrows[i].reset (new CellArrow (mCellNode, direction, mCoordinates)); else - mCellArrows[i].reset (0); + mCellArrows[i].reset (nullptr); } } } diff --git a/apps/opencs/view/render/cellwater.cpp b/apps/opencs/view/render/cellwater.cpp index 435178860..f8857c3af 100644 --- a/apps/opencs/view/render/cellwater.cpp +++ b/apps/opencs/view/render/cellwater.cpp @@ -27,9 +27,9 @@ namespace CSVRender : mData(data) , mId(id) , mParentNode(cellNode) - , mWaterTransform(0) - , mWaterNode(0) - , mWaterGeometry(0) + , mWaterTransform(nullptr) + , mWaterNode(nullptr) + , mWaterGeometry(nullptr) , mDeleted(false) , mExterior(false) , mHasWater(false) @@ -137,7 +137,7 @@ namespace CSVRender if (mWaterGeometry) { mWaterNode->removeDrawable(mWaterGeometry); - mWaterGeometry = 0; + mWaterGeometry = nullptr; } if (mDeleted || !mHasWater) diff --git a/apps/opencs/view/render/editmode.hpp b/apps/opencs/view/render/editmode.hpp index c0482c81a..52c35811d 100644 --- a/apps/opencs/view/render/editmode.hpp +++ b/apps/opencs/view/render/editmode.hpp @@ -30,7 +30,7 @@ namespace CSVRender public: EditMode (WorldspaceWidget *worldspaceWidget, const QIcon& icon, unsigned int mask, - const QString& tooltip = "", QWidget *parent = 0); + const QString& tooltip = "", QWidget *parent = nullptr); unsigned int getInteractionMask() const; diff --git a/apps/opencs/view/render/instancemode.cpp b/apps/opencs/view/render/instancemode.cpp index 987dea437..19018fae6 100644 --- a/apps/opencs/view/render/instancemode.cpp +++ b/apps/opencs/view/render/instancemode.cpp @@ -98,7 +98,7 @@ osg::Vec3f CSVRender::InstanceMode::getScreenCoords(const osg::Vec3f& pos) CSVRender::InstanceMode::InstanceMode (WorldspaceWidget *worldspaceWidget, osg::ref_ptr parentNode, QWidget *parent) : EditMode (worldspaceWidget, QIcon (":scenetoolbar/editing-instance"), Mask_Reference | Mask_Terrain, "Instance editing", - parent), mSubMode (0), mSubModeId ("move"), mSelectionMode (0), mDragMode (DragMode_None), + parent), mSubMode (nullptr), mSubModeId ("move"), mSelectionMode (nullptr), mDragMode (DragMode_None), mDragAxis (-1), mLocked (false), mUnitScaleDist(1), mParentNode (parentNode) { connect(this, SIGNAL(requestFocus(const std::string&)), @@ -169,14 +169,14 @@ void CSVRender::InstanceMode::deactivate (CSVWidget::SceneToolbar *toolbar) { toolbar->removeTool (mSelectionMode); delete mSelectionMode; - mSelectionMode = 0; + mSelectionMode = nullptr; } if (mSubMode) { toolbar->removeTool (mSubMode); delete mSubMode; - mSubMode = 0; + mSubMode = nullptr; } EditMode::deactivate (toolbar); diff --git a/apps/opencs/view/render/instancemode.hpp b/apps/opencs/view/render/instancemode.hpp index 29955feef..32dd4ac67 100644 --- a/apps/opencs/view/render/instancemode.hpp +++ b/apps/opencs/view/render/instancemode.hpp @@ -62,7 +62,7 @@ namespace CSVRender public: - InstanceMode (WorldspaceWidget *worldspaceWidget, osg::ref_ptr parentNode, QWidget *parent = 0); + InstanceMode (WorldspaceWidget *worldspaceWidget, osg::ref_ptr parentNode, QWidget *parent = nullptr); void activate (CSVWidget::SceneToolbar *toolbar) override; diff --git a/apps/opencs/view/render/instancemovemode.hpp b/apps/opencs/view/render/instancemovemode.hpp index bd0e28dac..62e6b6a1f 100644 --- a/apps/opencs/view/render/instancemovemode.hpp +++ b/apps/opencs/view/render/instancemovemode.hpp @@ -11,7 +11,7 @@ namespace CSVRender public: - InstanceMoveMode (QWidget *parent = 0); + InstanceMoveMode (QWidget *parent = nullptr); }; } diff --git a/apps/opencs/view/render/lighting.hpp b/apps/opencs/view/render/lighting.hpp index 66b0eec00..d9d90767f 100644 --- a/apps/opencs/view/render/lighting.hpp +++ b/apps/opencs/view/render/lighting.hpp @@ -16,7 +16,7 @@ namespace CSVRender { public: - Lighting() : mRootNode(0) {} + Lighting() : mRootNode(nullptr) {} virtual ~Lighting(); virtual void activate (osg::Group* rootNode, bool isExterior) = 0; diff --git a/apps/opencs/view/render/object.cpp b/apps/opencs/view/render/object.cpp index f9d2c8872..2bb537d74 100644 --- a/apps/opencs/view/render/object.cpp +++ b/apps/opencs/view/render/object.cpp @@ -413,7 +413,7 @@ osg::Vec3f CSVRender::Object::getMarkerPosition (float x, float y, float z, int CSVRender::Object::Object (CSMWorld::Data& data, osg::Group* parentNode, const std::string& id, bool referenceable, bool forceBaseToZero) -: mData (data), mBaseNode(0), mSelected(false), mParentNode(parentNode), mResourceSystem(data.getResourceSystem().get()), mForceBaseToZero (forceBaseToZero), +: mData (data), mBaseNode(nullptr), mSelected(false), mParentNode(parentNode), mResourceSystem(data.getResourceSystem().get()), mForceBaseToZero (forceBaseToZero), mScaleOverride (1), mOverrideFlags (0), mSubMode (-1), mMarkerTransparency(0.5f) { mRootNode = new osg::PositionAttitudeTransform; diff --git a/apps/opencs/view/render/orbitcameramode.cpp b/apps/opencs/view/render/orbitcameramode.cpp index ba25beaba..79ac0167a 100644 --- a/apps/opencs/view/render/orbitcameramode.cpp +++ b/apps/opencs/view/render/orbitcameramode.cpp @@ -13,7 +13,7 @@ namespace CSVRender QWidget* parent) : ModeButton(icon, tooltip, parent) , mWorldspaceWidget(worldspaceWidget) - , mCenterOnSelection(0) + , mCenterOnSelection(nullptr) { mCenterShortcut = new CSMPrefs::Shortcut("orbit-center-selection", worldspaceWidget); mCenterShortcut->enable(false); @@ -35,7 +35,7 @@ namespace CSVRender void OrbitCameraMode::deactivate(CSVWidget::SceneToolbar* toolbar) { - mCenterShortcut->associateAction(0); + mCenterShortcut->associateAction(nullptr); mCenterShortcut->enable(false); } diff --git a/apps/opencs/view/render/pagedworldspacewidget.cpp b/apps/opencs/view/render/pagedworldspacewidget.cpp index b5d9234e4..dca5549af 100644 --- a/apps/opencs/view/render/pagedworldspacewidget.cpp +++ b/apps/opencs/view/render/pagedworldspacewidget.cpp @@ -787,7 +787,7 @@ CSVRender::Cell* CSVRender::PagedWorldspaceWidget::getCell(const osg::Vec3d& poi if (searchResult != mCells.end()) return searchResult->second; else - return 0; + return nullptr; } CSVRender::Cell* CSVRender::PagedWorldspaceWidget::getCell(const CSMWorld::CellCoordinates& coords) const diff --git a/apps/opencs/view/render/pathgrid.cpp b/apps/opencs/view/render/pathgrid.cpp index 7f0454d8f..470a3d092 100644 --- a/apps/opencs/view/render/pathgrid.cpp +++ b/apps/opencs/view/render/pathgrid.cpp @@ -60,8 +60,8 @@ namespace CSVRender , mRemoveGeometry(false) , mUseOffset(true) , mParent(parent) - , mPathgridGeometry(0) - , mDragGeometry(0) + , mPathgridGeometry(nullptr) + , mDragGeometry(nullptr) , mTag(new PathgridTag(this)) { const float CoordScalar = ESM::Land::REAL_SIZE; @@ -219,7 +219,7 @@ namespace CSVRender mMoveOffset.set(0, 0, 0); mPathgridGeode->removeDrawable(mDragGeometry); - mDragGeometry = 0; + mDragGeometry = nullptr; } void Pathgrid::applyPoint(CSMWorld::CommandMacro& commands, const osg::Vec3d& worldPos) @@ -557,7 +557,7 @@ namespace CSVRender if (mPathgridGeometry) { mPathgridGeode->removeDrawable(mPathgridGeometry); - mPathgridGeometry = 0; + mPathgridGeometry = nullptr; } } @@ -566,7 +566,7 @@ namespace CSVRender if (mSelectedGeometry) { mPathgridGeode->removeDrawable(mSelectedGeometry); - mSelectedGeometry = 0; + mSelectedGeometry = nullptr; } } @@ -612,7 +612,7 @@ namespace CSVRender return &mPathgridCollection.getRecord(index).get(); } - return 0; + return nullptr; } int Pathgrid::edgeExists(const CSMWorld::Pathgrid& source, unsigned short node1, unsigned short node2) diff --git a/apps/opencs/view/render/pathgridmode.cpp b/apps/opencs/view/render/pathgridmode.cpp index 8863ad235..7a3fc8ecf 100644 --- a/apps/opencs/view/render/pathgridmode.cpp +++ b/apps/opencs/view/render/pathgridmode.cpp @@ -27,7 +27,7 @@ namespace CSVRender getTooltip(), parent) , mDragMode(DragMode_None) , mFromNode(0) - , mSelectionMode(0) + , mSelectionMode(nullptr) { } @@ -59,7 +59,7 @@ namespace CSVRender { toolbar->removeTool (mSelectionMode); delete mSelectionMode; - mSelectionMode = 0; + mSelectionMode = nullptr; } } @@ -214,7 +214,7 @@ namespace CSVRender Cell* cell = getWorldspaceWidget().getCell(hit.worldPos); if (cell && cell->getPathgrid()) { - PathgridTag* tag = 0; + PathgridTag* tag = nullptr; if (hit.tag && (tag = dynamic_cast(hit.tag.get())) && tag->getPathgrid()->getId() == mEdgeId) { unsigned short node = SceneUtil::getPathgridNode(static_cast(hit.index0)); diff --git a/apps/opencs/view/render/pathgridmode.hpp b/apps/opencs/view/render/pathgridmode.hpp index 6d8f96e8c..cc61dfe9b 100644 --- a/apps/opencs/view/render/pathgridmode.hpp +++ b/apps/opencs/view/render/pathgridmode.hpp @@ -15,7 +15,7 @@ namespace CSVRender public: - PathgridMode(WorldspaceWidget* worldspace, QWidget* parent=0); + PathgridMode(WorldspaceWidget* worldspace, QWidget* parent=nullptr); void activate(CSVWidget::SceneToolbar* toolbar) override; diff --git a/apps/opencs/view/render/previewwidget.hpp b/apps/opencs/view/render/previewwidget.hpp index 630ccf293..a8d73729a 100644 --- a/apps/opencs/view/render/previewwidget.hpp +++ b/apps/opencs/view/render/previewwidget.hpp @@ -29,7 +29,7 @@ namespace CSVRender public: PreviewWidget (CSMWorld::Data& data, const std::string& id, bool referenceable, - QWidget *parent = 0); + QWidget *parent = nullptr); signals: diff --git a/apps/opencs/view/render/scenewidget.cpp b/apps/opencs/view/render/scenewidget.cpp index f3186e76a..3abc01d2e 100644 --- a/apps/opencs/view/render/scenewidget.cpp +++ b/apps/opencs/view/render/scenewidget.cpp @@ -36,7 +36,7 @@ namespace CSVRender RenderWidget::RenderWidget(QWidget *parent, Qt::WindowFlags f) : QWidget(parent, f) - , mRootNode(0) + , mRootNode(nullptr) { osgViewer::CompositeViewer& viewer = CompositeViewer::get(); @@ -257,7 +257,7 @@ void SceneWidget::setLighting(Lighting *lighting) mLighting = lighting; mLighting->activate (mRootNode, mIsExterior); - osg::Vec4f ambient = mLighting->getAmbientColour(mHasDefaultAmbient ? &mDefaultAmbient : 0); + osg::Vec4f ambient = mLighting->getAmbientColour(mHasDefaultAmbient ? &mDefaultAmbient : nullptr); setAmbient(ambient); flagAsModified(); diff --git a/apps/opencs/view/render/terrainshapemode.cpp b/apps/opencs/view/render/terrainshapemode.cpp index 5664378ca..e495d2355 100644 --- a/apps/opencs/view/render/terrainshapemode.cpp +++ b/apps/opencs/view/render/terrainshapemode.cpp @@ -99,7 +99,7 @@ void CSVRender::TerrainShapeMode::primaryOpenPressed (const WorldspaceHitResult& void CSVRender::TerrainShapeMode::primaryEditPressed(const WorldspaceHitResult& hit) { - if (hit.hit && hit.tag == 0) + if (hit.hit && hit.tag == nullptr) { if (mShapeEditTool == ShapeEditTool_Flatten) setFlattenToolTargetHeight(hit); @@ -124,7 +124,7 @@ void CSVRender::TerrainShapeMode::primaryEditPressed(const WorldspaceHitResult& void CSVRender::TerrainShapeMode::primarySelectPressed(const WorldspaceHitResult& hit) { - if(hit.hit && hit.tag == 0) + if(hit.hit && hit.tag == nullptr) { selectTerrainShapes(CSMWorld::CellCoordinates::toVertexCoords(hit.worldPos), 0, false); } @@ -132,7 +132,7 @@ void CSVRender::TerrainShapeMode::primarySelectPressed(const WorldspaceHitResult void CSVRender::TerrainShapeMode::secondarySelectPressed(const WorldspaceHitResult& hit) { - if(hit.hit && hit.tag == 0) + if(hit.hit && hit.tag == nullptr) { selectTerrainShapes(CSMWorld::CellCoordinates::toVertexCoords(hit.worldPos), 1, false); } @@ -144,7 +144,7 @@ bool CSVRender::TerrainShapeMode::primaryEditStartDrag (const QPoint& pos) mDragMode = InteractionType_PrimaryEdit; - if (hit.hit && hit.tag == 0) + if (hit.hit && hit.tag == nullptr) { mEditingPos = hit.worldPos; mIsEditing = true; @@ -164,7 +164,7 @@ bool CSVRender::TerrainShapeMode::primarySelectStartDrag (const QPoint& pos) { WorldspaceHitResult hit = getWorldspaceWidget().mousePick (pos, getWorldspaceWidget().getInteractionMask()); mDragMode = InteractionType_PrimarySelect; - if (!hit.hit || hit.tag != 0) + if (!hit.hit || hit.tag != nullptr) { mDragMode = InteractionType_None; return false; @@ -177,7 +177,7 @@ bool CSVRender::TerrainShapeMode::secondarySelectStartDrag (const QPoint& pos) { WorldspaceHitResult hit = getWorldspaceWidget().mousePick (pos, getWorldspaceWidget().getInteractionMask()); mDragMode = InteractionType_SecondarySelect; - if (!hit.hit || hit.tag != 0) + if (!hit.hit || hit.tag != nullptr) { mDragMode = InteractionType_None; return false; @@ -202,13 +202,13 @@ void CSVRender::TerrainShapeMode::drag (const QPoint& pos, int diffX, int diffY, if (mDragMode == InteractionType_PrimarySelect) { WorldspaceHitResult hit = getWorldspaceWidget().mousePick (pos, getWorldspaceWidget().getInteractionMask()); - if (hit.hit && hit.tag == 0) selectTerrainShapes(CSMWorld::CellCoordinates::toVertexCoords(hit.worldPos), 0, true); + if (hit.hit && hit.tag == nullptr) selectTerrainShapes(CSMWorld::CellCoordinates::toVertexCoords(hit.worldPos), 0, true); } if (mDragMode == InteractionType_SecondarySelect) { WorldspaceHitResult hit = getWorldspaceWidget().mousePick (pos, getWorldspaceWidget().getInteractionMask()); - if (hit.hit && hit.tag == 0) selectTerrainShapes(CSMWorld::CellCoordinates::toVertexCoords(hit.worldPos), 1, true); + if (hit.hit && hit.tag == nullptr) selectTerrainShapes(CSMWorld::CellCoordinates::toVertexCoords(hit.worldPos), 1, true); } } diff --git a/apps/opencs/view/render/terraintexturemode.cpp b/apps/opencs/view/render/terraintexturemode.cpp index ae5711881..c8d63f32e 100644 --- a/apps/opencs/view/render/terraintexturemode.cpp +++ b/apps/opencs/view/render/terraintexturemode.cpp @@ -119,7 +119,7 @@ void CSVRender::TerrainTextureMode::primaryEditPressed(const WorldspaceHitResult CSMWorld::IdCollection& landtexturesCollection = document.getData().getLandTextures(); int index = landtexturesCollection.searchId(mBrushTexture); - if (index != -1 && !landtexturesCollection.getRecord(index).isDeleted() && hit.hit && hit.tag == 0) + if (index != -1 && !landtexturesCollection.getRecord(index).isDeleted() && hit.hit && hit.tag == nullptr) { undoStack.beginMacro ("Edit texture records"); if(allowLandTextureEditing(mCellId)) @@ -133,7 +133,7 @@ void CSVRender::TerrainTextureMode::primaryEditPressed(const WorldspaceHitResult void CSVRender::TerrainTextureMode::primarySelectPressed(const WorldspaceHitResult& hit) { - if(hit.hit && hit.tag == 0) + if(hit.hit && hit.tag == nullptr) { selectTerrainTextures(CSMWorld::CellCoordinates::toTextureCoords(hit.worldPos), 0, false); } @@ -141,7 +141,7 @@ void CSVRender::TerrainTextureMode::primarySelectPressed(const WorldspaceHitResu void CSVRender::TerrainTextureMode::secondarySelectPressed(const WorldspaceHitResult& hit) { - if(hit.hit && hit.tag == 0) + if(hit.hit && hit.tag == nullptr) { selectTerrainTextures(CSMWorld::CellCoordinates::toTextureCoords(hit.worldPos), 1, false); } @@ -166,7 +166,7 @@ bool CSVRender::TerrainTextureMode::primaryEditStartDrag (const QPoint& pos) CSMWorld::IdCollection& landtexturesCollection = document.getData().getLandTextures(); int index = landtexturesCollection.searchId(mBrushTexture); - if (index != -1 && !landtexturesCollection.getRecord(index).isDeleted() && hit.hit && hit.tag == 0) + if (index != -1 && !landtexturesCollection.getRecord(index).isDeleted() && hit.hit && hit.tag == nullptr) { undoStack.beginMacro ("Edit texture records"); mIsEditing = true; @@ -189,7 +189,7 @@ bool CSVRender::TerrainTextureMode::primarySelectStartDrag (const QPoint& pos) { WorldspaceHitResult hit = getWorldspaceWidget().mousePick (pos, getWorldspaceWidget().getInteractionMask()); mDragMode = InteractionType_PrimarySelect; - if (!hit.hit || hit.tag != 0) + if (!hit.hit || hit.tag != nullptr) { mDragMode = InteractionType_None; return false; @@ -202,7 +202,7 @@ bool CSVRender::TerrainTextureMode::secondarySelectStartDrag (const QPoint& pos) { WorldspaceHitResult hit = getWorldspaceWidget().mousePick (pos, getWorldspaceWidget().getInteractionMask()); mDragMode = InteractionType_SecondarySelect; - if (!hit.hit || hit.tag != 0) + if (!hit.hit || hit.tag != nullptr) { mDragMode = InteractionType_None; return false; @@ -222,7 +222,7 @@ void CSVRender::TerrainTextureMode::drag (const QPoint& pos, int diffX, int diff CSMWorld::IdCollection& landtexturesCollection = document.getData().getLandTextures(); int index = landtexturesCollection.searchId(mBrushTexture); - if (index != -1 && !landtexturesCollection.getRecord(index).isDeleted() && hit.hit && hit.tag == 0) + if (index != -1 && !landtexturesCollection.getRecord(index).isDeleted() && hit.hit && hit.tag == nullptr) { editTerrainTextureGrid(hit); } @@ -231,13 +231,13 @@ void CSVRender::TerrainTextureMode::drag (const QPoint& pos, int diffX, int diff if (mDragMode == InteractionType_PrimarySelect) { WorldspaceHitResult hit = getWorldspaceWidget().mousePick (pos, getWorldspaceWidget().getInteractionMask()); - if (hit.hit && hit.tag == 0) selectTerrainTextures(CSMWorld::CellCoordinates::toTextureCoords(hit.worldPos), 0, true); + if (hit.hit && hit.tag == nullptr) selectTerrainTextures(CSMWorld::CellCoordinates::toTextureCoords(hit.worldPos), 0, true); } if (mDragMode == InteractionType_SecondarySelect) { WorldspaceHitResult hit = getWorldspaceWidget().mousePick (pos, getWorldspaceWidget().getInteractionMask()); - if (hit.hit && hit.tag == 0) selectTerrainTextures(CSMWorld::CellCoordinates::toTextureCoords(hit.worldPos), 1, true); + if (hit.hit && hit.tag == nullptr) selectTerrainTextures(CSMWorld::CellCoordinates::toTextureCoords(hit.worldPos), 1, true); } } diff --git a/apps/opencs/view/render/worldspacewidget.cpp b/apps/opencs/view/render/worldspacewidget.cpp index 4535b5e8a..82a1459f2 100644 --- a/apps/opencs/view/render/worldspacewidget.cpp +++ b/apps/opencs/view/render/worldspacewidget.cpp @@ -34,11 +34,11 @@ CSVRender::WorldspaceWidget::WorldspaceWidget (CSMDoc::Document& document, QWidget* parent) : SceneWidget (document.getData().getResourceSystem(), parent, Qt::WindowFlags(), false) - , mSceneElements(0) - , mRun(0) + , mSceneElements(nullptr) + , mRun(nullptr) , mDocument(document) , mInteractionMask (0) - , mEditMode (0) + , mEditMode (nullptr) , mLocked (false) , mDragMode(InteractionType_None) , mDragging (false) @@ -435,7 +435,7 @@ CSVRender::WorldspaceHitResult CSVRender::WorldspaceWidget::mousePick (const QPo } // Something untagged, probably terrain - WorldspaceHitResult hit = { true, 0, 0, 0, 0, intersection.getWorldIntersectPoint() }; + WorldspaceHitResult hit = { true, nullptr, 0, 0, 0, intersection.getWorldIntersectPoint() }; if (intersection.indexList.size() >= 3) { hit.index0 = intersection.indexList[0]; @@ -449,7 +449,7 @@ CSVRender::WorldspaceHitResult CSVRender::WorldspaceWidget::mousePick (const QPo direction.normalize(); direction *= CSMPrefs::get()["3D Scene Editing"]["distance"].toInt(); - WorldspaceHitResult hit = { false, 0, 0, 0, 0, start + direction }; + WorldspaceHitResult hit = { false, nullptr, 0, 0, 0, start + direction }; return hit; } diff --git a/apps/opencs/view/render/worldspacewidget.hpp b/apps/opencs/view/render/worldspacewidget.hpp index 5ed3d01b3..3b8cf70c2 100644 --- a/apps/opencs/view/render/worldspacewidget.hpp +++ b/apps/opencs/view/render/worldspacewidget.hpp @@ -96,7 +96,7 @@ namespace CSVRender InteractionType_None }; - WorldspaceWidget (CSMDoc::Document& document, QWidget *parent = 0); + WorldspaceWidget (CSMDoc::Document& document, QWidget *parent = nullptr); ~WorldspaceWidget (); CSVWidget::SceneToolMode *makeNavigationSelector (CSVWidget::SceneToolbar *parent); diff --git a/apps/opencs/view/tools/merge.cpp b/apps/opencs/view/tools/merge.cpp index c49044ccd..f50a85f2f 100644 --- a/apps/opencs/view/tools/merge.cpp +++ b/apps/opencs/view/tools/merge.cpp @@ -27,7 +27,7 @@ void CSVTools::Merge::keyPressEvent (QKeyEvent *event) } CSVTools::Merge::Merge (CSMDoc::DocumentManager& documentManager, QWidget *parent) -: QWidget (parent), mDocument (0), mDocumentManager (documentManager) +: QWidget (parent), mDocument (nullptr), mDocumentManager (documentManager) { setWindowTitle ("Merge Content Files into a new Game File"); @@ -117,7 +117,7 @@ CSMDoc::Document *CSVTools::Merge::getDocument() const void CSVTools::Merge::cancel() { - mDocument = 0; + mDocument = nullptr; hide(); } diff --git a/apps/opencs/view/tools/merge.hpp b/apps/opencs/view/tools/merge.hpp index c82feba14..d394a431e 100644 --- a/apps/opencs/view/tools/merge.hpp +++ b/apps/opencs/view/tools/merge.hpp @@ -39,7 +39,7 @@ namespace CSVTools public: - Merge (CSMDoc::DocumentManager& documentManager, QWidget *parent = 0); + Merge (CSMDoc::DocumentManager& documentManager, QWidget *parent = nullptr); /// Configure dialogue for a new merge void configure (CSMDoc::Document *document); diff --git a/apps/opencs/view/tools/reporttable.cpp b/apps/opencs/view/tools/reporttable.cpp index 7b28f2b0f..c1297d475 100644 --- a/apps/opencs/view/tools/reporttable.cpp +++ b/apps/opencs/view/tools/reporttable.cpp @@ -25,7 +25,7 @@ namespace CSVTools { public: - RichTextDelegate (QObject *parent = 0); + RichTextDelegate (QObject *parent = nullptr); void paint(QPainter *painter, const QStyleOptionViewItem& option, const QModelIndex& index) const override; @@ -142,7 +142,7 @@ CSVTools::ReportTable::ReportTable (CSMDoc::Document& document, const CSMWorld::UniversalId& id, bool richTextDescription, int refreshState, QWidget *parent) : CSVWorld::DragRecordTable (document, parent), mModel (document.getReport (id)), - mRefreshAction (0), mRefreshState (refreshState) + mRefreshAction (nullptr), mRefreshState (refreshState) { horizontalHeader()->setSectionResizeMode (QHeaderView::Interactive); horizontalHeader()->setStretchLastSection (true); @@ -159,7 +159,7 @@ CSVTools::ReportTable::ReportTable (CSMDoc::Document& document, setModel (mProxyModel); setColumnHidden (2, true); - mIdTypeDelegate = CSVWorld::IdTypeDelegateFactory().makeDelegate (0, + mIdTypeDelegate = CSVWorld::IdTypeDelegateFactory().makeDelegate (nullptr, mDocument, this); setItemDelegateForColumn (0, mIdTypeDelegate); diff --git a/apps/opencs/view/tools/reporttable.hpp b/apps/opencs/view/tools/reporttable.hpp index 4c169a986..f39dd6f85 100644 --- a/apps/opencs/view/tools/reporttable.hpp +++ b/apps/opencs/view/tools/reporttable.hpp @@ -62,7 +62,7 @@ namespace CSVTools /// 0 no refresh function exists. If the document current has the specified state /// the refresh function is disabled. ReportTable (CSMDoc::Document& document, const CSMWorld::UniversalId& id, - bool richTextDescription, int refreshState = 0, QWidget *parent = 0); + bool richTextDescription, int refreshState = 0, QWidget *parent = nullptr); std::vector getDraggedRecords() const override; diff --git a/apps/opencs/view/tools/searchbox.hpp b/apps/opencs/view/tools/searchbox.hpp index eff5296b4..cbeb150d8 100644 --- a/apps/opencs/view/tools/searchbox.hpp +++ b/apps/opencs/view/tools/searchbox.hpp @@ -41,7 +41,7 @@ namespace CSVTools public: - SearchBox (QWidget *parent = 0); + SearchBox (QWidget *parent = nullptr); void setSearchMode (bool enabled); diff --git a/apps/opencs/view/tools/searchsubview.cpp b/apps/opencs/view/tools/searchsubview.cpp index 9bada22af..07ba7907e 100644 --- a/apps/opencs/view/tools/searchsubview.cpp +++ b/apps/opencs/view/tools/searchsubview.cpp @@ -30,7 +30,7 @@ void CSVTools::SearchSubView::replace (bool selection) bool autoDelete = CSMPrefs::get()["Search & Replace"]["auto-delete"].isTrue(); CSMTools::Search search (mSearch); - CSMWorld::IdTableBase *currentTable = 0; + CSMWorld::IdTableBase *currentTable = nullptr; // We are running through the indices in reverse order to avoid messing up multiple results // in a single string. diff --git a/apps/opencs/view/widget/coloreditor.hpp b/apps/opencs/view/widget/coloreditor.hpp index d4a802ca2..aa746da68 100644 --- a/apps/opencs/view/widget/coloreditor.hpp +++ b/apps/opencs/view/widget/coloreditor.hpp @@ -22,8 +22,8 @@ namespace CSVWidget QPoint calculatePopupPosition(); public: - ColorEditor(const QColor &color, QWidget *parent = 0, const bool popupOnStart = false); - ColorEditor(const int colorInt, QWidget *parent = 0, const bool popupOnStart = false); + ColorEditor(const QColor &color, QWidget *parent = nullptr, const bool popupOnStart = false); + ColorEditor(const int colorInt, QWidget *parent = nullptr, const bool popupOnStart = false); QColor color() const; @@ -41,7 +41,7 @@ namespace CSVWidget void showEvent(QShowEvent *event) override; private: - ColorEditor(QWidget *parent = 0, const bool popupOnStart = false); + ColorEditor(QWidget *parent = nullptr, const bool popupOnStart = false); private slots: void showPicker(); diff --git a/apps/opencs/view/widget/completerpopup.hpp b/apps/opencs/view/widget/completerpopup.hpp index 62fdf5388..96675f56f 100644 --- a/apps/opencs/view/widget/completerpopup.hpp +++ b/apps/opencs/view/widget/completerpopup.hpp @@ -8,7 +8,7 @@ namespace CSVWidget class CompleterPopup : public QListView { public: - CompleterPopup(QWidget *parent = 0); + CompleterPopup(QWidget *parent = nullptr); int sizeHintForRow(int row) const override; }; diff --git a/apps/opencs/view/widget/droplineedit.hpp b/apps/opencs/view/widget/droplineedit.hpp index ed991af0d..911051873 100644 --- a/apps/opencs/view/widget/droplineedit.hpp +++ b/apps/opencs/view/widget/droplineedit.hpp @@ -26,7 +26,7 @@ namespace CSVWidget ///< The accepted Display type for this LineEdit. public: - DropLineEdit(CSMWorld::ColumnBase::Display type, QWidget *parent = 0); + DropLineEdit(CSMWorld::ColumnBase::Display type, QWidget *parent = nullptr); protected: void dragEnterEvent(QDragEnterEvent *event) override; diff --git a/apps/opencs/view/widget/modebutton.hpp b/apps/opencs/view/widget/modebutton.hpp index 1615ff298..f59596923 100644 --- a/apps/opencs/view/widget/modebutton.hpp +++ b/apps/opencs/view/widget/modebutton.hpp @@ -17,7 +17,7 @@ namespace CSVWidget public: ModeButton (const QIcon& icon, const QString& tooltip = "", - QWidget *parent = 0); + QWidget *parent = nullptr); /// Default-Implementation: do nothing virtual void activate (SceneToolbar *toolbar); diff --git a/apps/opencs/view/widget/pushbutton.hpp b/apps/opencs/view/widget/pushbutton.hpp index 5522cd74f..b3aaaebef 100644 --- a/apps/opencs/view/widget/pushbutton.hpp +++ b/apps/opencs/view/widget/pushbutton.hpp @@ -48,11 +48,11 @@ namespace CSVWidget /// \param push Do not maintain a toggle state PushButton (const QIcon& icon, Type type, const QString& tooltip = "", - QWidget *parent = 0); + QWidget *parent = nullptr); /// \param push Do not maintain a toggle state PushButton (Type type, const QString& tooltip = "", - QWidget *parent = 0); + QWidget *parent = nullptr); bool hasKeepOpen() const; diff --git a/apps/opencs/view/widget/scenetoolbar.hpp b/apps/opencs/view/widget/scenetoolbar.hpp index d9998eefc..70f580765 100644 --- a/apps/opencs/view/widget/scenetoolbar.hpp +++ b/apps/opencs/view/widget/scenetoolbar.hpp @@ -23,11 +23,11 @@ namespace CSVWidget public: - SceneToolbar (int buttonSize, QWidget *parent = 0); + SceneToolbar (int buttonSize, QWidget *parent = nullptr); /// If insertPoint==0, insert \a tool at the end of the scrollbar. Otherwise /// insert tool after \a insertPoint. - void addTool (SceneTool *tool, SceneTool *insertPoint = 0); + void addTool (SceneTool *tool, SceneTool *insertPoint = nullptr); void removeTool (SceneTool *tool); diff --git a/apps/opencs/view/widget/scenetoolmode.cpp b/apps/opencs/view/widget/scenetoolmode.cpp index 7b2ff64db..3aec44f1b 100644 --- a/apps/opencs/view/widget/scenetoolmode.cpp +++ b/apps/opencs/view/widget/scenetoolmode.cpp @@ -33,7 +33,7 @@ void CSVWidget::SceneToolMode::adjustToolTip (const ModeButton *activeMode) toolTip += "

(left click to change mode)"; - if (createContextMenu (0)) + if (createContextMenu (nullptr)) toolTip += "
(right click to access context menu)"; setToolTip (toolTip); @@ -62,7 +62,7 @@ void CSVWidget::SceneToolMode::setButton (std::map::i CSVWidget::SceneToolMode::SceneToolMode (SceneToolbar *parent, const QString& toolTip) : SceneTool (parent), mButtonSize (parent->getButtonSize()), mIconSize (parent->getIconSize()), - mToolTip (toolTip), mFirst (0), mCurrent (0), mToolbar (parent) + mToolTip (toolTip), mFirst (nullptr), mCurrent (nullptr), mToolbar (parent) { mPanel = new QFrame (this, Qt::Popup); diff --git a/apps/opencs/view/widget/scenetoolshapebrush.hpp b/apps/opencs/view/widget/scenetoolshapebrush.hpp index 76c0dfa04..3afd7f8b3 100644 --- a/apps/opencs/view/widget/scenetoolshapebrush.hpp +++ b/apps/opencs/view/widget/scenetoolshapebrush.hpp @@ -54,7 +54,7 @@ namespace CSVWidget public: - ShapeBrushWindow(CSMDoc::Document& document, QWidget *parent = 0); + ShapeBrushWindow(CSMDoc::Document& document, QWidget *parent = nullptr); void configureButtonInitialSettings(QPushButton *button); const QString toolTipPoint = "Paint single point"; diff --git a/apps/opencs/view/widget/scenetooltexturebrush.hpp b/apps/opencs/view/widget/scenetooltexturebrush.hpp index c6f0b5e52..5f42800cb 100644 --- a/apps/opencs/view/widget/scenetooltexturebrush.hpp +++ b/apps/opencs/view/widget/scenetooltexturebrush.hpp @@ -57,7 +57,7 @@ namespace CSVWidget Q_OBJECT public: - TextureBrushWindow(CSMDoc::Document& document, QWidget *parent = 0); + TextureBrushWindow(CSMDoc::Document& document, QWidget *parent = nullptr); void configureButtonInitialSettings(QPushButton *button); const QString toolTipPoint = "Paint single point"; diff --git a/apps/opencs/view/widget/scenetooltoggle.cpp b/apps/opencs/view/widget/scenetooltoggle.cpp index 5919a280a..fa0be3155 100644 --- a/apps/opencs/view/widget/scenetooltoggle.cpp +++ b/apps/opencs/view/widget/scenetooltoggle.cpp @@ -115,7 +115,7 @@ QRect CSVWidget::SceneToolToggle::getIconBox (int index) const CSVWidget::SceneToolToggle::SceneToolToggle (SceneToolbar *parent, const QString& toolTip, const std::string& emptyIcon) : SceneTool (parent), mEmptyIcon (emptyIcon), mButtonSize (parent->getButtonSize()), - mIconSize (parent->getIconSize()), mToolTip (toolTip), mFirst (0) + mIconSize (parent->getIconSize()), mToolTip (toolTip), mFirst (nullptr) { mPanel = new QFrame (this, Qt::Popup); diff --git a/apps/opencs/view/widget/scenetooltoggle2.cpp b/apps/opencs/view/widget/scenetooltoggle2.cpp index 720da6a96..cf9bfe349 100644 --- a/apps/opencs/view/widget/scenetooltoggle2.cpp +++ b/apps/opencs/view/widget/scenetooltoggle2.cpp @@ -57,7 +57,7 @@ CSVWidget::SceneToolToggle2::SceneToolToggle2 (SceneToolbar *parent, const QStri const std::string& compositeIcon, const std::string& singleIcon) : SceneTool (parent), mCompositeIcon (compositeIcon), mSingleIcon (singleIcon), mButtonSize (parent->getButtonSize()), mIconSize (parent->getIconSize()), mToolTip (toolTip), - mFirst (0) + mFirst (nullptr) { mPanel = new QFrame (this, Qt::Popup); diff --git a/apps/opencs/view/world/creator.cpp b/apps/opencs/view/world/creator.cpp index 7a93339c5..53664c186 100644 --- a/apps/opencs/view/world/creator.cpp +++ b/apps/opencs/view/world/creator.cpp @@ -17,5 +17,5 @@ CSVWorld::CreatorFactoryBase::~CreatorFactoryBase() {} CSVWorld::Creator *CSVWorld::NullCreatorFactory::makeCreator (CSMDoc::Document& document, const CSMWorld::UniversalId& id) const { - return 0; + return nullptr; } diff --git a/apps/opencs/view/world/dialoguespinbox.hpp b/apps/opencs/view/world/dialoguespinbox.hpp index b7c4889a5..90fe8d20c 100644 --- a/apps/opencs/view/world/dialoguespinbox.hpp +++ b/apps/opencs/view/world/dialoguespinbox.hpp @@ -12,7 +12,7 @@ namespace CSVWorld public: - DialogueSpinBox (QWidget *parent = 0); + DialogueSpinBox (QWidget *parent = nullptr); protected: @@ -27,7 +27,7 @@ namespace CSVWorld public: - DialogueDoubleSpinBox (QWidget *parent = 0); + DialogueDoubleSpinBox (QWidget *parent = nullptr); protected: diff --git a/apps/opencs/view/world/dialoguesubview.cpp b/apps/opencs/view/world/dialoguesubview.cpp index e29fcb779..3d3b3cdbe 100644 --- a/apps/opencs/view/world/dialoguesubview.cpp +++ b/apps/opencs/view/world/dialoguesubview.cpp @@ -498,7 +498,7 @@ void CSVWorld::EditWidget::remake(int row) if (mDispatcher) delete mDispatcher; - mDispatcher = new DialogueDelegateDispatcher(0/*this*/, mTable, mCommandDispatcher, mDocument); + mDispatcher = new DialogueDelegateDispatcher(nullptr/*this*/, mTable, mCommandDispatcher, mDocument); if (mNestedTableDispatcher) delete mNestedTableDispatcher; @@ -648,7 +648,7 @@ void CSVWorld::EditWidget::remake(int row) mNestedTableMapper->setModel(tree); // FIXME: lack MIME support? mNestedTableDispatcher = - new DialogueDelegateDispatcher (0/*this*/, mTable, mCommandDispatcher, mDocument, tree); + new DialogueDelegateDispatcher (nullptr/*this*/, mTable, mCommandDispatcher, mDocument, tree); mNestedTableMapper->setRootIndex (tree->index(row, i)); mNestedTableMapper->setItemDelegate(mNestedTableDispatcher); @@ -732,7 +732,7 @@ bool CSVWorld::SimpleDialogueSubView::isLocked() const CSVWorld::SimpleDialogueSubView::SimpleDialogueSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document) : SubView (id), - mEditWidget(0), + mEditWidget(nullptr), mMainLayout(nullptr), mTable(dynamic_cast(document.getData().getTableModel(id))), mLocked(false), @@ -834,7 +834,7 @@ void CSVWorld::SimpleDialogueSubView::rowsAboutToBeRemoved(const QModelIndex &pa if(mEditWidget) { delete mEditWidget; - mEditWidget = 0; + mEditWidget = nullptr; } emit closeRequest(this); } @@ -869,7 +869,7 @@ void CSVWorld::DialogueSubView::addButtonBar() CSVWorld::DialogueSubView::DialogueSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document, const CreatorFactoryBase& creatorFactory, bool sorting) -: SimpleDialogueSubView (id, document), mButtons (0) +: SimpleDialogueSubView (id, document), mButtons (nullptr) { // bottom box mBottom = new TableBottomBox (creatorFactory, document, id, this); @@ -905,7 +905,7 @@ void CSVWorld::DialogueSubView::settingChanged (const CSMPrefs::Setting *setting { getMainLayout().removeWidget (mButtons); delete mButtons; - mButtons = 0; + mButtons = nullptr; } } } diff --git a/apps/opencs/view/world/dialoguesubview.hpp b/apps/opencs/view/world/dialoguesubview.hpp index eb14efa8e..2cf05f711 100644 --- a/apps/opencs/view/world/dialoguesubview.hpp +++ b/apps/opencs/view/world/dialoguesubview.hpp @@ -50,7 +50,7 @@ namespace CSVWorld const CSMWorld::IdTable* mTable; public: NotEditableSubDelegate(const CSMWorld::IdTable* table, - QObject * parent = 0); + QObject * parent = nullptr); void setEditorData (QWidget* editor, const QModelIndex& index) const override; @@ -126,7 +126,7 @@ namespace CSVWorld CSMWorld::IdTable* table, CSMWorld::CommandDispatcher& commandDispatcher, CSMDoc::Document& document, - QAbstractItemModel* model = 0); + QAbstractItemModel* model = nullptr); ~DialogueDelegateDispatcher(); diff --git a/apps/opencs/view/world/enumdelegate.cpp b/apps/opencs/view/world/enumdelegate.cpp index 3140adc48..65ded46c7 100644 --- a/apps/opencs/view/world/enumdelegate.cpp +++ b/apps/opencs/view/world/enumdelegate.cpp @@ -71,7 +71,7 @@ QWidget *CSVWorld::EnumDelegate::createEditor(QWidget *parent, const QStyleOptio const QModelIndex& index, CSMWorld::ColumnBase::Display display) const { if (!index.data(Qt::EditRole).isValid() && !index.data(Qt::DisplayRole).isValid()) - return 0; + return nullptr; QComboBox *comboBox = new QComboBox (parent); diff --git a/apps/opencs/view/world/extendedcommandconfigurator.hpp b/apps/opencs/view/world/extendedcommandconfigurator.hpp index 42573924a..85862ac49 100644 --- a/apps/opencs/view/world/extendedcommandconfigurator.hpp +++ b/apps/opencs/view/world/extendedcommandconfigurator.hpp @@ -57,7 +57,7 @@ namespace CSVWorld public: ExtendedCommandConfigurator(CSMDoc::Document &document, const CSMWorld::UniversalId &id, - QWidget *parent = 0); + QWidget *parent = nullptr); void configure(Mode mode, const std::vector &selectedIds); void setEditLock(bool locked); diff --git a/apps/opencs/view/world/genericcreator.cpp b/apps/opencs/view/world/genericcreator.cpp index 5e2118e9b..23813f806 100644 --- a/apps/opencs/view/world/genericcreator.cpp +++ b/apps/opencs/view/world/genericcreator.cpp @@ -148,8 +148,8 @@ void CSVWorld::GenericCreator::addScope (const QString& name, CSMWorld::Scope sc CSVWorld::GenericCreator::GenericCreator (CSMWorld::Data& data, QUndoStack& undoStack, const CSMWorld::UniversalId& id, bool relaxedIdRules) : mData (data), mUndoStack (undoStack), mListId (id), mLocked (false), - mClonedType (CSMWorld::UniversalId::Type_None), mScopes (CSMWorld::Scope_Content), mScope (0), - mScopeLabel (0), mCloneMode (false) + mClonedType (CSMWorld::UniversalId::Type_None), mScopes (CSMWorld::Scope_Content), mScope (nullptr), + mScopeLabel (nullptr), mCloneMode (false) { // If the collection ID has a parent type, use it instead. // It will change IDs with Record/SubRecord class (used for creators in Dialogue subviews) @@ -322,10 +322,10 @@ void CSVWorld::GenericCreator::setScope (unsigned int scope) else { delete mScope; - mScope = 0; + mScope = nullptr; delete mScopeLabel; - mScopeLabel = 0; + mScopeLabel = nullptr; } updateNamespace(); diff --git a/apps/opencs/view/world/idcompletiondelegate.cpp b/apps/opencs/view/world/idcompletiondelegate.cpp index 4ff850b9f..447bcc25d 100644 --- a/apps/opencs/view/world/idcompletiondelegate.cpp +++ b/apps/opencs/view/world/idcompletiondelegate.cpp @@ -74,7 +74,7 @@ QWidget *CSVWorld::IdCompletionDelegate::createEditor(QWidget *parent, { return new CSVWidget::DropLineEdit(display, parent); } - default: return 0; // The rest of them can't be edited anyway + default: return nullptr; // The rest of them can't be edited anyway } } diff --git a/apps/opencs/view/world/idvalidator.hpp b/apps/opencs/view/world/idvalidator.hpp index 17624a243..278335a65 100644 --- a/apps/opencs/view/world/idvalidator.hpp +++ b/apps/opencs/view/world/idvalidator.hpp @@ -19,7 +19,7 @@ namespace CSVWorld public: - IdValidator (bool relaxed = false, QObject *parent = 0); + IdValidator (bool relaxed = false, QObject *parent = nullptr); ///< \param relaxed Relaxed rules for IDs that also functino as user visible text State validate (QString& input, int& pos) const override; diff --git a/apps/opencs/view/world/recordbuttonbar.hpp b/apps/opencs/view/world/recordbuttonbar.hpp index fbee066ce..aca3211f8 100644 --- a/apps/opencs/view/world/recordbuttonbar.hpp +++ b/apps/opencs/view/world/recordbuttonbar.hpp @@ -58,8 +58,8 @@ namespace CSVWorld public: RecordButtonBar (const CSMWorld::UniversalId& id, - CSMWorld::IdTable& table, TableBottomBox *bottomBox = 0, - CSMWorld::CommandDispatcher *commandDispatcher = 0, QWidget *parent = 0); + CSMWorld::IdTable& table, TableBottomBox *bottomBox = nullptr, + CSMWorld::CommandDispatcher *commandDispatcher = nullptr, QWidget *parent = nullptr); void setEditLock (bool locked); diff --git a/apps/opencs/view/world/recordstatusdelegate.hpp b/apps/opencs/view/world/recordstatusdelegate.hpp index 6ec8c37bd..38f066862 100644 --- a/apps/opencs/view/world/recordstatusdelegate.hpp +++ b/apps/opencs/view/world/recordstatusdelegate.hpp @@ -19,7 +19,7 @@ namespace CSVWorld RecordStatusDelegate (const ValueList& values, const IconList& icons, CSMWorld::CommandDispatcher *dispatcher, CSMDoc::Document& document, - QObject *parent = 0); + QObject *parent = nullptr); }; class RecordStatusDelegateFactory : public DataDisplayDelegateFactory diff --git a/apps/opencs/view/world/regionmap.hpp b/apps/opencs/view/world/regionmap.hpp index b1f7cdc67..443de9ce3 100644 --- a/apps/opencs/view/world/regionmap.hpp +++ b/apps/opencs/view/world/regionmap.hpp @@ -61,7 +61,7 @@ namespace CSVWorld public: RegionMap (const CSMWorld::UniversalId& universalId, CSMDoc::Document& document, - QWidget *parent = 0); + QWidget *parent = nullptr); std::vector getDraggedRecords() const override; diff --git a/apps/opencs/view/world/scriptedit.cpp b/apps/opencs/view/world/scriptedit.cpp index 9083359d2..743df9c76 100644 --- a/apps/opencs/view/world/scriptedit.cpp +++ b/apps/opencs/view/world/scriptedit.cpp @@ -47,7 +47,7 @@ CSVWorld::ScriptEdit::ScriptEdit( ) : QPlainTextEdit(parent), mChangeLocked(0), mShowLineNum(false), - mLineNumberArea(0), + mLineNumberArea(nullptr), mDefaultFont(font()), mMonoFont(QFont("Monospace")), mTabCharCount(4), @@ -314,7 +314,7 @@ void CSVWorld::ScriptEdit::markOccurrences() // prevent infinite recursion with cursor.select(), // which ends up calling this function again // could be fixed with blockSignals, but mDocument is const - disconnect(this, SIGNAL(cursorPositionChanged()), this, 0); + disconnect(this, SIGNAL(cursorPositionChanged()), this, nullptr); cursor.select(QTextCursor::WordUnderCursor); connect(this, SIGNAL(cursorPositionChanged()), this, SLOT(markOccurrences())); diff --git a/apps/opencs/view/world/scripterrortable.hpp b/apps/opencs/view/world/scripterrortable.hpp index ad287707d..7165d0fc6 100644 --- a/apps/opencs/view/world/scripterrortable.hpp +++ b/apps/opencs/view/world/scripterrortable.hpp @@ -41,7 +41,7 @@ namespace CSVWorld public: - ScriptErrorTable (const CSMDoc::Document& document, QWidget *parent = 0); + ScriptErrorTable (const CSMDoc::Document& document, QWidget *parent = nullptr); void update (const std::string& source); diff --git a/apps/opencs/view/world/scriptsubview.cpp b/apps/opencs/view/world/scriptsubview.cpp index 58ad09451..096fc8a9e 100644 --- a/apps/opencs/view/world/scriptsubview.cpp +++ b/apps/opencs/view/world/scriptsubview.cpp @@ -88,7 +88,7 @@ void CSVWorld::ScriptSubView::adjustSplitter() } CSVWorld::ScriptSubView::ScriptSubView (const CSMWorld::UniversalId& id, CSMDoc::Document& document) -: SubView (id), mDocument (document), mColumn (-1), mBottom(0), mButtons (0), +: SubView (id), mDocument (document), mColumn (-1), mBottom(nullptr), mButtons (nullptr), mCommandDispatcher (document, CSMWorld::UniversalId::getParentType (id.getType())), mErrorHeight (CSMPrefs::get()["Scripts"]["error-height"].toInt()) { @@ -177,7 +177,7 @@ void CSVWorld::ScriptSubView::settingChanged (const CSMPrefs::Setting *setting) { mLayout.removeWidget (mButtons); delete mButtons; - mButtons = 0; + mButtons = nullptr; } } else if (*setting=="Scripts/compile-delay") diff --git a/apps/opencs/view/world/tablebottombox.hpp b/apps/opencs/view/world/tablebottombox.hpp index 50d61150f..6ad2dbd82 100644 --- a/apps/opencs/view/world/tablebottombox.hpp +++ b/apps/opencs/view/world/tablebottombox.hpp @@ -59,7 +59,7 @@ namespace CSVWorld TableBottomBox (const CreatorFactoryBase& creatorFactory, CSMDoc::Document& document, const CSMWorld::UniversalId& id, - QWidget *parent = 0); + QWidget *parent = nullptr); virtual ~TableBottomBox(); diff --git a/apps/opencs/view/world/tableeditidaction.hpp b/apps/opencs/view/world/tableeditidaction.hpp index f2cf0b7bd..9fe41b0de 100644 --- a/apps/opencs/view/world/tableeditidaction.hpp +++ b/apps/opencs/view/world/tableeditidaction.hpp @@ -19,7 +19,7 @@ namespace CSVWorld CellData getCellData(int row, int column) const; public: - TableEditIdAction(const QTableView &table, QWidget *parent = 0); + TableEditIdAction(const QTableView &table, QWidget *parent = nullptr); void setCell(int row, int column); diff --git a/apps/opencs/view/world/util.cpp b/apps/opencs/view/world/util.cpp index 5a4503362..ba9f40847 100644 --- a/apps/opencs/view/world/util.cpp +++ b/apps/opencs/view/world/util.cpp @@ -57,7 +57,7 @@ QVariant CSVWorld::NastyTableModelHack::getData() const CSVWorld::CommandDelegateFactory::~CommandDelegateFactory() {} -CSVWorld::CommandDelegateFactoryCollection *CSVWorld::CommandDelegateFactoryCollection::sThis = 0; +CSVWorld::CommandDelegateFactoryCollection *CSVWorld::CommandDelegateFactoryCollection::sThis = nullptr; CSVWorld::CommandDelegateFactoryCollection::CommandDelegateFactoryCollection() { @@ -69,7 +69,7 @@ CSVWorld::CommandDelegateFactoryCollection::CommandDelegateFactoryCollection() CSVWorld::CommandDelegateFactoryCollection::~CommandDelegateFactoryCollection() { - sThis = 0; + sThis = nullptr; for (std::map::iterator iter ( mFactories.begin()); @@ -193,7 +193,7 @@ QWidget *CSVWorld::CommandDelegate::createEditor (QWidget *parent, const QStyleO variant = index.data(Qt::DisplayRole); if (!variant.isValid()) { - return 0; + return nullptr; } } @@ -362,7 +362,7 @@ void CSVWorld::CommandDelegate::setEditorData (QWidget *editor, const QModelInde if (!n.isEmpty()) { if (!variant.isValid()) - variant = QVariant(editor->property(n).userType(), (const void *)0); + variant = QVariant(editor->property(n).userType(), (const void *)nullptr); editor->setProperty(n, variant); } diff --git a/apps/openmw/engine.cpp b/apps/openmw/engine.cpp index 0bfd67dd7..8092bb770 100644 --- a/apps/openmw/engine.cpp +++ b/apps/openmw/engine.cpp @@ -380,7 +380,7 @@ OMW::Engine::Engine(Files::ConfigurationManager& configurationManager) , mGrab(true) , mExportFonts(false) , mRandomSeed(0) - , mScriptContext (0) + , mScriptContext (nullptr) , mFSStrict (false) , mScriptBlacklistUse (true) , mNewGame (false) diff --git a/apps/openmw/mwbase/environment.cpp b/apps/openmw/mwbase/environment.cpp index 764a07ec9..aca2685e0 100644 --- a/apps/openmw/mwbase/environment.cpp +++ b/apps/openmw/mwbase/environment.cpp @@ -14,11 +14,11 @@ #include "windowmanager.hpp" #include "statemanager.hpp" -MWBase::Environment *MWBase::Environment::sThis = 0; +MWBase::Environment *MWBase::Environment::sThis = nullptr; MWBase::Environment::Environment() -: mWorld (0), mSoundManager (0), mScriptManager (0), mWindowManager (0), - mMechanicsManager (0), mDialogueManager (0), mJournal (0), mInputManager (0), mStateManager (0), +: mWorld (nullptr), mSoundManager (nullptr), mScriptManager (nullptr), mWindowManager (nullptr), + mMechanicsManager (nullptr), mDialogueManager (nullptr), mJournal (nullptr), mInputManager (nullptr), mStateManager (nullptr), mFrameDuration (0), mFrameRateLimit(0.f) { assert (!sThis); @@ -28,7 +28,7 @@ MWBase::Environment::Environment() MWBase::Environment::~Environment() { cleanup(); - sThis = 0; + sThis = nullptr; } void MWBase::Environment::setWorld (World *world) @@ -166,31 +166,31 @@ float MWBase::Environment::getFrameDuration() const void MWBase::Environment::cleanup() { delete mMechanicsManager; - mMechanicsManager = 0; + mMechanicsManager = nullptr; delete mDialogueManager; - mDialogueManager = 0; + mDialogueManager = nullptr; delete mJournal; - mJournal = 0; + mJournal = nullptr; delete mScriptManager; - mScriptManager = 0; + mScriptManager = nullptr; delete mWindowManager; - mWindowManager = 0; + mWindowManager = nullptr; delete mWorld; - mWorld = 0; + mWorld = nullptr; delete mSoundManager; - mSoundManager = 0; + mSoundManager = nullptr; delete mInputManager; - mInputManager = 0; + mInputManager = nullptr; delete mStateManager; - mStateManager = 0; + mStateManager = nullptr; } const MWBase::Environment& MWBase::Environment::get() diff --git a/apps/openmw/mwbase/statemanager.hpp b/apps/openmw/mwbase/statemanager.hpp index 643695c37..157833a0e 100644 --- a/apps/openmw/mwbase/statemanager.hpp +++ b/apps/openmw/mwbase/statemanager.hpp @@ -59,7 +59,7 @@ namespace MWBase virtual void deleteGame (const MWState::Character *character, const MWState::Slot *slot) = 0; - virtual void saveGame (const std::string& description, const MWState::Slot *slot = 0) = 0; + virtual void saveGame (const std::string& description, const MWState::Slot *slot = nullptr) = 0; ///< Write a saved game to \a slot or create a new slot if \a slot == 0. /// /// \note Slot must belong to the current character. diff --git a/apps/openmw/mwbase/world.hpp b/apps/openmw/mwbase/world.hpp index 49bc76a76..d4f1d2f8a 100644 --- a/apps/openmw/mwbase/world.hpp +++ b/apps/openmw/mwbase/world.hpp @@ -180,7 +180,7 @@ namespace MWBase virtual char getGlobalVariableType (const std::string& name) const = 0; ///< Return ' ', if there is no global variable with this name. - virtual std::string getCellName (const MWWorld::CellStore *cell = 0) const = 0; + virtual std::string getCellName (const MWWorld::CellStore *cell = nullptr) const = 0; ///< Return name of the cell. /// /// \note If cell==0, the cell the player is currently in will be used instead to diff --git a/apps/openmw/mwclass/creature.cpp b/apps/openmw/mwclass/creature.cpp index c51eab513..31341db73 100644 --- a/apps/openmw/mwclass/creature.cpp +++ b/apps/openmw/mwclass/creature.cpp @@ -69,7 +69,7 @@ namespace MWClass return *this; } - CreatureCustomData() : mContainerStore(0) {} + CreatureCustomData() : mContainerStore(nullptr) {} virtual ~CreatureCustomData() { delete mContainerStore; } }; diff --git a/apps/openmw/mwgui/bookpage.cpp b/apps/openmw/mwgui/bookpage.cpp index 8a6ec998d..c70783f39 100644 --- a/apps/openmw/mwgui/bookpage.cpp +++ b/apps/openmw/mwgui/bookpage.cpp @@ -925,7 +925,7 @@ public: void dirtyFocusItem () { - if (mFocusItem != 0) + if (mFocusItem != nullptr) { MyGUI::IFont* Font = mBook->affectedFont (mFocusItem); @@ -946,7 +946,7 @@ public: dirtyFocusItem (); - mFocusItem = 0; + mFocusItem = nullptr; mItemActive = false; } @@ -976,7 +976,7 @@ public: } } else - if (mFocusItem != 0) + if (mFocusItem != nullptr) { bool newItemActive = hit == mFocusItem; diff --git a/apps/openmw/mwgui/charactercreation.cpp b/apps/openmw/mwgui/charactercreation.cpp index 31fe3afb0..827f87c7d 100644 --- a/apps/openmw/mwgui/charactercreation.cpp +++ b/apps/openmw/mwgui/charactercreation.cpp @@ -87,15 +87,15 @@ namespace MWGui CharacterCreation::CharacterCreation(osg::Group* parent, Resource::ResourceSystem* resourceSystem) : mParent(parent) , mResourceSystem(resourceSystem) - , mNameDialog(0) - , mRaceDialog(0) - , mClassChoiceDialog(0) - , mGenerateClassQuestionDialog(0) - , mGenerateClassResultDialog(0) - , mPickClassDialog(0) - , mCreateClassDialog(0) - , mBirthSignDialog(0) - , mReviewDialog(0) + , mNameDialog(nullptr) + , mRaceDialog(nullptr) + , mClassChoiceDialog(nullptr) + , mGenerateClassQuestionDialog(nullptr) + , mGenerateClassResultDialog(nullptr) + , mPickClassDialog(nullptr) + , mCreateClassDialog(nullptr) + , mBirthSignDialog(nullptr) + , mReviewDialog(nullptr) , mGenerateClassStep(0) { mCreationStage = CSE_NotStarted; @@ -184,7 +184,7 @@ namespace MWGui { case GM_Name: MWBase::Environment::get().getWindowManager()->removeDialog(mNameDialog); - mNameDialog = 0; + mNameDialog = nullptr; mNameDialog = new TextInputDialog(); mNameDialog->setTextLabel(MWBase::Environment::get().getWindowManager()->getGameSettingString("sName", "Name")); mNameDialog->setTextInput(mPlayerName); @@ -195,7 +195,7 @@ namespace MWGui case GM_Race: MWBase::Environment::get().getWindowManager()->removeDialog(mRaceDialog); - mRaceDialog = 0; + mRaceDialog = nullptr; mRaceDialog = new RaceDialog(mParent, mResourceSystem); mRaceDialog->setNextButtonShow(mCreationStage >= CSE_RaceChosen); mRaceDialog->setRaceId(mPlayerRaceId); @@ -208,7 +208,7 @@ namespace MWGui case GM_Class: MWBase::Environment::get().getWindowManager()->removeDialog(mClassChoiceDialog); - mClassChoiceDialog = 0; + mClassChoiceDialog = nullptr; mClassChoiceDialog = new ClassChoiceDialog(); mClassChoiceDialog->eventButtonSelected += MyGUI::newDelegate(this, &CharacterCreation::onClassChoice); mClassChoiceDialog->setVisible(true); @@ -218,7 +218,7 @@ namespace MWGui case GM_ClassPick: MWBase::Environment::get().getWindowManager()->removeDialog(mPickClassDialog); - mPickClassDialog = 0; + mPickClassDialog = nullptr; mPickClassDialog = new PickClassDialog(); mPickClassDialog->setNextButtonShow(mCreationStage >= CSE_ClassChosen); mPickClassDialog->setClassId(mPlayerClass.mId); @@ -231,7 +231,7 @@ namespace MWGui case GM_Birth: MWBase::Environment::get().getWindowManager()->removeDialog(mBirthSignDialog); - mBirthSignDialog = 0; + mBirthSignDialog = nullptr; mBirthSignDialog = new BirthDialog(); mBirthSignDialog->setNextButtonShow(mCreationStage >= CSE_BirthSignChosen); mBirthSignDialog->setBirthId(mPlayerBirthSignId); @@ -266,7 +266,7 @@ namespace MWGui break; case GM_Review: MWBase::Environment::get().getWindowManager()->removeDialog(mReviewDialog); - mReviewDialog = 0; + mReviewDialog = nullptr; mReviewDialog = new ReviewDialog(); MWBase::World *world = MWBase::Environment::get().getWorld(); @@ -316,7 +316,7 @@ namespace MWGui void CharacterCreation::onReviewDialogDone(WindowBase* parWindow) { MWBase::Environment::get().getWindowManager()->removeDialog(mReviewDialog); - mReviewDialog = 0; + mReviewDialog = nullptr; MWBase::Environment::get().getWindowManager()->popGuiMode(); } @@ -324,7 +324,7 @@ namespace MWGui void CharacterCreation::onReviewDialogBack() { MWBase::Environment::get().getWindowManager()->removeDialog(mReviewDialog); - mReviewDialog = 0; + mReviewDialog = nullptr; mCreationStage = CSE_ReviewBack; MWBase::Environment::get().getWindowManager()->popGuiMode(); @@ -334,7 +334,7 @@ namespace MWGui void CharacterCreation::onReviewActivateDialog(int parDialog) { MWBase::Environment::get().getWindowManager()->removeDialog(mReviewDialog); - mReviewDialog = 0; + mReviewDialog = nullptr; mCreationStage = CSE_ReviewNext; MWBase::Environment::get().getWindowManager()->popGuiMode(); @@ -370,7 +370,7 @@ namespace MWGui mPlayerClass = *klass; } MWBase::Environment::get().getWindowManager()->removeDialog(mPickClassDialog); - mPickClassDialog = 0; + mPickClassDialog = nullptr; } updatePlayerHealth(); @@ -394,7 +394,7 @@ namespace MWGui void CharacterCreation::onClassChoice(int _index) { MWBase::Environment::get().getWindowManager()->removeDialog(mClassChoiceDialog); - mClassChoiceDialog = 0; + mClassChoiceDialog = nullptr; MWBase::Environment::get().getWindowManager()->popGuiMode(); @@ -423,7 +423,7 @@ namespace MWGui mPlayerName = mNameDialog->getTextInput(); MWBase::Environment::get().getMechanicsManager()->setPlayerName(mPlayerName); MWBase::Environment::get().getWindowManager()->removeDialog(mNameDialog); - mNameDialog = 0; + mNameDialog = nullptr; } handleDialogDone(CSE_NameChosen, GM_Race); @@ -446,7 +446,7 @@ namespace MWGui MWBase::Environment::get().getWindowManager()->getInventoryWindow()->rebuildAvatar(); MWBase::Environment::get().getWindowManager()->removeDialog(mRaceDialog); - mRaceDialog = 0; + mRaceDialog = nullptr; } updatePlayerHealth(); @@ -475,7 +475,7 @@ namespace MWGui if (!mPlayerBirthSignId.empty()) MWBase::Environment::get().getMechanicsManager()->setPlayerBirthsign(mPlayerBirthSignId); MWBase::Environment::get().getWindowManager()->removeDialog(mBirthSignDialog); - mBirthSignDialog = 0; + mBirthSignDialog = nullptr; } updatePlayerHealth(); @@ -551,7 +551,7 @@ namespace MWGui MWBase::Environment::get().getSoundManager()->stopSay(); MWBase::Environment::get().getWindowManager()->removeDialog(mGenerateClassQuestionDialog); - mGenerateClassQuestionDialog = 0; + mGenerateClassQuestionDialog = nullptr; if (_index < 0 || _index >= 3) { @@ -669,7 +669,7 @@ namespace MWGui } MWBase::Environment::get().getWindowManager()->removeDialog(mGenerateClassResultDialog); - mGenerateClassResultDialog = 0; + mGenerateClassResultDialog = nullptr; mGenerateClassResultDialog = new GenerateClassResultDialog(); mGenerateClassResultDialog->setClassId(mGenerateClass); @@ -687,7 +687,7 @@ namespace MWGui } MWBase::Environment::get().getWindowManager()->removeDialog(mGenerateClassQuestionDialog); - mGenerateClassQuestionDialog = 0; + mGenerateClassQuestionDialog = nullptr; mGenerateClassQuestionDialog = new InfoBoxDialog(); @@ -711,7 +711,7 @@ namespace MWGui void CharacterCreation::selectGeneratedClass() { MWBase::Environment::get().getWindowManager()->removeDialog(mGenerateClassResultDialog); - mGenerateClassResultDialog = 0; + mGenerateClassResultDialog = nullptr; MWBase::Environment::get().getMechanicsManager()->setPlayerClass(mGenerateClass); diff --git a/apps/openmw/mwgui/class.cpp b/apps/openmw/mwgui/class.cpp index cfbf5e5fb..ee5fe5939 100644 --- a/apps/openmw/mwgui/class.cpp +++ b/apps/openmw/mwgui/class.cpp @@ -550,16 +550,16 @@ namespace MWGui void CreateClassDialog::onDialogCancel() { MWBase::Environment::get().getWindowManager()->removeDialog(mSpecDialog); - mSpecDialog = 0; + mSpecDialog = nullptr; MWBase::Environment::get().getWindowManager()->removeDialog(mAttribDialog); - mAttribDialog = 0; + mAttribDialog = nullptr; MWBase::Environment::get().getWindowManager()->removeDialog(mSkillDialog); - mSkillDialog = 0; + mSkillDialog = nullptr; MWBase::Environment::get().getWindowManager()->removeDialog(mDescDialog); - mDescDialog = 0; + mDescDialog = nullptr; } void CreateClassDialog::onSpecializationClicked(MyGUI::Widget* _sender) @@ -577,7 +577,7 @@ namespace MWGui setSpecialization(mSpecializationId); MWBase::Environment::get().getWindowManager()->removeDialog(mSpecDialog); - mSpecDialog = 0; + mSpecDialog = nullptr; } void CreateClassDialog::setSpecialization(int id) @@ -618,7 +618,7 @@ namespace MWGui } mAffectedAttribute->setAttributeId(id); MWBase::Environment::get().getWindowManager()->removeDialog(mAttribDialog); - mAttribDialog = 0; + mAttribDialog = nullptr; update(); } @@ -651,7 +651,7 @@ namespace MWGui mAffectedSkill->setSkillId(mSkillDialog->getSkillId()); MWBase::Environment::get().getWindowManager()->removeDialog(mSkillDialog); - mSkillDialog = 0; + mSkillDialog = nullptr; update(); } @@ -667,7 +667,7 @@ namespace MWGui { mDescription = mDescDialog->getTextInput(); MWBase::Environment::get().getWindowManager()->removeDialog(mDescDialog); - mDescDialog = 0; + mDescDialog = nullptr; } void CreateClassDialog::onOkClicked(MyGUI::Widget* _sender) diff --git a/apps/openmw/mwgui/console.cpp b/apps/openmw/mwgui/console.cpp index e56cd170c..89ba5d388 100644 --- a/apps/openmw/mwgui/console.cpp +++ b/apps/openmw/mwgui/console.cpp @@ -36,7 +36,7 @@ namespace MWGui ConsoleInterpreterContext::ConsoleInterpreterContext (Console& console, MWWorld::Ptr reference) : MWScript::InterpreterContext ( - reference.isEmpty() ? 0 : &reference.getRefData().getLocals(), reference), + reference.isEmpty() ? nullptr : &reference.getRefData().getLocals(), reference), mConsole (console) {} diff --git a/apps/openmw/mwgui/draganddrop.cpp b/apps/openmw/mwgui/draganddrop.cpp index daf9f6636..cfe60db5d 100644 --- a/apps/openmw/mwgui/draganddrop.cpp +++ b/apps/openmw/mwgui/draganddrop.cpp @@ -135,7 +135,7 @@ void DragAndDrop::finish() MWBase::Environment::get().getWindowManager()->getInventoryWindow()->updateItemView(); MyGUI::Gui::getInstance().destroyWidget(mDraggedWidget); - mDraggedWidget = 0; + mDraggedWidget = nullptr; MWBase::Environment::get().getWindowManager()->setDragDrop(false); } diff --git a/apps/openmw/mwgui/mainmenu.cpp b/apps/openmw/mwgui/mainmenu.cpp index a5d8f7344..4e695710f 100644 --- a/apps/openmw/mwgui/mainmenu.cpp +++ b/apps/openmw/mwgui/mainmenu.cpp @@ -24,7 +24,7 @@ namespace MWGui MainMenu::MainMenu(int w, int h, const VFS::Manager* vfs, const std::string& versionDescription) : WindowBase("openmw_mainmenu.layout") , mWidth (w), mHeight (h) - , mVFS(vfs), mButtonBox(0) + , mVFS(vfs), mButtonBox(nullptr) , mBackground(nullptr) , mVideoBackground(nullptr) , mVideo(nullptr) diff --git a/apps/openmw/mwgui/mapwindow.cpp b/apps/openmw/mwgui/mapwindow.cpp index acf131926..6e8804a43 100644 --- a/apps/openmw/mwgui/mapwindow.cpp +++ b/apps/openmw/mwgui/mapwindow.cpp @@ -644,7 +644,7 @@ namespace MWGui : WindowPinnableBase("openmw_map_window.layout") , LocalMapBase(customMarkers, localMapRender) , NoDrop(drag, mMainWidget) - , mGlobalMap(0) + , mGlobalMap(nullptr) , mGlobalMapImage(nullptr) , mGlobalMapOverlay(nullptr) , mGlobal(Settings::Manager::getBool("global", "Map")) diff --git a/apps/openmw/mwgui/quickkeysmenu.cpp b/apps/openmw/mwgui/quickkeysmenu.cpp index 214e52942..a6bfac2a4 100644 --- a/apps/openmw/mwgui/quickkeysmenu.cpp +++ b/apps/openmw/mwgui/quickkeysmenu.cpp @@ -37,9 +37,9 @@ namespace MWGui , mKey(std::vector(10)) , mSelected(nullptr) , mActivated(nullptr) - , mAssignDialog(0) - , mItemSelectionDialog(0) - , mMagicSelectionDialog(0) + , mAssignDialog(nullptr) + , mItemSelectionDialog(nullptr) + , mMagicSelectionDialog(nullptr) { getWidget(mOkButton, "OKButton"); diff --git a/apps/openmw/mwgui/review.cpp b/apps/openmw/mwgui/review.cpp index e76cbe770..101b6956d 100644 --- a/apps/openmw/mwgui/review.cpp +++ b/apps/openmw/mwgui/review.cpp @@ -86,7 +86,7 @@ namespace MWGui for (int i = 0; i < ESM::Skill::Length; ++i) { mSkillValues.insert(std::make_pair(i, MWMechanics::SkillValue())); - mSkillWidgetMap.insert(std::make_pair(i, static_cast (0))); + mSkillWidgetMap.insert(std::make_pair(i, static_cast (nullptr))); } MyGUI::Button* backButton; diff --git a/apps/openmw/mwgui/spellcreationdialog.cpp b/apps/openmw/mwgui/spellcreationdialog.cpp index 1f086507f..f9de469e2 100644 --- a/apps/openmw/mwgui/spellcreationdialog.cpp +++ b/apps/openmw/mwgui/spellcreationdialog.cpp @@ -587,7 +587,7 @@ namespace MWGui mAddEffectDialog.newEffect(effect); mAddEffectDialog.setAttribute (mSelectAttributeDialog->getAttributeId()); MWBase::Environment::get().getWindowManager ()->removeDialog (mSelectAttributeDialog); - mSelectAttributeDialog = 0; + mSelectAttributeDialog = nullptr; } void EffectEditorBase::onSelectSkill () @@ -598,7 +598,7 @@ namespace MWGui mAddEffectDialog.newEffect(effect); mAddEffectDialog.setSkill (mSelectSkillDialog->getSkillId()); MWBase::Environment::get().getWindowManager ()->removeDialog (mSelectSkillDialog); - mSelectSkillDialog = 0; + mSelectSkillDialog = nullptr; } void EffectEditorBase::onAttributeOrSkillCancel () @@ -608,8 +608,8 @@ namespace MWGui if (mSelectAttributeDialog) MWBase::Environment::get().getWindowManager ()->removeDialog (mSelectAttributeDialog); - mSelectSkillDialog = 0; - mSelectAttributeDialog = 0; + mSelectSkillDialog = nullptr; + mSelectAttributeDialog = nullptr; } void EffectEditorBase::onAvailableEffectClicked (MyGUI::Widget* sender) diff --git a/apps/openmw/mwgui/tooltips.cpp b/apps/openmw/mwgui/tooltips.cpp index c0db57b1b..e0a8e4d3e 100644 --- a/apps/openmw/mwgui/tooltips.cpp +++ b/apps/openmw/mwgui/tooltips.cpp @@ -153,7 +153,7 @@ namespace MWGui return; MyGUI::Widget* focus = MyGUI::InputManager::getInstance().getMouseFocusWidget(); - if (focus == 0) + if (focus == nullptr) return; MyGUI::IntSize tooltipSize; @@ -410,7 +410,7 @@ namespace MWGui if (text.size() > 0 && text[0] == '\n') text.erase(0, 1); - const ESM::Enchantment* enchant = 0; + const ESM::Enchantment* enchant = nullptr; const MWWorld::ESMStore& store = MWBase::Environment::get().getWorld()->getStore(); if (info.enchant != "") { diff --git a/apps/openmw/mwgui/widgets.cpp b/apps/openmw/mwgui/widgets.cpp index 74076641a..fb8521f06 100644 --- a/apps/openmw/mwgui/widgets.cpp +++ b/apps/openmw/mwgui/widgets.cpp @@ -101,7 +101,7 @@ namespace MWGui button->eventMouseButtonClick += MyGUI::newDelegate(this, &MWSkill::onClicked); } - button = 0; + button = nullptr; assignWidget(button, "StatValueButton"); if (button) { @@ -192,7 +192,7 @@ namespace MWGui button->eventMouseButtonClick += MyGUI::newDelegate(this, &MWAttribute::onClicked); } - button = 0; + button = nullptr; assignWidget(button, "StatValueButton"); if (button) { diff --git a/apps/openmw/mwgui/windowmanagerimp.cpp b/apps/openmw/mwgui/windowmanagerimp.cpp index 840f0f9cf..bfce90810 100644 --- a/apps/openmw/mwgui/windowmanagerimp.cpp +++ b/apps/openmw/mwgui/windowmanagerimp.cpp @@ -1957,7 +1957,7 @@ namespace MWGui { if (_type != "Text") return; - char* text=0; + char* text=nullptr; text = SDL_GetClipboardText(); if (text) _data = MyGUI::TextIterator::toTagsString(text); diff --git a/apps/openmw/mwinput/mousemanager.cpp b/apps/openmw/mwinput/mousemanager.cpp index ac30d4487..4816470ff 100644 --- a/apps/openmw/mwinput/mousemanager.cpp +++ b/apps/openmw/mwinput/mousemanager.cpp @@ -154,7 +154,7 @@ namespace MWInput { guiMode = MWBase::Environment::get().getWindowManager()->isGuiMode(); guiMode = MyGUI::InputManager::getInstance().injectMousePress(static_cast(mGuiCursorX), static_cast(mGuiCursorY), sdlButtonToMyGUI(id)) && guiMode; - if (MyGUI::InputManager::getInstance().getMouseFocusWidget () != 0) + if (MyGUI::InputManager::getInstance().getMouseFocusWidget () != nullptr) { MyGUI::Button* b = MyGUI::InputManager::getInstance().getMouseFocusWidget()->castType(false); if (b && b->getEnabled() && id == SDL_BUTTON_LEFT) diff --git a/apps/openmw/mwmechanics/alchemy.cpp b/apps/openmw/mwmechanics/alchemy.cpp index 116937fcd..6d06724f0 100644 --- a/apps/openmw/mwmechanics/alchemy.cpp +++ b/apps/openmw/mwmechanics/alchemy.cpp @@ -255,7 +255,7 @@ const ESM::Potion *MWMechanics::Alchemy::getRecord(const ESM::Potion& toFind) co return &(*iter); } - return 0; + return nullptr; } void MWMechanics::Alchemy::removeIngredients() diff --git a/apps/openmw/mwscript/transformationextensions.cpp b/apps/openmw/mwscript/transformationextensions.cpp index ce45729b3..a908940ed 100644 --- a/apps/openmw/mwscript/transformationextensions.cpp +++ b/apps/openmw/mwscript/transformationextensions.cpp @@ -368,7 +368,7 @@ namespace MWScript std::string cellID = runtime.getStringLiteral (runtime[0].mInteger); runtime.pop(); - MWWorld::CellStore* store = 0; + MWWorld::CellStore* store = nullptr; try { store = MWBase::Environment::get().getWorld()->getInterior(cellID); @@ -481,7 +481,7 @@ namespace MWScript Interpreter::Type_Float zRotDegrees = runtime[0].mFloat; runtime.pop(); - MWWorld::CellStore* store = 0; + MWWorld::CellStore* store = nullptr; try { store = MWBase::Environment::get().getWorld()->getInterior(cellID); diff --git a/apps/openmw/mwsound/ffmpeg_decoder.cpp b/apps/openmw/mwsound/ffmpeg_decoder.cpp index 6c334978c..95ed9eeed 100644 --- a/apps/openmw/mwsound/ffmpeg_decoder.cpp +++ b/apps/openmw/mwsound/ffmpeg_decoder.cpp @@ -437,7 +437,7 @@ FFmpeg_Decoder::FFmpeg_Decoder(const VFS::Manager* vfs) , mFrameSize(0) , mFramePos(0) , mNextPts(0.0) - , mSwr(0) + , mSwr(nullptr) , mOutputSampleFormat(AV_SAMPLE_FMT_NONE) , mOutputChannelLayout(0) , mDataBuf(nullptr) diff --git a/apps/openmw/mwsound/openal_output.cpp b/apps/openmw/mwsound/openal_output.cpp index a7be5a743..67b52309d 100644 --- a/apps/openmw/mwsound/openal_output.cpp +++ b/apps/openmw/mwsound/openal_output.cpp @@ -624,7 +624,7 @@ bool OpenAL_Output::init(const std::string &devname, const std::string &hrtfname attrs.reserve(15); if(ALC.SOFT_HRTF) { - LPALCGETSTRINGISOFT alcGetStringiSOFT = 0; + LPALCGETSTRINGISOFT alcGetStringiSOFT = nullptr; getALCFunc(alcGetStringiSOFT, mDevice, "alcGetStringiSOFT"); attrs.push_back(ALC_HRTF_SOFT); @@ -850,13 +850,13 @@ void OpenAL_Output::deinit() alDeleteFilters(1, &mWaterFilter); mWaterFilter = 0; - alcMakeContextCurrent(0); + alcMakeContextCurrent(nullptr); if(mContext) alcDestroyContext(mContext); - mContext = 0; + mContext = nullptr; if(mDevice) alcCloseDevice(mDevice); - mDevice = 0; + mDevice = nullptr; mInitialized = false; } @@ -869,7 +869,7 @@ std::vector OpenAL_Output::enumerateHrtf() if(!mDevice || !ALC.SOFT_HRTF) return ret; - LPALCGETSTRINGISOFT alcGetStringiSOFT = 0; + LPALCGETSTRINGISOFT alcGetStringiSOFT = nullptr; getALCFunc(alcGetStringiSOFT, mDevice, "alcGetStringiSOFT"); ALCint num_hrtf; @@ -892,10 +892,10 @@ void OpenAL_Output::setHrtf(const std::string &hrtfname, HrtfMode hrtfmode) return; } - LPALCGETSTRINGISOFT alcGetStringiSOFT = 0; + LPALCGETSTRINGISOFT alcGetStringiSOFT = nullptr; getALCFunc(alcGetStringiSOFT, mDevice, "alcGetStringiSOFT"); - LPALCRESETDEVICESOFT alcResetDeviceSOFT = 0; + LPALCRESETDEVICESOFT alcResetDeviceSOFT = nullptr; getALCFunc(alcResetDeviceSOFT, mDevice, "alcResetDeviceSOFT"); std::vector attrs; @@ -1213,7 +1213,7 @@ void OpenAL_Output::finishSound(Sound *sound) { if(!sound->mHandle) return; ALuint source = GET_PTRID(sound->mHandle); - sound->mHandle = 0; + sound->mHandle = nullptr; // Rewind the stream to put the source back into an AL_INITIAL state, for // the next time it's used. @@ -1316,7 +1316,7 @@ void OpenAL_Output::finishStream(Stream *sound) OpenAL_SoundStream *stream = reinterpret_cast(sound->mHandle); ALuint source = stream->mSource; - sound->mHandle = 0; + sound->mHandle = nullptr; mStreamThread->remove(stream); // Rewind the stream to put the source back into an AL_INITIAL state, for @@ -1462,7 +1462,7 @@ void OpenAL_Output::pauseActiveDevice() if(alcIsExtensionPresent(mDevice, "ALC_SOFT_PAUSE_DEVICE")) { - LPALCDEVICEPAUSESOFT alcDevicePauseSOFT = 0; + LPALCDEVICEPAUSESOFT alcDevicePauseSOFT = nullptr; getALCFunc(alcDevicePauseSOFT, mDevice, "alcDevicePauseSOFT"); alcDevicePauseSOFT(mDevice); getALCError(mDevice); @@ -1478,7 +1478,7 @@ void OpenAL_Output::resumeActiveDevice() if(alcIsExtensionPresent(mDevice, "ALC_SOFT_PAUSE_DEVICE")) { - LPALCDEVICERESUMESOFT alcDeviceResumeSOFT = 0; + LPALCDEVICERESUMESOFT alcDeviceResumeSOFT = nullptr; getALCFunc(alcDeviceResumeSOFT, mDevice, "alcDeviceResumeSOFT"); alcDeviceResumeSOFT(mDevice); getALCError(mDevice); @@ -1513,7 +1513,7 @@ void OpenAL_Output::resumeSounds(int types) OpenAL_Output::OpenAL_Output(SoundManager &mgr) : Sound_Output(mgr) - , mDevice(0), mContext(0) + , mDevice(nullptr), mContext(nullptr) , mListenerPos(0.0f, 0.0f, 0.0f), mListenerEnv(Env_Normal) , mWaterFilter(0), mWaterEffect(0), mDefaultEffect(0), mEffectSlot(0) , mStreamThread(new StreamThread) diff --git a/apps/openmw/mwsound/sound_buffer.hpp b/apps/openmw/mwsound/sound_buffer.hpp index 5ca3a45da..83b08d6be 100644 --- a/apps/openmw/mwsound/sound_buffer.hpp +++ b/apps/openmw/mwsound/sound_buffer.hpp @@ -20,7 +20,7 @@ namespace MWSound size_t mUses; Sound_Buffer(std::string resname, float volume, float mindist, float maxdist) - : mResourceName(resname), mVolume(volume), mMinDist(mindist), mMaxDist(maxdist), mHandle(0), mUses(0) + : mResourceName(resname), mVolume(volume), mMinDist(mindist), mMaxDist(maxdist), mHandle(nullptr), mUses(0) { } }; } diff --git a/apps/openmw/mwsound/soundmanagerimp.cpp b/apps/openmw/mwsound/soundmanagerimp.cpp index 1a90dceed..37ba80820 100644 --- a/apps/openmw/mwsound/soundmanagerimp.cpp +++ b/apps/openmw/mwsound/soundmanagerimp.cpp @@ -120,7 +120,7 @@ namespace MWSound { if(sfx.mHandle) mOutput->unloadSound(sfx.mHandle); - sfx.mHandle = 0; + sfx.mHandle = nullptr; } mUnusedBuffers.clear(); mOutput.reset(); @@ -229,7 +229,7 @@ namespace MWSound size = mOutput->unloadSound(unused->mHandle); mBufferCacheSize -= size; - unused->mHandle = 0; + unused->mHandle = nullptr; mUnusedBuffers.pop_back(); } while(mBufferCacheSize > mBufferCacheMin); diff --git a/apps/openmw/mwstate/character.cpp b/apps/openmw/mwstate/character.cpp index 3c5c4f8b2..df1ab1bdf 100644 --- a/apps/openmw/mwstate/character.cpp +++ b/apps/openmw/mwstate/character.cpp @@ -64,7 +64,7 @@ void MWState::Character::addSlot (const ESM::SavedGame& profile) } slot.mProfile = profile; - slot.mTimeStamp = std::time (0); + slot.mTimeStamp = std::time (nullptr); mSlots.push_back (slot); } @@ -143,7 +143,7 @@ const MWState::Slot *MWState::Character::updateSlot (const Slot *slot, const ESM Slot newSlot = *slot; newSlot.mProfile = profile; - newSlot.mTimeStamp = std::time (0); + newSlot.mTimeStamp = std::time (nullptr); mSlots.erase (mSlots.begin()+index); diff --git a/apps/openmw/mwstate/charactermanager.cpp b/apps/openmw/mwstate/charactermanager.cpp index b5868c3e5..a324dfe0f 100644 --- a/apps/openmw/mwstate/charactermanager.cpp +++ b/apps/openmw/mwstate/charactermanager.cpp @@ -7,7 +7,7 @@ MWState::CharacterManager::CharacterManager (const boost::filesystem::path& saves, const std::string& game) -: mPath (saves), mCurrent (0), mGame (game) +: mPath (saves), mCurrent (nullptr), mGame (game) { if (!boost::filesystem::is_directory (mPath)) { diff --git a/apps/openmw/mwstate/statemanagerimp.hpp b/apps/openmw/mwstate/statemanagerimp.hpp index 11984b7f5..3534dabf2 100644 --- a/apps/openmw/mwstate/statemanagerimp.hpp +++ b/apps/openmw/mwstate/statemanagerimp.hpp @@ -53,7 +53,7 @@ namespace MWState void deleteGame (const MWState::Character *character, const MWState::Slot *slot) override; ///< Delete a saved game slot from this character. If all save slots are deleted, the character will be deleted too. - void saveGame (const std::string& description, const Slot *slot = 0) override; + void saveGame (const std::string& description, const Slot *slot = nullptr) override; ///< Write a saved game to \a slot or create a new slot if \a slot == 0. /// /// \note Slot must belong to the current character. diff --git a/apps/openmw/mwworld/cells.cpp b/apps/openmw/mwworld/cells.cpp index 94c78b433..15c1b46ba 100644 --- a/apps/openmw/mwworld/cells.cpp +++ b/apps/openmw/mwworld/cells.cpp @@ -94,7 +94,7 @@ void MWWorld::Cells::clear() { mInteriors.clear(); mExteriors.clear(); - std::fill(mIdCache.begin(), mIdCache.end(), std::make_pair("", (MWWorld::CellStore*)0)); + std::fill(mIdCache.begin(), mIdCache.end(), std::make_pair("", (MWWorld::CellStore*)nullptr)); mIdCacheIndex = 0; } @@ -132,7 +132,7 @@ void MWWorld::Cells::writeCell (ESM::ESMWriter& writer, CellStore& cell) const MWWorld::Cells::Cells (const MWWorld::ESMStore& store, std::vector& reader) : mStore (store), mReader (reader), - mIdCache (Settings::Manager::getInt("pointers cache size", "Cells"), std::pair ("", (CellStore*)0)), + mIdCache (Settings::Manager::getInt("pointers cache size", "Cells"), std::pair ("", (CellStore*)nullptr)), mIdCacheIndex (0) {} @@ -449,7 +449,7 @@ bool MWWorld::Cells::readRecord (ESM::ESMReader& reader, uint32_t type, ESM::CellState state; state.mId.load (reader); - CellStore *cellStore = 0; + CellStore *cellStore = nullptr; try { diff --git a/apps/openmw/mwworld/cellstore.cpp b/apps/openmw/mwworld/cellstore.cpp index 14b96b27c..b48fe74a6 100644 --- a/apps/openmw/mwworld/cellstore.cpp +++ b/apps/openmw/mwworld/cellstore.cpp @@ -37,7 +37,7 @@ namespace for (typename MWWorld::CellRefList::List::iterator iter (containerList.mList.begin()); iter!=containerList.mList.end(); ++iter) { - MWWorld::Ptr container (&*iter, 0); + MWWorld::Ptr container (&*iter, nullptr); if (container.getRefData().getCustomData() == nullptr) continue; diff --git a/apps/openmw/mwworld/containerstore.cpp b/apps/openmw/mwworld/containerstore.cpp index 6fad42926..17c35489f 100644 --- a/apps/openmw/mwworld/containerstore.cpp +++ b/apps/openmw/mwworld/containerstore.cpp @@ -67,7 +67,7 @@ namespace { if (Misc::StringUtils::ciEqual(iter->mBase->mId, id2) && iter->mData.getCount()) { - MWWorld::Ptr ptr (&*iter, 0); + MWWorld::Ptr ptr (&*iter, nullptr); ptr.setContainerStore (store); return ptr; } @@ -326,7 +326,7 @@ MWWorld::ContainerStoreIterator MWWorld::ContainerStore::add (const Ptr& itemPtr if (actorPtr == player) { // Items in player's inventory have cell set to 0, so their scripts will never be removed - item.mCell = 0; + item.mCell = nullptr; } else { @@ -1138,18 +1138,18 @@ PtrType MWWorld::ContainerStoreIteratorBase::operator*() const switch (mType) { - case ContainerStore::Type_Potion: ptr = PtrType (&*mPotion, 0); break; - case ContainerStore::Type_Apparatus: ptr = PtrType (&*mApparatus, 0); break; - case ContainerStore::Type_Armor: ptr = PtrType (&*mArmor, 0); break; - case ContainerStore::Type_Book: ptr = PtrType (&*mBook, 0); break; - case ContainerStore::Type_Clothing: ptr = PtrType (&*mClothing, 0); break; - case ContainerStore::Type_Ingredient: ptr = PtrType (&*mIngredient, 0); break; - case ContainerStore::Type_Light: ptr = PtrType (&*mLight, 0); break; - case ContainerStore::Type_Lockpick: ptr = PtrType (&*mLockpick, 0); break; - case ContainerStore::Type_Miscellaneous: ptr = PtrType (&*mMiscellaneous, 0); break; - case ContainerStore::Type_Probe: ptr = PtrType (&*mProbe, 0); break; - case ContainerStore::Type_Repair: ptr = PtrType (&*mRepair, 0); break; - case ContainerStore::Type_Weapon: ptr = PtrType (&*mWeapon, 0); break; + case ContainerStore::Type_Potion: ptr = PtrType (&*mPotion, nullptr); break; + case ContainerStore::Type_Apparatus: ptr = PtrType (&*mApparatus, nullptr); break; + case ContainerStore::Type_Armor: ptr = PtrType (&*mArmor, nullptr); break; + case ContainerStore::Type_Book: ptr = PtrType (&*mBook, nullptr); break; + case ContainerStore::Type_Clothing: ptr = PtrType (&*mClothing, nullptr); break; + case ContainerStore::Type_Ingredient: ptr = PtrType (&*mIngredient, nullptr); break; + case ContainerStore::Type_Light: ptr = PtrType (&*mLight, nullptr); break; + case ContainerStore::Type_Lockpick: ptr = PtrType (&*mLockpick, nullptr); break; + case ContainerStore::Type_Miscellaneous: ptr = PtrType (&*mMiscellaneous, nullptr); break; + case ContainerStore::Type_Probe: ptr = PtrType (&*mProbe, nullptr); break; + case ContainerStore::Type_Repair: ptr = PtrType (&*mRepair, nullptr); break; + case ContainerStore::Type_Weapon: ptr = PtrType (&*mWeapon, nullptr); break; } if (ptr.isEmpty()) diff --git a/apps/openmw/mwworld/esmstore.cpp b/apps/openmw/mwworld/esmstore.cpp index 942d5feeb..90bc80b48 100644 --- a/apps/openmw/mwworld/esmstore.cpp +++ b/apps/openmw/mwworld/esmstore.cpp @@ -71,7 +71,7 @@ void ESMStore::load(ESM::ESMReader &esm, Loading::Listener* listener) { listener->setProgressRange(1000); - ESM::Dialogue *dialogue = 0; + ESM::Dialogue *dialogue = nullptr; // Land texture loading needs to use a separate internal store for each plugin. // We set the number of plugins here to avoid continual resizes during loading, @@ -153,7 +153,7 @@ void ESMStore::load(ESM::ESMReader &esm, Loading::Listener* listener) if (n.intval==ESM::REC_DIAL) { dialogue = const_cast(mDialogs.find(id.mId)); } else { - dialogue = 0; + dialogue = nullptr; } } listener->setProgress(static_cast(esm.getFileOffset() / (float)esm.getFileSize() * 1000)); diff --git a/apps/openmw/mwworld/esmstore.hpp b/apps/openmw/mwworld/esmstore.hpp index 99db96ac1..d69c56d8c 100644 --- a/apps/openmw/mwworld/esmstore.hpp +++ b/apps/openmw/mwworld/esmstore.hpp @@ -196,7 +196,7 @@ namespace MWWorld const std::string id = "$dynamic" + std::to_string(mDynamicCount++); Store &store = const_cast &>(get()); - if (store.search(id) != 0) + if (store.search(id) != nullptr) { const std::string msg = "Try to override existing record '" + id + "'"; throw std::runtime_error(msg); @@ -234,7 +234,7 @@ namespace MWWorld const std::string id = "$dynamic" + std::to_string(mDynamicCount++); Store &store = const_cast &>(get()); - if (store.search(id) != 0) + if (store.search(id) != nullptr) { const std::string msg = "Try to override existing record '" + id + "'"; throw std::runtime_error(msg); @@ -286,7 +286,7 @@ namespace MWWorld { return mNpcs.insert(npc); } - else if (mNpcs.search(id) != 0) + else if (mNpcs.search(id) != nullptr) { const std::string msg = "Try to override existing record '" + id + "'"; throw std::runtime_error(msg); diff --git a/apps/openmw/mwworld/manualref.cpp b/apps/openmw/mwworld/manualref.cpp index 48270d224..7f7fd6033 100644 --- a/apps/openmw/mwworld/manualref.cpp +++ b/apps/openmw/mwworld/manualref.cpp @@ -26,7 +26,7 @@ namespace MWWorld::LiveCellRef ref(cellRef, base); refValue = ref; - ptrValue = MWWorld::Ptr(&boost::any_cast&>(refValue), 0); + ptrValue = MWWorld::Ptr(&boost::any_cast&>(refValue), nullptr); } } diff --git a/apps/openmw/mwworld/player.cpp b/apps/openmw/mwworld/player.cpp index 66ae4e319..d8e2fb2f0 100644 --- a/apps/openmw/mwworld/player.cpp +++ b/apps/openmw/mwworld/player.cpp @@ -29,7 +29,7 @@ namespace MWWorld { Player::Player (const ESM::NPC *player) - : mCellStore(0), + : mCellStore(nullptr), mLastKnownExteriorPosition(0,0,0), mMarkedPosition(ESM::Position()), mMarkedCell(nullptr), @@ -299,9 +299,9 @@ namespace MWWorld void Player::clear() { - mCellStore = 0; + mCellStore = nullptr; mSign.clear(); - mMarkedCell = 0; + mMarkedCell = nullptr; mAutoMove = false; mForwardBackward = 0; mTeleported = false; @@ -448,7 +448,7 @@ namespace MWWorld } else { - mMarkedCell = 0; + mMarkedCell = nullptr; } mForwardBackward = 0; diff --git a/apps/openmw/mwworld/ptr.cpp b/apps/openmw/mwworld/ptr.cpp index 12c44b0b3..e16a19629 100644 --- a/apps/openmw/mwworld/ptr.cpp +++ b/apps/openmw/mwworld/ptr.cpp @@ -8,7 +8,7 @@ const std::string& MWWorld::Ptr::getTypeName() const { - if(mRef != 0) + if(mRef != nullptr) return mRef->mClass->getTypeName(); throw std::runtime_error("Can't get type name from an empty object."); } @@ -57,7 +57,7 @@ MWWorld::Ptr::operator const void *() const std::string &MWWorld::ConstPtr::getTypeName() const { - if(mRef != 0) + if(mRef != nullptr) return mRef->mClass->getTypeName(); throw std::runtime_error("Can't get type name from an empty object."); } diff --git a/apps/openmw/mwworld/ptr.hpp b/apps/openmw/mwworld/ptr.hpp index d7c170e45..9ab18d7f4 100644 --- a/apps/openmw/mwworld/ptr.hpp +++ b/apps/openmw/mwworld/ptr.hpp @@ -25,21 +25,21 @@ namespace MWWorld ContainerStore *mContainerStore; public: - Ptr(MWWorld::LiveCellRefBase *liveCellRef=0, CellStore *cell=0) - : mRef(liveCellRef), mCell(cell), mContainerStore(0) + Ptr(MWWorld::LiveCellRefBase *liveCellRef=nullptr, CellStore *cell=nullptr) + : mRef(liveCellRef), mCell(cell), mContainerStore(nullptr) { } bool isEmpty() const { - return mRef == 0; + return mRef == nullptr; } const std::string& getTypeName() const; const Class& getClass() const { - if(mRef != 0) + if(mRef != nullptr) return *(mRef->mClass); throw std::runtime_error("Cannot get class of an empty object"); } @@ -52,7 +52,7 @@ namespace MWWorld std::stringstream str; str<< "Bad LiveCellRef cast to "<mClass); throw std::runtime_error("Cannot get class of an empty object"); } @@ -128,7 +128,7 @@ namespace MWWorld std::stringstream str; str<< "Bad LiveCellRef cast to "<clone() : 0; + mCustomData = refData.mCustomData ? refData.mCustomData->clone() : nullptr; } void RefData::cleanup() { - mBaseNode = 0; + mBaseNode = nullptr; delete mCustomData; - mCustomData = 0; + mCustomData = nullptr; } RefData::RefData() - : mBaseNode(0), mDeletedByContentFile(false), mEnabled (true), mCount (1), mCustomData (0), mChanged(false), mFlags(0) + : mBaseNode(nullptr), mDeletedByContentFile(false), mEnabled (true), mCount (1), mCustomData (nullptr), mChanged(false), mFlags(0) { for (int i=0; i<3; ++i) { @@ -56,20 +56,20 @@ namespace MWWorld } RefData::RefData (const ESM::CellRef& cellRef) - : mBaseNode(0), mDeletedByContentFile(false), mEnabled (true), + : mBaseNode(nullptr), mDeletedByContentFile(false), mEnabled (true), mCount (1), mPosition (cellRef.mPos), - mCustomData (0), + mCustomData (nullptr), mChanged(false), mFlags(0) // Loading from ESM/ESP files -> assume unchanged { } RefData::RefData (const ESM::ObjectState& objectState, bool deletedByContentFile) - : mBaseNode(0), mDeletedByContentFile(deletedByContentFile), + : mBaseNode(nullptr), mDeletedByContentFile(deletedByContentFile), mEnabled (objectState.mEnabled != 0), mCount (objectState.mCount), mPosition (objectState.mPosition), mAnimationState(objectState.mAnimationState), - mCustomData (0), + mCustomData (nullptr), mChanged(true), mFlags(objectState.mFlags) // Loading from a savegame -> assume changed { // "Note that the ActivationFlag_UseEnabled is saved to the reference, @@ -79,7 +79,7 @@ namespace MWWorld } RefData::RefData (const RefData& refData) - : mBaseNode(0), mCustomData (0) + : mBaseNode(nullptr), mCustomData (nullptr) { try { diff --git a/apps/openmw/mwworld/scene.cpp b/apps/openmw/mwworld/scene.cpp index d01cc741c..47b62862f 100644 --- a/apps/openmw/mwworld/scene.cpp +++ b/apps/openmw/mwworld/scene.cpp @@ -397,7 +397,7 @@ namespace MWWorld if (!test && cell->getCell()->isExterior()) { osg::ref_ptr land = mRendering.getLandManager()->getLand(cellX, cellY); - const ESM::Land::LandData* data = land ? land->getData(ESM::Land::DATA_VHGT) : 0; + const ESM::Land::LandData* data = land ? land->getData(ESM::Land::DATA_VHGT) : nullptr; if (data) { mPhysics->addHeightField (data->mHeights, cellX, cellY, worldsize / (verts-1), verts, data->mMinHeight, data->mMaxHeight, land.get()); @@ -755,7 +755,7 @@ namespace MWWorld Scene::Scene (MWRender::RenderingManager& rendering, MWPhysics::PhysicsSystem *physics, DetourNavigator::Navigator& navigator) - : mCurrentCell (0), mCellChanged (false), mPhysics(physics), mRendering(rendering), mNavigator(navigator) + : mCurrentCell (nullptr), mCellChanged (false), mPhysics(physics), mRendering(rendering), mNavigator(navigator) , mCellLoadingThreshold(1024.f) , mPreloadDistance(Settings::Manager::getInt("preload distance", "Cells")) , mPreloadEnabled(Settings::Manager::getBool("preload enabled", "Cells")) diff --git a/apps/openmw/mwworld/store.cpp b/apps/openmw/mwworld/store.cpp index f8ec8c7c2..69ca1f8c2 100644 --- a/apps/openmw/mwworld/store.cpp +++ b/apps/openmw/mwworld/store.cpp @@ -101,7 +101,7 @@ namespace MWWorld const T *IndexedStore::find(int index) const { const T *ptr = search(index); - if (ptr == 0) + if (ptr == nullptr) { const std::string msg = T::getRecordType() + " with index " + std::to_string(index) + " not found"; throw std::runtime_error(msg); @@ -146,7 +146,7 @@ namespace MWWorld if (it != mStatic.end()) return &(it->second); - return 0; + return nullptr; } template const T *Store::searchStatic(const std::string &id) const @@ -156,7 +156,7 @@ namespace MWWorld if (it != mStatic.end()) return &(it->second); - return 0; + return nullptr; } template @@ -178,7 +178,7 @@ namespace MWWorld const T *Store::find(const std::string &id) const { const T *ptr = search(id); - if (ptr == 0) + if (ptr == nullptr) { const std::string msg = T::getRecordType() + " '" + id + "' not found"; throw std::runtime_error(msg); @@ -189,7 +189,7 @@ namespace MWWorld const T *Store::findRandom(const std::string &id) const { const T *ptr = searchRandom(id); - if(ptr == 0) + if(ptr == nullptr) { const std::string msg = T::getRecordType() + " starting with '" + id + "' not found"; throw std::runtime_error(msg); @@ -370,7 +370,7 @@ namespace MWWorld const ESM::LandTexture *Store::find(size_t index, size_t plugin) const { const ESM::LandTexture *ptr = search(index, plugin); - if (ptr == 0) + if (ptr == nullptr) { const std::string msg = "Land texture with index " + std::to_string(index) + " not found"; throw std::runtime_error(msg); @@ -471,12 +471,12 @@ namespace MWWorld if (it != mStatic.end() && (*it)->mX == x && (*it)->mY == y) { return *it; } - return 0; + return nullptr; } const ESM::Land *Store::find(int x, int y) const { const ESM::Land *ptr = search(x, y); - if (ptr == 0) + if (ptr == nullptr) { const std::string msg = "Land at (" + std::to_string(x) + ", " + std::to_string(y) + ") not found"; throw std::runtime_error(msg); @@ -570,7 +570,7 @@ namespace MWWorld return &dit->second; } - return 0; + return nullptr; } const ESM::Cell *Store::search(int x, int y) const { @@ -588,7 +588,7 @@ namespace MWWorld return &dit->second; } - return 0; + return nullptr; } const ESM::Cell *Store::searchStatic(int x, int y) const { @@ -600,7 +600,7 @@ namespace MWWorld if (it != mExt.end()) { return &(it->second); } - return 0; + return nullptr; } const ESM::Cell *Store::searchOrCreate(int x, int y) { @@ -628,7 +628,7 @@ namespace MWWorld const ESM::Cell *Store::find(const std::string &id) const { const ESM::Cell *ptr = search(id); - if (ptr == 0) + if (ptr == nullptr) { const std::string msg = "Cell '" + id + "' not found"; throw std::runtime_error(msg); @@ -638,7 +638,7 @@ namespace MWWorld const ESM::Cell *Store::find(int x, int y) const { const ESM::Cell *ptr = search(x, y); - if (ptr == 0) + if (ptr == nullptr) { const std::string msg = "Exterior at (" + std::to_string(x) + ", " + std::to_string(y) + ") not found"; throw std::runtime_error(msg); @@ -781,7 +781,7 @@ namespace MWWorld { if (Misc::StringUtils::ciEqual(sharedCell->mName, id)) { - if (cell == 0 || + if (cell == nullptr || (sharedCell->mData.mX > cell->mData.mX) || (sharedCell->mData.mX == cell->mData.mX && sharedCell->mData.mY > cell->mData.mY)) { @@ -831,7 +831,7 @@ namespace MWWorld } ESM::Cell *Store::insert(const ESM::Cell &cell) { - if (search(cell) != 0) + if (search(cell) != nullptr) { const std::string cellType = (cell.isExterior()) ? "exterior" : "interior"; throw std::runtime_error("Failed to create " + cellType + " cell"); @@ -1032,7 +1032,7 @@ namespace MWWorld const ESM::Attribute *Store::search(size_t index) const { if (index >= mStatic.size()) { - return 0; + return nullptr; } return &mStatic.at(index); } @@ -1040,7 +1040,7 @@ namespace MWWorld const ESM::Attribute *Store::find(size_t index) const { const ESM::Attribute *ptr = search(index); - if (ptr == 0) + if (ptr == nullptr) { const std::string msg = "Attribute with index " + std::to_string(index) + " not found"; throw std::runtime_error(msg); diff --git a/apps/openmw/mwworld/store.hpp b/apps/openmw/mwworld/store.hpp index d2406b602..cb9f4f1e0 100644 --- a/apps/openmw/mwworld/store.hpp +++ b/apps/openmw/mwworld/store.hpp @@ -412,7 +412,7 @@ namespace MWWorld const ESM::WeaponType *search(const int id) const; const ESM::WeaponType *find(const int id) const; - RecordId load(ESM::ESMReader &esm) override { return RecordId(0, false); } + RecordId load(ESM::ESMReader &esm) override { return RecordId(nullptr, false); } ESM::WeaponType* insert(const ESM::WeaponType &weaponType); diff --git a/apps/openmw/mwworld/worldimp.cpp b/apps/openmw/mwworld/worldimp.cpp index 20ee7625b..224925dd5 100644 --- a/apps/openmw/mwworld/worldimp.cpp +++ b/apps/openmw/mwworld/worldimp.cpp @@ -302,7 +302,7 @@ namespace MWWorld if (mPlayer) { mPlayer->clear(); - mPlayer->setCell(0); + mPlayer->setCell(nullptr); mPlayer->getPlayer().getRefData() = RefData(); mPlayer->set(mStore.get().find ("player")); } @@ -1010,7 +1010,7 @@ namespace MWWorld if (!facedObject.isEmpty() && !facedObject.getClass().allowTelekinesis(facedObject) && mDistanceToFacedObject > getMaxActivationDistance() && !MWBase::Environment::get().getWindowManager()->isGuiMode()) - return 0; + return nullptr; } return facedObject; } @@ -1180,7 +1180,7 @@ namespace MWWorld haveToMove = false; newPtr = currCell->moveTo(ptr, newCell); - newPtr.getRefData().setBaseNode(0); + newPtr.getRefData().setBaseNode(nullptr); } else if (!currCellActive && !newCellActive) newPtr = currCell->moveTo(ptr, newCell); @@ -1263,7 +1263,7 @@ namespace MWWorld mWorldScene->removeFromPagedRefs(ptr); } - if(ptr.getRefData().getBaseNode() != 0) + if(ptr.getRefData().getBaseNode() != nullptr) mWorldScene->updateObjectScale(ptr); if (mPhysics->getActor(ptr)) @@ -1311,7 +1311,7 @@ namespace MWWorld mRendering->pagingBlacklistObject(mStore.find(ptr.getCellRef().getRefId()), ptr); mWorldScene->removeFromPagedRefs(ptr); - if(ptr.getRefData().getBaseNode() != 0) + if(ptr.getRefData().getBaseNode() != nullptr) { const auto order = flags & MWBase::RotationFlag_inverseOrder ? RotationOrder::inverse : RotationOrder::direct; @@ -1396,7 +1396,7 @@ namespace MWWorld void World::rotateWorldObject (const Ptr& ptr, osg::Quat rotate) { - if(ptr.getRefData().getBaseNode() != 0) + if(ptr.getRefData().getBaseNode() != nullptr) { mRendering->pagingBlacklistObject(mStore.find(ptr.getCellRef().getRefId()), ptr); mWorldScene->removeFromPagedRefs(ptr); diff --git a/apps/openmw/mwworld/worldimp.hpp b/apps/openmw/mwworld/worldimp.hpp index 41ab9cf2c..1fc5ebc20 100644 --- a/apps/openmw/mwworld/worldimp.hpp +++ b/apps/openmw/mwworld/worldimp.hpp @@ -275,7 +275,7 @@ namespace MWWorld char getGlobalVariableType (const std::string& name) const override; ///< Return ' ', if there is no global variable with this name. - std::string getCellName (const MWWorld::CellStore *cell = 0) const override; + std::string getCellName (const MWWorld::CellStore *cell = nullptr) const override; ///< Return name of the cell. /// /// \note If cell==0, the cell the player is currently in will be used instead to diff --git a/apps/wizard/mainwizard.hpp b/apps/wizard/mainwizard.hpp index 8d9623baa..4c221635e 100644 --- a/apps/wizard/mainwizard.hpp +++ b/apps/wizard/mainwizard.hpp @@ -41,7 +41,7 @@ namespace Wizard Page_Conclusion }; - MainWizard(QWidget *parent = 0); + MainWizard(QWidget *parent = nullptr); ~MainWizard(); bool findFiles(const QString &name, const QString &path); diff --git a/apps/wizard/unshield/unshieldworker.hpp b/apps/wizard/unshield/unshieldworker.hpp index 3f922ad78..2553d1bef 100644 --- a/apps/wizard/unshield/unshieldworker.hpp +++ b/apps/wizard/unshield/unshieldworker.hpp @@ -26,7 +26,7 @@ namespace Wizard Q_OBJECT public: - UnshieldWorker(QObject *parent = 0); + UnshieldWorker(QObject *parent = nullptr); ~UnshieldWorker(); void stopWorker(); diff --git a/apps/wizard/utils/componentlistwidget.hpp b/apps/wizard/utils/componentlistwidget.hpp index 23965f8a6..be15ea49f 100644 --- a/apps/wizard/utils/componentlistwidget.hpp +++ b/apps/wizard/utils/componentlistwidget.hpp @@ -10,7 +10,7 @@ class ComponentListWidget : public QListWidget Q_PROPERTY(QStringList mCheckedItems READ checkedItems) public: - ComponentListWidget(QWidget *parent = 0); + ComponentListWidget(QWidget *parent = nullptr); QStringList mCheckedItems; QStringList checkedItems(); diff --git a/components/compiler/context.hpp b/components/compiler/context.hpp index 2d6af0e45..399e8125b 100644 --- a/components/compiler/context.hpp +++ b/components/compiler/context.hpp @@ -13,14 +13,14 @@ namespace Compiler public: - Context() : mExtensions (0) {} + Context() : mExtensions (nullptr) {} virtual ~Context() = default; virtual bool canDeclareLocals() const = 0; ///< Is the compiler allowed to declare local variables? - void setExtensions (const Extensions *extensions = 0) + void setExtensions (const Extensions *extensions = nullptr) { mExtensions = extensions; } diff --git a/components/contentselector/model/contentmodel.cpp b/components/contentselector/model/contentmodel.cpp index 86208d7af..e51c1809a 100644 --- a/components/contentselector/model/contentmodel.cpp +++ b/components/contentselector/model/contentmodel.cpp @@ -53,7 +53,7 @@ const ContentSelectorModel::EsmFile *ContentSelectorModel::ContentModel::item(in if (row >= 0 && row < mFiles.size()) return mFiles.at(row); - return 0; + return nullptr; } ContentSelectorModel::EsmFile *ContentSelectorModel::ContentModel::item(int row) @@ -61,7 +61,7 @@ ContentSelectorModel::EsmFile *ContentSelectorModel::ContentModel::item(int row) if (row >= 0 && row < mFiles.count()) return mFiles.at(row); - return 0; + return nullptr; } const ContentSelectorModel::EsmFile *ContentSelectorModel::ContentModel::item(const QString &name) const { @@ -75,7 +75,7 @@ const ContentSelectorModel::EsmFile *ContentSelectorModel::ContentModel::item(co if (name.compare(file->fileProperty (fp).toString(), Qt::CaseInsensitive) == 0) return file; } - return 0; + return nullptr; } QModelIndex ContentSelectorModel::ContentModel::indexFromItem(const EsmFile *item) const diff --git a/components/contentselector/model/esmfile.hpp b/components/contentselector/model/esmfile.hpp index 614eee298..66863d7c6 100644 --- a/components/contentselector/model/esmfile.hpp +++ b/components/contentselector/model/esmfile.hpp @@ -28,7 +28,7 @@ namespace ContentSelectorModel FileProperty_GameFile = 6 }; - EsmFile(QString fileName = QString(), ModelItem *parent = 0); + EsmFile(QString fileName = QString(), ModelItem *parent = nullptr); // EsmFile(const EsmFile &); ~EsmFile() diff --git a/components/contentselector/model/modelitem.hpp b/components/contentselector/model/modelitem.hpp index e4ea7acc6..a860b1891 100644 --- a/components/contentselector/model/modelitem.hpp +++ b/components/contentselector/model/modelitem.hpp @@ -11,7 +11,7 @@ namespace ContentSelectorModel Q_OBJECT public: - ModelItem(ModelItem *parent = 0); + ModelItem(ModelItem *parent = nullptr); //ModelItem(const ModelItem *parent = 0); ~ModelItem(); diff --git a/components/contentselector/view/combobox.cpp b/components/contentselector/view/combobox.cpp index 1ef9f9bd7..742e236b3 100644 --- a/components/contentselector/view/combobox.cpp +++ b/components/contentselector/view/combobox.cpp @@ -9,7 +9,7 @@ ContentSelectorView::ComboBox::ComboBox(QWidget *parent) : mValidator = new QRegExpValidator(QRegExp("^[a-zA-Z0-9_]*$"), this); // Alpha-numeric + underscore setValidator(mValidator); setEditable(true); - setCompleter(0); + setCompleter(nullptr); setEnabled (true); setInsertPolicy(QComboBox::NoInsert); diff --git a/components/contentselector/view/combobox.hpp b/components/contentselector/view/combobox.hpp index c57a5f116..9af3c83af 100644 --- a/components/contentselector/view/combobox.hpp +++ b/components/contentselector/view/combobox.hpp @@ -14,7 +14,7 @@ namespace ContentSelectorView Q_OBJECT public: - explicit ComboBox (QWidget *parent = 0); + explicit ComboBox (QWidget *parent = nullptr); void setPlaceholderText(const QString &text); diff --git a/components/contentselector/view/contentselector.hpp b/components/contentselector/view/contentselector.hpp index f1058d510..1b50f1e5e 100644 --- a/components/contentselector/view/contentselector.hpp +++ b/components/contentselector/view/contentselector.hpp @@ -23,7 +23,7 @@ namespace ContentSelectorView public: - explicit ContentSelector(QWidget *parent = 0); + explicit ContentSelector(QWidget *parent = nullptr); QString currentFile() const; diff --git a/components/crashcatcher/crashcatcher.cpp b/components/crashcatcher/crashcatcher.cpp index 307c08d95..4ad856548 100644 --- a/components/crashcatcher/crashcatcher.cpp +++ b/components/crashcatcher/crashcatcher.cpp @@ -451,7 +451,7 @@ static void getExecPath(char **argv) if(argv[0][0] == '/') snprintf(argv0, sizeof(argv0), "%s", argv[0]); - else if (getcwd(argv0, sizeof(argv0)) != NULL) + else if (getcwd(argv0, sizeof(argv0)) != nullptr) { cwdlen = strlen(argv0); snprintf(argv0+cwdlen, sizeof(argv0)-cwdlen, "/%s", argv[0]); diff --git a/components/detournavigator/findsmoothpath.cpp b/components/detournavigator/findsmoothpath.cpp index 8e443def9..a13b83abd 100644 --- a/components/detournavigator/findsmoothpath.cpp +++ b/components/detournavigator/findsmoothpath.cpp @@ -58,8 +58,8 @@ namespace DetourNavigator return path; // Get connected polygons - const dtMeshTile* tile = 0; - const dtPoly* poly = 0; + const dtMeshTile* tile = nullptr; + const dtPoly* poly = nullptr; if (dtStatusFailed(navQuery.getAttachedNavMesh()->getTileAndPolyByRef(path[0], &tile, &poly))) return path; diff --git a/components/detournavigator/findsmoothpath.hpp b/components/detournavigator/findsmoothpath.hpp index dcdddce8a..a351f8279 100644 --- a/components/detournavigator/findsmoothpath.hpp +++ b/components/detournavigator/findsmoothpath.hpp @@ -158,10 +158,10 @@ namespace DetourNavigator { // Iterate over the path to find smooth path on the detail mesh surface. osg::Vec3f iterPos; - navMeshQuery.closestPointOnPoly(polygonPath.front(), start.ptr(), iterPos.ptr(), 0); + navMeshQuery.closestPointOnPoly(polygonPath.front(), start.ptr(), iterPos.ptr(), nullptr); osg::Vec3f targetPos; - navMeshQuery.closestPointOnPoly(polygonPath.back(), end.ptr(), targetPos.ptr(), 0); + navMeshQuery.closestPointOnPoly(polygonPath.back(), end.ptr(), targetPos.ptr(), nullptr); const float SLOP = 0.01f; diff --git a/components/esm/loadcell.hpp b/components/esm/loadcell.hpp index 132c869ad..d06b509c5 100644 --- a/components/esm/loadcell.hpp +++ b/components/esm/loadcell.hpp @@ -185,7 +185,7 @@ struct Cell CellRef &ref, bool &isDeleted, bool ignoreMoves = false, - MovedCellRef *mref = 0); + MovedCellRef *mref = nullptr); /* This fetches an MVRF record, which is used to track moved references. * Since they are comparably rare, we use a separate method for this. diff --git a/components/esm/variant.cpp b/components/esm/variant.cpp index c65eed5e0..6ff31dc44 100644 --- a/components/esm/variant.cpp +++ b/components/esm/variant.cpp @@ -16,11 +16,11 @@ namespace const uint32_t STTV = ESM::FourCC<'S','T','T','V'>::value; } -ESM::Variant::Variant() : mType (VT_None), mData (0) {} +ESM::Variant::Variant() : mType (VT_None), mData (nullptr) {} ESM::Variant::Variant(const std::string &value) { - mData = 0; + mData = nullptr; mType = VT_None; setType(VT_String); setString(value); @@ -28,7 +28,7 @@ ESM::Variant::Variant(const std::string &value) ESM::Variant::Variant(int value) { - mData = 0; + mData = nullptr; mType = VT_None; setType(VT_Long); setInteger(value); @@ -36,7 +36,7 @@ ESM::Variant::Variant(int value) ESM::Variant::Variant(float value) { - mData = 0; + mData = nullptr; mType = VT_None; setType(VT_Float); setFloat(value); @@ -51,7 +51,7 @@ ESM::Variant& ESM::Variant::operator= (const Variant& variant) { if (&variant!=this) { - VariantDataBase *newData = variant.mData ? variant.mData->clone() : 0; + VariantDataBase *newData = variant.mData ? variant.mData->clone() : nullptr; delete mData; @@ -63,7 +63,7 @@ ESM::Variant& ESM::Variant::operator= (const Variant& variant) } ESM::Variant::Variant (const Variant& variant) -: mType (variant.mType), mData (variant.mData ? variant.mData->clone() : 0) +: mType (variant.mType), mData (variant.mData ? variant.mData->clone() : nullptr) {} ESM::VarType ESM::Variant::getType() const @@ -254,7 +254,7 @@ void ESM::Variant::setType (VarType type) { if (type!=mType) { - VariantDataBase *newData = 0; + VariantDataBase *newData = nullptr; switch (type) { diff --git a/components/esm/variantimp.hpp b/components/esm/variantimp.hpp index e7ac722b1..c1203ddf8 100644 --- a/components/esm/variantimp.hpp +++ b/components/esm/variantimp.hpp @@ -71,7 +71,7 @@ namespace ESM public: - VariantStringData (const VariantDataBase *data = 0); + VariantStringData (const VariantDataBase *data = nullptr); ///< Calling the constructor with an incompatible data type will result in a silent /// default initialisation. @@ -103,7 +103,7 @@ namespace ESM public: - VariantIntegerData (const VariantDataBase *data = 0); + VariantIntegerData (const VariantDataBase *data = nullptr); ///< Calling the constructor with an incompatible data type will result in a silent /// default initialisation. @@ -142,7 +142,7 @@ namespace ESM public: - VariantFloatData (const VariantDataBase *data = 0); + VariantFloatData (const VariantDataBase *data = nullptr); ///< Calling the constructor with an incompatible data type will result in a silent /// default initialisation. diff --git a/components/esmterrain/storage.cpp b/components/esmterrain/storage.cpp index cf27b7128..4d3f3c305 100644 --- a/components/esmterrain/storage.cpp +++ b/components/esmterrain/storage.cpp @@ -71,7 +71,7 @@ namespace ESMTerrain int endColumn = startColumn + size * (ESM::Land::LAND_SIZE-1) + 1; osg::ref_ptr land = getLand (cellX, cellY); - const ESM::Land::LandData* data = land ? land->getData(ESM::Land::DATA_VHGT) : 0; + const ESM::Land::LandData* data = land ? land->getData(ESM::Land::DATA_VHGT) : nullptr; if (data) { min = std::numeric_limits::max(); @@ -119,7 +119,7 @@ namespace ESMTerrain } const LandObject* land = getLand(cellX, cellY, cache); - const ESM::Land::LandData* data = land ? land->getData(ESM::Land::DATA_VNML) : 0; + const ESM::Land::LandData* data = land ? land->getData(ESM::Land::DATA_VNML) : nullptr; if (data) { normal.x() = data->mNormals[col*ESM::Land::LAND_SIZE*3+row*3]; @@ -156,7 +156,7 @@ namespace ESMTerrain } const LandObject* land = getLand(cellX, cellY, cache); - const ESM::Land::LandData* data = land ? land->getData(ESM::Land::DATA_VCLR) : 0; + const ESM::Land::LandData* data = land ? land->getData(ESM::Land::DATA_VCLR) : nullptr; if (data) { color.r() = data->mColours[col*ESM::Land::LAND_SIZE*3+row*3]; @@ -207,9 +207,9 @@ namespace ESMTerrain for (int cellX = startCellX; cellX < startCellX + std::ceil(size); ++cellX) { const LandObject* land = getLand(cellX, cellY, cache); - const ESM::Land::LandData *heightData = 0; - const ESM::Land::LandData *normalData = 0; - const ESM::Land::LandData *colourData = 0; + const ESM::Land::LandData *heightData = nullptr; + const ESM::Land::LandData *normalData = nullptr; + const ESM::Land::LandData *colourData = nullptr; if (land) { heightData = land->getData(ESM::Land::DATA_VHGT); @@ -341,7 +341,7 @@ namespace ESMTerrain const LandObject* land = getLand(cellX, cellY, cache); - const ESM::Land::LandData *data = land ? land->getData(ESM::Land::DATA_VTEX) : 0; + const ESM::Land::LandData *data = land ? land->getData(ESM::Land::DATA_VTEX) : nullptr; if (data) { int tex = data->mTextures[y * ESM::Land::LAND_TEXTURE_SIZE + x]; diff --git a/components/files/constrainedfilestream.cpp b/components/files/constrainedfilestream.cpp index d2802218f..baab1b081 100644 --- a/components/files/constrainedfilestream.cpp +++ b/components/files/constrainedfilestream.cpp @@ -32,7 +32,7 @@ namespace Files if (start != 0) mFile.seek(start); - setg(0,0,0); + setg(nullptr,nullptr,nullptr); mOrigin = start; } @@ -81,7 +81,7 @@ namespace Files mFile.seek(mOrigin+newPos); // Clear read pointers so underflow() gets called on the next read attempt. - setg(0, 0, 0); + setg(nullptr, nullptr, nullptr); return newPos; } @@ -97,7 +97,7 @@ namespace Files mFile.seek(mOrigin + pos); // Clear read pointers so underflow() gets called on the next read attempt. - setg(0, 0, 0); + setg(nullptr, nullptr, nullptr); return pos; } diff --git a/components/interpreter/runtime.cpp b/components/interpreter/runtime.cpp index a90bda94b..35ad93a8a 100644 --- a/components/interpreter/runtime.cpp +++ b/components/interpreter/runtime.cpp @@ -6,7 +6,7 @@ namespace Interpreter { - Runtime::Runtime() : mContext (0), mCode (0), mCodeSize(0), mPC (0) {} + Runtime::Runtime() : mContext (nullptr), mCode (nullptr), mCodeSize(0), mPC (0) {} int Runtime::getPC() const { @@ -65,8 +65,8 @@ namespace Interpreter void Runtime::clear() { - mContext = 0; - mCode = 0; + mContext = nullptr; + mCode = nullptr; mCodeSize = 0; mStack.clear(); } diff --git a/components/myguiplatform/myguirendermanager.cpp b/components/myguiplatform/myguirendermanager.cpp index bba7df702..dc771f11f 100644 --- a/components/myguiplatform/myguirendermanager.cpp +++ b/components/myguiplatform/myguirendermanager.cpp @@ -127,7 +127,7 @@ public: if(texture) state->applyTextureAttribute(0, texture); - osg::GLBufferObject* bufferobject = state->isVertexBufferObjectSupported() ? vbo->getOrCreateGLBufferObject(state->getContextID()) : 0; + osg::GLBufferObject* bufferobject = state->isVertexBufferObjectSupported() ? vbo->getOrCreateGLBufferObject(state->getContextID()) : nullptr; if (bufferobject) { state->bindVertexBufferObject(bufferobject); diff --git a/components/nifosg/particle.cpp b/components/nifosg/particle.cpp index 2cb0ffc62..e2e1f92cf 100644 --- a/components/nifosg/particle.cpp +++ b/components/nifosg/particle.cpp @@ -344,7 +344,7 @@ void Emitter::emitParticles(double dt) for (int i=0; icreateParticle(0); + osgParticle::Particle* P = getParticleSystem()->createParticle(nullptr); if (P) { mPlacer->place(P); diff --git a/components/resource/imagemanager.cpp b/components/resource/imagemanager.cpp index ff6fb04a6..dd34ed1a1 100644 --- a/components/resource/imagemanager.cpp +++ b/components/resource/imagemanager.cpp @@ -151,7 +151,7 @@ namespace Resource image->setFileName(normalized); if (!checkSupported(image, filename)) { - static bool uncompress = (getenv("OPENMW_DECOMPRESS_TEXTURES") != 0); + static bool uncompress = (getenv("OPENMW_DECOMPRESS_TEXTURES") != nullptr); if (!uncompress) { Log(Debug::Error) << "Error loading " << filename << ": no S3TC texture compression support installed"; diff --git a/components/resource/objectcache.hpp b/components/resource/objectcache.hpp index 6e309a7f7..5c4b511f0 100644 --- a/components/resource/objectcache.hpp +++ b/components/resource/objectcache.hpp @@ -119,7 +119,7 @@ class GenericObjectCache : public osg::Referenced typename ObjectCacheMap::iterator itr = _objectCache.find(key); if (itr!=_objectCache.end()) return itr->second.first; - else return 0; + else return nullptr; } /** Check if an object is in the cache, and if it is, update its usage time stamp. */ diff --git a/components/sceneutil/lightmanager.cpp b/components/sceneutil/lightmanager.cpp index 673e01f33..2ebce241d 100644 --- a/components/sceneutil/lightmanager.cpp +++ b/components/sceneutil/lightmanager.cpp @@ -111,11 +111,11 @@ namespace SceneUtil { public: CollectLightCallback() - : mLightManager(0) { } + : mLightManager(nullptr) { } CollectLightCallback(const CollectLightCallback& copy, const osg::CopyOp& copyop) : osg::NodeCallback(copy, copyop) - , mLightManager(0) { } + , mLightManager(nullptr) { } META_Object(SceneUtil, SceneUtil::CollectLightCallback) diff --git a/components/sdlutil/sdlcursormanager.cpp b/components/sdlutil/sdlcursormanager.cpp index 82854cb2f..56225868e 100644 --- a/components/sdlutil/sdlcursormanager.cpp +++ b/components/sdlutil/sdlcursormanager.cpp @@ -50,7 +50,7 @@ namespace CursorDecompression traits->alpha = 8; traits->windowDecoration = false; traits->doubleBuffer = false; - traits->sharedContext = 0; + traits->sharedContext = nullptr; traits->pbuffer = true; osg::GraphicsContext::ScreenIdentifier si; @@ -267,7 +267,7 @@ namespace SDLUtil if (mCursorMap.find(name) != mCursorMap.end()) return; - static bool forceSoftwareDecompression = (getenv("OPENMW_DECOMPRESS_TEXTURES") != 0); + static bool forceSoftwareDecompression = (getenv("OPENMW_DECOMPRESS_TEXTURES") != nullptr); SurfaceUniquePtr (*decompressionFunction)(osg::ref_ptr, float); if (forceSoftwareDecompression || CursorDecompression::DXTCSupported) { diff --git a/components/sdlutil/sdlgraphicswindow.cpp b/components/sdlutil/sdlgraphicswindow.cpp index 0a1951700..ad7ecd9ae 100644 --- a/components/sdlutil/sdlgraphicswindow.cpp +++ b/components/sdlutil/sdlgraphicswindow.cpp @@ -11,8 +11,8 @@ GraphicsWindowSDL2::~GraphicsWindowSDL2() } GraphicsWindowSDL2::GraphicsWindowSDL2(osg::GraphicsContext::Traits *traits) - : mWindow(0) - , mContext(0) + : mWindow(nullptr) + , mContext(nullptr) , mValid(false) , mRealized(false) , mOwnsWindow(false) @@ -79,7 +79,7 @@ void GraphicsWindowSDL2::init() WindowData *inheritedWindowData = dynamic_cast(_traits->inheritedWindowData.get()); mWindow = inheritedWindowData ? inheritedWindowData->mWindow : nullptr; - mOwnsWindow = (mWindow == 0); + mOwnsWindow = (mWindow == nullptr); if(mOwnsWindow) { OSG_FATAL<<"Error: No SDL window provided."<(object)!=0; } + bool isSameKindAs(const Object* object) const override { return dynamic_cast(object)!=nullptr; } const char* libraryName() const override { return "osgViewer"; } const char* className() const override { return "GraphicsWindowSDL2"; } diff --git a/components/terrain/quadtreenode.cpp b/components/terrain/quadtreenode.cpp index 7baea45c8..c113a629c 100644 --- a/components/terrain/quadtreenode.cpp +++ b/components/terrain/quadtreenode.cpp @@ -63,7 +63,7 @@ QuadTreeNode::QuadTreeNode(QuadTreeNode* parent, ChildDirection direction, float , mCenter(center) { for (unsigned int i=0; i<4; ++i) - mNeighbours[i] = 0; + mNeighbours[i] = nullptr; } QuadTreeNode::~QuadTreeNode() diff --git a/components/widgets/box.cpp b/components/widgets/box.cpp index 1db193320..23a108ee9 100644 --- a/components/widgets/box.cpp +++ b/components/widgets/box.cpp @@ -8,7 +8,7 @@ namespace Gui void AutoSizedWidget::notifySizeChange (MyGUI::Widget* w) { MyGUI::Widget * parent = w->getParent(); - if (parent != 0) + if (parent != nullptr) { if (mExpandDirection.isLeft()) { @@ -17,7 +17,7 @@ namespace Gui } w->setSize(getRequestedSize ()); - while (parent != 0) + while (parent != nullptr) { Box * b = dynamic_cast(parent); if (b) @@ -280,7 +280,7 @@ namespace Gui void HBox::initialiseOverride() { Base::initialiseOverride(); - MyGUI::Widget* client = 0; + MyGUI::Widget* client = nullptr; assignWidget(client, "Client"); setWidgetClient(client); } @@ -435,7 +435,7 @@ namespace Gui void VBox::initialiseOverride() { Base::initialiseOverride(); - MyGUI::Widget* client = 0; + MyGUI::Widget* client = nullptr; assignWidget(client, "Client"); setWidgetClient(client); } diff --git a/components/widgets/list.cpp b/components/widgets/list.cpp index bf24acf7e..73ca94929 100644 --- a/components/widgets/list.cpp +++ b/components/widgets/list.cpp @@ -7,9 +7,9 @@ namespace Gui { - MWList::MWList() : - mScrollView(0) - ,mClient(0) + MWList::MWList() + : mScrollView(nullptr) + , mClient(nullptr) , mItemHeight(0) { } @@ -19,7 +19,7 @@ namespace Gui Base::initialiseOverride(); assignWidget(mClient, "Client"); - if (mClient == 0) + if (mClient == nullptr) mClient = this; mScrollView = mClient->createWidgetReal( diff --git a/extern/osg-ffmpeg-videoplayer/audiodecoder.cpp b/extern/osg-ffmpeg-videoplayer/audiodecoder.cpp index 0c314ec7d..337382679 100644 --- a/extern/osg-ffmpeg-videoplayer/audiodecoder.cpp +++ b/extern/osg-ffmpeg-videoplayer/audiodecoder.cpp @@ -30,7 +30,7 @@ namespace Video struct AudioResampler { AudioResampler() - : mSwr(NULL) + : mSwr(nullptr) { } @@ -51,8 +51,8 @@ MovieAudioDecoder::MovieAudioDecoder(VideoState* videoState) , mFramePos(0) , mFrameSize(0) , mAudioClock(0.0) - , mDataBuf(NULL) - , mFrameData(NULL) + , mDataBuf(nullptr) + , mFrameData(nullptr) , mDataBufLen(0) , mFrame(av_frame_alloc()) , mGetNextPacket(true) @@ -125,7 +125,7 @@ void MovieAudioDecoder::setupFormat() inputSampleFormat, inputSampleRate, 0, // logging level offset - NULL); // log context + nullptr); // log context if(!mAudioResampler->mSwr) fail(std::string("Couldn't allocate SwrContext")); if(swr_init(mAudioResampler->mSwr) < 0) diff --git a/extern/osg-ffmpeg-videoplayer/videoplayer.cpp b/extern/osg-ffmpeg-videoplayer/videoplayer.cpp index c6544de9c..28ac3b36c 100644 --- a/extern/osg-ffmpeg-videoplayer/videoplayer.cpp +++ b/extern/osg-ffmpeg-videoplayer/videoplayer.cpp @@ -11,7 +11,7 @@ namespace Video { VideoPlayer::VideoPlayer() - : mState(NULL) + : mState(nullptr) { } @@ -87,13 +87,13 @@ void VideoPlayer::close() mState->deinit(); delete mState; - mState = NULL; + mState = nullptr; } } bool VideoPlayer::hasAudioStream() { - return mState && mState->audio_st != NULL; + return mState && mState->audio_st != nullptr; } void VideoPlayer::play() diff --git a/extern/osg-ffmpeg-videoplayer/videostate.cpp b/extern/osg-ffmpeg-videoplayer/videostate.cpp index c176fe0f2..5858d985a 100644 --- a/extern/osg-ffmpeg-videoplayer/videostate.cpp +++ b/extern/osg-ffmpeg-videoplayer/videostate.cpp @@ -42,14 +42,14 @@ namespace Video { VideoState::VideoState() - : mAudioFactory(NULL) - , format_ctx(NULL) - , video_ctx(NULL) - , audio_ctx(NULL) + : mAudioFactory(nullptr) + , format_ctx(nullptr) + , video_ctx(nullptr) + , audio_ctx(nullptr) , av_sync_type(AV_SYNC_DEFAULT) - , audio_st(NULL) - , video_st(NULL), frame_last_pts(0.0) - , video_clock(0.0), sws_context(NULL), rgbaFrame(NULL), pictq_size(0) + , audio_st(nullptr) + , video_st(nullptr), frame_last_pts(0.0) + , video_clock(0.0), sws_context(nullptr), rgbaFrame(nullptr), pictq_size(0) , pictq_rindex(0), pictq_windex(0) , mSeekRequested(false) , mSeekPos(0) @@ -86,7 +86,7 @@ void PacketQueue::put(AVPacket *pkt) throw std::runtime_error("Failed to duplicate packet"); pkt1->pkt = *pkt; - pkt1->next = NULL; + pkt1->next = nullptr; this->mutex.lock (); @@ -112,7 +112,7 @@ int PacketQueue::get(AVPacket *pkt, VideoState *is) { this->first_pkt = pkt1->next; if(!this->first_pkt) - this->last_pkt = NULL; + this->last_pkt = nullptr; this->nb_packets--; this->size -= pkt1->pkt.size; @@ -141,15 +141,15 @@ void PacketQueue::clear() AVPacketList *pkt, *pkt1; this->mutex.lock(); - for(pkt = this->first_pkt; pkt != NULL; pkt = pkt1) + for(pkt = this->first_pkt; pkt != nullptr; pkt = pkt1) { pkt1 = pkt->next; if (pkt->pkt.data != flush_pkt.data) av_packet_unref(&pkt->pkt); av_freep(&pkt); } - this->last_pkt = NULL; - this->first_pkt = NULL; + this->last_pkt = nullptr; + this->first_pkt = nullptr; this->nb_packets = 0; this->size = 0; this->mutex.unlock (); @@ -296,14 +296,14 @@ int VideoState::queue_picture(AVFrame *pFrame, double pts) // Convert the image into RGBA format // TODO: we could do this in a pixel shader instead, if the source format // matches a commonly used format (ie YUV420P) - if(this->sws_context == NULL) + if(this->sws_context == nullptr) { int w = this->video_ctx->width; int h = this->video_ctx->height; this->sws_context = sws_getContext(w, h, this->video_ctx->pix_fmt, w, h, AV_PIX_FMT_RGBA, SWS_BICUBIC, - NULL, NULL, NULL); - if(this->sws_context == NULL) + nullptr, nullptr, nullptr); + if(this->sws_context == nullptr) throw std::runtime_error("Cannot initialize the conversion context!\n"); } @@ -587,7 +587,7 @@ int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx) av_codec_set_pkt_timebase(this->audio_ctx, pFormatCtx->streams[stream_index]->time_base); #endif - if (avcodec_open2(this->audio_ctx, codec, NULL) < 0) + if (avcodec_open2(this->audio_ctx, codec, nullptr) < 0) { fprintf(stderr, "Unsupported codec!\n"); return -1; @@ -597,7 +597,7 @@ int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx) { std::cerr << "No audio factory registered, can not play audio stream" << std::endl; avcodec_free_context(&this->audio_ctx); - this->audio_st = NULL; + this->audio_st = nullptr; return -1; } @@ -606,7 +606,7 @@ int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx) { std::cerr << "Failed to create audio decoder, can not play audio stream" << std::endl; avcodec_free_context(&this->audio_ctx); - this->audio_st = NULL; + this->audio_st = nullptr; return -1; } mAudioDecoder->setupFormat(); @@ -624,7 +624,7 @@ int VideoState::stream_open(int stream_index, AVFormatContext *pFormatCtx) av_codec_set_pkt_timebase(this->video_ctx, pFormatCtx->streams[stream_index]->time_base); #endif - if (avcodec_open2(this->video_ctx, codec, NULL) < 0) + if (avcodec_open2(this->video_ctx, codec, nullptr) < 0) { fprintf(stderr, "Unsupported codec!\n"); return -1; @@ -653,7 +653,7 @@ void VideoState::init(std::shared_ptr inputstream, const std::stri if(!this->stream.get()) throw std::runtime_error("Failed to open video resource"); - AVIOContext *ioCtx = avio_alloc_context(NULL, 0, 0, this, istream_read, istream_write, istream_seek); + AVIOContext *ioCtx = avio_alloc_context(nullptr, 0, 0, this, istream_read, istream_write, istream_seek); if(!ioCtx) throw std::runtime_error("Failed to allocate AVIOContext"); this->format_ctx = avformat_alloc_context(); @@ -667,27 +667,27 @@ void VideoState::init(std::shared_ptr inputstream, const std::stri /// /// https://trac.ffmpeg.org/ticket/1357 /// - if(!this->format_ctx || avformat_open_input(&this->format_ctx, name.c_str(), NULL, NULL)) + if(!this->format_ctx || avformat_open_input(&this->format_ctx, name.c_str(), nullptr, nullptr)) { - if (this->format_ctx != NULL) + if (this->format_ctx != nullptr) { - if (this->format_ctx->pb != NULL) + if (this->format_ctx->pb != nullptr) { av_free(this->format_ctx->pb->buffer); - this->format_ctx->pb->buffer = NULL; + this->format_ctx->pb->buffer = nullptr; av_free(this->format_ctx->pb); - this->format_ctx->pb = NULL; + this->format_ctx->pb = nullptr; } } // "Note that a user-supplied AVFormatContext will be freed on failure." - this->format_ctx = NULL; + this->format_ctx = nullptr; av_free(ioCtx); throw std::runtime_error("Failed to open video input"); } // Retrieve stream information - if(avformat_find_stream_info(this->format_ctx, NULL) < 0) + if(avformat_find_stream_info(this->format_ctx, nullptr) < 0) throw std::runtime_error("Failed to retrieve stream information"); // Dump information about file onto standard error @@ -735,16 +735,16 @@ void VideoState::deinit() if(this->audio_ctx) avcodec_free_context(&this->audio_ctx); - this->audio_st = NULL; - this->audio_ctx = NULL; + this->audio_st = nullptr; + this->audio_ctx = nullptr; if(this->video_ctx) avcodec_free_context(&this->video_ctx); - this->video_st = NULL; - this->video_ctx = NULL; + this->video_st = nullptr; + this->video_ctx = nullptr; if(this->sws_context) sws_freeContext(this->sws_context); - this->sws_context = NULL; + this->sws_context = nullptr; if(this->format_ctx) { @@ -754,13 +754,13 @@ void VideoState::deinit() /// /// https://trac.ffmpeg.org/ticket/1357 /// - if (this->format_ctx->pb != NULL) + if (this->format_ctx->pb != nullptr) { av_free(this->format_ctx->pb->buffer); - this->format_ctx->pb->buffer = NULL; + this->format_ctx->pb->buffer = nullptr; av_free(this->format_ctx->pb); - this->format_ctx->pb = NULL; + this->format_ctx->pb = nullptr; } avformat_close_input(&this->format_ctx); } @@ -768,8 +768,8 @@ void VideoState::deinit() if (mTexture) { // reset Image separately, it's pointing to *this and there might still be outside references to mTexture - mTexture->setImage(NULL); - mTexture = NULL; + mTexture->setImage(nullptr); + mTexture = nullptr; } } diff --git a/extern/osg-ffmpeg-videoplayer/videostate.hpp b/extern/osg-ffmpeg-videoplayer/videostate.hpp index 984050cd6..641fce04b 100644 --- a/extern/osg-ffmpeg-videoplayer/videostate.hpp +++ b/extern/osg-ffmpeg-videoplayer/videostate.hpp @@ -71,7 +71,7 @@ struct ExternalClock struct PacketQueue { PacketQueue() - : first_pkt(NULL), last_pkt(NULL), flushing(false), nb_packets(0), size(0) + : first_pkt(nullptr), last_pkt(nullptr), flushing(false), nb_packets(0), size(0) { } ~PacketQueue() { clear(); }