rajko-horvat / OpenCiv1

Open source rewrite of the original Civilization 1 Game designed by Sid Meier and Bruce Shelley in year 1991
MIT License
225 stars 11 forks source link

Repeatable crash in CityWorker.F0_1d12_0045_ProcessCityState #73

Closed elliotkendall closed 1 week ago

elliotkendall commented 2 weeks ago

Describe the bug Fairly late in a game (1909, tech tree complete), I'm seeing increasingly frequent crashes. Was generally possible to reload and play maybe another turn or two before it happened again, but I've now got a 100% repeatable crash.

To Reproduce Load the attached game. Press S to sentry the Artillery unit in Chapultepec.

Expected behavior The unit should go into sentry mode and the game should continue.

Screenshots The log shows:

                Exception message: Index was outside the bounds of the array.
                Exception source: OpenCiv1
                Exception stack trace:    at OpenCiv1.CityWorker.F0_1d12_0045_ProcessCityState(Int16 cityID, Int16 flag) in /Users/ekenda2/OpenCiv1/src/CivGame/Game/CityWorker.cs:line 40
   at OpenCiv1.Segment_1ade.F0_1ade_0006(Int16 playerID) in /Users/ekenda2/OpenCiv1/src/CivGame/Game/Segment_1ade.cs:line 62
   at OpenCiv1.Segment_1238.F0_1238_0092() in /Users/ekenda2/OpenCiv1/src/CivGame/Game/Segment_1238.cs:line 163
   at OpenCiv1.Segment_11a8.F0_11a8_0008_Main() in /Users/ekenda2/OpenCiv1/src/CivGame/Game/Segment_11a8.cs:line 147
   at OpenCiv1.CivGame.Start() in /Users/ekenda2/OpenCiv1/src/CivGame/CivGame.cs:line 1116
   at OpenCiv1.UI.MainWindow.GameThread() in /Users/ekenda2/OpenCiv1/src/UI/MainWindow.axaml.cs:line 544

Desktop (please complete the following information):

.NET SDKs installed: 8.0.104 [/opt/homebrew/Cellar/dotnet/8.0.4/libexec/sdk]

.NET runtimes installed: Microsoft.AspNetCore.App 8.0.4 [/opt/homebrew/Cellar/dotnet/8.0.4/libexec/shared/Microsoft.AspNetCore.App] Microsoft.NETCore.App 8.0.4 [/opt/homebrew/Cellar/dotnet/8.0.4/libexec/shared/Microsoft.NETCore.App] save.zip

rajko-horvat commented 2 weeks ago

Thank you for testing OpenCiv1.

Your bug details help a lot. I will check what the problem is and how to fix it.

rajko-horvat commented 2 weeks ago

I have made a fix for the issue. Please clone the Master and compile with a Debug flag