// ***************************************************************************
// Function: Continue
// Description: Our '/continue' command
// Usage: /continue
// ***************************************************************************
VOID Continue(PSPAWNINFO pChar, PCHAR szLine)
{
int extraFors = 0;
if (!gMacroBlock)
{
MacroError("Can only use /continue during a macro.");
return;
}
while (bRunNextCommand == TRUE) //FIX?
{
if (!strnicmp(gMacroBlock->Line,"Sub ",4) || (!gMacroBlock->pNext))
{
FatalError("/continue without matching /for ... /next block");
return;
}
if (!strnicmp(gMacroBlock->Line,"/for",4)) {
extraFors++;
} else if (!strnicmp(gMacroBlock->Line,"/next",5)) {
if (extraFors)
extraFors--;
else
{
gMacroBlock = gMacroBlock->pPrev;
break;
}
}
gMacroBlock = gMacroBlock->pNext;
}
}
// ***************************************************************************
// Function: Break
// Description: Our '/break' command
// Usage: /break
// ***************************************************************************
VOID Break(PSPAWNINFO pChar, PCHAR szLine)
{
int extraFors = 0;
if (!gMacroBlock)
{
MacroError("Can only use /break during a macro.");
return;
}
while (bRunNextCommand == TRUE) //FIX?
{
if (!strnicmp(gMacroBlock->Line,"Sub ",4) || (!gMacroBlock->pNext))
{
FatalError("/break without matching /for ... /next block");
return;
}
if (!strnicmp(gMacroBlock->Line,"/for",4)) {
extraFors++;
} else if (!strnicmp(gMacroBlock->Line,"/next",5)) {
if (extraFors)
extraFors--;
else
break;
}
gMacroBlock = gMacroBlock->pNext;
}
}