SWY1985 / CivOne

An open source implementation of Sid Meier's Civilization.
http://www.civone.org/
Creative Commons Zero v1.0 Universal
244 stars 49 forks source link

Starting new game after loading crashes game #383

Closed AlexFolland closed 7 years ago

AlexFolland commented 7 years ago

Loading a game wasn't working. Pressing Enter while highlighting a game wasn't giving any feedback, nor clicking. I know these are valid saves because some of them are from Civilization. Anyway, after doing that, I figured I should just start a new game to test what I wanted to test, but it crashed doing so. Here's the full console output. I'll check for where I should post the other issue and/or open a new ticket about it.

-------------------------------------------------------------------
You may only use the Microsoft .NET Core Debugger (vsdbg) with
Visual Studio Code, Visual Studio or Visual Studio for Mac software
to help you develop and test your applications.
-------------------------------------------------------------------
Game Start
Setting Loaded - FullScreen: 0
Setting Loaded - Scale: 4
Setting Loaded - AspectRatio: 0
Setting Loaded - DebugMenu: 1
Setting Loaded - CursorType: 0
Loaded e:\games\civone\data\sp257.pic
Warning: Character width larger than bytes per character. (ID: 95, Width: 9)
Loaded e:\games\civone\data\iconpg2.pic
Loaded e:\games\civone\data\iconpg3.pic
Loaded e:\games\civone\data\iconpg6.pic
Loaded e:\games\civone\data\iconpg5.pic
Loaded e:\games\civone\data\iconpg1.pic
Loaded e:\games\civone\data\iconpg4.pic
Loaded e:\games\civone\data\iconpg8.pic
Loaded e:\games\civone\data\iconpg7.pic
Loaded e:\games\civone\data\citypix2.pic
Loaded e:\games\civone\data\sp299.pic
Loaded e:\games\civone\data\sp257.pic
Warning: Character width larger than bytes per character. (ID: 95, Width: 9)
Loaded e:\games\civone\data\birth0.pic
Loaded e:\games\civone\data\birth1.pic
Loaded e:\games\civone\data\logo.pic
Checking data files...
- Done, all files exist
Checking data files...
- Done, all files exist
Civilopedia: Preloading articles...
Loaded e:\games\civone\data\iconpg4.pic
Loaded e:\games\civone\data\sp299.pic
Loaded e:\games\civone\data\iconpg5.pic
Loaded e:\games\civone\data\iconpg8.pic
Loaded e:\games\civone\data\iconpg6.pic
Loaded e:\games\civone\data\iconpg1.pic
Loaded e:\games\civone\data\iconpg3.pic
Loaded e:\games\civone\data\iconpg2.pic
Credits: "A MICROPROSE PRESENTATION"
Loaded e:\games\civone\data\iconpg7.pic
Loaded e:\games\civone\data\iconpgd.pic
Loaded e:\games\civone\data\iconpgb.pic
Loaded e:\games\civone\data\iconpga.pic
Loaded e:\games\civone\data\iconpga.pic
Loaded e:\games\civone\data\iconpgb.pic
Loaded e:\games\civone\data\iconpge.pic
Loaded e:\games\civone\data\iconpgd.pic
Loaded e:\games\civone\data\iconpgb.pic
Loaded e:\games\civone\data\iconpgc.pic
Loaded e:\games\civone\data\iconpgd.pic
Loaded e:\games\civone\data\iconpgc.pic
Loaded e:\games\civone\data\iconpgc.pic
Loaded e:\games\civone\data\iconpga.pic
Loaded e:\games\civone\data\iconpgb.pic
Loaded e:\games\civone\data\iconpga.pic
Loaded e:\games\civone\data\iconpge.pic
Loaded e:\games\civone\data\iconpge.pic
Loaded e:\games\civone\data\iconpgc.pic
Loaded e:\games\civone\data\iconpgc.pic
Loaded e:\games\civone\data\iconpga.pic
Loaded e:\games\civone\data\iconpgd.pic
Loaded e:\games\civone\data\iconpge.pic
Loaded e:\games\civone\data\iconpgd.pic
Loaded e:\games\civone\data\iconpgb.pic
Loaded e:\games\civone\data\iconpgd.pic
Loaded e:\games\civone\data\iconpgc.pic
Loaded e:\games\civone\data\iconpga.pic
Loaded e:\games\civone\data\iconpgb.pic
Civilopedia: Preloading done!
Main Menu: Load a Saved Game
Load game: Emperor Napoleon, French/1 AD
Map instance created
Map: Loading e:\games\civone\saves\C\CIVIL8.MAP - Random seed: 0
Loaded e:\games\civone\saves\C\CIVIL8.MAP
Map: Placing goody huts
Map: Calculating land value
Map: Ready
Load game: Emperor Napoleon, French/1000 BC
Map: Loading e:\games\civone\saves\C\CIVIL7.MAP - Random seed: 0
Loaded e:\games\civone\saves\C\CIVIL7.MAP
Map: Placing goody huts
Map: Calculating land value
Map: Ready
Load game: Emperor Napoleon, French/1000 BC
Map: Loading e:\games\civone\saves\C\CIVIL7.MAP - Random seed: 0
Loaded e:\games\civone\saves\C\CIVIL7.MAP
Map: Placing goody huts
Map: Calculating land value
Map: Ready
Load game: Emperor Napoleon, French/1000 BC
Map: Loading e:\games\civone\saves\C\CIVIL7.MAP - Random seed: 0
Loaded e:\games\civone\saves\C\CIVIL7.MAP
Map: Placing goody huts
Map: Calculating land value
Map: Ready
Load game: Emperor Napoleon, French/1000 BC
Map: Loading e:\games\civone\saves\C\CIVIL7.MAP - Random seed: 0
Loaded e:\games\civone\saves\C\CIVIL7.MAP
Map: Placing goody huts
Map: Calculating land value
Map: Ready
Load game: Emperor Napoleon, French/2000 BC
Map: Loading e:\games\civone\saves\C\CIVIL6.MAP - Random seed: 0
Loaded e:\games\civone\saves\C\CIVIL6.MAP
Map: Placing goody huts
Map: Calculating land value
Map: Ready
Load game: Emperor Montezuma, Aztecs/3000 BC
Map: Loading e:\games\civone\saves\C\CIVIL5.MAP - Random seed: 7
Loaded e:\games\civone\saves\C\CIVIL5.MAP
Map: Placing goody huts
Map: Calculating land value
Map: Ready
Loaded e:\games\civone\data\slam2.pic
Game instance loaded (difficulty: 4, competition: 1)
- Player 0 is Atilla of the Barbarians
- Player 1 is Stalin of the Russians
Turn 50: 3000 BC
Load game: Prince M.Gandhi, Indians/2480 BC
ERROR: Game instance already exists
Load game: Chief Caesar, Romans/520 AD
ERROR: Game instance already exists
Load game: Chief Caesar, Romans/20 BC
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/320 BC
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/320 BC
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/320 BC
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/320 BC
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/320 BC
ERROR: Game instance already exists
Load game: Emperor Napoleon, French/1 AD
ERROR: Game instance already exists
Load game: Emperor Napoleon, French/1 AD
ERROR: Game instance already exists
Load game: Emperor Napoleon, French/1 AD
ERROR: Game instance already exists
Empty save file, cancel
Main Menu: Load a Saved Game
Load game: Chief Stalin, Russians/1470 AD
ERROR: Game instance already exists
Load game: Emperor Stalin, Russians/760 AD
ERROR: Game instance already exists
Load game: Emperor Stalin, Russians/760 AD
ERROR: Game instance already exists
Load game: Emperor Stalin, Russians/760 AD
ERROR: Game instance already exists
Load game: Emperor Stalin, Russians/760 AD
ERROR: Game instance already exists
Load game: Emperor Stalin, Russians/760 AD
ERROR: Game instance already exists
Load game: Emperor Stalin, Russians/760 AD
ERROR: Game instance already exists
Load game: Emperor Stalin, Russians/760 AD
ERROR: Game instance already exists
Load game: Emperor Stalin, Russians/760 AD
ERROR: Game instance already exists
Cancel
Main Menu: Load a Saved Game
Load game: Chief Stalin, Russians/1 AD
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/1000 AD
ERROR: Game instance already exists
Load game: Prince Rico, Russians/1500 AD
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/1 AD
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/1000 BC
ERROR: Game instance already exists
Load game: Prince Abe Lincoln, Americans/2000 BC
ERROR: Game instance already exists
Load game: Prince Abe Lincoln, Americans/3000 BC
ERROR: Game instance already exists
Load game: Prince Rico, Russians/1974 AD
ERROR: Game instance already exists
Load game: Emperor Peter, Zulus/1600 BC
ERROR: Game instance already exists
Load game: Emperor Ri, Russians/1907 AD
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/1470 AD
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/1470 AD
ERROR: Game instance already exists
Load game: Prince Abe Lincoln, Americans/2000 BC
ERROR: Game instance already exists
Load game: Prince Abe Lincoln, Americans/2000 BC
ERROR: Game instance already exists
Load game: Prince Abe Lincoln, Americans/2000 BC
ERROR: Game instance already exists
Load game: Prince Abe Lincoln, Americans/2000 BC
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/1000 BC
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/1000 BC
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/1000 BC
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/1 AD
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/1 AD
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/1000 AD
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/1000 AD
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/1 AD
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/1000 AD
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/1000 AD
ERROR: Game instance already exists
Load game: Chief Stalin, Russians/1 AD
ERROR: Game instance already exists
Cancel
Main Menu: Start a New Game
ERROR: Map is already loaded/generated
Loaded e:\games\civone\data\birth1.pic
Loaded e:\games\civone\data\birth2.pic
Loaded e:\games\civone\data\birth3.pic
Loaded e:\games\civone\data\birth4.pic
Loaded e:\games\civone\data\birth5.pic
Loaded e:\games\civone\data\birth6.pic
Loaded e:\games\civone\data\birth7.pic
Loaded e:\games\civone\data\birth8.pic
Intro: "In the beginning,"
Loaded e:\games\civone\data\diffs.pic
Difficulty: Emperor (toughest)
Competition: 7 Civilizations
Tribe: Zulu
ERROR: Game instance already exists
Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
   at CivOne.Screens.NewGame.HasUpdate(UInt32 gameTick) in e:\games\civone\src\Screens\NewGame.cs:line 197
   at CivOne.Window.<get_HasUpdate>b__24_2(IScreen x) in e:\games\civone\src\Window.cs:line 108
   at System.Linq.Enumerable.Count[TSource](IEnumerable`1 source, Func`2 predicate)
   at CivOne.Window.get_HasUpdate() in e:\games\civone\src\Window.cs:line 108
   at CivOne.Window.OnUpdateFrame(FrameEventArgs args) in e:\games\civone\src\Window.cs:line 318
   at OpenTK.GameWindow.RaiseUpdateFrame(Double elapsed, Double& timestamp)
   at OpenTK.GameWindow.DispatchUpdateAndRenderFrame(Object sender, EventArgs e)
   at OpenTK.GameWindow.Run(Double updates_per_second, Double frames_per_second)
   at CivOne.Program.Main(String[] args) in e:\games\civone\src\Program.cs:line 36
SWY1985 commented 7 years ago

The game instance has been created but the game didn't load correctly. This will not be an issue once Load Games are working correctly. #153

AlexFolland commented 7 years ago

Instead of crashing when there is a game instance already, the game should handle the failure elegantly, preferably by deleting (and backing up preferably, but that adds complexity) the current game instance. Otherwise, you won't be able to start a new game without restarting the entire client. It will be a problem if a new feature of returning to the main menu without restarting the application is implemented.

SWY1985 commented 7 years ago

I've created a solution: #384