Browse Source

Enable asserts in files that where cleaned

pull/704/head
Anders Jenbo 6 years ago
parent
commit
cc280eeba3
  1. 2
      Source/cursor.cpp
  2. 10
      Source/diablo.cpp
  3. 8
      Source/dx.cpp
  4. 4
      Source/effects.cpp
  5. 30
      Source/engine.cpp
  6. 2
      Source/error.cpp
  7. 2
      Source/gmenu.cpp

2
Source/cursor.cpp

@ -75,7 +75,7 @@ const int InvItemHeight[] = {
void InitCursor()
{
/// ASSERT: assert(! pCursCels);
assert(! pCursCels);
pCursCels = LoadFileInMem("Data\\Inv\\Objcurs.CEL", NULL);
ClearCursor();
}

10
Source/diablo.cpp

@ -858,7 +858,7 @@ BOOL LeftMouseCmd(BOOL bShift)
{
BOOL bNear;
/// ASSERT: assert(MouseY < 352); // PANEL_TOP
assert(MouseY < PANEL_TOP); // 352
if (leveltype == DTYPE_TOWN) {
if (pcursitem != -1 && pcurs == CURSOR_HAND)
@ -1023,7 +1023,7 @@ void diablo_hotkey_msg(DWORD dwMsg)
}
strcat(szFileName, "\\Diablo.ini");
/// ASSERT: assert(dwMsg < sizeof(spszMsgTbl) / sizeof(spszMsgTbl[0]));
assert(dwMsg < sizeof(spszMsgTbl) / sizeof(spszMsgTbl[0]));
GetPrivateProfileString("NetMsg", spszMsgHotKeyTbl[dwMsg], spszMsgTbl[dwMsg], szMsg, sizeof(szMsg), szFileName);
NetSendCmdString(-1, szMsg);
}
@ -1521,7 +1521,7 @@ void PressChar(int vkey)
void LoadLvlGFX()
{
/// ASSERT: assert(! pDungeonCels);
assert(! pDungeonCels);
switch (leveltype) {
case DTYPE_TOWN:
@ -1564,7 +1564,7 @@ void LoadLvlGFX()
void LoadAllGFX()
{
/// ASSERT: assert(! pSpeedCels);
assert(! pSpeedCels);
pSpeedCels = DiabloAllocPtr(0x100000);
IncProgress();
IncProgress();
@ -1756,7 +1756,7 @@ void LoadGameLevel(BOOL firstflag, int lvldir)
ResyncMPQuests();
#ifndef SPAWN
} else {
/// ASSERT: assert(! pSpeedCels);
assert(! pSpeedCels);
pSpeedCels = DiabloAllocPtr(0x100000);
LoadSetMap();
IncProgress();

8
Source/dx.cpp

@ -99,9 +99,9 @@ void dx_init(HWND hWnd)
BOOL bSuccess;
GUID *lpGUID;
/// ASSERT: assert(! gpBuffer);
/// ASSERT: assert(! sgdwLockCount);
/// ASSERT: assert(! sgpBackBuf);
assert(! gpBuffer);
assert(! sgdwLockCount);
assert(! sgpBackBuf);
SetFocus(hWnd);
ShowWindow(hWnd, SW_SHOWNORMAL);
@ -157,7 +157,7 @@ void dx_init(HWND hWnd)
GdiSetBatchLimit(1);
dx_create_back_buffer();
bSuccess = SDrawManualInitialize(hWnd, lpDDInterface, lpDDSPrimary, NULL, NULL, lpDDSBackBuf, lpDDPalette, NULL);
/// ASSERT: assert(bSuccess);
assert(bSuccess);
}
static void lock_buf_priv()

4
Source/effects.cpp

@ -1082,8 +1082,8 @@ void stream_play(TSFX *pSFX, int lVolume, int lPan)
{
BOOL success;
/// ASSERT: assert(pSFX);
/// ASSERT: assert(pSFX->bFlags & sfx_STREAM);
assert(pSFX);
assert(pSFX->bFlags & sfx_STREAM);
stream_stop();
lVolume += sound_get_or_set_sound_volume(1);
if (lVolume >= VOLUME_MIN) {

30
Source/engine.cpp

@ -2751,7 +2751,7 @@ void Cl2Draw(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSkip,
return;
pFrameTable = (DWORD *)pCelBuff;
/// ASSERT: assert(nCel <= (int) pFrameTable[0]);
assert(nCel <= (int)pFrameTable[0]);
pRLEBytes = &pCelBuff[pFrameTable[nCel]];
nDataStart = *(WORD *)&pRLEBytes[CelSkip];
if (!nDataStart)
@ -2942,12 +2942,12 @@ void Cl2DrawOutline(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int nWid
/// ASSERT: assert(pCelBuff != NULL);
if (pCelBuff == NULL)
return;
/// ASSERT: assert(nCel > 0);
assert(nCel > 0);
if (nCel <= 0)
return;
pFrameTable = (DWORD *)pCelBuff;
/// ASSERT: assert(nCel <= (int) pFrameTable[0]);
assert(nCel <= (int)pFrameTable[0]);
pRLEBytes = &pCelBuff[pFrameTable[nCel]];
nDataStart = *(WORD *)&pRLEBytes[CelSkip];
if (!nDataStart)
@ -3161,12 +3161,12 @@ void Cl2DrawLightTbl(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int C
/// ASSERT: assert(pCelBuff != NULL);
if (pCelBuff == NULL)
return;
/// ASSERT: assert(nCel > 0);
assert(nCel > 0);
if (nCel <= 0)
return;
pFrameTable = (DWORD *)pCelBuff;
/// ASSERT: assert(nCel <= (int) pFrameTable[0]);
assert(nCel <= (int)pFrameTable[0]);
pRLEBytes = &pCelBuff[pFrameTable[nCel]];
nDataStart = *(WORD *)&pRLEBytes[CelSkip];
if (!nDataStart)
@ -3377,12 +3377,12 @@ void Cl2DrawLight(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelS
/// ASSERT: assert(pCelBuff != NULL);
if (pCelBuff == NULL)
return;
/// ASSERT: assert(nCel > 0);
assert(nCel > 0);
if (nCel <= 0)
return;
pFrameTable = (DWORD *)pCelBuff;
/// ASSERT: assert(nCel <= (int) pFrameTable[0]);
assert(nCel <= (int)pFrameTable[0]);
pRLEBytes = &pCelBuff[pFrameTable[nCel]];
nDataStart = *(WORD *)&pRLEBytes[CelSkip];
if (!nDataStart)
@ -3427,12 +3427,12 @@ void Cl2DrawSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int CelSk
/// ASSERT: assert(pCelBuff != NULL);
if (pCelBuff == NULL)
return;
/// ASSERT: assert(nCel > 0);
assert(nCel > 0);
if (nCel <= 0)
return;
pFrameTable = (DWORD *)pCelBuff;
/// ASSERT: assert(nCel <= (int) pFrameTable[0]);
assert(nCel <= (int)pFrameTable[0]);
pRLEBytes = &pCelBuff[pFrameTable[nCel]];
nDataStart = *(WORD *)&pRLEBytes[CelSkip];
if (!nDataStart)
@ -3636,12 +3636,12 @@ void Cl2DrawOutlineSafe(char col, int sx, int sy, BYTE *pCelBuff, int nCel, int
/// ASSERT: assert(pCelBuff != NULL);
if (pCelBuff == NULL)
return;
/// ASSERT: assert(nCel > 0);
assert(nCel > 0);
if (nCel <= 0)
return;
pFrameTable = (DWORD *)pCelBuff;
/// ASSERT: assert(nCel <= (int) pFrameTable[0]);
assert(nCel <= (int)pFrameTable[0]);
pRLEBytes = &pCelBuff[pFrameTable[nCel]];
nDataStart = *(WORD *)&pRLEBytes[CelSkip];
if (!nDataStart)
@ -3868,12 +3868,12 @@ void Cl2DrawLightTblSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, i
/// ASSERT: assert(pCelBuff != NULL);
if (pCelBuff == NULL)
return;
/// ASSERT: assert(nCel > 0);
assert(nCel > 0);
if (nCel <= 0)
return;
pFrameTable = (DWORD *)pCelBuff;
/// ASSERT: assert(nCel <= (int) pFrameTable[0]);
assert(nCel <= (int)pFrameTable[0]);
pRLEBytes = &pCelBuff[pFrameTable[nCel]];
nDataStart = *(WORD *)&pRLEBytes[CelSkip];
if (!nDataStart)
@ -4097,12 +4097,12 @@ void Cl2DrawLightSafe(int sx, int sy, BYTE *pCelBuff, int nCel, int nWidth, int
/// ASSERT: assert(pCelBuff != NULL);
if (pCelBuff == NULL)
return;
/// ASSERT: assert(nCel > 0);
assert(nCel > 0);
if (nCel <= 0)
return;
pFrameTable = (DWORD *)pCelBuff;
/// ASSERT: assert(nCel <= (int) pFrameTable[0]);
assert(nCel <= (int)pFrameTable[0]);
pRLEBytes = &pCelBuff[pFrameTable[nCel]];
nDataStart = *(WORD *)&pRLEBytes[CelSkip];
if (!nDataStart)

2
Source/error.cpp

@ -109,7 +109,7 @@ void DrawDiabloMsg()
sy += 12;
}
/// ASSERT: assert(gpBuffer);
assert(gpBuffer);
#define TRANS_RECT_X (PANEL_LEFT + 104)
#define TRANS_RECT_Y (DIALOG_TOP - 8)

2
Source/gmenu.cpp

@ -384,7 +384,7 @@ void gmenu_slider_set(TMenuItem *pItem, int min, int max, int value)
{
int nSteps;
/// ASSERT: assertassert(pItem, "gmenu.cpp", 445);
assert(pItem);
nSteps = (int)(pItem->dwFlags & 0xFFF000) >> 12;
if (nSteps < 2)
nSteps = 2;

Loading…
Cancel
Save