SAGA2: Add debug output to path.cpp

This commit is contained in:
a/ 2021-06-23 21:57:38 +09:00 committed by Eugene Sandulenko
parent 8bf479ba43
commit 8940f362a2
No known key found for this signature in database
GPG key ID: 014D387312D34F08
3 changed files with 12 additions and 2 deletions

View file

@ -36,6 +36,7 @@ static const DebugChannelDef debugFlagList[] = {
{Saga2::kDebugPalettes, "palettes", "Debug the palettes"},
{Saga2::kDebugLoading, "loading", "Debug the loading"},
{Saga2::kDebugTimers, "timers", "Debug the timers"},
{Saga2::kDebugPath, "path", "Debug the pathfinding"},
DEBUG_CHANNEL_END
};

View file

@ -1602,6 +1602,8 @@ void PathRequest::finish(void) {
static TilePoint tempResult[32];
debugC(2, kDebugPath, "Finishing Path Request: %p", (void *)this);
if (bestLoc != Nowhere) {
cell = cellArray->getCell(bestPlatform, bestLoc.u, bestLoc.v);
assert(cell != nullptr);
@ -1672,6 +1674,8 @@ void PathRequest::finish(void) {
}
void PathRequest::abortReq(void) {
debugC(4, kDebugPath, "Aborting Path Request: %p", (void *)this);
if (mTask->pathFindTask == this)
mTask->pathFindTask = nullptr;
}
@ -1680,12 +1684,14 @@ void PathRequest::abortReq(void) {
PathResult PathRequest::findPath(void) {
assert(cellArray != nullptr);
static const uint8 costTable[] = { 4, 10, 12, 16, 12, 10, 4, 0, 4, 10, 12, 16, 12, 10, 4, 0 };
static const uint8 costTable[] = {4, 10, 12, 16, 12, 10, 4, 0, 4, 10, 12, 16, 12, 10, 4, 0};
ProtoObj *proto = actor->proto();
QueueItem qi;
uint8 pCross = proto->crossSection;
debugC(4, kDebugPath, "Finding Path for %p: pCross = %d", (void *)this, pCross);
if (flags & aborted) return pathAborted;
int32 lastTick_ = gameTime;
@ -2062,6 +2068,8 @@ DestinationPathRequest::DestinationPathRequest(Actor *a, int16 howSmart) :
// Initialize the static data members
void DestinationPathRequest::initialize(void) {
debugC(2, kDebugPath, "Initializing Path Request: %p", (void *)this);
PathRequest::initialize();
// Initialize bestDist to the highest possible value.

View file

@ -51,7 +51,8 @@ enum {
kDebugTiles = 1 << 5,
kDebugPalettes = 1 << 6,
kDebugLoading = 1 << 7,
kDebugTimers = 1 << 8
kDebugTimers = 1 << 8,
kDebugPath = 1 << 9
};
#define TICKSPERSECOND (728L/10L)