Author: mir3x
Date: Tue Dec  8 22:27:50 2015
New Revision: 30894

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

See patch #6652


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=30894&r1=30893&r2=30894&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/menu.cpp        (original)
+++ branches/S2_5/client/gui-qt/menu.cpp        Tue Dec  8 22:27:50 2015
@@ -156,6 +156,7 @@
 {
   full_hp = false;
   full_mp = false;
+  full_hp_mp = false;
   any = false;
 }
 
@@ -308,13 +309,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);
   }
 }
@@ -609,6 +617,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_5/client/gui-qt/menu.h
URL: 
http://svn.gna.org/viewcvs/freeciv/branches/S2_5/client/gui-qt/menu.h?rev=30894&r1=30893&r2=30894&view=diff
==============================================================================
--- branches/S2_5/client/gui-qt/menu.h  (original)
+++ branches/S2_5/client/gui-qt/menu.h  Tue Dec  8 22:27:50 2015
@@ -86,6 +86,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