-
Notifications
You must be signed in to change notification settings - Fork 50
Open
Labels
Description
This exception was thrown while I was in observer mode, it wasn't my city, or a city I destroyed, so I don't really know what happened. I only have this stacktrace
ERROR: System.NullReferenceException: Object reference not set to an instance of an object.
at C7GameData.GameData.UpdateTileOwners() in C:\Users\Stavros\Documents\C7\C7-Prototype\C7Engine\C7GameData\GameData.cs:line 142
at C7GameData.GameData.UpdateTileOwnersOnCityDestruction(City city) in C:\Users\Stavros\Documents\C7\C7-Prototype\C7Engine\C7GameData\GameData.cs:line 200
at C7Engine.CityInteractions.DestroyCity(Int32 X, Int32 Y) in C:\Users\Stavros\Documents\C7\C7-Prototype\C7Engine\EntryPoints\CityInteractions.cs:line 55
at C7GameData.MapUnit.OnEnterTile(Tile tile) in C:\Users\Stavros\Documents\C7\C7-Prototype\C7Engine\C7GameData\MapUnit.cs:line 490
at C7GameData.MapUnit.move(TileDirection dir, Boolean wait) in C:\Users\Stavros\Documents\C7\C7-Prototype\C7Engine\C7GameData\MapUnit.cs:line 651
at C7GameData.UnitAI.PlayTurn(Player player, MapUnit unit) in C:\Users\Stavros\Documents\C7\C7-Prototype\C7Engine\C7GameData\UnitAI.cs:line 40
at C7Engine.PlayerAI.DoUnitActions(Player player) in C:\Users\Stavros\Documents\C7\C7-Prototype\C7Engine\AI\PlayerAI.cs:line 133
at C7Engine.PlayerAI.PlayTurn(Player player, Random rng, List`1 techs) in C:\Users\Stavros\Documents\C7\C7-Prototype\C7Engine\AI\PlayerAI.cs:line 44
at C7Engine.TurnHandling.PlayPlayerTurns(GameData gameData, Boolean firstTurn) in C:\Users\Stavros\Documents\C7\C7-Prototype\C7Engine\EntryPoints\TurnHandling.cs:line 95
I am only posting this in case it happens to someone else, and just want to have a record of it.
In case the stacktrace has wrong line numbers, because I am working on a modified branch, the exception was thrown here
OpenCiv3/C7Engine/C7GameData/GameData.cs
Line 142 in 86b04f8
| t.owningCity.owner.tileKnowledge.AddTilesToKnown(t, recomputeActiveTiles); |
My guess is that it has something to do with the order in which we remove tile ownership from the player, before trying to re-assign tiles to other cities, or there is simply a gap in the logic to check for null when calling UpdateTileOwners()
Reactions are currently unavailable