mirror of
https://github.com/blupi-games/planetblupi
synced 2024-12-30 10:15:36 +01:00
Replace NULL by nullptr
This commit is contained in:
parent
31483d7ded
commit
36d0a341bb
@ -936,7 +936,7 @@ void CDecor::ArrangeFill(POINT pos, int channel, int icon, bool bFloor)
|
||||
}
|
||||
|
||||
m_pFillMap = (char*)malloc(MAXCELX*MAXCELY*sizeof(char)/4);
|
||||
if ( m_pFillMap == NULL ) return;
|
||||
if ( m_pFillMap == nullptr ) return;
|
||||
memset(m_pFillMap, 0, MAXCELX*MAXCELY*sizeof(char)/4);
|
||||
|
||||
ArrangeFillSearch(pos);
|
||||
|
62
blupi.cpp
62
blupi.cpp
@ -32,11 +32,11 @@
|
||||
|
||||
SDL_Window *g_window;
|
||||
SDL_Renderer *g_renderer;
|
||||
CEvent* g_pEvent = NULL;
|
||||
CPixmap* g_pPixmap = NULL; // pixmap principal
|
||||
CSound* g_pSound = NULL; // sound principal
|
||||
CMovie* g_pMovie = NULL; // movie principal
|
||||
CDecor* g_pDecor = NULL;
|
||||
CEvent* g_pEvent = nullptr;
|
||||
CPixmap* g_pPixmap = nullptr; // pixmap principal
|
||||
CSound* g_pSound = nullptr; // sound principal
|
||||
CMovie* g_pMovie = nullptr; // movie principal
|
||||
CDecor* g_pDecor = nullptr;
|
||||
bool g_bFullScreen = false; // false si mode de test
|
||||
int g_speedRate = 1;
|
||||
int g_timerInterval = 50; // inverval = 50ms
|
||||
@ -68,19 +68,19 @@ int GetNum(char *p)
|
||||
|
||||
bool ReadConfig(LPSTR lpCmdLine)
|
||||
{
|
||||
FILE* file = NULL;
|
||||
FILE* file = nullptr;
|
||||
char buffer[200];
|
||||
char* pText;
|
||||
size_t nb;
|
||||
|
||||
file = fopen("data\\config.def", "rb");
|
||||
if ( file == NULL ) return false;
|
||||
if ( file == nullptr ) return false;
|
||||
nb = fread(buffer, sizeof(char), 200-1, file);
|
||||
buffer[nb] = 0;
|
||||
fclose(file);
|
||||
|
||||
pText = strstr(buffer, "SpeedRate=");
|
||||
if ( pText != NULL )
|
||||
if ( pText != nullptr )
|
||||
{
|
||||
g_speedRate = GetNum(pText+10);
|
||||
if ( g_speedRate < 1 ) g_speedRate = 1;
|
||||
@ -88,7 +88,7 @@ bool ReadConfig(LPSTR lpCmdLine)
|
||||
}
|
||||
|
||||
pText = strstr(buffer, "Timer=");
|
||||
if ( pText != NULL )
|
||||
if ( pText != nullptr )
|
||||
{
|
||||
g_timerInterval = GetNum(pText+6);
|
||||
if ( g_timerInterval < 10 ) g_timerInterval = 10;
|
||||
@ -96,14 +96,14 @@ bool ReadConfig(LPSTR lpCmdLine)
|
||||
}
|
||||
|
||||
pText = strstr(buffer, "FullScreen=");
|
||||
if ( pText != NULL )
|
||||
if ( pText != nullptr )
|
||||
{
|
||||
g_bFullScreen = !!GetNum(pText+11);
|
||||
if ( g_bFullScreen != 0 ) g_bFullScreen = 1;
|
||||
}
|
||||
|
||||
pText = strstr(buffer, "MouseType=");
|
||||
if ( pText != NULL )
|
||||
if ( pText != nullptr )
|
||||
{
|
||||
g_mouseType = GetNum(pText+10);
|
||||
if ( g_mouseType < 1 ) g_mouseType = 1;
|
||||
@ -239,7 +239,7 @@ void Benchmark()
|
||||
|
||||
bool RestoreGame()
|
||||
{
|
||||
if ( g_pPixmap == NULL ) return false;
|
||||
if ( g_pPixmap == nullptr ) return false;
|
||||
|
||||
g_pEvent->RestoreGame();
|
||||
return true;
|
||||
@ -249,7 +249,7 @@ bool RestoreGame()
|
||||
|
||||
bool FlushGame()
|
||||
{
|
||||
if ( g_pPixmap == NULL ) return false;
|
||||
if ( g_pPixmap == nullptr ) return false;
|
||||
|
||||
return g_pPixmap->Flush();
|
||||
}
|
||||
@ -259,38 +259,38 @@ bool FlushGame()
|
||||
|
||||
static void FinishObjects(void)
|
||||
{
|
||||
if ( g_pMovie != NULL )
|
||||
if ( g_pMovie != nullptr )
|
||||
{
|
||||
g_pEvent->StopMovie();
|
||||
|
||||
delete g_pMovie;
|
||||
g_pMovie = NULL;
|
||||
g_pMovie = nullptr;
|
||||
}
|
||||
|
||||
if ( g_pEvent != NULL )
|
||||
if ( g_pEvent != nullptr )
|
||||
{
|
||||
delete g_pEvent;
|
||||
g_pEvent = NULL;
|
||||
g_pEvent = nullptr;
|
||||
}
|
||||
|
||||
if ( g_pDecor != NULL )
|
||||
if ( g_pDecor != nullptr )
|
||||
{
|
||||
delete g_pDecor;
|
||||
g_pDecor = NULL;
|
||||
g_pDecor = nullptr;
|
||||
}
|
||||
|
||||
if ( g_pSound != NULL )
|
||||
if ( g_pSound != nullptr )
|
||||
{
|
||||
g_pSound->StopMusic(); // stoppe la musique Midi
|
||||
|
||||
delete g_pSound;
|
||||
g_pSound = NULL;
|
||||
g_pSound = nullptr;
|
||||
}
|
||||
|
||||
if ( g_pPixmap != NULL )
|
||||
if ( g_pPixmap != nullptr )
|
||||
{
|
||||
delete g_pPixmap;
|
||||
g_pPixmap = NULL;
|
||||
g_pPixmap = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -298,7 +298,7 @@ void WindowProc2 (const SDL_Event &event)
|
||||
{
|
||||
POINT totalDim, iconDim;
|
||||
|
||||
if ( g_pEvent != NULL &&
|
||||
if ( g_pEvent != nullptr &&
|
||||
g_pEvent->TreatEvent(event) )
|
||||
return;
|
||||
|
||||
@ -323,7 +323,7 @@ void WindowProc2 (const SDL_Event &event)
|
||||
g_pPixmap->Cache (CHHILI, "image\\hili.blp", totalDim, iconDim);
|
||||
}
|
||||
SDL_SetWindowTitle (g_window, "Blupi");
|
||||
if (g_pSound != NULL) g_pSound->RestartMusic ();
|
||||
if (g_pSound != nullptr) g_pSound->RestartMusic ();
|
||||
return;
|
||||
|
||||
case SDL_WINDOWEVENT_FOCUS_LOST:
|
||||
@ -332,7 +332,7 @@ void WindowProc2 (const SDL_Event &event)
|
||||
FlushGame ();
|
||||
}
|
||||
SDL_SetWindowTitle (g_window, "Blupi -- stop");
|
||||
if (g_pSound != NULL) g_pSound->SuspendMusic ();
|
||||
if (g_pSound != nullptr) g_pSound->SuspendMusic ();
|
||||
return;
|
||||
}
|
||||
break;
|
||||
@ -462,7 +462,7 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
|
||||
|
||||
// Crée le pixmap principal.
|
||||
g_pPixmap = new CPixmap;
|
||||
if ( g_pPixmap == NULL ) return InitFail("New pixmap", true);
|
||||
if ( g_pPixmap == nullptr ) return InitFail("New pixmap", true);
|
||||
|
||||
totalDim.x = LXIMAGE;
|
||||
totalDim.y = LYIMAGE;
|
||||
@ -582,7 +582,7 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
|
||||
|
||||
// Crée le gestionnaire de son.
|
||||
g_pSound = new CSound;
|
||||
if ( g_pSound == NULL ) return InitFail("New sound", true);
|
||||
if ( g_pSound == nullptr ) return InitFail("New sound", true);
|
||||
|
||||
g_pSound->Create();
|
||||
g_pSound->CacheAll();
|
||||
@ -590,20 +590,20 @@ static bool DoInit(HINSTANCE hInstance, LPSTR lpCmdLine, int nCmdShow)
|
||||
|
||||
// Crée le gestionnaire de films.
|
||||
g_pMovie = new CMovie;
|
||||
if ( g_pMovie == NULL ) return InitFail("New movie", false);
|
||||
if ( g_pMovie == nullptr ) return InitFail("New movie", false);
|
||||
|
||||
g_pMovie->Create();
|
||||
|
||||
// Crée le gestionnaire de décors.
|
||||
g_pDecor = new CDecor;
|
||||
if ( g_pDecor == NULL ) return InitFail("New decor", false);
|
||||
if ( g_pDecor == nullptr ) return InitFail("New decor", false);
|
||||
|
||||
g_pDecor->Create(g_pSound, g_pPixmap);
|
||||
g_pDecor->MapInitColors();
|
||||
|
||||
// Crée le gestionnaire d'événements.
|
||||
g_pEvent = new CEvent;
|
||||
if ( g_pEvent == NULL ) return InitFail("New event", false);
|
||||
if ( g_pEvent == nullptr ) return InitFail("New event", false);
|
||||
|
||||
g_pEvent->Create(g_pPixmap, g_pDecor, g_pSound, g_pMovie);
|
||||
g_pEvent->SetFullScreen(g_bFullScreen);
|
||||
|
@ -1318,7 +1318,7 @@ bool CDecor::GoalNextPhase(int rank)
|
||||
if ( m_blupi[rank].goalAction == 0 ) return false;
|
||||
|
||||
pTable = GetTableGoal(m_blupi[rank].goalAction);
|
||||
if ( pTable == NULL )
|
||||
if ( pTable == nullptr )
|
||||
{
|
||||
GoalStop(rank, true);
|
||||
return false;
|
||||
@ -1363,7 +1363,7 @@ void CDecor::GoalInitJauge(int rank)
|
||||
if ( m_blupi[rank].goalAction == 0 ) return;
|
||||
|
||||
pTable = GetTableGoal(m_blupi[rank].goalAction);
|
||||
if ( pTable == NULL ) goto term;
|
||||
if ( pTable == nullptr ) goto term;
|
||||
|
||||
while ( true )
|
||||
{
|
||||
|
@ -3525,7 +3525,7 @@ static short* table_pGoal[] =
|
||||
table_goal_teleporte10,
|
||||
table_goal_teleporte01,
|
||||
table_goal_teleporte11,
|
||||
NULL
|
||||
nullptr
|
||||
};
|
||||
|
||||
// Retourne le pointeur à la table table_goal_*.
|
||||
@ -3534,7 +3534,7 @@ short* GetTableGoal(int action)
|
||||
{
|
||||
short** ppTable = table_pGoal;
|
||||
|
||||
while ( *ppTable != NULL )
|
||||
while ( *ppTable != nullptr )
|
||||
{
|
||||
if ( **ppTable == action )
|
||||
{
|
||||
@ -3544,6 +3544,6 @@ short* GetTableGoal(int action)
|
||||
ppTable ++;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
36
decio.cpp
36
decio.cpp
@ -96,8 +96,8 @@ OldBlupi;
|
||||
bool CDecor::Write(int rank, bool bUser, int world, int time, int total)
|
||||
{
|
||||
char filename[MAX_PATH];
|
||||
FILE* file = NULL;
|
||||
DescFile* pBuffer = NULL;
|
||||
FILE* file = nullptr;
|
||||
DescFile* pBuffer = nullptr;
|
||||
int i;
|
||||
size_t nb;
|
||||
|
||||
@ -112,10 +112,10 @@ bool CDecor::Write(int rank, bool bUser, int world, int time, int total)
|
||||
}
|
||||
|
||||
file = fopen(filename, "wb");
|
||||
if ( file == NULL ) goto error;
|
||||
if ( file == nullptr ) goto error;
|
||||
|
||||
pBuffer = (DescFile*)malloc(sizeof(DescFile));
|
||||
if ( pBuffer == NULL ) goto error;
|
||||
if ( pBuffer == nullptr ) goto error;
|
||||
memset(pBuffer, 0, sizeof(DescFile));
|
||||
|
||||
pBuffer->majRev = 1;
|
||||
@ -165,8 +165,8 @@ bool CDecor::Write(int rank, bool bUser, int world, int time, int total)
|
||||
return true;
|
||||
|
||||
error:
|
||||
if ( pBuffer != NULL ) free(pBuffer);
|
||||
if ( file != NULL ) fclose(file);
|
||||
if ( pBuffer != nullptr ) free(pBuffer);
|
||||
if ( file != nullptr ) fclose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -175,8 +175,8 @@ bool CDecor::Write(int rank, bool bUser, int world, int time, int total)
|
||||
bool CDecor::Read(int rank, bool bUser, int &world, int &time, int &total)
|
||||
{
|
||||
char filename[MAX_PATH];
|
||||
FILE* file = NULL;
|
||||
DescFile* pBuffer = NULL;
|
||||
FILE* file = nullptr;
|
||||
DescFile* pBuffer = nullptr;
|
||||
int majRev, minRev;
|
||||
int i, x, y;
|
||||
size_t nb;
|
||||
@ -195,10 +195,10 @@ bool CDecor::Read(int rank, bool bUser, int &world, int &time, int &total)
|
||||
}
|
||||
|
||||
file = fopen(filename, "rb");
|
||||
if ( file == NULL ) goto error;
|
||||
if ( file == nullptr ) goto error;
|
||||
|
||||
pBuffer = (DescFile*)malloc(sizeof(DescFile));
|
||||
if ( pBuffer == NULL ) goto error;
|
||||
if ( pBuffer == nullptr ) goto error;
|
||||
|
||||
nb = fread(pBuffer, sizeof(DescFile), 1, file);
|
||||
if ( nb < 1 ) goto error;
|
||||
@ -304,8 +304,8 @@ bool CDecor::Read(int rank, bool bUser, int &world, int &time, int &total)
|
||||
return true;
|
||||
|
||||
error:
|
||||
if ( pBuffer != NULL ) free(pBuffer);
|
||||
if ( file != NULL ) fclose(file);
|
||||
if ( pBuffer != nullptr ) free(pBuffer);
|
||||
if ( file != nullptr ) fclose(file);
|
||||
|
||||
Flush(); // initialise un décor neutre
|
||||
return false;
|
||||
@ -316,8 +316,8 @@ bool CDecor::Read(int rank, bool bUser, int &world, int &time, int &total)
|
||||
bool CDecor::FileExist(int rank, bool bUser, int &world, int &time, int &total)
|
||||
{
|
||||
char filename[MAX_PATH];
|
||||
FILE* file = NULL;
|
||||
DescFile* pBuffer = NULL;
|
||||
FILE* file = nullptr;
|
||||
DescFile* pBuffer = nullptr;
|
||||
int majRev, minRev;
|
||||
size_t nb;
|
||||
|
||||
@ -332,10 +332,10 @@ bool CDecor::FileExist(int rank, bool bUser, int &world, int &time, int &total)
|
||||
}
|
||||
|
||||
file = fopen(filename, "rb");
|
||||
if ( file == NULL ) goto error;
|
||||
if ( file == nullptr ) goto error;
|
||||
|
||||
pBuffer = (DescFile*)malloc(sizeof(DescFile));
|
||||
if ( pBuffer == NULL ) goto error;
|
||||
if ( pBuffer == nullptr ) goto error;
|
||||
|
||||
nb = fread(pBuffer, sizeof(DescFile), 1, file);
|
||||
if ( nb < 1 ) goto error;
|
||||
@ -373,8 +373,8 @@ bool CDecor::FileExist(int rank, bool bUser, int &world, int &time, int &total)
|
||||
return true;
|
||||
|
||||
error:
|
||||
if ( pBuffer != NULL ) free(pBuffer);
|
||||
if ( file != NULL ) fclose(file);
|
||||
if ( pBuffer != nullptr ) free(pBuffer);
|
||||
if ( file != nullptr ) fclose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -538,7 +538,7 @@ bool CDecor::GenerateMap()
|
||||
|
||||
hbm = CreateBitmap(DIMMAPX, DIMMAPY, 1, 32, g_map32_bits);
|
||||
|
||||
if ( hbm == NULL ) return false;
|
||||
if ( hbm == nullptr ) return false;
|
||||
|
||||
SDL_Surface *surface = SDL_CreateRGBSurfaceFrom(g_map32_bits, DIMMAPX, DIMMAPY, 32, 4 * DIMMAPX, 0, 0, 0, 0);
|
||||
|
||||
|
@ -384,7 +384,7 @@ short* GetListMoves(int rank)
|
||||
if ( rank == 11 ) return table_move11;
|
||||
if ( rank == 12 ) return table_move12;
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
@ -522,7 +522,7 @@ short* GetListIcons(int rank)
|
||||
if ( rank == 10 ) return table_icon10;
|
||||
if ( rank == 11 ) return table_icon11;
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
||||
|
16
decor.cpp
16
decor.cpp
@ -98,8 +98,8 @@ POINT GetVector(int direct)
|
||||
|
||||
CDecor::CDecor()
|
||||
{
|
||||
m_pSound = NULL;
|
||||
m_pUndoDecor = NULL;
|
||||
m_pSound = nullptr;
|
||||
m_pUndoDecor = nullptr;
|
||||
|
||||
m_celCoin.x = 90;
|
||||
m_celCoin.y = 98;
|
||||
@ -3363,7 +3363,7 @@ char* CDecor::GetButtonExist()
|
||||
|
||||
void CDecor::UndoOpen()
|
||||
{
|
||||
if ( m_pUndoDecor == NULL )
|
||||
if ( m_pUndoDecor == nullptr )
|
||||
{
|
||||
m_pUndoDecor = (Cellule*)malloc(sizeof(Cellule)*(MAXCELX/2)*(MAXCELY/2));
|
||||
}
|
||||
@ -3373,10 +3373,10 @@ void CDecor::UndoOpen()
|
||||
|
||||
void CDecor::UndoClose()
|
||||
{
|
||||
if ( m_pUndoDecor != NULL )
|
||||
if ( m_pUndoDecor != nullptr )
|
||||
{
|
||||
free(m_pUndoDecor);
|
||||
m_pUndoDecor = NULL;
|
||||
m_pUndoDecor = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
@ -3386,7 +3386,7 @@ void CDecor::UndoCopy()
|
||||
{
|
||||
UndoOpen(); // ouvre le buffer du undo si nécessaire
|
||||
|
||||
if ( m_pUndoDecor != NULL )
|
||||
if ( m_pUndoDecor != nullptr )
|
||||
{
|
||||
memcpy(m_pUndoDecor, &m_decor, sizeof(Cellule)*(MAXCELX/2)*(MAXCELY/2));
|
||||
}
|
||||
@ -3396,7 +3396,7 @@ void CDecor::UndoCopy()
|
||||
|
||||
void CDecor::UndoBack()
|
||||
{
|
||||
if ( m_pUndoDecor != NULL )
|
||||
if ( m_pUndoDecor != nullptr )
|
||||
{
|
||||
memcpy(&m_decor, m_pUndoDecor, sizeof(Cellule)*(MAXCELX/2)*(MAXCELY/2));
|
||||
UndoClose();
|
||||
@ -3408,5 +3408,5 @@ void CDecor::UndoBack()
|
||||
|
||||
bool CDecor::IsUndo()
|
||||
{
|
||||
return ( m_pUndoDecor != NULL );
|
||||
return ( m_pUndoDecor != nullptr );
|
||||
}
|
||||
|
52
event.cpp
52
event.cpp
@ -1468,7 +1468,7 @@ CEvent::CEvent()
|
||||
m_bInfoHelp = false;
|
||||
m_bDemoRec = false;
|
||||
m_bDemoPlay = false;
|
||||
m_pDemoBuffer = NULL;
|
||||
m_pDemoBuffer = nullptr;
|
||||
m_demoTime = 0;
|
||||
m_keymod = 0;
|
||||
|
||||
@ -2808,7 +2808,7 @@ bool CEvent::ChangePhase(UINT phase)
|
||||
m_index = index;
|
||||
|
||||
strcpy(filename, table[m_index].backName);
|
||||
if ( strstr(filename, "%.3d") != NULL ) // "%.3d" dans le nom ?
|
||||
if ( strstr(filename, "%.3d") != nullptr ) // "%.3d" dans le nom ?
|
||||
{
|
||||
sprintf(filename, table[m_index].backName, GetImageWorld());
|
||||
}
|
||||
@ -4123,8 +4123,8 @@ void CEvent::PrivateLibelle()
|
||||
|
||||
bool CEvent::ReadLibelle(int world, bool bSchool, bool bHelp)
|
||||
{
|
||||
FILE* file = NULL;
|
||||
char* pBuffer = NULL;
|
||||
FILE* file = nullptr;
|
||||
char* pBuffer = nullptr;
|
||||
char* pText;
|
||||
char* pDest;
|
||||
char indic;
|
||||
@ -4136,11 +4136,11 @@ bool CEvent::ReadLibelle(int world, bool bSchool, bool bHelp)
|
||||
if ( bHelp ) indic = '@';
|
||||
|
||||
pBuffer = (char*)malloc(sizeof(char)*50000);
|
||||
if ( pBuffer == NULL ) goto error;
|
||||
if ( pBuffer == nullptr ) goto error;
|
||||
memset(pBuffer, 0, sizeof(char)*50000);
|
||||
|
||||
file = fopen("data\\enigmes.blp", "rb");
|
||||
if ( file == NULL ) goto error;
|
||||
if ( file == nullptr ) goto error;
|
||||
|
||||
nb = fread(pBuffer, sizeof(char), 50000-1, file);
|
||||
pBuffer[nb] = 0;
|
||||
@ -4178,8 +4178,8 @@ bool CEvent::ReadLibelle(int world, bool bSchool, bool bHelp)
|
||||
return true;
|
||||
|
||||
error:
|
||||
if ( pBuffer != NULL ) free(pBuffer);
|
||||
if ( file != NULL ) fclose(file);
|
||||
if ( pBuffer != nullptr ) free(pBuffer);
|
||||
if ( file != nullptr ) fclose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -4189,7 +4189,7 @@ bool CEvent::ReadLibelle(int world, bool bSchool, bool bHelp)
|
||||
bool CEvent::WriteInfo()
|
||||
{
|
||||
char filename[MAX_PATH];
|
||||
FILE* file = NULL;
|
||||
FILE* file = nullptr;
|
||||
DescInfo info;
|
||||
size_t nb;
|
||||
|
||||
@ -4197,7 +4197,7 @@ bool CEvent::WriteInfo()
|
||||
AddUserPath(filename);
|
||||
|
||||
file = fopen(filename, "wb");
|
||||
if ( file == NULL ) goto error;
|
||||
if ( file == nullptr ) goto error;
|
||||
|
||||
info.majRev = 1;
|
||||
info.minRev = 0;
|
||||
@ -4222,7 +4222,7 @@ bool CEvent::WriteInfo()
|
||||
return true;
|
||||
|
||||
error:
|
||||
if ( file != NULL ) fclose(file);
|
||||
if ( file != nullptr ) fclose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -4231,7 +4231,7 @@ bool CEvent::WriteInfo()
|
||||
bool CEvent::ReadInfo()
|
||||
{
|
||||
char filename[MAX_PATH];
|
||||
FILE* file = NULL;
|
||||
FILE* file = nullptr;
|
||||
DescInfo info;
|
||||
size_t nb;
|
||||
|
||||
@ -4239,7 +4239,7 @@ bool CEvent::ReadInfo()
|
||||
AddUserPath(filename);
|
||||
|
||||
file = fopen(filename, "rb");
|
||||
if ( file == NULL ) goto error;
|
||||
if ( file == nullptr ) goto error;
|
||||
|
||||
nb = fread(&info, sizeof(DescInfo), 1, file);
|
||||
if ( nb < 1 ) goto error;
|
||||
@ -4262,7 +4262,7 @@ bool CEvent::ReadInfo()
|
||||
return true;
|
||||
|
||||
error:
|
||||
if ( file != NULL ) fclose(file);
|
||||
if ( file != nullptr ) fclose(file);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -4297,7 +4297,7 @@ bool CEvent::GetPause()
|
||||
void CEvent::DemoRecStart()
|
||||
{
|
||||
m_pDemoBuffer = (DemoEvent*)malloc(MAXDEMO*sizeof(DemoEvent));
|
||||
if ( m_pDemoBuffer == NULL ) return;
|
||||
if ( m_pDemoBuffer == nullptr ) return;
|
||||
memset(m_pDemoBuffer, 0, MAXDEMO*sizeof(DemoEvent));
|
||||
|
||||
m_demoTime = 0;
|
||||
@ -4315,16 +4315,16 @@ void CEvent::DemoRecStart()
|
||||
|
||||
void CEvent::DemoRecStop()
|
||||
{
|
||||
FILE* file = NULL;
|
||||
FILE* file = nullptr;
|
||||
DemoHeader header;
|
||||
|
||||
if ( m_bDemoPlay ) return;
|
||||
|
||||
if ( m_pDemoBuffer != NULL )
|
||||
if ( m_pDemoBuffer != nullptr )
|
||||
{
|
||||
DeleteFile("data\\demo.blp");
|
||||
file = fopen("data\\demo.blp", "wb");
|
||||
if ( file != NULL )
|
||||
if ( file != nullptr )
|
||||
{
|
||||
memset(&header, 0, sizeof(DemoHeader));
|
||||
header.majRev = 1;
|
||||
@ -4338,7 +4338,7 @@ void CEvent::DemoRecStop()
|
||||
fclose(file);
|
||||
}
|
||||
free(m_pDemoBuffer);
|
||||
m_pDemoBuffer = NULL;
|
||||
m_pDemoBuffer = nullptr;
|
||||
}
|
||||
|
||||
m_bDemoRec = false;
|
||||
@ -4351,18 +4351,18 @@ void CEvent::DemoRecStop()
|
||||
bool CEvent::DemoPlayStart()
|
||||
{
|
||||
char filename[MAX_PATH];
|
||||
FILE* file = NULL;
|
||||
FILE* file = nullptr;
|
||||
DemoHeader header;
|
||||
int world, time, total;
|
||||
size_t nb;
|
||||
|
||||
m_pDemoBuffer = (DemoEvent*)malloc(MAXDEMO*sizeof(DemoEvent));
|
||||
if ( m_pDemoBuffer == NULL ) return false;
|
||||
if ( m_pDemoBuffer == nullptr ) return false;
|
||||
memset(m_pDemoBuffer, 0, MAXDEMO*sizeof(DemoEvent));
|
||||
|
||||
sprintf(filename, "data\\demo%.3d.blp", m_demoNumber);
|
||||
file = fopen(filename, "rb");
|
||||
if ( file == NULL )
|
||||
if ( file == nullptr )
|
||||
{
|
||||
DemoPlayStop();
|
||||
return false;
|
||||
@ -4403,10 +4403,10 @@ bool CEvent::DemoPlayStart()
|
||||
|
||||
void CEvent::DemoPlayStop()
|
||||
{
|
||||
if ( m_pDemoBuffer != NULL )
|
||||
if ( m_pDemoBuffer != nullptr )
|
||||
{
|
||||
free(m_pDemoBuffer);
|
||||
m_pDemoBuffer = NULL;
|
||||
m_pDemoBuffer = nullptr;
|
||||
}
|
||||
m_bDemoPlay = false;
|
||||
m_bDemoRec = false;
|
||||
@ -4526,7 +4526,7 @@ void CEvent::DemoStep()
|
||||
}
|
||||
|
||||
if ( m_bDemoPlay && // démo en lecture ?
|
||||
m_pDemoBuffer != NULL )
|
||||
m_pDemoBuffer != nullptr )
|
||||
{
|
||||
while ( true )
|
||||
{
|
||||
@ -4568,7 +4568,7 @@ void CEvent::DemoStep()
|
||||
|
||||
void CEvent::DemoRecEvent(UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
if ( m_bDemoRec && m_pDemoBuffer != NULL &&
|
||||
if ( m_bDemoRec && m_pDemoBuffer != nullptr &&
|
||||
(message == WM_KEYDOWN ||
|
||||
message == WM_KEYUP ||
|
||||
message == WM_LBUTTONDOWN ||
|
||||
|
4
menu.cpp
4
menu.cpp
@ -223,7 +223,7 @@ void CMenu::Draw()
|
||||
{
|
||||
LoadString(m_errors[i], text, 50);
|
||||
pText = strchr(text, '\n');
|
||||
if ( pText != NULL ) *pText = 0;
|
||||
if ( pText != nullptr ) *pText = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -261,7 +261,7 @@ void CMenu::Draw()
|
||||
{
|
||||
LoadString(m_errors[i], text, 50);
|
||||
pText = strchr(text, '\n');
|
||||
if ( pText != NULL ) strcpy(text, pText+1);
|
||||
if ( pText != nullptr ) strcpy(text, pText+1);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
4
misc.cpp
4
misc.cpp
@ -125,12 +125,12 @@ void AddUserPath(char *pFilename)
|
||||
strcpy(temp, "c:\\Planète Blupi\\");
|
||||
|
||||
att.nLength = sizeof(SECURITY_ATTRIBUTES);
|
||||
att.lpSecurityDescriptor = NULL;
|
||||
att.lpSecurityDescriptor = nullptr;
|
||||
att.bInheritHandle = false;
|
||||
CreateDirectory(temp, &att);
|
||||
|
||||
pText = strstr(pFilename, "\\");
|
||||
if ( pText != NULL )
|
||||
if ( pText != nullptr )
|
||||
{
|
||||
pos = strlen(temp)+(pText-pFilename)+1;
|
||||
strcat(temp, pFilename);
|
||||
|
@ -101,7 +101,7 @@ bool CMovie::fileOpenMovie(RECT rect, char *pFilename)
|
||||
{
|
||||
// Create the player
|
||||
m_player = Kit_CreatePlayer (m_movie);
|
||||
if (m_player == NULL)
|
||||
if (m_player == nullptr)
|
||||
return false;
|
||||
|
||||
pinfo = new Kit_PlayerInfo;
|
||||
@ -123,7 +123,7 @@ bool CMovie::fileOpenMovie(RECT rect, char *pFilename)
|
||||
pinfo->video.width,
|
||||
pinfo->video.height
|
||||
);
|
||||
if (m_videoTex == NULL)
|
||||
if (m_videoTex == nullptr)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
@ -145,7 +145,7 @@ void CMovie::playMovie(int nDirection)
|
||||
m_fPlaying = !m_fPlaying; // swap the play flag
|
||||
|
||||
if( !nDirection )
|
||||
m_fPlaying = false; // wDirection == NULL means PAUSE
|
||||
m_fPlaying = false; // wDirection == nullptr means PAUSE
|
||||
|
||||
// play/pause the AVI movie
|
||||
if ( m_fPlaying )
|
||||
@ -223,7 +223,7 @@ bool CMovie::IsExist(char *pFilename)
|
||||
}
|
||||
|
||||
file = fopen(string, "rb");
|
||||
if ( file == NULL ) return false;
|
||||
if ( file == nullptr ) return false;
|
||||
|
||||
fclose(file);
|
||||
return true;
|
||||
|
22
pixmap.cpp
22
pixmap.cpp
@ -37,7 +37,7 @@ CPixmap::CPixmap()
|
||||
|
||||
for ( i=0 ; i<MAXIMAGE ; i++ )
|
||||
{
|
||||
m_lpSDLTexture[i] = NULL;
|
||||
m_lpSDLTexture[i] = nullptr;
|
||||
}
|
||||
|
||||
m_lpCurrentCursor = nullptr;
|
||||
@ -60,10 +60,10 @@ CPixmap::~CPixmap()
|
||||
|
||||
for ( i=0 ; i<MAXIMAGE ; i++ )
|
||||
{
|
||||
if ( m_lpSDLTexture[i] != NULL )
|
||||
if ( m_lpSDLTexture[i] != nullptr )
|
||||
{
|
||||
SDL_DestroyTexture (m_lpSDLTexture[i]);
|
||||
m_lpSDLTexture[i] = NULL;
|
||||
m_lpSDLTexture[i] = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -271,7 +271,7 @@ bool CPixmap::Cache(int channel, SDL_Surface *surface, POINT totalDim)
|
||||
|
||||
m_lpSDLTexture[channel] = SDL_CreateTextureFromSurface (g_renderer, surface);
|
||||
|
||||
if (m_lpSDLTexture[channel] == NULL )
|
||||
if (m_lpSDLTexture[channel] == nullptr )
|
||||
return false;
|
||||
|
||||
m_totalDim[channel] = totalDim;
|
||||
@ -302,7 +302,7 @@ bool CPixmap::IsIconPixel(int channel, int rank, POINT pos)
|
||||
int nbx, nby;
|
||||
|
||||
if ( channel < 0 || channel >= MAXIMAGE ) return false;
|
||||
if (m_lpSDLTexture[channel] == NULL ) return false;
|
||||
if (m_lpSDLTexture[channel] == nullptr ) return false;
|
||||
|
||||
if ( m_iconDim[channel].x == 0 ||
|
||||
m_iconDim[channel].y == 0 ) return false;
|
||||
@ -340,7 +340,7 @@ bool CPixmap::DrawIcon(int chDst, int channel, int rank, POINT pos, bool bMask)
|
||||
COLORREF oldColor1, oldColor2;
|
||||
|
||||
if ( channel < 0 || channel >= MAXIMAGE ) return false;
|
||||
if ( channel != CHMAP && m_lpSDLTexture[channel] == NULL ) return false;
|
||||
if ( channel != CHMAP && m_lpSDLTexture[channel] == nullptr ) return false;
|
||||
|
||||
if ( m_iconDim[channel].x == 0 ||
|
||||
m_iconDim[channel].y == 0 ) return false;
|
||||
@ -378,7 +378,7 @@ bool CPixmap::DrawIconDemi(int chDst, int channel, int rank, POINT pos, bool bMa
|
||||
COLORREF oldColor1, oldColor2;
|
||||
|
||||
if ( channel < 0 || channel >= MAXIMAGE ) return false;
|
||||
if (m_lpSDLTexture[channel] == NULL ) return false;
|
||||
if (m_lpSDLTexture[channel] == nullptr ) return false;
|
||||
|
||||
if ( m_iconDim[channel].x == 0 ||
|
||||
m_iconDim[channel].y == 0 ) return false;
|
||||
@ -411,7 +411,7 @@ bool CPixmap::DrawIconPart(int chDst, int channel, int rank, POINT pos,
|
||||
COLORREF oldColor1, oldColor2;
|
||||
|
||||
if ( channel < 0 || channel >= MAXIMAGE ) return false;
|
||||
if (m_lpSDLTexture[channel] == NULL ) return false;
|
||||
if (m_lpSDLTexture[channel] == nullptr ) return false;
|
||||
|
||||
if ( m_iconDim[channel].x == 0 ||
|
||||
m_iconDim[channel].y == 0 ) return false;
|
||||
@ -442,7 +442,7 @@ bool CPixmap::DrawPart(int chDst, int channel, POINT dest, RECT rect, bool bMask
|
||||
COLORREF oldColor1, oldColor2;
|
||||
|
||||
if ( channel < 0 || channel >= MAXIMAGE ) return false;
|
||||
if (m_lpSDLTexture[channel] == NULL ) return false;
|
||||
if (m_lpSDLTexture[channel] == nullptr ) return false;
|
||||
|
||||
oldColor1 = m_colorSurface[2*channel+0];
|
||||
oldColor2 = m_colorSurface[2*channel+1];
|
||||
@ -458,7 +458,7 @@ bool CPixmap::DrawImage(int chDst, int channel, RECT rect)
|
||||
int res;
|
||||
|
||||
if ( channel < 0 || channel >= MAXIMAGE ) return false;
|
||||
if (m_lpSDLTexture[channel] == NULL ) return false;
|
||||
if (m_lpSDLTexture[channel] == nullptr ) return false;
|
||||
|
||||
dst.x = rect.left;
|
||||
dst.y = rect.top;
|
||||
@ -488,7 +488,7 @@ bool CPixmap::BuildIconMask(int channelMask, int rankMask,
|
||||
int res;
|
||||
|
||||
if ( channel < 0 || channel >= MAXIMAGE ) return false;
|
||||
if (m_lpSDLTexture[channel] == NULL ) return false;
|
||||
if (m_lpSDLTexture[channel] == nullptr ) return false;
|
||||
|
||||
if ( m_iconDim[channel].x == 0 ||
|
||||
m_iconDim[channel].y == 0 ) return false;
|
||||
|
@ -212,7 +212,7 @@ bool CSound::PlayImage(int channel, POINT pos, int rank)
|
||||
if ( rank >= 0 && rank < MAXBLUPI )
|
||||
{
|
||||
stopCh = m_channelBlupi[rank];
|
||||
if ( stopCh >= 0 && m_lpSDL[stopCh] != NULL )
|
||||
if ( stopCh >= 0 && m_lpSDL[stopCh] != nullptr )
|
||||
Mix_FadeOutChannel (stopCh + 1, 500);
|
||||
|
||||
m_channelBlupi[rank] = channel;
|
||||
|
Loading…
x
Reference in New Issue
Block a user