Re: [Freeciv-Dev] (PR#39935) cities not disbanded by building engeers at 1pop.

2007-12-10 Thread Egor Vyscrebentsov

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

On Fri, 30 Nov 2007 23:37:40 -0800 Daniel Markstedt wrote:

 On Dec 1, 2007 12:13 PM, Karl Goetz kamping_kaiser wrote:
 
  Freeciv: 2.1
  apt-cache policy freeciv-data
  freeciv-data:
Installed: 2.1.0-1
Candidate: 2.1.0-1
 
  when building an engineer in a city with a population of 1, the city is
  not disbanded. the 'disband city' tickbox in 'settings' has been
  selected.
  This has happened in multiple cities, both built by me or conquered.

 This is the correct behavior. You have to build a _settler_ to disband the 
 city.

Could you build settler when you know engineers?
This behavior seems to be buggy for me - city of N size _should_ be destroyed
when build any unit with population cost = N.

-- 
Thanks, evyscr



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


Re: [Freeciv-Dev] (PR#39935) cities not disbanded by building engeers at 1pop.

2007-12-10 Thread Erik Johansson

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

On Dec 10, 2007 11:38 AM, Egor Vyscrebentsov [EMAIL PROTECTED] wrote:

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

 On Fri, 30 Nov 2007 23:37:40 -0800 Daniel Markstedt wrote:
 
  On Dec 1, 2007 12:13 PM, Karl Goetz kamping_kaiser wrote:
  
   Freeciv: 2.1
   apt-cache policy freeciv-data
   freeciv-data:
 Installed: 2.1.0-1
 Candidate: 2.1.0-1
  
   when building an engineer in a city with a population of 1, the city is
   not disbanded. the 'disband city' tickbox in 'settings' has been
   selected.
   This has happened in multiple cities, both built by me or conquered.
 
  This is the correct behavior. You have to build a _settler_ to disband the 
  city.

 Could you build settler when you know engineers?
 This behavior seems to be buggy for me - city of N size _should_ be destroyed
 when build any unit with population cost = N.


In the CivII rulset I'm sure that is the case. In the default there is
a new unit called worker that is obsoleted by egineers and these units
doesn't require population to be built, settlers are never obsoleted
and do require population to be built.



-- 
/emj



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


[Freeciv-Dev] (PR#39960) reducing the number of *_info messages sent to client (pass 1)

2007-12-10 Thread William Allen Simpson

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

Implement part of the bug fix proposal in PR#39578.

There are more than 80 calls.  Concentrating on those sent initially.

Because send_player_info() is hidden inside certain functions, remove and
scatter to various code branches instead to reveal code flow.  This also
fixes several potential bugs.

Moreover, in most places that send_all_info() was called, it was immediately
followed by send_player_info(NULL, NULL), duplicated to the connection!

Generally, send_conn_info() after send_game_info() and send_player_info()
because of player number.  This also fixes several potential bugs.

server/connecthand.c
   establish_new_connection()
 repeat calls in various code branches to avoid sending redundant packets.
 bug fix: send_conn_info() after send_game_info() and send_player_info()

   attach_connection_to_player()
 remove redundant calls, scatter to various code branches instead:
   send_game_info(NULL)
   send_player_info(pplayer, NULL)

   lost_connection_to_client()
 send_player_info(pplayer, NULL) was only sent in S_S_RUNNING,
 but also sent sometimes by toggle_ai_player_direct();
 now always send for consistency.

server/srv_main.c
   send_all_info()
 remove redundant call after each call, include within function:
   send_player_info(NULL, NULL)

server/stdinhand.c
   toggle_ai_player_direct()
 remove redundant call, scatter to various code branches instead:
   send_player_info(pplayer, NULL)
 (allows the calls to be moved ahead of sending *_info)

   detach_command()
 bug fix? detaching observer should be sent rulesets (like /take)?




Index: server/srv_main.c
===
--- server/srv_main.c   (revision 14150)
+++ server/srv_main.c   (working copy)
@@ -352,7 +352,8 @@
 
   send_game_info(dest);
   send_map_info(dest);
-  send_player_info_c(NULL, dest);
+  /* avoid redundancy, send to everybody */
+  send_player_info_c(NULL, game.est_connections);
   send_conn_info(game.est_connections, dest);
   send_spaceship_info(NULL, dest);
   send_all_known_tiles(dest);
Index: server/srv_main.h
===
--- server/srv_main.h   (revision 14150)
+++ server/srv_main.h   (working copy)
@@ -59,6 +59,7 @@
 enum server_states server_state(void);
 void set_server_state(enum server_states newstate);
 
+void check_for_full_turn_done(void);
 bool check_for_game_over(void);
 
 bool server_packet_input(struct connection *pconn, void *packet, int type);
@@ -67,14 +68,12 @@
 void pick_random_player_name(const struct nation_type *pnation,
 char *newname);
 void send_all_info(struct conn_list *dest);
-void check_for_full_turn_done(void);
 
 void dealloc_id(int id);
 void alloc_id(int id);
 int get_next_id_number(void);
 void server_game_init(void);
 void server_game_free(void);
-void check_for_full_turn_done(void);
 void aifill(int amount);
 
 extern struct server_arguments srvarg;
Index: server/connecthand.c
===
--- server/connecthand.c(revision 14150)
+++ server/connecthand.c(working copy)
@@ -112,33 +112,50 @@
   if ((pplayer = find_player_by_user(pconn-username))) {
 attach_connection_to_player(pconn, pplayer);
 
+if (game.info.auto_ai_toggle  pplayer-ai.control) {
+  toggle_ai_player_direct(NULL, pplayer);
+}
+
 if (S_S_RUNNING == server_state()) {
   /* Player and other info is only updated when the game is running.
* See the comment in lost_connection_to_client(). */
   send_packet_freeze_hint(pconn);
   send_all_info(dest);
-  send_player_info(NULL,NULL);
   send_diplomatic_meetings(pconn);
   send_packet_thaw_hint(pconn);
   dsend_packet_start_phase(pconn, game.info.phase);
+} else {
+  /* send new player connection to everybody */
+  send_game_info(game.est_connections);
+  send_player_info_c(NULL, game.est_connections);
+  send_conn_info(game.est_connections, dest);
 }
+  } else {
+if (S_S_INITIAL == server_state()  game.info.is_new_game) {
+  if (attach_connection_to_player(pconn, NULL)) {
+sz_strlcpy(pconn-player-name, pconn-username);
 
-/* This must be done after the above info is sent, because it will
- * generate a player-packet which can't be sent until (at least)
- * rulesets are sent. */
-if (game.info.auto_ai_toggle  pplayer-ai.control) {
-  toggle_ai_player_direct(NULL, pplayer);
-}
+/* send new player connection to everybody */
+send_game_info(game.est_connections);
+send_player_info_c(NULL, game.est_connections);
+  } else {
+notify_conn(dest, NULL, E_CONNECTION,
+_(Couldn't attach your connection to new player.));
+freelog(LOG_VERBOSE, %s is not attached to a player, 
pconn-username);
 

Re: [Freeciv-Dev] (PR#39935) cities not disbanded by building engeers at 1pop.

2007-12-10 Thread Egor Vyscrebentsov

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

On Mon, 10 Dec 2007 03:38:47 -0800 Erik Johansson wrote:

 On Dec 10, 2007 11:38 AM, Egor Vyscrebentsov evyscr wrote:
 
  On Fri, 30 Nov 2007 23:37:40 -0800 Daniel Markstedt wrote:
  
   On Dec 1, 2007 12:13 PM, Karl Goetz kamping_kaiser wrote:
[skip/]
when building an engineer in a city with a population of 1, the city is
not disbanded. the 'disband city' tickbox in 'settings' has been
selected.
This has happened in multiple cities, both built by me or conquered.
  
   This is the correct behavior. You have to build a _settler_ to disband 
   the city.
 
  Could you build settler when you know engineers?
  This behavior seems to be buggy for me - city of N size _should_ be 
  destroyed
  when build any unit with population cost = N.

 In the CivII rulset I'm sure that is the case. In the default there is
 a new unit called worker that is obsoleted by egineers and these units
 doesn't require population to be built, settlers are never obsoleted
 and do require population to be built.

Surely you're right (and the code is right too.)
Could this be a documentation problem? I haven't found such possibility.
All the entries of 'disband city' in .po are about settlers only (which is bad
for me, but this is another story.)
So, Karl, I ask you why you decide that building engineer should cost 1 
population?
Was it somewhere in docs or just by analogy with Civ2 rules?
(I'm dancing with civ2 ruleset now, so this is my reason of fail.)

-- 
Thanks, evyscr



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


Re: [Freeciv-Dev] (PR#39959) SaveGame compression level changes when Leaving (re)Loading savegames!

2007-12-10 Thread William Allen Simpson

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

[EMAIL PROTECTED] wrote:
 SaveGame compression 0 (none) reverted back to compression 6 when Leaving  
 Loading a savegame, i would expect, especially since i did not Quit, that my 
 save games would continue to have the same same compression level set in the 
 Server options beforehand, however this is not so...
 
I've not run into this before, but that probably occurs because the entire
game is reloaded from scratch, all the rulesets and everything.

You probably never noticed, but when the server is started, it loads the
(default) ruleset, and when you connect the first time, sends a copy.

Then, when the game is loaded, another entire ruleset is reloaded, too,
and another copy is sent to you.

(Actually, another copy is sent during the load, and another copy is sent
immediately after the load.  And some things are sent several times.  See
PR#39579.  I'm working on it, but fixing too many crashing bugs, so it's
hard to work on improvements.)

There have been some requests for savable server options, but that's
pretty far in the future.  It requires new UI and commands and packets.
Since it's been requested for more than 5 years, obviously it's not easy.

I will take a look at this specific issue.  It shouldn't throw that away.


 Stderr.txt says this: 
 2: Old attributes detected and removed.
 
We all see this, something completely different.  The attributes are
something nobody understands from the CMA, not well documented, and
treated as opaque bit-blobs.  (See PR#39576.)

The problem is that sometimes they are bad, with wrong version fields,
and incorrect lengths, and random idiosyncrasies, so the server cannot
even save and reload them.  So we throw them away.  We even get old
attributes in 2.1.1 itself!



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


Re: [Freeciv-Dev] (PR#39935) cities not disbanded by building engeers at 1pop.

2007-12-10 Thread Karl Goetz

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

On Mon, 2007-12-10 at 09:58 -0800, Egor Vyscrebentsov wrote:
 URL: http://bugs.freeciv.org/Ticket/Display.html?id=39935 
 
 On Mon, 10 Dec 2007 03:38:47 -0800 Erik Johansson wrote:
   Could you build settler when you know engineers?
   This behavior seems to be buggy for me - city of N size _should_ be 
   destroyed
   when build any unit with population cost = N.
 
  In the CivII rulset I'm sure that is the case. In the default there is
  a new unit called worker that is obsoleted by egineers and these units
  doesn't require population to be built, settlers are never obsoleted
  and do require population to be built.
 
 Surely you're right (and the code is right too.)
 Could this be a documentation problem? I haven't found such possibility.
 All the entries of 'disband city' in .po are about settlers only (which is bad
 for me, but this is another story.)
 So, Karl, I ask you why you decide that building engineer should cost 1 
 population?
 Was it somewhere in docs or just by analogy with Civ2 rules?
 (I'm dancing with civ2 ruleset now, so this is my reason of fail.)

it was probably caused by my memories from playing Civ2, and Civ2:Test
of Time.
not sure if it would be worth meantioning in the engineer description
that it wont disband, for civers who forget its not entirely the same ;)
kk

 




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


[Freeciv-Dev] (PR#12188) Alt-t key does not work

2007-12-10 Thread William Allen Simpson

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

As I recently discovered, GDK_t (the letter t) was hijacked
in client/gui-gtk-2.0/gui_main.c keyboard_handler(), just as
GDK_escape (PR#39924), and a host of others.  That breaks
every keyboard + 't' combination.

This puts it in a menu, using the menu string from SDL, so
no new translation is needed.  Not perfect, but better than
nothing  Dunno why nobody fixed this in 2 years.

Hopefully, this fixes the Alt-t problem for you.  (Cannot
test, have no Alt-t commands in English.)  So, I'll commit
immediately, for everybody else to test.

Committed S2_1 revision 14151.

Index: client/gui-gtk-2.0/gui_main.c
===
--- client/gui-gtk-2.0/gui_main.c   (revision 14150)
+++ client/gui-gtk-2.0/gui_main.c   (working copy)
@@ -542,10 +542,6 @@
 key_cancel_action();
 return TRUE;
 
-  case GDK_t:
-key_city_workers(w, ev);
-return TRUE;
-
   default:
 break;
   };
Index: client/gui-gtk-2.0/menu.c
===
--- client/gui-gtk-2.0/menu.c   (revision 14150)
+++ client/gui-gtk-2.0/menu.c   (working copy)
@@ -100,6 +100,7 @@
   MENU_VIEW_SHOW_CITY_NAMES,
   MENU_VIEW_SHOW_CITY_GROWTH_TURNS,
   MENU_VIEW_SHOW_CITY_PRODUCTIONS,
+  MENU_VIEW_SHOW_CITY_WORKERS,
   MENU_VIEW_SHOW_TERRAIN,
   MENU_VIEW_SHOW_COASTLINE,
   MENU_VIEW_SHOW_ROADS_RAILS,
@@ -321,6 +322,9 @@
 if (draw_city_productions ^ GTK_CHECK_MENU_ITEM(widget)-active)
   key_city_productions_toggle();
 break;
+  case MENU_VIEW_SHOW_CITY_WORKERS:
+key_city_workers();
+break;
   case MENU_VIEW_SHOW_TERRAIN:
 if (draw_terrain ^ GTK_CHECK_MENU_ITEM(widget)-active) {
   key_terrain_toggle();
@@ -764,10 +768,11 @@
   { / N_(View) / N_(City _Names),  controln,
view_menu_callback, MENU_VIEW_SHOW_CITY_NAMES,  
CheckItem   },
   { / N_(View) / N_(City G_rowth), controlr,
-   view_menu_callback, MENU_VIEW_SHOW_CITY_GROWTH_TURNS,
-   CheckItem   },
+   view_menu_callback, MENU_VIEW_SHOW_CITY_GROWTH_TURNS,   
CheckItem   },
   { / N_(View) / N_(City _Productions),controlp,
view_menu_callback, MENU_VIEW_SHOW_CITY_PRODUCTIONS,
CheckItem   },
+  { / N_(View) / N_(Draw city worker map grid),t,
+view_menu_callback, MENU_VIEW_SHOW_CITY_WORKERS
},
   { / N_(View) /sep1,NULL,
NULL,   0,  
Separator   },
   { / N_(View) / N_(Terrain),   NULL,
Index: client/gui-gtk-2.0/mapctrl.c
===
--- client/gui-gtk-2.0/mapctrl.c(revision 14150)
+++ client/gui-gtk-2.0/mapctrl.c(working copy)
@@ -458,7 +458,7 @@
 /**
   Draws the on the map the tiles the given city is using
 **/
-void key_city_workers(GtkWidget *w, GdkEventKey *ev)
+void key_city_workers(void)
 {
   int x, y;
   
Index: client/gui-gtk-2.0/mapctrl.h
===
--- client/gui-gtk-2.0/mapctrl.h(revision 14150)
+++ client/gui-gtk-2.0/mapctrl.h(working copy)
@@ -19,8 +19,6 @@
 
 #include mapctrl_g.h
 
-void key_city_workers(GtkWidget *w, GdkEventKey *ev);
-
 gboolean butt_release_mapcanvas(GtkWidget *w, GdkEventButton *ev, gpointer 
data);
 gboolean butt_down_mapcanvas(GtkWidget *w, GdkEventButton *ev, gpointer data);
 gboolean butt_down_overviewcanvas(GtkWidget *w, GdkEventButton *ev, gpointer 
data);
@@ -29,6 +27,8 @@
 gboolean move_overviewcanvas(GtkWidget *w, GdkEventMotion *ev, gpointer data);
 
 void center_on_unit(void);
+void key_city_workers(void);
+
 void popupinfo_popdown_callback(GtkWidget *w, gpointer data);
 
 #endif  /* FC__MAPCTRL_H */
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#39749) [Bug] battle groups keys [EMAIL PROTECTED] don't work on French keyboard

2007-12-10 Thread William Allen Simpson

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

Pepeto _ wrote:
 Battle groups short cuts seems work only with English keyboard. Mine is
 French, and I cannot use this any of this short cuts: I have é'
 instead of [EMAIL PROTECTED]
 
Problems with the French keyboard have been mentioned before.  It was
suggested in (PR#15850) 1, 2, 3, and 4 keys don't move unit that
control and shiftF1 to F12 be used.  Although the ticket was marked
resolved, it didn't even fix its subject, let alone the underlying issues.

These are completely undocumented, so changing is not a problem



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


Re: [Freeciv-Dev] (PR#39956) reducing the number of rulesets sent to client (pass 1)

2007-12-10 Thread William Allen Simpson

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

Seeing a considerable improvement in load time!  Since this should not
affect existing clients in any negative fashion (they just receive fewer
copies of the same things), I've checked it into 2.1, too.  Please test!

Committed S2_1 revision 14152.



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


Re: [Freeciv-Dev] (PR#39935) cities not disbanded by building engineers at 1pop.

2007-12-10 Thread William Allen Simpson

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

The city should disband when engineer takes population and abandon is set!
Otherwise, it's a bug.



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


Re: [Freeciv-Dev] (PR#39961) Open trading tabs from previous turns have wrong data during current trading...

2007-12-10 Thread [EMAIL PROTECTED]

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

WinXp sp2 + FC 211GTK2



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


Re: [Freeciv-Dev] (PR#39957) multiple bugs in HACK handling

2007-12-10 Thread Jason Dorje Short

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

William Allen Simpson wrote:
 URL: http://bugs.freeciv.org/Ticket/Display.html?id=39957 
 
 server/gamehand.c
handle_single_want_hack_req()
  Sent send_ruleset_choices() when HACK is not successful.
  Redundant send_conn_info() when HACK is not successful.
 
 client/connectdlg_common.c
handle_single_want_hack_reply()
  File should be deleted by server, client doesn't always have permission.
 
 Implies every client request should have different file?
 
 Really need different paradigm for 2.2, perhaps the AUTH system?

The purpose of a file-driven HACK check was always to make sure that the 
local connection was given hack access when the client launches the 
server.  It will also give you hack access when you launch client and 
server separately from the same computer (and account); whether this is 
needed I'm not sure.

The former case could be handled more cleanly using environment 
variables.  The client sets the FREECIV_HACK_PASSWORD environment 
variable to some large bit of pseudo-random garbage.  On connecting it 
passes this bit of garbage to the server which is then used to verify 
the connection and provide HACK access.  The only problem is that this 
will ONLY work if the client controls the server's environment - i.e., 
when the client launches the server.

Also the whole point of the HACK check is that the client SHOULD have 
permission to delete the file created.  If the client cannot write to 
that file then it should not be granted hack access.  And yes, a 
separate file is needed for each connection.

-jason




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


[Freeciv-Dev] (PR#39954) Savegame got corrupted - Bug? Cannot Meet with nations any longer.

2007-12-10 Thread Jason Short

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

This is a reintroduction of an old, oft-fixed, and apparently under 2.1
oft-reported bug.

Namely, the save (autosave) is being created with the human player
toggled to AI.  On load the AI flag is not unset.

This happened in the past when the client crashed and the server would
toggle the player to AI before doing an autosave and exiting.  This was
fixed some time ago, I don't remember the PR#.

What we're seeing appears to be the same thing except that in the
reported case it is always happening, not just when the client exits
abnormally.

The results of a human player being set as AI are annoying.  The AI will
move your units at the end of the turn if you didn't already.  It will
change your city productions.  It will do your diplomacy for you, not
letting you do it yourself.  And so on.  This should sound familiar from
a few other recently reported bugs.

The question then is how is the player getting toggled.

-jason


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


Re: [Freeciv-Dev] (PR#12188) Alt-t key does not work

2007-12-10 Thread Jason Dorje Short

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

William Allen Simpson wrote:

 This puts it in a menu, using the menu string from SDL, so
 no new translation is needed.  Not perfect, but better than
 nothing  Dunno why nobody fixed this in 2 years.

I considered doing this a long time ago.  The problem is that when used 
from the menu it will do nothing, or at least it will not do anything 
like what you might expect it to do.

This command depends on the mouse location - maybe it should be a mouse 
click and not a keyboard command?

-jason



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


[Freeciv-Dev] (PR#39961) Open trading tabs from previous turns have wrong data during current trading...

2007-12-10 Thread Jason Short

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

 [EMAIL PROTECTED] - Mon Dec 10 23:16:18 2007]:
 
 Any open trading tabs from previous turns have wrong data during
current trading because there is no refresh.  For example, Gold
data is not refreshed and a NEW trading tab is not opened, so...
trading with Gold is all wrong.

Are you talking about diplomacy?  If not, what do you mean by trading
tabs?

-jason


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


Re: [Freeciv-Dev] (PR#39935) cities not disbanded by building engineers at 1pop.

2007-12-10 Thread Jason Dorje Short

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

William Allen Simpson wrote:
 URL: http://bugs.freeciv.org/Ticket/Display.html?id=39935 
 
 The city should disband when engineer takes population and abandon is set!
 Otherwise, it's a bug.

But engineer doesn't take population.  It's not a bug.  Nor is there 
anything that needs fixing, unless someone finds some part of the 
documentation that doesn't differentiate worker-type from settler-type 
units.

-jason



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


[Freeciv-Dev] (PR#39959) SaveGame compression level changes when Leaving (re)Loading savegames!

2007-12-10 Thread Jason Short

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

Not sure how you could get the idea this was caused by the rulesets...

The bug is simple; compress_level (and in the development version,
compress_type) are not saved in the savegame.

Attached are some quick patches to fix it.  This should get a bit of
review; care must be taken on load since the available compression types
may not be the same as when the game was saved.

The compress_type is saved as an integer meaning the enumeration order
gets linked to the savegame format.  Alternately this could be saved as
a string I suppose.  In 2.1 the compress_type is explicitly saved as
zlib (1) so such games loaded in 2.2 will continue to use zlib
compression rather than switching mid-game.

-jason

Index: utility/ioz.h
===
--- utility/ioz.h	(revision 14152)
+++ utility/ioz.h	(working copy)
@@ -27,6 +27,7 @@
 typedef struct fz_FILE_s fz_FILE;
 
 /* (possibly) supported methods (depending on config.h) */
+/* Do not reorder these or compatibility will be broken. */
 enum fz_method { FZ_PLAIN = 0, FZ_ZLIB = 1, FZ_BZIP2 = 2, FZ_LAST };
 #define FZ_NOT_USED FZ_LAST
 
Index: server/settings.c
===
--- server/settings.c	(revision 14152)
+++ server/settings.c	(working copy)
@@ -197,25 +197,7 @@
 
 
 //
-#if defined(HAVE_LIBBZ2)
-#define GAME_MIN_COMPRESS_TYPE FZ_PLAIN
-#define GAME_MAX_COMPRESS_TYPE FZ_BZIP2
-#define GAME_DEFAULT_COMPRESS_TYPE FZ_BZIP2
 
-#elif defined(HAVE_LIBZ)
-#define GAME_MIN_COMPRESS_TYPE FZ_PLAIN
-#define GAME_MAX_COMPRESS_TYPE FZ_ZLIB
-#define GAME_DEFAULT_COMPRESS_TYPE FZ_ZLIB
-
-#else
-#define GAME_MIN_COMPRESS_TYPE FZ_PLAIN
-#define GAME_MAX_COMPRESS_TYPE FZ_PLAIN
-#define GAME_DEFAULT_COMPRESS_TYPE FZ_PLAIN
-
-#endif
-
-//
-
 #define GEN_BOOL(name, value, sclass, scateg, slevel, to_client,	\
 		 short_help, extra_help, func, _default)		\
   {name, sclass, to_client, short_help, extra_help, SSET_BOOL,		\
Index: server/savegame.c
===
--- server/savegame.c	(revision 14152)
+++ server/savegame.c	(working copy)
@@ -3720,6 +3720,26 @@
 game.info.diplomacy = secfile_lookup_int_default(file, GAME_DEFAULT_DIPLOMACY, 
 game.diplomacy);
 
+game.info.save_compress_level
+  = secfile_lookup_int_default(file, GAME_DEFAULT_COMPRESS_LEVEL,
+   game.compress_level);
+game.info.save_compress_type
+  = secfile_lookup_int_default(file, GAME_DEFAULT_COMPRESS_TYPE,
+   game.compress_type);
+#ifndef HAVE_LIBBZ2
+if (game.info.save_compress_type == FZ_BZIP2) {
+  game.info.save_compress_type = GAME_DEFAULT_COMPRESS_TYPE;
+}
+#endif
+#ifndef HAVE_LIBZ
+if (game.info.save_compress_type == FZ_ZLIB) {
+  game.info.save_compress_type = GAME_DEFAULT_COMPRESS_TYPE;
+}
+#endif
+if (game.info.save_compress_type == FZ_PLAIN) {
+  game.info.save_compress_level = 0;
+}
+
 sz_strlcpy(game.save_name,
 	   secfile_lookup_str_default(file, GAME_DEFAULT_SAVE_NAME,
 	  game.save_name));
@@ -4329,6 +4349,9 @@
   /* Write civstyle for compatibility with old servers */
   secfile_insert_int(file, 2, game.civstyle);
   secfile_insert_int(file, game.info.save_nturns, game.save_nturns);
+  secfile_insert_int(file,
+		 game.info.save_compress_level, game.compress_level);
+  secfile_insert_int(file, game.info.save_compress_type, game.compress_type);
   secfile_insert_str(file, game.save_name, game.save_name);
   secfile_insert_int(file, game.info.aifill, game.aifill);
   secfile_insert_bool(file, game.scorelog, game.scorelog);
Index: common/game.h
===
--- common/game.h	(revision 14152)
+++ common/game.h	(working copy)
@@ -346,6 +346,24 @@
 #define GAME_MIN_COMPRESS_LEVEL 1
 #define GAME_MAX_COMPRESS_LEVEL 9
 
+#if defined(HAVE_LIBBZ2)
+#define GAME_MIN_COMPRESS_TYPE FZ_PLAIN
+#define GAME_MAX_COMPRESS_TYPE FZ_BZIP2
+#define GAME_DEFAULT_COMPRESS_TYPE FZ_BZIP2
+
+#elif defined(HAVE_LIBZ)
+#define GAME_MIN_COMPRESS_TYPE FZ_PLAIN
+#define GAME_MAX_COMPRESS_TYPE FZ_ZLIB
+#define GAME_DEFAULT_COMPRESS_TYPE FZ_ZLIB
+
+#else
+#define GAME_MIN_COMPRESS_TYPE FZ_PLAIN
+#define GAME_MAX_COMPRESS_TYPE FZ_PLAIN
+#define GAME_DEFAULT_COMPRESS_TYPE FZ_PLAIN
+
+#endif
+
+
 #define GAME_DEFAULT_ALLOWED_CITY_NAMES 1
 #define GAME_MIN_ALLOWED_CITY_NAMES 0
 #define GAME_MAX_ALLOWED_CITY_NAMES 3
Index: server/savegame.c
===
--- server/savegame.c	(revision 14152)
+++ server/savegame.c	(working copy)
@@ -3731,6 +3731,13 @@
 game.info.diplomacy = secfile_lookup_int_default(file, GAME_DEFAULT_DIPLOMACY, 
   

Re: [Freeciv-Dev] (PR#8737) mapview centering error caused by panel resize

2007-12-10 Thread Jason Dorje Short

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

Christian Knoke wrote:
 URL: http://bugs.freeciv.org/Ticket/Display.html?id=8737 
 
 Jason schrieb am 09. Dec um 22:48 Uhr:
 
 I stand by my claim that the proper solution is that the widget should
 auto-resize to be larger but never to be smaller.  I find it hard to
 believe GTK cannot be easily configured for this, though vasco seemed to
 think that was the case and that intercepting the signal was the only
 solution.  Even if this were done there might still be some translation
 issues as there is no real upper bound on how long a line might be.
 
 What about adding just one (constant) line and break up the terrain
 properties properly?

What does that mean?

 An alternative might be to embed this widget into a scrollable frame. 
 Then if it exceeds the size rather than resizing the container it will
 just add scrollbars.  Not perfect but surely better than the current system.
 
 Hey you'll get two scrollbars then ...

You mean in addition to the mapview scrollbar?  That's not a problem.

-jason



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


[Freeciv-Dev] (PR#39957) multiple bugs in HACK handling

2007-12-10 Thread Jason Short

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

 [book - Mon Dec 10 16:22:28 2007]:

 We ameliorated this situation somewhat for warserver by
 introducing/modifying the cmdlevels to:

[...]

What's the difference between ADMIN and CTRL access levels?

-jason


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