[Freeciv-commits] r34435 - /branches/S2_6/client/gui-gtk-3.22/gui_main.c

2016-11-07 Thread cazfi74
Author: cazfi
Date: Tue Nov  8 06:28:52 2016
New Revision: 34435

URL: http://svn.gna.org/viewcvs/freeciv?rev=34435=rev
Log:
Commented out setup_canvas_color_for_state() from gtk3.22-client

See patch #6797

Modified:
branches/S2_6/client/gui-gtk-3.22/gui_main.c

Modified: branches/S2_6/client/gui-gtk-3.22/gui_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.22/gui_main.c?rev=34435=34434=34435=diff
==
--- branches/S2_6/client/gui-gtk-3.22/gui_main.c(original)
+++ branches/S2_6/client/gui-gtk-3.22/gui_main.cTue Nov  8 06:28:52 2016
@@ -1113,6 +1113,7 @@
 /**
   Override background color for canvases
 **/
+#if 0
 static void setup_canvas_color_for_state(GtkStateFlags state)
 {
   gtk_widget_override_background_color(GTK_WIDGET(overview_canvas), state,
@@ -1120,6 +1121,7 @@
   gtk_widget_override_background_color(GTK_WIDGET(map_canvas), state,
_color(tileset, 
COLOR_OVERVIEW_UNKNOWN)->color);
 }
+#endif
 
 /**
   Do the heavy lifting for the widget setup.
@@ -1485,6 +1487,7 @@
   gtk_widget_set_size_request(map_canvas, 300, 300);
   gtk_widget_set_can_focus(map_canvas, TRUE);
 
+#if 0
   setup_canvas_color_for_state(GTK_STATE_FLAG_NORMAL);
   setup_canvas_color_for_state(GTK_STATE_FLAG_ACTIVE);
   setup_canvas_color_for_state(GTK_STATE_FLAG_PRELIGHT);
@@ -1493,6 +1496,7 @@
   setup_canvas_color_for_state(GTK_STATE_FLAG_INCONSISTENT);
   setup_canvas_color_for_state(GTK_STATE_FLAG_FOCUSED);
   setup_canvas_color_for_state(GTK_STATE_FLAG_BACKDROP);
+#endif
 
   gtk_widget_add_events(map_canvas, GDK_EXPOSURE_MASK
|GDK_BUTTON_PRESS_MASK


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


[Freeciv-commits] r34436 - in /trunk/data/hexemplio: unitcost.png unitcost.spec

2016-11-07 Thread cazfi74
Author: cazfi
Date: Tue Nov  8 06:40:48 2016
New Revision: 34436

URL: http://svn.gna.org/viewcvs/freeciv?rev=34436=rev
Log:
Updated hexemplio unitcost files.

Art by GriffonSpade

See patch #7950

Modified:
trunk/data/hexemplio/unitcost.png
trunk/data/hexemplio/unitcost.spec

Modified: trunk/data/hexemplio/unitcost.png
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/hexemplio/unitcost.png?rev=34436=34435=34436=diff
==
Binary files - no diff available.

Modified: trunk/data/hexemplio/unitcost.spec
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/hexemplio/unitcost.spec?rev=34436=34435=34436=diff
==
--- trunk/data/hexemplio/unitcost.spec  (original)
+++ trunk/data/hexemplio/unitcost.spec  Tue Nov  8 06:40:48 2016
@@ -9,6 +9,7 @@
 artists = "
 Tatu Rissanen 
 Jeff Mallatt  (miscellaneous)
+GriffonSpade [GS]
 "
 
 [file]
@@ -25,9 +26,6 @@
 tiles = { "row", "column", "tag"
 
 ; Unit upkeep in city dialog:
-; These should probably be handled differently and have
-; a different size...
-; values over 2 not loaded by code
 
   0, 0, "upkeep.food"
   0, 1, "upkeep.food2"


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


[Freeciv-commits] r34437 - in /branches/S2_6/data/hexemplio: unitcost.png unitcost.spec

2016-11-07 Thread cazfi74
Author: cazfi
Date: Tue Nov  8 06:40:58 2016
New Revision: 34437

URL: http://svn.gna.org/viewcvs/freeciv?rev=34437=rev
Log:
Updated hexemplio unitcost files.

Art by GriffonSpade

See patch #7950

Modified:
branches/S2_6/data/hexemplio/unitcost.png
branches/S2_6/data/hexemplio/unitcost.spec

Modified: branches/S2_6/data/hexemplio/unitcost.png
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/hexemplio/unitcost.png?rev=34437=34436=34437=diff
==
Binary files - no diff available.

Modified: branches/S2_6/data/hexemplio/unitcost.spec
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/hexemplio/unitcost.spec?rev=34437=34436=34437=diff
==
--- branches/S2_6/data/hexemplio/unitcost.spec  (original)
+++ branches/S2_6/data/hexemplio/unitcost.spec  Tue Nov  8 06:40:58 2016
@@ -9,6 +9,7 @@
 artists = "
 Tatu Rissanen 
 Jeff Mallatt  (miscellaneous)
+GriffonSpade [GS]
 "
 
 [file]
@@ -25,9 +26,6 @@
 tiles = { "row", "column", "tag"
 
 ; Unit upkeep in city dialog:
-; These should probably be handled differently and have
-; a different size...
-; values over 2 not loaded by code
 
   0, 0, "upkeep.food"
   0, 1, "upkeep.food2"


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


[Freeciv-commits] r34439 - in /branches/S2_6/client: gui-gtk-3.0/ gui-gtk-3.22/

2016-11-07 Thread cazfi74
Author: cazfi
Date: Tue Nov  8 07:29:20 2016
New Revision: 34439

URL: http://svn.gna.org/viewcvs/freeciv?rev=34439=rev
Log:
Use proper overlays for units in citydlg present units area.

See bug #24642

Modified:
branches/S2_6/client/gui-gtk-3.0/citydlg.c
branches/S2_6/client/gui-gtk-3.22/citydlg.c
branches/S2_6/client/gui-gtk-3.22/gui_main.c
branches/S2_6/client/gui-gtk-3.22/mapview.c
branches/S2_6/client/gui-gtk-3.22/mapview.h

Modified: branches/S2_6/client/gui-gtk-3.0/citydlg.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/citydlg.c?rev=34439=34438=34439=diff
==
--- branches/S2_6/client/gui-gtk-3.0/citydlg.c  (original)
+++ branches/S2_6/client/gui-gtk-3.0/citydlg.c  Tue Nov  8 07:29:20 2016
@@ -533,11 +533,13 @@
   pcity_sup = game_city_by_number(punit->homecity);
   pcity_pre = tile_city(unit_tile(punit));
 
-  if (pcity_sup && (pdialog = get_city_dialog(pcity_sup)))
+  if (pcity_sup && (pdialog = get_city_dialog(pcity_sup))) {
 city_dialog_update_supported_units(pdialog);
-
-  if (pcity_pre && (pdialog = get_city_dialog(pcity_pre)))
+  }
+
+  if (pcity_pre && (pdialog = get_city_dialog(pcity_pre))) {
 city_dialog_update_present_units(pdialog);
+  }
 }
 
 /

Modified: branches/S2_6/client/gui-gtk-3.22/citydlg.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.22/citydlg.c?rev=34439=34438=34439=diff
==
--- branches/S2_6/client/gui-gtk-3.22/citydlg.c (original)
+++ branches/S2_6/client/gui-gtk-3.22/citydlg.c Tue Nov  8 07:29:20 2016
@@ -535,11 +535,13 @@
   pcity_sup = game_city_by_number(punit->homecity);
   pcity_pre = tile_city(unit_tile(punit));
 
-  if (pcity_sup && (pdialog = get_city_dialog(pcity_sup)))
+  if (pcity_sup && (pdialog = get_city_dialog(pcity_sup))) {
 city_dialog_update_supported_units(pdialog);
-
-  if (pcity_pre && (pdialog = get_city_dialog(pcity_pre)))
+  }
+
+  if (pcity_pre && (pdialog = get_city_dialog(pcity_pre))) {
 city_dialog_update_present_units(pdialog);
+  }
 }
 
 /
@@ -2252,7 +2254,7 @@
   cmd = pnode->cmd;
   pix = pnode->pix;
 
-  put_unit_image(punit, GTK_IMAGE(pix));
+  put_unit_image(punit, GTK_IMAGE(pix), pnode->height);
 
   g_signal_handlers_disconnect_matched(cmd,
  G_SIGNAL_MATCH_FUNC,

Modified: branches/S2_6/client/gui-gtk-3.22/gui_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.22/gui_main.c?rev=34439=34438=34439=diff
==
--- branches/S2_6/client/gui-gtk-3.22/gui_main.c(original)
+++ branches/S2_6/client/gui-gtk-3.22/gui_main.cTue Nov  8 07:29:20 2016
@@ -1919,7 +1919,7 @@
   }
 
   if (punit) {
-put_unit_image(punit, GTK_IMAGE(w));
+put_unit_image(punit, GTK_IMAGE(w), -1);
   } else {
 gtk_image_clear(GTK_IMAGE(w));
   }

Modified: branches/S2_6/client/gui-gtk-3.22/mapview.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.22/mapview.c?rev=34439=34438=34439=diff
==
--- branches/S2_6/client/gui-gtk-3.22/mapview.c (original)
+++ branches/S2_6/client/gui-gtk-3.22/mapview.c Tue Nov  8 07:29:20 2016
@@ -497,16 +497,27 @@
 /**
   Fill image with unit gfx
 **/
-void put_unit_image(struct unit *punit, GtkImage *p)
-{
-  GdkPixbuf *pixbuf;
-  struct sprite *spr;
-
-  spr = get_unittype_sprite(tileset, unit_type_get(punit), punit->facing, 
FALSE);
-  pixbuf = sprite_get_pixbuf(spr);
-
-  gtk_image_set_from_pixbuf(p, pixbuf);
-  g_object_unref(pixbuf);
+void put_unit_image(struct unit *punit, GtkImage *p, int height)
+{
+  struct canvas store = FC_STATIC_CANVAS_INIT;
+  int width;
+
+  if (height <= 0) {
+struct sprite *spr;
+
+spr = get_unittype_sprite(tileset, unit_type_get(punit), punit->facing, 
FALSE);
+get_sprite_dimensions(spr, , );
+  } else {
+width = tileset_full_tile_width(tileset);
+  }
+
+  store.surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
+ width, height);
+
+  put_unit(punit, , 1.0, 0, 0);
+
+  gtk_image_set_from_surface(p, store.surface);
+  cairo_surface_destroy(store.surface);
 }
 
 /**

Modified: branches/S2_6/client/gui-gtk-3.22/mapview.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.22/mapview.h?rev=34439=34438=34439=diff
==
--- 

[Freeciv-commits] r34438 - in /trunk/client: gui-gtk-3.0/ gui-gtk-3.22/

2016-11-07 Thread cazfi74
Author: cazfi
Date: Tue Nov  8 07:29:10 2016
New Revision: 34438

URL: http://svn.gna.org/viewcvs/freeciv?rev=34438=rev
Log:
Use proper overlays for units in citydlg present units area.

See bug #24642

Modified:
trunk/client/gui-gtk-3.0/citydlg.c
trunk/client/gui-gtk-3.0/gui_main.c
trunk/client/gui-gtk-3.0/mapview.c
trunk/client/gui-gtk-3.0/mapview.h
trunk/client/gui-gtk-3.22/citydlg.c
trunk/client/gui-gtk-3.22/gui_main.c
trunk/client/gui-gtk-3.22/mapview.c
trunk/client/gui-gtk-3.22/mapview.h

Modified: trunk/client/gui-gtk-3.0/citydlg.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/citydlg.c?rev=34438=34437=34438=diff
==
--- trunk/client/gui-gtk-3.0/citydlg.c  (original)
+++ trunk/client/gui-gtk-3.0/citydlg.c  Tue Nov  8 07:29:10 2016
@@ -535,11 +535,13 @@
   pcity_sup = game_city_by_number(punit->homecity);
   pcity_pre = tile_city(unit_tile(punit));
 
-  if (pcity_sup && (pdialog = get_city_dialog(pcity_sup)))
+  if (pcity_sup && (pdialog = get_city_dialog(pcity_sup))) {
 city_dialog_update_supported_units(pdialog);
-
-  if (pcity_pre && (pdialog = get_city_dialog(pcity_pre)))
+  }
+
+  if (pcity_pre && (pdialog = get_city_dialog(pcity_pre))) {
 city_dialog_update_present_units(pdialog);
+  }
 }
 
 /
@@ -2212,7 +2214,7 @@
   cmd = pnode->cmd;
   pix = pnode->pix;
 
-  put_unit_image(punit, GTK_IMAGE(pix));
+  put_unit_image(punit, GTK_IMAGE(pix), pnode->height);
 
   g_signal_handlers_disconnect_matched(cmd,
  G_SIGNAL_MATCH_FUNC,

Modified: trunk/client/gui-gtk-3.0/gui_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/gui_main.c?rev=34438=34437=34438=diff
==
--- trunk/client/gui-gtk-3.0/gui_main.c (original)
+++ trunk/client/gui-gtk-3.0/gui_main.c Tue Nov  8 07:29:10 2016
@@ -1915,7 +1915,7 @@
   }
 
   if (punit) {
-put_unit_image(punit, GTK_IMAGE(w));
+put_unit_image(punit, GTK_IMAGE(w), -1);
   } else {
 gtk_image_clear(GTK_IMAGE(w));
   }

Modified: trunk/client/gui-gtk-3.0/mapview.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/mapview.c?rev=34438=34437=34438=diff
==
--- trunk/client/gui-gtk-3.0/mapview.c  (original)
+++ trunk/client/gui-gtk-3.0/mapview.c  Tue Nov  8 07:29:10 2016
@@ -464,16 +464,27 @@
 /**
   Fill image with unit gfx
 **/
-void put_unit_image(struct unit *punit, GtkImage *p)
-{
-  GdkPixbuf *pixbuf;
-  struct sprite *spr;
-
-  spr = get_unittype_sprite(tileset, unit_type_get(punit), punit->facing);
-  pixbuf = sprite_get_pixbuf(spr);
-
-  gtk_image_set_from_pixbuf(p, pixbuf);
-  g_object_unref(pixbuf);
+void put_unit_image(struct unit *punit, GtkImage *p, int height)
+{
+  struct canvas store = FC_STATIC_CANVAS_INIT;
+  int width;
+
+  if (height <= 0) {
+struct sprite *spr;
+
+spr = get_unittype_sprite(tileset, unit_type_get(punit), punit->facing);
+get_sprite_dimensions(spr, , );
+  } else {
+width = tileset_full_tile_width(tileset);
+  }
+
+  store.surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32,
+ width, height);
+
+  put_unit(punit, , 1.0, 0, 0);
+
+  gtk_image_set_from_surface(p, store.surface);
+  cairo_surface_destroy(store.surface);
 }
 
 /**

Modified: trunk/client/gui-gtk-3.0/mapview.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/mapview.h?rev=34438=34437=34438=diff
==
--- trunk/client/gui-gtk-3.0/mapview.h  (original)
+++ trunk/client/gui-gtk-3.0/mapview.h  Tue Nov  8 07:29:10 2016
@@ -36,7 +36,7 @@
 gboolean map_canvas_configure(GtkWidget *w, GdkEventConfigure *ev,
   gpointer data);
 
-void put_unit_image(struct unit *punit, GtkImage *p);
+void put_unit_image(struct unit *punit, GtkImage *p, int height);
 
 void put_unit_image_city_overlays(struct unit *punit, GtkImage *p,
   int height, int *upkeep_cost, int 
happy_cost);

Modified: trunk/client/gui-gtk-3.22/citydlg.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.22/citydlg.c?rev=34438=34437=34438=diff
==
--- trunk/client/gui-gtk-3.22/citydlg.c (original)
+++ trunk/client/gui-gtk-3.22/citydlg.c Tue Nov  8 07:29:10 2016
@@ -535,11 +535,13 @@
   pcity_sup = game_city_by_number(punit->homecity);
   pcity_pre = tile_city(unit_tile(punit));
 
-  if (pcity_sup && 

[Freeciv-commits] r34440 - in /trunk/client: gui-gtk-2.0/ gui-gtk-3.0/ gui-gtk-3.22/ gui-qt/

2016-11-07 Thread cazfi74
Author: cazfi
Date: Tue Nov  8 08:00:26 2016
New Revision: 34440

URL: http://svn.gna.org/viewcvs/freeciv?rev=34440=rev
Log:
Cleaned out remaining radar sprite code.

See patch #7949

Modified:
trunk/client/gui-gtk-2.0/graphics.c
trunk/client/gui-gtk-2.0/graphics.h
trunk/client/gui-gtk-2.0/mapview.c
trunk/client/gui-gtk-3.0/graphics.c
trunk/client/gui-gtk-3.0/graphics.h
trunk/client/gui-gtk-3.0/mapview.c
trunk/client/gui-gtk-3.22/graphics.c
trunk/client/gui-gtk-3.22/graphics.h
trunk/client/gui-gtk-3.22/mapview.c
trunk/client/gui-qt/graphics.cpp

Modified: trunk/client/gui-gtk-2.0/graphics.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/graphics.c?rev=34440=34439=34440=diff
==
--- trunk/client/gui-gtk-2.0/graphics.c (original)
+++ trunk/client/gui-gtk-2.0/graphics.c Tue Nov  8 08:00:26 2016
@@ -1,4 +1,4 @@
-/** 
+/***
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -48,7 +48,6 @@
 #include "graphics.h"
 
 struct sprite *intro_gfx_sprite;
-struct sprite *radar_gfx_sprite;
 
 GdkCursor *fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES];
 
@@ -144,10 +143,6 @@
 {
   if (intro_gfx_sprite) {
 free_sprite(intro_gfx_sprite);
-intro_gfx_sprite=NULL;
-  }
-  if (radar_gfx_sprite) {
-free_sprite(radar_gfx_sprite);
-radar_gfx_sprite=NULL;
+intro_gfx_sprite = NULL;
   }
 }

Modified: trunk/client/gui-gtk-2.0/graphics.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/graphics.h?rev=34440=34439=34440=diff
==
--- trunk/client/gui-gtk-2.0/graphics.h (original)
+++ trunk/client/gui-gtk-2.0/graphics.h Tue Nov  8 08:00:26 2016
@@ -1,4 +1,4 @@
-/** 
+/***
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -25,7 +25,6 @@
  enum direction8 facing);
 
 extern struct sprite *intro_gfx_sprite;
-extern struct sprite *radar_gfx_sprite;
 
 /* This name is to avoid a naming conflict with a global 'cursors'
  * variable in GTK+-2.6.  See PR#12459. */

Modified: trunk/client/gui-gtk-2.0/mapview.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/mapview.c?rev=34440=34439=34440=diff
==
--- trunk/client/gui-gtk-2.0/mapview.c  (original)
+++ trunk/client/gui-gtk-2.0/mapview.c  Tue Nov  8 08:00:26 2016
@@ -324,12 +324,6 @@
 gboolean overview_canvas_expose(GtkWidget *w, GdkEventExpose *ev, gpointer 
data)
 {
   if (!can_client_change_view()) {
-if (radar_gfx_sprite) {
-  gdk_draw_drawable(overview_canvas->window, civ_gc,
-   radar_gfx_sprite->pixmap, ev->area.x, ev->area.y,
-   ev->area.x, ev->area.y,
-   ev->area.width, ev->area.height);
-}
 return TRUE;
   }
   

Modified: trunk/client/gui-gtk-3.0/graphics.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/graphics.c?rev=34440=34439=34440=diff
==
--- trunk/client/gui-gtk-3.0/graphics.c (original)
+++ trunk/client/gui-gtk-3.0/graphics.c Tue Nov  8 08:00:26 2016
@@ -1,4 +1,4 @@
-/** 
+/***
  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
@@ -46,7 +46,6 @@
 #include "graphics.h"
 
 struct sprite *intro_gfx_sprite;
-struct sprite *radar_gfx_sprite;
 
 GdkCursor *fc_cursors[CURSOR_LAST][NUM_CURSOR_FRAMES];
 
@@ -99,10 +98,6 @@
 {
   if (intro_gfx_sprite) {
 free_sprite(intro_gfx_sprite);
-intro_gfx_sprite=NULL;
-  }
-  if (radar_gfx_sprite) {
-free_sprite(radar_gfx_sprite);
-radar_gfx_sprite=NULL;
+intro_gfx_sprite = NULL;
   }
 }

Modified: trunk/client/gui-gtk-3.0/graphics.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/graphics.h?rev=34440=34439=34440=diff
==
--- trunk/client/gui-gtk-3.0/graphics.h (original)
+++ trunk/client/gui-gtk-3.0/graphics.h Tue Nov  8 08:00:26 2016

[Freeciv-commits] r34432 - /trunk/server/unittools.c

2016-11-07 Thread sveinung84
Author: sveinung
Date: Mon Nov  7 13:42:27 2016
New Revision: 34432

URL: http://svn.gna.org/viewcvs/freeciv?rev=34432=rev
Log:
autoattack: have the best attacker go first.

A unit will only auto attack if its probability of success is above a
certain threshold. The threshold is currently 90% if the unit is the last
defender in a city and 25% otherwise.

A unit's probability of success against a target can depend on target
specific factors. One example of target relative unit strength is how the
classic ruleset gives a defense bonus to Pikemen when attacked by Horsemen.

Up unit now the potential attacker with the *worst* odds (above the
threshold) have attacked first.
 * saved the stronger units for more worthy potential future enemies.
   (Thanks to Jacob Nevins  for noticing.)
 * made it harder to lure strong enemy units out of the way by using
   sacrificial units. (A regular attack may, depending on the occupychance
   server setting, make the attacker move after victory is achieved)
 * made it possible to exploit target relative unit strength by moving a
   unit a strong unit in a unit stack is weak against next to the tile.
 * increased the probability of the auto attacker losing and dying.
 * decreased the probability of a follow up attack (target weakness can
   increase the probability of victory enough to have it pass the threshold)

Make the potential attacker with the *best* odds attack first.
 * makes it possible to waste a strong unit's attacks by sending weak units
   against it. (Assuming a more or less global ranking of attack strength.)
 * makes it possible to lure away strong units by using sacrificial units.
   (Assuming a more or less global ranking of attack strength.)
 * target specific factors are exploited to the autoattacker's advantage.
   This beats the advantage of the old system because attacker unit strength
   can depend on the target unit.
 * reduces the probability of the auto attacker dying during the attack.
 * increases the probability of a second auto attacker finishing of the
   target if the first auto attacker fails.

See patch #7942

Modified:
trunk/server/unittools.c

Modified: trunk/server/unittools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unittools.c?rev=34432=34431=34432=diff
==
--- trunk/server/unittools.c(original)
+++ trunk/server/unittools.cMon Nov  7 13:42:27 2016
@@ -3052,8 +3052,13 @@
 /* The units have a different number of recursive transporters. */
 return unit_transport_depth(q1unit) - unit_transport_depth(p1unit);
   } else {
-/* Assume the worst. */
-return action_prob_cmp_pessimist((*p1)->prob, (*q1)->prob);
+/* Put the units with the highest probability of success first. The up
+ * side of this is that units with bonuses against the victim attacks
+ * before other units. The downside is that strong units can be lead
+ * away by sacrificial units. */
+return (-1
+/* Assume the worst. */
+* action_prob_cmp_pessimist((*p1)->prob, (*q1)->prob));
   }
 }
 
@@ -3097,7 +3102,8 @@
 } unit_list_iterate_end;
   } adjc_iterate_end;
 
-  /* The unit list is now sorted according to win chance against punit */
+  /* Sort the potential attackers from highest to lowest success
+   * probability. */
   if (autoattack_prob_list_size(autoattack) >= 2) {
 autoattack_prob_list_sort(autoattack, _units);
   }


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


[Freeciv-commits] r34433 - /branches/S2_6/server/unittools.c

2016-11-07 Thread sveinung84
Author: sveinung
Date: Mon Nov  7 13:44:50 2016
New Revision: 34433

URL: http://svn.gna.org/viewcvs/freeciv?rev=34433=rev
Log:
autoattack: have the best attacker go first.

A unit will only auto attack if its probability of success is above a
certain threshold. The threshold is currently 90% if the unit is the last
defender in a city and 25% otherwise.

A unit's probability of success against a target can depend on target
specific factors. One example of target relative unit strength is how the
classic ruleset gives a defense bonus to Pikemen when attacked by Horsemen.

Up unit now the potential attacker with the *worst* odds (above the
threshold) have attacked first.
 * saved the stronger units for more worthy potential future enemies.
   (Thanks to Jacob Nevins  for noticing.)
 * made it harder to lure strong enemy units out of the way by using
   sacrificial units. (A regular attack may, depending on the occupychance
   server setting, make the attacker move after victory is achieved)
 * made it possible to exploit target relative unit strength by moving a
   unit a strong unit in a unit stack is weak against next to the tile.
 * increased the probability of the auto attacker losing and dying.
 * decreased the probability of a follow up attack (target weakness can
   increase the probability of victory enough to have it pass the threshold)

Make the potential attacker with the *best* odds attack first.
 * makes it possible to waste a strong unit's attacks by sending weak units
   against it. (Assuming a more or less global ranking of attack strength.)
 * makes it possible to lure away strong units by using sacrificial units.
   (Assuming a more or less global ranking of attack strength.)
 * target specific factors are exploited to the autoattacker's advantage.
   This beats the advantage of the old system because attacker unit strength
   can depend on the target unit.
 * reduces the probability of the auto attacker dying during the attack.
 * increases the probability of a second auto attacker finishing of the
   target if the first auto attacker fails.

See patch #7942

Modified:
branches/S2_6/server/unittools.c

Modified: branches/S2_6/server/unittools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/unittools.c?rev=34433=34432=34433=diff
==
--- branches/S2_6/server/unittools.c(original)
+++ branches/S2_6/server/unittools.cMon Nov  7 13:44:50 2016
@@ -2961,12 +2961,16 @@
 return unit_transport_depth(*q1) - unit_transport_depth(*p1);
   }
 
+  /* Put the units with the highest probability of success first. The up
+   * side of this is that units with bonuses against the victim attacks
+   * before other units. The downside is that strong units can be lead
+   * away by sacrificial units. */
   if (p1uwc < q1uwc) {
-return -1; /* q is better */
+return +1; /* q is better */
   } else if (p1uwc == q1uwc) {
 return 0;
   } else {
-return 1; /* p is better */
+return -1; /* p is better */
   }
 }
 
@@ -3019,7 +3023,8 @@
 } unit_list_iterate_end;
   } adjc_iterate_end;
 
-  /* The unit list is now sorted according to win chance against punit */
+  /* Sort the potential attackers from highest to lowest success
+   * probability. */
   autoattack_target = unit_tile(punit); /* global variable */
   if (unit_list_size(autoattack) >= 2) {
 unit_list_sort(autoattack, _units);


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


[Freeciv-commits] r34434 - in /trunk/data: alien/ civ2/ classic/ experimental/ multiplayer/

2016-11-07 Thread cazfi74
Author: cazfi
Date: Mon Nov  7 21:06:03 2016
New Revision: 34434

URL: http://svn.gna.org/viewcvs/freeciv?rev=34434=rev
Log:
Fixed format of unitclass helptexts about paradrop ability.

See patch #7947

Modified:
trunk/data/alien/terrain.ruleset
trunk/data/civ2/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=34434=34433=34434=diff
==
--- trunk/data/alien/terrain.ruleset(original)
+++ trunk/data/alien/terrain.rulesetMon Nov  7 21:06:03 2016
@@ -901,7 +901,7 @@
 removal_time   = 0
 native_to  = "Antigravity"
 helptext   = _("\
-Units can paradrop from this tile.
+Units can paradrop from this tile.\
 ")
 
 [extra_road]

Modified: trunk/data/civ2/terrain.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/terrain.ruleset?rev=34434=34433=34434=diff
==
--- trunk/data/civ2/terrain.ruleset (original)
+++ trunk/data/civ2/terrain.ruleset Mon Nov  7 21:06:03 2016
@@ -1076,7 +1076,7 @@
 Airbases allow your air units to land and refuel. Air units in an \
 airbase may be attacked by land units.\
 "), _("\
-Units can paradrop from this tile.
+Units can paradrop from this tile.\
 ")
 
 [extra_road]

Modified: trunk/data/classic/terrain.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/terrain.ruleset?rev=34434=34433=34434=diff
==
--- trunk/data/classic/terrain.ruleset  (original)
+++ trunk/data/classic/terrain.ruleset  Mon Nov  7 21:06:03 2016
@@ -1302,7 +1302,7 @@
 Airbases allow your air units to land and refuel. Air units in an \
 airbase may be attacked by land units.\
 "), _("\
-Units can paradrop from this tile.
+Units can paradrop from this tile.\
 ")
 
 [extra_buoy]

Modified: trunk/data/experimental/terrain.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/experimental/terrain.ruleset?rev=34434=34433=34434=diff
==
--- trunk/data/experimental/terrain.ruleset (original)
+++ trunk/data/experimental/terrain.ruleset Mon Nov  7 21:06:03 2016
@@ -1278,7 +1278,7 @@
 Airbases allow your air units to land and refuel. Air units in an \
 airbase may be attacked by land units.\
 "), _("\
-Units can paradrop from this tile.
+Units can paradrop from this tile.\
 ")
 
 [extra_buoy]

Modified: trunk/data/multiplayer/terrain.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/multiplayer/terrain.ruleset?rev=34434=34433=34434=diff
==
--- trunk/data/multiplayer/terrain.ruleset  (original)
+++ trunk/data/multiplayer/terrain.ruleset  Mon Nov  7 21:06:03 2016
@@ -1276,7 +1276,7 @@
 Airbases allow your air units to land and refuel. Air units in an \
 airbase may be attacked by land units.\
 "), _("\
-Units can paradrop from this tile.
+Units can paradrop from this tile.\
 ")
 
 [extra_buoy]


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