Follow-up Comment #5, patch #3346 (project freeciv):

I redesigned the rank_users() function. Any ranking is now correct, after
_endturn_, too.
The attached patch to consider is now score_system.diff.

In the function, now I distinguish two conditions:
1) rank_users() is called the traditional way, when a game is over for space
race or conquest. I call this a "victory condition";
2) the functions is called with a flag set, to identify that the game has been
interrupted some way, and no victory condition should be analyzed to rank
players (alive / space). This happens when endturn is reached, when /endgame
is issued, and, potentially, when just the parameter flag is set.

In case 2), victory and winners/losers sorting are determined as:
  For each team is calculated the sum of the scores of any
  belonging member which is alive and has not surrendered;
  all the players in the team with the highest sum of scores win.

To specify the first or the second method of calculation the prototype of the
function now is:
  void rank_users(bool interrupt);
* interrupt == FALSE: game ended because of explicit victory, use the
traditional calculation algorithm;
* interrupt == TRUE: game interrupted, calculate teams scores.

The only call to rank_users() in the whole server is done by
/server/srv_main.c::srv_running(). Here I adjusted the _interrupt_ flag.

Touched files are:
* server/score.h
* server/score.c
* server/srv_main.c

(file #15908)

Additional Item Attachment:

File name: score_system.diff              Size:6 KB


Reply to this item at:


  Message sent via/by Gna!

Freeciv-dev mailing list

Reply via email to