[Freeciv-Dev] Additions to connect dialog (PR#977)
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: |
undisclosed-recipients: ; |
Subject: |
[Freeciv-Dev] Additions to connect dialog (PR#977) |
From: |
"Daniel L Speyer" <dspeyer@xxxxxxxxxxx> |
Date: |
Tue, 27 Jan 2004 00:03:59 -0800 |
Reply-to: |
rt@xxxxxxxxxxx |
<URL: http://rt.freeciv.org/Ticket/Display.html?id=977 >
I finally got a chance to play with Mike's version of the connection
dialog. It looks good -- I'd been dreading the gtk2 and new packet
system conversions. I do, of course, have various improvements to
suggest :-).
Attached is a system for setting options graphically. It dumps
everything to the client with a packet designed for the purpose and then
processes it client side. Options are now organized by category. The
whole thing's a lot cleaner than my previous implementation. It does
mean that old clients will have trouble with the new server, but
want_hack is mandatory in Mike's patch anyway. I've also increased
MAX_LEN_PACKET. Will this be a problem?
I've also thrown in a handful of GUI tweaks for things that really
jumped out at me.
The patch is diffed from Mike's version, so apply his patch first.
You'll need to generate_packets.py after applying mine.
Enjoy!
--Daniel Speyer
diff -ur freeciv-mike-Jan-19/client/gui-gtk-2.0/connectdlg.c
freeciv-speyer-Jan-19/client/gui-gtk-2.0/connectdlg.c
--- freeciv-mike-Jan-19/client/gui-gtk-2.0/connectdlg.c 2004-01-25
19:16:03.000000000 -0500
+++ freeciv-speyer-Jan-19/client/gui-gtk-2.0/connectdlg.c 2004-01-27
00:21:06.000000000 -0500
@@ -529,7 +529,7 @@
/**************************************************************************
create a file selector for both the load and save commands
**************************************************************************/
-void create_file_selection(char *title, bool is_save)
+GtkWidget* create_file_selection(char *title, bool is_save)
{
GtkWidget *file_selector;
@@ -560,6 +560,7 @@
/* Display that dialog */
gtk_widget_show(file_selector);
+ return file_selector;
}
/**************************************************************************
@@ -574,7 +575,12 @@
gtk_widget_set_sensitive(nextw, FALSE);
- create_file_selection(_("Choose Savegame to Load"), FALSE);
+ /* swapped makes the fileSel the second arg, and a filesel is always true */
+ g_signal_connect_swapped(create_file_selection(_("Choose Savegame to Load"),
FALSE),
+ "destroy",
+ G_CALLBACK(gtk_widget_set_sensitive),
+ w);
+ gtk_widget_set_sensitive(w, FALSE);
}
/****************************************************************
@@ -691,6 +697,9 @@
/* check which radio button is active and switch "book" to that page */
gtk_notebook_set_current_page(GTK_NOTEBOOK(uberbook), next_page);
gtk_button_set_label(GTK_BUTTON(nextw), next_labels[next_page]);
+ if (next_page == LOAD_PAGE) {
+ load_callback(loadw, NULL);
+ }
} else {
switch (gtk_notebook_get_current_page(GTK_NOTEBOOK(uberbook))) {
case NEW_PAGE:
@@ -723,7 +732,7 @@
{
GtkWidget *label, *table, *scrolled, *listsaved, *listmeta, *listlan;
GtkWidget *hbox, *vbox, *updatemeta, *updatelan;
- GtkWidget *radio;
+ GtkWidget *radio, *button;
int i;
char buf[256];
GtkCellRenderer *trenderer, *prenderer;
@@ -818,7 +827,7 @@
table = gtk_table_new(2, 2, FALSE);
gtk_table_set_col_spacings(GTK_TABLE(table), 15);
- gtk_box_pack_start(GTK_BOX(hbox), table, FALSE, FALSE, 20);
+ gtk_box_pack_start(GTK_BOX(hbox), table, TRUE, TRUE, 20);
label = g_object_new(GTK_TYPE_LABEL,
"label", _("Number of players:"),
@@ -842,6 +851,7 @@
aiskill = gtk_combo_new();
+ gtk_entry_set_editable(GTK_COMBO(aiskill)->entry, FALSE);
for (i = 0; i < NUM_SKILL_LEVELS; i++) {
items = g_list_append(items, (char*)skill_level_names_translated[i]);
}
@@ -851,13 +861,11 @@
hbox = gtk_hbox_new(FALSE, 2);
gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 20);
- label = g_object_new(GTK_TYPE_LABEL,
- "label", _("Use the commands /show and /set on the "
- "Chatline to set additional options."),
- "xalign", 0.0,
- "yalign", 0.5,
- NULL);
- gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 20);
+ button = gtk_button_new_with_label(_("Initial Server Options"));
+ g_signal_connect_swapped(G_OBJECT(button), "clicked",
+ G_CALLBACK(send_report_request),
+ (gpointer)REPORT_SERVER_OPTIONS1);
+ gtk_box_pack_end(GTK_BOX(hbox), button, TRUE, TRUE, 20);
/* third page of uber book: load game */
diff -ur freeciv-mike-Jan-19/client/gui-gtk-2.0/connectdlg.h
freeciv-speyer-Jan-19/client/gui-gtk-2.0/connectdlg.h
--- freeciv-mike-Jan-19/client/gui-gtk-2.0/connectdlg.h 2004-01-25
19:16:03.000000000 -0500
+++ freeciv-speyer-Jan-19/client/gui-gtk-2.0/connectdlg.h 2004-01-25
21:37:43.000000000 -0500
@@ -15,7 +15,7 @@
#include "connectdlg_g.h"
-void create_file_selection(char *title, bool is_save);
+GtkWidget* create_file_selection(char *title, bool is_save);
#endif /* FC__CONNECTDLG_H */
--- freeciv-mike-Jan-19/client/gui-gtk-2.0/menu.c 2004-01-25
19:16:03.000000000 -0500
+++ freeciv-speyer-Jan-19/client/gui-gtk-2.0/menu.c 2004-01-25
20:59:41.000000000 -0500
@@ -603,17 +603,19 @@
game_menu_callback, MENU_GAME_SERVER_OPTIONS1
},
{ "/" N_("Game") "/" N_("Server Opt _ongoing"), NULL,
game_menu_callback, MENU_GAME_SERVER_OPTIONS2
},
+ { "/" N_("Game") "/sep3", NULL,
+ NULL, 0,
"<Separator>" },
{ "/" N_("Game") "/" N_("Save Game As..."), NULL,
game_menu_callback, MENU_GAME_SAVE_GAME
},
{ "/" N_("Game") "/" N_("Save Game As Autogame"), NULL,
game_menu_callback, MENU_GAME_SAVE_AUTO
},
- { "/" N_("Game") "/sep3", NULL,
+ { "/" N_("Game") "/sep4", NULL,
NULL, 0,
"<Separator>" },
{ "/" N_("Game") "/" N_("_Export Log"), NULL,
game_menu_callback, MENU_GAME_OUTPUT_LOG
},
{ "/" N_("Game") "/" N_("_Clear Log"), NULL,
game_menu_callback, MENU_GAME_CLEAR_OUTPUT
},
- { "/" N_("Game") "/sep4", NULL,
+ { "/" N_("Game") "/sep5", NULL,
NULL, 0,
"<Separator>" },
{ "/" N_("Game") "/" N_("_Disconnect"), NULL,
game_menu_callback, MENU_GAME_DISCONNECT
},
diff -ur freeciv-mike-Jan-19/client/gui-gtk-2.0/repodlgs.c
freeciv-speyer-Jan-19/client/gui-gtk-2.0/repodlgs.c
--- freeciv-mike-Jan-19/client/gui-gtk-2.0/repodlgs.c 2003-11-29
01:05:23.000000000 -0500
+++ freeciv-speyer-Jan-19/client/gui-gtk-2.0/repodlgs.c 2004-01-27
00:13:00.000000000 -0500
@@ -30,6 +30,7 @@
#include "shared.h"
#include "support.h"
+#include "chatline_common.h"
#include "cityrep.h"
#include "civclient.h"
#include "clinet.h"
@@ -1399,3 +1400,137 @@
endgame_report_shell = NULL;
}
+/*************************************************************************
+ Server options dialog and helper functions
+*************************************************************************/
+static void popup_name(GtkWidget *w, gpointer data)
+{
+ GtkWidget *dial, *close, *lab;
+ char buffer[1024];
+ sprintf(buffer,"<tt>%s</tt>",gtk_widget_get_name(w));
+ lab=gtk_label_new(buffer);
+ gtk_label_set_use_markup(GTK_LABEL(lab), TRUE);
+ if (!strchr(gtk_widget_get_name(w),'\n') ||
+ (*(strchr(gtk_widget_get_name(w),'\n')+1)=='\n' &&
+ !strchr(strchr(gtk_widget_get_name(w),'\n')+2,'\n'))) {
+ gtk_label_set_line_wrap(GTK_LABEL(lab), TRUE);
+ }
+ dial = gtk_dialog_new();
+ gtk_window_set_title(GTK_WINDOW(dial),_("Help"));
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dial)->vbox),
+ lab,
+ FALSE, FALSE, 5);
+ close=gtk_button_new_with_label(_("Close"));
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(dial)->action_area), close, TRUE,
TRUE, 0);
+ g_signal_connect_swapped(G_OBJECT(close), "clicked",
+ G_CALLBACK(gtk_widget_destroy), dial);
+ gtk_widget_show_all(dial);
+}
+
+static void mark(GtkWidget *w){
+ g_object_set_data(G_OBJECT(w), "changed", (gpointer)TRUE);
+}
+
+static void setOptions(GtkWidget *w){
+ GtkWidget *tmp;
+ if (g_object_get_data(G_OBJECT(w),"changed")) {
+ char buffer[256];
+ my_snprintf(buffer, MAX_LEN_MSG, "/set %s %s\n",
+ gtk_widget_get_name(w),
+ GTK_IS_ENTRY(w)?gtk_entry_get_text(GTK_ENTRY(w)):
+ (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON(w))?"1":"0"));
+ send_chat(buffer);
+ }
+ tmp=(GtkWidget*)g_object_get_data(G_OBJECT(w),"prev");
+ if (tmp){
+ setOptions(tmp);
+ }else{
+ gtk_widget_destroy(gtk_widget_get_toplevel(w));
+ }
+}
+
+void handle_options_settable(struct packet_options_settable *packet)
+{
+ GtkWidget *win, *book, **vbox, *but, *prev=NULL;
+ gboolean used[16];
+ int i;
+
+ for(i=0;i<16;i++){
+ used[i]=FALSE;
+ }
+
+ win=gtk_dialog_new();
+ gtk_window_set_title(GTK_WINDOW(win),_("Server Options"));
+ book=gtk_notebook_new();
+ gtk_box_pack_start(GTK_BOX(GTK_DIALOG(win)->vbox), book, FALSE, FALSE, 2);
+
+ vbox=fc_malloc(packet->ncateg*sizeof(GtkWidget*));
+ for (i=0;i<packet->ncateg;i++) {
+ vbox[i]=gtk_vbox_new(FALSE, 2);
+ gtk_notebook_append_page(GTK_NOTEBOOK(book),
+ vbox[i],
+ gtk_label_new(packet->categNames[i]));
+ gtk_box_pack_end(GTK_BOX(vbox[i]),gtk_label_new(""),FALSE,FALSE,0);
+ }
+ for (i=0;i<packet->nopts;i++) {
+ GtkWidget *hbox, *but, *ent;
+ hbox = gtk_hbox_new(FALSE, 0);
+ gtk_box_pack_start(GTK_BOX(hbox), gtk_label_new(packet->optname[i]),
FALSE, FALSE, 0);
+ but = gtk_button_new_with_label(_("?"));
+ gtk_widget_set_name(but, packet->opthelp[i]);
+ g_signal_connect(but, "clicked",
+ G_CALLBACK(popup_name), NULL);
+ gtk_box_pack_end(GTK_BOX(hbox), but, FALSE, FALSE, 0);
+ if (packet->min[i]==1 && packet->max[i]==0) {
+ /* Boolean */
+ GtkWidget *no;
+ ent = gtk_radio_button_new_with_label(NULL, _("Yes"));
+ no = gtk_radio_button_new_with_label_from_widget(GTK_RADIO_BUTTON(ent),
_("No"));
+ gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(ent), packet->val[i]);
+ gtk_box_pack_end(GTK_BOX(hbox), no, FALSE, FALSE, 0);
+ g_signal_connect(G_OBJECT(ent),"toggled",G_CALLBACK(mark),NULL);
+ } else if (packet->min[i]==0 && packet->max[i]==-1) {
+ /* String */
+ ent=gtk_entry_new();
+ gtk_entry_set_text(GTK_ENTRY(ent), packet->stringVals[packet->val[i]]);
+ g_signal_connect(G_OBJECT(ent),"changed",G_CALLBACK(mark),NULL);
+ } else {
+ /* Integer */
+ int step, max, min;
+ min = packet->min[i];
+ max = packet->max[i];
+ step = (max-min)/101+1;
+ if (step > 100) {
+ /* This is rediculoous, the bounds must be meaningless */
+ step=5;
+ }
+ ent =
gtk_spin_button_new(GTK_ADJUSTMENT(gtk_adjustment_new(packet->val[i],
+ min, max,
step,
+ 0, 0)), 1, 0);
+ g_signal_connect(G_OBJECT(ent),"changed",G_CALLBACK(mark),NULL);
+ }
+ gtk_box_pack_end(GTK_BOX(hbox), ent, FALSE, FALSE, 0);
+ gtk_widget_set_name(ent, packet->optname[i]);
+ g_object_set_data(G_OBJECT(ent), "prev", prev);
+ g_object_set_data(G_OBJECT(ent), "changed", FALSE);
+ prev=ent;
+ gtk_box_pack_start(GTK_BOX(vbox[packet->categ[i]]), hbox, FALSE, FALSE, 0);
+ used[packet->categ[i]] = TRUE;
+ }
+ for (i=packet->ncateg-1; i>=0; i--) {
+ if (!used[i]) {
+ gtk_notebook_remove_page(GTK_NOTEBOOK(book), i);
+ }
+ }
+
+ but = gtk_button_new_with_label(_("OK"));
+ g_signal_connect_swapped(G_OBJECT(but), "clicked",
+ G_CALLBACK(setOptions), prev);
+ gtk_box_pack_end(GTK_BOX(GTK_DIALOG(win)->action_area), but, TRUE, TRUE, 2);
+ but = gtk_button_new_with_label(_("Cancel"));
+ g_signal_connect_swapped(G_OBJECT(but), "clicked",
+ G_CALLBACK(gtk_widget_destroy), win);
+ gtk_box_pack_end(GTK_BOX(GTK_DIALOG(win)->action_area), but, TRUE, TRUE, 2);
+
+ gtk_widget_show_all(win);
+}
diff -ur freeciv-mike-Jan-19/common/connection.h
freeciv-speyer-Jan-19/common/connection.h
--- freeciv-mike-Jan-19/common/connection.h 2004-01-15 01:16:19.000000000
-0500
+++ freeciv-speyer-Jan-19/common/connection.h 2004-01-26 21:37:45.000000000
-0500
@@ -35,7 +35,7 @@
struct hash_table;
struct timer_list;
-#define MAX_LEN_PACKET 4096
+#define MAX_LEN_PACKET 16384
#define MAX_LEN_BUFFER (MAX_LEN_PACKET * 128)
#define MAX_LEN_CAPSTR 512
diff -ur freeciv-mike-Jan-19/common/dataio.h
freeciv-speyer-Jan-19/common/dataio.h
--- freeciv-mike-Jan-19/common/dataio.h 2003-11-29 01:05:26.000000000 -0500
+++ freeciv-speyer-Jan-19/common/dataio.h 2004-01-26 19:23:26.000000000
-0500
@@ -59,7 +59,8 @@
void dio_get_sint8(struct data_in *din, int *dest);
void dio_get_sint16(struct data_in *din, int *dest);
-void dio_get_sint32(struct data_in *din, int *dest);
+#define dio_get_sint32(d,v) dio_get_uint32(d,v)
+
void dio_get_bool8(struct data_in *din, bool *dest);
void dio_get_bool32(struct data_in *din, bool *dest);
diff -ur freeciv-mike-Jan-19/common/packets.def
freeciv-speyer-Jan-19/common/packets.def
--- freeciv-mike-Jan-19/common/packets.def 2004-01-25 19:16:03.000000000
-0500
+++ freeciv-speyer-Jan-19/common/packets.def 2004-01-26 18:58:53.000000000
-0500
@@ -213,7 +213,7 @@
Spaceship
Ruleset
-The last used packet number is 110.
+The last used packet number is 111.
****************************************************/
@@ -1230,3 +1230,13 @@
BOOL is_alive[MAX_NUM_PLAYERS:nplayers];
BOOL is_ai[MAX_NUM_PLAYERS:nplayers];
end
+
+PACKET_OPTIONS_SETTABLE=111;sc
+ UINT8 nopts;
+ STRING optname[256:nopts][MAX_LEN_NAME], opthelp[256:nopts][1024];
+ SINT32 val[256:nopts], min[256:nopts], max[256:nopts], categ[256:nopts];
+ UINT8 ncateg;
+ STRING categNames[16:ncateg][MAX_LEN_NAME];
+ UINT8 nstrings;
+ STRING stringVals[16:nstrings][MAX_LEN_NAME];
+end
diff -ur freeciv-mike-Jan-19/server/srv_main.c
freeciv-speyer-Jan-19/server/srv_main.c
--- freeciv-mike-Jan-19/server/srv_main.c 2004-01-25 19:16:03.000000000
-0500
+++ freeciv-speyer-Jan-19/server/srv_main.c 2004-01-26 14:56:10.000000000
-0500
@@ -671,10 +671,10 @@
report_demographics(pconn);
break;
case REPORT_SERVER_OPTIONS1:
- report_server_options(dest, 1);
+ report_settable_server_options(pconn, 1);
break;
case REPORT_SERVER_OPTIONS2:
- report_server_options(dest, 2);
+ report_settable_server_options(pconn, 2);
break;
case REPORT_SERVER_OPTIONS: /* obsolete */
default:
diff -ur freeciv-mike-Jan-19/server/stdinhand.c
freeciv-speyer-Jan-19/server/stdinhand.c
--- freeciv-mike-Jan-19/server/stdinhand.c 2004-01-25 19:16:03.000000000
-0500
+++ freeciv-speyer-Jan-19/server/stdinhand.c 2004-01-27 00:09:03.000000000
-0500
@@ -115,6 +115,25 @@
SSET_TO_CLIENT, SSET_SERVER_ONLY
};
+/* Categories allow options to be usefully organized when presented to the user
+ */
+enum sset_category {
+ SSET_GEOLOGY,
+ SSET_ECOLOGY,
+ SSET_SOCIOLOGY,
+ SSET_MILITARY,
+ SSET_SCIENCE,
+ SSET_INTERNAL,
+ SSET_NUM_CATEGORIES
+};
+
+char *sset_category_names[]= { ("Geological"),
+ ("Ecological"),
+ ("Sociological"),
+ ("Military"),
+ ("Scientific"),
+ ("Internal") };
+
/*
* The type of the setting.
*/
@@ -144,6 +163,7 @@
*/
const char *extra_help;
enum sset_type type;
+ enum sset_category category;
/*
* About the *_validate functions: If the function is non-NULL, it
@@ -194,26 +214,26 @@
return TRUE;
}
-#define GEN_BOOL(name, value, sclass, to_client, short_help, extra_help, func,
default) \
- { name, sclass, to_client, short_help, extra_help, SSET_BOOL, \
+#define GEN_BOOL(name, value, sclass, to_client, short_help, extra_help, func,
default, categ) \
+ { name, sclass, to_client, short_help, extra_help, SSET_BOOL, categ, \
&value, default, func, \
NULL, 0, NULL, 0, 0, \
NULL, NULL, NULL, 0 },
-#define GEN_INT(name, value, sclass, to_client, short_help, extra_help, func,
min, max, default) \
- { name, sclass, to_client, short_help, extra_help, SSET_INT, \
+#define GEN_INT(name, value, sclass, to_client, short_help, extra_help, func,
min, max, default, categ) \
+ { name, sclass, to_client, short_help, extra_help, SSET_INT, categ, \
NULL, FALSE, NULL, \
&value, default, func, min, max, \
NULL, NULL, NULL, 0 },
-#define GEN_STRING(name, value, sclass, to_client, short_help, extra_help,
func, default) \
- { name, sclass, to_client, short_help, extra_help, SSET_STRING, \
+#define GEN_STRING(name, value, sclass, to_client, short_help, extra_help,
func, default, categ) \
+ { name, sclass, to_client, short_help, extra_help, SSET_STRING, categ, \
NULL, FALSE, NULL, \
NULL, 0, NULL, 0, 0, \
value, default, func, sizeof(value)},
#define GEN_END \
- { NULL, SSET_LAST, SSET_SERVER_ONLY, NULL, NULL, SSET_INT, \
+ { NULL, SSET_LAST, SSET_SERVER_ONLY, NULL, NULL, SSET_INT,
SSET_NUM_CATEGORIES, \
NULL, FALSE, NULL, \
NULL, 0, NULL, 0, 0, \
NULL, NULL, NULL, 0 },
@@ -225,11 +245,11 @@
/* Map size parameters: adjustable if we don't yet have a map */
GEN_INT("xsize", map.xsize, SSET_MAP_SIZE, SSET_TO_CLIENT,
N_("Map width in squares"), "", NULL,
- MAP_MIN_WIDTH, MAP_MAX_WIDTH, MAP_DEFAULT_WIDTH)
+ MAP_MIN_WIDTH, MAP_MAX_WIDTH, MAP_DEFAULT_WIDTH, SSET_GEOLOGY)
GEN_INT("ysize", map.ysize, SSET_MAP_SIZE, SSET_TO_CLIENT,
N_("Map height in squares"), "", NULL,
- MAP_MIN_HEIGHT, MAP_MAX_HEIGHT, MAP_DEFAULT_HEIGHT)
+ MAP_MIN_HEIGHT, MAP_MAX_HEIGHT, MAP_DEFAULT_HEIGHT, SSET_GEOLOGY)
GEN_INT("topology", map.topology_id, SSET_MAP_SIZE, SSET_TO_CLIENT,
N_("The map topology index"),
@@ -241,7 +261,7 @@
" 2 Uranus (wraps N-S) 6 Uranus (isometric)\n"
" 3 Donut World (wraps N-S, E-W) 7 Donut World (isometric)"
), NULL,
- MAP_MIN_TOPO, MAP_MAX_TOPO, MAP_DEFAULT_TOPO)
+ MAP_MIN_TOPO, MAP_MAX_TOPO, MAP_DEFAULT_TOPO, SSET_GEOLOGY)
/* Map generation parameters: once we have a map these are of historical
* interest only, and cannot be changed.
@@ -264,55 +284,55 @@
"Note: values 2,3 and 4 generate \"fairer\" (but more boring) "
"maps.\n"
"(Zero indicates a scenario map.)"), NULL,
- MAP_MIN_GENERATOR, MAP_MAX_GENERATOR, MAP_DEFAULT_GENERATOR)
+ MAP_MIN_GENERATOR, MAP_MAX_GENERATOR, MAP_DEFAULT_GENERATOR,
SSET_GEOLOGY)
GEN_BOOL("tinyisles", map.tinyisles, SSET_MAP_GEN, SSET_TO_CLIENT,
N_("Presence or absence of 1x1 islands"),
N_("0 = no 1x1 islands; 1 = some 1x1 islands"), NULL,
- MAP_DEFAULT_TINYISLES)
+ MAP_DEFAULT_TINYISLES, SSET_GEOLOGY)
GEN_BOOL("separatepoles", map.separatepoles, SSET_MAP_GEN, SSET_TO_CLIENT,
N_("Whether the poles are separate continents"),
N_("0 = continents may attach to poles; 1 = poles will "
"be separate"), NULL,
- MAP_DEFAULT_SEPARATE_POLES)
+ MAP_DEFAULT_SEPARATE_POLES, SSET_GEOLOGY)
GEN_INT("landmass", map.landpercent, SSET_MAP_GEN, SSET_TO_CLIENT,
N_("Amount of land vs ocean"), "", NULL,
- MAP_MIN_LANDMASS, MAP_MAX_LANDMASS, MAP_DEFAULT_LANDMASS)
+ MAP_MIN_LANDMASS, MAP_MAX_LANDMASS, MAP_DEFAULT_LANDMASS,
SSET_GEOLOGY)
GEN_INT("mountains", map.mountains, SSET_MAP_GEN, SSET_TO_CLIENT,
N_("Amount of hills/mountains"),
N_("Small values give flat maps, higher values give more "
"hills and mountains."), NULL,
- MAP_MIN_MOUNTAINS, MAP_MAX_MOUNTAINS, MAP_DEFAULT_MOUNTAINS)
+ MAP_MIN_MOUNTAINS, MAP_MAX_MOUNTAINS, MAP_DEFAULT_MOUNTAINS,
SSET_ECOLOGY)
GEN_INT("rivers", map.riverlength, SSET_MAP_GEN, SSET_TO_CLIENT,
N_("Amount of river squares"), "", NULL,
- MAP_MIN_RIVERS, MAP_MAX_RIVERS, MAP_DEFAULT_RIVERS)
+ MAP_MIN_RIVERS, MAP_MAX_RIVERS, MAP_DEFAULT_RIVERS, SSET_ECOLOGY)
GEN_INT("grass", map.grasssize, SSET_MAP_GEN, SSET_TO_CLIENT,
N_("Amount of grass squares"), "", NULL,
- MAP_MIN_GRASS, MAP_MAX_GRASS, MAP_DEFAULT_GRASS)
+ MAP_MIN_GRASS, MAP_MAX_GRASS, MAP_DEFAULT_GRASS, SSET_ECOLOGY)
GEN_INT("forests", map.forestsize, SSET_MAP_GEN, SSET_TO_CLIENT,
N_("Amount of forest squares"), "", NULL,
- MAP_MIN_FORESTS, MAP_MAX_FORESTS, MAP_DEFAULT_FORESTS)
+ MAP_MIN_FORESTS, MAP_MAX_FORESTS, MAP_DEFAULT_FORESTS, SSET_ECOLOGY)
GEN_INT("swamps", map.swampsize, SSET_MAP_GEN, SSET_TO_CLIENT,
N_("Amount of swamp squares"), "", NULL,
- MAP_MIN_SWAMPS, MAP_MAX_SWAMPS, MAP_DEFAULT_SWAMPS)
+ MAP_MIN_SWAMPS, MAP_MAX_SWAMPS, MAP_DEFAULT_SWAMPS, SSET_ECOLOGY)
GEN_INT("deserts", map.deserts, SSET_MAP_GEN, SSET_TO_CLIENT,
N_("Amount of desert squares"), "", NULL,
- MAP_MIN_DESERTS, MAP_MAX_DESERTS, MAP_DEFAULT_DESERTS)
+ MAP_MIN_DESERTS, MAP_MAX_DESERTS, MAP_DEFAULT_DESERTS, SSET_ECOLOGY)
GEN_INT("seed", map.seed, SSET_MAP_GEN, SSET_SERVER_ONLY,
N_("Map generation random seed"),
N_("The same seed will always produce the same map; "
"for zero (the default) a seed will be chosen based on "
"the time, to give a random map."), NULL,
- MAP_MIN_SEED, MAP_MAX_SEED, MAP_DEFAULT_SEED)
+ MAP_MIN_SEED, MAP_MAX_SEED, MAP_DEFAULT_SEED, SSET_INTERNAL)
/* Map additional stuff: huts and specials. randseed also goes here
* because huts and specials are the first time the randseed gets used (?)
@@ -323,18 +343,18 @@
N_("General random seed"),
N_("For zero (the default) a seed will be chosen based "
"on the time."), NULL,
- GAME_MIN_RANDSEED, GAME_MAX_RANDSEED, GAME_DEFAULT_RANDSEED)
+ GAME_MIN_RANDSEED, GAME_MAX_RANDSEED, GAME_DEFAULT_RANDSEED,
SSET_INTERNAL)
GEN_INT("specials", map.riches, SSET_MAP_ADD, SSET_TO_CLIENT,
N_("Amount of \"special\" resource squares"),
N_("Special resources improve the basic terrain type they "
"are on. The server variable's scale is parts per "
"thousand."), NULL,
- MAP_MIN_RICHES, MAP_MAX_RICHES, MAP_DEFAULT_RICHES)
+ MAP_MIN_RICHES, MAP_MAX_RICHES, MAP_DEFAULT_RICHES, SSET_GEOLOGY)
GEN_INT("huts", map.huts, SSET_MAP_ADD, SSET_TO_CLIENT,
N_("Amount of huts (minor tribe villages)"), "", NULL,
- MAP_MIN_HUTS, MAP_MAX_HUTS, MAP_DEFAULT_HUTS)
+ MAP_MIN_HUTS, MAP_MAX_HUTS, MAP_DEFAULT_HUTS, SSET_GEOLOGY)
/* Options affecting numbers of players and AI players. These only
* affect the start of the game and can not be adjusted after that.
@@ -346,7 +366,7 @@
N_("There must be at least this many players (connected "
"players or AI's) before the game can start."), NULL,
GAME_MIN_MIN_PLAYERS, GAME_MAX_MIN_PLAYERS,
- GAME_DEFAULT_MIN_PLAYERS)
+ GAME_DEFAULT_MIN_PLAYERS, SSET_INTERNAL)
GEN_INT("maxplayers", game.max_players, SSET_PLAYERS, SSET_TO_CLIENT,
N_("Maximum number of players"),
@@ -355,7 +375,7 @@
"the pregame state, any new players who try to connect "
"will be rejected."), valid_max_players,
GAME_MIN_MAX_PLAYERS, GAME_MAX_MAX_PLAYERS,
- GAME_DEFAULT_MAX_PLAYERS)
+ GAME_DEFAULT_MAX_PLAYERS, SSET_INTERNAL)
GEN_INT("aifill", game.aifill, SSET_PLAYERS, SSET_TO_CLIENT,
N_("Number of players to fill to with AI's"),
@@ -363,39 +383,40 @@
"game starts, extra AI players will be created to "
"increase the total number of players to the value of "
"this option."), NULL,
- GAME_MIN_AIFILL, GAME_MAX_AIFILL, GAME_DEFAULT_AIFILL)
+ GAME_MIN_AIFILL, GAME_MAX_AIFILL, GAME_DEFAULT_AIFILL, SSET_INTERNAL)
/* Game initialization parameters (only affect the first start of the game,
* and not reloads). Can not be changed after first start of game.
*/
GEN_INT("settlers", game.settlers, SSET_GAME_INIT, SSET_TO_CLIENT,
N_("Number of initial settlers per player"), "", NULL,
- GAME_MIN_SETTLERS, GAME_MAX_SETTLERS, GAME_DEFAULT_SETTLERS)
+ GAME_MIN_SETTLERS, GAME_MAX_SETTLERS, GAME_DEFAULT_SETTLERS,
SSET_SOCIOLOGY)
GEN_INT("explorer", game.explorer, SSET_GAME_INIT, SSET_TO_CLIENT,
N_("Number of initial explorers per player"), "", NULL,
- GAME_MIN_EXPLORER, GAME_MAX_EXPLORER, GAME_DEFAULT_EXPLORER)
+ GAME_MIN_EXPLORER, GAME_MAX_EXPLORER, GAME_DEFAULT_EXPLORER,
SSET_SOCIOLOGY)
GEN_INT("dispersion", game.dispersion, SSET_GAME_INIT, SSET_TO_CLIENT,
N_("Area where initial units are located"),
N_("This is half the length of a side of the square within "
"which the initial units are dispersed."), NULL,
- GAME_MIN_DISPERSION, GAME_MAX_DISPERSION, GAME_DEFAULT_DISPERSION)
+ GAME_MIN_DISPERSION, GAME_MAX_DISPERSION, GAME_DEFAULT_DISPERSION,
+ SSET_SOCIOLOGY)
GEN_INT("gold", game.gold, SSET_GAME_INIT, SSET_TO_CLIENT,
N_("Starting gold per player"), "", NULL,
- GAME_MIN_GOLD, GAME_MAX_GOLD, GAME_DEFAULT_GOLD)
+ GAME_MIN_GOLD, GAME_MAX_GOLD, GAME_DEFAULT_GOLD, SSET_SOCIOLOGY)
GEN_INT("techlevel", game.tech, SSET_GAME_INIT, SSET_TO_CLIENT,
N_("Number of initial advances per player"), "", NULL,
- GAME_MIN_TECHLEVEL, GAME_MAX_TECHLEVEL, GAME_DEFAULT_TECHLEVEL)
+ GAME_MIN_TECHLEVEL, GAME_MAX_TECHLEVEL, GAME_DEFAULT_TECHLEVEL,
SSET_SOCIOLOGY)
GEN_INT("researchcost", game.researchcost, SSET_RULES, SSET_TO_CLIENT,
N_("Points required to gain a new advance"),
N_("This affects how quickly players can research new "
"technology."), NULL,
GAME_MIN_RESEARCHCOST, GAME_MAX_RESEARCHCOST,
- GAME_DEFAULT_RESEARCHCOST)
+ GAME_DEFAULT_RESEARCHCOST, SSET_SCIENCE)
GEN_INT("techpenalty", game.techpenalty, SSET_RULES, SSET_TO_CLIENT,
N_("Percentage penalty when changing tech"),
@@ -404,7 +425,7 @@
"research points. This does not apply if you have just gained "
"tech this turn."), NULL,
GAME_MIN_TECHPENALTY, GAME_MAX_TECHPENALTY,
- GAME_DEFAULT_TECHPENALTY)
+ GAME_DEFAULT_TECHPENALTY, SSET_SCIENCE)
GEN_INT("diplcost", game.diplcost, SSET_RULES, SSET_TO_CLIENT,
N_("Penalty when getting tech from treaty"),
@@ -412,7 +433,7 @@
"research points equal to this percentage of the cost to "
"research an new advance. You can end up with negative "
"research points if this is non-zero."), NULL,
- GAME_MIN_DIPLCOST, GAME_MAX_DIPLCOST, GAME_DEFAULT_DIPLCOST)
+ GAME_MIN_DIPLCOST, GAME_MAX_DIPLCOST, GAME_DEFAULT_DIPLCOST,
SSET_SCIENCE)
GEN_INT("conquercost", game.conquercost, SSET_RULES, SSET_TO_CLIENT,
N_("Penalty when getting tech from conquering"),
@@ -421,7 +442,7 @@
"to research an new advance. You can end up with negative "
"research points if this is non-zero."), NULL,
GAME_MIN_CONQUERCOST, GAME_MAX_CONQUERCOST,
- GAME_DEFAULT_CONQUERCOST)
+ GAME_DEFAULT_CONQUERCOST, SSET_SCIENCE)
GEN_INT("freecost", game.freecost, SSET_RULES, SSET_TO_CLIENT,
N_("Penalty when getting a free tech"),
@@ -431,11 +452,11 @@
"percentage of the cost to research a new advance. You can "
"end up with negative research points if this is non-zero."),
NULL,
- GAME_MIN_FREECOST, GAME_MAX_FREECOST, GAME_DEFAULT_FREECOST)
+ GAME_MIN_FREECOST, GAME_MAX_FREECOST, GAME_DEFAULT_FREECOST,
SSET_SCIENCE)
GEN_INT("foodbox", game.foodbox, SSET_RULES, SSET_TO_CLIENT,
N_("Food required for a city to grow"), "", NULL,
- GAME_MIN_FOODBOX, GAME_MAX_FOODBOX, GAME_DEFAULT_FOODBOX)
+ GAME_MIN_FOODBOX, GAME_MAX_FOODBOX, GAME_DEFAULT_FOODBOX,
SSET_SOCIOLOGY)
GEN_INT("aqueductloss", game.aqueductloss, SSET_RULES, SSET_TO_CLIENT,
N_("Percentage food lost when need aqueduct"),
@@ -444,7 +465,7 @@
"of its foodbox (or half that amount if it has a "
"Granary)."), NULL,
GAME_MIN_AQUEDUCTLOSS, GAME_MAX_AQUEDUCTLOSS,
- GAME_DEFAULT_AQUEDUCTLOSS)
+ GAME_DEFAULT_AQUEDUCTLOSS, SSET_SOCIOLOGY)
GEN_INT("fulltradesize", game.fulltradesize, SSET_RULES, SSET_TO_CLIENT,
N_("Minimum city size to get full trade"),
@@ -454,7 +475,7 @@
"except the normal corruption) for size=fulltradesize. "
"See also notradesize."), valid_fulltradesize,
GAME_MIN_FULLTRADESIZE, GAME_MAX_FULLTRADESIZE,
- GAME_DEFAULT_FULLTRADESIZE)
+ GAME_DEFAULT_FULLTRADESIZE, SSET_SOCIOLOGY)
GEN_INT("notradesize", game.notradesize, SSET_RULES, SSET_TO_CLIENT,
N_("Maximum size of a city without trade"),
@@ -464,7 +485,7 @@
"than fulltradesize. See also fulltradesize."),
valid_notradesize,
GAME_MIN_NOTRADESIZE, GAME_MAX_NOTRADESIZE,
- GAME_DEFAULT_NOTRADESIZE)
+ GAME_DEFAULT_NOTRADESIZE, SSET_SOCIOLOGY)
GEN_INT("unhappysize", game.unhappysize, SSET_RULES, SSET_TO_CLIENT,
N_("City size before people become unhappy"),
@@ -472,7 +493,7 @@
"city are content, and subsequent citizens are unhappy. "
"See also cityfactor."), NULL,
GAME_MIN_UNHAPPYSIZE, GAME_MAX_UNHAPPYSIZE,
- GAME_DEFAULT_UNHAPPYSIZE)
+ GAME_DEFAULT_UNHAPPYSIZE, SSET_SOCIOLOGY)
GEN_BOOL("angrycitizen", game.angrycitizen, SSET_RULES, SSET_TO_CLIENT,
N_("Whether angry citizens are enabled"),
@@ -480,7 +501,7 @@
"citizens have to become unhappy before any other class "
"of citizens may be considered. See also unhappysize, "
"cityfactor and governments."), NULL,
- GAME_DEFAULT_ANGRYCITIZEN)
+ GAME_DEFAULT_ANGRYCITIZEN, SSET_SOCIOLOGY)
GEN_INT("cityfactor", game.cityfactor, SSET_RULES, SSET_TO_CLIENT,
N_("Number of cities for higher unhappiness"),
@@ -489,7 +510,8 @@
"adjustments; see also unhappysize. This assumes a "
"Democracy; for other governments the effect occurs at "
"smaller numbers of cities."), NULL,
- GAME_MIN_CITYFACTOR, GAME_MAX_CITYFACTOR, GAME_DEFAULT_CITYFACTOR)
+ GAME_MIN_CITYFACTOR, GAME_MAX_CITYFACTOR, GAME_DEFAULT_CITYFACTOR,
+ SSET_SOCIOLOGY)
GEN_INT("citymindist", game.citymindist, SSET_RULES, SSET_TO_CLIENT,
N_("Minimum distance between cities (move distance)"),
@@ -500,20 +522,21 @@
"to 0 (default), it is overwritten by the current ruleset "
"when the game starts."), NULL,
GAME_MIN_CITYMINDIST, GAME_MAX_CITYMINDIST,
- GAME_DEFAULT_CITYMINDIST)
+ GAME_DEFAULT_CITYMINDIST, SSET_SOCIOLOGY)
GEN_INT("rapturedelay", game.rapturedelay, SSET_RULES, SSET_TO_CLIENT,
N_("Number of turns between rapture effect"),
N_("Sets the number of turns between rapture growth of a city. "
"If set to n a city will grow after rapturing n+1 turns."), NULL,
GAME_MIN_RAPTUREDELAY, GAME_MAX_RAPTUREDELAY,
- GAME_DEFAULT_RAPTUREDELAY)
+ GAME_DEFAULT_RAPTUREDELAY, SSET_SOCIOLOGY)
GEN_INT("razechance", game.razechance, SSET_RULES, SSET_TO_CLIENT,
N_("Chance for conquered building destruction"),
N_("When a player conquers a city, each City Improvement has this "
"percentage chance to be destroyed."), NULL,
- GAME_MIN_RAZECHANCE, GAME_MAX_RAZECHANCE, GAME_DEFAULT_RAZECHANCE)
+ GAME_MIN_RAZECHANCE, GAME_MAX_RAZECHANCE, GAME_DEFAULT_RAZECHANCE,
+ SSET_MILITARY)
GEN_INT("civstyle", game.civstyle, SSET_RULES, SSET_TO_CLIENT,
N_("Style of Civ rules"),
@@ -521,7 +544,8 @@
"Currently this option affects the following rules:\n"
" - Apollo shows whole map in Civ2, only cities in Civ1.\n"
"See also README.rulesets."), NULL,
- GAME_MIN_CIVSTYLE, GAME_MAX_CIVSTYLE, GAME_DEFAULT_CIVSTYLE)
+ GAME_MIN_CIVSTYLE, GAME_MAX_CIVSTYLE, GAME_DEFAULT_CIVSTYLE,
+ SSET_MILITARY)
GEN_INT("occupychance", game.occupychance, SSET_RULES, SSET_TO_CLIENT,
N_("Chance of moving into tile after attack"),
@@ -532,7 +556,7 @@
"set to a value between 0 and 100, this will be used as "
"the percent chance of \"occupying\" territory."), NULL,
GAME_MIN_OCCUPYCHANCE, GAME_MAX_OCCUPYCHANCE,
- GAME_DEFAULT_OCCUPYCHANCE)
+ GAME_DEFAULT_OCCUPYCHANCE, SSET_MILITARY)
GEN_INT("killcitizen", game.killcitizen, SSET_RULES, SSET_TO_CLIENT,
N_("Reduce city population after attack"),
@@ -544,7 +568,7 @@
" 4 = heli\n"
" 8 = air"), NULL,
GAME_MIN_KILLCITIZEN, GAME_MAX_KILLCITIZEN,
- GAME_DEFAULT_KILLCITIZEN)
+ GAME_DEFAULT_KILLCITIZEN, SSET_MILITARY)
GEN_INT("wtowervision", game.watchtower_vision, SSET_RULES, SSET_TO_CLIENT,
N_("Range of vision for units in a fortress"),
@@ -555,7 +579,7 @@
"'Watchtower' in the techs ruleset. Also see wtowerevision."),
NULL,
GAME_MIN_WATCHTOWER_VISION, GAME_MAX_WATCHTOWER_VISION,
- GAME_DEFAULT_WATCHTOWER_VISION)
+ GAME_DEFAULT_WATCHTOWER_VISION, SSET_MILITARY)
GEN_INT("wtowerevision", game.watchtower_extra_vision, SSET_RULES,
SSET_TO_CLIENT,
@@ -568,14 +592,14 @@
"value of wtowervision and wtowerevision will be used. "
"Also see wtowervision."), NULL,
GAME_MIN_WATCHTOWER_EXTRA_VISION, GAME_MAX_WATCHTOWER_EXTRA_VISION,
- GAME_DEFAULT_WATCHTOWER_EXTRA_VISION)
+ GAME_DEFAULT_WATCHTOWER_EXTRA_VISION, SSET_MILITARY)
GEN_INT("borders", game.borders, SSET_RULES, SSET_TO_CLIENT,
N_("National border's radius"),
N_("If this is set to greater than 0, nations will have territory "
"delineated by borders placed on the loci between cities, with "
"the maximum distance from any city specified."), NULL,
- GAME_MIN_BORDERS, GAME_MAX_BORDERS, GAME_DEFAULT_BORDERS)
+ GAME_MIN_BORDERS, GAME_MAX_BORDERS, GAME_DEFAULT_BORDERS,
SSET_MILITARY)
GEN_INT("diplomacy", game.diplomacy, SSET_RULES, SSET_TO_CLIENT,
N_("The ability to do diplomacy with other players"),
@@ -584,7 +608,7 @@
"If set to 2, diplomacy is only allowed between AI players.\n"
"If set to 3, diplomacy is disabled for all.\n"
"You can always do diplomacy with players on your team."), NULL,
- GAME_MIN_DIPLOMACY, GAME_MAX_DIPLOMACY, GAME_DEFAULT_DIPLOMACY)
+ GAME_MIN_DIPLOMACY, GAME_MAX_DIPLOMACY, GAME_DEFAULT_DIPLOMACY,
SSET_MILITARY)
GEN_INT("citynames", game.allowed_city_names, SSET_RULES, SSET_TO_CLIENT,
N_("Allowed city names"),
@@ -597,7 +621,7 @@
"If set to 3, a player isn't allowed to use a default city name "
"of another nations."),NULL,
GAME_MIN_ALLOWED_CITY_NAMES, GAME_MAX_ALLOWED_CITY_NAMES,
- GAME_DEFAULT_ALLOWED_CITY_NAMES)
+ GAME_DEFAULT_ALLOWED_CITY_NAMES, SSET_SOCIOLOGY)
/* Flexible rules: these can be changed after the game has started.
*
@@ -621,14 +645,14 @@
"3 - frequent barbarian uprising \n"
"4 - raging hordes, lots of barbarians"), NULL,
GAME_MIN_BARBARIANRATE, GAME_MAX_BARBARIANRATE,
- GAME_DEFAULT_BARBARIANRATE)
+ GAME_DEFAULT_BARBARIANRATE, SSET_MILITARY)
GEN_INT("onsetbarbs", game.onsetbarbarian, SSET_RULES_FLEXIBLE,
SSET_TO_CLIENT,
N_("Barbarian onset year"),
N_("Barbarians will not appear before this year."), NULL,
GAME_MIN_ONSETBARBARIAN, GAME_MAX_ONSETBARBARIAN,
- GAME_DEFAULT_ONSETBARBARIAN)
+ GAME_DEFAULT_ONSETBARBARIAN, SSET_MILITARY)
GEN_BOOL("fogofwar", game.fogofwar, SSET_RULES_FLEXIBLE, SSET_TO_CLIENT,
N_("Whether to enable fog of war"),
@@ -636,7 +660,7 @@
"the sightrange of your own units and cities will be "
"revealed to you. You will not see new cities or terrain "
"changes in squares not observed."), NULL,
- GAME_DEFAULT_FOGOFWAR)
+ GAME_DEFAULT_FOGOFWAR, SSET_MILITARY)
GEN_INT("diplchance", game.diplchance, SSET_RULES_FLEXIBLE, SSET_TO_CLIENT,
N_("Chance in diplomat/spy contests"),
@@ -650,12 +674,13 @@
"Defending Spys are generally twice as capable as "
"Diplomats, veteran units 50% more capable than "
"non-veteran ones."), NULL,
- GAME_MIN_DIPLCHANCE, GAME_MAX_DIPLCHANCE, GAME_DEFAULT_DIPLCHANCE)
+ GAME_MIN_DIPLCHANCE, GAME_MAX_DIPLCHANCE, GAME_DEFAULT_DIPLCHANCE,
+ SSET_MILITARY)
GEN_BOOL("spacerace", game.spacerace, SSET_RULES_FLEXIBLE, SSET_TO_CLIENT,
N_("Whether to allow space race"),
N_("If this option is 1, players can build spaceships."), NULL,
- GAME_DEFAULT_SPACERACE)
+ GAME_DEFAULT_SPACERACE, SSET_SCIENCE)
GEN_INT("civilwarsize", game.civilwarsize, SSET_RULES_FLEXIBLE,
SSET_TO_CLIENT,
@@ -665,7 +690,7 @@
"this option is set to the maximum value, civil wars are "
"turned off altogether."), NULL,
GAME_MIN_CIVILWARSIZE, GAME_MAX_CIVILWARSIZE,
- GAME_DEFAULT_CIVILWARSIZE)
+ GAME_DEFAULT_CIVILWARSIZE, SSET_SOCIOLOGY)
GEN_INT("contactturns", game.contactturns, SSET_RULES_FLEXIBLE,
SSET_TO_CLIENT,
@@ -674,21 +699,21 @@
"after their units have last met. Set this to zero "
"to turn this feature off entirely."), NULL,
GAME_MIN_CONTACTTURNS, GAME_MAX_CONTACTTURNS,
- GAME_DEFAULT_CONTACTTURNS)
+ GAME_DEFAULT_CONTACTTURNS, SSET_MILITARY)
GEN_BOOL("savepalace", game.savepalace, SSET_RULES_FLEXIBLE, SSET_TO_CLIENT,
N_("Rebuild palace if capital is conquered"),
N_("If this is set to 1 when the capital is conquered, palace "
"is automatically rebuilt for free in another randomly "
"choosed city, regardless on the knowledge of Masonry."), NULL,
- GAME_DEFAULT_SAVEPALACE)
+ GAME_DEFAULT_SAVEPALACE, SSET_MILITARY)
GEN_BOOL("naturalcitynames", game.natural_city_names,
SSET_RULES_FLEXIBLE, SSET_TO_CLIENT,
N_("Whether to use natural city names"),
N_("If enabled, the default city names will be determined based "
"on the surrounding terrain."),
- NULL, GAME_DEFAULT_NATURALCITYNAMES)
+ NULL, GAME_DEFAULT_NATURALCITYNAMES, SSET_SOCIOLOGY)
/* Meta options: these don't affect the internal rules of the game, but
* do affect players. Also options which only produce extra server
@@ -728,17 +753,17 @@
" 4 = No controller allowed, observers allowed;\n"
"\"Displacing a connection\" means that you may take over "
"a player that another user already has control of."),
- is_valid_allowtake, GAME_DEFAULT_ALLOW_TAKE)
+ is_valid_allowtake, GAME_DEFAULT_ALLOW_TAKE, SSET_INTERNAL)
GEN_BOOL("autotoggle", game.auto_ai_toggle, SSET_META, SSET_TO_CLIENT,
N_("Whether AI-status toggles with connection"),
N_("If this is set to 1, AI status is turned off when a player "
"connects, and on when a player disconnects."), autotoggle,
- GAME_DEFAULT_AUTO_AI_TOGGLE)
+ GAME_DEFAULT_AUTO_AI_TOGGLE, SSET_INTERNAL)
GEN_INT("endyear", game.end_year, SSET_META, SSET_TO_CLIENT,
N_("Year the game ends"), "", NULL,
- GAME_MIN_END_YEAR, GAME_MAX_END_YEAR, GAME_DEFAULT_END_YEAR)
+ GAME_MIN_END_YEAR, GAME_MAX_END_YEAR, GAME_DEFAULT_END_YEAR,
SSET_SOCIOLOGY)
#ifndef NDEBUG
GEN_INT( "timeout", game.timeout, SSET_META, SSET_TO_CLIENT,
@@ -748,7 +773,7 @@
"means there is no timeout. In DEBUG servers, a timeout "
"of -1 sets the autogame test mode. Use this with the command "
"\"timeoutincrease\" to have a dynamic timer."), NULL,
- GAME_MIN_TIMEOUT, GAME_MAX_TIMEOUT, GAME_DEFAULT_TIMEOUT)
+ GAME_MIN_TIMEOUT, GAME_MAX_TIMEOUT, GAME_DEFAULT_TIMEOUT,
SSET_INTERNAL)
#else
GEN_INT( "timeout", game.timeout, SSET_META, SSET_TO_CLIENT,
N_("Maximum seconds per turn"),
@@ -756,7 +781,7 @@
"time is up, then the turn ends automatically. Zero "
"means there is no timeout. Use this with the command "
"\"timeoutincrease\" to have a dynamic timer."), NULL,
- GAME_MIN_TIMEOUT, GAME_MAX_TIMEOUT, GAME_DEFAULT_TIMEOUT)
+ GAME_MIN_TIMEOUT, GAME_MAX_TIMEOUT, GAME_DEFAULT_TIMEOUT,
SSET_INTERNAL)
#endif
GEN_INT("tcptimeout", game.tcptimeout, SSET_META, SSET_TO_CLIENT,
@@ -765,7 +790,7 @@
"this value, then the TCP connection is closed. Zero "
"means there is no timeout beyond that enforced by the "
"TCP protocol implementation itself."), NULL,
- GAME_MIN_TCPTIMEOUT, GAME_MAX_TCPTIMEOUT, GAME_DEFAULT_TCPTIMEOUT)
+ GAME_MIN_TCPTIMEOUT, GAME_MAX_TCPTIMEOUT, GAME_DEFAULT_TCPTIMEOUT,
SSET_INTERNAL)
GEN_INT("netwait", game.netwait, SSET_META, SSET_TO_CLIENT,
N_("Max seconds for TCP buffers to drain"),
@@ -773,33 +798,34 @@
"parameter in seconds, for all client connection TCP "
"buffers to unblock. Zero means the server will not "
"wait at all."), NULL,
- GAME_MIN_NETWAIT, GAME_MAX_NETWAIT, GAME_DEFAULT_NETWAIT)
+ GAME_MIN_NETWAIT, GAME_MAX_NETWAIT, GAME_DEFAULT_NETWAIT,
SSET_INTERNAL)
GEN_INT("pingtime", game.pingtime, SSET_META, SSET_TO_CLIENT,
N_("Seconds between PINGs"),
N_("The civserver will poll the clients with a PING request "
"each time this period elapses."), NULL,
- GAME_MIN_PINGTIME, GAME_MAX_PINGTIME, GAME_DEFAULT_PINGTIME)
+ GAME_MIN_PINGTIME, GAME_MAX_PINGTIME, GAME_DEFAULT_PINGTIME,
SSET_INTERNAL)
GEN_INT("pingtimeout", game.pingtimeout, SSET_META, SSET_TO_CLIENT,
N_("Time to cut a client"),
N_("If a client doesn't reply to a PONG in this time the "
"client is disconnected."), NULL,
- GAME_MIN_PINGTIMEOUT, GAME_MAX_PINGTIMEOUT, GAME_DEFAULT_PINGTIMEOUT)
+ GAME_MIN_PINGTIMEOUT, GAME_MAX_PINGTIMEOUT, GAME_DEFAULT_PINGTIMEOUT,
+ SSET_INTERNAL)
GEN_BOOL("turnblock", game.turnblock, SSET_META, SSET_TO_CLIENT,
N_("Turn-blocking game play mode"),
N_("If this is set to 1 the game turn is not advanced "
"until all players have finished their turn, including "
"disconnected players."), NULL,
- FALSE)
+ FALSE, SSET_INTERNAL)
GEN_BOOL("fixedlength", game.fixedlength, SSET_META, SSET_TO_CLIENT,
N_("Fixed-length turns play mode"),
N_("If this is set to 1 the game turn will not advance "
"until the timeout has expired, irrespective of players "
"clicking on \"Turn Done\"."), NULL,
- FALSE)
+ FALSE, SSET_INTERNAL)
GEN_STRING("demography", game.demography, SSET_META, SSET_TO_CLIENT,
N_("What is in the Demographics report"),
@@ -818,13 +844,13 @@
" b = display \"best nation\" column\n"
"(The order of these characters is not significant, but their
case is.)"),
is_valid_demography,
- GAME_DEFAULT_DEMOGRAPHY)
+ GAME_DEFAULT_DEMOGRAPHY, SSET_INTERNAL)
GEN_INT("saveturns", game.save_nturns, SSET_META, SSET_SERVER_ONLY,
N_("Turns per auto-save"),
N_("The game will be automatically saved per this number of turns.\n"
"Zero means never auto-save."), NULL,
- 0, 200, 10)
+ 0, 200, 10, SSET_INTERNAL)
/* Could undef entire option if !HAVE_LIBZ, but this way users get to see
* what they're missing out on if they didn't compile with zlib? --dwp
@@ -838,7 +864,7 @@
"this server was not compiled to use zlib."), NULL,
GAME_MIN_COMPRESS_LEVEL, GAME_MAX_COMPRESS_LEVEL,
- GAME_DEFAULT_COMPRESS_LEVEL)
+ GAME_DEFAULT_COMPRESS_LEVEL, SSET_INTERNAL)
#else
GEN_INT("compress", game.save_compress_level, SSET_META, SSET_SERVER_ONLY,
N_("Savegame compression level"),
@@ -848,7 +874,7 @@
"this server was not compiled to use zlib."), NULL,
GAME_NO_COMPRESS_LEVEL, GAME_NO_COMPRESS_LEVEL,
- GAME_NO_COMPRESS_LEVEL)
+ GAME_NO_COMPRESS_LEVEL, SSET_INTERNAL)
#endif
GEN_STRING("savename", game.save_name, SSET_META, SSET_SERVER_ONLY,
@@ -856,14 +882,14 @@
N_("Automatically saved games will have name "
"\"<prefix><year>.sav\".\nThis setting sets "
"the <prefix> part."), NULL,
- GAME_DEFAULT_SAVE_NAME)
+ GAME_DEFAULT_SAVE_NAME, SSET_INTERNAL)
GEN_BOOL("scorelog", game.scorelog, SSET_META, SSET_SERVER_ONLY,
N_("Whether to log player statistics"),
N_("If this is set to 1, player statistics are appended to "
"the file \"civscore.log\" every turn. These statistics "
"can be used to create power graphs after the game."), NULL,
- GAME_DEFAULT_SCORELOG)
+ GAME_DEFAULT_SCORELOG, SSET_INTERNAL)
GEN_INT("gamelog", gamelog_level, SSET_META, SSET_SERVER_ONLY,
N_("Detail level for logging game events"),
@@ -871,7 +897,7 @@
"(with the -g command line option). "
"Levels: 0=no logging, 20=standard logging, 30=detailed logging, "
"40=debuging logging."), NULL,
- 0, 40, 20)
+ 0, 40, 20, SSET_INTERNAL)
GEN_END
};
@@ -2553,7 +2579,7 @@
******************************************************************/
void report_server_options(struct conn_list *dest, int which)
{
- int i;
+ int i,c;
char buffer[4096];
char title[128];
char *caption;
@@ -2563,37 +2589,100 @@
_("Server Options (initial)") :
_("Server Options (ongoing)");
- for (i=0;settings[i].name;i++) {
- struct settings_s *op = &settings[i];
- if (!sset_is_to_client(i)) continue;
- if (which==1 && op->sclass > SSET_GAME_INIT) continue;
- if (which==2 && op->sclass <= SSET_GAME_INIT) continue;
- switch (op->type) {
- case SSET_BOOL:
- cat_snprintf(buffer, sizeof(buffer), "%-20s%c%-6d (0,1)\n",
- op->name,
- (*op->bool_value == op->bool_default_value) ? '*' : ' ',
- *op->bool_value);
- break;
-
- case SSET_INT:
- cat_snprintf(buffer, sizeof(buffer), "%-20s%c%-6d (%d,%d)\n", op->name,
- (*op->int_value == op->int_default_value) ? '*' : ' ',
- *op->int_value, op->int_min_value, op->int_max_value);
- break;
- case SSET_STRING:
- cat_snprintf(buffer, sizeof(buffer), "%-20s%c\"%s\"\n", op->name,
- (strcmp(op->string_value,
- op->string_default_value) == 0) ? '*' : ' ',
- op->string_value);
- break;
+ for (c=0;c<SSET_NUM_CATEGORIES;c++) {
+ cat_snprintf(buffer, sizeof(buffer), "%s:\n", sset_category_names[c]);
+ for (i=0;settings[i].name;i++) {
+ struct settings_s *op = &settings[i];
+ if (!sset_is_to_client(i)) continue;
+ if (which==1 && op->sclass > SSET_GAME_INIT) continue;
+ if (which==2 && op->sclass <= SSET_GAME_INIT) continue;
+ if (op->category != c) continue;
+ switch (op->type) {
+ case SSET_BOOL:
+ cat_snprintf(buffer, sizeof(buffer), "%-20s%c%-6d (0,1)\n",
+ op->name,
+ (*op->bool_value == op->bool_default_value) ? '*' : ' ',
+ *op->bool_value);
+ break;
+
+ case SSET_INT:
+ cat_snprintf(buffer, sizeof(buffer), "%-20s%c%-6d (%d,%d)\n", op->name,
+ (*op->int_value == op->int_default_value) ? '*' : ' ',
+ *op->int_value, op->int_min_value, op->int_max_value);
+ break;
+ case SSET_STRING:
+ cat_snprintf(buffer, sizeof(buffer), "%-20s%c\"%s\"\n", op->name,
+ (strcmp(op->string_value,
+ op->string_default_value) == 0) ? '*' : ' ',
+ op->string_value);
+ break;
+ }
}
+ cat_snprintf(buffer, sizeof(buffer), "\n");
}
freelog(LOG_DEBUG, "report_server_options buffer len %d", i);
page_conn(dest, caption, title, buffer);
}
/******************************************************************
+ Deliver options to the client for setting
+******************************************************************/
+void report_settable_server_options(struct connection *dest, int which)
+{
+ static struct packet_options_settable pack;
+ int i, s=0;
+
+ fprintf(stderr,"<<<%d>>>\n",which);
+
+ if (dest->access_level < ALLOW_CTRL ||
+ (which==1 && server_state > PRE_GAME_STATE)){
+ report_server_options(&dest->self, which);
+ return;
+ }
+
+ memset(&pack, 0, sizeof(struct packet_options_settable));
+
+ pack.nopts=0;
+ for (i=0;settings[i].name;i++) {
+ if (which==1 && settings[i].sclass > SSET_GAME_INIT) continue;
+ if (which==2 && settings[i].sclass <= SSET_GAME_INIT) continue;
+ /* if (i==32) {
+ fprintf(stderr,"skipping %s\n",settings[i].name);
+ continue;
+ }*/
+ strcpy(pack.optname[pack.nopts], settings[i].name);
+ strcpy(pack.opthelp[pack.nopts], settings[i].short_help);
+ if (settings[i].extra_help[0]) {
+ strcat(pack.opthelp[pack.nopts], ".\n\n");
+ strcat(pack.opthelp[pack.nopts], settings[i].extra_help);
+ }
+ pack.categ[pack.nopts]=settings[i].category;
+ if (settings[i].type == SSET_STRING) {
+ pack.val[pack.nopts]=s;
+ pack.min[pack.nopts]=0;
+ pack.max[pack.nopts]=-1;
+ strcpy(pack.stringVals[s++],settings[i].string_value);
+ } else if (settings[i].type == SSET_BOOL) {
+ /*Swap these to distinguish logically numeric options from boolean ones*/
+ pack.min[pack.nopts]=1;
+ pack.max[pack.nopts]=0;
+ pack.val[pack.nopts]=*(settings[i].bool_value);
+ } else {
+ pack.min[pack.nopts]=settings[i].int_min_value;
+ pack.max[pack.nopts]=settings[i].int_max_value;
+ pack.val[pack.nopts]=*(settings[i].int_value);
+ }
+ pack.nopts++;
+ }
+ pack.nstrings=s;
+ pack.ncateg=SSET_NUM_CATEGORIES;
+ for (i=0;i<SSET_NUM_CATEGORIES;i++) {
+ strcpy(pack.categNames[i], sset_category_names[i]);
+ }
+ send_packet_options_settable(dest, &pack);
+}
+
+/******************************************************************
Set an AI level and related quantities, with no feedback.
******************************************************************/
void set_ai_level_directer(struct player *pplayer, int level)
diff -ur freeciv-mike-Jan-19/server/stdinhand.h
freeciv-speyer-Jan-19/server/stdinhand.h
--- freeciv-mike-Jan-19/server/stdinhand.h 2002-12-17 10:14:48.000000000
-0500
+++ freeciv-speyer-Jan-19/server/stdinhand.h 2004-01-26 14:55:53.000000000
-0500
@@ -22,6 +22,7 @@
void handle_stdin_input(struct connection *caller, char *str);
void report_server_options(struct conn_list *dest, int which);
+void report_settable_server_options(struct connection *dest, int which);
void set_ai_level_direct(struct player *pplayer, int level);
void set_ai_level_directer(struct player *pplayer, int level);
bool read_init_script(struct connection *caller, char *script_filename);
- [Freeciv-Dev] Re: Extended connect dialog (PR#977), (continued)
- [Freeciv-Dev] Re: Extended connect dialog (PR#977), Jason Short, 2004/01/19
- [Freeciv-Dev] Re: Extended connect dialog (PR#977), Jason Short, 2004/01/19
- [Freeciv-Dev] Re: Extended connect dialog (PR#977), Raimar Falke, 2004/01/20
- [Freeciv-Dev] Re: Extended connect dialog (PR#977), imbaczek@xxxxxxxxxxxxxx, 2004/01/22
- [Freeciv-Dev] Re: Extended connect dialog (PR#977), Raimar Falke, 2004/01/22
- [Freeciv-Dev] Re: Extended connect dialog (PR#977), imbaczek@xxxxxxxxxxxxxx, 2004/01/22
- [Freeciv-Dev] Re: Extended connect dialog (PR#977), imbaczek@xxxxxxxxxxxxxx, 2004/01/22
- [Freeciv-Dev] Re: Extended connect dialog (PR#977), Raimar Falke, 2004/01/23
- [Freeciv-Dev] Re: Extended connect dialog (PR#977), imbaczek@xxxxxxxxxxxxxx, 2004/01/23
- [Freeciv-Dev] (PR#977) Extended connect dialog, Vasco Alexandre da Silva Costa, 2004/01/26
- [Freeciv-Dev] Additions to connect dialog (PR#977),
Daniel L Speyer <=
|
|