Also check for DebugRec flag in #ifdef DEBUGREC_* blocks

stable-5.4
Martin Plicht 2013-05-25 23:01:41 +02:00
parent 524fe879aa
commit eaf93d6a0e
5 changed files with 63 additions and 42 deletions

View File

@ -404,13 +404,14 @@ bool C4Menu::AddItem(C4MenuItem *pNew, const char *szCaption, const char *szComm
C4ID idID, const char *szCommand2, bool fOwnValue, int32_t iValue, bool fIsSelectable)
{
#ifdef DEBUGREC_MENU
if (pObject)
{
C4RCMenuAdd rc = { pObject ? pObject->Number : -1, iCount, idID, fOwnValue, iValue, fIsSelectable };
AddDbgRec(RCT_MenuAdd, &rc, sizeof(C4RCMenuAdd));
if (szCommand) AddDbgRec(RCT_MenuAddC, szCommand, strlen(szCommand)+1);
if (szCommand2) AddDbgRec(RCT_MenuAddC, szCommand2, strlen(szCommand2)+1);
}
if (Config.General.DebugRec)
if (pObject)
{
C4RCMenuAdd rc = { pObject ? pObject->Number : -1, iCount, idID, fOwnValue, iValue, fIsSelectable };
AddDbgRec(RCT_MenuAdd, &rc, sizeof(C4RCMenuAdd));
if (szCommand) AddDbgRec(RCT_MenuAddC, szCommand, strlen(szCommand)+1);
if (szCommand2) AddDbgRec(RCT_MenuAddC, szCommand2, strlen(szCommand2)+1);
}
#endif
// Add it to the list
pClientWindow->AddElement(pNew);

View File

@ -38,6 +38,7 @@ static const C4Real WindDrift_Factor = itofix(1, 800);
void C4PXS::Execute()
{
#ifdef DEBUGREC_PXS
if (Config.General.DebugRec)
{
C4RCExecPXS rc;
rc.x=x; rc.y=y; rc.iMat=Mat;
@ -127,6 +128,7 @@ void C4PXS::Execute()
// No contact? Free movement
x=ctcox; y=ctcoy;
#ifdef DEBUGREC_PXS
if (Config.General.DebugRec)
{
C4RCExecPXS rc;
rc.x=x; rc.y=y; rc.iMat=Mat;
@ -140,10 +142,13 @@ void C4PXS::Execute()
void C4PXS::Deactivate()
{
#ifdef DEBUGREC_PXS
C4RCExecPXS rc;
rc.x=x; rc.y=y; rc.iMat=Mat;
rc.pos = 2;
AddDbgRec(RCT_ExecPXS, &rc, sizeof(rc));
if (Config.General.DebugRec)
{
C4RCExecPXS rc;
rc.x=x; rc.y=y; rc.iMat=Mat;
rc.pos = 2;
AddDbgRec(RCT_ExecPXS, &rc, sizeof(rc));
}
#endif
Mat=MNone;
::PXS.Delete(this);

View File

@ -839,8 +839,11 @@ void C4Object::SetOCF()
if ((Def->GrabPutGet & C4D_Grab_Put) || (Def->GrabPutGet & C4D_Grab_Get) || (OCF & OCF_Entrance))
OCF|=OCF_Container;
#ifdef DEBUGREC_OCF
C4RCOCF rc = { dwOCFOld, OCF, false };
AddDbgRec(RCT_OCF, &rc, sizeof(rc));
if (Config.General.DebugRec)
{
C4RCOCF rc = { dwOCFOld, OCF, false };
AddDbgRec(RCT_OCF, &rc, sizeof(rc));
}
#endif
}
@ -907,8 +910,11 @@ void C4Object::UpdateOCF()
if ((Def->GrabPutGet & C4D_Grab_Put) || (Def->GrabPutGet & C4D_Grab_Get) || (OCF & OCF_Entrance))
OCF|=OCF_Container;
#ifdef DEBUGREC_OCF
C4RCOCF rc = { dwOCFOld, OCF, true };
AddDbgRec(RCT_OCF, &rc, sizeof(rc));
if (Config.General.DebugRec)
{
C4RCOCF rc = { dwOCFOld, OCF, true };
AddDbgRec(RCT_OCF, &rc, sizeof(rc));
}
#endif
#ifdef _DEBUG
DEBUGREC_OFF

View File

@ -887,33 +887,36 @@ C4AulBCC *C4AulExec::Call(C4AulFunc *pFunc, C4Value *pReturn, C4Value *pPars, C4
throw new C4AulExecError("using removed object");
#ifdef DEBUGREC_SCRIPT
StdStrBuf sCallText;
if (pContext && pContext->GetObject())
sCallText.AppendFormat("Object(%d): ", pContext->GetObject()->Number);
sCallText.Append(pFunc->GetName());
sCallText.AppendChar('(');
for (int i=0; i<C4AUL_MAX_Par; ++i)
if (Config.General.DebugRec)
{
if (i) sCallText.AppendChar(',');
C4Value &rV = pPars[i];
if (rV.GetType() == C4V_String)
StdStrBuf sCallText;
if (pContext && pContext->GetObject())
sCallText.AppendFormat("Object(%d): ", pContext->GetObject()->Number);
sCallText.Append(pFunc->GetName());
sCallText.AppendChar('(');
for (int i=0; i<C4AUL_MAX_Par; ++i)
{
C4String *s = rV.getStr();
if (!s)
sCallText.Append("(Snull)");
else
if (i) sCallText.AppendChar(',');
C4Value &rV = pPars[i];
if (rV.GetType() == C4V_String)
{
sCallText.Append("\"");
sCallText.Append(s->GetData());
sCallText.Append("\"");
C4String *s = rV.getStr();
if (!s)
sCallText.Append("(Snull)");
else
{
sCallText.Append("\"");
sCallText.Append(s->GetData());
sCallText.Append("\"");
}
}
else
sCallText.Append(rV.GetDataString());
}
else
sCallText.Append(rV.GetDataString());
sCallText.AppendChar(')');
sCallText.AppendChar(';');
AddDbgRec(RCT_AulFunc, sCallText.getData(), sCallText.getLength()+1);
}
sCallText.AppendChar(')');
sCallText.AppendChar(';');
AddDbgRec(RCT_AulFunc, sCallText.getData(), sCallText.getLength()+1);
#endif
// Execute
@ -1076,9 +1079,12 @@ C4Value C4AulScriptFunc::Exec(C4PropList * p, C4Value pPars[], bool fPassErrors)
C4Value C4AulScript::DirectExec(C4Object *pObj, const char *szScript, const char *szContext, bool fPassErrors, C4AulScriptContext* context)
{
#ifdef DEBUGREC_SCRIPT
AddDbgRec(RCT_DirectExec, szScript, strlen(szScript)+1);
int32_t iObjNumber = pObj ? pObj->Number : -1;
AddDbgRec(RCT_DirectExec, &iObjNumber, sizeof(int32_t));
if (Config.General.DebugRec)
{
AddDbgRec(RCT_DirectExec, szScript, strlen(szScript)+1);
int32_t iObjNumber = pObj ? pObj->Number : -1;
AddDbgRec(RCT_DirectExec, &iObjNumber, sizeof(int32_t));
}
#endif
// profiler
AulExec.StartDirectExec();

View File

@ -607,9 +607,12 @@ void C4PropList::SetPropertyByS(C4String * k, const C4Value & to)
//C4Property p(k, to);
//Properties.Add(p);
#ifdef DEBUGREC_SCRIPT
// deactivate this debugrec for now, because property orders seem to be out of sync
// after loading at the moment. might need to invastigate the cause later...
//if (k->GetCStr()) AddDbgRec(RCT_SetProperty, k->GetCStr(), strlen(k->GetCStr())+1);
if (Config.General.DebugRec)
{
// deactivate this debugrec for now, because property orders seem to be out of sync
// after loading at the moment. might need to invastigate the cause later...
//if (k->GetCStr()) AddDbgRec(RCT_SetProperty, k->GetCStr(), strlen(k->GetCStr())+1);
}
#endif
Properties.Add(C4Property(k, to));
}