Complete.Org: Mailing Lists: Archives: freeciv-dev: November 2002:
[Freeciv-Dev] (PR#2274)
Home

[Freeciv-Dev] (PR#2274)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Cc: freeciv-dev@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#2274)
From: "Per I. Mathisen via RT" <rt@xxxxxxxxxxxxxx>
Date: Thu, 7 Nov 2002 08:45:08 -0800
Reply-to: rt@xxxxxxxxxxxxxx

(Repost and summary to RT.)

This patch allows us to clean up the special case of diplomats and
allied cities, which makes for a lot of mess for such a stupid special case.

For instance: If this is applied then diplomats don't need a dialog
before entering allied cities (they can behave like normal units), and
all code related to DIPLOMAT_MOVE can go away.

It also makes sense (at least to me) for in-game reasons. You can't
maintain diplomatic relations with someone that you cannot contact.

The solution is:
 - When you make a Peace or Alliance treaty with someone, you gain a
permanent embassy with that player.
 - If you lose your embassy, you also lose your Ceasefire agreements.

I think this is the most obvious solution.

  - Per
Index: server/diplhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/diplhand.c,v
retrieving revision 1.63
diff -u -r1.63 diplhand.c
--- server/diplhand.c   2002/09/22 19:21:30     1.63
+++ server/diplhand.c   2002/11/02 13:19:23
@@ -360,6 +360,8 @@
                         pgiver->name);
        check_city_workers(plr0);
        check_city_workers(plr1);
+        plr0->embassy |= (1 << plr1->player_no); /* make permanent embassies */
+        plr1->embassy |= (1 << plr0->player_no); /* make permanent embassies */
        break;
       case CLAUSE_ALLIANCE:
        pgiver->diplstates[pdest->player_no].type=DS_ALLIANCE;
@@ -372,6 +374,8 @@
                         pgiver->name);
        check_city_workers(plr0);
        check_city_workers(plr1);
+        plr0->embassy |= (1 << plr1->player_no); /* make permanent embassies */
+        plr1->embassy |= (1 << plr0->player_no); /* make permanent embassies */
        break;          
       case CLAUSE_VISION:
        give_shared_vision(pgiver, pdest);
Index: server/plrhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/plrhand.c,v
retrieving revision 1.248
diff -u -r1.248 plrhand.c
--- server/plrhand.c    2002/11/01 17:59:44     1.248
+++ server/plrhand.c    2002/11/02 13:19:24
@@ -1591,7 +1591,7 @@
   for(i = 0; i<game.num_tech_types ; i++)
     cplayer->research.inventions[i] = pplayer->research.inventions[i];
   cplayer->turn_done = TRUE; /* Have other things to think about - paralysis*/
-  cplayer->embassy = 0;   /* all embassys destroyed */
+  cplayer->embassy = 0; /* starts with no embassies */
 
   /* Do the ai */
 
@@ -1614,7 +1614,6 @@
   }
   pplayer->economic.gold = cplayer->economic.gold;
   pplayer->research.bulbs_researched = 0;
-  pplayer->embassy = 0; /* all embassys destroyed */
 
   player_limit_to_government_rates(pplayer);
 
Index: server/srv_main.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/srv_main.c,v
retrieving revision 1.99
diff -u -r1.99 srv_main.c
--- server/srv_main.c   2002/11/02 00:42:56     1.99
+++ server/srv_main.c   2002/11/02 13:19:24
@@ -320,6 +320,15 @@
       pdiplstate->has_reason_to_cancel =
          MAX(pdiplstate->has_reason_to_cancel - 1, 0);
 
+      /* If we had Marco's and lost it we might lose our ceasefire. */
+      if (pdiplstate->type == DS_CEASEFIRE
+          && (!player_has_embassy(player1, player2)
+              && !player_has_embassy(player2, player1))) {
+        pdiplstate->type = DS_NEUTRAL; /* no reputation loss */
+        pdiplstate->turns_left = 0;
+        continue;
+      }
+
       if(pdiplstate->type == DS_CEASEFIRE) {
        switch(--pdiplstate->turns_left) {
        case 1:

[Prev in Thread] Current Thread [Next in Thread]