[Freeciv-Dev] Re: (PR#5135) Re: Re: Free for all Games
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] Re: (PR#5135) Re: Re: Free for all Games |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Mon, 8 Sep 2003 06:34:33 -0700 |
Reply-to: |
rt@xxxxxxxxxxxxxx |
> help diplom
Option: diplomacy - The ability to do diplomacy with other players
Description:
If set to 0 (default), diplomacy is enabled for all.
If set to 1, diplomacy is only allowed between human players.
If set to 2, diplomacy is only allowed between AI players.
If set to 3, diplomacy is disabled for all.
You can always do diplomacy with players on your team.
Status: changeable
Value: 0, Minimum: 0, Default: 0, Maximum: 3
CHANGES:
- prettier help (see above)
- saved to savegame
- war set on contact as appropriate
- team mates can always do diplomacy
Please test/comment.
- Per
Index: common/diptreaty.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/diptreaty.c,v
retrieving revision 1.17
diff -u -r1.17 diptreaty.c
--- common/diptreaty.c 8 Aug 2003 22:11:41 -0000 1.17
+++ common/diptreaty.c 8 Sep 2003 13:33:45 -0000
@@ -18,6 +18,7 @@
#include <stdio.h>
#include <stdlib.h>
+#include "game.h"
#include "log.h"
#include "mem.h"
#include "player.h"
@@ -36,6 +37,15 @@
return (pplayer->is_alive
&& aplayer->is_alive
&& pplayer != aplayer
+ && (game.diplomacy == 0
+ || (game.diplomacy == 1
+ && !pplayer->ai.control
+ && !aplayer->ai.control)
+ || (game.diplomacy == 2
+ && pplayer->ai.control
+ && aplayer->ai.control)
+ || (pplayer->team != TEAM_NONE
+ && pplayer->team == aplayer->team))
&& (player_has_embassy(aplayer, pplayer)
|| player_has_embassy(pplayer, aplayer)
|| pplayer->diplstates[aplayer->player_no].contact_turns_left > 0
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.124
diff -u -r1.124 game.h
--- common/game.h 10 Aug 2003 14:44:14 -0000 1.124
+++ common/game.h 8 Sep 2003 13:33:45 -0000
@@ -161,6 +161,7 @@
int allowed_city_names;
int borders; /* distance of border from city; 0=disabled. */
+ int diplomacy; /* who can do it */
char rulesetdir[MAX_LEN_NAME];
int firepower_factor; /* See README.rulesets */
@@ -319,6 +320,10 @@
#define GAME_DEFAULT_BORDERS 7
#define GAME_MIN_BORDERS 0
#define GAME_MAX_BORDERS 24
+
+#define GAME_DEFAULT_DIPLOMACY 0
+#define GAME_MIN_DIPLOMACY 0
+#define GAME_MAX_DIPLOMACY 3
#define GAME_DEFAULT_DIPLCHANCE 80
#define GAME_MIN_DIPLCHANCE 1
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.290
diff -u -r1.290 plrhand.c
--- server/plrhand.c 3 Sep 2003 21:33:58 -0000 1.290
+++ server/plrhand.c 8 Sep 2003 13:33:45 -0000
@@ -1442,9 +1442,22 @@
pplayer2->diplstates[player1].contact_turns_left = game.contactturns;
if (pplayer_get_diplstate(pplayer1, pplayer2)->type == DS_NO_CONTACT) {
+ /* Set default new diplomatic state depending on game.diplomacy
+ * server setting. Default is zero, which gives DS_NEUTRAL. */
+ enum diplstate_type dipstate = (game.diplomacy == 0
+ || (game.diplomacy == 1
+ && pplayer1->ai.control == FALSE
+ && pplayer2->ai.control == FALSE)
+ || (game.diplomacy == 2
+ && pplayer1->ai.control == TRUE
+ && pplayer2->ai.control == TRUE)
+ || (pplayer1->team != TEAM_NONE
+ && pplayer1->team == pplayer2->team))
+ ? DS_NEUTRAL : DS_WAR;
+
pplayer1->diplstates[player2].type
= pplayer2->diplstates[player1].type
- = DS_NEUTRAL;
+ = dipstate;
notify_player_ex(pplayer1, x, y,
E_FIRST_CONTACT,
_("Game: You have made contact with the %s, ruled by %s."),
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.134
diff -u -r1.134 savegame.c
--- server/savegame.c 19 Aug 2003 19:46:25 -0000 1.134
+++ server/savegame.c 8 Sep 2003 13:33:45 -0000
@@ -1905,6 +1905,10 @@
/* National borders setting. */
game.borders = secfile_lookup_int_default(file, 0, "game.borders");
+ /* Diplomacy. */
+ game.diplomacy = secfile_lookup_int_default(file, GAME_DEFAULT_DIPLOMACY,
+ "game.diplomacy");
+
if (has_capability("watchtower", savefile_options)) {
game.watchtower_extra_vision =
secfile_lookup_int(file, "game.watchtower_extra_vision");
@@ -2306,6 +2310,7 @@
secfile_insert_int(file, game.occupychance, "game.occupychance");
secfile_insert_str(file, game.demography, "game.demography");
secfile_insert_int(file, game.borders, "game.borders");
+ secfile_insert_int(file, game.diplomacy, "game.diplomacy");
secfile_insert_int(file, game.watchtower_vision, "game.watchtower_vision");
secfile_insert_int(file, game.watchtower_extra_vision,
"game.watchtower_extra_vision");
secfile_insert_int(file, game.allowed_city_names, "game.allowed_city_names");
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.291
diff -u -r1.291 stdinhand.c
--- server/stdinhand.c 2 Sep 2003 04:52:06 -0000 1.291
+++ server/stdinhand.c 8 Sep 2003 13:33:46 -0000
@@ -564,6 +564,15 @@
"the maximum distance from any city specified."), NULL,
GAME_MIN_BORDERS, GAME_MAX_BORDERS, GAME_DEFAULT_BORDERS)
+ GEN_INT("diplomacy", game.diplomacy, SSET_RULES, SSET_TO_CLIENT,
+ N_("The ability to do diplomacy with other players"),
+ N_("If set to 0 (default), diplomacy is enabled for all.\n"
+ "If set to 1, diplomacy is only allowed between human players.\n"
+ "If set to 2, diplomacy is only allowed between AI players.\n"
+ "If set to 3, diplomacy is disabled for all.\n"
+ "You can always do diplomacy with players on your team."), NULL,
+ GAME_MIN_DIPLOMACY, GAME_MAX_DIPLOMACY, GAME_DEFAULT_DIPLOMACY)
+
GEN_INT("citynames", game.allowed_city_names, SSET_RULES, SSET_TO_CLIENT,
N_("Allowed city names"),
N_("If set to 0, there are no restrictions: players can have "
- [Freeciv-Dev] Re: (PR#5135) Re: Re: Free for all Games,
Per I. Mathisen <=
|
|