[Freeciv-commits] r34514 - /branches/S2_5/server/unittools.c
Author: jtn Date: Tue Nov 15 11:22:17 2016 New Revision: 34514 URL: http://svn.gna.org/viewcvs/freeciv?rev=34514=rev Log: Small optimisation to autoattack transport depth check. See gna patch #7985. Modified: branches/S2_5/server/unittools.c Modified: branches/S2_5/server/unittools.c URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/unittools.c?rev=34514=34513=34514=diff == --- branches/S2_5/server/unittools.c(original) +++ branches/S2_5/server/unittools.cTue Nov 15 11:22:17 2016 @@ -3025,10 +3025,10 @@ /** This function is passed to unit_list_sort() to sort a list of units - according to their win chance against autoattack_target modified by + according to their win chance against autoattack_target, modified by transportation relationships. - The reason for making sure that a cargo unit is ahead of it + The reason for making sure that a cargo unit is ahead of its transporter(s) is to leave transports out of combat if at all possible. (The transport could be destroyed during combat.) **/ @@ -3041,10 +3041,26 @@ int q1uwc = unit_win_chance(*q1, q1def); /* Sort by transport depth first. This makes sure that no transport - * attacks before its cargo does. */ - if (unit_transport_depth(*p1) != unit_transport_depth(*q1)) { -/* The units have a different number of recursive transporters. */ -return unit_transport_depth(*q1) - unit_transport_depth(*p1); + * attacks before its cargo does -- cargo sorts earlier in the list. */ + { +const struct unit *p1trans = *p1, *q1trans = *q1; + +/* Walk the transport stacks in parallel, so as to bail out as soon as + * one of them is empty (avoid walking deep stacks more often than + * necessary). */ +while (p1trans && q1trans) { + p1trans = unit_transport_get(p1trans); + q1trans = unit_transport_get(q1trans); +} +if (!p1trans && q1trans) { + /* q1 is at greater depth (perhaps it's p1's cargo). It should sort + * earlier in the list (p1 > q1). */ + return 1; +} else if (p1trans && !q1trans) { + /* p1 is at greater depth, so should sort earlier (p1 < q1). */ + return -1; +} +/* else same depth, so move on to checking win chance: */ } if (p1uwc < q1uwc) { ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34513 - /branches/S2_6/server/unittools.c
Author: jtn Date: Tue Nov 15 11:21:54 2016 New Revision: 34513 URL: http://svn.gna.org/viewcvs/freeciv?rev=34513=rev Log: Small optimisation to autoattack transport depth check. See gna patch #7985. 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=34513=34512=34513=diff == --- branches/S2_6/server/unittools.c(original) +++ branches/S2_6/server/unittools.cTue Nov 15 11:21:54 2016 @@ -2939,10 +2939,10 @@ /** This function is passed to unit_list_sort() to sort a list of units - according to their win chance against autoattack_target modified by + according to their win chance against autoattack_target, modified by transportation relationships. - The reason for making sure that a cargo unit is ahead of it + The reason for making sure that a cargo unit is ahead of its transporter(s) is to leave transports out of combat if at all possible. (The transport could be destroyed during combat.) **/ @@ -2955,10 +2955,26 @@ int q1uwc = unit_win_chance(*q1, q1def); /* Sort by transport depth first. This makes sure that no transport - * attacks before its cargo does. */ - if (unit_transport_depth(*p1) != unit_transport_depth(*q1)) { -/* The units have a different number of recursive transporters. */ -return unit_transport_depth(*q1) - unit_transport_depth(*p1); + * attacks before its cargo does -- cargo sorts earlier in the list. */ + { +const struct unit *p1trans = *p1, *q1trans = *q1; + +/* Walk the transport stacks in parallel, so as to bail out as soon as + * one of them is empty (avoid walking deep stacks more often than + * necessary). */ +while (p1trans && q1trans) { + p1trans = unit_transport_get(p1trans); + q1trans = unit_transport_get(q1trans); +} +if (!p1trans && q1trans) { + /* q1 is at greater depth (perhaps it's p1's cargo). It should sort + * earlier in the list (p1 > q1). */ + return 1; +} else if (p1trans && !q1trans) { + /* p1 is at greater depth, so should sort earlier (p1 < q1). */ + return -1; +} +/* else same depth, so move on to checking win chance: */ } /* Put the units with the highest probability of success first. The up ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34512 - /trunk/server/unittools.c
Author: jtn Date: Tue Nov 15 11:21:02 2016 New Revision: 34512 URL: http://svn.gna.org/viewcvs/freeciv?rev=34512=rev Log: Small optimisation to autoattack transport depth check. See gna patch #7985. Modified: trunk/server/unittools.c Modified: trunk/server/unittools.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/unittools.c?rev=34512=34511=34512=diff == --- trunk/server/unittools.c(original) +++ trunk/server/unittools.cTue Nov 15 11:21:02 2016 @@ -3040,9 +3040,9 @@ /** This function is passed to autoattack_prob_list_sort() to sort a list of units and action probabilities according to their win chance against the - autoattack target modified by transportation relationships. - - The reason for making sure that a cargo unit is ahead of it + autoattack target, modified by transportation relationships. + + The reason for making sure that a cargo unit is ahead of its transporter(s) is to leave transports out of combat if at all possible. (The transport could be destroyed during combat.) **/ @@ -3053,19 +3053,35 @@ const struct unit *q1unit = game_unit_by_number((*q1)->unit_id); /* Sort by transport depth first. This makes sure that no transport - * attacks before its cargo does. */ - if (unit_transport_depth(p1unit) != unit_transport_depth(q1unit)) { -/* The units have a different number of recursive transporters. */ -return unit_transport_depth(q1unit) - unit_transport_depth(p1unit); - } else { -/* 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)); - } + * attacks before its cargo does -- cargo sorts earlier in the list. */ + { +const struct unit *p1trans = p1unit, *q1trans = q1unit; + +/* Walk the transport stacks in parallel, so as to bail out as soon as + * one of them is empty (avoid walking deep stacks more often than + * necessary). */ +while (p1trans && q1trans) { + p1trans = unit_transport_get(p1trans); + q1trans = unit_transport_get(q1trans); +} +if (!p1trans && q1trans) { + /* q1 is at greater depth (perhaps it's p1's cargo). It should sort + * earlier in the list (p1 > q1). */ + return 1; +} else if (p1trans && !q1trans) { + /* p1 is at greater depth, so should sort earlier (p1 < q1). */ + return -1; +} +/* else same depth, so move on to checking win chance: */ + } + + /* 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 led + * away by sacrificial units. */ + return (-1 + /* Assume the worst. */ + * action_prob_cmp_pessimist((*p1)->prob, (*q1)->prob)); } /* ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34516 - in /trunk: ai/default/ client/ client/gui-gtk-2.0/ client/gui-gtk-3.0/ client/gui-gtk-3.22/ client/gui-qt/ client/g...
Author: cazfi Date: Tue Nov 15 20:42:40 2016 New Revision: 34516 URL: http://svn.gna.org/viewcvs/freeciv?rev=34516=rev Log: Added spaces around '==' where ever they were still missing. See patch #7986 Modified: trunk/ai/default/aitech.c trunk/client/control.c trunk/client/goto.c trunk/client/gui-gtk-2.0/gui_main.c trunk/client/gui-gtk-2.0/helpdlg.c trunk/client/gui-gtk-2.0/pages.c trunk/client/gui-gtk-3.0/gui_main.c trunk/client/gui-gtk-3.0/pages.c trunk/client/gui-gtk-3.22/gui_main.c trunk/client/gui-gtk-3.22/pages.c trunk/client/gui-qt/gui_main.cpp trunk/client/gui-qt/menu.h trunk/client/gui-sdl2/graphics.c trunk/client/gui-sdl2/mapview.c trunk/client/gui-stub/gui_main.c trunk/client/helpdata.c trunk/client/packhand.c trunk/common/effects.c trunk/common/movement.c trunk/common/networking/connection.c trunk/common/networking/packets.def trunk/common/version.h trunk/server/citytools.c trunk/server/fcdb.c trunk/server/gamehand.c trunk/server/score.c trunk/server/srv_main.c trunk/server/stdinhand.c trunk/utility/inputfile.c trunk/utility/shared.c trunk/utility/timing.c [This mail would be too long, it was shortened to contain the URLs only.] Modified: trunk/ai/default/aitech.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aitech.c?rev=34516=34515=34516=diff Modified: trunk/client/control.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/control.c?rev=34516=34515=34516=diff Modified: trunk/client/goto.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/goto.c?rev=34516=34515=34516=diff Modified: trunk/client/gui-gtk-2.0/gui_main.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/gui_main.c?rev=34516=34515=34516=diff Modified: trunk/client/gui-gtk-2.0/helpdlg.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/helpdlg.c?rev=34516=34515=34516=diff Modified: trunk/client/gui-gtk-2.0/pages.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/pages.c?rev=34516=34515=34516=diff 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=34516=34515=34516=diff Modified: trunk/client/gui-gtk-3.0/pages.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/pages.c?rev=34516=34515=34516=diff Modified: trunk/client/gui-gtk-3.22/gui_main.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.22/gui_main.c?rev=34516=34515=34516=diff Modified: trunk/client/gui-gtk-3.22/pages.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.22/pages.c?rev=34516=34515=34516=diff Modified: trunk/client/gui-qt/gui_main.cpp URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/gui_main.cpp?rev=34516=34515=34516=diff Modified: trunk/client/gui-qt/menu.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.h?rev=34516=34515=34516=diff Modified: trunk/client/gui-sdl2/graphics.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/graphics.c?rev=34516=34515=34516=diff Modified: trunk/client/gui-sdl2/mapview.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/mapview.c?rev=34516=34515=34516=diff Modified: trunk/client/gui-stub/gui_main.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-stub/gui_main.c?rev=34516=34515=34516=diff Modified: trunk/client/helpdata.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/helpdata.c?rev=34516=34515=34516=diff Modified: trunk/client/packhand.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/client/packhand.c?rev=34516=34515=34516=diff Modified: trunk/common/effects.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/effects.c?rev=34516=34515=34516=diff Modified: trunk/common/movement.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/movement.c?rev=34516=34515=34516=diff Modified: trunk/common/networking/connection.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/networking/connection.c?rev=34516=34515=34516=diff Modified: trunk/common/networking/packets.def URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/networking/packets.def?rev=34516=34515=34516=diff Modified: trunk/common/version.h URL: http://svn.gna.org/viewcvs/freeciv/trunk/common/version.h?rev=34516=34515=34516=diff Modified: trunk/server/citytools.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/citytools.c?rev=34516=34515=34516=diff Modified: trunk/server/fcdb.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/fcdb.c?rev=34516=34515=34516=diff Modified: trunk/server/gamehand.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/gamehand.c?rev=34516=34515=34516=diff Modified: trunk/server/score.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/score.c?rev=34516=34515=34516=diff Modified: trunk/server/srv_main.c URL: http://svn.gna.org/viewcvs/freeciv/trunk/server/srv_main.c?rev=34516=34515=34516=diff Modified:
[Freeciv-commits] r34515 - /branches/S2_6/m4/gtk3.22-client.m4
Author: cazfi Date: Tue Nov 15 20:30:16 2016 New Revision: 34515 URL: http://svn.gna.org/viewcvs/freeciv?rev=34515=rev Log: Prevent things deprecated in gtk+ 3.22 from gtk3.22-client See patch #7705 Modified: branches/S2_6/m4/gtk3.22-client.m4 Modified: branches/S2_6/m4/gtk3.22-client.m4 URL: http://svn.gna.org/viewcvs/freeciv/branches/S2_6/m4/gtk3.22-client.m4?rev=34515=34514=34515=diff == --- branches/S2_6/m4/gtk3.22-client.m4 (original) +++ branches/S2_6/m4/gtk3.22-client.m4 Tue Nov 15 20:30:16 2016 @@ -10,8 +10,8 @@ test "x$client" = "xall" ; then PKG_CHECK_MODULES([GTK3_22], [gtk+-3.0 >= 3.22.0], [ -GTK3_22_CFLAGS="$GTK3_22_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_20" -GTK3_22_CFLAGS="$GTK3_22_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_48" +GTK3_22_CFLAGS="$GTK3_22_CFLAGS -DGDK_VERSION_MIN_REQUIRED=GDK_VERSION_3_22" +GTK3_22_CFLAGS="$GTK3_22_CFLAGS -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_50" gui_gtk3_22=yes if test "x$client" = "xauto" ; then client=yes ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits
[Freeciv-commits] r34517 - in /trunk/data/sandbox: README.sandbox terrain.ruleset
Author: cazfi Date: Tue Nov 15 21:08:40 2016 New Revision: 34517 URL: http://svn.gna.org/viewcvs/freeciv?rev=34517=rev Log: Sandbox ruleset fortress and airbase hides units inside See patch #7984 Modified: trunk/data/sandbox/README.sandbox trunk/data/sandbox/terrain.ruleset Modified: trunk/data/sandbox/README.sandbox URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/sandbox/README.sandbox?rev=34517=34516=34517=diff == --- trunk/data/sandbox/README.sandbox (original) +++ trunk/data/sandbox/README.sandbox Tue Nov 15 21:08:40 2016 @@ -111,3 +111,7 @@ The workable tiles next to a city are permanently within the city owner's borders, once claimed. The outer workable tiles can be stolen by a city with greater influence. + +Opponents not seeing units in fortress or airbase: +Opponents can't see units that are inside fortress or airbase. +Units inside fort and airstrip can still be seen. Modified: trunk/data/sandbox/terrain.ruleset URL: http://svn.gna.org/viewcvs/freeciv/trunk/data/sandbox/terrain.ruleset?rev=34517=34516=34517=diff == --- trunk/data/sandbox/terrain.ruleset (original) +++ trunk/data/sandbox/terrain.ruleset Tue Nov 15 21:08:40 2016 @@ -1370,6 +1370,7 @@ } build_time = 2 removal_time = 0 +unit_seen = "Hidden" native_to = "Land", "Small Land", "Big Land" conflicts = "Airstrip", "Airbase" flags = "NativeTile", "DiplomatDefense" @@ -1450,6 +1451,7 @@ } build_time = 2 removal_time = 0 +unit_seen = "Hidden" native_to = "Air", "Helicopter", "Missile" conflicts = "Fort", "Fortress" flags = "Refuel", "ParadropFrom" ___ Freeciv-commits mailing list Freeciv-commits@gna.org https://mail.gna.org/listinfo/freeciv-commits