[Freeciv-commits] r25151 - in /trunk: ai/default/ client/ client/gui-gtk-2.0/ client/gui-gtk-3.0/ client/gui-sdl/ client/gui-sdl2/ common/ com...

2014-06-16 Thread pepeto69
Author: pepeto
Date: Mon Jun 16 10:21:16 2014
New Revision: 25151

URL: http://svn.gna.org/viewcvs/freeciv?rev=25151view=rev
Log:
Specific genhash improvements:
* functions are no more blindly casted to genhash_XXX_fn_t ;
* differentiation between internal key|data types (used inside genhash) and
  user key|data types (used by the caller) ;
* make a set of default functions for integer, allocated string, and static
  strings key|data.

See gna patch #4802

Modified:
trunk/ai/default/aisettler.c
trunk/client/attribute.c
trunk/client/control.c
trunk/client/gui-gtk-2.0/editprop.c
trunk/client/gui-gtk-3.0/editprop.c
trunk/client/gui-sdl/themespec.c
trunk/client/gui-sdl2/themespec.c
trunk/client/mapview_common.c
trunk/client/options.c
trunk/client/tilespec.c
trunk/client/unitselect_common.h
trunk/client/update_queue.c
trunk/common/government.h
trunk/common/idex.c
trunk/common/map.c
trunk/common/nation.h
trunk/common/scriptcore/luascript_func.c
trunk/common/scriptcore/luascript_signal.c
trunk/common/tile.h
trunk/server/fcdb.c
trunk/server/srv_main.c
trunk/server/stdinhand.c
trunk/utility/genhash.c
trunk/utility/genhash.h
trunk/utility/section_file.h
trunk/utility/spechash.h

[This mail would be too long, it was shortened to contain the URLs only.]

Modified: trunk/ai/default/aisettler.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aisettler.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/client/attribute.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/attribute.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/client/control.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/control.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/client/gui-gtk-2.0/editprop.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/editprop.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/client/gui-gtk-3.0/editprop.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/editprop.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/client/gui-sdl/themespec.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl/themespec.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/client/gui-sdl2/themespec.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/themespec.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/client/mapview_common.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/mapview_common.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/client/options.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/options.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/client/tilespec.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/tilespec.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/client/unitselect_common.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/unitselect_common.h?rev=25151r1=25150r2=25151view=diff

Modified: trunk/client/update_queue.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/update_queue.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/common/government.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/government.h?rev=25151r1=25150r2=25151view=diff

Modified: trunk/common/idex.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/idex.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/common/map.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/map.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/common/nation.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/nation.h?rev=25151r1=25150r2=25151view=diff

Modified: trunk/common/scriptcore/luascript_func.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/luascript_func.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/common/scriptcore/luascript_signal.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/luascript_signal.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/common/tile.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/tile.h?rev=25151r1=25150r2=25151view=diff

Modified: trunk/server/fcdb.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/fcdb.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/srv_main.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/server/stdinhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/stdinhand.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/utility/genhash.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/genhash.c?rev=25151r1=25150r2=25151view=diff

Modified: trunk/utility/genhash.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/genhash.h?rev=25151r1=25150r2=25151view=diff

Modified: trunk/utility/section_file.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/utility/section_file.h?rev=25151r1=25150r2=25151view=diff

Modified: trunk/utility/spechash.h
URL: 

[Freeciv-commits] r25153 - /branches/S2_5/tests/copyright.sh

2014-06-16 Thread cazfi74
Author: cazfi
Date: Mon Jun 16 22:12:37 2014
New Revision: 25153

URL: http://svn.gna.org/viewcvs/freeciv?rev=25153view=rev
Log:
Fixed copyright.sh test
- Check also .cpp files
- config.h - fc_config.h
- Removed no longer existing config.mac.h from list of files to skip
- Removed SDL_ttf files no longer part of freeciv from list of files to skip
- Removed SDL_rotozoom files no longer part of freeciv from list of files to 
skip 

See patch #4792

Modified:
branches/S2_5/tests/copyright.sh

Modified: branches/S2_5/tests/copyright.sh
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/tests/copyright.sh?rev=25153r1=25152r2=25153view=diff
==
--- branches/S2_5/tests/copyright.sh(original)
+++ branches/S2_5/tests/copyright.shMon Jun 16 22:12:37 2014
@@ -1,20 +1,17 @@
 #!/bin/sh
 
-files=`find $1 -name *.c -o -name *.h \
+files=`find $1 -name *.c -o -name *.h -o -name *.cpp \
| sort \
| grep -v intl \
| grep -v Freeciv.h \
| fgrep -v _gen. \
-   | grep -v config.h \
-   | grep -v config.mac.h \
+   | grep -v fc_config.h \
| grep -v gtkpixcomm \
| grep -v mmx.h \
-   | grep -v SDL_ttf \
| grep -v xaw/canvas \
| grep -v pixcomm \
| grep -v dependencies \
| grep -v utility/md5\.. \
-   | grep -v client/gui-sdl/SDL_rotozoom\.. \
| grep -v client/gui-sdl/alphablit.c `
 
 echo # No Freeciv Copyright:


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r25152 - /trunk/tests/copyright.sh

2014-06-16 Thread cazfi74
Author: cazfi
Date: Mon Jun 16 22:12:32 2014
New Revision: 25152

URL: http://svn.gna.org/viewcvs/freeciv?rev=25152view=rev
Log:
Fixed copyright.sh test
- Check also .cpp files
- config.h - fc_config.h
- Removed no longer existing config.mac.h from list of files to skip
- Removed SDL_ttf files no longer part of freeciv from list of files to skip
- Removed SDL_rotozoom files no longer part of freeciv from list of files to 
skip 

See patch #4792

Modified:
trunk/tests/copyright.sh

Modified: trunk/tests/copyright.sh
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tests/copyright.sh?rev=25152r1=25151r2=25152view=diff
==
--- trunk/tests/copyright.sh(original)
+++ trunk/tests/copyright.shMon Jun 16 22:12:32 2014
@@ -1,19 +1,16 @@
 #!/bin/sh
 
-files=`find $1 -name *.c -o -name *.h \
+files=`find $1 -name *.c -o -name *.h -o -name *.cpp \
| sort \
| grep -v Freeciv.h \
| fgrep -v _gen. \
-   | grep -v config.h \
-   | grep -v config.mac.h \
+   | grep -v fc_config.h \
| grep -v gtkpixcomm \
| grep -v mmx.h \
-   | grep -v SDL_ttf \
| grep -v xaw/canvas \
| grep -v pixcomm \
| grep -v dependencies \
| grep -v utility/md5\.. \
-   | grep -v client/gui-sdl/SDL_rotozoom\.. \
| grep -v client/gui-sdl/alphablit.c `
 
 echo # No Freeciv Copyright:


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r25155 - /trunk/client/helpdata.c

2014-06-16 Thread 0jacobnk . gna
Author: jtn
Date: Mon Jun 16 23:57:00 2014
New Revision: 25155

URL: http://svn.gna.org/viewcvs/freeciv?rev=25155view=rev
Log:
Don't claim veteran Nuclear units with no defence have increased
strength in combat; they don't.

Reported by 'vla22'.

See gna bug #22165.

Modified:
trunk/client/helpdata.c

Modified: trunk/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/helpdata.c?rev=25155r1=25154r2=25155view=diff
==
--- trunk/client/helpdata.c (original)
+++ trunk/client/helpdata.c Mon Jun 16 23:57:00 2014
@@ -3291,7 +3291,7 @@
  * through combat/missions/work. */
 CATLSTR(buf, bufsz, _(* May acquire veteran status.\n));
 if (utype_veteran_has_power_bonus(utype)) {
-  if (utype-attack_strength  0
+  if ((!utype_has_flag(utype, UTYF_NUCLEAR)  utype-attack_strength  0)
   || utype-defense_strength  0) {
 CATLSTR(buf, bufsz,
 _(  * Veterans have increased strength in combat.\n));


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r25154 - in /trunk/data: alien/ civ2civ3/ classic/ experimental/ multiplayer/

2014-06-16 Thread 0jacobnk . gna
Author: jtn
Date: Mon Jun 16 23:56:56 2014
New Revision: 25154

URL: http://svn.gna.org/viewcvs/freeciv?rev=25154view=rev
Log:
Add NoCities and UnsafeCoast flags to Inaccessible terrain.

See gna patch #4784.

Modified:
trunk/data/alien/terrain.ruleset
trunk/data/civ2civ3/terrain.ruleset
trunk/data/classic/terrain.ruleset
trunk/data/experimental/terrain.ruleset
trunk/data/multiplayer/terrain.ruleset

Modified: trunk/data/alien/terrain.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/terrain.ruleset?rev=25154r1=25153r2=25154view=diff
==
--- trunk/data/alien/terrain.ruleset(original)
+++ trunk/data/alien/terrain.rulesetMon Jun 16 23:56:56 2014
@@ -184,7 +184,7 @@
 warmer_drier_result  = no
 cooler_wetter_result = no
 cooler_drier_result  = no
-flags= NotGenerated, NoPollution
+flags= NotGenerated, NoPollution, NoCities, UnsafeCoast
 color.r  = 25
 color.g  = 25
 color.b  = 25

Modified: trunk/data/civ2civ3/terrain.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/terrain.ruleset?rev=25154r1=25153r2=25154view=diff
==
--- trunk/data/civ2civ3/terrain.ruleset (original)
+++ trunk/data/civ2civ3/terrain.ruleset Mon Jun 16 23:56:56 2014
@@ -193,7 +193,7 @@
 warmer_drier_result  = no
 cooler_wetter_result = no
 cooler_drier_result  = no
-flags= NotGenerated, NoPollution
+flags= NotGenerated, NoPollution, NoCities, UnsafeCoast
 color.r  = 25
 color.g  = 25
 color.b  = 25

Modified: trunk/data/classic/terrain.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/terrain.ruleset?rev=25154r1=25153r2=25154view=diff
==
--- trunk/data/classic/terrain.ruleset  (original)
+++ trunk/data/classic/terrain.ruleset  Mon Jun 16 23:56:56 2014
@@ -193,7 +193,7 @@
 warmer_drier_result  = no
 cooler_wetter_result = no
 cooler_drier_result  = no
-flags= NotGenerated, NoPollution
+flags= NotGenerated, NoPollution, NoCities, UnsafeCoast
 color.r  = 25
 color.g  = 25
 color.b  = 25

Modified: trunk/data/experimental/terrain.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/terrain.ruleset?rev=25154r1=25153r2=25154view=diff
==
--- trunk/data/experimental/terrain.ruleset (original)
+++ trunk/data/experimental/terrain.ruleset Mon Jun 16 23:56:56 2014
@@ -195,7 +195,7 @@
 warmer_drier_result  = no
 cooler_wetter_result = no
 cooler_drier_result  = no
-flags= NotGenerated, NoPollution
+flags= NotGenerated, NoPollution, NoCities, UnsafeCoast
 color.r  = 25
 color.g  = 25
 color.b  = 25

Modified: trunk/data/multiplayer/terrain.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/terrain.ruleset?rev=25154r1=25153r2=25154view=diff
==
--- trunk/data/multiplayer/terrain.ruleset  (original)
+++ trunk/data/multiplayer/terrain.ruleset  Mon Jun 16 23:56:56 2014
@@ -193,7 +193,7 @@
 warmer_drier_result  = no
 cooler_wetter_result = no
 cooler_drier_result  = no
-flags= NotGenerated, NoPollution
+flags= NotGenerated, NoPollution, NoCities, UnsafeCoast
 color.r  = 25
 color.g  = 25
 color.b  = 25


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r25156 - in /trunk/server: savegame.c savegame2.c

2014-06-16 Thread 0jacobnk . gna
Author: jtn
Date: Mon Jun 16 23:57:03 2014
New Revision: 25156

URL: http://svn.gna.org/viewcvs/freeciv?rev=25156view=rev
Log:
Protect against savegames where a unit has a higher veteran level than
the current ruleset permits it.

See gna bug #22172.

Modified:
trunk/server/savegame.c
trunk/server/savegame2.c

Modified: trunk/server/savegame.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame.c?rev=25156r1=25155r2=25156view=diff
==
--- trunk/server/savegame.c (original)
+++ trunk/server/savegame.c Mon Jun 16 23:57:03 2014
@@ -1170,6 +1170,7 @@
 int nat_x, nat_y;
 const char* type_name;
 struct unit_type *type;
+int veteran;
 enum tile_special_type target;
 struct base_type *pbase = NULL;
 struct road_type *proad = NULL;
@@ -1191,9 +1192,19 @@
 plrno, i, type_name);
   exit(EXIT_FAILURE);
 }
+
+veteran
+  = secfile_lookup_int_default(file, 0, player%d.u%d.veteran, plrno, i);
+{
+  /* Protect against change in veteran system in ruleset */
+  const int levels = utype_veteran_levels(type);
+  if (veteran = levels) {
+fc_assert(levels = 1);
+veteran = levels - 1;
+  }
+}
 
-punit = unit_virtual_create(plr, NULL, type,
-  secfile_lookup_int_default(file, 0, player%d.u%d.veteran, plrno, i));
+punit = unit_virtual_create(plr, NULL, type, veteran);
 fc_assert_exit_msg(secfile_lookup_int(file, punit-id,
   player%d.u%d.id, plrno, i),
%s, secfile_error());

Modified: trunk/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame2.c?rev=25156r1=25155r2=25156view=diff
==
--- trunk/server/savegame2.c(original)
+++ trunk/server/savegame2.cMon Jun 16 23:57:03 2014
@@ -5155,6 +5155,14 @@
 
   punit-veteran
 = secfile_lookup_int_default(loading-file, 0, %s.veteran, unitstr);
+  {
+/* Protect against change in veteran system in ruleset */
+const int levels = utype_veteran_levels(unit_type(punit));
+if (punit-veteran = levels) {
+  fc_assert(levels = 1);
+  punit-veteran = levels - 1;
+}
+  }
   punit-done_moving
 = secfile_lookup_bool_default(loading-file, (punit-moves_left == 0),
   %s.done_moving, unitstr);


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r25159 - in /trunk: client/helpdata.c client/packhand.c common/movement.c common/movement.h server/ruleset.c

2014-06-16 Thread 0jacobnk . gna
Author: jtn
Date: Mon Jun 16 23:57:12 2014
New Revision: 25159

URL: http://svn.gna.org/viewcvs/freeciv?rev=25159view=rev
Log:
Fix minor bugs in display of fractional movement points resulting from
generalisation of move_fragments, and reduce fractional MP to lowest terms.
Use move_points_text() in road helptext.

See gna bug #22194.

Modified:
trunk/client/helpdata.c
trunk/client/packhand.c
trunk/common/movement.c
trunk/common/movement.h
trunk/server/ruleset.c

Modified: trunk/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/helpdata.c?rev=25159r1=25158r2=25159view=diff
==
--- trunk/client/helpdata.c (original)
+++ trunk/client/helpdata.c Mon Jun 16 23:57:12 2014
@@ -3652,8 +3652,11 @@
   CATLSTR(buf, bufsz, _(* Allows infinite movement.\n));
 } else {
   cat_snprintf(buf, bufsz,
-   _(* Movement cost along this road is %d/%d movement 
points.\n),
-   proad-move_cost, SINGLE_MOVE);
+   /* TRANS: MP = movement points. Second %s may have a
+* fractional part. */
+   _(* Movement cost along %s is %s MP.\n),
+   road_name_translation(proad),
+   move_points_text(proad-move_cost, NULL, NULL, FALSE));
 }
   }
 

Modified: trunk/client/packhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/packhand.c?rev=25159r1=25158r2=25159view=diff
==
--- trunk/client/packhand.c (original)
+++ trunk/client/packhand.c Mon Jun 16 23:57:12 2014
@@ -3499,6 +3499,8 @@
   /* Since terrain_control is the same as packet_ruleset_terrain_control
* we can just copy the data directly. */
   terrain_control = *p;
+  /* terrain_control.move_fragments likely changed */
+  init_move_fragments();
 }
 
 /

Modified: trunk/common/movement.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/movement.c?rev=25159r1=25158r2=25159view=diff
==
--- trunk/common/movement.c (original)
+++ trunk/common/movement.c Mon Jun 16 23:57:12 2014
@@ -748,9 +748,23 @@
   return availability;
 }
 
-/
-  Render movement points as text, including fractional movement points,
-  scaled by SINGLE_MOVE. Returns a pointer to a static buffer.
+static int move_points_denomlen = 0;
+
+/
+  Call whenever terrain_control.move_fragments / SINGLE_MOVE changes.
+/
+void init_move_fragments(void)
+{
+  char denomstr[10];
+  /* String length of maximum denominator for fractional representation of
+   * movement points, for padding of text representation */
+  fc_snprintf(denomstr, sizeof(denomstr), %d, SINGLE_MOVE);
+  move_points_denomlen = strlen(denomstr);
+}
+
+/
+  Render positive movement points as text, including fractional movement
+  points, scaled by SINGLE_MOVE. Returns a pointer to a static buffer.
   'prefix' is a string put in front of all numeric output.
   'none' is the string to display in place of the integer part if no
   movement points (or NULL to just say 0).
@@ -762,45 +776,51 @@
  bool align)
 {
   static struct astring str = ASTRING_INIT;
-  static int denomlen = 0;
   int pad1, pad2;
 
-  if (denomlen == 0) {
-/* String length of denominator for fractional representation of
- * movement points, for padding */
-char denomstr[10];
-fc_snprintf(denomstr, sizeof(denomstr), %d, SINGLE_MOVE);
-denomlen = strlen(denomstr);
-  }
-  if (align) {
-pad1 = denomlen; /* numerator or denominator */
-pad2 = denomlen*2+2; /* everything right of integer part */
+  if (align  SINGLE_MOVE  1) {
+pad1 = move_points_denomlen;  /* numerator or denominator */
+pad2 = move_points_denomlen*2+2;  /* everything right of integer part */
   } else {
+/* If no fractional part, no need for alignment even if requested */
 pad1 = pad2 = 0;
   }
   if (!prefix) {
 prefix = ;
   }
   astr_clear(str);
-  if ((mp == 0 || SINGLE_MOVE == 0)  none) {
-/* No movement points, special representation */
-astr_add(str, %s%*s, none, pad2, );
-  } else if (SINGLE_MOVE == 0) {
-/* Do not divide by zero. Important for client before ruleset
- * received. Just add */
-astr_add(str, 0/0);
+  if ((mp == 0  none) || SINGLE_MOVE == 0) {
+/* No movement points, and we have a special representation to use */
+/* (Also used when SINGLE_MOVE==0, to avoid dividing by zero, which is
+ * 

[Freeciv-commits] r25160 - in /trunk: client/ data/alien/ data/civ2civ3/ data/classic/ data/experimental/ data/multiplayer/

2014-06-16 Thread 0jacobnk . gna
Author: jtn
Date: Mon Jun 16 23:57:16 2014
New Revision: 25160

URL: http://svn.gna.org/viewcvs/freeciv?rev=25160view=rev
Log:
Correct IgTer help and ruleset comments.

Ruleset comments requested by Marko Lindqvist (cazfi@gna).

See gna bug #22195.

Modified:
trunk/client/helpdata.c
trunk/data/alien/units.ruleset
trunk/data/civ2civ3/units.ruleset
trunk/data/classic/units.ruleset
trunk/data/experimental/units.ruleset
trunk/data/multiplayer/units.ruleset

Modified: trunk/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/helpdata.c?rev=25160r1=25159r2=25160view=diff
==
--- trunk/client/helpdata.c (original)
+++ trunk/client/helpdata.c Mon Jun 16 23:57:16 2014
@@ -3141,8 +3141,13 @@
 utype-bombard_rate);
   }
   if (utype_has_flag(utype, UTYF_IGTER)) {
-CATLSTR(buf, bufsz,
-   _(* Ignores terrain effects (treats all tiles as roads).\n));
+cat_snprintf(buf, bufsz,
+ /* TRANS: MP = movement points. %s may have a 
+  * fractional part. */
+ _(* Ignores terrain effects (moving costs at most %s MP 
+   per tile).\n),
+ move_points_text(terrain_control.igter_cost,
+  NULL, NULL, FALSE));
   }
   if (utype_has_flag(utype, UTYF_IGZOC)) {
 CATLSTR(buf, bufsz, _(* Ignores zones of control.\n));

Modified: trunk/data/alien/units.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/units.ruleset?rev=25160r1=25159r2=25160view=diff
==
--- trunk/data/alien/units.ruleset  (original)
+++ trunk/data/alien/units.ruleset  Mon Jun 16 23:57:16 2014
@@ -257,8 +257,9 @@
 ;around it freely
 ; NonMil  = a non-military unit: no attacks; no martial law; can enter
 ; peaceful borders; DoesntOccupyTile
-; IgTer   = ignore terrain/road etc, use constant move cost defined in
-; igter_cost (terrain.ruleset)
+; IgTer   = use constant move cost defined in igter_cost 
(terrain.ruleset)
+; rather than terrain/road etc cost, unless terrain cost is
+; less
 ; OneAttack  = can only make a single attack, regardless of movement points
 ; IgWall = ignore effect of city walls
 ; FieldUnit  = cause unhappiness even when not being aggressive

Modified: trunk/data/civ2civ3/units.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/units.ruleset?rev=25160r1=25159r2=25160view=diff
==
--- trunk/data/civ2civ3/units.ruleset   (original)
+++ trunk/data/civ2civ3/units.ruleset   Mon Jun 16 23:57:16 2014
@@ -300,8 +300,9 @@
 ;around it freely
 ; NonMil = a non-military unit: no attacks; no martial law; can enter
 ; peaceful borders; DoesntOccupyTile
-; IgTer   = ignore terrain/road etc, use constant move cost defined in
-; igter_cost (terrain.ruleset)
+; IgTer   = use constant move cost defined in igter_cost 
(terrain.ruleset)
+; rather than terrain/road etc cost, unless terrain cost is
+; less
 ; OneAttack  = can only make a single attack, regardless of movement points
 ; IgWall = ignore effect of city walls
 ; FieldUnit  = cause unhappiness even when not being aggressive

Modified: trunk/data/classic/units.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/units.ruleset?rev=25160r1=25159r2=25160view=diff
==
--- trunk/data/classic/units.ruleset(original)
+++ trunk/data/classic/units.rulesetMon Jun 16 23:57:16 2014
@@ -277,8 +277,9 @@
 ;around it freely
 ; NonMil = a non-military unit: no attacks; no martial law; can enter
 ; peaceful borders; DoesntOccupyTile
-; IgTer   = ignore terrain/road etc, use constant move cost defined in
-; igter_cost (terrain.ruleset)
+; IgTer   = use constant move cost defined in igter_cost 
(terrain.ruleset)
+; rather than terrain/road etc cost, unless terrain cost is
+; less
 ; OneAttack  = can only make a single attack, regardless of movement points
 ; IgWall = ignore effect of city walls
 ; FieldUnit  = cause unhappiness even when not being aggressive

Modified: trunk/data/experimental/units.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/units.ruleset?rev=25160r1=25159r2=25160view=diff
==
--- trunk/data/experimental/units.ruleset   (original)
+++ trunk/data/experimental/units.ruleset   Mon Jun 16 23:57:16 2014
@@ -291,8 +291,9 @@
 ;around it freely
 ; NonMil = a 

[Freeciv-commits] r25158 - in /trunk: client/control.c common/unit.c

2014-06-16 Thread 0jacobnk . gna
Author: jtn
Date: Mon Jun 16 23:57:09 2014
New Revision: 25158

URL: http://svn.gna.org/viewcvs/freeciv?rev=25158view=rev
Log:
When choosing a transporter for a unit, prefer less deeply nested ones,
then ones with more move points.

See gna bug #22189.

Modified:
trunk/client/control.c
trunk/common/unit.c

Modified: trunk/client/control.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/control.c?rev=25158r1=25157r2=25158view=diff
==
--- trunk/client/control.c  (original)
+++ trunk/client/control.c  Mon Jun 16 23:57:09 2014
@@ -1640,7 +1640,7 @@
 /
   Send a request to the server that the cargo be loaded into the transporter.
 
-  If ptransporter is NULL a transporter will be picked at random.
+  If ptransporter is NULL a suitable transporter will be chosen.
 /
 void request_unit_load(struct unit *pcargo, struct unit *ptrans)
 {

Modified: trunk/common/unit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.c?rev=25158r1=25157r2=25158view=diff
==
--- trunk/common/unit.c (original)
+++ trunk/common/unit.c Mon Jun 16 23:57:09 2014
@@ -1972,15 +1972,24 @@
 /
 struct unit *transporter_for_unit(const struct unit *pcargo)
 {
-  struct tile *ptile = unit_tile(pcargo);
-
-  unit_list_iterate(ptile-units, ptrans) {
+  struct unit_list *tile_units = unit_tile(pcargo)-units;
+  struct unit *best = NULL;
+  int bestdepth = 0; /* initialiser doesn't matter */
+
+  unit_list_iterate(tile_units, ptrans) {
 if (can_unit_load(pcargo, ptrans)) {
-  return ptrans;
+  int depth = unit_transport_depth(ptrans);
+  if (!best || depth  bestdepth) {
+best = ptrans;
+bestdepth = depth;
+  } else if (depth == bestdepth
+  ptrans-moves_left  best-moves_left) {
+best = ptrans;
+  }
 }
   } unit_list_iterate_end;
 
-  return NULL;
+  return best;
 }
 
 /


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r25161 - in /branches/S2_5/data: alien/ civ2civ3/ classic/ experimental/ multiplayer/

2014-06-16 Thread 0jacobnk . gna
Author: jtn
Date: Mon Jun 16 23:59:49 2014
New Revision: 25161

URL: http://svn.gna.org/viewcvs/freeciv?rev=25161view=rev
Log:
Add NoCities and UnsafeCoast flags to Inaccessible terrain.

See gna patch #4784.

Modified:
branches/S2_5/data/alien/terrain.ruleset
branches/S2_5/data/civ2civ3/terrain.ruleset
branches/S2_5/data/classic/terrain.ruleset
branches/S2_5/data/experimental/terrain.ruleset
branches/S2_5/data/multiplayer/terrain.ruleset

Modified: branches/S2_5/data/alien/terrain.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/alien/terrain.ruleset?rev=25161r1=25160r2=25161view=diff
==
--- branches/S2_5/data/alien/terrain.ruleset(original)
+++ branches/S2_5/data/alien/terrain.rulesetMon Jun 16 23:59:49 2014
@@ -198,7 +198,7 @@
 warmer_drier_result  = no
 cooler_wetter_result = no
 cooler_drier_result  = no
-flags= NotGenerated, NoPollution
+flags= NotGenerated, NoPollution, NoCities, UnsafeCoast
 color.r  = 25
 color.g  = 25
 color.b  = 25

Modified: branches/S2_5/data/civ2civ3/terrain.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/civ2civ3/terrain.ruleset?rev=25161r1=25160r2=25161view=diff
==
--- branches/S2_5/data/civ2civ3/terrain.ruleset (original)
+++ branches/S2_5/data/civ2civ3/terrain.ruleset Mon Jun 16 23:59:49 2014
@@ -206,7 +206,7 @@
 warmer_drier_result  = no
 cooler_wetter_result = no
 cooler_drier_result  = no
-flags= NotGenerated, NoPollution
+flags= NotGenerated, NoPollution, NoCities, UnsafeCoast
 color.r  = 25
 color.g  = 25
 color.b  = 25

Modified: branches/S2_5/data/classic/terrain.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/classic/terrain.ruleset?rev=25161r1=25160r2=25161view=diff
==
--- branches/S2_5/data/classic/terrain.ruleset  (original)
+++ branches/S2_5/data/classic/terrain.ruleset  Mon Jun 16 23:59:49 2014
@@ -206,7 +206,7 @@
 warmer_drier_result  = no
 cooler_wetter_result = no
 cooler_drier_result  = no
-flags= NotGenerated, NoPollution
+flags= NotGenerated, NoPollution, NoCities, UnsafeCoast
 color.r  = 25
 color.g  = 25
 color.b  = 25

Modified: branches/S2_5/data/experimental/terrain.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/experimental/terrain.ruleset?rev=25161r1=25160r2=25161view=diff
==
--- branches/S2_5/data/experimental/terrain.ruleset (original)
+++ branches/S2_5/data/experimental/terrain.ruleset Mon Jun 16 23:59:49 2014
@@ -208,7 +208,7 @@
 warmer_drier_result  = no
 cooler_wetter_result = no
 cooler_drier_result  = no
-flags= NotGenerated, NoPollution
+flags= NotGenerated, NoPollution, NoCities, UnsafeCoast
 color.r  = 25
 color.g  = 25
 color.b  = 25

Modified: branches/S2_5/data/multiplayer/terrain.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/multiplayer/terrain.ruleset?rev=25161r1=25160r2=25161view=diff
==
--- branches/S2_5/data/multiplayer/terrain.ruleset  (original)
+++ branches/S2_5/data/multiplayer/terrain.ruleset  Mon Jun 16 23:59:49 2014
@@ -206,7 +206,7 @@
 warmer_drier_result  = no
 cooler_wetter_result = no
 cooler_drier_result  = no
-flags= NotGenerated, NoPollution
+flags= NotGenerated, NoPollution, NoCities, UnsafeCoast
 color.r  = 25
 color.g  = 25
 color.b  = 25


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r25162 - /branches/S2_5/client/helpdata.c

2014-06-16 Thread 0jacobnk . gna
Author: jtn
Date: Mon Jun 16 23:59:52 2014
New Revision: 25162

URL: http://svn.gna.org/viewcvs/freeciv?rev=25162view=rev
Log:
Don't claim veteran Nuclear units with no defence have increased
strength in combat; they don't.

Reported by 'vla22'.

See gna bug #22165.

Modified:
branches/S2_5/client/helpdata.c

Modified: branches/S2_5/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/helpdata.c?rev=25162r1=25161r2=25162view=diff
==
--- branches/S2_5/client/helpdata.c (original)
+++ branches/S2_5/client/helpdata.c Mon Jun 16 23:59:52 2014
@@ -2650,7 +2650,7 @@
  * through combat/missions/work. */
 CATLSTR(buf, bufsz, _(* May acquire veteran status.\n));
 if (utype_veteran_has_power_bonus(utype)) {
-  if (utype-attack_strength  0
+  if ((!utype_has_flag(utype, UTYF_NUCLEAR)  utype-attack_strength  0)
   || utype-defense_strength  0) {
 CATLSTR(buf, bufsz,
 _(  * Veterans have increased strength in combat.\n));


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r25167 - in /branches/S2_5: client/ data/alien/ data/civ2civ3/ data/classic/ data/experimental/ data/multiplayer/

2014-06-16 Thread 0jacobnk . gna
Author: jtn
Date: Tue Jun 17 00:00:09 2014
New Revision: 25167

URL: http://svn.gna.org/viewcvs/freeciv?rev=25167view=rev
Log:
Correct IgTer help and ruleset comments.

Ruleset comments requested by Marko Lindqvist (cazfi@gna).

See gna bug #22195.

Modified:
branches/S2_5/client/helpdata.c
branches/S2_5/data/alien/units.ruleset
branches/S2_5/data/civ2civ3/units.ruleset
branches/S2_5/data/classic/units.ruleset
branches/S2_5/data/experimental/units.ruleset
branches/S2_5/data/multiplayer/units.ruleset

Modified: branches/S2_5/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/helpdata.c?rev=25167r1=25166r2=25167view=diff
==
--- branches/S2_5/client/helpdata.c (original)
+++ branches/S2_5/client/helpdata.c Tue Jun 17 00:00:09 2014
@@ -2553,8 +2553,13 @@
 utype-bombard_rate);
   }
   if (utype_has_flag(utype, UTYF_IGTER)) {
-CATLSTR(buf, bufsz,
-   _(* Ignores terrain effects (treats all tiles as roads).\n));
+cat_snprintf(buf, bufsz,
+ /* TRANS: MP = movement points. %s may have a 
+  * fractional part. */
+ _(* Ignores terrain effects (moving costs at most %s MP 
+   per tile).\n),
+ move_points_text(terrain_control.igter_cost,
+  NULL, NULL, FALSE));
   }
   if (utype_has_flag(utype, UTYF_IGZOC)) {
 CATLSTR(buf, bufsz, _(* Ignores zones of control.\n));

Modified: branches/S2_5/data/alien/units.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/alien/units.ruleset?rev=25167r1=25166r2=25167view=diff
==
--- branches/S2_5/data/alien/units.ruleset  (original)
+++ branches/S2_5/data/alien/units.ruleset  Tue Jun 17 00:00:09 2014
@@ -254,8 +254,9 @@
 ; ZOC flag
 ; NonMil  = a non-military unit: no attacks; no martial law; can enter
 ; peaceful borders; DoesntOccupyTile
-; IgTer   = ignore terrain/road etc, use constant move cost defined in
-; igter_cost (terrain.ruleset)
+; IgTer   = use constant move cost defined in igter_cost 
(terrain.ruleset)
+; rather than terrain/road etc cost, unless terrain cost is
+; less
 ; OneAttack  = can only make a single attack, regardless of movement points
 ; IgWall = ignore effect of city walls
 ; FieldUnit  = cause unhappiness even when not being aggressive

Modified: branches/S2_5/data/civ2civ3/units.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/civ2civ3/units.ruleset?rev=25167r1=25166r2=25167view=diff
==
--- branches/S2_5/data/civ2civ3/units.ruleset   (original)
+++ branches/S2_5/data/civ2civ3/units.ruleset   Tue Jun 17 00:00:09 2014
@@ -296,8 +296,9 @@
 ; ZOC flag
 ; NonMil = a non-military unit: no attacks; no martial law; can enter
 ; peaceful borders; DoesntOccupyTile
-; IgTer   = ignore terrain/road etc, use constant move cost defined in
-; igter_cost (terrain.ruleset)
+; IgTer   = use constant move cost defined in igter_cost 
(terrain.ruleset)
+; rather than terrain/road etc cost, unless terrain cost is
+; less
 ; OneAttack  = can only make a single attack, regardless of movement points
 ; IgWall = ignore effect of city walls
 ; FieldUnit  = cause unhappiness even when not being aggressive

Modified: branches/S2_5/data/classic/units.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/classic/units.ruleset?rev=25167r1=25166r2=25167view=diff
==
--- branches/S2_5/data/classic/units.ruleset(original)
+++ branches/S2_5/data/classic/units.rulesetTue Jun 17 00:00:09 2014
@@ -273,8 +273,9 @@
 ; ZOC flag
 ; NonMil = a non-military unit: no attacks; no martial law; can enter
 ; peaceful borders; DoesntOccupyTile
-; IgTer   = ignore terrain/road etc, use constant move cost defined in
-; igter_cost (terrain.ruleset)
+; IgTer   = use constant move cost defined in igter_cost 
(terrain.ruleset)
+; rather than terrain/road etc cost, unless terrain cost is
+; less
 ; OneAttack  = can only make a single attack, regardless of movement points
 ; IgWall = ignore effect of city walls
 ; FieldUnit  = cause unhappiness even when not being aggressive

Modified: branches/S2_5/data/experimental/units.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/data/experimental/units.ruleset?rev=25167r1=25166r2=25167view=diff
==
--- 

[Freeciv-commits] r25166 - in /branches/S2_5: client/helpdata.c client/packhand.c common/movement.c common/movement.h server/ruleset.c

2014-06-16 Thread 0jacobnk . gna
Author: jtn
Date: Tue Jun 17 00:00:06 2014
New Revision: 25166

URL: http://svn.gna.org/viewcvs/freeciv?rev=25166view=rev
Log:
Fix minor bugs in display of fractional movement points resulting from
generalisation of move_fragments, and reduce fractional MP to lowest terms.
Use move_points_text() in road helptext.

See gna bug #22194.

Modified:
branches/S2_5/client/helpdata.c
branches/S2_5/client/packhand.c
branches/S2_5/common/movement.c
branches/S2_5/common/movement.h
branches/S2_5/server/ruleset.c

Modified: branches/S2_5/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/helpdata.c?rev=25166r1=25165r2=25166view=diff
==
--- branches/S2_5/client/helpdata.c (original)
+++ branches/S2_5/client/helpdata.c Tue Jun 17 00:00:06 2014
@@ -3097,8 +3097,11 @@
 CATLSTR(buf, bufsz, _(* Allows infinite movement.\n));
   } else {
 cat_snprintf(buf, bufsz,
- _(* Movement cost along this road is %d/%d movement 
points.\n),
- proad-move_cost, SINGLE_MOVE);
+ /* TRANS: MP = movement points. Second %s may have a
+  * fractional part. */
+ _(* Movement cost along %s is %s MP.\n),
+ road_name_translation(proad),
+ move_points_text(proad-move_cost, NULL, NULL, FALSE));
   }
 
   if (!proad-buildable) {

Modified: branches/S2_5/client/packhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/packhand.c?rev=25166r1=25165r2=25166view=diff
==
--- branches/S2_5/client/packhand.c (original)
+++ branches/S2_5/client/packhand.c Tue Jun 17 00:00:06 2014
@@ -34,6 +34,7 @@
 #include government.h
 #include idex.h
 #include map.h
+#include movement.h
 #include name_translation.h
 #include nation.h
 #include packets.h
@@ -3366,6 +3367,8 @@
   /* Since terrain_control is the same as packet_ruleset_terrain_control
* we can just copy the data directly. */
   terrain_control = *p;
+  /* terrain_control.move_fragments likely changed */
+  init_move_fragments();
 }
 
 /

Modified: branches/S2_5/common/movement.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/movement.c?rev=25166r1=25165r2=25166view=diff
==
--- branches/S2_5/common/movement.c (original)
+++ branches/S2_5/common/movement.c Tue Jun 17 00:00:06 2014
@@ -618,9 +618,23 @@
   return availability;
 }
 
-/
-  Render movement points as text, including fractional movement points,
-  scaled by SINGLE_MOVE. Returns a pointer to a static buffer.
+static int move_points_denomlen = 0;
+
+/
+  Call whenever terrain_control.move_fragments / SINGLE_MOVE changes.
+/
+void init_move_fragments(void)
+{
+  char denomstr[10];
+  /* String length of maximum denominator for fractional representation of
+   * movement points, for padding of text representation */
+  fc_snprintf(denomstr, sizeof(denomstr), %d, SINGLE_MOVE);
+  move_points_denomlen = strlen(denomstr);
+}
+
+/
+  Render positive movement points as text, including fractional movement
+  points, scaled by SINGLE_MOVE. Returns a pointer to a static buffer.
   'prefix' is a string put in front of all numeric output.
   'none' is the string to display in place of the integer part if no
   movement points (or NULL to just say 0).
@@ -632,45 +646,51 @@
  bool align)
 {
   static struct astring str = ASTRING_INIT;
-  static int denomlen = 0;
   int pad1, pad2;
 
-  if (denomlen == 0) {
-/* String length of denominator for fractional representation of
- * movement points, for padding */
-char denomstr[10];
-fc_snprintf(denomstr, sizeof(denomstr), %d, SINGLE_MOVE);
-denomlen = strlen(denomstr);
-  }
-  if (align) {
-pad1 = denomlen; /* numerator or denominator */
-pad2 = denomlen*2+2; /* everything right of integer part */
+  if (align  SINGLE_MOVE  1) {
+pad1 = move_points_denomlen;  /* numerator or denominator */
+pad2 = move_points_denomlen*2+2;  /* everything right of integer part */
   } else {
+/* If no fractional part, no need for alignment even if requested */
 pad1 = pad2 = 0;
   }
   if (!prefix) {
 prefix = ;
   }
   astr_clear(str);
-  if ((mp == 0 || SINGLE_MOVE == 0)  none) {
-/* No movement points, special representation */
-astr_add(str, %s%*s, none, pad2, );
-  } else if (SINGLE_MOVE == 0) {
-/* Do not divide by zero. 

[Freeciv-commits] r25164 - /branches/S2_5/common/unit.c

2014-06-16 Thread 0jacobnk . gna
Author: jtn
Date: Mon Jun 16 23:59:58 2014
New Revision: 25164

URL: http://svn.gna.org/viewcvs/freeciv?rev=25164view=rev
Log:
Allow unloading from a nested transport, in line with the recent change
to allow loading onto such a transport.

See gna bug #22190.

Modified:
branches/S2_5/common/unit.c

Modified: branches/S2_5/common/unit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/unit.c?rev=25164r1=25163r2=25164view=diff
==
--- branches/S2_5/common/unit.c (original)
+++ branches/S2_5/common/unit.c Mon Jun 16 23:59:58 2014
@@ -807,7 +807,7 @@
 return FALSE;
   }
 
-  /* Only top-level transporters may be loaded or loaded into. */
+  /* Cannot load if cargo is already loaded onto something else. */
   if (unit_transported(pcargo)) {
 return FALSE;
   }
@@ -884,13 +884,6 @@
 
   /* Make sure the unit's transporter exists and is known. */
   if (unit_transport_get(pcargo) != ptrans) {
-return FALSE;
-  }
-
-  /* Only top-level transporters may be unloaded.  However the unit being
-   * unloaded may be transporting other units (well, at least it's allowed
-   * here: elsewhere this may be disallowed). */
-  if (unit_transport_get(ptrans)) {
 return FALSE;
   }
 


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r25165 - in /branches/S2_5: client/control.c common/unit.c

2014-06-16 Thread 0jacobnk . gna
Author: jtn
Date: Tue Jun 17 00:00:03 2014
New Revision: 25165

URL: http://svn.gna.org/viewcvs/freeciv?rev=25165view=rev
Log:
When choosing a transporter for a unit, prefer less deeply nested ones,
then ones with more move points.

See gna bug #22189.

Modified:
branches/S2_5/client/control.c
branches/S2_5/common/unit.c

Modified: branches/S2_5/client/control.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/control.c?rev=25165r1=25164r2=25165view=diff
==
--- branches/S2_5/client/control.c  (original)
+++ branches/S2_5/client/control.c  Tue Jun 17 00:00:03 2014
@@ -1648,7 +1648,7 @@
 /
   Send a request to the server that the cargo be loaded into the transporter.
 
-  If ptransporter is NULL a transporter will be picked at random.
+  If ptransporter is NULL a suitable transporter will be chosen.
 /
 void request_unit_load(struct unit *pcargo, struct unit *ptrans)
 {

Modified: branches/S2_5/common/unit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/common/unit.c?rev=25165r1=25164r2=25165view=diff
==
--- branches/S2_5/common/unit.c (original)
+++ branches/S2_5/common/unit.c Tue Jun 17 00:00:03 2014
@@ -1999,15 +1999,24 @@
 /
 struct unit *transporter_for_unit(const struct unit *pcargo)
 {
-  struct tile *ptile = unit_tile(pcargo);
-
-  unit_list_iterate(ptile-units, ptrans) {
+  struct unit_list *tile_units = unit_tile(pcargo)-units;
+  struct unit *best = NULL;
+  int bestdepth = 0; /* initialiser doesn't matter */
+
+  unit_list_iterate(tile_units, ptrans) {
 if (can_unit_load(pcargo, ptrans)) {
-  return ptrans;
+  int depth = unit_transport_depth(ptrans);
+  if (!best || depth  bestdepth) {
+best = ptrans;
+bestdepth = depth;
+  } else if (depth == bestdepth
+  ptrans-moves_left  best-moves_left) {
+best = ptrans;
+  }
 }
   } unit_list_iterate_end;
 
-  return NULL;
+  return best;
 }
 
 /


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r25163 - in /branches/S2_5/server: savegame.c savegame2.c

2014-06-16 Thread 0jacobnk . gna
Author: jtn
Date: Mon Jun 16 23:59:55 2014
New Revision: 25163

URL: http://svn.gna.org/viewcvs/freeciv?rev=25163view=rev
Log:
Protect against savegames where a unit has a higher veteran level than
the current ruleset permits it.

See gna bug #22172.

Modified:
branches/S2_5/server/savegame.c
branches/S2_5/server/savegame2.c

Modified: branches/S2_5/server/savegame.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/savegame.c?rev=25163r1=25162r2=25163view=diff
==
--- branches/S2_5/server/savegame.c (original)
+++ branches/S2_5/server/savegame.c Mon Jun 16 23:59:55 2014
@@ -1438,6 +1438,7 @@
 int nat_x, nat_y;
 const char* type_name;
 struct unit_type *type;
+int veteran;
 enum tile_special_type target;
 struct base_type *pbase = NULL;
 struct road_type *proad = NULL;
@@ -1466,9 +1467,19 @@
 plrno, i, type_name);
   exit(EXIT_FAILURE);
 }
+
+veteran
+  = secfile_lookup_int_default(file, 0, player%d.u%d.veteran, plrno, i);
+{
+  /* Protect against change in veteran system in ruleset */
+  const int levels = utype_veteran_levels(type);
+  if (veteran = levels) {
+fc_assert(levels = 1);
+veteran = levels - 1;
+  }
+}
 
-punit = unit_virtual_create(plr, NULL, type,
-  secfile_lookup_int_default(file, 0, player%d.u%d.veteran, plrno, i));
+punit = unit_virtual_create(plr, NULL, type, veteran);
 fc_assert_exit_msg(secfile_lookup_int(file, punit-id,
   player%d.u%d.id, plrno, i),
%s, secfile_error());

Modified: branches/S2_5/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/savegame2.c?rev=25163r1=25162r2=25163view=diff
==
--- branches/S2_5/server/savegame2.c(original)
+++ branches/S2_5/server/savegame2.cMon Jun 16 23:59:55 2014
@@ -5000,6 +5000,14 @@
 
   punit-veteran
 = secfile_lookup_int_default(loading-file, 0, %s.veteran, unitstr);
+  {
+/* Protect against change in veteran system in ruleset */
+const int levels = utype_veteran_levels(unit_type(punit));
+if (punit-veteran = levels) {
+  fc_assert(levels = 1);
+  punit-veteran = levels - 1;
+}
+  }
   punit-done_moving
 = secfile_lookup_bool_default(loading-file, (punit-moves_left == 0),
   %s.done_moving, unitstr);


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r25168 - /branches/S2_4/client/helpdata.c

2014-06-16 Thread 0jacobnk . gna
Author: jtn
Date: Tue Jun 17 00:05:42 2014
New Revision: 25168

URL: http://svn.gna.org/viewcvs/freeciv?rev=25168view=rev
Log:
Don't claim veteran Nuclear units with no defence have increased
strength in combat; they don't.

Reported by 'vla22'.

See gna bug #22165.

Modified:
branches/S2_4/client/helpdata.c

Modified: branches/S2_4/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_4/client/helpdata.c?rev=25168r1=25167r2=25168view=diff
==
--- branches/S2_4/client/helpdata.c (original)
+++ branches/S2_4/client/helpdata.c Tue Jun 17 00:05:42 2014
@@ -2231,7 +2231,7 @@
  * through combat/missions/work. */
 CATLSTR(buf, bufsz, _(* May acquire veteran status.\n));
 if (utype_veteran_has_power_bonus(utype)) {
-  if (utype-attack_strength  0
+  if ((!utype_has_flag(utype, F_NUCLEAR)  utype-attack_strength  0)
   || utype-defense_strength  0) {
 CATLSTR(buf, bufsz,
 _(  * Veterans have increased strength in combat.\n));


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r25169 - in /branches/S2_4/server: savegame.c savegame2.c

2014-06-16 Thread 0jacobnk . gna
Author: jtn
Date: Tue Jun 17 00:06:27 2014
New Revision: 25169

URL: http://svn.gna.org/viewcvs/freeciv?rev=25169view=rev
Log:
Protect against savegames where a unit has a higher veteran level than
the current ruleset permits it.

See gna bug #22172.

Modified:
branches/S2_4/server/savegame.c
branches/S2_4/server/savegame2.c

Modified: branches/S2_4/server/savegame.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_4/server/savegame.c?rev=25169r1=25168r2=25169view=diff
==
--- branches/S2_4/server/savegame.c (original)
+++ branches/S2_4/server/savegame.c Tue Jun 17 00:06:27 2014
@@ -1943,6 +1943,7 @@
 int nat_x, nat_y;
 const char* type_name;
 struct unit_type *type;
+int veteran;
 enum tile_special_type target;
 struct base_type *pbase = NULL;
 int base;
@@ -1969,9 +1970,19 @@
 plrno, i, type_name);
   exit(EXIT_FAILURE);
 }
+
+veteran
+  = secfile_lookup_int_default(file, 0, player%d.u%d.veteran, plrno, i);
+{
+  /* Protect against change in veteran system in ruleset */
+  const int levels = utype_veteran_levels(type);
+  if (veteran = levels) {
+fc_assert(levels = 1);
+veteran = levels - 1;
+  }
+}
 
-punit = unit_virtual_create(plr, NULL, type,
-  secfile_lookup_int_default(file, 0, player%d.u%d.veteran, plrno, i));
+punit = unit_virtual_create(plr, NULL, type, veteran);
 fc_assert_exit_msg(secfile_lookup_int(file, punit-id,
   player%d.u%d.id, plrno, i),
%s, secfile_error());

Modified: branches/S2_4/server/savegame2.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_4/server/savegame2.c?rev=25169r1=25168r2=25169view=diff
==
--- branches/S2_4/server/savegame2.c(original)
+++ branches/S2_4/server/savegame2.cTue Jun 17 00:06:27 2014
@@ -4562,6 +4562,14 @@
 
   punit-veteran
 = secfile_lookup_int_default(loading-file, 0, %s.veteran, unitstr);
+  {
+/* Protect against change in veteran system in ruleset */
+const int levels = utype_veteran_levels(unit_type(punit));
+if (punit-veteran = levels) {
+  fc_assert(levels = 1);
+  punit-veteran = levels - 1;
+}
+  }
   punit-done_moving
 = secfile_lookup_bool_default(loading-file, (punit-moves_left == 0),
   %s.done_moving, unitstr);


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits