Author: mir3x
Date: Sun Feb 14 09:50:11 2016
New Revision: 31914

URL: http://svn.gna.org/viewcvs/freeciv?rev=31914&view=rev
Log:
Renamed Auto Settler to Auto Worker - for non settlers units. 
Fixed "go and build city" enabled for workers. 
Fixed "revolution" enabled for observers. 
Fixed "tax rates" enabled for observers. 

See bug #24396


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

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=31914&r1=31913&r2=31914&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/menu.cpp        (original)
+++ branches/S2_5/client/gui-qt/menu.cpp        Sun Feb 14 09:50:11 2016
@@ -196,15 +196,16 @@
   gov_mapper->deleteLater();
   gov_mapper = new QSignalMapper();
 
+  gov_count = government_count();
+  actions.reserve(gov_count + 1);
   action = addAction(_("Revolution..."));
   connect(action, &QAction::triggered, this, &gov_menu::revolution);
+  actions.append(action);
 
   addSeparator();
 
   // Add an action for each government. There is no icon yet.
-  gov_count = government_count();
   revol_gov = game.government_during_revolution;
-  actions.reserve(gov_count);
   for (i = 0; i < gov_count; ++i) {
     gov = government_by_number(i);
     if (gov != revol_gov) { // Skip revolution goverment
@@ -235,11 +236,13 @@
     if (gov != revol_gov) { // Skip revolution goverment
       sprite = get_government_sprite(tileset, gov);
       if (sprite != NULL) {
-        actions[j]->setIcon(QIcon(*(sprite->pm)));
+        actions[j + 1]->setIcon(QIcon(*(sprite->pm)));
       }
-      actions[j]->setEnabled(
-          can_change_to_government(client.conn.playing, gov));
+      actions[j + 1]->setEnabled(
+        can_change_to_government(client.conn.playing, gov));
       ++j;
+    } else {
+      actions[0]->setEnabled(!client_is_observer());
     }
   }
 }
@@ -715,7 +718,7 @@
   menu_list.insertMulti(BUILD, act);
   connect(act, SIGNAL(triggered()), this, SLOT(slot_build_city()));
   act = menu->addAction(_("Go And Build City"));
-  menu_list.insertMulti(AUTOSETTLER, act);
+  menu_list.insertMulti(GO_AND_BUILD_CITY, act);
   act->setShortcut(QKeySequence(tr("shift+b")));
   connect(act, SIGNAL(triggered()), this, SLOT(slot_go_build_city()));
   act = menu->addAction(_("Auto Settler"));
@@ -773,6 +776,7 @@
   /* Civilization menu */
   menu = this->addMenu(_("Civilization"));
   act = menu->addAction(_("Tax Rates..."));
+  menu_list.insertMulti(NOT_4_OBS, act);
   connect(act, SIGNAL(triggered()), this, SLOT(slot_popup_tax_rates()));
   menu->addSeparator();
 
@@ -979,6 +983,10 @@
           i.value()->setEnabled(true);
         }
         break;
+      case NOT_4_OBS:
+        if (client_is_observer() == false) {
+          i.value()->setEnabled(true);
+        }
       default:
         break;
       }
@@ -1202,8 +1210,17 @@
         if (can_units_do(punits, can_unit_do_autosettlers)) {
           i.value()->setEnabled(true);
         }
-        break;
-
+        if (units_have_type_flag(punits, UTYF_CITIES, true)) {
+          i.value()->setText(_("Auto Settler"));
+        } else {
+          i.value()->setText(_("Auto Worker"));
+        }
+        break;
+      case GO_AND_BUILD_CITY:
+        if (units_have_type_flag(punits, UTYF_CITIES, TRUE)) {
+          i.value()->setEnabled(true);
+        }
+        break;
       case CONNECT_ROAD:
         proad = road_by_compat_special(ROCO_ROAD);
         if (proad != NULL) {

Modified: branches/S2_5/client/gui-qt/menu.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.h?rev=31914&r1=31913&r2=31914&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/menu.h  (original)
+++ branches/S2_5/client/gui-qt/menu.h  Sun Feb 14 09:50:11 2016
@@ -34,8 +34,8 @@
 class QSignalMapper;
 class QScrollArea;
 
-/** used for indicating menu about current option - for renaming 
- * and enabling disbaling */
+/** used for indicating menu about current option - for renaming
+ * and enabling, disabling */
 enum munit {
   STANDARD,
   EXPLORE,
@@ -68,6 +68,8 @@
   ORDER_DIPLOMAT_DLG,
   NUKE,
   UPGRADE,
+  GO_AND_BUILD_CITY,
+  NOT_4_OBS,
   SAVE
 };
 


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

Reply via email to