|
From: <xer...@us...> - 2026-07-24 02:39:28
|
Revision: 1678
http://sourceforge.net/p/seq/svn/1678
Author: xerxes00
Date: 2026-07-24 02:39:26 +0000 (Fri, 24 Jul 2026)
Log Message:
-----------
Add NPC display-name option; fix spawn-list self/pet/zone bugs
NPC Display Name feature
- New Options submenu "NPC Display Name" with a tri-state radio, saved as
[SpawnList] NpcNameDisplay; replaces the old showRealName bool:
- Transformed (default): stripped and article-reordered for name
sorting, e.g. "a_Giant_Spider00" -> "Giant Spider, a".
- Cleaned: digits and underscores removed, article left in place,
e.g. "a_Giant_Spider00" -> "a Giant Spider".
- Unstripped: the raw wire name, e.g. "a_Giant_Spider00".
- Shared name helpers in spawn.cpp (cleanSpawnName/transformSpawnName/
npcDisplayName) and Item::displayName(); applied at render across the
spawn list, spawn list 2, spawn point list (Name+Last), spawn detail
view, map hover tooltips, and the spawn message-log line. Toggling
refreshes the open windows in place (selection, scroll, sort, and tree
expansion preserved).
Display vs filters (decoupled)
- The option only changes the name TEXT shown in the windows. Filter
matching is unaffected: it still runs on filterString()/filterFlags()
(built from transformedName()), independent of the display option, so
the same spawns are caught/filtered/alerted regardless of which name
form is displayed. Map aggro and filter notifications likewise still
match on transformedName(). No filter files need to change.
Bug fixes surfaced along the way
- seqwindow: fall back to the default caption when the saved one is empty
(fixes the blank spawn point window title).
- spawnlist: fix the File -> Rebuild SpawnList menu action. It was
rebuilding the list but dropping most spawns and leaving every category
count at 0 (an internal category iterator wasn't being reset between
spawns). A rebuild now repopulates every category correctly.
- spawnlist: self-player now added to the tree (the shell announces it
via changeItem, not addItem).
- spawnlist: re-parent pets under an owner added after them (pets were
stranded at top level; fixes pet not nesting under the player).
- spawnlist clear(): preserve category expansion across a zone.
- seqdef.xml: SpawnPointList font matched to the spawn lists.
Modified Paths:
--------------
showeq/branches/xerxes-trunk-dev/conf/seqdef.xml
showeq/branches/xerxes-trunk-dev/src/interface.cpp
showeq/branches/xerxes-trunk-dev/src/interface.h
showeq/branches/xerxes-trunk-dev/src/main.cpp
showeq/branches/xerxes-trunk-dev/src/main.h
showeq/branches/xerxes-trunk-dev/src/map.cpp
showeq/branches/xerxes-trunk-dev/src/messageshell.cpp
showeq/branches/xerxes-trunk-dev/src/seqwindow.cpp
showeq/branches/xerxes-trunk-dev/src/showspawn.cpp
showeq/branches/xerxes-trunk-dev/src/spawn.cpp
showeq/branches/xerxes-trunk-dev/src/spawn.h
showeq/branches/xerxes-trunk-dev/src/spawnlist.cpp
showeq/branches/xerxes-trunk-dev/src/spawnlist.h
showeq/branches/xerxes-trunk-dev/src/spawnlist2.cpp
showeq/branches/xerxes-trunk-dev/src/spawnlist2.h
showeq/branches/xerxes-trunk-dev/src/spawnlistcommon.cpp
showeq/branches/xerxes-trunk-dev/src/spawnpointlist.cpp
Modified: showeq/branches/xerxes-trunk-dev/conf/seqdef.xml
===================================================================
--- showeq/branches/xerxes-trunk-dev/conf/seqdef.xml 2026-07-23 02:45:49 UTC (rev 1677)
+++ showeq/branches/xerxes-trunk-dev/conf/seqdef.xml 2026-07-24 02:39:26 UTC (rev 1678)
@@ -3185,7 +3185,7 @@
<!-- ============================================================= -->
<section name="SpawnPointList" >
<property name="Font" >
- <font family="Helvetica" bold="false" strikeout="false" underline="false" pointsize="8" italic="false" />
+ <font family="adobe-helvetica" bold="false" strikeout="false" underline="false" pointsize="8" italic="false" />
</property>
<property name="ShowCoord1" >
<bool value="true" />
Modified: showeq/branches/xerxes-trunk-dev/src/interface.cpp
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/interface.cpp 2026-07-23 02:45:49 UTC (rev 1677)
+++ showeq/branches/xerxes-trunk-dev/src/interface.cpp 2026-07-24 02:39:26 UTC (rev 1678)
@@ -1801,6 +1801,32 @@
m_action_opt_KeepSelectedVisible->setCheckable(true);
m_action_opt_KeepSelectedVisible->setChecked(showeq_params->keep_selected_visible);
+ // NPC Display Name submenu - how NPC names render in the spawn lists,
+ // spawn point list, and spawn detail view (does not affect filtering)
+ QMenu* pNpcNameMenu = pOptMenu->addMenu("NPC Display Name");
+ m_actionGroup_npcNameDisplay = new QActionGroup(this);
+ m_actionGroup_npcNameDisplay->setExclusive(true);
+ m_action_npcName_transformed = pNpcNameMenu->addAction("Show NPC Transformed Name");
+ m_action_npcName_transformed->setCheckable(true);
+ m_action_npcName_transformed->setData(tNpcNameTransformed);
+ m_actionGroup_npcNameDisplay->addAction(m_action_npcName_transformed);
+ m_action_npcName_cleaned = pNpcNameMenu->addAction("Show NPC Cleaned Name");
+ m_action_npcName_cleaned->setCheckable(true);
+ m_action_npcName_cleaned->setData(tNpcNameCleaned);
+ m_actionGroup_npcNameDisplay->addAction(m_action_npcName_cleaned);
+ m_action_npcName_unstripped = pNpcNameMenu->addAction("Show NPC Unstripped Name");
+ m_action_npcName_unstripped->setCheckable(true);
+ m_action_npcName_unstripped->setData(tNpcNameUnstripped);
+ m_actionGroup_npcNameDisplay->addAction(m_action_npcName_unstripped);
+ switch (showeq_params->npcNameDisplay)
+ {
+ case tNpcNameCleaned: m_action_npcName_cleaned->setChecked(true); break;
+ case tNpcNameUnstripped: m_action_npcName_unstripped->setChecked(true); break;
+ default: m_action_npcName_transformed->setChecked(true); break;
+ }
+ connect(m_actionGroup_npcNameDisplay, SIGNAL(triggered(QAction*)),
+ this, SLOT(select_opt_NpcNameDisplay(QAction*)));
+
m_action_opt_LogSpawns = pOptMenu->addAction("Log Spawns", this,
SLOT(toggle_opt_LogSpawns()));
m_action_opt_LogSpawns->setCheckable(true);
@@ -4043,6 +4069,28 @@
}
void
+EQInterface::select_opt_NpcNameDisplay (QAction* action)
+{
+ if (action == 0)
+ return;
+
+ showeq_params->npcNameDisplay = (uint8_t)action->data().toInt();
+ pSEQPrefs->setPrefInt("NpcNameDisplay", "SpawnList",
+ showeq_params->npcNameDisplay);
+
+ // redraw the affected windows so the new form shows immediately. The
+ // category tree is refreshed in place so it keeps its expansion state;
+ // spawn list 2 is a flat list (nothing to collapse) so it rebuilds; the
+ // point list re-runs its row update.
+ if (m_spawnList != 0)
+ m_spawnList->spawnList()->refreshItemNames();
+ if (m_spawnList2 != 0)
+ m_spawnList2->refreshItemNames();
+ if (m_spawnPointList != 0)
+ m_spawnPointList->spawnPointList()->refresh();
+}
+
+void
EQInterface::toggle_opt_UseUpdateRadius (void)
{
showeq_params->useUpdateRadius = !(showeq_params->useUpdateRadius);
Modified: showeq/branches/xerxes-trunk-dev/src/interface.h
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/interface.h 2026-07-23 02:45:49 UTC (rev 1677)
+++ showeq/branches/xerxes-trunk-dev/src/interface.h 2026-07-24 02:39:26 UTC (rev 1678)
@@ -263,6 +263,7 @@
void toggle_opt_TarSelect();
void toggle_opt_TarDeselect();
void toggle_opt_KeepSelectedVisible();
+ void select_opt_NpcNameDisplay(QAction* action);
void toggle_opt_LogSpawns();
void toggle_opt_PvPTeams();
void toggle_opt_PvPDeity();
@@ -506,6 +507,10 @@
QAction* m_action_opt_TarSelect;
QAction* m_action_opt_TarDeselect;
QAction* m_action_opt_KeepSelectedVisible;
+ QActionGroup* m_actionGroup_npcNameDisplay;
+ QAction* m_action_npcName_transformed;
+ QAction* m_action_npcName_cleaned;
+ QAction* m_action_npcName_unstripped;
QAction* m_action_opt_LogSpawns;
QAction* m_action_opt_PvPTeams;
QAction* m_action_opt_PvPDeity;
Modified: showeq/branches/xerxes-trunk-dev/src/main.cpp
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/main.cpp 2026-07-23 02:45:49 UTC (rev 1677)
+++ showeq/branches/xerxes-trunk-dev/src/main.cpp 2026-07-24 02:39:26 UTC (rev 1678)
@@ -274,7 +274,7 @@
/* Tells SEQ whether or not to display casting messages (Turn this off if you're on a big raid) */
section = "SpawnList";
- showeq_params->showRealName = pSEQPrefs->getPrefBool("ShowRealName", section, false);
+ showeq_params->npcNameDisplay = (uint8_t)pSEQPrefs->getPrefInt("NpcNameDisplay", section, tNpcNameTransformed);
/* Different files for different kinds of raw data */
Modified: showeq/branches/xerxes-trunk-dev/src/main.h
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/main.h 2026-07-23 02:45:49 UTC (rev 1677)
+++ showeq/branches/xerxes-trunk-dev/src/main.h 2026-07-24 02:39:26 UTC (rev 1678)
@@ -37,6 +37,15 @@
#include "config.h"
//----------------------------------------------------------------------
+// how NPC names are shown in the spawn/spawn-point lists and the spawn
+// detail view (does not affect filter matching)
+enum NpcNameDisplay
+{
+ tNpcNameTransformed = 0, // "giant spider, a" (stripped + article reordered)
+ tNpcNameCleaned = 1, // "a giant spider" (stripped, article in place)
+ tNpcNameUnstripped = 2, // "a_giant_spider15" (raw wire name)
+};
+
// bogus structure that should die soon
struct ShowEQParams
{
@@ -49,8 +58,8 @@
bool walkpathrecord;
uint32_t walkpathlength;
bool systime_spawntime;
- bool showRealName;
-
+ uint8_t npcNameDisplay; // one of enum NpcNameDisplay
+
bool saveZoneState;
bool savePlayerState;
bool saveSpawns;
Modified: showeq/branches/xerxes-trunk-dev/src/map.cpp
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/map.cpp 2026-07-23 02:45:49 UTC (rev 1677)
+++ showeq/branches/xerxes-trunk-dev/src/map.cpp 2026-07-24 02:39:26 UTC (rev 1678)
@@ -4421,12 +4421,12 @@
"%.3s/Z: %5d/%5d/%5d\n"
"Last: %s\n"
"Spawned: %s\t Remaining: %s\t Count: %d",
- sp->name().toLatin1().data(),
+ npcDisplayName(sp->name(), showeq_params->npcNameDisplay).toLatin1().data(),
showeq_params->retarded_coords ? "Y/X" : "X/Y",
showeq_params->retarded_coords ? sp->y() : sp->x(),
showeq_params->retarded_coords ? sp->x() : sp->y(),
sp->z(),
- sp->last().toLatin1().data(),
+ npcDisplayName(sp->last(), showeq_params->npcNameDisplay).toLatin1().data(),
spawned.toLatin1().data(),
remaining.toLatin1().data(),
sp->count());
@@ -4435,12 +4435,12 @@
"%.3s/Z: %5d/%5d/%5d\n"
"Last: %s\n"
"Spawned: %s\t Remaining: %s\t Count: %d",
- sp->name().toLatin1().data(),
+ npcDisplayName(sp->name(), showeq_params->npcNameDisplay).toLatin1().data(),
showeq_params->retarded_coords ? "Y/X" : "X/Y",
showeq_params->retarded_coords ? sp->y() : sp->x(),
showeq_params->retarded_coords ? sp->x() : sp->y(),
sp->z(),
- sp->last().toLatin1().data(),
+ npcDisplayName(sp->last(), showeq_params->npcNameDisplay).toLatin1().data(),
spawned.toLatin1().data(),
remaining.toLatin1().data(),
sp->count());
@@ -4502,7 +4502,7 @@
string = QString::asprintf("%s %s%s\n"
"Level: %2d\tHP: %s\t %.3s/Z: %5d/%5d/%5d\n"
"Race: %s\t Class: %s",
- spawn->transformedName().toUtf8().data(),
+ spawn->displayName().toUtf8().data(),
lastName.toUtf8().data(),
guild.toLatin1().data(),
spawn->level(), hp.toLatin1().data(),
@@ -4516,7 +4516,7 @@
string.sprintf("%s %s%s\n"
"Level: %2d\tHP: %s\t %.3s/Z: %5d/%5d/%5d\n"
"Race: %s\t Class: %s",
- spawn->transformedName().toUtf8().data(),
+ spawn->displayName().toUtf8().data(),
lastName.toUtf8().data(),
guild.toLatin1().data(),
spawn->level(), hp.toLatin1().data(),
@@ -4543,7 +4543,7 @@
string = QString::asprintf("%s\n"
"%.3s/Z: %5d/%5d/%5d\n"
"Race: %s\t Class: %s",
- item->transformedName().toUtf8().data(),
+ item->displayName().toUtf8().data(),
showeq_params->retarded_coords ? "Y/X" : "X/Y",
showeq_params->retarded_coords ? item->y() : item->x(),
showeq_params->retarded_coords ? item->x() : item->y(),
@@ -4554,7 +4554,7 @@
string.sprintf("%s\n"
"%.3s/Z: %5d/%5d/%5d\n"
"Race: %s\t Class: %s",
- item->transformedName().toUtf8().data(),
+ item->displayName().toUtf8().data(),
showeq_params->retarded_coords ? "Y/X" : "X/Y",
showeq_params->retarded_coords ? item->y() : item->x(),
showeq_params->retarded_coords ? item->x() : item->y(),
Modified: showeq/branches/xerxes-trunk-dev/src/messageshell.cpp
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/messageshell.cpp 2026-07-23 02:45:49 UTC (rev 1677)
+++ showeq/branches/xerxes-trunk-dev/src/messageshell.cpp 2026-07-24 02:39:26 UTC (rev 1678)
@@ -1661,7 +1661,7 @@
else
message = "%1: %2/%3/%4 at %6,%5,%7%8";
- m_messages->addMessage(type, message.arg(prefix).arg(item->transformedName())
+ m_messages->addMessage(type, message.arg(prefix).arg(item->displayName())
.arg(item->raceString()).arg(item->classString())
.arg(item->x()).arg(item->y()).arg(item->z())
.arg(spawnInfo));
Modified: showeq/branches/xerxes-trunk-dev/src/seqwindow.cpp
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/seqwindow.cpp 2026-07-23 02:45:49 UTC (rev 1677)
+++ showeq/branches/xerxes-trunk-dev/src/seqwindow.cpp 2026-07-24 02:39:26 UTC (rev 1678)
@@ -39,9 +39,13 @@
{
setObjectName(name);
setWindowFlags(f);
- // set the windows caption
- QDockWidget::setWindowTitle(pSEQPrefs->getPrefString("Caption", preferenceName(),
- caption));
+ // set the windows caption - fall back to the passed-in default when the
+ // saved caption is empty (an empty stored value should never blank the title)
+ QString savedCaption = pSEQPrefs->getPrefString("Caption", preferenceName(),
+ caption);
+ if (savedCaption.isEmpty())
+ savedCaption = caption;
+ QDockWidget::setWindowTitle(savedCaption);
setFeatures(QDockWidget::DockWidgetClosable |
QDockWidget::DockWidgetMovable |
Modified: showeq/branches/xerxes-trunk-dev/src/showspawn.cpp
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/showspawn.cpp 2026-07-23 02:45:49 UTC (rev 1677)
+++ showeq/branches/xerxes-trunk-dev/src/showspawn.cpp 2026-07-24 02:39:26 UTC (rev 1678)
@@ -245,7 +245,7 @@
// display the data
out << "<H1>" << spawn.realName() << "</H1>\n";
- out << "<P>ShortName: " << spawn.transformedName() << "<BR>\n";
+ out << "<P>ShortName: " << spawn.displayName() << "<BR>\n";
out << "Level: " << spawn.level() << "<BR>\n";
out << "HP: " << spawn.HP() << "/"
<< spawn.maxHP() << "<BR>\n";
Modified: showeq/branches/xerxes-trunk-dev/src/spawn.cpp
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/spawn.cpp 2026-07-23 02:45:49 UTC (rev 1677)
+++ showeq/branches/xerxes-trunk-dev/src/spawn.cpp 2026-07-24 02:39:26 UTC (rev 1678)
@@ -42,6 +42,7 @@
#include "spawnshell.h"
#include "fixpt.h"
#include "util.h"
+#include "main.h"
//----------------------------------------------------------------------
// constants
@@ -272,6 +273,74 @@
return name();
}
+QString Item::cleanedName() const
+{
+ return name();
+}
+
+QString Item::displayName() const
+{
+ // resolve through the virtual name methods so spawns get their stripped
+ // forms while non-spawn items (doors/drops) stay on their raw name
+ switch (showeq_params->npcNameDisplay)
+ {
+ case tNpcNameCleaned: return cleanedName();
+ case tNpcNameUnstripped: return name();
+ default: return transformedName();
+ }
+}
+
+//----------------------------------------------------------------------
+// NPC name normalization helpers (see spawn.h)
+QString cleanSpawnName(const QString& rawName)
+{
+ QString newName = rawName;
+ newName.replace(QRegExp("[0-9]"), "");
+ newName.replace(QRegExp("_"), " ");
+ return newName;
+}
+
+QString transformSpawnName(const QString& rawName)
+{
+ QString temp = cleanSpawnName(rawName);
+ QString article;
+
+ if (temp.startsWith("a "))
+ {
+ temp = temp.mid(2);
+ article = "a";
+ }
+ else if (temp.startsWith("an "))
+ {
+ temp = temp.mid(3);
+ article = "an";
+ }
+ else if (temp.startsWith("the "))
+ {
+ temp = temp.mid(4);
+ article = "the";
+ }
+
+ if (!article.isEmpty())
+ {
+ temp += ", ";
+ temp += article;
+ }
+
+ return temp;
+}
+
+QString npcDisplayName(const QString& rawName, int mode)
+{
+ // mode values mirror enum NpcNameDisplay in main.h
+ switch (mode)
+ {
+ case 1: return cleanSpawnName(rawName); // tNpcNameCleaned
+ case 2: return rawName; // tNpcNameUnstripped
+ default: return transformSpawnName(rawName); // tNpcNameTransformed
+ }
+}
+
uint16_t Item::race() const
{
return 0;
@@ -833,40 +902,12 @@
QString Spawn::cleanedName() const
{
- QString newName = name();
- newName.replace(QRegExp("[0-9]"), "");
- newName.replace(QRegExp("_"), " ");
- return newName;
+ return cleanSpawnName(name());
}
QString Spawn::transformedName() const
{
- QString temp = cleanedName();
- QString article;
-
- if (temp.startsWith( "a " ))
- {
- temp = temp.mid( 2 );
- article = "a";
- }
- else if (temp.startsWith( "an " ))
- {
- temp = temp.mid( 3 );
- article = "an";
- }
- else if (temp.startsWith( "the " ))
- {
- temp = temp.mid( 4 );
- article = "the";
- }
-
- if (!article.isEmpty())
- {
- temp += ", ";
- temp += article;
- }
-
- return temp;
+ return transformSpawnName(name());
}
uint16_t Spawn::race() const
Modified: showeq/branches/xerxes-trunk-dev/src/spawn.h
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/spawn.h 2026-07-23 02:45:49 UTC (rev 1677)
+++ showeq/branches/xerxes-trunk-dev/src/spawn.h 2026-07-24 02:39:26 UTC (rev 1678)
@@ -57,6 +57,17 @@
struct doorStruct;
//----------------------------------------------------------------------
+// NPC name normalization helpers (shared by Spawn, SpawnPoint, and the
+// spawn detail view). All operate on the raw wire name.
+// cleanSpawnName: strip trailing spawn digits, turn '_' into ' '
+// transformSpawnName: cleanSpawnName, then move a leading a/an/the article
+// to the end (for name-sorted lists)
+// npcDisplayName: pick a form by NpcNameDisplay mode (see main.h)
+QString cleanSpawnName(const QString& rawName);
+QString transformSpawnName(const QString& rawName);
+QString npcDisplayName(const QString& rawName, int mode);
+
+//----------------------------------------------------------------------
// enumerated types
// type of item
enum spawnItemType
@@ -153,6 +164,11 @@
// virtual methods that provide reasonable default values/behaviour
virtual QString name() const;
virtual QString transformedName() const;
+ virtual QString cleanedName() const;
+ // the name to show in the UI, resolved from the NPC display-name option.
+ // Non-spawn items keep their raw name in every mode (their transformed/
+ // cleaned forms both return name()).
+ QString displayName() const;
virtual uint16_t race() const;
virtual QString raceString() const;
virtual uint8_t classVal() const;
Modified: showeq/branches/xerxes-trunk-dev/src/spawnlist.cpp
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/spawnlist.cpp 2026-07-23 02:45:49 UTC (rev 1677)
+++ showeq/branches/xerxes-trunk-dev/src/spawnlist.cpp 2026-07-24 02:39:26 UTC (rev 1678)
@@ -50,6 +50,8 @@
#include <cmath>
#include <regex.h>
#include <QMenu>
+#include <QScrollBar>
+#include <QSet>
#include <QApplication>
// ------------------------------------------------------
@@ -198,6 +200,17 @@
SEQListViewItemIterator it(this);
SpawnListItem *i = Find(it, item);
+
+ // if the item isn't in the tree yet, add it. The self-player is announced
+ // by the spawn shell via changeItem (not addItem), so without this it would
+ // never appear in the spawn list (it does appear in spawn list 2, which
+ // adds-on-change).
+ if (i == NULL)
+ {
+ addItem(item);
+ return;
+ }
+
while (i)
{
// reinsert only if level, NPC or filterFlags changes
@@ -442,6 +455,31 @@
j->update(m_player, tSpawnChangedALL);
} // else
+ // If this item can own pets (it's a spawn/player that is not itself a pet),
+ // re-parent any of its pets that were added before it. Pets added before
+ // their owner appeared went to the top level and never nested; now that the
+ // owner exists, re-add them so they nest. Covers the self-player, whose pet
+ // is often present before the player row is created.
+ if ((spawn != NULL) && (spawn->petOwnerID() == 0))
+ {
+ const ItemMap& spawnMap = m_spawnShell->getConstMap(tSpawn);
+ ItemConstIterator sit(spawnMap);
+ QList<const Item*> pets;
+ while (sit.hasNext())
+ {
+ sit.next();
+ const Item* s = sit.value();
+ if (s && (s->type() == tSpawn) &&
+ (((const Spawn*)s)->petOwnerID() == item->id()))
+ pets.append(s);
+ }
+ for (int p = 0; p < pets.count(); p++)
+ {
+ delItem(pets[p]);
+ addItem(pets[p]);
+ }
+ }
+
return;
} // end addItem
@@ -728,6 +766,15 @@
void SpawnList::clear(void)
{
//seqDebug("SpawnList::clear()");
+ // remember which categories are expanded so the tree keeps its expansion
+ // state across a rebuild (e.g. on zoning). Category pointers are stable
+ // across zones, so we key on them.
+ QSet<const void*> expanded;
+ QHash<void*, SpawnListItem*>::const_iterator eit;
+ for (eit = m_categoryListItems.begin(); eit != m_categoryListItems.end(); ++eit)
+ if (eit.value() && eit.value()->isExpanded())
+ expanded.insert(eit.key());
+
SEQListView::clear();
m_categoryListItems.clear();
@@ -752,6 +799,10 @@
// update count
litem->updateTitle(cat->name());
+
+ // restore prior expansion state
+ if (expanded.contains((void*)cat))
+ litem->setExpanded(true);
}
} // end clear
@@ -834,6 +885,36 @@
repaint();
}
+// Re-set the displayed name on every spawn row in place. Used when the NPC
+// display-name option changes - avoids a full rebuild so the category tree
+// keeps its expansion and selection state.
+void SpawnList::refreshItemNames()
+{
+ // suspend sorting while renaming: changing a row's name re-sorts the tree,
+ // which would move rows out from under the live iterator (visited twice or
+ // skipped, leaving a mix of old and new names). Re-sort once at the end.
+ bool wasSorting = isSortingEnabled();
+ setSortingEnabled(false);
+
+ // remember the scroll position so the view does not snap when the re-sort
+ // moves rows around (names change their sort key)
+ int scrollPos = verticalScrollBar()->value();
+
+ SEQListViewItemIterator it(this);
+ while (*it)
+ {
+ SpawnListItem* slitem = (SpawnListItem*)*it;
+ // skip category header rows (they have no backing item)
+ if (slitem->item() != NULL)
+ slitem->update(m_player, tSpawnChangedName);
+ ++it;
+ }
+
+ // re-enable sorting, which resorts by the current sort column/order
+ setSortingEnabled(wasSorting);
+ verticalScrollBar()->setValue(scrollPos);
+}
+
void SpawnList::playerLevelChanged(uint8_t)
{
SEQListViewItemIterator it(this);
@@ -984,6 +1065,10 @@
// retrieve the filter string
filterStr = filterString(item, flags);
+ // reset the category iterator for this spawn (it is shared across
+ // the whole populate, so it must be rewound before each spawn)
+ cit.toFront();
+
// iterate over all the categories
while (cit.hasNext())
{
@@ -1020,8 +1105,9 @@
}
}
- // done adding items, now iterate over all the categories and
+ // done adding items, now iterate over all the categories and
// update the counts
+ cit.toFront();
while (cit.hasNext())
{
cat = cit.next();
Modified: showeq/branches/xerxes-trunk-dev/src/spawnlist.h
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/spawnlist.h 2026-07-23 02:45:49 UTC (rev 1677)
+++ showeq/branches/xerxes-trunk-dev/src/spawnlist.h 2026-07-24 02:39:26 UTC (rev 1678)
@@ -118,6 +118,7 @@
void loadedCategories(void);
void rebuildSpawnList();
+ void refreshItemNames();
void playerLevelChanged(uint8_t);
void styleChanged();
Modified: showeq/branches/xerxes-trunk-dev/src/spawnlist2.cpp
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/spawnlist2.cpp 2026-07-23 02:45:49 UTC (rev 1677)
+++ showeq/branches/xerxes-trunk-dev/src/spawnlist2.cpp 2026-07-24 02:39:26 UTC (rev 1678)
@@ -28,6 +28,7 @@
#include "main.h"
#include <QComboBox>
+#include <QScrollBar>
#include <QSpinBox>
#include <QTimer>
#include <QLayout>
@@ -617,6 +618,32 @@
populateSpawns();
}
+// Re-set the displayed name on every visible row in place. Used when the NPC
+// display-name option changes - a full rebuild would clear the selection and
+// re-emit spawnSelected, hijacking the player's current target.
+void SpawnListWindow2::refreshItemNames(void)
+{
+ // suspend sorting while renaming so the live iterator is not disturbed
+ bool wasSorting = m_spawnList->isSortingEnabled();
+ m_spawnList->setSortingEnabled(false);
+
+ // remember the scroll position so the view does not snap when the re-sort
+ // moves rows around (names change their sort key)
+ int scrollPos = m_spawnList->verticalScrollBar()->value();
+
+ SEQListViewItemIterator it(m_spawnList);
+ while (*it)
+ {
+ SpawnListItem* slitem = (SpawnListItem*)*it;
+ if (slitem->item() != NULL)
+ slitem->update(m_player, tSpawnChangedName);
+ ++it;
+ }
+
+ m_spawnList->setSortingEnabled(wasSorting);
+ m_spawnList->verticalScrollBar()->setValue(scrollPos);
+}
+
void SpawnListWindow2::refresh(void)
{
#if 0 // ZBTEMP
Modified: showeq/branches/xerxes-trunk-dev/src/spawnlist2.h
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/spawnlist2.h 2026-07-23 02:45:49 UTC (rev 1677)
+++ showeq/branches/xerxes-trunk-dev/src/spawnlist2.h 2026-07-24 02:39:26 UTC (rev 1678)
@@ -89,6 +89,7 @@
int32_t degrees);
void rebuildSpawnList(void);
+ void refreshItemNames(void);
void refresh(void);
virtual void savePrefs(void);
Modified: showeq/branches/xerxes-trunk-dev/src/spawnlistcommon.cpp
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/spawnlistcommon.cpp 2026-07-23 02:45:49 UTC (rev 1677)
+++ showeq/branches/xerxes-trunk-dev/src/spawnlistcommon.cpp 2026-07-24 02:39:26 UTC (rev 1678)
@@ -183,11 +183,8 @@
if (changeType & tSpawnChangedName)
{
- // Name
- if (!showeq_params->showRealName)
- buff = item()->transformedName();
- else
- buff = item()->name();
+ // Name - honor the NPC display-name option (non-spawn items keep raw name)
+ buff = item()->displayName();
if (spawn != NULL)
{
Modified: showeq/branches/xerxes-trunk-dev/src/spawnpointlist.cpp
===================================================================
--- showeq/branches/xerxes-trunk-dev/src/spawnpointlist.cpp 2026-07-23 02:45:49 UTC (rev 1677)
+++ showeq/branches/xerxes-trunk-dev/src/spawnpointlist.cpp 2026-07-24 02:39:26 UTC (rev 1678)
@@ -87,8 +87,8 @@
setText(tSpawnPointRemaining, tmpStr);
// set the name and last spawn info
- setText(tSpawnPointName, m_spawnPoint->name());
- setText(tSpawnPointLast, m_spawnPoint->last());
+ setText(tSpawnPointName, npcDisplayName(m_spawnPoint->name(), showeq_params->npcNameDisplay));
+ setText(tSpawnPointLast, npcDisplayName(m_spawnPoint->last(), showeq_params->npcNameDisplay));
// construct and set the spawned string
QDateTime dateTime;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|