From 920b6759e6b9c7a1ba4ff144f7e7206f2ad85e29 Mon Sep 17 00:00:00 2001 From: jsalmon3 <> Date: Tue, 23 Jul 2002 15:46:35 +0000 Subject: [PATCH] DebugLevel uses _C_ instead of comma --- src/action/actions.cpp | 8 +- src/ai/ai.cpp | 2 +- src/ai/old_ai.cpp | 128 +++++++++++++++---------------- src/map/map_draw.cpp | 4 +- src/map/map_fog.cpp | 2 +- src/network/netconnect.cpp | 2 +- src/network/network.cpp | 2 +- src/pathfinder/region.cpp | 4 +- src/pathfinder/region_groups.cpp | 6 +- src/stratagus/missile.cpp | 6 +- src/unit/unit.cpp | 14 ++-- src/unit/unit_cache.cpp | 58 +++++++------- src/unit/unit_draw.cpp | 4 +- src/video/X11.cpp | 4 +- src/video/svgalib.cpp | 2 +- src/video/video.cpp | 2 +- src/video/wince.cpp | 4 +- 17 files changed, 126 insertions(+), 126 deletions(-) diff --git a/src/action/actions.cpp b/src/action/actions.cpp index 802cf0a38..44eb7cea0 100644 --- a/src/action/actions.cpp +++ b/src/action/actions.cpp @@ -365,18 +365,18 @@ global void UnitActions(void) if( !list && (!unit->Type->Vanishes && !unit->Orders[0].Action==UnitActionDie) ) { - DebugLevel0Fn("!removed not on map %d\n",UnitNumber(unit)); + DebugLevel0Fn("!removed not on map %d\n" _C_ UnitNumber(unit)); abort(); } } else if( list ) { - DebugLevel0Fn("remove on map %d\n",UnitNumber(unit)); + DebugLevel0Fn("remove on map %d\n" _C_ UnitNumber(unit)); abort(); } list=unit->Next; while( list ) { if( list->X!=unit->X || list->Y!=unit->Y ) { - DebugLevel0Fn("Wrong X,Y %d %d,%d\n",UnitNumber(list) - ,list->X,list->Y); + DebugLevel0Fn("Wrong X,Y %d %d,%d\n" _C_ UnitNumber(list) + _C_ list->X _C_ list->Y); abort(); } list=list->Next; diff --git a/src/ai/ai.cpp b/src/ai/ai.cpp index 2f473983e..0294a16d4 100644 --- a/src/ai/ai.cpp +++ b/src/ai/ai.cpp @@ -1389,7 +1389,7 @@ global void AiEachSecond(Player* player) ev=rdtsc(); sx=(ev-sv); mv=(mv+sx)/2; - DebugLevel1Fn("%ld %ld\n",sx/1000,mv/1000); + DebugLevel1Fn("%ld %ld\n" _C_ sx/1000 _C_ mv/1000); #endif } diff --git a/src/ai/old_ai.cpp b/src/ai/old_ai.cpp index 44b1af17f..6c398e6fc 100644 --- a/src/ai/old_ai.cpp +++ b/src/ai/old_ai.cpp @@ -370,15 +370,15 @@ local int AiNeedResources(const UnitType * type) player = AiPlayer->Player; if ((err = PlayerCheckUnitType(player, type))) { if (err & (1 << GoldCost)) { - DebugLevel3Fn("%d Need gold\n", AiPlayer->Player - Players); + DebugLevel3Fn("%d Need gold\n" _C_ AiPlayer->Player - Players); AiPlayer->NeedGold = 1; } if (err & (1 << WoodCost)) { - DebugLevel3Fn("%d Need wood\n", AiPlayer->Player - Players); + DebugLevel3Fn("%d Need wood\n" _C_ AiPlayer->Player - Players); AiPlayer->NeedWood = 1; } if (err & (1 << OilCost)) { - DebugLevel3Fn("%d Need oil\n", AiPlayer->Player - Players); + DebugLevel3Fn("%d Need oil\n" _C_ AiPlayer->Player - Players); AiPlayer->NeedOil = 1; } // FIXME: more resources!!! @@ -425,20 +425,20 @@ local int AiNearGoldmine(const Unit * goldmine, const Unit * worker, y = goldmine->Y; addx = goldmine->Type->TileWidth; addy = goldmine->Type->TileHeight; - DebugLevel3("%d,%d\n", type->TileWidth, type->TileHeight); + DebugLevel3("%d,%d\n" _C_ type->TileWidth _C_ type->TileHeight); x -= type->TileWidth; // this should correct it y -= type->TileHeight - 1; addx += type->TileWidth - 1; addy += type->TileHeight - 1; - DebugLevel3("XXXXX: %d,%d\n", addx, addy); + DebugLevel3("XXXXX: %d,%d\n" _C_ addx _C_ addy); cost = 99999; IfDebug( best_x = best_y = 0; ); // remove compiler warning for (;;) { // test rectangles around the mine for (i = addy; i--; y++) { - DebugLevel3("\t\tTest %3d,%3d\n", x, y); + DebugLevel3("\t\tTest %3d,%3d\n" _C_ x _C_ y); if (CanBuildUnitType(worker, type, x, y)) { d = MapDistanceToType(wx, wy, type, x, y); - DebugLevel3("\t\t%3d,%3d -> %3d,%3d = %3d\n", wx, wy, x, y, d); + DebugLevel3("\t\t%3d,%3d -> %3d,%3d = %3d\n" _C_ wx _C_ wy _C_ x _C_ y _C_ d); if (d < cost) { cost = d; best_x = x; @@ -448,10 +448,10 @@ local int AiNearGoldmine(const Unit * goldmine, const Unit * worker, } ++addx; for (i = addx; i--; x++) { - DebugLevel3("\t\tTest %3d,%3d\n", x, y); + DebugLevel3("\t\tTest %3d,%3d\n" _C_ x _C_ y); if (CanBuildUnitType(worker, type, x, y)) { d = MapDistanceToType(wx, wy, type, x, y); - DebugLevel3("\t\t%3d,%3d -> %3d,%3d = %3d\n", wx, wy, x, y, d); + DebugLevel3("\t\t%3d,%3d -> %3d,%3d = %3d\n" _C_ wx _C_ wy _C_ x _C_ y _C_ d); if (d < cost) { cost = d; best_x = x; @@ -461,10 +461,10 @@ local int AiNearGoldmine(const Unit * goldmine, const Unit * worker, } ++addy; for (i = addy; i--; y--) { - DebugLevel3("\t\tTest %3d,%3d\n", x, y); + DebugLevel3("\t\tTest %3d,%3d\n" _C_ x _C_ y); if (CanBuildUnitType(worker, type, x, y)) { d = MapDistanceToType(wx, wy, type, x, y); - DebugLevel3("\t\t%3d,%3d -> %3d,%3d = %3d\n", wx, wy, x, y, d); + DebugLevel3("\t\t%3d,%3d -> %3d,%3d = %3d\n" _C_ wx _C_ wy _C_ x _C_ y _C_ d); if (d < cost) { cost = d; best_x = x; @@ -474,10 +474,10 @@ local int AiNearGoldmine(const Unit * goldmine, const Unit * worker, } ++addx; for (i = addx; i--; x--) { - DebugLevel3("\t\tTest %3d,%3d\n", x, y); + DebugLevel3("\t\tTest %3d,%3d\n" _C_ x _C_ y); if (CanBuildUnitType(worker, type, x, y)) { d = MapDistanceToType(wx, wy, type, x, y); - DebugLevel3("\t\t%3d,%3d -> %3d,%3d = %3d\n", wx, wy, x, y, d); + DebugLevel3("\t\t%3d,%3d -> %3d,%3d = %3d\n" _C_ wx _C_ wy _C_ x _C_ y _C_ d); if (d < cost) { cost = d; best_x = x; @@ -486,7 +486,7 @@ local int AiNearGoldmine(const Unit * goldmine, const Unit * worker, } } if (cost != 99999) { - DebugLevel3("\tBuild at %d,%d\n", best_x, best_y); + DebugLevel3("\tBuild at %d,%d\n" _C_ best_x _C_ best_y); *dx = best_x; *dy = best_y; return 0; @@ -510,7 +510,7 @@ global int AiNearHall(const Unit * hall, const Unit * worker, int end, state, best_x, best_y, d, cost; Unit *goldmines[UnitMax]; - DebugLevel3Fn("hall %d %d,%d\n", UnitNumber(hall), hall->X, hall->Y); + DebugLevel3Fn("hall %d %d,%d\n" _C_ UnitNumber(hall) _C_ hall->X _C_ hall->Y); if (!hall) { // No hall take units place. DebugLevel3Fn("Called without hall\n"); @@ -520,7 +520,7 @@ global int AiNearHall(const Unit * hall, const Unit * worker, } num_goldmine = FindUnitsByType(UnitTypeGoldMine, goldmines); - DebugLevel3("\tGoldmines %d\n", num_goldmine); + DebugLevel3("\tGoldmines %d\n" _C_ num_goldmine); wx = worker->X; wy = worker->Y; x = hall->X; @@ -530,7 +530,7 @@ global int AiNearHall(const Unit * hall, const Unit * worker, cost = 99999; IfDebug(best_x = best_y = 0; ); // remove compiler warning - DebugLevel3("%d,%d\n", type->TileWidth, type->TileHeight); + DebugLevel3("%d,%d\n" _C_ type->TileWidth _C_ type->TileHeight); /// leave two fields free! #define SPACE 2 /// Space around buildings x -= type->TileWidth + SPACE; // this should correct it @@ -565,7 +565,7 @@ global int AiNearHall(const Unit * hall, const Unit * worker, state = 0; end = y + addy++; if (cost != 99999) { - DebugLevel3("\tBuild at %d,%d\n", best_x, best_y); + DebugLevel3("\tBuild at %d,%d\n" _C_ best_x _C_ best_y); *dx = best_x; *dy = best_y; return cost; @@ -575,10 +575,10 @@ global int AiNearHall(const Unit * hall, const Unit * worker, } // FIXME: this check outside the map could be speeded up. if (y < 0 || x < 0 || y >= TheMap.Height || x >= TheMap.Width) { - DebugLevel3("\t\tSkip %3d,%3d\n", x, y); + DebugLevel3("\t\tSkip %3d,%3d\n" _C_ x _C_ y); continue; } - DebugLevel3("\t\tTest %3d,%3d\n", x, y); + DebugLevel3("\t\tTest %3d,%3d\n" _C_ x _C_ y); if (CanBuildUnitType(worker, type, x, y)) { if (x == hall->X || y == hall->Y || x == hall->X + 1 || y == hall->Y + 1 || x == hall->X + 2 || y == hall->Y + 2 @@ -598,7 +598,7 @@ global int AiNearHall(const Unit * hall, const Unit * worker, continue; } //too near goldmine d = MapDistanceToType(wx, wy, type, x, y); - DebugLevel3("\t\t%3d,%3d -> %3d,%3d = %3d\n", wx, wy, x, y, d); + DebugLevel3("\t\t%3d,%3d -> %3d,%3d = %3d\n" _C_ wx _C_ wy _C_ x _C_ y _C_ d); if (d < cost) { cost = d; best_x = x; @@ -637,14 +637,14 @@ local int AiBuildHall(int type) // Find all available peon/peasants. num_worker = AiFindFreeWorkers(workers); - DebugLevel3("\tWorkers %d\n", num_worker); + DebugLevel3("\tWorkers %d\n" _C_ num_worker); if (!num_worker) { return -1; } // QUESTION: only not working ?? // Find all goldmines. num_goldmine = FindUnitsByType(UnitTypeGoldMine, goldmines); - DebugLevel3("\tGoldmines %d\n", num_goldmine); + DebugLevel3("\tGoldmines %d\n" _C_ num_goldmine); if (!num_goldmine) { return -1; } @@ -662,8 +662,8 @@ local int AiBuildHall(int type) y = workers[w]->Y; for (g = 0; g < num_goldmine; ++g) { d = MapDistanceToUnit(x, y, goldmines[g]); - DebugLevel3("\t\t%3d,%3d -> %3d,%3d = %3d\n", x, y, - goldmines[g]->X, goldmines[g]->Y, d); + DebugLevel3("\t\t%3d,%3d -> %3d,%3d = %3d\n" _C_ x _C_ y _C_ + goldmines[g]->X _C_ goldmines[g]->Y _C_ d); if (d < cost && UnitReachable(workers[w], goldmines[g], 1)) { best_w = w; best_g = g; @@ -672,11 +672,11 @@ local int AiBuildHall(int type) } } // Did use the first if no could be moved. - DebugLevel3("\tWorker %d %d,%d -> Goldmine %d %d,%d\n", + DebugLevel3("\tWorker %d %d,%d -> Goldmine %d %d,%d\n" _C_ UnitNumber(workers[best_w]) - , workers[best_w]->X, workers[best_w]->Y, + _C_ workers[best_w]->X _C_ workers[best_w]->Y _C_ UnitNumber(goldmines[best_g]) - , goldmines[best_g]->X, goldmines[best_g]->Y); + _C_ goldmines[best_g]->X _C_ goldmines[best_g]->Y); // Find the nearest buildable place near the gold-mine. if (AiNearGoldmine(goldmines[best_g] @@ -708,11 +708,11 @@ local int AiBuildBuilding(int type) Unit *workers[UnitMax]; int num_worker, cost, best_w, best_x, best_y, x, y, d, w; - DebugLevel3Fn("(%d)\n", type); + DebugLevel3Fn("(%d)\n" _C_ type); // Find all available peon/peasants. num_worker = AiFindFreeWorkers(workers); - DebugLevel3("\tWorkers %d\n", num_worker); + DebugLevel3("\tWorkers %d\n" _C_ num_worker); if (!num_worker) { return -1; } @@ -742,7 +742,7 @@ local int AiBuildBuilding(int type) } } if (cost != 99999) { - DebugLevel3Fn("at %d,%d\n", best_x, best_y); + DebugLevel3Fn("at %d,%d\n" _C_ best_x _C_ best_y); CommandBuildBuilding(workers[best_w], best_x, best_y, UnitTypeByWcNum(type), 1); AiMarkBuildUnitType(UnitTypeByWcNum(type)); @@ -807,7 +807,7 @@ local void AiMineGold(Unit * unit) { Unit *dest; - DebugLevel3Fn("%d\n", UnitNumber(unit)); + DebugLevel3Fn("%d\n" _C_ UnitNumber(unit)); dest = FindGoldMine(unit, unit->X, unit->Y); if (!dest) { // FIXME: now not really, no goldmine. @@ -826,7 +826,7 @@ local int AiHarvest(Unit * unit) int x, y, addx, addy, i, n, r, wx, wy, bestx, besty, cost; Unit *dest; - DebugLevel3Fn("%d\n", UnitNumber(unit)); + DebugLevel3Fn("%d\n" _C_ UnitNumber(unit)); x = unit->X; y = unit->Y; addx = unit->Type->TileWidth; @@ -838,7 +838,7 @@ local int AiHarvest(Unit * unit) // This is correct, but can this be written faster??? if ((dest = FindWoodDeposit(unit->Player, x, y))) { NearestOfUnit(dest, x, y, &wx, &wy); - DebugLevel3("To %d,%d\n", wx, wy); + DebugLevel3("To %d,%d\n" _C_ wx _C_ wy); } else { wx = unit->X; wy = unit->Y; @@ -854,7 +854,7 @@ local int AiHarvest(Unit * unit) if (CheckedForestOnMap(x, y)) { AiPlayer->NoWood = 0; n = max(abs(wx - x), abs(wy - y)); - DebugLevel3("Distance %d,%d %d\n", x, y, n); + DebugLevel3("Distance %d,%d %d\n" _C_ x _C_ y _C_ n); if (n < cost && PlaceReachable(unit, x, y, 1)) { cost = n; bestx = x; @@ -867,7 +867,7 @@ local int AiHarvest(Unit * unit) if (CheckedForestOnMap(x, y)) { AiPlayer->NoWood = 0; n = max(abs(wx - x), abs(wy - y)); - DebugLevel3("Distance %d,%d %d\n", x, y, n); + DebugLevel3("Distance %d,%d %d\n" _C_ x _C_ y _C_ n); if (n < cost && PlaceReachable(unit, x, y, 1)) { cost = n; bestx = x; @@ -880,7 +880,7 @@ local int AiHarvest(Unit * unit) if (CheckedForestOnMap(x, y)) { AiPlayer->NoWood = 0; n = max(abs(wx - x), abs(wy - y)); - DebugLevel3("Distance %d,%d %d\n", x, y, n); + DebugLevel3("Distance %d,%d %d\n" _C_ x _C_ y _C_ n); if (n < cost && PlaceReachable(unit, x, y, 1)) { cost = n; bestx = x; @@ -893,7 +893,7 @@ local int AiHarvest(Unit * unit) if (CheckedForestOnMap(x, y)) { AiPlayer->NoWood = 0; n = max(abs(wx - x), abs(wy - y)); - DebugLevel3("Distance %d,%d %d\n", x, y, n); + DebugLevel3("Distance %d,%d %d\n" _C_ x _C_ y _C_ n); if (n < cost && PlaceReachable(unit, x, y, 1)) { cost = n; bestx = x; @@ -902,7 +902,7 @@ local int AiHarvest(Unit * unit) } } if (cost != 99999) { - DebugLevel3Fn("wood on %d,%d\n", x, y); + DebugLevel3Fn("wood on %d,%d\n" _C_ x _C_ y); CommandHarvest(unit, bestx, besty,FlushCommands); return 1; } @@ -926,7 +926,7 @@ local void AiAssignWorker(void) // Count workers num_worker = AiFindFreeWorkers(workers); - DebugLevel3Fn("Player %d: %d\n", AiPlayer->Player - Players, num_worker); + DebugLevel3Fn("Player %d: %d\n" _C_ AiPlayer->Player - Players _C_ num_worker); if (num_worker) { num_still = num_gold = num_wood = num_repair = 0; for (w = 0; w < num_worker; ++w) { @@ -945,17 +945,17 @@ local void AiAssignWorker(void) ++num_repair; break; default: - DebugLevel0("%d\n", action); + DebugLevel0("%d\n" _C_ action); break; } } - DebugLevel3("Ai: Player %d: ", AiPlayer->Player - Players); - DebugLevel3("Workers %d, Gold %d, Wood %d, Repair %d, Still %d.\n", - num_worker, num_gold, num_wood, num_repair, num_still); + DebugLevel3("Ai: Player %d: " _C_ AiPlayer->Player - Players); + DebugLevel3("Workers %d, Gold %d, Wood %d, Repair %d, Still %d.\n" _C_ + num_worker _C_ num_gold _C_ num_wood _C_ num_repair _C_ num_still); if (AiPlayer->NeedGold && AiPlayer->NeedWood) { - DebugLevel3("Ai: Player %d need gold and wood\n", + DebugLevel3("Ai: Player %d need gold and wood\n" _C_ AiPlayer->Player - Players); // Assign half to wood and gold. if (num_still) { // assign the non-working @@ -986,7 +986,7 @@ local void AiAssignWorker(void) } if (AiPlayer->NeedGold) { - DebugLevel3("Ai: Player %d need gold\n", + DebugLevel3("Ai: Player %d need gold\n" _C_ AiPlayer->Player - Players); // Assign all to mine gold. for (w = 0; w < num_worker; ++w) { @@ -1009,7 +1009,7 @@ local void AiAssignWorker(void) } if (AiPlayer->NeedWood) { - DebugLevel3("Ai: Player %d need wood\n", + DebugLevel3("Ai: Player %d need wood\n" _C_ AiPlayer->Player - Players); // Assign all to harvest wood. for (w = 0; w < num_worker; ++w) { @@ -1064,7 +1064,7 @@ local void AiAssignWorker(void) num_worker = FindPlayerUnitsByType(AiPlayer->Player, UnitTypeByWcNum(AiChooseRace(UnitPeasantWithGold)), workers); - DebugLevel3("Gold %d\n", num_worker); + DebugLevel3("Gold %d\n" _C_ num_worker); if (num_worker) { // assign the non working if (AiPlayer->MainHall) { for (w = 0; w < num_worker; ++w) { @@ -1078,7 +1078,7 @@ local void AiAssignWorker(void) num_worker = FindPlayerUnitsByType(AiPlayer->Player, UnitTypeByWcNum(AiChooseRace(UnitPeasantWithWood)), workers); - DebugLevel3("Wood %d\n", num_worker); + DebugLevel3("Wood %d\n" _C_ num_worker); if (num_worker) { // assign the non working if (AiPlayer->MainHall) { for (w = 0; w < num_worker; ++w) { @@ -1253,8 +1253,8 @@ local int AiNeedBuilding(int type) */ local int AiCommandBuild(int type, int number, int action) { - DebugLevel3Fn("%s(%d), %d, %d\n", - UnitTypeByWcNum(type)->Ident, type, number, action); + DebugLevel3Fn("%s(%d), %d, %d\n" _C_ + UnitTypeByWcNum(type)->Ident _C_ type _C_ number _C_ action); if (number == 0) return 1; @@ -1388,10 +1388,10 @@ local void AiNextGoal(void) */ global void AiHelpMe(const Unit* attacker,Unit * defender) { - DebugLevel0("HELP %s(%d,%d) attacked by %s(%d,%d)", - defender->Type->Ident,defender->X, defender->Y, - attacker ? attacker->Type->Ident : "killed", - attacker ? attacker->X : 0, attacker ? attacker->Y : 0); + DebugLevel0("HELP %s(%d,%d) attacked by %s(%d,%d)" _C_ + defender->Type->Ident _C_ defender->X _C_ defender->Y _C_ + attacker ? attacker->Type->Ident : "killed" _C_ + attacker ? attacker->X : 0 _C_ attacker ? attacker->Y : 0); } /** @@ -1432,8 +1432,8 @@ global void AiNeedMoreFarms(Unit* unit,const UnitType* what) */ global void AiWorkComplete(Unit * unit, Unit * what) { - DebugLevel3("Ai: Player %d: %d Work %d complete\n", - unit->Player - Players, UnitNumber(unit), UnitNumber(what)); + DebugLevel3("Ai: Player %d: %d Work %d complete\n" _C_ + unit->Player - Players _C_ UnitNumber(unit) _C_ UnitNumber(what)); // FIXME: correct position if (unit->Player->Type == PlayerPerson) { return; @@ -1457,8 +1457,8 @@ global void AiCanNotBuild(Unit * unit, const UnitType * what) { int i; - DebugLevel1("Ai: Player %d: %d Can't build %d at %d,%d\n", - unit->Player - Players, UnitNumber(unit), what->Type, unit->X, + DebugLevel1("Ai: Player %d: %d Can't build %d at %d,%d\n" _C_ + unit->Player - Players _C_ UnitNumber(unit) _C_ what->Type _C_ unit->X _C_ unit->Y); // FIXME: correct position if (unit->Player->Type == PlayerPerson) { @@ -1488,8 +1488,8 @@ global void AiCanNotReach(Unit * unit, const UnitType * what) { int i; - DebugLevel3("Ai: Player %d: %d Can't reach %d at %d,%d\n", - unit->Player - Players, UnitNumber(unit), what->Type, unit->X, + DebugLevel3("Ai: Player %d: %d Can't reach %d at %d,%d\n" _C_ + unit->Player - Players _C_ UnitNumber(unit) _C_ what->Type _C_ unit->X _C_ unit->Y); // FIXME: correct position if (unit->Player->Type == PlayerPerson) { @@ -1520,8 +1520,8 @@ global void AiCanNotReach(Unit * unit, const UnitType * what) */ global void AiTrainingComplete(Unit * unit, Unit * what) { - DebugLevel3("Ai: Player %d: %d Training %d complete\n", - unit->Player - Players, UnitNumber(unit), UnitNumber(what)); + DebugLevel3("Ai: Player %d: %d Training %d complete\n" _C_ + unit->Player - Players _C_ UnitNumber(unit) _C_ UnitNumber(what)); // FIXME: correct position if (unit->Player->Type == PlayerPerson) { return; @@ -1580,7 +1580,7 @@ global void AiEachCycle(Player * player) } AiPlayer = player->Ai; - DebugLevel3Fn("Player %d\n", player->Player); + DebugLevel3Fn("Player %d\n" _C_ player->Player); command = AiPlayer->Commands[AiPlayer->CmdIndex]; if (AiPlayer->GoalHead->Next == 0) { if (command.Number == 0 && command.Command == 0) { diff --git a/src/map/map_draw.cpp b/src/map/map_draw.cpp index 835bb2c53..f09c880cc 100644 --- a/src/map/map_draw.cpp +++ b/src/map/map_draw.cpp @@ -1705,7 +1705,7 @@ global void DrawMapBackgroundInViewport (int v, int x, int y) mv=sx; } - DebugLevel1("%ld %ld %3ld\n",(long)sx,mv,(sx*100)/mv); + DebugLevel1("%ld %ld %3ld\n" _C_ (long)sx _C_ mv _C_ (sx*100)/mv); #endif } @@ -1799,7 +1799,7 @@ global void DrawMapBackground(int x,int y) mv=sx; } - DebugLevel1("%ld %ld %3ld\n",(long)sx,mv,(sx*100)/mv); + DebugLevel1("%ld %ld %3ld\n" _C_ (long)sx _C_ mv _C_ (sx*100)/mv); #endif } diff --git a/src/map/map_fog.cpp b/src/map/map_fog.cpp index 6d7d2e0d7..d6a1710a8 100644 --- a/src/map/map_fog.cpp +++ b/src/map/map_fog.cpp @@ -1791,7 +1791,7 @@ extern int VideoDrawText(int x,int y,unsigned font,const unsigned char* text); mv=sx; } - DebugLevel1("%ld %ld %3ld\n",(long)sx,mv,(sx*100)/mv); + DebugLevel1("%ld %ld %3ld\n" _C_ (long)sx _C_ mv _C_ (sx*100)/mv); #endif } diff --git a/src/network/netconnect.cpp b/src/network/netconnect.cpp index bbe2ed384..e1481f38c 100644 --- a/src/network/netconnect.cpp +++ b/src/network/netconnect.cpp @@ -445,7 +445,7 @@ global void NetworkServerStartGame(void) #if 0 // ARI: is this code path really executed? (initially h >= NetPlayers..) Hosts[i].PlyNr = num[0]; - DebugLevel0Fn("Hosts[%d].PlyNr = %i\n", i, num[0]); + DebugLevel0Fn("Hosts[%d].PlyNr = %i\n" _C_ i _C_ num[0]); #endif } } diff --git a/src/network/network.cpp b/src/network/network.cpp index 4e123ff58..ead3418fa 100644 --- a/src/network/network.cpp +++ b/src/network/network.cpp @@ -699,7 +699,7 @@ global void NetworkEvent(void) // Both directions are same fast/slow ncq = (NetworkCommandQueue *)(CommandsOut->last); while (ncq->List->prev) { - DebugLevel3Fn("resend %d? %d\n", ncq->Time, n); + DebugLevel3Fn("resend %d? %d\n" _C_ ncq->Time _C_ n); if (ncq->Time == n) { NetworkSendPacket(ncq); break; diff --git a/src/pathfinder/region.cpp b/src/pathfinder/region.cpp index fc5d25bf9..bfbcf9fbf 100644 --- a/src/pathfinder/region.cpp +++ b/src/pathfinder/region.cpp @@ -135,8 +135,8 @@ void RegionDeleteNeighbor (Region *reg, Region *neigh) break; } if (i == reg->NumNeighbors) { - DebugLevel0Fn ("region %d is not a neighbor of %d.\n", - reg->RegId, neigh->RegId); + DebugLevel0Fn ("region %d is not a neighbor of %d.\n" _C_ + reg->RegId _C_ neigh->RegId); return; } for ( ; i+1 < reg->NumNeighbors; i++) { diff --git a/src/pathfinder/region_groups.cpp b/src/pathfinder/region_groups.cpp index 7eacd90a2..f67c2a941 100644 --- a/src/pathfinder/region_groups.cpp +++ b/src/pathfinder/region_groups.cpp @@ -401,7 +401,7 @@ void RegGroupAddToSuperGroups (int group_id) RegGroup *g = RegGroupSetFindGroup (group_id); Region *r; - //DebugLevel0Fn ("reinitializing group %d.\n", group_id); + //DebugLevel0Fn ("reinitializing group %d.\n" _C_ group_id); for (r = g->Regions; r; r = r->NextInGroup) { int i; @@ -496,8 +496,8 @@ local void SuperGroupAddRegGroup (SuperGroup *s, RegGroup *g) for ( ; gptr->NextInSGroup[type]; gptr=gptr->NextInSGroup[type]); gptr->NextInSGroup[type] = g; } - //DebugLevel2Fn ("added Group %4d to SuperGroup %2d of type %d.\n", - // g->Id, s->Id, type); + //DebugLevel2Fn ("added Group %4d to SuperGroup %2d of type %d.\n" _C_ + // g->Id _C_ s->Id _C_ type); } local void SuperGroupDeleteRegGroup (SuperGroup *s, RegGroup *group) diff --git a/src/stratagus/missile.cpp b/src/stratagus/missile.cpp index f666aa1be..3c8bb5d26 100644 --- a/src/stratagus/missile.cpp +++ b/src/stratagus/missile.cpp @@ -737,9 +737,9 @@ local int MissileVisible(const Missile* missile) if ( !AnyMapAreaVisibleOnScreen(tileMinX,tileMinY,tileMaxX,tileMaxY) ) { return 0; } - DebugLevel3Fn("Missile bounding box %d %d %d %d (Map %d %d %d %d)\n", - tileMinX,tileMaxX,tileMinY,tileMaxY, - MapX,MapX+MapWidth,MapY,MapY+MapHeight); + DebugLevel3Fn("Missile bounding box %d %d %d %d (Map %d %d %d %d)\n" _C_ + tileMinX _C_ tileMaxX _C_ tileMinY _C_ tileMaxY _C_ + MapX _C_ MapX+MapWidth _C_ MapY _C_ MapY+MapHeight); return 1; } #endif /* SPLIT_SCREEN_SUPPORT */ diff --git a/src/unit/unit.cpp b/src/unit/unit.cpp index a92ad591b..c9419b943 100644 --- a/src/unit/unit.cpp +++ b/src/unit/unit.cpp @@ -2565,7 +2565,7 @@ global int FindWoodInSight(Unit* unit,int* px,int* py) int bestd; Unit* destu; - DebugLevel3Fn("%d %d,%d\n",UnitNumber(unit),unit->X,unit->Y); + DebugLevel3Fn("%d %d,%d\n" _C_ UnitNumber(unit) _C_ unit->X _C_ unit->Y); x=unit->X; y=unit->Y; @@ -2578,7 +2578,7 @@ global int FindWoodInSight(Unit* unit,int* px,int* py) // if( (destu=FindWoodDeposit(unit->Player,x,y)) ) { NearestOfUnit(destu,x,y,&wx,&wy); - DebugLevel3("To %d,%d\n",wx,wy); + DebugLevel3("To %d,%d\n" _C_ wx _C_ wy); } else { wx=unit->X; wy=unit->Y; @@ -2592,7 +2592,7 @@ global int FindWoodInSight(Unit* unit,int* px,int* py) for( i=addy; i--; y++ ) { if( CheckedForestOnMap(x,y) ) { n=max(abs(wx-x),abs(wy-y)); - DebugLevel3("Distance %d,%d %d\n",x,y,n); + DebugLevel3("Distance %d,%d %d\n" _C_ x _C_ y _C_ n); if( n<bestd ) { bestd=n; bestx=x; @@ -2604,7 +2604,7 @@ global int FindWoodInSight(Unit* unit,int* px,int* py) for( i=addx; i--; x++ ) { if( CheckedForestOnMap(x,y) ) { n=max(abs(wx-x),abs(wy-y)); - DebugLevel3("Distance %d,%d %d\n",x,y,n); + DebugLevel3("Distance %d,%d %d\n" _C_ x _C_ y _C_ n); if( n<bestd ) { bestd=n; bestx=x; @@ -2616,7 +2616,7 @@ global int FindWoodInSight(Unit* unit,int* px,int* py) for( i=addy; i--; y-- ) { if( CheckedForestOnMap(x,y) ) { n=max(abs(wx-x),abs(wy-y)); - DebugLevel3("Distance %d,%d %d\n",x,y,n); + DebugLevel3("Distance %d,%d %d\n" _C_ x _C_ y _C_ n); if( n<bestd ) { bestd=n; bestx=x; @@ -2628,7 +2628,7 @@ global int FindWoodInSight(Unit* unit,int* px,int* py) for( i=addx; i--; x-- ) { if( CheckedForestOnMap(x,y) ) { n=max(abs(wx-x),abs(wy-y)); - DebugLevel3("Distance %d,%d %d\n",x,y,n); + DebugLevel3("Distance %d,%d %d\n" _C_ x _C_ y _C_ n); if( n<bestd ) { bestd=n; bestx=x; @@ -2637,7 +2637,7 @@ global int FindWoodInSight(Unit* unit,int* px,int* py) } } if( bestd!=99999 ) { - DebugLevel3Fn("wood on %d,%d\n",x,y); + DebugLevel3Fn("wood on %d,%d\n" _C_ x _C_ y); *px=bestx; *py=besty; return 1; diff --git a/src/unit/unit_cache.cpp b/src/unit/unit_cache.cpp index b4a825b9b..9545f732d 100644 --- a/src/unit/unit_cache.cpp +++ b/src/unit/unit_cache.cpp @@ -228,7 +228,7 @@ local QuadTreeLeaf* NewQuadTreeLeaf(QuadTreeValue* value,QuadTreeLeaf* next) */ local void QuadTreeLeafFree(QuadTreeLeaf* leaf) { - DebugLevel3("Free-leaf: %p\n",leaf); + DebugLevel3("Free-leaf: %p\n" _C_ leaf); free(leaf); } @@ -240,7 +240,7 @@ local void QuadTreeLeafFree(QuadTreeLeaf* leaf) */ local void QuadTreeNodeFree(QuadTreeNode* node) { - DebugLevel3("Free-node: %p\n",node); + DebugLevel3("Free-node: %p\n" _C_ node); free(node); } @@ -280,8 +280,8 @@ local void QuadTreeInsert(QuadTree* tree,QuadTreeValue* value) IfDebug( if( leaf->Next ) { DebugLevel3("More...\n"); - DebugLevel3("Leaf: %p %p,",leaf,leaf->Value); - DebugLevel3("Leaf: %p %p\n",leaf->Next,leaf->Next->Value); + DebugLevel3("Leaf: %p %p," _C_ leaf _C_ leaf->Value); + DebugLevel3("Leaf: %p %p\n" _C_ leaf->Next _C_ leaf->Next->Value); } ); *nodep=(QuadTreeNode*)leaf; @@ -315,7 +315,7 @@ local void QuadTreeDelete(QuadTree* tree,QuadTreeValue* value) if( !(node=*nodep) ) { DebugLevel0Fn("Value not found\n"); DebugLevel0Fn("%d,%d\n" - ,QuadTreeValueXOf(value),QuadTreeValueYOf(value)); + _C_ QuadTreeValueXOf(value) _C_ QuadTreeValueYOf(value)); return; } stack[1+level]=nodep; @@ -333,7 +333,7 @@ local void QuadTreeDelete(QuadTree* tree,QuadTreeValue* value) if( !leaf ) { DebugLevel0Fn("Value not found\n"); DebugLevel0Fn("%d,%d\n" - ,QuadTreeValueXOf(value),QuadTreeValueYOf(value)); + _C_ QuadTreeValueXOf(value) _C_ QuadTreeValueYOf(value)); return; } if( leaf->Value==value ) { @@ -343,8 +343,8 @@ local void QuadTreeDelete(QuadTree* tree,QuadTreeValue* value) } *leafp=leaf->Next; // remove from list - DebugLevel3("FREE: %p %p %d,%d\n",leafp,leaf - ,leaf->Value->X,leaf->Value->Y); + DebugLevel3("FREE: %p %p %d,%d\n" _C_ leafp _C_ leaf + _C_ leaf->Value->X _C_ leaf->Value->Y); QuadTreeLeafFree(leaf); StatisticDelLeaf(tree); @@ -361,7 +361,7 @@ local void QuadTreeDelete(QuadTree* tree,QuadTreeValue* value) break; } *nodep=NULL; - DebugLevel3("FREE: %p %p\n",nodep,node); + DebugLevel3("FREE: %p %p\n" _C_ nodep _C_ node); QuadTreeNodeFree(node); StatisticDelNode(tree); } @@ -444,7 +444,7 @@ local int SelectQuadTreeLeaf(QuadTreeLeaf* leaf,QuadTreeValue** table,int index) if( leaf ) { while( leaf ) { DebugLevel3("%d,%d " - ,QuadTreeValueXOf(leaf->Value),QuadTreeValueYOf(leaf->Value)); + _C_ QuadTreeValueXOf(leaf->Value) _C_ QuadTreeValueYOf(leaf->Value)); table[index++]=leaf->Value; leaf=leaf->Next; } @@ -465,10 +465,10 @@ local int SelectQuadTreeNode(QuadTreeNode* node,int kx,int ky,int levels if( node ) { if( levels ) { - DebugLevel3("Levels %d key %x %x\n",levels,kx,ky); + DebugLevel3("Levels %d key %x %x\n" _C_ levels _C_ kx _C_ ky); i=kx|(1<<levels); j=ky|(1<<levels); - DebugLevel3("New key %d %d\n",i,j); + DebugLevel3("New key %d %d\n" _C_ i _C_ j); if( x1<=i ) { if( y1<=j ) { index=SelectQuadTreeNode(node->Next[0],kx,ky,levels-1 @@ -491,10 +491,10 @@ local int SelectQuadTreeNode(QuadTreeNode* node,int kx,int ky,int levels } } } else { - DebugLevel3("Levels %d key %x %x\n",levels,kx,ky); + DebugLevel3("Levels %d key %x %x\n" _C_ levels _C_ kx _C_ ky); i=kx|(1<<levels); j=ky|(1<<levels); - DebugLevel3("New key %d %d\n",i,j); + DebugLevel3("New key %d %d\n" _C_ i _C_ j); if( x1<=i ) { if( y1<=j ) { index=SelectQuadTreeLeaf((QuadTreeLeaf*)node->Next[0] @@ -528,7 +528,7 @@ local int QuadTreeSelect(QuadTree* tree { int num; - DebugLevel3("%d,%d-%d,%d:",x1,y1,x2,y2); + DebugLevel3("%d,%d-%d,%d:" _C_ x1 _C_ y1 _C_ x2 _C_ y2); num=SelectQuadTreeNode(tree->Root,0,0,tree->Levels-1,x1,y1,x2,y2,table,0); DebugLevel3("\n"); return num; @@ -546,7 +546,7 @@ local void PrintQuadTreeLeaf(QuadTreeLeaf* leaf,int level,int levels) DebugLevel0(" "); } while( leaf ) { - DebugLevel0("%d,%d ",leaf->Value->X,leaf->Value->Y); + DebugLevel0("%d,%d " _C_ leaf->Value->X _C_ leaf->Value->Y); leaf=leaf->Next; } DebugLevel0("\n"); @@ -564,8 +564,8 @@ local void PrintQuadTreeNode(QuadTreeNode* node,int level,int levels) for( i=0; i<level; ++i ) { DebugLevel0(" "); } - DebugLevel0("%8p(%d): %8p %8p %8p %8p\n",node,levels-level - ,node->Next[0],node->Next[1],node->Next[2],node->Next[3]); + DebugLevel0("%8p(%d): %8p %8p %8p %8p\n" _C_ node _C_ levels-level + _C_ node->Next[0] _C_ node->Next[1] _C_ node->Next[2] _C_ node->Next[3]); if( level+1==levels ) { PrintQuadTreeLeaf((QuadTreeLeaf*)node->Next[0],level+1,levels); PrintQuadTreeLeaf((QuadTreeLeaf*)node->Next[1],level+1,levels); @@ -585,7 +585,7 @@ local void PrintQuadTreeNode(QuadTreeNode* node,int level,int levels) */ local void PrintQuadTree(QuadTree* tree) { - DebugLevel0("Tree: Levels %d\n",tree->Levels); + DebugLevel0("Tree: Levels %d\n" _C_ tree->Levels); if( !tree->Root ) { DebugLevel0("EMPTY TREE\n"); return; @@ -599,13 +599,13 @@ local void PrintQuadTree(QuadTree* tree) local void QuadTreePrintStatistic(QuadTree* tree) { IfDebug(if (!tree) return;) - DebugLevel0("Quad-Tree: %p Levels %d\n",tree,tree->Levels); + DebugLevel0("Quad-Tree: %p Levels %d\n" _C_ tree _C_ tree->Levels); DebugLevel0("\tInserts %d, deletes %d\n" - ,tree->Inserts,tree->Deletes); + _C_ tree->Inserts _C_ tree->Deletes); DebugLevel0("\tNodes %d, made %d, freed %d\n" - ,tree->Nodes,tree->NodesMade,tree->NodesFreed); + _C_ tree->Nodes _C_ tree->NodesMade _C_ tree->NodesFreed); DebugLevel0("\tLeafs %d, made %d, freed %d\n" - ,tree->Leafs,tree->LeafsMade,tree->LeafsFreed); + _C_ tree->Leafs _C_ tree->LeafsMade _C_ tree->LeafsFreed); } //***************************************************************************** @@ -621,7 +621,7 @@ local QuadTree* PositionCache; /// My quad tree for lookup */ global void UnitCacheInsert(Unit* unit) { - DebugLevel3Fn("Insert UNIT %8p %08X\n",unit,UnitNumber(unit)); + DebugLevel3Fn("Insert UNIT %8p %08X\n" _C_ unit _C_ UnitNumber(unit)); QuadTreeInsert(PositionCache,unit); } @@ -632,7 +632,7 @@ global void UnitCacheInsert(Unit* unit) */ global void UnitCacheRemove(Unit* unit) { - DebugLevel3Fn("Remove UNIT %8p %08X\n",unit,UnitNumber(unit)); + DebugLevel3Fn("Remove UNIT %8p %08X\n" _C_ unit _C_ UnitNumber(unit)); QuadTreeDelete(PositionCache,unit); } @@ -728,9 +728,9 @@ global Unit* UnitCacheOnXY(int x,int y,int type) IfDebug( // FIXME: the error isn't here! if( !leaf->Value->Type ) { - DebugLevel0("Error UNIT %8p %08X %d,%d\n",leaf->Value - ,UnitNumber(leaf->Value),leaf->Value->X,leaf->Value->Y); - DebugLevel0("Removed unit in cache %d,%d!!!!\n",x,y); + DebugLevel0("Error UNIT %8p %08X %d,%d\n" _C_ leaf->Value + _C_ UnitNumber(leaf->Value) _C_ leaf->Value->X _C_ leaf->Value->Y); + DebugLevel0("Removed unit in cache %d,%d!!!!\n" _C_ x _C_ y); leaf=leaf->Next; continue; } @@ -767,7 +767,7 @@ global void InitUnitCache(void) for( l=0; n; l++ ) { n>>=1; } - DebugLevel0("UnitCache: %d Levels\n",l); + DebugLevel0("UnitCache: %d Levels\n" _C_ l); PositionCache=NewQuadTree(l); } diff --git a/src/unit/unit_draw.cpp b/src/unit/unit_draw.cpp index 1d348f438..3b84a1f1e 100644 --- a/src/unit/unit_draw.cpp +++ b/src/unit/unit_draw.cpp @@ -973,10 +973,10 @@ local void DrawDecoration(const Unit* unit,const UnitType* type,int x,int y) n=3-((f-75)/(25/3))+ 0; } else if( f>50 ) { n=3-((f-50)/(25/3))+ 4; - DebugLevel3("%d - %d\n",f,n); + DebugLevel3("%d - %d\n" _C_ f _C_ n); } else { n=3-(f/(50/3))+ 8; - DebugLevel3("%d - %d\n",f,n); + DebugLevel3("%d - %d\n" _C_ f _C_ n); } #endif DebugCheck( n<0 ); diff --git a/src/video/X11.cpp b/src/video/X11.cpp index 81836cb25..2ea1cb83b 100644 --- a/src/video/X11.cpp +++ b/src/video/X11.cpp @@ -132,8 +132,8 @@ global void SetVideoSync(void) fprintf(stderr,"Can't set itimer\n"); } - DebugLevel3("Timer installed %ld,%ld\n", - itv.it_interval.tv_sec,itv.it_interval.tv_usec); + DebugLevel3("Timer installed %ld,%ld\n" _C_ + itv.it_interval.tv_sec _C_ itv.it_interval.tv_usec); } #else diff --git a/src/video/svgalib.cpp b/src/video/svgalib.cpp index d78b65335..c573b1e75 100644 --- a/src/video/svgalib.cpp +++ b/src/video/svgalib.cpp @@ -172,7 +172,7 @@ global void SetVideoSync(void) FrameTicks = ms / 10; FrameRemainder = ms % 10; - DebugLevel0Fn("frames %d - %d.%dms\n", SkipFrames, ms / 10, ms % 10); + DebugLevel0Fn("frames %d - %d.%dms\n" _C_ SkipFrames _C_ ms / 10 _C_ ms % 10); } #endif diff --git a/src/video/video.cpp b/src/video/video.cpp index f5f29550f..1906a82ad 100644 --- a/src/video/video.cpp +++ b/src/video/video.cpp @@ -1293,7 +1293,7 @@ global void InitVideo(void) #endif #ifndef SPLIT_SCREEN_SUPPORT - DebugLevel3Fn("%d %d\n",MapWidth,MapHeight); + DebugLevel3Fn("%d %d\n" _C_ MapWidth _C_ MapHeight); #endif } diff --git a/src/video/wince.cpp b/src/video/wince.cpp index df68eba1e..cf0a7e81f 100644 --- a/src/video/wince.cpp +++ b/src/video/wince.cpp @@ -70,7 +70,7 @@ */ global void SetVideoSync(void) { - DebugLevel0Fn("%d\n",(100*1000/CYCLES_PER_SECOND)/VideoSyncSpeed); + DebugLevel0Fn("%d\n" _C_ (100*1000/CYCLES_PER_SECOND)/VideoSyncSpeed); } /*---------------------------------------------------------------------------- @@ -94,7 +94,7 @@ global void InitVideoSdl(void) VideoBpp=16; VideoDepth=16; - DebugLevel3Fn("Video init ready %d %d\n",VideoDepth,VideoBpp); + DebugLevel3Fn("Video init ready %d %d\n" _C_ VideoDepth _C_ VideoBpp); } /**