~widelands-dev/widelands/trunk

Viewing all changes in revision 4835.

  • Committer: sigra
  • Date: 2010-01-04 03:32:50 UTC
  • Revision ID: git-v1:82d9f24adcbde7d19f90434aac5f96c7df58aa10
Fix bug #2924988 (crash when initialization removed between game preload and game start) reported by qcs - Qcumber-some.

Before the game is set up, the tribes are preloaded, which means that it is checked which tribes exist and which initializations each tribe has, so that each player can select a tribe and an initialization. The selected initialization is saved as an index. When the game is finally started, the tribes are fully read. Then a player is initialized with the initialization with the stored index.

But if for example a player has selected the initialization with index 1, then the tribe is edited so that there is no initialization with that index (such as only the initialization with index 0 remains), then the game i started, the tribe fully read, the player initialized with initialization 1, an assertion will fail in debug builds (and an out-of-range access will be done in release builds.

Now throw game_data_error when this happens. Of course it may still behave a bit unexpected if a player selects initialization a with index 0 and then initializaion a is removed and initialization b has index 0, but at least a crash is fixed.

Also make donkey breeding less broken.

git-svn-id: https://widelands.svn.sourceforge.net/svnroot/widelands/trunk@4870 37b2a8de-5219-0410-9f54-a31bc463ab9c

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: