diff --git a/src/action/action_attack.cpp b/src/action/action_attack.cpp index 68e43c974..5f92f512b 100644 --- a/src/action/action_attack.cpp +++ b/src/action/action_attack.cpp @@ -125,7 +125,7 @@ local Unit* CheckForDeadGoal(Unit* unit) unit->Orders[0].Y=goal->Y+goal->Type->TileHeight/2; unit->Orders[0].RangeX=unit->Orders[0].RangeY=0; - DebugLevel0Fn("destroyed unit %d\n",UnitNumber(goal)); + DebugLevel0Fn("destroyed unit %d\n" _C_ UnitNumber(goal)); RefsDebugCheck( !goal->Refs ); if( !--goal->Refs ) { ReleaseUnit(goal); @@ -211,7 +211,7 @@ local int CheckForTargetInRange(Unit* unit) unit->SubAction|=WEAK_TARGET; // weak target NewResetPath(unit); DebugLevel3Fn("%d in react range %d\n" - ,UnitNumber(unit),UnitNumber(goal)); + _C_ UnitNumber(unit) _C_ UnitNumber(goal)); } // @@ -229,7 +229,7 @@ local int CheckForTargetInRange(Unit* unit) // Save current command to come back. unit->SavedOrder=unit->Orders[0]; if( (goal=unit->SavedOrder.Goal) ) { - DebugLevel0Fn("Have goal to come back %d\n", + DebugLevel0Fn("Have goal to come back %d\n" _C_ UnitNumber(goal)); unit->SavedOrder.X=goal->X+goal->Type->TileWidth/2; unit->SavedOrder.Y=goal->Y+goal->Type->TileHeight/2; @@ -441,7 +441,7 @@ local void AttackTarget(Unit* unit) if( unit->SavedOrder.Action==UnitActionStill ) { unit->SavedOrder=unit->Orders[0]; if( (temp=unit->SavedOrder.Goal) ) { - DebugLevel0Fn("Have unit to come back %d?\n", + DebugLevel0Fn("Have unit to come back %d?\n" _C_ UnitNumber(temp)); unit->SavedOrder.X=temp->X+temp->Type->TileWidth/2; unit->SavedOrder.Y=temp->Y+temp->Type->TileHeight/2; @@ -453,7 +453,7 @@ local void AttackTarget(Unit* unit) RefsDebugCheck( goal->Destroyed || !goal->Refs ); goal->Refs++; DebugLevel3Fn("%d Unit in react range %d\n" - ,UnitNumber(unit),UnitNumber(goal)); + _C_ UnitNumber(unit) _C_ UnitNumber(goal)); unit->Orders[0].Goal=goal; unit->Orders[0].X=unit->Orders[0].Y=-1; unit->Orders[0].RangeX=unit->Orders[0].RangeY= @@ -478,7 +478,7 @@ local void AttackTarget(Unit* unit) // Save current order to come back or to continue it. unit->SavedOrder=unit->Orders[0]; if( (goal=unit->SavedOrder.Goal) ) { - DebugLevel0Fn("Have goal to come back %d\n", + DebugLevel0Fn("Have goal to come back %d\n" _C_ UnitNumber(goal)); unit->SavedOrder.X=goal->X+goal->Type->TileWidth/2; unit->SavedOrder.Y=goal->Y+goal->Type->TileHeight/2; @@ -501,7 +501,7 @@ local void AttackTarget(Unit* unit) // Save current order to come back or to continue it. unit->SavedOrder=unit->Orders[0]; if( (temp=unit->SavedOrder.Goal) ) { - DebugLevel0Fn("Have goal to come back %d\n", + DebugLevel0Fn("Have goal to come back %d\n" _C_ UnitNumber(temp)); unit->SavedOrder.X=temp->X+temp->Type->TileWidth/2; unit->SavedOrder.Y=temp->Y+temp->Type->TileHeight/2; @@ -543,7 +543,7 @@ local void AttackTarget(Unit* unit) */ global void HandleActionAttack(Unit* unit) { - DebugLevel3Fn("Attack %d\n",UnitNumber(unit)); + DebugLevel3Fn("Attack %d\n" _C_ UnitNumber(unit)); switch( unit->SubAction ) { // diff --git a/src/action/action_board.cpp b/src/action/action_board.cpp index cb8663948..acbac9c2e 100644 --- a/src/action/action_board.cpp +++ b/src/action/action_board.cpp @@ -79,7 +79,7 @@ local int WaitForTransporter(Unit* unit) if( !trans || !trans->Type->Transporter ) { // FIXME: destination destroyed?? - DebugLevel2Fn("TRANSPORTER NOT REACHED %d,%d\n",unit->X,unit->Y); + DebugLevel2Fn("TRANSPORTER NOT REACHED %d,%d\n" _C_ unit->X _C_ unit->Y); return 0; } @@ -110,7 +110,7 @@ local int WaitForTransporter(Unit* unit) // FIXME: any enemies in range attack them, while waiting. // - DebugLevel2Fn("TRANSPORTER NOT REACHED %d,%d\n",unit->X,unit->Y); + DebugLevel2Fn("TRANSPORTER NOT REACHED %d,%d\n" _C_ unit->X _C_ unit->Y); return 0; } @@ -187,7 +187,7 @@ global void HandleActionBoard(Unit* unit) Unit* goal; DebugLevel3Fn("%p(%d) SubAction %d\n" - ,unit,UnitNumber(unit),unit->SubAction); + _C_ unit _C_ UnitNumber(unit) _C_ unit->SubAction); switch( unit->SubAction ) { // diff --git a/src/action/action_build.cpp b/src/action/action_build.cpp index 652ec85da..52c11eeae 100644 --- a/src/action/action_build.cpp +++ b/src/action/action_build.cpp @@ -95,7 +95,7 @@ global void HandleActionBuild(Unit* unit) return; case PF_REACHED: - DebugLevel3Fn("reached %d,%d\n",unit->X,unit->Y); + DebugLevel3Fn("reached %d,%d\n" _C_ unit->X _C_ unit->Y); break; default: @@ -218,8 +218,8 @@ global void HandleActionBuild(Unit* unit) build->Data.Builded.Cancel=0; // FIXME: Is it necessary? build->Data.Builded.Worker=unit; DebugLevel3Fn("Build Sum %d, Add %d, Val %d, Sub %d\n" - ,build->Data.Builded.Sum,build->Data.Builded.Add - ,build->Data.Builded.Val,build->Data.Builded.Sub); + _C_ build->Data.Builded.Sum _C_ build->Data.Builded.Add + _C_ build->Data.Builded.Val _C_ build->Data.Builded.Sub); build->Wait=CYCLES_PER_SECOND/6; // @@ -341,7 +341,7 @@ global void HandleActionBuilded(Unit* unit) if( type->GivesOil ) { CommandHaulOil(worker,unit,0); // Let the unit haul oil DebugLevel0Fn("Update oil-platform\n"); - DebugLevel0Fn(" =%d\n",unit->Data.Resource.Active); + DebugLevel0Fn(" =%d\n" _C_ unit->Data.Resource.Active); unit->Data.Resource.Active=0; unit->Value=worker->Value; // worker holding value while building } diff --git a/src/action/action_demolish.cpp b/src/action/action_demolish.cpp index aaded4bb8..680d2cda1 100644 --- a/src/action/action_demolish.cpp +++ b/src/action/action_demolish.cpp @@ -61,7 +61,7 @@ global void HandleActionDemolish(Unit* unit) Unit* goal; int err; - DebugLevel3Fn("Demolish %d\n",UnitNumber(unit)); + DebugLevel3Fn("Demolish %d\n" _C_ UnitNumber(unit)); switch( unit->SubAction ) { // diff --git a/src/action/action_die.cpp b/src/action/action_die.cpp index 3c44a7185..c4b0c2afa 100644 --- a/src/action/action_die.cpp +++ b/src/action/action_die.cpp @@ -64,7 +64,7 @@ global void HandleActionDie(Unit* unit) // Die sequence terminated, generate corpse. // if( unit->Reset ) { - DebugLevel3("Die complete %d\n",UnitNumber(unit)); + DebugLevel3("Die complete %d\n" _C_ UnitNumber(unit)); if( !unit->Type->CorpseType ) { ReleaseUnit(unit); return; diff --git a/src/action/action_follow.cpp b/src/action/action_follow.cpp index 2b69045cd..5d051b72a 100644 --- a/src/action/action_follow.cpp +++ b/src/action/action_follow.cpp @@ -56,9 +56,9 @@ global void HandleActionFollow(Unit* unit) { Unit* goal; - DebugLevel3Fn("%d: %d %d,%d \n",UnitNumber(unit), - unit->Orders[0].Goal ? UnitNumber(unit->Orders[0].Goal) : -1, - unit->Orders[0].X,unit->Orders[0].Y); + DebugLevel3Fn("%d: %d %d,%d \n" _C_ UnitNumber(unit) _C_ + unit->Orders[0].Goal ? UnitNumber(unit->Orders[0].Goal) : -1 _C_ + unit->Orders[0].X _C_ unit->Orders[0].Y); // // Reached target @@ -187,7 +187,7 @@ global void HandleActionFollow(Unit* unit) || goal->Orders[0].Action==UnitActionStill) ) { goal=AttackUnitsInReactRange(unit); if( goal ) { - DebugLevel2Fn("Follow attack %d\n",UnitNumber(goal)); + DebugLevel2Fn("Follow attack %d\n" _C_ UnitNumber(goal)); CommandAttack(unit,goal->X,goal->Y,NULL,FlushCommands); // Save current command to come back. unit->SavedOrder=unit->Orders[0]; diff --git a/src/action/action_harvest.cpp b/src/action/action_harvest.cpp index c4e484e69..223690dc6 100644 --- a/src/action/action_harvest.cpp +++ b/src/action/action_harvest.cpp @@ -205,7 +205,7 @@ local int ChopWood(Unit* unit) } else { // FIXME: support more races! DebugLevel0Fn("Wrong unit for chopping wood %d\n" - ,unit->Type->Type); + _C_ unit->Type->Type); } unit->Player->UnitTypesCount[unit->Type->Type]++; @@ -330,8 +330,8 @@ local int ReturnWithWood(Unit* unit) if( i==PF_UNREACHABLE ) { // FIXME: could try another depot, or retry later. DebugLevel2Fn("WOOD-DEPOSIT NOT REACHED %d=%d,%d ? %d\n" - ,UnitNumber(destu),destu->X,destu->Y - ,MapDistanceToUnit(unit->X,unit->Y,destu)); + _C_ UnitNumber(destu) _C_ destu->X _C_ destu->Y + _C_ MapDistanceToUnit(unit->X,unit->Y,destu)); unit->Orders[0].Action=UnitActionStill; unit->SubAction=0; return 0; @@ -381,7 +381,7 @@ local int ReturnWithWood(Unit* unit) unit->Type=UnitTypeHumanWorker; } else { // FIXME: must support more races. - DebugLevel0Fn("Wrong unit for returning wood %d\n",unit->Type->Type); + DebugLevel0Fn("Wrong unit for returning wood %d\n" _C_ unit->Type->Type); } unit->Player->UnitTypesCount[unit->Type->Type]++; diff --git a/src/action/action_minegold.cpp b/src/action/action_minegold.cpp index d451216f3..59c175808 100644 --- a/src/action/action_minegold.cpp +++ b/src/action/action_minegold.cpp @@ -101,7 +101,7 @@ local int MoveToGoldMine(Unit* unit) if( i==PF_UNREACHABLE ) { // FIXME: could try another mine, or retry later. DebugLevel3Fn("GOLD-MINE NOT REACHED %d=%d,%d ? %d\n" - ,UnitNumber(destu),destu->X,destu->Y, + _C_ UnitNumber(destu) _C_ destu->X _C_ destu->Y _C_ MapDistanceToUnit(unit->X,unit->Y,destu)); return -1; } @@ -214,7 +214,7 @@ local int MineInGoldmine(Unit* unit) // End of gold: destroy gold-mine. // if( !OptionUseDepletedMines && mine->Value<DEFAULT_INCOMES[GoldCost] ) { - DebugLevel0Fn("Mine destroyed %d,%d\n",mine->X,mine->Y); + DebugLevel0Fn("Mine destroyed %d,%d\n" _C_ mine->X _C_ mine->Y); DropOutAll(mine); LetUnitDie(mine); mine=NULL; @@ -248,7 +248,7 @@ local int MineInGoldmine(Unit* unit) unit->Orders[0].X=unit->Orders[0].Y=-1; unit->Orders[0].Action=UnitActionMineGold; unit->SubAction=64; - DebugLevel3Fn("Mine with deposit %d,%d\n",destu->X,destu->Y); + DebugLevel3Fn("Mine with deposit %d,%d\n" _C_ destu->X _C_ destu->Y); } // @@ -262,7 +262,7 @@ local int MineInGoldmine(Unit* unit) } else { // FIXME: support workers for more races. DebugLevel0Fn("Wrong unit (%d,%d) for mining gold %d (%s)\n" - ,unit->X,unit->Y,unit->Type->Type,unit->Type->Name); + _C_ unit->X _C_ unit->Y _C_ unit->Type->Type _C_ unit->Type->Name); } unit->Player->UnitTypesCount[unit->Type->Type]++; CheckUnitToBeDrawn(unit); @@ -349,8 +349,8 @@ local int MoveToGoldDeposit(Unit* unit) if( i==PF_UNREACHABLE ) { // FIXME: could try another depot, or retry later. DebugLevel3Fn("GOLD-DEPOT NOT REACHED %d=%d,%d ? %d\n" - ,UnitNumber(destu),destu->X,destu->Y - ,MapDistanceToUnit(unit->X,unit->Y,destu)); + _C_ UnitNumber(destu) _C_ destu->X _C_ destu->Y + _C_ MapDistanceToUnit(unit->X,unit->Y,destu)); return -1; } @@ -389,7 +389,7 @@ local int MoveToGoldDeposit(Unit* unit) } else { // FIXME: support workers for more races. DebugLevel0Fn("Wrong unit (%d,%d) for returning gold %d (%s)\n" - ,unit->X,unit->Y,unit->Type->Type,unit->Type->Name); + _C_ unit->X _C_ unit->Y _C_ unit->Type->Type _C_ unit->Type->Name); } unit->Player->UnitTypesCount[unit->Type->Type]++; diff --git a/src/action/action_move.cpp b/src/action/action_move.cpp index a29dbf0f2..05adf73e0 100644 --- a/src/action/action_move.cpp +++ b/src/action/action_move.cpp @@ -179,13 +179,13 @@ local int ActionMoveGeneric(Unit* unit,const Animation* anim) #endif } - DebugLevel3Fn(": %d,%d State %2d ",xd,yd,unit->State); + DebugLevel3Fn(": %d,%d State %2d " _C_ xd _C_ yd _C_ unit->State); DebugLevel3("Walk %d Frame %2d Wait %3d Heading %d %d,%d\n" - ,anim[state].Pixel - ,anim[state].Frame - ,anim[state].Sleep - ,unit->Direction - ,unit->IX,unit->IY); + _C_ anim[state].Pixel + _C_ anim[state].Frame + _C_ anim[state].Sleep + _C_ unit->Direction + _C_ unit->IX _C_ unit->IY); // // Next animation. @@ -234,7 +234,7 @@ local int ActionMoveGeneric(Unit* unit,const Animation* anim) global int DoActionMove(Unit* unit) { if( unit->Type->Animations ) { - DebugLevel3("%s: %p\n",unit->Type->Ident,unit->Type->Animations ); + DebugLevel3("%s: %p\n" _C_ unit->Type->Ident _C_ unit->Type->Animations ); return ActionMoveGeneric(unit,unit->Type->Animations->Move); } @@ -255,9 +255,9 @@ global void HandleActionMove(Unit* unit) { Unit* goal; - DebugLevel3Fn("%d: %d %d,%d \n",UnitNumber(unit), - unit->Orders[0].Goal ? UnitNumber(unit->Orders[0].Goal) : -1, - unit->Orders[0].X,unit->Orders[0].Y); + DebugLevel3Fn("%d: %d %d,%d \n" _C_ UnitNumber(unit) _C_ + unit->Orders[0].Goal ? UnitNumber(unit->Orders[0].Goal) : -1 _C_ + unit->Orders[0].X _C_ unit->Orders[0].Y); if( !unit->SubAction ) { // first entry unit->SubAction=1; diff --git a/src/action/action_patrol.cpp b/src/action/action_patrol.cpp index 7aa839447..8b52ab94b 100644 --- a/src/action/action_patrol.cpp +++ b/src/action/action_patrol.cpp @@ -87,14 +87,14 @@ global void HandleActionPatrol(Unit* unit) if( unit->Type->CanAttack && !unit->Type->Tower ) { goal=AttackUnitsInReactRange(unit); if( goal ) { - DebugLevel0Fn("Patrol attack %d\n",UnitNumber(goal)); + DebugLevel0Fn("Patrol attack %d\n" _C_ UnitNumber(goal)); CommandAttack(unit,goal->X,goal->Y,NULL,FlushCommands); // Save current command to come back. unit->SavedOrder=unit->Orders[0]; unit->Orders[0].Action=UnitActionStill; unit->Orders[0].Goal=NoUnitP; unit->SubAction=0; - DebugLevel0Fn("Wait %d\n",unit->Wait); + DebugLevel0Fn("Wait %d\n" _C_ unit->Wait); } } } diff --git a/src/action/action_repair.cpp b/src/action/action_repair.cpp index 1d10b1f9e..1fc076bea 100644 --- a/src/action/action_repair.cpp +++ b/src/action/action_repair.cpp @@ -91,7 +91,7 @@ local void RepairUnit(Unit* unit,Unit* goal) // original per 100 hit points only 25 gold 25 wood // hp=GIVES_HP; - DebugLevel2Fn("hitpoints %d\n",hp); + DebugLevel2Fn("hitpoints %d\n" _C_ hp); // // Calculate the repair costs. @@ -197,7 +197,7 @@ global void HandleActionRepair(Unit* unit) Unit* goal; int err; - DebugLevel3("Repair %d\n",UnitNumber(unit)); + DebugLevel3("Repair %d\n" _C_ UnitNumber(unit)); switch( unit->SubAction ) { case 0: diff --git a/src/action/action_resource.cpp b/src/action/action_resource.cpp index 84769bc74..45cd796bd 100644 --- a/src/action/action_resource.cpp +++ b/src/action/action_resource.cpp @@ -147,7 +147,7 @@ local int MoveToResource(Unit* unit,const Resource* resource) // Activate the resource // goal->Data.Resource.Active++; - DebugLevel3Fn("+%d\n",goal->Data.Resource.Active); + DebugLevel3Fn("+%d\n" _C_ goal->Data.Resource.Active); if( !goal->Frame ) { // show resource working goal->Frame=resource->Frame; @@ -234,7 +234,7 @@ local int WaitInResource(Unit* unit,const Resource* resource) // source->Value-=DEFAULT_INCOMES[resource->Cost]; - DebugLevel3Fn("-%d\n",source->Data.Resource.Active); + DebugLevel3Fn("-%d\n" _C_ source->Data.Resource.Active); if( !--source->Data.Resource.Active ) { source->Frame=0; CheckUnitToBeDrawn(source); @@ -264,7 +264,7 @@ local int WaitInResource(Unit* unit,const Resource* resource) } else { // FIXME: should support more races DebugLevel0Fn("Wrong unit-type `%s' for resource `%s'\n" - ,unit->Type->Ident,DEFAULT_NAMES[resource->Cost]); + _C_ unit->Type->Ident _C_ DEFAULT_NAMES[resource->Cost]); } unit->Player->UnitTypesCount[unit->Type->Type]++; @@ -416,7 +416,7 @@ local int MoveToDepot(Unit* unit,const Resource* resource) unit->Type=*resource->Orc; } else { DebugLevel0Fn("Wrong unit-type `%s' for resource `%s'\n" - ,unit->Type->Ident,DEFAULT_NAMES[resource->Cost]); + _C_ unit->Type->Ident _C_ DEFAULT_NAMES[resource->Cost]); } unit->Player->UnitTypesCount[unit->Type->Type]++; @@ -508,7 +508,7 @@ global void HandleActionResource(Unit* unit,const Resource* resource) int ret; DebugLevel3Fn("%s(%d) SubAction %d\n" - ,unit->Type->Ident,UnitNumber(unit),unit->SubAction); + _C_ unit->Type->Ident _C_ UnitNumber(unit) _C_ unit->SubAction); switch( unit->SubAction ) { // diff --git a/src/action/action_returngoods.cpp b/src/action/action_returngoods.cpp index 783a162af..6c954b91d 100644 --- a/src/action/action_returngoods.cpp +++ b/src/action/action_returngoods.cpp @@ -78,7 +78,7 @@ global void HandleActionReturnGoods(Unit* unit) unit->Orders[0].Arg1=(void*)-1; NewResetPath(unit); unit->SubAction=65; // FIXME: hardcoded - DebugLevel3("Wait: %d\n",unit->Wait); + DebugLevel3("Wait: %d\n" _C_ unit->Wait); unit->Wait=1; return; } @@ -97,13 +97,13 @@ global void HandleActionReturnGoods(Unit* unit) unit->Orders[0].X=unit->X; unit->Orders[0].Y=unit->Y; // Return point to continue. DebugLevel3("Return to %d=%d,%d\n" - ,UnitNumber(unit->Orders[0].Goal) - ,unit->Orders[0].X,unit->Orders[0].Y); + _C_ UnitNumber(unit->Orders[0].Goal) + _C_ unit->Orders[0].X _C_ unit->Orders[0].Y); unit->Orders[0].Action=UnitActionHarvest; unit->Orders[0].Arg1=(void*)-1; NewResetPath(unit); unit->SubAction=128; // FIXME: Hardcoded - DebugLevel3("Wait: %d\n",unit->Wait); + DebugLevel3("Wait: %d\n" _C_ unit->Wait); unit->Wait=1; return; } @@ -120,13 +120,13 @@ global void HandleActionReturnGoods(Unit* unit) ++destu->Refs; } DebugLevel3("Return to %d=%d,%d\n" - ,UnitNumber(unit->Orders[0].Goal) - ,unit->Orders[0].X,unit->Orders[0].Y); + _C_ UnitNumber(unit->Orders[0].Goal) + _C_ unit->Orders[0].X _C_ unit->Orders[0].Y); unit->Orders[0].Action=UnitActionHaulOil; unit->Orders[0].Arg1=(void*)-1; NewResetPath(unit); unit->SubAction=65; // FIXME: Hardcoded - DebugLevel3("Wait: %d\n",unit->Wait); + DebugLevel3("Wait: %d\n" _C_ unit->Wait); unit->Wait=1; return; } diff --git a/src/action/action_spellcast.cpp b/src/action/action_spellcast.cpp index eab9cfcd2..ae9df7b5e 100644 --- a/src/action/action_spellcast.cpp +++ b/src/action/action_spellcast.cpp @@ -155,9 +155,9 @@ global void HandleActionSpellCast(Unit * unit) int flags; const SpellType *spell; - DebugLevel3Fn("%d %d,%d+%d+%d\n", - UnitNumber(unit),unit->Orders[0].X,unit->Orders[0].Y, - unit->Orders[0].RangeX,unit->Orders[0].RangeY); + DebugLevel3Fn("%d %d,%d+%d+%d\n" _C_ + UnitNumber(unit) _C_ unit->Orders[0].X _C_ unit->Orders[0].Y _C_ + unit->Orders[0].RangeX _C_ unit->Orders[0].RangeY); switch (unit->SubAction) { diff --git a/src/action/action_still.cpp b/src/action/action_still.cpp index 8e1553419..de6b016db 100644 --- a/src/action/action_still.cpp +++ b/src/action/action_still.cpp @@ -58,7 +58,7 @@ global void ActionStillGeneric(Unit* unit,int ground) Unit* temp; Unit* goal; - DebugLevel3Fn(" %d\n",UnitNumber(unit)); + DebugLevel3Fn(" %d\n" _C_ UnitNumber(unit)); if( unit->Removed ) { // Removed units, do nothing? // If peon is in building or unit is in transporter it is removed. @@ -161,7 +161,7 @@ global void ActionStillGeneric(Unit* unit,int ground) // Weak goal, can choose other unit, come back after attack CommandAttack(unit,goal->X,goal->Y,NULL,FlushCommands); DebugLevel3Fn(" %d Attacking in range %d\n" - ,UnitNumber(unit),unit->SubAction); + _C_ UnitNumber(unit) _C_ unit->SubAction); DebugCheck( unit->SavedOrder.Action!=UnitActionStill ); DebugCheck( unit->SavedOrder.Goal ); unit->SavedOrder.Action=UnitActionAttack; @@ -171,14 +171,14 @@ global void ActionStillGeneric(Unit* unit,int ground) unit->SavedOrder.Goal=NoUnitP; } } else if( (goal=AttackUnitsInRange(unit)) ) { - DebugLevel3Fn(" %d #%d\n",UnitNumber(goal),goal->Refs); + DebugLevel3Fn(" %d #%d\n" _C_ UnitNumber(goal) _C_ goal->Refs); // // Old goal destroyed. // temp=unit->Orders[0].Goal; if( temp && temp->Destroyed ) { DebugLevel3Fn(" destroyed unit %d #%d\n" - ,UnitNumber(temp),temp->Refs); + _C_ UnitNumber(temp) _C_ temp->Refs); RefsDebugCheck( !temp->Refs ); if( !--temp->Refs ) { ReleaseUnit(temp); @@ -189,7 +189,7 @@ global void ActionStillGeneric(Unit* unit,int ground) // New target. if( temp ) { DebugLevel3Fn(" old unit %d #%d\n" - ,UnitNumber(temp),temp->Refs); + _C_ UnitNumber(temp) _C_ temp->Refs); RefsDebugCheck( !temp->Refs ); temp->Refs--; RefsDebugCheck( !temp->Refs ); diff --git a/src/action/action_unload.cpp b/src/action/action_unload.cpp index 71e1466af..72e3bba74 100644 --- a/src/action/action_unload.cpp +++ b/src/action/action_unload.cpp @@ -166,7 +166,7 @@ found: */ local int MoveToCoast(Unit* unit) { - DebugLevel3Fn("%p\n",unit->Orders[0].Goal); + DebugLevel3Fn("%p\n" _C_ unit->Orders[0].Goal); switch( DoActionMove(unit) ) { // reached end-point? case PF_UNREACHABLE: @@ -200,7 +200,7 @@ local void LeaveTransporter(Unit* unit) Unit* goal; goal=unit->Orders[0].Goal; - DebugLevel3Fn("Goal %p\n",goal); + DebugLevel3Fn("Goal %p\n" _C_ goal); if( goal ) { unit->Orders[0].Goal=NoUnitP; if( goal->Destroyed ) { @@ -258,7 +258,7 @@ global void HandleActionUnload(Unit* unit) int i; DebugLevel3Fn("%p(%d) SubAction %d\n" - ,unit,UnitNumber(unit),unit->SubAction); + _C_ unit _C_ UnitNumber(unit) _C_ unit->SubAction); switch( unit->SubAction ) { // diff --git a/src/action/action_upgradeto.cpp b/src/action/action_upgradeto.cpp index a9af030b2..59e4ef40c 100644 --- a/src/action/action_upgradeto.cpp +++ b/src/action/action_upgradeto.cpp @@ -55,7 +55,7 @@ global void HandleActionUpgradeTo(Unit* unit) UnitType* type; const UnitStats* stats; - DebugLevel3Fn(" %d\n",UnitNumber(unit)); + DebugLevel3Fn(" %d\n" _C_ UnitNumber(unit)); player=unit->Player; if( !unit->SubAction ) { // first entry diff --git a/src/action/actions.cpp b/src/action/actions.cpp index 25550cc67..87349a710 100644 --- a/src/action/actions.cpp +++ b/src/action/actions.cpp @@ -78,11 +78,11 @@ global int UnitShowAnimation(Unit* unit,const Animation* animation) UnitUpdateHeading(unit); // FIXME: remove this!! } - DebugLevel3Fn("State %2d ",state); + DebugLevel3Fn("State %2d " _C_ state); DebugLevel3("Flags %2d Pixel %2d Frame %2d Wait %3d " - ,animation[state].Flags,animation[state].Pixel - ,animation[state].Frame,animation[state].Sleep); - DebugLevel3("Heading %d +%d,%d\n",unit->Direction,unit->IX,unit->IY); + _C_ animation[state].Flags _C_ animation[state].Pixel + _C_ animation[state].Frame _C_ animation[state].Sleep); + DebugLevel3("Heading %d +%d,%d\n" _C_ unit->Direction _C_ unit->IX _C_ unit->IY); unit->Frame+=animation[state].Frame; unit->IX+=animation[state].Pixel; @@ -125,8 +125,8 @@ global int UnitShowAnimation(Unit* unit,const Animation* animation) local void HandleActionNone(Unit* unit __attribute__((unused))) { DebugLevel1Fn("FIXME: Should not happen!\n"); - DebugLevel1Fn("FIXME: Unit (%d) %s has action none.!\n", - UnitNumber(unit),unit->Type->Ident); + DebugLevel1Fn("FIXME: Unit (%d) %s has action none.!\n" _C_ + UnitNumber(unit) _C_ unit->Type->Ident); } /** @@ -137,8 +137,8 @@ local void HandleActionNone(Unit* unit __attribute__((unused))) local void HandleActionNotWritten(Unit* unit __attribute__((unused))) { DebugLevel1Fn("FIXME: Not written!\n"); - DebugLevel1Fn("FIXME: Unit (%d) %s has action %d.!\n", - UnitNumber(unit),unit->Type->Ident,unit->Orders[0].Action); + DebugLevel1Fn("FIXME: Unit (%d) %s has action %d.!\n" _C_ + UnitNumber(unit) _C_ unit->Type->Ident _C_ unit->Orders[0].Action); } /** diff --git a/src/action/command.cpp b/src/action/command.cpp index dd7653ec7..ed2920ff3 100644 --- a/src/action/command.cpp +++ b/src/action/command.cpp @@ -939,7 +939,7 @@ global void CommandCancelTraining(Unit* unit,int slot,const UnitType* type) slot+=n; } - DebugLevel0Fn("Cancel type: %s\n",type ? type->Ident : "-any-"); + DebugLevel0Fn("Cancel type: %s\n" _C_ type ? type->Ident : "-any-"); // // Check if the unit-type is still trained? (NETWORK!) // @@ -1238,7 +1238,7 @@ global void CommandSpellCast(Unit* unit,int x,int y,Unit* dest ); DebugLevel3Fn(": %d spell-casts on %d\n" - ,UnitNumber(unit),dest ? UnitNumber(dest) : 0); + _C_ UnitNumber(unit) _C_ dest ? UnitNumber(dest) : 0); // // Check if unit is still valid? (NETWORK!) diff --git a/src/ai/ai.cpp b/src/ai/ai.cpp index 008ecc2c9..8f878b3b2 100644 --- a/src/ai/ai.cpp +++ b/src/ai/ai.cpp @@ -150,7 +150,7 @@ local void AiCheckUnits(void) if( x>e+counter[t] ) { // Request it. DebugLevel3Fn("Need %s *%d\n" _C_ - AiPlayer->UnitTypeRequests[i].Table[0]->Ident,x); + AiPlayer->UnitTypeRequests[i].Table[0]->Ident _C_ x); AiAddUnitTypeRequest(AiPlayer->UnitTypeRequests[i].Table[0], x-e-counter[t]); counter[t]+=x-e-counter[t]; @@ -175,7 +175,7 @@ local void AiCheckUnits(void) x=aiut->Want; if( x>unit_types_count[t]+counter[t] ) { // Request it. DebugLevel2Fn("Force %d need %s * %d\n" _C_ i _C_ - aiut->Type->Ident,x); + aiut->Type->Ident _C_ x); AiAddUnitTypeRequest(aiut->Type, x-unit_types_count[t]-counter[t]); counter[t]+=x-unit_types_count[t]-counter[t]; @@ -495,7 +495,7 @@ local void SaveAiType(FILE* file,const AiType* aitype) if( aitype->Next ) { SaveAiType(file,aitype->Next); } - DebugLevel3Fn("%s,%s,%s\n",aitype->Name,aitype->Race,aitype->Class); + DebugLevel3Fn("%s,%s,%s\n" _C_ aitype->Name _C_ aitype->Race _C_ aitype->Class); fprintf(file,"(define-ai \"%s\" '%s '%s\n", aitype->Name,aitype->Race ? aitype->Race : "*",aitype->Class); @@ -735,7 +735,7 @@ global void AiInit(Player* player) ait=AiTypes; ainame=AiTypeWcNames[player->AiNum]; - DebugLevel0(" %s\n",ainame); + DebugLevel0(" %s\n" _C_ ainame); // // Search correct AI type. @@ -841,7 +841,7 @@ global void CleanAi(void) // Free AiTypes. // for( aitype=AiTypes; aitype; aitype=temp ) { - DebugLevel3Fn("%s,%s,%s\n",aitype->Name,aitype->Race,aitype->Class); + DebugLevel3Fn("%s,%s,%s\n" _C_ aitype->Name _C_ aitype->Race _C_ aitype->Class); free(aitype->Name); free(aitype->Race); free(aitype->Class); diff --git a/src/ai/ai_force.cpp b/src/ai/ai_force.cpp index fe977594d..99fb24f58 100644 --- a/src/ai/ai_force.cpp +++ b/src/ai/ai_force.cpp @@ -106,7 +106,7 @@ local void AiCleanForce(int force) aitype=AiPlayer->Force[force].UnitTypes; while( aitype ) { if( aitype->Want>counter[aitype->Type->Type] ) { - DebugLevel3Fn("%d: missing %s.\n",force,aitype->Type->Ident); + DebugLevel3Fn("%d: missing %s.\n" _C_ force _C_ aitype->Type->Ident); AiPlayer->Force[force].Completed=0; } counter[aitype->Type->Type]-=aitype->Want; @@ -417,7 +417,7 @@ local void AiLoadForce(AiForce* force) if( unit->Orders[0].Action!=UnitActionBoard ) { if( table[i]->Orders[0].Action==UnitActionStill && table[i]->OrderCount==1 ) { - DebugLevel0Fn("Send transporter %d\n",i); + DebugLevel0Fn("Send transporter %d\n" _C_ i); CommandFollow(table[i],unit,FlushCommands); } CommandBoard(unit,table[i],FlushCommands); diff --git a/src/ai/ai_magic.cpp b/src/ai/ai_magic.cpp index 23fc3c1f6..5aeb9cb7e 100644 --- a/src/ai/ai_magic.cpp +++ b/src/ai/ai_magic.cpp @@ -144,7 +144,7 @@ local int AiBloodlustSpell(Unit* unit) continue; } r = MapDistanceBetweenUnits(unit, table[i]); - DebugLevel0Fn("Distance %d\n", r); + DebugLevel0Fn("Distance %d\n" _C_ r); if (r <= 1) { DebugLevel0Fn("`%s' cast bloodlust\n" _C_ unit->Type-> Ident); diff --git a/src/ai/ai_resource.cpp b/src/ai/ai_resource.cpp index 310edf2f6..6d4d92e0a 100644 --- a/src/ai/ai_resource.cpp +++ b/src/ai/ai_resource.cpp @@ -1151,10 +1151,10 @@ local void AiCollectResources(void) total=0; for( c=0; c<MaxCosts; ++c ) { total+=an[c]+rn[c]; - DebugLevel3Fn("Assigned %d = %d\n",c,an[c]); - DebugLevel3Fn("Resource %d = %d\n",c,rn[c]); + DebugLevel3Fn("Assigned %d = %d\n" _C_ c _C_ an[c]); + DebugLevel3Fn("Resource %d = %d\n" _C_ c _C_ rn[c]); } - DebugLevel3Fn("Unassigned %d of total %d\n",un,total); + DebugLevel3Fn("Unassigned %d of total %d\n" _C_ un _C_ total); // // Now assign the free workers. @@ -1165,7 +1165,7 @@ local void AiCollectResources(void) unit=unassigned[i]; for( o=c=0; c<MaxCosts; ++c ) { - DebugLevel3Fn("%d, %d, %d\n",(an[c]+rn[c])*pt,p[c],total*p[c]); + DebugLevel3Fn("%d, %d, %d\n" _C_ (an[c]+rn[c])*pt _C_ p[c] _C_ total*p[c]); if( (an[c]+rn[c])*pt<total*p[c] ) { o=c; break; diff --git a/src/ai/script_ai.cpp b/src/ai/script_ai.cpp index 2e42ad91d..4d1248a93 100644 --- a/src/ai/script_ai.cpp +++ b/src/ai/script_ai.cpp @@ -304,7 +304,9 @@ local SCM CclDefineAi(SCM list) SCM value; char* str; AiType* aitype; +#ifdef DEBUG const AiType* ait; +#endif aitype=malloc(sizeof(AiType)); aitype->Next=AiTypes; @@ -771,7 +773,7 @@ local SCM CclAiSleep(SCM value) { int i; - DebugLevel3Fn("%lu %d\n",GameCycle,AiPlayer->SleepCycles); + DebugLevel3Fn("%lu %d\n" _C_ GameCycle _C_ AiPlayer->SleepCycles); if( AiPlayer->SleepCycles ) { if( AiPlayer->SleepCycles<GameCycle ) { AiPlayer->SleepCycles=0;