Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv11737
Modified Files:
TmpEff.h basics.cpp tmpeff.cpp wolf.dsp wolfpack.cpp world.cpp
Removed Files:
iserialization.cpp iserialization.h serxmlfile.cpp
serxmlfile.h
Log Message:
Implemented serialization of effects to the database (experimental!).
Index: TmpEff.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/TmpEff.h,v
retrieving revision 1.37
retrieving revision 1.38
diff -C2 -d -r1.37 -r1.38
*** TmpEff.h 27 Jun 2003 18:25:03 -0000 1.37
--- TmpEff.h 12 Sep 2003 15:28:59 -0000 1.38
***************
*** 48,52 ****
class cTempEffect;
class cScriptEffect;
- class cTimedSpellAction;
class cTempEffects;
--- 48,51 ----
***************
*** 56,62 ****
#include "singleton.h"
! class cTempEffect : public cSerializable
{
- Q_OBJECT
protected:
SERIAL sourSer;
--- 55,62 ----
#include "singleton.h"
! class cDBResult;
!
! class cTempEffect
{
protected:
SERIAL sourSer;
***************
*** 76,80 ****
unsigned int rank;
bool marker;
!
public:
// cTempEffect() { serializable = true; }
--- 76,90 ----
unsigned int rank;
bool marker;
!
! /*
! Provided for subclasses to save additional information.
! */
! void saveFloat( unsigned int id, QString key, double value );
! void saveInt( unsigned int id, QString key, int value );
! void saveString( unsigned int id, QString key, const QString &value );
! bool loadFloat( unsigned int id, QString key, double &value );
! bool loadInt( unsigned int id, QString key, int &value );
! bool loadString( unsigned int id, QString key, QString &value );
!
public:
// cTempEffect() { serializable = true; }
***************
*** 93,96 ****
--- 103,107 ----
rank = rank_;
marker = marker_;
+ dispellable = false; // Most Effects are NOT dispellable by default
}
***************
*** 110,114 ****
void Off(P_CHAR pc) { Q_UNUSED(pc); }
virtual void Expire() = 0;
- virtual void Serialize(ISerialization &archive);
virtual void Dispel( P_CHAR pSource, bool silent = false ) { Q_UNUSED(pSource); Q_UNUSED(silent); }
virtual QString objectID() const { return objectid;}
--- 121,124 ----
***************
*** 116,119 ****
--- 126,132 ----
void setSerializable( bool data ) { serializable = data; }
+ virtual void load( unsigned int id, const char **result );
+ virtual void save( unsigned int id );
+
std::vector< cTempEffect* > asVector();
};
***************
*** 121,169 ****
class cDelayedHideChar : public cTempEffect
{
- Q_OBJECT
public:
cDelayedHideChar( SERIAL serial );
! virtual void Expire();
! virtual void Serialize(ISerialization &archive);
! virtual QString objectID() const { return "HIDECHAR";}
! SERIAL character;
! };
!
! class cTimedSpellAction : public cTempEffect
! {
! Q_OBJECT
! private:
! SERIAL character;
! UI08 action;
! public:
! // Do that as long as we're casting
! cTimedSpellAction( SERIAL serial, UI08 nAction );
! virtual void Expire();
! };
!
! /*
! class cTmpEffFibHeap
! {
! public:
! cTmpEffFibHeap() : head(0) {}
! cTmpEffFibHeap( cTempEffect* head_ ) { head = head_; }
!
! // methods
! cTempEffect* accessMin();
! void deleteMin();
! void erase( cTempEffect* pT );
! void insert( cTempEffect* pT );
! cTempEffect* meld( cTmpEffFibHeap &nFheap );
!
! std::vector< cTempEffect* > asVector();
!
! private:
! void decrease( cTempEffect* pT, int diffTime );
!
! public:
! // variables
! cTempEffect* head;
};
- */
class cTempEffects
--- 134,142 ----
class cDelayedHideChar : public cTempEffect
{
public:
cDelayedHideChar( SERIAL serial );
! void Expire();
! QString objectID() const { return "cDelayedHideChar"; }
};
class cTempEffects
***************
*** 181,190 ****
public:
cTempEffects() { std::make_heap( teffects.begin(), teffects.end(), cTempEffects::ComparePredicate() ); } // No temp effects to start with
- // cTmpEffFibHeap teffects;
- // QPtrVector< cTempEffect > vector;
std::vector< cTempEffect* > teffects;
void check();
- void serialize(ISerialization &archive);
void dispel( P_CHAR pc_dest, P_CHAR pSource, bool silent = false );
void dispel( P_CHAR pc_dest, P_CHAR pSource, const QString &type, bool silent = false, bool onlyDispellable = true );
--- 154,163 ----
public:
cTempEffects() { std::make_heap( teffects.begin(), teffects.end(), cTempEffects::ComparePredicate() ); } // No temp effects to start with
std::vector< cTempEffect* > teffects;
+ void load();
+ void save();
+
void check();
void dispel( P_CHAR pc_dest, P_CHAR pSource, bool silent = false );
void dispel( P_CHAR pc_dest, P_CHAR pSource, const QString &type, bool silent = false, bool onlyDispellable = true );
***************
*** 217,221 ****
class cRepeatAction: public cTempEffect
{
- Q_OBJECT
private:
SERIAL _mage;
--- 190,193 ----
***************
*** 225,229 ****
cRepeatAction( P_CHAR mage, UINT8 anim, UINT32 delay );
virtual void Expire();
- virtual QString objectID() const { return "repeataction"; }
};
--- 197,200 ----
Index: basics.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basics.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** basics.cpp 11 Sep 2003 12:22:24 -0000 1.26
--- basics.cpp 12 Sep 2003 15:29:00 -0000 1.27
***************
*** 163,170 ****
{
timeval tTime;
- timezone tZone;
// Error handling wouldn't have much sense here.
! gettimeofday( &tTime, &tZone );
return ( tTime.tv_sec * 1000 ) + (unsigned int)( tTime.tv_usec / 1000 );
--- 163,169 ----
{
timeval tTime;
// Error handling wouldn't have much sense here.
! gettimeofday( &tTime, NULL );
return ( tTime.tv_sec * 1000 ) + (unsigned int)( tTime.tv_usec / 1000 );
Index: tmpeff.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/tmpeff.cpp,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -d -r1.61 -r1.62
*** tmpeff.cpp 7 Sep 2003 19:07:47 -0000 1.61
--- tmpeff.cpp 12 Sep 2003 15:29:00 -0000 1.62
***************
*** 30,36 ****
//==================================================================================
! //////////////////////////////////////////////////////////////////////
! // TmpEff.cpp: implementation of temporary effects
! // cut from Wolfpack.cpp by Duke, 25.10.2000
#include "platform.h"
--- 30,34 ----
//==================================================================================
! #include "python/tempeffect.h"
#include "platform.h"
***************
*** 45,48 ****
--- 43,48 ----
#include "wpdefmanager.h"
#include "network/uosocket.h"
+ #include "dbdriver.h"
+ #include "persistentbroker.h"
#include "skills.h"
#include "sectors.h"
***************
*** 51,55 ****
--- 51,57 ----
#include "npc.h"
#include "ai.h"
+ #include "basics.h"
#include "world.h"
+ #include "inlines.h"
#include <algorithm>
***************
*** 57,63 ****
#include <math.h>
- #undef DBGFILE
- #define DBGFILE "tmpeff.cpp"
-
int cTempEffect::getDest()
{
--- 59,62 ----
***************
*** 90,111 ****
}
! void cTempEffect::Serialize(ISerialization &archive)
{
! if (archive.isReading())
{
! archive.read( "expiretime", this->expiretime ); // exptime must be subtracted from current server clock time, so it can be recalculated on next server startup
! archive.read( "dispellable", this->dispellable );
! archive.read( "srcserial", this->sourSer );
! archive.read( "destserial", this->destSer );
! this->expiretime += uiCurrentTime;
}
! else if( archive.isWritting() )
{
! archive.write( "expiretime", ( this->expiretime - uiCurrentTime ) ); // exptime must be subtracted from current server clock time, so it can be recalculated on next server startup
! archive.write( "dispellable", this->dispellable );
! archive.write( "srcserial", this->getSour() );
! archive.write( "destserial", this->getDest() );
}
! cSerializable::Serialize( archive );
}
--- 89,191 ----
}
! /*
! Save a float to the effects_properties table.
! */
! void cTempEffect::saveFloat( unsigned int id, QString key, double value )
{
! persistentBroker->executeQuery( QString( "INSERT INTO effects_properties VALUES(%1,'%2','%3','%4');" ).arg( id ).arg( persistentBroker->quoteString( key ) ).arg( "float" ).arg( value ) );
! }
!
! /*
! Save an integer to the effects_properties table.
! */
! void cTempEffect::saveInt( unsigned int id, QString key, int value )
! {
! persistentBroker->executeQuery( QString( "INSERT INTO effects_properties VALUES(%1,'%2','%3','%4');" ).arg( id ).arg( persistentBroker->quoteString( key ) ).arg( "int" ).arg( value ) );
! }
!
! /*
! Save a string to the effects_properties table.
! */
! void cTempEffect::saveString( unsigned int id, QString key, const QString &value )
! {
! persistentBroker->executeQuery( QString( "INSERT INTO effects_properties VALUES(%1,'%2','%3','%4');" ).arg( id ).arg( persistentBroker->quoteString( key ) ).arg( "string" ).arg( persistentBroker->quoteString( value.utf8() ) ) );
! }
!
! /*
! Load a float from the effects_properties table.
! */
! bool cTempEffect::loadFloat( unsigned int id, QString key, double &value )
! {
! cDBResult result = persistentBroker->query( QString( "SELECT value FROM effects_properties WHERE id = '%1' AND key = '%2' AND type = 'float'" ).arg( id ).arg( persistentBroker->quoteString( key ) ) );
!
! if( !result.fetchrow() )
{
! result.free();
! return false;
}
!
! value = result.getString( 0 ).toFloat();
!
! result.free();
!
! return true;
! }
!
! /*
! Load an integer from the effects_properties table.
! */
! bool cTempEffect::loadInt( unsigned int id, QString key, int &value )
! {
! cDBResult result = persistentBroker->query( QString( "SELECT value FROM effects_properties WHERE id = '%1' AND key = '%2' AND type = 'int'" ).arg( id ).arg( persistentBroker->quoteString( key ) ) );
!
! if( !result.fetchrow() )
{
! result.free();
! return false;
}
!
! value = result.getString( 0 ).toInt();
!
! result.free();
!
! return true;
! }
!
! /*
! Load a string from the effects_properties table.
! */
! bool cTempEffect::loadString( unsigned int id, QString key, QString &value )
! {
! cDBResult result = persistentBroker->query( QString( "SELECT value FROM effects_properties WHERE id = '%1' AND key = '%2' AND type = 'string'" ).arg( id ).arg( persistentBroker->quoteString( key ) ) );
!
! if( !result.fetchrow() )
! {
! result.free();
! return false;
! }
!
! value = result.getString( 0 );
!
! result.free();
!
! return true;
! }
!
! #include "console.h"
!
! void cTempEffect::save( unsigned int id )
! {
! persistentBroker->executeQuery( QString( "INSERT INTO effects VALUES(%1,'%2',%3,%4,%5,%6);" ).arg( id ).arg( persistentBroker->quoteString( objectID() ) ).arg( expiretime - uiCurrentTime ).arg( dispellable ? 1 : 0 ).arg( sourSer ).arg( destSer ) );
! }
!
! void cTempEffect::load( unsigned int id, const char **result )
! {
! unsigned int offset = 2;
!
! expiretime = atol( result[offset++] ) + uiCurrentTime;
! dispellable = atol( result[offset++] ) == 0 ? false : true;
! sourSer = atol( result[offset++] );
! destSer = atol( result[offset++] );
}
***************
*** 138,153 ****
break;
}
-
- }
-
- void cTempEffects::serialize(ISerialization &archive)
- {
- std::vector< cTempEffect* >::iterator it = teffects.begin();
- while( it != teffects.end() )
- {
- if( (*it)->isSerializable() )
- archive.writeObject( (*it) );
- ++it;
- }
}
--- 218,221 ----
***************
*** 197,228 ****
}
! // cDelayedHideChar
! cDelayedHideChar::cDelayedHideChar( SERIAL serial )
{
! if( !isCharSerial( serial ) || !FindCharBySerial( serial ) )
{
! character = INVALID_SERIAL;
! return;
}
- character = serial;
- setSerializable( true );
}
! void cDelayedHideChar::Serialize( ISerialization &archive )
{
! if( archive.isReading() )
{
! archive.read( "charserial", character );
}
! else
{
! archive.write( "charserial", character );
}
! cTempEffect::Serialize( archive );
}
void cDelayedHideChar::Expire()
{
! P_PLAYER pc = dynamic_cast<P_PLAYER>(FindCharBySerial( character ));
if( !pc || pc->socket() ) // break if the char has relogged in the meantime
return;
--- 265,332 ----
}
! void cTempEffects::load()
{
! // Query the Database
!
! cDBResult result = persistentBroker->query( "SELECT id,objectid,expiretime,dispellable,source,destination FROM effects ORDER BY expiretime ASC;" );
!
! while( result.fetchrow() )
{
! unsigned int id = result.getInt( 0 );
! QString objectId = result.getString( 1 );
!
! cTempEffect *effect = 0;
!
! if( objectId == "cPythonEffect" )
! {
! effect = new cPythonEffect;
! }
! else if( objectId == "cDelayedHideChar" )
! {
! effect = new cDelayedHideChar;
! }
! else
! {
! throw QString( "Unknown TempEffect Type: %1" ).arg( objectId );
! }
!
! const char **res = (const char**)result.data(); // Skip id, objectid
! effect->load( id, res );
!
! insert( effect );
}
}
! void cTempEffects::save()
{
! persistentBroker->executeQuery( "DELETE FROM effects;" );
! persistentBroker->executeQuery( "DELETE FROM effects_properties;" );
!
! std::vector< cTempEffect* >::iterator it = teffects.begin();
! unsigned int id = 0;
!
! while( it != teffects.end() )
{
! (*it)->save( id++ );
! ++it;
}
! }
!
! // cDelayedHideChar
! cDelayedHideChar::cDelayedHideChar( SERIAL serial )
! {
! if( !isCharSerial( serial ) || !FindCharBySerial( serial ) )
{
! destSer = INVALID_SERIAL;
! return;
}
!
! destSer = serial;
! 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;
***************
*** 264,531 ****
}
- /*
- // Fibonacci Heap implementation
- //
- // 18.07.2002, Joerg Stueckler (sereg)
- // email: jo...@gm...
- //
- // based on "Algorithms and Data Structures", T.Ottmann/P.Widmayer, 4th Edition
- // Ch. 6.1.5., page 410
- cTempEffect* cTmpEffFibHeap::accessMin() // O(1)!
- {
- return head;
- }
-
- void cTmpEffFibHeap::insert( cTempEffect* pT ) // O(1) too!
- {
- cTmpEffFibHeap toMeld = cTmpEffFibHeap( pT );
- this->meld( toMeld );
- }
-
- cTempEffect* cTmpEffFibHeap::meld( cTmpEffFibHeap &nFheap ) // O(1) !!!
- {
- if( !this->head )
- {
- this->head = nFheap.head;
- }
- else if( this->head && nFheap.head )
- {
- cTempEffect* minHead = NULL;
- cTempEffect* maxHead = NULL;
- if( this->head->expiretime < nFheap.head->expiretime )
- {
- minHead = this->head;
- maxHead = nFheap.head;
- }
- else
- {
- maxHead = this->head;
- minHead = nFheap.head;
- }
- minHead->left->right = maxHead;
- cTempEffect* rightElement = maxHead->left;
- maxHead->left = minHead->left;
- minHead->left = rightElement;
- rightElement->right = minHead;
-
- this->head = minHead;
- }
-
- return this->head;
- }
-
- void cTmpEffFibHeap::deleteMin() // amortized O( lg N )
- {
- if( this->head )
- {
- if( this->head->left == this->head ) // only one element in the heap
- {
- delete this->head;
- this->head = NULL;
- return;
- }
- else
- {
- if( this->head->son ) // min element has a son
- {
- // replace the head with its sons in the list
- this->head->right->left = this->head->son->left;
- this->head->son->left->right = this->head->right;
- this->head->son->left = this->head->left;
- this->head->left->right = this->head->son;
-
- cTempEffect* newHead = this->head->son;
- delete this->head;
- this->head = newHead;
- }
- else
- {
- // unlink the head from the list
- this->head->right->left = this->head->left;
- this->head->left->right = this->head->right;
-
- cTempEffect* newHead = this->head->right;
- delete this->head;
- this->head = newHead;
- }
-
- // now we have to iterate through the root list to find two trees with equal rank
- // we use an array to find collisions.
- cTempEffect* ranks[RANK_ARRAY_SIZE];
- memset( &ranks, 0, sizeof( ranks ) );
-
- cTempEffect* it = this->head;
- cTempEffect* minNode = it;
- cTempEffect* coll = NULL;
-
- bool collision = false;
- do
- {
- collision = false;
- it->father = NULL; // reset the fathers of the inserted sons of head (see above)
- if( it->expiretime < minNode->expiretime )
- minNode = it; // find the min node by the way :)
-
- if( ranks[ it->rank ] && ranks[ it->rank ] != it ) // there is already another address stored in the array!
- {
- coll = ranks[ it->rank ];
- ranks[ it->rank ] = NULL;
-
- if( coll->expiretime < it->expiretime )
- {
- cTempEffect* templeft = NULL;
- cTempEffect* tempright = NULL;
- if( coll->left == it )
- {
- if( coll->right != it )
- {
- templeft = it->left;
- tempright = coll->right;
-
- templeft->right = coll;
- tempright->left = it;
- it->left = coll;
- it->right = tempright;
- coll->left = templeft;
- coll->right = it;
- }
- }
- else if( coll->right == it )
- {
- templeft = coll->left;
- tempright = it->right;
-
- templeft->right = it;
- tempright->left = coll;
- it->left = templeft;
- it->right = coll;
- coll->left = it;
- coll->right = tempright;
- }
- else
- {
- // swap the min element into it position
- templeft = coll->left;
- tempright = coll->right;
-
- it->left->right = coll;
- it->right->left = coll;
- coll->right = it->right;
- coll->left = it->left;
-
- templeft->right = it;
- tempright->left = it;
- it->right = tempright;
- it->left = templeft;
- }
- templeft = it;
- it = coll;
- coll = templeft;
- }
-
- // delete max element (coll) out of the list
- // if coll was head move the head one node right
- if( coll == this->head )
- this->head = coll->right;
- coll->left->right = coll->right;
- coll->right->left = coll->left;
-
- // insert max into the list of sons of min
- if( it->son )
- {
- cTempEffect* rightElement = it->son->left;
- coll->left = rightElement;
- it->son->left = coll;
- rightElement->right = coll;
- coll->right = it->son;
- }
- else
- {
- it->son = coll;
- coll->left = coll;
- coll->right = coll;
- }
- coll->father = it;
-
- it->rank = it->rank + 1;
-
- it->marker = false; // reset the marker cause the node got an additional son
-
- it = it->left;
- collision = true;
- }
- else
- {
- ranks[ it->rank ] = it;
- }
- it = it->right;
- } while( it != this->head || collision);
-
- this->head = minNode;
- }
- }
- }
-
- void cTmpEffFibHeap::decrease( cTempEffect* pT, int diffTime ) // O( 1 )
- {
- if( !pT )
- return;
-
- pT->expiretime -= diffTime;
- if( pT->father )
- {
- // first cut pT out and insert it into the root list
- // mark the father, if the father is already marked,
- // run decrease(...) recursively with diffTime = 0
- pT->left->right = pT->right;
- pT->right->left = pT->left;
-
- this->insert( pT );
-
- if( pT->father->marker )
- this->decrease( pT->father, 0 );
- else
- pT->father->marker = true;
-
- pT->father = NULL;
- pT->marker = false;
- }
- }
-
- void cTmpEffFibHeap::erase( cTempEffect *pT ) // O( lg N )
- {
- this->decrease( pT, (pT->expiretime - this->head->expiretime) + 1 );
- this->deleteMin();
- }
-
- std::vector< cTempEffect* > cTempEffect::asVector()
- {
- std::vector< cTempEffect* > list_ = std::vector< cTempEffect* >();
-
- cTempEffect* iterNode = this;
-
- do
- {
- list_.push_back( iterNode );
- if( iterNode->son )
- {
- std::vector< cTempEffect* > sons_ = iterNode->son->asVector();
- list_.insert( list_.end(), sons_.begin(), sons_.end() );
- }
- iterNode = iterNode->right;
- } while( iterNode != this );
-
- return list_;
- }
-
- std::vector< cTempEffect* > cTmpEffFibHeap::asVector()
- {
- if( this->head )
- return this->head->asVector();
- else
- return std::vector< cTempEffect* >();
- }
- */
-
cRepeatAction::cRepeatAction( P_CHAR mage, UINT8 anim, UINT32 delay )
{
--- 368,371 ----
***************
*** 636,677 ****
}
}
-
- /*
- cFleeReset::cFleeReset( P_NPC pNPC, UINT32 time )
- {
- m_npc = pNPC;
- objectid = "cFleeReset";
- serializable = true;
- dispellable = false;
- expiretime = uiCurrentTime + time * MY_CLOCKS_PER_SEC;
- }
-
- void cFleeReset::Expire()
- {
- if( m_npc )
- {
- cNPC_AI* ai = m_npc->ai();
- if( ai && ai->currState() )
- {
- ai->currState()->ceaseFlee();
- ai->updateState();
- }
- }
- }
-
- void cFleeReset::Serialize( ISerialization &archive )
- {
- if( archive.isReading() )
- {
- SERIAL character = INVALID_SERIAL;
- archive.read( "charserial", character );
- m_npc = dynamic_cast<P_NPC>(World::instance()->findChar( character ));
- }
- else
- {
- archive.write( "charserial", m_npc ? m_npc->serial() : INVALID_SERIAL );
- }
-
- cTempEffect::Serialize( archive );
- }
- */
\ No newline at end of file
--- 476,477 ----
Index: wolf.dsp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolf.dsp,v
retrieving revision 1.227
retrieving revision 1.228
diff -C2 -d -r1.227 -r1.228
*** wolf.dsp 11 Sep 2003 16:21:26 -0000 1.227
--- wolf.dsp 12 Sep 2003 15:29:00 -0000 1.228
***************
*** 52,56 ****
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
! # ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib ws2_32.lib $(QTDIR)\lib\qt-mt320.lib python22.lib /nologo /subsystem:windows /map /machine:I386 /out:"..\wolfpack.exe" /libpath:"lib\ZThread\lib" /libpath:"lib\Python\lib" /libpath:"lib\bugreport\lib" /libpath:"flatstore\Release" /opt:ref /opt:nowin98
# SUBTRACT LINK32 /pdb:none
--- 52,56 ----
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /machine:I386
! # ADD LINK32 kernel32.lib user32.lib gdi32.lib advapi32.lib ws2_32.lib $(QTDIR)\lib\qt-mt320.lib /nologo /subsystem:windows /map /machine:I386 /out:"..\wolfpack.exe" /libpath:"lib\ZThread\lib" /libpath:"lib\Python\lib" /libpath:"lib\bugreport\lib" /libpath:"flatstore\Release" /opt:ref /opt:nowin98
# SUBTRACT LINK32 /pdb:none
Index: wolfpack.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolfpack.cpp,v
retrieving revision 1.464
retrieving revision 1.465
diff -C2 -d -r1.464 -r1.465
*** wolfpack.cpp 11 Sep 2003 15:33:58 -0000 1.464
--- wolfpack.cpp 12 Sep 2003 15:29:00 -0000 1.465
***************
*** 539,542 ****
--- 539,545 ----
PyEval_RestoreThread( _save );
+ // Update our currenttime
+ uiCurrentTime = getNormalizedTime();
+
Console::instance()->poll();
Index: world.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/world.cpp,v
retrieving revision 1.42
retrieving revision 1.43
diff -C2 -d -r1.42 -r1.43
*** world.cpp 11 Sep 2003 15:33:58 -0000 1.42
--- world.cpp 12 Sep 2003 15:29:00 -0000 1.43
***************
*** 254,293 ****
// Load Temporary Effects
! archive = cPluginFactory::serializationArchiver( "xml" );
!
! archive->prepareReading( "effects" );
!
! if ( archive->size() )
! {
! Console::instance()->send( QString( "Loading %1 Temp. Effects...\n" ).arg( archive->size() ) );
! progress_display progress( archive->size() );
!
! for ( i = 0; i < archive->size(); ++progress, ++i)
! {
! archive->readObjectID(objectID);
!
! cTempEffect* pTE = NULL;
!
! if( objectID == "HIDECHAR" )
! pTE = new cDelayedHideChar( INVALID_SERIAL );
!
! else if( objectID == "cPythonEffect" )
! pTE = new cPythonEffect;
!
! else
! {
! Console::instance()->log( LOG_ERROR, tr( "An unknown temporary Effect class was found: %1" ).arg( objectID ) );
! continue; // Skip the class, not a good habit but at the moment the user couldn't really debug the error
! }
!
! archive->readObject( pTE );
! TempEffects::instance()->insert( pTE );
! }
! }
!
! archive->close();
! delete archive;
! Console::instance()->PrepareProgress( tr("Postprocessing") );
P_ITEM pi;
--- 254,260 ----
// Load Temporary Effects
! TempEffects::instance()->load();
! Console::instance()->PrepareProgress( "Postprocessing" );
P_ITEM pi;
***************
*** 488,491 ****
--- 455,460 ----
persistentBroker->saveObject( pChar );
+ TempEffects::instance()->save();
+
persistentBroker->commitTransaction();
}
***************
*** 495,499 ****
Console::instance()->ChangeColor( WPC_RED );
! Console::instance()->send( " Failed" );
Console::instance()->ChangeColor( WPC_NORMAL );
--- 464,468 ----
Console::instance()->ChangeColor( WPC_RED );
! Console::instance()->send( " Failed\n" );
Console::instance()->ChangeColor( WPC_NORMAL );
***************
*** 502,511 ****
}
- ISerialization *archive = cPluginFactory::serializationArchiver( "xml" );
- archive->prepareWritting( "effects" );
- TempEffects::instance()->serialize( *archive );
- archive->close();
- delete archive;
-
// Save the accounts
Accounts::instance()->save();
--- 471,474 ----
***************
*** 519,523 ****
persistentBroker->disconnect();
! Console::instance()->send( QString( " [%1ms]\n" ).arg( getNormalizedTime() - startTime ) );
}
--- 482,486 ----
persistentBroker->disconnect();
! Console::instance()->send( QString( " [%1ms]\n" ).arg( uiCurrentTime - startTime ) );
}
--- iserialization.cpp DELETED ---
--- iserialization.h DELETED ---
--- serxmlfile.cpp DELETED ---
--- serxmlfile.h DELETED ---
|