Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv9847
Modified Files:
Timing.cpp accounts.cpp accounts.h commands.cpp console.cpp
console.h console_win.cpp globals.cpp globals.h items.cpp
npc.cpp persistentbroker.cpp persistentbroker.h player.cpp
player.h speech.cpp srvparams.cpp srvparams.h wolf.dsp
wolfpack.cpp world.cpp wpdefmanager.cpp
Log Message:
Implemented saving of Accounts to the Database and cleaned up a lot of srvparams.h and globals.h
Index: Timing.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/Timing.cpp,v
retrieving revision 1.178
retrieving revision 1.179
diff -C2 -d -r1.178 -r1.179
*** Timing.cpp 7 Sep 2003 19:07:46 -0000 1.178
--- Timing.cpp 9 Sep 2003 23:09:30 -0000 1.179
***************
*** 66,78 ****
#define DBGFILE "Timing.cpp"
- void checktimers() // Check shutdown timers
- {
- if (endtime)
- {
- if (endtime <= uiCurrentTime) keeprun = 0;
- }
- lclock = uiCurrentTime;
- }
-
void restockNPC( UINT32 currenttime, P_NPC pc_i )
{
--- 66,69 ----
***************
*** 578,588 ****
}
- //Time functions
- if( uotickcount <= currenttime )
- {
- uoTime.addSecs(1);
- uotickcount = currenttime + SrvParams->secondsPerUOMinute()*MY_CLOCKS_PER_SEC;
- }
-
// Recalculate and Resend Lightlevel
if( lighttime <= currenttime )
--- 569,572 ----
***************
*** 711,722 ****
if( checknpcs <= currenttime ) checknpcs=(unsigned int)((double)(SrvParams->checkNPCTime()*MY_CLOCKS_PER_SEC+currenttime)); //lb
! if( checktamednpcs <= currenttime ) checktamednpcs=(unsigned int)((double) currenttime+(SrvParams->checkTammedTime()*MY_CLOCKS_PER_SEC)); //AntiChrist
if( checknpcfollow <= currenttime ) checknpcfollow=(unsigned int)((double) currenttime+(SrvParams->checkFollowTime()*MY_CLOCKS_PER_SEC)); //Ripper
if( checkitemstime <= currenttime ) checkitemstime=(unsigned int)((double)(SrvParams->checkItemTime()*MY_CLOCKS_PER_SEC+currenttime)); //lb
if( shoprestocktime <= currenttime )
shoprestocktime = currenttime + MY_CLOCKS_PER_SEC * 60 * 20;
-
- // Update the delay for the next field-effect (every 500ms)
- if( nextfieldeffecttime <= currenttime )
- nextfieldeffecttime = (unsigned int) ( currenttime + ( 0.5 * MY_CLOCKS_PER_SEC ) );
}
--- 695,702 ----
if( checknpcs <= currenttime ) checknpcs=(unsigned int)((double)(SrvParams->checkNPCTime()*MY_CLOCKS_PER_SEC+currenttime)); //lb
! if( checktamednpcs <= currenttime ) checktamednpcs=(unsigned int)((double) currenttime+(SrvParams->checkTamedTime()*MY_CLOCKS_PER_SEC)); //AntiChrist
if( checknpcfollow <= currenttime ) checknpcfollow=(unsigned int)((double) currenttime+(SrvParams->checkFollowTime()*MY_CLOCKS_PER_SEC)); //Ripper
if( checkitemstime <= currenttime ) checkitemstime=(unsigned int)((double)(SrvParams->checkItemTime()*MY_CLOCKS_PER_SEC+currenttime)); //lb
if( shoprestocktime <= currenttime )
shoprestocktime = currenttime + MY_CLOCKS_PER_SEC * 60 * 20;
}
Index: accounts.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/accounts.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -d -r1.64 -r1.65
*** accounts.cpp 9 Sep 2003 03:24:15 -0000 1.64
--- accounts.cpp 9 Sep 2003 23:09:30 -0000 1.65
***************
*** 32,55 ****
#include "accounts.h"
#include "srvparams.h"
- #include "pfactory.h"
#include "network/uosocket.h"
!
#include "commands.h"
#include "player.h"
#include "network.h"
- #include "exceptions.h"
#include "globals.h"
#include "world.h"
/*****************************************************************************
! AccountRecord member functions
*****************************************************************************/
! AccountRecord::AccountRecord()
: acl_(0), inUse_(false), flags_(0)
{
}
! void AccountRecord::Serialize( ISerialization& archive )
{
if ( archive.isReading() )
--- 32,55 ----
#include "accounts.h"
#include "srvparams.h"
#include "network/uosocket.h"
! #include "dbdriver.h"
! #include "console.h"
#include "commands.h"
#include "player.h"
#include "network.h"
#include "globals.h"
+ #include "persistentbroker.h"
#include "world.h"
/*****************************************************************************
! cAccount member functions
*****************************************************************************/
! cAccount::cAccount()
: acl_(0), inUse_(false), flags_(0)
{
}
! /*void cAccount::Serialize( ISerialization& archive )
{
if ( archive.isReading() )
***************
*** 87,93 ****
}
cSerializable::Serialize( archive );
! }
! bool AccountRecord::isBlocked() const
{
if ( (blockUntil.isValid() && blockUntil < QDateTime::currentDateTime()) || flags_&0x00000001 )
--- 87,93 ----
}
cSerializable::Serialize( archive );
! }*/
! bool cAccount::isBlocked() const
{
if ( (blockUntil.isValid() && blockUntil < QDateTime::currentDateTime()) || flags_&0x00000001 )
***************
*** 97,101 ****
}
! uint AccountRecord::secsToUnblock() const
{
if ( isBlocked() )
--- 97,101 ----
}
! uint cAccount::secsToUnblock() const
{
if ( isBlocked() )
***************
*** 106,110 ****
}
! bool AccountRecord::addCharacter( P_PLAYER d )
{
if( qFind( characters_.begin(), characters_.end(), d ) == characters_.end() )
--- 106,110 ----
}
! bool cAccount::addCharacter( P_PLAYER d )
{
if( qFind( characters_.begin(), characters_.end(), d ) == characters_.end() )
***************
*** 116,120 ****
}
! bool AccountRecord::removeCharacter( P_PLAYER d )
{
QValueVector<P_PLAYER>::iterator it = qFind( characters_.begin(), characters_.end(), d );
--- 116,120 ----
}
! bool cAccount::removeCharacter( P_PLAYER d )
{
QValueVector<P_PLAYER>::iterator it = qFind( characters_.begin(), characters_.end(), d );
***************
*** 127,131 ****
}
! bool AccountRecord::authorized( const QString& group, const QString& value ) const
{
// No Valid ACL specified
--- 127,131 ----
}
! bool cAccount::authorized( const QString& group, const QString& value ) const
{
// No Valid ACL specified
***************
*** 160,169 ****
}
! void AccountRecord::remove()
{
Accounts::instance()->remove( this );
}
! void cAccounts::remove( AccountRecord *record )
{
if( accounts.contains( record->login() ) )
--- 160,169 ----
}
! void cAccount::remove()
{
Accounts::instance()->remove( this );
}
! void cAccounts::remove( cAccount *record )
{
if( accounts.contains( record->login() ) )
***************
*** 172,206 ****
}
! void AccountRecord::refreshAcl()
{
acl_ = cCommands::instance()->getACL( aclName_ );
}
! bool AccountRecord::isAllMove() const
{
return flags_&0x00000002;
}
! bool AccountRecord::isAllShow() const
{
return flags_&0x00000004;
}
! bool AccountRecord::isShowSerials() const
{
return flags_&0x00000008;
}
! bool AccountRecord::isPageNotify() const
{
return flags_&0x00000010;
}
! bool AccountRecord::isStaff() const
{
return flags_&0x00000020;
}
! void AccountRecord::setBlocked( bool data )
{
if( data )
--- 172,206 ----
}
! void cAccount::refreshAcl()
{
acl_ = cCommands::instance()->getACL( aclName_ );
}
! bool cAccount::isAllMove() const
{
return flags_&0x00000002;
}
! bool cAccount::isAllShow() const
{
return flags_&0x00000004;
}
! bool cAccount::isShowSerials() const
{
return flags_&0x00000008;
}
! bool cAccount::isPageNotify() const
{
return flags_&0x00000010;
}
! bool cAccount::isStaff() const
{
return flags_&0x00000020;
}
! void cAccount::setBlocked( bool data )
{
if( data )
***************
*** 210,214 ****
}
! void AccountRecord::setAllMove( bool data )
{
if( data )
--- 210,214 ----
}
! void cAccount::setAllMove( bool data )
{
if( data )
***************
*** 218,222 ****
}
! void AccountRecord::setAllShow( bool data )
{
if( data )
--- 218,222 ----
}
! void cAccount::setAllShow( bool data )
{
if( data )
***************
*** 226,230 ****
}
! void AccountRecord::setShowSerials( bool data )
{
if( data )
--- 226,230 ----
}
! void cAccount::setShowSerials( bool data )
{
if( data )
***************
*** 234,238 ****
}
! void AccountRecord::setPageNotify( bool data )
{
if( data )
--- 234,238 ----
}
! void cAccount::setPageNotify( bool data )
{
if( data )
***************
*** 242,246 ****
}
! void AccountRecord::setStaff( bool data )
{
if( data )
--- 242,246 ----
}
! void cAccount::setStaff( bool data )
{
if( data )
***************
*** 263,271 ****
iterator it = accounts.begin();
for (; it != accounts.end(); ++it)
! delete it.data();
!
}
! AccountRecord* cAccounts::authenticate(const QString& login, const QString& password, enErrorCode* error) const
{
const_iterator it = accounts.find(login);
--- 263,270 ----
iterator it = accounts.begin();
for (; it != accounts.end(); ++it)
! delete it.data();
}
! cAccount* cAccounts::authenticate(const QString& login, const QString& password, enErrorCode* error) const
{
const_iterator it = accounts.find(login);
***************
*** 298,309 ****
else
{
- // it.data()->loginAttemped();
if( error )
*error = BadPassword;
! // Now we check for the number of attempts;
! // if ( it.data()->loginAttempts() > SrvParams->MaxLoginAttempts() )
! // {
! // it.data()->block(SrvParams->AccountBlockTime());
! // }
return 0;
}
--- 297,303 ----
else
{
if( error )
*error = BadPassword;
!
return 0;
}
***************
*** 319,353 ****
void cAccounts::save()
{
! ISerialization* archive = cPluginFactory::serializationArchiver( SrvParams->accountsArchiver());
! archive->prepareWritting("accounts");
! // Now save accounts
! iterator it = accounts.begin();
! for (; it != accounts.end(); ++it )
{
! archive->writeObject( it.data() );
}
! archive->close();
! delete archive;
}
void cAccounts::load()
{
! ISerialization* archive = cPluginFactory::serializationArchiver( SrvParams->accountsArchiver());
! archive->prepareReading("accounts");
! for (uint i = 0; i < archive->size(); ++i)
{
! QString objectID;
! archive->readObjectID( objectID );
! if ( objectID == "ACCOUNT" )
{
! AccountRecord* d = new AccountRecord;
! archive->readObject( d );
! accounts.insert( d->login(), d );
}
- else
- throw wpException( "Error parsing account records." );
}
! archive->close();
! delete archive;
}
--- 313,408 ----
void cAccounts::save()
{
! // Open the Account Driver
! if( !persistentBroker->openDriver( SrvParams->accountsDriver() ) )
{
! Console::instance()->log( LOG_ERROR, QString( "Unknown Account Database Driver '%1', check your wolfpack.xml").arg( SrvParams->accountsDriver() ) );
! return;
}
!
! bool connected = false;
!
! try
! {
! persistentBroker->connect( SrvParams->accountsHost(), SrvParams->accountsName(), SrvParams->accountsUsername(), SrvParams->accountsPassword() );
! connected = true;
!
! persistentBroker->executeQuery( "BEGIN;" );
!
! persistentBroker->executeQuery( "DELETE FROM accounts;" );
!
! iterator it = accounts.begin();
! for (; it != accounts.end(); ++it)
! {
! // INSERT
! cAccount *account = it.data();
!
! QString sql( "INSERT INTO accounts VALUES( '%1', '%2', %3, '%4', %5, %6 );" );
!
! sql = sql.arg( account->login_ ).arg( account->password_ ).arg( account->flags_ ).arg( account->aclName_ ).arg( !account->lastLogin_.isNull() ? account->lastLogin_.toTime_t() : 0 ).arg( !account->blockUntil.isNull() ? account->blockUntil.toTime_t() : 0 );
!
! persistentBroker->executeQuery( sql );
! }
!
! persistentBroker->executeQuery( "COMMIT;" );
! }
! catch( QString &error )
! {
! if( connected )
! persistentBroker->executeQuery( "ROLLBACK;" );
! Console::instance()->log( LOG_ERROR, QString( "Error while saving Accounts: %1." ).arg( error ) );
! }
! catch( ... )
! {
! if( connected )
! persistentBroker->executeQuery( "ROLLBACK;" );
! Console::instance()->log( LOG_ERROR, "Unknown error while saving Accounts." );
! }
}
void cAccounts::load()
{
! // Open the Account Driver
! if( !persistentBroker->openDriver( SrvParams->accountsDriver() ) )
{
! Console::instance()->log( LOG_ERROR, QString( "Unknown Account Database Driver '%1', check your wolfpack.xml").arg( SrvParams->accountsDriver() ) );
! return;
! }
!
! // Load all Accounts
! try
! {
! persistentBroker->connect( SrvParams->accountsHost(), SrvParams->accountsName(), SrvParams->accountsUsername(), SrvParams->accountsPassword() );
!
! cDBResult result = persistentBroker->query( "SELECT accounts.login,accounts.password,accounts.flags,accounts.acl,accounts.lastlogin,accounts.blockuntil FROM accounts;" );
!
! // Clear Accounts HERE
! // Here we can be pretty sure that we have a valid datasource for accounts
! clear();
!
! while( result.fetchrow() )
{
! cAccount *account = new cAccount;
! account->login_ = result.getString( 0 );
! account->password_ = result.getString( 1 );
! account->flags_ = result.getInt( 2 );
! account->aclName_ = result.getString( 3 );
! account->refreshAcl();
! if( result.getInt( 4 ) != 0 )
! account->lastLogin_.setTime_t( result.getInt( 4 ) );
!
! if( result.getInt( 5 ) != 0 )
! account->blockUntil.setTime_t( result.getInt( 5 ) );
!
! accounts.insert( account->login_, account );
}
}
! catch( QString &error )
! {
! Console::instance()->log( LOG_ERROR, QString( "Error while loading Accounts: %1" ).arg( error ) );
! }
! catch( ... )
! {
! Console::instance()->log( LOG_ERROR, "Unknown error while loading Accounts" );
! }
}
***************
*** 377,381 ****
}
- clear();
load();
--- 432,435 ----
***************
*** 396,405 ****
++sit;
}
-
}
! AccountRecord* cAccounts::createAccount( const QString& login, const QString& password )
{
! AccountRecord* d = new AccountRecord;
d->login_ = login;
d->password_ = password;
--- 450,458 ----
++sit;
}
}
! cAccount* cAccounts::createAccount( const QString& login, const QString& password )
{
! cAccount* d = new cAccount;
d->login_ = login;
d->password_ = password;
***************
*** 419,423 ****
}
! AccountRecord* cAccounts::getRecord( const QString& login )
{
iterator it = accounts.find( login );
--- 472,476 ----
}
! cAccount* cAccounts::getRecord( const QString& login )
{
iterator it = accounts.find( login );
Index: accounts.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/accounts.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** accounts.h 9 Sep 2003 03:24:15 -0000 1.30
--- accounts.h 9 Sep 2003 23:09:30 -0000 1.31
***************
*** 54,58 ****
class cAcl;
! class AccountRecord : public cSerializable
{
friend class cAccounts; // my manager
--- 54,58 ----
class cAcl;
! class cAccount
{
friend class cAccounts; // my manager
***************
*** 78,82 ****
public:
! AccountRecord();
QString login() const;
--- 78,82 ----
public:
! cAccount();
QString login() const;
***************
*** 105,111 ****
UINT32 flags() const;
QDateTime blockedUntil() const { return blockUntil; }
-
- void Serialize( ISerialization& );
- QString objectID( void ) const;
// Flag Setters/Getters
--- 105,108 ----
***************
*** 129,134 ****
{
private:
! QMap<QString, AccountRecord*> accounts;
! typedef QMap<QString, AccountRecord*>::iterator iterator;
public:
enum enErrorCode {LoginNotFound, BadPassword, Banned, Wipped, AlreadyInUse, NoError};
--- 126,131 ----
{
private:
! QMap<QString, cAccount*> accounts;
! typedef QMap<QString, cAccount*>::iterator iterator;
public:
enum enErrorCode {LoginNotFound, BadPassword, Banned, Wipped, AlreadyInUse, NoError};
***************
*** 136,145 ****
public:
~cAccounts();
! AccountRecord* authenticate(const QString& login, const QString& password, enErrorCode* = 0) const;
! AccountRecord* getRecord( const QString& );
! AccountRecord* createAccount( const QString& login, const QString& password );
uint count();
! void remove( AccountRecord *record );
void save();
--- 133,142 ----
public:
~cAccounts();
! cAccount* authenticate(const QString& login, const QString& password, enErrorCode* = 0) const;
! cAccount* getRecord( const QString& );
! cAccount* createAccount( const QString& login, const QString& password );
uint count();
! void remove( cAccount *record );
void save();
***************
*** 148,152 ****
void clear();
! typedef QMap<QString, AccountRecord*>::const_iterator const_iterator;
const_iterator begin() const { return accounts.begin(); }
const_iterator end() const { return accounts.end(); }
--- 145,149 ----
void clear();
! typedef QMap<QString, cAccount*>::const_iterator const_iterator;
const_iterator begin() const { return accounts.begin(); }
const_iterator end() const { return accounts.end(); }
***************
*** 154,228 ****
// inline members
! inline QString AccountRecord::acl() const
{
return aclName_;
}
! inline QString AccountRecord::login() const
{
return login_;
}
! inline QString AccountRecord::password() const
{
return password_;
}
! inline void AccountRecord::setPassword( const QString& data )
{
password_ = data;
}
! inline QValueVector<P_PLAYER> AccountRecord::caracterList() const
{
return characters_;
}
! inline QString AccountRecord::objectID( void ) const
! {
! return "ACCOUNT";
! }
!
! inline void AccountRecord::setAcl( const QString &d )
{
aclName_ = d;
}
! inline void AccountRecord::block( int seconds )
{
blockUntil = QDateTime::currentDateTime().addSecs( seconds );
}
! inline QDateTime AccountRecord::lastLogin() const
{
return lastLogin_;
}
! inline UINT32 AccountRecord::flags() const
{
return flags_;
}
! inline void AccountRecord::setLastLogin( const QDateTime& d )
{
lastLogin_ = d;
}
! inline bool AccountRecord::inUse() const
{
return inUse_;
}
! inline void AccountRecord::setInUse( bool data )
{
inUse_ = data;
}
! inline void AccountRecord::setBlockUntil( const QDateTime &d )
{
blockUntil = d;
}
! inline void AccountRecord::setFlags( UINT32 data )
{
flags_ = data;
--- 151,220 ----
// inline members
! inline QString cAccount::acl() const
{
return aclName_;
}
! inline QString cAccount::login() const
{
return login_;
}
! inline QString cAccount::password() const
{
return password_;
}
! inline void cAccount::setPassword( const QString& data )
{
password_ = data;
}
! inline QValueVector<P_PLAYER> cAccount::caracterList() const
{
return characters_;
}
! inline void cAccount::setAcl( const QString &d )
{
aclName_ = d;
}
! inline void cAccount::block( int seconds )
{
blockUntil = QDateTime::currentDateTime().addSecs( seconds );
}
! inline QDateTime cAccount::lastLogin() const
{
return lastLogin_;
}
! inline UINT32 cAccount::flags() const
{
return flags_;
}
! inline void cAccount::setLastLogin( const QDateTime& d )
{
lastLogin_ = d;
}
! inline bool cAccount::inUse() const
{
return inUse_;
}
! inline void cAccount::setInUse( bool data )
{
inUse_ = data;
}
! inline void cAccount::setBlockUntil( const QDateTime &d )
{
blockUntil = d;
}
! inline void cAccount::setFlags( UINT32 data )
{
flags_ = data;
Index: commands.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/commands.cpp,v
retrieving revision 1.200
retrieving revision 1.201
diff -C2 -d -r1.200 -r1.201
*** commands.cpp 9 Sep 2003 03:24:15 -0000 1.200
--- commands.cpp 9 Sep 2003 23:09:30 -0000 1.201
***************
*** 409,413 ****
else
{
! AccountRecord *account = Accounts::instance()->getRecord( args[1].left( 30 ) );
QValueVector<P_PLAYER> characters = account->caracterList();
Accounts::instance()->remove( account );
--- 409,413 ----
else
{
! cAccount *account = Accounts::instance()->getRecord( args[1].left( 30 ) );
QValueVector<P_PLAYER> characters = account->caracterList();
Accounts::instance()->remove( account );
***************
*** 434,438 ****
else
{
! AccountRecord *account = Accounts::instance()->getRecord( args[1].left( 30 ) );
QString key = args[2];
QString value = args[3];
--- 434,438 ----
else
{
! cAccount *account = Accounts::instance()->getRecord( args[1].left( 30 ) );
QString key = args[2];
QString value = args[3];
***************
*** 502,506 ****
else
{
! AccountRecord *account = Accounts::instance()->getRecord( args[1].left( 30 ) );
QString key = args[2];
--- 502,506 ----
else
{
! cAccount *account = Accounts::instance()->getRecord( args[1].left( 30 ) );
QString key = args[2];
Index: console.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console.cpp,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** console.cpp 8 Sep 2003 23:38:49 -0000 1.2
--- console.cpp 9 Sep 2003 23:09:30 -0000 1.3
***************
*** 247,248 ****
--- 247,256 ----
return true;
}
+
+ void cConsole::queueCommand( const QString &command )
+ {
+ commandMutex.lock();
+ commandQueue.push_back( command );
+ commandMutex.unlock();
+ }
+
Index: console.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** console.h 9 Sep 2003 15:17:07 -0000 1.3
--- console.h 9 Sep 2003 23:09:30 -0000 1.4
***************
*** 42,45 ****
--- 42,46 ----
#include <qstringlist.h>
#include <qstring.h>
+ #include <qmutex.h>
// Third Party includes
***************
*** 74,77 ****
--- 75,81 ----
QStringList linebuffer_;
QString incompleteLine_;
+ QStringList commandQueue;
+ QMutex commandMutex;
+
public:
cConsole();
***************
*** 100,107 ****
virtual void ChangeColor( WPC_ColorKeys Color );
virtual void setConsoleTitle( const QString& data );
-
QStringList linebuffer() const { return linebuffer_; }
!
! bool handleCommand( const QString &command, bool silentFail = false );
virtual void start();
virtual void poll();
--- 104,110 ----
virtual void ChangeColor( WPC_ColorKeys Color );
virtual void setConsoleTitle( const QString& data );
QStringList linebuffer() const { return linebuffer_; }
! void queueCommand( const QString &command ); // Thread-Safe
!
virtual void start();
virtual void poll();
***************
*** 114,117 ****
--- 117,121 ----
std::ostream *outputstrm;
bool bEnabled;
+ bool handleCommand( const QString &command, bool silentFail = false );
};
Index: console_win.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console_win.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** console_win.cpp 9 Sep 2003 15:33:07 -0000 1.6
--- console_win.cpp 9 Sep 2003 23:09:30 -0000 1.7
***************
*** 84,87 ****
--- 84,90 ----
LRESULT CALLBACK wpWindowProc( HWND hwnd, UINT msg, WPARAM wparam, LPARAM lparam )
{
+ if( mainWindow && hwnd != mainWindow )
+ return DefWindowProc( hwnd, msg, wparam, lparam );
+
CHARFORMAT cf;
LOGFONT lfont;
***************
*** 201,204 ****
--- 204,211 ----
return 0;
+ case WM_CLOSE:
+ keeprun = 0;
+ return 1;
+
case WM_DESTROY:
keeprun = 0;
***************
*** 336,342 ****
GetWindowText( inputWindow, command, 512 );
SetWindowText( inputWindow, "" );
!
! // Process Command
! Console::instance()->handleCommand( command );
}
--- 343,349 ----
GetWindowText( inputWindow, command, 512 );
SetWindowText( inputWindow, "" );
!
! // We are in a different Thread. Remember that.
! Console::instance()->queueCommand( command );
}
***************
*** 361,364 ****
--- 368,382 ----
void cConsole::poll()
{
+ // Poll for new Commands
+ commandMutex.lock();
+ QStringList commands = commandQueue;
+ commandQueue.clear();
+ commandMutex.unlock();
+
+ while( commands.count() > 0 )
+ {
+ handleCommand( commands.front() );
+ commands.pop_front();
+ }
}
***************
*** 520,521 ****
--- 538,540 ----
SendMessage( logWindow, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)&cf );
}
+
Index: globals.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/globals.cpp,v
retrieving revision 1.102
retrieving revision 1.103
diff -C2 -d -r1.102 -r1.103
*** globals.cpp 9 Sep 2003 03:24:15 -0000 1.102
--- globals.cpp 9 Sep 2003 23:09:30 -0000 1.103
***************
*** 50,146 ****
#include <qdatetime.h>
-
- using namespace std;
-
enServerState serverState;
!
! // Instantiate our console object
! cConsole clConsole;
!
! time_t oldtime, newtime;
!
! unsigned int polyduration=90;
!
! //Time variables
QDateTime uoTime;
! int secondsperuominute=5; //Number of seconds for a WOLFPACK minute.
! int uotickcount=1;
! unsigned long initialserversec ;
! unsigned long initialservermill ;
! //int goldamount;
! unsigned int nextfieldeffecttime=0;
! unsigned int nextnpcaitime=0;
!
! // MSVC fails to compile WOLFPACK if this is unsigned, change it then
! int autosaved, saveinterval;
! int dosavewarning=0;
! bool heartbeat;
!
! int err, error;
volatile int keeprun;
- //int now;
-
- int secure; // Secure mode
-
- // - the below structure is for looking up items based on serial #
- // - item's serial, owner's serial, char's serial, and container's serial
-
- unsigned int raindroptime;
-
- int tnum;
-
- unsigned int starttime, endtime, lclock;
-
- unsigned int shoprestocktime=0;
-
- //int *spawnedguards;
- // Profiling
- int networkTime = 0;
- int timerTime = 0;
- int autoTime = 0;
- int loopTime = 0;
- int networkTimeCount = 1000;
- int timerTimeCount = 1000;
- int autoTimeCount = 1000;
- int loopTimeCount = 1000;
-
- unsigned long int serverstarttime;
-
- // Script files that need to be cached
- // Crackerjack Jul 31/99
-
- int escortRegions = 0;
-
-
- unsigned int hungerdamagetimer=0; // For hunger damage
-
- //-=-=-=-=-=-=-Classes Definitions=-=-=-=-=-=//
cSrvParams *SrvParams;
Maps *Map;
cSkills *Skills;
cSpeech *Speech;
- cBounty *Bounty;
cScriptManager *ScriptManager;
WPDefManager *DefManager;
PersistentBroker* persistentBroker;
!
! // - the below structure is for looking up items based on serial #
! // - item's serial, owner's serial, char's serial, and container's serial
!
! list<SERIAL> guilds;
!
! /******************************************************/
!
! ///////////////////////////////////////////
! /// and the rest /
! ///////////////////////////////////////////
! std::vector<std::string> clientsAllowed; // client version controll system
!
! /////////////////////////////////////////
! ///////////// global string vars /////////
! /////////////////////////////////////////
!
! char temp[1024];
--- 50,72 ----
#include <qdatetime.h>
enServerState serverState;
! time_t oldtime;
! time_t newtime;
QDateTime uoTime;
! int autosaved;
! int secure = 1;
! int dosavewarning = 0;
volatile int keeprun;
+ unsigned int shoprestocktime = 0;
+ unsigned int hungerdamagetimer = 0;
cSrvParams *SrvParams;
Maps *Map;
cSkills *Skills;
cSpeech *Speech;
cScriptManager *ScriptManager;
WPDefManager *DefManager;
PersistentBroker* persistentBroker;
! char temp[1024];
Index: globals.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/globals.h,v
retrieving revision 1.76
retrieving revision 1.77
diff -C2 -d -r1.76 -r1.77
*** globals.h 9 Sep 2003 03:24:16 -0000 1.76
--- globals.h 9 Sep 2003 23:09:30 -0000 1.77
***************
*** 32,37 ****
#if !defined(__GLOBALS_H__)
#define __GLOBALS_H__
! // Platform specifics
#include "platform.h"
// System Includes
--- 32,39 ----
#if !defined(__GLOBALS_H__)
#define __GLOBALS_H__
!
! // Wolfpack Includes
#include "platform.h"
+ #include "structs.h"
// System Includes
***************
*** 44,118 ****
#include <termios.h>
#endif
- // Third Party
-
-
- //Forward Class Declaration
class QDateTime;
class cScriptManager;
class WPDefManager;
- #include "structs.h"
-
// Global Variables
-
extern enServerState serverState;
-
extern unsigned int uiCurrentTime;
- extern unsigned int raindroptime;
- extern unsigned int polyduration;
- //extern wp_version_info wp_version;
-
- //Time variables
extern QDateTime uoTime;
- extern int uotickcount;
-
- //extern int goldamount;
- extern unsigned int nextfieldeffecttime;
extern unsigned int nextnpcaitime;
extern int autosaved, dosavewarning;
- extern int err, error;
extern volatile int keeprun;
- //extern int now;
- extern int secure; // Secure mode
! extern unsigned int starttime, endtime, lclock;
extern unsigned int shoprestocktime;
extern unsigned int hungerdamagetimer; // Used for hunger damage
- // Profiling
- extern int networkTime;
- extern int timerTime;
- extern int autoTime;
- extern int loopTime;
- extern int networkTimeCount;
- extern int timerTimeCount;
- extern int autoTimeCount;
- extern int loopTimeCount;
-
- extern unsigned long int serverstarttime;
-
- extern unsigned long initialserversec;
- extern unsigned long initialservermill ;
-
-
-
- // - the below structure is for looking up items based on serial #
- // - item's serial, owner's serial, char's serial, and container's serial
-
- extern std::list<SERIAL> guilds;
-
- /*...
[truncated message content] |