|
From: Chad M. <cmm...@us...> - 2005-05-28 03:55:30
|
Update of /cvsroot/seq/showeq/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17209/src Modified Files: Tag: pre_5_0_beta filter.cpp spawn.cpp Log Message: Made filters silently drop the # at the start of spawn names so that filters can be written without knowledge of whether there is a # in front of a name or not. Also made filters that have Name:# in them drop the # so that if old filters have the #name but the in game name has removed the #, the filters will still match. In short, filters ignore the # in front of names whether it comes from the filter file or from the spawn name. Index: spawn.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/spawn.cpp,v retrieving revision 1.31.6.4 retrieving revision 1.31.6.5 diff -u -d -r1.31.6.4 -r1.31.6.5 --- spawn.cpp 10 May 2005 17:01:33 -0000 1.31.6.4 +++ spawn.cpp 28 May 2005 03:55:21 -0000 1.31.6.5 @@ -860,10 +860,26 @@ QString Spawn::filterString() const { + QString name = transformedName(); + + // For the spawn name, remove the # off the front if it is there. This is + // because only some mobs have #, but there's no real rule to where it is + // there or not. To ease in filter writing, we just remove it before + // filtering, so you don't have to see the spawn in seq before writing a + // filter for it. + // + // If this turns out too slow, we could always cache the name without the # + // I guess, but transformedName already does string manipulation without + // caching, so what's another only if there's a # at the start *wink* + if (name.startsWith("#")) + { + name = name.mid(1); + } + QString buff; buff.sprintf("Name:%s:Level:%d:Race:%s:Class:%s:NPC:%d:X:%d:Y:%d:Z:%d:" "Light:%s:Deity:%s:RTeam:%d:DTeam:%d:Type:%s:LastName:%s:Guild:%s:", - (const char*)transformedName().utf8(), + (const char*)name.utf8(), level(), (const char*)raceString(), (const char*)classString(), Index: filter.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/filter.cpp,v retrieving revision 1.6.6.2 retrieving revision 1.6.6.3 diff -u -d -r1.6.6.2 -r1.6.6.3 --- filter.cpp 7 Nov 2004 23:10:03 -0000 1.6.6.2 +++ filter.cpp 28 May 2005 03:55:20 -0000 1.6.6.3 @@ -213,13 +213,13 @@ { if (m_maxLevel != m_minLevel) { - if ((level >= m_minLevel) && (level <= m_maxLevel)) - return true; // filter matched + if ((level >= m_minLevel) && (level <= m_maxLevel)) + return true; // filter matched } else { - if (level == m_minLevel) - return true; + if (level == m_minLevel) + return true; } } else @@ -331,17 +331,27 @@ { FilterItem* re; + // Take the # off the front of the filters. + // + // This is showeq specific, since EQ puts #'s in front of some + // special mobs, but without being in the zone, it's hard to tell what + // has a # and what doesn't. In order to ease in filter writing, just + // strip it off here, and we'll strip it off the spawn names before matching + // too. + QString fixedFilterPattern = filterPattern; + fixedFilterPattern.replace("Name:#", "Name:", false); + // no duplicates allowed - if (findFilter(filterPattern)) + if (findFilter(fixedFilterPattern)) return false; - re = new FilterItem(filterPattern, m_caseSensitive); + re = new FilterItem(fixedFilterPattern, m_caseSensitive); // append it to the end of the list m_filterItems.append(re); #ifdef DEBUG_FILTER - seqDebug("Added Filter '%s'", (const char*)filterPattern); + seqDebug("Added Filter '%s'", (const char*)fixedFilterPattern); #endif return re->valid(); @@ -352,18 +362,28 @@ { FilterItem* re; + // Take the # off the front of the filters for name. + // + // This is showeq specific, since EQ puts #'s in front of some + // special mobs, but without being in the zone, it's hard to tell what + // has a # and what doesn't. In order to ease in filter writing, just + // strip it off here, and we'll strip it off the spawn names before matching + // too. + QString fixedFilterPattern = filterPattern; + fixedFilterPattern.replace("Name:#", "Name:", false); + // no duplicates allowed - if (findFilter(filterPattern)) + if (findFilter(fixedFilterPattern)) return false; - re = new FilterItem(filterPattern, m_caseSensitive, minLevel, maxLevel); + re = new FilterItem(fixedFilterPattern, m_caseSensitive, minLevel, maxLevel); // append it to the end of the list m_filterItems.append(re); #ifdef DEBUG_FILTER seqDebug("Added Filter '%s' (%d, %d)", - (const char*)filterPattern, minLevel, maxLevel); + (const char*)fixedFilterPattern, minLevel, maxLevel); #endif return re->valid(); |