[Freeciv-Dev] Re: (PR#13302) Show changed
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=13302 >
Am Freitag, 24. Juni 2005 06:15 schrieb Jason Short:
> <URL: http://bugs.freeciv.org/Ticket/Display.html?id=13302 >
>
> You forgot the patch.
Lol, you're right, sorry ...
here are the patches, i didnt know how to make one diff for 2 files, so there
are 2 of them. I've tested it, and it seems to work fine for me.
Thomas
--
Wußten Sie schon...
... daß eine Lachmöwe auch auf einer Heulboje sitzen kann?
--- orig.settings.h 2005-06-21 00:35:40.000000000 +0200
+++ settings.h 2005-06-21 00:35:57.000000000 +0200
@@ -68,7 +68,8 @@
SSET_ALL,
SSET_VITAL,
SSET_SITUATIONAL,
- SSET_RARE
+ SSET_RARE,
+ SSET_CHANGED
};
extern const char *sset_level_names[];
--- orig.stdinhand.c 2005-06-20 23:46:46.000000000 +0200
+++ stdinhand.c 2005-06-21 01:13:34.000000000 +0200
@@ -1909,6 +1909,12 @@
return FALSE;
}
}
+
+ if (strcmp(command,"changed")==0) {
+ level = SSET_CHANGED;
+ cmd=-8;
+ }
+
if (cmd == -1) {
cmd_reply(CMD_SHOW, caller, C_FAIL, _("Unknown option '%s'."), command);
return FALSE;
@@ -1929,11 +1935,15 @@
#define OPTION_NAME_SPACE 13
/* under 16, so it fits into 80 cols more easily - rp */
+
cmd_reply_show(horiz_line);
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;
@@ -1961,25 +1971,33 @@
buf[0] = '\0';
for (i = 0; settings[i].name; i++) {
- if (may_view_option(caller, i)
- && (cmd == -1 || cmd == -3 || cmd == i
+
+ if (may_view_option(caller, i)
+ && (cmd == -1 || cmd == -3 || cmd == -8 || 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 || cmd == -8)) {
+int is_changed = 0;
+ switch (op->type) {
+ case SSET_BOOL:
+ if (*op->bool_value != op->bool_default_value) {
+ is_changed = 1; }
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 = 1; }
len = my_snprintf(buf, sizeof(buf),
"%-*s %c%c%-5d (%d,%d)", OPTION_NAME_SPACE,
op->name, may_set_option_now(caller,
@@ -1987,16 +2005,17 @@
((*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:
+ case SSET_STRING: if (strcmp(op->string_value,
op->string_default_value) != 0) {
+ is_changed = 1; }
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) {
@@ -2009,7 +2028,7 @@
sz_strlcat(buf, " ");
}
sz_strlcat(buf, _(op->short_help));
- cmd_reply_show(buf);
+ if ((is_changed == 1)|| (cmd != -8)) {cmd_reply_show(buf);}
}
}
}
- [Freeciv-Dev] Re: (PR#13302) Show changed,
Thomas Müller <=
|
|