[Freeciv-commits] r35700 - /trunk/ai/default/aicity.c

2017-05-23 Thread cazfi74
Author: cazfi
Date: Wed May 24 07:31:34 2017
New Revision: 35700

URL: http://svn.gna.org/viewcvs/freeciv?rev=35700=rev
Log:
Make AI less likely to stop building wonder

See hrm Feature #662556

Modified:
trunk/ai/default/aicity.c

Modified: trunk/ai/default/aicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aicity.c?rev=35700=35699=35700=diff
==
--- trunk/ai/default/aicity.c   (original)
+++ trunk/ai/default/aicity.c   Wed May 24 07:31:34 2017
@@ -1880,6 +1880,13 @@
 /* Not only would we get the wonder, but we would also prevent
  * opponents from getting it. */
 pcity->server.adv->building_want[idx] *= 1.5;
+
+if (pcity->production.kind == VUT_IMPROVEMENT
+&& is_great_wonder(pcity->production.value.building)) {
+  /* If we already are building a great wonder, prefer continuing
+   * to do so over stopping it */
+  pcity->server.adv->building_want[idx] *= 1.25;
+}
   }
 
   /* If I am not an expansionist, I want buildings more than units */


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


[Freeciv-commits] r35702 - /branches/S2_6/ai/default/aicity.c

2017-05-23 Thread cazfi74
Author: cazfi
Date: Wed May 24 07:31:48 2017
New Revision: 35702

URL: http://svn.gna.org/viewcvs/freeciv?rev=35702=rev
Log:
Make AI less likely to stop building wonder

See hrm Feature #662556

Modified:
branches/S2_6/ai/default/aicity.c

Modified: branches/S2_6/ai/default/aicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/ai/default/aicity.c?rev=35702=35701=35702=diff
==
--- branches/S2_6/ai/default/aicity.c   (original)
+++ branches/S2_6/ai/default/aicity.c   Wed May 24 07:31:48 2017
@@ -1765,6 +1765,13 @@
 /* Not only would we get the wonder, but we would also prevent
  * opponents from getting it. */
 pcity->server.adv->building_want[idx] *= 1.5;
+
+if (pcity->production.kind == VUT_IMPROVEMENT
+&& is_great_wonder(pcity->production.value.building)) {
+  /* If we already are building a great wonder, prefer continuing
+   * to do so over stopping it */
+  pcity->server.adv->building_want[idx] *= 1.25;
+}
   }
 
   /* If I am not an expansionist, I want buildings more than units */


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


[Freeciv-commits] r35701 - /branches/S3_0/ai/default/aicity.c

2017-05-23 Thread cazfi74
Author: cazfi
Date: Wed May 24 07:31:41 2017
New Revision: 35701

URL: http://svn.gna.org/viewcvs/freeciv?rev=35701=rev
Log:
Make AI less likely to stop building wonder

See hrm Feature #662556

Modified:
branches/S3_0/ai/default/aicity.c

Modified: branches/S3_0/ai/default/aicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/default/aicity.c?rev=35701=35700=35701=diff
==
--- branches/S3_0/ai/default/aicity.c   (original)
+++ branches/S3_0/ai/default/aicity.c   Wed May 24 07:31:41 2017
@@ -1880,6 +1880,13 @@
 /* Not only would we get the wonder, but we would also prevent
  * opponents from getting it. */
 pcity->server.adv->building_want[idx] *= 1.5;
+
+if (pcity->production.kind == VUT_IMPROVEMENT
+&& is_great_wonder(pcity->production.value.building)) {
+  /* If we already are building a great wonder, prefer continuing
+   * to do so over stopping it */
+  pcity->server.adv->building_want[idx] *= 1.25;
+}
   }
 
   /* If I am not an expansionist, I want buildings more than units */


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


[Freeciv-commits] r35699 - in /trunk: data/alien/ data/civ1/ data/civ2/ data/civ2civ3/ data/classic/ data/experimental/ data/multiplayer/ data...

2017-05-23 Thread cazfi74
Author: cazfi
Date: Tue May 23 19:11:08 2017
New Revision: 35699

URL: http://svn.gna.org/viewcvs/freeciv?rev=35699=rev
Log:
Add 'parser.lua' to rulesets

See hrm Feature #661644

Added:
trunk/data/alien/parser.lua
trunk/data/civ1/parser.lua
trunk/data/civ2/parser.lua
trunk/data/civ2civ3/parser.lua
trunk/data/classic/parser.lua
trunk/data/experimental/parser.lua
trunk/data/multiplayer/parser.lua
trunk/data/sandbox/parser.lua
trunk/data/stub/parser.lua
trunk/data/webperimental/parser.lua
Modified:
trunk/data/alien/Makefile.am
trunk/data/civ1/Makefile.am
trunk/data/civ2/Makefile.am
trunk/data/civ2civ3/Makefile.am
trunk/data/classic/Makefile.am
trunk/data/multiplayer/Makefile.am
trunk/data/sandbox/Makefile.am
trunk/server/ruleset.c
trunk/server/ruleset.h
trunk/tools/ruleutil/rulesave.c

Modified: trunk/data/alien/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/Makefile.am?rev=35699=35698=35699=diff
==
--- trunk/data/alien/Makefile.am(original)
+++ trunk/data/alien/Makefile.amTue May 23 19:11:08 2017
@@ -9,6 +9,7 @@
effects.ruleset \
nation_effects.ruleset  \
script.lua  \
+   parser.lua  \
styles.ruleset  \
game.ruleset\
governments.ruleset \

Added: trunk/data/alien/parser.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/parser.lua?rev=35699=auto
==
--- trunk/data/alien/parser.lua (added)
+++ trunk/data/alien/parser.lua Tue May 23 19:11:08 2017
@@ -0,0 +1,13 @@
+-- Freeciv - Copyright (C) 2007 - The Freeciv Project
+--   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
+--   the Free Software Foundation; either version 2, or (at your option)
+--   any later version.
+--
+--   This program is distributed in the hope that it will be useful,
+--   but WITHOUT ANY WARRANTY; without even the implied warranty of
+--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+--   GNU General Public License for more details.
+
+-- This file is for lua-functionality for parsing luadata.txt
+-- of this ruleset.

Modified: trunk/data/civ1/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/Makefile.am?rev=35699=35698=35699=diff
==
--- trunk/data/civ1/Makefile.am (original)
+++ trunk/data/civ1/Makefile.am Tue May 23 19:11:08 2017
@@ -8,6 +8,7 @@
cities.ruleset  \
effects.ruleset \
script.lua  \
+   parser.lua  \
styles.ruleset  \
game.ruleset\
governments.ruleset \

Added: trunk/data/civ1/parser.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/parser.lua?rev=35699=auto
==
--- trunk/data/civ1/parser.lua  (added)
+++ trunk/data/civ1/parser.lua  Tue May 23 19:11:08 2017
@@ -0,0 +1,13 @@
+-- Freeciv - Copyright (C) 2007 - The Freeciv Project
+--   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
+--   the Free Software Foundation; either version 2, or (at your option)
+--   any later version.
+--
+--   This program is distributed in the hope that it will be useful,
+--   but WITHOUT ANY WARRANTY; without even the implied warranty of
+--   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+--   GNU General Public License for more details.
+
+-- This file is for lua-functionality for parsing luadata.txt
+-- of this ruleset.

Modified: trunk/data/civ2/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/Makefile.am?rev=35699=35698=35699=diff
==
--- trunk/data/civ2/Makefile.am (original)
+++ trunk/data/civ2/Makefile.am Tue May 23 19:11:08 2017
@@ -8,6 +8,7 @@
cities.ruleset  \
effects.ruleset \
script.lua  \
+   parser.lua  \
styles.ruleset  \
game.ruleset\
governments.ruleset \

Added: trunk/data/civ2/parser.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/parser.lua?rev=35699=auto
==
--- trunk/data/civ2/parser.lua  (added)
+++ trunk/data/civ2/parser.lua  Tue May 23 19:11:08 2017
@@ -0,0 +1,13 @@
+-- Freeciv - Copyright (C) 2007 - The Freeciv Project
+--   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
+--   the Free Software Foundation; either version 2, or (at 

[Freeciv-commits] r35698 - in /trunk: common/fc_types.h fc_version

2017-05-23 Thread cazfi74
Author: cazfi
Date: Tue May 23 18:43:56 2017
New Revision: 35698

URL: http://svn.gna.org/viewcvs/freeciv?rev=35698=rev
Log:
Increase max number of regular players to 250

Requested by Andreas Røsdal

See hrm Feature #654973

Modified:
trunk/common/fc_types.h
trunk/fc_version

Modified: trunk/common/fc_types.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/fc_types.h?rev=35698=35697=35698=diff
==
--- trunk/common/fc_types.h (original)
+++ trunk/common/fc_types.h Tue May 23 18:43:56 2017
@@ -29,10 +29,10 @@
  * Nothing in this file should require anything else from the common/
  * directory! */
 
-#define MAX_NUM_PLAYER_SLOTS 160 /* Used in the network protocol. */
+#define MAX_NUM_PLAYER_SLOTS 256 /* Used in the network protocol. */
  /* Must be divisable by 32 or iterations
   * in savegame2.c needs to be changed */
-#define MAX_NUM_BARBARIANS   10  /* 3, but slots reserved for future use. */
+#define MAX_NUM_BARBARIANS   6   /* 3, but slots reserved for future use. */
 #define MAX_NUM_PLAYERS  MAX_NUM_PLAYER_SLOTS - MAX_NUM_BARBARIANS
 /* Used in the network protocol. */
 #define MAX_NUM_CONNECTIONS (2 * (MAX_NUM_PLAYER_SLOTS))

Modified: trunk/fc_version
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/fc_version?rev=35698=35697=35698=diff
==
--- trunk/fc_version(original)
+++ trunk/fc_versionTue May 23 18:43:56 2017
@@ -56,7 +56,7 @@
 #   - Avoid adding a new mandatory capability to the development branch for
 # as long as possible.  We want to maintain network compatibility with
 # the stable branch for as long as possible.
-NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.1-2017.May.19"
+NETWORK_CAPSTRING_MANDATORY="+Freeciv.Devel-3.1-2017.May.23"
 NETWORK_CAPSTRING_OPTIONAL=""
 
 FREECIV_DISTRIBUTOR=""


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


[Freeciv-commits] r35697 - in /branches/S3_0/server/scripting: api_server_edit.c api_server_edit.h tolua_server.pkg

2017-05-22 Thread cazfi74
Author: cazfi
Date: Tue May 23 00:09:15 2017
New Revision: 35697

URL: http://svn.gna.org/viewcvs/freeciv?rev=35697=rev
Log:
Add scripting API control over unit 'stay'

See hrm Feature #661580

Modified:
branches/S3_0/server/scripting/api_server_edit.c
branches/S3_0/server/scripting/api_server_edit.h
branches/S3_0/server/scripting/tolua_server.pkg

Modified: branches/S3_0/server/scripting/api_server_edit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/scripting/api_server_edit.c?rev=35697=35696=35697=diff
==
--- branches/S3_0/server/scripting/api_server_edit.c(original)
+++ branches/S3_0/server/scripting/api_server_edit.cTue May 23 00:09:15 2017
@@ -591,6 +591,32 @@
 }
 
 /*
+  Prohibit unit from moving
+*/
+void api_edit_unit_moving_disallow(lua_State *L, Unit *punit)
+{
+  LUASCRIPT_CHECK_STATE(L);
+  LUASCRIPT_CHECK_SELF(L, punit);
+
+  if (punit != NULL) {
+punit->stay = TRUE;
+  }
+}
+
+/*
+  Allow unit to move
+*/
+void api_edit_unit_moving_allow(lua_State *L, Unit *punit)
+{
+  LUASCRIPT_CHECK_STATE(L);
+  LUASCRIPT_CHECK_SELF(L, punit);
+
+  if (punit != NULL) {
+punit->stay = FALSE;
+  }
+}
+
+/*
   Add history to a city
 */
 void api_edit_city_add_history(lua_State *L, City *pcity, int amount)

Modified: branches/S3_0/server/scripting/api_server_edit.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/scripting/api_server_edit.h?rev=35697=35696=35697=diff
==
--- branches/S3_0/server/scripting/api_server_edit.h(original)
+++ branches/S3_0/server/scripting/api_server_edit.hTue May 23 00:09:15 2017
@@ -73,6 +73,8 @@
 void api_edit_player_victory(lua_State *L, Player *pplayer);
 bool api_edit_unit_move(lua_State *L, Unit *punit, Tile *ptile,
 int movecost);
+void api_edit_unit_moving_disallow(lua_State *L, Unit *punit);
+void api_edit_unit_moving_allow(lua_State *L, Unit *punit);
 
 void api_edit_city_add_history(lua_State *L, City *pcity, int amount);
 void api_edit_player_add_history(lua_State *L, Player *pplayer, int amount);

Modified: branches/S3_0/server/scripting/tolua_server.pkg
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/scripting/tolua_server.pkg?rev=35697=35696=35697=diff
==
--- branches/S3_0/server/scripting/tolua_server.pkg (original)
+++ branches/S3_0/server/scripting/tolua_server.pkg Tue May 23 00:09:15 2017
@@ -177,6 +177,10 @@
 @ player_victory (lua_State *L, Player *self);
   bool api_edit_unit_move
 @ unit_move(lua_State *L, Unit *self, Tile *moveto, int movecost);
+  void api_edit_unit_moving_disallow
+@ movement_disallow(lua_State *L, Unit *self);
+  void api_edit_unit_moving_allow
+@ movement_allow(lua_State *L, Unit *self);
 
   void api_edit_city_add_history
 @ add_city_history(lua_State *L, City *self, int amount);
@@ -333,6 +337,14 @@
 
 function Unit:move(moveto, movecost)
   return edit.unit_move(self, moveto, movecost)
+end
+
+function Unit:movement_disallow()
+  edit.movement_disallow(self)
+end
+
+function Unit:movement_allow()
+  edit.movement_allow(self)
 end
 
 -- Server functions for Tile module


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


[Freeciv-commits] r35696 - in /trunk/server/scripting: api_server_edit.c api_server_edit.h tolua_server.pkg

2017-05-22 Thread cazfi74
Author: cazfi
Date: Tue May 23 00:09:08 2017
New Revision: 35696

URL: http://svn.gna.org/viewcvs/freeciv?rev=35696=rev
Log:
Add scripting API control over unit 'stay'

See hrm Feature #661580

Modified:
trunk/server/scripting/api_server_edit.c
trunk/server/scripting/api_server_edit.h
trunk/server/scripting/tolua_server.pkg

Modified: trunk/server/scripting/api_server_edit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/scripting/api_server_edit.c?rev=35696=35695=35696=diff
==
--- trunk/server/scripting/api_server_edit.c(original)
+++ trunk/server/scripting/api_server_edit.cTue May 23 00:09:08 2017
@@ -592,6 +592,32 @@
 }
 
 /*
+  Prohibit unit from moving
+*/
+void api_edit_unit_moving_disallow(lua_State *L, Unit *punit)
+{
+  LUASCRIPT_CHECK_STATE(L);
+  LUASCRIPT_CHECK_SELF(L, punit);
+
+  if (punit != NULL) {
+punit->stay = TRUE;
+  }
+}
+
+/*
+  Allow unit to move
+*/
+void api_edit_unit_moving_allow(lua_State *L, Unit *punit)
+{
+  LUASCRIPT_CHECK_STATE(L);
+  LUASCRIPT_CHECK_SELF(L, punit);
+
+  if (punit != NULL) {
+punit->stay = FALSE;
+  }
+}
+
+/*
   Add history to a city
 */
 void api_edit_city_add_history(lua_State *L, City *pcity, int amount)

Modified: trunk/server/scripting/api_server_edit.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/scripting/api_server_edit.h?rev=35696=35695=35696=diff
==
--- trunk/server/scripting/api_server_edit.h(original)
+++ trunk/server/scripting/api_server_edit.hTue May 23 00:09:08 2017
@@ -73,6 +73,8 @@
 void api_edit_player_victory(lua_State *L, Player *pplayer);
 bool api_edit_unit_move(lua_State *L, Unit *punit, Tile *ptile,
 int movecost);
+void api_edit_unit_moving_disallow(lua_State *L, Unit *punit);
+void api_edit_unit_moving_allow(lua_State *L, Unit *punit);
 
 void api_edit_city_add_history(lua_State *L, City *pcity, int amount);
 void api_edit_player_add_history(lua_State *L, Player *pplayer, int amount);

Modified: trunk/server/scripting/tolua_server.pkg
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/scripting/tolua_server.pkg?rev=35696=35695=35696=diff
==
--- trunk/server/scripting/tolua_server.pkg (original)
+++ trunk/server/scripting/tolua_server.pkg Tue May 23 00:09:08 2017
@@ -178,6 +178,10 @@
 @ player_victory (lua_State *L, Player *self);
   bool api_edit_unit_move
 @ unit_move(lua_State *L, Unit *self, Tile *moveto, int movecost);
+  void api_edit_unit_moving_disallow
+@ movement_disallow(lua_State *L, Unit *self);
+  void api_edit_unit_moving_allow
+@ movement_allow(lua_State *L, Unit *self);
 
   void api_edit_city_add_history
 @ add_city_history(lua_State *L, City *self, int amount);
@@ -340,6 +344,14 @@
 
 function Unit:move(moveto, movecost)
   return edit.unit_move(self, moveto, movecost)
+end
+
+function Unit:movement_disallow()
+  edit.movement_disallow(self)
+end
+
+function Unit:movement_allow()
+  edit.movement_allow(self)
 end
 
 -- Server functions for Tile module


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


[Freeciv-commits] r35684 - /branches/S2_6/server/srv_main.c

2017-05-21 Thread cazfi74
Author: cazfi
Date: Sun May 21 19:07:21 2017
New Revision: 35684

URL: http://svn.gna.org/viewcvs/freeciv?rev=35684=rev
Log:
Do not try to cancel Team membership

When a player with which we are allied and another with which we
are in the same team go to war, only cancel the alliance. Do not try
to cancel pact with the team member.

Reported by David Fernandez (bard)

See hrm Bug #662059

Modified:
branches/S2_6/server/srv_main.c

Modified: branches/S2_6/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/srv_main.c?rev=35684=35683=35684=diff
==
--- branches/S2_6/server/srv_main.c (original)
+++ branches/S2_6/server/srv_main.c Sun May 21 19:07:21 2017
@@ -819,33 +819,72 @@
 = player_diplstate_get(plr3, plr2);
 struct player_diplstate *from2
 = player_diplstate_get(plr2, plr3);
-
-notify_player(plr3, NULL, E_TREATY_BROKEN, ftc_server,
-  _("The cease-fire between %s and %s has run out. 
"
-"They are at war. You cancel your alliance "
-"with both."),
-  player_name(plr1),
-  player_name(plr2));
-
-/* Cancel the alliance. */
-to1->has_reason_to_cancel = TRUE;
-to2->has_reason_to_cancel = TRUE;
-handle_diplomacy_cancel_pact(plr3, player_number(plr1), 
CLAUSE_ALLIANCE);
-handle_diplomacy_cancel_pact(plr3, player_number(plr2), 
CLAUSE_ALLIANCE);
-
-/* Avoid asymmetric turns_left for the armistice. */
-to1->auto_cancel_turn = game.info.turn;
-from1->auto_cancel_turn = game.info.turn;
-
-to2->auto_cancel_turn = game.info.turn;
-from2->auto_cancel_turn = game.info.turn;
-
-/* Count down for this turn. */
-to1->turns_left--;
-from1->turns_left--;
-
-to2->turns_left--;
-from2->turns_left--;
+const char *plr1name = player_name(plr1);
+const char *plr2name = player_name(plr2);
+bool cancel1;
+bool cancel2;
+
+if (players_on_same_team(plr3, plr1)) {
+  fc_assert(!players_on_same_team(plr3, plr2));
+
+  cancel1 = FALSE;
+  cancel2 = TRUE;
+
+  notify_player(plr3, NULL, E_TREATY_BROKEN, ftc_server,
+_("The cease-fire between %s and %s has run 
out. "
+  "They are at war. You cancel your alliance "
+  "with %s."),
+plr1name, plr2name, plr2name);
+} else if (players_on_same_team(plr3, plr2)) {
+
+  cancel1 = TRUE;
+  cancel2 = FALSE;
+
+  notify_player(plr3, NULL, E_TREATY_BROKEN, ftc_server,
+_("The cease-fire between %s and %s has run 
out. "
+  "They are at war. You cancel your alliance "
+  "with %s."),
+plr1name, plr2name, plr1name);
+} else {
+
+  cancel1 = TRUE;
+  cancel2 = TRUE;
+
+  notify_player(plr3, NULL, E_TREATY_BROKEN, ftc_server,
+_("The cease-fire between %s and %s has run 
out. "
+  "They are at war. You cancel your alliance "
+  "with both."),
+player_name(plr1),
+player_name(plr2));
+}
+
+if (cancel1) {
+  /* Cancel the alliance. */
+  to1->has_reason_to_cancel = TRUE;
+  handle_diplomacy_cancel_pact(plr3, player_number(plr1), 
CLAUSE_ALLIANCE);
+
+  /* Avoid asymmetric turns_left for the armistice. */
+  to1->auto_cancel_turn = game.info.turn;
+  from1->auto_cancel_turn = game.info.turn;
+
+  /* Count down for this turn. */
+  to1->turns_left--;
+  from1->turns_left--;
+}
+
+if (cancel2) {
+  /* Cancel the alliance. */
+  to2->has_reason_to_cancel = TRUE;
+  handle_diplomacy_cancel_pact(plr3, player_number(plr2), 
CLAUSE_ALLIANCE);
+
+  /* Avoid asymmetric turns_left for the armistice. */
+  to2->auto_cancel_turn = game.info.turn;
+  from2->auto_cancel_turn = game.info.turn;
+
+  /* Count down for this turn. */
+  to2->turns_left--;

[Freeciv-commits] r35685 - /branches/S2_5/server/srv_main.c

2017-05-21 Thread cazfi74
Author: cazfi
Date: Sun May 21 19:07:28 2017
New Revision: 35685

URL: http://svn.gna.org/viewcvs/freeciv?rev=35685=rev
Log:
Do not try to cancel Team membership

When a player with which we are allied and another with which we
are in the same team go to war, only cancel the alliance. Do not try
to cancel pact with the team member.

Reported by David Fernandez (bard)

See hrm Bug #662059

Modified:
branches/S2_5/server/srv_main.c

Modified: branches/S2_5/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/srv_main.c?rev=35685=35684=35685=diff
==
--- branches/S2_5/server/srv_main.c (original)
+++ branches/S2_5/server/srv_main.c Sun May 21 19:07:28 2017
@@ -773,33 +773,72 @@
 = player_diplstate_get(plr3, plr2);
 struct player_diplstate *from2
 = player_diplstate_get(plr2, plr3);
-
-notify_player(plr3, NULL, E_TREATY_BROKEN, ftc_server,
-  _("The cease-fire between %s and %s has run out. 
"
-"They are at war. You cancel your alliance "
-"with both."),
-  player_name(plr1),
-  player_name(plr2));
-
-/* Cancel the alliance. */
-to1->has_reason_to_cancel = TRUE;
-to2->has_reason_to_cancel = TRUE;
-handle_diplomacy_cancel_pact(plr3, player_number(plr1), 
CLAUSE_ALLIANCE);
-handle_diplomacy_cancel_pact(plr3, player_number(plr2), 
CLAUSE_ALLIANCE);
-
-/* Avoid asymmetric turns_left for the armistice. */
-to1->auto_cancel_turn = game.info.turn;
-from1->auto_cancel_turn = game.info.turn;
-
-to2->auto_cancel_turn = game.info.turn;
-from2->auto_cancel_turn = game.info.turn;
-
-/* Count down for this turn. */
-to1->turns_left--;
-from1->turns_left--;
-
-to2->turns_left--;
-from2->turns_left--;
+const char *plr1name = player_name(plr1);
+const char *plr2name = player_name(plr2);
+bool cancel1;
+bool cancel2;
+
+if (players_on_same_team(plr3, plr1)) {
+  fc_assert(!players_on_same_team(plr3, plr2));
+
+  cancel1 = FALSE;
+  cancel2 = TRUE;
+
+  notify_player(plr3, NULL, E_TREATY_BROKEN, ftc_server,
+_("The cease-fire between %s and %s has run 
out. "
+  "They are at war. You cancel your alliance "
+  "with %s."),
+plr1name, plr2name, plr2name);
+} else if (players_on_same_team(plr3, plr2)) {
+
+  cancel1 = TRUE;
+  cancel2 = FALSE;
+
+  notify_player(plr3, NULL, E_TREATY_BROKEN, ftc_server,
+_("The cease-fire between %s and %s has run 
out. "
+  "They are at war. You cancel your alliance "
+  "with %s."),
+plr1name, plr2name, plr1name);
+} else {
+
+  cancel1 = TRUE;
+  cancel2 = TRUE;
+
+  notify_player(plr3, NULL, E_TREATY_BROKEN, ftc_server,
+_("The cease-fire between %s and %s has run 
out. "
+  "They are at war. You cancel your alliance "
+  "with both."),
+player_name(plr1),
+player_name(plr2));
+}
+
+if (cancel1) {
+  /* Cancel the alliance. */
+  to1->has_reason_to_cancel = TRUE;
+  handle_diplomacy_cancel_pact(plr3, player_number(plr1), 
CLAUSE_ALLIANCE);
+
+  /* Avoid asymmetric turns_left for the armistice. */
+  to1->auto_cancel_turn = game.info.turn;
+  from1->auto_cancel_turn = game.info.turn;
+
+  /* Count down for this turn. */
+  to1->turns_left--;
+  from1->turns_left--;
+}
+
+if (cancel2) {
+  /* Cancel the alliance. */
+  to2->has_reason_to_cancel = TRUE;
+  handle_diplomacy_cancel_pact(plr3, player_number(plr2), 
CLAUSE_ALLIANCE);
+
+  /* Avoid asymmetric turns_left for the armistice. */
+  to2->auto_cancel_turn = game.info.turn;
+  from2->auto_cancel_turn = game.info.turn;
+
+  /* Count down for this turn. */
+  to2->turns_left--;

[Freeciv-commits] r35683 - /branches/S3_0/server/srv_main.c

2017-05-21 Thread cazfi74
Author: cazfi
Date: Sun May 21 19:07:14 2017
New Revision: 35683

URL: http://svn.gna.org/viewcvs/freeciv?rev=35683=rev
Log:
Do not try to cancel Team membership

When a player with which we are allied and another with which we
are in the same team go to war, only cancel the alliance. Do not try
to cancel pact with the team member.

Reported by David Fernandez (bard)

See hrm Bug #662059

Modified:
branches/S3_0/server/srv_main.c

Modified: branches/S3_0/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/srv_main.c?rev=35683=35682=35683=diff
==
--- branches/S3_0/server/srv_main.c (original)
+++ branches/S3_0/server/srv_main.c Sun May 21 19:07:14 2017
@@ -852,33 +852,72 @@
 = player_diplstate_get(plr3, plr2);
 struct player_diplstate *from2
 = player_diplstate_get(plr2, plr3);
-
-notify_player(plr3, NULL, E_TREATY_BROKEN, ftc_server,
-  _("The cease-fire between %s and %s has run out. 
"
-"They are at war. You cancel your alliance "
-"with both."),
-  player_name(plr1),
-  player_name(plr2));
-
-/* Cancel the alliance. */
-to1->has_reason_to_cancel = TRUE;
-to2->has_reason_to_cancel = TRUE;
-handle_diplomacy_cancel_pact(plr3, player_number(plr1), 
CLAUSE_ALLIANCE);
-handle_diplomacy_cancel_pact(plr3, player_number(plr2), 
CLAUSE_ALLIANCE);
-
-/* Avoid asymmetric turns_left for the armistice. */
-to1->auto_cancel_turn = game.info.turn;
-from1->auto_cancel_turn = game.info.turn;
-
-to2->auto_cancel_turn = game.info.turn;
-from2->auto_cancel_turn = game.info.turn;
-
-/* Count down for this turn. */
-to1->turns_left--;
-from1->turns_left--;
-
-to2->turns_left--;
-from2->turns_left--;
+const char *plr1name = player_name(plr1);
+const char *plr2name = player_name(plr2);
+bool cancel1;
+bool cancel2;
+
+if (players_on_same_team(plr3, plr1)) {
+  fc_assert(!players_on_same_team(plr3, plr2));
+
+  cancel1 = FALSE;
+  cancel2 = TRUE;
+
+  notify_player(plr3, NULL, E_TREATY_BROKEN, ftc_server,
+_("The cease-fire between %s and %s has run 
out. "
+  "They are at war. You cancel your alliance "
+  "with %s."),
+plr1name, plr2name, plr2name);
+} else if (players_on_same_team(plr3, plr2)) {
+
+  cancel1 = TRUE;
+  cancel2 = FALSE;
+
+  notify_player(plr3, NULL, E_TREATY_BROKEN, ftc_server,
+_("The cease-fire between %s and %s has run 
out. "
+  "They are at war. You cancel your alliance "
+  "with %s."),
+plr1name, plr2name, plr1name);
+} else {
+
+  cancel1 = TRUE;
+  cancel2 = TRUE;
+
+  notify_player(plr3, NULL, E_TREATY_BROKEN, ftc_server,
+_("The cease-fire between %s and %s has run 
out. "
+  "They are at war. You cancel your alliance "
+  "with both."),
+player_name(plr1),
+player_name(plr2));
+}
+
+if (cancel1) {
+  /* Cancel the alliance. */
+  to1->has_reason_to_cancel = TRUE;
+  handle_diplomacy_cancel_pact(plr3, player_number(plr1), 
CLAUSE_ALLIANCE);
+
+  /* Avoid asymmetric turns_left for the armistice. */
+  to1->auto_cancel_turn = game.info.turn;
+  from1->auto_cancel_turn = game.info.turn;
+
+  /* Count down for this turn. */
+  to1->turns_left--;
+  from1->turns_left--;
+}
+
+if (cancel2) {
+  /* Cancel the alliance. */
+  to2->has_reason_to_cancel = TRUE;
+  handle_diplomacy_cancel_pact(plr3, player_number(plr2), 
CLAUSE_ALLIANCE);
+
+  /* Avoid asymmetric turns_left for the armistice. */
+  to2->auto_cancel_turn = game.info.turn;
+  from2->auto_cancel_turn = game.info.turn;
+
+  /* Count down for this turn. */
+  to2->turns_left--;

[Freeciv-commits] r35682 - /trunk/server/srv_main.c

2017-05-21 Thread cazfi74
Author: cazfi
Date: Sun May 21 19:07:05 2017
New Revision: 35682

URL: http://svn.gna.org/viewcvs/freeciv?rev=35682=rev
Log:
Do not try to cancel Team membership

When a player with which we are allied and another with which we
are in the same team go to war, only cancel the alliance. Do not try
to cancel pact with the team member.

Reported by David Fernandez (bard)

See hrm Bug #662059

Modified:
trunk/server/srv_main.c

Modified: trunk/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/srv_main.c?rev=35682=35681=35682=diff
==
--- trunk/server/srv_main.c (original)
+++ trunk/server/srv_main.c Sun May 21 19:07:05 2017
@@ -853,33 +853,72 @@
 = player_diplstate_get(plr3, plr2);
 struct player_diplstate *from2
 = player_diplstate_get(plr2, plr3);
-
-notify_player(plr3, NULL, E_TREATY_BROKEN, ftc_server,
-  _("The cease-fire between %s and %s has run out. 
"
-"They are at war. You cancel your alliance "
-"with both."),
-  player_name(plr1),
-  player_name(plr2));
-
-/* Cancel the alliance. */
-to1->has_reason_to_cancel = TRUE;
-to2->has_reason_to_cancel = TRUE;
-handle_diplomacy_cancel_pact(plr3, player_number(plr1), 
CLAUSE_ALLIANCE);
-handle_diplomacy_cancel_pact(plr3, player_number(plr2), 
CLAUSE_ALLIANCE);
-
-/* Avoid asymmetric turns_left for the armistice. */
-to1->auto_cancel_turn = game.info.turn;
-from1->auto_cancel_turn = game.info.turn;
-
-to2->auto_cancel_turn = game.info.turn;
-from2->auto_cancel_turn = game.info.turn;
-
-/* Count down for this turn. */
-to1->turns_left--;
-from1->turns_left--;
-
-to2->turns_left--;
-from2->turns_left--;
+const char *plr1name = player_name(plr1);
+const char *plr2name = player_name(plr2);
+bool cancel1;
+bool cancel2;
+
+if (players_on_same_team(plr3, plr1)) {
+  fc_assert(!players_on_same_team(plr3, plr2));
+
+  cancel1 = FALSE;
+  cancel2 = TRUE;
+
+  notify_player(plr3, NULL, E_TREATY_BROKEN, ftc_server,
+_("The cease-fire between %s and %s has run 
out. "
+  "They are at war. You cancel your alliance "
+  "with %s."),
+plr1name, plr2name, plr2name);
+} else if (players_on_same_team(plr3, plr2)) {
+
+  cancel1 = TRUE;
+  cancel2 = FALSE;
+
+  notify_player(plr3, NULL, E_TREATY_BROKEN, ftc_server,
+_("The cease-fire between %s and %s has run 
out. "
+  "They are at war. You cancel your alliance "
+  "with %s."),
+plr1name, plr2name, plr1name);
+} else {
+
+  cancel1 = TRUE;
+  cancel2 = TRUE;
+
+  notify_player(plr3, NULL, E_TREATY_BROKEN, ftc_server,
+_("The cease-fire between %s and %s has run 
out. "
+  "They are at war. You cancel your alliance "
+  "with both."),
+player_name(plr1),
+player_name(plr2));
+}
+
+if (cancel1) {
+  /* Cancel the alliance. */
+  to1->has_reason_to_cancel = TRUE;
+  handle_diplomacy_cancel_pact(plr3, player_number(plr1), 
CLAUSE_ALLIANCE);
+
+  /* Avoid asymmetric turns_left for the armistice. */
+  to1->auto_cancel_turn = game.info.turn;
+  from1->auto_cancel_turn = game.info.turn;
+
+  /* Count down for this turn. */
+  to1->turns_left--;
+  from1->turns_left--;
+}
+
+if (cancel2) {
+  /* Cancel the alliance. */
+  to2->has_reason_to_cancel = TRUE;
+  handle_diplomacy_cancel_pact(plr3, player_number(plr2), 
CLAUSE_ALLIANCE);
+
+  /* Avoid asymmetric turns_left for the armistice. */
+  to2->auto_cancel_turn = game.info.turn;
+  from2->auto_cancel_turn = game.info.turn;
+
+  /* Count down for this turn. */
+  to2->turns_left--;
+  from2->turns_left--;

[Freeciv-commits] r35678 - in /trunk/common/scriptcore: api_game_methods.c api_game_methods.h tolua_game.pkg

2017-05-20 Thread cazfi74
Author: cazfi
Date: Sat May 20 14:28:36 2017
New Revision: 35678

URL: http://svn.gna.org/viewcvs/freeciv?rev=35678=rev
Log:
Add Tile:is_enemy() to scripting API

See hrm Feature #661538

Modified:
trunk/common/scriptcore/api_game_methods.c
trunk/common/scriptcore/api_game_methods.h
trunk/common/scriptcore/tolua_game.pkg

Modified: trunk/common/scriptcore/api_game_methods.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/api_game_methods.c?rev=35678=35677=35678=diff
==
--- trunk/common/scriptcore/api_game_methods.c  (original)
+++ trunk/common/scriptcore/api_game_methods.c  Sat May 20 14:28:36 2017
@@ -861,6 +861,28 @@
 }
 
 /*
+  Is tile occupied by enemies
+*/
+bool api_methods_enemy_tile(lua_State *L, Tile *ptile, Player *against)
+{
+  struct city *pcity;
+  
+  LUASCRIPT_CHECK_STATE(L, FALSE);
+  LUASCRIPT_CHECK_SELF(L, ptile, FALSE);
+
+  if (is_non_allied_unit_tile(ptile, against)) {
+return TRUE;
+  }
+
+  pcity = tile_city(ptile);
+  if (ptile != NULL && !pplayers_allied(against, city_owner(pcity))) {
+return TRUE;
+  }
+
+  return FALSE;
+}
+
+/*
   Return number of units on tile
 */
 int api_methods_tile_num_units(lua_State *L, Tile *ptile)

Modified: trunk/common/scriptcore/api_game_methods.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/api_game_methods.h?rev=35678=35677=35678=diff
==
--- trunk/common/scriptcore/api_game_methods.h  (original)
+++ trunk/common/scriptcore/api_game_methods.h  Sat May 20 14:28:36 2017
@@ -134,6 +134,7 @@
 bool api_methods_tile_has_extra(lua_State *L, Tile *ptile, const char *name);
 bool api_methods_tile_has_base(lua_State *L, Tile *ptile, const char *name);
 bool api_methods_tile_has_road(lua_State *L, Tile *ptile, const char *name);
+bool api_methods_enemy_tile(lua_State *L, Tile *ptile, Player *against);
 int api_methods_tile_num_units(lua_State *L, Tile *ptile);
 int api_methods_tile_sq_distance(lua_State *L, Tile *ptile1, Tile *ptile2);
 int api_methods_private_tile_next_outward_index(lua_State *L, Tile *pstart,

Modified: trunk/common/scriptcore/tolua_game.pkg
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/tolua_game.pkg?rev=35678=35677=35678=diff
==
--- trunk/common/scriptcore/tolua_game.pkg  (original)
+++ trunk/common/scriptcore/tolua_game.pkg  Sat May 20 14:28:36 2017
@@ -289,6 +289,8 @@
 @ has_base(lua_State *L, Tile *self, const char *name);
   bool api_methods_tile_has_road
 @ has_road(lua_State *L, Tile *self, const char *name);
+  bool api_methods_enemy_tile
+@ is_enemy(lua_State *L, Tile *self, Player *against);
   int api_methods_tile_num_units
 @ num_units (lua_State *L, Tile *self);
   int api_methods_tile_sq_distance


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


[Freeciv-commits] r35677 - in /trunk: common/ server/ server/scripting/

2017-05-20 Thread cazfi74
Author: cazfi
Date: Sat May 20 13:41:36 2017
New Revision: 35677

URL: http://svn.gna.org/viewcvs/freeciv?rev=35677=rev
Log:
Add initial support for optional luadata.txt datafile

See hrm Feature #661635

Added:
trunk/server/scripting/api_server_luadata.c
trunk/server/scripting/api_server_luadata.h
Modified:
trunk/common/game.c
trunk/common/game.h
trunk/server/ruleset.c
trunk/server/scripting/Makefile.am
trunk/server/scripting/tolua_server.pkg

Modified: trunk/common/game.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/game.c?rev=35677=35676=35677=diff
==
--- trunk/common/game.c (original)
+++ trunk/common/game.c Sat May 20 13:41:36 2017
@@ -530,6 +530,7 @@
   multipliers_init();
 
   if (is_server()) {
+game.server.luadata = NULL;
 game.server.ruledit.nationlist = NULL;
 game.server.ruledit.embedded_nations = NULL;
 game.server.ruledit.embedded_nations_count = 0;
@@ -598,6 +599,9 @@
   }
 
   if (is_server()) {
+if (game.server.luadata != NULL) {
+  secfile_destroy(game.server.luadata);
+}
 if (game.server.ruledit.description_file != NULL) {
   free(game.server.ruledit.description_file);
   game.server.ruledit.description_file = NULL;

Modified: trunk/common/game.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/game.h?rev=35677=35676=35677=diff
==
--- trunk/common/game.h (original)
+++ trunk/common/game.h Sat May 20 13:41:36 2017
@@ -233,6 +233,8 @@
 
   struct rgbcolor_list *plr_colors;
 
+  struct section_file *luadata;
+
   struct {
 int turns;
 int max_size;

Modified: trunk/server/ruleset.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/ruleset.c?rev=35677=35676=35677=diff
==
--- trunk/server/ruleset.c  (original)
+++ trunk/server/ruleset.c  Sat May 20 13:41:36 2017
@@ -221,7 +221,8 @@
 **/
 static const char *valid_ruleset_filename(const char *subdir,
   const char *name,
-  const char *extension)
+  const char *extension,
+  bool optional)
 {
   char filename[512];
   const char *dfilename;
@@ -250,7 +251,7 @@
   dfilename = fileinfoname(get_data_dirs(), filename);
   if (dfilename) {
 return dfilename;
-  } else {
+  } else if (!optional) {
 ruleset_error(LOG_ERROR,
   /* TRANS: message about an installation error. */
   _("Could not find a readable \"%s.%s\" ruleset file."),
@@ -277,7 +278,7 @@
 {
   char sfilename[512];
   const char *dfilename = valid_ruleset_filename(rsdir, whichset,
- RULES_SUFFIX);
+ RULES_SUFFIX, FALSE);
   struct section_file *secfile;
 
   if (dfilename == NULL) {
@@ -304,7 +305,7 @@
  char **buffer)
 {
   const char *dfilename = valid_ruleset_filename(rsdir, whichset,
- SCRIPT_SUFFIX);
+ SCRIPT_SUFFIX, FALSE);
 
   if (dfilename == NULL) {
 return FALSE;
@@ -322,6 +323,33 @@
   }
 
   return TRUE;
+}
+
+/**
+  Load optional luadata.txt
+**/
+static struct section_file *openload_luadata_file(const char *rsdir)
+{
+  struct section_file *secfile;
+  char sfilename[512];
+  const char *dfilename = valid_ruleset_filename(rsdir, "luadata",
+ "txt", TRUE);
+
+  if (dfilename == NULL) {
+return NULL;
+  }
+
+  /* Need to save a copy of the filename for following message, since
+ section_file_load() may call datafilename() for includes. */
+  sz_strlcpy(sfilename, dfilename);
+  secfile = secfile_load(sfilename, FALSE);
+
+  if (secfile == NULL) {
+ruleset_error(LOG_ERROR, "Could not load luadata '%s':\n%s",
+  sfilename, secfile_error());
+  }
+
+  return secfile;
 }
 
 /**
@@ -8006,6 +8034,7 @@
   nationfile = openload_ruleset_file("nations", rsdir);
   effectfile = openload_ruleset_file("effects", rsdir);
   gamefile = openload_ruleset_file("game", rsdir);
+  game.server.luadata = openload_luadata_file(rsdir);
 
   if (techfile == NULL
   || buildfile  == NULL

Modified: trunk/server/scripting/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/scripting/Makefile.am?rev=35677=35676=35677=diff

[Freeciv-commits] r35676 - in /branches/S2_6: ai/default/aiunit.c server/advisors/advgoto.c

2017-05-20 Thread cazfi74
Author: cazfi
Date: Sat May 20 13:11:42 2017
New Revision: 35676

URL: http://svn.gna.org/viewcvs/freeciv?rev=35676=rev
Log:
Set ACTIVITY_GOTO persistently for military units heading to target

See hrm Bug #661869

Modified:
branches/S2_6/ai/default/aiunit.c
branches/S2_6/server/advisors/advgoto.c

Modified: branches/S2_6/ai/default/aiunit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/ai/default/aiunit.c?rev=35676=35675=35676=diff
==
--- branches/S2_6/ai/default/aiunit.c   (original)
+++ branches/S2_6/ai/default/aiunit.c   Sat May 20 13:11:42 2017
@@ -1734,6 +1734,12 @@
  * and on a ferry. This fixes the problem (usually). */
 UNIT_LOG(LOG_DEBUG, punit, "mil att gothere -> (%d, %d)",
  TILE_XY(dest_tile));
+
+/* Set ACTIVITY_GOTO more permanently than just inside
+ * adv_follow_path(). This way other units will know we're
+ * on our way even if we don't reach target yet. */
+punit->goto_tile = dest_tile;
+unit_activity_handling(punit, ACTIVITY_GOTO);
 if (NULL != path && !adv_follow_path(punit, path, dest_tile)) {
   /* Died. */
   pf_path_destroy(path);

Modified: branches/S2_6/server/advisors/advgoto.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/advisors/advgoto.c?rev=35676=35675=35676=diff
==
--- branches/S2_6/server/advisors/advgoto.c (original)
+++ branches/S2_6/server/advisors/advgoto.c Sat May 20 13:11:42 2017
@@ -59,9 +59,12 @@
   unit_activity_handling(punit, ACTIVITY_GOTO);
   alive = adv_unit_execute_path(punit, path);
   if (alive) {
-unit_activity_handling(punit, ACTIVITY_IDLE);
-send_unit_info(NULL, punit); /* FIXME: probably duplicate */
-unit_activity_handling_targeted(punit, activity, );
+if (activity != ACTIVITY_GOTO) {
+  /* Only go via ACTIVITY_IDLE if we are actually changing the activity */
+  unit_activity_handling(punit, ACTIVITY_IDLE);
+  send_unit_info(NULL, punit); /* FIXME: probably duplicate */
+  unit_activity_handling_targeted(punit, activity, );
+}
 punit->goto_tile = old_tile; /* May be NULL. */
 send_unit_info(NULL, punit);
   }


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


[Freeciv-commits] r35675 - in /branches/S3_0: ai/default/aiunit.c server/advisors/advgoto.c

2017-05-20 Thread cazfi74
Author: cazfi
Date: Sat May 20 13:11:35 2017
New Revision: 35675

URL: http://svn.gna.org/viewcvs/freeciv?rev=35675=rev
Log:
Set ACTIVITY_GOTO persistently for military units heading to target

See hrm Bug #661869

Modified:
branches/S3_0/ai/default/aiunit.c
branches/S3_0/server/advisors/advgoto.c

Modified: branches/S3_0/ai/default/aiunit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/default/aiunit.c?rev=35675=35674=35675=diff
==
--- branches/S3_0/ai/default/aiunit.c   (original)
+++ branches/S3_0/ai/default/aiunit.c   Sat May 20 13:11:35 2017
@@ -1738,6 +1738,12 @@
  * and on a ferry. This fixes the problem (usually). */
 UNIT_LOG(LOG_DEBUG, punit, "mil att gothere -> (%d, %d)",
  TILE_XY(dest_tile));
+
+/* Set ACTIVITY_GOTO more permanently than just inside
+ * adv_follow_path(). This way other units will know we're
+ * on our way even if we don't reach target yet. */
+punit->goto_tile = dest_tile;
+unit_activity_handling(punit, ACTIVITY_GOTO);
 if (NULL != path && !adv_follow_path(punit, path, dest_tile)) {
   /* Died. */
   pf_path_destroy(path);

Modified: branches/S3_0/server/advisors/advgoto.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/advisors/advgoto.c?rev=35675=35674=35675=diff
==
--- branches/S3_0/server/advisors/advgoto.c (original)
+++ branches/S3_0/server/advisors/advgoto.c Sat May 20 13:11:35 2017
@@ -59,9 +59,12 @@
   unit_activity_handling(punit, ACTIVITY_GOTO);
   alive = adv_unit_execute_path(punit, path);
   if (alive) {
-unit_activity_handling(punit, ACTIVITY_IDLE);
-send_unit_info(NULL, punit); /* FIXME: probably duplicate */
-unit_activity_handling_targeted(punit, activity, );
+if (activity != ACTIVITY_GOTO) {
+  /* Only go via ACTIVITY_IDLE if we are actually changing the activity */
+  unit_activity_handling(punit, ACTIVITY_IDLE);
+  send_unit_info(NULL, punit); /* FIXME: probably duplicate */
+  unit_activity_handling_targeted(punit, activity, );
+}
 punit->goto_tile = old_tile; /* May be NULL. */
 send_unit_info(NULL, punit);
   }


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


[Freeciv-commits] r35674 - in /trunk: ai/default/aiunit.c server/advisors/advgoto.c

2017-05-20 Thread cazfi74
Author: cazfi
Date: Sat May 20 13:11:29 2017
New Revision: 35674

URL: http://svn.gna.org/viewcvs/freeciv?rev=35674=rev
Log:
Set ACTIVITY_GOTO persistently for military units heading to target

See hrm Bug #661869

Modified:
trunk/ai/default/aiunit.c
trunk/server/advisors/advgoto.c

Modified: trunk/ai/default/aiunit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aiunit.c?rev=35674=35673=35674=diff
==
--- trunk/ai/default/aiunit.c   (original)
+++ trunk/ai/default/aiunit.c   Sat May 20 13:11:29 2017
@@ -1738,6 +1738,12 @@
  * and on a ferry. This fixes the problem (usually). */
 UNIT_LOG(LOG_DEBUG, punit, "mil att gothere -> (%d, %d)",
  TILE_XY(dest_tile));
+
+/* Set ACTIVITY_GOTO more permanently than just inside
+ * adv_follow_path(). This way other units will know we're
+ * on our way even if we don't reach target yet. */
+punit->goto_tile = dest_tile;
+unit_activity_handling(punit, ACTIVITY_GOTO);
 if (NULL != path && !adv_follow_path(punit, path, dest_tile)) {
   /* Died. */
   pf_path_destroy(path);

Modified: trunk/server/advisors/advgoto.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/advisors/advgoto.c?rev=35674=35673=35674=diff
==
--- trunk/server/advisors/advgoto.c (original)
+++ trunk/server/advisors/advgoto.c Sat May 20 13:11:29 2017
@@ -59,9 +59,12 @@
   unit_activity_handling(punit, ACTIVITY_GOTO);
   alive = adv_unit_execute_path(punit, path);
   if (alive) {
-unit_activity_handling(punit, ACTIVITY_IDLE);
-send_unit_info(NULL, punit); /* FIXME: probably duplicate */
-unit_activity_handling_targeted(punit, activity, );
+if (activity != ACTIVITY_GOTO) {
+  /* Only go via ACTIVITY_IDLE if we are actually changing the activity */
+  unit_activity_handling(punit, ACTIVITY_IDLE);
+  send_unit_info(NULL, punit); /* FIXME: probably duplicate */
+  unit_activity_handling_targeted(punit, activity, );
+}
 punit->goto_tile = old_tile; /* May be NULL. */
 send_unit_info(NULL, punit);
   }


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


[Freeciv-commits] r35673 - /branches/S3_0/windows/installer_cross/winbuild.sh

2017-05-20 Thread cazfi74
Author: cazfi
Date: Sat May 20 10:34:11 2017
New Revision: 35673

URL: http://svn.gna.org/viewcvs/freeciv?rev=35673=rev
Log:
Add "-crs" to version number of installer_cross builds

Distinguish installer_cross builds from other build types

See hrm Feature #661802

Modified:
branches/S3_0/windows/installer_cross/winbuild.sh

Modified: branches/S3_0/windows/installer_cross/winbuild.sh
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/windows/installer_cross/winbuild.sh?rev=35673=35672=35673=diff
==
--- branches/S3_0/windows/installer_cross/winbuild.sh   (original)
+++ branches/S3_0/windows/installer_cross/winbuild.sh   Sat May 20 10:34:11 2017
@@ -134,7 +134,7 @@
 if ! (
 cd build-$SETUP$GUIP
 
-if ! ../../../configure CPPFLAGS="-I${DLLSPATH}/include 
-D_WIN32_WINNT=${MIN_WINVER}" CFLAGS="-Wno-error" 
PKG_CONFIG_LIBDIR="${DLLSPATH}/lib/pkgconfig" --enable-sys-tolua-cmd 
--with-magickwand="${DLLSPATH}/bin" --prefix="/" --enable-client=$CLIENTS 
--enable-fcmp=$FCMP --enable-svnrev --enable-debug --host=$TARGET 
--build=$(../../../bootstrap/config.guess) --with-libiconv-prefix=${DLLSPATH} 
--with-sqlite3-prefix=${DLLSPATH} --with-followtag="crosser" --enable-crosser 
--enable-ai-static=${AIS} --disable-freeciv-manual --enable-sdl-mixer=sdl2 
--with-qt5-includes=${DLLSPATH}/include --with-qt5-libs=${DLLSPATH}/lib 
--with-tinycthread --enable-server=$SERVER --enable-ruledit=$RULEDIT
+if ! ../../../configure FREECIV_LABEL_FORCE="-crs" 
CPPFLAGS="-I${DLLSPATH}/include -D_WIN32_WINNT=${MIN_WINVER}" 
CFLAGS="-Wno-error" PKG_CONFIG_LIBDIR="${DLLSPATH}/lib/pkgconfig" 
--enable-sys-tolua-cmd --with-magickwand="${DLLSPATH}/bin" --prefix="/" 
--enable-client=$CLIENTS --enable-fcmp=$FCMP --enable-svnrev --enable-debug 
--host=$TARGET --build=$(../../../bootstrap/config.guess) 
--with-libiconv-prefix=${DLLSPATH} --with-sqlite3-prefix=${DLLSPATH} 
--with-followtag="crosser" --enable-crosser --enable-ai-static=${AIS} 
--disable-freeciv-manual --enable-sdl-mixer=sdl2 
--with-qt5-includes=${DLLSPATH}/include --with-qt5-libs=${DLLSPATH}/lib 
--with-tinycthread --enable-server=$SERVER --enable-ruledit=$RULEDIT
 then
   echo "Configure failed" >&2
   exit 1


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


[Freeciv-commits] r35670 - in /trunk: common/movement.c common/movement.h common/unit.c common/unit.h server/savegame3.c

2017-05-20 Thread cazfi74
Author: cazfi
Date: Sat May 20 09:34:44 2017
New Revision: 35670

URL: http://svn.gna.org/viewcvs/freeciv?rev=35670=rev
Log:
Add "stay" property for individual units

See hrm Feature #661437

Modified:
trunk/common/movement.c
trunk/common/movement.h
trunk/common/unit.c
trunk/common/unit.h
trunk/server/savegame3.c

Modified: trunk/common/movement.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/movement.c?rev=35670=35669=35670=diff
==
--- trunk/common/movement.c (original)
+++ trunk/common/movement.c Sat May 20 09:34:44 2017
@@ -544,20 +544,21 @@
 
   The unit can move if:
 1) The unit is idle or on server goto.
-2) The target location is next to the unit.
-3) There are no non-allied units on the target tile.
-4) Animals cannot move out from home terrains
-5) Unit can move to a tile where it can't survive on its own if there
+2) Unit is not prohibited from moving by scenario
+3) The target location is next to the unit.
+4) There are no non-allied units on the target tile.
+5) Animals cannot move out from home terrains
+6) Unit can move to a tile where it can't survive on its own if there
is free transport capacity.
-6) There are no peaceful but non allied units on the target tile.
-7) There is not a non allied city on the target tile when
+7) There are no peaceful but non allied units on the target tile.
+8) There is not a non allied city on the target tile when
enter_enemy_city is false. When enter_enemy_city is true a non
peaceful city is also accepted.
-8) There is no non-allied unit blocking (zoc) [or igzoc is true].
-9) Triremes cannot move out of sight from land.
-   10) It is not the territory of a player we are at peace with.
-   11) The unit is unable to disembark from current transporter.
-   12) The unit is making a non-native move (e.g. lack of road)
+9) There is no non-allied unit blocking (zoc) [or igzoc is true].
+   10) Triremes cannot move out of sight from land.
+   11) It is not the territory of a player we are at peace with.
+   12) The unit is unable to disembark from current transporter.
+   13) The unit is making a non-native move (e.g. lack of road)
 **/
 enum unit_move_result
 unit_move_to_tile_test(const struct civ_map *nmap,
@@ -581,25 +582,30 @@
   }
 
   /* 2) */
+  if (punit->stay) {
+return MR_UNIT_STAY;
+  }
+
+  /* 3) */
   if (!is_tiles_adjacent(src_tile, dst_tile)) {
 /* Of course you can only move to adjacent positions. */
 return MR_BAD_DESTINATION;
   }
 
-  /* 3) */
+  /* 4) */
   if (is_non_allied_unit_tile(dst_tile, puowner)) {
 /* You can't move onto a tile with non-allied units on it (try
  * attacking instead). */
 return MR_DESTINATION_OCCUPIED_BY_NON_ALLIED_UNIT;
   }
 
-  /* 4) */
+  /* 5) */
   if (puowner->ai_common.barbarian_type == ANIMAL_BARBARIAN
   && dst_tile->terrain->animal != punittype) {
 return MR_ANIMAL_DISALLOWED;
   }
 
-  /* 5) */
+  /* 6) */
   if (embark_to != NULL) {
 if (!could_unit_load(punit, embark_to)) {
   return MR_NO_TRANSPORTER_CAPACITY;
@@ -609,7 +615,7 @@
 return MR_NO_TRANSPORTER_CAPACITY;
   }
 
-  /* 6) */
+  /* 7) */
   if (is_non_attack_unit_tile(dst_tile, puowner)) {
 /* You can't move into a non-allied tile.
  *
@@ -618,7 +624,7 @@
 return MR_NO_WAR;
   }
 
-  /* 7) */
+  /* 8) */
   if ((pcity = tile_city(dst_tile))) {
 if (enter_enemy_city) {
   if (pplayers_non_attack(city_owner(pcity), puowner)) {
@@ -636,7 +642,7 @@
 }
   }
 
-  /* 8) */
+  /* 9) */
   zoc = igzoc
 || can_step_taken_wrt_to_zoc(punittype, puowner, src_tile, dst_tile);
   if (!zoc) {
@@ -644,25 +650,25 @@
 return MR_ZOC;
   }
 
-  /* 9) */
+  /* 10) */
   if (utype_has_flag(punittype, UTYF_COAST_STRICT)
   && !is_safe_ocean(&(wld.map), dst_tile)) {
 return MR_TRIREME;
   }
 
-  /* 10) */
+  /* 11) */
   if (!utype_has_flag(punittype, UTYF_CIVILIAN)
   && !player_can_invade_tile(puowner, dst_tile)) {
 return MR_PEACE;
   }
 
-  /* 11) */
+  /* 12) */
   if (unit_transported(punit)
  && !can_unit_unload(punit, unit_transport_get(punit))) {
 return MR_CANNOT_DISEMBARK;
   }
 
-  /* 12) */
+  /* 13) */
   if (!(is_native_move(utype_class(punittype), src_tile, dst_tile)
 /* Allow non-native moves into cities or boarding transport. */
 || pcity

Modified: trunk/common/movement.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/movement.h?rev=35670=35669=35670=diff
==
--- trunk/common/movement.h (original)
+++ trunk/common/movement.h Sat May 20 09:34:44 2017
@@ -43,6 +43,7 @@
   MR_CANNOT_DISEMBARK,
   MR_NON_NATIVE_MOVE,  /* Usually RMM_RELAXED road diagonally without link */
   

[Freeciv-commits] r35671 - in /branches/S3_0: common/movement.c common/movement.h common/unit.c common/unit.h server/savegame3.c

2017-05-20 Thread cazfi74
Author: cazfi
Date: Sat May 20 09:34:52 2017
New Revision: 35671

URL: http://svn.gna.org/viewcvs/freeciv?rev=35671=rev
Log:
Add "stay" property for individual units

See hrm Feature #661437

Modified:
branches/S3_0/common/movement.c
branches/S3_0/common/movement.h
branches/S3_0/common/unit.c
branches/S3_0/common/unit.h
branches/S3_0/server/savegame3.c

Modified: branches/S3_0/common/movement.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/movement.c?rev=35671=35670=35671=diff
==
--- branches/S3_0/common/movement.c (original)
+++ branches/S3_0/common/movement.c Sat May 20 09:34:52 2017
@@ -537,20 +537,21 @@
 
   The unit can move if:
 1) The unit is idle or on server goto.
-2) The target location is next to the unit.
-3) There are no non-allied units on the target tile.
-4) Animals cannot move out from home terrains
-5) Unit can move to a tile where it can't survive on its own if there
+2) Unit is not prohibited from moving by scenario
+3) The target location is next to the unit.
+4) There are no non-allied units on the target tile.
+5) Animals cannot move out from home terrains
+6) Unit can move to a tile where it can't survive on its own if there
is free transport capacity.
-6) There are no peaceful but non allied units on the target tile.
-7) There is not a non allied city on the target tile when
+7) There are no peaceful but non allied units on the target tile.
+8) There is not a non allied city on the target tile when
enter_enemy_city is false. When enter_enemy_city is true a non
peaceful city is also accepted.
-8) There is no non-allied unit blocking (zoc) [or igzoc is true].
-9) Triremes cannot move out of sight from land.
-   10) It is not the territory of a player we are at peace with.
-   11) The unit is unable to disembark from current transporter.
-   12) The unit is making a non-native move (e.g. lack of road)
+9) There is no non-allied unit blocking (zoc) [or igzoc is true].
+   10) Triremes cannot move out of sight from land.
+   11) It is not the territory of a player we are at peace with.
+   12) The unit is unable to disembark from current transporter.
+   13) The unit is making a non-native move (e.g. lack of road)
 **/
 enum unit_move_result
 unit_move_to_tile_test(const struct unit *punit,
@@ -573,25 +574,30 @@
   }
 
   /* 2) */
+  if (punit->stay) {
+return MR_UNIT_STAY;
+  }
+
+  /* 3) */
   if (!is_tiles_adjacent(src_tile, dst_tile)) {
 /* Of course you can only move to adjacent positions. */
 return MR_BAD_DESTINATION;
   }
 
-  /* 3) */
+  /* 4) */
   if (is_non_allied_unit_tile(dst_tile, puowner)) {
 /* You can't move onto a tile with non-allied units on it (try
  * attacking instead). */
 return MR_DESTINATION_OCCUPIED_BY_NON_ALLIED_UNIT;
   }
 
-  /* 4) */
+  /* 5) */
   if (puowner->ai_common.barbarian_type == ANIMAL_BARBARIAN
   && dst_tile->terrain->animal != punittype) {
 return MR_ANIMAL_DISALLOWED;
   }
 
-  /* 5) */
+  /* 6) */
   if (embark_to != NULL) {
 if (!could_unit_load(punit, embark_to)) {
   return MR_NO_TRANSPORTER_CAPACITY;
@@ -601,7 +607,7 @@
 return MR_NO_TRANSPORTER_CAPACITY;
   }
 
-  /* 6) */
+  /* 7) */
   if (is_non_attack_unit_tile(dst_tile, puowner)) {
 /* You can't move into a non-allied tile.
  *
@@ -610,7 +616,7 @@
 return MR_NO_WAR;
   }
 
-  /* 7) */
+  /* 8) */
   if ((pcity = tile_city(dst_tile))) {
 if (enter_enemy_city) {
   if (pplayers_non_attack(city_owner(pcity), puowner)) {
@@ -628,7 +634,7 @@
 }
   }
 
-  /* 8) */
+  /* 9) */
   zoc = igzoc
 || can_step_taken_wrt_to_zoc(punittype, puowner, src_tile, dst_tile);
   if (!zoc) {
@@ -636,24 +642,24 @@
 return MR_ZOC;
   }
 
-  /* 9) */
+  /* 10) */
   if (utype_has_flag(punittype, UTYF_COAST_STRICT) && 
!is_safe_ocean(dst_tile)) {
 return MR_TRIREME;
   }
 
-  /* 10) */
+  /* 11) */
   if (!utype_has_flag(punittype, UTYF_CIVILIAN)
   && !player_can_invade_tile(puowner, dst_tile)) {
 return MR_PEACE;
   }
 
-  /* 11) */
+  /* 12) */
   if (unit_transported(punit)
  && !can_unit_unload(punit, unit_transport_get(punit))) {
 return MR_CANNOT_DISEMBARK;
   }
 
-  /* 12) */
+  /* 13) */
   if (!(is_native_move(utype_class(punittype), src_tile, dst_tile)
 /* Allow non-native moves into cities or boarding transport. */
 || pcity

Modified: branches/S3_0/common/movement.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/movement.h?rev=35671=35670=35671=diff
==
--- branches/S3_0/common/movement.h (original)
+++ branches/S3_0/common/movement.h Sat May 20 09:34:52 2017
@@ -43,6 +43,7 @@
   MR_CANNOT_DISEMBARK,
   

[Freeciv-commits] r35669 - /branches/S3_0/tools/ruledit/

2017-05-19 Thread cazfi74
Author: cazfi
Date: Sat May 20 01:35:39 2017
New Revision: 35669

URL: http://svn.gna.org/viewcvs/freeciv?rev=35669=rev
Log:
Prevent opening multiple req_edit dialogs for the same requirement vector

See hrm Feature #660194

Modified:
branches/S3_0/tools/ruledit/req_edit.cpp
branches/S3_0/tools/ruledit/req_edit.h
branches/S3_0/tools/ruledit/ruledit_qt.cpp
branches/S3_0/tools/ruledit/ruledit_qt.h
branches/S3_0/tools/ruledit/tab_building.cpp
branches/S3_0/tools/ruledit/tab_enablers.cpp
branches/S3_0/tools/ruledit/tab_extras.cpp
branches/S3_0/tools/ruledit/tab_gov.cpp

Modified: branches/S3_0/tools/ruledit/req_edit.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/tools/ruledit/req_edit.cpp?rev=35669=35668=35669=diff
==
--- branches/S3_0/tools/ruledit/req_edit.cpp(original)
+++ branches/S3_0/tools/ruledit/req_edit.cppSat May 20 01:35:39 2017
@@ -31,6 +31,7 @@
 
 // ruledit
 #include "ruledit.h"
+#include "ruledit_qt.h"
 #include "univ_value.h"
 
 #include "req_edit.h"
@@ -177,6 +178,7 @@
 **/
 void req_edit::close_now()
 {
+  ui->unregister_req_edit(this);
   done(0);
 }
 
@@ -361,3 +363,11 @@
 refresh();
   }
 }
+
+/**
+  User clicked windows close button.
+**/
+void req_edit::closeEvent(QCloseEvent *event)
+{
+  ui->unregister_req_edit(this);
+}

Modified: branches/S3_0/tools/ruledit/req_edit.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/tools/ruledit/req_edit.h?rev=35669=35668=35669=diff
==
--- branches/S3_0/tools/ruledit/req_edit.h  (original)
+++ branches/S3_0/tools/ruledit/req_edit.h  Sat May 20 01:35:39 2017
@@ -35,11 +35,12 @@
 void refresh();
 void add(const char *msg);
 
+struct requirement_vector *req_vector;
+
   private:
 ruledit_gui *ui;
 
 QListWidget *req_list;
-struct requirement_vector *req_vector;
 
 struct requirement *selected;
 
@@ -62,6 +63,9 @@
 void req_present_menu(QAction *action);
 void univ_value_enum_menu(QAction *action);
 void univ_value_edit();
+
+  protected:
+void closeEvent(QCloseEvent *event);
 };
 
 #endif // FC__REQ_EDIT_H

Modified: branches/S3_0/tools/ruledit/ruledit_qt.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/tools/ruledit/ruledit_qt.cpp?rev=35669=35668=35669=diff
==
--- branches/S3_0/tools/ruledit/ruledit_qt.cpp  (original)
+++ branches/S3_0/tools/ruledit/ruledit_qt.cpp  Sat May 20 01:35:39 2017
@@ -40,6 +40,7 @@
 
 // ruledit
 #include "requirers_dlg.h"
+#include "req_edit.h"
 #include "ruledit.h"
 #include "tab_building.h"
 #include "tab_enablers.h"
@@ -192,6 +193,8 @@
   full_layout->addWidget(msg_dspl);
 
   central->setLayout(full_layout);
+
+  req_edits = req_edit_list_new();
 }
 
 /**
@@ -269,6 +272,35 @@
 }
 
 /**
+  Open req_edit dialog
+**/
+void ruledit_gui::open_req_edit(QString target, struct requirement_vector 
*preqs)
+{
+  req_edit *redit;  
+  
+  req_edit_list_iterate(req_edits, old_edit) {
+if (old_edit->req_vector == preqs) {
+  // Already open
+  return;
+}
+  } req_edit_list_iterate_end;
+
+  redit = new req_edit(this, target, preqs);
+
+  redit->show();
+
+  req_edit_list_append(req_edits, redit);
+}
+
+/**
+  Unregisted closed req_edit dialog
+**/
+void ruledit_gui::unregister_req_edit(class req_edit *redit)
+{
+  req_edit_list_remove(req_edits, redit);
+}
+
+/**
   Main window constructor
 **/
 ruledit_main::ruledit_main(QApplication *qapp_in, QWidget *central_in) : 
QMainWindow()

Modified: branches/S3_0/tools/ruledit/ruledit_qt.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/tools/ruledit/ruledit_qt.h?rev=35669=35668=35669=diff
==
--- branches/S3_0/tools/ruledit/ruledit_qt.h(original)
+++ branches/S3_0/tools/ruledit/ruledit_qt.hSat May 20 01:35:39 2017
@@ -38,6 +38,7 @@
 class tab_enabler;
 class tab_extras;
 class tab_terrains;
+class req_edit;
 
 class ruledit_main : public QMainWindow
 {
@@ -55,6 +56,15 @@
   void closeEvent(QCloseEvent *cevent);
 };
 
+/* get 'struct 

[Freeciv-commits] r35668 - /trunk/tools/ruledit/

2017-05-19 Thread cazfi74
Author: cazfi
Date: Sat May 20 01:35:32 2017
New Revision: 35668

URL: http://svn.gna.org/viewcvs/freeciv?rev=35668=rev
Log:
Prevent opening multiple req_edit dialogs for the same requirement vector

See hrm Feature #660194

Modified:
trunk/tools/ruledit/effect_edit.cpp
trunk/tools/ruledit/req_edit.cpp
trunk/tools/ruledit/req_edit.h
trunk/tools/ruledit/ruledit_qt.cpp
trunk/tools/ruledit/ruledit_qt.h
trunk/tools/ruledit/tab_building.cpp
trunk/tools/ruledit/tab_enablers.cpp
trunk/tools/ruledit/tab_extras.cpp
trunk/tools/ruledit/tab_gov.cpp

Modified: trunk/tools/ruledit/effect_edit.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/effect_edit.cpp?rev=35668=35667=35668=diff
==
--- trunk/tools/ruledit/effect_edit.cpp (original)
+++ trunk/tools/ruledit/effect_edit.cpp Sat May 20 01:35:32 2017
@@ -29,8 +29,8 @@
 #include "effects.h"
 
 // ruledit
-#include "req_edit.h"
 #include "ruledit.h"
+#include "ruledit_qt.h"
 #include "validity.h"
 
 #include "effect_edit.h"
@@ -221,13 +221,10 @@
 {
   if (selected != nullptr) {
 char buf[128];
-req_edit *redit;
 
 fc_snprintf(buf, sizeof(buf), R__("%s effect #%d"), name.toUtf8().data(),
 selected_nbr);
 
-redit = new req_edit(ui, QString::fromUtf8(buf), >reqs);
-
-redit->show();
-  }
-}
+ui->open_req_edit(QString::fromUtf8(buf), >reqs);
+  }
+}

Modified: trunk/tools/ruledit/req_edit.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/req_edit.cpp?rev=35668=35667=35668=diff
==
--- trunk/tools/ruledit/req_edit.cpp(original)
+++ trunk/tools/ruledit/req_edit.cppSat May 20 01:35:32 2017
@@ -31,6 +31,7 @@
 
 // ruledit
 #include "ruledit.h"
+#include "ruledit_qt.h"
 #include "univ_value.h"
 
 #include "req_edit.h"
@@ -177,6 +178,7 @@
 **/
 void req_edit::close_now()
 {
+  ui->unregister_req_edit(this);
   done(0);
 }
 
@@ -361,3 +363,11 @@
 refresh();
   }
 }
+
+/**
+  User clicked windows close button.
+**/
+void req_edit::closeEvent(QCloseEvent *event)
+{
+  ui->unregister_req_edit(this);
+}

Modified: trunk/tools/ruledit/req_edit.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/req_edit.h?rev=35668=35667=35668=diff
==
--- trunk/tools/ruledit/req_edit.h  (original)
+++ trunk/tools/ruledit/req_edit.h  Sat May 20 01:35:32 2017
@@ -35,11 +35,12 @@
 void refresh();
 void add(const char *msg);
 
+struct requirement_vector *req_vector;
+
   private:
 ruledit_gui *ui;
 
 QListWidget *req_list;
-struct requirement_vector *req_vector;
 
 struct requirement *selected;
 
@@ -62,6 +63,9 @@
 void req_present_menu(QAction *action);
 void univ_value_enum_menu(QAction *action);
 void univ_value_edit();
+
+  protected:
+void closeEvent(QCloseEvent *event);
 };
 
 #endif // FC__REQ_EDIT_H

Modified: trunk/tools/ruledit/ruledit_qt.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/ruledit_qt.cpp?rev=35668=35667=35668=diff
==
--- trunk/tools/ruledit/ruledit_qt.cpp  (original)
+++ trunk/tools/ruledit/ruledit_qt.cpp  Sat May 20 01:35:32 2017
@@ -40,6 +40,7 @@
 
 // ruledit
 #include "requirers_dlg.h"
+#include "req_edit.h"
 #include "ruledit.h"
 #include "tab_building.h"
 #include "tab_enablers.h"
@@ -192,6 +193,8 @@
   full_layout->addWidget(msg_dspl);
 
   central->setLayout(full_layout);
+
+  req_edits = req_edit_list_new();
 }
 
 /**
@@ -269,6 +272,35 @@
 }
 
 /**
+  Open req_edit dialog
+**/
+void ruledit_gui::open_req_edit(QString target, struct requirement_vector 
*preqs)
+{
+  req_edit *redit;  
+  
+  req_edit_list_iterate(req_edits, old_edit) {
+if (old_edit->req_vector == preqs) {
+  // Already open
+  return;
+}
+  } req_edit_list_iterate_end;
+
+  redit = new req_edit(this, target, preqs);
+
+  redit->show();
+
+  req_edit_list_append(req_edits, redit);
+}
+
+/**
+  Unregisted closed req_edit dialog
+**/
+void ruledit_gui::unregister_req_edit(class req_edit *redit)
+{
+  req_edit_list_remove(req_edits, redit);
+}
+
+/**
   Main window 

[Freeciv-commits] r35666 - in /trunk: client/luascript/ common/scriptcore/ server/scripting/

2017-05-19 Thread cazfi74
Author: cazfi
Date: Sat May 20 01:05:45 2017
New Revision: 35666

URL: http://svn.gna.org/viewcvs/freeciv?rev=35666=rev
Log:
Let security restrictions of 'game' and 'fcdb' lua instances differ

Requested by Jacob Nevins 

See hrm Feature #657141

Modified:
trunk/client/luascript/script_client.c
trunk/common/scriptcore/luascript.c
trunk/common/scriptcore/luascript.h
trunk/server/scripting/script_fcdb.c
trunk/server/scripting/script_server.c

Modified: trunk/client/luascript/script_client.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/luascript/script_client.c?rev=35666=35665=35666=diff
==
--- trunk/client/luascript/script_client.c  (original)
+++ trunk/client/luascript/script_client.c  Sat May 20 01:05:45 2017
@@ -200,7 +200,7 @@
 return TRUE;
   }
 
-  main_fcl = luascript_new(script_client_output);
+  main_fcl = luascript_new(script_client_output, TRUE);
   if (main_fcl == NULL) {
 luascript_destroy(main_fcl); /* TODO: main_fcl is NULL here... */
 main_fcl = NULL;

Modified: trunk/common/scriptcore/luascript.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/luascript.c?rev=35666=35665=35666=diff
==
--- trunk/common/scriptcore/luascript.c (original)
+++ trunk/common/scriptcore/luascript.c Sat May 20 01:05:45 2017
@@ -62,13 +62,20 @@
 #define LUASCRIPT_SECURE_LUA_VERSION1 502
 #define LUASCRIPT_SECURE_LUA_VERSION2 503
 
-static const char *luascript_unsafe_symbols[] = {
+static const char *luascript_unsafe_symbols_secure[] = {
   "debug",
   "dofile",
   "loadfile",
   NULL
 };
 
+static const char *luascript_unsafe_symbols_permissive[] = {
+  "debug",
+  "dofile",
+  "loadfile",
+  NULL
+};
+
 #if LUA_VERSION_NUM != LUASCRIPT_SECURE_LUA_VERSION1 && LUA_VERSION_NUM != 
LUASCRIPT_SECURE_LUA_VERSION2
 #warning "The script runtime's unsafe symbols information is not up to date."
 #warning "This can be a big security hole!"
@@ -79,7 +86,7 @@
   and library loading modules). See linit.c in Lua 5.1 for the default list.
 */
 #if LUA_VERSION_NUM == 502
-static luaL_Reg luascript_lualibs[] = {
+static luaL_Reg luascript_lualibs_secure[] = {
   /* Using default libraries excluding: package, io and os */
   {"_G", luaopen_base},
   {LUA_COLIBNAME, luaopen_coroutine},
@@ -91,7 +98,7 @@
   {NULL, NULL}
 };
 #elif LUA_VERSION_NUM == 503
-static luaL_Reg luascript_lualibs[] = {
+static luaL_Reg luascript_lualibs_secure[] = {
   /* Using default libraries excluding: package, io, os, and bit32 */
   {"_G", luaopen_base},
   {LUA_COLIBNAME, luaopen_coroutine},
@@ -100,6 +107,19 @@
   {LUA_UTF8LIBNAME, luaopen_utf8},
   {LUA_MATHLIBNAME, luaopen_math},
   {LUA_DBLIBNAME, luaopen_debug},
+  {NULL, NULL}
+};
+
+static luaL_Reg luascript_lualibs_permissive[] = {
+  /* Using default libraries excluding: package, io, os, and bit32 */
+  {"_G", luaopen_base},
+  {LUA_COLIBNAME, luaopen_coroutine},
+  {LUA_TABLIBNAME, luaopen_table},
+  {LUA_STRLIBNAME, luaopen_string},
+  {LUA_UTF8LIBNAME, luaopen_utf8},
+  {LUA_MATHLIBNAME, luaopen_math},
+  {LUA_DBLIBNAME, luaopen_debug},
+  {LUA_OSLIBNAME, luaopen_os},
   {NULL, NULL}
 };
 #else  /* LUA_VERSION_NUM */
@@ -316,7 +336,8 @@
 /*
   Initialize the scripting state.
 */
-struct fc_lua *luascript_new(luascript_log_func_t output_fct)
+struct fc_lua *luascript_new(luascript_log_func_t output_fct,
+ bool secured_environment)
 {
   struct fc_lua *fcl = fc_calloc(1, sizeof(*fcl));
 
@@ -328,9 +349,15 @@
   fcl->output_fct = output_fct;
   fcl->caller = NULL;
 
-  luascript_openlibs(fcl->state, luascript_lualibs);
-  luascript_traceback_func_save(fcl->state);
-  luascript_blacklist(fcl->state, luascript_unsafe_symbols);
+  if (secured_environment) {
+luascript_openlibs(fcl->state, luascript_lualibs_secure);
+luascript_traceback_func_save(fcl->state);
+luascript_blacklist(fcl->state, luascript_unsafe_symbols_secure);
+  } else {
+luascript_openlibs(fcl->state, luascript_lualibs_permissive);
+luascript_traceback_func_save(fcl->state);
+luascript_blacklist(fcl->state, luascript_unsafe_symbols_permissive);
+  }
 
   /* Save the freeciv lua struct in the lua state. */
   lua_pushstring(fcl->state, LUASCRIPT_GLOBAL_VAR_NAME);

Modified: trunk/common/scriptcore/luascript.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/scriptcore/luascript.h?rev=35666=35665=35666=diff
==
--- trunk/common/scriptcore/luascript.h (original)
+++ trunk/common/scriptcore/luascript.h Sat May 20 01:05:45 2017
@@ -61,7 +61,8 @@
 int 

[Freeciv-commits] r35667 - in /branches/S3_0: client/luascript/ common/scriptcore/ server/scripting/

2017-05-19 Thread cazfi74
Author: cazfi
Date: Sat May 20 01:05:53 2017
New Revision: 35667

URL: http://svn.gna.org/viewcvs/freeciv?rev=35667=rev
Log:
Let security restrictions of 'game' and 'fcdb' lua instances differ

Requested by Jacob Nevins 

See hrm Feature #657141

Modified:
branches/S3_0/client/luascript/script_client.c
branches/S3_0/common/scriptcore/luascript.c
branches/S3_0/common/scriptcore/luascript.h
branches/S3_0/server/scripting/script_fcdb.c
branches/S3_0/server/scripting/script_server.c

Modified: branches/S3_0/client/luascript/script_client.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/luascript/script_client.c?rev=35667=35666=35667=diff
==
--- branches/S3_0/client/luascript/script_client.c  (original)
+++ branches/S3_0/client/luascript/script_client.c  Sat May 20 01:05:53 2017
@@ -200,7 +200,7 @@
 return TRUE;
   }
 
-  main_fcl = luascript_new(script_client_output);
+  main_fcl = luascript_new(script_client_output, TRUE);
   if (main_fcl == NULL) {
 luascript_destroy(main_fcl); /* TODO: main_fcl is NULL here... */
 main_fcl = NULL;

Modified: branches/S3_0/common/scriptcore/luascript.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/scriptcore/luascript.c?rev=35667=35666=35667=diff
==
--- branches/S3_0/common/scriptcore/luascript.c (original)
+++ branches/S3_0/common/scriptcore/luascript.c Sat May 20 01:05:53 2017
@@ -62,13 +62,20 @@
 #define LUASCRIPT_SECURE_LUA_VERSION1 502
 #define LUASCRIPT_SECURE_LUA_VERSION2 503
 
-static const char *luascript_unsafe_symbols[] = {
+static const char *luascript_unsafe_symbols_secure[] = {
   "debug",
   "dofile",
   "loadfile",
   NULL
 };
 
+static const char *luascript_unsafe_symbols_permissive[] = {
+  "debug",
+  "dofile",
+  "loadfile",
+  NULL
+};
+
 #if LUA_VERSION_NUM != LUASCRIPT_SECURE_LUA_VERSION1 && LUA_VERSION_NUM != 
LUASCRIPT_SECURE_LUA_VERSION2
 #warning "The script runtime's unsafe symbols information is not up to date."
 #warning "This can be a big security hole!"
@@ -79,7 +86,7 @@
   and library loading modules). See linit.c in Lua 5.1 for the default list.
 */
 #if LUA_VERSION_NUM == 502
-static luaL_Reg luascript_lualibs[] = {
+static luaL_Reg luascript_lualibs_secure[] = {
   /* Using default libraries excluding: package, io and os */
   {"_G", luaopen_base},
   {LUA_COLIBNAME, luaopen_coroutine},
@@ -91,7 +98,7 @@
   {NULL, NULL}
 };
 #elif LUA_VERSION_NUM == 503
-static luaL_Reg luascript_lualibs[] = {
+static luaL_Reg luascript_lualibs_secure[] = {
   /* Using default libraries excluding: package, io, os, and bit32 */
   {"_G", luaopen_base},
   {LUA_COLIBNAME, luaopen_coroutine},
@@ -100,6 +107,19 @@
   {LUA_UTF8LIBNAME, luaopen_utf8},
   {LUA_MATHLIBNAME, luaopen_math},
   {LUA_DBLIBNAME, luaopen_debug},
+  {NULL, NULL}
+};
+
+static luaL_Reg luascript_lualibs_permissive[] = {
+  /* Using default libraries excluding: package, io, os, and bit32 */
+  {"_G", luaopen_base},
+  {LUA_COLIBNAME, luaopen_coroutine},
+  {LUA_TABLIBNAME, luaopen_table},
+  {LUA_STRLIBNAME, luaopen_string},
+  {LUA_UTF8LIBNAME, luaopen_utf8},
+  {LUA_MATHLIBNAME, luaopen_math},
+  {LUA_DBLIBNAME, luaopen_debug},
+  {LUA_OSLIBNAME, luaopen_os},
   {NULL, NULL}
 };
 #else  /* LUA_VERSION_NUM */
@@ -316,7 +336,8 @@
 /*
   Initialize the scripting state.
 */
-struct fc_lua *luascript_new(luascript_log_func_t output_fct)
+struct fc_lua *luascript_new(luascript_log_func_t output_fct,
+ bool secured_environment)
 {
   struct fc_lua *fcl = fc_calloc(1, sizeof(*fcl));
 
@@ -328,9 +349,15 @@
   fcl->output_fct = output_fct;
   fcl->caller = NULL;
 
-  luascript_openlibs(fcl->state, luascript_lualibs);
-  luascript_traceback_func_save(fcl->state);
-  luascript_blacklist(fcl->state, luascript_unsafe_symbols);
+  if (secured_environment) {
+luascript_openlibs(fcl->state, luascript_lualibs_secure);
+luascript_traceback_func_save(fcl->state);
+luascript_blacklist(fcl->state, luascript_unsafe_symbols_secure);
+  } else {
+luascript_openlibs(fcl->state, luascript_lualibs_permissive);
+luascript_traceback_func_save(fcl->state);
+luascript_blacklist(fcl->state, luascript_unsafe_symbols_permissive);
+  }
 
   /* Save the freeciv lua struct in the lua state. */
   lua_pushstring(fcl->state, LUASCRIPT_GLOBAL_VAR_NAME);

Modified: branches/S3_0/common/scriptcore/luascript.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/scriptcore/luascript.h?rev=35667=35666=35667=diff
==
--- 

[Freeciv-commits] r35665 - in /branches/S3_0/server/scripting: Makefile.am api_server_edit.c api_server_edit.h tolua_server.pkg

2017-05-19 Thread cazfi74
Author: cazfi
Date: Sat May 20 00:05:54 2017
New Revision: 35665

URL: http://svn.gna.org/viewcvs/freeciv?rev=35665=rev
Log:
Add edit.change_terrain() to scripting API

Requested by J. M. Gorbach 

See hrm Feature #657140

Modified:
branches/S3_0/server/scripting/Makefile.am
branches/S3_0/server/scripting/api_server_edit.c
branches/S3_0/server/scripting/api_server_edit.h
branches/S3_0/server/scripting/tolua_server.pkg

Modified: branches/S3_0/server/scripting/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/scripting/Makefile.am?rev=35665=35664=35665=diff
==
--- branches/S3_0/server/scripting/Makefile.am  (original)
+++ branches/S3_0/server/scripting/Makefile.am  Sat May 20 00:05:54 2017
@@ -10,6 +10,7 @@
-I$(top_srcdir)/common/networking \
-I$(top_srcdir)/common/scriptcore \
-I$(top_srcdir)/server \
+   -I$(top_srcdir)/server/generator \
-I$(top_srcdir)/ai \
-I$(top_srcdir)/dependencies/tinycthread \
$(FCDB_MYSQL_CFLAGS) $(FCDB_POSTGRES_CFLAGS) $(FCDB_SQLITE_CFLAGS) \

Modified: branches/S3_0/server/scripting/api_server_edit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/scripting/api_server_edit.c?rev=35665=35664=35665=diff
==
--- branches/S3_0/server/scripting/api_server_edit.c(original)
+++ branches/S3_0/server/scripting/api_server_edit.cSat May 20 00:05:54 2017
@@ -42,6 +42,9 @@
 
 /* server/scripting */
 #include "script_server.h"
+
+/* server/generator */
+#include "mapgen_utils.h"
 
 #include "api_server_edit.h"
 
@@ -227,6 +230,36 @@
 }
 
 /*
+  Change terrain on tile
+*/
+bool api_edit_change_terrain(lua_State *L, Tile *ptile, Terrain *pterr)
+{
+  struct terrain *old_terrain;
+
+  LUASCRIPT_CHECK_STATE(L, FALSE);
+  LUASCRIPT_CHECK_ARG_NIL(L, ptile, 2, Tile, FALSE);
+  LUASCRIPT_CHECK_ARG_NIL(L, pterr, 3, Terrain, FALSE);
+
+  old_terrain = tile_terrain(ptile);
+
+  if (old_terrain == pterr
+  || (terrain_has_flag(pterr, TER_NO_CITIES) && tile_city(ptile) != NULL)) 
{
+return FALSE;
+  }
+  
+  tile_change_terrain(ptile, pterr);
+  fix_tile_on_terrain_change(ptile, old_terrain, FALSE);
+  if (need_to_reassign_continents(old_terrain, pterr)) {
+assign_continent_numbers();
+send_all_known_tiles(NULL);
+  }
+
+  update_tile_knowledge(ptile);
+
+  return TRUE;
+}
+
+/*
   Create a new city.
 */
 void api_edit_create_city(lua_State *L, Player *pplayer, Tile *ptile,

Modified: branches/S3_0/server/scripting/api_server_edit.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/scripting/api_server_edit.h?rev=35665=35664=35665=diff
==
--- branches/S3_0/server/scripting/api_server_edit.h(original)
+++ branches/S3_0/server/scripting/api_server_edit.hSat May 20 00:05:54 2017
@@ -42,6 +42,8 @@
 void api_edit_unit_kill(lua_State *L, Unit *punit, const char *reason,
 Player *killer);
 
+bool api_edit_change_terrain(lua_State *L, Tile *ptile, Terrain *pterr);
+
 void api_edit_create_city(lua_State *L, Player *pplayer, Tile *ptile,
   const char *name);
 Player *api_edit_create_player(lua_State *L, const char *username,

Modified: branches/S3_0/server/scripting/tolua_server.pkg
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/scripting/tolua_server.pkg?rev=35665=35664=35665=diff
==
--- branches/S3_0/server/scripting/tolua_server.pkg (original)
+++ branches/S3_0/server/scripting/tolua_server.pkg Sat May 20 00:05:54 2017
@@ -120,6 +120,8 @@
   void api_edit_unit_kill
 @ unit_kill(lua_State *L, Unit *self, const char *reason,
 Player *killer);
+  bool api_edit_change_terrain
+@ change_terrain(lua_State *L, Tile *ptile, Terrain *pterr);
   void api_edit_create_city
 @ create_city (lua_State *L, Player *pplayer, Tile *ptile,
const char *name);
@@ -360,6 +362,10 @@
   edit.remove_extra(self, name)
 end
 
+function Tile:change_terrain(terrain)
+  edit.change_terrain(self, terrain)
+end
+
 function Tile:unleash_barbarians()
   return edit.unleash_barbarians(self)
 end


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


[Freeciv-commits] r35664 - in /trunk/server/scripting: Makefile.am api_server_edit.c api_server_edit.h tolua_server.pkg

2017-05-19 Thread cazfi74
Author: cazfi
Date: Sat May 20 00:05:49 2017
New Revision: 35664

URL: http://svn.gna.org/viewcvs/freeciv?rev=35664=rev
Log:
Add edit.change_terrain() to scripting API

Requested by J. M. Gorbach 

See hrm Feature #657140

Modified:
trunk/server/scripting/Makefile.am
trunk/server/scripting/api_server_edit.c
trunk/server/scripting/api_server_edit.h
trunk/server/scripting/tolua_server.pkg

Modified: trunk/server/scripting/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/scripting/Makefile.am?rev=35664=35663=35664=diff
==
--- trunk/server/scripting/Makefile.am  (original)
+++ trunk/server/scripting/Makefile.am  Sat May 20 00:05:49 2017
@@ -10,6 +10,7 @@
-I$(top_srcdir)/common/networking \
-I$(top_srcdir)/common/scriptcore \
-I$(top_srcdir)/server \
+   -I$(top_srcdir)/server/generator \
-I$(top_srcdir)/ai \
-I$(top_srcdir)/dependencies/tinycthread \
$(FCDB_MYSQL_CFLAGS) $(FCDB_POSTGRES_CFLAGS) $(FCDB_SQLITE_CFLAGS) \

Modified: trunk/server/scripting/api_server_edit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/scripting/api_server_edit.c?rev=35664=35663=35664=diff
==
--- trunk/server/scripting/api_server_edit.c(original)
+++ trunk/server/scripting/api_server_edit.cSat May 20 00:05:49 2017
@@ -43,6 +43,9 @@
 
 /* server/scripting */
 #include "script_server.h"
+
+/* server/generator */
+#include "mapgen_utils.h"
 
 #include "api_server_edit.h"
 
@@ -228,6 +231,36 @@
 }
 
 /*
+  Change terrain on tile
+*/
+bool api_edit_change_terrain(lua_State *L, Tile *ptile, Terrain *pterr)
+{
+  struct terrain *old_terrain;
+
+  LUASCRIPT_CHECK_STATE(L, FALSE);
+  LUASCRIPT_CHECK_ARG_NIL(L, ptile, 2, Tile, FALSE);
+  LUASCRIPT_CHECK_ARG_NIL(L, pterr, 3, Terrain, FALSE);
+
+  old_terrain = tile_terrain(ptile);
+
+  if (old_terrain == pterr
+  || (terrain_has_flag(pterr, TER_NO_CITIES) && tile_city(ptile) != NULL)) 
{
+return FALSE;
+  }
+  
+  tile_change_terrain(ptile, pterr);
+  fix_tile_on_terrain_change(ptile, old_terrain, FALSE);
+  if (need_to_reassign_continents(old_terrain, pterr)) {
+assign_continent_numbers();
+send_all_known_tiles(NULL);
+  }
+
+  update_tile_knowledge(ptile);
+
+  return TRUE;
+}
+
+/*
   Create a new city.
 */
 void api_edit_create_city(lua_State *L, Player *pplayer, Tile *ptile,

Modified: trunk/server/scripting/api_server_edit.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/scripting/api_server_edit.h?rev=35664=35663=35664=diff
==
--- trunk/server/scripting/api_server_edit.h(original)
+++ trunk/server/scripting/api_server_edit.hSat May 20 00:05:49 2017
@@ -42,6 +42,8 @@
 void api_edit_unit_kill(lua_State *L, Unit *punit, const char *reason,
 Player *killer);
 
+bool api_edit_change_terrain(lua_State *L, Tile *ptile, Terrain *pterr);
+
 void api_edit_create_city(lua_State *L, Player *pplayer, Tile *ptile,
   const char *name);
 Player *api_edit_create_player(lua_State *L, const char *username,

Modified: trunk/server/scripting/tolua_server.pkg
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/scripting/tolua_server.pkg?rev=35664=35663=35664=diff
==
--- trunk/server/scripting/tolua_server.pkg (original)
+++ trunk/server/scripting/tolua_server.pkg Sat May 20 00:05:49 2017
@@ -120,6 +120,8 @@
   void api_edit_unit_kill
 @ unit_kill(lua_State *L, Unit *self, const char *reason,
 Player *killer);
+  bool api_edit_change_terrain
+@ change_terrain(lua_State *L, Tile *ptile, Terrain *pterr);
   void api_edit_create_city
 @ create_city (lua_State *L, Player *pplayer, Tile *ptile,
const char *name);
@@ -360,6 +362,10 @@
   edit.remove_extra(self, name)
 end
 
+function Tile:change_terrain(terrain)
+  edit.change_terrain(self, terrain)
+end
+
 function Tile:unleash_barbarians()
   return edit.unleash_barbarians(self)
 end


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


[Freeciv-commits] r35662 - /branches/S2_6/server/scripting/api_server_edit.c

2017-05-19 Thread cazfi74
Author: cazfi
Date: Fri May 19 23:27:59 2017
New Revision: 35662

URL: http://svn.gna.org/viewcvs/freeciv?rev=35662=rev
Log:
Prevent scripting API unit creation from creating stack conflicts

See hrm Bug #661533

Modified:
branches/S2_6/server/scripting/api_server_edit.c

Modified: branches/S2_6/server/scripting/api_server_edit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/scripting/api_server_edit.c?rev=35662=35661=35662=diff
==
--- branches/S2_6/server/scripting/api_server_edit.c(original)
+++ branches/S2_6/server/scripting/api_server_edit.cFri May 19 23:27:59 2017
@@ -93,6 +93,7 @@
 Unit *ptransport)
 {
   struct fc_lua *fcl;
+  struct city *pcity;
 
   LUASCRIPT_CHECK_STATE(L, NULL);
   LUASCRIPT_CHECK_ARG_NIL(L, pplayer, 2, Player, NULL);
@@ -129,6 +130,19 @@
 return NULL;
   }
 
+  if (is_non_allied_unit_tile(ptile, pplayer)) {
+luascript_log(fcl, LOG_ERROR, "create_unit_full: tile is occupied by "
+  "enemy unit");
+return NULL;
+  }
+
+  pcity = tile_city(ptile);
+  if (pcity != NULL && !pplayers_allied(pplayer, city_owner(pcity))) {
+luascript_log(fcl, LOG_ERROR, "create_unit_full: tile is occupied by "
+  "enemy city");
+return NULL;
+  }
+
   return create_unit_full(pplayer, ptile, ptype, veteran_level,
   homecity ? homecity->id : 0, moves_left,
   hp_left, ptransport);


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


[Freeciv-commits] r35661 - /branches/S3_0/server/scripting/api_server_edit.c

2017-05-19 Thread cazfi74
Author: cazfi
Date: Fri May 19 23:27:52 2017
New Revision: 35661

URL: http://svn.gna.org/viewcvs/freeciv?rev=35661=rev
Log:
Prevent scripting API unit creation from creating stack conflicts

See hrm Bug #661533

Modified:
branches/S3_0/server/scripting/api_server_edit.c

Modified: branches/S3_0/server/scripting/api_server_edit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/scripting/api_server_edit.c?rev=35661=35660=35661=diff
==
--- branches/S3_0/server/scripting/api_server_edit.c(original)
+++ branches/S3_0/server/scripting/api_server_edit.cFri May 19 23:27:52 2017
@@ -93,6 +93,7 @@
 Unit *ptransport)
 {
   struct fc_lua *fcl;
+  struct city *pcity;
 
   LUASCRIPT_CHECK_STATE(L, NULL);
   LUASCRIPT_CHECK_ARG_NIL(L, pplayer, 2, Player, NULL);
@@ -129,6 +130,19 @@
 return NULL;
   }
 
+  if (is_non_allied_unit_tile(ptile, pplayer)) {
+luascript_log(fcl, LOG_ERROR, "create_unit_full: tile is occupied by "
+  "enemy unit");
+return NULL;
+  }
+
+  pcity = tile_city(ptile);
+  if (pcity != NULL && !pplayers_allied(pplayer, city_owner(pcity))) {
+luascript_log(fcl, LOG_ERROR, "create_unit_full: tile is occupied by "
+  "enemy city");
+return NULL;
+  }
+
   return create_unit_full(pplayer, ptile, ptype, veteran_level,
   homecity ? homecity->id : 0, moves_left,
   hp_left, ptransport);


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


[Freeciv-commits] r35663 - /branches/S2_5/server/scripting/api_server_edit.c

2017-05-19 Thread cazfi74
Author: cazfi
Date: Fri May 19 23:28:06 2017
New Revision: 35663

URL: http://svn.gna.org/viewcvs/freeciv?rev=35663=rev
Log:
Prevent scripting API unit creation from creating stack conflicts

See hrm Bug #661533

Modified:
branches/S2_5/server/scripting/api_server_edit.c

Modified: branches/S2_5/server/scripting/api_server_edit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/scripting/api_server_edit.c?rev=35663=35662=35663=diff
==
--- branches/S2_5/server/scripting/api_server_edit.c(original)
+++ branches/S2_5/server/scripting/api_server_edit.cFri May 19 23:28:06 2017
@@ -92,6 +92,7 @@
 Unit *ptransport)
 {
   struct fc_lua *fcl;
+  struct city *pcity;
 
   LUASCRIPT_CHECK_STATE(L, NULL);
   LUASCRIPT_CHECK_ARG_NIL(L, pplayer, 2, Player, NULL);
@@ -128,6 +129,19 @@
 return NULL;
   }
 
+  if (is_non_allied_unit_tile(ptile, pplayer)) {
+luascript_log(fcl, LOG_ERROR, "create_unit_full: tile is occupied by "
+  "enemy unit");
+return NULL;
+  }
+
+  pcity = tile_city(ptile);
+  if (pcity != NULL && !pplayers_allied(pplayer, city_owner(pcity))) {
+luascript_log(fcl, LOG_ERROR, "create_unit_full: tile is occupied by "
+  "enemy city");
+return NULL;
+  }
+
   return create_unit_full(pplayer, ptile, ptype, veteran_level,
   homecity ? homecity->id : 0, moves_left,
   hp_left, ptransport);


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


[Freeciv-commits] r35660 - /trunk/server/scripting/api_server_edit.c

2017-05-19 Thread cazfi74
Author: cazfi
Date: Fri May 19 23:27:46 2017
New Revision: 35660

URL: http://svn.gna.org/viewcvs/freeciv?rev=35660=rev
Log:
Prevent scripting API unit creation from creating stack conflicts

See hrm Bug #661533

Modified:
trunk/server/scripting/api_server_edit.c

Modified: trunk/server/scripting/api_server_edit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/scripting/api_server_edit.c?rev=35660=35659=35660=diff
==
--- trunk/server/scripting/api_server_edit.c(original)
+++ trunk/server/scripting/api_server_edit.cFri May 19 23:27:46 2017
@@ -94,6 +94,7 @@
 Unit *ptransport)
 {
   struct fc_lua *fcl;
+  struct city *pcity;
 
   LUASCRIPT_CHECK_STATE(L, NULL);
   LUASCRIPT_CHECK_ARG_NIL(L, pplayer, 2, Player, NULL);
@@ -130,6 +131,19 @@
 return NULL;
   }
 
+  if (is_non_allied_unit_tile(ptile, pplayer)) {
+luascript_log(fcl, LOG_ERROR, "create_unit_full: tile is occupied by "
+  "enemy unit");
+return NULL;
+  }
+
+  pcity = tile_city(ptile);
+  if (pcity != NULL && !pplayers_allied(pplayer, city_owner(pcity))) {
+luascript_log(fcl, LOG_ERROR, "create_unit_full: tile is occupied by "
+  "enemy city");
+return NULL;
+  }
+
   return create_unit_full(pplayer, ptile, ptype, veteran_level,
   homecity ? homecity->id : 0, moves_left,
   hp_left, ptransport);


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


[Freeciv-commits] r35653 - /branches/S2_6/ai/default/aicity.c

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 17:24:57 2017
New Revision: 35653

URL: http://svn.gna.org/viewcvs/freeciv?rev=35653=rev
Log:
Multiply AI want for Great Wonders by 1.5

See hrm Feature #661176

Modified:
branches/S2_6/ai/default/aicity.c

Modified: branches/S2_6/ai/default/aicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/ai/default/aicity.c?rev=35653=35652=35653=diff
==
--- branches/S2_6/ai/default/aicity.c   (original)
+++ branches/S2_6/ai/default/aicity.c   Thu May 18 17:24:57 2017
@@ -1753,19 +1753,26 @@
* We DO want to calculate (tech) wants because of buildings
* we already have. */
   const bool already = city_has_building(pcity, pimprove);
+  int idx = improvement_index(pimprove);
 
   adjust_improvement_wants_by_effects(ait, pplayer, pcity,
   pimprove, already);
 
   fc_assert(!(already
-  && 0 < 
pcity->server.adv->building_want[improvement_index(pimprove)]));
+  && 0 < pcity->server.adv->building_want[idx]));
+
+  if (is_great_wonder(pimprove)) {
+/* Not only would we get the wonder, but we would also prevent
+ * opponents from getting it. */
+pcity->server.adv->building_want[idx] *= 1.5;
+  }
 
   /* If I am not an expansionist, I want buildings more than units */
-  if (pcity->server.adv->building_want[improvement_index(pimprove)] > 
0) {
-pcity->server.adv->building_want[improvement_index(pimprove)]
-  = pcity->server.adv->building_want[improvement_index(pimprove)]
-  * TRAIT_DEFAULT_VALUE
-  / ai_trait_get_value(TRAIT_EXPANSIONIST, pplayer);
+  if (pcity->server.adv->building_want[idx] > 0) {
+pcity->server.adv->building_want[idx]
+  = pcity->server.adv->building_want[idx]
+  * TRAIT_DEFAULT_VALUE
+  / ai_trait_get_value(TRAIT_EXPANSIONIST, pplayer);
   }
 }
 /* else wait until a later turn */


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


[Freeciv-commits] r35651 - /trunk/ai/default/aicity.c

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 17:24:44 2017
New Revision: 35651

URL: http://svn.gna.org/viewcvs/freeciv?rev=35651=rev
Log:
Multiply AI want for Great Wonders by 1.5

See hrm Feature #661176

Modified:
trunk/ai/default/aicity.c

Modified: trunk/ai/default/aicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aicity.c?rev=35651=35650=35651=diff
==
--- trunk/ai/default/aicity.c   (original)
+++ trunk/ai/default/aicity.c   Thu May 18 17:24:44 2017
@@ -1867,19 +1867,26 @@
* We DO want to calculate (tech) wants because of buildings
* we already have. */
   const bool already = city_has_building(pcity, pimprove);
+  int idx = improvement_index(pimprove);
 
   adjust_improvement_wants_by_effects(ait, pplayer, pcity,
   pimprove, already);
 
   fc_assert(!(already
-  && 0 < 
pcity->server.adv->building_want[improvement_index(pimprove)]));
+  && 0 < pcity->server.adv->building_want[idx]));
+
+  if (is_great_wonder(pimprove)) {
+/* Not only would we get the wonder, but we would also prevent
+ * opponents from getting it. */
+pcity->server.adv->building_want[idx] *= 1.5;
+  }
 
   /* If I am not an expansionist, I want buildings more than units */
-  if (pcity->server.adv->building_want[improvement_index(pimprove)] > 
0) {
-pcity->server.adv->building_want[improvement_index(pimprove)]
-  = pcity->server.adv->building_want[improvement_index(pimprove)]
-  * TRAIT_DEFAULT_VALUE
-  / ai_trait_get_value(TRAIT_EXPANSIONIST, pplayer);
+  if (pcity->server.adv->building_want[idx] > 0) {
+pcity->server.adv->building_want[idx]
+  = pcity->server.adv->building_want[idx]
+  * TRAIT_DEFAULT_VALUE
+  / ai_trait_get_value(TRAIT_EXPANSIONIST, pplayer);
   }
 }
 /* else wait until a later turn */


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


[Freeciv-commits] r35652 - /branches/S3_0/ai/default/aicity.c

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 17:24:51 2017
New Revision: 35652

URL: http://svn.gna.org/viewcvs/freeciv?rev=35652=rev
Log:
Multiply AI want for Great Wonders by 1.5

See hrm Feature #661176

Modified:
branches/S3_0/ai/default/aicity.c

Modified: branches/S3_0/ai/default/aicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/default/aicity.c?rev=35652=35651=35652=diff
==
--- branches/S3_0/ai/default/aicity.c   (original)
+++ branches/S3_0/ai/default/aicity.c   Thu May 18 17:24:51 2017
@@ -1867,19 +1867,26 @@
* We DO want to calculate (tech) wants because of buildings
* we already have. */
   const bool already = city_has_building(pcity, pimprove);
+  int idx = improvement_index(pimprove);
 
   adjust_improvement_wants_by_effects(ait, pplayer, pcity,
   pimprove, already);
 
   fc_assert(!(already
-  && 0 < 
pcity->server.adv->building_want[improvement_index(pimprove)]));
+  && 0 < pcity->server.adv->building_want[idx]));
+
+  if (is_great_wonder(pimprove)) {
+/* Not only would we get the wonder, but we would also prevent
+ * opponents from getting it. */
+pcity->server.adv->building_want[idx] *= 1.5;
+  }
 
   /* If I am not an expansionist, I want buildings more than units */
-  if (pcity->server.adv->building_want[improvement_index(pimprove)] > 
0) {
-pcity->server.adv->building_want[improvement_index(pimprove)]
-  = pcity->server.adv->building_want[improvement_index(pimprove)]
-  * TRAIT_DEFAULT_VALUE
-  / ai_trait_get_value(TRAIT_EXPANSIONIST, pplayer);
+  if (pcity->server.adv->building_want[idx] > 0) {
+pcity->server.adv->building_want[idx]
+  = pcity->server.adv->building_want[idx]
+  * TRAIT_DEFAULT_VALUE
+  / ai_trait_get_value(TRAIT_EXPANSIONIST, pplayer);
   }
 }
 /* else wait until a later turn */


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


[Freeciv-commits] r35650 - /branches/S2_6/ai/default/daidomestic.c

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 15:24:00 2017
New Revision: 35650

URL: http://svn.gna.org/viewcvs/freeciv?rev=35650=rev
Log:
Fix NULL dereference when there's no suitable founder unit type

See hrm Bug #661409

Modified:
branches/S2_6/ai/default/daidomestic.c

Modified: branches/S2_6/ai/default/daidomestic.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/ai/default/daidomestic.c?rev=35650=35649=35650=diff
==
--- branches/S2_6/ai/default/daidomestic.c  (original)
+++ branches/S2_6/ai/default/daidomestic.c  Thu May 18 15:24:00 2017
@@ -460,7 +460,7 @@
   settler_want = city_data->settler_want * pplayer->ai_common.expand / 100;
 
   if (adv->wonder_city == pcity->id) {
-if (!settler_type || settler_type->pop_cost > 0) {
+if (settler_type == NULL || settler_type->pop_cost > 0) {
   settler_want /= 5;
 } else {
   settler_want /= 2;
@@ -492,13 +492,13 @@
 founder_want = city_data->founder_want;
 
 if (adv->wonder_city == pcity->id) {
-  if (founder_type->pop_cost > 0) {
+  if (founder_type == NULL || founder_type->pop_cost > 0) {
 founder_want /= 5;
   } else {
 founder_want /= 2;
   }
 }
-
+
 if (adv->max_num_cities <= city_list_size(pplayer->cities)) {
   founder_want /= 100;
 }


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


[Freeciv-commits] r35648 - /trunk/ai/default/daidomestic.c

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 15:23:46 2017
New Revision: 35648

URL: http://svn.gna.org/viewcvs/freeciv?rev=35648=rev
Log:
Fix NULL dereference when there's no suitable founder unit type

See hrm Bug #661409

Modified:
trunk/ai/default/daidomestic.c

Modified: trunk/ai/default/daidomestic.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/daidomestic.c?rev=35648=35647=35648=diff
==
--- trunk/ai/default/daidomestic.c  (original)
+++ trunk/ai/default/daidomestic.c  Thu May 18 15:23:46 2017
@@ -475,7 +475,7 @@
   worker_want = city_data->worker_want * pplayer->ai_common.expand / 100;
 
   if (adv->wonder_city == pcity->id) {
-if (!worker_type || worker_type->pop_cost > 0) {
+if (worker_type == NULL || worker_type->pop_cost > 0) {
   worker_want /= 5;
 } else {
   worker_want /= 2;
@@ -509,13 +509,13 @@
 founder_want = city_data->founder_want;
 
 if (adv->wonder_city == pcity->id) {
-  if (founder_type->pop_cost > 0) {
+  if (founder_type == NULL || founder_type->pop_cost > 0) {
 founder_want /= 5;
   } else {
 founder_want /= 2;
   }
 }
-
+
 if (adv->max_num_cities <= city_list_size(pplayer->cities)) {
   founder_want /= 100;
 }


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


[Freeciv-commits] r35649 - /branches/S3_0/ai/default/daidomestic.c

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 15:23:53 2017
New Revision: 35649

URL: http://svn.gna.org/viewcvs/freeciv?rev=35649=rev
Log:
Fix NULL dereference when there's no suitable founder unit type

See hrm Bug #661409

Modified:
branches/S3_0/ai/default/daidomestic.c

Modified: branches/S3_0/ai/default/daidomestic.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/default/daidomestic.c?rev=35649=35648=35649=diff
==
--- branches/S3_0/ai/default/daidomestic.c  (original)
+++ branches/S3_0/ai/default/daidomestic.c  Thu May 18 15:23:53 2017
@@ -475,7 +475,7 @@
   worker_want = city_data->worker_want * pplayer->ai_common.expand / 100;
 
   if (adv->wonder_city == pcity->id) {
-if (!worker_type || worker_type->pop_cost > 0) {
+if (worker_type == NULL || worker_type->pop_cost > 0) {
   worker_want /= 5;
 } else {
   worker_want /= 2;
@@ -509,13 +509,13 @@
 founder_want = city_data->founder_want;
 
 if (adv->wonder_city == pcity->id) {
-  if (founder_type->pop_cost > 0) {
+  if (founder_type == NULL || founder_type->pop_cost > 0) {
 founder_want /= 5;
   } else {
 founder_want /= 2;
   }
 }
-
+
 if (adv->max_num_cities <= city_list_size(pplayer->cities)) {
   founder_want /= 100;
 }


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


[Freeciv-commits] r35647 - /trunk/tools/mpdb.c

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 15:17:19 2017
New Revision: 35647

URL: http://svn.gna.org/viewcvs/freeciv?rev=35647=rev
Log:
Create directory for modpack database if it doesn't exist

See hrm Bug #661353

Modified:
trunk/tools/mpdb.c

Modified: trunk/tools/mpdb.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/mpdb.c?rev=35647=35646=35647=diff
==
--- trunk/tools/mpdb.c  (original)
+++ trunk/tools/mpdb.c  Thu May 18 15:17:19 2017
@@ -135,6 +135,19 @@
 {
   sqlite3 **handle;
   int ret;
+  int llen = strlen(filename) + 1;
+  char *local_name = fc_malloc(llen);
+  int i;
+
+  strncpy(local_name, filename, llen);
+  for (i = llen - 1 ; local_name[i] != DIR_SEPARATOR_CHAR ; i--) {
+/* Nothing */
+  }
+  local_name[i] = '\0';
+  if (!make_dir(local_name)) {
+log_error(_("Can't create directory \"%s\" for modpack database."), 
local_name);
+return;
+  }
 
   if (scenario_db) {
 handle = _handle;


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


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

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 15:13:00 2017
New Revision: 35643

URL: http://svn.gna.org/viewcvs/freeciv?rev=35643=rev
Log:
Make sure unit vision radius is not negative

Reported by David Fernandez (bard)

See hrm Bug #661313

Modified:
trunk/server/unittools.c

Modified: trunk/server/unittools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unittools.c?rev=35643=35642=35643=diff
==
--- trunk/server/unittools.c(original)
+++ trunk/server/unittools.cThu May 18 15:13:00 2017
@@ -4453,17 +4453,17 @@
   properly.
 /
 int get_unit_vision_at(struct unit *punit, struct tile *ptile,
-  enum vision_layer vlayer)
+   enum vision_layer vlayer)
 {
   const int base = (unit_type_get(punit)->vision_radius_sq
-   + get_unittype_bonus(unit_owner(punit), ptile,
++ get_unittype_bonus(unit_owner(punit), ptile,
  unit_type_get(punit),
-EFT_UNIT_VISION_RADIUS_SQ));
+ EFT_UNIT_VISION_RADIUS_SQ));
   switch (vlayer) {
   case V_MAIN:
-return base;
+return MAX(0, base);
   case V_INVIS:
-return MIN(base, 2);
+return CLIP(0, base, 2);
   case V_COUNT:
 break;
   }


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


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

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 15:13:14 2017
New Revision: 35645

URL: http://svn.gna.org/viewcvs/freeciv?rev=35645=rev
Log:
Make sure unit vision radius is not negative

Reported by David Fernandez (bard)

See hrm Bug #661313

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=35645=35644=35645=diff
==
--- branches/S2_6/server/unittools.c(original)
+++ branches/S2_6/server/unittools.cThu May 18 15:13:14 2017
@@ -4308,17 +4308,17 @@
   properly.
 /
 int get_unit_vision_at(struct unit *punit, struct tile *ptile,
-  enum vision_layer vlayer)
+   enum vision_layer vlayer)
 {
   const int base = (unit_type_get(punit)->vision_radius_sq
-   + get_unittype_bonus(unit_owner(punit), ptile,
++ get_unittype_bonus(unit_owner(punit), ptile,
  unit_type_get(punit),
-EFT_UNIT_VISION_RADIUS_SQ));
+ EFT_UNIT_VISION_RADIUS_SQ));
   switch (vlayer) {
   case V_MAIN:
-return base;
+return MAX(0, base);
   case V_INVIS:
-return MIN(base, 2);
+return CLIP(0, base, 2);
   case V_COUNT:
 break;
   }


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


[Freeciv-commits] r35646 - /branches/S2_5/server/unittools.c

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 15:13:21 2017
New Revision: 35646

URL: http://svn.gna.org/viewcvs/freeciv?rev=35646=rev
Log:
Make sure unit vision radius is not negative

Reported by David Fernandez (bard)

See hrm Bug #661313

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=35646=35645=35646=diff
==
--- branches/S2_5/server/unittools.c(original)
+++ branches/S2_5/server/unittools.cThu May 18 15:13:21 2017
@@ -4164,16 +4164,16 @@
   properly.
 /
 int get_unit_vision_at(struct unit *punit, struct tile *ptile,
-  enum vision_layer vlayer)
+   enum vision_layer vlayer)
 {
   const int base = (unit_type(punit)->vision_radius_sq
-   + get_unittype_bonus(unit_owner(punit), ptile, 
unit_type(punit),
-EFT_UNIT_VISION_RADIUS_SQ));
++ get_unittype_bonus(unit_owner(punit), ptile, 
unit_type(punit),
+ EFT_UNIT_VISION_RADIUS_SQ));
   switch (vlayer) {
   case V_MAIN:
-return base;
+return MAX(0, base);
   case V_INVIS:
-return MIN(base, 2);
+return CLIP(0, base, 2);
   case V_COUNT:
 break;
   }


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


[Freeciv-commits] r35636 - /branches/S2_5/server/citytools.c

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 11:16:25 2017
New Revision: 35636

URL: http://svn.gna.org/viewcvs/freeciv?rev=35636=rev
Log:
Make sure veterancy of the newly built unit is not negative

Reported by David Fernandez (bard)

See hrm Bug #661193

Modified:
branches/S2_5/server/citytools.c

Modified: branches/S2_5/server/citytools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/citytools.c?rev=35636=35635=35636=diff
==
--- branches/S2_5/server/citytools.c(original)
+++ branches/S2_5/server/citytools.cThu May 18 11:16:25 2017
@@ -563,9 +563,13 @@
 int do_make_unit_veteran(struct city *pcity,
  const struct unit_type *punittype)
 {
-  return MIN(get_unittype_bonus(city_owner(pcity), pcity->tile, punittype,
-EFT_VETERAN_BUILD),
- utype_veteran_levels(punittype) - 1);
+  int levels = get_unittype_bonus(city_owner(pcity), pcity->tile, punittype,
+  EFT_VETERAN_BUILD);
+  int max_levels = utype_veteran_levels(punittype) - 1;
+
+  levels = CLIP(0, levels, max_levels);
+
+  return levels;
 }
 
 /*


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


[Freeciv-commits] r35635 - /branches/S2_6/server/citytools.c

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 11:16:18 2017
New Revision: 35635

URL: http://svn.gna.org/viewcvs/freeciv?rev=35635=rev
Log:
Make sure veterancy of the newly built unit is not negative

Reported by David Fernandez (bard)

See hrm Bug #661193

Modified:
branches/S2_6/server/citytools.c

Modified: branches/S2_6/server/citytools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/citytools.c?rev=35635=35634=35635=diff
==
--- branches/S2_6/server/citytools.c(original)
+++ branches/S2_6/server/citytools.cThu May 18 11:16:18 2017
@@ -571,9 +571,13 @@
 int do_make_unit_veteran(struct city *pcity,
  const struct unit_type *punittype)
 {
-  return MIN(get_unittype_bonus(city_owner(pcity), pcity->tile, punittype,
-EFT_VETERAN_BUILD),
- utype_veteran_levels(punittype) - 1);
+  int levels = get_unittype_bonus(city_owner(pcity), pcity->tile, punittype,
+  EFT_VETERAN_BUILD);
+  int max_levels = utype_veteran_levels(punittype) - 1;
+
+  levels = CLIP(0, levels, max_levels);
+
+  return levels;
 }
 
 /*


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


[Freeciv-commits] r35634 - /branches/S3_0/server/citytools.c

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 11:16:11 2017
New Revision: 35634

URL: http://svn.gna.org/viewcvs/freeciv?rev=35634=rev
Log:
Make sure veterancy of the newly built unit is not negative

Reported by David Fernandez (bard)

See hrm Bug #661193

Modified:
branches/S3_0/server/citytools.c

Modified: branches/S3_0/server/citytools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/citytools.c?rev=35634=35633=35634=diff
==
--- branches/S3_0/server/citytools.c(original)
+++ branches/S3_0/server/citytools.cThu May 18 11:16:11 2017
@@ -571,9 +571,13 @@
 int do_make_unit_veteran(struct city *pcity,
  const struct unit_type *punittype)
 {
-  return MIN(get_unittype_bonus(city_owner(pcity), pcity->tile, punittype,
-EFT_VETERAN_BUILD),
- utype_veteran_levels(punittype) - 1);
+  int levels = get_unittype_bonus(city_owner(pcity), pcity->tile, punittype,
+  EFT_VETERAN_BUILD);
+  int max_levels = utype_veteran_levels(punittype) - 1;
+
+  levels = CLIP(0, levels, max_levels);
+
+  return levels;
 }
 
 /*


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


[Freeciv-commits] r35633 - /trunk/server/citytools.c

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 11:16:05 2017
New Revision: 35633

URL: http://svn.gna.org/viewcvs/freeciv?rev=35633=rev
Log:
Make sure veterancy of the newly built unit is not negative

Reported by David Fernandez (bard)

See hrm Bug #661193

Modified:
trunk/server/citytools.c

Modified: trunk/server/citytools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/citytools.c?rev=35633=35632=35633=diff
==
--- trunk/server/citytools.c(original)
+++ trunk/server/citytools.cThu May 18 11:16:05 2017
@@ -571,9 +571,13 @@
 int do_make_unit_veteran(struct city *pcity,
  const struct unit_type *punittype)
 {
-  return MIN(get_unittype_bonus(city_owner(pcity), pcity->tile, punittype,
-EFT_VETERAN_BUILD),
- utype_veteran_levels(punittype) - 1);
+  int levels = get_unittype_bonus(city_owner(pcity), pcity->tile, punittype,
+  EFT_VETERAN_BUILD);
+  int max_levels = utype_veteran_levels(punittype) - 1;
+
+  levels = CLIP(0, levels, max_levels);
+
+  return levels;
 }
 
 /*


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


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

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 11:03:06 2017
New Revision: 35632

URL: http://svn.gna.org/viewcvs/freeciv?rev=35632=rev
Log:
Fix division by zero when unit activity rate is zero

Reported by David Fernandez (bard)

See hrm Bug #660342

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=35632=35631=35632=diff
==
--- branches/S2_5/common/unit.c (original)
+++ branches/S2_5/common/unit.c Thu May 18 11:03:06 2017
@@ -606,15 +606,15 @@
   already done by this unit.
 **/
 int get_turns_for_activity_at(const struct unit *punit,
- enum unit_activity activity,
- const struct tile *ptile)
+  enum unit_activity activity,
+  const struct tile *ptile)
 {
   /* FIXME: This is just an approximation since we don't account for
* get_activity_rate_this_turn. */
   int speed = get_activity_rate(punit);
   int time = tile_activity_time(activity, ptile);
 
-  if (time >= 0 && speed >= 0) {
+  if (time >= 0 && speed > 0) {
 return (time - 1) / speed + 1; /* round up */
   } else {
 return FC_INFINITY;


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


[Freeciv-commits] r35630 - /branches/S3_0/common/unit.c

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 11:02:52 2017
New Revision: 35630

URL: http://svn.gna.org/viewcvs/freeciv?rev=35630=rev
Log:
Fix division by zero when unit activity rate is zero

Reported by David Fernandez (bard)

See hrm Bug #660342

Modified:
branches/S3_0/common/unit.c

Modified: branches/S3_0/common/unit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/unit.c?rev=35630=35629=35630=diff
==
--- branches/S3_0/common/unit.c (original)
+++ branches/S3_0/common/unit.c Thu May 18 11:02:52 2017
@@ -414,8 +414,8 @@
   already done by this unit.
 **/
 int get_turns_for_activity_at(const struct unit *punit,
- enum unit_activity activity,
- const struct tile *ptile,
+  enum unit_activity activity,
+  const struct tile *ptile,
   struct extra_type *tgt)
 {
   /* FIXME: This is just an approximation since we don't account for
@@ -423,7 +423,7 @@
   int speed = get_activity_rate(punit);
   int points_needed = tile_activity_time(activity, ptile, tgt);
 
-  if (points_needed >= 0 && speed >= 0) {
+  if (points_needed >= 0 && speed > 0) {
 return (points_needed - 1) / speed + 1; /* round up */
   } else {
 return FC_INFINITY;


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


[Freeciv-commits] r35631 - /branches/S2_6/common/unit.c

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 11:02:58 2017
New Revision: 35631

URL: http://svn.gna.org/viewcvs/freeciv?rev=35631=rev
Log:
Fix division by zero when unit activity rate is zero

Reported by David Fernandez (bard)

See hrm Bug #660342

Modified:
branches/S2_6/common/unit.c

Modified: branches/S2_6/common/unit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/common/unit.c?rev=35631=35630=35631=diff
==
--- branches/S2_6/common/unit.c (original)
+++ branches/S2_6/common/unit.c Thu May 18 11:02:58 2017
@@ -504,8 +504,8 @@
   already done by this unit.
 **/
 int get_turns_for_activity_at(const struct unit *punit,
- enum unit_activity activity,
- const struct tile *ptile,
+  enum unit_activity activity,
+  const struct tile *ptile,
   struct extra_type *tgt)
 {
   /* FIXME: This is just an approximation since we don't account for
@@ -513,7 +513,7 @@
   int speed = get_activity_rate(punit);
   int points_needed = tile_activity_time(activity, ptile, tgt);
 
-  if (points_needed >= 0 && speed >= 0) {
+  if (points_needed >= 0 && speed > 0) {
 return (points_needed - 1) / speed + 1; /* round up */
   } else {
 return FC_INFINITY;


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


[Freeciv-commits] r35629 - /trunk/common/unit.c

2017-05-18 Thread cazfi74
Author: cazfi
Date: Thu May 18 11:02:44 2017
New Revision: 35629

URL: http://svn.gna.org/viewcvs/freeciv?rev=35629=rev
Log:
Fix division by zero when unit activity rate is zero

Reported by David Fernandez (bard)

See hrm Bug #660342

Modified:
trunk/common/unit.c

Modified: trunk/common/unit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/unit.c?rev=35629=35628=35629=diff
==
--- trunk/common/unit.c (original)
+++ trunk/common/unit.c Thu May 18 11:02:44 2017
@@ -415,8 +415,8 @@
   already done by this unit.
 **/
 int get_turns_for_activity_at(const struct unit *punit,
- enum unit_activity activity,
- const struct tile *ptile,
+  enum unit_activity activity,
+  const struct tile *ptile,
   struct extra_type *tgt)
 {
   /* FIXME: This is just an approximation since we don't account for
@@ -424,7 +424,7 @@
   int speed = get_activity_rate(punit);
   int points_needed = tile_activity_time(activity, ptile, tgt);
 
-  if (points_needed >= 0 && speed >= 0) {
+  if (points_needed >= 0 && speed > 0) {
 return (points_needed - 1) / speed + 1; /* round up */
   } else {
 return FC_INFINITY;


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


[Freeciv-commits] r35628 - /branches/S3_0/m4/web-client.m4

2017-05-17 Thread cazfi74
Author: cazfi
Date: Thu May 18 01:54:16 2017
New Revision: 35628

URL: http://svn.gna.org/viewcvs/freeciv?rev=35628=rev
Log:
Make --enable-fcweb help clearer

Reported by Christian Knoke

See hrm Bug #660894

Modified:
branches/S3_0/m4/web-client.m4

Modified: branches/S3_0/m4/web-client.m4
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/m4/web-client.m4?rev=35628=35627=35628=diff
==
--- branches/S3_0/m4/web-client.m4  (original)
+++ branches/S3_0/m4/web-client.m4  Thu May 18 01:54:16 2017
@@ -5,7 +5,7 @@
   AM_CONDITIONAL([FREECIV_WEB], [test "x$fcweb" = "xtrue"])
 
   if test "x$fcweb" = "xtrue" ; then
-AC_DEFINE([FREECIV_WEB], [1], [Build freeciv-web version])
+AC_DEFINE([FREECIV_WEB], [1], [Build freeciv-web version instead of 
regular freeciv])
   fi
 ])
 


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


[Freeciv-commits] r35627 - /trunk/m4/web-client.m4

2017-05-17 Thread cazfi74
Author: cazfi
Date: Thu May 18 01:54:08 2017
New Revision: 35627

URL: http://svn.gna.org/viewcvs/freeciv?rev=35627=rev
Log:
Make --enable-fcweb help clearer

Reported by Christian Knoke

See hrm Bug #660894

Modified:
trunk/m4/web-client.m4

Modified: trunk/m4/web-client.m4
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/m4/web-client.m4?rev=35627=35626=35627=diff
==
--- trunk/m4/web-client.m4  (original)
+++ trunk/m4/web-client.m4  Thu May 18 01:54:08 2017
@@ -5,7 +5,7 @@
   AM_CONDITIONAL([FREECIV_WEB], [test "x$fcweb" = "xtrue"])
 
   if test "x$fcweb" = "xtrue" ; then
-AC_DEFINE([FREECIV_WEB], [1], [Build freeciv-web version])
+AC_DEFINE([FREECIV_WEB], [1], [Build freeciv-web version instead of 
regular freeciv])
   fi
 ])
 


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


[Freeciv-commits] r35618 - in /branches/S3_0: ai/classic/ ai/tex/ ai/threaded/ common/ doc/ server/

2017-05-16 Thread cazfi74
Author: cazfi
Date: Wed May 17 05:29:16 2017
New Revision: 35618

URL: http://svn.gna.org/viewcvs/freeciv?rev=35618=rev
Log:
Free ai_type private data

See hrm Bug #660840

Modified:
branches/S3_0/ai/classic/classicai.c
branches/S3_0/ai/tex/texai.c
branches/S3_0/ai/threaded/threadedai.c
branches/S3_0/common/ai.h
branches/S3_0/doc/README.AI_modules
branches/S3_0/server/srv_main.c

Modified: branches/S3_0/ai/classic/classicai.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/classic/classicai.c?rev=35618=35617=35618=diff
==
--- branches/S3_0/ai/classic/classicai.c(original)
+++ branches/S3_0/ai/classic/classicai.cWed May 17 05:29:16 2017
@@ -70,6 +70,16 @@
 }
 
 /**
+  Free resources allocated by the classic AI module
+**/
+static void cai_module_close(void)
+{
+  struct ai_type *deftype = classic_ai_get_self();
+
+  FC_FREE(deftype->private);
+}
+
+/**
   Call default ai with classic ai type as parameter.
 **/
 static void cai_player_alloc(struct player *pplayer)
@@ -578,6 +588,8 @@
   private = fc_malloc(sizeof(struct dai_private_data));
   private->contemplace_workers = TRUE;
   ai->private = private;
+
+  ai->funcs.module_close = cai_module_close;
 
   /* ai->funcs.game_start = NULL; */
   /* ai->funcs.game_free = NULL; */

Modified: branches/S3_0/ai/tex/texai.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/tex/texai.c?rev=35618=35617=35618=diff
==
--- branches/S3_0/ai/tex/texai.c(original)
+++ branches/S3_0/ai/tex/texai.cWed May 17 05:29:16 2017
@@ -67,6 +67,16 @@
 #define TEXAI_DFUNC(_func, ...) _func(ait, ## __VA_ARGS__ );
 
 /**
+  Free resources allocated by the tex AI module
+**/
+static void texai_module_close(void)
+{
+  TEXAI_AIT;
+
+  FC_FREE(ait->private);
+}
+
+/**
   Call default ai with tex ai type as parameter.
 **/
 static void texwai_player_alloc(struct player *pplayer)
@@ -566,6 +576,7 @@
 
   texai_init_self(ai);
 
+  ai->funcs.module_close = texai_module_close;
   ai->funcs.player_alloc = texwai_player_alloc;
   ai->funcs.player_free = texwai_player_free;
   ai->funcs.player_save = texwai_player_save;

Modified: branches/S3_0/ai/threaded/threadedai.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/threaded/threadedai.c?rev=35618=35617=35618=diff
==
--- branches/S3_0/ai/threaded/threadedai.c  (original)
+++ branches/S3_0/ai/threaded/threadedai.c  Wed May 17 05:29:16 2017
@@ -66,6 +66,16 @@
 #define TAI_DFUNC(_func, ...) _func(ait, ## __VA_ARGS__ );
 
 /**
+  Free resources allocated by the threaded AI module
+**/
+static void tai_module_close(void)
+{
+  TAI_AIT;
+
+  FC_FREE(ait->private);
+}
+
+/**
   Call default ai with threaded ai type as parameter.
 **/
 static void twai_player_alloc(struct player *pplayer)
@@ -552,6 +562,7 @@
 
   tai_init_self(ai);
 
+  ai->funcs.module_close = tai_module_close;
   ai->funcs.player_alloc = twai_player_alloc;
   ai->funcs.player_free = twai_player_free;
   ai->funcs.player_save = twai_player_save;

Modified: branches/S3_0/common/ai.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/ai.h?rev=35618=35617=35618=diff
==
--- branches/S3_0/common/ai.h   (original)
+++ branches/S3_0/common/ai.h   Wed May 17 05:29:16 2017
@@ -55,6 +55,9 @@
   void *private;
 
   struct {
+/* Called for every AI type when server quits. */
+void (*module_close)(void);
+
 /* Called for every AI type when game starts. Game is not necessarily new 
one,
it can also be an old game loaded from a savegame. */
 void (*game_start)(void);

Modified: branches/S3_0/doc/README.AI_modules
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/doc/README.AI_modules?rev=35618=35617=35618=diff
==
--- branches/S3_0/doc/README.AI_modules 

[Freeciv-commits] r35617 - in /trunk: ai/classic/ ai/tex/ ai/threaded/ common/ doc/ server/

2017-05-16 Thread cazfi74
Author: cazfi
Date: Wed May 17 05:29:09 2017
New Revision: 35617

URL: http://svn.gna.org/viewcvs/freeciv?rev=35617=rev
Log:
Free ai_type private data

See hrm Bug #660840

Modified:
trunk/ai/classic/classicai.c
trunk/ai/tex/texai.c
trunk/ai/threaded/threadedai.c
trunk/common/ai.h
trunk/doc/README.AI_modules
trunk/server/srv_main.c

Modified: trunk/ai/classic/classicai.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/classic/classicai.c?rev=35617=35616=35617=diff
==
--- trunk/ai/classic/classicai.c(original)
+++ trunk/ai/classic/classicai.cWed May 17 05:29:09 2017
@@ -70,6 +70,16 @@
 }
 
 /**
+  Free resources allocated by the classic AI module
+**/
+static void cai_module_close(void)
+{
+  struct ai_type *deftype = classic_ai_get_self();
+
+  FC_FREE(deftype->private);
+}
+
+/**
   Call default ai with classic ai type as parameter.
 **/
 static void cai_player_alloc(struct player *pplayer)
@@ -578,6 +588,8 @@
   private = fc_malloc(sizeof(struct dai_private_data));
   private->contemplace_workers = TRUE;
   ai->private = private;
+
+  ai->funcs.module_close = cai_module_close;
 
   /* ai->funcs.game_start = NULL; */
   /* ai->funcs.game_free = NULL; */

Modified: trunk/ai/tex/texai.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/tex/texai.c?rev=35617=35616=35617=diff
==
--- trunk/ai/tex/texai.c(original)
+++ trunk/ai/tex/texai.cWed May 17 05:29:09 2017
@@ -68,6 +68,16 @@
 #define TEXAI_DFUNC(_func, ...) _func(ait, ## __VA_ARGS__ );
 
 /**
+  Free resources allocated by the tex AI module
+**/
+static void texai_module_close(void)
+{
+  TEXAI_AIT;
+
+  FC_FREE(ait->private);
+}
+
+/**
   Call default ai with tex ai type as parameter.
 **/
 static void texwai_game_start(void)
@@ -586,6 +596,8 @@
   ai->private = private;
 
   texai_init_self(ai);
+
+  ai->funcs.module_close = texai_module_close;
 
   ai->funcs.game_start = texwai_game_start;
   ai->funcs.game_free = texwai_game_free;

Modified: trunk/ai/threaded/threadedai.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/threaded/threadedai.c?rev=35617=35616=35617=diff
==
--- trunk/ai/threaded/threadedai.c  (original)
+++ trunk/ai/threaded/threadedai.c  Wed May 17 05:29:09 2017
@@ -66,6 +66,16 @@
 #define TAI_DFUNC(_func, ...) _func(ait, ## __VA_ARGS__ );
 
 /**
+  Free resources allocated by the threaded AI module
+**/
+static void tai_module_close(void)
+{
+  TAI_AIT;
+
+  FC_FREE(ait->private);
+}
+
+/**
   Call default ai with threaded ai type as parameter.
 **/
 static void twai_player_alloc(struct player *pplayer)
@@ -552,6 +562,7 @@
 
   tai_init_self(ai);
 
+  ai->funcs.module_close = tai_module_close;
   ai->funcs.player_alloc = twai_player_alloc;
   ai->funcs.player_free = twai_player_free;
   ai->funcs.player_save = twai_player_save;

Modified: trunk/common/ai.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/ai.h?rev=35617=35616=35617=diff
==
--- trunk/common/ai.h   (original)
+++ trunk/common/ai.h   Wed May 17 05:29:09 2017
@@ -55,6 +55,9 @@
   void *private;
 
   struct {
+/* Called for every AI type when server quits. */
+void (*module_close)(void);
+
 /* Called for every AI type when game starts. Game is not necessarily new 
one,
it can also be an old game loaded from a savegame. */
 void (*game_start)(void);

Modified: trunk/doc/README.AI_modules
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.AI_modules?rev=35617=35616=35617=diff
==
--- trunk/doc/README.AI_modules (original)
+++ trunk/doc/README.AI_modules Wed May 17 05:29:09 2017
@@ -124,6 +124,7 @@
 New in Freeciv 3.0:
 ---
 - Added 'private' pointer for ai module to store data of its own
+- Added 'module_close', called when server quits
 - 

[Freeciv-commits] r35614 - /branches/S3_0/ai/default/daidiplomacy.c

2017-05-16 Thread cazfi74
Author: cazfi
Date: Tue May 16 15:33:42 2017
New Revision: 35614

URL: http://svn.gna.org/viewcvs/freeciv?rev=35614=rev
Log:
Do not set out-of-range AI love towards player launching spaceship

See hrm Bug #660363

Modified:
branches/S3_0/ai/default/daidiplomacy.c

Modified: branches/S3_0/ai/default/daidiplomacy.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/default/daidiplomacy.c?rev=35614=35613=35614=diff
==
--- branches/S3_0/ai/default/daidiplomacy.c (original)
+++ branches/S3_0/ai/default/daidiplomacy.c Tue May 16 15:33:42 2017
@@ -1555,7 +1555,7 @@
   remove_shared_vision(pplayer, aplayer);
 }
 /* Never forgive this */
-pplayer->ai_common.love[player_index(aplayer)] = -(BIG_NUMBER);
+pplayer->ai_common.love[player_index(aplayer)] = -MAX_AI_LOVE;
   } else if (ship->state == SSHIP_STARTED 
 && adip->warned_about_space == 0) {
 pplayer->ai_common.love[player_index(aplayer)] -= MAX_AI_LOVE / 10;


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


[Freeciv-commits] r35616 - /branches/S2_5/ai/default/advdiplomacy.c

2017-05-16 Thread cazfi74
Author: cazfi
Date: Tue May 16 15:33:54 2017
New Revision: 35616

URL: http://svn.gna.org/viewcvs/freeciv?rev=35616=rev
Log:
Do not set out-of-range AI love towards player launching spaceship

See hrm Bug #660363

Modified:
branches/S2_5/ai/default/advdiplomacy.c

Modified: branches/S2_5/ai/default/advdiplomacy.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/ai/default/advdiplomacy.c?rev=35616=35615=35616=diff
==
--- branches/S2_5/ai/default/advdiplomacy.c (original)
+++ branches/S2_5/ai/default/advdiplomacy.c Tue May 16 15:33:54 2017
@@ -1485,7 +1485,7 @@
   remove_shared_vision(pplayer, aplayer);
 }
 /* Never forgive this */
-pplayer->ai_common.love[player_index(aplayer)] = -(BIG_NUMBER);
+pplayer->ai_common.love[player_index(aplayer)] = -MAX_AI_LOVE;
   } else if (ship->state == SSHIP_STARTED 
 && adip->warned_about_space == 0) {
 pplayer->ai_common.love[player_index(aplayer)] -= MAX_AI_LOVE / 10;


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


[Freeciv-commits] r35615 - /branches/S2_6/ai/default/daidiplomacy.c

2017-05-16 Thread cazfi74
Author: cazfi
Date: Tue May 16 15:33:49 2017
New Revision: 35615

URL: http://svn.gna.org/viewcvs/freeciv?rev=35615=rev
Log:
Do not set out-of-range AI love towards player launching spaceship

See hrm Bug #660363

Modified:
branches/S2_6/ai/default/daidiplomacy.c

Modified: branches/S2_6/ai/default/daidiplomacy.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/ai/default/daidiplomacy.c?rev=35615=35614=35615=diff
==
--- branches/S2_6/ai/default/daidiplomacy.c (original)
+++ branches/S2_6/ai/default/daidiplomacy.c Tue May 16 15:33:49 2017
@@ -1546,7 +1546,7 @@
   remove_shared_vision(pplayer, aplayer);
 }
 /* Never forgive this */
-pplayer->ai_common.love[player_index(aplayer)] = -(BIG_NUMBER);
+pplayer->ai_common.love[player_index(aplayer)] = -MAX_AI_LOVE;
   } else if (ship->state == SSHIP_STARTED 
 && adip->warned_about_space == 0) {
 pplayer->ai_common.love[player_index(aplayer)] -= MAX_AI_LOVE / 10;


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


[Freeciv-commits] r35613 - /trunk/ai/default/daidiplomacy.c

2017-05-16 Thread cazfi74
Author: cazfi
Date: Tue May 16 15:33:32 2017
New Revision: 35613

URL: http://svn.gna.org/viewcvs/freeciv?rev=35613=rev
Log:
Do not set out-of-range AI love towards player launching spaceship

See hrm Bug #660363

Modified:
trunk/ai/default/daidiplomacy.c

Modified: trunk/ai/default/daidiplomacy.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/daidiplomacy.c?rev=35613=35612=35613=diff
==
--- trunk/ai/default/daidiplomacy.c (original)
+++ trunk/ai/default/daidiplomacy.c Tue May 16 15:33:32 2017
@@ -1555,7 +1555,7 @@
   remove_shared_vision(pplayer, aplayer);
 }
 /* Never forgive this */
-pplayer->ai_common.love[player_index(aplayer)] = -(BIG_NUMBER);
+pplayer->ai_common.love[player_index(aplayer)] = -MAX_AI_LOVE;
   } else if (ship->state == SSHIP_STARTED 
 && adip->warned_about_space == 0) {
 pplayer->ai_common.love[player_index(aplayer)] -= MAX_AI_LOVE / 10;


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


[Freeciv-commits] r35606 - /trunk/client/tilespec.c

2017-05-15 Thread cazfi74
Author: cazfi
Date: Mon May 15 23:40:50 2017
New Revision: 35606

URL: http://svn.gna.org/viewcvs/freeciv?rev=35606=rev
Log:
Apply activity offsets to workertask icons

See hrm Bug #660421

Modified:
trunk/client/tilespec.c

Modified: trunk/client/tilespec.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/tilespec.c?rev=35606=35605=35606=diff
==
--- trunk/client/tilespec.c (original)
+++ trunk/client/tilespec.c Mon May 15 23:40:50 2017
@@ -5930,23 +5930,35 @@
   switch (ptask->act) {
   case ACTIVITY_MINE:
 if (ptask->tgt == NULL) {
-  ADD_SPRITE_SIMPLE(t->sprites.unit.plant);
+  ADD_SPRITE(t->sprites.unit.plant,
+ TRUE, FULL_TILE_X_OFFSET + t->activity_offset_x,
+ FULL_TILE_Y_OFFSET + t->activity_offset_y);
 } else {
-  
ADD_SPRITE_SIMPLE(t->sprites.extras[extra_index(ptask->tgt)].activity);
+  ADD_SPRITE(t->sprites.extras[extra_index(ptask->tgt)].activity,
+ TRUE, FULL_TILE_X_OFFSET + t->activity_offset_x,
+ FULL_TILE_Y_OFFSET + t->activity_offset_y);
 }
 break;
   case ACTIVITY_IRRIGATE:
 if (ptask->tgt == NULL) {
-  ADD_SPRITE_SIMPLE(t->sprites.unit.irrigate);
+  ADD_SPRITE(t->sprites.unit.irrigate,
+ TRUE, FULL_TILE_X_OFFSET + t->activity_offset_x,
+ FULL_TILE_Y_OFFSET + t->activity_offset_y);
 } else {
-  
ADD_SPRITE_SIMPLE(t->sprites.extras[extra_index(ptask->tgt)].activity);
+  ADD_SPRITE(t->sprites.extras[extra_index(ptask->tgt)].activity,
+ TRUE, FULL_TILE_X_OFFSET + t->activity_offset_x,
+ FULL_TILE_Y_OFFSET + t->activity_offset_y);
 }
 break;
   case ACTIVITY_GEN_ROAD:
-
ADD_SPRITE_SIMPLE(t->sprites.extras[extra_index(ptask->tgt)].activity);
+ADD_SPRITE(t->sprites.extras[extra_index(ptask->tgt)].activity,
+   TRUE, FULL_TILE_X_OFFSET + t->activity_offset_x,
+   FULL_TILE_Y_OFFSET + t->activity_offset_y);
 break;
   case ACTIVITY_TRANSFORM:
-ADD_SPRITE_SIMPLE(t->sprites.unit.transform);
+ADD_SPRITE(t->sprites.unit.transform,
+ TRUE, FULL_TILE_X_OFFSET + t->activity_offset_x,
+ FULL_TILE_Y_OFFSET + t->activity_offset_y);
 break;
   default:
 break;


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


[Freeciv-commits] r35603 - /trunk/ai/tex/texaicity.c

2017-05-15 Thread cazfi74
Author: cazfi
Date: Mon May 15 22:47:30 2017
New Revision: 35603

URL: http://svn.gna.org/viewcvs/freeciv?rev=35603=rev
Log:
Fix tex compile

See hrm Bug #660664

Modified:
trunk/ai/tex/texaicity.c

Modified: trunk/ai/tex/texaicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/tex/texaicity.c?rev=35603=35602=35603=diff
==
--- trunk/ai/tex/texaicity.c(original)
+++ trunk/ai/tex/texaicity.cMon May 15 22:47:30 2017
@@ -132,8 +132,8 @@
 }
   } unit_type_iterate_end;
 
-  cdata->defai.settler_want = maxwant / 70;
-  cdata->defai.settler_type = type;
+  cdata->defai.worker_want = maxwant / 70;
+  cdata->defai.worker_type = type;
 }
 
 struct texai_tile_state


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


[Freeciv-commits] r35604 - /branches/S3_0/ai/tex/texaicity.c

2017-05-15 Thread cazfi74
Author: cazfi
Date: Mon May 15 22:47:36 2017
New Revision: 35604

URL: http://svn.gna.org/viewcvs/freeciv?rev=35604=rev
Log:
Fix tex compile

See hrm Bug #660664

Modified:
branches/S3_0/ai/tex/texaicity.c

Modified: branches/S3_0/ai/tex/texaicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/tex/texaicity.c?rev=35604=35603=35604=diff
==
--- branches/S3_0/ai/tex/texaicity.c(original)
+++ branches/S3_0/ai/tex/texaicity.cMon May 15 22:47:36 2017
@@ -132,8 +132,8 @@
 }
   } unit_type_iterate_end;
 
-  cdata->defai.settler_want = maxwant / 70;
-  cdata->defai.settler_type = type;
+  cdata->defai.worker_want = maxwant / 70;
+  cdata->defai.worker_type = type;
 }
 
 struct texai_tile_state


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


[Freeciv-commits] r35602 - in /branches/S3_0: common/ data/alien/ data/civ1/ data/civ2/ data/civ2civ3/ data/classic/ data/experimental/ data/m...

2017-05-15 Thread cazfi74
Author: cazfi
Date: Mon May 15 20:53:26 2017
New Revision: 35602

URL: http://svn.gna.org/viewcvs/freeciv?rev=35602=rev
Log:
Add ruleset capabilities for !ruleset_locked scenarios to use

See hrm Feature #659482

Modified:
branches/S3_0/common/game.c
branches/S3_0/common/game.h
branches/S3_0/data/alien/game.ruleset
branches/S3_0/data/civ1/game.ruleset
branches/S3_0/data/civ2/game.ruleset
branches/S3_0/data/civ2civ3/game.ruleset
branches/S3_0/data/classic/game.ruleset
branches/S3_0/data/experimental/game.ruleset
branches/S3_0/data/multiplayer/game.ruleset
branches/S3_0/data/sandbox/game.ruleset
branches/S3_0/data/stub/game.ruleset
branches/S3_0/data/webperimental/game.ruleset
branches/S3_0/server/ruleset.c
branches/S3_0/server/savegame3.c
branches/S3_0/tools/ruleutil/rulesave.c

Modified: branches/S3_0/common/game.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/game.c?rev=35602=35601=35602=diff
==
--- branches/S3_0/common/game.c (original)
+++ branches/S3_0/common/game.c Mon May 15 20:53:26 2017
@@ -254,6 +254,7 @@
 
   game.ruleset_summary   = NULL;
   game.ruleset_description   = NULL;
+  game.ruleset_capabilities  = NULL;
 
   /* The info packet. */
   game.info.aifill   = GAME_DEFAULT_AIFILL;
@@ -650,6 +651,11 @@
 free(game.ruleset_description);
 game.ruleset_description = NULL;
   }
+
+  if (game.ruleset_capabilities != NULL) {
+free(game.ruleset_capabilities);
+game.ruleset_capabilities = NULL;
+  }
 }
 
 /***

Modified: branches/S3_0/common/game.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/game.h?rev=35602=35601=35602=diff
==
--- branches/S3_0/common/game.h (original)
+++ branches/S3_0/common/game.h Mon May 15 20:53:26 2017
@@ -82,6 +82,7 @@
   struct packet_ruleset_control control;
   char *ruleset_summary;
   char *ruleset_description;
+  char *ruleset_capabilities;
   struct packet_scenario_info scenario;
   struct packet_scenario_description scenario_desc;
   struct packet_game_info info;

Modified: branches/S3_0/data/alien/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/alien/game.ruleset?rev=35602=35601=35602=diff
==
--- branches/S3_0/data/alien/game.ruleset   (original)
+++ branches/S3_0/data/alien/game.ruleset   Mon May 15 20:53:26 2017
@@ -42,6 +42,9 @@
 ; Detailed description
 ; When updating this, update also desciption_file in [ruledit] section to match
 description = *alien/README.alien*
+
+; What capabilities ruleset provides for the scenarios.
+capabilities = ""
 
 [options]
 global_init_techs=""

Modified: branches/S3_0/data/civ1/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/civ1/game.ruleset?rev=35602=35601=35602=diff
==
--- branches/S3_0/data/civ1/game.ruleset(original)
+++ branches/S3_0/data/civ1/game.rulesetMon May 15 20:53:26 2017
@@ -42,6 +42,9 @@
 ; Detailed description
 ; When updating this, update also desciption_file in [ruledit] section to match
 ; description = ""
+
+; What capabilities ruleset provides for the scenarios.
+capabilities = ""
 
 [options]
 global_init_techs=""

Modified: branches/S3_0/data/civ2/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/civ2/game.ruleset?rev=35602=35601=35602=diff
==
--- branches/S3_0/data/civ2/game.ruleset(original)
+++ branches/S3_0/data/civ2/game.rulesetMon May 15 20:53:26 2017
@@ -38,6 +38,10 @@
 ; Detailed description
 ; When updating this, update also desciption_file in [ruledit] section to match
 ; description = ""
+
+; What capabilities ruleset provides for the scenarios.
+; mimimum-default-sets - Default units, terrains, buildings, etc
+capabilities = "minimum-default-sets"
 
 [options]
 global_init_techs=""

Modified: branches/S3_0/data/civ2civ3/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/civ2civ3/game.ruleset?rev=35602=35601=35602=diff
==
--- branches/S3_0/data/civ2civ3/game.ruleset(original)
+++ branches/S3_0/data/civ2civ3/game.rulesetMon May 15 20:53:26 2017
@@ -44,6 +44,10 @@
 ; Detailed description
 ; When updating this, update also desciption_file in [ruledit] section to match
 description = *civ2civ3/README.civ2civ3*
+
+; What capabilities ruleset provides for the scenarios.
+; mimimum-default-sets - Default units, terrains, buildings, etc
+capabilities = "minimum-default-sets"
 
 [options]
 global_init_techs=""

Modified: 

[Freeciv-commits] r35601 - in /trunk: common/ data/alien/ data/civ1/ data/civ2/ data/civ2civ3/ data/classic/ data/experimental/ data/multiplay...

2017-05-15 Thread cazfi74
Author: cazfi
Date: Mon May 15 20:53:18 2017
New Revision: 35601

URL: http://svn.gna.org/viewcvs/freeciv?rev=35601=rev
Log:
Add ruleset capabilities for !ruleset_locked scenarios to use

See hrm Feature #659482

Modified:
trunk/common/game.c
trunk/common/game.h
trunk/data/alien/game.ruleset
trunk/data/civ1/game.ruleset
trunk/data/civ2/game.ruleset
trunk/data/civ2civ3/game.ruleset
trunk/data/classic/game.ruleset
trunk/data/experimental/game.ruleset
trunk/data/multiplayer/game.ruleset
trunk/data/sandbox/game.ruleset
trunk/data/stub/game.ruleset
trunk/data/webperimental/game.ruleset
trunk/server/ruleset.c
trunk/server/savegame3.c
trunk/tools/ruleutil/rulesave.c

Modified: trunk/common/game.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/game.c?rev=35601=35600=35601=diff
==
--- trunk/common/game.c (original)
+++ trunk/common/game.c Mon May 15 20:53:18 2017
@@ -254,6 +254,7 @@
 
   game.ruleset_summary   = NULL;
   game.ruleset_description   = NULL;
+  game.ruleset_capabilities  = NULL;
 
   /* The info packet. */
   game.info.aifill   = GAME_DEFAULT_AIFILL;
@@ -652,6 +653,11 @@
 free(game.ruleset_description);
 game.ruleset_description = NULL;
   }
+
+  if (game.ruleset_capabilities != NULL) {
+free(game.ruleset_capabilities);
+game.ruleset_capabilities = NULL;
+  }
 }
 
 /***

Modified: trunk/common/game.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/game.h?rev=35601=35600=35601=diff
==
--- trunk/common/game.h (original)
+++ trunk/common/game.h Mon May 15 20:53:18 2017
@@ -82,6 +82,7 @@
   struct packet_ruleset_control control;
   char *ruleset_summary;
   char *ruleset_description;
+  char *ruleset_capabilities;
   struct packet_scenario_info scenario;
   struct packet_scenario_description scenario_desc;
   struct packet_game_info info;

Modified: trunk/data/alien/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/alien/game.ruleset?rev=35601=35600=35601=diff
==
--- trunk/data/alien/game.ruleset   (original)
+++ trunk/data/alien/game.ruleset   Mon May 15 20:53:18 2017
@@ -42,6 +42,9 @@
 ; Detailed description
 ; When updating this, update also desciption_file in [ruledit] section to match
 description = *alien/README.alien*
+
+; What capabilities ruleset provides for the scenarios.
+capabilities = ""
 
 [options]
 global_init_techs=""

Modified: trunk/data/civ1/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ1/game.ruleset?rev=35601=35600=35601=diff
==
--- trunk/data/civ1/game.ruleset(original)
+++ trunk/data/civ1/game.rulesetMon May 15 20:53:18 2017
@@ -42,6 +42,9 @@
 ; Detailed description
 ; When updating this, update also desciption_file in [ruledit] section to match
 ; description = ""
+
+; What capabilities ruleset provides for the scenarios.
+capabilities = ""
 
 [options]
 global_init_techs=""

Modified: trunk/data/civ2/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2/game.ruleset?rev=35601=35600=35601=diff
==
--- trunk/data/civ2/game.ruleset(original)
+++ trunk/data/civ2/game.rulesetMon May 15 20:53:18 2017
@@ -38,6 +38,10 @@
 ; Detailed description
 ; When updating this, update also desciption_file in [ruledit] section to match
 ; description = ""
+
+; What capabilities ruleset provides for the scenarios.
+; mimimum-default-sets - Default units, terrains, buildings, etc
+capabilities = "minimum-default-sets"
 
 [options]
 global_init_techs=""

Modified: trunk/data/civ2civ3/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/civ2civ3/game.ruleset?rev=35601=35600=35601=diff
==
--- trunk/data/civ2civ3/game.ruleset(original)
+++ trunk/data/civ2civ3/game.rulesetMon May 15 20:53:18 2017
@@ -44,6 +44,10 @@
 ; Detailed description
 ; When updating this, update also desciption_file in [ruledit] section to match
 description = *civ2civ3/README.civ2civ3*
+
+; What capabilities ruleset provides for the scenarios.
+; mimimum-default-sets - Default units, terrains, buildings, etc
+capabilities = "minimum-default-sets"
 
 [options]
 global_init_techs=""

Modified: trunk/data/classic/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/classic/game.ruleset?rev=35601=35600=35601=diff
==
--- trunk/data/classic/game.ruleset (original)
+++ trunk/data/classic/game.ruleset Mon May 15 20:53:18 2017
@@ 

[Freeciv-commits] r35585 - in /trunk: doc/README.fcdb lua/database.lua

2017-05-15 Thread cazfi74
Author: cazfi
Date: Mon May 15 19:15:53 2017
New Revision: 35585

URL: http://svn.gna.org/viewcvs/freeciv?rev=35585=rev
Log:
Update ticket links in documentation to point to hostedredmine.

See hrm Feature #660271

Modified:
trunk/doc/README.fcdb
trunk/lua/database.lua

Modified: trunk/doc/README.fcdb
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.fcdb?rev=35585=35584=35585=diff
==
--- trunk/doc/README.fcdb   (original)
+++ trunk/doc/README.fcdb   Mon May 15 19:15:53 2017
@@ -236,10 +236,11 @@
 
 
 * Move password comparison / policy to Lua script
-  
-* Give database.lua access to do more stuff 
-* Allow setting cmdlevel per-user, etc 
+  
+* Give database.lua access to do more stuff
+  
+* Allow setting cmdlevel per-user, etc
+  
 * Give database.lua access to game signals and events
-  
-* Lua script for postgres 
+  
 * Improve this README

Modified: trunk/lua/database.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/lua/database.lua?rev=35585=35584=35585=diff
==
--- trunk/lua/database.lua  (original)
+++ trunk/lua/database.lua  Mon May 15 19:15:53 2017
@@ -127,7 +127,7 @@
 -- DIRTY: return a string to put in a database query which gets the
 -- current time (in seconds since the epoch, UTC).
 -- (This should be replaced with Lua os.time() once the script has access
--- to this, see .)
+-- to this, see .)
 function sql_time()
   local backend = get_option("backend")
   if backend == 'mysql' then


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


[Freeciv-commits] r35587 - in /branches/S2_6: doc/README.fcdb lua/database.lua

2017-05-15 Thread cazfi74
Author: cazfi
Date: Mon May 15 19:16:06 2017
New Revision: 35587

URL: http://svn.gna.org/viewcvs/freeciv?rev=35587=rev
Log:
Update ticket links in documentation to point to hostedredmine.

See hrm Feature #660271

Modified:
branches/S2_6/doc/README.fcdb
branches/S2_6/lua/database.lua

Modified: branches/S2_6/doc/README.fcdb
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/doc/README.fcdb?rev=35587=35586=35587=diff
==
--- branches/S2_6/doc/README.fcdb   (original)
+++ branches/S2_6/doc/README.fcdb   Mon May 15 19:16:06 2017
@@ -236,10 +236,11 @@
 
 
 * Move password comparison / policy to Lua script
-  
-* Give database.lua access to do more stuff 
-* Allow setting cmdlevel per-user, etc 
+  
+* Give database.lua access to do more stuff
+  
+* Allow setting cmdlevel per-user, etc
+  
 * Give database.lua access to game signals and events
-  
-* Lua script for postgres 
+  
 * Improve this README

Modified: branches/S2_6/lua/database.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/lua/database.lua?rev=35587=35586=35587=diff
==
--- branches/S2_6/lua/database.lua  (original)
+++ branches/S2_6/lua/database.lua  Mon May 15 19:16:06 2017
@@ -127,7 +127,7 @@
 -- DIRTY: return a string to put in a database query which gets the
 -- current time (in seconds since the epoch, UTC).
 -- (This should be replaced with Lua os.time() once the script has access
--- to this, see .)
+-- to this, see .)
 function sql_time()
   local backend = get_option("backend")
   if backend == 'mysql' then


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


[Freeciv-commits] r35586 - in /branches/S3_0: doc/README.fcdb lua/database.lua

2017-05-15 Thread cazfi74
Author: cazfi
Date: Mon May 15 19:16:01 2017
New Revision: 35586

URL: http://svn.gna.org/viewcvs/freeciv?rev=35586=rev
Log:
Update ticket links in documentation to point to hostedredmine.

See hrm Feature #660271

Modified:
branches/S3_0/doc/README.fcdb
branches/S3_0/lua/database.lua

Modified: branches/S3_0/doc/README.fcdb
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/doc/README.fcdb?rev=35586=35585=35586=diff
==
--- branches/S3_0/doc/README.fcdb   (original)
+++ branches/S3_0/doc/README.fcdb   Mon May 15 19:16:01 2017
@@ -236,10 +236,11 @@
 
 
 * Move password comparison / policy to Lua script
-  
-* Give database.lua access to do more stuff 
-* Allow setting cmdlevel per-user, etc 
+  
+* Give database.lua access to do more stuff
+  
+* Allow setting cmdlevel per-user, etc
+  
 * Give database.lua access to game signals and events
-  
-* Lua script for postgres 
+  
 * Improve this README

Modified: branches/S3_0/lua/database.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/lua/database.lua?rev=35586=35585=35586=diff
==
--- branches/S3_0/lua/database.lua  (original)
+++ branches/S3_0/lua/database.lua  Mon May 15 19:16:01 2017
@@ -127,7 +127,7 @@
 -- DIRTY: return a string to put in a database query which gets the
 -- current time (in seconds since the epoch, UTC).
 -- (This should be replaced with Lua os.time() once the script has access
--- to this, see .)
+-- to this, see .)
 function sql_time()
   local backend = get_option("backend")
   if backend == 'mysql' then


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


[Freeciv-commits] r35588 - in /branches/S2_5: doc/README.fcdb lua/database.lua

2017-05-15 Thread cazfi74
Author: cazfi
Date: Mon May 15 19:16:12 2017
New Revision: 35588

URL: http://svn.gna.org/viewcvs/freeciv?rev=35588=rev
Log:
Update ticket links in documentation to point to hostedredmine.

See hrm Feature #660271

Modified:
branches/S2_5/doc/README.fcdb
branches/S2_5/lua/database.lua

Modified: branches/S2_5/doc/README.fcdb
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/doc/README.fcdb?rev=35588=35587=35588=diff
==
--- branches/S2_5/doc/README.fcdb   (original)
+++ branches/S2_5/doc/README.fcdb   Mon May 15 19:16:12 2017
@@ -225,10 +225,11 @@
 
 
 * Move password comparison / policy to Lua script
-  
-* Give database.lua access to do more stuff 
-* Allow setting cmdlevel per-user, etc 
+  
+* Give database.lua access to do more stuff
+  
+* Allow setting cmdlevel per-user, etc
+  
 * Give database.lua access to game signals and events
-  
-* Lua script for postgres 
+  
 * Improve this README

Modified: branches/S2_5/lua/database.lua
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/lua/database.lua?rev=35588=35587=35588=diff
==
--- branches/S2_5/lua/database.lua  (original)
+++ branches/S2_5/lua/database.lua  Mon May 15 19:16:12 2017
@@ -127,7 +127,7 @@
 -- DIRTY: return a string to put in a database query which gets the
 -- current time (in seconds since the epoch, UTC).
 -- (This should be replaced with Lua os.time() once the script has access
--- to this, see .)
+-- to this, see .)
 function sql_time()
   local backend = get_option("backend")
   if backend == 'mysql' then


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


[Freeciv-commits] r35581 - in /branches/S3_0: client/ common/ server/ tools/ tools/ruledit/

2017-05-14 Thread cazfi74
Author: cazfi
Date: Mon May 15 00:56:12 2017
New Revision: 35581

URL: http://svn.gna.org/viewcvs/freeciv?rev=35581=rev
Log:
Reload current ruleset when loading !ruleset_locked scenario

See hrm Bug #659453

Modified:
branches/S3_0/client/client_main.c
branches/S3_0/common/game.c
branches/S3_0/common/game.h
branches/S3_0/server/savegame3.c
branches/S3_0/server/srv_main.c
branches/S3_0/server/srv_main.h
branches/S3_0/server/stdinhand.c
branches/S3_0/tools/civmanual.c
branches/S3_0/tools/ruledit/ruledit.cpp
branches/S3_0/tools/ruleup.c

Modified: branches/S3_0/client/client_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/client_main.c?rev=35581=35580=35581=diff
==
--- branches/S3_0/client/client_main.c  (original)
+++ branches/S3_0/client/client_main.c  Mon May 15 00:56:12 2017
@@ -249,7 +249,7 @@
   client.conn.playing = NULL;
   client.conn.observer = FALSE;
 
-  game_init();
+  game_init(FALSE);
   attribute_init();
   agents_init();
   control_init();

Modified: branches/S3_0/common/game.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/game.c?rev=35581=35580=35581=diff
==
--- branches/S3_0/common/game.c (original)
+++ branches/S3_0/common/game.c Mon May 15 00:56:12 2017
@@ -59,7 +59,7 @@
 
 bool am_i_server = FALSE;
 
-static void game_defaults(void);
+static void game_defaults(bool keep_ruleset_value);
 
 /**
   Is program type server?
@@ -227,7 +227,7 @@
 /
   Set default game values.
 /
-static void game_defaults(void)
+static void game_defaults(bool keep_ruleset_value)
 {
   int i;
 
@@ -394,7 +394,9 @@
 game.server.razechance= GAME_DEFAULT_RAZECHANCE;
 game.server.revealmap = GAME_DEFAULT_REVEALMAP;
 game.server.revolution_length = GAME_DEFAULT_REVOLUTION_LENGTH;
-sz_strlcpy(game.server.rulesetdir, GAME_DEFAULT_RULESETDIR);
+if (!keep_ruleset_value) {
+  sz_strlcpy(game.server.rulesetdir, GAME_DEFAULT_RULESETDIR);
+}
 game.server.save_compress_level = GAME_DEFAULT_COMPRESS_LEVEL;
 game.server.save_compress_type = GAME_DEFAULT_COMPRESS_TYPE;
 sz_strlcpy(game.server.save_name, GAME_DEFAULT_SAVE_NAME);
@@ -432,9 +434,9 @@
 
   The variables are listed in alphabetical order.
 /
-void game_init(void)
-{
-  game_defaults();
+void game_init(bool keep_ruleset_value)
+{
+  game_defaults(keep_ruleset_value);
   player_slots_init();
   map_init();
   team_slots_init();
@@ -481,7 +483,7 @@
 {
   if (is_server()) {
 game_free();
-game_init();
+game_init(FALSE);
   } else {
 /* Reset the players infos. */
 players_iterate(pplayer) {

Modified: branches/S3_0/common/game.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/game.h?rev=35581=35580=35581=diff
==
--- branches/S3_0/common/game.h (original)
+++ branches/S3_0/common/game.h Mon May 15 00:56:12 2017
@@ -291,7 +291,7 @@
   i_am_server(); /* No difference between a tool and server at the moment */
 }
 
-void game_init(void);
+void game_init(bool keep_ruleset_value);
 void game_map_init(void);
 void game_free(void);
 void game_reset(void);

Modified: branches/S3_0/server/savegame3.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/savegame3.c?rev=35581=35580=35581=diff
==
--- branches/S3_0/server/savegame3.c(original)
+++ branches/S3_0/server/savegame3.cMon May 15 00:56:12 2017
@@ -1310,10 +1310,11 @@
* are special scenarios. */
   sz_strlcpy(game.server.rulesetdir, GAME_DEFAULT_RULESETDIR);
 }
-if (!load_rulesets(NULL, FALSE, TRUE, FALSE)) {
-  /* Failed to load correct ruleset */
-  sg_failure_ret(FALSE, "Failed to load ruleset");
-}
+  }
+
+  if (!load_rulesets(NULL, FALSE, TRUE, FALSE)) {
+/* Failed to load correct ruleset */
+sg_failure_ret(FALSE, "Failed to load ruleset");
   }
 
   /* This is in the savegame only if the game has been started before 
savegame3.c time,

Modified: branches/S3_0/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/srv_main.c?rev=35581=35580=35581=diff
==
--- branches/S3_0/server/srv_main.c (original)
+++ branches/S3_0/server/srv_main.c Mon May 15 00:56:12 2017
@@ -2745,7 +2745,7 @@
   voting_init();
   ai_timer_init();
 
-  server_game_init();
+  server_game_init(FALSE);
   

[Freeciv-commits] r35580 - in /trunk: client/ common/ server/ tools/ tools/ruledit/

2017-05-14 Thread cazfi74
Author: cazfi
Date: Mon May 15 00:56:02 2017
New Revision: 35580

URL: http://svn.gna.org/viewcvs/freeciv?rev=35580=rev
Log:
Reload current ruleset when loading !ruleset_locked scenario

See hrm Bug #659453

Modified:
trunk/client/client_main.c
trunk/common/game.c
trunk/common/game.h
trunk/server/savegame3.c
trunk/server/srv_main.c
trunk/server/srv_main.h
trunk/server/stdinhand.c
trunk/tools/civmanual.c
trunk/tools/ruledit/ruledit.cpp
trunk/tools/ruleup.c

Modified: trunk/client/client_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/client_main.c?rev=35580=35579=35580=diff
==
--- trunk/client/client_main.c  (original)
+++ trunk/client/client_main.c  Mon May 15 00:56:02 2017
@@ -249,7 +249,7 @@
   client.conn.playing = NULL;
   client.conn.observer = FALSE;
 
-  game_init();
+  game_init(FALSE);
   attribute_init();
   agents_init();
   control_init();

Modified: trunk/common/game.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/game.c?rev=35580=35579=35580=diff
==
--- trunk/common/game.c (original)
+++ trunk/common/game.c Mon May 15 00:56:02 2017
@@ -59,7 +59,7 @@
 
 bool am_i_server = FALSE;
 
-static void game_defaults(void);
+static void game_defaults(bool keep_ruleset_value);
 
 /**
   Is program type server?
@@ -227,7 +227,7 @@
 /
   Set default game values.
 /
-static void game_defaults(void)
+static void game_defaults(bool keep_ruleset_value)
 {
   int i;
 
@@ -394,7 +394,9 @@
 game.server.razechance= GAME_DEFAULT_RAZECHANCE;
 game.server.revealmap = GAME_DEFAULT_REVEALMAP;
 game.server.revolution_length = GAME_DEFAULT_REVOLUTION_LENGTH;
-sz_strlcpy(game.server.rulesetdir, GAME_DEFAULT_RULESETDIR);
+if (!keep_ruleset_value) {
+  sz_strlcpy(game.server.rulesetdir, GAME_DEFAULT_RULESETDIR);
+}
 game.server.save_compress_level = GAME_DEFAULT_COMPRESS_LEVEL;
 game.server.save_compress_type = GAME_DEFAULT_COMPRESS_TYPE;
 sz_strlcpy(game.server.save_name, GAME_DEFAULT_SAVE_NAME);
@@ -432,9 +434,9 @@
 
   The variables are listed in alphabetical order.
 /
-void game_init(void)
-{
-  game_defaults();
+void game_init(bool keep_ruleset_value)
+{
+  game_defaults(keep_ruleset_value);
   player_slots_init();
   map_init(, is_server());
   team_slots_init();
@@ -482,7 +484,7 @@
 {
   if (is_server()) {
 game_free();
-game_init();
+game_init(FALSE);
   } else {
 /* Reset the players infos. */
 players_iterate(pplayer) {

Modified: trunk/common/game.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/game.h?rev=35580=35579=35580=diff
==
--- trunk/common/game.h (original)
+++ trunk/common/game.h Mon May 15 00:56:02 2017
@@ -291,7 +291,7 @@
   i_am_server(); /* No difference between a tool and server at the moment */
 }
 
-void game_init(void);
+void game_init(bool keep_ruleset_value);
 void game_map_init(void);
 void game_free(void);
 void game_reset(void);

Modified: trunk/server/savegame3.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame3.c?rev=35580=35579=35580=diff
==
--- trunk/server/savegame3.c(original)
+++ trunk/server/savegame3.cMon May 15 00:56:02 2017
@@ -1316,10 +1316,11 @@
* are special scenarios. */
   sz_strlcpy(game.server.rulesetdir, GAME_DEFAULT_RULESETDIR);
 }
-if (!load_rulesets(NULL, FALSE, TRUE, FALSE)) {
-  /* Failed to load correct ruleset */
-  sg_failure_ret(FALSE, "Failed to load ruleset");
-}
+  }
+
+  if (!load_rulesets(NULL, FALSE, TRUE, FALSE)) {
+/* Failed to load correct ruleset */
+sg_failure_ret(FALSE, "Failed to load ruleset");
   }
 
   /* This is in the savegame only if the game has been started before 
savegame3.c time,

Modified: trunk/server/srv_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/srv_main.c?rev=35580=35579=35580=diff
==
--- trunk/server/srv_main.c (original)
+++ trunk/server/srv_main.c Mon May 15 00:56:02 2017
@@ -2746,7 +2746,7 @@
   voting_init();
   ai_timer_init();
 
-  server_game_init();
+  server_game_init(FALSE);
   mapimg_init(mapimg_server_tile_known, mapimg_server_tile_terrain,
   mapimg_server_tile_owner, mapimg_server_tile_city,
   mapimg_server_tile_unit, mapimg_server_plrcolor_count,
@@ -3110,7 +3110,7 @@
 

[Freeciv-commits] r35579 - in /branches/S3_0/ai/default: aicity.c aicity.h daidomestic.c

2017-05-14 Thread cazfi74
Author: cazfi
Date: Sun May 14 22:07:57 2017
New Revision: 35579

URL: http://svn.gna.org/viewcvs/freeciv?rev=35579=rev
Log:
Rename settler_want as worker_want

See hrm Feature #660200

Modified:
branches/S3_0/ai/default/aicity.c
branches/S3_0/ai/default/aicity.h
branches/S3_0/ai/default/daidomestic.c

Modified: branches/S3_0/ai/default/aicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/default/aicity.c?rev=35579=35578=35579=diff
==
--- branches/S3_0/ai/default/aicity.c   (original)
+++ branches/S3_0/ai/default/aicity.c   Sun May 14 22:07:57 2017
@@ -744,7 +744,7 @@
 return;
   }
 
-  city_data->settler_want = 0; /* Make sure old want does not stay if we don't 
want now */
+  city_data->worker_want = 0; /* Make sure old want does not stay if we don't 
want now */
 
   utype = dai_role_utype_for_terrain_class(pcity, UTYF_SETTLERS, TC_LAND);
 
@@ -807,8 +807,8 @@
 
   fc_assert(want >= 0);
 
-  city_data->settler_want = want;
-  city_data->settler_type = dai_role_utype_for_terrain_class(pcity, 
UTYF_SETTLERS,
+  city_data->worker_want = want;
+  city_data->worker_type = dai_role_utype_for_terrain_class(pcity, 
UTYF_SETTLERS,
  TC_LAND);
 }
 
@@ -881,14 +881,14 @@
 adv_free_choice(choice);
 TIMING_LOG(AIT_CITY_MILITARY, TIMER_STOP);
 if (dai_on_war_footing(ait, pplayer) && city_data->choice.want > 0) {
-  city_data->settler_want = 0;
+  city_data->worker_want = 0;
   city_data->founder_want = 0;
   city_data->founder_turn = game.info.turn; /* Do not consider zero we set 
here
  * valid value, if real want 
is needed.
  * Recalculate immediately in 
such situation. */
   continue; /* Go, soldiers! */
 }
-/* Will record its findings in pcity->settler_want */ 
+/* Will record its findings in pcity->worker_want */ 
 TIMING_LOG(AIT_CITY_TERRAIN, TIMER_START);
 contemplate_terrain_improvements(ait, pcity);
 TIMING_LOG(AIT_CITY_TERRAIN, TIMER_STOP);

Modified: branches/S3_0/ai/default/aicity.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/default/aicity.h?rev=35579=35578=35579=diff
==
--- branches/S3_0/ai/default/aicity.h   (original)
+++ branches/S3_0/ai/default/aicity.h   Sun May 14 22:07:57 2017
@@ -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
@@ -64,8 +64,8 @@
   bool founder_boat;/* city founder will need a boat */
   int founder_turn; /* only recalculate every Nth turn */
   int founder_want;
-  int settler_want;
-  struct unit_type *settler_type;
+  int worker_want;
+  struct unit_type *worker_type;
 };
 
 void dai_manage_cities(struct ai_type *ait, struct player *pplayer);

Modified: branches/S3_0/ai/default/daidomestic.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/default/daidomestic.c?rev=35579=35578=35579=diff
==
--- branches/S3_0/ai/default/daidomestic.c  (original)
+++ branches/S3_0/ai/default/daidomestic.c  Sun May 14 22:07:57 2017
@@ -459,44 +459,44 @@
 {
   struct adv_data *adv = adv_data_get(pplayer, NULL);
   /* Unit type with certain role */
-  struct unit_type *settler_type;
+  struct unit_type *worker_type;
   struct unit_type *founder_type;
-  adv_want settler_want, founder_want;
+  adv_want worker_want, founder_want;
   struct ai_city *city_data = def_ai_city_data(pcity, ait);
   struct adv_choice *choice = adv_new_choice();
 
   /* Find out desire for workers (terrain improvers) */
-  settler_type = city_data->settler_type;
+  worker_type = city_data->worker_type;
 
   /* The worker want is calculated in aicity.c called from
* dai_manage_cities.  The expand value is the % that the AI should
* value expansion (basically to handicap easier difficulty levels)
* and is set when the difficulty level is changed (difficulty.c). */
-  settler_want = city_data->settler_want * pplayer->ai_common.expand / 100;
+  worker_want = city_data->worker_want * pplayer->ai_common.expand / 100;
 
   if (adv->wonder_city == pcity->id) {
-if (!settler_type || settler_type->pop_cost > 0) {
-  settler_want /= 5;
+if (!worker_type || worker_type->pop_cost > 0) {
+  worker_want /= 5;
 } else {
-  settler_want /= 2;
-}
-  }
-
-  if (settler_type
-  && pcity->surplus[O_FOOD] > utype_upkeep_cost(settler_type,
+  worker_want /= 2;
+   

[Freeciv-commits] r35578 - in /trunk/ai/default: aicity.c aicity.h daidomestic.c

2017-05-14 Thread cazfi74
Author: cazfi
Date: Sun May 14 22:07:51 2017
New Revision: 35578

URL: http://svn.gna.org/viewcvs/freeciv?rev=35578=rev
Log:
Rename settler_want as worker_want

See hrm Feature #660200

Modified:
trunk/ai/default/aicity.c
trunk/ai/default/aicity.h
trunk/ai/default/daidomestic.c

Modified: trunk/ai/default/aicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aicity.c?rev=35578=35577=35578=diff
==
--- trunk/ai/default/aicity.c   (original)
+++ trunk/ai/default/aicity.c   Sun May 14 22:07:51 2017
@@ -744,7 +744,7 @@
 return;
   }
 
-  city_data->settler_want = 0; /* Make sure old want does not stay if we don't 
want now */
+  city_data->worker_want = 0; /* Make sure old want does not stay if we don't 
want now */
 
   utype = dai_role_utype_for_terrain_class(pcity, UTYF_SETTLERS, TC_LAND);
 
@@ -807,8 +807,8 @@
 
   fc_assert(want >= 0);
 
-  city_data->settler_want = want;
-  city_data->settler_type = dai_role_utype_for_terrain_class(pcity, 
UTYF_SETTLERS,
+  city_data->worker_want = want;
+  city_data->worker_type = dai_role_utype_for_terrain_class(pcity, 
UTYF_SETTLERS,
  TC_LAND);
 }
 
@@ -881,14 +881,14 @@
 adv_free_choice(choice);
 TIMING_LOG(AIT_CITY_MILITARY, TIMER_STOP);
 if (dai_on_war_footing(ait, pplayer) && city_data->choice.want > 0) {
-  city_data->settler_want = 0;
+  city_data->worker_want = 0;
   city_data->founder_want = 0;
   city_data->founder_turn = game.info.turn; /* Do not consider zero we set 
here
  * valid value, if real want 
is needed.
  * Recalculate immediately in 
such situation. */
   continue; /* Go, soldiers! */
 }
-/* Will record its findings in pcity->settler_want */ 
+/* Will record its findings in pcity->worker_want */ 
 TIMING_LOG(AIT_CITY_TERRAIN, TIMER_START);
 contemplate_terrain_improvements(ait, pcity);
 TIMING_LOG(AIT_CITY_TERRAIN, TIMER_STOP);

Modified: trunk/ai/default/aicity.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aicity.h?rev=35578=35577=35578=diff
==
--- trunk/ai/default/aicity.h   (original)
+++ trunk/ai/default/aicity.h   Sun May 14 22:07:51 2017
@@ -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
@@ -64,8 +64,8 @@
   bool founder_boat;/* city founder will need a boat */
   int founder_turn; /* only recalculate every Nth turn */
   int founder_want;
-  int settler_want;
-  struct unit_type *settler_type;
+  int worker_want;
+  struct unit_type *worker_type;
 };
 
 void dai_manage_cities(struct ai_type *ait, struct player *pplayer);

Modified: trunk/ai/default/daidomestic.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/daidomestic.c?rev=35578=35577=35578=diff
==
--- trunk/ai/default/daidomestic.c  (original)
+++ trunk/ai/default/daidomestic.c  Sun May 14 22:07:51 2017
@@ -459,44 +459,44 @@
 {
   struct adv_data *adv = adv_data_get(pplayer, NULL);
   /* Unit type with certain role */
-  struct unit_type *settler_type;
+  struct unit_type *worker_type;
   struct unit_type *founder_type;
-  adv_want settler_want, founder_want;
+  adv_want worker_want, founder_want;
   struct ai_city *city_data = def_ai_city_data(pcity, ait);
   struct adv_choice *choice = adv_new_choice();
 
   /* Find out desire for workers (terrain improvers) */
-  settler_type = city_data->settler_type;
+  worker_type = city_data->worker_type;
 
   /* The worker want is calculated in aicity.c called from
* dai_manage_cities.  The expand value is the % that the AI should
* value expansion (basically to handicap easier difficulty levels)
* and is set when the difficulty level is changed (difficulty.c). */
-  settler_want = city_data->settler_want * pplayer->ai_common.expand / 100;
+  worker_want = city_data->worker_want * pplayer->ai_common.expand / 100;
 
   if (adv->wonder_city == pcity->id) {
-if (!settler_type || settler_type->pop_cost > 0) {
-  settler_want /= 5;
+if (!worker_type || worker_type->pop_cost > 0) {
+  worker_want /= 5;
 } else {
-  settler_want /= 2;
-}
-  }
-
-  if (settler_type
-  && pcity->surplus[O_FOOD] > utype_upkeep_cost(settler_type,
+  worker_want /= 2;
+}
+  }
+
+  if (worker_type != NULL
+  && pcity->surplus[O_FOOD] > utype_upkeep_cost(worker_type,
 

[Freeciv-commits] r35577 - in /trunk/tools/ruledit: effect_edit.cpp tab_misc.cpp tab_misc.h

2017-05-14 Thread cazfi74
Author: cazfi
Date: Sun May 14 21:47:15 2017
New Revision: 35577

URL: http://svn.gna.org/viewcvs/freeciv?rev=35577=rev
Log:
Add editing of always active effects

See hrm Feature #659227

Modified:
trunk/tools/ruledit/effect_edit.cpp
trunk/tools/ruledit/tab_misc.cpp
trunk/tools/ruledit/tab_misc.h

Modified: trunk/tools/ruledit/effect_edit.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/effect_edit.cpp?rev=35577=35576=35577=diff
==
--- trunk/tools/ruledit/effect_edit.cpp (original)
+++ trunk/tools/ruledit/effect_edit.cpp Sun May 14 21:47:15 2017
@@ -52,7 +52,11 @@
 
   ui = ui_in;
   selected = nullptr;
-  filter = *filter_in;
+  if (filter_in == nullptr) {
+filter.kind = VUT_NONE;
+  } else {
+filter = *filter_in;
+  }
   name = target;
 
   list_widget = new QListWidget(this);
@@ -108,7 +112,7 @@
 {
   struct effect_list_fill_data *cbdata = (struct effect_list_fill_data *)data;
 
-  if (cbdata->filter == nullptr) {
+  if (cbdata->filter->kind == VUT_NONE) {
 // Look for empty req lists.
 if (requirement_vector_size(>reqs) == 0) {
   cbdata->edit->add_effect_to_list(peffect, cbdata);

Modified: trunk/tools/ruledit/tab_misc.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/tab_misc.cpp?rev=35577=35576=35577=diff
==
--- trunk/tools/ruledit/tab_misc.cpp(original)
+++ trunk/tools/ruledit/tab_misc.cppSun May 14 21:47:15 2017
@@ -39,6 +39,7 @@
 #include "rssanity.h"
 
 // ruledit
+#include "effect_edit.h"
 #include "ruledit.h"
 #include "ruledit_qt.h"
 #include "rulesave.h"
@@ -56,6 +57,7 @@
   QLabel *name_label;
   QLabel *version_label;
   QPushButton *save_button;
+  QPushButton *always_active_effects;
   QPushButton *refresh_button;
   int row = 0;
   QTableWidgetItem *item;
@@ -89,6 +91,9 @@
   save_button = new QPushButton(QString::fromUtf8(R__("Save now")), this);
   connect(save_button, SIGNAL(pressed()), this, SLOT(save_now()));
   main_layout->addWidget(save_button, row++, 1);
+  always_active_effects = new QPushButton(QString::fromUtf8(R__("Always active 
Effects")), this);
+  connect(always_active_effects, SIGNAL(pressed()), this, 
SLOT(edit_aae_effects()));
+  main_layout->addWidget(always_active_effects, row++, 1);
 
   stats = new QTableWidget(this);
   stats->setColumnCount(8);
@@ -336,3 +341,16 @@
 
   stats->resizeColumnsToContents();
 }
+
+/**
+  User wants to edit always active effects
+**/
+void tab_misc::edit_aae_effects()
+{
+  effect_edit *e_edit;
+
+  e_edit = new effect_edit(ui, QString::fromUtf8(R__("Always active")),
+   nullptr);
+
+  e_edit->show();
+}

Modified: trunk/tools/ruledit/tab_misc.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/tab_misc.h?rev=35577=35576=35577=diff
==
--- trunk/tools/ruledit/tab_misc.h  (original)
+++ trunk/tools/ruledit/tab_misc.h  Sun May 14 21:47:15 2017
@@ -35,6 +35,7 @@
   private slots:
 void save_now();
 void refresh_stats();
+void edit_aae_effects();
 
   private:
 ruledit_gui *ui;


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


[Freeciv-commits] r35576 - in /trunk/windows/installer_cross/helpers: installer-helper-gtk3.cmd installer-helper-qt.cmd

2017-05-14 Thread cazfi74
Author: cazfi
Date: Sun May 14 15:54:06 2017
New Revision: 35576

URL: http://svn.gna.org/viewcvs/freeciv?rev=35576=rev
Log:
Set eol-style of new .cmd files to CRLF

Modified:
trunk/windows/installer_cross/helpers/installer-helper-gtk3.cmd   
(contents, props changed)
trunk/windows/installer_cross/helpers/installer-helper-qt.cmd   (contents, 
props changed)

Modified: trunk/windows/installer_cross/helpers/installer-helper-gtk3.cmd
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/windows/installer_cross/helpers/installer-helper-gtk3.cmd?rev=35576=35575=35576=diff
==
--- trunk/windows/installer_cross/helpers/installer-helper-gtk3.cmd 
(original)
+++ trunk/windows/installer_cross/helpers/installer-helper-gtk3.cmd Sun May 
14 15:54:06 2017
@@ -1,3 +1,3 @@
-cd %~dp0\..
-
-bin\gdk-pixbuf-query-loaders.exe > lib\gdk-pixbuf-2.0\2.10.0\loaders.cache
+cd %~dp0\..
+
+bin\gdk-pixbuf-query-loaders.exe > lib\gdk-pixbuf-2.0\2.10.0\loaders.cache

Propchange: trunk/windows/installer_cross/helpers/installer-helper-gtk3.cmd
--
svn:eol-style = CRLF

Modified: trunk/windows/installer_cross/helpers/installer-helper-qt.cmd
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/windows/installer_cross/helpers/installer-helper-qt.cmd?rev=35576=35575=35576=diff
==
--- trunk/windows/installer_cross/helpers/installer-helper-qt.cmd   
(original)
+++ trunk/windows/installer_cross/helpers/installer-helper-qt.cmd   Sun May 
14 15:54:06 2017
@@ -1,3 +1,3 @@
-cd %~dp0\..
-
-echo "No special install helper actions needed"
+cd %~dp0\..
+
+echo "No special install helper actions needed"

Propchange: trunk/windows/installer_cross/helpers/installer-helper-qt.cmd
--
svn:eol-style = CRLF


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


[Freeciv-commits] r35575 - in /branches/S3_0/windows/installer_cross/helpers: installer-helper-gtk3.cmd installer-helper-qt.cmd

2017-05-14 Thread cazfi74
Author: cazfi
Date: Sun May 14 15:53:25 2017
New Revision: 35575

URL: http://svn.gna.org/viewcvs/freeciv?rev=35575=rev
Log:
Set eol-style of new .cmd files to CRLF

Modified:
branches/S3_0/windows/installer_cross/helpers/installer-helper-gtk3.cmd   
(contents, props changed)
branches/S3_0/windows/installer_cross/helpers/installer-helper-qt.cmd   
(contents, props changed)

Modified: 
branches/S3_0/windows/installer_cross/helpers/installer-helper-gtk3.cmd
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/windows/installer_cross/helpers/installer-helper-gtk3.cmd?rev=35575=35574=35575=diff
==
--- branches/S3_0/windows/installer_cross/helpers/installer-helper-gtk3.cmd 
(original)
+++ branches/S3_0/windows/installer_cross/helpers/installer-helper-gtk3.cmd 
Sun May 14 15:53:25 2017
@@ -1,3 +1,3 @@
-cd %~dp0\..
-
-bin\gdk-pixbuf-query-loaders.exe > lib\gdk-pixbuf-2.0\2.10.0\loaders.cache
+cd %~dp0\..
+
+bin\gdk-pixbuf-query-loaders.exe > lib\gdk-pixbuf-2.0\2.10.0\loaders.cache

Propchange: 
branches/S3_0/windows/installer_cross/helpers/installer-helper-gtk3.cmd
--
svn:eol-style = CRLF

Modified: branches/S3_0/windows/installer_cross/helpers/installer-helper-qt.cmd
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/windows/installer_cross/helpers/installer-helper-qt.cmd?rev=35575=35574=35575=diff
==
--- branches/S3_0/windows/installer_cross/helpers/installer-helper-qt.cmd   
(original)
+++ branches/S3_0/windows/installer_cross/helpers/installer-helper-qt.cmd   
Sun May 14 15:53:25 2017
@@ -1,3 +1,3 @@
-cd %~dp0\..
-
-echo "No special install helper actions needed"
+cd %~dp0\..
+
+echo "No special install helper actions needed"

Propchange: 
branches/S3_0/windows/installer_cross/helpers/installer-helper-qt.cmd
--
svn:eol-style = CRLF


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


[Freeciv-commits] r35574 - /branches/S3_0/translations/core/POTFILES.in

2017-05-14 Thread cazfi74
Author: cazfi
Date: Sun May 14 11:14:58 2017
New Revision: 35574

URL: http://svn.gna.org/viewcvs/freeciv?rev=35574=rev
Log:
Update POTFILES.in to tex AI rename

Modified:
branches/S3_0/translations/core/POTFILES.in

Modified: branches/S3_0/translations/core/POTFILES.in
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/translations/core/POTFILES.in?rev=35574=35573=35574=diff
==
--- branches/S3_0/translations/core/POTFILES.in (original)
+++ branches/S3_0/translations/core/POTFILES.in Sun May 14 11:14:58 2017
@@ -3,7 +3,7 @@
 ai/default/aicity.c
 ai/default/daidiplomacy.c
 ai/threaded/threadedai.c
-ai/threxpr/threxprai.c
+ai/tex/texai.c
 client/agents/cma_core.c
 client/agents/cma_fec.c
 client/attribute.c


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


[Freeciv-commits] r35573 - /trunk/translations/core/POTFILES.in

2017-05-14 Thread cazfi74
Author: cazfi
Date: Sun May 14 11:14:46 2017
New Revision: 35573

URL: http://svn.gna.org/viewcvs/freeciv?rev=35573=rev
Log:
Update POTFILES.in to tex AI rename

Modified:
trunk/translations/core/POTFILES.in

Modified: trunk/translations/core/POTFILES.in
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/translations/core/POTFILES.in?rev=35573=35572=35573=diff
==
--- trunk/translations/core/POTFILES.in (original)
+++ trunk/translations/core/POTFILES.in Sun May 14 11:14:46 2017
@@ -3,7 +3,7 @@
 ai/default/aicity.c
 ai/default/daidiplomacy.c
 ai/threaded/threadedai.c
-ai/threxpr/threxprai.c
+ai/tex/texai.c
 client/agents/cma_core.c
 client/agents/cma_fec.c
 client/attribute.c


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


[Freeciv-commits] r35571 - in /trunk/windows: ./ installer_cross/ installer_cross/helpers/

2017-05-14 Thread cazfi74
Author: cazfi
Date: Sun May 14 10:59:03 2017
New Revision: 35571

URL: http://svn.gna.org/viewcvs/freeciv?rev=35571=rev
Log:
installer_cross: Execute gdk-pixbuf-query-loaders.exe when installing

See hrm Feature #660105

Added:
trunk/windows/installer_cross/helpers/
trunk/windows/installer_cross/helpers/installer-helper-gtk3.cmd   (with 
props)
trunk/windows/installer_cross/helpers/installer-helper-qt.cmd   (with props)
Modified:
trunk/windows/Makefile.am
trunk/windows/installer_cross/create-freeciv-gtk-qt-nsi.sh
trunk/windows/installer_cross/create-freeciv-sdl2-nsi.sh
trunk/windows/installer_cross/installer_build.sh

Modified: trunk/windows/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/windows/Makefile.am?rev=35571=35570=35571=diff
==
--- trunk/windows/Makefile.am   (original)
+++ trunk/windows/Makefile.am   Sun May 14 10:59:03 2017
@@ -39,7 +39,9 @@
installer_cross/freeciv-mp-qt.cmd   \
installer_cross/freeciv-sdl2.cmd\
installer_cross/freeciv-ruledit.cmd \
-   installer_cross/licenses/COPYING.installer
+   installer_cross/licenses/COPYING.installer  \
+   installer_cross/helpers/installer-helper-gtk3.cmd \
+   installer_cross/helpers/installer-helper-qt.cmd
 
 if MINGW
 nodist_noinst_DATA =   \

Modified: trunk/windows/installer_cross/create-freeciv-gtk-qt-nsi.sh
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/windows/installer_cross/create-freeciv-gtk-qt-nsi.sh?rev=35571=35570=35571=diff
==
--- trunk/windows/installer_cross/create-freeciv-gtk-qt-nsi.sh  (original)
+++ trunk/windows/installer_cross/create-freeciv-gtk-qt-nsi.sh  Sun May 14 
10:59:03 2017
@@ -56,6 +56,8 @@
 
 !insertmacro MUI_PAGE_STARTMENU "Application" \$STARTMENU_FOLDER
 !insertmacro MUI_PAGE_INSTFILES
+
+Page custom HelperScriptFunction
 
 !define MUI_FINISHPAGE_RUN
 !define MUI_FINISHPAGE_RUN_FUNCTION RunFreeciv
@@ -263,6 +265,10 @@
 cat  lib\gdk-pixbuf-2.0\2.10.0\loaders.cache

Propchange: trunk/windows/installer_cross/helpers/installer-helper-gtk3.cmd
--
svn:executable = *

Added: trunk/windows/installer_cross/helpers/installer-helper-qt.cmd
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/windows/installer_cross/helpers/installer-helper-qt.cmd?rev=35571=auto
==
--- trunk/windows/installer_cross/helpers/installer-helper-qt.cmd   (added)
+++ trunk/windows/installer_cross/helpers/installer-helper-qt.cmd   Sun May 
14 10:59:03 2017
@@ -0,0 +1,3 @@
+cd %~dp0\..
+
+echo "No special install helper actions needed"

Propchange: trunk/windows/installer_cross/helpers/installer-helper-qt.cmd
--
svn:executable = *

Modified: trunk/windows/installer_cross/installer_build.sh
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/windows/installer_cross/installer_build.sh?rev=35571=35570=35571=diff
==
--- trunk/windows/installer_cross/installer_build.sh(original)
+++ trunk/windows/installer_cross/installer_build.shSun May 14 10:59:03 2017
@@ -32,7 +32,8 @@
   cp $1/bin/libxml2-2.dll $2/ &&
   cp $1/bin/libharfbuzz-0.dll $2/ &&
   mkdir -p $2/bin &&
-  cp $1/bin/gdk-pixbuf-query-loaders.exe $2/bin/
+  cp $1/bin/gdk-pixbuf-query-loaders.exe $2/bin/ &&
+  cp ./helpers/installer-helper-gtk3.cmd $2/bin/installer-helper.cmd
 }
 
 add_sdl2_mixer_env() {
@@ -54,7 +55,9 @@
   cp -R $1/plugins $2/ &&
   cp $1/bin/Qt5Core.dll $2/ &&
   cp $1/bin/Qt5Gui.dll $2/ &&
-  cp 

[Freeciv-commits] r35572 - in /branches/S3_0/windows: ./ installer_cross/ installer_cross/helpers/

2017-05-14 Thread cazfi74
Author: cazfi
Date: Sun May 14 10:59:10 2017
New Revision: 35572

URL: http://svn.gna.org/viewcvs/freeciv?rev=35572=rev
Log:
installer_cross: Execute gdk-pixbuf-query-loaders.exe when installing

See hrm Feature #660105

Added:
branches/S3_0/windows/installer_cross/helpers/
branches/S3_0/windows/installer_cross/helpers/installer-helper-gtk3.cmd   
(with props)
branches/S3_0/windows/installer_cross/helpers/installer-helper-qt.cmd   
(with props)
Modified:
branches/S3_0/windows/Makefile.am
branches/S3_0/windows/installer_cross/create-freeciv-gtk-qt-nsi.sh
branches/S3_0/windows/installer_cross/create-freeciv-sdl2-nsi.sh
branches/S3_0/windows/installer_cross/installer_build.sh

Modified: branches/S3_0/windows/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/windows/Makefile.am?rev=35572=35571=35572=diff
==
--- branches/S3_0/windows/Makefile.am   (original)
+++ branches/S3_0/windows/Makefile.am   Sun May 14 10:59:10 2017
@@ -42,7 +42,9 @@
installer_cross/freeciv-mp-qt.cmd   \
installer_cross/freeciv-sdl2.cmd\
installer_cross/freeciv-ruledit.cmd \
-   installer_cross/licenses/COPYING.installer
+   installer_cross/licenses/COPYING.installer  \
+   installer_cross/helpers/installer-helper-gtk3.cmd \
+   installer_cross/helpers/installer-helper-qt.cmd
 
 if MINGW
 nodist_noinst_DATA =   \

Modified: branches/S3_0/windows/installer_cross/create-freeciv-gtk-qt-nsi.sh
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/windows/installer_cross/create-freeciv-gtk-qt-nsi.sh?rev=35572=35571=35572=diff
==
--- branches/S3_0/windows/installer_cross/create-freeciv-gtk-qt-nsi.sh  
(original)
+++ branches/S3_0/windows/installer_cross/create-freeciv-gtk-qt-nsi.sh  Sun May 
14 10:59:10 2017
@@ -56,6 +56,8 @@
 
 !insertmacro MUI_PAGE_STARTMENU "Application" \$STARTMENU_FOLDER
 !insertmacro MUI_PAGE_INSTFILES
+
+Page custom HelperScriptFunction
 
 !define MUI_FINISHPAGE_RUN
 !define MUI_FINISHPAGE_RUN_FUNCTION RunFreeciv
@@ -263,6 +265,10 @@
 cat  lib\gdk-pixbuf-2.0\2.10.0\loaders.cache

Propchange: 
branches/S3_0/windows/installer_cross/helpers/installer-helper-gtk3.cmd
--
svn:executable = *

Added: branches/S3_0/windows/installer_cross/helpers/installer-helper-qt.cmd
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/windows/installer_cross/helpers/installer-helper-qt.cmd?rev=35572=auto
==
--- branches/S3_0/windows/installer_cross/helpers/installer-helper-qt.cmd   
(added)
+++ branches/S3_0/windows/installer_cross/helpers/installer-helper-qt.cmd   
Sun May 14 10:59:10 2017
@@ -0,0 +1,3 @@
+cd %~dp0\..
+
+echo "No special install helper actions needed"

Propchange: 
branches/S3_0/windows/installer_cross/helpers/installer-helper-qt.cmd
--
svn:executable = *

Modified: branches/S3_0/windows/installer_cross/installer_build.sh
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/windows/installer_cross/installer_build.sh?rev=35572=35571=35572=diff
==
--- branches/S3_0/windows/installer_cross/installer_build.sh(original)
+++ branches/S3_0/windows/installer_cross/installer_build.shSun May 14 
10:59:10 2017
@@ -32,7 +32,8 @@
   cp $1/bin/libxml2-2.dll $2/ &&
   cp $1/bin/libharfbuzz-0.dll $2/ &&
   mkdir -p $2/bin &&
-  cp $1/bin/gdk-pixbuf-query-loaders.exe $2/bin/
+  cp 

[Freeciv-commits] r35570 - in /trunk: ai/default/ client/ client/gui-gtk-3.0/ client/gui-gtk-3.22/ client/gui-gtk-4.0/ client/gui-qt/ client/g...

2017-05-14 Thread cazfi74
Author: cazfi
Date: Sun May 14 10:30:35 2017
New Revision: 35570

URL: http://svn.gna.org/viewcvs/freeciv?rev=35570=rev
Log:
Add map parameter to can_exist_at family of functions

See hrm Feature #660079

Modified:
trunk/ai/default/aiunit.c
trunk/ai/default/daimilitary.c
trunk/client/control.c
trunk/client/goto.c
trunk/client/gui-gtk-3.0/action_dialog.c
trunk/client/gui-gtk-3.0/citydlg.c
trunk/client/gui-gtk-3.0/editprop.c
trunk/client/gui-gtk-3.22/action_dialog.c
trunk/client/gui-gtk-3.22/citydlg.c
trunk/client/gui-gtk-3.22/editprop.c
trunk/client/gui-gtk-4.0/action_dialog.c
trunk/client/gui-gtk-4.0/citydlg.c
trunk/client/gui-gtk-4.0/editprop.c
trunk/client/gui-qt/dialogs.cpp
trunk/client/gui-qt/hudwidget.cpp
trunk/client/gui-sdl2/action_dialog.c
trunk/common/actions.c
trunk/common/aicore/pf_tools.c
trunk/common/city.c
trunk/common/combat.c
trunk/common/map.c
trunk/common/map.h
trunk/common/movement.c
trunk/common/movement.h
trunk/common/reqtext.c
trunk/common/requirements.c
trunk/common/scriptcore/api_game_methods.c
trunk/common/unit.c
trunk/common/unitlist.c
trunk/server/advisors/advgoto.c
trunk/server/advisors/advruleset.c
trunk/server/advisors/autoexplorer.c
trunk/server/animals.c
trunk/server/barbarian.c
trunk/server/citytools.c
trunk/server/edithand.c
trunk/server/maphand.c
trunk/server/plrhand.c
trunk/server/sanitycheck.c
trunk/server/savegame2.c
trunk/server/savegame3.c
trunk/server/scripting/api_server_edit.c
trunk/server/unithand.c
trunk/server/unittools.c

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

Modified: trunk/ai/default/aiunit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aiunit.c?rev=35570=35569=35570=diff

Modified: trunk/ai/default/daimilitary.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/daimilitary.c?rev=35570=35569=35570=diff

Modified: trunk/client/control.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/control.c?rev=35570=35569=35570=diff

Modified: trunk/client/goto.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/goto.c?rev=35570=35569=35570=diff

Modified: trunk/client/gui-gtk-3.0/action_dialog.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/action_dialog.c?rev=35570=35569=35570=diff

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=35570=35569=35570=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=35570=35569=35570=diff

Modified: trunk/client/gui-gtk-3.22/action_dialog.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.22/action_dialog.c?rev=35570=35569=35570=diff

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=35570=35569=35570=diff

Modified: trunk/client/gui-gtk-3.22/editprop.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.22/editprop.c?rev=35570=35569=35570=diff

Modified: trunk/client/gui-gtk-4.0/action_dialog.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-4.0/action_dialog.c?rev=35570=35569=35570=diff

Modified: trunk/client/gui-gtk-4.0/citydlg.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-4.0/citydlg.c?rev=35570=35569=35570=diff

Modified: trunk/client/gui-gtk-4.0/editprop.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-4.0/editprop.c?rev=35570=35569=35570=diff

Modified: trunk/client/gui-qt/dialogs.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/dialogs.cpp?rev=35570=35569=35570=diff

Modified: trunk/client/gui-qt/hudwidget.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/hudwidget.cpp?rev=35570=35569=35570=diff

Modified: trunk/client/gui-sdl2/action_dialog.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/action_dialog.c?rev=35570=35569=35570=diff

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=35570=35569=35570=diff

Modified: trunk/common/aicore/pf_tools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/aicore/pf_tools.c?rev=35570=35569=35570=diff

Modified: trunk/common/city.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/city.c?rev=35570=35569=35570=diff

Modified: trunk/common/combat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/combat.c?rev=35570=35569=35570=diff

Modified: trunk/common/map.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/map.c?rev=35570=35569=35570=diff

Modified: trunk/common/map.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/map.h?rev=35570=35569=35570=diff

Modified: trunk/common/movement.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/movement.c?rev=35570=35569=35570=diff

Modified: trunk/common/movement.h

[Freeciv-commits] r35567 - /trunk/ai/default/daidomestic.c

2017-05-13 Thread cazfi74
Author: cazfi
Date: Sun May 14 01:18:01 2017
New Revision: 35567

URL: http://svn.gna.org/viewcvs/freeciv?rev=35567=rev
Log:
Remove hard limitation that AI wonder cities never build settlers

See hrm Bug #660089

Modified:
trunk/ai/default/daidomestic.c

Modified: trunk/ai/default/daidomestic.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/daidomestic.c?rev=35567=35566=35567=diff
==
--- trunk/ai/default/daidomestic.c  (original)
+++ trunk/ai/default/daidomestic.c  Sun May 14 01:18:01 2017
@@ -475,11 +475,14 @@
   settler_want = city_data->settler_want * pplayer->ai_common.expand / 100;
 
   if (adv->wonder_city == pcity->id) {
-settler_want /= 5;
+if (!settler_type || settler_type->pop_cost > 0) {
+  settler_want /= 5;
+} else {
+  settler_want /= 2;
+}
   }
 
   if (settler_type
-  && (pcity->id != adv->wonder_city || settler_type->pop_cost == 0)
   && pcity->surplus[O_FOOD] > utype_upkeep_cost(settler_type,
 pplayer, O_FOOD)) {
 if (settler_want > 0) {
@@ -506,7 +509,11 @@
 founder_want = city_data->founder_want;
 
 if (adv->wonder_city == pcity->id) {
-  founder_want /= 5;
+  if (founder_type->pop_cost > 0) {
+founder_want /= 5;
+  } else {
+founder_want /= 2;
+  }
 }
 
 if (adv->max_num_cities <= city_list_size(pplayer->cities)) {
@@ -518,8 +525,6 @@
   / TRAIT_DEFAULT_VALUE;
 
 if (founder_type
-&& (pcity->id != adv->wonder_city
-|| founder_type->pop_cost == 0)
 && pcity->surplus[O_FOOD] >= utype_upkeep_cost(founder_type,
pplayer, O_FOOD)) {
 


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


[Freeciv-commits] r35569 - /branches/S2_6/ai/default/daidomestic.c

2017-05-13 Thread cazfi74
Author: cazfi
Date: Sun May 14 01:18:14 2017
New Revision: 35569

URL: http://svn.gna.org/viewcvs/freeciv?rev=35569=rev
Log:
Remove hard limitation that AI wonder cities never build settlers

See hrm Bug #660089

Modified:
branches/S2_6/ai/default/daidomestic.c

Modified: branches/S2_6/ai/default/daidomestic.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/ai/default/daidomestic.c?rev=35569=35568=35569=diff
==
--- branches/S2_6/ai/default/daidomestic.c  (original)
+++ branches/S2_6/ai/default/daidomestic.c  Sun May 14 01:18:14 2017
@@ -460,11 +460,14 @@
   settler_want = city_data->settler_want * pplayer->ai_common.expand / 100;
 
   if (adv->wonder_city == pcity->id) {
-settler_want /= 5;
+if (!settler_type || settler_type->pop_cost > 0) {
+  settler_want /= 5;
+} else {
+  settler_want /= 2;
+}
   }
 
   if (settler_type
-  && (pcity->id != adv->wonder_city || settler_type->pop_cost == 0)
   && pcity->surplus[O_FOOD] > utype_upkeep_cost(settler_type,
 pplayer, O_FOOD)) {
 if (settler_want > 0) {
@@ -489,7 +492,11 @@
 founder_want = city_data->founder_want;
 
 if (adv->wonder_city == pcity->id) {
-  founder_want /= 5;
+  if (founder_type->pop_cost > 0) {
+founder_want /= 5;
+  } else {
+founder_want /= 2;
+  }
 }
 
 if (adv->max_num_cities <= city_list_size(pplayer->cities)) {
@@ -501,8 +508,6 @@
   / TRAIT_DEFAULT_VALUE;
 
 if (founder_type
-&& (pcity->id != adv->wonder_city
-|| founder_type->pop_cost == 0)
 && pcity->surplus[O_FOOD] >= utype_upkeep_cost(founder_type,
pplayer, O_FOOD)) {
 


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


[Freeciv-commits] r35568 - /branches/S3_0/ai/default/daidomestic.c

2017-05-13 Thread cazfi74
Author: cazfi
Date: Sun May 14 01:18:08 2017
New Revision: 35568

URL: http://svn.gna.org/viewcvs/freeciv?rev=35568=rev
Log:
Remove hard limitation that AI wonder cities never build settlers

See hrm Bug #660089

Modified:
branches/S3_0/ai/default/daidomestic.c

Modified: branches/S3_0/ai/default/daidomestic.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/default/daidomestic.c?rev=35568=35567=35568=diff
==
--- branches/S3_0/ai/default/daidomestic.c  (original)
+++ branches/S3_0/ai/default/daidomestic.c  Sun May 14 01:18:08 2017
@@ -475,11 +475,14 @@
   settler_want = city_data->settler_want * pplayer->ai_common.expand / 100;
 
   if (adv->wonder_city == pcity->id) {
-settler_want /= 5;
+if (!settler_type || settler_type->pop_cost > 0) {
+  settler_want /= 5;
+} else {
+  settler_want /= 2;
+}
   }
 
   if (settler_type
-  && (pcity->id != adv->wonder_city || settler_type->pop_cost == 0)
   && pcity->surplus[O_FOOD] > utype_upkeep_cost(settler_type,
 pplayer, O_FOOD)) {
 if (settler_want > 0) {
@@ -506,7 +509,11 @@
 founder_want = city_data->founder_want;
 
 if (adv->wonder_city == pcity->id) {
-  founder_want /= 5;
+  if (founder_type->pop_cost > 0) {
+founder_want /= 5;
+  } else {
+founder_want /= 2;
+  }
 }
 
 if (adv->max_num_cities <= city_list_size(pplayer->cities)) {
@@ -518,8 +525,6 @@
   / TRAIT_DEFAULT_VALUE;
 
 if (founder_type
-&& (pcity->id != adv->wonder_city
-|| founder_type->pop_cost == 0)
 && pcity->surplus[O_FOOD] >= utype_upkeep_cost(founder_type,
pplayer, O_FOOD)) {
 


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


[Freeciv-commits] r35558 - /branches/S3_0/ai/default/daimilitary.c

2017-05-13 Thread cazfi74
Author: cazfi
Date: Sat May 13 20:32:14 2017
New Revision: 35558

URL: http://svn.gna.org/viewcvs/freeciv?rev=35558=rev
Log:
Increase AI desire to conquer cities

See hrm Feature #659537

Modified:
branches/S3_0/ai/default/daimilitary.c

Modified: branches/S3_0/ai/default/daimilitary.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/default/daimilitary.c?rev=35558=35557=35558=diff
==
--- branches/S3_0/ai/default/daimilitary.c  (original)
+++ branches/S3_0/ai/default/daimilitary.c  Sat May 13 20:32:14 2017
@@ -1235,7 +1235,7 @@
 }
 if (unit_can_take_over(myunit) || acity_data->invasion.occupy > 0) {
   /* bonus for getting the city */
-  benefit += acity_data->worth / 5;
+  benefit += acity_data->worth / 3;
 }
 
 /* end dealing with cities */


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


[Freeciv-commits] r35559 - /branches/S2_6/ai/default/daimilitary.c

2017-05-13 Thread cazfi74
Author: cazfi
Date: Sat May 13 20:32:20 2017
New Revision: 35559

URL: http://svn.gna.org/viewcvs/freeciv?rev=35559=rev
Log:
Increase AI desire to conquer cities

See hrm Feature #659537

Modified:
branches/S2_6/ai/default/daimilitary.c

Modified: branches/S2_6/ai/default/daimilitary.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/ai/default/daimilitary.c?rev=35559=35558=35559=diff
==
--- branches/S2_6/ai/default/daimilitary.c  (original)
+++ branches/S2_6/ai/default/daimilitary.c  Sat May 13 20:32:20 2017
@@ -1235,7 +1235,7 @@
 }
 if (unit_can_take_over(myunit) || acity_data->invasion.occupy > 0) {
   /* bonus for getting the city */
-  benefit += acity_data->worth / 5;
+  benefit += acity_data->worth / 3;
 }
 
 /* end dealing with cities */


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


[Freeciv-commits] r35557 - /trunk/ai/default/daimilitary.c

2017-05-13 Thread cazfi74
Author: cazfi
Date: Sat May 13 20:32:05 2017
New Revision: 35557

URL: http://svn.gna.org/viewcvs/freeciv?rev=35557=rev
Log:
Increase AI desire to conquer cities

See hrm Feature #659537

Modified:
trunk/ai/default/daimilitary.c

Modified: trunk/ai/default/daimilitary.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/daimilitary.c?rev=35557=35556=35557=diff
==
--- trunk/ai/default/daimilitary.c  (original)
+++ trunk/ai/default/daimilitary.c  Sat May 13 20:32:05 2017
@@ -1235,7 +1235,7 @@
 }
 if (unit_can_take_over(myunit) || acity_data->invasion.occupy > 0) {
   /* bonus for getting the city */
-  benefit += acity_data->worth / 5;
+  benefit += acity_data->worth / 3;
 }
 
 /* end dealing with cities */


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


[Freeciv-commits] r35550 - in /branches/S3_0: doc/README.msys2 windows/installer_msys2/Makefile

2017-05-13 Thread cazfi74
Author: cazfi
Date: Sat May 13 14:31:02 2017
New Revision: 35550

URL: http://svn.gna.org/viewcvs/freeciv?rev=35550=rev
Log:
Update msys2 environment to 170422 level

See hrm Task #652797

Modified:
branches/S3_0/doc/README.msys2
branches/S3_0/windows/installer_msys2/Makefile

Modified: branches/S3_0/doc/README.msys2
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/doc/README.msys2?rev=35550=35549=35550=diff
==
--- branches/S3_0/doc/README.msys2  (original)
+++ branches/S3_0/doc/README.msys2  Sat May 13 14:31:02 2017
@@ -57,10 +57,11 @@
 
  - tar
 
-2.1.1.3) Arch independent packages needed for building freeciv from svn 
checkout
- These are needed in addition to the ones always needed for building freeciv.
+2.1.1.3) Arch independent packages needed for building freeciv from repository
+ checkout. These are needed in addition to the ones always needed for building
+ freeciv.
 
- - subversion
+ - git
  - automake
  - libtool
  - autoconf
@@ -111,9 +112,9 @@
 
 win64 host:
 ---
-msys2-freeciv-win64-170126.7z, based on
+msys2-freeciv-win64-170422.7z, based on
 
https://sourceforge.net/projects/msys2/files/Base/x86-64/msys2-x86_64-20161025.exe
-with packages updated to 26-Jan-17 level.
+with packages updated to 22-Apr-17 level.
 
 Only win64 target is included - replace  with 'x86_64' in package names 
below
 
@@ -122,7 +123,7 @@
 - make
 - pkg-config
 - tar
-- subversion
+- git
 - patch
 - nano
 - automake

Modified: branches/S3_0/windows/installer_msys2/Makefile
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/windows/installer_msys2/Makefile?rev=35550=35549=35550=diff
==
--- branches/S3_0/windows/installer_msys2/Makefile  (original)
+++ branches/S3_0/windows/installer_msys2/Makefile  Sat May 13 14:31:02 2017
@@ -229,7 +229,8 @@
libepoxy-0.dll \
libgraphite2.dll \
libpangoft2-1.0-0.dll \
-   libpcre-1.dll
+   libpcre-1.dll \
+   libunistring-2.dll
 
 install-env-default-fcmp: install-env-common
cp -R $(addprefix $(DLLPATH_PREFIX), $(DEFAULT_FCMP_DLLS)) 
install-$(WINARCH)-$(GUI)/
@@ -272,7 +273,7 @@
SDL2_ttf.dll \
libjpeg-8.dll \
libtiff-5.dll \
-   libwebp-6.dll
+   libwebp-7.dll
 
 install-env-sdl2: install-env-default-fcmp
# add DLLs
@@ -289,7 +290,8 @@
Qt5Gui.dll \
Qt5Widgets.dll \
libgraphite2.dll \
-   libpcre-1.dll
+   libpcre-1.dll \
+   libunistring-2.dll
 
 install-env-qt: install-env-common
# add DLLs


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


[Freeciv-commits] r35549 - in /trunk: doc/README.msys2 windows/installer_msys2/Makefile

2017-05-13 Thread cazfi74
Author: cazfi
Date: Sat May 13 14:30:55 2017
New Revision: 35549

URL: http://svn.gna.org/viewcvs/freeciv?rev=35549=rev
Log:
Update msys2 environment to 170422 level

See hrm Task #652797

Modified:
trunk/doc/README.msys2
trunk/windows/installer_msys2/Makefile

Modified: trunk/doc/README.msys2
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/doc/README.msys2?rev=35549=35548=35549=diff
==
--- trunk/doc/README.msys2  (original)
+++ trunk/doc/README.msys2  Sat May 13 14:30:55 2017
@@ -56,10 +56,11 @@
 
  - tar
 
-2.1.1.3) Arch independent packages needed for building freeciv from svn 
checkout
- These are needed in addition to the ones always needed for building freeciv.
+2.1.1.3) Arch independent packages needed for building freeciv from repository
+ checkout. These are needed in addition to the ones always needed for building
+ freeciv.
 
- - subversion
+ - git
  - automake
  - libtool
  - autoconf
@@ -107,9 +108,9 @@
 
 win64 host:
 ---
-msys2-freeciv-win64-170126.7z, based on
+msys2-freeciv-win64-170422.7z, based on
 
https://sourceforge.net/projects/msys2/files/Base/x86-64/msys2-x86_64-20161025.exe
-with packages updated to 26-Jan-17 level.
+with packages updated to 22-Apr-17 level.
 
 Only win64 target is included - replace  with 'x86_64' in package names 
below
 
@@ -118,7 +119,7 @@
 - make
 - pkg-config
 - tar
-- subversion
+- git
 - patch
 - nano
 - automake

Modified: trunk/windows/installer_msys2/Makefile
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/windows/installer_msys2/Makefile?rev=35549=35548=35549=diff
==
--- trunk/windows/installer_msys2/Makefile  (original)
+++ trunk/windows/installer_msys2/Makefile  Sat May 13 14:30:55 2017
@@ -221,7 +221,8 @@
libepoxy-0.dll \
libgraphite2.dll \
libpangoft2-1.0-0.dll \
-   libpcre-1.dll
+   libpcre-1.dll \
+   libunistring-2.dll
 
 install-env-default-fcmp: install-env-common
cp -R $(addprefix $(DLLPATH_PREFIX), $(DEFAULT_FCMP_DLLS)) 
install-$(WINARCH)-$(GUI)/
@@ -245,7 +246,7 @@
SDL2_ttf.dll \
libjpeg-8.dll \
libtiff-5.dll \
-   libwebp-6.dll
+   libwebp-7.dll
 
 install-env-sdl2: install-env-default-fcmp
# add DLLs
@@ -262,7 +263,8 @@
Qt5Gui.dll \
Qt5Widgets.dll \
libgraphite2.dll \
-   libpcre-1.dll
+   libpcre-1.dll \
+   libunistring-2.dll
 
 install-env-qt: install-env-common
# add DLLs


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


[Freeciv-commits] r35551 - in /branches/S2_6: doc/README.msys2 win32/installer_msys2/Makefile

2017-05-13 Thread cazfi74
Author: cazfi
Date: Sat May 13 14:31:09 2017
New Revision: 35551

URL: http://svn.gna.org/viewcvs/freeciv?rev=35551=rev
Log:
Update msys2 environment to 170422 level

See hrm Task #652797

Modified:
branches/S2_6/doc/README.msys2
branches/S2_6/win32/installer_msys2/Makefile

Modified: branches/S2_6/doc/README.msys2
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/doc/README.msys2?rev=35551=35550=35551=diff
==
--- branches/S2_6/doc/README.msys2  (original)
+++ branches/S2_6/doc/README.msys2  Sat May 13 14:31:09 2017
@@ -59,10 +59,11 @@
 
  - tar
 
-2.1.1.3) Arch independent packages needed for building freeciv from svn 
checkout
- These are needed in addition to the ones always needed for building freeciv.
+2.1.1.3) Arch independent packages needed for building freeciv from repository
+ checkout. These are needed in addition to the ones always needed for building
+ freeciv.
 
- - subversion
+ - git
  - automake
  - libtool
  - autoconf
@@ -112,9 +113,9 @@
 
 win64 host:
 ---
-msys2-freeciv-win64-170126.7z, based on
+msys2-freeciv-win64-170422.7z, based on
 
https://sourceforge.net/projects/msys2/files/Base/x86-64/msys2-x86_64-20161025.exe
-with packages updated to 26-Jan-17 level.
+with packages updated to 22-Apr-17 level.
 
 Only win64 target is included - replace  with 'x86_64' in package names 
below
 
@@ -123,7 +124,7 @@
 - make
 - pkg-config
 - tar
-- subversion
+- git
 - patch
 - nano
 - automake

Modified: branches/S2_6/win32/installer_msys2/Makefile
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/win32/installer_msys2/Makefile?rev=35551=35550=35551=diff
==
--- branches/S2_6/win32/installer_msys2/Makefile(original)
+++ branches/S2_6/win32/installer_msys2/MakefileSat May 13 14:31:09 2017
@@ -232,7 +232,8 @@
libepoxy-0.dll \
libgraphite2.dll \
libpangoft2-1.0-0.dll \
-   libpcre-1.dll
+   libpcre-1.dll \
+   libunistring-2.dll
 
 install-env-default-fcmp: install-env-common
cp -R $(addprefix $(DLLPATH_PREFIX), $(DEFAULT_FCMP_DLLS)) 
install-$(WINARCH)-$(GUI)/
@@ -277,7 +278,7 @@
SDL2_ttf.dll \
libjpeg-8.dll \
libtiff-5.dll \
-   libwebp-6.dll
+   libwebp-7.dll
 
 install-env-sdl2: install-env-default-fcmp
# add DLLs
@@ -294,7 +295,8 @@
Qt5Gui.dll \
Qt5Widgets.dll \
libgraphite2.dll \
-   libpcre-1.dll
+   libpcre-1.dll \
+   libunistring-2.dll
 
 install-env-qt: install-env-common
# add DLLs


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


[Freeciv-commits] r35548 - /trunk/ai/tex/texaiworld.c

2017-05-13 Thread cazfi74
Author: cazfi
Date: Sat May 13 14:00:50 2017
New Revision: 35548

URL: http://svn.gna.org/viewcvs/freeciv?rev=35548=rev
Log:
Tex: Free city when it's destroyed from the world.

See hrm Bug #659528

Modified:
trunk/ai/tex/texaiworld.c

Modified: trunk/ai/tex/texaiworld.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/tex/texaiworld.c?rev=35548=35547=35548=diff
==
--- trunk/ai/tex/texaiworld.c   (original)
+++ trunk/ai/tex/texaiworld.c   Sat May 13 14:00:50 2017
@@ -168,4 +168,5 @@
   struct city *pcity = idex_lookup_city(_world, info->id);
 
   idex_unregister_city(_world, pcity);
+  destroy_city_virtual(pcity);
 }


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


[Freeciv-commits] r35539 - in /branches/S3_0/ai/tex: Makefile.am texai.c threxprai.c

2017-05-13 Thread cazfi74
Author: cazfi
Date: Sat May 13 12:33:41 2017
New Revision: 35539

URL: http://svn.gna.org/viewcvs/freeciv?rev=35539=rev
Log:
Rename threxprai.c as texai.c

See hrm Feature #658487

Added:
branches/S3_0/ai/tex/texai.c
  - copied unchanged from r35538, branches/S3_0/ai/tex/threxprai.c
Removed:
branches/S3_0/ai/tex/threxprai.c
Modified:
branches/S3_0/ai/tex/Makefile.am

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

Modified: branches/S3_0/ai/tex/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/tex/Makefile.am?rev=35539=35538=35539=diff

Removed: branches/S3_0/ai/tex/threxprai.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/tex/threxprai.c?rev=35538=auto


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


[Freeciv-commits] r35538 - in /trunk/ai/tex: Makefile.am texai.c threxprai.c

2017-05-13 Thread cazfi74
Author: cazfi
Date: Sat May 13 12:33:35 2017
New Revision: 35538

URL: http://svn.gna.org/viewcvs/freeciv?rev=35538=rev
Log:
Rename threxprai.c as texai.c

See hrm Feature #658487

Added:
trunk/ai/tex/texai.c
  - copied unchanged from r35537, trunk/ai/tex/threxprai.c
Removed:
trunk/ai/tex/threxprai.c
Modified:
trunk/ai/tex/Makefile.am

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

Modified: trunk/ai/tex/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/tex/Makefile.am?rev=35538=35537=35538=diff

Removed: trunk/ai/tex/threxprai.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/tex/threxprai.c?rev=35537=auto


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


[Freeciv-commits] r35528 - in /trunk/tools/ruledit: effect_edit.cpp effect_edit.h

2017-05-12 Thread cazfi74
Author: cazfi
Date: Fri May 12 19:58:25 2017
New Revision: 35528

URL: http://svn.gna.org/viewcvs/freeciv?rev=35528=rev
Log:
Add editing of effect requirements

See hrm Feature #659223

Modified:
trunk/tools/ruledit/effect_edit.cpp
trunk/tools/ruledit/effect_edit.h

Modified: trunk/tools/ruledit/effect_edit.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/effect_edit.cpp?rev=35528=35527=35528=diff
==
--- trunk/tools/ruledit/effect_edit.cpp (original)
+++ trunk/tools/ruledit/effect_edit.cpp Fri May 12 19:58:25 2017
@@ -29,6 +29,7 @@
 #include "effects.h"
 
 // ruledit
+#include "req_edit.h"
 #include "ruledit.h"
 #include "validity.h"
 
@@ -44,6 +45,7 @@
   QGridLayout *effect_edit_layout = new QGridLayout();
   QHBoxLayout *active_layout = new QHBoxLayout();
   QPushButton *close_button;
+  QPushButton *reqs_button;
   QMenu *menu;
   QLabel *lbl;
   enum effect_type eff;
@@ -51,6 +53,7 @@
   ui = ui_in;
   selected = nullptr;
   filter = *filter_in;
+  name = target;
 
   list_widget = new QListWidget(this);
   effects = effect_list_new();
@@ -74,9 +77,13 @@
 
   main_layout->addLayout(active_layout);
 
+  reqs_button = new QPushButton(QString::fromUtf8(R__("Requirements")), this);
+  connect(reqs_button, SIGNAL(pressed()), this, SLOT(edit_reqs()));
+  effect_edit_layout->addWidget(reqs_button, 0, 0);
+
   close_button = new QPushButton(QString::fromUtf8(R__("Close")), this);
   connect(close_button, SIGNAL(pressed()), this, SLOT(close_now()));
-  effect_edit_layout->addWidget(close_button, 0, 0);
+  effect_edit_layout->addWidget(close_button, 1, 0);
 
   refresh();
 
@@ -141,7 +148,7 @@
   QListWidgetItem *item;
 
   fc_snprintf(buf, sizeof(buf), _("Effect #%d: %s"),
-  data->num, effect_type_name(peffect->type));
+  data->num + 1, effect_type_name(peffect->type));
 
   item = new QListWidgetItem(QString::fromUtf8(buf));
   list_widget->insertItem(data->num++, item);
@@ -171,6 +178,7 @@
 
 if (item != nullptr && item->isSelected()) {
   selected = peffect;
+  selected_nbr = i;
   fill_active();
   return;
 }
@@ -201,3 +209,21 @@
 
   refresh();
 }
+
+/**
+  User wants to edit requirements
+**/
+void effect_edit::edit_reqs()
+{
+  if (selected != nullptr) {
+char buf[128];
+req_edit *redit;
+
+fc_snprintf(buf, sizeof(buf), R__("%s effect #%d"), name.toUtf8().data(),
+selected_nbr);
+
+redit = new req_edit(ui, QString::fromUtf8(buf), >reqs);
+
+redit->show();
+  }
+}

Modified: trunk/tools/ruledit/effect_edit.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/effect_edit.h?rev=35528=35527=35528=diff
==
--- trunk/tools/ruledit/effect_edit.h   (original)
+++ trunk/tools/ruledit/effect_edit.h   Fri May 12 19:58:25 2017
@@ -51,17 +51,20 @@
   private:
 ruledit_gui *ui;
 
+QString name;
 QListWidget *list_widget;
 struct universal filter;
 struct effect_list *effects;
 
 struct effect *selected;
+int selected_nbr;
 
 QToolButton *edit_type_button;
 
   private slots:
 void select_effect();
 void fill_active();
+void edit_reqs();
 void close_now();
 
 void effect_type_menu(QAction *action);


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


[Freeciv-commits] r35527 - in /trunk: ai/default/ client/ client/gui-gtk-3.0/ client/gui-gtk-3.22/ client/gui-gtk-4.0/ client/gui-qt/ client/g...

2017-05-12 Thread cazfi74
Author: cazfi
Date: Fri May 12 17:28:13 2017
New Revision: 35527

URL: http://svn.gna.org/viewcvs/freeciv?rev=35527=rev
Log:
Give map parameter to map_pos_to_tile()

See hrm Feature #659205

Modified:
trunk/ai/default/aidiplomat.c
trunk/ai/default/aiferry.c
trunk/ai/default/aiparatrooper.c
trunk/ai/default/aisettler.c
trunk/ai/default/aitools.c
trunk/ai/default/aiunit.c
trunk/ai/default/daieffects.c
trunk/client/climap.c
trunk/client/climisc.c
trunk/client/control.c
trunk/client/editor.c
trunk/client/goto.c
trunk/client/gui-gtk-3.0/mapctrl.c
trunk/client/gui-gtk-3.22/mapctrl.c
trunk/client/gui-gtk-4.0/mapctrl.c
trunk/client/gui-qt/mapview.cpp
trunk/client/gui-qt/menu.cpp
trunk/client/gui-sdl2/dialogs.c
trunk/client/gui-sdl2/finddlg.c
trunk/client/gui-sdl2/mapctrl.c
trunk/client/mapctrl_common.c
trunk/client/mapview_common.c
trunk/client/mapview_common.h
trunk/client/overview_common.c
trunk/client/tilespec.c
trunk/common/actions.c
trunk/common/aicore/path_finding.c
trunk/common/aicore/pf_tools.c
trunk/common/base.c
trunk/common/city.c
trunk/common/combat.c
trunk/common/extras.c
trunk/common/featured_text.c
trunk/common/map.c
trunk/common/map.h
trunk/common/mapimg.c
trunk/common/metaknowledge.c
trunk/common/movement.c
trunk/common/requirements.c
trunk/common/road.c
trunk/common/scriptcore/api_game_find.c
trunk/common/scriptcore/api_game_methods.c
trunk/common/terrain.c
trunk/common/unit.c
trunk/server/advisors/advdata.c
trunk/server/advisors/advgoto.c
trunk/server/advisors/autoexplorer.c
trunk/server/advisors/autosettlers.c
trunk/server/animals.c
trunk/server/barbarian.c
trunk/server/citytools.c
trunk/server/cityturn.c
trunk/server/diplomats.c
trunk/server/edithand.c
trunk/server/gamehand.c
trunk/server/generator/fracture_map.c
trunk/server/generator/height_map.c
trunk/server/generator/mapgen.c
trunk/server/generator/mapgen_utils.c
trunk/server/generator/mapgen_utils.h
trunk/server/generator/startpos.c
trunk/server/generator/temperature_map.c
trunk/server/maphand.c
trunk/server/notify.c
trunk/server/plrhand.c
trunk/server/sanitycheck.c
trunk/server/savegame2.c
trunk/server/savegame3.c
trunk/server/srv_main.c
trunk/server/stdinhand.c
trunk/server/unithand.c
trunk/server/unittools.c

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

Modified: trunk/ai/default/aidiplomat.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aidiplomat.c?rev=35527=35526=35527=diff

Modified: trunk/ai/default/aiferry.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aiferry.c?rev=35527=35526=35527=diff

Modified: trunk/ai/default/aiparatrooper.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aiparatrooper.c?rev=35527=35526=35527=diff

Modified: trunk/ai/default/aisettler.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aisettler.c?rev=35527=35526=35527=diff

Modified: trunk/ai/default/aitools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aitools.c?rev=35527=35526=35527=diff

Modified: trunk/ai/default/aiunit.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aiunit.c?rev=35527=35526=35527=diff

Modified: trunk/ai/default/daieffects.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/daieffects.c?rev=35527=35526=35527=diff

Modified: trunk/client/climap.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/climap.c?rev=35527=35526=35527=diff

Modified: trunk/client/climisc.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/climisc.c?rev=35527=35526=35527=diff

Modified: trunk/client/control.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/control.c?rev=35527=35526=35527=diff

Modified: trunk/client/editor.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/editor.c?rev=35527=35526=35527=diff

Modified: trunk/client/goto.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/goto.c?rev=35527=35526=35527=diff

Modified: trunk/client/gui-gtk-3.0/mapctrl.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/mapctrl.c?rev=35527=35526=35527=diff

Modified: trunk/client/gui-gtk-3.22/mapctrl.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.22/mapctrl.c?rev=35527=35526=35527=diff

Modified: trunk/client/gui-gtk-4.0/mapctrl.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-4.0/mapctrl.c?rev=35527=35526=35527=diff

Modified: trunk/client/gui-qt/mapview.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=35527=35526=35527=diff

Modified: trunk/client/gui-qt/menu.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=35527=35526=35527=diff

Modified: trunk/client/gui-sdl2/dialogs.c
URL: 

[Freeciv-commits] r35513 - in /trunk/ai/tex: texaimsg.h texaiplayer.c texaiworld.c texaiworld.h threxprai.c

2017-05-11 Thread cazfi74
Author: cazfi
Date: Fri May 12 00:08:45 2017
New Revision: 35513

URL: http://svn.gna.org/viewcvs/freeciv?rev=35513=rev
Log:
Un/register cities to/from tex AI world

See hrm Feature #658468

Modified:
trunk/ai/tex/texaimsg.h
trunk/ai/tex/texaiplayer.c
trunk/ai/tex/texaiworld.c
trunk/ai/tex/texaiworld.h
trunk/ai/tex/threxprai.c

Modified: trunk/ai/tex/texaimsg.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/tex/texaimsg.h?rev=35513=35512=35513=diff
==
--- trunk/ai/tex/texaimsg.h (original)
+++ trunk/ai/tex/texaimsg.h Fri May 12 00:08:45 2017
@@ -26,6 +26,10 @@
 #define SPECENUM_VALUE4NAME "GameStart"
 #define SPECENUM_VALUE5 TEXAI_MSG_GAME_END
 #define SPECENUM_VALUE5NAME "GameEnd"
+#define SPECENUM_VALUE6 TEXAI_MSG_CITY_CREATED
+#define SPECENUM_VALUE6NAME "CityCreated"
+#define SPECENUM_VALUE7 TEXAI_MSG_CITY_DESTROYED
+#define SPECENUM_VALUE7NAME "CityDestroyed"
 #include "specenum_gen.h"
 
 #define SPECENUM_NAME texaireqtype

Modified: trunk/ai/tex/texaiplayer.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/tex/texaiplayer.c?rev=35513=35512=35513=diff
==
--- trunk/ai/tex/texaiplayer.c  (original)
+++ trunk/ai/tex/texaiplayer.c  Fri May 12 00:08:45 2017
@@ -178,6 +178,12 @@
 case TEXAI_MSG_TILE_INFO:
   texai_tile_info_recv(msg->data);
   break;
+case TEXAI_MSG_CITY_CREATED:
+  texai_city_info_recv(msg->data, msg->type);
+  break;
+case TEXAI_MSG_CITY_DESTROYED:
+  texai_city_destruction_recv(msg->data);
+  break;
 case TEXAI_MSG_PHASE_FINISHED:
   new_abort = TEXAI_ABORT_PHASE_END;
   break;

Modified: trunk/ai/tex/texaiworld.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/tex/texaiworld.c?rev=35513=35512=35513=diff
==
--- trunk/ai/tex/texaiworld.c   (original)
+++ trunk/ai/tex/texaiworld.c   Fri May 12 00:08:45 2017
@@ -32,6 +32,18 @@
   int index;
   struct terrain *terrain;
   bv_extras extras;
+};
+
+struct texai_city_info_msg
+{
+  int id;
+  int owner;
+  int tindex;
+};
+
+struct texai_city_id_msg
+{
+  int id;
 };
 
 /**
@@ -86,3 +98,74 @@
 
   free(info);
 }
+
+/**
+  Send city information to the thread.
+**/
+static void texai_city_update(struct city *pcity, enum texaireqtype msgtype)
+{
+  struct texai_city_info_msg *info
+= fc_malloc(sizeof(struct texai_city_info_msg));
+
+  info->id = pcity->id;
+  info->owner = player_number(city_owner(pcity));
+  info->tindex = tile_index(city_tile(pcity));
+
+  texai_send_msg(msgtype, NULL, info);
+}
+
+/**
+  New city has been added to the main map.
+**/
+void texai_city_created(struct city *pcity)
+{
+  if (texai_thread_running()) {
+texai_city_update(pcity, TEXAI_MSG_CITY_CREATED);
+  }
+}
+
+/**
+  Receive city update to the thread.
+**/
+void texai_city_info_recv(void *data, enum texaimsgtype msgtype)
+{
+  struct texai_city_info_msg *info = (struct texai_city_info_msg *)data;
+  struct city *pcity;
+  struct player *pplayer = player_by_number(info->owner);
+
+  if (msgtype == TEXAI_MSG_CITY_CREATED) {
+struct tile *ptile = index_to_tile(&(texai_world.map), info->tindex);
+
+pcity = create_city_virtual(pplayer, ptile, "");
+pcity->id = info->id;
+
+idex_register_city(_world, pcity);
+  } else {
+pcity = idex_lookup_city(_world, info->id);
+  }
+}
+  
+/**
+  City has been removed from the main map.
+**/
+void texai_city_destroyed(struct city *pcity)
+{
+  if (texai_thread_running()) {
+struct texai_city_id_msg *info = fc_malloc(sizeof(struct 
texai_city_id_msg));
+
+info->id = pcity->id;
+
+texai_send_msg(TEXAI_MSG_CITY_DESTROYED, NULL, info);
+  }
+}
+
+/**
+  Receive city destruction to the thread.
+**/
+void texai_city_destruction_recv(void *data)
+{
+  struct texai_city_id_msg *info = (struct texai_city_id_msg *)data;
+  struct city *pcity = idex_lookup_city(_world, info->id);
+
+  idex_unregister_city(_world, pcity);
+}

Modified: trunk/ai/tex/texaiworld.h
URL: 

[Freeciv-commits] r35511 - in /trunk/data/sandbox: README.sandbox terrain.ruleset

2017-05-11 Thread cazfi74
Author: cazfi
Date: Thu May 11 23:03:46 2017
New Revision: 35511

URL: http://svn.gna.org/viewcvs/freeciv?rev=35511=rev
Log:
sandbox: Make Buoys visible only to those player who know Radio

See hrm Feature #658922

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=35511=35510=35511=diff
==
--- trunk/data/sandbox/README.sandbox   (original)
+++ trunk/data/sandbox/README.sandbox   Thu May 11 23:03:46 2017
@@ -99,3 +99,7 @@
 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.
+
+Buoys visible only once Radio known:
+One can see Buoys only when one knows Radio. The leading player
+may build Buoys that others can't yet see.

Modified: trunk/data/sandbox/terrain.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/sandbox/terrain.ruleset?rev=35511=35510=35511=diff
==
--- trunk/data/sandbox/terrain.ruleset  (original)
+++ trunk/data/sandbox/terrain.ruleset  Thu May 11 23:03:46 2017
@@ -1493,11 +1493,15 @@
   "UnitFlag", "Airbase", "Local", TRUE
   "CityTile", "Center", "Local", FALSE
 }
+visibility_req = "Radio"
 build_time = 3
 removal_time   = 0
 flags  = "ShowFlag"
 helptext   = _("\
 Buoys may be built in the ocean (by units on a sea-going vessel).\
+"), _("\
+Only those players that already know Radio can see Buoys of any \
+players.\
 ")
 
 [extra_ruins]


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


[Freeciv-commits] r35512 - in /branches/S3_0/data/sandbox: README.sandbox terrain.ruleset

2017-05-11 Thread cazfi74
Author: cazfi
Date: Thu May 11 23:03:52 2017
New Revision: 35512

URL: http://svn.gna.org/viewcvs/freeciv?rev=35512=rev
Log:
sandbox: Make Buoys visible only to those player who know Radio

See hrm Feature #658922

Modified:
branches/S3_0/data/sandbox/README.sandbox
branches/S3_0/data/sandbox/terrain.ruleset

Modified: branches/S3_0/data/sandbox/README.sandbox
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/sandbox/README.sandbox?rev=35512=35511=35512=diff
==
--- branches/S3_0/data/sandbox/README.sandbox   (original)
+++ branches/S3_0/data/sandbox/README.sandbox   Thu May 11 23:03:52 2017
@@ -99,3 +99,7 @@
 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.
+
+Buoys visible only once Radio known:
+One can see Buoys only when one knows Radio. The leading player
+may build Buoys that others can't yet see.

Modified: branches/S3_0/data/sandbox/terrain.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/sandbox/terrain.ruleset?rev=35512=35511=35512=diff
==
--- branches/S3_0/data/sandbox/terrain.ruleset  (original)
+++ branches/S3_0/data/sandbox/terrain.ruleset  Thu May 11 23:03:52 2017
@@ -1493,11 +1493,15 @@
   "UnitFlag", "Airbase", "Local", TRUE
   "CityTile", "Center", "Local", FALSE
 }
+visibility_req = "Radio"
 build_time = 3
 removal_time   = 0
 flags  = "ShowFlag"
 helptext   = _("\
 Buoys may be built in the ocean (by units on a sea-going vessel).\
+"), _("\
+Only those players that already know Radio can see Buoys of any \
+players.\
 ")
 
 [extra_ruins]


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


[Freeciv-commits] r35509 - in /trunk: ai/Makefile.am ai/tex/Makefile.am ai/tex/threxprai.c configure.ac server/Makefile.am server/aiiface.c

2017-05-11 Thread cazfi74
Author: cazfi
Date: Thu May 11 22:05:06 2017
New Revision: 35509

URL: http://svn.gna.org/viewcvs/freeciv?rev=35509=rev
Log:
Rename threxpr AI module as tex

See hrm Feature #658487

Modified:
trunk/ai/Makefile.am
trunk/ai/tex/Makefile.am
trunk/ai/tex/threxprai.c
trunk/configure.ac
trunk/server/Makefile.am
trunk/server/aiiface.c

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

Modified: trunk/ai/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/Makefile.am?rev=35509=35508=35509=diff

Modified: trunk/ai/tex/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/tex/Makefile.am?rev=35509=35508=35509=diff

Modified: trunk/ai/tex/threxprai.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/tex/threxprai.c?rev=35509=35508=35509=diff

Modified: trunk/configure.ac
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/configure.ac?rev=35509=35508=35509=diff

Modified: trunk/server/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/Makefile.am?rev=35509=35508=35509=diff

Modified: trunk/server/aiiface.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/aiiface.c?rev=35509=35508=35509=diff


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


[Freeciv-commits] r35510 - in /branches/S3_0: ./ ai/ ai/tex/ server/

2017-05-11 Thread cazfi74
Author: cazfi
Date: Thu May 11 22:05:15 2017
New Revision: 35510

URL: http://svn.gna.org/viewcvs/freeciv?rev=35510=rev
Log:
Rename threxpr AI module as tex

See hrm Feature #658487

Modified:
branches/S3_0/ai/Makefile.am
branches/S3_0/ai/tex/Makefile.am
branches/S3_0/ai/tex/threxprai.c
branches/S3_0/configure.ac
branches/S3_0/server/Makefile.am
branches/S3_0/server/aiiface.c

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

Modified: branches/S3_0/ai/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/Makefile.am?rev=35510=35509=35510=diff

Modified: branches/S3_0/ai/tex/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/tex/Makefile.am?rev=35510=35509=35510=diff

Modified: branches/S3_0/ai/tex/threxprai.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/tex/threxprai.c?rev=35510=35509=35510=diff

Modified: branches/S3_0/configure.ac
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/configure.ac?rev=35510=35509=35510=diff

Modified: branches/S3_0/server/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/Makefile.am?rev=35510=35509=35510=diff

Modified: branches/S3_0/server/aiiface.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/aiiface.c?rev=35510=35509=35510=diff


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


[Freeciv-commits] r35508 - /branches/S3_0/ai/default/aitech.c

2017-05-11 Thread cazfi74
Author: cazfi
Date: Thu May 11 16:15:30 2017
New Revision: 35508

URL: http://svn.gna.org/viewcvs/freeciv?rev=35508=rev
Log:
Restore global_advance_count after AI tech speculation

Reported by wotan 

See gna bug #24992

Modified:
branches/S3_0/ai/default/aitech.c

Modified: branches/S3_0/ai/default/aitech.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/ai/default/aitech.c?rev=35508=35507=35508=diff
==
--- branches/S3_0/ai/default/aitech.c   (original)
+++ branches/S3_0/ai/default/aitech.c   Thu May 11 16:15:30 2017
@@ -213,6 +213,7 @@
   adv_want orig_want = dai_city_want(pplayer, pcity, adv, NULL);
   adv_want final_want;
   bool world_knew = game.info.global_advances[tech];
+  int world_count = game.info.global_advance_count;
 
   research_invention_set(pres, tech, TECH_KNOWN);
 
@@ -220,6 +221,7 @@
 
   research_invention_set(pres, tech, old_state);
   game.info.global_advances[tech] = world_knew;
+  game.info.global_advance_count = world_count;
 
   return final_want - orig_want;
 }


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


[Freeciv-commits] r35507 - /trunk/ai/default/aitech.c

2017-05-11 Thread cazfi74
Author: cazfi
Date: Thu May 11 16:15:22 2017
New Revision: 35507

URL: http://svn.gna.org/viewcvs/freeciv?rev=35507=rev
Log:
Restore global_advance_count after AI tech speculation

Reported by wotan 

See gna bug #24992

Modified:
trunk/ai/default/aitech.c

Modified: trunk/ai/default/aitech.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aitech.c?rev=35507=35506=35507=diff
==
--- trunk/ai/default/aitech.c   (original)
+++ trunk/ai/default/aitech.c   Thu May 11 16:15:22 2017
@@ -213,6 +213,7 @@
   adv_want orig_want = dai_city_want(pplayer, pcity, adv, NULL);
   adv_want final_want;
   bool world_knew = game.info.global_advances[tech];
+  int world_count = game.info.global_advance_count;
 
   research_invention_set(pres, tech, TECH_KNOWN);
 
@@ -220,6 +221,7 @@
 
   research_invention_set(pres, tech, old_state);
   game.info.global_advances[tech] = world_knew;
+  game.info.global_advance_count = world_count;
 
   return final_want - orig_want;
 }


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


[Freeciv-commits] r35498 - /branches/S3_0/tools/ruledit/validity.c

2017-05-10 Thread cazfi74
Author: cazfi
Date: Wed May 10 21:14:51 2017
New Revision: 35498

URL: http://svn.gna.org/viewcvs/freeciv?rev=35498=rev
Log:
Consider extra, that is visibility_req of another one, needed

See hrm Bug #658575

Modified:
branches/S3_0/tools/ruledit/validity.c

Modified: branches/S3_0/tools/ruledit/validity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/tools/ruledit/validity.c?rev=35498=35497=35498=diff
==
--- branches/S3_0/tools/ruledit/validity.c  (original)
+++ branches/S3_0/tools/ruledit/validity.c  Wed May 10 21:14:51 2017
@@ -190,6 +190,16 @@
 }
   } unit_type_iterate_end;
 
+  extra_type_iterate(pextra) {
+if (pextra->visibility_req == advance_number(padv)) {
+  char buf[512];
+
+  fc_snprintf(buf, sizeof(buf), "%s visibility",
+  extra_rule_name(pextra));
+  cb(buf, data);
+}
+  } extra_type_iterate_end;
+
   needed |= is_universal_needed(, cb, data);
 
   return needed;


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


[Freeciv-commits] r35497 - /trunk/tools/ruledit/validity.c

2017-05-10 Thread cazfi74
Author: cazfi
Date: Wed May 10 21:14:43 2017
New Revision: 35497

URL: http://svn.gna.org/viewcvs/freeciv?rev=35497=rev
Log:
Consider extra, that is visibility_req of another one, needed

See hrm Bug #658575

Modified:
trunk/tools/ruledit/validity.c

Modified: trunk/tools/ruledit/validity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/validity.c?rev=35497=35496=35497=diff
==
--- trunk/tools/ruledit/validity.c  (original)
+++ trunk/tools/ruledit/validity.c  Wed May 10 21:14:43 2017
@@ -190,6 +190,16 @@
 }
   } unit_type_iterate_end;
 
+  extra_type_iterate(pextra) {
+if (pextra->visibility_req == advance_number(padv)) {
+  char buf[512];
+
+  fc_snprintf(buf, sizeof(buf), "%s visibility",
+  extra_rule_name(pextra));
+  cb(buf, data);
+}
+  } extra_type_iterate_end;
+
   needed |= is_universal_needed(, cb, data);
 
   return needed;


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


[Freeciv-commits] r35496 - /trunk/tools/ruledit/

2017-05-10 Thread cazfi74
Author: cazfi
Date: Wed May 10 18:55:59 2017
New Revision: 35496

URL: http://svn.gna.org/viewcvs/freeciv?rev=35496=rev
Log:
Add initial version of effect edit dialog to ruledit

See hrm Feature #658566

Added:
trunk/tools/ruledit/effect_edit.cpp
trunk/tools/ruledit/effect_edit.h
Modified:
trunk/tools/ruledit/Makefile.am
trunk/tools/ruledit/tab_building.cpp
trunk/tools/ruledit/tab_building.h
trunk/tools/ruledit/validity.c
trunk/tools/ruledit/validity.h

Modified: trunk/tools/ruledit/Makefile.am
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/Makefile.am?rev=35496=35495=35496=diff
==
--- trunk/tools/ruledit/Makefile.am (original)
+++ trunk/tools/ruledit/Makefile.am Wed May 10 18:55:59 2017
@@ -25,6 +25,7 @@
 
 MOC_FILES = \
 meta_edit_utype.cpp \
+   meta_effect_edit.cpp \
meta_req_edit.cpp   \
 meta_requirers_dlg.cpp \
 meta_ruledit_qt.cpp \
@@ -42,6 +43,8 @@
 freeciv_ruledit_SOURCES =  \
edit_utype.cpp  \
edit_utype.h\
+   effect_edit.cpp \
+   effect_edit.h   \
tab_building.cpp \
tab_building.h  \
tab_enablers.cpp \

Added: trunk/tools/ruledit/effect_edit.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/effect_edit.cpp?rev=35496=auto
==
--- trunk/tools/ruledit/effect_edit.cpp (added)
+++ trunk/tools/ruledit/effect_edit.cpp Wed May 10 18:55:59 2017
@@ -0,0 +1,203 @@
+/***
+ 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
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include 
+#endif
+
+// Qt
+#include 
+#include 
+#include 
+#include 
+#include 
+
+// utility
+#include "fcintl.h"
+
+// common
+#include "effects.h"
+
+// ruledit
+#include "ruledit.h"
+#include "validity.h"
+
+#include "effect_edit.h"
+
+/**
+  Setup effect_edit object
+**/
+effect_edit::effect_edit(ruledit_gui *ui_in, QString target,
+ struct universal *filter_in) : QDialog()
+{
+  QVBoxLayout *main_layout = new QVBoxLayout(this);
+  QGridLayout *effect_edit_layout = new QGridLayout();
+  QHBoxLayout *active_layout = new QHBoxLayout();
+  QPushButton *close_button;
+  QMenu *menu;
+  QLabel *lbl;
+  enum effect_type eff;
+
+  ui = ui_in;
+  selected = nullptr;
+  filter = *filter_in;
+
+  list_widget = new QListWidget(this);
+  effects = effect_list_new();
+
+  connect(list_widget, SIGNAL(itemSelectionChanged()), this, 
SLOT(select_effect()));
+  main_layout->addWidget(list_widget);
+
+  lbl = new QLabel(R__("Type:"));
+  active_layout->addWidget(lbl, 0, 0);
+  edit_type_button = new QToolButton();
+  menu = new QMenu();
+  edit_type_button->setToolButtonStyle(Qt::ToolButtonTextOnly);
+  edit_type_button->setPopupMode(QToolButton::MenuButtonPopup);
+  connect(menu, SIGNAL(triggered(QAction *)), this, 
SLOT(effect_type_menu(QAction *)));
+  edit_type_button->setMenu(menu);
+  for (eff = (enum effect_type)0; eff < EFT_COUNT;
+   eff = (enum effect_type)(eff + 1)) {
+menu->addAction(effect_type_name(eff));
+  }
+  active_layout->addWidget(edit_type_button, 1, 0);
+
+  main_layout->addLayout(active_layout);
+
+  close_button = new QPushButton(QString::fromUtf8(R__("Close")), this);
+  connect(close_button, SIGNAL(pressed()), this, SLOT(close_now()));
+  effect_edit_layout->addWidget(close_button, 0, 0);
+
+  refresh();
+
+  main_layout->addLayout(effect_edit_layout);
+
+  setLayout(main_layout);
+  setWindowTitle(target);
+}
+
+/**
+  Effect edit destructor
+**/
+effect_edit::~effect_edit()
+{
+  effect_list_destroy(effects);
+}
+
+/**
+  Callback to fill effects list from iterate_effect_cache()
+**/
+static bool effect_list_fill_cb(struct effect *peffect, void *data)
+{
+  struct 

  1   2   3   4   5   6   7   8   9   10   >