Re: [Freeciv-Dev] (PR#15097) air units only autoroute to my cities (or allies)

2007-03-18 Thread Daniel Markstedt

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

On 3/8/07, Per I. Mathisen [EMAIL PROTECTED] wrote:

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

 My version of the allow-aircraft-to-goto patch. It allows movement
 anywhere as long as we have movement points to return, and allow
 attacks, even suicidal ones. Of course, it is still not perfect, since
 for example fighters cannot goto to see the enemy and then attack it,
 but I think it is a highly useful band-aid before we come up with
 something better.

   - Per


Doesn't apply cleanly to S2_1 (the branch that most desperately needs
this band-aid.)

 ~Daniel



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


[Freeciv-Dev] (PR#38358) 2.1.0-beta3-sdl crash reports

2007-03-18 Thread Lauri Uotinen

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

Hi!

We played some test games with the 2.1.0-beta3-sdl clients. Here are our 
findings:

Game crashed for Mikko Boman on these occasions:
- After exiting the Units (F2?) menu (could not reproduce)
- After changing the resolution to larger (could not reproduce) 1)
1) After restarting the game the main menu was no longer shown
and he had to join the test game with command line switches
(-a -s [server ip])

Game crashed for Sini Leppäkoski on these occasions:
- After pressing Enter  (could not reproduce, obviously :) 2)
- After pressing Enter  (could not reproduce, obviously :) 2)
1) This crashing had something to do with memory, since the computer
started hd-swapping before the crash occurred. The tested computer
has 512 MB of RAM. The crashes occurred before 1000 BC.

Fortunately, only the clients crashed. The server was stable, so crashing
was more of an annoyance, really. If AUTOTOGGLE is set then this is
more than annoying, since then the AI changes everything you have
commanded...

Suggestions:
Mikko: You should have a private chatline in the diplomacy window to 
discuss the terms
Sini: You could right-click on enemy units and ask them to leave your 
territory. Basically, they
would just send a message to their leader that they have been asked to 
leave and offer an option
to focus and center on the unit in question.

Regards,
Lauri Uotinen relaying (and translating) the report by
Sini Leppäkoski and
Mikko Boman



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


Re: [Freeciv-Dev] (PR#38311) 2.1_beta3 air attack does not work ?

2007-03-18 Thread Per I. Mathisen

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

On Sat, 17 Mar 2007, alain Baeckeroot wrote:
 A game imported from 2.0.8, then played enough to get
 cruise missiles and bombers.
 None seem to work:
 - i can move them to my cities or allied cities
 - i can never attack boats, earth units or cities (always red cursor)

 i can provide saved game if needed.

Known problem. Goto generally does not work for air units, but arrow keys 
should work fine. I have a patch, but it has not been committed yet.

   - Per



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


[Freeciv-Dev] (PR#13864) Data: Kurd nation

2007-03-18 Thread Daniel Markstedt

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

Completely reworked Kurd nation. This flag is that of the 19th century
Soran Emirate.

 ~Daniel



kurd.ruleset
Description: Binary data
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#38046) default ruler titles, revisited

2007-03-18 Thread Daniel Markstedt

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

Patch to change default despotism title to Chief. Won't break
translations, since Chief and ?female:Chief is already in for
example zulu.ruleset.

 ~Daniel



despotism_title.diff
Description: Binary data
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#38363) freecive: failure to use SDL.

2007-03-18 Thread James Supancic

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

Version: freeciv-2.0.9.
Output:
1: Error calling Mix_OpenAudio
1: Plugin sdl found but can't be initialized.
1: Plugin esd found but can't be initialized.
1: Plugin alsa found but can't be initialized.
1: No real audio subsystem managed to initialize!
1: Perhaps there is some misconfigurationg or bad permissions
2: Proceeding with sound support disabled

I don't care about lacking sound. But I would like to run FreeCiv in
SDL mode. Why can't my SDL plugin be initialized?

Thank you for  your time,
James Steven Supancic III



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


Re: [Freeciv-Dev] (PR#34529) [wishlist/GTK2] hide unreachable techs from players

2007-03-18 Thread Marko Lindqvist

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

On 3/17/07, Marko Lindqvist [EMAIL PROTECTED] wrote:
 On 1/25/07, Daniel Markstedt [EMAIL PROTECTED] wrote:
 
  This is an issue with larger scale scenarios: nation/race specific
  technologies clutter the tech tree overview in the GTK2 client.

  Patch for S2_1 attached.

  In trunk this introduces a problem that techs with root_req cannot be
 given to player even in editor mode.

 Untested version for trunk.


 - ML

diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/menu.c freeciv/client/gui-gtk-2.0/menu.c
--- freeciv/client/gui-gtk-2.0/menu.c	2007-03-14 13:15:03.0 +0200
+++ freeciv/client/gui-gtk-2.0/menu.c	2007-03-18 14:32:31.0 +0200
@@ -607,6 +607,7 @@
   switch(callback_action) {
   case MENU_EDITOR_TOGGLE:
 key_editor_toggle();
+popdown_science_dialog(); /* Unreachbale techs in reqtree on/off */
 break;
   case MENU_EDITOR_TOOLS:
 editdlg_show_tools();
diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/repodlgs.c freeciv/client/gui-gtk-2.0/repodlgs.c
--- freeciv/client/gui-gtk-2.0/repodlgs.c	2007-03-12 20:47:50.0 +0200
+++ freeciv/client/gui-gtk-2.0/repodlgs.c	2007-03-18 14:27:23.0 +0200
@@ -235,12 +235,20 @@
 static GtkWidget *create_reqtree_diagram(void)
 {
   GtkWidget *sw;
-  struct reqtree *reqtree = create_reqtree();
+  struct reqtree *reqtree;
   GtkAdjustment* adjustment;
   int width, height;
   int x;
   Tech_type_id researching;
 
+  if (can_conn_edit(aconnection)) {
+/* Show all techs in editor mode, not only currently reachable ones */
+reqtree = create_reqtree(NULL);
+  } else {
+/* Show only at some point reachable techs */
+reqtree = create_reqtree(game.player_ptr);
+  }
+
   get_reqtree_dimensions(reqtree, width, height);
 
   sw = gtk_scrolled_window_new(NULL, NULL);
diff -Nurd -X.diff_ignore freeciv/client/reqtree.c freeciv/client/reqtree.c
--- freeciv/client/reqtree.c	2007-03-05 21:12:22.0 +0200
+++ freeciv/client/reqtree.c	2007-03-18 14:22:15.0 +0200
@@ -367,8 +367,10 @@
   Create a dummy tech tree from current ruleset.  This tree is then
   fleshed out further (see create_reqtree). This tree doesn't include
   dummy edges. Layering and ordering isn't done also.
+
+  If pplayer is given, add only techs reachable by that player to tree.
 */
-static struct reqtree *create_dummy_reqtree(void)
+static struct reqtree *create_dummy_reqtree(struct player *pplayer)
 {
   struct reqtree *tree = fc_malloc(sizeof(*tree));
   struct advance *advance;
@@ -380,6 +382,12 @@
   nodes[tech] = NULL;
   continue;
 }
+if (pplayer  !tech_is_available(pplayer, tech)) {
+  /* Reqtree requested for particular player and this tech is
+   * unreachable to him/her. */
+  nodes[tech] = NULL;
+  continue;
+}
 nodes[tech] = new_tree_node();
 nodes[tech]-is_dummy = FALSE;
 nodes[tech]-tech = tech;
@@ -389,13 +397,18 @@
 if (!tech_exists(tech)) {
   continue;
 }
+if (nodes[tech] == NULL) {
+  continue;
+}
+
 advance = advances[tech];
 /* Don't include redundant edges */
 if (advance-req[0] != A_NONE  advance-req[1] != A_LAST) {
   if ((advance-req[1] != A_NONE
-	!is_tech_a_req_for_goal(game.player_ptr, advance-req[0],
-  advance-req[1]))
-	  || advance-req[1] == A_NONE) {
+   !is_tech_a_req_for_goal(game.player_ptr, advance-req[0],
+ advance-req[1]))
+ || advance-req[1] == A_NONE) {
+
 	add_requirement(nodes[tech], nodes[advance-req[0]]);
   }
 
@@ -789,13 +802,15 @@
 /*
   Generate optimized tech_tree from current ruleset.
   You should free it by destroy_reqtree.
+
+  If pplayer is not NULL, techs unreachable to that player are not shown.
 */
-struct reqtree *create_reqtree(void)
+struct reqtree *create_reqtree(struct player *pplayer)
 {
   struct reqtree *tree1, *tree2;
   int i, j;
 
-  tree1 = create_dummy_reqtree();
+  tree1 = create_dummy_reqtree(pplayer);
   longest_path_layering(tree1);
   tree2 = add_dummy_nodes(tree1);
   destroy_reqtree(tree1);
diff -Nurd -X.diff_ignore freeciv/client/reqtree.h freeciv/client/reqtree.h
--- freeciv/client/reqtree.h	2007-03-05 21:12:22.0 +0200
+++ freeciv/client/reqtree.h	2007-03-18 14:22:15.0 +0200
@@ -32,7 +32,7 @@
 
 struct reqtree;
 
-struct reqtree *create_reqtree(void);
+struct reqtree *create_reqtree(struct player *pplayer);
 void destroy_reqtree(struct reqtree *tree);
 
 void get_reqtree_dimensions(struct reqtree *tree,
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#38372) [Bug] AI tries to trade unreachable techs

2007-03-18 Thread Marko Lindqvist

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

1: Treaty: The White Horde can't have tech Asian Architecture


 - ML



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


[Freeciv-Dev] (PR#38378) [Patch] Check rulesets for barbarian nation

2007-03-18 Thread Marko Lindqvist

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

 If there is no barbarian nation defined, game will assert later.
Atatched patch adds sanity checking to ruleset load. This is for S2_1.
Trunk will need different patch, as there land and sea barbarians use
separate nations.


 - ML

diff -Nurd -X.diff_ignore freeciv/server/ruleset.c freeciv/server/ruleset.c
--- freeciv/server/ruleset.c	2007-03-05 19:13:46.0 +0200
+++ freeciv/server/ruleset.c	2007-03-18 16:38:48.0 +0200
@@ -2004,6 +2004,7 @@
   char **leaders, **sec, **civilwar_nations, **groups, **conflicts;
   char* name;
   const char *filename = secfile_filename(file);
+  int barbarians = 0;
 
   (void) check_ruleset_capabilities(file, +1.9, filename);
   
@@ -2106,6 +2107,17 @@
 pl-is_barbarian = secfile_lookup_bool_default(file, FALSE,
 		  %s.is_barbarian, sec[i]);
 
+if (pl-is_barbarian) {
+  if (pl-is_playable) {
+/* We can't allow players to use barbarian nations, barbarians
+ * may run out of nations */
+freelog(LOG_ERROR, Nation %s marked both barbarian and playable.,
+pl-name);
+exit(EXIT_FAILURE);
+  }
+  barbarians++;
+}
+
 /* Flags */
 
 sz_strlcpy(pl-flag_graphic_str,
@@ -2244,6 +2256,12 @@
   free(sec);
   section_file_check_unused(file, filename);
   section_file_free(file);
+
+  if (barbarians  1) {
+freelog(LOG_FATAL,
+No barbarian nation in rulesets, at least one required!);
+exit(EXIT_FAILURE);
+  }
 }
 
 /**
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#37988) [Patch] Tileset suggestion to game.ruleset

2007-03-18 Thread Marko Lindqvist

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

On 3/14/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

 On 3/12/07, Marko Lindqvist [EMAIL PROTECTED] wrote:
 
   This patch implements tileset suggestions to game.ruleset. If
  game.ruleset contains tileset.suggest -entry, it is sent to client in
  packet_ruleset_control. Client then asks from user if tileset should
  be changed. Gtk client supports this. Other clients will not even
  compile with this patch version.

  - Ruleset entry is now tileset.prefered. I didn't want to repeat word
 'tileset' as in tileset.prefered_tileset.
  - Internal namespace changes 'suggested' - 'prefered'
  - Word 'Ruleset' - 'Modpack' in popup message. It may be less
 accurate, but I believe end user is more likely to understand latter.
  - Added warning that it might be impossible to use modpack without
 suggested tileset
  - Added stub functions for other clients, so they at least compile

 - Updated against svn


 - ML

diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/Makefile.am freeciv/client/gui-gtk-2.0/Makefile.am
--- freeciv/client/gui-gtk-2.0/Makefile.am	2007-03-05 21:11:59.0 +0200
+++ freeciv/client/gui-gtk-2.0/Makefile.am	2007-03-18 18:36:20.0 +0200
@@ -92,6 +92,6 @@
 	sprite.c	\
 	sprite.h	\
 	themes.c	\
+	tileset_dlg.c	\
 	wldlg.c		\
 	wldlg.h	
-
diff -Nurd -X.diff_ignore freeciv/client/gui-gtk-2.0/tileset_dlg.c freeciv/client/gui-gtk-2.0/tileset_dlg.c
--- freeciv/client/gui-gtk-2.0/tileset_dlg.c	1970-01-01 02:00:00.0 +0200
+++ freeciv/client/gui-gtk-2.0/tileset_dlg.c	2007-03-18 18:36:20.0 +0200
@@ -0,0 +1,82 @@
+/** 
+ Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2, or (at your option)
+   any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include config.h
+#endif
+
+#include gtk/gtk.h
+
+#include fcintl.h
+
+#include game.h
+#include unitlist.h
+
+#include tilespec.h
+
+#include dialogs_g.h
+
+static void tileset_suggestion_callback(GtkWidget *dlg, gint arg);
+
+/
+  Callback either loading suggested tileset or doing nothing
+*/
+static void tileset_suggestion_callback(GtkWidget *dlg, gint arg)
+{
+  if (arg == GTK_RESPONSE_YES) {
+/* User accepted tileset loading */
+tilespec_reread(game.control.prefered_tileset);
+  }
+}
+
+/
+  Popup dialog asking if ruleset suggested tileset should be
+  used.
+*/
+void popup_tileset_suggestion_dialog(void)
+{
+  GtkWidget *dialog, *label;
+  char buf[1024];
+
+  dialog = gtk_dialog_new_with_buttons(_(Prefered tileset),
+   NULL,
+   0,
+   _(Load tileset),
+   GTK_RESPONSE_YES,
+   _(Keep current tileset),
+   GTK_RESPONSE_NO,
+   NULL);
+  gtk_dialog_set_default_response(GTK_DIALOG(dialog), GTK_RESPONSE_YES);
+  gtk_window_set_destroy_with_parent(GTK_WINDOW(dialog), TRUE);
+
+  sprintf(buf,
+  _(Modpack suggest using %s tileset.\n
+It might not work with other tilesets.\n
+You are currently using tileset %s.),
+  game.control.prefered_tileset, tileset_get_name(tileset));
+
+  label = gtk_label_new(buf);
+  gtk_container_add(GTK_CONTAINER(GTK_DIALOG(dialog)-vbox), label);
+  gtk_label_set_justify(GTK_LABEL(label), GTK_JUSTIFY_CENTER);
+  gtk_widget_show(label);
+
+  g_signal_connect(dialog, response,
+   G_CALLBACK(tileset_suggestion_callback), NULL);
+
+  /* In case incoming rulesets are incompatible with current tileset
+   * we need to block their receive before user has accepted loading
+   * of the correct tileset. */
+  gtk_dialog_run(GTK_DIALOG(dialog));
+
+  gtk_widget_destroy(dialog);
+}
diff -Nurd -X.diff_ignore freeciv/client/gui-sdl/dialogs.c freeciv/client/gui-sdl/dialogs.c
--- freeciv/client/gui-sdl/dialogs.c	2007-03-08 18:42:40.0 +0200
+++ freeciv/client/gui-sdl/dialogs.c	2007-03-18 18:36:20.0 +0200
@@ -3074,3 +3074,11 @@
   redraw_group(pNationDlg-pBeginWidgetList, pNationDlg-pEndWidgetList, 

Re: [Freeciv-Dev] (PR#38372) [Bug] AI tries to trade unreachable techs

2007-03-18 Thread Peter Schaefer

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

Interesting question, there probably would be room for a flag that
allows trading techs unreachable to other nations. Dunno if it would
be used much

On 3/18/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

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

 1: Treaty: The White Horde can't have tech Asian Architecture


  - ML



 ___
 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


Re: [Freeciv-Dev] (PR#37592) Project directions

2007-03-18 Thread (Eddie_Anderson)

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

Per I. Mathisen [EMAIL PROTECTED] wrote:

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

On Mon, 5 Mar 2007, (Eddie_Anderson) wrote:
   a) Reduce the government corruption penalty for Despotism and
  Anarchy to 10%.

  Both Despotism and Anarchy impose penalties at the tile level.
  For tiles like fish, that represents a 33% penalty of its food
  production.  I don't understand why there is an additional 37%
  penalty (plus a distance penalty) on top of that.

I agree that the recent corruption changes may have penalized the early 
governments a little bit too much.

I've changed my mind about this one.  Part of the beauty of the
original proposal (IMO) was that it was simple (a one line change in
a ruleset, IIRC).  But I think that I have a better idea now.
Please tell me what you think of it.  Here it is:

Get rid of the per tile penalties for Despotism and Anarchy.

E.g. as it is now, if you put a citizen of a city on a Spice
tile (while your government type is Despotism), then that tile
produces 2 food, 0 shields, and 3 trade (2-0-3).  Yet, under any
other gov't type, that tile would produce 3-0-4.  I propose making
that tile's output 3-0-4 at all times (regardless of your gov't
type).

Here are some of the reasons for eliminating the per tile
penalty:

1) It is a newbie trap.

2) It would remove the need for putting parenthetical values on the
   tile info displays.

3) It would concentrate the waste/corruption penalties in one place
   (the ruleset) which would make it easier to tune those penalties
   in the future.

4) It increases the benefits of choosing good city sites.

If this is implemented, then there are some other things that
may be worth doing too:

1) Restore Whales tiles back to 2-2-3 (Food-Shields-Trade).

   AIUI part of why a Whales tile (at 2-2-3) was disproportionately
   valuable was because most of its production flew under the
   radar of Despotism's per tile penalties.  But with the per tile
   penalties removed, other special tiles would be more competitive
   with the Whales tile's original values.

2) Make Anarchy significantly more wasteful than Despotism.

   Either make Anarchy's waste greater or Despotism's less.  IIRC,
   as it is now, there is little difference between them.  IMO that
   seems counterintuitive.

3) Remove the free food and free shield for city centers.

   This is sort of a newbie trap in reverse.  But it helps some tile
   types and not others - which means that what appears on tile info
   displays is sometimes not true.  FWIW, I implemented this on my
   copy of Freeciv a while ago.  AFAICS there were no ill effects on
   game balance.

What do you think?

-Eddie




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


[Freeciv-Dev] (PR#38392) Memory leak in loading city style sprites

2007-03-18 Thread Marko Lindqvist

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

 When ever client connects to new server and gets rulesets (city
styles), tileset_setup_city_tiles() loads city sprites. They are not
freed when connection to old server is cut.
 Note that game.control.num_styles was not necessarily same in the old
server (when memory was allocated for old sprite set) and in new
server.


 - ML



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


Re: [Freeciv-Dev] (PR#37592) Project directions

2007-03-18 Thread Randy Kramer

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

On Sunday 18 March 2007 02:02 pm, Peter Schaefer wrote:
 There always will be newbie traps and Im not sure whether it is a good
 idea to remove complexity from the game. After all, you want some
 learning curve.

+1

Randy Kramer



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


Re: [Freeciv-Dev] (PR#38392) Memory leak in loading city style sprites

2007-03-18 Thread Marko Lindqvist

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

On 3/18/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

  When ever client connects to new server and gets rulesets (city
 styles), tileset_setup_city_tiles() loads city sprites. They are not
 freed when connection to old server is cut.
  Note that game.control.num_styles was not necessarily same in the old
 server (when memory was allocated for old sprite set) and in new
 server.

 This patch frees old city style sprites before loading new ones (or
more typically: loading same ones again)


 - 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	2007-03-11 23:20:28.0 +0200
+++ freeciv/client/gui-gtk-2.0/gui_main.c	2007-03-18 21:15:28.0 +0200
@@ -1408,6 +1408,7 @@
 gdk_gc_set_foreground(mask_bg_gc, pixel);
   }
 
+  tileset_init(tileset);
   tileset_load_tiles(tileset);
 
   /* Only call this after tileset_load_tiles is called. */
diff -Nurd -X.diff_ignore freeciv/client/gui-sdl/gui_main.c freeciv/client/gui-sdl/gui_main.c
--- freeciv/client/gui-sdl/gui_main.c	2007-03-13 15:57:48.0 +0200
+++ freeciv/client/gui-sdl/gui_main.c	2007-03-18 21:16:05.0 +0200
@@ -927,7 +927,8 @@
CF_DRAW_PLAYERS_CEASEFIRE_STATUS|
CF_DRAW_PLAYERS_PEACE_STATUS|
CF_DRAW_PLAYERS_ALLIANCE_STATUS);
-   
+
+  tileset_init(tileset);
   tileset_load_tiles(tileset);
   tileset_use_prefered_theme(tileset);
   
diff -Nurd -X.diff_ignore freeciv/client/gui-win32/gui_main.c freeciv/client/gui-win32/gui_main.c
--- freeciv/client/gui-win32/gui_main.c	2007-03-05 21:12:09.0 +0200
+++ freeciv/client/gui-win32/gui_main.c	2007-03-18 21:16:50.0 +0200
@@ -746,6 +746,7 @@
   SetMenu(root_window,create_mainmenu());
   ShowWindow(root_window,SW_SHOWNORMAL);
   UpdateWindow(root_window);
+  tileset_init(tileset);
   tileset_load_tiles(tileset);
   init_fog_bmp();
   load_cursors();
diff -Nurd -X.diff_ignore freeciv/client/gui-xaw/gui_main.c freeciv/client/gui-xaw/gui_main.c
--- freeciv/client/gui-xaw/gui_main.c	2007-03-05 21:12:03.0 +0200
+++ freeciv/client/gui-xaw/gui_main.c	2007-03-18 21:16:31.0 +0200
@@ -444,6 +444,7 @@
  setup_widgets() has enough colors available:  (on 256-colour systems)
   */
   setup_widgets();
+  tileset_init(tileset);
   tileset_load_tiles(tileset);
   load_intro_gfx();
   load_cursors();
diff -Nurd -X.diff_ignore freeciv/client/tilespec.c freeciv/client/tilespec.c
--- freeciv/client/tilespec.c	2007-03-15 15:48:28.0 +0200
+++ freeciv/client/tilespec.c	2007-03-18 21:14:14.0 +0200
@@ -121,6 +121,7 @@
   struct sprite *sprite;
 } *thresholds;
   } *styles;
+  int num_styles;
 };
 
 struct named_sprites {
@@ -1896,9 +1897,13 @@
 {
   /* get style and match the best tile based on city size */
   int style = get_city_style(pcity);
-  int num_thresholds = city_sprite-styles[style].num_thresholds;
+  int num_thresholds;
   int t;
 
+  assert(style  city_sprite-num_styles);
+
+  num_thresholds = city_sprite-styles[style].num_thresholds;
+
   if (num_thresholds == 0) {
 return NULL;
   }
@@ -1928,10 +1933,14 @@
   int style, size;
   char buffer[128];
 
-  city_sprite-styles = fc_malloc(game.control.styles_count
+  /* Store number of styles we have allocated memory for.
+   * game.control.styles_count might change if client disconnects from
+   * server and connects new one. */
+  city_sprite-num_styles = game.control.styles_count;
+  city_sprite-styles = fc_malloc(city_sprite-num_styles
   * sizeof(*city_sprite-styles));
 
-  for (style = 0; style  game.control.styles_count; style++) {
+  for (style = 0; style  city_sprite-num_styles; style++) {
 int thresholds = 0;
 struct sprite *sprite;
 char *graphic = city_styles[style].graphic;
@@ -1977,7 +1986,7 @@
   if (!city_sprite) {
 return;
   }
-  for (style = 0; style  game.control.styles_count; style++) {
+  for (style = 0; style  city_sprite-num_styles; style++) {
 if (city_sprite-styles[style].thresholds) {
   free(city_sprite-styles[style].thresholds);
 }
@@ -4279,6 +4288,12 @@
 void tileset_setup_city_tiles(struct tileset *t, int style)
 {
   if (style == game.control.styles_count - 1) {
+
+/* Free old sprites */
+free_city_sprite(t-sprites.city.tile);
+free_city_sprite(t-sprites.city.wall);
+free_city_sprite(t-sprites.city.occupied);
+
 t-sprites.city.tile = load_city_sprite(t, city);
 t-sprites.city.wall = load_city_sprite(t, wall);
 t-sprites.city.occupied = load_city_sprite(t, occupied);
@@ -4777,3 +4792,14 @@
 		   default);
   gui_clear_theme();
 }
+
+/
+  Initialize tileset structure
+/
+void tileset_init(struct tileset *t)

[Freeciv-Dev] (PR#38398) [patch] add SDL client prerequisites to INSTALL

2007-03-18 Thread Christian Prochaska

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

This patch adds the SDL client prerequisites to the INSTALL file.

Index: INSTALL
===
--- INSTALL	(Revision 12853)
+++ INSTALL	(Arbeitskopie)
@@ -3,7 +3,7 @@
 ===
 
 This file describes how to compile and install Freeciv. This file is
-last updated 16-Jul-06.
+last updated 18-Mar-07.
 
 There may be a localized version of this file in the ./doc directory,
 named INSTALL.locale (e.g., INSTALL.de).
@@ -12,7 +12,8 @@
  0. Prerequisites:
  1. Prerequisites for the clients:
   1a. Prerequisites for the Gtk+ client:
-  1b. Prerequisites for the Xaw client:
+  1b. Prerequisites for the SDL client:
+  1c. Prerequisites for the Xaw client:
  2. Generating Makefiles
   2a. Generating the Makefile for svn versions:
   2b. Generating the Makefile for release versions:
@@ -181,7 +182,40 @@
 If you are going to make these yourself, build and install them in the
 following order: pkg-config, Glib, Atk, Pango, Gtk+.
 
+1b. Prerequisites for the SDL client:
+=
 
+ - The SDL library.
+
+   Simple DirectMedia Layer is a cross-platform multimedia library designed
+to provide low level access to audio, keyboard, mouse, joystick, 3D hardware
+via OpenGL, and 2D video framebuffer. (http://www.libsdl.org)
+
+   These features make it a good choice for portable games. You may obtain it
+   at:
+
+   http://www.libsdl.org/release/SDL-1.2.11.tar.gz
+
+   To compile the client using the SDL library add --enable-client=sdl
+   to the Freeciv configure script.  See the section below for more 
+   information about the configure script.
+
+ - The SDL_image library.
+ 
+   This library loads the PNG images (with the help of libpng) and converts
+   them to SDL surfaces that can be handled by the SDL library. You may
+   obtain it at:
+   
+   http://www.libsdl.org/projects/SDL_image/release/SDL_image-1.2.5.tar.gz
+   
+ - The freetype library.
+
+   This library helps to render text for the SDL client, using an externally
+   provided TrueType font. You may obtain it at:
+   
+   http://download.savannah.gnu.org/releases/freetype/freetype-2.3.2.tar.gz
+   
+ 
 1c. Prerequisites for the Xaw client:
 =
 
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#38406) [Patch] ai_wants_role_unit() unreachable techs

2007-03-18 Thread Marko Lindqvist

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

 As comment says:  Assigns tech wants for techs to get better units
with given role, but *only for cheapest* to research next unit up
the chain. So it gives want only for one tech, not to every tech that
provide role units.
 This will not help us getting role units, if tech want is increased
for unreachable tech.

 Attached patch makes sure that tech want is given to reachable tech.

 This problem was found when writing another fix for Mongols scenario
(namely: AI should research tech that gives first settler units).


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aitech.c freeciv/ai/aitech.c
--- freeciv/ai/aitech.c	2007-03-05 21:11:52.0 +0200
+++ freeciv/ai/aitech.c	2007-03-19 01:43:08.0 +0200
@@ -256,6 +256,7 @@
 } else if (can_eventually_build_unit(pcity, iunit)) {
   int cost = 0;
   Impr_type_id iimpr = iunit-impr_requirement;
+  bool reachable = TRUE;
 
   if (itech != A_LAST  get_invention(pplayer, itech) != TECH_KNOWN) {
 /* See if we want to invent this. */
@@ -269,22 +270,30 @@
 	  if (preq-source.type == REQ_TECH
 	   (get_invention(pplayer, preq-source.value.tech)
 		!= TECH_KNOWN)) {
-	int iimprtech = preq-source.value.tech;
-	int imprcost = total_bulbs_required_for_goal(pplayer, iimprtech);
+if (tech_is_available(pplayer, preq-source.value.tech)) {
+  int iimprtech = preq-source.value.tech;
+  int imprcost = total_bulbs_required_for_goal(pplayer, iimprtech);
 
-	if (imprcost  cost || cost == 0) {
-	  /* If we already have the primary tech (cost==0),
-	   * or the building's
-	   * tech is cheaper, go for the building's required tech. */
-	  itech = iimprtech; /* get this first */
-	  cost = 0;
-	}
-	cost += imprcost;
+  if (imprcost  cost || cost == 0) {
+/* If we already have the primary tech (cost==0),
+ * or the building's
+ * tech is cheaper, go for the building's required tech. */
+itech = iimprtech; /* get this first */
+cost = 0;
+  }
+  cost += imprcost;
+} else {
+  /* We can't get tech for required building */
+  reachable = FALSE;
+  break;
+}
 	  }
 	} requirement_vector_iterate_end;
   }
 
-  if (cost  best_cost) {
+  if (cost  best_cost
+   tech_is_available(pplayer, itech)
+   reachable) {
 best_tech = itech;
 best_cost = cost;
 best_unit = iunit;
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#38406) [Patch] ai_wants_role_unit() unreachable techs

2007-03-18 Thread Marko Lindqvist

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

On 3/19/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

  Attached patch makes sure that tech want is given to reachable tech.

 Correct patch


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aitech.c freeciv/ai/aitech.c
--- freeciv/ai/aitech.c	2007-03-05 21:11:52.0 +0200
+++ freeciv/ai/aitech.c	2007-03-19 02:06:13.0 +0200
@@ -284,7 +284,7 @@
 	} requirement_vector_iterate_end;
   }
 
-  if (cost  best_cost) {
+  if (cost  best_cost  tech_is_available(pplayer, itech)) {
 best_tech = itech;
 best_cost = cost;
 best_unit = iunit;
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#38409) [Patch] Fix process_attacker_want() crash

2007-03-18 Thread Marko Lindqvist

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

 This fixes process_attacker_want() crash when enemy cannot build
defending units.


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/advmilitary.c freeciv/ai/advmilitary.c
--- freeciv/ai/advmilitary.c	2007-03-18 23:27:54.0 +0200
+++ freeciv/ai/advmilitary.c	2007-03-19 03:05:43.0 +0200
@@ -930,10 +930,14 @@
   }
 
   /* Estimate strength of the enemy. */
-  
-  vuln = unittype_def_rating_sq(punittype, victim_unit_type,
-victim_player,
-ptile, FALSE, veteran);
+
+  if (victim_unit_type) {
+vuln = unittype_def_rating_sq(punittype, victim_unit_type,
+  victim_player,
+  ptile, FALSE, veteran);
+  } else {
+vuln = 0;
+  }
 
   /* Not bothering to s/!vuln/!pdef/ here for the time being. -- Syela
* (this is noted elsewhere as terrible bug making warships yoyoing) 
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev