Follow-up Comment #6, bug #18886 (project freeciv):

Here is an explanation for this fix:

In freeciv 2.2 and before the number of players was limited. A player could
only be added and never be removed. Thus, the player shuffle information was
saved as a simple list <index> => <player id>. There <index> is a counter from
0 to the number of players. The remaining numbers up to the limit of 32 there
simply automatically filled at the time of loading the game.

After player slots there introduced, the logic was not changed. It does work
fine as long as no player is _removed_. If one player is removed, the highest
player index is equal to the number of players. At the time of loading a
savegame, the available numbers fill the shuffle array index 0 to (number of
players - 1). The remaining numbers are automatically filled with the
remaining indices. As result, one number (= number of players) is used twice.
This would print an error and force a reshuffle of the players.

Example for 3 players:

player shuffle:
0 => player index 1
1 => player index 2
2 => player index 0
(remaining numbers as 3 => 3, 4 => 4 ...)

remove player 1 (saved like this in the savegame):
0 => player index 2
1 => player index 0
(remaining numbers as 2 => 2, 3 => 3, 4 => 4 ...)

reload (old):
0 => player index 2
1 => player index 0
2 => (automatically set) index 2
3 => (automatically set) index 3
(remaining numbers as 4 => 4, 5 =>5 ...)

The new algorithm fills the remaining indices with the unused numbers ...

I hope I the explanation helps. If not I will try it again.

    _______________________________________________________

Reply to this item at:

  <http://gna.org/bugs/?18886>

_______________________________________________
  Nachricht geschickt von/durch Gna!
  http://gna.org/


_______________________________________________
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev

Reply via email to