wpdev-commits Mailing List for Wolfpack Emu (Page 66)
Brought to you by:
rip,
thiagocorrea
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(14) |
Aug
(121) |
Sep
(256) |
Oct
(59) |
Nov
(73) |
Dec
(120) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(259) |
Feb
(381) |
Mar
(501) |
Apr
(355) |
May
(427) |
Jun
(270) |
Jul
(394) |
Aug
(412) |
Sep
(724) |
Oct
(578) |
Nov
(65) |
Dec
|
From: Sebastian H. <dar...@us...> - 2004-08-17 00:17:25
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2138 Modified Files: wolfpack.vcproj world.cpp Log Message: Binary save updates. Index: wolfpack.vcproj =================================================================== RCS file: /cvsroot/wpdev/wolfpack/wolfpack.vcproj,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** wolfpack.vcproj 16 Aug 2004 18:18:03 -0000 1.42 --- wolfpack.vcproj 17 Aug 2004 00:13:50 -0000 1.43 *************** *** 75,79 **** ConfigurationType="1" CharacterSet="2" ! WholeProgramOptimization="FALSE"> <Tool Name="VCCLCompilerTool" --- 75,79 ---- ConfigurationType="1" CharacterSet="2" ! WholeProgramOptimization="TRUE"> <Tool Name="VCCLCompilerTool" *************** *** 154,158 **** ConfigurationType="1" CharacterSet="2" ! WholeProgramOptimization="FALSE"> <Tool Name="VCCLCompilerTool" --- 154,158 ---- ConfigurationType="1" CharacterSet="2" ! WholeProgramOptimization="TRUE"> <Tool Name="VCCLCompilerTool" Index: world.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/world.cpp,v retrieving revision 1.114 retrieving revision 1.115 diff -C2 -d -r1.114 -r1.115 *** world.cpp 16 Aug 2004 18:18:03 -0000 1.114 --- world.cpp 17 Aug 2004 00:13:50 -0000 1.115 *************** *** 494,498 **** else if ( type != 0xFF ) { ! throw wpException( QString( "Invalid worldfile, unknown and unskippable type %1." ).arg( type ) ); } } --- 494,499 ---- else if ( type != 0xFF ) { ! Console::instance()->log(LOG_ERROR, QString( "Invalid worldfile, unknown and unskippable type %1." ).arg( type ) ); ! return; } } |
From: Sebastian H. <dar...@us...> - 2004-08-17 00:17:25
|
Update of /cvsroot/wpdev/wolfpack/python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2138/python Modified Files: tempeffect.h Log Message: Binary save updates. Index: tempeffect.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/tempeffect.h,v retrieving revision 1.24 retrieving revision 1.25 diff -C2 -d -r1.24 -r1.25 *** tempeffect.h 16 Aug 2004 18:18:03 -0000 1.24 --- tempeffect.h 17 Aug 2004 00:13:51 -0000 1.25 *************** *** 196,202 **** if ( PyInt_Check( object ) ) { ! cVariant(PyInt_AsLong(object)).serialize(writer, version); } else if ( PyString_Check( object ) || PyUnicode_Check( object ) ) { ! cVariant(Python2QString(object)).serialize(writer, version); } else if ( PyFloat_Check( object ) ) { cVariant(PyFloat_AsDouble(object)).serialize(writer, version); --- 196,202 ---- if ( PyInt_Check( object ) ) { ! cVariant((int)PyInt_AsLong(object)).serialize(writer, version); } else if ( PyString_Check( object ) || PyUnicode_Check( object ) ) { ! cVariant((QString)Python2QString(object)).serialize(writer, version); } else if ( PyFloat_Check( object ) ) { cVariant(PyFloat_AsDouble(object)).serialize(writer, version); |
From: Sebastian H. <dar...@us...> - 2004-08-16 18:18:12
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32435 Modified Files: customtags.h timers.cpp timers.h wolfpack.vcproj world.cpp world.h Log Message: Binary saves almost completed. Index: world.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/world.h,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** world.h 10 Aug 2004 03:15:57 -0000 1.18 --- world.h 16 Aug 2004 18:18:03 -0000 1.19 *************** *** 35,38 **** --- 35,39 ---- // Library Includes #include <qvaluevector.h> + #include <qmap.h> #include "server.h" *************** *** 78,81 **** --- 79,83 ---- unsigned int _playerCount, _npcCount; void loadTag( cBufferedReader& reader, unsigned int version ); + QMap<QString, QString> options; public: *************** *** 90,95 **** // For the "settings" table ! void getOption( const QString& name, QString& value, const QString fallback, bool newconnection = true ); ! void setOption( const QString& name, const QString& value, bool newconnection = true ); // Book-keeping functions --- 92,97 ---- // For the "settings" table ! void getOption( const QString& name, QString& value, const QString fallback ); ! void setOption( const QString& name, const QString& value ); // Book-keeping functions Index: customtags.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/customtags.h,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** customtags.h 10 Aug 2004 03:15:56 -0000 1.32 --- customtags.h 16 Aug 2004 18:18:03 -0000 1.33 *************** *** 54,59 **** static const cVariant null; ! enum Type ! { Invalid = 0, String, --- 54,58 ---- static const cVariant null; ! enum Type { Invalid = 0, String, Index: wolfpack.vcproj =================================================================== RCS file: /cvsroot/wpdev/wolfpack/wolfpack.vcproj,v retrieving revision 1.41 retrieving revision 1.42 diff -C2 -d -r1.41 -r1.42 *** wolfpack.vcproj 15 Aug 2004 02:17:39 -0000 1.41 --- wolfpack.vcproj 16 Aug 2004 18:18:03 -0000 1.42 *************** *** 81,87 **** Optimization="3" GlobalOptimizations="TRUE" ! InlineFunctionExpansion="1" ! EnableIntrinsicFunctions="FALSE" ! FavorSizeOrSpeed="2" OptimizeForProcessor="0" OptimizeForWindowsApplication="TRUE" --- 81,87 ---- Optimization="3" GlobalOptimizations="TRUE" ! InlineFunctionExpansion="2" ! EnableIntrinsicFunctions="TRUE" ! FavorSizeOrSpeed="1" OptimizeForProcessor="0" OptimizeForWindowsApplication="TRUE" *************** *** 89,96 **** PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;QT_THREAD_SUPPORT;QT_LITE_COMPONENT;QT_DLL;QT_NO_STL;QT_NO_COMPRESS;CRASHHANDLER;MYSQL_DRIVER" StringPooling="TRUE" ! MinimalRebuild="FALSE" BasicRuntimeChecks="0" RuntimeLibrary="2" ! StructMemberAlignment="3" BufferSecurityCheck="FALSE" EnableFunctionLevelLinking="FALSE" --- 89,96 ---- PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;QT_THREAD_SUPPORT;QT_LITE_COMPONENT;QT_DLL;QT_NO_STL;QT_NO_COMPRESS;CRASHHANDLER;MYSQL_DRIVER" StringPooling="TRUE" ! MinimalRebuild="TRUE" BasicRuntimeChecks="0" RuntimeLibrary="2" ! StructMemberAlignment="0" BufferSecurityCheck="FALSE" EnableFunctionLevelLinking="FALSE" Index: timers.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/timers.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** timers.cpp 13 Aug 2004 08:55:26 -0000 1.9 --- timers.cpp 16 Aug 2004 18:18:03 -0000 1.10 *************** *** 386,393 **** effect = new cPythonEffect; } - else if ( objectId == "cDelayedHideChar" ) - { - effect = new cDelayedHideChar; - } else { --- 386,389 ---- *************** *** 436,468 **** } - - // cDelayedHideChar - cDelayedHideChar::cDelayedHideChar( SERIAL serial ) - { - if ( !isCharSerial( serial ) || !FindCharBySerial( serial ) ) - { - destSer = INVALID_SERIAL; - return; - } - - destSer = serial; - setSerializable( true ); - } - - cDelayedHideChar::cDelayedHideChar() - { - setSerializable( true ); - } - - void cDelayedHideChar::Expire() - { - P_PLAYER pc = dynamic_cast<P_PLAYER>( FindCharBySerial( destSer ) ); - if ( !pc || pc->socket() ) // break if the char has relogged in the meantime - return; - - pc->setHidden( 1 ); - pc->resend( true ); - } - cDelayedOnCreateCall::cDelayedOnCreateCall( cUObject* obj, const QString& definition ) : obj_(obj), def_(definition) --- 432,435 ---- *************** *** 509,510 **** --- 476,518 ---- } } + + void cTimer::load(cBufferedReader &reader, unsigned int version) { + serializable = true; + expiretime = Server::instance()->time() + reader.readInt(); + dispellable = reader.readBool(); + sourSer = reader.readInt(); + destSer = reader.readInt(); + } + + void cTimer::save(cBufferedWriter &writer, unsigned int version) { + writer.writeInt(expiretime - Server::instance()->time()); + writer.writeBool(dispellable); + writer.writeInt(sourSer); + writer.writeInt(destSer); + } + + void cTimers::save(cBufferedWriter &writer) { + std::vector<cTimer*>::iterator it; + for (it = teffects.begin(); it != teffects.end(); ++it) { + if ((*it)->isSerializable()) { + writer.writeByte(0xFC); + writer.writeAscii((*it)->objectID().latin1()); + (*it)->save(writer, writer.version()); + } + } + } + + void cTimers::load(cBufferedReader &reader) { + QCString objectId = reader.readAscii(); + + cTimer *timer = 0; + + if (objectId == "cPythonEffect") { + timer = new cPythonEffect; + } else { + throw QString("Unknown TempEffect Type: %1").arg(objectId); + } + + timer->load(reader, reader.version()); + insert(timer); + } Index: world.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/world.cpp,v retrieving revision 1.113 retrieving revision 1.114 diff -C2 -d -r1.113 -r1.114 *** world.cpp 16 Aug 2004 14:58:59 -0000 1.113 --- world.cpp 16 Aug 2004 18:18:03 -0000 1.114 *************** *** 466,469 **** --- 466,479 ---- // Special Type for Tags } + else if ( type == 0xFB ) + { + QString name = reader.readUtf8(); + QString value = reader.readUtf8(); + setOption(name, value); + } + else if ( type == 0xFC ) + { + Timers::instance()->load(reader); + } else if ( type == 0xFD ) { *************** *** 521,525 **** if ( !strcmp( tableInfo[i].name, "settings" ) ) { ! setOption( "db_version", WP_DATABASE_VERSION, false ); } } --- 531,535 ---- if ( !strcmp( tableInfo[i].name, "settings" ) ) { ! setOption("db_version", WP_DATABASE_VERSION); } } *************** *** 583,586 **** --- 593,603 ---- Timers::instance()->load(); + // Load Options + cDBResult oresult = PersistentBroker::instance()->query("SELECT option,value FROM settings;"); + while (oresult.fetchrow()) { + setOption(oresult.getString(0), oresult.getString(1)); + } + oresult.free(); + // It's not possible to use cItemIterator during postprocessing because it skips lingering items ItemMap::iterator iter; *************** *** 734,740 **** cSpawnRegion *region = SpawnRegions::instance()->region( spawnregion ); cUObject *object = findObject( serial ); ! if ( object && region ) { ! object->setSpawnregion( region ); } } --- 751,757 ---- cSpawnRegion *region = SpawnRegions::instance()->region( spawnregion ); cUObject *object = findObject( serial ); ! if (object && region) { ! object->setSpawnregion(region); } } *************** *** 747,751 **** QString db_time; QString default_time = Config::instance()->getString( "General", "UO Time", "", true ); ! getOption( "worldtime", db_time, default_time, false ); UoTime::instance()->setMinutes( db_time.toInt() ); --- 764,768 ---- QString db_time; QString default_time = Config::instance()->getString( "General", "UO Time", "", true ); ! getOption( "worldtime", db_time, default_time ); UoTime::instance()->setMinutes( db_time.toInt() ); *************** *** 757,764 **** } ! void cWorld::save() ! { Console::instance()->send( "Saving World..." ); - Timing::instance()->setLastWorldsave( getNormalizedTime() ); // Send a nice status gump to all sockets if enabled --- 774,782 ---- } ! void cWorld::save() { ! // Broadcast a message to all connected clients ! Network::instance()->broadcast(tr("Worldsave Initialized")); ! Console::instance()->send( "Saving World..." ); // Send a nice status gump to all sockets if enabled *************** *** 789,795 **** } try { ! unsigned int startTime = getNormalizedTime(); if (Config::instance()->databaseDriver() == "binary") { --- 807,816 ---- } + unsigned int startTime = getNormalizedTime(); + try { ! // Save the Current Time ! setOption("worldtime", QString::number( UoTime::instance()->getMinutes() )); if (Config::instance()->databaseDriver() == "binary") { *************** *** 820,823 **** --- 841,855 ---- } + // Write Temporary Effects + Timers::instance()->save(writer); + + // Write Options + QMap<QString, QString>::iterator oit; + for (oit = options.begin(); oit != options.end(); ++oit) { + writer.writeByte(0xFB); + writer.writeUtf8(oit.key()); + writer.writeUtf8(oit.data()); + } + writer.writeByte( 0xFF ); // Terminator Type writer.close(); *************** *** 889,903 **** Guilds::instance()->save(); ! PersistentBroker::instance()->commitTransaction(); ! // Save the Current Time ! setOption( "worldtime", QString::number( UoTime::instance()->getMinutes() ), false ); ! // Save the accounts ! Accounts::instance()->save(); PersistentBroker::instance()->disconnect(); } Server::instance()->refreshTime(); --- 921,943 ---- Guilds::instance()->save(); ! PersistentBroker::instance()->commitTransaction(); ! // Write Options ! PersistentBroker::instance()->executeQuery("DELETE FROM settings;"); ! QMap<QString, QString>::iterator oit; ! for (oit = options.begin(); oit != options.end(); ++oit) { ! QString sql = QString("INSERT INTO settings VALUES('%1','%2');") ! .arg(PersistentBroker::instance()->quoteString(oit.key())) ! .arg(PersistentBroker::instance()->quoteString(oit.data())); ! PersistentBroker::instance()->executeQuery(sql); ! } PersistentBroker::instance()->disconnect(); } + // Save the accounts + Accounts::instance()->save(); + Server::instance()->refreshTime(); *************** *** 919,922 **** --- 959,965 ---- } + // Broadcast a message to all connected clients + Network::instance()->broadcast(tr("Worldsave Completed In %1ms").arg(Server::instance()->time() - startTime)); + if ( fancy ) { *************** *** 929,932 **** --- 972,977 ---- } } + + Timing::instance()->setLastWorldsave( getNormalizedTime() ); } *************** *** 934,973 **** * Gets a value from the settings table and returns the value */ ! void cWorld::getOption( const QString& name, QString& value, const QString fallback, bool newconnection ) { ! if ( newconnection ) ! { ! if ( !PersistentBroker::instance()->openDriver( Config::instance()->databaseDriver() ) ) ! { ! Console::instance()->log( LOG_ERROR, QString( "Unknown Worldsave Database Driver '%1', check your wolfpack.xml" ).arg( Config::instance()->databaseDriver() ) ); ! return; ! } ! ! try ! { ! PersistentBroker::instance()->connect( Config::instance()->databaseHost(), Config::instance()->databaseName(), Config::instance()->databaseUsername(), Config::instance()->databasePassword() ); ! } ! catch ( QString& e ) ! { ! Console::instance()->log( LOG_ERROR, QString( "Couldn't open the database: %1\n" ).arg( e ) ); ! return; ! } ! } ! ! cDBResult res = PersistentBroker::instance()->query( QString( "SELECT option,value FROM settings WHERE option='%1' LIMIT 1;" ).arg( PersistentBroker::instance()->quoteString( name ) ) ); ! ! if ( !res.fetchrow() ) ! { value = fallback; ! } ! else ! { ! value = res.getString( 1 ); ! } ! res.free(); ! ! if ( newconnection ) ! { ! PersistentBroker::instance()->disconnect(); } } --- 979,989 ---- * Gets a value from the settings table and returns the value */ ! void cWorld::getOption( const QString& name, QString& value, const QString fallback ) { ! QMap<QString, QString>::iterator it = options.find(name); ! if (it == options.end()) { value = fallback; ! } else { ! value = it.data(); } } *************** *** 976,1012 **** * Sets a value in the settings table. */ ! void cWorld::setOption( const QString& name, const QString& value, bool newconnection ) { ! if ( newconnection ) ! { ! if ( !PersistentBroker::instance()->openDriver( Config::instance()->databaseDriver() ) ) ! { ! Console::instance()->log( LOG_ERROR, QString( "Unknown Worldsave Database Driver '%1', check your wolfpack.xml" ).arg( Config::instance()->databaseDriver() ) ); ! return; ! } ! ! try ! { ! if ( !PersistentBroker::instance()->driver() ) ! { ! PersistentBroker::instance()->connect( Config::instance()->databaseHost(), Config::instance()->databaseName(), Config::instance()->databaseUsername(), Config::instance()->databasePassword() ); ! } ! } ! catch ( QString& e ) ! { ! Console::instance()->log( LOG_ERROR, QString( "Couldn't open the database: %1\n" ).arg( e ) ); ! return; ! } ! } ! ! // check if the option already exists ! PersistentBroker::instance()->addToDeleteQueue( "settings", QString( "option = '%1'" ).arg( name ) ); ! ! PersistentBroker::instance()->executeQuery( QString( "REPLACE INTO settings VALUES( '%1', '%2' );" ).arg( PersistentBroker::instance()->quoteString( name ), PersistentBroker::instance()->quoteString( value ) ) ); ! ! if ( newconnection ) ! { ! PersistentBroker::instance()->disconnect(); ! } } --- 992,998 ---- * Sets a value in the settings table. */ ! void cWorld::setOption( const QString& name, const QString& value ) { ! options.insert(name, value, true); } Index: timers.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/timers.h,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** timers.h 12 Aug 2004 03:02:51 -0000 1.5 --- timers.h 16 Aug 2004 18:18:03 -0000 1.6 *************** *** 41,44 **** --- 41,46 ---- class cScriptTimer; class cTimers; + class cBufferedReader; + class cBufferedWriter; // Wolfpack includes *************** *** 84,88 **** bool loadItem( unsigned int id, const QString& key, P_ITEM& item ); ! public: // cTimer() { serializable = true; } cTimer( cTimer* left_ = NULL, cTimer* right_ = NULL, cTimer* father_ = NULL, cTimer* son_ = NULL, int rank_ = 0, bool marker_ = false ) --- 86,92 ---- bool loadItem( unsigned int id, const QString& key, P_ITEM& item ); ! virtual void load(cBufferedReader &reader, unsigned int version); ! virtual void save(cBufferedWriter &writer, unsigned int version); ! // cTimer() { serializable = true; } cTimer( cTimer* left_ = NULL, cTimer* right_ = NULL, cTimer* father_ = NULL, cTimer* son_ = NULL, int rank_ = 0, bool marker_ = false ) *************** *** 149,164 **** }; - class cDelayedHideChar : public cTimer - { - public: - cDelayedHideChar( SERIAL serial ); - cDelayedHideChar(); - void Expire(); - QString objectID() const - { - return "cDelayedHideChar"; - } - }; - class cDelayedOnCreateCall : public cTimer { --- 153,156 ---- *************** *** 192,195 **** --- 184,189 ---- void load(); void save(); + void save(cBufferedWriter &writer); + void load(cBufferedReader &reader); void check(); |
From: Sebastian H. <dar...@us...> - 2004-08-16 18:18:12
|
Update of /cvsroot/wpdev/wolfpack/python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32435/python Modified Files: tempeffect.h Log Message: Binary saves almost completed. Index: tempeffect.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/tempeffect.h,v retrieving revision 1.23 retrieving revision 1.24 diff -C2 -d -r1.23 -r1.24 *** tempeffect.h 2 Jul 2004 06:01:33 -0000 1.23 --- tempeffect.h 16 Aug 2004 18:18:03 -0000 1.24 *************** *** 32,35 **** --- 32,37 ---- #include "utilities.h" + #include "../coord.h" + #include "../basics.h" #include "../timers.h" #include "../persistentbroker.h" *************** *** 180,183 **** --- 182,262 ---- } + void save(cBufferedWriter &writer, unsigned int version) { + cTimer::save(writer, version); + + writer.writeUtf8(functionName); + writer.writeUtf8(dispelFunc_); + writer.writeUtf8(dispelId_); + + int count = PyTuple_Size(args); + writer.writeInt(count); + + for (int i = 0; i < count; ++i) { + PyObject *object = PyTuple_GetItem(args, i); + + if ( PyInt_Check( object ) ) { + cVariant(PyInt_AsLong(object)).serialize(writer, version); + } else if ( PyString_Check( object ) || PyUnicode_Check( object ) ) { + cVariant(Python2QString(object)).serialize(writer, version); + } else if ( PyFloat_Check( object ) ) { + cVariant(PyFloat_AsDouble(object)).serialize(writer, version); + } else if ( checkWpChar( object ) ) { + cVariant(getWpChar(object)).serialize(writer, version); + } else if ( checkWpItem( object ) ) { + cVariant(getWpItem(object)).serialize(writer, version); + } else if ( checkWpCoord( object ) ) { + cVariant(getWpCoord(object)).serialize(writer, version); + } + } + } + + void load(cBufferedReader &reader, unsigned int version) { + cTimer::load(reader, version); + + functionName = reader.readUtf8(); + dispelFunc_ = reader.readUtf8(); + dispelId_ = reader.readUtf8(); + int count = reader.readInt(); + + for(int i = 0; i < count; ++i) { + cVariant variant; + PyObject *object = 0; + + variant.serialize(reader, version); + switch (variant.type()) { + case cVariant::Int: + object = PyInt_FromLong(variant.asInt()); + break; + + case cVariant::String: + object = QString2Python(variant.asString()); + break; + + case cVariant::Double: + object = PyFloat_FromDouble(variant.asDouble()); + break; + + case cVariant::BaseChar: + object = PyGetCharObject(variant.toChar()); + break; + + case cVariant::Item: + object = PyGetItemObject(variant.toItem()); + break; + + case cVariant::Coord: + object = PyGetCoordObject(variant.toCoord()); + break; + } + + if (!object) { + Py_INCREF(Py_None); + object = Py_None; + } + + PyTuple_SetItem(args, i, object); + } + } + void save( unsigned int id ) { |
From: Richard M. <dr...@us...> - 2004-08-16 14:59:08
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24617 Modified Files: dbdriver.cpp world.cpp Log Message: This should remove the need for the `` patch to SQLite. Index: dbdriver.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/dbdriver.cpp,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** dbdriver.cpp 13 Aug 2004 08:55:25 -0000 1.40 --- dbdriver.cpp 16 Aug 2004 14:58:59 -0000 1.41 *************** *** 269,273 **** static PyMethodDef wpDbResultMethods[] = { ! {"free", ( getattrofunc ) wpDbResult_free, METH_VARARGS, 0}, {"fetchrow", ( getattrofunc ) wpDbResult_fetchrow, METH_VARARGS, 0}, {"getint", ( getattrofunc ) wpDbResult_getint, METH_VARARGS, 0}, {"getstring", ( getattrofunc ) wpDbResult_getstring, METH_VARARGS, 0}, {0, 0, 0, 0} }; --- 269,277 ---- static PyMethodDef wpDbResultMethods[] = { ! { "free", ( getattrofunc ) wpDbResult_free, METH_VARARGS, 0 }, ! { "fetchrow", ( getattrofunc ) wpDbResult_fetchrow, METH_VARARGS, 0 }, ! { "getint", ( getattrofunc ) wpDbResult_getint, METH_VARARGS, 0 }, ! { "getstring", ( getattrofunc ) wpDbResult_getstring, METH_VARARGS, 0 }, ! { 0, 0, 0, 0 } }; Index: world.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/world.cpp,v retrieving revision 1.112 retrieving revision 1.113 diff -C2 -d -r1.112 -r1.113 *** world.cpp 15 Aug 2004 20:54:16 -0000 1.112 --- world.cpp 16 Aug 2004 14:58:59 -0000 1.113 *************** *** 955,959 **** } ! cDBResult res = PersistentBroker::instance()->query( QString( "SELECT `value` FROM `settings` WHERE `option` = '%1'" ).arg( PersistentBroker::instance()->quoteString( name ) ) ); if ( !res.fetchrow() ) --- 955,959 ---- } ! cDBResult res = PersistentBroker::instance()->query( QString( "SELECT option,value FROM settings WHERE option='%1' LIMIT 1;" ).arg( PersistentBroker::instance()->quoteString( name ) ) ); if ( !res.fetchrow() ) *************** *** 963,967 **** else { ! value = res.getString( 0 ); } res.free(); --- 963,967 ---- else { ! value = res.getString( 1 ); } res.free(); *************** *** 1001,1011 **** // check if the option already exists ! PersistentBroker::instance()->executeQuery( QString( "DELETE FROM `settings` WHERE `option` = '%1'" ).arg( PersistentBroker::instance()->quoteString( name ) ) ); ! ! QString sql; ! sql = "INSERT INTO `settings` VALUES('%1','%2')"; ! sql = sql.arg( PersistentBroker::instance()->quoteString( name ), PersistentBroker::instance()->quoteString( value ) ); ! PersistentBroker::instance()->executeQuery( sql ); if ( newconnection ) --- 1001,1007 ---- // check if the option already exists ! PersistentBroker::instance()->addToDeleteQueue( "settings", QString( "option = '%1'" ).arg( name ) ); ! PersistentBroker::instance()->executeQuery( QString( "REPLACE INTO settings VALUES( '%1', '%2' );" ).arg( PersistentBroker::instance()->quoteString( name ), PersistentBroker::instance()->quoteString( value ) ) ); if ( newconnection ) |
From: Richard M. <dr...@us...> - 2004-08-16 01:43:53
|
Update of /cvsroot/wpdev/xmlscripts/scripts/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3304/commands Modified Files: adddecor.py Log Message: grr, I hate it when I forget something so simple. Index: adddecor.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/commands/adddecor.py,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** adddecor.py 16 Aug 2004 01:40:54 -0000 1.3 --- adddecor.py 16 Aug 2004 01:43:43 -0000 1.4 *************** *** 565,568 **** --- 565,569 ---- # Specific Tree elif value in trees: + item = value if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): socket.sysmessage( "Where do you want to place the tree '%s', '%s' ?" % ( trees[item][TREE], trees[item][LEAVES]) ) |
From: Richard M. <dr...@us...> - 2004-08-16 01:41:03
|
Update of /cvsroot/wpdev/xmlscripts/scripts/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv2807/commands Modified Files: adddecor.py Log Message: And done with the lists. Index: adddecor.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/commands/adddecor.py,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** adddecor.py 16 Aug 2004 01:24:21 -0000 1.2 --- adddecor.py 16 Aug 2004 01:40:54 -0000 1.3 *************** *** 103,106 **** --- 103,107 ---- 'd3f', # Brambles 'd40', # Brambles + 'c9e', # O'hii Tree 'd29', # Flowers 'd2b', # Flowers *************** *** 143,146 **** --- 144,148 ---- 'cc6', # Grasses 'cc7', # Weed + 'c9e', # O'hii Tree 'd29', # Flowers 'd2b', # Flowers *************** *** 169,178 **** 'd34', # Morning Glories 'd33', # Grasses 'd32' # Grasses ] swamp_decor = [ ] jungle_decor = [ ! ] --- 171,243 ---- 'd34', # Morning Glories 'd33', # Grasses + 'c95', # Coconut Palm + 'c96', # Date Palm 'd32' # Grasses ] swamp_decor = [ + 'd04', # Water Plants + 'd05', # Reeds + 'd06', # Lilypad + 'd07', # Lilypad + 'd08', # Lilypad + 'd09', # Lilypad + 'd0a', # Lilypad + 'd0b', # Lilypad + 'dbc', # Lilypad + 'dbd', # Lilypad + 'dbe', # Lilypads + 'dc1', # Water Lily + 'dc2', # Water Lily + 'dc3', # Water Lily ] jungle_decor = [ ! 'd09', # Lilypad ! 'd0a', # Lilypad ! 'd0b', # Lilypad ! 'dbc', # Lilypad ! 'dbd', # Lilypad ! 'dbe', # Lilypads ! 'c93', # Blade Plant ! 'c94', # Bulrushes ! 'c97', # Elephant Ear Plant ! 'c98', # Fan Plant ! 'c99', # Small Palm ! 'c9a', # Small Palm ! 'c9b', # Small Palm ! 'c9c', # Small Palm ! 'c9d', # Small Palm ! 'c9e', # O'hii Tree ! 'c9f', # Fern ! 'ca0', # Fern ! 'ca1', # Large Fern ! 'ca2', # Fern ! 'ca3', # Fern ! 'ca4', # Fern ! 'ca5', # Pampas Grass ! 'ca6', # Ponytail Palm ! 'ca7', # Rushes ! 'ca8', # Small Banana Tree ! 'ca9', # Snake Plant ! 'caa', # Banana Tree ! 'cab', # Banana Tree ! 'cac', # Grasses ! 'cad', # Grasses ! 'cae', # Grasses ! 'caf', # Grasses ! 'cb0', # Grasses ! 'cb1', # Grasses ! 'cb2', # Grasses ! 'cb3', # Grasses ! 'cb4', # Grasses ! 'cb5', # Grasses ! 'cb6', # Grasses ! 'cb7', # Cattails ! 'cb8', # Cattails ! 'cb9', # Grasses ! 'cba', # Grasses ! 'cbc', # Grasses ! 'cbd', # Grasses ! 'cc3', # Muck ! 'cc5' # Grasses ] |
From: Richard M. <dr...@us...> - 2004-08-16 01:24:34
|
Update of /cvsroot/wpdev/xmlscripts/scripts/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32705/commands Modified Files: adddecor.py Log Message: Small fix, going to add the rest of the items now. Index: adddecor.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/commands/adddecor.py,v retrieving revision 1.1 retrieving revision 1.2 diff -C2 -d -r1.1 -r1.2 *** adddecor.py 16 Aug 2004 01:18:18 -0000 1.1 --- adddecor.py 16 Aug 2004 01:24:21 -0000 1.2 *************** *** 396,400 **** def adddecor( socket, command, args ): ! if len(arguments) > 0: args= str( args.strip() ) args = args.split( ' ' ) --- 396,400 ---- def adddecor( socket, command, args ): ! if len(args) > 0: args= str( args.strip() ) args = args.split( ' ' ) *************** *** 565,569 **** return True # Desert Ground Decoration ! elif value == "desert": if socket.hastag( 'last_ground_desert' ): templist = [] --- 565,569 ---- return True # Desert Ground Decoration ! elif value == "desert": if socket.hastag( 'last_ground_desert' ): templist = [] *************** *** 582,589 **** --- 582,599 ---- socket.sysmessage( "Usage: adddecor ground [ forest, swamp, plains, jungle, desert ]" ) return False + # No Args + else: + socket.sysmessage( "Usage: adddecor [ tree, ground ]" ) + socket.sysmessage( "Usage: adddecor tree [ id, yew, jungle, random, forest, fruit, swamp, log[1-2] ]" ) + socket.sysmessage( "Usage: adddecor ground [ forest, swamp, plains, jungle, desert ]" ) + return False # No Args else: socket.sysmessage( "Usage: adddecor [ tree, ground ]" ) return False + # No Args + else: + socket.sysmessage( "Usage: adddecor [ tree, ground ]" ) + return False return False |
From: Richard M. <dr...@us...> - 2004-08-16 01:19:22
|
Update of /cvsroot/wpdev/xmlscripts/definitions In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31919 Modified Files: scripts.xml Log Message: Moved Index: scripts.xml =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/definitions/scripts.xml,v retrieving revision 1.153 retrieving revision 1.154 diff -C2 -d -r1.153 -r1.154 *** scripts.xml 13 Aug 2004 04:50:35 -0000 1.153 --- scripts.xml 16 Aug 2004 01:19:13 -0000 1.154 *************** *** 82,86 **** <script>commands.action</script> <script>commands.add</script> ! <script>commands.addtree</script> <script>commands.bank</script> <script>commands.cast</script> --- 82,86 ---- <script>commands.action</script> <script>commands.add</script> ! <script>commands.adddecor</script> <script>commands.bank</script> <script>commands.cast</script> |
From: Richard M. <dr...@us...> - 2004-08-16 01:18:33
|
Update of /cvsroot/wpdev/xmlscripts/scripts/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31781 Added Files: adddecor.py Removed Files: addtree.py Log Message: Moved the command, expanded it's abilities. --- addtree.py DELETED --- --- NEW FILE: adddecor.py --- #===============================================================# # ) (\_ | WOLFPACK 13.0.0 Scripts # (( _/{ "-; | Created by: Dreoth # )).-' {{ ;'` | Revised by: # ( ( ;._ \\ ctr | Last Modification: Created #===============================================================# # .adddecor Command #===============================================================# import wolfpack import random from wolfpack.consts import WPDT_ITEM from wolfpack.utilities import hex2dec from wolfpack import console """ \command adddecor \description Adds a decoration object, such as a tree or flowers. \usage - <code>adddecor [ tree, ground ]</code> Tree allows tree types. <code>adddecor tree [ id, yew, jungle, random, forest, fruit, swamp, log[1-2] ]</code> Ground allows ground items. <code>adddecor ground [ forest, swamp, plains, jungle, desert ]</code> \notes Green leaves will be added ontop of the trees. """ # Tree Lists treeindex = [ 'cca', 'ccb', 'ccc', 'ccd', 'cd0', 'cd3', 'cd6', 'cd8', 'cda', 'cdd', 'ce0', 'ce3', 'ce6', 'cf8', 'cfe', 'd01', 'd94', 'd98', 'd9c', 'da0', 'da4', 'da8' ] jungletreeindex = [ 'jungle1', 'jungle2', 'jungle3', 'jungle4', 'jungle5', 'jungle6', 'jungle7' ] forestlist = [ 'ccd', 'cd0', 'cd3', 'cd6', 'cd8', 'cda', 'cdd', 'ce0', 'ce3', 'ce6' ] swamplist = [ 'cf8', 'cfe', 'd01' ] fruitlist = [ 'd94', 'd98', 'd9c', 'da0', 'da4', 'da8' ] trees = \ { 'cca': [ 'cca', 'cce' ], 'ccb': [ 'ccb', 'cce' ], 'ccc': [ 'ccc', 'cce' ], 'ccd': [ 'ccd', 'cce' ], 'cd0': [ 'cd0', 'cd1' ], 'cd3': [ 'cd3', 'cd4' ], 'cd6': [ 'cd6', 'cd7' ], 'cd8': [ 'cd8', 'cd9' ], 'cda': [ 'cda', 'cdb' ], 'cdd': [ 'cdd', 'cde' ], 'ce0': [ 'ce0', 'ce1' ], 'ce3': [ 'ce3', 'ce4' ], 'ce6': [ 'ce6', 'ce7' ], 'cf8': [ 'cf8', 'cf9' ], # Cypress 'cfe': [ 'cfe', 'cff' ], # Cypress 'd01': [ 'd01', 'd02' ], # Cypress 'd94': [ 'd94', 'd95' ], # Apple 'd98': [ 'd98', 'd99' ], # Apple 'd9c': [ 'd9c', 'd9d' ], # Peach 'da0': [ 'da0', 'da1' ], # Peach 'da4': [ 'da4', 'da5' ], # Pear 'da8': [ 'da8', 'da9' ] # Pear } logs = \ { 'log1': [ 'cf3', 'cf4' ], # Y + 1 'log2': [ 'cf5', 'cf6', 'cf7' ] # X + 1 } # Ground Decorations forest_decor = [ 'c84', # Foxglove Flowers 'c85', # Orfluer Flowers 'c87', # Champion Flowers 'c88', # Snowdrops 'c89', # Champion Flowers 'c8a', # Foxglove Flowers 'c8b', # White Flowers 'c8c', # White Flowers 'cdd', # White Poppies 'c8e', # Snowdrops 'cac', # Grasses 'cad', # Grasses 'cae', # Grasses 'caf', # Grasses 'cb0', # Grasses 'cb1', # Grasses 'cb2', # Grasses 'cb3', # Grasses 'cb4', # Grasses 'cb5', # Grasses 'cb6', # Grasses 'cb7', # Cattails 'cb8', # Cattails 'cb9', # Grasses 'cba', # Grasses 'cbe', # Poppies 'cbf', # Poppies 'cc0', # Orfluer Flowers 'cc1', # Orfluer Flowers 'cc3', # Muck 'cc5', # Grasses 'cc6', # Grasses 'cc7', # Weed 'cc8', # Juniper Bush 'cc9', # Spider Tree 'd3f', # Brambles 'd40', # Brambles 'd29', # Flowers 'd2b', # Flowers 'd2d', # Flowers 'd36', # Flowers 'd2f' # Flowers ] plains_decor = [ 'c84', # Foxglove Flowers 'c85', # Orfluer Flowers 'c87', # Champion Flowers 'c88', # Snowdrops 'c89', # Champion Flowers 'c8a', # Foxglove Flowers 'c8b', # White Flowers 'c8c', # White Flowers 'cdd', # White Poppies 'c8e', # Snowdrops 'cac', # Grasses 'cad', # Grasses 'cae', # Grasses 'caf', # Grasses 'cb0', # Grasses 'cb1', # Grasses 'cb2', # Grasses 'cb3', # Grasses 'cb4', # Grasses 'cb5', # Grasses 'cb6', # Grasses 'cb7', # Cattails 'cb8', # Cattails 'cb9', # Grasses 'cba', # Grasses 'cbe', # Poppies 'cbf', # Poppies 'cc0', # Orfluer Flowers 'cc1', # Orfluer Flowers 'cc3', # Muck 'cc5', # Grasses 'cc6', # Grasses 'cc7', # Weed 'd29', # Flowers 'd2b', # Flowers 'd2d', # Flowers 'd36', # Flowers 'd2f' # Flowers ] desert_decor = [ 'd25', # Cactus 'd26', # Cactus 'd27', # Cactus 'd28', # Cactus 'd29', # Flowers 'd2a', # Cactus 'd2b', # Flowers 'd2c', # Cactus 'd2d', # Flowers 'd2e', # Cactus 'd2f' # Flowers 'd30', # Century Plant 'd31', # Century Plant 'd36', # Flowers 'd38', # Yucca 'd37', # Yucca 'd35', # Pipe Cactus 'd34', # Morning Glories 'd33', # Grasses 'd32' # Grasses ] swamp_decor = [ ] jungle_decor = [ ] # Constants TREE = 0 LEAVES = 1 # Adds a complex tree def addcomplextree( target, index, xmod, ymod): for object in index: if target.item: if target.item.type == 1: return elif target.item.container: return else: object.moveto( target.item.pos ) elif target.char: object.moveto( target.char.pos ) else: object.moveto( target.pos ) pos = object.pos pos.x = int( pos.x + xmod ) pos.y = int( pos.y + ymod ) object.moveto( pos ) xmod += 1 ymod -= 1 object.update() return def createtree(player, arguments, target): tree = wolfpack.additem( trees[arguments[0]][TREE] ) leaves = wolfpack.additem( trees[arguments[0]][LEAVES] ) if target.item: if target.item.type == 1: target.item.additem( tree, 1, 1, 0 ) target.item.additem( leaves, 1, 1, 0 ) elif target.item.container: target.item.container.additem( tree, 1, 1, 0 ) target.item.container.additem( leaves, 1, 1, 0 ) else: tree.moveto( target.item.pos ) leaves.moveto( target.item.pos ) elif target.char: tree.moveto( target.char.pos ) leaves.moveto( target.char.pos ) else: tree.moveto( target.pos ) leaves.moveto( target.pos ) tree.update() leaves.update() return def createjungletree( player, args, target): treetype = args[0] if treetype == 'jungle1' or treetype == 'jungle2': base1 = wolfpack.additem( 'd41' ) base2 = wolfpack.additem( 'd42' ) base3 = wolfpack.additem( 'd43' ) base4 = wolfpack.additem( 'd44' ) base = [ base1, base2, base3, base4 ] addcomplextree( target, base, -2, 2) if treetype == 'jungle1': top1 = wolfpack.additem( 'd45' ) top2 = wolfpack.additem( 'd46' ) top3 = wolfpack.additem( 'd47' ) top4 = wolfpack.additem( 'd48' ) top5 = wolfpack.additem( 'd49' ) top6 = wolfpack.additem( 'd4a' ) top7 = wolfpack.additem( 'd4b' ) top8 = wolfpack.additem( 'd4c' ) top = [ top1, top2, top3, top4, top5, top6, top7, top8 ] addcomplextree( target, top, -4, 4) return True elif treetype == 'jungle2': top1 = wolfpack.additem( 'd4d' ) top2 = wolfpack.additem( 'd4e' ) top3 = wolfpack.additem( 'd4f' ) top4 = wolfpack.additem( 'd50' ) top5 = wolfpack.additem( 'd51' ) top6 = wolfpack.additem( 'd52' ) top7 = wolfpack.additem( 'd53' ) top = [ top1, top2, top3, top4, top5, top6, top7 ] addcomplextree( target, top, -3, 3) return True elif treetype == 'jungle3': base1 = wolfpack.additem( 'd57' ) base2 = wolfpack.additem( 'd58' ) base3 = wolfpack.additem( 'd59' ) base4 = wolfpack.additem( 'd5a' ) base5 = wolfpack.additem( 'd5b' ) base = [ base1, base2, base3, base4, base5 ] addcomplextree( target, base, -2, 2) top1 = wolfpack.additem( 'd5c' ) top2 = wolfpack.additem( 'd5d' ) top3 = wolfpack.additem( 'd5e' ) top4 = wolfpack.additem( 'd5f' ) top5 = wolfpack.additem( 'd60' ) top6 = wolfpack.additem( 'd61' ) top7 = wolfpack.additem( 'd62' ) top = [ top1, top2, top3, top4, top5, top6, top7 ] addcomplextree( target, top, -3, 3) return True elif treetype == 'jungle4' or treetype == 'jungle5': base1 = wolfpack.additem( 'd6e' ) base2 = wolfpack.additem( 'd6f' ) base3 = wolfpack.additem( 'd70' ) base4 = wolfpack.additem( 'd71' ) base5 = wolfpack.additem( 'd72' ) base = [ base1, base2, base3, base4, base5 ] addcomplextree( target, base, -2, 2) if treetype == 'jungle4': top1 = wolfpack.additem( 'd73' ) top2 = wolfpack.additem( 'd74' ) top3 = wolfpack.additem( 'd75' ) top4 = wolfpack.additem( 'd76' ) top5 = wolfpack.additem( 'd77' ) top6 = wolfpack.additem( 'd78' ) top7 = wolfpack.additem( 'd79' ) top = [ top1, top2, top3, top4, top5, top6, top7 ] addcomplextree( target, top, -3, 3) return True elif treetype == 'jungle5': top1 = wolfpack.additem( 'd7a' ) top2 = wolfpack.additem( 'd7b' ) top3 = wolfpack.additem( 'd7c' ) top4 = wolfpack.additem( 'd7d' ) top5 = wolfpack.additem( 'd7e' ) top6 = wolfpack.additem( 'd7f' ) top7 = wolfpack.additem( 'd80' ) top = [ top1, top2, top3, top4, top5, top6, top7 ] addcomplextree( target, top, -3, 3) return True elif treetype == 'jungle6' or treetype == 'jungle7': base1 = wolfpack.additem( 'd84' ) base2 = wolfpack.additem( 'd85' ) base3 = wolfpack.additem( 'd86' ) base = [ base1, base2, base3 ] addcomplextree( target, base, -1, 1) if treetype == 'jungle6': top1 = wolfpack.additem( 'd87' ) top2 = wolfpack.additem( 'd88' ) top3 = wolfpack.additem( 'd89' ) top4 = wolfpack.additem( 'd8a' ) top5 = wolfpack.additem( 'd8b' ) top = [ top1, top2, top3, top4, top5 ] addcomplextree( target, top, -2, 2) return True elif treetype == 'jungle7': top1 = wolfpack.additem( 'd8c' ) top2 = wolfpack.additem( 'd8d' ) top3 = wolfpack.additem( 'd8e' ) top4 = wolfpack.additem( 'd8f' ) top5 = wolfpack.additem( 'd90' ) top = [ top1, top2, top3, top4, top5 ] addcomplextree( target, top, -2, 2) return True return False def createyewtree( player, arguments, target): # Tree yew1 = wolfpack.additem( '12b6' ) yew2 = wolfpack.additem( '12b7' ) yew3 = wolfpack.additem( '12b8' ) yew4 = wolfpack.additem( '12b9' ) yew5 = wolfpack.additem( '12ba' ) yew6 = wolfpack.additem( '12bb' ) yew7 = wolfpack.additem( '12bc' ) yew8 = wolfpack.additem( '12bd' ) yewtree = [yew1, yew2, yew3, yew4, yew5, yew6, yew7, yew8] xmod = -4 ymod = 4 addcomplextree( target, yewtree, xmod, ymod) # Leaves leaves1 = wolfpack.additem( '12be' ) leaves2 = wolfpack.additem( '12bf' ) leaves3 = wolfpack.additem( '12c0' ) leaves4 = wolfpack.additem( '12c1' ) leaves5 = wolfpack.additem( '12c2' ) leaves6 = wolfpack.additem( '12c3' ) leaves7 = wolfpack.additem( '12c4' ) leaves8 = wolfpack.additem( '12c5' ) leaves9 = wolfpack.additem( '12c6' ) leaves10 = wolfpack.additem( '12c7' ) yewleaves = [ leaves1, leaves2, leaves3, leaves4, leaves5, leaves6, leaves7, leaves8, leaves9, leaves10 ] xmod = -5 ymod = 5 addcomplextree( target, yewleaves, xmod, ymod) return True def createlog( player, args, target ): #added by Jim 20040814 logtype = args[0] if logtype == 'log1': log1 = wolfpack.additem( 'cf3' ) log1.moveto( target.pos ) log2 = wolfpack.additem( 'cf4' ) log2.pos = "%i,%i,%i,%i" % ( log1.pos.x , log1.pos.y + 1, log1.pos.z, log1.pos.map ) log1.update() log2.update() return True elif logtype == 'log2': log1 = wolfpack.additem( 'cf6' ) log1.moveto( target.pos ) log2 = wolfpack.additem( 'cf5' ) log2.pos = "%i,%i,%i,%i" % ( log1.pos.x - 1, log1.pos.y, log1.pos.z, log1.pos.map ) log3 = wolfpack.additem( 'cf7' ) log3.pos = "%i,%i,%i,%i" % ( log1.pos.x + 1, log1.pos.y, log1.pos.z, log1.pos.map ) log1.update() log2.update() log3.update() return True return False def createground( player, args, target ): item = wolfpack.additem( args[0] ) item.pos = target.pos item.update() return True def adddecor( socket, command, args ): if len(arguments) > 0: args= str( args.strip() ) args = args.split( ' ' ) if len( args ) == 2: ( key, value ) = args # Tree Lists if key == 'tree': # Random Forest Trees if value == 'forest': if socket.hastag( 'last_tree_forest' ): templist = [] for choice in forestlist: if choice != str( socket.gettag( 'last_tree_forest' ) ): templist += [ choice ] item = random.choice( templist ) socket.settag( 'last_tree_forest', str( item ) ) else: item = random.choice( forestlist ) socket.settag( 'last_tree_forest', str( item ) ) if item in trees: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): socket.sysmessage( "Where do you want to place the tree '%s', '%s' ?" % ( trees[item][TREE], trees[item][LEAVES ]) ) socket.attachtarget( 'commands.adddecor.createtree', [ item ] ) return True # Random Fruit Tree elif value == 'fruit': item = random.choice( fruitlist ) if socket.hastag( 'last_tree_fruit' ): templist = [] for choice in fruitlist: if choice != str( socket.gettag( 'last_tree_fruit' ) ): templist += [ choice ] item = random.choice( templist ) socket.settag( 'last_tree_fruit', str( item ) ) else: item = random.choice( fruitlist ) socket.settag( 'last_tree_fruit', str( item ) ) if item in trees: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): socket.sysmessage( "Where do you want to place the tree '%s', '%s' ?" % ( trees[item][TREE], trees[item][LEAVES ]) ) socket.attachtarget( 'commands.adddecor.createtree', [ item ] ) return True # Random Swamp Tree elif value == 'swamp': item = random.choice( swamplist ) if socket.hastag( 'last_tree_swamp' ): templist = [] for choice in swamplist: if choice != str( socket.gettag( 'last_tree_swamp' ) ): templist += [ choice ] item = random.choice( templist ) socket.settag( 'last_tree_swamp', str( item ) ) else: item = random.choice( swamplist ) socket.settag( 'last_tree_swamp', str( item ) ) if item in trees: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): socket.sysmessage( "Where do you want to place the tree '%s', '%s' ?" % ( trees[item][TREE], trees[item][LEAVES ]) ) socket.attachtarget( 'commands.adddecor.createtree', [ item ] ) return True # Random Trees elif value == 'random': if socket.hastag( 'last_tree_random' ): templist = [] for choice in treeindex: if choice != str( socket.gettag( 'last_tree_random' ) ): templist += [ choice ] item = random.choice( templist ) socket.settag( 'last_tree_random', str( item ) ) else: item = random.choice( treeindex ) socket.settag( 'last_tree_random', str( item ) ) if item in trees: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): socket.sysmessage( "Where do you want to place the tree '%s', '%s' ?" % ( trees[item][TREE], trees[item][LEAVES ]) ) socket.attachtarget( 'commands.adddecor.createtree', [ item ] ) return True # Yew Trees elif value == 'yew': socket.sysmessage( "Where do you want to place the yew tree?" ) socket.attachtarget( 'commands.adddecor.createyewtree', [] ) return True # Tree Logs log1, log2 elif value in [ 'log1', 'log2' ]: #added by Jim 20040814 socket.sysmessage( "Where do you want to place the fallen log [%s]?" % ( item ) ) socket.attachtarget( 'commands.adddecor.createlog', [ item ] ) return True # Jungle Trees elif value == 'jungle': if socket.hastag( 'last_tree_jungle' ): templist = [] for choice in jungleindex: if choice != str( socket.gettag( 'last_tree_jungle' ) ): templist += [ choice ] item = random.choice( templist ) socket.settag( 'last_tree_jungle', str( item ) ) else: item = random.choice( jungleindex ) socket.settag( 'last_tree_jungle', str( item ) ) socket.sysmessage( "Where do you want to place the jungle tree [%s]?" %( item ) ) socket.attachtarget( 'commands.adddecor.createjungletree', [ item ] ) return True # Specific Tree elif value in trees: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): socket.sysmessage( "Where do you want to place the tree '%s', '%s' ?" % ( trees[item][TREE], trees[item][LEAVES]) ) socket.attachtarget( 'commands.adddecor.createtree', [ item ] ) return True else: socket.sysmessage( "Usage: adddecor tree [ id, yew, jungle, random, forest, fruit, swamp, log[1-2] ]" ) return False elif key == 'ground': # Forest Ground Decoration if value == "forest": if socket.hastag( 'last_ground_forest' ): templist = [] for choice in forest_decor: if choice != str( socket.gettag( 'last_ground_forest' ) ): templist += [ choice ] item = random.choice( templist ) socket.settag( 'last_ground_forest', str( item ) ) else: item = random.choice( forest_decor ) socket.settag( 'last_ground_forest', str( item ) ) socket.attachtarget( 'commands.adddecor.createground', [ item ] ) return True # Swamp Ground Decoration elif value == "swamp": if socket.hastag( 'last_ground_swamp' ): templist = [] for choice in swamp_decor: if choice != str( socket.gettag( 'last_ground_swamp' ) ): templist += [ choice ] item = random.choice( templist ) socket.settag( 'last_ground_swamp', str( item ) ) else: item = random.choice( swamp_decor ) socket.settag( 'last_ground_swamp', str( item ) ) socket.attachtarget( 'commands.adddecor.createground', [ item ] ) return True # Plains/Grass Ground Decoration elif value == "plains": if socket.hastag( 'last_ground_plains' ): templist = [] for choice in plains_decor: if choice != str( socket.gettag( 'last_ground_plains' ) ): templist += [ choice ] item = random.choice( templist ) socket.settag( 'last_ground_plains', str( item ) ) else: item = random.choice( plains_decor ) socket.settag( 'last_ground_plains', str( item ) ) socket.attachtarget( 'commands.adddecor.createground', [ item ] ) return True # Jungle Ground Decoration elif value == "jungle": if socket.hastag( 'last_ground_jungle' ): templist = [] for choice in jungle_decor: if choice != str( socket.gettag( 'last_ground_jungle' ) ): templist += [ choice ] item = random.choice( templist ) socket.settag( 'last_ground_jungle', str( item ) ) else: item = random.choice( jungle_decor ) socket.settag( 'last_ground_jungle', str( item ) ) socket.attachtarget( 'commands.adddecor.createground', [ item ] ) return True # Desert Ground Decoration elif value == "desert": if socket.hastag( 'last_ground_desert' ): templist = [] for choice in desert_decor: if choice != str( socket.gettag( 'last_ground_desert' ) ): templist += [ choice ] item = random.choice( templist ) socket.settag( 'last_ground_desert', str( item ) ) else: item = random.choice( desert_decor ) socket.settag( 'last_ground_desert', str( item ) ) socket.attachtarget( 'commands.adddecor.createground', [ item ] ) return True # Nothing else: socket.sysmessage( "Usage: adddecor ground [ forest, swamp, plains, jungle, desert ]" ) return False # No Args else: socket.sysmessage( "Usage: adddecor [ tree, ground ]" ) return False return False def onLoad(): wolfpack.registercommand( 'adddecor', adddecor ) |
From: Sebastian H. <dar...@us...> - 2004-08-15 20:54:26
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22975 Modified Files: basics.cpp basics.h guilds.cpp guilds.h persistentobject.h world.cpp Log Message: Binary saving and loading of guilds. Index: persistentobject.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/persistentobject.h,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** persistentobject.h 15 Aug 2004 02:17:39 -0000 1.13 --- persistentobject.h 15 Aug 2004 20:54:16 -0000 1.14 *************** *** 145,154 **** Register a SQL query to retrieve objects of a given type. */ ! void registerSqlQuery( const QString& type, const QString& query ) { sql_queries.insert(type, query); sql_keys.push_back( type ); } /* Retrieve a SQL query to retrieve objects of a given type. */ --- 145,167 ---- Register a SQL query to retrieve objects of a given type. */ ! void registerSqlQuery( const QString& type, const QString& query, const QString &sqlcount ) { sql_queries.insert(type, query); + sql_count_queries.insert(type, sqlcount); sql_keys.push_back( type ); } /* + Retrieve a SQL query to retrieve the number of objects for a given type. + */ + QString findSqlCountQuery(const QString& type) const { + QMap<QString, QString>::const_iterator iter = sql_count_queries.find( type ); + + if (iter == sql_count_queries.end()) + return QString::null; + else + return iter.data(); + } + + /* Retrieve a SQL query to retrieve objects of a given type. */ *************** *** 171,174 **** --- 184,188 ---- private: QMap<QString, QString> sql_queries; + QMap<QString, QString> sql_count_queries; QStringList sql_keys; }; *************** *** 201,206 **** } // Register the SQL query for this type in the factory ! PersistentFactory::instance()->registerSqlQuery(className, sqlString); // Register the type for the 8-bit binary mapping --- 215,226 ---- } + QString sqlCountString = QString("SELECT COUNT(*) FROM %1").arg(tables.join(",")); + if (conditions.count() > 0) { + sqlCountString.append(" WHERE "); + sqlCountString.append(conditions.join(" AND ")); + } + // Register the SQL query for this type in the factory ! PersistentFactory::instance()->registerSqlQuery(className, sqlString, sqlCountString); // Register the type for the 8-bit binary mapping Index: basics.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/basics.h,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** basics.h 15 Aug 2004 02:17:39 -0000 1.26 --- basics.h 15 Aug 2004 20:54:16 -0000 1.27 *************** *** 34,38 **** --- 34,40 ---- #include <functional> + #include <algorithm> #include <qmap.h> + #include <qfile.h> // Forward definitions *************** *** 62,66 **** }; ! class QCString; class cBufferedWriter --- 64,96 ---- }; ! // Swap the value in place ! inline void swapBytes( unsigned int& data ) ! { ! data = ( ( data & 0xFF ) << 24 ) | ( ( data & 0xFF00 ) << 8 ) | ( ( data & 0xFF0000 ) >> 8 ) | ( ( data & 0xFF000000 ) >> 24 ); ! } ! ! inline void swapBytes( double& value ) ! { ! unsigned char * ptr = ( unsigned char * ) &value; ! std::swap( ptr[0], ptr[7] ); ! std::swap( ptr[1], ptr[6] ); ! std::swap( ptr[2], ptr[5] ); ! std::swap( ptr[3], ptr[4] ); ! } ! ! inline void swapBytes( int& data ) ! { ! data = ( ( data & 0xFF ) << 24 ) | ( ( data & 0xFF00 ) << 8 ) | ( ( data & 0xFF0000 ) >> 8 ) | ( ( data & 0xFF000000 ) >> 24 ); ! } ! ! inline void swapBytes( unsigned short& data ) ! { ! data = ( ( data & 0xFF00 ) >> 8 ) | ( ( data & 0xFF ) << 8 ); ! } ! ! inline void swapBytes( short& data ) ! { ! data = ( ( data & 0xFF00 ) >> 8 ) | ( ( data & 0xFF ) << 8 ); ! } class cBufferedWriter *************** *** 77,87 **** void flush(); ! void writeInt( unsigned int data, bool unbuffered = false ); ! void writeShort( unsigned short data, bool unbuffered = false ); ! void writeByte( unsigned char data, bool unbuffered = false ); ! void writeUtf8( const QString& data, bool unbuffered = false ); ! void writeAscii( const QCString& data, bool unbuffered = false ); ! void writeRaw( const void* data, unsigned int size, bool unbuffered = false ); ! void writeDouble( double data, bool unbuffered = false ); unsigned int position(); --- 107,118 ---- void flush(); ! inline void writeInt( unsigned int data, bool unbuffered = false ); ! inline void writeShort( unsigned short data, bool unbuffered = false ); ! inline void writeByte( unsigned char data, bool unbuffered = false ); ! inline void writeBool( bool data, bool unbuffered = false ); ! inline void writeUtf8( const QString& data, bool unbuffered = false ); ! inline void writeAscii( const QCString& data, bool unbuffered = false ); ! inline void writeRaw( const void* data, unsigned int size, bool unbuffered = false ); ! inline void writeDouble( double data, bool unbuffered = false ); unsigned int position(); *************** *** 92,95 **** --- 123,142 ---- }; + class cBufferedWriterPrivate + { + public: + QFile file; + unsigned int version; + QCString magic; + bool needswap; + QByteArray buffer; + unsigned int bufferpos; + QMap<QCString, unsigned int> dictionary; + QMap<unsigned char, unsigned int> skipmap; + QMap<unsigned char, QString> typemap; + unsigned int lastStringId; + unsigned int objectCount; + }; + class cBufferedReader { *************** *** 108,111 **** --- 155,159 ---- unsigned short readShort(); unsigned char readByte(); + bool readBool(); double readDouble(); QString readUtf8(); *************** *** 120,122 **** --- 168,283 ---- }; + inline void cBufferedWriter::writeInt( unsigned int data, bool unbuffered ) + { + // Inplace Swapping (data is a copy anyway) + if ( d->needswap ) { + swapBytes( data ); + } + + writeRaw( &data, sizeof( data ), unbuffered ); + } + + inline void cBufferedWriter::writeShort( unsigned short data, bool unbuffered ) + { + // Inplace Swapping (data is a copy anyway) + if ( d->needswap ) + { + swapBytes( data ); + } + + writeRaw( &data, sizeof( data ), unbuffered ); + } + + inline void cBufferedWriter::writeBool( bool data, bool unbuffered ) { + writeByte( data ? 1 : 0, unbuffered ); + } + + inline void cBufferedWriter::writeByte( unsigned char data, bool unbuffered ) + { + if ( unbuffered ) + { + flush(); + d->file.writeBlock( ( const char * ) &data, sizeof( data ) ); + } + else + { + if ( d->bufferpos + sizeof( data ) >= 4096 ) + { + flush(); // Flush buffer to file + } + + *( unsigned char * ) ( d->buffer.data() + d->bufferpos ) = data; + d->bufferpos += sizeof( data ); + } + } + + inline void cBufferedWriter::writeUtf8( const QString& data, bool unbuffered ) + { + QCString utf8 = data.utf8(); + writeAscii( utf8, unbuffered ); + } + + inline void cBufferedWriter::writeAscii( const QCString& data, bool unbuffered ) + { + QMap<QCString, unsigned int>::iterator it = d->dictionary.find( data ); + + if ( it != d->dictionary.end() ) + { + writeInt( it.data(), unbuffered ); + } + else + { + d->dictionary.insert( data, ++d->lastStringId ); + writeInt( d->lastStringId, unbuffered ); + } + } + + inline void cBufferedWriter::writeRaw( const void* data, unsigned int size, bool unbuffered ) + { + if ( unbuffered ) + { + flush(); + d->file.writeBlock( ( const char * ) data, size ); + } + else + { + // Flush out entire blocks if neccesary until we dont + // overflow the buffer anymore, then just append + unsigned int pos = 0; + + while ( d->bufferpos + size >= 4096 ) + { + unsigned int bspace = 4096 - d->bufferpos; + + // Try putting in some bytes of the remaining data + if ( bspace != 0 ) + { + memcpy( d->buffer.data() + d->bufferpos, ( unsigned char * ) data + pos, bspace ); + d->bufferpos = 4096; + pos += bspace; + size -= bspace; + } + + flush(); + } + + // There are still some remaining bytes of our data + if ( size != 0 ) + { + memcpy( d->buffer.data() + d->bufferpos, ( unsigned char * ) data + pos, size ); + d->bufferpos += size; + } + } + } + + inline void cBufferedWriter::writeDouble( double value, bool unbuffered ) + { + if ( d->needswap ) + { + swapBytes( value ); + } + + writeRaw( &value, sizeof( value ), unbuffered ); + } + #endif Index: guilds.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/guilds.h,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** guilds.h 15 Aug 2004 02:17:39 -0000 1.9 --- guilds.h 15 Aug 2004 20:54:16 -0000 1.10 *************** *** 40,44 **** \brief This class represents a guild and all associated information. */ ! class cGuild : public cPythonScriptable, public PersistentObject { public: --- 40,44 ---- \brief This class represents a guild and all associated information. */ ! class cGuild : public cPythonScriptable { public: *************** *** 131,146 **** QMap<P_PLAYER, MemberInfo*> memberinfo_; - static unsigned char classid; public: - static void registerInFactory(); - - static void setClassid(unsigned char id) { - cGuild::classid = id; - } - - unsigned char getClassid() const { - return cGuild::classid; - } - const char* objectID() const { return "cGuild"; --- 131,135 ---- *************** *** 171,179 **** void load( const cDBResult& result ); - /* - Build a sql string for loading all objects of this type from the database. - */ - static void buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ); - /*! \returns The guildstone for this guild. May be NULL. --- 160,163 ---- *************** *** 377,385 **** // Wrappers - void load( cBufferedReader& reader ); - void save( cBufferedWriter& reader ); void load( cBufferedReader& reader, unsigned int version ); void save( cBufferedWriter& reader, unsigned int version ); - void postload( unsigned int version ); // Methods inherited from cPythonScriptable --- 361,366 ---- Index: guilds.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/guilds.cpp,v retrieving revision 1.19 retrieving revision 1.20 diff -C2 -d -r1.19 -r1.20 *** guilds.cpp 15 Aug 2004 02:17:39 -0000 1.19 --- guilds.cpp 15 Aug 2004 20:54:16 -0000 1.20 *************** *** 26,29 **** --- 26,30 ---- */ + #include "basics.h" #include "guilds.h" *************** *** 33,38 **** #include "items.h" - unsigned char cGuild::classid; - cGuilds::~cGuilds() { --- 34,37 ---- *************** *** 58,67 **** } ! void cGuilds::save() ! { // Clear the tables first: guilds are not saved incremental. ! PersistentBroker::instance()->executeQuery( "DELETE FROM guilds;" ); ! PersistentBroker::instance()->executeQuery( "DELETE FROM guilds_members;" ); ! PersistentBroker::instance()->executeQuery( "DELETE FROM guilds_canidates;" ); for (iterator it = begin(); it != end(); ++it) { --- 57,65 ---- } ! void cGuilds::save() { // Clear the tables first: guilds are not saved incremental. ! PersistentBroker::instance()->executeQuery( "DELETE FROM guilds;" ); ! PersistentBroker::instance()->executeQuery( "DELETE FROM guilds_members;" ); ! PersistentBroker::instance()->executeQuery( "DELETE FROM guilds_canidates;" ); for (iterator it = begin(); it != end(); ++it) { *************** *** 70,75 **** } ! void cGuilds::load() ! { // Get all guilds from the database cDBResult result = PersistentBroker::instance()->query( "SELECT serial,name,abbreviation,charta,website,alignment,leader,founded,guildstone FROM guilds" ); --- 68,72 ---- } ! void cGuilds::load() { // Get all guilds from the database cDBResult result = PersistentBroker::instance()->query( "SELECT serial,name,abbreviation,charta,website,alignment,leader,founded,guildstone FROM guilds" ); *************** *** 890,916 **** } ! void cGuild::registerInFactory() { ! classid = BinaryTypemap::instance()->registerType("cGuild"); ! } ! void cGuild::load( cBufferedReader& reader ) { ! } ! void cGuild::save( cBufferedWriter& reader ) { ! } ! void cGuild::load( cBufferedReader& reader, unsigned int version ) { ! } ! void cGuild::save( cBufferedWriter& reader, unsigned int version ) { ! } ! void cGuild::postload( unsigned int version ) { ! } ! void cGuild::buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ) { ! fields.append("serial,name,abbreviation,charta,website,alignment,leader,founded,guildstone"); ! tables.append("guilds"); } ! static FactoryRegistration< cGuild > registration("cGuild"); --- 887,961 ---- } ! void cGuild::load( cBufferedReader& reader, unsigned int version ) { ! serial_ = reader.readInt(); ! name_ = reader.readUtf8(); ! abbreviation_ = reader.readUtf8(); ! charta_ = reader.readUtf8(); ! website_ = reader.readUtf8(); ! alignment_ = (eAlignment)reader.readByte(); ! leader_ = dynamic_cast<P_PLAYER>(World::instance()->findChar(reader.readInt())); ! founded_.setTime_t(reader.readInt()); ! guildstone_ = World::instance()->findItem(reader.readInt()); ! // Save Members/Canidates ! P_PLAYER player; ! int count, i; ! count = reader.readInt(); ! for (i = 0; i < count; ++i) { ! P_PLAYER player = dynamic_cast<P_PLAYER>( World::instance()->findChar( reader.readInt() ) ); ! MemberInfo* info = new MemberInfo; ! info->setShowSign( reader.readBool() ); ! info->setGuildTitle( reader.readUtf8() ); ! info->setJoined( reader.readInt() ); ! if (player) { ! player->setGuild(this); ! members_.append(player); ! memberinfo_.insert( player, info ); ! } else { ! delete info; ! } ! } ! count = reader.readInt(); ! for (i = 0; i < count; ++i) { ! P_PLAYER player = dynamic_cast<P_PLAYER>( World::instance()->findChar( reader.readInt() ) ); ! if (player) { ! addCanidate(player); ! } ! } } ! void cGuild::save( cBufferedWriter& writer, unsigned int version ) { ! writer.writeByte(0xFD); ! ! writer.writeInt(serial_); ! writer.writeUtf8(name_); ! writer.writeUtf8(abbreviation_); ! writer.writeUtf8(charta_); ! writer.writeUtf8(website_); ! writer.writeByte(alignment_); ! writer.writeInt(leader_ ? leader_->serial() : INVALID_SERIAL); ! writer.writeInt(founded_.toTime_t()); ! writer.writeInt(guildstone_ ? guildstone_->serial() : INVALID_SERIAL); ! ! // Save Members/Canidates ! P_PLAYER player; ! ! writer.writeInt(members_.count()); ! for ( player = members_.first(); player; player = members_.next() ) { ! MemberInfo* info = getMemberInfo(player); ! writer.writeInt(player->serial()); ! writer.writeBool(info->showSign()); ! writer.writeUtf8(info->guildTitle()); ! writer.writeInt(info->joined()); ! } ! ! writer.writeInt(canidates_.count()); ! for (player = canidates_.first(); player; player = canidates_.next()) { ! writer.writeInt(player->serial()); ! } ! } Index: world.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/world.cpp,v retrieving revision 1.111 retrieving revision 1.112 diff -C2 -d -r1.111 -r1.112 *** world.cpp 15 Aug 2004 02:17:39 -0000 1.111 --- world.cpp 15 Aug 2004 20:54:16 -0000 1.112 *************** *** 427,431 **** unsigned char type; const QMap<unsigned char, QCString> &typemap = reader.typemap(); - const QMap<unsigned char, QCString> &server_typemap = BinaryTypemap::instance()->getTypemap(); unsigned int loaded = 0; unsigned int count = reader.objectCount(); --- 427,430 ---- *************** *** 440,462 **** if ( typemap.contains( type ) ) { ! if ( !server_typemap.contains( type ) ) ! { ! // Get the size for this block from the worldfile ! // and skip the entire block ! Console::instance()->log( LOG_WARNING, QString( "Skipping unknown object type %1." ).arg( typemap[type] ) ); ! } ! else ! { ! PersistentObject *object = PersistentFactory::instance()->createObject( typemap[type] ); ! if (object) { ! try ! { ! object->load( reader ); ! } ! catch ( wpException e ) ! { ! } } } --- 439,452 ---- if ( typemap.contains( type ) ) { ! PersistentObject *object = PersistentFactory::instance()->createObject( typemap[type] ); ! if (object) { ! try { ! object->load( reader ); ! } catch (wpException e) { ! Console::instance()->log( LOG_WARNING, e.error() + "\n" ); } + } else { + // Skip an unknown object type. } *************** *** 476,479 **** --- 466,481 ---- // Special Type for Tags } + else if ( type == 0xFD ) + { + cGuild *guild = 0; + + try { + guild = new cGuild(); + guild->load(reader, reader.version()); + Guilds::instance()->registerGuild(guild); + } catch (wpException e) { + delete guild; + } + } else if ( type == 0xFE ) { *************** *** 532,536 **** QString type = types[j]; ! cDBResult res = PersistentBroker::instance()->query( QString( "SELECT COUNT(*) FROM uobjectmap WHERE type = '%1'" ).arg( type ) ); // Find out how many objects of this type are available --- 534,539 ---- QString type = types[j]; ! QString countQuery = PersistentFactory::instance()->findSqlCountQuery(type); ! cDBResult res = PersistentBroker::instance()->query( countQuery ); // Find out how many objects of this type are available *************** *** 559,564 **** // Fetch row-by-row PersistentBroker::instance()->driver()->setActiveConnection( CONN_SECOND ); ! while ( res.fetchrow() ) ! { unsigned short offset = 0; char** row = res.data(); --- 562,566 ---- // Fetch row-by-row PersistentBroker::instance()->driver()->setActiveConnection( CONN_SECOND ); ! while ( res.fetchrow() ) { unsigned short offset = 0; char** row = res.data(); *************** *** 740,744 **** result.free(); - // Load Guilds Guilds::instance()->load(); --- 742,745 ---- *************** *** 792,839 **** unsigned int startTime = getNormalizedTime(); ! if ( Config::instance()->databaseDriver() == "binary" ) ! { // Save in binary format - cItemIterator itemIterator; - P_ITEM item; cBufferedWriter writer( "WOLFPACK", DATABASE_VERSION ); writer.open( "world.bin" ); - const QMap<unsigned char, QCString> &typemap = BinaryTypemap::instance()->getTypemap(); ! for ( item = itemIterator.first(); item; item = itemIterator.next() ) ! { ! if ( !item->container() && !item->multi() ) ! { ! item->save( writer ); } } ! cCharIterator charIterator; ! P_CHAR character; ! for ( character = charIterator.first(); character; character = charIterator.next() ) ! { ! if ( !character->multi() ) ! { ! character->save( writer ); } } writer.writeByte( 0xFF ); // Terminator Type writer.close(); ! } ! else ! { ! if ( !PersistentBroker::instance()->openDriver( Config::instance()->databaseDriver() ) ) ! { Console::instance()->log( LOG_ERROR, QString( "Unknown Worldsave Database Driver '%1', check your wolfpack.xml" ).arg( Config::instance()->databaseDriver() ) ); return; } ! try ! { PersistentBroker::instance()->connect( Config::instance()->databaseHost(), Config::instance()->databaseName(), Config::instance()->databaseUsername(), Config::instance()->databasePassword() ); ! } ! catch ( QString& e ) ! { Console::instance()->log( LOG_ERROR, QString( "Couldn't open the database: %1\n" ).arg( e ) ); return; --- 793,834 ---- unsigned int startTime = getNormalizedTime(); ! if (Config::instance()->databaseDriver() == "binary") { // Save in binary format cBufferedWriter writer( "WOLFPACK", DATABASE_VERSION ); writer.open( "world.bin" ); ! cCharIterator charIterator; ! P_CHAR character; ! for (character = charIterator.first(); character; character = charIterator.next()) { ! if (!character->multi()) { ! character->save(writer); } } ! cItemIterator itemIterator; ! P_ITEM item; ! for (item = itemIterator.first(); item; item = itemIterator.next()) { ! if (!item->container() && !item->multi()) { ! item->save( writer ); } } + // Write Guilds + cGuilds::iterator git; + for (git = Guilds::instance()->begin(); git != Guilds::instance()->end(); ++git) { + (*git)->save(writer, writer.version()); + } + writer.writeByte( 0xFF ); // Terminator Type writer.close(); ! } else { ! if (!PersistentBroker::instance()->openDriver( Config::instance()->databaseDriver())) { Console::instance()->log( LOG_ERROR, QString( "Unknown Worldsave Database Driver '%1', check your wolfpack.xml" ).arg( Config::instance()->databaseDriver() ) ); return; } ! try { PersistentBroker::instance()->connect( Config::instance()->databaseHost(), Config::instance()->databaseName(), Config::instance()->databaseUsername(), Config::instance()->databasePassword() ); ! } catch (QString& e) { Console::instance()->log( LOG_ERROR, QString( "Couldn't open the database: %1\n" ).arg( e ) ); return; Index: basics.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/basics.cpp,v retrieving revision 1.33 retrieving revision 1.34 diff -C2 -d -r1.33 -r1.34 *** basics.cpp 15 Aug 2004 02:17:39 -0000 1.33 --- basics.cpp 15 Aug 2004 20:54:16 -0000 1.34 *************** *** 186,237 **** } - // Swap the value in place - inline void swapBytes( unsigned int& data ) - { - data = ( ( data & 0xFF ) << 24 ) | ( ( data & 0xFF00 ) << 8 ) | ( ( data & 0xFF0000 ) >> 8 ) | ( ( data & 0xFF000000 ) >> 24 ); - } - - inline void swapBytes( double& value ) - { - unsigned char * ptr = ( unsigned char * ) &value; - std::swap( ptr[0], ptr[7] ); - std::swap( ptr[1], ptr[6] ); - std::swap( ptr[2], ptr[5] ); - std::swap( ptr[3], ptr[4] ); - } - - inline void swapBytes( int& data ) - { - data = ( ( data & 0xFF ) << 24 ) | ( ( data & 0xFF00 ) << 8 ) | ( ( data & 0xFF0000 ) >> 8 ) | ( ( data & 0xFF000000 ) >> 24 ); - } - - inline void swapBytes( unsigned short& data ) - { - data = ( ( data & 0xFF00 ) >> 8 ) | ( ( data & 0xFF ) << 8 ); - } - - inline void swapBytes( short& data ) - { - data = ( ( data & 0xFF00 ) >> 8 ) | ( ( data & 0xFF ) << 8 ); - } - - class cBufferedWriterPrivate - { - public: - QFile file; - unsigned int version; - QCString magic; - bool needswap; - QByteArray buffer; - unsigned int bufferpos; - QMap<QCString, unsigned int> dictionary; - QMap<unsigned char, unsigned int> skipmap; - QMap<unsigned char, QString> typemap; - unsigned int lastStringId; - unsigned int objectCount; - }; - - #define BUFFERSIZE 4096 - cBufferedWriter::cBufferedWriter( const QCString& magic, unsigned int version ) { --- 186,189 ---- *************** *** 239,243 **** d->version = version; d->magic = magic; ! d->buffer.resize( BUFFERSIZE ); d->bufferpos = 0; d->lastStringId = 0; --- 191,195 ---- d->version = version; d->magic = magic; ! d->buffer.resize( 4096 ); d->bufferpos = 0; d->lastStringId = 0; *************** *** 356,400 **** } - void cBufferedWriter::writeInt( unsigned int data, bool unbuffered ) - { - // Inplace Swapping (data is a copy anyway) - if ( d->needswap ) - { - swapBytes( data ); - } - - writeRaw( &data, sizeof( data ), unbuffered ); - } - - void cBufferedWriter::writeShort( unsigned short data, bool unbuffered ) - { - // Inplace Swapping (data is a copy anyway) - if ( d->needswap ) - { - swapBytes( data ); - } - - writeRaw( &data, sizeof( data ), unbuffered ); - } - - void cBufferedWriter::writeByte( unsigned char data, bool unbuffered ) - { - if ( unbuffered ) - { - flush(); - d->file.writeBlock( ( const char * ) &data, sizeof( data ) ); - } - else - { - if ( d->bufferpos + sizeof( data ) >= BUFFERSIZE ) - { - flush(); // Flush buffer to file - } - - *( unsigned char * ) ( d->buffer.data() + d->bufferpos ) = data; - d->bufferpos += sizeof( data ); - } - } - void cBufferedWriter::flush() { --- 308,311 ---- *************** *** 403,465 **** } - void cBufferedWriter::writeUtf8( const QString& data, bool unbuffered ) - { - QCString utf8 = data.utf8(); - writeAscii( utf8, unbuffered ); - } - - void cBufferedWriter::writeAscii( const QCString& data, bool unbuffered ) - { - QMap<QCString, unsigned int>::iterator it = d->dictionary.find( data ); - - if ( it != d->dictionary.end() ) - { - writeInt( it.data(), unbuffered ); - } - else - { - d->dictionary.insert( data, ++d->lastStringId ); - writeInt( d->lastStringId, unbuffered ); - } - } - - void cBufferedWriter::writeRaw( const void* data, unsigned int size, bool unbuffered ) - { - if ( unbuffered ) - { - flush(); - d->file.writeBlock( ( const char * ) data, size ); - } - else - { - // Flush out entire blocks if neccesary until we dont - // overflow the buffer anymore, then just append - unsigned int pos = 0; - - while ( d->bufferpos + size >= BUFFERSIZE ) - { - unsigned int bspace = BUFFERSIZE - d->bufferpos; - - // Try putting in some bytes of the remaining data - if ( bspace != 0 ) - { - memcpy( d->buffer.data() + d->bufferpos, ( unsigned char * ) data + pos, bspace ); - d->bufferpos = BUFFERSIZE; - pos += bspace; - size -= bspace; - } - - flush(); - } - - // There are still some remaining bytes of our data - if ( size != 0 ) - { - memcpy( d->buffer.data() + d->bufferpos, ( unsigned char * ) data + pos, size ); - d->bufferpos += size; - } - } - } - unsigned int cBufferedWriter::position() { --- 314,317 ---- *************** *** 472,485 **** } - void cBufferedWriter::writeDouble( double value, bool unbuffered ) - { - if ( d->needswap ) - { - swapBytes( value ); - } - - writeRaw( &value, sizeof( value ), unbuffered ); - } - void cBufferedWriter::setSkipSize( unsigned char type, unsigned int skipsize ) { --- 324,327 ---- *************** *** 506,510 **** { d = new cBufferedReaderPrivate; ! d->buffer.resize( BUFFERSIZE ); d->bufferpos = 0; d->buffersize = 0; // Current amount of data in buffer --- 348,352 ---- { d = new cBufferedReaderPrivate; ! d->buffer.resize( 4096 ); d->bufferpos = 0; d->buffersize = 0; // Current amount of data in buffer *************** *** 669,672 **** --- 511,518 ---- } + bool cBufferedReader::readBool() { + return readByte() != 0; + } + unsigned char cBufferedReader::readByte() { *************** *** 747,754 **** if ( available == 0 ) { ! unsigned int read = d->file.readBlock( d->buffer.data(), BUFFERSIZE ); // We will never be able to statisfy the request ! if ( read != BUFFERSIZE && read < size ) { throw wpException( QString( "Unexpected end of file while reading." ) ); --- 593,600 ---- if ( available == 0 ) { ! unsigned int read = d->file.readBlock( d->buffer.data(), 4096 ); // We will never be able to statisfy the request ! if ( read != 4096 && read < size ) { throw wpException( QString( "Unexpected end of file while reading." ) ); |
From: Richard M. <dr...@us...> - 2004-08-15 08:57:13
|
Update of /cvsroot/wpdev/xmlscripts/scripts/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9013/commands Modified Files: export.py Log Message: Fixed a bug with exporting. Index: export.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/commands/export.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** export.py 15 Jul 2004 01:04:23 -0000 1.10 --- export.py 15 Aug 2004 08:57:04 -0000 1.11 *************** *** 193,197 **** output.write( "COLOR %i%s" % ( item.color, newline ) ) output.write( "CONT -1%s" % newline ) ! output.write( "}%s%s" ( newline, newline ) ) else: # Text --- 193,197 ---- output.write( "COLOR %i%s" % ( item.color, newline ) ) output.write( "CONT -1%s" % newline ) ! output.write( "}%s%s" % ( newline, newline ) ) else: # Text |
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27923 Modified Files: basechar.cpp basechar.h basics.cpp basics.h corpse.cpp corpse.h guilds.cpp guilds.h items.cpp items.h multi.cpp multi.h npc.cpp npc.h persistentobject.cpp persistentobject.h player.cpp player.h server.cpp uobject.cpp uobject.h wolfpack.vcproj world.cpp Log Message: Some very nice cleanups for the serialization code. THIS IS EXPERIMENTAL No release until fully tested. Index: uobject.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/uobject.cpp,v retrieving revision 1.172 retrieving revision 1.173 diff -C2 -d -r1.172 -r1.173 *** uobject.cpp 10 Aug 2004 03:15:57 -0000 1.172 --- uobject.cpp 15 Aug 2004 02:17:39 -0000 1.173 *************** *** 99,106 **** } - void cUObject::init() - { - } - void cUObject::moveTo( const Coord_cl& newpos, bool noRemove ) { --- 99,102 ---- *************** *** 268,277 **** Builds the SQL string needed to retrieve all objects of this type. */ ! void cUObject::buildSqlString( QStringList& fields, QStringList& tables, QStringList& conditions ) { // We are requiring fixed order by now, so this *is* possible fields.push_back( "uobject.name,uobject.serial,uobject.multis,uobject.pos_x,uobject.pos_y,uobject.pos_z,uobject.pos_map,uobject.events,uobject.havetags" ); tables.push_back( "uobject" ); conditions.push_back( "uobjectmap.serial = uobject.serial" ); } --- 264,275 ---- Builds the SQL string needed to retrieve all objects of this type. */ ! void cUObject::buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ) { // We are requiring fixed order by now, so this *is* possible fields.push_back( "uobject.name,uobject.serial,uobject.multis,uobject.pos_x,uobject.pos_y,uobject.pos_z,uobject.pos_map,uobject.events,uobject.havetags" ); tables.push_back( "uobject" ); + tables.push_back( "uobjectmap" ); conditions.push_back( "uobjectmap.serial = uobject.serial" ); + conditions.push_back( QString("uobjectmap.type = '%1'").arg(objectid) ); } *************** *** 1063,1068 **** } ! void cUObject::save( cBufferedWriter& writer ) ! { writer.setObjectCount( writer.objectCount() + 1 ); writer.writeByte( getClassid() ); --- 1061,1065 ---- } ! void cUObject::save(cBufferedWriter& writer) { writer.setObjectCount( writer.objectCount() + 1 ); writer.writeByte( getClassid() ); Index: uobject.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/uobject.h,v retrieving revision 1.102 retrieving revision 1.103 diff -C2 -d -r1.102 -r1.103 *** uobject.h 10 Aug 2004 03:15:57 -0000 1.102 --- uobject.h 15 Aug 2004 02:17:39 -0000 1.103 *************** *** 80,85 **** // Things for building the SQL string ! static void buildSqlString( QStringList& fields, QStringList& tables, QStringList& conditions ); ! void init(); enum eChanged --- 80,84 ---- // Things for building the SQL string ! static void buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ); enum eChanged *************** *** 129,139 **** // Wrapper ! virtual void load( cBufferedReader& reader ) = 0; ! virtual void save( cBufferedWriter& reader ); // "Real" ones ! virtual void load( cBufferedReader& reader, unsigned int version ); ! virtual void save( cBufferedWriter& reader, unsigned int version ); ! virtual void postload( unsigned int version ) = 0; // Utility Methods --- 128,138 ---- // Wrapper ! void load( cBufferedReader& reader ) = 0; ! void save( cBufferedWriter& reader ); // "Real" ones ! void load( cBufferedReader& reader, unsigned int version ); ! void save( cBufferedWriter& reader, unsigned int version ); ! void postload( unsigned int version ) = 0; // Utility Methods *************** *** 238,291 **** #pragma pack() - class cUObjectFactory : public Factory<cUObject, QString> - { - public: - cUObjectFactory() - { - lastid = 0; - } - - unsigned int registerSqlQuery( const QString& type, const QString& query ) - { - sql_queries.insert( std::make_pair( type, query ) ); - sql_keys.push_back( type ); - - if ( lastid + 1 < lastid ) - { - throw wpException( "Only 256 types can be registered with the UObject factory." ); - } - - typemap.insert( lastid, type ); - return lastid++; - } - - QString findSqlQuery( const QString& type ) const - { - std::map<QString, QString>::const_iterator iter = sql_queries.find( type ); - - if ( iter == sql_queries.end() ) - return QString::null; - else - return iter->second; - } - - QStringList objectTypes() const - { - return sql_keys; - } - - const QMap<unsigned char, QString>& getTypemap() - { - return typemap; - } - - private: - std::map<QString, QString> sql_queries; - QMap<unsigned char, QString> typemap; - QStringList sql_keys; - unsigned char lastid; - }; - - typedef SingletonHolder<cUObjectFactory> UObjectFactory; - #endif // __UOBJECT_H__ --- 237,239 ---- Index: basics.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/basics.cpp,v retrieving revision 1.32 retrieving revision 1.33 diff -C2 -d -r1.32 -r1.33 *** basics.cpp 10 Aug 2004 03:15:56 -0000 1.32 --- basics.cpp 15 Aug 2004 02:17:39 -0000 1.33 *************** *** 283,288 **** // Start writing the object type list ! const QMap<unsigned char, QString> &typemap = UObjectFactory::instance()->getTypemap(); ! QMap<unsigned char, QString>::const_iterator it; d->skipmap.clear(); --- 283,288 ---- // Start writing the object type list ! const QMap<unsigned char, QCString> &typemap = BinaryTypemap::instance()->getTypemap(); ! QMap<unsigned char, QCString>::const_iterator it; d->skipmap.clear(); *************** *** 292,296 **** writeByte( it.key() ); writeInt( 0 ); // SkipSize ! writeAscii( it.data().latin1() ); // Preinsert into the dictionary d->skipmap.insert( it.key(), 0 ); d->typemap.insert( it.key(), it.data() ); --- 292,296 ---- writeByte( it.key() ); writeInt( 0 ); // SkipSize ! writeAscii( it.data() ); // Preinsert into the dictionary d->skipmap.insert( it.key(), 0 ); d->typemap.insert( it.key(), it.data() ); Index: multi.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/multi.cpp,v retrieving revision 1.13 retrieving revision 1.14 diff -C2 -d -r1.13 -r1.14 *** multi.cpp 12 Aug 2004 03:02:50 -0000 1.13 --- multi.cpp 15 Aug 2004 02:17:39 -0000 1.14 *************** *** 62,65 **** --- 62,69 ---- } + void cMulti::buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ) { + cItem::buildSqlString(objectid, fields, tables, conditions); + } + const char* cMulti::className() const { *************** *** 150,166 **** } ! static cUObject* productCreator() ! { ! return new cMulti; ! } ! ! void cMulti::registerInFactory() ! { ! QStringList fields, tables, conditions; ! cItem::buildSqlString( fields, tables, conditions ); // Build our SQL string ! QString sqlString = QString( "SELECT %1 FROM uobjectmap,%2 WHERE uobjectmap.type = 'cMulti' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) ); ! UObjectFactory::instance()->registerType( "cMulti", productCreator ); ! classid = UObjectFactory::instance()->registerSqlQuery( "cMulti", sqlString ); ! } unsigned char cMulti::classid; --- 154,158 ---- } ! static FactoryRegistration<cMulti> registration("cMulti"); unsigned char cMulti::classid; Index: items.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/items.cpp,v retrieving revision 1.433 retrieving revision 1.434 diff -C2 -d -r1.433 -r1.434 *** items.cpp 14 Aug 2004 09:27:45 -0000 1.433 --- items.cpp 15 Aug 2004 02:17:39 -0000 1.434 *************** *** 1433,1452 **** } - static cUObject* productCreator() - { - return new cItem; - } - - void cItem::registerInFactory() - { - QStringList fields, tables, conditions; - buildSqlString( fields, tables, conditions ); // Build our SQL string - QString sqlString = QString( "SELECT %1 FROM uobjectmap,%2 WHERE uobjectmap.type = 'cItem' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) ); - UObjectFactory::instance()->registerType( "cItem", productCreator ); - classid = UObjectFactory::instance()->registerSqlQuery( "cItem", sqlString ); - } - unsigned char cItem::classid; void cItem::load( char** result, UINT16& offset ) { --- 1433,1440 ---- } unsigned char cItem::classid; + static FactoryRegistration<cItem> registration("cItem"); + void cItem::load( char** result, UINT16& offset ) { *************** *** 1488,1494 **** } ! void cItem::buildSqlString( QStringList& fields, QStringList& tables, QStringList& conditions ) { ! cUObject::buildSqlString( fields, tables, conditions ); fields.push_back( "items.id,items.color,items.cont,items.layer,items.amount,items.hp,items.maxhp,items.movable,items.owner,items.visible,items.priv,items.baseid" ); tables.push_back( "items" ); --- 1476,1482 ---- } ! void cItem::buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ) { ! cUObject::buildSqlString( objectid, fields, tables, conditions ); fields.push_back( "items.id,items.color,items.cont,items.layer,items.amount,items.hp,items.maxhp,items.movable,items.owner,items.visible,items.priv,items.baseid" ); tables.push_back( "items" ); Index: corpse.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/corpse.cpp,v retrieving revision 1.62 retrieving revision 1.63 diff -C2 -d -r1.62 -r1.63 *** corpse.cpp 10 Aug 2004 03:15:56 -0000 1.62 --- corpse.cpp 15 Aug 2004 02:17:39 -0000 1.63 *************** *** 43,65 **** using namespace std; ! static cUObject* productCreator() ! { ! return new cCorpse; ! } ! ! void cCorpse::registerInFactory() ! { ! QStringList fields, tables, conditions; ! buildSqlString( fields, tables, conditions ); // Build our SQL string ! QString sqlString = QString( "SELECT %1 FROM uobjectmap,%2 WHERE uobjectmap.type = 'cCorpse' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) ); ! UObjectFactory::instance()->registerType( "cCorpse", productCreator ); ! classid = UObjectFactory::instance()->registerSqlQuery( "cCorpse", sqlString ); ! } unsigned char cCorpse::classid; ! void cCorpse::buildSqlString( QStringList& fields, QStringList& tables, QStringList& conditions ) { ! cItem::buildSqlString( fields, tables, conditions ); fields.push_back( "corpses.bodyid,corpses.hairstyle,corpses.haircolor,corpses.beardstyle,corpses.beardcolor" ); fields.push_back( "corpses.direction,corpses.charbaseid,corpses.murderer,corpses.murdertime" ); --- 43,53 ---- using namespace std; ! static FactoryRegistration<cCorpse> registration("cCorpse"); unsigned char cCorpse::classid; ! void cCorpse::buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ) { ! cItem::buildSqlString( objectid, fields, tables, conditions ); fields.push_back( "corpses.bodyid,corpses.hairstyle,corpses.haircolor,corpses.beardstyle,corpses.beardcolor" ); fields.push_back( "corpses.direction,corpses.charbaseid,corpses.murderer,corpses.murdertime" ); Index: items.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/items.h,v retrieving revision 1.211 retrieving revision 1.212 diff -C2 -d -r1.211 -r1.212 *** items.h 14 Aug 2004 03:40:36 -0000 1.211 --- items.h 15 Aug 2004 02:17:39 -0000 1.212 *************** *** 183,186 **** --- 183,189 ---- cItem( const cItem& src ); // Copy constructor + static void setClassid(unsigned char id) { + cItem::classid = id; + } unsigned char getClassid() *************** *** 545,557 **** static P_ITEM createFromList( const QString& list ); static P_ITEM createFromId( unsigned short id ); ! static void registerInFactory(); protected: // Methods - static void buildSqlString( QStringList& fields, QStringList& tables, QStringList& conditions ); virtual void processNode( const cElement* Tag ); void processModifierNode( const cElement* Tag ); - protected: unsigned short id_; // Display id of the item unsigned short color_ : 12; // Color of this item (Note: only colors up to 0xBFF available -> 12 bit) --- 548,559 ---- static P_ITEM createFromList( const QString& list ); static P_ITEM createFromId( unsigned short id ); ! ! static void buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ); protected: // Methods virtual void processNode( const cElement* Tag ); void processModifierNode( const cElement* Tag ); unsigned short id_; // Display id of the item unsigned short color_ : 12; // Color of this item (Note: only colors up to 0xBFF available -> 12 bit) Index: basics.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/basics.h,v retrieving revision 1.25 retrieving revision 1.26 diff -C2 -d -r1.25 -r1.26 *** basics.h 10 Aug 2004 03:15:56 -0000 1.25 --- basics.h 15 Aug 2004 02:17:39 -0000 1.26 *************** *** 121,123 **** #endif - --- 121,122 ---- Index: server.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/server.cpp,v retrieving revision 1.16 retrieving revision 1.17 diff -C2 -d -r1.16 -r1.17 *** server.cpp 10 Aug 2004 03:15:57 -0000 1.16 --- server.cpp 15 Aug 2004 02:17:39 -0000 1.17 *************** *** 442,452 **** void cServer::load() { - // Registers our Built-in types into factory. - cPlayer::registerInFactory(); - cMulti::registerInFactory(); - cNPC::registerInFactory(); - cItem::registerInFactory(); - cCorpse::registerInFactory(); - // NPC AI types Monster_Aggressive_L0::registerInFactory(); --- 442,445 ---- Index: basechar.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/basechar.h,v retrieving revision 1.79 retrieving revision 1.80 diff -C2 -d -r1.79 -r1.80 *** basechar.h 13 Aug 2004 08:55:24 -0000 1.79 --- basechar.h 15 Aug 2004 02:17:39 -0000 1.80 *************** *** 631,635 **** // other protected methods ! static void buildSqlString( QStringList& fields, QStringList& tables, QStringList& conditions ); virtual void processNode( const cElement* Tag ); --- 631,635 ---- // other protected methods ! static void buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ); virtual void processNode( const cElement* Tag ); Index: corpse.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/corpse.h,v retrieving revision 1.27 retrieving revision 1.28 diff -C2 -d -r1.27 -r1.28 *** corpse.h 10 Aug 2004 03:15:56 -0000 1.27 --- corpse.h 15 Aug 2004 02:17:39 -0000 1.28 *************** *** 43,47 **** { private: - static void buildSqlString( QStringList& fields, QStringList& tables, QStringList& conditions ); bool changed_; static unsigned char classid; --- 43,46 ---- *************** *** 62,65 **** --- 61,66 ---- // they're displayed as equipment public: + static void buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ); + unsigned char getClassid() { *************** *** 67,70 **** --- 68,75 ---- } + static void setClassid(unsigned char id) { + cCorpse::classid = id; + } + cCorpse( bool init = false ); void setBodyId( UINT16 data ); *************** *** 109,113 **** // DB Serialization - static void registerInFactory(); void load( char**, UINT16& ); void save(); --- 114,117 ---- Index: player.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/player.h,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** player.h 12 Aug 2004 03:02:51 -0000 1.54 --- player.h 15 Aug 2004 02:17:39 -0000 1.55 *************** *** 71,75 **** // implementation of interfaces - static void registerInFactory(); void load( char**, UINT16& ); void save(); --- 71,74 ---- *************** *** 201,204 **** --- 200,207 ---- const char* className() const; + static void setClassid(unsigned char id) { + cPlayer::classid = id; + } + unsigned char getClassid() { *************** *** 206,209 **** --- 209,214 ---- } + static void buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ); + private: bool changed_; *************** *** 212,216 **** protected: // interface implementation - static void buildSqlString( QStringList& fields, QStringList& tables, QStringList& conditions ); // Reference to a guild this character is in --- 217,220 ---- Index: persistentobject.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/persistentobject.cpp,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** persistentobject.cpp 2 Jun 2004 15:04:06 -0000 1.9 --- persistentobject.cpp 15 Aug 2004 02:17:39 -0000 1.10 *************** *** 50,51 **** --- 50,57 ---- isPersistent = true; } + + void PersistentObject::postload( unsigned int version ) { + } + + static void buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ) { + } Index: persistentobject.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/persistentobject.h,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** persistentobject.h 2 Jun 2004 15:04:06 -0000 1.12 --- persistentobject.h 15 Aug 2004 02:17:39 -0000 1.13 *************** *** 29,33 **** --- 29,40 ---- #define __PERSISTENTOBJECT_H__ + #include <typeinfo> #include <qobject.h> + #include <qstringlist.h> + #include "singleton.h" + #include "factory.h" + + class cBufferedReader; + class cBufferedWriter; #pragma pack(1) *************** *** 41,44 **** --- 48,53 ---- { } + + static void buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ); virtual bool del(); *************** *** 46,49 **** --- 55,67 ---- virtual void save(); + // Wrapper + virtual void load( cBufferedReader& reader ) = 0; + virtual void save( cBufferedWriter& reader ) = 0; + + // "Real" ones + virtual void load( cBufferedReader& reader, unsigned int version ) = 0; + virtual void save( cBufferedWriter& reader, unsigned int version ) = 0; + virtual void postload( unsigned int version ); + virtual const char* objectID() const { *************** *** 53,55 **** --- 71,211 ---- #pragma pack() + /* + This class is used to assign 8-bit keys to all + classes that should be serialized by the binary + serialization system. + */ + class cBinaryTypemap { + protected: + typedef QMap<unsigned char, QCString> Container; + typedef Container::iterator Iterator; + + /* + The map storing the 8-bit to string mapping. + */ + Container typemap; + + public: + /* + Register a new type with this object and return + the 8-bit identifier assigned to this type. + */ + unsigned int registerType(QCString type) { + // Find the largest typeid in use + int lastid = -1; + for (Iterator it = typemap.begin(); it != typemap.end(); ++it) { + if (it.key() > lastid) { + lastid = it.key(); + } + } + + // Increase the typeid and register the type + lastid += 1; + typemap.insert(lastid, type); + + // Return the assigned type id. + return lastid; + } + + /* + Get a type identified by its 8-bit key. + */ + QString getType(unsigned char key) { + if (!typemap.contains(key)) { + return QString::null; + } + + return typemap[key]; + } + + /* + Check if a given 8-bit key is known. + */ + bool hasType(unsigned char key) { + return typemap.contains(key); + } + + /* + Return the full typemap. + */ + const QMap<unsigned char, QCString> &getTypemap() { + return typemap; + } + }; + + typedef SingletonHolder<cBinaryTypemap> BinaryTypemap; + + /* + This factory creates objects from type ids used in the + binary and database serialization process. + */ + class cPersistentFactory : public Factory<PersistentObject, QString> { + public: + /* + Register a SQL query to retrieve objects of a given type. + */ + void registerSqlQuery( const QString& type, const QString& query ) { + sql_queries.insert(type, query); + sql_keys.push_back( type ); + } + + /* + Retrieve a SQL query to retrieve objects of a given type. + */ + QString findSqlQuery(const QString& type) const { + QMap<QString, QString>::const_iterator iter = sql_queries.find( type ); + + if (iter == sql_queries.end()) + return QString::null; + else + return iter.data(); + } + + /* + Retrieve the list of registered object types. + */ + const QStringList &objectTypes() const { + return sql_keys; + } + + private: + QMap<QString, QString> sql_queries; + QStringList sql_keys; + }; + + typedef SingletonHolder<cPersistentFactory> PersistentFactory; + + /* + A static and local instance of this class allows an automatic + registration of a type in the factory at application startup. + The registration order isn't predictable though. + */ + template <class C> + class FactoryRegistration { + public: + static PersistentObject *productCreator() { + return new C; + } + + FactoryRegistration(const char *className) { + // Register the type for creation + PersistentFactory::instance()->registerType(className, productCreator); + + // Build the SQL query for selecting all objects of this type + QStringList fields, tables, conditions; + C::buildSqlString(className, fields, tables, conditions); + QString sqlString = QString("SELECT %1 FROM %2").arg(fields.join(",")).arg(tables.join(",")); + if (conditions.count() > 0) { + sqlString.append(" WHERE "); + sqlString.append(conditions.join(" AND ")); + } + + // Register the SQL query for this type in the factory + PersistentFactory::instance()->registerSqlQuery(className, sqlString); + + // Register the type for the 8-bit binary mapping + C::setClassid(BinaryTypemap::instance()->registerType(className)); + } + }; + #endif // __PERSISTENTOBJECT_H__ Index: wolfpack.vcproj =================================================================== RCS file: /cvsroot/wpdev/wolfpack/wolfpack.vcproj,v retrieving revision 1.40 retrieving revision 1.41 diff -C2 -d -r1.40 -r1.41 *** wolfpack.vcproj 9 Aug 2004 20:30:22 -0000 1.40 --- wolfpack.vcproj 15 Aug 2004 02:17:39 -0000 1.41 *************** *** 86,90 **** OptimizeForProcessor="0" OptimizeForWindowsApplication="TRUE" ! AdditionalIncludeDirectories="sqlite;"D:\coding\STLport-5.0-0125\stlport";D:\coding\msvcrt\include;qt;C:\MySQL\include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;QT_THREAD_SUPPORT;QT_LITE_COMPONENT;QT_DLL;QT_NO_STL;QT_NO_COMPRESS;CRASHHANDLER;MYSQL_DRIVER" StringPooling="TRUE" --- 86,90 ---- OptimizeForProcessor="0" OptimizeForWindowsApplication="TRUE" ! AdditionalIncludeDirectories="sqlite;qt;C:\MySQL\include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;QT_THREAD_SUPPORT;QT_LITE_COMPONENT;QT_DLL;QT_NO_STL;QT_NO_COMPRESS;CRASHHANDLER;MYSQL_DRIVER" StringPooling="TRUE" *************** *** 165,169 **** OptimizeForProcessor="0" OptimizeForWindowsApplication="TRUE" ! AdditionalIncludeDirectories="sqlite;"D:\coding\STLport-5.0-0125\stlport";D:\coding\msvcrt\include;qt;C:\MySQL\include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;QT_THREAD_SUPPORT;QT_LITE_COMPONENT;QT_DLL;QT_NO_STL;QT_NO_COMPRESS;CRASHHANDLER;MYSQL_DRIVER" StringPooling="TRUE" --- 165,169 ---- OptimizeForProcessor="0" OptimizeForWindowsApplication="TRUE" ! AdditionalIncludeDirectories="sqlite;STLPort\stlport;msvcrt\include;qt;C:\MySQL\include" PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;QT_THREAD_SUPPORT;QT_LITE_COMPONENT;QT_DLL;QT_NO_STL;QT_NO_COMPRESS;CRASHHANDLER;MYSQL_DRIVER" StringPooling="TRUE" *************** *** 190,194 **** LinkIncremental="1" SuppressStartupBanner="TRUE" ! AdditionalLibraryDirectories="D:\coding\msvcrt\lib;C:\MySQL\lib\opt" IgnoreAllDefaultLibraries="TRUE" GenerateDebugInformation="TRUE" --- 190,194 ---- LinkIncremental="1" SuppressStartupBanner="TRUE" ! AdditionalLibraryDirectories="msvcrt\lib;C:\MySQL\lib\opt" IgnoreAllDefaultLibraries="TRUE" GenerateDebugInformation="TRUE" *************** *** 274,283 **** </File> <File - RelativePath=".\serverconfig.cpp"> - </File> - <File - RelativePath=".\serverconfig.h"> - </File> - <File RelativePath=".\win\config_win.cpp"> </File> --- 274,277 ---- *************** *** 487,490 **** --- 481,490 ---- </File> <File + RelativePath=".\serverconfig.cpp"> + </File> + <File + RelativePath=".\serverconfig.h"> + </File> + <File RelativePath=".\singleton.h"> </File> Index: basechar.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/basechar.cpp,v retrieving revision 1.129 retrieving revision 1.130 diff -C2 -d -r1.129 -r1.130 *** basechar.cpp 13 Aug 2004 08:55:24 -0000 1.129 --- basechar.cpp 15 Aug 2004 02:17:38 -0000 1.130 *************** *** 134,140 **** } ! void cBaseChar::buildSqlString( QStringList& fields, QStringList& tables, QStringList& conditions ) { ! cUObject::buildSqlString( fields, tables, conditions ); fields.push_back( "characters.name,characters.title,characters.creationdate" ); fields.push_back( "characters.body,characters.orgbody,characters.skin" ); --- 134,140 ---- } ! void cBaseChar::buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ) { ! cUObject::buildSqlString( objectid, fields, tables, conditions ); fields.push_back( "characters.name,characters.title,characters.creationdate" ); fields.push_back( "characters.body,characters.orgbody,characters.skin" ); Index: guilds.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/guilds.cpp,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** guilds.cpp 10 Aug 2004 03:15:57 -0000 1.18 --- guilds.cpp 15 Aug 2004 02:17:39 -0000 1.19 *************** *** 33,36 **** --- 33,38 ---- #include "items.h" + unsigned char cGuild::classid; + cGuilds::~cGuilds() { *************** *** 59,68 **** { // Clear the tables first: guilds are not saved incremental. ! PersistentBroker::instance()->executeQuery( "DELETE FROM guilds;" ); ! PersistentBroker::instance()->executeQuery( "DELETE FROM guilds_members;" ); ! PersistentBroker::instance()->executeQuery( "DELETE FROM guilds_canidates;" ); ! for ( iterator it = begin(); it != end(); ++it ) ! { it.data()->save(); } --- 61,69 ---- { // Clear the tables first: guilds are not saved incremental. ! PersistentBroker::instance()->executeQuery( "DELETE FROM guilds;" ); ! PersistentBroker::instance()->executeQuery( "DELETE FROM guilds_members;" ); ! PersistentBroker::instance()->executeQuery( "DELETE FROM guilds_canidates;" ); ! for (iterator it = begin(); it != end(); ++it) { it.data()->save(); } *************** *** 78,82 **** cGuild* guild = new cGuild( false ); guild->load( result ); - registerGuild( guild ); } --- 79,82 ---- *************** *** 138,141 **** --- 138,143 ---- leader_ = 0; } + + Guilds::instance()->registerGuild(this); } *************** *** 887,888 **** --- 889,916 ---- return ( PyObject * ) returnVal; } + + void cGuild::registerInFactory() { + classid = BinaryTypemap::instance()->registerType("cGuild"); + } + + void cGuild::load( cBufferedReader& reader ) { + } + + void cGuild::save( cBufferedWriter& reader ) { + } + + void cGuild::load( cBufferedReader& reader, unsigned int version ) { + } + + void cGuild::save( cBufferedWriter& reader, unsigned int version ) { + } + + void cGuild::postload( unsigned int version ) { + } + + void cGuild::buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ) { + fields.append("serial,name,abbreviation,charta,website,alignment,leader,founded,guildstone"); + tables.append("guilds"); + } + + static FactoryRegistration< cGuild > registration("cGuild"); Index: npc.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/npc.h,v retrieving revision 1.55 retrieving revision 1.56 diff -C2 -d -r1.55 -r1.56 *** npc.h 13 Aug 2004 08:55:25 -0000 1.55 --- npc.h 15 Aug 2004 02:17:39 -0000 1.56 *************** *** 87,91 **** // implementation of interfaces - static void registerInFactory(); void load( char**, UINT16& ); void save(); --- 87,90 ---- *************** *** 197,200 **** --- 196,203 ---- const char* className() const; + static void setClassid(unsigned char id) { + cNPC::classid = id; + } + unsigned char getClassid() { *************** *** 202,205 **** --- 205,210 ---- } + static void buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ); + private: bool changed_; *************** *** 208,212 **** protected: // interface implementation - static void buildSqlString( QStringList& fields, QStringList& tables, QStringList& conditions ); virtual void processNode( const cElement* Tag ); --- 213,216 ---- Index: player.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/player.cpp,v retrieving revision 1.118 retrieving revision 1.119 diff -C2 -d -r1.118 -r1.119 *** player.cpp 12 Aug 2004 03:02:50 -0000 1.118 --- player.cpp 15 Aug 2004 02:17:39 -0000 1.119 *************** *** 85,107 **** } ! static cUObject* productCreator() ! { ! return new cPlayer; ! } ! ! void cPlayer::registerInFactory() ! { ! QStringList fields, tables, conditions; ! buildSqlString( fields, tables, conditions ); // Build our SQL string ! QString sqlString = QString( "SELECT %1 FROM uobjectmap,%2 WHERE uobjectmap.type = 'cPlayer' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) ); ! UObjectFactory::instance()->registerType( "cPlayer", productCreator ); ! classid = UObjectFactory::instance()->registerSqlQuery( "cPlayer", sqlString ); ! } unsigned char cPlayer::classid; ! void cPlayer::buildSqlString( QStringList& fields, QStringList& tables, QStringList& conditions ) { ! cBaseChar::buildSqlString( fields, tables, conditions ); fields.push_back( "players.account,players.additionalflags,players.visualrange" ); fields.push_back( "players.profile,players.fixedlight" ); --- 85,95 ---- } ! static FactoryRegistration<cPlayer> registration("cPlayer"); unsigned char cPlayer::classid; ! void cPlayer::buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ) { ! cBaseChar::buildSqlString( objectid, fields, tables, conditions ); fields.push_back( "players.account,players.additionalflags,players.visualrange" ); fields.push_back( "players.profile,players.fixedlight" ); Index: guilds.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/guilds.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** guilds.h 10 Aug 2004 03:15:57 -0000 1.8 --- guilds.h 15 Aug 2004 02:17:39 -0000 1.9 *************** *** 40,44 **** \brief This class represents a guild and all associated information. */ ! class cGuild : public cPythonScriptable { public: --- 40,44 ---- \brief This class represents a guild and all associated information. */ ! class cGuild : public cPythonScriptable, public PersistentObject { public: *************** *** 130,134 **** --- 130,150 ---- QPtrList<cPlayer> canidates_; QMap<P_PLAYER, MemberInfo*> memberinfo_; + + static unsigned char classid; public: + static void registerInFactory(); + + static void setClassid(unsigned char id) { + cGuild::classid = id; + } + + unsigned char getClassid() const { + return cGuild::classid; + } + + const char* objectID() const { + return "cGuild"; + } + /*! \brief Creates a new guild. *************** *** 155,158 **** --- 171,179 ---- void load( const cDBResult& result ); + /* + Build a sql string for loading all objects of this type from the database. + */ + static void buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ); + /*! \returns The guildstone for this guild. May be NULL. *************** *** 355,358 **** --- 376,386 ---- } + // Wrappers + void load( cBufferedReader& reader ); + void save( cBufferedWriter& reader ); + void load( cBufferedReader& reader, unsigned int version ); + void save( cBufferedWriter& reader, unsigned int version ); + void postload( unsigned int version ); + // Methods inherited from cPythonScriptable const char* className() const; Index: world.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/world.cpp,v retrieving revision 1.110 retrieving revision 1.111 diff -C2 -d -r1.110 -r1.111 *** world.cpp 14 Aug 2004 03:40:36 -0000 1.110 --- world.cpp 15 Aug 2004 02:17:39 -0000 1.111 *************** *** 427,431 **** unsigned char type; const QMap<unsigned char, QCString> &typemap = reader.typemap(); ! const QMap<unsigned char, QString> &server_typemap = UObjectFactory::instance()->getTypemap(); unsigned int loaded = 0; unsigned int count = reader.objectCount(); --- 427,431 ---- unsigned char type; const QMap<unsigned char, QCString> &typemap = reader.typemap(); ! const QMap<unsigned char, QCString> &server_typemap = BinaryTypemap::instance()->getTypemap(); unsigned int loaded = 0; unsigned int count = reader.objectCount(); *************** *** 448,458 **** else { ! cUObject *object = UObjectFactory::instance()->createObject( typemap[type] ); ! try ! { ! object->load( reader ); ! } ! catch ( wpException e ) ! { } } --- 448,461 ---- else { ! PersistentObject *object = PersistentFactory::instance()->createObject( typemap[type] ); ! ! if (object) { ! try ! { ! object->load( reader ); ! } ! catch ( wpException e ) ! { ! } } } *************** *** 523,527 **** } ! QStringList types = UObjectFactory::instance()->objectTypes(); for ( uint j = 0; j < types.count(); ++j ) --- 526,530 ---- } ! QStringList types = PersistentFactory::instance()->objectTypes(); for ( uint j = 0; j < types.count(); ++j ) *************** *** 544,548 **** Console::instance()->send( "\n" + tr( "Loading " ) + QString::number( count ) + tr( " objects of type " ) + type ); ! res = PersistentBroker::instance()->query( UObjectFactory::instance()->findSqlQuery( type ) ); // Error Checking --- 547,551 ---- Console::instance()->send( "\n" + tr( "Loading " ) + QString::number( count ) + tr( " objects of type " ) + type ); ! res = PersistentBroker::instance()->query( PersistentFactory::instance()->findSqlQuery( type ) ); // Error Checking *************** *** 551,555 **** //UINT32 sTime = getNormalizedTime(); ! cUObject* object; progress_display progress( count ); --- 554,558 ---- //UINT32 sTime = getNormalizedTime(); ! PersistentObject* object; progress_display progress( count ); *************** *** 562,566 **** // do something with data ! object = UObjectFactory::instance()->createObject( type ); object->load( row, offset ); --- 565,569 ---- // do something with data ! object = PersistentFactory::instance()->createObject( type ); object->load( row, offset ); *************** *** 796,800 **** cBufferedWriter writer( "WOLFPACK", DATABASE_VERSION ); writer.open( "world.bin" ); ! const QMap<unsigned char, QString> &typemap = UObjectFactory::instance()->getTypemap(); for ( item = itemIterator.first(); item; item = itemIterator.next() ) --- 799,803 ---- cBufferedWriter writer( "WOLFPACK", DATABASE_VERSION ); writer.open( "world.bin" ); ! const QMap<unsigned char, QCString> &typemap = BinaryTypemap::instance()->getTypemap(); for ( item = itemIterator.first(); item; item = itemIterator.next() ) Index: multi.h =================================================================== RCS file: /cvsroot/wpdev/wolfpack/multi.h,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** multi.h 10 Aug 2004 03:15:57 -0000 1.8 --- multi.h 15 Aug 2004 02:17:39 -0000 1.9 *************** *** 46,49 **** --- 46,53 ---- public: + static void setClassid(unsigned char id) { + cMulti::classid = id; + } + unsigned char getClassid() { *************** *** 59,63 **** virtual ~cMulti(); ! /*static void buildSqlString(QStringList &fields, QStringList &tables, QStringList &conditions); void load( char **, UINT16& ); void save(); --- 63,69 ---- virtual ~cMulti(); ! ! static void buildSqlString(const char *objectid, QStringList &fields, QStringList &tables, QStringList &conditions); ! /* void load( char **, UINT16& ); void save(); *************** *** 68,74 **** static cMulti* find( const Coord_cl& pos ); - // Register in load factory - static void registerInFactory(); - // Property Interface Methods stError* setProperty( const QString& name, const cVariant& value ); --- 74,77 ---- Index: npc.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/npc.cpp,v retrieving revision 1.105 retrieving revision 1.106 diff -C2 -d -r1.105 -r1.106 *** npc.cpp 13 Aug 2004 08:55:25 -0000 1.105 --- npc.cpp 15 Aug 2004 02:17:39 -0000 1.106 *************** *** 85,107 **** } ! static cUObject* productCreator() ! { ! return new cNPC; ! } ! ! void cNPC::registerInFactory() ! { ! QStringList fields, tables, conditions; ! buildSqlString( fields, tables, conditions ); // Build our SQL string ! QString sqlString = QString( "SELECT %1 FROM uobjectmap,%2 WHERE uobjectmap.type = 'cNPC' AND %3" ).arg( fields.join( "," ) ).arg( tables.join( "," ) ).arg( conditions.join( " AND " ) ); ! UObjectFactory::instance()->registerType( "cNPC", productCreator ); ! classid = UObjectFactory::instance()->registerSqlQuery( "cNPC", sqlString ); ! } unsigned char cNPC::classid; ! void cNPC::buildSqlString( QStringList& fields, QStringList& tables, QStringList& conditions ) { ! cBaseChar::buildSqlString( fields, tables, conditions ); fields.push_back( "npcs.summontime,npcs.additionalflags,npcs.owner" ); fields.push_back( "npcs.stablemaster" ); --- 85,95 ---- } ! static FactoryRegistration<cNPC> registration("cNPC"); unsigned char cNPC::classid; ! void cNPC::buildSqlString( const char *objectid, QStringList& fields, QStringList& tables, QStringList& conditions ) { ! cBaseChar::buildSqlString( objectid, fields, tables, conditions ); fields.push_back( "npcs.summontime,npcs.additionalflags,npcs.owner" ); fields.push_back( "npcs.stablemaster" ); |
From: Sebastian H. <dar...@us...> - 2004-08-15 02:17:49
|
Update of /cvsroot/wpdev/wolfpack/network In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27923/network Modified Files: uosocket.cpp Log Message: Some very nice cleanups for the serialization code. THIS IS EXPERIMENTAL No release until fully tested. Index: uosocket.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/network/uosocket.cpp,v retrieving revision 1.392 retrieving revision 1.393 diff -C2 -d -r1.392 -r1.393 *** uosocket.cpp 13 Aug 2004 08:55:27 -0000 1.392 --- uosocket.cpp 15 Aug 2004 02:17:40 -0000 1.393 *************** *** 2000,2010 **** } ! if ( pCont->objectID() == QString( "cCorpse" ) ) ! { ! cCorpse* pCorpse = dynamic_cast<cCorpse*>( pCont ); ! ! if ( !pCorpse ) ! return; if ( pCorpse->hairStyle() ) { --- 2000,2006 ---- } ! cCorpse* pCorpse = dynamic_cast<cCorpse*>(pCont); + if (pCorpse) { if ( pCorpse->hairStyle() ) { |
From: Sebastian H. <dar...@us...> - 2004-08-15 02:17:49
|
Update of /cvsroot/wpdev/wolfpack/python In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27923/python Modified Files: pyspawnregion.cpp Log Message: Some very nice cleanups for the serialization code. THIS IS EXPERIMENTAL No release until fully tested. Index: pyspawnregion.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/python/pyspawnregion.cpp,v retrieving revision 1.3 retrieving revision 1.4 diff -C2 -d -r1.3 -r1.4 *** pyspawnregion.cpp 10 Aug 2004 03:27:54 -0000 1.3 --- pyspawnregion.cpp 15 Aug 2004 02:17:40 -0000 1.4 *************** *** 108,111 **** --- 108,113 ---- return 0; } + + Py_RETURN_NONE; } |
From: Richard M. <dr...@us...> - 2004-08-15 01:39:30
|
Update of /cvsroot/wpdev/xmlscripts/scripts/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23405/commands Modified Files: addtree.py Log Message: Fixed jungles/yew Index: addtree.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/commands/addtree.py,v retrieving revision 1.11 retrieving revision 1.12 diff -C2 -d -r1.11 -r1.12 *** addtree.py 14 Aug 2004 19:00:35 -0000 1.11 --- addtree.py 15 Aug 2004 01:39:22 -0000 1.12 *************** *** 221,225 **** def createyewtree( player, arguments, target): - # Tree yew1 = wolfpack.additem( '12b6' ) --- 221,224 ---- *************** *** 330,334 **** elif item == 'yew': socket.sysmessage( "Where do you want to place the yew tree?" ) ! socket.attachitemtarget( 'commands.addtree.createyewtree', yewindex, 0, 0, 0, [] ) return elif item in logindex: #added by Jim 20040814 --- 329,333 ---- elif item == 'yew': socket.sysmessage( "Where do you want to place the yew tree?" ) ! socket.attachtarget( 'commands.addtree.createyewtree', [] ) return elif item in logindex: #added by Jim 20040814 *************** *** 340,344 **** socket.sysmessage( "Where do you want to place the tree '%s', '%s' ?" % ( trees[item][TREE], trees[item][LEAVES]) ) socket.attachtarget( 'commands.addtree.createtree', [ item ] ) ! elif item in jungletreeindex and item in jungleindex: socket.sysmessage( "Where do you want to place the jungle tree [%s]?" %( item ) ) socket.attachtarget( 'commands.addtree.createjungletree', [ item ] ) --- 339,343 ---- socket.sysmessage( "Where do you want to place the tree '%s', '%s' ?" % ( trees[item][TREE], trees[item][LEAVES]) ) socket.attachtarget( 'commands.addtree.createtree', [ item ] ) ! elif item in jungletreeindex: socket.sysmessage( "Where do you want to place the jungle tree [%s]?" %( item ) ) socket.attachtarget( 'commands.addtree.createjungletree', [ item ] ) |
From: Richard M. <dr...@us...> - 2004-08-14 19:00:50
|
Update of /cvsroot/wpdev/xmlscripts/scripts/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30123/commands Modified Files: addtree.py Log Message: My friend Jim / Laocourn put in stuff for fallen logs. Index: addtree.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/commands/addtree.py,v retrieving revision 1.10 retrieving revision 1.11 diff -C2 -d -r1.10 -r1.11 *** addtree.py 14 Aug 2004 08:07:50 -0000 1.10 --- addtree.py 14 Aug 2004 19:00:35 -0000 1.11 *************** *** 23,26 **** --- 23,27 ---- jungle[1-7] places a jungle tree. random places a random normal tree. + log[1-2] places a fallen log \notes Green leaves will be added ontop of the tree. """ *************** *** 28,33 **** jungletreeindex = [ 'jungle1', 'jungle2', 'jungle3', 'jungle4', 'jungle5', 'jungle6', 'jungle7' ] - treeindex = ['cca','ccb','ccc','ccd','cd0','cd3','cd6','cd8','cda','cdd','ce0','ce3','ce6','cf8','cfe','d01','d94','d98','d9c','da0','da4','da8'] forestlist = ['ccd','cd0','cd3','cd6','cd8','cda','cdd','ce0','ce3','ce6'] swamplist = ['cf8','cfe','d01'] --- 29,34 ---- jungletreeindex = [ 'jungle1', 'jungle2', 'jungle3', 'jungle4', 'jungle5', 'jungle6', 'jungle7' ] treeindex = ['cca','ccb','ccc','ccd','cd0','cd3','cd6','cd8','cda','cdd','ce0','ce3','ce6','cf8','cfe','d01','d94','d98','d9c','da0','da4','da8'] + logindex = [ 'log1', 'log2'] #added by Jim 20040814 forestlist = ['ccd','cd0','cd3','cd6','cd8','cda','cdd','ce0','ce3','ce6'] swamplist = ['cf8','cfe','d01'] *************** *** 60,63 **** --- 61,70 ---- } + logs = \ + { + 'log1': [ 'cf3', 'cf4' ], # Y + 1 + 'log2': [ 'cf5', 'cf6', 'cf7' ] # X + 1 + } + TREE = 0 LEAVES = 1 *************** *** 246,249 **** --- 253,280 ---- return + def createlog(player, arguments, target): + #added by Jim 20040814 + logtype = arguments[0] + #something is wrong with my arguments variable I think... I should have read the docs on some of this stuff.. and I should probably learn some python =P + + if logtype == 'log1': + log1 = wolfpack.additem( 'cf3' ) + log1.moveto( target.pos ) + log2 = wolfpack.additem( 'cf4' ) + log2.pos = "%i,%i,%i,%i" % ( log1.pos.x , log1.pos.y + 1, log1.pos.z, log1.pos.map ) + log1.update() + log2.update() + if logtype == 'log2': + log1 = wolfpack.additem( 'cf6' ) + log1.moveto( target.pos ) + log2 = wolfpack.additem( 'cf5' ) + log2.pos = "%i,%i,%i,%i" % ( log1.pos.x - 1, log1.pos.y, log1.pos.z, log1.pos.map ) + log3 = wolfpack.additem( 'cf7' ) + log3.pos = "%i,%i,%i,%i" % ( log1.pos.x + 1, log1.pos.y, log1.pos.z, log1.pos.map ) + log1.update() + log2.update() + log3.update() + return + def addtree(socket, command, arguments): if len(arguments) > 0: *************** *** 301,304 **** --- 332,339 ---- socket.attachitemtarget( 'commands.addtree.createyewtree', yewindex, 0, 0, 0, [] ) return + elif item in logindex: #added by Jim 20040814 + socket.sysmessage( "Where do you want to place the fallen log [%s]?" % ( item ) ) + socket.attachtarget( 'commands.addtree.createlog', [ item ] ) + return elif item in trees and not item in jungletreeindex: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): *************** *** 310,316 **** return else: ! socket.sysmessage( "Usage: addtree [ id, yew, jungle[1-7], random, forest, fruit, swamp ]" ) else: ! socket.sysmessage( "Usage: addtree [ id, yew, jungle[1-7], random, forest, fruit, swamp ]" ) def onLoad(): --- 345,351 ---- return else: ! socket.sysmessage( "Usage: addtree [ id, yew, jungle[1-7], random, forest, fruit, swamp, log[1-2] ]" ) else: ! socket.sysmessage( "Usage: addtree [ id, yew, jungle[1-7], random, forest, fruit, swamp, log[1-2] ]" ) def onLoad(): |
From: Richard M. <dr...@us...> - 2004-08-14 09:28:12
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13155 Modified Files: items.cpp Log Message: Small documentation fix Index: items.cpp =================================================================== RCS file: /cvsroot/wpdev/wolfpack/items.cpp,v retrieving revision 1.432 retrieving revision 1.433 diff -C2 -d -r1.432 -r1.433 *** items.cpp 14 Aug 2004 03:40:36 -0000 1.432 --- items.cpp 14 Aug 2004 09:27:45 -0000 1.433 *************** *** 1826,1832 **** \property item.visible The visibile level of the object. Values: ! <code>0 - Everyone ! 1 - Owner ! 2 - Invisible </code> */ --- 1826,1831 ---- \property item.visible The visibile level of the object. Values: ! <code>0 - Invisible ! 1 - Visible </code> */ |
From: Richard M. <dr...@us...> - 2004-08-14 08:08:06
|
Update of /cvsroot/wpdev/xmlscripts/scripts/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4583/commands Modified Files: addtree.py Log Message: socket tags prevent the same tree from placing twice, a lot more random. Index: addtree.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/commands/addtree.py,v retrieving revision 1.9 retrieving revision 1.10 diff -C2 -d -r1.9 -r1.10 *** addtree.py 14 Aug 2004 06:29:36 -0000 1.9 --- addtree.py 14 Aug 2004 08:07:50 -0000 1.10 *************** *** 29,33 **** jungletreeindex = [ 'jungle1', 'jungle2', 'jungle3', 'jungle4', 'jungle5', 'jungle6', 'jungle7' ] ! treeindex = ['cca','ccb','ccc','ccd','cd0','cd3','cd6','cd8','cda','cdd','ce0','ce3','ce6','cf8','cfe','d01', 'd94', 'd98', 'd9c', 'da0', 'da4', 'da8'] trees = \ --- 29,36 ---- jungletreeindex = [ 'jungle1', 'jungle2', 'jungle3', 'jungle4', 'jungle5', 'jungle6', 'jungle7' ] ! treeindex = ['cca','ccb','ccc','ccd','cd0','cd3','cd6','cd8','cda','cdd','ce0','ce3','ce6','cf8','cfe','d01','d94','d98','d9c','da0','da4','da8'] ! forestlist = ['ccd','cd0','cd3','cd6','cd8','cda','cdd','ce0','ce3','ce6'] ! swamplist = ['cf8','cfe','d01'] ! fruitlist = ['d94', 'd98', 'd9c', 'da0', 'da4', 'da8'] trees = \ *************** *** 247,251 **** item = str( arguments.strip() ) if item == 'forest': ! item = treeindex[ random.randint(0, 12) ] if item in trees: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): --- 250,264 ---- item = str( arguments.strip() ) if item == 'forest': ! if socket.hastag( 'last_foresttree' ): ! templist = [] ! for choice in forestlist: ! if choice != str( socket.gettag( 'last_foresttree' ) ): ! templist += [ choice ] ! item = random.choice( templist ) ! socket.settag( 'last_foresttree', str( item ) ) ! else: ! item = random.choice( forestlist ) ! socket.settag( 'last_foresttree', str( item ) ) ! if item in trees: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): *************** *** 254,258 **** return elif item == 'fruit': ! item = treeindex[ random.randint( 16, 21 ) ] if item in trees: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): --- 267,271 ---- return elif item == 'fruit': ! item = random.choice( fruitlist ) if item in trees: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): *************** *** 261,265 **** return elif item == 'swamp': ! item = treeindex[ random.randint(13, 15) ] if item in trees: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): --- 274,278 ---- return elif item == 'swamp': ! item = random.choice( swamplist ) if item in trees: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): *************** *** 268,272 **** return elif item == 'random': ! item = random.choice( treeindex ) if item in trees: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): --- 281,295 ---- return elif item == 'random': ! if socket.hastag( 'last_randomtree' ): ! templist = [] ! for choice in treeindex: ! if choice != str( socket.gettag( 'last_randomtree' ) ): ! templist += [ choice ] ! item = random.choice( templist ) ! socket.settag( 'last_randomtree', str( item ) ) ! else: ! item = random.choice( treeindex ) ! socket.settag( 'last_randomtree', str( item ) ) ! if item in trees: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): |
From: Richard M. <dr...@us...> - 2004-08-14 06:29:45
|
Update of /cvsroot/wpdev/xmlscripts/scripts/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv25990/commands Modified Files: addtree.py Log Message: Updates Index: addtree.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/commands/addtree.py,v retrieving revision 1.8 retrieving revision 1.9 diff -C2 -d -r1.8 -r1.9 *** addtree.py 14 Aug 2004 05:45:33 -0000 1.8 --- addtree.py 14 Aug 2004 06:29:36 -0000 1.9 *************** *** 9,16 **** import wolfpack from wolfpack.consts import WPDT_ITEM from wolfpack.utilities import hex2dec from wolfpack import console ! from random import randint """ --- 9,17 ---- import wolfpack + import random from wolfpack.consts import WPDT_ITEM from wolfpack.utilities import hex2dec from wolfpack import console ! """ *************** *** 28,32 **** jungletreeindex = [ 'jungle1', 'jungle2', 'jungle3', 'jungle4', 'jungle5', 'jungle6', 'jungle7' ] ! treeindex = ['cca','ccb','ccc','ccd','cd0','cd3','cd6','cda','cdd','ce0','ce3','ce6','cf8','cfe','d01', 'd94', 'd98', 'd9c', 'da0', 'da4', 'da8'] trees = \ --- 29,33 ---- jungletreeindex = [ 'jungle1', 'jungle2', 'jungle3', 'jungle4', 'jungle5', 'jungle6', 'jungle7' ] ! treeindex = ['cca','ccb','ccc','ccd','cd0','cd3','cd6','cd8','cda','cdd','ce0','ce3','ce6','cf8','cfe','d01', 'd94', 'd98', 'd9c', 'da0', 'da4', 'da8'] trees = \ *************** *** 48,57 **** 'cfe': [ 'cfe', 'cff' ], # Cypress 'd01': [ 'd01', 'd02' ], # Cypress ! 'd94': [ 'd94', 'd95' ], ! 'd98': [ 'd98', 'd99' ], ! 'd9c': [ 'd9c', 'd9d' ], ! 'da0': [ 'da0', 'da1' ], ! 'da4': [ 'da4', 'da5' ], ! 'da8': [ 'da8', 'da9' ] } --- 49,58 ---- 'cfe': [ 'cfe', 'cff' ], # Cypress 'd01': [ 'd01', 'd02' ], # Cypress ! 'd94': [ 'd94', 'd95' ], # Apple ! 'd98': [ 'd98', 'd99' ], # Apple ! 'd9c': [ 'd9c', 'd9d' ], # Peach ! 'da0': [ 'da0', 'da1' ], # Peach ! 'da4': [ 'da4', 'da5' ], # Pear ! 'da8': [ 'da8', 'da9' ] # Pear } *************** *** 245,251 **** if len(arguments) > 0: item = str( arguments.strip() ) ! if item == 'random': ! randomtrees = [ randint(0,2), randint(0,12), randint(2,12), randint(0,20), randint(13,15), randint(16,20) ] ! item = treeindex[ randomtrees[ randint( 0, 5 ) ] ] if item in trees: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): --- 246,272 ---- if len(arguments) > 0: item = str( arguments.strip() ) ! if item == 'forest': ! item = treeindex[ random.randint(0, 12) ] ! if item in trees: ! if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): ! socket.sysmessage( "Where do you want to place the tree '%s', '%s' ?" % ( trees[item][TREE], trees[item][LEAVES ]) ) ! socket.attachtarget( 'commands.addtree.createtree', [ item ] ) ! return ! elif item == 'fruit': ! item = treeindex[ random.randint( 16, 21 ) ] ! if item in trees: ! if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): ! socket.sysmessage( "Where do you want to place the tree '%s', '%s' ?" % ( trees[item][TREE], trees[item][LEAVES ]) ) ! socket.attachtarget( 'commands.addtree.createtree', [ item ] ) ! return ! elif item == 'swamp': ! item = treeindex[ random.randint(13, 15) ] ! if item in trees: ! if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): ! socket.sysmessage( "Where do you want to place the tree '%s', '%s' ?" % ( trees[item][TREE], trees[item][LEAVES ]) ) ! socket.attachtarget( 'commands.addtree.createtree', [ item ] ) ! return ! elif item == 'random': ! item = random.choice( treeindex ) if item in trees: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): *************** *** 266,272 **** return else: ! socket.sysmessage( "Usage: addtree [id, yew, jungle[1-7], random") else: ! socket.sysmessage( "Usage: addtree [id, yew, jungle[1-7], random") def onLoad(): --- 287,293 ---- return else: ! socket.sysmessage( "Usage: addtree [ id, yew, jungle[1-7], random, forest, fruit, swamp ]" ) else: ! socket.sysmessage( "Usage: addtree [ id, yew, jungle[1-7], random, forest, fruit, swamp ]" ) def onLoad(): |
From: Richard M. <dr...@us...> - 2004-08-14 05:45:41
|
Update of /cvsroot/wpdev/xmlscripts/scripts/commands In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21290/commands Modified Files: addtree.py Log Message: This works a bit better Index: addtree.py =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/scripts/commands/addtree.py,v retrieving revision 1.7 retrieving revision 1.8 diff -C2 -d -r1.7 -r1.8 *** addtree.py 6 Aug 2004 02:25:43 -0000 1.7 --- addtree.py 14 Aug 2004 05:45:33 -0000 1.8 *************** *** 248,252 **** randomtrees = [ randint(0,2), randint(0,12), randint(2,12), randint(0,20), randint(13,15), randint(16,20) ] item = treeindex[ randomtrees[ randint( 0, 5 ) ] ] ! if trees[ item ]: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): socket.sysmessage( "Where do you want to place the tree '%s', '%s' ?" % ( trees[item][TREE], trees[item][LEAVES ]) ) --- 248,252 ---- randomtrees = [ randint(0,2), randint(0,12), randint(2,12), randint(0,20), randint(13,15), randint(16,20) ] item = treeindex[ randomtrees[ randint( 0, 5 ) ] ] ! if item in trees: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): socket.sysmessage( "Where do you want to place the tree '%s', '%s' ?" % ( trees[item][TREE], trees[item][LEAVES ]) ) *************** *** 257,265 **** socket.attachitemtarget( 'commands.addtree.createyewtree', yewindex, 0, 0, 0, [] ) return ! elif trees[item] and ( item not in jungletreeindex ): if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): socket.sysmessage( "Where do you want to place the tree '%s', '%s' ?" % ( trees[item][TREE], trees[item][LEAVES]) ) socket.attachtarget( 'commands.addtree.createtree', [ item ] ) ! elif item in jungletreeindex and jungleindex[item]: socket.sysmessage( "Where do you want to place the jungle tree [%s]?" %( item ) ) socket.attachtarget( 'commands.addtree.createjungletree', [ item ] ) --- 257,265 ---- socket.attachitemtarget( 'commands.addtree.createyewtree', yewindex, 0, 0, 0, [] ) return ! elif item in trees and not item in jungletreeindex: if wolfpack.getdefinition( WPDT_ITEM, trees[item][TREE] ) and wolfpack.getdefinition( WPDT_ITEM, trees[item][LEAVES] ): socket.sysmessage( "Where do you want to place the tree '%s', '%s' ?" % ( trees[item][TREE], trees[item][LEAVES]) ) socket.attachtarget( 'commands.addtree.createtree', [ item ] ) ! elif item in jungletreeindex and item in jungleindex: socket.sysmessage( "Where do you want to place the jungle tree [%s]?" %( item ) ) socket.attachtarget( 'commands.addtree.createjungletree', [ item ] ) |
From: Richard M. <dr...@us...> - 2004-08-14 05:45:14
|
Update of /cvsroot/wpdev/xmlscripts/documentation/webroot In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21217/documentation/webroot Modified Files: ChangeLog.wolfpack Log Message: Updated the changelog Index: ChangeLog.wolfpack =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/documentation/webroot/ChangeLog.wolfpack,v retrieving revision 1.39 retrieving revision 1.40 diff -C2 -d -r1.39 -r1.40 *** ChangeLog.wolfpack 13 Aug 2004 05:05:14 -0000 1.39 --- ChangeLog.wolfpack 14 Aug 2004 05:44:58 -0000 1.40 *************** *** 27,34 **** - Added status on MySQL/SQLite modules. - New Python getProperty method. ! - Fixed a possible bug with the Python interface ( Possibly source of crashing bugs ) - Property item.magic is now item.movable ! - (Configurable) Speedhack Countermeasure (See Anti Speed Hack settings in the General group) - Added some additional checking to wolfpack.pro --- 27,34 ---- - Added status on MySQL/SQLite modules. - New Python getProperty method. ! - Fixed a possible bug with the Python interface ( Possibly source of crashing bugs ) - Property item.magic is now item.movable ! - (Configurable) Speedhack Countermeasure (See Anti Speed Hack settings in the General group) - Added some additional checking to wolfpack.pro *************** *** 36,39 **** --- 36,41 ---- - Fixes for mul and diff files. Haven should now work. + - Database Change: + items.magic is now items.movable * Definition Changes: - Fixed Sheep definitions *************** *** 96,100 **** Inscription - Thanks to khpae - Decoration Saving ! - Magic fixes: Fire, Poison, Energy and Paralyze fields should work better. Mass dispell can now wipe out these fields. --- 98,102 ---- Inscription - Thanks to khpae - Decoration Saving ! - Magic fixes: Fire, Poison, Energy and Paralyze fields should work better. Mass dispell can now wipe out these fields. *************** *** 103,107 **** For scrolls the following rules are in effect: 50% decreased mana usage. ! The effective circle for measuring the skill requirement is lowered by two. when casting from a scroll. --- 105,109 ---- For scrolls the following rules are in effect: 50% decreased mana usage. ! The effective circle for measuring the skill requirement is lowered by two. when casting from a scroll. *************** *** 138,144 **** - Spawnregions save spawned NPCs. - Multi tables removed, being redone. ! - Item.type and other properties are no longer saved, uses base definitions. ! - Removed the `spawnregion` field from the `items`,`npcs` database tables. * Code Changes: --- 140,146 ---- - Spawnregions save spawned NPCs. - Multi tables removed, being redone. ! - Item.type and other properties are no longer saved, uses base definitions. ! - Removed the `spawnregion` field from the `items`,`npcs` database tables. * Code Changes: *************** *** 150,164 **** * Definition Changes: * Item Updates: ! - Colored platemail baseid mapping. This was overlooked and should fix armor bugs. - Added the new artwork/items from client 4.0.3a. * NPC Updates: - Several AoS NPCs added. Most NPCs should be added now. ! - Some NPCs such as orcs and lizardmen can now pull their id and skin from a list. - Lootlist improvements. - Stat adjustments. ( UO Stratics Data ) - Fame/Karma adjustments. ( UO Stratics Data ) ! - Basic loot list implimentation, most monsters should drop some gold/gems. * Region/Spawn Region Updates: --- 152,166 ---- * Definition Changes: * Item Updates: ! - Colored platemail baseid mapping. This was overlooked and should fix armor bugs. - Added the new artwork/items from client 4.0.3a. * NPC Updates: - Several AoS NPCs added. Most NPCs should be added now. ! - Some NPCs such as orcs and lizardmen can now pull their id and skin from a list. - Lootlist improvements. - Stat adjustments. ( UO Stratics Data ) - Fame/Karma adjustments. ( UO Stratics Data ) ! - Basic loot list implimentation, most monsters should drop some gold/gems. * Region/Spawn Region Updates: *************** *** 167,179 **** - Updated town spawns for felucca and trammel towns. * Misc. Updates: ! - Organized scripts.xml to be easier to read/check for missing scripts. * Python Script Changes: * Commands: ! - import/export now saves/imports the baseid and map values with WSC and TXT. - info updated, supports NPC properties a bit better. - freeze command added, toggles the frozen value. ! - dye updated to modify character skins. 'dye 0x0 will replace the skin with char.orgskin. * Loot System: --- 169,181 ---- - Updated town spawns for felucca and trammel towns. * Misc. Updates: ! - Organized scripts.xml to be easier to read/check for missing scripts. * Python Script Changes: * Commands: ! - import/export now saves/imports the baseid and map values with WSC and TXT. - info updated, supports NPC properties a bit better. - freeze command added, toggles the frozen value. ! - dye updated to modify character skins. 'dye 0x0 will replace the skin with char.orgskin. * Loot System: *************** *** 186,190 **** * System: - SQLite database optimization added. ! - Script system.debugging created to set different debugging options. - Support for the Open Door Macro --- 188,192 ---- * System: - SQLite database optimization added. ! - Script system.debugging created to set different debugging options. - Support for the Open Door Macro *************** *** 220,224 **** - Add fixes. * Definitions cleanup ! - Reorganized the definitions to be cleaner and easier to manage with updates. - Note: ./definitions.xml moved to ./definitions/index.xml --- 222,226 ---- - Add fixes. * Definitions cleanup ! - Reorganized the definitions to be cleaner and easier to manage with updates. - Note: ./definitions.xml moved to ./definitions/index.xml *************** *** 249,254 **** * Known bugs: - Necromancy/Paladin spells do not function, still in the works. ! - Non-functioning skills: ! Snooping, Inscription, Cartography, Animal Lore, Arms Lore, Enticement. - Reload (python) memory leak. --- 251,256 ---- * Known bugs: - Necromancy/Paladin spells do not function, still in the works. ! - Non-functioning skills: ! Snooping, Inscription, Cartography, Animal Lore, Arms Lore, Enticement. - Reload (python) memory leak. |
From: Richard M. <dr...@us...> - 2004-08-14 05:42:57
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21013 Modified Files: configure.py Log Message: This allows for ./configure.py to be done. Index: configure.py =================================================================== RCS file: /cvsroot/wpdev/wolfpack/configure.py,v retrieving revision 1.18 retrieving revision 1.19 diff -C2 -d -r1.18 -r1.19 *** configure.py 5 Aug 2004 22:07:55 -0000 1.18 --- configure.py 14 Aug 2004 05:42:48 -0000 1.19 *************** *** 1,3 **** ! ################################################################# # ) (\_ # Wolfpack 13.0.0 Build Script # --- 1,3 ---- ! #!/usr/bin/env python ################################################################# # ) (\_ # Wolfpack 13.0.0 Build Script # |
From: Richard M. <dr...@us...> - 2004-08-14 03:56:07
|
Update of /cvsroot/wpdev/wolfpack In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9920 Modified Files: ChangeLog Log Message: Updates Index: ChangeLog =================================================================== RCS file: /cvsroot/wpdev/wolfpack/ChangeLog,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** ChangeLog 13 Aug 2004 08:57:30 -0000 1.5 --- ChangeLog 14 Aug 2004 03:55:50 -0000 1.6 *************** *** 31,34 **** --- 31,36 ---- - Fixes for mul and diff files. Haven should now work. + - Database Change: + items.magic is now items.movable Wolfpack 12.9.7 Beta (4. July 2004) |
From: Richard M. <dr...@us...> - 2004-08-14 03:41:50
|
Update of /cvsroot/wpdev/xmlscripts In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8261 Modified Files: wolfpack.sql Log Message: items.magic -> items.movable Index: wolfpack.sql =================================================================== RCS file: /cvsroot/wpdev/xmlscripts/wolfpack.sql,v retrieving revision 1.54 retrieving revision 1.55 diff -C2 -d -r1.54 -r1.55 *** wolfpack.sql 2 Jul 2004 06:28:04 -0000 1.54 --- wolfpack.sql 14 Aug 2004 03:41:36 -0000 1.55 *************** *** 123,127 **** `hp` smallint(6) NOT NULL default '0', `maxhp` smallint(6) NOT NULL default '0', ! `magic` tinyint(3) NOT NULL default '0', `owner` int(10) unsigned NOT NULL default '0', `visible` tinyint(3) NOT NULL default '0', --- 123,127 ---- `hp` smallint(6) NOT NULL default '0', `maxhp` smallint(6) NOT NULL default '0', ! `movable` tinyint(3) NOT NULL default '0', `owner` int(10) unsigned NOT NULL default '0', `visible` tinyint(3) NOT NULL default '0', |