Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv15450
Modified Files:
Timing.cpp Trade.h accounts.cpp basics.cpp basics.h combat.cpp
console.cpp console.h console_unix.cpp house.cpp
iserialization.h items.cpp pfactory.cpp serbinfile.cpp
serbinfile.h serxmlfile.cpp serxmlfile.h spawnregions.cpp
speech.h territories.cpp verinfo.h wolf.dsp wolfpack.cpp
world.cpp wpdefmanager.cpp
Removed Files:
stream.h utilsys.cpp utilsys.h wpconsole.cpp wpconsole.h
Log Message:
Removed references to STL strings and iostreams.
Index: Timing.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/Timing.cpp,v
retrieving revision 1.179
retrieving revision 1.180
diff -C2 -d -r1.179 -r1.180
*** Timing.cpp 9 Sep 2003 23:09:30 -0000 1.179
--- Timing.cpp 11 Sep 2003 12:22:24 -0000 1.180
***************
*** 35,39 ****
#include "Timing.h"
! #include "walking.h"
#include "TmpEff.h"
#include "combat.h"
--- 35,39 ----
#include "Timing.h"
! #include "basics.h"
#include "TmpEff.h"
#include "combat.h"
***************
*** 54,63 ****
#include "ai.h"
#include "inlines.h"
#include "world.h"
- #include "utilsys.h"
// Library Includes
#include <qdatetime.h>
#include <math.h>
using namespace std;
--- 54,64 ----
#include "ai.h"
#include "inlines.h"
+ #include "walking.h"
#include "world.h"
// Library Includes
#include <qdatetime.h>
#include <math.h>
+ #include <time.h>
using namespace std;
Index: Trade.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/Trade.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** Trade.h 7 Sep 2003 19:07:46 -0000 1.17
--- Trade.h 11 Sep 2003 12:22:24 -0000 1.18
***************
*** 37,43 ****
#include "inlines.h"
- //system includes
- #include <iostream>
-
// Wolfpack includes
#include "itemid.h"
--- 37,40 ----
Index: accounts.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/accounts.cpp,v
retrieving revision 1.65
retrieving revision 1.66
diff -C2 -d -r1.65 -r1.66
*** accounts.cpp 9 Sep 2003 23:09:30 -0000 1.65
--- accounts.cpp 11 Sep 2003 12:22:24 -0000 1.66
***************
*** 51,92 ****
}
- /*void cAccount::Serialize( ISerialization& archive )
- {
- if ( archive.isReading() )
- {
- archive.read("login", login_);
- archive.read("password", password_);
- archive.read("flags", flags_);
- archive.read("acl", aclName_);
- QString temp;
- archive.read("lastlogin", temp);
- if( !temp.isNull() && !temp.isEmpty() && temp != "0" )
- lastLogin_ = QDateTime::fromString( temp, Qt::ISODate );
-
- archive.read("blockuntil", temp);
- if( !temp.isNull() && !temp.isEmpty() && temp != "0" )
- blockUntil = QDateTime::fromString( temp, Qt::ISODate );
-
- refreshAcl(); // Reload our ACL
- }
- else // Writting
- {
- archive.write( "login", login_ );
- archive.write( "password", password_ );
- archive.write( "flags", flags_ );
- archive.write( "acl", aclName_ );
-
- if( lastLogin_.isValid() )
- archive.write( "lastlogin", lastLogin_.toString( Qt::ISODate ) );
- else
- archive.write( "lastlogin", QString( "0" ) );
- if( blockUntil.isValid() )
- archive.write( "blockuntil", blockUntil.toString( Qt::ISODate ) );
- else
- archive.write( "blockuntil", QString( "0" ) );
- }
- cSerializable::Serialize( archive );
- }*/
-
bool cAccount::isBlocked() const
{
--- 51,54 ----
***************
*** 339,343 ****
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 );
--- 301,305 ----
QString sql( "INSERT INTO accounts VALUES( '%1', '%2', %3, '%4', %5, %6 );" );
! sql = sql.arg( account->login_.lower() ).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 );
***************
*** 383,387 ****
{
cAccount *account = new cAccount;
! account->login_ = result.getString( 0 );
account->password_ = result.getString( 1 );
account->flags_ = result.getInt( 2 );
--- 345,349 ----
{
cAccount *account = new cAccount;
! account->login_ = result.getString( 0 ).lower();
account->password_ = result.getString( 1 );
account->flags_ = result.getInt( 2 );
Index: basics.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basics.cpp,v
retrieving revision 1.25
retrieving revision 1.26
diff -C2 -d -r1.25 -r1.26
*** basics.cpp 27 Feb 2003 16:31:52 -0000 1.25
--- basics.cpp 11 Sep 2003 12:22:24 -0000 1.26
***************
*** 30,39 ****
//==================================================================================
- ////////////////////////
- // name: basics.cpp
- // purpose: implementation of basic functions (that don't need wolfpack definitions)
- //
- //
-
// Wolfpack Includes
#include "basics.h"
--- 30,33 ----
***************
*** 47,50 ****
--- 41,50 ----
#include <stdlib.h>
+ #if defined( Q_OS_WIN32 )
+ #include <windows.h>
+ #else
+ #include <sys/time.h>
+ #endif
+
/*!
Returns a random number between \a nLowNum
***************
*** 145,147 ****
--- 145,186 ----
else
return value;
+ }
+
+ #if defined( Q_OS_WIN32 )
+
+ // Windows Version
+ // Return time in ms since system startup
+ static unsigned int getPlatformTime()
+ {
+ return GetTickCount();
+ }
+
+ #else
+
+ // Linux Version
+ // Return time in ms since system startup
+ static unsigned int getPlatformTime()
+ {
+ 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 );
+ }
+
+ #endif
+
+ unsigned int getNormalizedTime()
+ {
+ static unsigned int startTime = 0;
+
+ if( !startTime )
+ {
+ startTime = getPlatformTime();
+ return 0;
+ }
+
+ return getPlatformTime() - startTime;
}
Index: basics.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basics.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** basics.h 7 Sep 2003 19:07:46 -0000 1.15
--- basics.h 11 Sep 2003 12:22:24 -0000 1.16
***************
*** 83,85 ****
--- 83,87 ----
float RandomFloatNum(float nLowNum, float nHighNum);
+ unsigned int getNormalizedTime();
+
#endif
Index: combat.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/combat.cpp,v
retrieving revision 1.149
retrieving revision 1.150
diff -C2 -d -r1.149 -r1.150
*** combat.cpp 7 Sep 2003 19:07:46 -0000 1.149
--- combat.cpp 11 Sep 2003 12:22:24 -0000 1.150
***************
*** 36,40 ****
#include "itemid.h"
- #include "utilsys.h"
#include "sectors.h"
#include "combat.h"
--- 36,39 ----
Index: console.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** console.cpp 9 Sep 2003 23:09:30 -0000 1.3
--- console.cpp 11 Sep 2003 12:22:24 -0000 1.4
***************
*** 48,53 ****
#include <qthread.h>
- #include <iostream>
-
#if defined(Q_OS_WIN32)
# include <windows.h>
--- 48,51 ----
***************
*** 70,75 ****
{
bEnabled = true;
- // do nothing at the moment
- setStreams( &cin, &cout );
}
--- 68,71 ----
***************
*** 84,93 ****
{
bEnabled = bState;
- }
-
- void cConsole::setStreams(istream *in, ostream *out)
- {
- inputstrm = in;
- outputstrm = out;
}
--- 80,83 ----
Index: console.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** console.h 9 Sep 2003 23:09:30 -0000 1.4
--- console.h 11 Sep 2003 12:22:24 -0000 1.5
***************
*** 83,87 ****
void enabled(bool);
- void setStreams( std::istream *in, std::ostream *out );
// Send a message to the console
--- 83,86 ----
***************
*** 113,119 ****
void setAttributes( bool bold, bool italic, bool underlined, unsigned char r, unsigned char g, unsigned char b, unsigned char size, eFontType font );
private:
-
- std::istream *inputstrm;
- std::ostream *outputstrm;
bool bEnabled;
bool handleCommand( const QString &command, bool silentFail = false );
--- 112,115 ----
Index: console_unix.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/console_unix.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** console_unix.cpp 9 Sep 2003 22:17:59 -0000 1.3
--- console_unix.cpp 11 Sep 2003 12:22:24 -0000 1.4
***************
*** 36,41 ****
#include "globals.h"
- #include <iostream>
-
using namespace std;
--- 36,39 ----
***************
*** 156,164 ****
void cConsole::send(const QString &sMessage)
{
! if( outputstrm != NULL )
! {
! (*outputstrm) << sMessage.latin1();
! flush( *outputstrm );
! }
if( sMessage.contains( "\n" ) )
--- 154,159 ----
void cConsole::send(const QString &sMessage)
{
! fprintf( stdout, sMessage.latin1() );
! fflush( stdout );
if( sMessage.contains( "\n" ) )
Index: house.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/house.cpp,v
retrieving revision 1.114
retrieving revision 1.115
diff -C2 -d -r1.114 -r1.115
*** house.cpp 7 Sep 2003 19:07:47 -0000 1.114
--- house.cpp 11 Sep 2003 12:22:24 -0000 1.115
***************
*** 38,42 ****
#include "maps.h"
#include "tilecache.h"
- #include "utilsys.h"
#include "network.h"
#include "network/uosocket.h"
--- 38,41 ----
Index: iserialization.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/iserialization.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** iserialization.h 19 Jan 2003 16:08:59 -0000 1.24
--- iserialization.h 11 Sep 2003 12:22:24 -0000 1.25
***************
*** 85,90 ****
virtual ~ISerialization(){}
! virtual void prepareReading(std::string ident, int bLevel = 0 ) { Q_UNUSED(bLevel); _state = enReading; }
! virtual void prepareWritting(std::string ident) { _state = enWritting; }
virtual bool isReading() { return (_state == enReading); }
--- 85,90 ----
virtual ~ISerialization(){}
! virtual void prepareReading( const QString &ident, int bLevel = 0 ) { Q_UNUSED(bLevel); _state = enReading; }
! virtual void prepareWritting( const QString &ident ) { _state = enWritting; }
virtual bool isReading() { return (_state == enReading); }
***************
*** 102,106 ****
// Write Methods
virtual void writeObjectID( const QString& ) = 0;
! virtual void write(const char* Key, std::string &data) = 0;
virtual void write(const char* Key, unsigned int data) = 0;
virtual void write(const char* Key, signed int data) = 0;
--- 102,106 ----
// Write Methods
virtual void writeObjectID( const QString& ) = 0;
! virtual void write(const char* Key, const QString &data) = 0;
virtual void write(const char* Key, unsigned int data) = 0;
virtual void write(const char* Key, signed int data) = 0;
***************
*** 115,119 ****
virtual void readObjectID(QString &data) = 0;
! virtual void read(const char* Key, std::string &data) = 0;
virtual void read(const char* Key, unsigned int &data) = 0;
virtual void read(const char* Key, signed int &data) = 0;
--- 115,119 ----
virtual void readObjectID(QString &data) = 0;
! virtual void read(const char* Key, QString &data) = 0;
virtual void read(const char* Key, unsigned int &data) = 0;
virtual void read(const char* Key, signed int &data) = 0;
***************
*** 124,147 ****
virtual void read(const char* Key, bool &data) = 0;
virtual void read(const char* Key, double &data) = 0;
-
- // I hate to polute it but, as a temp measure:
- virtual void read( const char* Key, QString &data )
- {
- std::string temp;
- read( Key, temp );
- data = temp.c_str();
- }
-
- virtual void write(const char* Key, const QString &data)
- {
- std::string temp;
-
- if( data.isNull() )
- temp = "";
- else
- temp = data.latin1();
-
- write( Key, temp );
- }
protected:
--- 124,127 ----
Index: items.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/items.cpp,v
retrieving revision 1.349
retrieving revision 1.350
diff -C2 -d -r1.349 -r1.350
*** items.cpp 9 Sep 2003 23:09:30 -0000 1.349
--- items.cpp 11 Sep 2003 12:22:24 -0000 1.350
***************
*** 37,41 ****
#include "network/uosocket.h"
#include "network/uotxpackets.h"
- #include "utilsys.h"
#include "iserialization.h"
#include "items.h"
--- 37,40 ----
Index: pfactory.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/pfactory.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** pfactory.cpp 12 Jan 2003 18:11:32 -0000 1.3
--- pfactory.cpp 11 Sep 2003 12:22:24 -0000 1.4
***************
*** 38,48 ****
ISerialization* cPluginFactory::serializationArchiver( const QString& name )
{
! // for now only hardcoded stuff.
! if ( name == "binary")
! return new serBinFile;
! else if ( name == "xml")
! return new serXmlFile;
! else
! return new serBinFile; // return default.
}
--- 38,42 ----
ISerialization* cPluginFactory::serializationArchiver( const QString& name )
{
! return new serXmlFile;
}
Index: serbinfile.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/serbinfile.cpp,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** serbinfile.cpp 7 Sep 2003 19:07:47 -0000 1.26
--- serbinfile.cpp 11 Sep 2003 12:22:24 -0000 1.27
***************
*** 29,261 ****
// Wolfpack Homepage: http://wpdev.sf.net/
//==================================================================================
-
- #include "platform.h"
-
- // Wolfpack Includes
- #include "globals.h"
- #include "srvparams.h"
- #include "serbinfile.h"
-
- // Library Includes
- #include <qfile.h>
- #include <qstring.h>
-
- using namespace std;
-
- const unsigned int backuplevel = 4;
-
- void serBinFile::setVersion(unsigned int __version)
- {
- _version = __version;
- }
-
- unsigned int serBinFile::getVersion()
- {
- return _version;
- }
-
- unsigned int serBinFile::size()
- {
- return _count;
- }
-
- void serBinFile::prepareReading(std::string ident, int bLevel)
- {
- // do not recurse forever
- if ( bLevel >= backuplevel )
- return; // nothing more can be done.
-
- QString fileName( QString( "%1%2" ).arg( SrvParams->getString( "General", "SavePath", "./", true ) ).arg( ident.c_str() ) );
-
- if ( bLevel != 0 )
- fileName += QString("-%1").arg(bLevel);
- fileName.append(".bin");
- if ( !QFile::exists(fileName) )
- {
- prepareReading( ident.c_str(), ++bLevel );
- return;
- }
-
- file.open( fileName.latin1(), ios::in | ios::binary );
-
- if ( !file.is_open() )
- qWarning("Failled to open file %s for reading", fileName.latin1());
-
- file.read((char*)&_version, 4);
- file.read((char*)&_count, 4);
- if ( _count == 0 ) // has not finished writting.
- {
- file.close();
- prepareReading( ident.c_str(), ++bLevel );
- return;
- }
-
- ISerialization::prepareReading(ident);
- }
-
- void serBinFile::prepareWritting(std::string ident)
- {
- QString fileName( QString( "%1%2" ).arg( SrvParams->getString( "General", "SavePath", "./", true ) ).arg( ident.c_str() ) );
-
- // perform backups
- unsigned int i;
- QFile::remove( ident.c_str() + QString("-%1.%2").arg(backuplevel).arg("bin"));
- for ( i = backuplevel - 1; i > 0; --i )
- {
- QString from = ident.c_str() + QString("-%1.%2").arg(i).arg("bin");
- QString to = ident.c_str() + QString("-%1.%2").arg(i + 1).arg("bin");
- rename( from.latin1(), to.latin1() );
- }
- rename ( ident.c_str() + QString(".bin"), ident.c_str() + QString("-1%1").arg(".bin"));
- fileName.append(".bin");
- file.open( fileName.latin1(), ios::out | ios::binary );
- if ( !file.is_open() )
- qWarning("Critical Error: could not open %s for writting", fileName.latin1());
- _count = 0;
- // First line in file is version
- file.write((char*)&_version, 4);
- file.write((char*)&_count, 4);
- ISerialization::prepareWritting(ident);
- }
-
- void serBinFile::close()
- {
- if ( isWritting() )
- {
- file.seekp(4);
- file.write((char*)&_count, 4);
- }
- file.close();
- }
-
- void serBinFile::writeObjectID( const QString& data )
- {
- ISerialization::write("objectID", data);
- if( _objectlevel == 0 )
- ++_count;
- ++_objectlevel;
- }
-
- void serBinFile::write(const char* Key, std::string &data)
- {
- UI32 uiSize = data.size();
- file.write((char*)&uiSize, 4);
- if (uiSize != 0)
- file.write((char*)data.c_str(), uiSize);
- }
-
- void serBinFile::write(const char* Key, unsigned int data)
- {
- file.write((char*)&data, 4);
- }
-
- void serBinFile::write(const char* Key, signed int data)
- {
- file.write((char*)&data, 4);
- }
-
- void serBinFile::write(const char* Key, signed short data)
- {
- file.write((char*)&data, 2);
- }
-
- void serBinFile::write(const char* Key, unsigned short data)
- {
- file.write((char*)&data, 2);
- }
-
- void serBinFile::write(const char* Key, unsigned char data)
- {
- file.write((char*)&data, 1);
- }
-
- void serBinFile::write(const char* Key, signed char data)
- {
- file.write((char*)&data, 1);
- }
-
- void serBinFile::write(const char* Key, bool data)
- {
- file.write((char*)&data, 1);
- }
-
- void serBinFile::write(const char* Key, double data)
- {
- file.write((char*)&data, 8);
- }
-
- void serBinFile::done()
- {
- --_objectlevel;
- }
-
- void serBinFile::readObjectID(QString &data)
- {
- ISerialization::read("objectID", data);
- }
-
- void serBinFile::read(const char* Key, string& data)
- {
- UI32 uiSize = 0;
- file.read((char*)&uiSize, 4);
- if (!file.fail())
- {
- if ( uiSize != 0 )
- {
- char* c_Str = new char[uiSize + 1];
- if( c_Str )
- {
- file.read(c_Str, uiSize);
- c_Str[uiSize] = 0;
- data = c_Str;
- delete [] c_Str;
- }
- else
- {
- qFatal( QString( "Out of memory, couldn't allocate %1 bytes of memory." ).arg( uiSize ) );
- }
- }
- }
- else
- data = "";
- }
-
- void serBinFile::read(const char* Key, unsigned int &data)
- {
- file.read((char*)&data, 4);
- }
-
- void serBinFile::read(const char* Key, signed int &data)
- {
- file.read((char*)&data, 4);
- }
-
- void serBinFile::read(const char* Key, signed short &data)
- {
- file.read((char*)&data, 2);
- }
-
- void serBinFile::read(const char* Key, unsigned short &data)
- {
- file.read((char*)&data, 2);
- }
-
- void serBinFile::read(const char* Key, unsigned char &data)
- {
- file.read((char*)&data, 1);
- }
-
- void serBinFile::read(const char* Key, signed char &data)
- {
- file.read((char*)&data, 1);
- }
-
- void serBinFile::read(const char* Key, bool &data)
- {
- file.read((char*)&data, 1);
- }
-
- void serBinFile::read(const char* Key, double &data)
- {
- file.read((char*)&data, 8);
- }
--- 29,30 ----
Index: serbinfile.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/serbinfile.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** serbinfile.h 12 Jan 2003 18:11:32 -0000 1.14
--- serbinfile.h 11 Sep 2003 12:22:24 -0000 1.15
***************
*** 33,122 ****
#define __SERBINFILE_H__
- #include "iserialization.h"
-
- #include <fstream>
- #include <cstdio>
-
- // Forward declarations
- class QString;
-
- /*!
- CLASS
-
-
- This class provides an implementation for Binary file serialization implementation.
-
-
- USAGE
- <More detailed description of the class and
- a summary of it's (public) operations>.
-
- */
- class serBinFile : public ISerialization
- {
- protected:
- std::fstream file;
- unsigned int _version;
- unsigned int _count;
- unsigned int _objectlevel;
- public:
- serBinFile() : _version(0), _count(0), _objectlevel(0) {}
- virtual ~serBinFile() {}
-
- virtual void prepareReading(std::string ident, int bLevel = 0);
- virtual void prepareWritting(std::string ident);
- virtual void close();
-
- virtual unsigned int getVersion();
- virtual unsigned int size();
- virtual void setVersion(unsigned int);
-
- // Write Methods
- virtual void writeObjectID( const QString &data );
-
- virtual void write(const char* Key, std::string &data);
- virtual void write(const char* Key, unsigned int data);
- virtual void write(const char* Key, signed int data);
- virtual void write(const char* Key, signed short data);
- virtual void write(const char* Key, unsigned short data);
- virtual void write(const char* Key, unsigned char data);
- virtual void write(const char* Key, signed char data);
- virtual void write(const char* Key, bool data);
- virtual void write(const char* Key, double data);
-
- virtual void done();
-
- // Read Methods
- virtual void readObjectID(QString &data);
-
- virtual void read(const char* Key, std::string &data);
- virtual void read(const char* Key, unsigned int &data);
- virtual void read(const char* Key, signed int &data);
- virtual void read(const char* Key, unsigned short &data);
- virtual void read(const char* Key, signed short &data);
- virtual void read(const char* Key, unsigned char &data);
- virtual void read(const char* Key, signed char &data);
- virtual void read(const char* Key, bool &data);
- virtual void read(const char* Key, double &data);
-
- /* virtual void read( const char* Key, QString &data )
- {
- std::string temp;
- read( Key, temp );
- data = temp.c_str();
- }
-
- virtual void write(const char* Key, QString &data)
- {
- std::string temp;
-
- if( data.latin1() == NULL )
- temp = "";
- else
- temp = data.latin1();
-
- write( Key, temp );
- }*/
- };
-
#endif // __SERBINFILE_H__
--- 33,35 ----
Index: serxmlfile.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/serxmlfile.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** serxmlfile.cpp 7 Sep 2003 19:07:47 -0000 1.22
--- serxmlfile.cpp 11 Sep 2003 12:22:24 -0000 1.23
***************
*** 144,148 ****
}
! void serXmlFile::prepareReading(std::string ident, int bLevel)
{
// do not recurse forever
--- 144,148 ----
}
! void serXmlFile::prepareReading( const QString &ident, int bLevel)
{
// do not recurse forever
***************
*** 150,154 ****
return; // nothing more can be done.
! QString fileName( QString( "%1%2" ).arg( SrvParams->getString( "General", "SavePath", "./", true ) ).arg( ident.c_str() ) );
if ( bLevel != 0 )
--- 150,154 ----
return; // nothing more can be done.
! QString fileName( QString( "%1%2" ).arg( SrvParams->getString( "General", "SavePath", "./", true ) ).arg( ident ) );
if ( bLevel != 0 )
***************
*** 157,161 ****
if ( !QFile::exists(fileName) )
{
! prepareReading( ident.c_str(), ++bLevel );
return;
}
--- 157,161 ----
if ( !QFile::exists(fileName) )
{
! prepareReading( ident, ++bLevel );
return;
}
***************
*** 186,190 ****
file->close();
document = NULL;
! prepareReading( ident.c_str(), ++bLevel );
}
node = root;
--- 186,190 ----
file->close();
document = NULL;
! prepareReading( ident, ++bLevel );
}
node = root;
***************
*** 192,209 ****
}
! void serXmlFile::prepareWritting(std::string ident)
{
! QString fileName( QString( "%1%2" ).arg( SrvParams->getString( "General", "SavePath", "./", true ) ).arg( ident.c_str() ) );
// perform backups
unsigned int i;
! QFile::remove( ident.c_str() + QString("-%1.%2").arg(backuplevel).arg("xml"));
for ( i = backuplevel - 1; i > 0; --i )
{
! QString from = ident.c_str() + QString("-%1.%2").arg(i).arg("xml");
! QString to = ident.c_str() + QString("-%1.%2").arg(i + 1).arg("xml");
rename( from.latin1(), to.latin1() );
}
! rename ( ident.c_str() + QString(".bin"), ident.c_str() + QString("-1%1").arg(".xml"));
fileName.append(".xml");
file = new QFile(fileName);
--- 192,209 ----
}
! void serXmlFile::prepareWritting(const QString &ident)
{
! QString fileName( QString( "%1%2" ).arg( SrvParams->getString( "General", "SavePath", "./", true ) ).arg( ident ) );
// perform backups
unsigned int i;
! QFile::remove( ident + QString("-%1.%2").arg(backuplevel).arg("xml"));
for ( i = backuplevel - 1; i > 0; --i )
{
! QString from = ident + QString("-%1.%2").arg(i).arg("xml");
! QString to = ident + QString("-%1.%2").arg(i + 1).arg("xml");
rename( from.latin1(), to.latin1() );
}
! rename ( ident + QString(".bin"), ident + QString("-1%1").arg(".xml"));
fileName.append(".xml");
file = new QFile(fileName);
***************
*** 212,216 ****
_count = 0;
! document = new QDomDocument(ident.c_str());
root = document->createElement(document->doctype().name());
root.setAttribute( "version", _version );
--- 212,216 ----
_count = 0;
! document = new QDomDocument(ident );
root = document->createElement(document->doctype().name());
root.setAttribute( "version", _version );
***************
*** 268,275 ****
}
! void serXmlFile::write(const char* Key, std::string &data)
{
QDomElement newNode = document->createElement(Key);
! newNode.setAttribute( "value", data.c_str() );
node.appendChild( newNode );
}
--- 268,275 ----
}
! void serXmlFile::write(const char* Key, const QString &data)
{
QDomElement newNode = document->createElement(Key);
! newNode.setAttribute( "value", data );
node.appendChild( newNode );
}
***************
*** 372,376 ****
}
! void serXmlFile::read(const char* Key, std::string& data)
{
QDomNodeList nodeList = node.elementsByTagName( Key );
--- 372,376 ----
}
! void serXmlFile::read(const char* Key, QString& data)
{
QDomNodeList nodeList = node.elementsByTagName( Key );
Index: serxmlfile.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/serxmlfile.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** serxmlfile.h 12 Jan 2003 18:11:32 -0000 1.8
--- serxmlfile.h 11 Sep 2003 12:22:24 -0000 1.9
***************
*** 95,100 ****
virtual ~serXmlFile();
! virtual void prepareReading(std::string ident, int bLevel = 0);
! virtual void prepareWritting(std::string ident);
virtual void close();
--- 95,100 ----
virtual ~serXmlFile();
! virtual void prepareReading( const QString &ident, int bLevel = 0);
! virtual void prepareWritting( const QString &ident);
virtual void close();
***************
*** 106,110 ****
virtual void writeObjectID( const QString& data );
! virtual void write(const char* Key, std::string &data);
virtual void write(const char* Key, unsigned int data);
virtual void write(const char* Key, signed int data);
--- 106,110 ----
virtual void writeObjectID( const QString& data );
! virtual void write(const char* Key, const QString &data);
virtual void write(const char* Key, unsigned int data);
virtual void write(const char* Key, signed int data);
***************
*** 121,125 ****
virtual void readObjectID(QString &data);
! virtual void read(const char* Key, std::string &data);
virtual void read(const char* Key, unsigned int &data);
virtual void read(const char* Key, signed int &data);
--- 121,125 ----
virtual void readObjectID(QString &data);
! virtual void read(const char* Key, QString &data);
virtual void read(const char* Key, unsigned int &data);
virtual void read(const char* Key, signed int &data);
Index: spawnregions.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/spawnregions.cpp,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** spawnregions.cpp 8 Sep 2003 10:58:47 -0000 1.48
--- spawnregions.cpp 11 Sep 2003 12:22:24 -0000 1.49
***************
*** 45,49 ****
#include "walking.h"
#include "log.h"
- #include "utilsys.h"
#include "chars.h"
#include "npc.h"
--- 45,48 ----
Index: speech.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/speech.h,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -d -r1.20 -r1.21
*** speech.h 7 Sep 2003 19:07:47 -0000 1.20
--- speech.h 11 Sep 2003 12:22:24 -0000 1.21
***************
*** 42,46 ****
// System includes
#include <vector>
- #include <iostream>
// QT
--- 42,45 ----
***************
*** 49,53 ****
//Wolfpack Includes
#include "speech.h"
- #include "utilsys.h"
#include "typedefs.h"
--- 48,51 ----
Index: territories.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/territories.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -C2 -d -r1.31 -r1.32
*** territories.cpp 8 Sep 2003 10:58:47 -0000 1.31
--- territories.cpp 11 Sep 2003 12:22:24 -0000 1.32
***************
*** 34,38 ****
#include "network/uosocket.h"
#include "defines.h"
- #include "utilsys.h"
#include "srvparams.h"
#include "network.h"
--- 34,37 ----
Index: verinfo.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/verinfo.h,v
retrieving revision 1.27
retrieving revision 1.28
diff -C2 -d -r1.27 -r1.28
*** verinfo.h 20 Jul 2003 00:04:51 -0000 1.27
--- verinfo.h 11 Sep 2003 12:22:24 -0000 1.28
***************
*** 127,138 ****
unsigned int vernumber;
wpversion_32bit verstruct;
! std::string verstring;
! std::string productstring;
! std::string betareleasestring;
QString clientsupportedstring;
! std::string timezonestring;
! std::string compiledbystring;
! std::string codersstring;
! std::string emailstring;
wp_version_info()
--- 127,138 ----
unsigned int vernumber;
wpversion_32bit verstruct;
! QString verstring;
! QString productstring;
! QString betareleasestring;
QString clientsupportedstring;
! QString timezonestring;
! QString compiledbystring;
! QString codersstring;
! QString emailstring;
wp_version_info()
***************
*** 147,160 ****
verstruct.derivate = WOLF;
! vernumber = to_32bitver(verstruct);
! /// code for auto generation of verstring, productstring and betareleasestring coming soon (LB) ...
! verstring = "12.9.3"; // Wolfpack version
productstring = "Wolfpack"; // selfexplainatory, isnt't it :)
betareleasestring = "Beta"; // release status
-
- //////////////////////////////////////////////////
-
- clientsupportedstring = "3.0.8z";
// SUPPORTED_CLIENT is part of the client version control system.
--- 147,155 ----
verstruct.derivate = WOLF;
! vernumber = to_32bitver(verstruct);
! verstring = "12.9.4"; // Wolfpack version
productstring = "Wolfpack"; // selfexplainatory, isnt't it :)
betareleasestring = "Beta"; // release status
// SUPPORTED_CLIENT is part of the client version control system.
Index: wolf.dsp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolf.dsp,v
retrieving revision 1.224
retrieving revision 1.225
diff -C2 -d -r1.224 -r1.225
*** wolf.dsp 9 Sep 2003 23:09:30 -0000 1.224
--- wolf.dsp 11 Sep 2003 12:22:24 -0000 1.225
***************
*** 43,47 ****
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
! # ADD CPP /nologo /MD /GR /GX /O2 /Ob0 /I "lib/Python/PC" /I "sqlite" /I "lib/Python/include" /I "lib\ZThread\include" /I "$(QTDIR)\include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "ZTHREAD_SHARED" /D "QT_DLL" /D "QT_THREAD_SUPPORT" /Fr /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
--- 43,47 ----
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_CONSOLE" /D "_MBCS" /YX /FD /c
! # ADD CPP /nologo /MT /GR /GX /O2 /Ob0 /I "lib/Python/PC" /I "sqlite" /I "lib/Python/include" /I "lib\ZThread\include" /I "$(QTDIR)\include" /D "NDEBUG" /D "WIN32" /D "_CONSOLE" /D "_MBCS" /D "QT_DLL" /D "QT_THREAD_SUPPORT" /Fr /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x409 /d "NDEBUG"
***************
*** 52,57 ****
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-mt312.lib libmysql.lib /nologo /subsystem:windows /map /machine:I386 /nodefaultlib:"libcmt MSVCRTD" /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 /debug
!ELSEIF "$(CFG)" == "wolf - Win32 Debug"
--- 52,57 ----
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 wsock32.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
!ELSEIF "$(CFG)" == "wolf - Win32 Debug"
***************
*** 339,346 ****
# Begin Source File
- SOURCE=.\utilsys.cpp
- # End Source File
- # Begin Source File
-
SOURCE=.\walking.cpp
# End Source File
--- 339,342 ----
***************
*** 992,999 ****
SOURCE=.\uobject.h
# PROP Ignore_Default_Tool 1
- # End Source File
- # Begin Source File
-
- SOURCE=.\utilsys.h
# End Source File
# Begin Source File
--- 988,991 ----
Index: wolfpack.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolfpack.cpp,v
retrieving revision 1.462
retrieving revision 1.463
diff -C2 -d -r1.462 -r1.463
*** wolfpack.cpp 9 Sep 2003 23:09:31 -0000 1.462
--- wolfpack.cpp 11 Sep 2003 12:22:24 -0000 1.463
***************
*** 34,38 ****
#include "speech.h"
#include "territories.h"
!
#include "TmpEff.h"
#include "combat.h"
--- 34,38 ----
#include "speech.h"
#include "territories.h"
! #include "basics.h"
#include "TmpEff.h"
#include "combat.h"
***************
*** 81,85 ****
#include <qmutex.h>
#include <qthread.h>
- #include <fstream>
#include "python/utilities.h"
--- 81,84 ----
***************
*** 320,324 ****
Console::instance()->setAttributes( true, false, true, 60, 140, 70, 12, FONT_NOSERIF );
! Console::instance()->send( QString( "\n%1 %2 %3\n\n" ).arg( wp_version.productstring.c_str() ).arg( wp_version.betareleasestring.c_str() ).arg( wp_version.verstring.c_str() ) );
Console::instance()->send( "Copyright (C) 1997, 98 Marcus Rating (Cironian)\n");
--- 319,323 ----
Console::instance()->setAttributes( true, false, true, 60, 140, 70, 12, FONT_NOSERIF );
! Console::instance()->send( QString( "\n%1 %2 %3\n\n" ).arg( wp_version.productstring.latin1() ).arg( wp_version.betareleasestring.latin1() ).arg( wp_version.verstring.latin1() ) );
Console::instance()->send( "Copyright (C) 1997, 98 Marcus Rating (Cironian)\n");
***************
*** 329,333 ****
Console::instance()->send( "\n" );
! QString consoleTitle = QString( "%1 %2 %3" ).arg( wp_version.productstring.c_str() ).arg( wp_version.betareleasestring.c_str() ).arg( wp_version.verstring.c_str() );
Console::instance()->setConsoleTitle( consoleTitle );
--- 328,332 ----
Console::instance()->send( "\n" );
! QString consoleTitle = QString( "%1 %2 %3" ).arg( wp_version.productstring.latin1() ).arg( wp_version.betareleasestring.latin1() ).arg( wp_version.verstring.latin1() );
Console::instance()->setConsoleTitle( consoleTitle );
***************
*** 528,531 ****
--- 527,531 ----
QWaitCondition niceLevel;
+
// This is our main loop
while( keeprun )
Index: world.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/world.cpp,v
retrieving revision 1.39
retrieving revision 1.40
diff -C2 -d -r1.39 -r1.40
*** world.cpp 9 Sep 2003 23:09:31 -0000 1.39
--- world.cpp 11 Sep 2003 12:22:24 -0000 1.40
***************
*** 39,43 ****
#include "iserialization.h"
#include "persistentbroker.h"
- #include "utilsys.h" // What the heck do we need this file for ?!
#include "accounts.h"
#include "inlines.h"
--- 39,42 ----
***************
*** 46,49 ****
--- 45,49 ----
#include "npc.h"
#include "log.h"
+ #include "basics.h"
#include <sqlite.h>
Index: wpdefmanager.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wpdefmanager.cpp,v
retrieving revision 1.63
retrieving revision 1.64
diff -C2 -d -r1.63 -r1.64
*** wpdefmanager.cpp 9 Sep 2003 23:09:31 -0000 1.63
--- wpdefmanager.cpp 11 Sep 2003 12:22:25 -0000 1.64
***************
*** 30,33 ****
--- 30,42 ----
//==================================================================================
+ // Library Includes
+ #include <qdom.h>
+ #include <qxml.h>
+ #include <qfile.h>
+ #include <qptrstack.h>
+ #include <qregexp.h>
+ #include <qstringlist.h>
+ #include <qvaluevector.h>
+
#include "wpdefmanager.h"
#include "globals.h"
***************
*** 41,52 ****
#include "log.h"
! // Library Includes
! #include <qdom.h>
! #include <qxml.h>
! #include <qfile.h>
! #include <qptrstack.h>
! #include <qregexp.h>
! #include <qstringlist.h>
! #include <qvaluevector.h>
struct stCategory
--- 50,54 ----
#include "log.h"
! #include <stdlib.h>
struct stCategory
***************
*** 414,418 ****
attrCount_ = 0;
! free( attributes );
attributes = 0;
}
--- 416,420 ----
attrCount_ = 0;
! delete [] attributes;
attributes = 0;
}
***************
*** 427,431 ****
childCount_ = 0;
! free( children );
children = 0;
}
--- 429,433 ----
childCount_ = 0;
! delete [] children;
children = 0;
}
***************
*** 457,463 ****
attrCount_ = attributes.count();
! if( attrCount_> 0 )
{
! this->attributes = (stAttribute**)malloc( sizeof( stAttribute* ) * attrCount_ );
for( unsigned int i = 0; i < attrCount_; ++i )
--- 459,465 ----
attrCount_ = attributes.count();
! if( attrCount_ > 0 )
{
! this->attributes = new stAttribute*[ attrCount_ ];
for( unsigned int i = 0; i < attrCount_; ++i )
***************
*** 475,485 ****
{
childCount_ = 1;
! children = (cElement**)malloc( sizeof( cElement* ) );
children[0] = element;
}
else
{
! children = (cElement**)realloc( children, sizeof( cElement* ) * ( childCount_ + 1 ) );
! children[childCount_++] = element;
}
}
--- 477,493 ----
{
childCount_ = 1;
! children = new cElement*[ 1 ];
children[0] = element;
}
else
{
! cElement **newChildren = new cElement* [ childCount_ + 1 ];
!
! // Copy over the old list
! memcpy( newChildren, children, childCount_ * sizeof( cElement* ) );
! newChildren[ childCount_++ ] = element;
!
! delete [] children;
! children = newChildren;
}
}
***************
*** 494,498 ****
unsigned int offset = 0;
! cElement **newChildren = (cElement**)malloc( ( childCount_ - 1 ) * sizeof( cElement* ) );
for( unsigned int j = 0; j < childCount_; ++j )
--- 502,506 ----
unsigned int offset = 0;
! cElement **newChildren = new cElement* [ childCount_ - 1 ];
for( unsigned int j = 0; j < childCount_; ++j )
***************
*** 501,505 ****
childCount_--;
! free( children );
children = newChildren;
return;
--- 509,513 ----
childCount_--;
! delete [] children;
children = newChildren;
return;
--- stream.h DELETED ---
--- utilsys.cpp DELETED ---
--- utilsys.h DELETED ---
--- wpconsole.cpp DELETED ---
--- wpconsole.h DELETED ---
|