|
From: <cn...@us...> - 2024-08-21 19:57:50
|
Revision: 1519
http://sourceforge.net/p/seq/svn/1519
Author: cn187
Date: 2024-08-21 19:57:47 +0000 (Wed, 21 Aug 2024)
Log Message:
-----------
Add option to deselect target if mob is untargeted
Modified Paths:
--------------
showeq/trunk/src/interface.cpp
showeq/trunk/src/interface.h
showeq/trunk/src/map.cpp
showeq/trunk/src/spawnlist.cpp
showeq/trunk/src/spawnlist2.cpp
Modified: showeq/trunk/src/interface.cpp
===================================================================
--- showeq/trunk/src/interface.cpp 2024-08-21 19:57:26 UTC (rev 1518)
+++ showeq/trunk/src/interface.cpp 2024-08-21 19:57:47 UTC (rev 1519)
@@ -171,6 +171,7 @@
m_selectOnConsider = pSEQPrefs->getPrefBool("SelectOnCon", section, false);
m_selectOnTarget = pSEQPrefs->getPrefBool("SelectOnTarget", section, false);
+ m_deselectOnUntarget = pSEQPrefs->getPrefBool("DeselectOnUntarget", section, false);
const char* player_classes[] = {"Warrior", "Cleric", "Paladin", "Ranger",
"Shadow Knight", "Druid", "Monk", "Bard",
@@ -1017,6 +1018,12 @@
m_action_opt_TarSelect->setCheckable(true);
m_action_opt_TarSelect->setChecked(m_selectOnTarget);
+ m_action_opt_TarDeselect = pOptMenu->addAction("Deselect on Untarget?", this,
+ SLOT(toggle_opt_TarDeselect()));
+ m_action_opt_TarDeselect->setCheckable(true);
+ m_action_opt_TarDeselect->setChecked(m_deselectOnUntarget);
+
+
m_action_opt_KeepSelectedVisible = pOptMenu->addAction("Keep Selected Visible?",
this, SLOT(toggle_opt_KeepSelectedVisible()));
m_action_opt_KeepSelectedVisible->setCheckable(true);
@@ -3829,6 +3836,14 @@
}
void
+EQInterface::toggle_opt_TarDeselect (void)
+{
+ m_deselectOnUntarget = !(m_deselectOnUntarget);
+ m_action_opt_TarDeselect->setChecked(m_deselectOnUntarget);
+ pSEQPrefs->setPrefBool("DeselectOnUntarget", "Interface", m_deselectOnUntarget);
+}
+
+void
EQInterface::toggle_opt_Fast (void)
{
showeq_params->fast_machine = !(showeq_params->fast_machine);
@@ -4888,11 +4903,20 @@
void EQInterface::clientTarget(const uint8_t* data)
{
+
+ const clientTargetStruct* cts = (const clientTargetStruct*)data;
+
+ if (cts->newTarget == 0 && m_deselectOnUntarget)
+ {
+ m_selectedSpawn = 0;
+ emit selectSpawn(m_selectedSpawn);
+ updateSelectedSpawnStatus(m_selectedSpawn);
+ return;
+ }
+
if (!m_selectOnTarget)
return;
- const clientTargetStruct* cts = (const clientTargetStruct*)data;
-
// try to find the targeted spawn in the spawn shell
const Item* item = m_spawnShell->findID(tSpawn, cts->newTarget);
@@ -4912,9 +4936,6 @@
void EQInterface::spawnSelected(const Item* item)
{
- if (item == 0)
- return;
-
// note the new selection
m_selectedSpawn = item;
@@ -4997,7 +5018,10 @@
void EQInterface::updateSelectedSpawnStatus(const Item* item)
{
if (item == 0)
+ {
+ stsMessage("");
return;
+ }
const Spawn* spawn = 0;
Modified: showeq/trunk/src/interface.h
===================================================================
--- showeq/trunk/src/interface.h 2024-08-21 19:57:26 UTC (rev 1518)
+++ showeq/trunk/src/interface.h 2024-08-21 19:57:47 UTC (rev 1519)
@@ -253,6 +253,7 @@
void toggle_view_CombatWindow();
void toggle_opt_ConSelect();
void toggle_opt_TarSelect();
+ void toggle_opt_TarDeselect();
void toggle_opt_KeepSelectedVisible();
void toggle_opt_LogSpawns();
void toggle_opt_PvPTeams();
@@ -477,6 +478,7 @@
QAction* m_action_view_SpawnList_Cols[tSpawnColMaxCols];
QAction* m_action_opt_ConSelect;
QAction* m_action_opt_TarSelect;
+ QAction* m_action_opt_TarDeselect;
QAction* m_action_opt_KeepSelectedVisible;
QAction* m_action_opt_LogSpawns;
QAction* m_action_opt_PvPTeams;
@@ -511,6 +513,7 @@
bool m_selectOnConsider;
bool m_selectOnTarget;
+ bool m_deselectOnUntarget;
bool m_useUpdateRadius;
};
Modified: showeq/trunk/src/map.cpp
===================================================================
--- showeq/trunk/src/map.cpp 2024-08-21 19:57:26 UTC (rev 1518)
+++ showeq/trunk/src/map.cpp 2024-08-21 19:57:47 UTC (rev 1519)
@@ -4572,10 +4572,6 @@
void Map::selectSpawn(const Item* item)
{
- // sanity check
- if (item == NULL)
- return;
-
/* seqDebug("%s", item->ID()); */
m_selectedItem = item;
Modified: showeq/trunk/src/spawnlist.cpp
===================================================================
--- showeq/trunk/src/spawnlist.cpp 2024-08-21 19:57:26 UTC (rev 1518)
+++ showeq/trunk/src/spawnlist.cpp 2024-08-21 19:57:47 UTC (rev 1519)
@@ -514,7 +514,10 @@
{
// seqDebug("SpawnList::selectSpawn(name=%s)", item->name().latin1());
if (item == NULL)
- return;
+ {
+ clearSelection();
+ return;
+ }
// start iterator at the beginning of this QListView
SEQListViewItemIterator it(this);
@@ -606,7 +609,7 @@
void SpawnList::setSelectedQuiet(SEQListViewItem* item, bool selected)
{
- if (!item || (item->isSelected() == selected ) ||
+ if ((item->isSelected() == selected ) ||
!(item->flags() & Qt::ItemIsSelectable))
return;
@@ -613,6 +616,12 @@
// get the old selection
SEQListViewItem *oldItem = currentItem();
+ if (!item)
+ {
+ clearSelection();
+ return;
+ }
+
// unselect the old selected item if any
if ((oldItem != item) && (oldItem != NULL) && (oldItem->isSelected()))
oldItem->setSelected(false);
Modified: showeq/trunk/src/spawnlist2.cpp
===================================================================
--- showeq/trunk/src/spawnlist2.cpp 2024-08-21 19:57:26 UTC (rev 1518)
+++ showeq/trunk/src/spawnlist2.cpp 2024-08-21 19:57:47 UTC (rev 1519)
@@ -416,7 +416,11 @@
void SpawnListWindow2::selectSpawn(const Item *item)
{
if (!item)
+ {
+ m_selectedItem = NULL;
+ m_spawnList->clearSelection();
return;
+ }
// cache the selected item
m_selectedItem = item;
@@ -896,12 +900,19 @@
void SpawnListWindow2::setSelectedQuiet(SEQListViewItem* item, bool selected)
{
- if (!item || (item->isSelected() == selected) )
+ if (item->isSelected() == selected)
return;
// get the old selection
SEQListViewItem *oldItem = m_spawnList->currentItem();
+ if (!item)
+ {
+ m_selectedItem = NULL;
+ m_spawnList->clearSelection();
+ return;
+ }
+
// unselect the old selected item if any
if ((oldItem != item) && (oldItem != NULL) && (oldItem->isSelected()))
oldItem->setSelected(false);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|