Re: [Freeciv-Dev] (PR#37988) [Patch] Tileset suggestion to game.ruleset
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#37988) [Patch] Tileset suggestion to game.ruleset
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#37988) [Patch] Tileset suggestion to game.ruleset
URL: http://bugs.freeciv.org/Ticket/Display.html?id=37988 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 Ready for commit, I think - 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-14 11:52:34.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-14 12:24:08.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-14 12:15:31.0 +0200 @@ -3074,3 +3074,11 @@ redraw_group(pNationDlg-pBeginWidgetList, pNationDlg-pEndWidgetList, 0); widget_flush(pNationDlg-pEndWidgetList); } +
Re: [Freeciv-Dev] (PR#37988) [Patch] Tileset suggestion to game.ruleset
URL: http://bugs.freeciv.org/Ticket/Display.html?id=37988 On 3/12/07, Marko Lindqvist [EMAIL PROTECTED] wrote: URL: http://bugs.freeciv.org/Ticket/Display.html?id=37988 On 3/12/07, Daniel Markstedt [EMAIL PROTECTED] wrote: On 3/12/07, Daniel Markstedt [EMAIL PROTECTED] wrote: On 3/12/07, Marko Lindqvist [EMAIL PROTECTED] wrote: URL: http://bugs.freeciv.org/Ticket/Display.html?id=37988 Default tilesets simply don't work with custom rulesets. It's quite demanding for new users to load correct tileset by giving commandline parameters to client before custom rulesets can be used. BTW, I experienced this way back when working with old modpacks and requested similar features in for example PR#16294 and PR#33921 As a usability issue, maybe we should backport this to S2_1. - ML Agreed. We just got yet another confused user at http://forum.freeciv.org/viewtopic.php?t=2880 ~Daniel ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#37988) [Patch] Tileset suggestion to game.ruleset
URL: http://bugs.freeciv.org/Ticket/Display.html?id=37988 Default tilesets simply don't work with custom rulesets. It's quite demanding for new users to load correct tileset by giving commandline parameters to client before custom rulesets can be used. 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. Rulesets compatible with typical tilesets (Amplio/Trident/Freeland) should *not* include tileset suggestion. User has chosen his/her tileset and that's it. Still, I find confirmation dialog in the client end necessary. It could be made optional (always accept suggestion/ask/never accept suggestion), but that's out of this scope of this patch. - 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-12 04:06:48.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-12 05:19:36.0 +0200 @@ -0,0 +1,78 @@ +/** + 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.suggested_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(_(Tileset suggested), + 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, + _(Rulesets suggest using %s tileset.\n +You are currently using %s.), + game.control.suggested_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); + + gtk_dialog_run(GTK_DIALOG(dialog)); + + gtk_widget_destroy(dialog); +} diff -Nurd -X.diff_ignore freeciv/client/include/dialogs_g.h freeciv/client/include/dialogs_g.h --- freeciv/client/include/dialogs_g.h 2007-03-05 21:12:04.0 +0200 +++ freeciv/client/include/dialogs_g.h 2007-03-12 04:28:22.0 +0200 @@ -46,6 +46,7 @@ void popup_sabotage_dialog(struct city *pcity); void popup_pillage_dialog(struct unit *punit, bv_special may_pillage); void popup_upgrade_dialog(struct unit_list *punits); +void popup_tileset_suggestion_dialog(void); void popdown_all_game_dialogs(void); diff -Nurd -X.diff_ignore freeciv/client/packhand.c freeciv/client/packhand.c ---
Re: [Freeciv-Dev] (PR#37988) [Patch] Tileset suggestion to game.ruleset
URL: http://bugs.freeciv.org/Ticket/Display.html?id=37988 On 3/12/07, Marko Lindqvist [EMAIL PROTECTED] wrote: URL: http://bugs.freeciv.org/Ticket/Display.html?id=37988 Default tilesets simply don't work with custom rulesets. It's quite demanding for new users to load correct tileset by giving commandline parameters to client before custom rulesets can be used. 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. Rulesets compatible with typical tilesets (Amplio/Trident/Freeland) should *not* include tileset suggestion. User has chosen his/her tileset and that's it. Still, I find confirmation dialog in the client end necessary. It could be made optional (always accept suggestion/ask/never accept suggestion), but that's out of this scope of this patch. - ML Maybe you could call the tag 'prefered_tilesets' instead; cf 'prefered_themes' in the tilespec. ~Daniel ___ 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
URL: http://bugs.freeciv.org/Ticket/Display.html?id=37988 On 3/12/07, Daniel Markstedt [EMAIL PROTECTED] wrote: On 3/12/07, Daniel Markstedt [EMAIL PROTECTED] wrote: On 3/12/07, Marko Lindqvist [EMAIL PROTECTED] wrote: URL: http://bugs.freeciv.org/Ticket/Display.html?id=37988 Default tilesets simply don't work with custom rulesets. It's quite demanding for new users to load correct tileset by giving commandline parameters to client before custom rulesets can be used. BTW, I experienced this way back when working with old modpacks and requested similar features in for example PR#16294 and PR#33921 As a usability issue, maybe we should backport this to S2_1. - ML ___ 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
URL: http://bugs.freeciv.org/Ticket/Display.html?id=37988 On 3/12/07, Marko Lindqvist [EMAIL PROTECTED] wrote: URL: http://bugs.freeciv.org/Ticket/Display.html?id=37988 (...) 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. (...) - ML The more I think about it, the more I like this solution. It theoretically works for full-fledged scenarios as well: User loads map (.sav) that contains a reference to the preferred ruleset, which contains a reference to the preferred tileset. Viola: all three components loaded in one command! ~Daniel ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev