[wpdev-commits] wolfpack ChangeLog,1.11,1.12 commands.cpp,1.261,1.262
Brought to you by:
rip,
thiagocorrea
From: Sebastian H. <dar...@us...> - 2004-08-22 16:35:12
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14586 Modified Files: ChangeLog commands.cpp Log Message: Multi export Index: ChangeLog =================================================================== RCS file: /cvsroot/wpdev/wolfpack/ChangeLog,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** ChangeLog 22 Aug 2004 15:15:07 -0000 1.11 --- ChangeLog 22 Aug 2004 16:34:51 -0000 1.12 *************** *** 12,15 **** --- 12,17 ---- - .exportdefinitions now exports data about NPCS and their equipment to the categories.db database. + - .exportdefinitions now exports data about multis to the + categories.db database. Wolfpack 12.9.8 Beta (19. August 2004) Index: commands.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/commands.cpp,v retrieving revision 1.261 retrieving revision 1.262 diff -C2 -d -r1.261 -r1.262 *** commands.cpp 22 Aug 2004 02:29:50 -0000 1.261 --- commands.cpp 22 Aug 2004 16:34:51 -0000 1.262 *************** *** 676,679 **** --- 676,729 ---- /* + Recursive processing function to get neccesary information about multis. + */ + static void processMulti( QMap<QCString, QString> &item, const cElement *node ) + { + // If there is an inherit tag, inherit a parent item definition. + QString inherit = node->getAttribute( "inherit" ); + if ( inherit != QString::null ) + { + const cElement *parent = Definitions::instance()->getDefinition( WPDT_MULTI, inherit ); + if ( parent ) { + processMulti( item, parent ); + } + } + + int count = node->childCount(); + int i; + for ( i = 0; i < count; ++i ) { + const cElement *child = node->getChild( i ); + + // Inherit properties from another item definition + if ( child->name() == "inherit" ) + { + const cElement *parent = 0; + + if ( child->hasAttribute("id") ) + { + parent = Definitions::instance()->getDefinition( WPDT_MULTI, child->getAttribute( "id" ) ); + } + else + { + parent = Definitions::instance()->getDefinition( WPDT_MULTI, child->text() ); + } + + if ( parent ) + { + processMulti( item, parent ); + } + } + else if ( child->name() == "id" ) + { + item[ "dispid" ] = child->value(); + } + else if ( child->name() == "name" ) + { + item[ "name" ] = child->text(); + } + } + } + + /* Recursive processing function to get neccesary information about items. */ *************** *** 930,933 **** --- 980,990 ---- );" ); + driver.exec( "CREATE TABLE multis (\ + id INTEGER PRIMARY KEY,\ + name varchar(255) NULL,\ + addid varchar(255) NULL,\ + multiid int NOT NULL\ + );" ); + unsigned int lastcategory = 0; QMap<QString, unsigned int> categories; *************** *** 1201,1204 **** --- 1258,1285 ---- } + sections = Definitions::instance()->getSections( WPDT_MULTI ); + for ( sectionIt = sections.begin(); sectionIt != sections.end(); ++sectionIt ) + { + const cElement *element = Definitions::instance()->getDefinition( WPDT_MULTI, *sectionIt ); + + item.clear(); + item.insert( "name", QString::null ); + item.insert( "dispid", "0" ); + + processMulti( item, element ); + + if (item["name"].isNull() || item["dispid"].toInt() < 0x4000) { + continue; + } + + // Insert the item into the table. + QString section = *sectionIt; + QString sql = QString( "INSERT INTO multis VALUES(NULL,'%1','%2',%3);" ) + .arg( item[ "name" ].replace( "'", "''" ) ) + .arg( section.replace( "'", "''" ) ) + .arg( item[ "dispid" ].toInt() ); + driver.exec( sql ); + } + socket->sysMessage( "Finished exporting definitions to categories.db." ); } |