Changed to Assert
This commit is contained in:
parent
a10e66e23f
commit
7bff651546
5 changed files with 50 additions and 50 deletions
|
@ -110,7 +110,7 @@ int AddButton(int pos, int level, const char* icon_ident,
|
|||
ButtonAction* ba;
|
||||
|
||||
ba = (ButtonAction*)malloc(sizeof(ButtonAction));
|
||||
DebugCheck(!ba); //FIXME: perhaps should return error?
|
||||
Assert(ba); //FIXME: perhaps should return error?
|
||||
|
||||
ba->Pos = pos;
|
||||
ba->Level = level;
|
||||
|
@ -126,7 +126,7 @@ int AddButton(int pos, int level, const char* icon_ident,
|
|||
#ifdef DEBUG
|
||||
if (ba->Value < 0) {
|
||||
DebugLevel0("Spell %s does not exist?\n" _C_ value);
|
||||
DebugCheck(ba->Value < 0);
|
||||
Assert(ba->Value >= 0);
|
||||
}
|
||||
#endif
|
||||
break;
|
||||
|
@ -169,7 +169,7 @@ int AddButton(int pos, int level, const char* icon_ident,
|
|||
ba->UnitMask = strdup(buf);
|
||||
UnitButtonTable[NumUnitButtons++] = ba;
|
||||
// FIXME: check if already initited
|
||||
//DebugCheck(ba->Icon.Icon == NoIcon);// just checks, that's why at the end
|
||||
//Assert(ba->Icon.Icon != NoIcon);// just checks, that's why at the end
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -185,7 +185,7 @@ global void CleanButtons(void)
|
|||
// Free the allocated buttons.
|
||||
//
|
||||
for (z = 0; z < NumUnitButtons; ++z) {
|
||||
DebugCheck(!UnitButtonTable[z]);
|
||||
Assert(UnitButtonTable[z]);
|
||||
if (UnitButtonTable[z]->Icon.Name) {
|
||||
free(UnitButtonTable[z]->Icon.Name);
|
||||
}
|
||||
|
@ -322,7 +322,7 @@ global void DrawButtonPanel(void)
|
|||
break;
|
||||
case ButtonSpellCast:
|
||||
for (j = 0; j < NumSelected; ++j) {
|
||||
DebugCheck(!Selected[j]->AutoCastSpell);
|
||||
Assert(Selected[j]->AutoCastSpell);
|
||||
if (Selected[j]->AutoCastSpell[buttons[i].Value] != 1) {
|
||||
break;
|
||||
}
|
||||
|
@ -539,7 +539,7 @@ global void UpdateButtonPanel(void)
|
|||
|
||||
unit = Selected[0];
|
||||
player = unit->Player;
|
||||
DebugCheck(unit == NoUnitP);
|
||||
Assert(unit != NoUnitP);
|
||||
|
||||
if (unit->Player != ThisPlayer &&
|
||||
!PlayersTeamed(ThisPlayer->Player, player->Player)) { // foreign unit
|
||||
|
@ -803,8 +803,8 @@ global void DoButtonButtonClicked(int button)
|
|||
break;
|
||||
|
||||
case ButtonCancelTrain:
|
||||
DebugCheck(Selected[0]->Orders[0].Action != UnitActionTrain ||
|
||||
!Selected[0]->Data.Train.Count);
|
||||
Assert(Selected[0]->Orders[0].Action == UnitActionTrain &&
|
||||
Selected[0]->Data.Train.Count);
|
||||
SendCommandCancelTraining(Selected[0], -1, NULL);
|
||||
ClearStatusLine();
|
||||
ClearCosts();
|
||||
|
|
|
@ -173,7 +173,7 @@ global void InitIcons(void)
|
|||
Icon* id;
|
||||
|
||||
id = IconByIdent(IconAliases[i * 2 + 1]);
|
||||
DebugCheck(id == NoIcon);
|
||||
Assert(id != NoIcon);
|
||||
|
||||
*(Icon**)hash_add(IconHash, IconAliases[i * 2 + 0]) = id;
|
||||
}
|
||||
|
@ -331,7 +331,7 @@ global Icon* IconByIdent(const char* ident)
|
|||
*/
|
||||
global const char* IdentOfIcon(const Icon* icon)
|
||||
{
|
||||
DebugCheck(!icon);
|
||||
Assert(icon);
|
||||
|
||||
return icon->Ident;
|
||||
}
|
||||
|
@ -366,7 +366,7 @@ global void DrawUnitIcon(const Player* player, Icon* icon, unsigned flags,
|
|||
int width;
|
||||
int height;
|
||||
|
||||
DebugCheck(!icon);
|
||||
Assert(icon);
|
||||
|
||||
width = icon->Width;
|
||||
height = icon->Height;
|
||||
|
@ -461,7 +461,7 @@ local int CclDefineIcon(lua_State* l)
|
|||
lua_pop(l, 1);
|
||||
}
|
||||
|
||||
DebugCheck(!ident || !filename || !width || !height);
|
||||
Assert(ident && filename && width && height);
|
||||
|
||||
AddIcon(ident, tileset, index, width, height, filename);
|
||||
|
||||
|
|
|
@ -288,7 +288,7 @@ local void DrawUnitInfo(const Unit* unit)
|
|||
const char* s;
|
||||
|
||||
s = strchr(type->Name, ' ');
|
||||
DebugCheck(!s);
|
||||
Assert(s);
|
||||
i = s-type->Name;
|
||||
memcpy(buf, type->Name, i);
|
||||
buf[i] = '\0';
|
||||
|
|
|
@ -1025,7 +1025,7 @@ local void SaveGameLBAction(Menuitem *mi, int i)
|
|||
{
|
||||
FileList *fl;
|
||||
|
||||
DebugCheck(i<0);
|
||||
Assert(i >= 0);
|
||||
if (i < mi->d.listbox.noptions) {
|
||||
fl = mi->d.listbox.options;
|
||||
if (mi->d.listbox.noptions > mi->d.listbox.nlines) {
|
||||
|
@ -1126,9 +1126,9 @@ local void SaveGameVSAction(Menuitem *mi, int i)
|
|||
}
|
||||
}
|
||||
|
||||
DebugCheck(mi->d.listbox.startline < 0);
|
||||
DebugCheck(mi->d.listbox.noptions > 0 &&
|
||||
mi->d.listbox.startline+mi->d.listbox.curopt >= mi->d.listbox.noptions);
|
||||
Assert(mi->d.listbox.startline >= 0);
|
||||
Assert(mi->d.listbox.noptions <= 0 ||
|
||||
mi->d.listbox.startline+mi->d.listbox.curopt < mi->d.listbox.noptions);
|
||||
|
||||
SaveGameLBAction(mi, mi->d.listbox.curopt + mi->d.listbox.startline);
|
||||
}
|
||||
|
@ -1269,7 +1269,7 @@ local void LoadGameLBAction(Menuitem *mi, int i)
|
|||
{
|
||||
FileList *fl;
|
||||
|
||||
DebugCheck(i<0);
|
||||
Assert(i >= 0);
|
||||
if (i < mi->d.listbox.noptions) {
|
||||
fl = mi->d.listbox.options;
|
||||
if (mi->d.listbox.noptions > mi->d.listbox.nlines) {
|
||||
|
@ -1368,9 +1368,9 @@ local void LoadGameVSAction(Menuitem *mi, int i)
|
|||
}
|
||||
}
|
||||
|
||||
DebugCheck(mi->d.listbox.startline < 0);
|
||||
DebugCheck(mi->d.listbox.noptions > 0 &&
|
||||
mi->d.listbox.startline+mi->d.listbox.curopt >= mi->d.listbox.noptions);
|
||||
Assert(mi->d.listbox.startline >= 0);
|
||||
Assert(mi->d.listbox.noptions <= 0 ||
|
||||
mi->d.listbox.startline+mi->d.listbox.curopt < mi->d.listbox.noptions);
|
||||
|
||||
LoadGameLBAction(mi, mi->d.listbox.curopt + mi->d.listbox.startline);
|
||||
}
|
||||
|
@ -3242,7 +3242,7 @@ local void FreeMapInfos(FileList *fl, int n)
|
|||
*/
|
||||
local void ScenSelectInit(Menuitem *mi)
|
||||
{
|
||||
DebugCheck(!*ScenSelectPath);
|
||||
Assert(*ScenSelectPath);
|
||||
mi->menu->Items[9].flags =
|
||||
*ScenSelectDisplayPath ? 0 : MenuButtonDisabled;
|
||||
mi->menu->Items[9].d.button.text = ScenSelectDisplayPath;
|
||||
|
@ -3256,7 +3256,7 @@ local void ScenSelectLBAction(Menuitem *mi, int i)
|
|||
{
|
||||
FileList *fl;
|
||||
|
||||
DebugCheck( i < 0);
|
||||
Assert(i >= 0);
|
||||
if (i < mi->d.listbox.noptions) {
|
||||
fl = mi->d.listbox.options;
|
||||
free(mi->menu->Items[3].d.button.text);
|
||||
|
@ -3546,9 +3546,9 @@ local void ScenSelectVSAction(Menuitem *mi, int i)
|
|||
}
|
||||
}
|
||||
|
||||
DebugCheck(mi->d.listbox.startline < 0);
|
||||
DebugCheck(mi->d.listbox.noptions > 0 &&
|
||||
mi->d.listbox.startline + mi->d.listbox.curopt >= mi->d.listbox.noptions);
|
||||
Assert(mi->d.listbox.startline >= 0);
|
||||
Assert(mi->d.listbox.noptions <= 0 ||
|
||||
mi->d.listbox.startline + mi->d.listbox.curopt < mi->d.listbox.noptions);
|
||||
|
||||
ScenSelectLBAction(mi, mi->d.listbox.curopt + mi->d.listbox.startline);
|
||||
}
|
||||
|
@ -4071,7 +4071,7 @@ local void MultiGamePTSAction(Menuitem *mi, int o)
|
|||
i = mi - menu->Items - SERVER_PLAYER_STATE;
|
||||
// JOHNS: Must this be always true?
|
||||
// ARI: NO! think of client menus!
|
||||
// DebugCheck( i<0 || i>PlayerMax-1 );
|
||||
// Assert(i >= 0 && i <= PlayerMax - 1);
|
||||
|
||||
if (i > 0 && i < PlayerMax-1) {
|
||||
if (mi->d.pulldown.curopt == o) {
|
||||
|
@ -4118,7 +4118,7 @@ local void NetworkGamePrepareGameSettings(void)
|
|||
int x;
|
||||
int v;
|
||||
|
||||
DebugCheck(!MenuMapInfo);
|
||||
Assert(MenuMapInfo);
|
||||
|
||||
DebugLevel0Fn("NetPlayers = %d\n" _C_ NetPlayers);
|
||||
|
||||
|
@ -4191,7 +4191,7 @@ local void NetworkGamePrepareGameSettings(void)
|
|||
|
||||
#ifdef DEBUG
|
||||
for (i = 0; i < NetPlayers; i++) {
|
||||
DebugCheck(GameSettings.Presets[Hosts[i].PlyNr].Type != PlayerPerson);
|
||||
Assert(GameSettings.Presets[Hosts[i].PlyNr].Type == PlayerPerson);
|
||||
;
|
||||
}
|
||||
#endif
|
||||
|
@ -4993,7 +4993,7 @@ local void EditorMainLoadMap(void)
|
|||
*/
|
||||
local void EditorMainLoadInit(Menuitem *mi)
|
||||
{
|
||||
DebugCheck(!*ScenSelectPath);
|
||||
Assert(*ScenSelectPath);
|
||||
mi->menu->Items[5].flags =
|
||||
*ScenSelectDisplayPath ? 0 : MenuButtonDisabled;
|
||||
mi->menu->Items[5].d.button.text = ScenSelectDisplayPath;
|
||||
|
@ -5269,7 +5269,7 @@ local void EditorMainLoadLBAction(Menuitem *mi, int i)
|
|||
{
|
||||
FileList *fl;
|
||||
|
||||
DebugCheck(i<0);
|
||||
Assert(i >= 0);
|
||||
if (i < mi->d.listbox.noptions) {
|
||||
fl = mi->d.listbox.options;
|
||||
free(mi->menu->Items[3].d.button.text);
|
||||
|
@ -5363,9 +5363,9 @@ local void EditorMainLoadVSAction(Menuitem *mi, int i)
|
|||
}
|
||||
}
|
||||
|
||||
DebugCheck(mi->d.listbox.startline < 0);
|
||||
DebugCheck(mi->d.listbox.noptions > 0 &&
|
||||
mi->d.listbox.startline+mi->d.listbox.curopt >= mi->d.listbox.noptions);
|
||||
Assert(mi->d.listbox.startline >= 0);
|
||||
Assert(mi->d.listbox.noptions <= 0 ||
|
||||
mi->d.listbox.startline+mi->d.listbox.curopt < mi->d.listbox.noptions);
|
||||
|
||||
EditorMainLoadLBAction(mi, mi->d.listbox.curopt + mi->d.listbox.startline);
|
||||
}
|
||||
|
@ -5853,7 +5853,7 @@ global int EditorSaveMenu(void)
|
|||
menu->Items[3].d.input.buffer = path;
|
||||
menu->Items[3].d.input.maxch = PATH_MAX - 4;
|
||||
|
||||
DebugCheck(!*ScenSelectPath);
|
||||
Assert(*ScenSelectPath);
|
||||
menu->Items[6].flags =
|
||||
*ScenSelectDisplayPath ? 0 : MenuButtonDisabled;
|
||||
menu->Items[6].d.button.text = ScenSelectDisplayPath;
|
||||
|
@ -6089,7 +6089,7 @@ local void EditorSaveLBAction(Menuitem *mi, int i)
|
|||
{
|
||||
FileList *fl;
|
||||
|
||||
DebugCheck(i<0);
|
||||
Assert(i >= 0);
|
||||
if (i < mi->d.listbox.noptions) {
|
||||
fl = mi->d.listbox.options;
|
||||
free(mi->menu->Items[4].d.button.text);
|
||||
|
@ -6184,9 +6184,9 @@ local void EditorSaveVSAction(Menuitem *mi, int i)
|
|||
}
|
||||
}
|
||||
|
||||
DebugCheck(mi->d.listbox.startline < 0);
|
||||
DebugCheck(mi->d.listbox.noptions > 0 &&
|
||||
mi->d.listbox.startline + mi->d.listbox.curopt >= mi->d.listbox.noptions);
|
||||
Assert(mi->d.listbox.startline >= 0);
|
||||
Assert(mi->d.listbox.noptions <= 0 ||
|
||||
mi->d.listbox.startline + mi->d.listbox.curopt < mi->d.listbox.noptions);
|
||||
|
||||
EditorSaveLBAction(mi, mi->d.listbox.curopt + mi->d.listbox.startline);
|
||||
}
|
||||
|
@ -6308,7 +6308,7 @@ local void ReplayGameMenu(void)
|
|||
*/
|
||||
local void ReplayGameInit(Menuitem *mi)
|
||||
{
|
||||
DebugCheck(!*ScenSelectPath);
|
||||
Assert(*ScenSelectPath);
|
||||
mi->menu->Items[5].flags =
|
||||
*ScenSelectDisplayPath ? 0 : MenuButtonDisabled;
|
||||
mi->menu->Items[5].d.button.text = ScenSelectDisplayPath;
|
||||
|
@ -6412,7 +6412,7 @@ local void ReplayGameLBAction(Menuitem *mi, int i)
|
|||
{
|
||||
FileList *fl;
|
||||
|
||||
DebugCheck(i<0);
|
||||
Assert(i >= 0);
|
||||
if (i < mi->d.listbox.noptions) {
|
||||
fl = mi->d.listbox.options;
|
||||
free(mi->menu->Items[3].d.button.text);
|
||||
|
@ -6528,9 +6528,9 @@ local void ReplayGameVSAction(Menuitem *mi, int i)
|
|||
}
|
||||
}
|
||||
|
||||
DebugCheck(mi->d.listbox.startline < 0);
|
||||
DebugCheck(mi->d.listbox.noptions > 0 &&
|
||||
mi->d.listbox.startline + mi->d.listbox.curopt >= mi->d.listbox.noptions);
|
||||
Assert(mi->d.listbox.startline >= 0);
|
||||
Assert(mi->d.listbox.noptions <= 0 ||
|
||||
mi->d.listbox.startline + mi->d.listbox.curopt < mi->d.listbox.noptions);
|
||||
|
||||
ReplayGameLBAction(mi, mi->d.listbox.curopt + mi->d.listbox.startline);
|
||||
}
|
||||
|
|
|
@ -166,7 +166,7 @@ global void DoRightButton(int sx, int sy)
|
|||
if (unit == desttransporter) {
|
||||
continue;
|
||||
}
|
||||
DebugCheck(!unit);
|
||||
Assert(unit);
|
||||
if (!acknowledged) {
|
||||
PlayUnitSound(unit, VoiceAcknowledging);
|
||||
acknowledged = 1;
|
||||
|
@ -276,10 +276,10 @@ global void DoRightButton(int sx, int sy)
|
|||
dest->Blink = 4;
|
||||
if (action == MouseActionSpellCast) {
|
||||
// This is for demolition squads and such
|
||||
DebugCheck(!unit->Type->CanCastSpell);
|
||||
Assert(unit->Type->CanCastSpell);
|
||||
for (spellnum = 0; !unit->Type->CanCastSpell[spellnum] &&
|
||||
spellnum < SpellTypeCount ; spellnum++) ;
|
||||
DebugCheck(spellnum == SpellTypeCount);
|
||||
Assert(spellnum != SpellTypeCount);
|
||||
SendCommandSpellCast(unit, x, y, dest, spellnum, flush);
|
||||
} else {
|
||||
if (CanTarget(unit->Type, dest->Type)) {
|
||||
|
@ -552,7 +552,7 @@ local void HandleMouseOn(int x, int y)
|
|||
|
||||
DebugLevel3Fn("viewport %d, %d\n" _C_ x _C_ y);
|
||||
vp = GetViewport(x, y);
|
||||
DebugCheck(!vp);
|
||||
Assert(vp);
|
||||
if (TheUI.MouseViewport != vp) { // viewport changed
|
||||
TheUI.MouseViewport = vp;
|
||||
DebugLevel0Fn("current viewport changed to %d.\n" _C_
|
||||
|
@ -1391,7 +1391,7 @@ global void UIHandleButtonDown(unsigned button)
|
|||
// Cursor is on the map area
|
||||
//
|
||||
if (CursorOn == CursorOnMap) {
|
||||
DebugCheck(!TheUI.MouseViewport);
|
||||
Assert(TheUI.MouseViewport);
|
||||
|
||||
if ((MouseButtons & LeftButton) &&
|
||||
TheUI.SelectedViewport != TheUI.MouseViewport) {
|
||||
|
@ -1599,7 +1599,7 @@ global void UIHandleButtonDown(unsigned button)
|
|||
--i;
|
||||
}
|
||||
}
|
||||
DebugCheck(!uins->Boarded);
|
||||
Assert(uins->Boarded);
|
||||
SendCommandUnload(Selected[0],
|
||||
Selected[0]->X, Selected[0]->Y, uins,
|
||||
!(KeyModifiers & ModifierShift));
|
||||
|
|
Loading…
Add table
Reference in a new issue