Update of /cvsroot/seq/showeq/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14505/src Modified Files: Makefile.am category.cpp classes.h combatlog.cpp combatlog.h compass.cpp compassframe.cpp crctab.h datetimemgr.cpp datetimemgr.h decode.h deity.h drawmap.cpp editor.cpp everquest.h experiencelog.cpp experiencelog.h filter.cpp filter.h filtermgr.cpp filtermgr.h fixpt.h group.cpp group.h guild.cpp guild.h interface.cpp interface.h itemdb.cpp itemdb.h itemdbtool.cpp languages.h logger.cpp main.cpp main.h map.cpp map.h mapcore.cpp mapcore.h netdiag.cpp packet.cpp packet.h packetcapture.cpp packetcapture.h packetcommon.h packetformat.cpp packetformat.h packetfragment.cpp packetfragment.h packetlog.cpp packetlog.h packetstream.cpp packetstream.h player.cpp player.h point.h races.h seqlistview.cpp seqwindow.cpp seqwindow.h skilllist.cpp skills.h spawn.cpp spawn.h spawnlist.cpp spawnlist.h spawnlist2.cpp spawnlist2.h spawnlistcommon.cpp spawnlistcommon.h spawnlog.cpp spawnlog.h spawnmonitor.cpp spawnmonitor.h spawnpointlist.cpp spawnpointlist.h spawnshell.cpp spawnshell.h spelllist.cpp spelllist.h spells.cpp spells.h spells_en2spellsh.pl spellshell.cpp spellshell.h staticspells.h statlist.cpp statlist.h typenames.h util.cpp util.h weapons.h weapons1.h weapons27.h weapons28.h weapons2b.h xmlconv.cpp xmlconv.h xmlpreferences.cpp xmlpreferences.h zonemgr.cpp zonemgr.h zones.h Added Files: bazaarlog.cpp bazaarlog.h datalocationmgr.cpp datalocationmgr.h diagnosticmessages.cpp diagnosticmessages.h diagnosticmessageslight.cpp eqstr.cpp eqstr.h filter2xml.pl filteredspawnlog.cpp filteredspawnlog.h filternotifications.cpp filternotifications.h guildlist.cpp guildlist.h guildshell.cpp guildshell.h h2info.pl mapicon.cpp mapicon.h mapicondialog.ui mapicondialog.ui.h message.cpp message.h messagefilter.cpp messagefilter.h messagefilterdialog.cpp messagefilterdialog.h messages.cpp messages.h messageshell.cpp messageshell.h messagewindow.cpp messagewindow.h netstream.cpp netstream.h packetinfo.cpp packetinfo.h pointarray.h terminal.cpp terminal.h weapons29.h weapons2a.h Removed Files: decode.cpp msgdlg.cpp msgdlg.h opcodes.h Log Message: Merged pre_5_0_beta down to the trunk. pre_5_0_beta should be treated as closed. All future development will occur on the branch. Updated version to 5.1.0.0 in preparation for new expansion release pending fixes for live compatibility. --- NEW FILE: pointarray.h --- /* * point.h * * ShowEQ Distributed under GPL * http://seq.sf.net/ */ // Original Author: Zaphod (do...@us...) // interfaces modeled after QPoint and QPointArray interface // but for 3D data of arbitraty type T. // // NOTE: Trying to keep this file ShowEQ/Everquest independent to allow it // to be reused for other Show{} style projects. // #ifndef __POINTARRAY_H_ #define __POINTARRAY_H_ #ifdef __FreeBSD__ #include "point.h" #include <sys/types.h> #else #include <stdint.h> #endif #include <qmemarray.h> #include <qpoint.h> // Point3DArray template <class _T> class Point3DArray : public QMemArray<Point3D<_T> > { public: Point3DArray() {}; Point3DArray(int size) : QMemArray<Point3D<_T> > (size) {} Point3DArray(const Point3DArray<_T>& array) : QMemArray<Point3D<_T> > (array) {} Point3DArray(uint32_t nPoints, const _T* points); ~Point3DArray() {}; Point3DArray<_T>& operator=(const Point3DArray<_T>& array) { return (Point3DArray<_T>&)assign(array); } Point3DArray<_T> copy() const { Point3DArray<_T> tmp; return *((Point3DArray<_T>*)&tmp.duplicate(*this)); } QRect boundingRect() const; void point(uint32_t i, _T* x, _T* y, _T* z) const; const Point3D<_T>& point( uint32_t i) const; void setPoint(uint32_t i, _T x, _T y, _T z); void setPoint(uint32_t i, const Point3D<_T>& p); bool setPoints(uint32_t nPoints, const _T* points); bool setPoints(uint32_t nPoints, _T firstx, _T firsty, _T firstz, ...); bool putPoints(uint32_t index, uint32_t nPoints, const _T* points); bool putPoints(uint32_t index, uint32_t nPoints, _T firstx, _T firsty, _T firstz, ...); QPointArray getQPointArray(); }; template <class _T> inline Point3DArray<_T>::Point3DArray(uint32_t nPoints, const _T* points) { setPoints(nPoints, points); } template <class _T> inline QRect Point3DArray<_T>::boundingRect() const { if (QMemArray<Point3D<_T> >::isEmpty()) return QRect(0, 0, 0, 0); Point3D<_T>* d = QMemArray<Point3D<_T> >::data(); _T minX, maxX, minY, maxY; minX = maxX = d->x(); minY = maxY = d->y(); uint32_t i; for (++d, i = 1; i < QMemArray<Point3D<_T> >::size(); i++, d++) { if (d->x() < minX) minX = d->x(); else if (d->x() > maxX) maxX = d->x(); if (d->y() < minY) minY = d->y(); else if (d->y() > maxY) maxY = d->y(); } return QRect(QPoint(minX, minY), QPoint(maxX, maxY)); } template <class _T> inline void Point3DArray<_T>::point(uint32_t index, _T* x, _T* y, _T* z) const { Point3D<_T> p = QMemArray<Point3D<_T> >::at(index); *x = p.x(); *y = p. y(); *z = p. z(); } template <class _T> inline const Point3D<_T>& Point3DArray<_T>::point(uint32_t index) const { return QMemArray<Point3D<_T> >::at(index); } template <class _T> inline void Point3DArray<_T>::setPoint(uint32_t index, _T x, _T y, _T z) { QMemArray<Point3D<_T> >::at(index) = Point3D<_T>(x, y, z); } template <class _T> inline void Point3DArray<_T>::setPoint(uint32_t index, const Point3D<_T>& p) { QMemArray<Point3D<_T> >::at(index) = p; } template <class _T> inline bool Point3DArray<_T>::setPoints(uint32_t nPoints, const _T* points) { if (!QMemArray<Point3D<_T> >::resize(nPoints)) return false; for (uint32_t i = 0; nPoints; nPoints--, i++, points += 3) setPoint(i, *points, *(points + 1), *(points + 2)); return true; } template <class _T> inline bool Point3DArray<_T>::setPoints(uint32_t nPoints, _T firstx, _T firsty, _T firstz, ...) { if (!QMemArray<Point3D<_T> >::resize(nPoints)) return false; setPoint( 0, firstx, firsty, firstz); va_list ap; va_start(ap, firstz); _T x, y, z; uint32_t i; for (i = 1, --nPoints; nPoints; nPoints--, i++) { x = va_arg(ap, _T); y = va_arg(ap, _T); z = va_arg(ap, _T); setPoint(i, x, y, z); } va_end(ap); return true; } template <class _T> inline bool Point3DArray<_T>::putPoints(uint32_t index, uint32_t nPoints, const _T* points) { if ((index + nPoints) > QMemArray<Point3D<_T> >::size()) if (!QMemArray<Point3D<_T> >::resize(index + nPoints)) return false; for (uint32_t i = index; nPoints; nPoints--, i++, points += 3) setPoint(i, *points, *(points + 1), *(points + 2)); return true; } template <class _T> inline bool Point3DArray<_T>::putPoints(uint32_t index, uint32_t nPoints, _T firstx, _T firsty, _T firstz, ...) { if ((index + nPoints) > QMemArray<Point3D<_T> >::size()) if (!QMemArray<Point3D<_T> >::resize(index + nPoints)) return false; setPoint( 0, firstx, firsty, firstz); va_list ap; va_start(ap, firstz); _T x, y, z; uint32_t i; for (i = index + 1, --nPoints; nPoints; nPoints--, i++) { x = va_arg(ap, _T); y = va_arg(ap, _T); z = va_arg(ap, _T); setPoint(i, x, y, z); } va_end(ap); return true; } template <class _T> inline QPointArray Point3DArray<_T>::getQPointArray() { // create a temporary QPointArray of the same size as this array QPointArray tmp(QMemArray<Point3D<_T> >::size()); // copy each Point3D<_T> as a QPoint into the temporary QPointArray for (uint32_t i = 0; i < QMemArray<Point3D<_T> >::size(); i++) tmp.setPoint(i, point(i).qpoint()); // return the temporary QPointArray return tmp; } #endif // __POINTARRAY_H_ --- NEW FILE: message.h --- /* * message.h * * ShowEQ Distributed under GPL * http://seq.sourceforge.net/ * * Copyright 2002-2003 Zaphod (do...@us...) * */ #ifndef _MESSAGE_H_ #define _MESSAGE_H_ #include <stdint.h> #include <qstring.h> #include <qdatetime.h> #include <qvaluevector.h> //---------------------------------------------------------------------- // constants const uint32_t ME_InvalidColor = 0x000000FF; //---------------------------------------------------------------------- // enumerated types enum MessageType { MT_Guild = 0, MT_Group = 2, MT_Shout = 3, MT_Auction = 4, MT_OOC = 5, MT_Tell = 7, MT_Say = 8, MT_GMSay = 11, MT_GMTell = 14, MT_Raid = 15, MT_Debug, MT_Info, MT_Warning, MT_General, MT_Motd, MT_System, MT_Money, MT_Random, MT_Emote, MT_Time, MT_Spell, MT_Zone, MT_Inspect, MT_Player, MT_Consider, MT_Alert, MT_Danger, MT_Caution, MT_Hunt, MT_Locate, MT_Max = MT_Locate, }; //---------------------------------------------------------------------- // MessageEntry class MessageEntry { public: MessageEntry(MessageType type, const QDateTime& dateTime, const QDateTime& eqDateTime, const QString& text, uint32_t color = ME_InvalidColor, uint32_t filterFlags = 0); MessageEntry(); ~MessageEntry(); MessageType type() const { return m_type; } const QDateTime& dateTime() const { return m_dateTime; } const QDateTime& eqDateTime() const { return m_eqDateTime; } const QString& text() const { return m_text; } const uint32_t color() const { return m_color; } uint32_t filterFlags() const { return m_filterFlags; } void setFilterFlags(uint32_t filterFlags) { m_filterFlags = filterFlags; } static const QString& messageTypeString(MessageType type); protected: MessageType m_type; QDateTime m_dateTime; QDateTime m_eqDateTime; QString m_text; uint32_t m_color; uint32_t m_filterFlags; static QString s_messageTypeStrings[MT_Max+1]; }; inline MessageEntry::MessageEntry(MessageType type, const QDateTime& dateTime, const QDateTime& eqDateTime, const QString& text, uint32_t color, uint32_t filters) : m_type(type), m_dateTime(dateTime), m_eqDateTime(eqDateTime), m_text(text), m_color(color), m_filterFlags(filters) { } inline MessageEntry::MessageEntry() : m_type(MT_Debug), m_color(0x000000FF), m_filterFlags(0) { } inline MessageEntry::~MessageEntry() { } inline const QString& MessageEntry::messageTypeString(MessageType type) { static QString dummy; if (type <= MT_Max) return s_messageTypeStrings[type]; return dummy; } #endif // _MESSAGE_H_ Index: seqwindow.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/seqwindow.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- seqwindow.cpp 21 May 2002 21:37:36 -0000 1.1 +++ seqwindow.cpp 13 Sep 2005 15:23:13 -0000 1.2 @@ -4,7 +4,7 @@ * ShowEQ Distributed under GPL * http://seq.sourceforge.net/ * - * Copyright 2001 Zaphod (do...@us...). All Rights Reserved. + * Copyright 2001-2003 Zaphod (do...@us...). All Rights Reserved. * * Contributed to ShowEQ by Zaphod (do...@us...) * for use under the terms of the GNU General Public License, @@ -15,15 +15,23 @@ #include "seqwindow.h" #include "main.h" +#include <qpopupmenu.h> + SEQWindow::SEQWindow(const QString prefName, const QString caption, QWidget* parent, const char* name, WFlags f) - : QWidget(parent, name, f), + : QDockWindow(parent, name, f), m_preferenceName(prefName) { // set the windows caption - QWidget::setCaption(pSEQPrefs->getPrefString("Caption", preferenceName(), + QDockWindow::setCaption(pSEQPrefs->getPrefString("Caption", preferenceName(), caption)); - + + // windows default to resizable + setResizeEnabled(true); + + // windows default to be closable when not docked + setCloseMode(Always); + // restore the font restoreFont(); } @@ -32,11 +40,16 @@ { } +QPopupMenu* SEQWindow::menu() +{ + return 0; +} void SEQWindow::setCaption(const QString& text) { // set the caption - QWidget::setCaption(text); + QDockWindow::setCaption(text); + setName((const char*)caption()); // set the preference pSEQPrefs->setPrefString("Caption", preferenceName(), caption()); @@ -64,27 +77,78 @@ void SEQWindow::restoreSize() { - // retrieve the saved size information - QSize s = pSEQPrefs->getPrefSize("WindowSize", preferenceName(), size()); + if (place() == InDock) + { + QSize s = pSEQPrefs->getPrefSize("DockFixedExtent", preferenceName(), + fixedExtent()); + setFixedExtentWidth(s.width()); + setFixedExtentHeight(s.height()); + } + else + { + // retrieve the saved size information + QSize s = pSEQPrefs->getPrefSize("WindowSize", preferenceName(), size()); + + resize(s); + } - resize(s); + if (pSEQPrefs->getPrefBool("DockVisible", preferenceName(), !isHidden())) + show(); + else + hide(); } void SEQWindow::restorePosition() { - // retrieve the saved position information - QPoint p = pSEQPrefs->getPrefPoint("WindowPos", preferenceName(), pos()); - - // Move window to new position - move(p); + if (place() == InDock) + { + setNewLine(pSEQPrefs->getPrefBool("DockNewLine", preferenceName(), + newLine())); + setOffset(pSEQPrefs->getPrefInt("DockOffset", preferenceName(), offset())); + } + else + { + // retrieve the saved position information + QPoint p = pSEQPrefs->getPrefPoint("WindowPos", preferenceName(), pos()); + + // Move window to new position + move(p); + } } void SEQWindow::savePrefs(void) { if (pSEQPrefs->getPrefBool("SavePosition", "Interface", true)) { - // save the windows size and position information - pSEQPrefs->setPrefSize("WindowSize", preferenceName(), size()); - pSEQPrefs->setPrefPoint("WindowPos", preferenceName(), pos()); + if (place() == InDock) + { + pSEQPrefs->setPrefBool("DockNewLine", preferenceName(), newLine()); + pSEQPrefs->setPrefInt("DockOffset", preferenceName(), offset()); + pSEQPrefs->setPrefSize("DockFixedExtent", preferenceName(), fixedExtent()); + } + else + { + // save the windows size and position information + pSEQPrefs->setPrefSize("WindowSize", preferenceName(), size()); + pSEQPrefs->setPrefPoint("WindowPos", preferenceName(), pos()); + } + + pSEQPrefs->setPrefBool("DockVisible", preferenceName(), !isHidden()); + } +} + +void SEQWindow::mousePressEvent(QMouseEvent* e) +{ + if (e->button() == RightButton) + { + QPopupMenu* popupMenu = menu(); + if (popupMenu) + popupMenu->popup(mapToGlobal(e->pos())); + else + QDockWindow::mousePressEvent(e); } + else + QDockWindow::mousePressEvent(e); } + +#include "seqwindow.moc" Index: util.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/util.cpp,v retrieving revision 1.21 retrieving revision 1.22 diff -u -d -r1.21 -r1.22 --- util.cpp 11 Nov 2003 07:13:53 -0000 1.21 +++ util.cpp 13 Sep 2005 15:23:14 -0000 1.22 @@ -5,6 +5,10 @@ * http://seq.sourceforge.net/ */ +#include "util.h" +#include "diagnosticmessages.h" +#include "main.h" + #include <stdlib.h> #include <stdio.h> #include <string.h> @@ -14,9 +18,6 @@ #include <qfileinfo.h> #include <qdir.h> -#include "util.h" -#include "main.h" - #ifdef __FreeBSD__ long int lroundf(float x) //closest int away from 0 @@ -78,6 +79,22 @@ return newstring; } /* END Commanate */ +QString classString(uint8_t classVal) +{ + // a non-sparse array of class names + static const char* classnames[] = + { +#include "classes.h" + }; + + // return class name from list if it's within range + if ((classVal < (sizeof(classnames) / sizeof (char*))) && + (classnames[classVal] != NULL)) + return classnames[classVal]; + else + return QString::number(classVal); +} + QString spell_name (uint16_t spellId) { @@ -138,98 +155,6 @@ return QString::number(langId); } -/* Saves spawn to spawn DB */ -void spawndb (const dbSpawnStruct *dbSpawn) -{ - FILE *sdb; - struct dbSpawnStruct s; - int found=0; - char thisname[256]; - char dbname[256]; - - /* Check if this is not a player or a corpse */ - if (dbSpawn->spawn.NPC == 0 || dbSpawn->spawn.NPC == 2) { - return; - } - - strcpy (thisname, dbSpawn->spawn.name); - - /* Strip off number after spawn name */ - size_t nameLen = strlen(dbSpawn->spawn.name); - for (size_t a=0; a < nameLen; a++) - if (thisname[a]<='9') - thisname[a]=0; - - if ((sdb = fopen (SPAWNFILE, "r")) != NULL) - { - while (fread (&s, sizeof(dbSpawnStruct), 1, sdb)) - { - strcpy (dbname, s.spawn.name); - size_t nameLen = strlen(s.spawn.name); - for (size_t a=0; a < nameLen; a++) - if (dbname[a]<='9') - dbname[a]=0; - if ( (!strcmp(dbname, thisname)) && - (dbSpawn->spawn.level == s.spawn.level) && - (!strcmp(dbSpawn->zoneName, s.zoneName)) ) - { - found=1; - break; - } - } - - fclose (sdb); - } - else { - puts("Error opening spawn file '" SPAWNFILE "'"); - } - - if (!found) - { - if ((sdb = fopen (SPAWNFILE, "a")) != NULL) - { - fwrite (dbSpawn, sizeof(dbSpawnStruct), 1, sdb); - fclose (sdb); - } - else { - puts("Error opening spawn file '" SPAWNFILE "'"); - } - } -} - -void petdb(const petStruct *spawn) -{ - FILE *pdb; - struct petStruct s; - int found=0; - - if ((pdb = fopen (LOGDIR "/pet.db", "r")) != NULL) - { - while (fread (&s, sizeof(petStruct), 1, pdb)) - { - // Unique on owner class, owner level and pet level - if ((spawn->owner.class_==s.owner.class_) && - (spawn->owner.level==s.owner.level) && - (spawn->pet.level==s.pet.level)) - { - found=1; - break; - } - } - - fclose (pdb); - } - - if (!found) - { - if ((pdb = fopen (LOGDIR "/pet.db", "a")) != NULL) - { - fwrite (spawn, sizeof(petStruct), 1, pdb); - fclose (pdb); - } - } -} - QString print_races (uint16_t races) { QString race_str; @@ -880,26 +805,26 @@ { // if what's supposed to be a directory isn't somethings wierd. if (!dirInfo.isDir()) - fprintf(stderr, "\tDirectory '%s' isn't a directory!\n", + seqWarn("\tDirectory '%s' isn't a directory!", (const char*)dirInfo.absFilePath()); else { // if the directory isn't writable, that might explain it if (!dirInfo.isWritable()) - fprintf(stderr, "\tCan't write to directory: %s\n", + seqWarn("\tCan't write to directory: %s", (const char*)dirInfo.absFilePath()); // if the directory isn't readable, that might explain it if (!dirInfo.isReadable()) - fprintf(stderr, "\tCan't read directory: %s\n", + seqWarn("\tCan't read directory: %s", (const char*)dirInfo.absFilePath()); // is the directory executable (listable), if (!dirInfo.isExecutable()) - fprintf(stderr, "\tCan't execute/access directory: %s\n", + seqWarn("\tCan't execute/access directory: %s", (const char*)dirInfo.absFilePath()); } } else // directory doesn't exist - fprintf(stderr, "\tDirectory '%s' doesn't exist!\n", + seqWarn("\tDirectory '%s' doesn't exist!", (const char*)dirInfo.absFilePath()); @@ -908,12 +833,12 @@ { // The file exists, but is it writable if (!fileInfo.isWritable()) - fprintf(stderr, "\tCan't write to file: %s\n", + seqWarn("\tCan't write to file: %s", (const char*)fileInfo.absFilePath()); // Is the file really a file (or did someone do something wierd) if (!fileInfo.isFile()) - fprintf(stderr, "\tNot a file:'%s'!", + seqWarn("\tNot a file:'%s'!", (const char*)fileInfo.absFilePath()); } } @@ -931,22 +856,22 @@ { // if what's supposed to be a directory isn't somethings wierd. if (!dirInfo.isDir()) - fprintf(stderr, "\tDirectory '%s' isn't a directory!\n", + seqWarn("\tDirectory '%s' isn't a directory!", (const char*)dirInfo.absFilePath()); else { // if the directory isn't readable, that might explain it if (!dirInfo.isReadable()) - fprintf(stderr, "\tCan't read directory: %s\n", + seqWarn("\tCan't read directory: %s", (const char*)dirInfo.absFilePath()); // is the directory executable (listable), if (!dirInfo.isExecutable()) - fprintf(stderr, "\tCan't execute/access directory: %s\n", + seqWarn("\tCan't execute/access directory: %s", (const char*)dirInfo.absFilePath()); } } else // directory doesn't exist - fprintf(stderr, "\tDirectory '%s' doesn't exist!\n", + seqWarn("\tDirectory '%s' doesn't exist!", (const char*)dirInfo.absFilePath()); @@ -955,16 +880,16 @@ { // The file exists, but is it writable if (!fileInfo.isReadable()) - fprintf(stderr, "\tCan't read to file: %s\n", + seqWarn("\tCan't read to file: %s", (const char*)fileInfo.absFilePath()); // Is the file really a file (or did someone do something wierd) if (!fileInfo.isFile()) - fprintf(stderr, "\tNot a file:'%s'!", + seqWarn("\tNot a file:'%s'!", (const char*)fileInfo.absFilePath()); } else - fprintf(stderr, "\tFile '%s' doesn't exist.\n", + seqWarn("\tFile '%s' doesn't exist.", (const char*)fileInfo.absFilePath()); } @@ -1038,31 +963,25 @@ return crc ^ 0xFFFFFFFF; } - -bool findFile( QString& filename ) +////////////////////////////////////////////////////////////////// +// Seeded CRC16 needed by the packet layer. +uint16_t calcCRC16(uint8_t* p, uint32_t length, uint32_t seed) { - bool found = false; - - QFileInfo fi( filename ); - QDir dir( fi.dirPath( true ) ); - QString fileLower = fi.fileName().lower(); - - QStringList dirEntries = dir.entryList(); - - for ( QStringList::Iterator it = dirEntries.begin(); - it != dirEntries.end(); - ++it ) - { - QString entry( (*it).lower() ); - if ( entry == fileLower ) - { - filename = fi.dirPath( true ); - filename += "/"; - filename += *it; - found = true; - break; - } - } - return found; +#include "crctab.h" + unsigned long crc = 0L ^ 0xffffffff; + + // CRC each byte of the seed + crc = crc >> 8 ^ crctab[(seed ^ crc) & 0xFF]; + crc = crc >> 8 ^ crctab[(seed >> 8 ^ crc) & 0xFF]; + crc = crc >> 8 ^ crctab[(seed >> 16 ^ crc) & 0xFF]; + crc = crc >> 8 ^ crctab[(seed >> 24 ^ crc) & 0xFF]; + + // Then crc the buffer + while(length--) + { + crc = crc >> 8 ^ crctab[(*(p++) ^ crc) & 0xFF]; + } + + return crc ^ 0xffffffffL; } --- NEW FILE: filter2xml.pl --- #!/usr/bin/perl $dir = 0; while($_ = $ARGV[0], /^-/) { shift; last if /^--$/; if (/^-D/) { $dir = 1; } } if (!$dir) { migrate(@ARGV); } else { migratedir(@ARGV); } sub migratedir { local ($source, $dest, $comments) = @_; opendir(SOURCEDIR, $source) || die "Can't open '$source' directory: $!\n"; @conffiles = grep /^filters_.*\.conf$/, readdir SOURCEDIR; closedir(SOURCEDIR); foreach $file (@conffiles) { ($destfile = $file) =~ s/^filters_(.*)\.conf$/$1.xml/; # print "$source/$file => $dest/$destfile\n"; migrate("$source/$file", "$dest/$destfile", $comments); } } sub migrate { local ($source, $dest, $comments) = @_; print "Migrating '$source' to '$dest'\n"; # open source and destination files open(SOURCE_FILE, "<$source") || die "Can't find '$source' $SOURCE_FILE: $!\n"; open(DEST_FILE, ">$dest") || die "Can't create '$dest' $DEST_FILE: $!\n"; # print the XML header print DEST_FILE "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; print DEST_FILE "<!DOCTYPE seqfilters SYSTEM \"seqfilters.dtd\">\n"; print DEST_FILE "<seqfilters>\n"; $incomment = 0; $insection = 0; # iterate over the contents of the source file while ($line = <SOURCE_FILE>) { # handle empty lines if ($line =~ m/^\s*$/) { next if (!$comments); if ($incomment) { print DEST_FILE "---> \n"; $incomment = 0; } next; } # handle escaping of XML unfriendly characters $line =~ s/&/&/g; $line =~ s/</</g; $line =~ s/>/>/g; $line =~ s/\"/"/g; # handle comments if ($line =~ m/^\#/) { next if (!$comments); if ($incomment) { $line =~ s/^\#(.*)$/ $1 /; } else { $line =~ s/^\#(.*)$/<--\n $1 /; $incomment = 1; } print DEST_FILE $line; next; } if ($incomment) { print DEST_FILE "---> \n"; $incomment = 0; } # handle section breaks if ($line =~ m/^\[/) { print DEST_FILE " </section>\n" if ($insection); $insection = 1; $line =~ s/^\[([^\]]+)\]\s*$/ <section name="$1">/; print DEST_FILE $line, "\n"; } else { # min and max default to 0 $min = 0; $max = 0; # fix line termination and errant trailing spaces $line =~ s/^(.*?)\s*$/$1/; # seperate @line = split(m/;/, $line); # process level ranges if ($#line > 0) { $range = $line[1]; if ($range =~ m/^(\d+)-$/) { $min = $1; $max = 255; } elsif ($range =~ m/^-(\d+)$/) { $min = 0; $max = $1; } elsif ($range =~ m/^(\d+)-(\d+)/) { $min = $1; $max = $2; } } # print out in the XML filter format print DEST_FILE " <oldfilter>"; print DEST_FILE "<regex>", $line[0], "</regex>" if ($line[0]); # handle outputting level ranges if ($min || $max) { print DEST_FILE "<level"; print DEST_FILE " min=\"$min\"" if ($min); print DEST_FILE " max=\"$max\"" if ($max); print DEST_FILE "/>"; } # close the filter entry print DEST_FILE "</oldfilter>\n" } } # close the section print DEST_FILE " </section>\n" if ($insection); print DEST_FILE "</seqfilters>\n"; } --- NEW FILE: filteredspawnlog.cpp --- /* * spawnlog.cpp * * ShowEQ Distributed under GPL * http://www.sourceforge.net/projects/seq * * Copyright 2001-2003 by the respective ShowEQ Developers * Portions Copyright 2001-2003 Zaphod (do...@us...). */ #include "filteredspawnlog.h" #include "filtermgr.h" #include "spawn.h" #include "datetimemgr.h" FilteredSpawnLog::FilteredSpawnLog(DateTimeMgr* dateTimeMgr, FilterMgr* filterMgr, const QString& filename) : SEQLogger(filename, NULL, "FilteredSpawnLog"), m_dateTimeMgr(dateTimeMgr), m_filterMgr(filterMgr), m_logFilters(0) { } FilteredSpawnLog::~FilteredSpawnLog() { } void FilteredSpawnLog::setFilters(uint32_t flags) { m_logFilters = flags; } void FilteredSpawnLog::addItem(const Item* item) { uint32_t filterFlags = item->filterFlags(); if (!(filterFlags & m_logFilters)) return; if (filterFlags & (FILTER_FLAG_ALERT | FILTER_FLAG_DANGER | FILTER_FLAG_CAUTION | FILTER_FLAG_HUNT | FILTER_FLAG_LOCATE)) logSpawn(item, "spawned", filterFlags); } void FilteredSpawnLog::delItem(const Item* item) { uint32_t filterFlags = item->filterFlags(); if (!(filterFlags & m_logFilters)) return; if (filterFlags & FILTER_FLAG_ALERT) logSpawn(item, "despawned", filterFlags); } void FilteredSpawnLog::killSpawn(const Item* item) { uint32_t filterFlags = item->filterFlags(); if (!(filterFlags & m_logFilters)) return; if (filterFlags & FILTER_FLAG_ALERT) logSpawn(item, "killed", filterFlags); } void FilteredSpawnLog::logSpawn(const Item* item, const char* action, uint32_t flag) { // make sure the log file is open if (!open()) return; // get the current EQ Date&Time const QDateTime& eqDate = m_dateTimeMgr->updatedDateTime(); // log the information outputf("%s %s %s LOC %dy, %dx, %dz at %s (%s)\n", (const char*)m_filterMgr->filterString(flag), action, (const char*)item->name(), item->y(), item->x(), item->z(), eqDate.isValid() ? (const char*)eqDate.toString() : "", (const char*)item->spawnTimeStr()); flush(); } #include "filteredspawnlog.moc" Index: compass.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/compass.cpp,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- compass.cpp 30 Aug 2003 15:51:45 -0000 1.2 +++ compass.cpp 13 Sep 2005 15:23:11 -0000 1.3 @@ -167,3 +167,5 @@ paintCompass (&p); p.end(); } + +#include "compass.moc" Index: packetformat.cpp =================================================================== RCS file: /cvsroot/seq/showeq/src/packetformat.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- packetformat.cpp 25 Oct 2003 00:21:00 -0000 1.1 +++ packetformat.cpp 13 Sep 2005 15:23:12 -0000 1.2 @@ -4,124 +4,100 @@ * ShowEQ Distributed under GPL * http://www.sourceforge.net/projects/seq * - * Copyright 2000-2003 by the respective ShowEQ Developers - * Portions Copyright 2001-2003 Zaphod (do...@us...). + * Copyright 2000-2004 by the respective ShowEQ Developers + * Portions Copyright 2001-2004 Zaphod (do...@us...). */ /* Implementation of packet format classes class */ #include "packetformat.h" +#include "diagnosticmessages.h" -//---------------------------------------------------------------------- -// EQPacketFormatRaw class methods -QString EQPacketFormatRaw::headerFlags(const QString& prefix, - bool brief) const -{ - QString tmp; - if (!prefix.isEmpty()) - { - if (brief) - tmp = prefix + ": "; - else - tmp = prefix + "[Hdr (" + QString::number(flagsHi(), 16) + ", " - + QString::number(flagsLo(), 16) + "): "; - } - else if (!brief) - tmp = "[Hdr (" + QString::number(flagsHi(), 16) + ", " - + QString::number(flagsLo(), 16) + "): "; - - if (isARQ()) - tmp += "ARQ, "; - if (isClosingLo()) - tmp += "closingLo, "; - if (isFragment()) - tmp += "Fragment, "; - if (isASQ()) - tmp += "ASQ, "; - if (isSEQStart()) - tmp += "SEQStart, "; - if (isClo... [truncated message content] |