Complete.Org: Mailing Lists: Archives: freeciv-dev: July 2004:
[Freeciv-Dev] (PR#9434) Option levels
Home

[Freeciv-Dev] (PR#9434) Option levels

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: undisclosed-recipients: ;
Subject: [Freeciv-Dev] (PR#9434) Option levels
From: "Gregory Richards" <akaquinn@xxxxxxxxxxx>
Date: Mon, 19 Jul 2004 19:34:38 -0700
Reply-to: rt@xxxxxxxxxxx

<URL: http://rt.freeciv.org/Ticket/Display.html?id=9434 >

The number of options has become quite immense.  This patch divides 
the options into 3 levels: Vital, situational, and rarely changed.  
Typing "show" will cause it to show only vital options, and then tell 
you how to show the others.  This not only makes the options list a 
bit more manageable, but also easier for newbies to the server, since 
they don't have to wade through tons of options to find what they're 
looking for. 
diff -ruN -X freeciv-cvs-Jul-18/diff_ignore freeciv-cvs-Jul-18/data/mkcycle 
freeciv-cvs-Jul-18-optionlevels/data/mkcycle
--- freeciv-cvs-Jul-18/data/mkcycle     1969-12-31 16:00:00.000000000 -0800
+++ freeciv-cvs-Jul-18-optionlevels/data/mkcycle        2004-07-19 
19:20:39.000000000 -0700
@@ -0,0 +1,5 @@
+#!/bin/sh
+cd ../server
+make
+cd ../data
+../server/civserver
diff -ruN -X freeciv-cvs-Jul-18/diff_ignore 
freeciv-cvs-Jul-18/server/stdinhand.c 
freeciv-cvs-Jul-18-optionlevels/server/stdinhand.c
--- freeciv-cvs-Jul-18/server/stdinhand.c       2004-07-12 22:14:48.000000000 
-0700
+++ freeciv-cvs-Jul-18-optionlevels/server/stdinhand.c  2004-07-19 
19:35:38.000000000 -0700
@@ -1,4 +1,4 @@
-/********************************************************************** 
+/**********************************************************************
  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
@@ -197,6 +197,12 @@
   const char *string_default_value;
   bool (*string_validate)(const char * value, const char **reject_message);
   size_t string_value_size;    /* max size we can write into string_value */
+
+  /* Each setting has a level to be viewed at
+     0 is settings which are quite often changed
+     1 is settings which are changed in many situations, but not all
+     2 are settings that are rarely changed */
+  int level;
 };
 
 /*
@@ -226,23 +232,23 @@
   return TRUE;
 }
   
-#define GEN_BOOL(name, value, sclass, scateg, to_client, short_help, 
extra_help, func, default) \
+#define GEN_BOOL(name, value, sclass, scateg, to_client, short_help, 
extra_help, func, default, level) \
  { name, sclass, to_client, short_help, extra_help, SSET_BOOL, scateg, \
    &value, default, func, \
    NULL, 0, NULL, 0, 0, \
-   NULL, NULL, NULL, 0 },
+   NULL, NULL, NULL, 0, level },
 
-#define GEN_INT(name, value, sclass, scateg, to_client, short_help, 
extra_help, func, min, max, default) \
+#define GEN_INT(name, value, sclass, scateg, to_client, short_help, 
extra_help, func, min, max, default, level) \
  { name, sclass, to_client, short_help, extra_help, SSET_INT, scateg, \
    NULL, FALSE, NULL, \
    &value, default, func, min, max, \
-   NULL, NULL, NULL, 0 },
+   NULL, NULL, NULL, 0, level },
 
-#define GEN_STRING(name, value, sclass, scateg, to_client, short_help, 
extra_help, func, default) \
+#define GEN_STRING(name, value, sclass, scateg, to_client, short_help, 
extra_help, func, default, level) \
  { name, sclass, to_client, short_help, extra_help, SSET_STRING, scateg, \
    NULL, FALSE, NULL, \
    NULL, 0, NULL, 0, 0, \
-   value, default, func, sizeof(value)},
+   value, default, func, sizeof(value), level },
 
 #define GEN_END \
  { NULL, SSET_LAST, SSET_SERVER_ONLY, NULL, NULL, SSET_INT, 
SSET_NUM_CATEGORIES, \
@@ -260,7 +266,7 @@
           N_("This value is used to determine xsize and ysize\n"
              "  size = 4 is a normal map of 4,000 tiles (default)\n"
              "  size = 20 is a huge map of 20,000 tiles"), NULL,
-          MAP_MIN_SIZE, MAP_MAX_SIZE, MAP_DEFAULT_SIZE)
+          MAP_MIN_SIZE, MAP_MAX_SIZE, MAP_DEFAULT_SIZE, 0)
   GEN_INT("topology", map.topology_id, SSET_MAP_SIZE, SSET_GEOLOGY, 
           SSET_TO_CLIENT,
          N_("The map topology index"),
@@ -276,7 +282,7 @@
             "  6 Uranus (isometric)\n"
             "  7 Donut World (isometric)"
           ), NULL, 
-         MAP_MIN_TOPO, MAP_MAX_TOPO, MAP_DEFAULT_TOPO)
+         MAP_MIN_TOPO, MAP_MAX_TOPO, MAP_DEFAULT_TOPO, 1)
 
 /* Map generation parameters: once we have a map these are of historical
  * interest only, and cannot be changed.
@@ -296,65 +302,65 @@
        "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, 0)
 
   GEN_BOOL("tinyisles", map.tinyisles, SSET_MAP_GEN, SSET_GEOLOGY,
            SSET_TO_CLIENT,
           N_("Presence of 1x1 islands"),
           N_("0 = no 1x1 islands; 1 = some 1x1 islands"), NULL,
-          MAP_DEFAULT_TINYISLES)
+          MAP_DEFAULT_TINYISLES, 2)
 
   GEN_BOOL("separatepoles", map.separatepoles, SSET_MAP_GEN, SSET_GEOLOGY,
            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, 1)
 
   GEN_BOOL("alltemperate", map.alltemperate, SSET_MAP_GEN, SSET_GEOLOGY,
            SSET_TO_CLIENT,
           N_("All the map is temperate (no poles or equatorial regions)"),
           N_("0 = normal Earth-like planet; 1 = all-temperate planet "),
-          NULL, MAP_DEFAULT_ALLTEMPERATE)
+          NULL, MAP_DEFAULT_ALLTEMPERATE, 2)
 
   GEN_INT("landmass", map.landpercent, SSET_MAP_GEN, SSET_GEOLOGY,
           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, 1)
 
   GEN_INT("mountains", map.mountains, SSET_MAP_GEN, SSET_GEOLOGY,
           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, 1)
 
   GEN_INT("rivers", map.riverlength, SSET_MAP_GEN, SSET_GEOLOGY, 
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, 1)
 
   GEN_INT("grass", map.grasssize, SSET_MAP_GEN, SSET_ECOLOGY, 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, 1)
 
   GEN_INT("forests", map.forestsize, SSET_MAP_GEN, SSET_ECOLOGY, 
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, 1)
 
   GEN_INT("swamps", map.swampsize, SSET_MAP_GEN, SSET_ECOLOGY, 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, 1)
     
   GEN_INT("deserts", map.deserts, SSET_MAP_GEN, SSET_ECOLOGY, 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, 1)
 
   GEN_INT("seed", map.seed, SSET_MAP_GEN, SSET_INTERNAL, 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, 2)
 
 /* Map additional stuff: huts and specials.  randseed also goes here
  * because huts and specials are the first time the randseed gets used (?)
@@ -366,18 +372,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, 2)
 
   GEN_INT("specials", map.riches, SSET_MAP_ADD, SSET_ECOLOGY, 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, 0)
 
   GEN_INT("huts", map.huts, SSET_MAP_ADD, SSET_GEOLOGY, 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, 0)
 
 /* Options affecting numbers of players and AI players.  These only
  * affect the start of the game and can not be adjusted after that.
@@ -389,7 +395,7 @@
          N_("Minimum number of players"),
          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_MIN_MIN_PLAYERS, GAME_MAX_MIN_PLAYERS, GAME_DEFAULT_MIN_PLAYERS, 
0)
   
   GEN_INT("maxplayers", game.max_players, SSET_PLAYERS, SSET_INTERNAL,
           SSET_TO_CLIENT,
@@ -398,7 +404,7 @@
              "the game. When this number of players are connected in "
              "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_MIN_MAX_PLAYERS, GAME_MAX_MAX_PLAYERS, GAME_DEFAULT_MAX_PLAYERS, 
0)
 
   GEN_INT("aifill", game.aifill, SSET_PLAYERS, SSET_INTERNAL, SSET_TO_CLIENT,
          N_("Number of players to fill to with AI's"),
@@ -406,7 +412,7 @@
             "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, 0)
 
 /* Game initialization parameters (only affect the first start of the game,
  * and not reloads).  Can not be changed after first start of game.
@@ -428,31 +434,31 @@
                "    D   = Good defense unit (eg. Phalanx)\n"
                "    a   = Fast attack unit (eg. Horsemen)\n"
                "    A   = Strong attack unit (eg. Catapult)\n"),
-               is_valid_startunits, GAME_DEFAULT_START_UNITS)
+               is_valid_startunits, GAME_DEFAULT_START_UNITS, 0)
 
   GEN_INT("dispersion", game.dispersion, SSET_GAME_INIT, SSET_SOCIOLOGY,
           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, 1)
 
   GEN_INT("gold", game.gold, SSET_GAME_INIT, SSET_ECONOMICS, 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, 0)
 
   GEN_INT("techlevel", game.tech, SSET_GAME_INIT, SSET_SCIENCE,
           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, 0)
 
-  GEN_INT("researchcost", game.researchcost, SSET_RULES, SSET_SCIENCE, 
+  GEN_INT("researchcost", game.researchcost, SSET_RULES, SSET_SCIENCE,
           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, 1)
 
   GEN_INT("techpenalty", game.techpenalty, SSET_RULES, SSET_SCIENCE,
           SSET_TO_CLIENT,
@@ -462,7 +468,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, 2)
 
   GEN_INT("diplcost", game.diplcost, SSET_RULES, SSET_SCIENCE, SSET_TO_CLIENT,
          N_("Penalty when getting tech from treaty"),
@@ -470,7 +476,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, 2)
 
   GEN_INT("conquercost", game.conquercost, SSET_RULES, SSET_SCIENCE,
           SSET_TO_CLIENT,
@@ -480,7 +486,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, 2)
 
   GEN_INT("freecost", game.freecost, SSET_RULES, SSET_SCIENCE, SSET_TO_CLIENT,
          N_("Penalty when getting a free tech"),
@@ -490,11 +496,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, 2)
 
   GEN_INT("foodbox", game.foodbox, SSET_RULES, SSET_ECONOMICS, 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, 1)
 
   GEN_INT("aqueductloss", game.aqueductloss, SSET_RULES, SSET_ECONOMICS,
           SSET_TO_CLIENT,
@@ -504,7 +510,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, 2)
 
   GEN_INT("fulltradesize", game.fulltradesize, SSET_RULES, SSET_ECONOMICS,
           SSET_TO_CLIENT,
@@ -515,7 +521,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, 2)
 
   GEN_INT("notradesize", game.notradesize, SSET_RULES, SSET_ECONOMICS,
           SSET_TO_CLIENT,
@@ -526,7 +532,7 @@
             "than fulltradesize.  See also fulltradesize."),
          valid_notradesize,
          GAME_MIN_NOTRADESIZE, GAME_MAX_NOTRADESIZE,
-         GAME_DEFAULT_NOTRADESIZE)
+         GAME_DEFAULT_NOTRADESIZE, 2)
 
   GEN_INT("unhappysize", game.unhappysize, SSET_RULES, SSET_SOCIOLOGY,
           SSET_TO_CLIENT,
@@ -535,7 +541,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, 2)
 
   GEN_BOOL("angrycitizen", game.angrycitizen, SSET_RULES, SSET_SOCIOLOGY,
            SSET_TO_CLIENT,
@@ -544,7 +550,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, 1)
 
   GEN_INT("cityfactor", game.cityfactor, SSET_RULES, SSET_SOCIOLOGY,
           SSET_TO_CLIENT,
@@ -554,7 +560,7 @@
             "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, 2)
 
   GEN_INT("citymindist", game.citymindist, SSET_RULES, SSET_SOCIOLOGY,
           SSET_TO_CLIENT,
@@ -566,7 +572,7 @@
             "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, 1)
   
   GEN_INT("rapturedelay", game.rapturedelay, SSET_RULES, SSET_SOCIOLOGY,
           SSET_TO_CLIENT,
@@ -574,14 +580,14 @@
           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, 1)
 
   GEN_INT("razechance", game.razechance, SSET_RULES, SSET_MILITARY,
           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, 2)
 
   GEN_INT("civstyle", game.civstyle, SSET_RULES, SSET_MILITARY, SSET_TO_CLIENT,
          N_("Style of Civ rules"),
@@ -589,7 +595,7 @@
             "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, 2)
 
   GEN_INT("occupychance", game.occupychance, SSET_RULES, SSET_MILITARY,
           SSET_TO_CLIENT,
@@ -601,7 +607,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, 2)
 
   GEN_INT("killcitizen", game.killcitizen, SSET_RULES, SSET_MILITARY,
           SSET_TO_CLIENT,
@@ -614,7 +620,7 @@
             "  4 = heli\n"
             "  8 = air"), NULL,
          GAME_MIN_KILLCITIZEN, GAME_MAX_KILLCITIZEN,
-         GAME_DEFAULT_KILLCITIZEN)
+         GAME_DEFAULT_KILLCITIZEN, 2)
 
   GEN_INT("wtowervision", game.watchtower_vision, SSET_RULES, SSET_MILITARY,
           SSET_TO_CLIENT,
@@ -626,7 +632,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, 2)
 
   GEN_INT("wtowerevision", game.watchtower_extra_vision, SSET_RULES,
          SSET_MILITARY, SSET_TO_CLIENT,
@@ -639,14 +645,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, 2)
 
   GEN_INT("borders", game.borders, SSET_RULES, SSET_MILITARY, 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, 1)
 
   GEN_INT("diplomacy", game.diplomacy, SSET_RULES, SSET_MILITARY,
           SSET_TO_CLIENT,
@@ -657,7 +663,7 @@
              "If set to 3, diplomacy is restricted to teams.\n"
              "If set to 4, 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, 1)
 
   GEN_INT("citynames", game.allowed_city_names, SSET_RULES, SSET_SOCIOLOGY,
           SSET_TO_CLIENT,
@@ -671,7 +677,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, 2)
   
 /* Flexible rules: these can be changed after the game has started.
  *
@@ -695,14 +701,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, 0)
 
   GEN_INT("onsetbarbs", game.onsetbarbarian, SSET_RULES_FLEXIBLE,
          SSET_MILITARY, 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, 0)
 
   GEN_INT("revolen", game.revolution_length, SSET_RULES_FLEXIBLE,
          SSET_SOCIOLOGY, SSET_TO_CLIENT,
@@ -713,7 +719,7 @@
              " Setting this value to 0 will give a random"
              " length of 1-6 turns."), NULL, 
          GAME_MIN_REVOLUTION_LENGTH, GAME_MAX_REVOLUTION_LENGTH, 
-         GAME_DEFAULT_REVOLUTION_LENGTH)
+         GAME_DEFAULT_REVOLUTION_LENGTH, 2)
 
   GEN_BOOL("fogofwar", game.fogofwar, SSET_RULES_FLEXIBLE, SSET_MILITARY,
            SSET_TO_CLIENT,
@@ -722,7 +728,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, 2)
 
   GEN_INT("diplchance", game.diplchance, SSET_RULES_FLEXIBLE, SSET_MILITARY,
           SSET_TO_CLIENT,
@@ -737,13 +743,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, 1)
 
   GEN_BOOL("spacerace", game.spacerace, SSET_RULES_FLEXIBLE, SSET_SCIENCE,
            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, 0)
 
   GEN_INT("civilwarsize", game.civilwarsize, SSET_RULES_FLEXIBLE,
          SSET_SOCIOLOGY, SSET_TO_CLIENT,
@@ -753,7 +759,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, 2)
 
   GEN_INT("contactturns", game.contactturns, SSET_RULES_FLEXIBLE,
          SSET_MILITARY, SSET_TO_CLIENT,
@@ -762,7 +768,7 @@
             "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, 2)
 
   GEN_BOOL("savepalace", game.savepalace, SSET_RULES_FLEXIBLE, SSET_MILITARY,
            SSET_TO_CLIENT,
@@ -770,14 +776,14 @@
           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, 2)
 
   GEN_BOOL("naturalcitynames", game.natural_city_names,
            SSET_RULES_FLEXIBLE, SSET_SOCIOLOGY, 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, 2)
 
 /* Meta options: these don't affect the internal rules of the game, but
  * do affect players.  Also options which only produce extra server
@@ -818,18 +824,18 @@
                 "     4 = No controller allowed, observers allowed;\n\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, 2)
 
   GEN_BOOL("autotoggle", game.auto_ai_toggle, SSET_META, SSET_NETWORK,
            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, 1)
 
   GEN_INT("endyear", game.end_year, SSET_META, SSET_SOCIOLOGY, 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, 0)
 
 #ifndef NDEBUG
   GEN_INT( "timeout", game.timeout, SSET_META, SSET_INTERNAL, SSET_TO_CLIENT,
@@ -839,7 +845,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, 0)
 #else
   GEN_INT( "timeout", game.timeout, SSET_META, SSET_INTERNAL, SSET_TO_CLIENT,
           N_("Maximum seconds per turn"),
@@ -847,7 +853,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, 0)
 #endif
 
   GEN_INT("tcptimeout", game.tcptimeout, SSET_META, SSET_NETWORK,
@@ -857,7 +863,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, 2)
 
   GEN_INT("netwait", game.netwait, SSET_META, SSET_NETWORK, SSET_TO_CLIENT,
          N_("Max seconds for TCP buffers to drain"),
@@ -865,20 +871,20 @@
             "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, 2)
 
   GEN_INT("pingtime", game.pingtime, SSET_META, SSET_NETWORK, 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, 2)
 
   GEN_INT("pingtimeout", game.pingtimeout, SSET_META, SSET_NETWORK,
           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, 
2)
 
   GEN_BOOL("turnblock", game.turnblock, SSET_META, SSET_INTERNAL,
            SSET_TO_CLIENT,
@@ -886,7 +892,7 @@
           N_("If this is set to 1 the game turn is not advanced "
              "until all players have finished their turn, including "
              "disconnected players."), NULL, 
-          GAME_DEFAULT_TURNBLOCK)
+          GAME_DEFAULT_TURNBLOCK, 1)
 
   GEN_BOOL("fixedlength", game.fixedlength, SSET_META, SSET_INTERNAL,
            SSET_TO_CLIENT,
@@ -894,7 +900,7 @@
           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, 1)
   
   GEN_STRING("demography", game.demography, SSET_META, SSET_INTERNAL,
              SSET_TO_CLIENT,
@@ -919,14 +925,14 @@
                "    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, 1)
 
   GEN_INT("saveturns", game.save_nturns, SSET_META, SSET_INTERNAL,
           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, 0)
 
   /* 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
@@ -941,7 +947,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, 2)
 #else
   GEN_INT("compress", game.save_compress_level, SSET_META, SSET_INTERNAL,
           SSET_SERVER_ONLY,
@@ -952,7 +958,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, 2)
 #endif
 
   GEN_STRING("savename", game.save_name, SSET_META, SSET_INTERNAL,
@@ -961,7 +967,7 @@
             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, 2)
 
   GEN_BOOL("scorelog", game.scorelog, SSET_META, SSET_INTERNAL,
            SSET_SERVER_ONLY,
@@ -969,7 +975,7 @@
           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, 1)
 
   GEN_INT("gamelog", gamelog_level, SSET_META, SSET_INTERNAL, SSET_SERVER_ONLY,
          N_("Detail level for logging game events"),
@@ -977,7 +983,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, 1)
 
   GEN_END
 };
@@ -3019,6 +3025,7 @@
   char buf[MAX_LEN_CONSOLE_LINE];
   char command[MAX_LEN_CONSOLE_LINE], *cptr_s, *cptr_d;
   int cmd,i,len1;
+  int level = -1;
   size_t clen = 0;
 
   for (cptr_s = str; *cptr_s != '\0' && !my_isalnum(*cptr_s); cptr_s++) {
@@ -3037,8 +3044,13 @@
       return FALSE;
     }
     if (cmd==-1) {
-      cmd_reply(CMD_SHOW, caller, C_FAIL, _("Unknown option '%s'."), command);
-      return FALSE;
+      // Level support:
+      level = atoi(command);
+      level--;
+      if (level < 0 || level > 2) {
+        cmd_reply(CMD_SHOW, caller, C_FAIL, _("Unknown option '%s'."), 
command);
+        return FALSE;
+      }
     }
     if (cmd==-2) {
       /* allow ambiguous: show all matching */
@@ -3046,6 +3058,7 @@
     }
   } else {
    cmd = -1;  /* to indicate that no comannd was specified */
+   level = 0; /* to not show ALL options */
   }
 
 #define cmd_reply_show(string)  cmd_reply(CMD_SHOW, caller, C_COMMENT, string)
@@ -3054,6 +3067,17 @@
   /* under SSET_MAX_LEN, so it fits into 80 cols more easily - rp */
 
   cmd_reply_show(horiz_line);
+  switch(level) {
+    case 0:
+      cmd_reply_show(_("Level 1: Vital options"));
+      break;
+    case 1:
+      cmd_reply_show(_("Level 2: Situational options"));
+      break;
+    case 2:
+      cmd_reply_show(_("Level 3: Rarely used options"));
+      break;
+  }
   cmd_reply_show(_("+ means you may change the option"));
   cmd_reply_show(_("= means the option is on its default value"));
   cmd_reply_show(horiz_line);
@@ -3075,49 +3099,55 @@
       struct settings_s *op = &settings[i];
       int len = 0;
 
-      switch (op->type) {
-      case SSET_BOOL:
-       len = my_snprintf(buf, sizeof(buf),
-                         "%-*s %c%c%-5d (0,1)", OPTION_NAME_SPACE, op->name,
-                         may_set_option_now(caller, i) ? '+' : ' ',
-                         ((*op->bool_value == op->bool_default_value) ?
-                          '=' : ' '), (*op->bool_value) ? 1 : 0);
-       break;
-
-      case SSET_INT:
-       len = my_snprintf(buf, sizeof(buf),
-                         "%-*s %c%c%-5d (%d,%d)", OPTION_NAME_SPACE,
-                         op->name, may_set_option_now(caller,
-                                                      i) ? '+' : ' ',
-                         ((*op->int_value == op->int_default_value) ?
-                          '=' : ' '),
-                         *op->int_value, op->int_min_value,
-                         op->int_max_value);
-       break;
-
-      case SSET_STRING:
-       len = my_snprintf(buf, sizeof(buf),
-                         "%-*s %c%c\"%s\"", OPTION_NAME_SPACE, op->name,
-                         may_set_option_now(caller, i) ? '+' : ' ',
-                         ((strcmp(op->string_value,
-                                  op->string_default_value) == 0) ?
-                          '=' : ' '), op->string_value);
-       break;
-      }
-      if (len == -1) {
-         len = sizeof(buf) - 1;
-      }
-      /* Line up the descriptions: */
-      if(len < len1) {
-        cat_snprintf(buf, sizeof(buf), "%*s", (len1-len), " ");
-      } else {
-        sz_strlcat(buf, " ");
+      if (level == -1 || op->level == level) {
+        switch (op->type) {
+        case SSET_BOOL:
+       len = my_snprintf(buf, sizeof(buf),
+                           "%-*s %c%c%-5d (0,1)", OPTION_NAME_SPACE, op->name,
+                           may_set_option_now(caller, i) ? '+' : ' ',
+                           ((*op->bool_value == op->bool_default_value) ?
+                            '=' : ' '), (*op->bool_value) ? 1 : 0);
+         break;
+
+        case SSET_INT:
+       len = my_snprintf(buf, sizeof(buf),
+                           "%-*s %c%c%-5d (%d,%d)", OPTION_NAME_SPACE,
+                           op->name, may_set_option_now(caller,
+                                                        i) ? '+' : ' ',
+                           ((*op->int_value == op->int_default_value) ?
+                            '=' : ' '),
+                           *op->int_value, op->int_min_value,
+                           op->int_max_value);
+         break;
+
+        case SSET_STRING:
+       len = my_snprintf(buf, sizeof(buf),
+                           "%-*s %c%c\"%s\"", OPTION_NAME_SPACE, op->name,
+                           may_set_option_now(caller, i) ? '+' : ' ',
+                           ((strcmp(op->string_value,
+                                    op->string_default_value) == 0) ?
+                            '=' : ' '), op->string_value);
+         break;
+        }
+        if (len == -1) {
+           len = sizeof(buf) - 1;
+        }
+        /* Line up the descriptions: */
+        if(len < len1) {
+          cat_snprintf(buf, sizeof(buf), "%*s", (len1-len), " ");
+        } else {
+          sz_strlcat(buf, " ");
+        }
+        sz_strlcat(buf, _(op->short_help));
+        cmd_reply_show(buf);
       }
-      sz_strlcat(buf, _(op->short_help));
-      cmd_reply_show(buf);
     }
   }
   cmd_reply_show(horiz_line);
+  if (level == 0) {
+    cmd_reply_show(_("Try 'show 2' or 'show 3' to show more options"));
+    cmd_reply_show(horiz_line);
+  }
   return TRUE;
 #undef cmd_reply_show
 #undef OPTION_NAME_SPACE

[Prev in Thread] Current Thread [Next in Thread]