Re: [Freeciv-Dev] (PR#39959) BUG: options/settings changes lost when Leaving (re)Loading
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39959 Harmonized S2_1 with S2_2 client_options_iterate(). Committed S2_1 revision 14161. Committed S2_2 revision 14162. Committed trunk revision 14163. Index: server/stdinhand.c === --- server/stdinhand.c (revision 14160) +++ server/stdinhand.c (working copy) @@ -1698,8 +1698,8 @@ packet.default_val = setting-int_default_value; break; case SSET_STRING: - strcpy(packet.strval, setting-string_value); - strcpy(packet.default_strval, setting-string_default_value); + sz_strlcpy(packet.strval, setting-string_value); + sz_strlcpy(packet.default_strval, setting-string_default_value); break; }; } Index: client/options.h === --- client/options.h(revision 14160) +++ client/options.h(working copy) @@ -90,7 +90,6 @@ /* volatile */ void *p_gui_data; } client_option; -extern client_option *options; #define GEN_INT_OPTION(oname, desc, help, category)\ { #oname, desc, help, category, COT_INT, \ @@ -104,18 +103,19 @@ { #oname, desc, help, category, COT_STR, \ NULL, NULL, oname, sizeof(oname), callback, str_defaults, NULL } -extern int num_options; +/* Initialization and iteration */ +struct client_option *client_option_array_first(void); +const struct client_option *client_option_array_last(void); -#define client_options_iterate(o) \ -{ \ - int _i; \ - for (_i = 0; _i num_options; _i++) {\ -client_option *o = options + _i;\ -{ +#define client_options_iterate(_p) \ +{ \ + struct client_option *_p = client_option_array_first(); \ + if (NULL != _p) {\ +for (; _p = client_option_array_last(); _p++) { -#define client_options_iterate_end \ -} \ - } \ +#define client_options_iterate_end \ +} \ + }\ } /* GUI-specific options declared in gui-xxx but handled by common code. */ @@ -176,6 +176,7 @@ void load_general_options(void); void load_ruleset_specific_options(void); +void load_settable_options(bool send_it); void save_options(void); /* Callback functions for changing options. */ Index: client/gui-gtk-2.0/repodlgs.c === --- client/gui-gtk-2.0/repodlgs.c (revision 14160) +++ client/gui-gtk-2.0/repodlgs.c (working copy) @@ -27,6 +27,7 @@ #include fcintl.h #include game.h #include government.h +#include log.h #include packets.h #include shared.h #include support.h @@ -1213,21 +1214,22 @@ k = 0; memset(unittotals, '\0', sizeof(unittotals)); unit_type_iterate(punittype) { - if (unitarray[punittype-index].active_count 0 - || unitarray[punittype-index].building_count 0) { + Unit_type_id uti = punittype-index; + if (unitarray[uti].active_count 0 + || unitarray[uti].building_count 0) { can = (can_upgrade_unittype(game.player_ptr, punittype) != NULL); gtk_list_store_append(activeunits_store, it); gtk_list_store_set(activeunits_store, it, 1, can, - 2, unitarray[punittype-index].building_count, - 3, unitarray[punittype-index].active_count, - 4, unitarray[punittype-index].upkeep[O_SHIELD], - 5, unitarray[punittype-index].upkeep[O_FOOD], - 6, unitarray[punittype-index].upkeep[O_GOLD], + 2, unitarray[uti].building_count, + 3, unitarray[uti].active_count, + 4, unitarray[uti].upkeep[O_SHIELD], + 5, unitarray[uti].upkeep[O_FOOD], + 6, unitarray[uti].upkeep[O_GOLD], 7, TRUE, - 8, ((unitarray[punittype-index].active_count 0) - ? punittype-index : U_LAST), + 8, ((unitarray[uti].active_count 0) + ? uti : U_LAST), -1); g_value_init(value, G_TYPE_STRING); g_value_set_static_string(value, utype_name_translation(punittype)); @@ -1235,12 +1237,11 @@
[Freeciv-Dev] (PR#39967) BUG: GTK2 menu _Reports: _Players conflicts with S_paceship
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39967 At some time, somebody noticed that _Spaceship would conflict with _Science, so they used S_paceship. Perhaps somebody else changed an entry to _Players. Civ12/2 calls the panel Intelligence Advisor/FOREIGN MINISTER, and either _I or _F would have been great! Freeciv has gradually changed from the concept of players and races to unified nations with users(connections): both players and observers. Change _Players to _Nations. Change _Science to _Research (already done in SDL?) Change S_paceship to _Spaceship (matching GTK player dialog). ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
Re: [Freeciv-Dev] (PR#39927) consistent UI - Map - use F4 for shortcut
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39927 Unfortunately, SDL is using F10 already, and there is a long translation that describes F1. So, the only thing open is F4. So, here's some code to use F4. I'm not totally satisfied, as it won't switch from a dialog to the main window (so I commented that part out for now). The focus unit still has the circling cursor when the map isn't in focus -- but that's an issue for another report Changed the tag and menu item to View to avoid shortcut conflicts. It makes some sense, as the _View menu item controls the View tag. Index: client/gui-gtk-2.0/gui_main.c === --- client/gui-gtk-2.0/gui_main.c (revision 14163) +++ client/gui-gtk-2.0/gui_main.c (working copy) @@ -385,6 +385,17 @@ /** ... **/ +gboolean map_canvas_focus(void) +{ + gtk_window_present(GTK_WINDOW(toplevel)); + gtk_notebook_set_current_page(GTK_NOTEBOOK(top_notebook), 0); + gtk_widget_grab_focus(map_canvas); + return TRUE; +} + +/** +... +**/ gboolean inputline_handler(GtkWidget *w, GdkEventKey *ev) { void *data = NULL; @@ -632,7 +643,8 @@ return FALSE; } - if ((ev-state GDK_SHIFT_MASK)) { + if ((ev-state GDK_CONTROL_MASK)) { + } else if ((ev-state GDK_SHIFT_MASK)) { switch (ev-keyval) { case GDK_Return: @@ -643,6 +655,7 @@ default: break; }; + } else { } switch (ev-keyval) { @@ -665,6 +678,23 @@ return keyboard_map_canvas(w, ev, data); } + /* We are focused some other dialog, tab, or widget. */ + if ((ev-state GDK_CONTROL_MASK)) { + } else if ((ev-state GDK_SHIFT_MASK)) { + } else { +switch (ev-keyval) { + +#if 0 +case GDK_F4: + map_canvas_focus(); + return TRUE; +#endif + +default: + break; +}; + } + return FALSE; } @@ -1161,7 +1191,7 @@ map_widget = gtk_table_new(2, 2, FALSE); - label = gtk_label_new_with_mnemonic(_(_Map)); + label = gtk_label_new(_(View)); gtk_notebook_append_page(GTK_NOTEBOOK(top_notebook), map_widget, label); frame = gtk_frame_new(NULL); Index: client/gui-gtk-2.0/gui_main.h === --- client/gui-gtk-2.0/gui_main.h (revision 14163) +++ client/gui-gtk-2.0/gui_main.h (working copy) @@ -76,6 +76,8 @@ void enable_menus(bool enable); +gboolean map_canvas_focus(void); + gboolean inputline_handler(GtkWidget *w, GdkEventKey *ev); void reset_unit_table(void); Index: client/gui-gtk-2.0/menu.c === --- client/gui-gtk-2.0/menu.c (revision 14163) +++ client/gui-gtk-2.0/menu.c (working copy) @@ -156,6 +156,7 @@ MENU_REPORT_CITIES, MENU_REPORT_UNITS, MENU_REPORT_PLAYERS, + MENU_REPORT_VIEW, MENU_REPORT_ECONOMY, MENU_REPORT_SCIENCE, MENU_REPORT_WOW, @@ -573,6 +574,9 @@ case MENU_REPORT_PLAYERS: popup_players_dialog(TRUE); break; + case MENU_REPORT_VIEW: +map_canvas_focus(); +break; case MENU_REPORT_ECONOMY: popup_economy_report_dialog(TRUE); break; @@ -946,6 +950,8 @@ reports_menu_callback, MENU_REPORT_UNITS }, { / N_(Reports) / N_(_Players), F3, reports_menu_callback, MENU_REPORT_PLAYERS }, + { / N_(Reports) / N_(_View), F4, + reports_menu_callback, MENU_REPORT_VIEW }, { / N_(Reports) / N_(_Economy), F5, reports_menu_callback, MENU_REPORT_ECONOMY }, { / N_(Reports) / N_(_Science), F6, ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev
[Freeciv-Dev] (PR#39944) Realistic wonder terrain reqs
URL: http://bugs.freeciv.org/Ticket/Display.html?id=39944 [wsimpson - Sun Dec 02 14:56:26 2007]: Yes for 2.1 -- this used to work correctly. How did something this obvious get overlooked? (By habit, I've always built on the coasts.) OTOH, I didn't remember Hoover near mountains and rivers in civ1 (or civ2); but then it's been a long time Good idea! Just played through a game of Civ2 (Multiplayer Gold Edition, to be exact) to confirm a few rule details in the original. Found out the following: *Lighthouse/Magellan does not require ocean terrain. *Hoover does not require river. (Hydro Plant does require river, OTOH.) I still think they are good reqs for the wonders, so I introduce them in default but not in civ1 and civ2. While scanning through buildings.ruleset for civ1 and civ2 I found a host of building reqs that had been incorrectly removed. This patch also restores these reqs as I have confirmed that they are in place in the original. Patch for 2.1. ~Daniel wonder_reqs.diff Description: Binary data ___ Freeciv-dev mailing list Freeciv-dev@gna.org https://mail.gna.org/listinfo/freeciv-dev