[Freeciv-Dev] (PR#40360) differences in trunk and S2_2

2008-07-03 Thread Jason Dorje Short

http://bugs.freeciv.org/Ticket/Display.html?id=40360 >

It is my intent to merge these two, in some form or fashion.  After 
discussion, I believe it is best to keep 2.2 as the development version 
for another cycle.  Therefore first we need to find any patches that 
were accidentally committed to just one branch (probably trunk) and 
merge them into the other if appropriate.  Then S2_2 basically just gets 
copied over trunk, and then S2_2 gets deleted.  At some future time when 
we are ready to branch off a 2.2 (or whatever the next version is) we 
will do so.  In the meantime it is unnecessary to maintain two branches.

So, here is a list of differences between the braches:

The biggest one is the removal of embassies in trunk.  Embassies should 
stay for now, until after the next (civ2-compatible) release.

39730 appears to be committed to 2.2 but not to trunk.  I'm highly 
uncertain on this patch which removes a lot of random things and could 
easily introduce massive bugs.  It changes the bribery code around 
heavily and was for some reason only applied to the stable branches.

I'm still going through the diff so more to come.  Or, well, hopefully not.

-jason



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


Re: [Freeciv-Dev] (PR#40296) [Patch] IPv6

2008-07-03 Thread Marko Lindqvist

http://bugs.freeciv.org/Ticket/Display.html?id=40296 >

2008/6/20 Marko Lindqvist:
>
>  This is my take of IPv6 support.

 Mostly rewritten for this second version...

 - Cleanup
 - Fourth configuration value for --enable-ipv6; "support". Like
"test", except will fail if IPv6 support cannot be built in
 - Default configuration is now to use IPv4 with old functions. No
problems of the new implementation should affect default build
 - Metaserver connections work with "support" and "test" configurations


 TODO:
 - IPv6 lan broadcast
 - Runtime support for simultaneous IPv4 and IPv6 connections
(connection to metaserver might be different from client connections)
 - More cleanup


 - ML



IPv6_40296-2.diff.bz2
Description: BZip2 compressed data
___
Freeciv-dev mailing list
Freeciv-dev@gna.org
https://mail.gna.org/listinfo/freeciv-dev


[Freeciv-Dev] (PR#40359) Building only allowing units considered redundant

2008-07-03 Thread Marko Lindqvist

http://bugs.freeciv.org/Ticket/Display.html?id=40359 >

 $subject.

 See forum thread about Dune modpack:
 http://forum.freeciv.org/viewtopic.php?t=4892


 - ML



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


[Freeciv-Dev] (PR#40358) [Patch] Ruleset descriptions

2008-07-03 Thread Marko Lindqvist

http://bugs.freeciv.org/Ticket/Display.html?id=40358 >

 This patch adds support for ruleset description. Custom rulesets can
show generic description, containing background and important rules of
the ruleset in the help browser.
 Only gtk-client supported.


 - 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   2008-07-03 21:58:06.0 +0300
+++ freeciv/client/gui-gtk-2.0/menu.c   2008-07-03 23:35:20.0 +0300
@@ -178,6 +178,7 @@
   MENU_HELP_WORKLIST_EDITOR,
   MENU_HELP_CMA,
   MENU_HELP_PLAYING,
+  MENU_HELP_RULESET,
   MENU_HELP_IMPROVEMENTS,
   MENU_HELP_UNITS,
   MENU_HELP_COMBAT,
@@ -667,6 +668,9 @@
   case MENU_HELP_PLAYING:
 popup_help_dialog_string(HELP_PLAYING_ITEM);
 break;
+  case MENU_HELP_RULESET:
+popup_help_dialog_string(HELP_RULESET_ITEM);
+break;
   case MENU_HELP_IMPROVEMENTS:
 popup_help_dialog_string(HELP_IMPROVEMENTS_ITEM);
 break;
@@ -995,6 +999,9 @@
help_menu_callback, MENU_HELP_PLAYING   
},
   { "/" N_("Help") "/sep1",NULL,
NULL,   0,  
""   },
+  { "/" N_("Help") "/" N_("About Ruleset"), NULL,
+   help_menu_callback, MENU_HELP_RULESET
+   },
   { "/" N_("Help") "/" N_("City _Improvements"),NULL,
help_menu_callback, MENU_HELP_IMPROVEMENTS  
},
   { "/" N_("Help") "/" N_("_Units"),   NULL,
diff -Nurd -X.diff_ignore freeciv/client/helpdata.c freeciv/client/helpdata.c
--- freeciv/client/helpdata.c   2008-06-18 18:49:41.0 +0300
+++ freeciv/client/helpdata.c   2008-07-03 23:39:27.0 +0300
@@ -49,9 +49,10 @@
 /* helper macro for easy conversion from snprintf and cat_snprintf */
 #define CATLSTR(_b, _s, _t) mystrlcat(_b, _t, _s)
 
+/* This must be in same order as enum in helpdlg_g.h */
 static const char * const help_type_names[] = {
   "(Any)", "(Text)", "Units", "Improvements", "Wonders",
-  "Techs", "Terrain", "Governments", NULL
+  "Techs", "Terrain", "Governments", "Ruleset", NULL
 };
 
 /*define MAX_LAST (MAX(MAX(MAX(A_LAST,B_LAST),U_LAST),terrain_count()))*/
@@ -393,81 +394,100 @@
*/
char name[2048];
struct help_list *category_nodes = help_list_new();
-   
-   if (current_type == HELP_UNIT) {
- unit_type_iterate(punittype) {
-   pitem = new_help_item(current_type);
-   my_snprintf(name, sizeof(name), " %s",
-   utype_name_translation(punittype));
-   pitem->topic = mystrdup(name);
-   pitem->text = mystrdup("");
-   help_list_append(category_nodes, pitem);
- } unit_type_iterate_end;
-   } else if (current_type == HELP_TECH) {
- advance_index_iterate(A_FIRST, i) {
-   if (valid_advance_by_number(i)) {
- pitem = new_help_item(current_type);
- my_snprintf(name, sizeof(name), " %s",
- advance_name_for_player(pplayer, i));
- pitem->topic = mystrdup(name);
- pitem->text = mystrdup("");
- help_list_append(category_nodes, pitem);
-   }
- } advance_index_iterate_end;
-   } else if (current_type == HELP_TERRAIN) {
- terrain_type_iterate(pterrain) {
-   if (0 != strlen(terrain_rule_name(pterrain))) {
- pitem = new_help_item(current_type);
- my_snprintf(name, sizeof(name), " %s",
- terrain_name_translation(pterrain));
- pitem->topic = mystrdup(name);
- pitem->text = mystrdup("");
- help_list_append(category_nodes, pitem);
-   }
- } terrain_type_iterate_end;
- /* Add special Civ2-style river help text if it's supplied. */
- if (terrain_control.river_help_text) {
-   pitem = new_help_item(HELP_TEXT);
-   /* TRANS: preserve single space at beginning */
-   pitem->topic = mystrdup(_(" Rivers"));
-   sz_strlcpy(long_buffer, _(terrain_control.river_help_text));
-   pitem->text = mystrdup(long_buffer);
-   help_list_append(category_nodes, pitem);
- }
-   } else if (current_type == HELP_GOVERNMENT) {
- government_iterate(gov) {
-   pitem = new_help_item(current_type);
-   my_snprintf(name, sizeof(name), " %s",
-   government_name_translation(gov));
-   pitem->topic = mystrdup(name);
-   pitem->text = mystrdup("");
-   help_list_append(category_nodes, pitem);
- } government_iterate_end;
-   } else if (current_type == HELP_IMPROVEMENT) {
- improvement_iterate(pimprove) {
-   if (valid_improvement(pimprove) && !is_great_wonder(pimprove)) {
- pitem = new_help_item(current_type);
- my_snprintf(name, sizeof(name),

[Freeciv-Dev] (PR#40317) ggz savegame support

2008-07-03 Thread Jason Short

http://bugs.freeciv.org/Ticket/Display.html?id=40317 >

New patch.

Some version checks will be necessary as only newer ggzd versions have
savegame support.  And it's still not quite working.

-jason

Index: configure.ac
===
--- configure.ac	(revision 14950)
+++ configure.ac	(working copy)
@@ -535,6 +535,9 @@
 else
   AC_GGZ_CHECK
 fi
+if test "$ggz_server" = "yes" ; then
+  AC_CHECK_FUNCS([chdir mkdtemp])
+fi
 
 AC_SUBST(gui_sources)
 AC_SUBST(CLIENT_CFLAGS)
Index: server/srv_main.c
===
--- server/srv_main.c	(revision 14950)
+++ server/srv_main.c	(working copy)
@@ -973,6 +973,8 @@
   freelog(LOG_VERBOSE, "Save time: %g seconds (%g apparent)",
 	  read_timer_seconds_free(timer_cpu),
 	  read_timer_seconds_free(timer_user));
+
+  ggz_game_saved(filename);
 }
 
 /**
Index: server/ggzserver.c
===
--- server/ggzserver.c	(revision 14950)
+++ server/ggzserver.c	(working copy)
@@ -17,6 +17,9 @@
 
 #ifdef GGZ_SERVER
 
+#include 
+#include 
+
 #include 
 
 #include "fciconv.h"
@@ -31,6 +34,8 @@
 #include "ggzserver.h"
 #include "score.h"
 #include "sernet.h"
+#include "srv_main.h"
+#include "stdinhand.h"
 
 bool with_ggz = FALSE;
 
@@ -93,12 +98,42 @@
 static void handle_ggz_state_event(GGZdMod * ggz, GGZdModEvent event,
    const void *data)
 {
-#if 0
   const GGZdModState *old_state = data;
   GGZdModState new_state = ggzdmod_get_state(ggz);
 
-  /* Currently no handling is done. */
-#endif
+  freelog(LOG_DEBUG, "ggz changed state to %d.", new_state);
+
+  if (*old_state == GGZDMOD_STATE_CREATED) {
+const char *savegame = ggzdmod_get_savedgame(ggz);
+
+/* If a savegame is given, load it. */
+freelog(LOG_DEBUG, "Instructed to load \"%s\".", savegame);
+if (savegame) {
+  if (!load_command(NULL, savegame, FALSE)) {
+	/* no error handling? */
+	server_quit();
+  }
+}
+
+/* If we loaded a game that'll include the serverid.  If not we
+ * generate one here. */
+if (strlen(srvarg.serverid) == 0) {
+  strcpy(srvarg.serverid, "ggz-civ-XX");
+  if (!mkdtemp(srvarg.serverid)) {
+	fc_fprintf(stderr,
+		   _("Unable to make temporary directory for GGZ game.\n"));
+	exit(EXIT_FAILURE);
+  }
+}
+
+/* Change into the server directory */
+if (chdir(srvarg.serverid) < 0) {
+  fc_fprintf(stderr, _("Unable to change into temporary server "
+			   "directory %s.\n"), srvarg.serverid);
+  server_quit();
+}
+freelog(LOG_DEBUG, "Changed into directory %s.", srvarg.serverid);
+  }
 }
 
 /
@@ -199,6 +234,10 @@
 			&handle_ggz_seat_event);
 ggzdmod_set_handler(ggzdmod, GGZDMOD_EVENT_SPECTATOR_JOIN,
 			&handle_ggz_spectator_seat_event);
+ggzdmod_set_handler(ggzdmod, GGZDMOD_EVENT_SPECTATOR_LEAVE,
+			&handle_ggz_spectator_seat_event);
+ggzdmod_set_handler(ggzdmod, GGZDMOD_EVENT_SPECTATOR_SEAT,
+			&handle_ggz_spectator_seat_event);
 if (ggzdmod_connect(ggzdmod) < 0) {
   exit(EXIT_FAILURE);
 }
@@ -332,4 +371,29 @@
   num_victors = 0; /* In case there's another game. */
 }
 
+/
+  Reports a savegame file to the GGZ server.  In theory GGZ will allow
+  reloading from a file later.
+/
+void ggz_game_saved(const char *filename)
+{
+  char full_filename[PATH_MAX];
+
+  if (!path_is_absolute(filename)) {
+if (!getcwd(full_filename, sizeof(full_filename))) {
+  freelog(LOG_FATAL, "Could not get cwd.");
+  exit(EXIT_FAILURE);
+}
+sz_strlcat(full_filename, "/");
+sz_strlcat(full_filename, filename);
+  } else {
+sz_strlcpy(full_filename, filename);
+  }
+  freelog(LOG_DEBUG, "Reporting filename %s to ggz.", full_filename);
+
+  if (with_ggz) {
+ggzdmod_report_savegame(ggzdmod, full_filename);
+  }
+}
+
 #endif
Index: server/ggzserver.h
===
--- server/ggzserver.h	(revision 14950)
+++ server/ggzserver.h	(working copy)
@@ -28,12 +28,15 @@
 void ggz_report_victor(const struct player *winner);
 void ggz_report_victory(void);
 
+void ggz_game_saved(const char *filename);
+
 #else
 
 #  define with_ggz FALSE
 #  define ggz_initialize() (void)0
 #  define ggz_report_victor(pplayer) (void)0
 #  define ggz_report_victory() (void)0
+#  define ggz_game_saved(filename) (void)0
 
 #endif
 
Index: server/stdinhand.c
===
--- server/stdinhand.c	(revision 14950)
+++ server/stdinhand.c	(working copy)
@@ -3301,7 +3301,7 @@
 legitimate but has inconsistencies) and would lead to a broken server
 afterwards.
 **

Re: [Freeciv-Dev] (PR#40356) Multiple bases on same tile

2008-07-03 Thread Jason Dorje Short

http://bugs.freeciv.org/Ticket/Display.html?id=40356 >

Marko Lindqvist wrote:
> http://bugs.freeciv.org/Ticket/Display.html?id=40356 >
> 
>  We already had some discussion about multiple bases on same tile.
> Let's continue, and gather information, in its own ticket.
> 
>  I'm currently aware of two parts of code that would not work with
> more than one base on same tile:
>  - Pillage selection has only "any base" resolution.
>  - Bases can act as vision/border sites. These are identified by the
> tile they are placed on.
> 
> 
>  About number of different bases ruleset format should allow:
>  One reason for generic bases is to allow modpacks to contain unique
> bases. These would already be on map when game begins, and one cannot
> build more of them. For example, fantasy modpack could have some
> ancient towers around. Ruleset format should allow many such unique
> bases in addition to several buildable ones.
>  Scripting allows unique behavior for any number of tiles, but that
> does not allow any graphics. Bases are visible.
> 
>  I have been looking in to possibility that there is boolean setting
> in ruleset defining if multiple bases can be on same tile. If it's
> true, ruleset can contain only one basetype / bit. If it's false,
> ruleset can contain (2^bits)-1 basetypes.

It sounds like 1 base per tile is a lot easier to implement.  Until 
there's a concrete need to break that barrier I wouldn't trouble 
yourself with generalizing it to multiple per tile.

-jason



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