mirror of
https://github.com/vcmi/vcmi.git
synced 2025-05-13 22:06:58 +02:00
Use the "nullptr" literal.
"nullptr" should be used to denote the null pointer
This commit is contained in:
parent
70acf987b4
commit
f01ec55d21
@ -260,7 +260,7 @@ public:
|
|||||||
//optimization - use one SM for every hero call
|
//optimization - use one SM for every hero call
|
||||||
|
|
||||||
const CGTownInstance * findTownWithTavern() const;
|
const CGTownInstance * findTownWithTavern() const;
|
||||||
bool canRecruitAnyHero(const CGTownInstance * t = NULL) const;
|
bool canRecruitAnyHero(const CGTownInstance * t = nullptr) const;
|
||||||
|
|
||||||
Goals::TSubgoal getGoal(HeroPtr h) const;
|
Goals::TSubgoal getGoal(HeroPtr h) const;
|
||||||
bool canAct(HeroPtr h) const;
|
bool canAct(HeroPtr h) const;
|
||||||
|
@ -86,7 +86,7 @@ static void prog_version()
|
|||||||
|
|
||||||
static void prog_help(const po::options_description &opts)
|
static void prog_help(const po::options_description &opts)
|
||||||
{
|
{
|
||||||
auto time = std::time(0);
|
auto time = std::time(nullptr);
|
||||||
printf("%s - A Heroes of Might and Magic 3 clone\n", GameConstants::VCMI_VERSION.c_str());
|
printf("%s - A Heroes of Might and Magic 3 clone\n", GameConstants::VCMI_VERSION.c_str());
|
||||||
printf("Copyright (C) 2007-%d VCMI dev team - see AUTHORS file\n", std::localtime(&time)->tm_year + 1900);
|
printf("Copyright (C) 2007-%d VCMI dev team - see AUTHORS file\n", std::localtime(&time)->tm_year + 1900);
|
||||||
printf("This is free software; see the source for copying conditions. There is NO\n");
|
printf("This is free software; see the source for copying conditions. There is NO\n");
|
||||||
|
@ -305,7 +305,7 @@ bool CVideoPlayer::nextFrame()
|
|||||||
sws_scale(sws, frame->data, frame->linesize,
|
sws_scale(sws, frame->data, frame->linesize,
|
||||||
0, codecContext->height, data, linesize);
|
0, codecContext->height, data, linesize);
|
||||||
|
|
||||||
SDL_UpdateYUVTexture(texture, NULL, data[0], linesize[0],
|
SDL_UpdateYUVTexture(texture, nullptr, data[0], linesize[0],
|
||||||
data[1], linesize[1],
|
data[1], linesize[1],
|
||||||
data[2], linesize[2]);
|
data[2], linesize[2]);
|
||||||
av_freep(&data[0]);
|
av_freep(&data[0]);
|
||||||
|
@ -31,7 +31,7 @@ public:
|
|||||||
class IMainVideoPlayer : public IVideoPlayer
|
class IMainVideoPlayer : public IVideoPlayer
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true, std::function<void()> restart = 0){}
|
virtual void update(int x, int y, SDL_Surface *dst, bool forceRedraw, bool update = true, std::function<void()> restart = nullptr){}
|
||||||
virtual bool openAndPlayVideo(const VideoPath & name, int x, int y, bool stopOnKey = false, bool scale = false)
|
virtual bool openAndPlayVideo(const VideoPath & name, int x, int y, bool stopOnKey = false, bool scale = false)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
|
@ -264,7 +264,7 @@ int CHighScoreInputScreen::addEntry(std::string text) {
|
|||||||
newNode["scenarioName"].String() = calc.calculate().cheater ? CGI->generaltexth->translate("core.genrltxt.260") : calc.parameters[0].scenarioName;
|
newNode["scenarioName"].String() = calc.calculate().cheater ? CGI->generaltexth->translate("core.genrltxt.260") : calc.parameters[0].scenarioName;
|
||||||
newNode["days"].Integer() = calc.calculate().sumDays;
|
newNode["days"].Integer() = calc.calculate().sumDays;
|
||||||
newNode["points"].Integer() = calc.calculate().cheater ? 0 : calc.calculate().total;
|
newNode["points"].Integer() = calc.calculate().cheater ? 0 : calc.calculate().total;
|
||||||
newNode["datetime"].String() = vstd::getFormattedDateTime(std::time(0));
|
newNode["datetime"].String() = vstd::getFormattedDateTime(std::time(nullptr));
|
||||||
newNode["posFlag"].Bool() = true;
|
newNode["posFlag"].Bool() = true;
|
||||||
|
|
||||||
baseNode.push_back(newNode);
|
baseNode.push_back(newNode);
|
||||||
|
@ -59,7 +59,7 @@ void CursorSoftware::updateTexture()
|
|||||||
CSDL_Ext::fillSurface(cursorSurface, CSDL_Ext::toSDL(Colors::TRANSPARENCY));
|
CSDL_Ext::fillSurface(cursorSurface, CSDL_Ext::toSDL(Colors::TRANSPARENCY));
|
||||||
|
|
||||||
cursorImage->draw(cursorSurface);
|
cursorImage->draw(cursorSurface);
|
||||||
SDL_UpdateTexture(cursorTexture, NULL, cursorSurface->pixels, cursorSurface->pitch);
|
SDL_UpdateTexture(cursorTexture, nullptr, cursorSurface->pixels, cursorSurface->pitch);
|
||||||
needUpdate = false;
|
needUpdate = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -68,7 +68,7 @@ void CSDL_Ext::updateRect(SDL_Surface *surface, const Rect & rect )
|
|||||||
logGlobal->error("%sSDL_UpdateTexture %s", __FUNCTION__, SDL_GetError());
|
logGlobal->error("%sSDL_UpdateTexture %s", __FUNCTION__, SDL_GetError());
|
||||||
|
|
||||||
SDL_RenderClear(mainRenderer);
|
SDL_RenderClear(mainRenderer);
|
||||||
if(0 != SDL_RenderCopy(mainRenderer, screenTexture, NULL, NULL))
|
if(0 != SDL_RenderCopy(mainRenderer, screenTexture, nullptr, nullptr))
|
||||||
logGlobal->error("%sSDL_RenderCopy %s", __FUNCTION__, SDL_GetError());
|
logGlobal->error("%sSDL_RenderCopy %s", __FUNCTION__, SDL_GetError());
|
||||||
SDL_RenderPresent(mainRenderer);
|
SDL_RenderPresent(mainRenderer);
|
||||||
|
|
||||||
@ -813,8 +813,8 @@ void CSDL_Ext::fillRectBlended( SDL_Surface *dst, const Rect & dstrect, const SD
|
|||||||
uint32_t sdlColor = SDL_MapRGBA(dst->format, color.r, color.g, color.b, color.a);
|
uint32_t sdlColor = SDL_MapRGBA(dst->format, color.r, color.g, color.b, color.a);
|
||||||
|
|
||||||
SDL_Surface * tmp = SDL_CreateRGBSurface(0, newRect.w, newRect.h, dst->format->BitsPerPixel, dst->format->Rmask, dst->format->Gmask, dst->format->Bmask, dst->format->Amask);
|
SDL_Surface * tmp = SDL_CreateRGBSurface(0, newRect.w, newRect.h, dst->format->BitsPerPixel, dst->format->Rmask, dst->format->Gmask, dst->format->Bmask, dst->format->Amask);
|
||||||
SDL_FillRect(tmp, NULL, sdlColor);
|
SDL_FillRect(tmp, nullptr, sdlColor);
|
||||||
SDL_BlitSurface(tmp, NULL, dst, &newRect);
|
SDL_BlitSurface(tmp, nullptr, dst, &newRect);
|
||||||
SDL_FreeSurface(tmp);
|
SDL_FreeSurface(tmp);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,7 +23,7 @@ class AboutProjectView : public QWidget
|
|||||||
|
|
||||||
void changeEvent(QEvent *event) override;
|
void changeEvent(QEvent *event) override;
|
||||||
public:
|
public:
|
||||||
explicit AboutProjectView(QWidget * parent = 0);
|
explicit AboutProjectView(QWidget * parent = nullptr);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
@ -67,7 +67,7 @@ class FirstLaunchView : public QWidget
|
|||||||
void installMod(const QString & modID);
|
void installMod(const QString & modID);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit FirstLaunchView(QWidget * parent = 0);
|
explicit FirstLaunchView(QWidget * parent = nullptr);
|
||||||
|
|
||||||
public slots:
|
public slots:
|
||||||
|
|
||||||
|
@ -194,7 +194,7 @@ class SocketLobby : public QObject
|
|||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
public:
|
public:
|
||||||
explicit SocketLobby(QObject *parent = 0);
|
explicit SocketLobby(QObject *parent = nullptr);
|
||||||
void connectServer(const QString & host, int port, const QString & username, int timeout);
|
void connectServer(const QString & host, int port, const QString & username, int timeout);
|
||||||
void disconnectServer();
|
void disconnectServer();
|
||||||
void requestNewSession(const QString & session, int totalPlayers, const QString & pswd, const QMap<QString, QString> & mods);
|
void requestNewSession(const QString & session, int totalPlayers, const QString & pswd, const QMap<QString, QString> & mods);
|
||||||
|
@ -56,7 +56,7 @@ class CModListModel : public QAbstractItemModel, public CModList
|
|||||||
QVariant getIcon(const CModEntry & mod, int field) const;
|
QVariant getIcon(const CModEntry & mod, int field) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CModListModel(QObject * parent = 0);
|
explicit CModListModel(QObject * parent = nullptr);
|
||||||
|
|
||||||
/// CModListContainer overrides
|
/// CModListContainer overrides
|
||||||
void resetRepositories() override;
|
void resetRepositories() override;
|
||||||
@ -93,5 +93,5 @@ class CModFilterModel : public QSortFilterProxyModel
|
|||||||
public:
|
public:
|
||||||
void setTypeFilter(int filteredType, int filterMask);
|
void setTypeFilter(int filteredType, int filterMask);
|
||||||
|
|
||||||
CModFilterModel(CModListModel * model, QObject * parent = 0);
|
CModFilterModel(CModListModel * model, QObject * parent = nullptr);
|
||||||
};
|
};
|
||||||
|
@ -64,7 +64,7 @@ signals:
|
|||||||
void modsChanged();
|
void modsChanged();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CModListView(QWidget * parent = 0);
|
explicit CModListView(QWidget * parent = nullptr);
|
||||||
~CModListView();
|
~CModListView();
|
||||||
|
|
||||||
void loadScreenshots();
|
void loadScreenshots();
|
||||||
|
@ -23,12 +23,12 @@ class ImageViewer : public QDialog
|
|||||||
|
|
||||||
void changeEvent(QEvent *event) override;
|
void changeEvent(QEvent *event) override;
|
||||||
public:
|
public:
|
||||||
explicit ImageViewer(QWidget * parent = 0);
|
explicit ImageViewer(QWidget * parent = nullptr);
|
||||||
~ImageViewer();
|
~ImageViewer();
|
||||||
|
|
||||||
void setPixmap(QPixmap & pixmap);
|
void setPixmap(QPixmap & pixmap);
|
||||||
|
|
||||||
static void showPixmap(QPixmap & pixmap, QWidget * parent = 0);
|
static void showPixmap(QPixmap & pixmap, QWidget * parent = nullptr);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void mousePressEvent(QMouseEvent * event) override;
|
void mousePressEvent(QMouseEvent * event) override;
|
||||||
|
@ -20,7 +20,7 @@ class CSettingsView : public QWidget
|
|||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit CSettingsView(QWidget * parent = 0);
|
explicit CSettingsView(QWidget * parent = nullptr);
|
||||||
~CSettingsView();
|
~CSettingsView();
|
||||||
|
|
||||||
void loadSettings();
|
void loadSettings();
|
||||||
|
@ -134,7 +134,7 @@ LONG WINAPI onUnhandledException(EXCEPTION_POINTERS* exception)
|
|||||||
HMODULE hModule = nullptr;
|
HMODULE hModule = nullptr;
|
||||||
GetModuleFileNameA(hModule, buffer, MAX_PATH);
|
GetModuleFileNameA(hModule, buffer, MAX_PATH);
|
||||||
mname = strrchr(buffer, '\\');
|
mname = strrchr(buffer, '\\');
|
||||||
if (mname != 0)
|
if (mname != nullptr)
|
||||||
mname++;
|
mname++;
|
||||||
else
|
else
|
||||||
mname = buffer;
|
mname = buffer;
|
||||||
|
@ -140,7 +140,7 @@ struct DLL_LINKAGE StartInfo
|
|||||||
}
|
}
|
||||||
|
|
||||||
StartInfo() : mode(INVALID), difficulty(1), seedToBeUsed(0), seedPostInit(0),
|
StartInfo() : mode(INVALID), difficulty(1), seedToBeUsed(0), seedPostInit(0),
|
||||||
mapfileChecksum(0), startTimeIso8601(vstd::getDateTimeISO8601Basic(std::time(0))), fileURI("")
|
mapfileChecksum(0), startTimeIso8601(vstd::getDateTimeISO8601Basic(std::time(nullptr))), fileURI("")
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -573,7 +573,7 @@ void CGameState::initNewGame(const IMapService * mapService, bool allowSavingRan
|
|||||||
|
|
||||||
const std::string templateName = options->getMapTemplate()->getName();
|
const std::string templateName = options->getMapTemplate()->getName();
|
||||||
const ui32 seed = scenarioOps->seedToBeUsed;
|
const ui32 seed = scenarioOps->seedToBeUsed;
|
||||||
const std::string dt = vstd::getDateTimeISO8601Basic(std::time(0));
|
const std::string dt = vstd::getDateTimeISO8601Basic(std::time(nullptr));
|
||||||
|
|
||||||
const std::string fileName = boost::str(boost::format("%s_%s_%d.vmap") % dt % templateName % seed );
|
const std::string fileName = boost::str(boost::format("%s_%s_%d.vmap") % dt % templateName % seed );
|
||||||
const auto fullPath = path / fileName;
|
const auto fullPath = path / fileName;
|
||||||
|
@ -54,7 +54,7 @@ struct VectorizedObjectInfo
|
|||||||
class DLL_LINKAGE CSerializer
|
class DLL_LINKAGE CSerializer
|
||||||
{
|
{
|
||||||
template<typename T>
|
template<typename T>
|
||||||
static si32 idToNumber(const T &t, typename std::enable_if<std::is_convertible<T,si32>::value>::type * dummy = 0)
|
static si32 idToNumber(const T &t, typename std::enable_if<std::is_convertible<T,si32>::value>::type * dummy = nullptr)
|
||||||
{
|
{
|
||||||
return t;
|
return t;
|
||||||
}
|
}
|
||||||
|
@ -317,7 +317,7 @@ bool CVCMIServer::prepareToStartGame()
|
|||||||
{
|
{
|
||||||
case StartInfo::CAMPAIGN:
|
case StartInfo::CAMPAIGN:
|
||||||
logNetwork->info("Preparing to start new campaign");
|
logNetwork->info("Preparing to start new campaign");
|
||||||
si->startTimeIso8601 = vstd::getDateTimeISO8601Basic(std::time(0));
|
si->startTimeIso8601 = vstd::getDateTimeISO8601Basic(std::time(nullptr));
|
||||||
si->fileURI = mi->fileURI;
|
si->fileURI = mi->fileURI;
|
||||||
si->campState->setCurrentMap(campaignMap);
|
si->campState->setCurrentMap(campaignMap);
|
||||||
si->campState->setCurrentMapBonus(campaignBonus);
|
si->campState->setCurrentMapBonus(campaignBonus);
|
||||||
@ -326,7 +326,7 @@ bool CVCMIServer::prepareToStartGame()
|
|||||||
|
|
||||||
case StartInfo::NEW_GAME:
|
case StartInfo::NEW_GAME:
|
||||||
logNetwork->info("Preparing to start new game");
|
logNetwork->info("Preparing to start new game");
|
||||||
si->startTimeIso8601 = vstd::getDateTimeISO8601Basic(std::time(0));
|
si->startTimeIso8601 = vstd::getDateTimeISO8601Basic(std::time(nullptr));
|
||||||
si->fileURI = mi->fileURI;
|
si->fileURI = mi->fileURI;
|
||||||
gh->init(si.get(), progressTracking);
|
gh->init(si.get(), progressTracking);
|
||||||
break;
|
break;
|
||||||
@ -1125,7 +1125,7 @@ static void handleCommandOptions(int argc, const char * argv[], boost::program_o
|
|||||||
#ifndef SINGLE_PROCESS_APP
|
#ifndef SINGLE_PROCESS_APP
|
||||||
if(options.count("help"))
|
if(options.count("help"))
|
||||||
{
|
{
|
||||||
auto time = std::time(0);
|
auto time = std::time(nullptr);
|
||||||
printf("%s - A Heroes of Might and Magic 3 clone\n", GameConstants::VCMI_VERSION.c_str());
|
printf("%s - A Heroes of Might and Magic 3 clone\n", GameConstants::VCMI_VERSION.c_str());
|
||||||
printf("Copyright (C) 2007-%d VCMI dev team - see AUTHORS file\n", std::localtime(&time)->tm_year + 1900);
|
printf("Copyright (C) 2007-%d VCMI dev team - see AUTHORS file\n", std::localtime(&time)->tm_year + 1900);
|
||||||
printf("This is free software; see the source for copying conditions. There is NO\n");
|
printf("This is free software; see the source for copying conditions. There is NO\n");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user