[Freeciv-Dev] Re: shore landing takes all movement (PR#7281)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] Re: shore landing takes all movement (PR#7281) |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Tue, 6 Apr 2004 05:24:26 -0700 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=7281 >
> > <URL: http://rt.freeciv.org/Ticket/Display.html?id=7281 >
> >
> > This patch implements shore landings by ground units that take all their
> > remaining movement. The patch looks simple, but should be carefully
> > considered by Raimar or Greg for its implications for path-finding.
Still no word from Raimar or Greg, but here is a new version which makes
the new rule optional.
- Per
PS It is way too difficult and error-prone to properly add new server
options, IMHO. Maybe we should outsource this task to a generator ;)
PPS I noticed some recent server options are not sent to the client. We
should probably fix this. Do we have a clear policy here?
Index: common/capstr.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/capstr.c,v
retrieving revision 1.160
diff -u -r1.160 capstr.c
--- common/capstr.c 30 Mar 2004 19:00:15 -0000 1.160
+++ common/capstr.c 6 Apr 2004 12:20:27 -0000
@@ -76,7 +76,8 @@
#define CAPABILITY "+1.14.delta +last_turns_shield_surplus veteran +orders " \
"+starter +union +iso_maps +orders2client " \
- "+change_production +tilespec1 +no_earth +trans"
+ "+change_production +tilespec1 +no_earth +trans" \
+ "slow_invasions"
/* "+1.14.delta" is the new delta protocol for 1.14.0-dev.
*
@@ -104,6 +105,9 @@
* ptile->spec_sprite
*
* "trans" means that the transported_by field is sent to the client.
+ *
+ * "slow_invasions" means that ground units lose all their movement
+ * when going from sea to land.
*/
void init_our_capability(void)
Index: common/packets.def
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/packets.def,v
retrieving revision 1.15
diff -u -r1.15 packets.def
--- common/packets.def 1 Apr 2004 23:46:26 -0000 1.15
+++ common/packets.def 6 Apr 2004 12:20:28 -0000
@@ -1215,6 +1215,7 @@
UINT8 playable_nation_count;
UINT8 style_count;
UINT8 borders;
+ BOOL slow_invasions; add-cap(slow_invasions)
STRING team_name[MAX_NUM_TEAMS][MAX_LEN_NAME];
end
Index: common/game.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.h,v
retrieving revision 1.132
diff -u -r1.132 game.h
--- common/game.h 22 Mar 2004 20:58:11 -0000 1.132
+++ common/game.h 6 Apr 2004 12:20:28 -0000
@@ -162,6 +162,7 @@
int borders; /* distance of border from city; 0=disabled. */
int diplomacy; /* who can do it */
+ bool slow_invasions; /* land units lose all movement landing on shores */
char rulesetdir[MAX_LEN_NAME];
int firepower_factor; /* See README.rulesets */
@@ -334,6 +335,8 @@
#define GAME_DEFAULT_BORDERS 7
#define GAME_MIN_BORDERS 0
#define GAME_MAX_BORDERS 24
+
+#define GAME_DEFAULT_SLOW_INVASIONS TRUE
#define GAME_DEFAULT_DIPLOMACY 0
#define GAME_MIN_DIPLOMACY 0
Index: common/game.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/game.c,v
retrieving revision 1.176
diff -u -r1.176 game.c
--- common/game.c 19 Feb 2004 21:06:41 -0000 1.176
+++ common/game.c 6 Apr 2004 12:20:28 -0000
@@ -245,6 +245,7 @@
game.fogofwar = GAME_DEFAULT_FOGOFWAR;
game.fogofwar_old= game.fogofwar;
game.borders = GAME_DEFAULT_BORDERS;
+ game.slow_invasions = GAME_DEFAULT_SLOW_INVASIONS;
game.auto_ai_toggle = GAME_DEFAULT_AUTO_AI_TOGGLE;
game.notradesize = GAME_DEFAULT_NOTRADESIZE;
game.fulltradesize = GAME_DEFAULT_FULLTRADESIZE;
Index: common/map.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/common/map.c,v
retrieving revision 1.163
diff -u -r1.163 map.c
--- common/map.c 26 Feb 2004 13:19:47 -0000 1.163
+++ common/map.c 6 Apr 2004 12:20:28 -0000
@@ -889,6 +889,15 @@
{
bool cardinal_move;
+ if (game.slow_invasions
+ && punit
+ && is_ground_unit(punit)
+ && is_ocean(t1->terrain)
+ && !is_ocean(t2->terrain)) {
+ /* Ground units moving from sea to land lose all their movement
+ * if "slowinvasions" server option is turned on. */
+ return punit->moves_left;
+ }
if (punit && !is_ground_unit(punit))
return SINGLE_MOVE;
if (tile_has_special(t1, S_RAILROAD) && tile_has_special(t2, S_RAILROAD))
Index: server/stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.312
diff -u -r1.312 stdinhand.c
--- server/stdinhand.c 2 Apr 2004 10:40:00 -0000 1.312
+++ server/stdinhand.c 6 Apr 2004 12:20:28 -0000
@@ -590,6 +590,12 @@
"the maximum distance from any city specified."), NULL,
GAME_MIN_BORDERS, GAME_MAX_BORDERS, GAME_DEFAULT_BORDERS)
+ GEN_BOOL("slowinvasions", game.slow_invasions, SSET_RULES, SSET_TO_CLIENT,
+ N_("Whether slow invasions are enabled"),
+ N_("When turned on, land units getting ashore from sea lose all "
+ "their movement points."), NULL,
+ GAME_DEFAULT_SLOW_INVASIONS)
+
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"
Index: server/ruleset.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/ruleset.c,v
retrieving revision 1.166
diff -u -r1.166 ruleset.c
--- server/ruleset.c 22 Mar 2004 20:58:13 -0000 1.166
+++ server/ruleset.c 6 Apr 2004 12:20:29 -0000
@@ -1949,6 +1949,7 @@
packet.num_impr_types = game.num_impr_types;
packet.num_tech_types = game.num_tech_types;
packet.borders = game.borders;
+ packet.slow_invasions = game.slow_invasions;
packet.nation_count = game.nation_count;
packet.playable_nation_count = game.playable_nation_count;
Index: client/packhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/client/packhand.c,v
retrieving revision 1.357
diff -u -r1.357 packhand.c
--- client/packhand.c 1 Apr 2004 23:46:25 -0000 1.357
+++ client/packhand.c 6 Apr 2004 12:20:29 -0000
@@ -2094,6 +2094,7 @@
game.num_tech_types = packet->num_tech_types;
game.borders = packet->borders;
+ game.slow_invasions = packet->slow_invasions;
governments_alloc(packet->government_count);
|
|