ekolis / FrEee

An open source clone of the classic 4X game Space Empires IV.
http://edkolis.com/freee
47 stars 11 forks source link

Error when selecting a planet #28

Open ekolis opened 4 years ago

ekolis commented 4 years ago

Describe the bug Error when selecting a planet. fmbrawl_14_0001.zip

To Reproduce Steps to reproduce the behavior:

  1. Open attached savegame
  2. Navigate to the Sophenis system.
  3. Click the planet Sophenis VI.

Expected behavior A report on the planet appears.

Actual behavior Error message: image

ekolis commented 4 years ago

Seems to happen when you click a random AI empire's homeworld.

fire-eggs commented 4 years ago

I started a game with "quick start". The error occurs frequently when clicking on my own planets.

A work-around (as it does not address the root cause) is in Pictures.cs, GetIcon(this Race race), add the following code:

if (race.PopulationIconName == null)
    return GetGenericImage(race.GetType());
ekolis commented 4 years ago

Oh, really? Thanks for catching that, I thought it only happened with "AI" empires. Also thanks for the fix, I'll have to implement that at some point, and also fix the quickstart empire so there is a population icon name selected for the player.

ekolis commented 4 years ago

I added the population icon fix, I don't see anything wrong with the quickstart empire...

fire-eggs commented 4 years ago

I'll revisit when I have a chance.

Skyburn1 commented 4 years ago

Perhaps related? I click on Mveloem IX in the 1v1 game.

System.Collections.Generic.KeyNotFoundException HResult=0x80131577 Message=The given key was not present in the dictionary. Source=mscorlib StackTrace: at System.ThrowHelper.ThrowKeyNotFoundException() at System.Collections.Generic.Dictionary`2.get_Item(TKey key) at FrEee.Game.Objects.Space.Planet.get_PopulationChangePerTurnPerRace() in C:\Games\FrEee1\FrEee\Game\Objects\Space\Planet.cs:line 570 at FrEee.Game.Objects.Space.Planet.get_PopulationChangePerTurn() in C:\Games\FrEee1\FrEee\Game\Objects\Space\Planet.cs:line 548 at FrEee.WinForms.Controls.PlanetReport.Bind() in C:\Games\FrEee1\FrEee.WinForms\Controls\PlanetReport.cs:line 99 at FrEee.WinForms.Controls.PlanetReport.set_Planet(Planet value) in C:\Games\FrEee1\FrEee.WinForms\Controls\PlanetReport.cs:line 38 at FrEee.WinForms.Controls.PlanetReport..ctor(Planet planet) in C:\Games\FrEee1\FrEee.WinForms\Controls\PlanetReport.cs:line 26 at FrEee.WinForms.Forms.MainGameForm.CreateSpaceObjectReport(ISpaceObject sobj) in C:\Games\FrEee1\FrEee.WinForms\Forms\MainGameForm.cs:line 627 at FrEee.WinForms.Forms.MainGameForm.set_SelectedSpaceObject(ISpaceObject value) in C:\Games\FrEee1\FrEee.WinForms\Forms\MainGameForm.cs:line 95 at FrEee.WinForms.Forms.MainGameForm.starSystemView_SectorSelected(StarSystemView sender, Sector sector) in C:\Games\FrEee1\FrEee.WinForms\Forms\MainGameForm.cs:line 1607 at FrEee.WinForms.Controls.StarSystemView.set_SelectedSector(Sector value) in C:\Games\FrEee1\FrEee.WinForms\Controls\StarSystemView.cs:line 53 at FrEee.WinForms.Forms.MainGameForm.starSystemView_SectorClicked(StarSystemView sender, Sector sector) in C:\Games\FrEee1\FrEee.WinForms\Forms\MainGameForm.cs:line 1585 at FrEee.WinForms.Controls.StarSystemView.StarSystemView_MouseDowned(Object sender, MouseEventArgs e) in C:\Games\FrEee1\FrEee.WinForms\Controls\StarSystemView.cs:line 454 at System.Windows.Forms.MouseEventHandler.Invoke(Object sender, MouseEventArgs e) at System.Windows.Forms.Control.OnMouseDown(MouseEventArgs e) at System.Windows.Forms.Control.WmMouseDown(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

ekolis commented 4 years ago

The issue Skyburn reported is due to attempting to retrieve fogged data about a colony's population, e.g. their growth rate and happiness. I fixed that but the original issue may still remain.

fire-eggs commented 4 years ago

I have not been able to repro the issue with my planets. I'll return if I see it again.

[Current games, I've not yet encountered an alien race so haven't tested that scenario.]

ekolis commented 3 years ago

Hmm. When I try to load the savegame which is attached, I get an error trying to load some Mono.Posix assembly. I wonder if game loading in general is broken, or something is wrong with this particular save?