[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] r35506 - in /branches/S3_0/tools: ruleup.c ruleutil/rulesave.c

2017-05-11 Thread sveinung84
Author: sveinung
Date: Thu May 11 13:07:04 2017
New Revision: 35506

URL: http://svn.gna.org/viewcvs/freeciv?rev=35506=rev
Log:
Comment fact fix

Modified:
branches/S3_0/tools/ruleup.c
branches/S3_0/tools/ruleutil/rulesave.c

Modified: branches/S3_0/tools/ruleup.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/tools/ruleup.c?rev=35506=35505=35506=diff
==
--- branches/S3_0/tools/ruleup.c(original)
+++ branches/S3_0/tools/ruleup.cThu May 11 13:07:04 2017
@@ -34,7 +34,7 @@
 #include "sernet.h"
 #include "settings.h"
 
-/* tools/ruledit */
+/* tools/ruleutil */
 #include "comments.h"
 #include "rulesave.h"
 

Modified: branches/S3_0/tools/ruleutil/rulesave.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/tools/ruleutil/rulesave.c?rev=35506=35505=35506=diff
==
--- branches/S3_0/tools/ruleutil/rulesave.c (original)
+++ branches/S3_0/tools/ruleutil/rulesave.c Thu May 11 13:07:04 2017
@@ -35,7 +35,7 @@
 #include "ruleset.h"
 #include "settings.h"
 
-/* tools/ruledit */
+/* tools/ruleutil */
 #include "comments.h"
 
 #include "rulesave.h"


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


[Freeciv-commits] r35505 - in /trunk/tools: ruleup.c ruleutil/rulesave.c

2017-05-11 Thread sveinung84
Author: sveinung
Date: Thu May 11 13:06:34 2017
New Revision: 35505

URL: http://svn.gna.org/viewcvs/freeciv?rev=35505=rev
Log:
Comment fact fix

Modified:
trunk/tools/ruleup.c
trunk/tools/ruleutil/rulesave.c

Modified: trunk/tools/ruleup.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruleup.c?rev=35505=35504=35505=diff
==
--- trunk/tools/ruleup.c(original)
+++ trunk/tools/ruleup.cThu May 11 13:06:34 2017
@@ -34,7 +34,7 @@
 #include "sernet.h"
 #include "settings.h"
 
-/* tools/ruledit */
+/* tools/ruleutil */
 #include "comments.h"
 #include "rulesave.h"
 

Modified: trunk/tools/ruleutil/rulesave.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruleutil/rulesave.c?rev=35505=35504=35505=diff
==
--- trunk/tools/ruleutil/rulesave.c (original)
+++ trunk/tools/ruleutil/rulesave.c Thu May 11 13:06:34 2017
@@ -35,7 +35,7 @@
 #include "ruleset.h"
 #include "settings.h"
 
-/* tools/ruledit */
+/* tools/ruleutil */
 #include "comments.h"
 
 #include "rulesave.h"


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


[Freeciv-commits] r35504 - in /branches/S3_0/data/webperimental: buildings.ruleset effects.ruleset game.ruleset

2017-05-11 Thread sveinung84
Author: sveinung
Date: Thu May 11 08:26:40 2017
New Revision: 35504

URL: http://svn.gna.org/viewcvs/freeciv?rev=35504=rev
Log:
webperimental: ally share J.S. Bach's Cathedral.

Apply J.S. Bach's Cathedral's happiness to allies of its owner too.

See hrm Feature #658833

Modified:
branches/S3_0/data/webperimental/buildings.ruleset
branches/S3_0/data/webperimental/effects.ruleset
branches/S3_0/data/webperimental/game.ruleset

Modified: branches/S3_0/data/webperimental/buildings.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/webperimental/buildings.ruleset?rev=35504=35503=35504=diff
==
--- branches/S3_0/data/webperimental/buildings.ruleset  (original)
+++ branches/S3_0/data/webperimental/buildings.ruleset  Thu May 11 08:26:40 2017
@@ -1428,8 +1428,8 @@
 sound  = "w_js_bachs_cathedral"
 sound_alt  = "w_generic"
 helptext   = _("\
-Makes two unhappy citizens content in every city (including citizens\
- unhappy about military activity).\
+Makes two unhappy citizens content in every city belonging to you or to \
+your allies (including citizens unhappy about military activity).\
 ")
 
 [building_king_richards_crusade]

Modified: branches/S3_0/data/webperimental/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/webperimental/effects.ruleset?rev=35504=35503=35504=diff
==
--- branches/S3_0/data/webperimental/effects.ruleset(original)
+++ branches/S3_0/data/webperimental/effects.rulesetThu May 11 08:26:40 2017
@@ -1959,7 +1959,7 @@
 value  = 2
 reqs   =
 { "type", "name", "range"
-  "Building", "J.S. Bach's Cathedral", "Player"
+  "Building", "J.S. Bach's Cathedral", "Alliance"
 }
 
 [effect_king_richards_crusade]

Modified: branches/S3_0/data/webperimental/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/data/webperimental/game.ruleset?rev=35504=35503=35504=diff
==
--- branches/S3_0/data/webperimental/game.ruleset   (original)
+++ branches/S3_0/data/webperimental/game.ruleset   Thu May 11 08:26:40 2017
@@ -95,6 +95,8 @@
   - Caravan and Freight can help allies to complete wonders.\n\
   - Sun Tzu's War Academy gives its veteran bonus (combat and production) \
 to both its owner and to all his allies.\n\
+  - J.S. Bach's Cathedral makes two unhappy citizens content in allied \
+cities too.\n\
 \n\
 This ruleset is still in development. If playing it makes you think that \
 a rule should change go to the Freeciv-web board at \


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


[Freeciv-commits] r35503 - in /branches/S3_0: client/helpdata.c common/unittype.c server/actiontools.c server/unithand.c

2017-05-11 Thread sveinung84
Author: sveinung
Date: Thu May 11 08:26:31 2017
New Revision: 35503

URL: http://svn.gna.org/viewcvs/freeciv?rev=35503=rev
Log:
Missile consumption: use action shared system.

Have the attack action use the shared action system when consuming units
with the Missile unit class flag.

This replaces the custom auto help for the Missile unit class flag.

See hrm Feature #657680

Modified:
branches/S3_0/client/helpdata.c
branches/S3_0/common/unittype.c
branches/S3_0/server/actiontools.c
branches/S3_0/server/unithand.c

Modified: branches/S3_0/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/client/helpdata.c?rev=35503=35502=35503=diff
==
--- branches/S3_0/client/helpdata.c (original)
+++ branches/S3_0/client/helpdata.c Thu May 11 08:26:31 2017
@@ -1578,9 +1578,6 @@
   if (uclass_has_flag(pclass, UCF_DAMAGE_SLOWS)) {
 CATLSTR(buf, bufsz, _("  * Slowed down while damaged.\n"));
   }
-  if (uclass_has_flag(pclass, UCF_MISSILE)) {
-CATLSTR(buf, bufsz, _("  * Gets used up in making an attack.\n"));
-  }
   if (uclass_has_flag(pclass, UCF_CAN_FORTIFY)
   && !utype_has_flag(utype, UTYF_CANT_FORTIFY)) {
 if (utype->defense_strength > 0) {
@@ -2080,7 +2077,7 @@
 _("* Won't lose all movement when moving from non-native "
   "terrain to native terrain.\n"));
   }
-  if (!uclass_has_flag(utype_class(utype), UCF_MISSILE)
+  if (!utype_is_consumed_by_action(action_by_number(ACTION_ATTACK), utype)
   && utype_has_flag(utype, UTYF_ONEATTACK)) {
 CATLSTR(buf, bufsz,
_("* Making an attack ends this unit's turn.\n"));
@@ -2472,7 +2469,8 @@
 /* Some units can never become veteran through combat in practice. */
 bool veteran_through_combat =
   !((!utype_can_do_action(utype, ACTION_ATTACK)
- || uclass_has_flag(utype_class(utype), UCF_MISSILE))
+ || utype_is_consumed_by_action(action_by_number(ACTION_ATTACK),
+utype))
 && utype->defense_strength == 0);
 #endif
 /* FIXME: if we knew the raise chances on the client, we could be

Modified: branches/S3_0/common/unittype.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/common/unittype.c?rev=35503=35502=35503=diff
==
--- branches/S3_0/common/unittype.c (original)
+++ branches/S3_0/common/unittype.c Thu May 11 08:26:31 2017
@@ -871,6 +871,8 @@
   case ACTION_SPY_NUKE:
 /* A Spy has a chance to escape after performing the action. */
 return !utype_has_flag(utype, UTYF_SPY);
+  case ACTION_ATTACK:
+return uclass_has_flag(utype->uclass, UCF_MISSILE);
   default:
 return FALSE;
   }

Modified: branches/S3_0/server/actiontools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/actiontools.c?rev=35503=35502=35503=diff
==
--- branches/S3_0/server/actiontools.c  (original)
+++ branches/S3_0/server/actiontools.c  Thu May 11 08:26:31 2017
@@ -47,6 +47,8 @@
   wipe_unit(actor, ULR_DISBANDED, NULL);
 } else if (action_has_result(paction, ACTION_NUKE)) {
   wipe_unit(actor, ULR_DETONATED, NULL);
+} else if (action_has_result(paction, ACTION_ATTACK)) {
+  wipe_unit(actor, ULR_MISSILE, NULL);
 } else {
   wipe_unit(actor, ULR_USED, NULL);
 }

Modified: branches/S3_0/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/unithand.c?rev=35503=35502=35503=diff
==
--- branches/S3_0/server/unithand.c (original)
+++ branches/S3_0/server/unithand.c Thu May 11 08:26:31 2017
@@ -133,7 +133,8 @@
 static bool do_unit_upgrade(struct player *pplayer,
 struct unit *punit, struct city *pcity,
 enum action_requester ordered_by);
-static bool do_attack(struct unit *actor_unit, struct tile *target_tile);
+static bool do_attack(struct unit *actor_unit, struct tile *target_tile,
+  const struct action *paction);
 static bool do_unit_conquer_city(struct player *act_player,
  struct unit *act_unit,
  struct city *tgt_city,
@@ -2503,7 +2504,7 @@
 break;
   case ACTION_ATTACK:
 ACTION_STARTED_UNIT_TILE(action_type, actor_unit, target_tile,
- do_attack(actor_unit, target_tile));
+ do_attack(actor_unit, target_tile, paction));
 break;
   case ACTION_COUNT:
 log_error("handle_unit_do_action() %s (%d) ordered to perform an "
@@ -3290,7 +3291,8 @@
   Returns TRUE iff action could be done, FALSE if it couldn't. Even if
   this returns TRUE, unit may have died during the action.
 

[Freeciv-commits] r35502 - in /branches/S3_0/server: citytools.c plrhand.c

2017-05-11 Thread sveinung84
Author: sveinung
Date: Thu May 11 08:26:13 2017
New Revision: 35502

URL: http://svn.gna.org/viewcvs/freeciv?rev=35502=rev
Log:
Fix trade route memory leak.

Free the memory of the trade route structs canceled by the destruction of a
city or player.

Reported by Valgrind.

See hrm Bug #658824

Modified:
branches/S3_0/server/citytools.c
branches/S3_0/server/plrhand.c

Modified: branches/S3_0/server/citytools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/citytools.c?rev=35502=35501=35502=diff
==
--- branches/S3_0/server/citytools.c(original)
+++ branches/S3_0/server/citytools.cThu May 11 08:26:13 2017
@@ -1743,7 +1743,11 @@
   }
 
   trade_routes_iterate_safe(pcity, proute) {
-remove_trade_route(pcity, proute, TRUE, TRUE);
+struct  trade_route *pback = remove_trade_route(pcity, proute,
+TRUE, TRUE);
+
+FC_FREE(proute);
+FC_FREE(pback);
   } trade_routes_iterate_safe_end;
 
   map_clear_border(pcenter);

Modified: branches/S3_0/server/plrhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/plrhand.c?rev=35502=35501=35502=diff
==
--- branches/S3_0/server/plrhand.c  (original)
+++ branches/S3_0/server/plrhand.c  Thu May 11 08:26:13 2017
@@ -1714,7 +1714,11 @@
* to point to a city removed by player_clear() */
   city_list_iterate(pplayer->cities, pcity) {
 trade_routes_iterate_safe(pcity, proute) {
-  remove_trade_route(pcity, proute, TRUE, TRUE);
+  struct  trade_route *pback = remove_trade_route(pcity, proute,
+  TRUE, TRUE);
+
+  FC_FREE(proute);
+  FC_FREE(pback);
 } trade_routes_iterate_safe_end;
   } city_list_iterate_end;
 


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


[Freeciv-commits] r35499 - in /trunk/server: citytools.c plrhand.c

2017-05-11 Thread sveinung84
Author: sveinung
Date: Thu May 11 08:25:25 2017
New Revision: 35499

URL: http://svn.gna.org/viewcvs/freeciv?rev=35499=rev
Log:
Fix trade route memory leak.

Free the memory of the trade route structs canceled by the destruction of a
city or player.

Reported by Valgrind.

See hrm Bug #658824

Modified:
trunk/server/citytools.c
trunk/server/plrhand.c

Modified: trunk/server/citytools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/citytools.c?rev=35499=35498=35499=diff
==
--- trunk/server/citytools.c(original)
+++ trunk/server/citytools.cThu May 11 08:25:25 2017
@@ -1743,7 +1743,11 @@
   }
 
   trade_routes_iterate_safe(pcity, proute) {
-remove_trade_route(pcity, proute, TRUE, TRUE);
+struct  trade_route *pback = remove_trade_route(pcity, proute,
+TRUE, TRUE);
+
+FC_FREE(proute);
+FC_FREE(pback);
   } trade_routes_iterate_safe_end;
 
   map_clear_border(pcenter);

Modified: trunk/server/plrhand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/plrhand.c?rev=35499=35498=35499=diff
==
--- trunk/server/plrhand.c  (original)
+++ trunk/server/plrhand.c  Thu May 11 08:25:25 2017
@@ -1714,7 +1714,11 @@
* to point to a city removed by player_clear() */
   city_list_iterate(pplayer->cities, pcity) {
 trade_routes_iterate_safe(pcity, proute) {
-  remove_trade_route(pcity, proute, TRUE, TRUE);
+  struct  trade_route *pback = remove_trade_route(pcity, proute,
+  TRUE, TRUE);
+
+  FC_FREE(proute);
+  FC_FREE(pback);
 } trade_routes_iterate_safe_end;
   } city_list_iterate_end;
 


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


[Freeciv-commits] r35500 - in /trunk: client/helpdata.c common/unittype.c server/actiontools.c server/unithand.c

2017-05-11 Thread sveinung84
Author: sveinung
Date: Thu May 11 08:25:37 2017
New Revision: 35500

URL: http://svn.gna.org/viewcvs/freeciv?rev=35500=rev
Log:
Missile consumption: use action shared system.

Have the attack action use the shared action system when consuming units
with the Missile unit class flag.

This replaces the custom auto help for the Missile unit class flag.

See hrm Feature #657680

Modified:
trunk/client/helpdata.c
trunk/common/unittype.c
trunk/server/actiontools.c
trunk/server/unithand.c

Modified: trunk/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/helpdata.c?rev=35500=35499=35500=diff
==
--- trunk/client/helpdata.c (original)
+++ trunk/client/helpdata.c Thu May 11 08:25:37 2017
@@ -1578,9 +1578,6 @@
   if (uclass_has_flag(pclass, UCF_DAMAGE_SLOWS)) {
 CATLSTR(buf, bufsz, _("  * Slowed down while damaged.\n"));
   }
-  if (uclass_has_flag(pclass, UCF_MISSILE)) {
-CATLSTR(buf, bufsz, _("  * Gets used up in making an attack.\n"));
-  }
   if (uclass_has_flag(pclass, UCF_CAN_FORTIFY)
   && !utype_has_flag(utype, UTYF_CANT_FORTIFY)) {
 if (utype->defense_strength > 0) {
@@ -2080,7 +2077,7 @@
 _("* Won't lose all movement when moving from non-native "
   "terrain to native terrain.\n"));
   }
-  if (!uclass_has_flag(utype_class(utype), UCF_MISSILE)
+  if (!utype_is_consumed_by_action(action_by_number(ACTION_ATTACK), utype)
   && utype_has_flag(utype, UTYF_ONEATTACK)) {
 CATLSTR(buf, bufsz,
_("* Making an attack ends this unit's turn.\n"));
@@ -2472,7 +2469,8 @@
 /* Some units can never become veteran through combat in practice. */
 bool veteran_through_combat =
   !((!utype_can_do_action(utype, ACTION_ATTACK)
- || uclass_has_flag(utype_class(utype), UCF_MISSILE))
+ || utype_is_consumed_by_action(action_by_number(ACTION_ATTACK),
+utype))
 && utype->defense_strength == 0);
 #endif
 /* FIXME: if we knew the raise chances on the client, we could be

Modified: trunk/common/unittype.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/unittype.c?rev=35500=35499=35500=diff
==
--- trunk/common/unittype.c (original)
+++ trunk/common/unittype.c Thu May 11 08:25:37 2017
@@ -871,6 +871,8 @@
   case ACTION_SPY_NUKE:
 /* A Spy has a chance to escape after performing the action. */
 return !utype_has_flag(utype, UTYF_SPY);
+  case ACTION_ATTACK:
+return uclass_has_flag(utype->uclass, UCF_MISSILE);
   default:
 return FALSE;
   }

Modified: trunk/server/actiontools.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/actiontools.c?rev=35500=35499=35500=diff
==
--- trunk/server/actiontools.c  (original)
+++ trunk/server/actiontools.c  Thu May 11 08:25:37 2017
@@ -47,6 +47,8 @@
   wipe_unit(actor, ULR_DISBANDED, NULL);
 } else if (action_has_result(paction, ACTION_NUKE)) {
   wipe_unit(actor, ULR_DETONATED, NULL);
+} else if (action_has_result(paction, ACTION_ATTACK)) {
+  wipe_unit(actor, ULR_MISSILE, NULL);
 } else {
   wipe_unit(actor, ULR_USED, NULL);
 }

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=35500=35499=35500=diff
==
--- trunk/server/unithand.c (original)
+++ trunk/server/unithand.c Thu May 11 08:25:37 2017
@@ -133,7 +133,8 @@
 static bool do_unit_upgrade(struct player *pplayer,
 struct unit *punit, struct city *pcity,
 enum action_requester ordered_by);
-static bool do_attack(struct unit *actor_unit, struct tile *target_tile);
+static bool do_attack(struct unit *actor_unit, struct tile *target_tile,
+  const struct action *paction);
 static bool do_unit_conquer_city(struct player *act_player,
  struct unit *act_unit,
  struct city *tgt_city,
@@ -2503,7 +2504,7 @@
 break;
   case ACTION_ATTACK:
 ACTION_STARTED_UNIT_TILE(action_type, actor_unit, target_tile,
- do_attack(actor_unit, target_tile));
+ do_attack(actor_unit, target_tile, paction));
 break;
   case ACTION_COUNT:
 log_error("handle_unit_do_action() %s (%d) ordered to perform an "
@@ -3290,7 +3291,8 @@
   Returns TRUE iff action could be done, FALSE if it couldn't. Even if
   this returns TRUE, unit may have died during the action.
 **/
-static bool do_attack(struct unit *punit, struct tile *def_tile)
+static bool do_attack(struct unit *punit, struct tile *def_tile,
+

[Freeciv-commits] r35501 - in /trunk/data/webperimental: buildings.ruleset effects.ruleset game.ruleset

2017-05-11 Thread sveinung84
Author: sveinung
Date: Thu May 11 08:25:46 2017
New Revision: 35501

URL: http://svn.gna.org/viewcvs/freeciv?rev=35501=rev
Log:
webperimental: ally share J.S. Bach's Cathedral.

Apply J.S. Bach's Cathedral's happiness to allies of its owner too.

See hrm Feature #658833

Modified:
trunk/data/webperimental/buildings.ruleset
trunk/data/webperimental/effects.ruleset
trunk/data/webperimental/game.ruleset

Modified: trunk/data/webperimental/buildings.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/webperimental/buildings.ruleset?rev=35501=35500=35501=diff
==
--- trunk/data/webperimental/buildings.ruleset  (original)
+++ trunk/data/webperimental/buildings.ruleset  Thu May 11 08:25:46 2017
@@ -1428,8 +1428,8 @@
 sound  = "w_js_bachs_cathedral"
 sound_alt  = "w_generic"
 helptext   = _("\
-Makes two unhappy citizens content in every city (including citizens\
- unhappy about military activity).\
+Makes two unhappy citizens content in every city belonging to you or to \
+your allies (including citizens unhappy about military activity).\
 ")
 
 [building_king_richards_crusade]

Modified: trunk/data/webperimental/effects.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/webperimental/effects.ruleset?rev=35501=35500=35501=diff
==
--- trunk/data/webperimental/effects.ruleset(original)
+++ trunk/data/webperimental/effects.rulesetThu May 11 08:25:46 2017
@@ -1959,7 +1959,7 @@
 value  = 2
 reqs   =
 { "type", "name", "range"
-  "Building", "J.S. Bach's Cathedral", "Player"
+  "Building", "J.S. Bach's Cathedral", "Alliance"
 }
 
 [effect_king_richards_crusade]

Modified: trunk/data/webperimental/game.ruleset
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/webperimental/game.ruleset?rev=35501=35500=35501=diff
==
--- trunk/data/webperimental/game.ruleset   (original)
+++ trunk/data/webperimental/game.ruleset   Thu May 11 08:25:46 2017
@@ -95,6 +95,8 @@
   - Caravan and Freight can help allies to complete wonders.\n\
   - Sun Tzu's War Academy gives its veteran bonus (combat and production) \
 to both its owner and to all his allies.\n\
+  - J.S. Bach's Cathedral makes two unhappy citizens content in allied \
+cities too.\n\
 \n\
 This ruleset is still in development. If playing it makes you think that \
 a rule should change go to the Freeciv-web board at \


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