[Freeciv-Dev] (PR#16459) Lots of conndlg errors
[Top] [All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index] [Thread Index]
Subject: |
[Freeciv-Dev] (PR#16459) Lots of conndlg errors |
From: |
"Per I. Mathisen" <per@xxxxxxxxxxx> |
Date: |
Sat, 15 Apr 2006 12:34:30 -0700 |
Reply-to: |
bugs@xxxxxxxxxxx |
<URL: http://bugs.freeciv.org/Ticket/Display.html?id=16459 >
1. Load savegame with username not in savegame. Try to 'take' your own
connection.
2. As in 1, but try to 'observe' your own connection.
3. As in 1, but the 'take' button in the 'taskbar' of the conndlg says
'Take player' although no player is selected, and executes 'take -' on the
server (meaning detach).
4. As in 3, but 'take' button also does nothing if a player is selected.
5. You cannot aitoggle, observe or take a player in the conndlg if the
player name contains spaces. Solution: Quote the name. Which turned out to
be harder than I thought. Nevertheless, patch for this one attached.
- Per
Index: utility/support.c
===================================================================
--- utility/support.c (revision 11842)
+++ utility/support.c (working copy)
@@ -133,7 +133,28 @@
#endif
}
+/***************************************************************
+ Compare strings like strncasecmp() but ignoring quotes in
+ either string. Quotes still count towards n.
+***************************************************************/
+int mystrncasequotecmp(const char *str0, const char *str1, size_t n)
+{
+ size_t i;
+ char c;
+ for (i = 0; i < n && *str0 != '\0'; i++) {
+ if (my_tolower(*str0) != my_tolower(*str1)
+ && *str0 != '"' && *str1 != '"') {
+ return ((int) (unsigned char) my_tolower(*str0))
+ - ((int) (unsigned char) my_tolower(*str1));
+ }
+ c = *str0;
+ str0 += (*str1 != '"');
+ str1 += (c != '"');
+ }
+ return 0;
+}
+
/***************************************************************
Return a string which describes a given error (errno-style.)
***************************************************************/
Index: utility/support.h
===================================================================
--- utility/support.h (revision 11842)
+++ utility/support.h (working copy)
@@ -75,6 +75,7 @@
int mystrcasecmp(const char *str0, const char *str1);
int mystrncasecmp(const char *str0, const char *str1, size_t n);
+int mystrncasequotecmp(const char *str0, const char *str1, size_t n);
const char *mystrerror(void);
void myusleep(unsigned long usec);
Index: common/player.c
===================================================================
--- common/player.c (revision 11842)
+++ common/player.c (working copy)
@@ -292,7 +292,7 @@
int ind;
*result = match_prefix(pname_accessor, game.info.nplayers, MAX_LEN_NAME-1,
- mystrncasecmp, name, &ind);
+ mystrncasequotecmp, name, &ind);
if (*result < M_PRE_AMBIGUOUS) {
return get_player(ind);
Index: client/gui-gtk-2.0/pages.c
===================================================================
--- client/gui-gtk-2.0/pages.c (revision 11842)
+++ client/gui-gtk-2.0/pages.c (working copy)
@@ -1066,9 +1066,8 @@
char buf[1024];
char *command = data;
- /* FIXME: We should use quotes here, but because of a bug in the server
- * it doesn't parse the quotes properly for some commands (e.g. "hard")! */
- my_snprintf(buf, sizeof(buf), "/%s %s", command, conn_menu_player->name);
+ my_snprintf(buf, sizeof(buf), "/%s \"%s\"", command,
+ conn_menu_player->name);
send_chat(buf);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Freeciv-Dev] (PR#16459) Lots of conndlg errors,
Per I. Mathisen <=
|
|