Complete.Org: Mailing Lists: Archives: freeciv-dev: June 2005:
[Freeciv-Dev] (PR#13302) Show changed
Home

[Freeciv-Dev] (PR#13302) Show changed

[Top] [All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
To: mail@xxxxxxxxxxx
Subject: [Freeciv-Dev] (PR#13302) Show changed
From: "Mateusz Stefek" <mstefek@xxxxxxxxx>
Date: Thu, 30 Jun 2005 01:43:13 -0700
Reply-to: bugs@xxxxxxxxxxx

<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13302 >

> > Maybe we should change the following message:
> > "Try 'show situational' or 'show rare' to show more options"
> > into
> > "Try 'show situational' or 'show rare' to show more options
> >  Try 'show changed' to see settings with non-default values
> 
> Which has to be translated though, and i dont know how that is
> handled. I can
> translate it into german ;)
> 
> Although i think it should be in the /help show somewhere, maybe add
> "All, rare, situational and changed will show a list of settings".
> 
> 
> Thomas
> 
You don't have to worry about translation just place english string
inside  _( ) 

This patch is your latest patch + one line message.
--
mateusz

? civgame-1000.sav.gz
? civgame-1500.sav.gz
? civgame-2000.sav.gz
? civgame-2500.sav.gz
? civgame-3000.sav.gz
? civgame-3500.sav.gz
Index: settings.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settings.c,v
retrieving revision 1.27
diff -u -r1.27 settings.c
--- settings.c  14 Jun 2005 18:49:09 -0000      1.27
+++ settings.c  30 Jun 2005 08:38:41 -0000
@@ -41,7 +41,8 @@
                                  N_("All"),
                                  N_("Vital"),
                                  N_("Situational"),
-                                 N_("Rare")};
+                                 N_("Rare"),
+                                 N_("Changed")};
 const int OLEVELS_NUM = ARRAY_SIZE(sset_level_names);
 
 
Index: settings.h
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/settings.h,v
retrieving revision 1.4
diff -u -r1.4 settings.h
--- settings.h  29 Apr 2005 17:49:27 -0000      1.4
+++ settings.h  30 Jun 2005 08:38:41 -0000
@@ -68,7 +68,8 @@
   SSET_ALL,
   SSET_VITAL,
   SSET_SITUATIONAL,
-  SSET_RARE
+  SSET_RARE,
+  SSET_CHANGED
 };
 
 extern const char *sset_level_names[];
Index: stdinhand.c
===================================================================
RCS file: /home/freeciv/CVS/freeciv/server/stdinhand.c,v
retrieving revision 1.423
diff -u -r1.423 stdinhand.c
--- stdinhand.c 27 Jun 2005 14:13:44 -0000      1.423
+++ stdinhand.c 30 Jun 2005 08:38:48 -0000
@@ -1431,7 +1431,7 @@
 {
   enum sset_level i;
 
-  for (i = SSET_ALL; i <= SSET_RARE; i++) {
+  for (i = SSET_ALL; i <= SSET_CHANGED; i++) {
     if (0 == mystrcasecmp(name, sset_level_names[i])) {
       return i;
     }
@@ -1872,6 +1872,7 @@
 {
   char buf[MAX_LEN_CONSOLE_LINE];
   char command[MAX_LEN_CONSOLE_LINE], *cptr_s, *cptr_d;
+  bool is_changed;
   int cmd,i,len1;
   enum sset_level level = SSET_VITAL;
   size_t clen = 0;
@@ -1923,6 +1924,9 @@
   switch(level) {
     case SSET_NONE:
       break;
+    case SSET_CHANGED:
+      cmd_reply_show(_("All options with non-default values"));
+      break;
     case SSET_ALL:
       cmd_reply_show(_("All options"));
       break;
@@ -1950,25 +1954,34 @@
   buf[0] = '\0';
 
   for (i = 0; settings[i].name; i++) {
-    if (may_view_option(caller, i)
-       && (cmd == -1 || cmd == -3 || cmd == i
-           || (cmd == -2
-               && mystrncasecmp(settings[i].name, command, clen) == 0))) {
+   is_changed = FALSE;
+   if (may_view_option(caller, i)
+       && (cmd == -1 || cmd == -3 || level == SSET_CHANGED || cmd == i 
+       || (cmd == -2 && mystrncasecmp(settings[i].name, command, clen) == 0))) 
{
       /* in the cmd==i case, this loop is inefficient. never mind - rp */
       struct settings_s *op = &settings[i];
       int len = 0;
 
-      if (level == SSET_ALL || op->level == level || cmd >= 0) {
-        switch (op->type) {
-        case SSET_BOOL:
+ 
+   if ((level == SSET_ALL || op->level == level || cmd >= 0 
+     || level == SSET_CHANGED))  {
+   switch (op->type) {
+        case SSET_BOOL: 
+         if (*op->bool_value != op->bool_default_value) {
+           is_changed = TRUE;
+         }
          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:
+        case SSET_INT: 
+         if (*op->int_value != op->int_default_value) {
+           is_changed = TRUE;
+         }
          len = my_snprintf(buf, sizeof(buf),
                            "%-*s %c%c%-5d (%d,%d)", OPTION_NAME_SPACE,
                            op->name, may_set_option_now(caller,
@@ -1976,16 +1989,19 @@
                            ((*op->int_value == op->int_default_value) ?
                             '=' : ' '),
                            *op->int_value, op->int_min_value,
-                           op->int_max_value);
+                           op->int_max_value); 
          break;
 
         case SSET_STRING:
+         if (strcmp(op->string_value, op->string_default_value) != 0) {
+           is_changed = TRUE; 
+         }
          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);
+                            '=' : ' '), op->string_value); 
          break;
         }
         if (len == -1) {
@@ -1998,14 +2014,18 @@
           sz_strlcat(buf, " ");
         }
         sz_strlcat(buf, _(op->short_help));
-        cmd_reply_show(buf);
+        if ((is_changed) || (level != SSET_CHANGED)) {
+         cmd_reply_show(buf);
+       }
       }
     }
   }
   cmd_reply_show(horiz_line);
   if (level == SSET_VITAL) {
     cmd_reply_show(_("Try 'show situational' or 'show rare' to show "
-                    "more options"));
+                    "more options.\n"
+                    "Try 'show changed' to show settings with "
+                    "non-default values."));
     cmd_reply_show(horiz_line);
   }
   return TRUE;

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