|
Britbot
|
This function checks if it is possible for a given group to be in certain location without pirates getting in enemy zone.
DAMM RIGHT IT IS
Definition at line 77 of file Extentions.cs. {
//Logger.BeginTime("IsPassableEnough");
//going over all the pirates in the group
foreach (int pirate in group.Pirates)
{
//calculate differance vector between the Group's center and the given pirate
HeadingVector difference = HeadingVector.CalcDifference(group.FindCenter(true)
, Bot.Game.GetMyPirate(pirate).Loc);
//calculate the location of this pirate if the group is placed in loc
Location newLocation = HeadingVector.AddvanceByVector(loc, difference);
//check if isn't passable, if so return false
if (!game.IsInMap(newLocation) || !game.IsPassable(newLocation))
return false;
}
//Logger.StopTime("IsPassableEnough");
//otherwise return true since all the pirates can fit here
return true;
/*
//go over the locations and check if they are passable.
for (int deltaX = -passRadius; deltaX <= passRadius; deltaX++)
{
for (int deltaY = -passRadius + Math.Abs(deltaX); deltaY <= passRadius - Math.Abs(deltaX); deltaY++)
{
Location testLocation = new Location(loc.Row + deltaY, loc.Col + deltaX);
//check if passable
if (!game.IsInMap(testLocation) || !game.IsPassable(testLocation))
return false;
}
}
*/
//return true if Ok
}
|
1.7.6.1