Complete.Org: Mailing Lists: Archives: freeciv-dev: April 2004:
[Freeciv-Dev] (PR#8483) killstack patch (fix 2)
Home

[Freeciv-Dev] (PR#8483) killstack patch (fix 2)

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#8483) killstack patch (fix 2)
From: "LoboGris" <molv@xxxxxxxxxxxxxx>
Date: Sun, 11 Apr 2004 20:22:38 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=8483 >

Description: optional killstack
    If this is set to 1, all units in the same tile of a killed unit will
be killed (unless they are on a fortress, airbase or city). This is the
freeciv default.
If this options is set to 0, units are killed one by one,
except by nuclear weapons, of course.

Observation: common/packets.def was modified. Don't forget to run
common/generate_packets.py after patch applied.

Fixes since fix 1:
- Only killstack is here. damage has been removed.
- client now has awareness of this option (client/packhand.c)
- Check of valid killstack value when loading rulesets. If not valid,
   killstack is enabled (the default).
- history/game.rulesets now has this option.


diff -Nur freeciv-orig-cvs/client/packhand.c freeciv-killstack/client/packhand.c
--- freeciv-orig-cvs/client/packhand.c  2004-04-02 20:28:43.000000000 -0300
+++ freeciv-killstack/client/packhand.c 2004-04-12 00:15:04.000000000 -0300
@@ -2655,6 +2655,7 @@
   game.rgame.granary_food_inc = packet->granary_food_inc;
   game.rgame.tech_cost_style = packet->tech_cost_style;
   game.rgame.tech_leakage = packet->tech_leakage;
+  game.rgame.killstack = packet->killstack;
 
   for (i = 0; i < MAX_VET_LEVELS; i++) {
     game.trireme_loss_chance[i] = packet->trireme_loss_chance[i];
diff -Nur freeciv-orig-cvs/common/combat.c freeciv-killstack/common/combat.c
--- freeciv-orig-cvs/common/combat.c    2004-03-17 21:39:51.000000000 -0300
+++ freeciv-killstack/common/combat.c   2004-04-12 00:02:11.000000000 -0300
@@ -662,5 +662,6 @@
 {
   return !(map_get_city(x, y) != NULL
            || map_has_special(x, y, S_FORTRESS)
-           || map_has_special(x, y, S_AIRBASE));
+           || map_has_special(x, y, S_AIRBASE)
+           || !(game.rgame.killstack));
 }
diff -Nur freeciv-orig-cvs/common/game.h freeciv-killstack/common/game.h
--- freeciv-orig-cvs/common/game.h      2004-03-27 20:26:37.000000000 -0300
+++ freeciv-killstack/common/game.h     2004-04-12 00:02:11.000000000 -0300
@@ -203,6 +203,8 @@
      * Advances given to all players at game start.
      */
     int global_init_techs[MAX_NUM_TECH_LIST];
+
+    int killstack;
   } rgame;
   
   struct {
diff -Nur freeciv-orig-cvs/common/packets.def 
freeciv-killstack/common/packets.def
--- freeciv-orig-cvs/common/packets.def 2004-04-09 20:29:59.000000000 -0300
+++ freeciv-killstack/common/packets.def        2004-04-12 00:02:11.000000000 
-0300
@@ -968,6 +968,8 @@
   UINT8 tech_leakage;
   TECH_LIST global_init_techs[MAX_NUM_TECH_LIST];
 
+  UINT8 killstack;
+
   UINT8 trireme_loss_chance[MAX_VET_LEVELS]; add-cap(veteran)
   UINT8 work_veteran_chance[MAX_VET_LEVELS]; add-cap(veteran)
   UINT8 veteran_chance[MAX_VET_LEVELS]; add-cap(veteran)
diff -Nur freeciv-orig-cvs/data/civ1/game.ruleset 
freeciv-killstack/data/civ1/game.ruleset
--- freeciv-orig-cvs/data/civ1/game.ruleset     2004-03-27 20:26:38.000000000 
-0300
+++ freeciv-killstack/data/civ1/game.ruleset    2004-04-12 00:02:11.000000000 
-0300
@@ -79,3 +79,12 @@
 improvement_factor = 1
 unit_factor = 1
 total_factor = 100
+
+[combat_rules]
+;If this is set to 1, all units in the same tile of a killed unit will
+;be killed (unless they are on a fortress, airbase or city). This is the
+;freeciv default.
+;If this options is set to 0, units are killed one by one,
+;except by nuclear weapons, of course.
+killstack               = 1
+
diff -Nur freeciv-orig-cvs/data/civ2/game.ruleset 
freeciv-killstack/data/civ2/game.ruleset
--- freeciv-orig-cvs/data/civ2/game.ruleset     2004-03-27 20:26:39.000000000 
-0300
+++ freeciv-killstack/data/civ2/game.ruleset    2004-04-12 00:02:11.000000000 
-0300
@@ -79,3 +79,12 @@
 improvement_factor = 1
 unit_factor = 1
 total_factor = 100
+
+[combat_rules]
+;If this is set to 1, all units in the same tile of a killed unit will
+;be killed (unless they are on a fortress, airbase or city). This is the
+;freeciv default.
+;If this options is set to 0, units are killed one by one,
+;except by nuclear weapons, of course.
+killstack               = 1
+
diff -Nur freeciv-orig-cvs/data/default/game.ruleset 
freeciv-killstack/data/default/game.ruleset
--- freeciv-orig-cvs/data/default/game.ruleset  2004-03-27 20:26:39.000000000 
-0300
+++ freeciv-killstack/data/default/game.ruleset 2004-04-12 00:02:11.000000000 
-0300
@@ -84,3 +84,12 @@
 improvement_factor = 1
 unit_factor = 1
 total_factor = 100
+
+[combat_rules]
+;If this is set to 1, all units in the same tile of a killed unit will
+;be killed (unless they are on a fortress, airbase or city). This is the
+;freeciv default.
+;If this options is set to 0, units are killed one by one,
+;except by nuclear weapons, of course.
+killstack               = 1
+
diff -Nur freeciv-orig-cvs/data/helpdata.txt freeciv-killstack/data/helpdata.txt
--- freeciv-orig-cvs/data/helpdata.txt  2003-12-24 01:30:41.000000000 -0300
+++ freeciv-killstack/data/helpdata.txt 2004-04-12 00:02:11.000000000 -0300
@@ -899,6 +899,9 @@
 [help_combat]
 name = _("Combat")
 text = _("\
+Default Combat Rules
+--------------------- \
+"), _("\
 When one unit attacks another unit, either the attacker will be \
 destroyed, or the defender will be destroyed -- never both (unless \
 the attacker was a missile).  The outcome depends on several \
@@ -993,6 +996,19 @@
 defender.\
 ")
 
+[help_combat_modifying]
+name = _(" Modifying Combat Rules")
+text = _("
+Modifying Combat Rules
+--------------------- \
+"), _("\
+The combat rules described before can be modified by changing the \
+following modifiers in game.ruleset, section combat_rules: \
+"), _("\
+ - killstack. (default: 1) If set to 0, units in the same tile of a \
+lost defender are not destroyed. \
+")
+
 [help_combat_example_1]
 name = _(" Combat example 1")
 text = _("\
diff -Nur freeciv-orig-cvs/data/history/game.ruleset 
freeciv-killstack/data/history/game.ruleset
--- freeciv-orig-cvs/data/history/game.ruleset  2004-03-27 20:26:40.000000000 
-0300
+++ freeciv-killstack/data/history/game.ruleset 2004-04-12 00:17:17.000000000 
-0300
@@ -84,3 +84,11 @@
 improvement_factor = 1
 unit_factor = 1
 total_factor = 100
+
+[combat_rules]
+;If this is set to 1, all units in the same tile of a killed unit will
+;be killed (unless they are on a fortress, airbase or city). This is the
+;freeciv default.
+;If this options is set to 0, units are killed one by one,
+;except by nuclear weapons, of course.
+killstack               = 1
diff -Nur freeciv-orig-cvs/server/ruleset.c freeciv-killstack/server/ruleset.c
--- freeciv-orig-cvs/server/ruleset.c   2004-03-27 20:26:40.000000000 -0300
+++ freeciv-killstack/server/ruleset.c  2004-04-12 00:11:43.000000000 -0300
@@ -2670,6 +2670,15 @@
   lookup_tech_list(&file, "options", "global_init_techs",
                   game.rgame.global_init_techs, filename);
 
+  /* Enable/Disable killstack */
+  game.rgame.killstack = secfile_lookup_int(&file, "combat_rules.killstack");
+  if (game.rgame.killstack != 0 && game.rgame.killstack != 1) {
+    freelog(LOG_ERROR, "Bad value %i for killstack. Using 1.",
+           game.rgame.killstack);
+    game.rgame.killstack = 1;
+  }
+   
+       
   section_file_check_unused(&file, filename);
   section_file_free(&file);
 }
@@ -3078,6 +3087,7 @@
   memcpy(misc_p.global_init_techs, game.rgame.global_init_techs,
         sizeof(misc_p.global_init_techs));
 
+  misc_p.killstack = game.rgame.killstack;
   lsend_packet_ruleset_game(dest, &misc_p);
 }
 

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