[Freeciv-Dev] (PR#40227) Invalid string conversion from UTF-8 to ISO-8859-1

2008-05-07 Thread Jason Short

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

 [EMAIL PROTECTED] - Sun May 04 09:50:59 2008]:
 
 2008/5/4 Jason Dorje Short:
 
   This is not a bug in freeciv.  If you use a non-universal character set
   on your command line then freeciv will simply be unable to display some
   characters.  We can try to fudge it using transliteration but
   iconv/glibc support for that is pretty varied.  The real solution is to
   use utf-8 for your command line charset.
 
  It might be bug that there *is* conversion to ISO-8859-1.
  I though that this conversion cannot be internal encoding - local
 encoding thing. Commandline should be UTF8. It is possible that it's
 not set at all in the actual Freeciv server environment launched from
 cron.
 
  Found two uses for ISO-8869-1 in Freeciv 2.1 codebase.
  1) data encoding
  2) fallback local encoding
   /* HACK: use latin1 instead of ascii in typical cases when the
* encoding is unconfigured. */
   local_encoding = ISO-8859-1;
 
  Latter probably explains my problem.
 
  Should we change this fallback to UTF-8 for 2.2 (S2_2) or 2.3 (TRUNK)?

You can try it and see if it works.  But my understanding is that when
the locale is unconfigured (i.e. left at C in older distributions
before utf-8 became standard) it's actually ascii or latin1 and any
attempt to print utf-8 to the console will give garbage.  If terminal
software is better now and itself defaults to utf-8, then perhaps we
could default there too.  Perhaps it would even be possible to find the
default of the terminal in that case.  Or perhaps we should default just
to ascii and get the transliteration to improve.

-jason


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


[Freeciv-Dev] (PR#40232) Compiler error in 2.2

2008-05-07 Thread Christian Knoke

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



Todays SVN (Revision 14659):

if gcc -DHAVE_CONFIG_H -I. -I. -I../..  -I. -I./.. -I./../include
-I../../utility -I../../common -I../../common/aicore -I./../agents
-I/usr/include/gtk-2.0 -I/usr/lib/gtk-2.0/include -I/usr/include/atk-1.0
-I/usr/include/cairo -I/usr/include/pango-1.0 -I/usr/include/glib-2.0
-I/usr/lib/glib-2.0/include -I/usr/include/freetype2 -I/usr/include/libpng12
-DLOCALEDIR=\/usr/local/share/locale\
-DDEFAULT_DATA_PATH=\.:data:~/.freeciv:/usr/local/share/freeciv\  -Wall
-Wpointer-arith -Wcast-align -Wmissing-prototypes -Wmissing-declarations -g
-O2 -MT plrdlg.o -MD -MP -MF .deps/plrdlg.Tpo -c -o plrdlg.o plrdlg.c; \
then mv -f .deps/plrdlg.Tpo .deps/plrdlg.Po; else rm -f
.deps/plrdlg.Tpo; exit 1; fi
plrdlg.c: In function ‘popup_players_dialog’:
plrdlg.c:85: internal compiler error: in copy_body_r, at tree-inline.c:684
Please submit a full bug report,
with preprocessed source if appropriate.
See URL:http://gcc.gnu.org/bugs.html for instructions.
For Debian GNU/Linux specific bug reporting instructions,
see URL:file:///usr/share/doc/gcc-4.1/README.Bugs.
The bug is not reproducible, so it is likely a hardware or OS problem.
make[4]: *** [plrdlg.o] Fehler 1
make[4]: Leaving directory `/home/chris/freeciv/svn/v22/client/gui-gtk-2.0'
make[3]: *** [all] Fehler 2
make[3]: Leaving directory `/home/chris/freeciv/svn/v22/client/gui-gtk-2.0'
make[2]: *** [all-recursive] Fehler 1
make[2]: Leaving directory `/home/chris/freeciv/svn/v22/client'
make[1]: *** [all-recursive] Fehler 1
make[1]: Leaving directory `/home/chris/freeciv/svn/v22'
make: *** [all] Fehler 2



-- 
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


Re: [Freeciv-Dev] (PR#40232) Compiler crash in 2.2

2008-05-07 Thread Marko Lindqvist

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

2008/5/7 Christian Knoke:

  Todays SVN (Revision 14659):

  plrdlg.c:85: internal compiler error: in copy_body_r, at tree-inline.c:684
  Please submit a full bug report,
  with preprocessed source if appropriate.
  See URL:http://gcc.gnu.org/bugs.html for instructions.

 Did you?

  For Debian GNU/Linux specific bug reporting instructions,
  see URL:file:///usr/share/doc/gcc-4.1/README.Bugs.
  The bug is not reproducible, so it is likely a hardware or OS problem.

 If it really is not reproducible, and happened just once, there's
nothing for us to do. If it happens often, we can try to rearrange
code so compilation is not triggering the bug. We did that for one bug
in gcc versions 4.2.0 - 4.2.2.

 What is the exact version of your gcc?


 - ML



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


[Freeciv-Dev] (PR#40234) [Patch] Start button sensitivity

2008-05-07 Thread Marko Lindqvist

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

 GTK-2

 Current Start button sensitivity checks against global observer, but
observer attached to player cannot start game either.

 Fix attached.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/gui_main.c freeciv/client/gui-gtk-2.0/gui_main.c
--- freeciv/client/gui-gtk-2.0/gui_main.c	2008-03-08 16:12:56.0 +0200
+++ freeciv/client/gui-gtk-2.0/gui_main.c	2008-05-08 00:48:29.0 +0300
@@ -1586,7 +1586,9 @@
   } else {
 gtk_stockbutton_set_label(ready_button, _(_Start));
   }
-  gtk_widget_set_sensitive(ready_button, (NULL != client.conn.playing));
+
+  /* Observer cannot start game. */
+  gtk_widget_set_sensitive(ready_button, (!client.conn.observer));
 
   gtk_stockbutton_set_label(nation_button, _(Pick _Nation));
   if (NULL == client.conn.playing) {
diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/gui_main.c freeciv/client/gui-gtk-2.0/gui_main.c
--- freeciv/client/gui-gtk-2.0/gui_main.c	2008-01-15 04:04:31.0 +0200
+++ freeciv/client/gui-gtk-2.0/gui_main.c	2008-05-08 00:55:16.0 +0300
@@ -1511,7 +1511,9 @@
   } else {
 gtk_stockbutton_set_label(ready_button, _(_Start));
   }
-  gtk_widget_set_sensitive(ready_button, (game.player_ptr != NULL));
+
+  /* Observer cannot start game. */
+  gtk_widget_set_sensitive(ready_button, (!aconnection.observer));
 
   gtk_stockbutton_set_label(nation_button, _(Pick _Nation));
   if (!aconnection.player) {
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40234) [Patch] Start button sensitivity

2008-05-07 Thread Madeline Book

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

 [EMAIL PROTECTED] - Wed May 07 21:59:32 2008]:
 
  GTK-2
 
  Current Start button sensitivity checks against global observer, but
 observer attached to player cannot start game either.

The start button should also not be sensitive for detached
connections (not observer and not attached to a player).


---
そのものを忘れないで下さい。

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


[Freeciv-Dev] (PR#40235) [Patch] Fix /take of currently observed player

2008-05-07 Thread Marko Lindqvist

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

 Player changes when trying to /take player one is currently observing.

 Reproducing in S2_1

 1) /set aifill 5
 2) Select nation for some of the players (this is just to make them
visibly unique)
 3) Observe player with nation selected
 4) /take that player

 Notice how selected nation is no longer applied to player you now
control. Also, /list may show that you control somebody else.

 All this is because server first detaches us from previous player
(which we were observing) - player removed.


 Fix attached.


 - ML

diff -Nurd -X.diff_ignore freeciv/server/stdinhand.c freeciv/server/stdinhand.c
--- freeciv/server/stdinhand.c  2008-05-07 17:44:45.0 +0300
+++ freeciv/server/stdinhand.c  2008-05-08 03:22:24.0 +0300
@@ -2900,7 +2900,8 @@
   struct connection *pconn = caller;
   struct player *pplayer = NULL;
   bool res = FALSE;
-  
+  bool was_observing;
+
   / PART I: fill pconn and pplayer /
 
   sz_strlcpy(buf, str);
@@ -2961,9 +2962,6 @@
 goto end;
   }
 
-  if (!pplayer) {
-  }
-
   /* Make sure there is free player slot if there is need to
* create new player. This is necessary for previously
* detached connections only. Others can reuse the slot
@@ -2990,6 +2988,11 @@
 /* others are sent below */
   }
 
+  if (pconn-playing == pplayer) {
+/* Connection was obserwing the very player it now /take */
+was_observing = TRUE;
+  }
+
   /* if the player is controlled by another user,
* forcibly convert the user to an observer.
*/
@@ -3013,9 +3016,10 @@
 } conn_list_iterate_end;
   }
 
-  /* if the connection is already attached to a player,
-   * unattach and cleanup old player (rename, remove, etc) */
-  if (NULL != pconn-playing) {
+  /* if the connection is already attached to another player,
+   * unattach and cleanup old player (rename, remove, etc)
+   * We may have been observing the player we now want to take */
+  if (NULL != pconn-playing  !was_observing) {
 char name[MAX_LEN_NAME], username[MAX_LEN_NAME];
 
 if (pplayer) {
@@ -3039,11 +3043,13 @@
 }
   } players_iterate_end;
 
-  /* now attach to new player */
-  res = attach_connection_to_player(pconn, pplayer, FALSE);
+  if (!was_observing) {
+/* now attach to new player */
+res = attach_connection_to_player(pconn, pplayer, FALSE);
 
-  /* Check aifill even if attach failed. Maybe we already detached. */
-  aifill(game.info.aifill);
+/* Check aifill even if attach failed. Maybe we already detached. */
+aifill(game.info.aifill);
+  }
 
   if (res) {
 /* Successfully attached */
diff -Nurd -X.diff_ignore freeciv/server/stdinhand.c freeciv/server/stdinhand.c
--- freeciv/server/stdinhand.c  2008-05-08 00:24:57.0 +0300
+++ freeciv/server/stdinhand.c  2008-05-08 03:30:59.0 +0300
@@ -2896,7 +2896,8 @@
   struct connection *pconn = caller;
   struct player *pplayer = NULL;
   bool res = FALSE;
-  
+  bool was_observing;
+
   / PART I: fill pconn and pplayer /
 
   sz_strlcpy(buf, str);
@@ -2979,6 +2980,11 @@
 /* others are sent below */
   }
 
+  if (pconn-player == pplayer) {
+/* Connection was obserwing the very player it now /take */
+was_observing = TRUE;
+  }
+
   /* if we're taking another player with a user attached, 
* forcibly detach the user from the player. */
   if (pplayer) {
@@ -2998,9 +3004,10 @@
 } conn_list_iterate_end;
   }
 
-  /* if the connection is already attached to a player,
-   * unattach and cleanup old player (rename, remove, etc) */
-  if (pconn-player) {
+  /* if the connection is already attached to another player,
+   * unattach and cleanup old player (rename, remove, etc)
+   * We may have been observing the player we now want to take */
+  if (pconn-player  !was_observing) {
 char name[MAX_LEN_NAME], username[MAX_LEN_NAME];
 
 if (pplayer) {
@@ -3026,7 +3033,11 @@
 
   /* now attach to new player */
   pconn-observer = FALSE; /* do this before attach! */
-  res = attach_connection_to_player(pconn, pplayer);
+
+  if (!was_observing) {
+/* now attach to new player */
+res = attach_connection_to_player(pconn, pplayer);
+  }
 
   if (res) {
 /* Successfully attached */
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#40235) [Patch] Fix /take of currently observed player

2008-05-07 Thread Marko Lindqvist

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

2008/5/8 Marko Lindqvist:

   Player changes when trying to /take player one is currently observing.

 - Fixed crash when global observer does /take -


 - ML

diff -Nurd -X.diff_ignore freeciv/server/stdinhand.c freeciv/server/stdinhand.c
--- freeciv/server/stdinhand.c  2008-05-07 17:44:45.0 +0300
+++ freeciv/server/stdinhand.c  2008-05-08 04:20:18.0 +0300
@@ -2900,7 +2900,8 @@
   struct connection *pconn = caller;
   struct player *pplayer = NULL;
   bool res = FALSE;
-  
+  bool was_observing_this;
+
   / PART I: fill pconn and pplayer /
 
   sz_strlcpy(buf, str);
@@ -2961,9 +2962,6 @@
 goto end;
   }
 
-  if (!pplayer) {
-  }
-
   /* Make sure there is free player slot if there is need to
* create new player. This is necessary for previously
* detached connections only. Others can reuse the slot
@@ -2990,6 +2988,11 @@
 /* others are sent below */
   }
 
+  if (pconn-playing  pconn-playing == pplayer) {
+/* Connection was obserwing the very player it now /take */
+was_observing_this = TRUE;
+  }
+
   /* if the player is controlled by another user,
* forcibly convert the user to an observer.
*/
@@ -3013,9 +3016,10 @@
 } conn_list_iterate_end;
   }
 
-  /* if the connection is already attached to a player,
-   * unattach and cleanup old player (rename, remove, etc) */
-  if (NULL != pconn-playing) {
+  /* if the connection is already attached to another player,
+   * unattach and cleanup old player (rename, remove, etc)
+   * We may have been observing the player we now want to take */
+  if (NULL != pconn-playing  !was_observing_this) {
 char name[MAX_LEN_NAME], username[MAX_LEN_NAME];
 
 if (pplayer) {
@@ -3039,11 +3043,13 @@
 }
   } players_iterate_end;
 
-  /* now attach to new player */
-  res = attach_connection_to_player(pconn, pplayer, FALSE);
+  if (!was_observing_this || !pconn-playing) {
+/* Now attach to new player */
+res = attach_connection_to_player(pconn, pplayer, FALSE);
 
-  /* Check aifill even if attach failed. Maybe we already detached. */
-  aifill(game.info.aifill);
+/* Check aifill even if attach failed. Maybe we already detached. */
+aifill(game.info.aifill);
+  }
 
   if (res) {
 /* Successfully attached */
diff -Nurd -X.diff_ignore freeciv/server/stdinhand.c freeciv/server/stdinhand.c
--- freeciv/server/stdinhand.c  2008-05-08 00:24:57.0 +0300
+++ freeciv/server/stdinhand.c  2008-05-08 04:04:24.0 +0300
@@ -2896,7 +2896,8 @@
   struct connection *pconn = caller;
   struct player *pplayer = NULL;
   bool res = FALSE;
-  
+  bool was_observing_this;
+
   / PART I: fill pconn and pplayer /
 
   sz_strlcpy(buf, str);
@@ -2979,6 +2980,11 @@
 /* others are sent below */
   }
 
+  if (pconn-player  pconn-player == pplayer) {
+/* Connection was obserwing the very player it now /take */
+was_observing_this = TRUE;
+  }
+
   /* if we're taking another player with a user attached, 
* forcibly detach the user from the player. */
   if (pplayer) {
@@ -2998,9 +3004,10 @@
 } conn_list_iterate_end;
   }
 
-  /* if the connection is already attached to a player,
-   * unattach and cleanup old player (rename, remove, etc) */
-  if (pconn-player) {
+  /* if the connection is already attached to another player,
+   * unattach and cleanup old player (rename, remove, etc)
+   * We may have been observing the player we now want to take */
+  if (pconn-player  !was_observing_this) {
 char name[MAX_LEN_NAME], username[MAX_LEN_NAME];
 
 if (pplayer) {
@@ -3026,7 +3033,11 @@
 
   /* now attach to new player */
   pconn-observer = FALSE; /* do this before attach! */
-  res = attach_connection_to_player(pconn, pplayer);
+
+  if (!was_observing_this || !pplayer) {
+/* now attach to new player */
+res = attach_connection_to_player(pconn, pplayer);
+  }
 
   if (res) {
 /* Successfully attached */
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40235) [Patch] Fix /take of currently observed player

2008-05-07 Thread Madeline Book

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

 [EMAIL PROTECTED] - Thu May 08 00:52:08 2008]:
 
  Player changes when trying to /take player one is
  currently observing.
 
  Reproducing in S2_1
 
  1) /set aifill 5
  2) Select nation for some of the players (this is just to make them
 visibly unique)
  3) Observe player with nation selected
  4) /take that player
 
  Notice how selected nation is no longer applied to player you now
 control. Also, /list may show that you control somebody else.
 
  All this is because server first detaches us from previous player
 (which we were observing) - player removed.

I have confirmed this for S2_1.

When compiling the patch I get

stdinhand.c: In function `take_command':
stdinhand.c:2899: warning: 'was_observing_this' might be used 
uninitialized in this function

There is also typo in a comment: obserwing.


--
好きなわけないぞ

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


[Freeciv-Dev] (PR#40237) S_RESOURCE_VALID and S_PILLAGE_BASE break tile_has_any_specials

2008-05-07 Thread Madeline Book

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

Using tile_has_any_specials to test for the presence of any
specials can spuriosly return TRUE even if the tile has
no specials.

By specials I mean those in [0, S_LAST), i.e. those given by
tile_special_type_iterate and causing pretty pictures to
be drawn on the world, not the fake specials S_RESOURCE_VALID
and S_PILLAGE_BASE. :(

The abuse of struct tile's bv_special special field to hold
the fake specials then causes tile_has_any_specials to act
confusingly (e.g. it would return TRUE, but then iterating
through the specials would not find any... :().

Modifying tile_has_any_specials to account for the fake
specials is not a good solution; the fakers need to be moved
out of bv_special and into their own fields in struct tile
(or whereever).

Ugh.


--
出てけ!二度と見たくない。


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