Complete.Org: Mailing Lists: Archives: freeciv-dev: May 2005:
[Freeciv-Dev] (PR#12961) New command: Raze the bloody city
Home

[Freeciv-Dev] (PR#12961) New command: Raze the bloody city

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: [Freeciv-Dev] (PR#12961) New command: Raze the bloody city
From: "Per I. Mathisen" <per@xxxxxxxxxxx>
Date: Mon, 2 May 2005 12:22:03 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=12961 >

This patch adds a new unit command that razes a city to the ground. This
is based on an effect, EFT_ALLOW_RAZE_CITY, which sets how many turns this
command takes - a value of zero disables it.

This should have a severe diplomatic penalty. Once I get around to redoing
reputation, I'll fix that properly, but until then I am not sure what to
do. Perhaps a 5% drop in reputation for each razed city would do? We can
also disallow raze for Republib and Democracy.

  - Per

Index: ai/aicity.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/ai/aicity.c,v
retrieving revision 1.217
diff -u -r1.217 aicity.c
--- ai/aicity.c 2 May 2005 10:37:18 -0000       1.217
+++ ai/aicity.c 2 May 2005 19:18:47 -0000
@@ -305,6 +305,8 @@
       struct city *palace = find_palace(pplayer);
 
       switch (peffect->type) {
+        case EFT_ALLOW_RAZE_CITY:
+          break; /* makes no sense for a city - I think */
        case EFT_PROD_TO_GOLD:
          /* Since coinage contains some entirely spurious ruleset values,
           * we need to return here with some spurious want. */
Index: client/control.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/control.c,v
retrieving revision 1.171
diff -u -r1.171 control.c
--- client/control.c    29 Apr 2005 18:39:25 -0000      1.171
+++ client/control.c    2 May 2005 19:18:47 -0000
@@ -2090,6 +2090,17 @@
 /**************************************************************************
 ...
 **************************************************************************/
+void key_unit_raze(void)
+{
+  if (punit_focus &&
+      can_unit_do_activity(punit_focus, ACTIVITY_RAZE)) {
+    request_new_unit_activity(punit_focus, ACTIVITY_RAZE);
+  }
+}
+
+/**************************************************************************
+...
+**************************************************************************/
 void key_unit_pollution(void)
 {
   if (punit_focus &&
Index: client/control.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/control.h,v
retrieving revision 1.50
diff -u -r1.50 control.h
--- client/control.h    26 Apr 2005 19:58:24 -0000      1.50
+++ client/control.h    2 May 2005 19:18:47 -0000
@@ -164,6 +164,7 @@
 void key_unit_patrol(void);
 void key_unit_paradrop(void);
 void key_unit_pillage(void);
+void key_unit_raze(void);
 void key_unit_pollution(void);
 void key_unit_road(void);
 void key_unit_sentry(void);
Index: client/tilespec.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/tilespec.c,v
retrieving revision 1.299
diff -u -r1.299 tilespec.c
--- client/tilespec.c   30 Apr 2005 17:09:25 -0000      1.299
+++ client/tilespec.c   2 May 2005 19:18:47 -0000
@@ -2797,7 +2797,14 @@
     case ACTIVITY_TRANSFORM:
       s = t->sprites.unit.transform;
       break;
-    default:
+    case ACTIVITY_RAZE:
+      s = t->sprites.unit.pillage;
+      break;
+    case ACTIVITY_IDLE:
+    case ACTIVITY_PATROL_UNUSED:
+    case ACTIVITY_LAST:
+    case ACTIVITY_UNKNOWN:
+      assert(FALSE); /* never here */
       break;
     }
 
Index: client/gui-gtk-2.0/menu.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/gui-gtk-2.0/menu.c,v
retrieving revision 1.75
diff -u -r1.75 menu.c
--- client/gui-gtk-2.0/menu.c   1 May 2005 16:21:58 -0000       1.75
+++ client/gui-gtk-2.0/menu.c   2 May 2005 19:18:48 -0000
@@ -126,6 +126,7 @@
   MENU_ORDER_FALLOUT,
   MENU_ORDER_SENTRY,
   MENU_ORDER_PILLAGE,
+  MENU_ORDER_RAZE,
   MENU_ORDER_HOMECITY,
   MENU_ORDER_UNLOAD_TRANSPORTER,
   MENU_ORDER_LOAD,
@@ -456,6 +457,9 @@
    case MENU_ORDER_PILLAGE:
     key_unit_pillage();
     break;
+   case MENU_ORDER_RAZE:
+    key_unit_raze();
+    break;
    case MENU_ORDER_HOMECITY:
     key_unit_homecity();
     break;
@@ -814,6 +818,8 @@
        orders_menu_callback,   MENU_ORDER_SENTRY                               
        },
   { "/" N_("Orders") "/" N_("Pillage"),                        "<shift>p",
        orders_menu_callback,   MENU_ORDER_PILLAGE                              
        },
+  { "/" N_("Orders") "/" N_("Raze city"),              "",
+       orders_menu_callback,   MENU_ORDER_RAZE                                 
        },
   { "/" N_("Orders") "/sep2",                          NULL,
        NULL,                   0,                                      
"<Separator>"   },
   { "/" N_("Orders") "/" N_("Make _Homecity"),         "h",
@@ -1363,6 +1369,8 @@
                          can_unit_do_activity(punit, ACTIVITY_SENTRY));
       menus_set_sensitive("<main>/_Orders/Pillage",
                          can_unit_do_activity(punit, ACTIVITY_PILLAGE));
+      menus_set_sensitive("<main>/_Orders/Raze city",
+                         can_unit_do_activity(punit, ACTIVITY_RAZE));
       menus_set_sensitive("<main>/_Orders/_Disband Unit",
                          !unit_flag(punit, F_UNDISBANDABLE));
       menus_set_sensitive("<main>/_Orders/Make _Homecity",
Index: common/effects.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/effects.c,v
retrieving revision 1.35
diff -u -r1.35 effects.c
--- common/effects.c    2 May 2005 08:57:46 -0000       1.35
+++ common/effects.c    2 May 2005 19:18:48 -0000
@@ -138,7 +138,8 @@
   "Has_Senate",
   "Inspire_Partisans",
   "Happiness_To_Gold",
-  "Fanatics"
+  "Fanatics",
+  "Allow_Raze_City"
 };
 
 static bool initialized = FALSE;
Index: common/effects.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/effects.h,v
retrieving revision 1.21
diff -u -r1.21 effects.h
--- common/effects.h    2 May 2005 08:45:19 -0000       1.21
+++ common/effects.h    2 May 2005 19:18:48 -0000
@@ -126,6 +126,7 @@
   EFT_INSPIRE_PARTISANS,
   EFT_HAPPINESS_TO_GOLD,
   EFT_FANATICS, /* stupid special case, we hatess it */
+  EFT_ALLOW_RAZE_CITY,
   EFT_LAST     /* keep this last */
 };
 
Index: common/unit.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.c,v
retrieving revision 1.237
diff -u -r1.237 unit.c
--- common/unit.c       30 Apr 2005 17:09:27 -0000      1.237
+++ common/unit.c       2 May 2005 19:18:49 -0000
@@ -543,6 +543,8 @@
     return _("Airbase");
   case ACTIVITY_FALLOUT:
     return _("Fallout");
+  case ACTIVITY_RAZE:
+    return _("Raze city");
   case ACTIVITY_UNKNOWN:
   case ACTIVITY_PATROL_UNUSED:
   case ACTIVITY_LAST:
@@ -840,6 +842,10 @@
     }
     return TRUE;
 
+  case ACTIVITY_RAZE:
+    return (tile_get_city(ptile) 
+            && get_player_bonus(pplayer, EFT_ALLOW_RAZE_CITY) > 0);
+
   case ACTIVITY_RAILROAD:
     /* if the tile has road, the terrain must be ok.. */
     return (terrain_control.may_road
@@ -1022,6 +1028,7 @@
    case ACTIVITY_SENTRY:
    case ACTIVITY_GOTO:
    case ACTIVITY_EXPLORE:
+   case ACTIVITY_RAZE:
      return get_activity_text (punit->activity);
    case ACTIVITY_PILLAGE:
      if(punit->activity_target == S_NO_SPECIAL) {
Index: common/unit.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/unit.h,v
retrieving revision 1.143
diff -u -r1.143 unit.h
--- common/unit.h       30 Apr 2005 17:09:28 -0000      1.143
+++ common/unit.h       2 May 2005 19:18:49 -0000
@@ -30,6 +30,7 @@
   ACTIVITY_RAILROAD, ACTIVITY_PILLAGE, ACTIVITY_GOTO, ACTIVITY_EXPLORE,
   ACTIVITY_TRANSFORM, ACTIVITY_UNKNOWN, ACTIVITY_AIRBASE, ACTIVITY_FORTIFYING,
   ACTIVITY_FALLOUT,
+  ACTIVITY_RAZE, /* raze city to the ground */
   ACTIVITY_PATROL_UNUSED, /* Needed for savegame compatability. */
   ACTIVITY_LAST   /* leave this one last */
 };
Index: data/default/effects.ruleset
===================================================================
RCS file: /home/freeciv/CVS/freeciv/data/default/effects.ruleset,v
retrieving revision 1.7
diff -u -r1.7 effects.ruleset
--- data/default/effects.ruleset        2 May 2005 08:45:21 -0000       1.7
+++ data/default/effects.ruleset        2 May 2005 19:18:49 -0000
@@ -1408,3 +1408,7 @@
       "Building", "Coinage", "City"
     }
 
+[effect_raze_0]
+name    = "Allow_Raze_City"
+value   = 3
+; reqs    = 
Index: server/savegame.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/savegame.c,v
retrieving revision 1.239
diff -u -r1.239 savegame.c
--- server/savegame.c   1 May 2005 16:18:14 -0000       1.239
+++ server/savegame.c   2 May 2005 19:18:50 -0000
@@ -422,6 +422,8 @@
   case ACTIVITY_UNKNOWN:
   case ACTIVITY_PATROL_UNUSED:
     return '?';
+  case ACTIVITY_RAZE:
+    return 'c';
   case ACTIVITY_LAST:
     break;
   }
Index: server/unittools.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/unittools.c,v
retrieving revision 1.347
diff -u -r1.347 unittools.c
--- server/unittools.c  2 May 2005 08:45:23 -0000       1.347
+++ server/unittools.c  2 May 2005 19:18:51 -0000
@@ -744,6 +744,14 @@
     }
   }
 
+  if (activity == ACTIVITY_RAZE
+      && ptile->city
+      && total_activity(ptile, ACTIVITY_RAZE)
+          >= get_player_bonus(pplayer, EFT_ALLOW_RAZE_CITY) * 10) {
+    remove_city(ptile->city);
+    unit_activity_done = TRUE;
+  }
+
   if (activity == ACTIVITY_FORTRESS) {
     if (total_activity (ptile, ACTIVITY_FORTRESS)
        >= tile_activity_time(ACTIVITY_FORTRESS, ptile)) {

[Prev in Thread] Current Thread [Next in Thread]
  • [Freeciv-Dev] (PR#12961) New command: Raze the bloody city, Per I. Mathisen <=