-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
Bugfix in McvManagerBotModule.cs. Game can crash at start if you play against lot of AI Exception of type `System.NullReferenceException`: Object reference not set to an instance of an object.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -58,6 +58,10 @@ public CPos GetBaseCenter(bool random = false) | |
var randomBotCYard = constructionYards.Actors. | ||
RandomOrDefault(world.LocalRandom); | ||
|
||
//important! Otherwise game can crash at the beginning of a skirmish vs lot of AI | ||
Check failure on line 61 in OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs GitHub Actions / Windows (.NET 6.0)
Check failure on line 61 in OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs GitHub Actions / Windows (.NET 6.0)
|
||
if (randomBotCYard == null) | ||
return CPos.Zero; | ||
|
||
var newBaseCenterLocation = world.Map.FindTilesInAnnulus(randomBotCYard.Location, | ||
Info.MaxBaseRadius, world.Map.Grid.MaximumTileSearchRange) | ||
.Where(a => resourceLayer.GetResource(a).Type != null) | ||
|
@@ -76,7 +80,7 @@ public CPos GetBaseCenter(bool random = false) | |
IBotRequestUnitProduction[] requestUnitProduction; | ||
IResourceLayer resourceLayer; | ||
CPos initialBaseCenter; | ||
int scanInterval; | ||
int scanInterval=20; | ||
Check failure on line 83 in OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs GitHub Actions / Windows (.NET 6.0)
Check failure on line 83 in OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs GitHub Actions / Windows (.NET 6.0)
Check failure on line 83 in OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs GitHub Actions / Windows (.NET 6.0)
Check failure on line 83 in OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs GitHub Actions / Windows (.NET 6.0)
Check failure on line 83 in OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs GitHub Actions / Windows (.NET 6.0)
Check failure on line 83 in OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs GitHub Actions / Windows (.NET 6.0)
Check failure on line 83 in OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs GitHub Actions / Windows (.NET 6.0)
Check failure on line 83 in OpenRA.Mods.Common/Traits/BotModules/McvManagerBotModule.cs GitHub Actions / Windows (.NET 6.0)
|
||
bool firstTick = true; | ||
|
||
public McvManagerBotModule(Actor self, McvManagerBotModuleInfo info) | ||
|
@@ -116,8 +120,7 @@ void IBotTick.BotTick(IBot bot) | |
DeployMcvs(bot, false); | ||
firstTick = false; | ||
} | ||
|
||
if (--scanInterval <= 0) | ||
else if (--scanInterval <= 0) | ||
{ | ||
scanInterval = Info.ScanForNewMcvInterval; | ||
DeployMcvs(bot, true); | ||
|