Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 11 additions & 17 deletions TacticalAI/AIMain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -209,15 +209,15 @@ STR szAction[] = {
// sevenfm
UINT32 guiAIStartCounter = 0, guiAILastCounter = 0;
//UINT8 gubAISelectedSoldier = NOBODY;
BOOLEAN gfLogsEnabled = TRUE;
BOOLEAN gfLogsEnabled = FALSE;

void DebugAI( INT8 bMsgType, SOLDIERTYPE *pSoldier, STR szOutput, INT8 bAction )
{
FILE* DebugFile;
CHAR8 msg[1024];
CHAR8 buf[1024];

if (!gfLogsEnabled)
if (!gfLogsEnabled || pSoldier == nullptr)
return;

memset(buf, 0, 1024 * sizeof(char));
Expand All @@ -235,17 +235,14 @@ void DebugAI( INT8 bMsgType, SOLDIERTYPE *pSoldier, STR szOutput, INT8 bAction )

sprintf(msg, "");

if (pSoldier)
sprintf(buf, "[%d] (%d)", pSoldier->ubID, pSoldier->sGridNo);
strcat(msg, buf);

if (pSoldier->ubProfile != NO_PROFILE)
{
sprintf(buf, "[%d] (%d)", pSoldier->ubID, pSoldier->sGridNo);
wcstombs(buf, pSoldier->GetName(), 1024 - 1);
strcat(msg, " ");
strcat(msg, buf);

if (pSoldier->ubProfile != NO_PROFILE)
{
wcstombs(buf, pSoldier->GetName(), 1024 - 1);
strcat(msg, " ");
strcat(msg, buf);
}
}

strcat(msg, " ");
Expand All @@ -266,13 +263,10 @@ void DebugAI( INT8 bMsgType, SOLDIERTYPE *pSoldier, STR szOutput, INT8 bAction )
strcat(msg, " ");
strcat(msg, szAction[bAction]);

if (pSoldier)
{
sprintf(buf, " %d", pSoldier->aiData.usActionData);
strcat(msg, buf);
}
sprintf(buf, " %d", pSoldier->aiData.usActionData);
strcat(msg, buf);

if (pSoldier && pSoldier->aiData.bNextAction != AI_ACTION_NONE)
if (pSoldier->aiData.bNextAction != AI_ACTION_NONE)
{
strcat(msg, " ");
strcat(msg, szAction[pSoldier->aiData.bNextAction]);
Expand Down