[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&view=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&r1=35512&r2=35513&view=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&r1=35512&r2=35513&view=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&r1=35512&r2=35513&view=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(&texai_world, pcity);
+  } else {
+pcity = idex_lookup_city(&texai_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(&texai_world, info->id);
+
+  idex_unregister_city(&texai_world, pcity);
+}

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

[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&view=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&r1=35510&r2=35511&view=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&r1=35510&r2=35511&view=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&view=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&r1=35511&r2=35512&view=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&r1=35511&r2=35512&view=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&view=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&r1=35508&r2=35509&view=diff

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

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

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

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

Modified: trunk/server/aiiface.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/aiiface.c?rev=35509&r1=35508&r2=35509&view=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&view=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&r1=35509&r2=35510&view=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&r1=35509&r2=35510&view=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&r1=35509&r2=35510&view=diff

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

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

Modified: branches/S3_0/server/aiiface.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S3_0/server/aiiface.c?rev=35510&r1=35509&r2=35510&view=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&view=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&r1=35507&r2=35508&view=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&view=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&r1=35506&r2=35507&view=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&view=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&r1=35505&r2=35506&view=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&r1=35505&r2=35506&view=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&view=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&r1=35504&r2=35505&view=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&r1=35504&r2=35505&view=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