Re: [Freeciv-Dev] (PR#39477) svn version 13132 breaks tilesets?

2007-08-03 Thread William Allen Simpson

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

Guest wrote:
 I'd also note that I registered this bug on Mon Jul 30 19:01:30, so nice
 new features uploaded on the 31st won't have caused it. 
 
My typo earlier, that was Jul 13th (checked in on the 14th).


 Are you sure the necessary updates have been uploaded to svn? The latest
 amplio.tilespec I have got from svn, having deleted the previous file
 before doing svn update, still doesn't contain a 'layer0.match_style' entry.
 
Quite sure.  There should be *no* 'layer0.match_style'!!!


svn log data/amplio.tilespec

r13120 | wsimpson | 2007-07-20 10:40:01 -0400 (Fri, 20 Jul 2007) | 11 lines

(PR#39381) RFE civ3+ water support

The internal documentation of the ocean_depth parameter was incorrect.  It
is not a percentage, it merely specifies a relative level from 1 to 100.

Revised the ocean_depth to empirical levels that make more plausible
oceans and coastlines.  Still has serious problems with most of the
deep parts next to polar caps, and oceanic ridges near coast.

Also, handled some FIXME comments.


r13118 | wsimpson | 2007-07-19 10:53:44 -0400 (Thu, 19 Jul 2007) | 10 lines

(PR#39381) RFE civ3+ water support

The penultimate step toward civ3+ water.  Add the revised full ocean.png,
and pair ice cliffs, updating the corresponding tilespecs.

Merely enough to test the tile editor and show future graphics.

Old savefiles continue to work, but (by definition) any editted water terrain
will prevent loading by earlier versions.


r13104 | wsimpson | 2007-07-14 16:09:38 -0400 (Sat, 14 Jul 2007) | 15 lines

(PR#39387) replace match_style = full with pair

After much testing, I've completely eliminated match_style, and its
parameters none, bool, and full.

Instead, I've replaced it with match_with, a listing of match_types.
This allows completely orthogonal operations between styles.

This patch doesn't make any substantive changes.  It continues to operate
in exactly the same manner as before, so that old savegames will run
without modification.

Never-the-less, this is the big one!  Old tilesets will no longer work.
(Replacements are provided for the main 5 here.)


r13096 | wsimpson | 2007-07-12 02:57:52 -0400 (Thu, 12 Jul 2007) | 1 line

(PR#39453) amplio civ3+ water, pass 1

r13092 | wsimpson | 2007-07-10 18:52:20 -0400 (Tue, 10 Jul 2007) | 11 lines

(PR#39381) RFE civ3+ water support

A bigger step toward civ3+ land and water.  Add the new water terrain
identifiers to the rulesets, updating the corresponding tilespecs.

This is a straightforward process, duplicating existing terrain information.
Merely enough to test the tile editor and show future graphics.

Old savefiles continue to work, but (by definition) any editted water terrain
will prevent loading by earlier versions.


r13079 | wsimpson | 2007-07-08 15:44:08 -0400 (Sun, 08 Jul 2007) | 6 lines

(PR#39381) RFE civ3+ water support

The next baby step toward amplio civ3+ land and water.  Copy the current
terrain2.png into water.png, and divide the respective .spec file lines.  All
river/water now uses water.spec (except the ocean blending tile in terrain1).




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


Re: [Freeciv-Dev] (PR#39477) svn version 13132 breaks tilesets?

2007-08-03 Thread William Allen Simpson

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

Guest wrote:
 [wsimpson - Tue Jul 31 06:51:16 2007]:
 Are you sure you installed correctly?

 I believe so, unless using svn update has become the incorrect way.
 ...
 
 []$ civclient -t amplio
 1: tilespec file appears incompatible:
 file: ./amplio.tilespec
 file options: +tilespec4.2007.Jul.13
 supported options: +tilespec4 duplicates_ok
 0: No usable default tileset found, aborting!
 
What's obvious from the lines above, you are not running the new binary.
The amplio.tilespec is not the problem, that binary is wrong!

Apparently, there's something wrong with your installation process for
./civclient.  Try ./civ in your make directory.



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


Re: [Freeciv-Dev] (PR#34727) [Patch] Is_boss_of_boat()

2007-08-03 Thread Marko Lindqvist

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

On 28/01/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

  Helper function for units that might control boat. Barbarian leader
 converted to use it. I expect more users in near future.

 Updated against svn


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aiferry.c freeciv/ai/aiferry.c
--- freeciv/ai/aiferry.c	2007-08-03 22:14:15.0 +0300
+++ freeciv/ai/aiferry.c	2007-08-03 22:22:25.0 +0300
@@ -349,6 +349,28 @@
 }
 
 /
+  Check if unit is boss in ferry
+/
+bool is_boss_of_boat(struct unit *punit)
+{
+  struct unit *ferry;
+
+  if (punit-transported_by == -1) {
+/* Not even in boat */
+return FALSE;
+  }
+
+  ferry = player_find_unit_by_id(unit_owner(punit), punit-transported_by);
+
+  if (ferry != NULL
+   ferry-ai.passenger == punit-id) {
+return TRUE;
+  }
+
+  return FALSE;
+}
+
+/
   Proper and real PF function for finding a boat.  If you don't require
   the path to the ferry, pass path=NULL.
   Return the unit ID of the boat; punit is the passenger.
diff -Nurd -X.diff_ignore freeciv/ai/aiferry.h freeciv/ai/aiferry.h
--- freeciv/ai/aiferry.h	2007-01-28 00:33:32.0 +0200
+++ freeciv/ai/aiferry.h	2007-08-03 22:22:25.0 +0300
@@ -60,6 +60,7 @@
 struct pft_amphibious *parameter);
 
 bool is_boat_free(struct unit *boat, struct unit *punit, int cap);
+bool is_boss_of_boat(struct unit *punit);
 
 /*
  * Main boat managing function.  Gets units on board to where they want to
diff -Nurd -X.diff_ignore freeciv/ai/aiunit.c freeciv/ai/aiunit.c
--- freeciv/ai/aiunit.c	2007-08-03 22:14:15.0 +0300
+++ freeciv/ai/aiunit.c	2007-08-03 22:42:33.0 +0300
@@ -2351,38 +2351,33 @@
   return;
   }
 
-  if (leader-transported_by != -1) {
-/* Leader is at boat */
-struct unit *boat = game_find_unit_by_number(leader-transported_by);
-
-if (boat-ai.passenger == leader-id) {
-  /* We are in charge. Of course, since we are the leader...
-   * But maybe somebody more militaristic should lead our ship to battle! */
-
-  /* First release boat from leaders lead */
-  aiferry_clear_boat(leader);
-
-  unit_list_iterate(leader-tile-units, warrior) {
-if (!unit_has_type_role(warrior, L_BARBARIAN_LEADER)
- get_transporter_capacity(warrior) == 0
- warrior-moves_left  0) {
-  /* This seems like a good warrior to lead us in to conquest! */
-  ai_manage_unit(pplayer, warrior);
-
-  /* If we reached our destination, ferryboat already called
-   * ai_manage_unit() for leader. So no need to continue here.
-   * Leader might even be dead.
-   * If this return is removed, surronding unit_list_iterate()
-   * has to be replaced with unit_list_iterate_safe()*/
-  return;
-}
-  } unit_list_iterate_end;
-}
+  if (is_boss_of_boat(leader)) {
+/* We are in charge. Of course, since we are the leader...
+ * But maybe somebody more militaristic should lead our ship to battle! */
+  
+/* First release boat from leaders lead */
+aiferry_clear_boat(leader);
+  
+unit_list_iterate(leader-tile-units, warrior) {
+  if (!unit_has_type_role(warrior, L_BARBARIAN_LEADER)
+   get_transporter_capacity(warrior) == 0
+   warrior-moves_left  0) {
+/* This seems like a good warrior to lead us in to conquest! */
+ai_manage_unit(pplayer, warrior);
 
-/* If we are not in charge of the boat, continue as if we
- * were not in a boat - we may want to leave the ship now. */
+/* If we reached our destination, ferryboat already called
+ * ai_manage_unit() for leader. So no need to continue here.
+ * Leader might even be dead.
+ * If this return is removed, surronding unit_list_iterate()
+ * has to be replaced with unit_list_iterate_safe()*/
+return;
+  }
+} unit_list_iterate_end;
   }
 
+  /* If we are not in charge of the boat, continue as if we
+   * were not in a boat - we may want to leave the ship now. */
+
   /* the following takes much CPU time and could be avoided */
   generate_warmap(tile_get_city(leader-tile), leader);
 
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


Re: [Freeciv-Dev] (PR#37537) [Patch] Base build time

2007-08-03 Thread Marko Lindqvist

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

On 05/03/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

  This makes built time property of base type.

 Updated against svn


 - ML

diff -Nurd -X.diff_ignore freeciv/client/packhand.c freeciv/client/packhand.c
--- freeciv/client/packhand.c	2007-08-03 22:14:26.0 +0300
+++ freeciv/client/packhand.c	2007-08-03 22:50:38.0 +0300
@@ -2433,8 +2433,6 @@
   pterrain-transform_result = terrain_by_number(p-transform_result);
   pterrain-transform_time = p-transform_time;
   pterrain-rail_time = p-rail_time;
-  pterrain-airbase_time = p-airbase_time;
-  pterrain-fortress_time = p-fortress_time;
   pterrain-clean_pollution_time = p-clean_pollution_time;
   pterrain-clean_fallout_time = p-clean_fallout_time;
   
@@ -2505,6 +2503,8 @@
 
   pbase-gui_type = p-gui_type;
 
+  pbase-build_time = p-build_time;
+
   pbase-flags = p-flags;
 
   tileset_setup_base(tileset, pbase);
diff -Nurd -X.diff_ignore freeciv/common/base.h freeciv/common/base.h
--- freeciv/common/base.h	2007-03-09 16:03:32.0 +0200
+++ freeciv/common/base.h	2007-08-03 22:50:38.0 +0300
@@ -47,6 +47,7 @@
   char activity_gfx[MAX_LEN_NAME];
   struct requirement_vector reqs;
   enum base_gui_type gui_type;
+  int build_time;
   bv_unit_classes native_to;
 
   bv_base_flags flags;
diff -Nurd -X.diff_ignore freeciv/common/packets.def freeciv/common/packets.def
--- freeciv/common/packets.def	2007-08-03 22:14:13.0 +0300
+++ freeciv/common/packets.def	2007-08-03 22:50:38.0 +0300
@@ -1264,8 +1264,6 @@
   TERRAIN transform_result;
   UINT8 transform_time;
   UINT8 rail_time;
-  UINT8 airbase_time;
-  UINT8 fortress_time;
   UINT8 clean_pollution_time;
   UINT8 clean_fallout_time;
   
@@ -1292,6 +1290,7 @@
   REQUIREMENT reqs[MAX_NUM_REQS:reqs_count];
   BASE_GUI gui_type;
   BV_UNIT_CLASSES native_to;
+  UINT8 build_time;
   BV_BASE_FLAGS flags;
 end
 
diff -Nurd -X.diff_ignore freeciv/common/terrain.h freeciv/common/terrain.h
--- freeciv/common/terrain.h	2007-08-03 22:14:13.0 +0300
+++ freeciv/common/terrain.h	2007-08-03 22:50:38.0 +0300
@@ -175,8 +175,6 @@
   struct terrain *transform_result;
   int transform_time;
   int rail_time;
-  int airbase_time;
-  int fortress_time;
   int clean_pollution_time;
   int clean_fallout_time;
 
diff -Nurd -X.diff_ignore freeciv/common/tile.c freeciv/common/tile.c
--- freeciv/common/tile.c	2007-08-03 22:14:13.0 +0300
+++ freeciv/common/tile.c	2007-08-03 23:05:36.0 +0300
@@ -315,9 +315,9 @@
 enum base_type_id base)
 {
   if (base == BASE_AIRBASE) {
-return ptile-terrain-fortress_time * ACTIVITY_FACTOR;
+return base_type_get_by_id(BASE_AIRBASE)-build_time * ACTIVITY_FACTOR;
   } else {
-return ptile-terrain-airbase_time * ACTIVITY_FACTOR;
+return base_type_get_by_id(BASE_FORTRESS)-build_time * ACTIVITY_FACTOR;
   }
 
   return 0;
diff -Nurd -X.diff_ignore freeciv/data/civ1/terrain.ruleset freeciv/data/civ1/terrain.ruleset
--- freeciv/data/civ1/terrain.ruleset	2007-08-03 22:13:41.0 +0300
+++ freeciv/data/civ1/terrain.ruleset	2007-08-03 22:54:21.0 +0300
@@ -909,6 +909,7 @@
 ; reqs 	  = requirements to build the base (see effects.ruleset
 ;   and README.effects for help on requirements)
 ; gui_type= How gui should handle this base. Fortress/Airbase/Other
+; build_time  = How long it takes for a unit to build this base
 ; flags
 ;   - NoAggressive  = Units inside are not considered aggressive
 ;   - DefenseBonus  = Units inside gain defense bonus
@@ -929,6 +930,7 @@
   UnitFlag, Settlers, Local
 }
 gui_type = Fortress
+build_time   = 3
 native_to= Land
 flags= NoAggressive, DefenseBonus, ClaimTerritory,
NoStackDeath, DiplomatDefense
@@ -943,5 +945,6 @@
   Tech, Never, Player
 }
 gui_type = Airbase
+build_time   = 3
 native_to= Air, Missile
 flags= NoStackDeath, DiplomatDefense, ParadropFrom
diff -Nurd -X.diff_ignore freeciv/data/civ2/terrain.ruleset freeciv/data/civ2/terrain.ruleset
--- freeciv/data/civ2/terrain.ruleset	2007-08-03 22:13:41.0 +0300
+++ freeciv/data/civ2/terrain.ruleset	2007-08-03 22:53:23.0 +0300
@@ -1000,6 +1000,7 @@
 ; reqs 	  = requirements to build the base (see effects.ruleset
 ;   and README.effects for help on requirements)
 ; gui_type= How gui should handle this base. Fortress/Airbase/Other
+; build_time  = How long it takes for a unit to build this base
 ; flags
 ;   - NoAggressive  = Units inside are not considered aggressive
 ;   - DefenseBonus  = Units inside gain defense bonus
@@ -1020,6 +1021,7 @@
   UnitFlag, Settlers, Local
 }
 gui_type = Fortress
+build_time   = 3
 native_to= Land
 flags= NoAggressive, DefenseBonus, ClaimTerritory,

Re: [Freeciv-Dev] (PR#38323) Crash when initial techs contain unreachable tech

2007-08-03 Thread Marko Lindqvist

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

On 17/03/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

  Nation does not have root_req for its initial tech. At least ruleset
 sanity checking is needed so that game gives sensible error message to
 ruleset author. This is not trivial as we need to check if *nations*
 are legal, but tech_is_available() works on *players*.
  It also seems to me that this crash might happen if initial root_req
 is simply processed later than than tech depending on it.

 This ticket has been closed, but only related commit I can find is
assert removal from trunk.
 I'm going to remove assert from S2_1 and commit full sanity checking
patch to trunk.


 - ML



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


Re: [Freeciv-Dev] (PR#38323) Crash when initial techs contain unreachable tech

2007-08-03 Thread Marko Lindqvist

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

On 17/03/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

 On 3/17/07, Marko Lindqvist [EMAIL PROTECTED] wrote:
 
   Nation does not have root_req for its initial tech. At least ruleset
  sanity checking is needed so that game gives sensible error message to
  ruleset author.

  Sanity checking part of this ticket.

 Updated against svn


 - ML

diff -Nurd -X.diff_ignore freeciv/server/ruleset.c freeciv/server/ruleset.c
--- freeciv/server/ruleset.c	2007-08-03 22:00:33.0 +0300
+++ freeciv/server/ruleset.c	2007-08-04 01:47:45.0 +0300
@@ -124,6 +124,10 @@
 static void send_ruleset_cities(struct conn_list *dest);
 static void send_ruleset_game(struct conn_list *dest);
 
+static bool nation_has_initial_tech(struct nation_type *pnation,
+Tech_type_id tech);
+static bool sanity_check_ruleset_data(void);
+
 /**
   datafilename() wrapper: tries to match in two ways.
   Returns NULL on failure, the (statically allocated) filename on success.
@@ -3509,6 +3513,8 @@
   load_ruleset_effects(effectfile);
   load_ruleset_game();
 
+  sanity_check_ruleset_data();
+
   precalc_tech_data();
 
   script_free();
@@ -3552,3 +3558,92 @@
   lsend_packet_thaw_hint(dest);
   conn_list_do_unbuffer(dest);
 }
+
+/**
+  Does nation have tech initially?
+**/
+static bool nation_has_initial_tech(struct nation_type *pnation,
+Tech_type_id tech)
+{
+  int i;
+
+  /* See if it's given as global init tech */
+  for (i = 0;
+   i  MAX_NUM_TECH_LIST  game.rgame.global_init_techs[i] != A_LAST;
+   i++) {
+if (game.rgame.global_init_techs[i] == tech) {
+  return TRUE;
+}
+  }
+
+  /* See if it's given as national init tech */
+  for (i = 0;
+   i  MAX_NUM_TECH_LIST  pnation-init_techs[i] != A_LAST;
+   i++) {
+if (pnation-init_techs[i] == tech) {
+  return TRUE;
+}
+  }
+
+  return FALSE;
+}
+
+/**
+  Some more sanity checking once all rulesets are loaded. These check
+  for some cross-referencing which was impossible to do while only one
+  party was loaded in load_ruleset_xxx()
+
+  Returns TRUE if everything ok.
+**/
+static bool sanity_check_ruleset_data(void)
+{
+  /* Check that all players can have their initial techs */
+  nations_iterate(pnation) {
+int i;
+
+/* Check global initial techs */
+for (i = 0;
+ i  MAX_NUM_TECH_LIST  game.rgame.global_init_techs[i] != A_LAST;
+ i++) {
+  Tech_type_id tech = game.rgame.global_init_techs[i];
+  if (!tech_exists(tech)) {
+freelog(LOG_FATAL, Tech %s does not exist, but is initial 
+   tech for everyone.,
+advance_rule_name(tech));
+exit(EXIT_FAILURE);
+  }
+  if (advances[tech].root_req != A_NONE
+   !nation_has_initial_tech(pnation, advances[tech].root_req)) {
+/* Nation has no root_req for tech */
+freelog(LOG_FATAL, Tech %s is initial for everyone, but %s has 
+   no root_req for it.,
+advance_rule_name(tech),
+nation_rule_name(pnation));
+exit(EXIT_FAILURE);
+  }
+}
+
+/* Check national initial techs */
+for (i = 0;
+ i  MAX_NUM_TECH_LIST  pnation-init_techs[i] != A_LAST;
+ i++) {
+  Tech_type_id tech = pnation-init_techs[i];
+  if (!tech_exists(tech)) {
+freelog(LOG_FATAL, Tech %s does not exist, but is tech for %s.,
+advance_rule_name(tech), nation_rule_name(pnation));
+exit(EXIT_FAILURE);
+  }
+  if (advances[tech].root_req != A_NONE
+   !nation_has_initial_tech(pnation, advances[tech].root_req)) {
+/* Nation has no root_req for tech */
+freelog(LOG_FATAL, Tech %s is initial for %s, but they have 
+   no root_req for it.,
+advance_rule_name(tech),
+nation_rule_name(pnation));
+exit(EXIT_FAILURE);
+  }
+}
+  } players_iterate_end;
+
+  return TRUE;
+}
___
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-08-03 Thread Marko Lindqvist

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

On 14/03/07, Daniel Markstedt [EMAIL PROTECTED] wrote:

 On 3/12/07, Marko Lindqvist [EMAIL PROTECTED] wrote:
 
   As a usability issue,  maybe we should backport this to S2_1.
 

 Agreed. We just got yet another confused user at
 http://forum.freeciv.org/viewtopic.php?t=2880


 Untested S2_1 version


 - 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 19:14:31.0 +0200
+++ freeciv/client/gui-gtk-2.0/Makefile.am	2007-08-04 02:05:47.0 +0300
@@ -90,6 +90,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-08-04 02:05:47.0 +0300
@@ -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-08-01 19:21:39.0 +0300
+++ freeciv/client/gui-sdl/dialogs.c	2007-08-04 02:05:47.0 +0300
@@ -3075,3 +3075,11 @@
   redraw_group(pNationDlg-pBeginWidgetList, pNationDlg-pEndWidgetList, 0);
   widget_flush(pNationDlg-pEndWidgetList);
 }
+
+/**
+  Ruleset (modpack) has suggested loading certain tileset. Confirm from
+  user and load.
+**/
+void popup_tileset_suggestion_dialog(void)
+{
+}
diff -Nurd -X.diff_ignore freeciv/client/gui-stub/dialogs.c freeciv/client/gui-stub/dialogs.c
--- freeciv/client/gui-stub/dialogs.c	2007-03-05 19:14:35.0 +0200
+++ freeciv/client/gui-stub/dialogs.c	2007-08-04 02:05:47.0 +0300
@@ -151,6 +151,15 

Re: [Freeciv-Dev] (PR#20672) Settler ferry assert

2007-08-03 Thread Marko Lindqvist

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

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

  Magic ruleset problem.

  aisettler code asserts that selected ferry is SEA_MOVING. It gets
 ferries from is_boat_free() which does not limit move_type.

 Patches updated against svn


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aiferry.c freeciv/ai/aiferry.c
--- freeciv/ai/aiferry.c	2007-08-01 17:17:27.0 +0300
+++ freeciv/ai/aiferry.c	2007-08-04 03:09:50.0 +0300
@@ -327,7 +327,7 @@
 
 /
   Runs a few checks to determine if boat is a free boat that can carry
-  cap units of the same type as punit.
+  cap units of the same type as punit over sea.
 /
 bool is_boat_free(struct unit *boat, struct unit *punit, int cap)
 {
@@ -338,14 +338,21 @@
* - Only available boats or boats that are already dedicated to this unit
*   are eligible.
* - Only boats with enough remaining capacity are eligible.
+   * - Only units that can travel at sea are eligible.
+   * - Units that require fuel are lose hitpoints are not eligible.
*/
+  struct unit_class *ferry_class = unit_class(boat);
+
   return (can_unit_transport(boat, punit)
 	   !unit_has_orders(boat)
 	   boat-owner == punit-owner
 	   (boat-ai.passenger == FERRY_AVAILABLE
 	  || boat-ai.passenger == punit-id)
 	   (get_transporter_capacity(boat) 
-	  - get_transporter_occupancy(boat) = cap));
+	  - get_transporter_occupancy(boat) = cap)
+   ferry_class-ai.sea_move != MOVE_NONE
+   !unit_type(boat)-fuel
+   !is_losing_hp(boat));
 }
 
 /
diff -Nurd -X.diff_ignore freeciv/ai/aisettler.c freeciv/ai/aisettler.c
--- freeciv/ai/aisettler.c	2007-08-01 17:17:27.0 +0300
+++ freeciv/ai/aisettler.c	2007-08-04 03:10:17.0 +0300
@@ -552,6 +552,7 @@
   struct player *pplayer = unit_owner(punit);
   struct pf_parameter parameter;
   struct unit *ferry = NULL;
+  struct unit_class *ferry_class = NULL;
 
   assert(pplayer-ai.control);
   /* Only virtual units may use virtual boats: */
@@ -606,7 +607,9 @@
   ferry-tile = punit-tile;
 }
 
-assert(SEA_MOVING == get_unit_move_type(unit_type(ferry)));
+ferry_class = unit_class(ferry);
+
+assert(ferry_class-ai.sea_move != MOVE_NONE);
 pft_fill_unit_overlap_param(parameter, ferry);
 parameter.get_TB = no_fights_or_unknown;
 
diff -Nurd -X.diff_ignore freeciv/ai/aiferry.c freeciv/ai/aiferry.c
--- freeciv/ai/aiferry.c	2007-07-04 14:04:26.0 +0300
+++ freeciv/ai/aiferry.c	2007-08-04 03:12:25.0 +0300
@@ -279,7 +279,7 @@
 
 /
   Runs a few checks to determine if boat is a free boat that can carry
-  cap units of the same type as punit.
+  cap units of the same type as punit over sea.
 /
 bool is_boat_free(struct unit *boat, struct unit *punit, int cap)
 {
@@ -290,14 +290,21 @@
* - Only available boats or boats that are already dedicated to this unit
*   are eligible.
* - Only boats with enough remaining capacity are eligible.
+   * - Land moving units cannot transport others over sea
+   * - Units that require fuel are lose hitpoints are not eligible
*/
+  enum unit_move_type boat_move_type = unit_type(boat)-move_type;
+
   return (can_unit_transport(boat, punit)
 	   !unit_has_orders(boat)
 	   boat-owner == punit-owner
 	   (boat-ai.passenger == FERRY_AVAILABLE
 	  || boat-ai.passenger == punit-id)
 	   (get_transporter_capacity(boat) 
-	  - get_transporter_occupancy(boat) = cap));
+	  - get_transporter_occupancy(boat) = cap)
+   boat_move_type != LAND_MOVING
+   !unit_type(boat)-fuel
+   unit_class(boat)-hp_loss_pct = 0);
 }
 
 /
diff -Nurd -X.diff_ignore freeciv/ai/aisettler.c freeciv/ai/aisettler.c
--- freeciv/ai/aisettler.c	2007-07-04 14:04:26.0 +0300
+++ freeciv/ai/aisettler.c	2007-08-04 03:11:45.0 +0300
@@ -606,7 +606,7 @@
   ferry-tile = punit-tile;
 }
 
-assert(SEA_MOVING == unit_type(ferry)-move_type);
+assert(LAND_MOVING != unit_type(ferry)-move_type);
 pft_fill_unit_overlap_param(parameter, ferry);
 parameter.get_TB = no_fights_or_unknown;
 
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#11051) No helptext for units

2007-08-03 Thread Marko Lindqvist

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

 Ruleset format allows helptexts for units, so this requires no
coding. We are simply missing actual texts.


 - ML



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


Re: [Freeciv-Dev] (PR#38165) Bug in 2.1.0-beta3

2007-08-03 Thread Marko Lindqvist

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

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

  It seems that units should never get foul status inside
 create_unit(). It is no longer called for spies getting foul.
  Attached patch changes create_unit() to always create non-foul units.
 Also, mark spies foul when they actually do something nasty.
  Untested patch for trunk. I have to check if above is true for S2_1 too.

 S2_1 version


 - ML

diff -Nurd -X.diff_ignore freeciv/server/diplomats.c freeciv/server/diplomats.c
--- freeciv/server/diplomats.c	2007-07-04 14:04:17.0 +0300
+++ freeciv/server/diplomats.c	2007-08-04 04:23:46.0 +0300
@@ -50,7 +50,7 @@
  struct unit *pdiplomat, struct tile *ptile);
 static void diplomat_escape(struct player *pplayer, struct unit *pdiplomat,
 			const struct city *pcity);
-static void maybe_cause_incident(enum diplomat_actions action, struct player *offender,
+static void maybe_cause_incident(enum diplomat_actions action, struct unit *offender_unit,
  struct unit *victim_unit, struct city *victim_city);
 
 /**
@@ -121,7 +121,7 @@
   send_city_info(NULL, pcity);
 
   /* this may cause a diplomatic incident */
-  maybe_cause_incident(SPY_POISON, pplayer, NULL, pcity);
+  maybe_cause_incident(SPY_POISON, pdiplomat, NULL, pcity);
 
   /* Now lets see if the spy survives. */
   diplomat_escape(pplayer, pdiplomat, pcity);
@@ -187,7 +187,7 @@
   }
 
   /* this may cause a diplomatic incident */
-  maybe_cause_incident(DIPLOMAT_INVESTIGATE, pplayer, NULL, pcity);
+  maybe_cause_incident(DIPLOMAT_INVESTIGATE, pdiplomat, NULL, pcity);
 
   /* Spies always survive. Diplomats never do. */
   if (!unit_has_type_flag(pdiplomat, F_SPY)) {
@@ -227,7 +227,7 @@
   lsend_packet_city_sabotage_list(player_reply_dest(pplayer), packet);
 
   /* this may cause a diplomatic incident */
-  maybe_cause_incident(SPY_GET_SABOTAGE_LIST, pplayer, NULL, pcity);
+  maybe_cause_incident(SPY_GET_SABOTAGE_LIST, pdiplomat, NULL, pcity);
 }
 
 /**
@@ -307,7 +307,7 @@
   }
 
   /* this may cause a diplomatic incident */
-  maybe_cause_incident(DIPLOMAT_EMBASSY, pplayer, NULL, pcity);
+  maybe_cause_incident(DIPLOMAT_EMBASSY, pdiplomat, NULL, pcity);
 
   /* Spies always survive. Diplomats never do. */
   if (!unit_has_type_flag(pdiplomat, F_SPY)) {
@@ -385,7 +385,7 @@
 		   pplayer-name);
 
   /* this may cause a diplomatic incident */
-  maybe_cause_incident(SPY_SABOTAGE_UNIT, pplayer, pvictim, NULL);
+  maybe_cause_incident(SPY_SABOTAGE_UNIT, pdiplomat, pvictim, NULL);
 
   /* Now lets see if the spy survives. */
   diplomat_escape(pplayer, pdiplomat, NULL);
@@ -502,7 +502,7 @@
   pplayer-economic.gold -= pvictim-bribe_cost;
 
   /* This may cause a diplomatic incident */
-  maybe_cause_incident(DIPLOMAT_BRIBE, pplayer, pvictim, NULL);
+  maybe_cause_incident(DIPLOMAT_BRIBE, pdiplomat, pvictim, NULL);
 
   /* Be sure to wipe the converted unit! */
   victim_tile = pvictim-tile;
@@ -642,7 +642,7 @@
 		 unit_name_translation(pdiplomat),
 		 pcity-name);
 /* this may cause a diplomatic incident */
-maybe_cause_incident(DIPLOMAT_STEAL, pplayer, NULL, pcity);
+maybe_cause_incident(DIPLOMAT_STEAL, pdiplomat, NULL, pcity);
 wipe_unit(pdiplomat);
 return;
   } 
@@ -665,7 +665,7 @@
   (pcity-steal)++;
 
   /* this may cause a diplomatic incident */
-  maybe_cause_incident(DIPLOMAT_STEAL, pplayer, NULL, pcity);
+  maybe_cause_incident(DIPLOMAT_STEAL, pdiplomat, NULL, pcity);
 
   /* Check if a spy survives her mission. Diplomats never do. */
   diplomat_escape(pplayer, pdiplomat, pcity);
@@ -776,7 +776,7 @@
   steal_a_tech (pplayer, cplayer, A_UNSET);
 
   /* this may cause a diplomatic incident */
-  maybe_cause_incident(DIPLOMAT_INCITE, pplayer, NULL, pcity);
+  maybe_cause_incident(DIPLOMAT_INCITE, pdiplomat, NULL, pcity);
 
   /* Transfer city and units supported by this city (that
  are within one square of the city) to the new owner.
@@ -1034,7 +1034,7 @@
   send_city_info(NULL, pcity);
 
   /* this may cause a diplomatic incident */
-  maybe_cause_incident(DIPLOMAT_SABOTAGE, pplayer, NULL, pcity);
+  maybe_cause_incident(DIPLOMAT_SABOTAGE, pdiplomat, NULL, pcity);
 
   /* Check if a spy survives her mission. Diplomats never do. */
   diplomat_escape(pplayer, pdiplomat, pcity);
@@ -1268,9 +1268,10 @@
 /**
 ...
 **/
-static void maybe_cause_incident(enum diplomat_actions action, struct player *offender,
+static void maybe_cause_incident(enum diplomat_actions action, struct unit *offender_unit,
   struct unit *victim_unit, struct city *victim_city)
 {
+  struct player *offender = unit_owner(offender_unit);
   struct player 

Re: [Freeciv-Dev] (PR#38245) [Bug] Sun Tzu always marked redundant

2007-08-03 Thread Marko Lindqvist

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

On 16/03/07, Marko Lindqvist [EMAIL PROTECTED] wrote:

  Sun Tzu's War Academy is always displayed as redundant.

  I think this relates to the fact that its effects have nreq UnitFlag 
 Diplomat.

 Totally untested patch

 Be always optimistic about effects: enabling requirements are
considered TRUE by default, disabling requirements FALSE.


 - ML

diff -Nurd -X.diff_ignore freeciv/ai/aicity.c freeciv/ai/aicity.c
--- freeciv/ai/aicity.c	2007-08-01 17:17:27.0 +0300
+++ freeciv/ai/aicity.c	2007-08-04 05:10:41.0 +0300
@@ -683,7 +683,8 @@
 
   requirement_vector_iterate(pimpr-reqs, preq) {
 const bool active = is_req_active(pplayer, pcity, pimpr,
-  pcity-tile, NULL, NULL, NULL, preq);
+  pcity-tile, NULL, NULL, NULL, preq,
+  TRUE);
 
 if (preq-source.type == REQ_TECH  !active) {
   /* Found a missing technology requirement for this improvement. */
@@ -859,7 +860,7 @@
 continue;
   }
   if (!is_req_active(pplayer, pcity, pimpr, NULL, NULL, NULL, NULL,
-			 preq)) {
+			 preq, TRUE)) {
 	active = FALSE;
 	if (preq-source.type == REQ_TECH) {
 	  /* This missing requirement is a missing tech requirement.
diff -Nurd -X.diff_ignore freeciv/common/base.c freeciv/common/base.c
--- freeciv/common/base.c	2007-08-01 17:17:24.0 +0300
+++ freeciv/common/base.c	2007-08-04 05:06:01.0 +0300
@@ -91,7 +91,7 @@
   }
 
   return are_reqs_active(unit_owner(punit), NULL, NULL, ptile,
- unit_type(punit), NULL, NULL, pbase-reqs);
+ unit_type(punit), NULL, NULL, pbase-reqs, TRUE);
 }
 
 /
diff -Nurd -X.diff_ignore freeciv/common/city.c freeciv/common/city.c
--- freeciv/common/city.c	2007-08-01 17:17:24.0 +0300
+++ freeciv/common/city.c	2007-08-04 05:08:09.0 +0300
@@ -411,7 +411,7 @@
 
   return are_reqs_active(city_owner(pcity), pcity, NULL,
 			 pcity-tile, NULL, NULL, NULL,
-			 building-reqs);
+			 building-reqs, TRUE);
 }
 
 /**
@@ -448,7 +448,7 @@
   requirement_vector_iterate(building-reqs, preq) {
 if (is_req_unchanging(preq)
 	 !is_req_active(city_owner(pcity), pcity, NULL,
-	  		  pcity-tile, NULL, NULL, NULL, preq)) {
+	  		  pcity-tile, NULL, NULL, NULL, preq, TRUE)) {
   return FALSE;
 }
   } requirement_vector_iterate_end;
@@ -531,7 +531,7 @@
 {
   return are_reqs_active(city_owner(pcity), pcity, NULL,
 			 NULL, NULL, NULL, NULL,
-			 get_specialist(type)-reqs);
+			 get_specialist(type)-reqs, TRUE);
 }
 
 /
@@ -1102,7 +1102,7 @@
   while ((replace = city_styles[prev].replaced_by) != -1) {
 prev = replace;
 if (are_reqs_active(plr, NULL, NULL, NULL, NULL, NULL, NULL,
-			city_styles[replace].reqs)) {
+			city_styles[replace].reqs, TRUE)) {
   style = replace;
 }
   }
diff -Nurd -X.diff_ignore freeciv/common/effects.c freeciv/common/effects.c
--- freeciv/common/effects.c	2007-08-01 17:17:24.0 +0300
+++ freeciv/common/effects.c	2007-08-04 05:01:06.0 +0300
@@ -573,7 +573,7 @@
 if (is_req_active(target_player, target_city, target_building,
 		  target_tile, target_unittype, target_output,
 		  target_specialist,
-		  preq)) {
+		  preq, FALSE)) {
   return TRUE;
 }
   } requirement_list_iterate_end;
@@ -581,7 +581,7 @@
 }
 
 /**
-  Return TRUE iff any of the disabling requirements for this effect are
+  Return TRUE iff all of the enabling requirements for this effect are
   active (an effect is active if all of its enabling requirements and
   none of its disabling ones are active).
 **/
@@ -598,7 +598,7 @@
 if (!is_req_active(target_player, target_city, target_building,
 		   target_tile, target_unittype, target_output,
 		   target_specialist,
-		   preq)) {
+		   preq, TRUE)) {
   return FALSE;
 }
   } requirement_list_iterate_end;
@@ -668,7 +668,7 @@
 if (!is_req_active(target_player, target_city, target_building,
 		   target_tile, target_unittype, target_output,
 		   target_specialist,
-		   preq)) {
+		   preq, TRUE)) {
   return FALSE;
 }
   } requirement_list_iterate_end;
diff -Nurd -X.diff_ignore freeciv/common/government.c freeciv/common/government.c
--- freeciv/common/government.c	2007-08-02 23:25:07.0 +0300
+++ freeciv/common/government.c	2007-08-04 05:08:23.0 +0300
@@ -228,7 +228,7 @@
   }
 
   return are_reqs_active(pplayer, NULL, NULL, NULL, NULL, NULL, NULL,
-			 gov-reqs);
+			 gov-reqs, TRUE);
 }