[Freeciv-Dev] Re: (PR#12668) Changes in how to win the game...
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] Re: (PR#12668) Changes in how to win the game... |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Tue, 29 Mar 2005 02:00:30 -0800 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12668 >
Ok, I try again with a new patch.
What it does:
- /endgame now withdraws you from the game, killing all your units and
cities (except cities belonging to another player, those are given back),
unless the command is used from the server command line, in which case it
ends the game for all. This is what you should use when you concede the
game.
- If all players are allied at the end of a turn, the game ends in a draw
among these players. I think this is the same as an 'allied victory'.
- It does _not_ change endyear as it is treated in cvs; if you run out of
endyear, the game ends in a draw among the surviving players. If you want
to concede the game, use /endgame. I think this is correct for what should
happen if you really did run out of years, as opposed to how 'endyear' is
currently used, which is deprecated now by /endgame.
- Per
Index: server/commands.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/commands.c,v
retrieving revision 1.7
diff -u -r1.7 commands.c
--- server/commands.c 20 Mar 2005 09:08:48 -0000 1.7
+++ server/commands.c 29 Mar 2005 09:38:21 -0000
@@ -312,10 +312,11 @@
},
{"endgame", ALLOW_CTRL,
/* TRANS: translate text between <> only */
- N_("endgame <player1 player2 player3 ...>"),
- N_("End the game. If players are listed, these win the game."),
- N_("This command ends the game immediately and credits the given players, "
- "if any, with winning it.")
+ N_("endgame"),
+ N_("Withdraw from the game."),
+ N_("Use this command to concede a game. You will be removed from the "
+ "game along with all your units and cities. If this command is "
+ "issued from the server command line, it ends the game immediately.")
},
{"remove", ALLOW_CTRL,
/* TRANS: translate text between <> only */
Index: server/gamelog.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gamelog.c,v
retrieving revision 1.44
diff -u -r1.44 gamelog.c
--- server/gamelog.c 22 Jan 2005 19:45:44 -0000 1.44
+++ server/gamelog.c 29 Mar 2005 09:38:21 -0000
@@ -533,15 +533,6 @@
: "Game ended in victory for the %s",
get_nation_name_plural(pplayer->nation));
break;
- case GL_ALLIEDWIN:
- my_snprintf(buf, sizeof(buf), "<type>%s</type>", endgame_strings[num]);
- players_iterate(aplayer) {
- if (aplayer->is_alive) {
- cat_snprintf(buf, sizeof(buf), "<n>%d</n>", aplayer->player_no);
- }
- } players_iterate_end;
- my_snprintf(msg, sizeof(msg), "Game ended in allied victory");
- break;
case GL_TEAMWIN:
pteam = va_arg(args, struct team *);
my_snprintf(buf, sizeof(buf), "<type>%s</type>", endgame_strings[num]);
@@ -612,8 +603,8 @@
Every time we save the game, we also output to the gamelog the score
and status info.
**************************************************************************/
-static void gamelog_status(char *buffer, int len) {
-
+static void gamelog_status(char *buffer, int len)
+{
int i, count = 0, highest = -1;
struct player *highest_plr = NULL;
struct player_score_entry size[game.nplayers], rank[game.nplayers];
@@ -632,20 +623,6 @@
}
} players_iterate_end;
- /* Draws and team victories */
- count = 0;
- players_iterate(pplayer) {
- if (!is_barbarian(pplayer)) {
- if ((BV_ISSET_ANY(srvarg.draw)
- && BV_ISSET(srvarg.draw, pplayer->player_no))
- || players_on_same_team(pplayer, highest_plr)) {
- /* We win a shared victory, so equal the score. */
- rank[count].value = highest;
- }
- count++;
- }
- } players_iterate_end;
-
buffer[0] = '\0';
qsort(rank, count, sizeof(struct player_score_entry), secompare1);
Index: server/gamelog.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/gamelog.h,v
retrieving revision 1.10
diff -u -r1.10 gamelog.h
--- server/gamelog.h 9 Dec 2004 16:38:35 -0000 1.10
+++ server/gamelog.h 29 Mar 2005 09:38:21 -0000
@@ -50,8 +50,7 @@
GL_NONE,
GL_DRAW,
GL_LONEWIN,
- GL_TEAMWIN,
- GL_ALLIEDWIN
+ GL_TEAMWIN
};
/* treaty clause types */
Index: server/srv_main.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.h,v
retrieving revision 1.28
diff -u -r1.28 srv_main.h
--- server/srv_main.h 22 Mar 2005 04:03:35 -0000 1.28
+++ server/srv_main.h 29 Mar 2005 09:38:24 -0000
@@ -19,8 +19,6 @@
struct connection;
-BV_DEFINE(bv_draw, MAX_NUM_PLAYERS);
-
struct server_arguments {
/* metaserver information */
bool metaserver_no_send;
@@ -43,8 +41,6 @@
int quitidle;
/* exit the server on game ending */
bool exit_on_end;
- /* what kind of end game we should use */
- bv_draw draw;
/* authentication options */
bool auth_enabled; /* defaults to FALSE */
bool auth_allow_guests; /* defaults to TRUE */
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.390
diff -u -r1.390 stdinhand.c
--- server/stdinhand.c 22 Mar 2005 04:03:35 -0000 1.390
+++ server/stdinhand.c 29 Mar 2005 09:38:25 -0000
@@ -3540,55 +3540,24 @@
}
/**************************************************************************
- End the game and accord victory to the listed players, if any.
+ End the game for the player giving the command, or for all players if
+ from the server command line.
**************************************************************************/
static bool end_command(struct connection *caller, char *str, bool check)
{
if (server_state == RUN_GAME_STATE) {
- char *arg[MAX_NUM_PLAYERS];
- int ntokens = 0, i;
- enum m_pre_result plr_result;
- bool result = TRUE;
- char buf[MAX_LEN_CONSOLE_LINE];
-
- if (str != NULL || strlen(str) > 0) {
- sz_strlcpy(buf, str);
- ntokens = get_tokens(buf, arg, MAX_NUM_PLAYERS, TOKEN_DELIMITERS);
- }
- /* Ensure players exist */
- for (i = 0; i < ntokens; i++) {
- struct player *pplayer = find_player_by_name_prefix(arg[i], &plr_result);
-
- if (!pplayer) {
- cmd_reply_no_such_player(CMD_TEAM, caller, arg[i], plr_result);
- result = FALSE;
- goto cleanup;
- } else if (pplayer->is_alive == FALSE) {
- cmd_reply(CMD_END_GAME, caller, C_FAIL, _("But %s is dead!"),
- pplayer->name);
- result = FALSE;
- goto cleanup;
- }
- }
if (check) {
- goto cleanup;
+ return TRUE;
}
- if (ntokens > 0) {
- /* Mark players for victory. */
- for (i = 0; i < ntokens; i++) {
- BV_SET(srvarg.draw,
- find_player_by_name_prefix(arg[i], &plr_result)->player_no);
- }
- }
- server_state = GAME_OVER_STATE;
- force_end_of_sniff = TRUE;
- cmd_reply(CMD_END_GAME, caller, C_OK,
- _("Ending the game. The server will restart once all clients "
- "have disconnected."));
-
- cleanup:
- for (i = 0; i < ntokens; i++) {
- free(arg[i]);
+ if (caller && caller->player) {
+ kill_player(caller->player);
+ } else if (!caller) {
+ /* Command issued from server command line */
+ server_state = GAME_OVER_STATE;
+ force_end_of_sniff = TRUE;
+ cmd_reply(CMD_END_GAME, caller, C_OK,
+ _("Ending the game. The server will restart once all clients "
+ "have disconnected."));
}
return TRUE;
} else {
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.236
diff -u -r1.236 srv_main.c
--- server/srv_main.c 22 Mar 2005 04:03:35 -0000 1.236
+++ server/srv_main.c 29 Mar 2005 09:47:31 -0000
@@ -186,7 +186,6 @@
srvarg.saves_pathname = "";
srvarg.quitidle = 0;
- BV_CLR_ALL(srvarg.draw);
srvarg.auth_enabled = FALSE;
srvarg.auth_allow_guests = FALSE;
@@ -292,8 +291,8 @@
} players_iterate_end;
if (all_allied) {
notify_conn_ex(game.est_connections, NULL, E_GAME_END,
- _("Game ended in allied victory"));
- gamelog(GAMELOG_JUDGE, GL_ALLIEDWIN);
+ _("Game ended in a draw"));
+ gamelog(GAMELOG_JUDGE, GL_DRAW);
return TRUE;
}
@@ -1954,6 +1953,5 @@
} players_iterate_end;
game_free();
ruleset_cache_free();
- BV_CLR_ALL(srvarg.draw);
clean_players_research();
}
- [Freeciv-Dev] Re: (PR#12668) Changes in how to win the game..., Benoit Hudson, 2005/03/26
- [Freeciv-Dev] Re: (PR#12668) Changes in how to win the game..., Mike Kaufman, 2005/03/26
- [Freeciv-Dev] Re: (PR#12668) Changes in how to win the game..., ue80@xxxxxxxxxxxxxxxxxxxxx, 2005/03/27
- [Freeciv-Dev] Re: (PR#12668) Changes in how to win the game..., Per I. Mathisen, 2005/03/27
- [Freeciv-Dev] Re: (PR#12668) Changes in how to win the game..., Per I. Mathisen, 2005/03/27
- [Freeciv-Dev] Re: (PR#12668) Changes in how to win the game..., Jason Short, 2005/03/27
- [Freeciv-Dev] Re: (PR#12668) Changes in how to win the game..., Mike Kaufman, 2005/03/27
- [Freeciv-Dev] Re: (PR#12668) Changes in how to win the game..., Mike Kaufman, 2005/03/27
- [Freeciv-Dev] Re: (PR#12668) Changes in how to win the game..., Jason Short, 2005/03/27
- [Freeciv-Dev] Re: (PR#12668) Changes in how to win the game...,
Per I. Mathisen <=
- [Freeciv-Dev] Re: (PR#12668) Changes in how to win the game..., Thomas.Strub@xxxxxxxxxxxxxxxxxxxxx, 2005/03/29
- [Freeciv-Dev] Re: (PR#12668) Changes in how to win the game..., Per I. Mathisen, 2005/03/29
|
|