disable bot debug by default

This commit is contained in:
Chris Forbes
2010-11-01 20:36:52 +13:00
parent 3fc4d1b219
commit eac548ac8b
2 changed files with 16 additions and 9 deletions

View File

@@ -38,6 +38,7 @@ namespace OpenRA.GameRules
public class DebugSettings public class DebugSettings
{ {
public bool BotDebug = false;
public bool PerfGraph = false; public bool PerfGraph = false;
public bool RecordSyncReports = true; public bool RecordSyncReports = true;
public float LongTickThreshold = 0.001f; public float LongTickThreshold = 0.001f;

View File

@@ -94,6 +94,12 @@ namespace OpenRA.Mods.RA
BuildState bstate = BuildState.WaitForFeedback; BuildState bstate = BuildState.WaitForFeedback;
BuildState dstate = BuildState.WaitForFeedback; BuildState dstate = BuildState.WaitForFeedback;
public static void BotDebug(string s, params object[] args)
{
if (Game.Settings.Debug.BotDebug)
Game.Debug(s, args);
}
/* called by the host's player creation code */ /* called by the host's player creation code */
public void Activate(Player p) public void Activate(Player p)
{ {
@@ -135,11 +141,11 @@ namespace OpenRA.Mods.RA
if (best != null) if (best != null)
{ {
Game.Debug("AI: Need more power, so {0} is best choice.".F(best.Name)); BotDebug("AI: Need more power, so {0} is best choice.", best.Name);
return best; return best;
} }
else else
Game.Debug("AI: Need more power, but can't build anything that produces it."); BotDebug("AI: Need more power, but can't build anything that produces it.");
} }
var myBuildings = p.World.Queries.OwnedBy[p].WithTrait<Building>() var myBuildings = p.World.Queries.OwnedBy[p].WithTrait<Building>()
@@ -268,7 +274,7 @@ namespace OpenRA.Mods.RA
foreach (var a in newUnits) foreach (var a in newUnits)
{ {
Game.Debug("AI: Found a newly built unit"); BotDebug("AI: Found a newly built unit");
unitsHangingAroundTheBase.Add(a); unitsHangingAroundTheBase.Add(a);
activeUnits.Add(a); activeUnits.Add(a);
} }
@@ -277,7 +283,7 @@ namespace OpenRA.Mods.RA
// (don't bother leaving any behind for defense.) // (don't bother leaving any behind for defense.)
if (unitsHangingAroundTheBase.Count > 8) if (unitsHangingAroundTheBase.Count > 8)
{ {
Game.Debug("Launch an attack."); BotDebug("Launch an attack.");
var attackTarget = ChooseEnemyTarget(); var attackTarget = ChooseEnemyTarget();
if (attackTarget == null) if (attackTarget == null)
@@ -353,7 +359,7 @@ namespace OpenRA.Mods.RA
world.IssueOrder(new Order("DeployTransform", mcv)); world.IssueOrder(new Order("DeployTransform", mcv));
} }
else else
Game.Debug("AI: Can't find the MCV."); BotDebug("AI: Can't find the MCV.");
} }
//Build a random unit of the given type. Not going to be needed once there is actual AI... //Build a random unit of the given type. Not going to be needed once there is actual AI...
@@ -414,7 +420,7 @@ namespace OpenRA.Mods.RA
} }
else else
{ {
Game.Debug("AI: Starting production of {0}".F(item.Name)); BotDebug("AI: Starting production of {0}".F(item.Name));
bstate = BuildState.WaitForProduction; bstate = BuildState.WaitForProduction;
world.IssueOrder(Order.StartProduction(queue.self, item.Name, 1)); world.IssueOrder(Order.StartProduction(queue.self, item.Name, 1));
} }
@@ -435,7 +441,7 @@ namespace OpenRA.Mods.RA
var location = ChooseBuildLocation(currentBuilding); var location = ChooseBuildLocation(currentBuilding);
if (location == null) if (location == null)
{ {
Game.Debug("AI: Nowhere to place {0}".F(currentBuilding.Item)); BotDebug("AI: Nowhere to place {0}".F(currentBuilding.Item));
world.IssueOrder(Order.CancelProduction(queue.self, currentBuilding.Item, 1)); world.IssueOrder(Order.CancelProduction(queue.self, currentBuilding.Item, 1));
} }
else else
@@ -476,7 +482,7 @@ namespace OpenRA.Mods.RA
} }
else else
{ {
Game.Debug("AI: Starting production of {0}".F(item.Name)); BotDebug("AI: Starting production of {0}".F(item.Name));
dstate = BuildState.WaitForProduction; dstate = BuildState.WaitForProduction;
world.IssueOrder(Order.StartProduction(queue.self, item.Name, 1)); world.IssueOrder(Order.StartProduction(queue.self, item.Name, 1));
} }
@@ -497,7 +503,7 @@ namespace OpenRA.Mods.RA
var location = ChooseBuildLocation(currentBuilding); var location = ChooseBuildLocation(currentBuilding);
if (location == null) if (location == null)
{ {
Game.Debug("AI: Nowhere to place {0}".F(currentBuilding.Item)); BotDebug("AI: Nowhere to place {0}".F(currentBuilding.Item));
world.IssueOrder(Order.CancelProduction(queue.self, currentBuilding.Item, 1)); world.IssueOrder(Order.CancelProduction(queue.self, currentBuilding.Item, 1));
} }
else else