[Freeciv-commits] r30580 - /branches/S2_6/gen_headers/freeciv_config.h.in

2015-11-12 Thread cazfi74
Author: cazfi
Date: Thu Nov 12 22:55:00 2015
New Revision: 30580

URL: http://svn.gna.org/viewcvs/freeciv?rev=30580=rev
Log:
Make FREECIV_WEB public in freeciv_config.h

See patch #6559

Modified:
branches/S2_6/gen_headers/freeciv_config.h.in

Modified: branches/S2_6/gen_headers/freeciv_config.h.in
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/gen_headers/freeciv_config.h.in?rev=30580=30579=30580=diff
==
--- branches/S2_6/gen_headers/freeciv_config.h.in   (original)
+++ branches/S2_6/gen_headers/freeciv_config.h.in   Thu Nov 12 22:55:00 2015
@@ -19,6 +19,9 @@
 
 #ifndef FC__FREECIV_CONFIG_H
 #define FC__FREECIV_CONFIG_H
+
+/* Is this freeciv-web instead of regular build */
+#undef FREECIV_WEB
 
 /* Metaserver URL */
 #undef FREECIV_META_URL


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30579 - /trunk/gen_headers/freeciv_config.h.in

2015-11-12 Thread cazfi74
Author: cazfi
Date: Thu Nov 12 22:54:45 2015
New Revision: 30579

URL: http://svn.gna.org/viewcvs/freeciv?rev=30579=rev
Log:
Make FREECIV_WEB public in freeciv_config.h

See patch #6559

Modified:
trunk/gen_headers/freeciv_config.h.in

Modified: trunk/gen_headers/freeciv_config.h.in
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/gen_headers/freeciv_config.h.in?rev=30579=30578=30579=diff
==
--- trunk/gen_headers/freeciv_config.h.in   (original)
+++ trunk/gen_headers/freeciv_config.h.in   Thu Nov 12 22:54:45 2015
@@ -19,6 +19,9 @@
 
 #ifndef FC__FREECIV_CONFIG_H
 #define FC__FREECIV_CONFIG_H
+
+/* Is this freeciv-web instead of regular build */
+#undef FREECIV_WEB
 
 /* Metaserver URL */
 #undef FREECIV_META_URL


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30576 - /trunk/server/savegame.c

2015-11-12 Thread cazfi74
Author: cazfi
Date: Thu Nov 12 22:34:43 2015
New Revision: 30576

URL: http://svn.gna.org/viewcvs/freeciv?rev=30576=rev
Log:
Do not refresh cities during savegame.c savegame loading when tradepartner has 
not necessarily been loaded yet.

See bug #23614

Modified:
trunk/server/savegame.c

Modified: trunk/server/savegame.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/savegame.c?rev=30576=30575=30576=diff
==
--- trunk/server/savegame.c (original)
+++ trunk/server/savegame.c Thu Nov 12 22:34:43 2015
@@ -2636,15 +2636,7 @@
 vision_reveal_tiles(pcity->server.vision, game.server.vision_reveal_tiles);
 city_refresh_vision(pcity);
 
-/* Refresh the city. This also checks the squared city radius. Thus, it
- * must be after improvements, as the effect City_Radius_SQ could be
- * influenced by improvements; and after the vision is defined, as the
- * function calls city_refresh_vision(). */
-city_refresh(pcity);
-
 city_list_append(plr->cities, pcity);
-
-CALL_PLR_AI_FUNC(city_got, plr, plr, pcity);
   }
 }
 
@@ -4103,9 +4095,12 @@
 /* Update all city information.  This must come after all cities are
  * loaded (in player_load) but before player (dumb) cities are loaded
  * in player_load_vision(). */
-cities_iterate(pcity) {
-  city_refresh_from_main_map(pcity, NULL);
-} cities_iterate_end;
+players_iterate(plr) {
+  city_list_iterate(plr->cities, pcity) {
+city_refresh(pcity);
+CALL_PLR_AI_FUNC(city_got, plr, plr, pcity);
+  } city_list_iterate_end;
+} players_iterate_end;
 
 /* Since the cities must be placed on the map to put them on the
player map we do this afterwards */


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30578 - /branches/S2_5/server/savegame.c

2015-11-12 Thread cazfi74
Author: cazfi
Date: Thu Nov 12 22:34:58 2015
New Revision: 30578

URL: http://svn.gna.org/viewcvs/freeciv?rev=30578=rev
Log:
Do not refresh cities during savegame.c savegame loading when tradepartner has 
not necessarily been loaded yet.

See bug #23614

Modified:
branches/S2_5/server/savegame.c

Modified: branches/S2_5/server/savegame.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/server/savegame.c?rev=30578=30577=30578=diff
==
--- branches/S2_5/server/savegame.c (original)
+++ branches/S2_5/server/savegame.c Thu Nov 12 22:34:58 2015
@@ -2902,12 +2902,6 @@
 vision_reveal_tiles(pcity->server.vision, game.server.vision_reveal_tiles);
 city_refresh_vision(pcity);
 
-/* Refresh the city. This also checks the squared city radius. Thus, it
- * must be after improvements, as the effect City_Radius_SQ could be
- * influenced by improvements; and after the vision is defined, as the
- * function calls city_refresh_vision(). */
-city_refresh(pcity);
-
 city_list_append(plr->cities, pcity);
   }
 }
@@ -4345,7 +4339,7 @@
  * loaded (in player_load) but before player (dumb) cities are loaded
  * in player_load_vision(). */
 cities_iterate(pcity) {
-  city_refresh_from_main_map(pcity, NULL);
+  city_refresh(pcity);
 } cities_iterate_end;
 
 /* Since the cities must be placed on the map to put them on the


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30577 - /branches/S2_6/server/savegame.c

2015-11-12 Thread cazfi74
Author: cazfi
Date: Thu Nov 12 22:34:52 2015
New Revision: 30577

URL: http://svn.gna.org/viewcvs/freeciv?rev=30577=rev
Log:
Do not refresh cities during savegame.c savegame loading when tradepartner has 
not necessarily been loaded yet.

See bug #23614

Modified:
branches/S2_6/server/savegame.c

Modified: branches/S2_6/server/savegame.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/server/savegame.c?rev=30577=30576=30577=diff
==
--- branches/S2_6/server/savegame.c (original)
+++ branches/S2_6/server/savegame.c Thu Nov 12 22:34:52 2015
@@ -2617,15 +2617,7 @@
 vision_reveal_tiles(pcity->server.vision, game.server.vision_reveal_tiles);
 city_refresh_vision(pcity);
 
-/* Refresh the city. This also checks the squared city radius. Thus, it
- * must be after improvements, as the effect City_Radius_SQ could be
- * influenced by improvements; and after the vision is defined, as the
- * function calls city_refresh_vision(). */
-city_refresh(pcity);
-
 city_list_append(plr->cities, pcity);
-
-CALL_PLR_AI_FUNC(city_got, plr, plr, pcity);
   }
 }
 
@@ -4078,9 +4070,12 @@
 /* Update all city information.  This must come after all cities are
  * loaded (in player_load) but before player (dumb) cities are loaded
  * in player_load_vision(). */
-cities_iterate(pcity) {
-  city_refresh_from_main_map(pcity, NULL);
-} cities_iterate_end;
+players_iterate(plr) {
+  city_list_iterate(plr->cities, pcity) {
+city_refresh(pcity);
+CALL_PLR_AI_FUNC(city_got, plr, plr, pcity);
+  } city_list_iterate_end;
+} players_iterate_end;
 
 /* Since the cities must be placed on the map to put them on the
player map we do this afterwards */


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30581 - in /trunk/client/gui-gtk-3.0: gui_main.c gui_main.h themes.c

2015-11-12 Thread cazfi74
Author: cazfi
Date: Thu Nov 12 23:09:53 2015
New Revision: 30581

URL: http://svn.gna.org/viewcvs/freeciv?rev=30581=rev
Log:
Converted last of the gui_options.gui_gtk3_ accesses to use wrapper macros

See patch #6566

Modified:
trunk/client/gui-gtk-3.0/gui_main.c
trunk/client/gui-gtk-3.0/gui_main.h
trunk/client/gui-gtk-3.0/themes.c

Modified: trunk/client/gui-gtk-3.0/gui_main.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/gui_main.c?rev=30581=30580=30581=diff
==
--- trunk/client/gui-gtk-3.0/gui_main.c (original)
+++ trunk/client/gui-gtk-3.0/gui_main.c Thu Nov 12 23:09:53 2015
@@ -1439,7 +1439,7 @@
 }
 gtk_container_add(GTK_CONTAINER(avbox), vgrid);
 
-if (gui_options.gui_gtk3_small_display_layout) {
+if (GUI_GTK_OPTION(small_display_layout)) {
   hpaned = gtk_paned_new(GTK_ORIENTATION_VERTICAL);
 } else {
   hpaned = gtk_paned_new(GTK_ORIENTATION_HORIZONTAL);

Modified: trunk/client/gui-gtk-3.0/gui_main.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/gui_main.h?rev=30581=30580=30581=diff
==
--- trunk/client/gui-gtk-3.0/gui_main.h (original)
+++ trunk/client/gui-gtk-3.0/gui_main.h Thu Nov 12 23:09:53 2015
@@ -23,6 +23,7 @@
 
 #define GUI_GTK_OPTION(optname) gui_options.gui_gtk3_##optname
 #define GUI_GTK_OPTION_STR(optname) "gui_gtk3_" #optname
+#define GUI_GTK_DEFAULT_THEME_NAME FC_GTK3_DEFAULT_THEME_NAME
 
 /* network string charset conversion */
 gchar *ntoh_str(const gchar *netstr);

Modified: trunk/client/gui-gtk-3.0/themes.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/themes.c?rev=30581=30580=30581=diff
==
--- trunk/client/gui-gtk-3.0/themes.c   (original)
+++ trunk/client/gui-gtk-3.0/themes.c   Thu Nov 12 23:09:53 2015
@@ -65,16 +65,16 @@
   bool theme_loaded;
 
   /* try to load user defined theme */
-  theme_loaded = load_theme(gui_options.gui_gtk3_default_theme_name);
+  theme_loaded = load_theme(GUI_GTK_OPTION(default_theme_name));
 
   /* no user defined theme loaded -> try to load Freeciv default theme */
   if (!theme_loaded) {
-theme_loaded = load_theme(FC_GTK3_DEFAULT_THEME_NAME);
+theme_loaded = load_theme(GUI_GTK_DEFAULT_THEME_NAME);
 if (theme_loaded) {
-  sz_strlcpy(gui_options.gui_gtk3_default_theme_name, 
FC_GTK3_DEFAULT_THEME_NAME);
+  sz_strlcpy(GUI_GTK_OPTION(default_theme_name), 
GUI_GTK_DEFAULT_THEME_NAME);
 }
   }
-
+
   /* still no theme loaded -> load system default theme */
   if (!theme_loaded) {
 gtk_style_context_add_provider_for_screen(


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30584 - /trunk/win32/installer/Makefile

2015-11-12 Thread cazfi74
Author: cazfi
Date: Thu Nov 12 23:39:40 2015
New Revision: 30584

URL: http://svn.gna.org/viewcvs/freeciv?rev=30584=rev
Log:
Fixed win32/installer 'make clean' removal of freeciv-ruledit package.

See bug #24062

Modified:
trunk/win32/installer/Makefile

Modified: trunk/win32/installer/Makefile
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/win32/installer/Makefile?rev=30584=30583=30584=diff
==
--- trunk/win32/installer/Makefile  (original)
+++ trunk/win32/installer/Makefile  Thu Nov 12 23:39:40 2015
@@ -298,7 +298,7 @@
rm -f Freeciv-*-$(GUI).nsi
 
 clean-installer-ruledit:
-   rm -f Output/Freeciv-*-ruledit-setup.exe
+   rm -f Output/Freeciv-ruledit-*-setup.exe
rm -f Freeciv-*-ruledit.nsi
 
 clean:


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30585 - /branches/S2_6/win32/installer/Makefile

2015-11-12 Thread cazfi74
Author: cazfi
Date: Thu Nov 12 23:39:48 2015
New Revision: 30585

URL: http://svn.gna.org/viewcvs/freeciv?rev=30585=rev
Log:
Fixed win32/installer 'make clean' removal of freeciv-ruledit package.

See bug #24062

Modified:
branches/S2_6/win32/installer/Makefile

Modified: branches/S2_6/win32/installer/Makefile
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/win32/installer/Makefile?rev=30585=30584=30585=diff
==
--- branches/S2_6/win32/installer/Makefile  (original)
+++ branches/S2_6/win32/installer/Makefile  Thu Nov 12 23:39:48 2015
@@ -298,7 +298,7 @@
rm -f Freeciv-*-$(GUI).nsi
 
 clean-installer-ruledit:
-   rm -f Output/Freeciv-*-ruledit-setup.exe
+   rm -f Output/Freeciv-ruledit-*-setup.exe
rm -f Freeciv-*-ruledit.nsi
 
 clean:


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30583 - /branches/S2_6/client/gui-sdl2/graphics.h

2015-11-12 Thread cazfi74
Author: cazfi
Date: Thu Nov 12 23:37:04 2015
New Revision: 30583

URL: http://svn.gna.org/viewcvs/freeciv?rev=30583=rev
Log:
Remove include of unused SDL2_gfxPrimitives.h

See patch #6565

Modified:
branches/S2_6/client/gui-sdl2/graphics.h

Modified: branches/S2_6/client/gui-sdl2/graphics.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-sdl2/graphics.h?rev=30583=30582=30583=diff
==
--- branches/S2_6/client/gui-sdl2/graphics.h(original)
+++ branches/S2_6/client/gui-sdl2/graphics.hThu Nov 12 23:37:04 2015
@@ -25,7 +25,6 @@
 #define FC__GRAPHICS_H
 
 /* SDL */
-#include 
 #include 
 
 /* client */


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30582 - /trunk/client/gui-sdl2/graphics.h

2015-11-12 Thread cazfi74
Author: cazfi
Date: Thu Nov 12 23:36:58 2015
New Revision: 30582

URL: http://svn.gna.org/viewcvs/freeciv?rev=30582=rev
Log:
Remove include of unused SDL2_gfxPrimitives.h

See patch #6565

Modified:
trunk/client/gui-sdl2/graphics.h

Modified: trunk/client/gui-sdl2/graphics.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/graphics.h?rev=30582=30581=30582=diff
==
--- trunk/client/gui-sdl2/graphics.h(original)
+++ trunk/client/gui-sdl2/graphics.hThu Nov 12 23:36:58 2015
@@ -25,7 +25,6 @@
 #define FC__GRAPHICS_H
 
 /* SDL */
-#include 
 #include 
 
 /* client */


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30566 - /branches/S2_6/client/gui-qt/chatline.cpp

2015-11-12 Thread mlewczuk80
Author: mir3x
Date: Thu Nov 12 12:31:19 2015
New Revision: 30566

URL: http://svn.gna.org/viewcvs/freeciv?rev=30566=rev
Log:
Replaced chars* with QStrings in chat widget. 

See patch #6562


Modified:
branches/S2_6/client/gui-qt/chatline.cpp

Modified: branches/S2_6/client/gui-qt/chatline.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/chatline.cpp?rev=30566=30565=30566=diff
==
--- branches/S2_6/client/gui-qt/chatline.cpp(original)
+++ branches/S2_6/client/gui-qt/chatline.cppThu Nov 12 12:31:19 2015
@@ -32,7 +32,7 @@
 
 #include "chatline.h"
 
-static bool is_plain_public_message(const char *s);
+static bool is_plain_public_message(QString s);
 static QString replace_html(QString str);
 /***
   Constructor for chatwdg
@@ -181,20 +181,14 @@
 ***/
 void chatwdg::send()
 {
-  char *theinput;
-  char buf[MAX_LEN_MSG];
-
-  theinput = chat_line->text().toUtf8().data();
   gui()->chat_history.prepend(chat_line->text());
-  if (*theinput) {
-if (client_state() == C_S_RUNNING
-&& gui_options.gui_qt_allied_chat_only
-&& is_plain_public_message(theinput)) {
-  fc_snprintf(buf, sizeof(buf), ". %s", theinput);
-  send_chat(buf);
+  if (chat_line->text() != "") {
+if (client_state() >= C_S_RUNNING && gui_options.gui_qt_allied_chat_only
+&& is_plain_public_message(chat_line->text())) {
+  send_chat(QString(". %s")
+  .arg(chat_line->text().toUtf8().data()).toUtf8().data());
 } else {
-  fc_snprintf(buf, sizeof(buf), "%s", theinput);
-  send_chat(buf);
+  send_chat(chat_line->text().toUtf8().data());
 }
   }
   chat_line->clear();
@@ -446,32 +440,19 @@
   Helper function to determine if a given client input line is intended as
   a "plain" public message.
 **/
-static bool is_plain_public_message(const char *s)
+static bool is_plain_public_message(QString s)
 {
   const char ALLIES_CHAT_PREFIX = '.';
   const char SERVER_COMMAND_PREFIX = '/';
-  const char MESSAGE_PREFIX = ':';
-  const char *p;
-
-  if (s[0] == SERVER_COMMAND_PREFIX || s[0] == ALLIES_CHAT_PREFIX) {
-return FALSE;
-  }
-
-  if (s[0] == '\'' || s[0] == '"') {
-p = strchr(s + 1, s[0]);
-  } else {
-p = s;
-  }
-
-  while (p != NULL && *p != '\0') {
-if (fc_isspace(*p)) {
-  return TRUE;
-} else if (*p == MESSAGE_PREFIX) {
-  return FALSE;
-}
-p++;
-  }
-  return TRUE;
+  QString str;
+
+  str = s.trimmed();
+  if (str.at(0) == SERVER_COMMAND_PREFIX
+  || str.at(0) == ALLIES_CHAT_PREFIX) {
+return false;
+  }
+
+  return true;
 }
 
 /**


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30567 - /trunk/client/gui-qt/chatline.cpp

2015-11-12 Thread mlewczuk80
Author: mir3x
Date: Thu Nov 12 12:31:27 2015
New Revision: 30567

URL: http://svn.gna.org/viewcvs/freeciv?rev=30567=rev
Log:
Replaced chars* with QStrings in chat widget. 

See patch #6562


Modified:
trunk/client/gui-qt/chatline.cpp

Modified: trunk/client/gui-qt/chatline.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/chatline.cpp?rev=30567=30566=30567=diff
==
--- trunk/client/gui-qt/chatline.cpp(original)
+++ trunk/client/gui-qt/chatline.cppThu Nov 12 12:31:27 2015
@@ -32,7 +32,7 @@
 
 #include "chatline.h"
 
-static bool is_plain_public_message(const char *s);
+static bool is_plain_public_message(QString s);
 static QString replace_html(QString str);
 /***
   Constructor for chatwdg
@@ -181,20 +181,14 @@
 ***/
 void chatwdg::send()
 {
-  char *theinput;
-  char buf[MAX_LEN_MSG];
-
-  theinput = chat_line->text().toUtf8().data();
   gui()->chat_history.prepend(chat_line->text());
-  if (*theinput) {
-if (client_state() == C_S_RUNNING
-&& gui_options.gui_qt_allied_chat_only
-&& is_plain_public_message(theinput)) {
-  fc_snprintf(buf, sizeof(buf), ". %s", theinput);
-  send_chat(buf);
+  if (chat_line->text() != "") {
+if (client_state() >= C_S_RUNNING && gui_options.gui_qt_allied_chat_only
+&& is_plain_public_message(chat_line->text())) {
+  send_chat(QString(". %s")
+  .arg(chat_line->text().toUtf8().data()).toUtf8().data());
 } else {
-  fc_snprintf(buf, sizeof(buf), "%s", theinput);
-  send_chat(buf);
+  send_chat(chat_line->text().toUtf8().data());
 }
   }
   chat_line->clear();
@@ -446,32 +440,19 @@
   Helper function to determine if a given client input line is intended as
   a "plain" public message.
 **/
-static bool is_plain_public_message(const char *s)
+static bool is_plain_public_message(QString s)
 {
   const char ALLIES_CHAT_PREFIX = '.';
   const char SERVER_COMMAND_PREFIX = '/';
-  const char MESSAGE_PREFIX = ':';
-  const char *p;
-
-  if (s[0] == SERVER_COMMAND_PREFIX || s[0] == ALLIES_CHAT_PREFIX) {
-return FALSE;
-  }
-
-  if (s[0] == '\'' || s[0] == '"') {
-p = strchr(s + 1, s[0]);
-  } else {
-p = s;
-  }
-
-  while (p != NULL && *p != '\0') {
-if (fc_isspace(*p)) {
-  return TRUE;
-} else if (*p == MESSAGE_PREFIX) {
-  return FALSE;
-}
-p++;
-  }
-  return TRUE;
+  QString str;
+
+  str = s.trimmed();
+  if (str.at(0) == SERVER_COMMAND_PREFIX
+  || str.at(0) == ALLIES_CHAT_PREFIX) {
+return false;
+  }
+
+  return true;
 }
 
 /**


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30556 - /branches/S2_5/client/gui-qt/mapview.cpp

2015-11-12 Thread mlewczuk80
Author: mir3x
Date: Thu Nov 12 12:19:27 2015
New Revision: 30556

URL: http://svn.gna.org/viewcvs/freeciv?rev=30556=rev
Log:
Fixed bug when connecting to game which ended - map was not shown.

See bug #24045


Modified:
branches/S2_5/client/gui-qt/mapview.cpp

Modified: branches/S2_5/client/gui-qt/mapview.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/mapview.cpp?rev=30556=30555=30556=diff
==
--- branches/S2_5/client/gui-qt/mapview.cpp (original)
+++ branches/S2_5/client/gui-qt/mapview.cpp Thu Nov 12 12:19:27 2015
@@ -285,7 +285,7 @@
 
   size = event->size();
 
-  if (C_S_RUNNING == client_state()) {
+  if (C_S_RUNNING <= client_state()) {
 map_canvas_resized(size.width(), size.height());
 gui()->infotab->resize(size.width() / 2, size.height() / 3);
 gui()->infotab->move(0 , size.height() - gui()->infotab->height());
@@ -685,7 +685,7 @@
   QSize size;
   size = event->size();
 
-  if (C_S_RUNNING == client_state()) {
+  if (C_S_RUNNING <= client_state()) {
 w_ratio = static_cast(width()) / overview.width;
 h_ratio = static_cast(height()) / overview.height;
   }


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30560 - /branches/S2_6/client/gui-qt/menu.cpp

2015-11-12 Thread mlewczuk80
Author: mir3x
Date: Thu Nov 12 12:23:55 2015
New Revision: 30560

URL: http://svn.gna.org/viewcvs/freeciv?rev=30560=rev
Log:
Fixed wrong focus when selecting multiple units in qt-client.

See bug #24055


Modified:
branches/S2_6/client/gui-qt/menu.cpp

Modified: branches/S2_6/client/gui-qt/menu.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/menu.cpp?rev=30560=30559=30560=diff
==
--- branches/S2_6/client/gui-qt/menu.cpp(original)
+++ branches/S2_6/client/gui-qt/menu.cppThu Nov 12 12:23:55 2015
@@ -348,7 +348,6 @@
 return;
   }
   pplayer = unit_owner(punit_first);
-  unit_focus_remove(punit_first);
   unit_list_iterate(punits, punit) {
 if (seltype == SELTYPE_SAME) {
   types.append(unit_type_get(punit));


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30561 - /trunk/client/gui-qt/menu.cpp

2015-11-12 Thread mlewczuk80
Author: mir3x
Date: Thu Nov 12 12:24:07 2015
New Revision: 30561

URL: http://svn.gna.org/viewcvs/freeciv?rev=30561=rev
Log:
Fixed wrong focus when selecting multiple units in qt-client.

See bug #24055


Modified:
trunk/client/gui-qt/menu.cpp

Modified: trunk/client/gui-qt/menu.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=30561=30560=30561=diff
==
--- trunk/client/gui-qt/menu.cpp(original)
+++ trunk/client/gui-qt/menu.cppThu Nov 12 12:24:07 2015
@@ -507,7 +507,6 @@
 return;
   }
   pplayer = unit_owner(punit_first);
-  unit_focus_remove(punit_first);
   unit_list_iterate(punits, punit) {
 if (seltype == SELTYPE_SAME) {
   types.append(unit_type_get(punit));


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30559 - /branches/S2_5/client/gui-qt/menu.cpp

2015-11-12 Thread mlewczuk80
Author: mir3x
Date: Thu Nov 12 12:23:42 2015
New Revision: 30559

URL: http://svn.gna.org/viewcvs/freeciv?rev=30559=rev
Log:
Fixed wrong focus when selecting multiple units in qt-client.

See bug #24055


Modified:
branches/S2_5/client/gui-qt/menu.cpp

Modified: branches/S2_5/client/gui-qt/menu.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.cpp?rev=30559=30558=30559=diff
==
--- branches/S2_5/client/gui-qt/menu.cpp(original)
+++ branches/S2_5/client/gui-qt/menu.cppThu Nov 12 12:23:42 2015
@@ -346,7 +346,6 @@
 return;
   }
   pplayer = unit_owner(punit_first);
-  unit_focus_remove(punit_first);
   unit_list_iterate(punits, punit) {
 if (seltype == SELTYPE_SAME) {
   types.append(unit_type(punit));


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30558 - /trunk/client/gui-qt/mapview.cpp

2015-11-12 Thread mlewczuk80
Author: mir3x
Date: Thu Nov 12 12:20:07 2015
New Revision: 30558

URL: http://svn.gna.org/viewcvs/freeciv?rev=30558=rev
Log:
Fixed bug when connecting to game which ended - map was not shown.

See bug #24045


Modified:
trunk/client/gui-qt/mapview.cpp

Modified: trunk/client/gui-qt/mapview.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/mapview.cpp?rev=30558=30557=30558=diff
==
--- trunk/client/gui-qt/mapview.cpp (original)
+++ trunk/client/gui-qt/mapview.cpp Thu Nov 12 12:20:07 2015
@@ -286,7 +286,7 @@
 
   size = event->size();
 
-  if (C_S_RUNNING == client_state()) {
+  if (C_S_RUNNING <= client_state()) {
 map_canvas_resized(size.width(), size.height());
 gui()->infotab->resize(size.width() / 2, size.height() / 3);
 gui()->infotab->move(0 , size.height() - gui()->infotab->height());
@@ -690,7 +690,7 @@
   QSize size;
   size = event->size();
 
-  if (C_S_RUNNING == client_state()) {
+  if (C_S_RUNNING <= client_state()) {
 w_ratio = static_cast(width()) / gui_options.overview.width;
 h_ratio = static_cast(height()) / gui_options.overview.height;
   }


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30562 - in /branches/S2_5/client/gui-qt: citydlg.cpp citydlg.h optiondlg.cpp optiondlg.h

2015-11-12 Thread mlewczuk80
Author: mir3x
Date: Thu Nov 12 12:28:38 2015
New Revision: 30562

URL: http://svn.gna.org/viewcvs/freeciv?rev=30562=rev
Log:
Added tooltips for chosen item in production widget in city dialog in qt-client.

See patch #6555


Modified:
branches/S2_5/client/gui-qt/citydlg.cpp
branches/S2_5/client/gui-qt/citydlg.h
branches/S2_5/client/gui-qt/optiondlg.cpp
branches/S2_5/client/gui-qt/optiondlg.h

Modified: branches/S2_5/client/gui-qt/citydlg.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/citydlg.cpp?rev=30562=30561=30562=diff
==
--- branches/S2_5/client/gui-qt/citydlg.cpp (original)
+++ branches/S2_5/client/gui-qt/citydlg.cpp Thu Nov 12 12:28:38 2015
@@ -33,7 +33,9 @@
 #include "climisc.h"
 #include "control.h"
 #include "global_worklist.h"
+#include "helpdata.h"
 #include "mapview_common.h"
+#include "movement.h"
 #include "sprite.h"
 #include "text.h"
 #include "tilespec.h"
@@ -56,6 +58,7 @@
* once per client
*/
 static city_dialog *city_dlg;
+extern QString split_text(QString text);
 
 /
   Draws X on pixmap pointing its useless
@@ -2581,6 +2584,96 @@
   return false;
 }
 
+/**
+  Event filter for catching tooltip events
+**/
+bool fc_tooltip::eventFilter(QObject *obj, QEvent *ev)
+{
+  QHelpEvent *help_event;
+  QString item_tooltip;
+  QRect rect;
+
+  if (ev->type() == QEvent::ToolTip) {
+QAbstractItemView *view = qobject_cast(obj->parent());
+if (!view) {
+  return false;
+}
+
+help_event = static_cast(ev);
+QPoint pos = help_event->pos();
+QModelIndex index = view->indexAt(pos);
+if (!index.isValid()) {
+  return false;
+}
+item_tooltip = view->model()->data(index, Qt::ToolTipRole).toString();
+rect = view->visualRect(index);
+
+if (!item_tooltip.isEmpty()) {
+  QToolTip::showText(help_event->globalPos(), item_tooltip, view, rect);
+} else {
+  QToolTip::hideText();
+}
+return true;
+  }
+  return false;
+}
+
+/**
+  Returns shortened help for given universal ( stored in qvar )
+**/
+QString get_tooltip(QVariant qvar)
+{
+  QString str, def_str, ret_str;
+  QStringList sl;
+  char buffer[8192];
+  char buf2[1];
+
+  buf2[0] = '\0';
+  struct universal *target;
+  target = reinterpret_cast(qvar.value());
+  if (target == NULL) {
+  } else if (VUT_UTYPE == target->kind) {
+def_str = QString(N_("Attack: %1, Defense: %2, Move: %3\n"))
+  .arg(target->value.utype->attack_strength)
+  .arg(target->value.utype->defense_strength)
+  .arg(QString(move_points_text(target->value.utype->move_rate, 
TRUE)));
+def_str += QString(N_("Cost: %1, Basic Upkeep: %2\n"))
+   .arg(utype_build_shield_cost(target->value.utype))
+   .arg(helptext_unit_upkeep_str(target->value.utype));
+def_str += QString(N_("Hitpoints: %1, FirePower: %2, Vision: %3\n\n"))
+   .arg(target->value.utype->hp)
+   .arg(target->value.utype->firepower)
+   .arg((int)sqrt((double)target->value.utype->vision_radius_sq));
+str = helptext_unit(buffer, sizeof(buffer), client.conn.playing,
+buf2, target->value.utype);
+  } else {
+if (!improvement_has_flag(target->value.building, IF_GOLD)) {
+  def_str = QString(N_("Cost: %1, Upkeep: %2\n\n"))
+.arg(impr_build_shield_cost(target->value.building))
+.arg(target->value.building->upkeep);
+}
+str = helptext_building(buffer, sizeof(buffer), client.conn.playing,
+NULL, target->value.building);
+  }
+
+  /* Remove all lines from help which has '*' in first 3 chars */
+  sl = str.split('\n');
+  foreach (const QString & s, sl) {
+if (s.count() > 2) {
+  if (s.at(0) != '*' && s.at(1) != '*' && s.at(2) != '*') {
+ret_str = ret_str + s + '\n';
+  }
+} else {
+  ret_str = ret_str + s + '\n';
+}
+  }
+
+  ret_str = split_text(ret_str);
+  ret_str = ret_str.trimmed();
+  ret_str = def_str + ret_str;
+
+  return ret_str;
+}
 
 /***
   City item delegate constructor
@@ -2799,8 +2892,13 @@
   if (!index.isValid()) return QVariant();
   if (index.row() >= 0 && index.row() < rowCount() && index.column() >= 0
   && index.column() < columnCount()
-  && (index.column() + index.row() * 3 < city_target_list.count()))
+  && (index.column() + index.row() * 3 < 

[Freeciv-commits] r30563 - in /branches/S2_6/client/gui-qt: citydlg.cpp citydlg.h optiondlg.cpp optiondlg.h

2015-11-12 Thread mlewczuk80
Author: mir3x
Date: Thu Nov 12 12:28:52 2015
New Revision: 30563

URL: http://svn.gna.org/viewcvs/freeciv?rev=30563=rev
Log:
Added tooltips for chosen item in production widget in city dialog in qt-client.

See patch #6555


Modified:
branches/S2_6/client/gui-qt/citydlg.cpp
branches/S2_6/client/gui-qt/citydlg.h
branches/S2_6/client/gui-qt/optiondlg.cpp
branches/S2_6/client/gui-qt/optiondlg.h

Modified: branches/S2_6/client/gui-qt/citydlg.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/citydlg.cpp?rev=30563=30562=30563=diff
==
--- branches/S2_6/client/gui-qt/citydlg.cpp (original)
+++ branches/S2_6/client/gui-qt/citydlg.cpp Thu Nov 12 12:28:52 2015
@@ -33,7 +33,9 @@
 #include "climisc.h"
 #include "control.h"
 #include "global_worklist.h"
+#include "helpdata.h"
 #include "mapview_common.h"
+#include "movement.h"
 #include "sprite.h"
 #include "text.h"
 #include "tilespec.h"
@@ -56,6 +58,7 @@
* once per client
*/
 static city_dialog *city_dlg;
+extern QString split_text(QString text);
 
 /
   Draws X on pixmap pointing its useless
@@ -2586,6 +2589,96 @@
   return false;
 }
 
+/**
+  Event filter for catching tooltip events
+**/
+bool fc_tooltip::eventFilter(QObject *obj, QEvent *ev)
+{
+  QHelpEvent *help_event;
+  QString item_tooltip;
+  QRect rect;
+
+  if (ev->type() == QEvent::ToolTip) {
+QAbstractItemView *view = qobject_cast(obj->parent());
+if (!view) {
+  return false;
+}
+
+help_event = static_cast(ev);
+QPoint pos = help_event->pos();
+QModelIndex index = view->indexAt(pos);
+if (!index.isValid()) {
+  return false;
+}
+item_tooltip = view->model()->data(index, Qt::ToolTipRole).toString();
+rect = view->visualRect(index);
+
+if (!item_tooltip.isEmpty()) {
+  QToolTip::showText(help_event->globalPos(), item_tooltip, view, rect);
+} else {
+  QToolTip::hideText();
+}
+return true;
+  }
+  return false;
+}
+
+/**
+  Returns shortened help for given universal ( stored in qvar )
+**/
+QString get_tooltip(QVariant qvar)
+{
+  QString str, def_str, ret_str;
+  QStringList sl;
+  char buffer[8192];
+  char buf2[1];
+
+  buf2[0] = '\0';
+  struct universal *target;
+  target = reinterpret_cast(qvar.value());
+  if (target == NULL) {
+  } else if (VUT_UTYPE == target->kind) {
+def_str = QString(N_("Attack: %1, Defense: %2, Move: %3\n"))
+  .arg(target->value.utype->attack_strength)
+  .arg(target->value.utype->defense_strength)
+  .arg(QString(move_points_text(target->value.utype->move_rate, 
TRUE)));
+def_str += QString(N_("Cost: %1, Basic Upkeep: %2\n"))
+   .arg(utype_build_shield_cost(target->value.utype))
+   .arg(helptext_unit_upkeep_str(target->value.utype));
+def_str += QString(N_("Hitpoints: %1, FirePower: %2, Vision: %3\n\n"))
+   .arg(target->value.utype->hp)
+   .arg(target->value.utype->firepower)
+   .arg((int)sqrt((double)target->value.utype->vision_radius_sq));
+str = helptext_unit(buffer, sizeof(buffer), client.conn.playing,
+buf2, target->value.utype);
+  } else {
+if (!improvement_has_flag(target->value.building, IF_GOLD)) {
+  def_str = QString(N_("Cost: %1, Upkeep: %2\n\n"))
+.arg(impr_build_shield_cost(target->value.building))
+.arg(target->value.building->upkeep);
+}
+str = helptext_building(buffer, sizeof(buffer), client.conn.playing,
+NULL, target->value.building);
+  }
+
+  /* Remove all lines from help which has '*' in first 3 chars */
+  sl = str.split('\n');
+  foreach (const QString & s, sl) {
+if (s.count() > 2) {
+  if (s.at(0) != '*' && s.at(1) != '*' && s.at(2) != '*') {
+ret_str = ret_str + s + '\n';
+  }
+} else {
+  ret_str = ret_str + s + '\n';
+}
+  }
+
+  ret_str = split_text(ret_str);
+  ret_str = ret_str.trimmed();
+  ret_str = def_str + ret_str;
+
+  return ret_str;
+}
 
 /***
   City item delegate constructor
@@ -2804,8 +2897,13 @@
   if (!index.isValid()) return QVariant();
   if (index.row() >= 0 && index.row() < rowCount() && index.column() >= 0
   && index.column() < columnCount()
-  && (index.column() + index.row() * 3 < city_target_list.count()))
+  && (index.column() + index.row() * 3 < 

[Freeciv-commits] r30564 - in /trunk/client/gui-qt: citydlg.cpp citydlg.h optiondlg.cpp optiondlg.h

2015-11-12 Thread mlewczuk80
Author: mir3x
Date: Thu Nov 12 12:29:00 2015
New Revision: 30564

URL: http://svn.gna.org/viewcvs/freeciv?rev=30564=rev
Log:
Added tooltips for chosen item in production widget in city dialog in qt-client.

See patch #6555


Modified:
trunk/client/gui-qt/citydlg.cpp
trunk/client/gui-qt/citydlg.h
trunk/client/gui-qt/optiondlg.cpp
trunk/client/gui-qt/optiondlg.h

Modified: trunk/client/gui-qt/citydlg.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/citydlg.cpp?rev=30564=30563=30564=diff
==
--- trunk/client/gui-qt/citydlg.cpp (original)
+++ trunk/client/gui-qt/citydlg.cpp Thu Nov 12 12:29:00 2015
@@ -33,7 +33,9 @@
 #include "climisc.h"
 #include "control.h"
 #include "global_worklist.h"
+#include "helpdata.h"
 #include "mapview_common.h"
+#include "movement.h"
 #include "sprite.h"
 #include "text.h"
 #include "tilespec.h"
@@ -56,6 +58,7 @@
* once per client
*/
 static city_dialog *city_dlg;
+extern QString split_text(QString text);
 
 /
   Draws X on pixmap pointing its useless
@@ -2586,6 +2589,96 @@
   return false;
 }
 
+/**
+  Event filter for catching tooltip events
+**/
+bool fc_tooltip::eventFilter(QObject *obj, QEvent *ev)
+{
+  QHelpEvent *help_event;
+  QString item_tooltip;
+  QRect rect;
+
+  if (ev->type() == QEvent::ToolTip) {
+QAbstractItemView *view = qobject_cast(obj->parent());
+if (!view) {
+  return false;
+}
+
+help_event = static_cast(ev);
+QPoint pos = help_event->pos();
+QModelIndex index = view->indexAt(pos);
+if (!index.isValid()) {
+  return false;
+}
+item_tooltip = view->model()->data(index, Qt::ToolTipRole).toString();
+rect = view->visualRect(index);
+
+if (!item_tooltip.isEmpty()) {
+  QToolTip::showText(help_event->globalPos(), item_tooltip, view, rect);
+} else {
+  QToolTip::hideText();
+}
+return true;
+  }
+  return false;
+}
+
+/**
+  Returns shortened help for given universal ( stored in qvar )
+**/
+QString get_tooltip(QVariant qvar)
+{
+  QString str, def_str, ret_str;
+  QStringList sl;
+  char buffer[8192];
+  char buf2[1];
+
+  buf2[0] = '\0';
+  struct universal *target;
+  target = reinterpret_cast(qvar.value());
+  if (target == NULL) {
+  } else if (VUT_UTYPE == target->kind) {
+def_str = QString(N_("Attack: %1, Defense: %2, Move: %3\n"))
+  .arg(target->value.utype->attack_strength)
+  .arg(target->value.utype->defense_strength)
+  .arg(QString(move_points_text(target->value.utype->move_rate, 
TRUE)));
+def_str += QString(N_("Cost: %1, Basic Upkeep: %2\n"))
+   .arg(utype_build_shield_cost(target->value.utype))
+   .arg(helptext_unit_upkeep_str(target->value.utype));
+def_str += QString(N_("Hitpoints: %1, FirePower: %2, Vision: %3\n\n"))
+   .arg(target->value.utype->hp)
+   .arg(target->value.utype->firepower)
+   .arg((int)sqrt((double)target->value.utype->vision_radius_sq));
+str = helptext_unit(buffer, sizeof(buffer), client.conn.playing,
+buf2, target->value.utype);
+  } else {
+if (!improvement_has_flag(target->value.building, IF_GOLD)) {
+  def_str = QString(N_("Cost: %1, Upkeep: %2\n\n"))
+.arg(impr_build_shield_cost(target->value.building))
+.arg(target->value.building->upkeep);
+}
+str = helptext_building(buffer, sizeof(buffer), client.conn.playing,
+NULL, target->value.building);
+  }
+
+  /* Remove all lines from help which has '*' in first 3 chars */
+  sl = str.split('\n');
+  foreach (const QString & s, sl) {
+if (s.count() > 2) {
+  if (s.at(0) != '*' && s.at(1) != '*' && s.at(2) != '*') {
+ret_str = ret_str + s + '\n';
+  }
+} else {
+  ret_str = ret_str + s + '\n';
+}
+  }
+
+  ret_str = split_text(ret_str);
+  ret_str = ret_str.trimmed();
+  ret_str = def_str + ret_str;
+
+  return ret_str;
+}
 
 /***
   City item delegate constructor
@@ -2804,8 +2897,13 @@
   if (!index.isValid()) return QVariant();
   if (index.row() >= 0 && index.row() < rowCount() && index.column() >= 0
   && index.column() < columnCount()
-  && (index.column() + index.row() * 3 < city_target_list.count()))
+  && (index.column() + index.row() * 3 < city_target_list.count())) {
+if (role == Qt::ToolTipRole) {
+  return 

[Freeciv-commits] r30565 - /branches/S2_5/client/gui-qt/chatline.cpp

2015-11-12 Thread mlewczuk80
Author: mir3x
Date: Thu Nov 12 12:31:11 2015
New Revision: 30565

URL: http://svn.gna.org/viewcvs/freeciv?rev=30565=rev
Log:
Replaced chars* with QStrings in chat widget. 

See patch #6562


Modified:
branches/S2_5/client/gui-qt/chatline.cpp

Modified: branches/S2_5/client/gui-qt/chatline.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/chatline.cpp?rev=30565=30564=30565=diff
==
--- branches/S2_5/client/gui-qt/chatline.cpp(original)
+++ branches/S2_5/client/gui-qt/chatline.cppThu Nov 12 12:31:11 2015
@@ -33,7 +33,7 @@
 #include "chatline.h"
 
 static bool gui_qt_allied_chat_only = false;
-static bool is_plain_public_message(const char *s);
+static bool is_plain_public_message(QString s);
 static QString replace_html(QString str);
 /***
   Constructor for chatwdg
@@ -182,19 +182,14 @@
 ***/
 void chatwdg::send()
 {
-  char *theinput;
-  char buf[MAX_LEN_MSG];
-
-  theinput = chat_line->text().toUtf8().data();
   gui()->chat_history.prepend(chat_line->text());
-  if (*theinput) {
-if (client_state() == C_S_RUNNING && ::gui_qt_allied_chat_only
-&& is_plain_public_message(theinput)) {
-  fc_snprintf(buf, sizeof(buf), ". %s", theinput);
-  send_chat(buf);
+  if (chat_line->text() != "") {
+if (client_state() >= C_S_RUNNING && ::gui_qt_allied_chat_only
+&& is_plain_public_message(chat_line->text())) {
+  send_chat(QString(". %s")
+  .arg(chat_line->text().toUtf8().data()).toUtf8().data());
 } else {
-  fc_snprintf(buf, sizeof(buf), "%s", theinput);
-  send_chat(buf);
+  send_chat(chat_line->text().toUtf8().data());
 }
   }
   chat_line->clear();
@@ -446,32 +441,19 @@
   Helper function to determine if a given client input line is intended as
   a "plain" public message.
 **/
-static bool is_plain_public_message(const char *s)
+static bool is_plain_public_message(QString s)
 {
   const char ALLIES_CHAT_PREFIX = '.';
   const char SERVER_COMMAND_PREFIX = '/';
-  const char MESSAGE_PREFIX = ':';
-  const char *p;
-
-  if (s[0] == SERVER_COMMAND_PREFIX || s[0] == ALLIES_CHAT_PREFIX) {
-return FALSE;
-  }
-
-  if (s[0] == '\'' || s[0] == '"') {
-p = strchr(s + 1, s[0]);
-  } else {
-p = s;
-  }
-
-  while (p != NULL && *p != '\0') {
-if (fc_isspace(*p)) {
-  return TRUE;
-} else if (*p == MESSAGE_PREFIX) {
-  return FALSE;
-}
-p++;
-  }
-  return TRUE;
+  QString str;
+
+  str = s.trimmed();
+  if (str.at(0) == SERVER_COMMAND_PREFIX
+  || str.at(0) == ALLIES_CHAT_PREFIX) {
+return false;
+  }
+
+  return true;
 }
 
 /**


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30591 - in /branches/S2_6/tools/ruledit: ruledit.cpp ruledit.h ruledit_qt.cpp

2015-11-12 Thread sveinung84
Author: sveinung
Date: Fri Nov 13 06:38:08 2015
New Revision: 30591

URL: http://svn.gna.org/viewcvs/freeciv?rev=30591=rev
Log:
ruledit: take ruleset as an argument

See patch #6586

Modified:
branches/S2_6/tools/ruledit/ruledit.cpp
branches/S2_6/tools/ruledit/ruledit.h
branches/S2_6/tools/ruledit/ruledit_qt.cpp

Modified: branches/S2_6/tools/ruledit/ruledit.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/tools/ruledit/ruledit.cpp?rev=30591=30590=30591=diff
==
--- branches/S2_6/tools/ruledit/ruledit.cpp (original)
+++ branches/S2_6/tools/ruledit/ruledit.cpp Fri Nov 13 06:38:08 2015
@@ -40,6 +40,8 @@
 
 static int re_parse_cmdline(int argc, char *argv[]);
 
+struct ruledit_arguments reargs;
+
 /**
   Main entry point for freeciv-ruledit
 **/
@@ -74,6 +76,9 @@
 
   log_init(NULL, loglevel, NULL, NULL, -1);
 
+  /* Initialize command line arguments. */
+  reargs.ruleset = NULL;
+
   ui_options = re_parse_cmdline(argc, argv);
 
   if (ui_options != -1) {
@@ -97,6 +102,11 @@
   free_libfreeciv();
   free_nls();
 
+  /* Clean up command line arguments. */
+  if (reargs.ruleset) {
+FC_FREE(reargs.ruleset);
+  }
+
   return EXIT_SUCCESS;
 }
 
@@ -110,6 +120,8 @@
   int ui_options = 0;
 
   while (i < argc) {
+char *option;
+
 if (ui_separator) {
   argv[1 + ui_options] = argv[i];
   ui_options++;
@@ -120,6 +132,10 @@
   R__("Print a summary of the options"));
   cmdhelp_add(help, "v", "version",
   R__("Print the version number"));
+  cmdhelp_add(help, "r",
+  /* TRANS: argument (don't translate) VALUE (translate) */
+  R__("ruleset RULESET"),
+  R__("Ruleset to use as the starting point."));
   /* The function below prints a header and footer for the options.
* Furthermore, the options are sorted. */
   cmdhelp_display(help, TRUE, TRUE, TRUE);
@@ -130,6 +146,12 @@
   fc_fprintf(stderr, "%s \n", freeciv_name_version());
 
   exit(EXIT_SUCCESS);
+} else if ((option = get_option_malloc("--ruleset", argv, , argc))) {
+  if (reargs.ruleset) {
+log_error(_("Can only edit one ruleset at a time."));
+  } else {
+reargs.ruleset = option;
+  }
 } else if (is_option("--", argv[i])) {
   ui_separator = TRUE;
 } else {

Modified: branches/S2_6/tools/ruledit/ruledit.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/tools/ruledit/ruledit.h?rev=30591=30590=30591=diff
==
--- branches/S2_6/tools/ruledit/ruledit.h   (original)
+++ branches/S2_6/tools/ruledit/ruledit.h   Fri Nov 13 06:38:08 2015
@@ -15,4 +15,11 @@
 
 void show_experimental(QWidget *wdg);
 
+struct ruledit_arguments {
+  /* Ruleset name. Is NULL if not specified. */
+  char *ruleset;
+};
+
+extern struct ruledit_arguments reargs;
+
 #endif /* FC__RULEDIT_H */

Modified: branches/S2_6/tools/ruledit/ruledit_qt.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/tools/ruledit/ruledit_qt.cpp?rev=30591=30590=30591=diff
==
--- branches/S2_6/tools/ruledit/ruledit_qt.cpp  (original)
+++ branches/S2_6/tools/ruledit/ruledit_qt.cpp  Fri Nov 13 06:38:08 2015
@@ -145,7 +145,11 @@
   rs_label->setSizePolicy(QSizePolicy::Ignored, QSizePolicy::Fixed);
   preload_layout->addWidget(rs_label);
   ruleset_select = new QLineEdit(central);
-  ruleset_select->setText(GAME_DEFAULT_RULESETDIR);
+  if (reargs.ruleset) {
+ruleset_select->setText(reargs.ruleset);
+  } else {
+ruleset_select->setText(GAME_DEFAULT_RULESETDIR);
+  }
   connect(ruleset_select, SIGNAL(returnPressed()),
   this, SLOT(launch_now()));
   preload_layout->addWidget(ruleset_select);


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30588 - /trunk/server/unithand.c

2015-11-12 Thread sveinung84
Author: sveinung
Date: Fri Nov 13 06:36:34 2015
New Revision: 30588

URL: http://svn.gna.org/viewcvs/freeciv?rev=30588=rev
Log:
The player is responsible for the illegal action

Assert that the player is responsible for the illegal action before
bothering him with a message about it or punishing him for it.

See patch #6587

Modified:
trunk/server/unithand.c

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=30588=30587=30588=diff
==
--- trunk/server/unithand.c (original)
+++ trunk/server/unithand.c Fri Nov 13 06:36:34 2015
@@ -129,7 +129,8 @@
struct player *tgt_player,
const struct tile *target_tile,
const struct city *target_city,
-   const struct unit *target_unit);
+   const struct unit *target_unit,
+   const enum action_requester requester);
 static bool city_add_unit(struct player *pplayer, struct unit *punit,
   struct city *pcity);
 static bool city_build(struct player *pplayer, struct unit *punit,
@@ -1195,8 +1196,21 @@
struct player *tgt_player,
const struct tile *target_tile,
const struct city *target_city,
-   const struct unit *target_unit)
-{
+   const struct unit *target_unit,
+   const enum action_requester requester)
+{
+  /* Why didn't the game check before trying something illegal? Did a good
+   * reason to not call is_action_enabled_unit_on...() appear? The game is
+   * omniscient... */
+  fc_assert(requester != ACT_REQ_RULES);
+
+  /* Don't punish the player for something the game did. Don't tell the
+   * player that the rules required the game to try to do something
+   * illegal. */
+  fc_assert_ret_msg((requester == ACT_REQ_PLAYER
+ || requester == ACT_REQ_SS_AGENT),
+"The player wasn't responsible for this.");
+
   /* The mistake may have a cost. */
   actor->moves_left = MAX(0, actor->moves_left
   - get_target_bonus_effects(NULL,
@@ -1285,7 +1299,7 @@
 action_type);
   } else {
 illegal_action(pplayer, pactor, action_type, unit_owner(punit),
-   NULL, NULL, punit);
+   NULL, NULL, punit, ACT_REQ_PLAYER);
 unit_query_impossible(pc, actor_id, target_id);
 return;
   }
@@ -1301,7 +1315,7 @@
 action_type);
   } else {
 illegal_action(pplayer, pactor, action_type, city_owner(pcity),
-   NULL, pcity, NULL);
+   NULL, pcity, NULL, ACT_REQ_PLAYER);
 unit_query_impossible(pc, actor_id, target_id);
 return;
   }
@@ -1314,7 +1328,7 @@
 spy_send_sabotage_list(pc, pactor, pcity);
   } else {
 illegal_action(pplayer, pactor, action_type, city_owner(pcity),
-   NULL, pcity, NULL);
+   NULL, pcity, NULL, ACT_REQ_PLAYER);
 unit_query_impossible(pc, actor_id, target_id);
 return;
   }
@@ -1459,7 +1473,8 @@
 return diplomat_bribe(pplayer, actor_unit, punit);
   } else {
 illegal_action(pplayer, actor_unit, action_type,
-   unit_owner(punit), NULL, NULL, punit);
+   unit_owner(punit), NULL, NULL, punit,
+   requester);
   }
 }
 break;
@@ -1472,7 +1487,8 @@
 return spy_sabotage_unit(pplayer, actor_unit, punit);
   } else {
 illegal_action(pplayer, actor_unit, action_type,
-   unit_owner(punit), NULL, NULL, punit);
+   unit_owner(punit), NULL, NULL, punit,
+   requester);
   }
 }
 break;
@@ -1485,7 +1501,8 @@
 return do_expel_unit(pplayer, actor_unit, punit);
   } else {
 illegal_action(pplayer, actor_unit, action_type,
-   unit_owner(punit), NULL, NULL, punit);
+   unit_owner(punit), NULL, NULL, punit,
+   requester);
   }
 }
 break;
@@ -1498,7 +1515,8 @@
 return do_unit_disband(pplayer, actor_unit);
   } else {
 illegal_action(pplayer, actor_unit, action_type,
-   unit_owner(actor_unit), NULL, NULL, actor_unit);
+   unit_owner(actor_unit), NULL, NULL, actor_unit,
+   requester);
   }
 }
 break;
@@ -1511,7 +1529,8 @@
  action_type);
   } else {
 illegal_action(pplayer, actor_unit, action_type,
-   city_owner(pcity), NULL, pcity, NULL);
+   

[Freeciv-commits] r30590 - /branches/S2_6/tools/ruledit/ruledit_qt.cpp

2015-11-12 Thread sveinung84
Author: sveinung
Date: Fri Nov 13 06:37:59 2015
New Revision: 30590

URL: http://svn.gna.org/viewcvs/freeciv?rev=30590=rev
Log:
ruledit: load ruleset when enter is pressed

See patch #6585

Modified:
branches/S2_6/tools/ruledit/ruledit_qt.cpp

Modified: branches/S2_6/tools/ruledit/ruledit_qt.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/tools/ruledit/ruledit_qt.cpp?rev=30590=30589=30590=diff
==
--- branches/S2_6/tools/ruledit/ruledit_qt.cpp  (original)
+++ branches/S2_6/tools/ruledit/ruledit_qt.cpp  Fri Nov 13 06:37:59 2015
@@ -146,6 +146,8 @@
   preload_layout->addWidget(rs_label);
   ruleset_select = new QLineEdit(central);
   ruleset_select->setText(GAME_DEFAULT_RULESETDIR);
+  connect(ruleset_select, SIGNAL(returnPressed()),
+  this, SLOT(launch_now()));
   preload_layout->addWidget(ruleset_select);
   ruleset_accept = new QPushButton(QString::fromUtf8(R__("Start editing")));
   connect(ruleset_accept, SIGNAL(pressed()), this, SLOT(launch_now()));


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30572 - in /trunk: ai/default/ common/ server/

2015-11-12 Thread sveinung84
Author: sveinung
Date: Thu Nov 12 15:54:31 2015
New Revision: 30572

URL: http://svn.gna.org/viewcvs/freeciv?rev=30572=rev
Log:
Be aware of action requester identity

Let unit_perform_action() know how responsible the player is for an attempt
to perform an action.

At the moment a request to perform an action can come from two sources: the
player or the game rules. A third action requester that hasn't appeared yet
is server side agents like auto settlers.

See patch #6581

Modified:
trunk/ai/default/aicity.c
trunk/common/actions.h
trunk/server/cityturn.c
trunk/server/unithand.c
trunk/server/unithand.h
trunk/server/unittools.c
trunk/server/unittools.h

Modified: trunk/ai/default/aicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aicity.c?rev=30572=30571=30572=diff
==
--- trunk/ai/default/aicity.c   (original)
+++ trunk/ai/default/aicity.c   Thu Nov 12 15:54:31 2015
@@ -463,7 +463,7 @@
   && def_ai_city_data(pcity, ait)->urgency == 0) {
 CITY_LOG(LOG_BUY, pcity, "disbanding %s to increase production",
  unit_rule_name(punit));
-unit_do_disband_trad(pplayer, punit);
+unit_do_disband_trad(pplayer, punit, ACT_REQ_PLAYER);
   }
 } unit_list_iterate_safe_end;
   } city_list_iterate_end;
@@ -938,7 +938,7 @@
   /* TODO: Should the unit try to find legal targets at adjacent tiles?
* Should it consider other self eliminating actions than the
* components of the traditional disband? */
-  unit_do_disband_trad(pplayer, punit);
+  unit_do_disband_trad(pplayer, punit, ACT_REQ_PLAYER);
   city_refresh(pcity);
 }
   } unit_list_iterate_safe_end;

Modified: trunk/common/actions.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.h?rev=30572=30571=30572=diff
==
--- trunk/common/actions.h  (original)
+++ trunk/common/actions.h  Thu Nov 12 15:54:31 2015
@@ -153,6 +153,21 @@
  */
 #define ACTPROB_NOT_KNOWN 255
 
+/* Who ordered the action to be performed? */
+#define SPECENUM_NAME action_requester
+/* The player ordered it directly. */
+#define SPECENUM_VALUE0 ACT_REQ_PLAYER
+#define SPECENUM_VALUE0NAME N_("the player")
+/* The game it self because the rules requires it. */
+#define SPECENUM_VALUE1 ACT_REQ_RULES
+#define SPECENUM_VALUE1NAME N_("the game rules")
+/* A server side autonomous agent working for the player. */
+#define SPECENUM_VALUE2 ACT_REQ_SS_AGENT
+#define SPECENUM_VALUE2NAME N_("a server agent")
+/* Number of action requesters. */
+#define SPECENUM_COUNT ACT_REQ_COUNT
+#include "specenum_gen.h"
+
 struct action
 {
   enum gen_action id;

Modified: trunk/server/cityturn.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/cityturn.c?rev=30572=30571=30572=diff
==
--- trunk/server/cityturn.c (original)
+++ trunk/server/cityturn.c Thu Nov 12 15:54:31 2015
@@ -2052,7 +2052,7 @@
 /* TODO: Should the unit try to help cities on adjacent tiles? That
  * would be a rules change. (This action is performed by the game
  * it self) */
-unit_do_disband_trad(pplayer, punit);
+unit_do_disband_trad(pplayer, punit, ACT_REQ_RULES);
/* pcity->surplus[O_SHIELD] is automatically updated. */
   }
 } unit_list_iterate_safe_end;

Modified: trunk/server/unithand.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.c?rev=30572=30571=30572=diff
==
--- trunk/server/unithand.c (original)
+++ trunk/server/unithand.c Thu Nov 12 15:54:31 2015
@@ -1337,7 +1337,7 @@
   const enum gen_action action_type)
 {
   (void) unit_perform_action(pplayer, actor_id, target_id, value, name,
- action_type);
+ action_type, ACT_REQ_PLAYER);
 }
 
 /**
@@ -1356,7 +1356,8 @@
  const int target_id,
  const int value,
  const char *name,
- const enum gen_action action_type)
+ const enum gen_action action_type,
+ const enum action_requester requester)
 {
   struct unit *actor_unit = player_unit_by_number(pplayer, actor_id);
   struct tile *target_tile = index_to_tile(target_id);

Modified: trunk/server/unithand.h
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/server/unithand.h?rev=30572=30571=30572=diff
==
--- trunk/server/unithand.h (original)
+++ trunk/server/unithand.h Thu Nov 12 15:54:31 2015
@@ -35,7 +35,8 @@
  const int 

[Freeciv-commits] r30586 - /trunk/tools/ruledit/ruledit_qt.cpp

2015-11-12 Thread sveinung84
Author: sveinung
Date: Fri Nov 13 06:36:15 2015
New Revision: 30586

URL: http://svn.gna.org/viewcvs/freeciv?rev=30586=rev
Log:
ruledit: load ruleset when enter is pressed

See patch #6585

Modified:
trunk/tools/ruledit/ruledit_qt.cpp

Modified: trunk/tools/ruledit/ruledit_qt.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/tools/ruledit/ruledit_qt.cpp?rev=30586=30585=30586=diff
==
--- trunk/tools/ruledit/ruledit_qt.cpp  (original)
+++ trunk/tools/ruledit/ruledit_qt.cpp  Fri Nov 13 06:36:15 2015
@@ -148,6 +148,8 @@
   preload_layout->addWidget(rs_label);
   ruleset_select = new QLineEdit(central);
   ruleset_select->setText(GAME_DEFAULT_RULESETDIR);
+  connect(ruleset_select, SIGNAL(returnPressed()),
+  this, SLOT(launch_now()));
   preload_layout->addWidget(ruleset_select);
   ruleset_accept = new QPushButton(QString::fromUtf8(R__("Start editing")));
   connect(ruleset_accept, SIGNAL(pressed()), this, SLOT(launch_now()));


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30589 - in /trunk: client/goto.c common/actions.c common/actions.h

2015-11-12 Thread sveinung84
Author: sveinung
Date: Fri Nov 13 06:36:44 2015
New Revision: 30589

URL: http://svn.gna.org/viewcvs/freeciv?rev=30589=rev
Log:
Centralize action actor target distance rules

Store an action's minimum and maximum legal distance between actor and
target in the action structure it self.

See patch #6588

Modified:
trunk/client/goto.c
trunk/common/actions.c
trunk/common/actions.h

Modified: trunk/client/goto.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/goto.c?rev=30589=30588=30589=diff
==
--- trunk/client/goto.c (original)
+++ trunk/client/goto.c Fri Nov 13 06:36:44 2015
@@ -1620,20 +1620,17 @@
  * direction. */
 return TRUE;
   case ORDER_PERFORM_ACTION:
-switch (act_id) {
-case ACTION_CAPTURE_UNITS:
-case ACTION_BOMBARD:
-  /* Mandatory. A single domestic unit at the target tile will make
-   * the action illegal. It must therefore be performed from another
-   * tile. */
+if (!action_id_distance_accepted(act_id, 0)) {
+  /* Always illegal to do to a target on the actor's own tile. */
   return TRUE;
-case ACTION_FOUND_CITY:
-case ACTION_RECYCLE_UNIT:
-  /* Currently illegal to perform to a target on another tile. */
+}
+
+if (!action_id_distance_accepted(act_id, 1)) {
+  /* Always illegal to perform to a target on a neighbor tile. */
   return FALSE;
-default:
-  return FALSE;
-}
+}
+
+return FALSE;
   default:
 return FALSE;
   }
@@ -1651,15 +1648,12 @@
 /* A move is always done in a direction. */
 return TRUE;
   case ORDER_PERFORM_ACTION:
-switch (act_id) {
-case ACTION_CAPTURE_UNITS:
-case ACTION_BOMBARD:
-  /* A single domestic unit at the target tile will make the action
-   * illegal. It must therefore be performed from another tile. */
+if (!action_id_distance_accepted(act_id, 0)) {
+  /* Always illegal to do to a target on the actor's own tile. */
   return TRUE;
-default:
-  return FALSE;
-}
+}
+
+return FALSE;
   default:
 return FALSE;
   }

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=30589=30588=30589=diff
==
--- trunk/common/actions.c  (original)
+++ trunk/common/actions.c  Fri Nov 13 06:36:44 2015
@@ -36,7 +36,9 @@
 static struct action *action_new(enum gen_action id,
  enum action_target_kind target_kind,
  bool hostile, bool requires_details,
- bool rare_pop_up);
+ bool rare_pop_up,
+ const int min_distance,
+ const int max_distance);
 
 static bool is_enabler_active(const struct action_enabler *enabler,
  const struct player *actor_player,
@@ -63,83 +65,120 @@
 {
   /* Hard code the actions */
   actions[ACTION_SPY_POISON] = action_new(ACTION_SPY_POISON, ATK_CITY,
-  TRUE, FALSE, FALSE);
+  TRUE, FALSE, FALSE,
+  0, 1);
   actions[ACTION_SPY_SABOTAGE_UNIT] =
   action_new(ACTION_SPY_SABOTAGE_UNIT, ATK_UNIT,
- TRUE, FALSE, FALSE);
+ TRUE, FALSE, FALSE,
+ 0, 1);
   actions[ACTION_SPY_BRIBE_UNIT] =
   action_new(ACTION_SPY_BRIBE_UNIT, ATK_UNIT,
- TRUE, FALSE, FALSE);
+ TRUE, FALSE, FALSE,
+ 0, 1);
   actions[ACTION_SPY_SABOTAGE_CITY] =
   action_new(ACTION_SPY_SABOTAGE_CITY, ATK_CITY,
- TRUE, FALSE, FALSE);
+ TRUE, FALSE, FALSE,
+ 0, 1);
   actions[ACTION_SPY_TARGETED_SABOTAGE_CITY] =
   action_new(ACTION_SPY_TARGETED_SABOTAGE_CITY, ATK_CITY,
- TRUE, TRUE, FALSE);
+ TRUE, TRUE, FALSE,
+ 0, 1);
   actions[ACTION_SPY_INCITE_CITY] =
   action_new(ACTION_SPY_INCITE_CITY, ATK_CITY,
- TRUE, FALSE, FALSE);
+ TRUE, FALSE, FALSE,
+ 0, 1);
   actions[ACTION_ESTABLISH_EMBASSY] =
   action_new(ACTION_ESTABLISH_EMBASSY, ATK_CITY,
- FALSE, FALSE, FALSE);
+ FALSE, FALSE, FALSE,
+ 0, 1);
   actions[ACTION_SPY_STEAL_TECH] =
   action_new(ACTION_SPY_STEAL_TECH, ATK_CITY,
- TRUE, FALSE, FALSE);
+ TRUE, FALSE, FALSE,
+ 0, 1);
   actions[ACTION_SPY_TARGETED_STEAL_TECH] =
   action_new(ACTION_SPY_TARGETED_STEAL_TECH, ATK_CITY,
- TRUE, TRUE, FALSE);
+ TRUE, TRUE, FALSE,
+ 0, 1);
   actions[ACTION_SPY_INVESTIGATE_CITY] =
   action_new(ACTION_SPY_INVESTIGATE_CITY, ATK_CITY,
- TRUE, FALSE, FALSE);

[Freeciv-commits] r30574 - in /branches/S2_6/client: gui-gtk-2.0/action_dialog.c gui-gtk-3.0/action_dialog.c

2015-11-12 Thread sveinung84
Author: sveinung
Date: Thu Nov 12 15:58:20 2015
New Revision: 30574

URL: http://svn.gna.org/viewcvs/freeciv?rev=30574=rev
Log:
GTK clients: act sel dlg "Show Location" button

Add a button that focuses the map on the actor unit to the GTK clients'
action selection dialog.

Requested by Marko Lindqvist 

See bug #23846

Modified:
branches/S2_6/client/gui-gtk-2.0/action_dialog.c
branches/S2_6/client/gui-gtk-3.0/action_dialog.c

Modified: branches/S2_6/client/gui-gtk-2.0/action_dialog.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-2.0/action_dialog.c?rev=30574=30573=30574=diff
==
--- branches/S2_6/client/gui-gtk-2.0/action_dialog.c(original)
+++ branches/S2_6/client/gui-gtk-2.0/action_dialog.cThu Nov 12 15:58:20 2015
@@ -50,8 +50,9 @@
 
 /* Locations for non action enabler controlled buttons. */
 #define BUTTON_MOVE ACTION_MOVE
-#define BUTTON_CANCEL BUTTON_MOVE + 1
-#define BUTTON_COUNT BUTTON_MOVE + 2
+#define BUTTON_LOCATION BUTTON_MOVE + 1
+#define BUTTON_CANCEL BUTTON_MOVE + 2
+#define BUTTON_COUNT BUTTON_MOVE + 3
 
 #define BUTTON_NOT_THERE -1
 
@@ -881,6 +882,20 @@
 
 
 /**
+  Callback from action selection dialog for "Show Location".
+**/
+static void act_sel_location_callback(GtkWidget *w, gpointer data)
+{
+  struct action_data *args = (struct action_data *)data;
+
+  struct unit *punit;
+
+  if ((punit = game_unit_by_number(args->actor_unit_id))) {
+center_tile_mapcanvas(unit_tile(punit));
+  }
+}
+
+/**
   Callback from diplomat/spy dialog for "keep moving".
   (This should only occur when entering a tile that has an allied city or
   an allied unit.)
@@ -1152,6 +1167,12 @@
   data, FALSE, NULL);
   }
 
+  action_button_map[BUTTON_LOCATION] =
+  choice_dialog_get_number_of_buttons(shl);
+  choice_dialog_add(shl, _("Show Location"),
+(GCallback)act_sel_location_callback, data,
+TRUE, NULL);
+
   action_button_map[BUTTON_CANCEL] =
   choice_dialog_get_number_of_buttons(shl);
   choice_dialog_add(shl, GTK_STOCK_CANCEL,

Modified: branches/S2_6/client/gui-gtk-3.0/action_dialog.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-3.0/action_dialog.c?rev=30574=30573=30574=diff
==
--- branches/S2_6/client/gui-gtk-3.0/action_dialog.c(original)
+++ branches/S2_6/client/gui-gtk-3.0/action_dialog.cThu Nov 12 15:58:20 2015
@@ -50,8 +50,9 @@
 
 /* Locations for non action enabler controlled buttons. */
 #define BUTTON_MOVE ACTION_MOVE
-#define BUTTON_CANCEL BUTTON_MOVE + 1
-#define BUTTON_COUNT BUTTON_MOVE + 2
+#define BUTTON_LOCATION BUTTON_MOVE + 1
+#define BUTTON_CANCEL BUTTON_MOVE + 2
+#define BUTTON_COUNT BUTTON_MOVE + 3
 
 #define BUTTON_NOT_THERE -1
 
@@ -891,6 +892,20 @@
 
 
 /**
+  Callback from action selection dialog for "Show Location".
+**/
+static void act_sel_location_callback(GtkWidget *w, gpointer data)
+{
+  struct action_data *args = (struct action_data *)data;
+
+  struct unit *punit;
+
+  if ((punit = game_unit_by_number(args->actor_unit_id))) {
+center_tile_mapcanvas(unit_tile(punit));
+  }
+}
+
+/**
   Callback from diplomat/spy dialog for "keep moving".
   (This should only occur when entering a tile that has an allied city or
   an allied unit.)
@@ -1162,6 +1177,12 @@
   data, FALSE, NULL);
   }
 
+  action_button_map[BUTTON_LOCATION] =
+  choice_dialog_get_number_of_buttons(shl);
+  choice_dialog_add(shl, _("Show Location"),
+(GCallback)act_sel_location_callback, data,
+TRUE, NULL);
+
   action_button_map[BUTTON_CANCEL] =
   choice_dialog_get_number_of_buttons(shl);
   choice_dialog_add(shl, GTK_STOCK_CANCEL,


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30568 - in /trunk: ./ ai/default/ client/ client/gui-gtk-2.0/ client/gui-gtk-3.0/ client/gui-qt/ client/gui-sdl2/ common/ d...

2015-11-12 Thread sveinung84
Author: sveinung
Date: Thu Nov 12 15:53:52 2015
New Revision: 30568

URL: http://svn.gna.org/viewcvs/freeciv?rev=30568=rev
Log:
Make unit disbanding action enabler controlled

"Disband Unit" action enabler rules controls the player ordering a unit to
disband without getting anything in return. The unit type flag
Undisbandable still has hard coded control over who the game won't try to
auto disband to save a city and who it will work extra hard to save from
drowning.

Patch #6536 temporarily broke the client's ability to order a unit to
disband when Recycle Unit is illegal but the player don't have enough
information to know that it is. This patch makes it possible again.

Patch #6389 temporarily made it impossible to put a non "Recycle Unit"
disband order in a units orders. This patch makes it possible again.

See patch #6573

Modified:
trunk/ai/default/aicity.c
trunk/client/control.c
trunk/client/gui-gtk-2.0/action_dialog.c
trunk/client/gui-gtk-2.0/citydlg.c
trunk/client/gui-gtk-2.0/dialogs.c
trunk/client/gui-gtk-2.0/menu.c
trunk/client/gui-gtk-3.0/action_dialog.c
trunk/client/gui-gtk-3.0/citydlg.c
trunk/client/gui-gtk-3.0/dialogs.c
trunk/client/gui-gtk-3.0/menu.c
trunk/client/gui-qt/citydlg.cpp
trunk/client/gui-qt/dialogs.cpp
trunk/client/gui-qt/menu.cpp
trunk/client/gui-sdl2/action_dialog.c
trunk/client/helpdata.c
trunk/client/repodlgs_common.c
trunk/client/text.c
trunk/common/actions.c
trunk/common/actions.h
trunk/common/packets.def
trunk/data/alien/game.ruleset
trunk/data/alien/units.ruleset
trunk/data/civ1/game.ruleset
trunk/data/civ2/game.ruleset
trunk/data/civ2civ3/game.ruleset
trunk/data/civ2civ3/units.ruleset
trunk/data/classic/game.ruleset
trunk/data/classic/units.ruleset
trunk/data/experimental/game.ruleset
trunk/data/experimental/units.ruleset
trunk/data/multiplayer/game.ruleset
trunk/data/multiplayer/units.ruleset
trunk/data/stub/units.ruleset
trunk/doc/README.actions
trunk/fc_version
trunk/server/advisors/advdata.c
trunk/server/rscompat.c
trunk/server/ruleset.c
trunk/server/unithand.c
trunk/server/unithand.h
trunk/server/unittools.c
trunk/tools/ruledit/rulesave.c

[This mail would be too long, it was shortened to contain the URLs only.]

Modified: trunk/ai/default/aicity.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/ai/default/aicity.c?rev=30568=30567=30568=diff

Modified: trunk/client/control.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/control.c?rev=30568=30567=30568=diff

Modified: trunk/client/gui-gtk-2.0/action_dialog.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/action_dialog.c?rev=30568=30567=30568=diff

Modified: trunk/client/gui-gtk-2.0/citydlg.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/citydlg.c?rev=30568=30567=30568=diff

Modified: trunk/client/gui-gtk-2.0/dialogs.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/dialogs.c?rev=30568=30567=30568=diff

Modified: trunk/client/gui-gtk-2.0/menu.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-2.0/menu.c?rev=30568=30567=30568=diff

Modified: trunk/client/gui-gtk-3.0/action_dialog.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/action_dialog.c?rev=30568=30567=30568=diff

Modified: trunk/client/gui-gtk-3.0/citydlg.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/citydlg.c?rev=30568=30567=30568=diff

Modified: trunk/client/gui-gtk-3.0/dialogs.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/dialogs.c?rev=30568=30567=30568=diff

Modified: trunk/client/gui-gtk-3.0/menu.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-gtk-3.0/menu.c?rev=30568=30567=30568=diff

Modified: trunk/client/gui-qt/citydlg.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/citydlg.cpp?rev=30568=30567=30568=diff

Modified: trunk/client/gui-qt/dialogs.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/dialogs.cpp?rev=30568=30567=30568=diff

Modified: trunk/client/gui-qt/menu.cpp
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-qt/menu.cpp?rev=30568=30567=30568=diff

Modified: trunk/client/gui-sdl2/action_dialog.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/gui-sdl2/action_dialog.c?rev=30568=30567=30568=diff

Modified: trunk/client/helpdata.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/helpdata.c?rev=30568=30567=30568=diff

Modified: trunk/client/repodlgs_common.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/repodlgs_common.c?rev=30568=30567=30568=diff

Modified: trunk/client/text.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/client/text.c?rev=30568=30567=30568=diff

Modified: trunk/common/actions.c
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/common/actions.c?rev=30568=30567=30568=diff

Modified: trunk/common/actions.h
URL: 

[Freeciv-commits] r30571 - /trunk/data/scenarios/europe_1901.sav

2015-11-12 Thread sveinung84
Author: sveinung
Date: Thu Nov 12 15:54:20 2015
New Revision: 30571

URL: http://svn.gna.org/viewcvs/freeciv?rev=30571=rev
Log:
Europe 1901: standardize AI skill level

Some players had the AI skill level Normal. Others used the global AI skill
level. It was set to Hard. Standardize on Hard.

See bug #23983

Modified:
trunk/data/scenarios/europe_1901.sav

Modified: trunk/data/scenarios/europe_1901.sav
URL: 
http://svn.gna.org/viewcvs/freeciv/trunk/data/scenarios/europe_1901.sav?rev=30571=30570=30571=diff
==
--- trunk/data/scenarios/europe_1901.sav(original)
+++ trunk/data/scenarios/europe_1901.savThu Nov 12 15:54:20 2015
@@ -1825,7 +1825,7 @@
 4,-1,5,0,0,0,0,0
 0,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=3090
 rates.tax=40
@@ -3478,7 +3478,7 @@
 0,-1,5,0,0,0,0,0
 1,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=4048
 rates.tax=50
@@ -5250,7 +5250,7 @@
 1,-1,5,0,0,0,0,0
 2,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=3887
 rates.tax=40
@@ -6950,7 +6950,7 @@
 2,-1,5,0,0,0,0,0
 3,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=3560
 rates.tax=40
@@ -8711,7 +8711,7 @@
 3,-1,5,0,0,0,0,0
 4,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=2840
 rates.tax=40
@@ -10548,7 +10548,7 @@
 4,-1,5,0,0,0,0,0
 0,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=2180
 rates.tax=40
@@ -12188,7 +12188,7 @@
 0,-1,5,0,0,0,0,0
 1,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=2200
 rates.tax=40
@@ -13846,7 +13846,7 @@
 1,-1,5,0,0,0,0,0
 2,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=2010
 rates.tax=40
@@ -15465,7 +15465,7 @@
 2,-1,5,0,0,0,0,0
 3,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=1510
 rates.tax=40
@@ -17044,7 +17044,7 @@
 3,-1,5,0,0,0,0,0
 4,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=1660
 rates.tax=40
@@ -18650,7 +18650,7 @@
 4,-1,5,0,0,0,0,0
 0,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=1890
 rates.tax=40


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits


[Freeciv-commits] r30573 - in /branches/S2_6/client: gui-gtk-2.0/ gui-gtk-3.0/

2015-11-12 Thread sveinung84
Author: sveinung
Date: Thu Nov 12 15:58:12 2015
New Revision: 30573

URL: http://svn.gna.org/viewcvs/freeciv?rev=30573=rev
Log:
GTK clients: choice dialog meta buttons

Make it possible to add a button to a choice dialog that isn't an
alternative choice. Since it isn't an alternative it shouldn't close the
dialog.

See patch #6576

Modified:
branches/S2_6/client/gui-gtk-2.0/action_dialog.c
branches/S2_6/client/gui-gtk-2.0/choice_dialog.c
branches/S2_6/client/gui-gtk-2.0/choice_dialog.h
branches/S2_6/client/gui-gtk-2.0/dialogs.c
branches/S2_6/client/gui-gtk-3.0/action_dialog.c
branches/S2_6/client/gui-gtk-3.0/choice_dialog.c
branches/S2_6/client/gui-gtk-3.0/choice_dialog.h
branches/S2_6/client/gui-gtk-3.0/citydlg.c
branches/S2_6/client/gui-gtk-3.0/dialogs.c

Modified: branches/S2_6/client/gui-gtk-2.0/action_dialog.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-2.0/action_dialog.c?rev=30573=30572=30573=diff
==
--- branches/S2_6/client/gui-gtk-2.0/action_dialog.c(original)
+++ branches/S2_6/client/gui-gtk-2.0/action_dialog.cThu Nov 12 15:58:12 2015
@@ -996,7 +996,8 @@
 action_probabilities[action_id]);
 
   action_button_map[action_id] = choice_dialog_get_number_of_buttons(shl);
-  choice_dialog_add(shl, label, af_map[action_id], handler_args, tooltip);
+  choice_dialog_add(shl, label, af_map[action_id], handler_args,
+FALSE, tooltip);
 }
 
 /**
@@ -1148,13 +1149,14 @@
 choice_dialog_get_number_of_buttons(shl);
 choice_dialog_add(shl, _("_Keep moving"),
   (GCallback)diplomat_keep_moving_callback,
-  data, NULL);
+  data, FALSE, NULL);
   }
 
   action_button_map[BUTTON_CANCEL] =
   choice_dialog_get_number_of_buttons(shl);
   choice_dialog_add(shl, GTK_STOCK_CANCEL,
-(GCallback)act_sel_cancel_callback, data, NULL);
+(GCallback)act_sel_cancel_callback, data,
+FALSE, NULL);
 
   choice_dialog_end(shl);
 

Modified: branches/S2_6/client/gui-gtk-2.0/choice_dialog.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-2.0/choice_dialog.c?rev=30573=30572=30573=diff
==
--- branches/S2_6/client/gui-gtk-2.0/choice_dialog.c(original)
+++ branches/S2_6/client/gui-gtk-2.0/choice_dialog.cThu Nov 12 15:58:12 2015
@@ -152,7 +152,7 @@
 */
 void choice_dialog_add(GtkWidget *dshell, const gchar *label,
GCallback handler, gpointer data,
-   const gchar *tool_tip)
+   bool meta, const gchar *tool_tip)
 {
   GtkWidget *button, *bbox;
   char name[512];
@@ -172,8 +172,11 @@
 g_signal_connect(button, "clicked", handler, data);
   }
 
-  g_signal_connect_after(button, "clicked",
-G_CALLBACK(choice_dialog_clicked), dshell);
+  if (!meta) {
+/* This button makes the choice. */
+g_signal_connect_after(button, "clicked",
+   G_CALLBACK(choice_dialog_clicked), dshell);
+  }
 
   if (tool_tip != NULL) {
 gtk_widget_set_tooltip_text(button, tool_tip);
@@ -222,7 +225,7 @@
 handler = va_arg(args, GCallback);
 data = va_arg(args, gpointer);
 
-choice_dialog_add(dshell, name, handler, data, NULL);
+choice_dialog_add(dshell, name, handler, data, FALSE, NULL);
   }
 
   va_end(args);

Modified: branches/S2_6/client/gui-gtk-2.0/choice_dialog.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-2.0/choice_dialog.h?rev=30573=30572=30573=diff
==
--- branches/S2_6/client/gui-gtk-2.0/choice_dialog.h(original)
+++ branches/S2_6/client/gui-gtk-2.0/choice_dialog.hThu Nov 12 15:58:12 2015
@@ -24,7 +24,7 @@
   const gchar *text);
 void choice_dialog_add(GtkWidget *dshell, const gchar *label,
GCallback handler, gpointer data,
-   const gchar *tool_tip);
+   bool meta, const gchar *tool_tip);
 void choice_dialog_end(GtkWidget *dshell);
 int choice_dialog_get_number_of_buttons(GtkWidget *cd);
 void choice_dialog_button_set_sensitive(GtkWidget *shl, int button,

Modified: branches/S2_6/client/gui-gtk-2.0/dialogs.c
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-gtk-2.0/dialogs.c?rev=30573=30572=30573=diff
==
--- branches/S2_6/client/gui-gtk-2.0/dialogs.c  (original)
+++ branches/S2_6/client/gui-gtk-2.0/dialogs.c  Thu Nov 12 15:58:12 2015
@@ -363,11 +363,12 @@
   

[Freeciv-commits] r30575 - /branches/S2_6/data/scenarios/europe_1901.sav

2015-11-12 Thread sveinung84
Author: sveinung
Date: Thu Nov 12 15:58:29 2015
New Revision: 30575

URL: http://svn.gna.org/viewcvs/freeciv?rev=30575=rev
Log:
Europe 1901: standardize AI skill level

Some players had the AI skill level Normal. Others used the global AI skill
level. It was set to Hard. Standardize on Hard.

See bug #23983

Modified:
branches/S2_6/data/scenarios/europe_1901.sav

Modified: branches/S2_6/data/scenarios/europe_1901.sav
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/data/scenarios/europe_1901.sav?rev=30575=30574=30575=diff
==
--- branches/S2_6/data/scenarios/europe_1901.sav(original)
+++ branches/S2_6/data/scenarios/europe_1901.savThu Nov 12 15:58:29 2015
@@ -1825,7 +1825,7 @@
 4,-1,5,0,0,0,0,0
 0,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=3090
 rates.tax=40
@@ -3478,7 +3478,7 @@
 0,-1,5,0,0,0,0,0
 1,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=4048
 rates.tax=50
@@ -5250,7 +5250,7 @@
 1,-1,5,0,0,0,0,0
 2,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=3887
 rates.tax=40
@@ -6950,7 +6950,7 @@
 2,-1,5,0,0,0,0,0
 3,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=3560
 rates.tax=40
@@ -8711,7 +8711,7 @@
 3,-1,5,0,0,0,0,0
 4,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=2840
 rates.tax=40
@@ -10548,7 +10548,7 @@
 4,-1,5,0,0,0,0,0
 0,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=2180
 rates.tax=40
@@ -12188,7 +12188,7 @@
 0,-1,5,0,0,0,0,0
 1,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=2200
 rates.tax=40
@@ -13846,7 +13846,7 @@
 1,-1,5,0,0,0,0,0
 2,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=2010
 rates.tax=40
@@ -15465,7 +15465,7 @@
 2,-1,5,0,0,0,0,0
 3,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=1510
 rates.tax=40
@@ -17044,7 +17044,7 @@
 3,-1,5,0,0,0,0,0
 4,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=1660
 rates.tax=40
@@ -18650,7 +18650,7 @@
 4,-1,5,0,0,0,0,0
 0,-1,5,0,0,0,0,0
 }
-ai.skill_level=5
+ai.skill_level=7
 ai.is_barbarian=0
 gold=1890
 rates.tax=40


___
Freeciv-commits mailing list
Freeciv-commits@gna.org
https://mail.gna.org/listinfo/freeciv-commits