Author: mir3x
Date: Tue Dec  8 22:27:44 2015
New Revision: 30893

URL: http://svn.gna.org/viewcvs/freeciv?rev=30893&view=rev
Log:
Added option to filter units with maximum hitpoints 
and movement points in Qt-client.

See patch #6652


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

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=30893&r1=30892&r2=30893&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/menu.cpp        (original)
+++ branches/S2_6/client/gui-qt/menu.cpp        Tue Dec  8 22:27:44 2015
@@ -158,6 +158,7 @@
 {
   full_hp = false;
   full_mp = false;
+  full_hp_mp = false;
   any = false;
 }
 
@@ -310,13 +311,20 @@
 ****************************************************************************/
 void mr_menu::apply_2nd_filter(struct unit *punit)
 {
-  if (punit->hp == punit->utype->hp && u_filter.full_hp) {
+  if (punit->hp >= punit->utype->hp && u_filter.full_hp
+      && !u_filter.full_hp_mp) {
     unit_focus_add(punit);
   }
-  if (punit->moves_left  >= punit->utype->move_rate && u_filter.full_mp) {
+  if (punit->moves_left  >= punit->utype->move_rate && u_filter.full_mp
+      && !u_filter.full_hp_mp) {
     unit_focus_add(punit);
   }
-  if (u_filter.any){
+  if (punit->hp >= punit->utype->hp
+      && punit->moves_left  >= punit->utype->move_rate
+      && u_filter.full_hp_mp) {
+    unit_focus_add(punit);
+  }
+  if (u_filter.any) {
     unit_focus_add(punit);
   }
 }
@@ -616,6 +624,13 @@
   act->setData(qVariantFromValue((void *) &u_filter.full_mp));
   filter_any->addAction(act);
   connect(act, SIGNAL(triggered()), this, SLOT(slot_filter_other()));
+  act = filter_menu->addAction(_("Full HP and MP"));
+  act->setCheckable(true);
+  act->setChecked(u_filter.full_hp_mp);
+  act->setShortcut(QKeySequence(tr("ctrl+9")));
+  act->setData(qVariantFromValue((void *) &u_filter.full_hp_mp));
+  filter_any->addAction(act);
+  connect(act, SIGNAL(triggered()), this, SLOT(slot_filter_other()));
 
   /* Unit Menu */
   menu = this->addMenu(_("Unit"));

Modified: branches/S2_6/client/gui-qt/menu.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_6/client/gui-qt/menu.h?rev=30893&r1=30892&r2=30893&view=diff
==============================================================================
--- branches/S2_6/client/gui-qt/menu.h  (original)
+++ branches/S2_6/client/gui-qt/menu.h  Tue Dec  8 22:27:44 2015
@@ -87,6 +87,7 @@
   bool any;
   bool full_mp;
   bool full_hp;
+  bool full_hp_mp;
 };
 
 /**************************************************************************


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

Reply via email to