Re: [Freeciv-Dev] peaceful units block my moves

2007-08-11 Thread Christian Knoke
/me wrote on Aug 10, 19:48 (+0200):
 
 How comes that a chap I'm in peace with can send diplos inside my
 borders and block my moves this way?
 
 Bug or feature?

with a lots of peaceful units inside my borders, this becomes a
problem. There were several diplomats and one warrior on my territory
(2.0.99 SVN). Shouldn't this be limited to non-aggressive units and/or
a number of turns?

Christian

-- 
Christian Knoke* * *http://cknoke.de
* * * * * * * * *  Ceterum censeo Microsoft esse dividendum.

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


[Freeciv-Dev] bug reprts by mail

2007-08-11 Thread banjo
hi

im getting bounces from [EMAIL PROTECTED]

is this temporary or is there a new way of emailing
bug reports to rt?

-billy

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


Re: [Freeciv-Dev] bug reprts by mail

2007-08-11 Thread Daniel Markstedt
It has changed to [EMAIL PROTECTED] to fool spammers. Please don't
post in in clear text anywhere!

~Daniel

On 8/11/07, banjo [EMAIL PROTECTED] wrote:
 hi

 im getting bounces from [EMAIL PROTECTED]

 is this temporary or is there a new way of emailing
 bug reports to rt?

 -billy

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


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


[Freeciv-Dev] (PR#39535) Re: [Freeciv-commits] r13247 - in /trunk: ai/ client/ client/gui-gtk-2.0/ common/ server/

2007-08-11 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39535 

On 11/08/07, Daniel Markstedt [EMAIL PROTECTED] wrote:
 Hi Marko,

 Did this go into S2_1 too? I'm pretty sure it's been reported for the
 betas at the forums.


 I'm still testing S2_1 version of the patch.


 - ML



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


Re: [Freeciv-Dev] bug reprts by mail

2007-08-11 Thread Christian Knoke
Daniel Markstedt wrote on Aug 11, 16:44 (+0900):
 It has changed to rep...@ to fool spammers. Please don't
 post in in clear text anywhere!

Isn't it more sensible to *only* refer to the web address
http://rt.freeciv.org/ and never to any mail address any more?

This means also the complete source code and wiki.

Christian

-- 
Christian Knoke* * *http://cknoke.de
* * * * * * * * *  Ceterum censeo Microsoft esse dividendum.

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


[Freeciv-Dev] (PR#39532) New Flag - OnePerCity

2007-08-11 Thread [EMAIL PROTECTED]

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39532 

Hi

I propose a new unitflag - OnePerCity

This flag is like Unique but allows one of these units per city.

This would aid rndCiv and other modpacks, as a flag halfway to Unique.
It allows fairly powerful units to be defined, but the players ( ai's)
can't create too many of them.

-billy



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


[Freeciv-Dev] (PR#39530) Wonders don't allow units

2007-08-11 Thread [EMAIL PROTECTED]

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39530 

Hi

With rndCiv i use Wonders to define special races,
ie if you build The Elves wonder you can build Elvish units.

I found that this didn't work, so i made building The Elves
allowed you to build Elveshome in your cities which allowed
you to build Elvish units.

Of course, if you build an Elveshome and lose The Elves
you can still build Elvish units.  If you conquer a city with
a Elveshome you can build Elves.

It's fiddly and annoying, but i can live with it.

But i also had, Lizardman Nests as wonders, but couldn't
build Lizardmen warriors unless i create a City Improvement
that can only be built with the Wonder, to allow the units
to be built - it's ugly.

I also wanted special case units, like..
Foreign Legion: requires Eiffel Tower
Men In Black:   requires NSA
Evil Magician:  requires Temple of Doom
Angel:  requires Holy City
etc,

It would be simpler for me, and prolly for the code, if Wonders
could allow certain units to be built, either on a City, Island,
Nation, or Planet wide basis.

This wouldn't affect the default rulesets, but would allow more
complexity in mods.

Civ ties special units to a Nation, i think this is stupid.
Ie, Germany and the Panzer, the real reason Germany had the Panzer
is not that it's inherent in their national makeup, but that tanks
were new and Germany having being beaten in WWI engaged in a complete
rethink of their military doctrine - it's context dependent.

-billy



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


[Freeciv-Dev] (PR#39531) Partisan should be just another flag

2007-08-11 Thread [EMAIL PROTECTED]

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39531 

Hi

The Partisan flag has two special requirements...
   1) one unit must have it
   2) only one unit can have it

This makes things a wee bit complicated for rndCiv.

My request is that the Partisan flag becomes just a flag
for indicating which units may become Partisans, with these
semantics...
   1) it's ok to have no Partisan units
   2) Partisan units appearing still depends on Inspire_Partisans
  effect - which becomes generalised in the effects.ruleset
   3) it's ok to have many Partisan units, the units that appear
  will be determined by what's available  not obsoleted.

This will make rndCiv rulesets easier to generate, and will allow
more complex Partisan effects...
   * Refugees
   * high tech 4GW Partisans
   * Elf freedom fighters

This should simplify the code handling Partisans, and doesn't affect
the default ruleset.

-billy



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


Re: [Freeciv-Dev] (PR#39534) Split up Diplomat/Spy abilities

2007-08-11 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39534 

On 11/08/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:

 I propose that Diplomat/Spy abilities be split up into more flags,
 each one handling some special ability - Seeing inside a city, bribing
 a unit, poisoning a city, bribing a city, establishing an embassy,
 stealing a tech, sabotaging an improvement etc.

 First step would be making at least current Diplomat  Spy flags
independent. Currently you cannot have Spy abilities without Diplomat
abilities (and it's even considered *ruleset* error if Spy has no
Diplomat flag)

 To keep config files manageable and backwards compatible, the
 traditional Diplomat  Spy flags can become macros that expand out
 to the new subset of Flags, or however the config parser would best
 handle this.

 Ruleset format changes a lot anyway. There's no need to keep it
backward compatible in some minor detail. Of course such changes have
to be weel documented, so modpack authors know to add additional flags
in order for their diplomats to keep all the old capabilities. See
http://freeciv.wikia.com/wiki/Units.ruleset (this wiki page will
probably move in near future)
 But you are correct about managability issue. It's not good if in
order to get standard diplomat abilities you have to write ten
different flags to ruleset.


 - ML



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


Re: [Freeciv-Dev] (PR#39515) struct req_source to struct universal

2007-08-11 Thread Per I. Mathisen

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39515 

On Fri, 10 Aug 2007, William Allen Simpson wrote:
 Marko Lindqvist wrote:
  While I have not looked this particular patch, and probably have
 nothing against it, you should reread
 http://freeciv.wikia.com/wiki/Commit_rules and what it says about
 allowing time for comments...

 Note that it presumes there are managers doing code review.

 Since nobody was reviewing my patches, even when I gave *weeks* and sent
 individual messages to various folks, I've not bothered anymore.

Just because nobody is saying anything, does not mean nobody is reading 
it.

I try to give patches a quick look when I have the time to see if I can 
catch something obvious, especially if the patch touches code I've written 
or touched in the past.

   - Per



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


[Freeciv-Dev] (PR#39536) Stable branch version number

2007-08-11 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39536 

 Stable branch simply uses what version information was set for
previous tag. So currently S2_1 claims to be '2.1.0-beta4'.
 Not big problem for private play, but in the metaserver real beta4
and current S2_1 should show up as different things.

 I think we should set real release number for stable branch only for
the time it takes to tag. That is: 1) Set release version number to
branch 2) Tag 3) Set branch version number to branch.
 Another possibility would be to tag with branch version number, and
then to correct version number in tag (and now svn purists will kill
me...)

 By 'branch version number' I mean something like '2.1.0-svn' (or
maybe '2.1.0-beta4+')


 If nobody reacts to this mail, I will at least change S2_1 version
number to '2.1.0-beta4+'.


 - ML



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


Re: [Freeciv-Dev] (PR#11517) Metamessage fixes

2007-08-11 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=11517 

On 10/08/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

  Showing that 'restarting for lack of players in xx seconds' message
 when game is actually running and everything is ok is quite bad thing.
 That for I will probably backport this patch to S2_0 too.

 Here is S2_0 version.

 Already committed to trunk and S2_1.


 - ML

diff -Nurd -X.diff_ignore freeciv/common/game.c freeciv/common/game.c
--- freeciv/common/game.c	2007-08-04 04:27:37.0 +0300
+++ freeciv/common/game.c	2007-08-11 18:50:27.0 +0300
@@ -294,6 +294,9 @@
   game.player_idx=0;
   game.player_ptr=game.players[0];
   terrain_control.river_help_text[0] = '\0';
+
+  game.meta_info.user_message_set = FALSE;
+  game.meta_info.user_message[0] = '\0';
 }
 
 /***
diff -Nurd -X.diff_ignore freeciv/common/game.h freeciv/common/game.h
--- freeciv/common/game.h	2007-03-05 19:15:59.0 +0200
+++ freeciv/common/game.h	2007-08-11 18:51:36.0 +0300
@@ -245,6 +245,12 @@
   int work_veteran_chance[MAX_VET_LEVELS];
   int veteran_chance[MAX_VET_LEVELS];
   int revolution_length; /* 0= random length, else the fixated length */
+
+  struct {
+bool user_message_set;
+char user_message[256];
+  } meta_info;
+ 
 };
 
 /* Unused? */
diff -Nurd -X.diff_ignore freeciv/server/commands.c freeciv/server/commands.c
--- freeciv/server/commands.c	2007-03-05 19:15:25.0 +0200
+++ freeciv/server/commands.c	2007-08-11 18:50:27.0 +0300
@@ -150,7 +150,11 @@
   {metamessage, ALLOW_CTRL, ALLOW_INFO,
/* TRANS: translate text between  only */
N_(metainfo meta-line),
-   N_(Set metaserver info line.), NULL
+   N_(Set metaserver info line.),
+   N_(Set user defined metaserver info line. If parameter is omitted,\n
+  previously set metamessage will be removed. For most of the time\n
+  user defined metamessage will be used instead of automatically\n
+  generated messages, if it is available.)
   },
   {metatopic, ALLOW_CTRL, ALLOW_INFO,
/* TRANS: translate text between  only */
diff -Nurd -X.diff_ignore freeciv/server/connecthand.c freeciv/server/connecthand.c
--- freeciv/server/connecthand.c	2007-03-05 19:15:25.0 +0200
+++ freeciv/server/connecthand.c	2007-08-11 18:52:23.0 +0300
@@ -163,6 +163,12 @@
 
   send_conn_info(dest, game.est_connections);
   conn_list_insert_back(game.est_connections, pconn);
+  if (conn_list_size(game.est_connections) == 1) {
+/* First connection
+ * Replace restarting in x seconds meta message */
+ maybe_automatic_meta_message(default_meta_message_string());
+ (void) send_server_info_to_metaserver(META_INFO);
+  }
   send_conn_info(game.est_connections, dest);
   (void) send_server_info_to_metaserver(META_INFO);
 }
diff -Nurd -X.diff_ignore freeciv/server/meta.c freeciv/server/meta.c
--- freeciv/server/meta.c	2007-03-05 19:15:25.0 +0200
+++ freeciv/server/meta.c	2007-08-11 18:50:27.0 +0300
@@ -85,20 +85,18 @@
 
 /*
   Return static string with default info line to send to metaserver.
-  This is a function (instead of a define) to keep meta.h clean of
-  including config.h and version.h
 */
 const char *default_meta_message_string(void)
 {
 #if IS_BETA_VERSION
   return unstable pre- NEXT_STABLE_VERSION : beware;
-#else
+#else  /* IS_BETA_VERSION */
 #if IS_DEVEL_VERSION
   return development version: beware;
-#else
+#else  /* IS_DEVEL_VERSION */
   return (default);
-#endif
-#endif
+#endif /* IS_DEVEL_VERSION */
+#endif /* IS_BETA_VERSION */
 }
 
 /*
@@ -126,6 +124,41 @@
 }
 
 /*
+ The metaserver message set by user
+*/
+const char *get_user_meta_message_string(void)
+{
+  if (game.meta_info.user_message_set) {
+return game.meta_info.user_message;
+  }
+
+  return NULL;
+}
+
+/*
+  Update meta message. Set it to user meta message, if it is available.
+  Otherwise use provided message.
+  It is ok to call this with NULL message. Then it only replaces current
+  meta message with user meta message if available.
+*/
+void maybe_automatic_meta_message(const char *automatic)
+{
+  const char *user_message;
+
+  user_message = get_user_meta_message_string();
+
+  if (user_message == NULL) {
+/* No user message */
+if (automatic != NULL) {
+  set_meta_message_string(automatic);
+}
+return;
+  }
+
+  set_meta_message_string(user_message);
+}
+

[Freeciv-Dev] (PR#39537) [Patch] Do not refer to cvs in CodingStyle

2007-08-11 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39537 

 $subject


 - ML

diff -Nurd -X.diff_ignore freeciv/doc/CodingStyle freeciv/doc/CodingStyle
--- freeciv/doc/CodingStyle	2007-08-04 18:36:17.0 +0300
+++ freeciv/doc/CodingStyle	2007-08-11 19:50:21.0 +0300
@@ -218,7 +218,8 @@
   used in header files.  It also means casts on void pointers (which should
   be avoided in C files) must be used in headers.
 
-- If you send patches, use diff -u (or diff -r -u, or cvs diff -u).
+- If you send patches, use diff -u (or diff -r -u). svn diff works
+  correctly without extra parameters.
   For further information, see
   http://www.freeciv.org/index.php/How_to_Contribute.
   Also, name patch files descriptively (e.g. fix-foo-bug-0.diff is good,
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#39538) No clear indication about editor mode to connecting clients

2007-08-11 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39538 

 - Start server
 - Connect client
 - /set aifill 2
 - Start game
 - Enable editor mode
 - Connect to server with second client
 - /take ai player

 - Wonder (as user of the second client) why you get that 'illegal
action' cursor all the time.
 - Finally notice from Editor menu that Editor mode is enabled


 Server should sent message to connecting clients if it is in editor mode.


 - ML



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


Re: [Freeciv-Dev] (PR#39539) Client command line parameter --port not working as expected

2007-08-11 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39539 

On 11/08/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

  ./civ --help
   ...
   -p, --port PORT   Connect to server port PORT
   ...

  One would think that this would automatically connect to server.
 Instead client starts to main menu as usual.

 Figured out how this is meant to be used.

 Attached patch makes help a bit more helpfull. Introduces string
changes, but that's probably lesser evil. IMO should go to S2_1 too.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/civclient.c freeciv/client/civclient.c
--- freeciv/client/civclient.c	2007-08-04 18:39:15.0 +0300
+++ freeciv/client/civclient.c	2007-08-11 20:47:55.0 +0300
@@ -211,14 +211,14 @@
 			   Connect to the metaserver at HOST\n));
   fc_fprintf(stderr, _(  -n, --name NAME\tUse NAME as name\n));
   fc_fprintf(stderr,
-		 _(  -p, --port PORT\tConnect to server port PORT\n));
+		 _(  -p, --port PORT\tConnect to server port PORT (usually with -a)\n));
   fc_fprintf(stderr,
 		 _(  -P, --Plugin PLUGIN\tUse PLUGIN for sound output %s\n),
 		 audio_get_all_plugin_names());
   fc_fprintf(stderr, _(  -r, --read FILE\tRead startup script FILE 
 			   (for spawned server only)\n));
   fc_fprintf(stderr,
-		 _(  -s, --server HOST\tConnect to the server at HOST\n));
+		 _(  -s, --server HOST\tConnect to the server at HOST (usually with -a)\n));
   fc_fprintf(stderr,
 		 _(  -S, --Sound FILE\tRead sound tags from FILE\n));
   fc_fprintf(stderr, _(  -t, --tiles FILE\t
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39511) [Patch] Call init_available_nations()

2007-08-11 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39511 

On 10/08/07, Marko Lindqvist [EMAIL PROTECTED] wrote:
 On 08/08/07, Marko Lindqvist [EMAIL PROTECTED] wrote:
 
   There was another call of init_available_nations() at wrong time. And
  sometimes it was not called when it should have been called.

  - Fixed client crash

 Separate version for S2_1. New asserts should go to trunk only.


 - ML

diff -Nurd -X.diff_ignore freeciv/server/ruleset.c freeciv/server/ruleset.c
--- freeciv/server/ruleset.c	2007-08-07 16:49:47.0 +0300
+++ freeciv/server/ruleset.c	2007-08-11 21:29:12.0 +0300
@@ -44,6 +44,7 @@
 #include aiunit.h		/* update_simple_ai_types */
 
 #include ruleset.h
+#include srv_main.h
 
 /* RULESET_SUFFIX already used, no leading dot here */
 #define RULES_SUFFIX ruleset
@@ -3132,6 +3133,10 @@
 static void reset_player_nations(void)
 {
   players_iterate(pplayer) {
+/* We cannot use player_set_nation() here since this is
+ * called before nations are loaded. Player pointers
+ * from nations will be initialized to NULL when nations are
+ * loaded. */
 pplayer-nation = NO_NATION_SELECTED;
 pplayer-city_style = 0;
   } players_iterate_end;
@@ -3186,6 +3191,9 @@
   load_ruleset_effects(effectfile);
   load_ruleset_game();
 
+  /* Init nations we just loaded. */
+  init_available_nations();
+
   sanity_check_ruleset_data();
 
   precalc_tech_data();
diff -Nurd -X.diff_ignore freeciv/server/srv_main.c freeciv/server/srv_main.c
--- freeciv/server/srv_main.c	2007-08-11 12:17:10.0 +0300
+++ freeciv/server/srv_main.c	2007-08-11 21:32:32.0 +0300
@@ -1307,7 +1307,24 @@
 }
   }
   nations_iterate(nation) {
-nation-player = NULL;
+/* Even though this function is called init_available_nations(),
+ * nation-player should never have value assigned to it
+ * (since it has beeen initialized in load_rulesets() ). */
+if (nation-player != NULL) {
+
+  freelog(LOG_ERROR, Player assigned to nation before 
+ init_available_nations());
+
+  /* Try to handle error situation as well as we can */
+  if (nation-player-nation == nation) {
+/* At least assignment is consistent. Leave nation assigned,
+ * and make sure that nation is also marked available. */
+nation-is_available = TRUE;
+  } else {
+/* Not consistent. Just initialize the pointer and hope for the best */
+nation-player = NULL;
+  }
+}
   } nations_iterate_end;
   send_ruleset_nations(game.est_connections);
 }
@@ -1776,7 +1793,6 @@
   
   con_flush();
 
-  server_game_init();
   stdinhand_init();
   diplhand_init();
 
@@ -1786,6 +1802,8 @@
 server_open_socket();
   }
 
+  server_game_init();
+
   /* load a saved game */
   if (srvarg.load_filename[0] != '\0') {
 (void) load_command(NULL, srvarg.load_filename, FALSE);
@@ -1874,8 +1892,6 @@
 **/
 static void srv_loop(void)
 {
-  init_available_nations();
-
   freelog(LOG_NORMAL, _(Now accepting new client connections.));
   while(server_state == PRE_GAME_STATE) {
 sniff_packets(); /* Accepting commands. */
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39511) [Patch] Call init_available_nations()

2007-08-11 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39511 

On 11/08/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

  New asserts should go to trunk only.

 Actually there is easily reproducible bug causing second assert to
fail. At this point I will commit this patch without that assert.
Assert should be added when known bug is fixed.


 - ML

diff -Nurd -X.diff_ignore freeciv/server/ruleset.c freeciv/server/ruleset.c
--- freeciv/server/ruleset.c	2007-08-09 17:20:08.0 +0300
+++ freeciv/server/ruleset.c	2007-08-11 21:43:12.0 +0300
@@ -46,6 +46,7 @@
 #include aiunit.h		/* update_simple_ai_types */
 
 #include ruleset.h
+#include srv_main.h
 
 /* RULESET_SUFFIX already used, no leading dot here */
 #define RULES_SUFFIX ruleset
@@ -3494,6 +3495,10 @@
 static void reset_player_nations(void)
 {
   players_iterate(pplayer) {
+/* We cannot use player_set_nation() here since this is
+ * called before nations are loaded. Player pointers
+ * from nations will be initialized to NULL when nations are
+ * loaded. */
 pplayer-nation = NO_NATION_SELECTED;
 pplayer-city_style = 0;
   } players_iterate_end;
@@ -3548,6 +3553,9 @@
   load_ruleset_effects(effectfile);
   load_ruleset_game();
 
+  /* Init nations we just loaded. */
+  init_available_nations();
+
   sanity_check_ruleset_data();
 
   precalc_tech_data();
diff -Nurd -X.diff_ignore freeciv/server/srv_main.c freeciv/server/srv_main.c
--- freeciv/server/srv_main.c	2007-08-10 03:05:02.0 +0300
+++ freeciv/server/srv_main.c	2007-08-11 21:43:12.0 +0300
@@ -1347,7 +1347,29 @@
 }
   }
   nations_iterate(nation) {
-nation-player = NULL;
+/* Even though this function is called init_available_nations(),
+ * nation-player should never have value assigned to it
+ * (since it has beeen initialized in load_rulesets() ). */
+if (nation-player != NULL) {
+
+  freelog(LOG_ERROR, Player assigned to nation before 
+ init_available_nations());
+
+  /* When we enter this execution branch, assert() will always
+   * fail. This one just provides more informative message than
+   * simple assert(FAIL); */
+  assert(nation-player == NULL);
+
+  /* Try to handle error situation as well as we can */
+  if (nation-player-nation == nation) {
+/* At least assignment is consistent. Leave nation assigned,
+ * and make sure that nation is also marked available. */
+nation-is_available = TRUE;
+  } else {
+/* Not consistent. Just initialize the pointer and hope for the best */
+nation-player = NULL;
+  }
+}
   } nations_iterate_end;
   send_ruleset_nations(game.est_connections);
 }
@@ -1791,7 +1813,6 @@
   
   con_flush();
 
-  server_game_init();
   stdinhand_init();
   diplhand_init();
 
@@ -1801,6 +1822,8 @@
 server_open_socket();
   }
 
+  server_game_init();
+
   /* load a saved game */
   if (srvarg.load_filename[0] != '\0') {
 (void) load_command(NULL, srvarg.load_filename, FALSE);
@@ -1889,8 +1912,6 @@
 **/
 static void srv_loop(void)
 {
-  init_available_nations();
-
   freelog(LOG_NORMAL, _(Now accepting new client connections.));
   while(server_state == PRE_GAME_STATE) {
 sniff_packets(); /* Accepting commands. */
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#39540) [Patch] Misc transfer_city_units() related stuff

2007-08-11 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39540 

 I tried to track crash in transfer_city() - transfer_city_units() -
real_unit_change_homecity(). Never found it (cannot reproduce if
compiled with debugging symbols, or without optimization, or if there
is virtually any code change (changing where instructions are in the
memory)).
 Still, attached is some changes I did in the hunting process. Adds
comments about not-so-obvious dependencies, rearranges code to be more
robust, adds one assert.

 There is no good reason to commit this to stable branch.


 - ML

diff -Nurd -X.diff_ignore freeciv/server/citytools.c freeciv/server/citytools.c
--- freeciv/server/citytools.c	2007-08-11 00:20:33.0 +0300
+++ freeciv/server/citytools.c	2007-08-11 22:36:37.0 +0300
@@ -591,7 +591,7 @@
 } unit_list_iterate_safe_end;
   }
 
-  /* Any remaining units supported by the city are either given new home
+  /* Any units supported by the city are either given new home
  cities or maybe destroyed */
   unit_list_iterate_safe(units, vunit) {
 struct city *new_home_city = tile_get_city(vunit-tile);
@@ -606,7 +606,7 @@
   transfer_unit(vunit, pcity, verbose);
 } else {
   /* The unit is lost.  Call notify_player (in all other cases it is
-   * called autmatically). */
+   * called automatically). */
   freelog(LOG_VERBOSE, Lost %s's %s at (%d,%d) when %s was lost.,
 	  unit_owner(vunit)-name,
 	  unit_rule_name(vunit),
@@ -779,8 +779,11 @@
 
   unit_list_iterate(pcity-units_supported, punit) {
 unit_list_prepend(old_city_units, punit);
-/* otherwise we might delete the homecity from under the unit
-   in the client. */
+/* Mark unit to have no homecity at all.
+ * 1. We remove unit from units_supported list here,
+ *real_change_unit_homecity() should not attempt it.
+ * 2. Otherwise we might delete the homecity from under the unit
+ *in the client */
 punit-homecity = 0;
 send_unit_info(NULL, punit);
   } unit_list_iterate_end;
diff -Nurd -X.diff_ignore freeciv/server/unithand.c freeciv/server/unithand.c
--- freeciv/server/unithand.c	2007-08-05 16:40:57.0 +0300
+++ freeciv/server/unithand.c	2007-08-11 22:43:57.0 +0300
@@ -282,6 +282,11 @@
   struct player *old_owner = unit_owner(punit);
   struct player *new_owner = city_owner(new_pcity);
 
+  /* Calling this function when new_pcity is same as old_pcity should
+   * be safe with current implementation, but it is not meant to
+   * be used that way. */
+  assert(new_pcity != old_pcity);
+
   if (old_owner != new_owner) {
 vision_clear_sight(punit-server.vision);
 vision_free(punit-server.vision);
@@ -300,11 +305,15 @@
 assert(can_unit_exist_at_tile(punit, new_pcity-tile));
 move_unit(punit, new_pcity-tile, 0); /* teleport to location */
   }
-  
-  unit_list_prepend(new_pcity-units_supported, punit);
+
+  /* Remove from old city first and add to new city only after that.
+   * This is more robust in case old_city == new_city (currently
+   * prohibited by assert in the beginning of the function).
+   */
   if (old_pcity) {
 unit_list_unlink(old_pcity-units_supported, punit);
   }
+  unit_list_prepend(new_pcity-units_supported, punit);
 
   punit-homecity = new_pcity-id;
   send_unit_info(unit_owner(punit), punit);
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39520) [Patch] Fix --disable-cvs-deps

2007-08-11 Thread Marko Lindqvist

URL: http://bugs.freeciv.org/Ticket/Display.html?id=39520 

On 10/08/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

  In addition to fixing bugs I renamed it as --disable-auto-deps, since
 I found its old name really confusing. It has nothing to do with
 version control!

 - Updated against svn
 - S2_0 and S2_1 versions of the patch should not remove
--with-included-gettext from sun compile instructions


 - ML

diff -Nurd -X.diff_ignore freeciv/bootstrap/undep.sh.in freeciv/bootstrap/undep.sh.in
--- freeciv/bootstrap/undep.sh.in	2007-03-05 19:14:04.0 +0200
+++ freeciv/bootstrap/undep.sh.in	2007-08-11 23:52:33.0 +0300
@@ -4,30 +4,30 @@
 #
 # This script gets run at the end of configure, to modify
 # the Makefile's produced by configure to remove deps stuff 
-# which can (for cvs sources and snapshots) upset some make 
+# which can (for svn sources and snapshots) upset some make 
 # programs and C compilers.  (GNU make and gcc work, maybe 
 # some others work too...)
 #
 # Whether anything is actually modified depends on how configure
-# sets CVS_DEPS; see configure.in; if CVS_DEPS is set to yes,
+# sets AUTO_DEPS; see configure.ac; if AUTO_DEPS is set to yes,
 # this script does nothing.   For a release distribution
 # of freeciv (where the deps are done differently and are portable) 
 # this script will in effect do nothing because the sed regex's 
 # won't match. 
 
[EMAIL PROTECTED]@
[EMAIL PROTECTED]@
 
-if test $CVS_DEPS = yes; then
+if test $AUTO_DEPS = yes; then
 exit
 fi
 
 @[EMAIL PROTECTED]client client/agents client/@gui_sources@
 @[EMAIL PROTECTED]
 
[EMAIL PROTECTED]@SSUBDIRS=ai server
[EMAIL PROTECTED]@SSUBDIRS=ai server server/generator server/scripting
 @[EMAIL PROTECTED]
 
-SUBDIRS=common common/aicore $SSUBDIRS $CSUBDIRS
+SUBDIRS=common common/aicore utility $SSUBDIRS $CSUBDIRS manual
 
 for subdir in $SUBDIRS ; do
 
@@ -43,19 +43,27 @@
 continue
 fi
 
-echo removing cvs-deps from $name
+echo removing auto-deps from $name
 
 mv -f $name $name.bak
 
+# These are known to match if automake version used is 1.4
 sed '
 s/^DEPS_MAGIC.*//
 s/^-include $(DEP_FILES)//
 s/^%\.o: %\.c/.c.o:/
 s/[EMAIL PROTECTED] '''$(COMPILE) -c $'''; \\/$(COMPILE) -c $/
 s/	$(COMPILE) -Wp,-MD,\.deps\/$(\*F)\.pp -c $/junknever:/
-' $name.bak  $name
+' $name.bak  $name.bak2
 
-# Above, COMPILE substitution line is appropriate for automake 1.4
-# It has an embedded tab character after the s/
+# These are known to match if automake version used is 1.9.6
+# There is several tab characters. Don't get fooled if they appear as one space!
+sed '
+s/^DEPDIR = .*//
+s/^include .\/$(DEPDIR)\/.*//
+s/^	if $(COMPILE) -MT $@ -MD -MP -MF \$(DEPDIR).*/	$(COMPILE) -c -o $@ $/
+s/^	then mv -f \$(DEPDIR).*//
+s/^	-rm -rf \.\/$(DEPDIR)//
+' $name.bak2  $name
 
 done
diff -Nurd -X.diff_ignore freeciv/configure.ac freeciv/configure.ac
--- freeciv/configure.ac	2007-08-07 15:19:47.0 +0300
+++ freeciv/configure.ac	2007-08-11 23:52:33.0 +0300
@@ -132,12 +132,14 @@
 esac], [make_include=false])
 AM_CONDITIONAL(MAKE_CLIENT_INCLUDE, test $make_include = true)
 
-AC_ARG_ENABLE(cvs_deps,
- 	[  --disable-cvs-deps  remove cvs-source deps calcs, which require gmake,gcc],,
-	enable_cvs_deps=maybe
-)
-CVS_DEPS=$enable_cvs_deps
-AC_SUBST(CVS_DEPS)
+AC_ARG_ENABLE([auto_deps],
+[  --disable-auto-deps remove automatic deps calcs, which require gmake,gcc],
+[case ${enableval} in
+  yes) enable_auto_deps=true ;;
+  no)  enable_auto_deps=false;;
+  *)   AC_MSG_ERROR([bad value ${enableval} for --enable-auto-deps]) ;;
+esac], [enable_auto_deps=maybe])
+AUTO_DEPS=$enable_auto_deps
 
 AC_ARG_WITH(efence,
 	[  --with-efence   use Electric Fence, malloc debugger ],
@@ -304,14 +306,15 @@
 AC_C99_INITIALIZERS
 AC_C99_STDINT_H
 
-if test $CVS_DEPS = maybe; then
+if test $AUTO_DEPS = maybe; then
dnl Should also check for gmake?
if test -n $GCC; then
-  CVS_DEPS=yes
+  AUTO_DEPS=yes
else
-  CVS_DEPS=no
+  AUTO_DEPS=no
fi
 fi
+AC_SUBST([AUTO_DEPS])
 
 dnl BeOS-specific settings
 if test x`$UNAME -s` = xBeOS ; then
diff -Nurd -X.diff_ignore freeciv/INSTALL freeciv/INSTALL
--- freeciv/INSTALL	2007-08-11 23:15:49.0 +0300
+++ freeciv/INSTALL	2007-08-11 23:56:20.0 +0300
@@ -55,7 +55,7 @@
project's excellent C compiler.  Releases can be compiled with gcc
or most other compilers (such as the unbundled Solaris C compiler).
Development releases and svn snapshots will not work without gcc,
-   unless you give configure the --disable-cvs-deps option.  See
+   unless you give configure the --disable-auto-deps option.  See
the section below for more information.
Note that there have been reports that gcc with -O3 miscompiled
freeciv. No problems have been reported with -O2.
@@ -68,7 +68,7 @@
makefiles which work with most make programs.  Development releases
and svn snapshots contain things (like dependencies) which use
gmake's enhanced