Update of /cvsroot/wpdev/wolfpack/network
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29663/network
Modified Files:
encryption.h network.h uosocket.cpp uotxpackets.cpp
uotxpackets.h
Log Message:
New sectors code and more. A changelog will be sent to the mailing list.
Index: network.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/network/network.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** network.h 25 Sep 2004 22:57:09 -0000 1.5
--- network.h 3 Nov 2004 02:09:31 -0000 1.6
***************
*** 75,79 ****
};
! typedef SingletonHolder<cNetwork> Network;
#endif
--- 75,79 ----
};
! typedef Singleton<cNetwork> Network;
#endif
Index: uosocket.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/network/uosocket.cpp,v
retrieving revision 1.437
retrieving revision 1.438
diff -C2 -d -r1.437 -r1.438
*** uosocket.cpp 2 Nov 2004 20:45:46 -0000 1.437
--- uosocket.cpp 3 Nov 2004 02:09:31 -0000 1.438
***************
*** 41,45 ****
#include "../territories.h"
#include "../inlines.h"
! #include "../sectors.h"
#include "../multi.h"
#include "../muls/maps.h"
--- 41,45 ----
#include "../territories.h"
#include "../inlines.h"
! #include "../mapobjects.h"
#include "../multi.h"
#include "../muls/maps.h"
***************
*** 479,483 ****
if ( _player )
{
! _player->onLogout();
_player->setSocket( NULL );
--- 479,483 ----
if ( _player )
{
! _player->onDisconnect();
_player->setSocket( NULL );
***************
*** 499,510 ****
{
_player->removeFromView( true );
! if ( !_player->isGMorCounselor() && ( !_player->region() || !_player->region()->isGuarded() ) )
{
! _player->setLogoutTime( Server::instance()->time() + Config::instance()->quittime() * 1000 );
}
else
{
! //SectorMaps::instance()->remove( _player );
}
_player->resend( false );
}
--- 499,514 ----
{
_player->removeFromView( true );
!
! // is the player allowed to logout instantly?
! if( _player->isGMorCounselor() || ( _player->region() && _player->region()->isGuarded() ) )
{
! _player->onLogout();
}
else
{
! // let the player linger...
! _player->setLogoutTime( Server::instance()->time() + Config::instance()->quittime() * 1000 );
}
+
_player->resend( false );
}
***************
*** 561,565 ****
// Send the server/account features here as well
// AoS needs it most likely for account creation
! const uint maxChars = QMIN( 6, Config::instance()->maxCharsPerAccount() );
cUOTxClientFeatures clientFeatures;
clientFeatures.setLbr( true );
--- 565,569 ----
// Send the server/account features here as well
// AoS needs it most likely for account creation
! const uint maxChars = wpMin<uint>( 6, Config::instance()->maxCharsPerAccount() );
cUOTxClientFeatures clientFeatures;
clientFeatures.setLbr( true );
***************
*** 675,679 ****
if (!Maps::instance()->hasMap(pChar->pos().map)) {
! Coord_cl pos;
pos.x = 0;
pos.y = 0;
--- 679,683 ----
if (!Maps::instance()->hasMap(pChar->pos().map)) {
! Coord pos;
pos.x = 0;
pos.y = 0;
***************
*** 881,885 ****
// If we have more than 6 characters
! const uint maxChars = QMIN( 6, Config::instance()->maxCharsPerAccount() );
if ( characters.size() >= maxChars )
{
--- 885,889 ----
// If we have more than 6 characters
! const uint maxChars = wpMin<uint>( 6, Config::instance()->maxCharsPerAccount() );
if ( characters.size() >= maxChars )
{
***************
*** 1640,1644 ****
void cUOSocket::sendChar( P_CHAR pChar )
{
! if ( pChar == _player )
{
updatePlayer();
--- 1644,1648 ----
void cUOSocket::sendChar( P_CHAR pChar )
{
! if( pChar == _player )
{
updatePlayer();
***************
*** 1646,1650 ****
}
! if ( canSee( pChar ) )
{
// Then completely resend it
--- 1650,1654 ----
}
! if( canSee( pChar ) )
{
// Then completely resend it
***************
*** 1657,1663 ****
// Send item tooltips
cBaseChar::ItemContainer content = pChar->content();
! for ( cBaseChar::ItemContainer::const_iterator it = content.begin(); it != content.end(); ++it )
{
! it.data()->sendTooltip( this );
}
}
--- 1661,1671 ----
// Send item tooltips
cBaseChar::ItemContainer content = pChar->content();
! for( cBaseChar::ItemContainer::const_iterator it = content.begin(); it != content.end(); ++it )
{
! P_ITEM item = it.data();
! if( item->layer() <= 0x19 )
! {
! item->sendTooltip( this );
! }
}
}
***************
*** 1689,1693 ****
_player->setLogoutTime( 0 );
_player->resend( false );
! //SectorMaps::instance()->remove( _player );
}
--- 1697,1701 ----
_player->setLogoutTime( 0 );
_player->resend( false );
! //MapObjects::instance()->remove( _player );
}
***************
*** 1695,1699 ****
_player->setSocket( this );
_player->resend( false );
! SectorMaps::instance()->add( _player );
}
--- 1703,1707 ----
_player->setSocket( this );
_player->resend( false );
! MapObjects::instance()->add( _player );
}
***************
*** 2240,2287 ****
return;
! cItemSectorIterator* itemIter = SectorMaps::instance()->findItems( _player->pos(), BUILDRANGE );
! for ( cItem*item = itemIter->first(); item; item = itemIter->next() )
{
if ( clean )
- {
removeObject( item );
! }
item->update( this );
}
! RegionIterator4Chars chIterator( _player->pos(), _player->visualRange(), true );
! for ( chIterator.Begin(); !chIterator.atEnd(); chIterator++ )
{
! P_CHAR pChar = chIterator.GetData();
! if ( pChar == _player )
! continue;
! if ( clean )
! {
! removeObject( pChar );
! }
! // Hidden
! if ( _player->canSee( pChar ) )
! {
! cUOTxDrawChar drawChar;
! drawChar.fromChar( pChar );
! drawChar.setHighlight( pChar->notoriety( _player ) );
! send( &drawChar );
! pChar->sendTooltip( this );
! // Send the equipment Tooltips
! cBaseChar::ItemContainer content = pChar->content();
! cBaseChar::ItemContainer::const_iterator it;
! for ( it = content.begin(); it != content.end(); it++ )
! {
! P_ITEM pItem = it.data();
! if ( pItem->layer() <= 0x19 )
! {
! pItem->sendTooltip( this );
! }
! }
! }
}
}
--- 2248,2282 ----
return;
! // resend items
! MapItemsIterator itemIt = MapObjects::instance()->listItemsInCircle( _player->pos(), _player->visualRange() );
! for( P_ITEM item = itemIt.first(); item; item = itemIt.next() )
{
if ( clean )
removeObject( item );
!
item->update( this );
}
! // resend multis
! MapMultisIterator multiIt = MapObjects::instance()->listMultisInCircle( _player->pos(), BUILDRANGE );
! for( P_MULTI multi = multiIt.first(); multi; multi = multiIt.next() )
{
! if( clean )
! removeObject( multi );
! multi->update( this );
! }
! // send online characters
! MapCharsIterator charIt = MapObjects::instance()->listCharsInCircle( _player->pos(), _player->visualRange() );
! for( P_CHAR character = charIt.first(); character; character = charIt.next() )
! {
! if( character == _player )
! continue;
! if( clean )
! removeObject( character );
! sendChar( character );
}
}
***************
*** 3010,3023 ****
if ( _player )
{
cUOTxLightLevel pLight;
- unsigned char level;
cTerritory* region = Territories::instance()->region( _player->pos() );
if ( region && region->isCave() )
{
! level = QMAX( 0, ( int ) Config::instance()->dungeonLightLevel() - _player->fixedLightLevel() );
}
else
{
! level = QMAX( 0, ( int ) Config::instance()->worldCurrentLevel() - _player->fixedLightLevel() );
}
pLight.setLevel( level );
--- 3005,3018 ----
if ( _player )
{
+ UI08 level;
cUOTxLightLevel pLight;
cTerritory* region = Territories::instance()->region( _player->pos() );
if ( region && region->isCave() )
{
! level = wpMax<UI08>( 0, Config::instance()->dungeonLightLevel() - static_cast<int>( _player->fixedLightLevel() ) );
}
else
{
! level = wpMax<UI08>( 0, Config::instance()->worldCurrentLevel() - static_cast<int>( _player->fixedLightLevel() ) );
}
pLight.setLevel( level );
***************
*** 3088,3092 ****
cUOTxQuestArrow qArrow;
qArrow.setActive( show ? 1 : 0 );
! qArrow.setPos( Coord_cl( x, y, 0, 0 ) );
send( &qArrow );
}
--- 3083,3087 ----
cUOTxQuestArrow qArrow;
qArrow.setActive( show ? 1 : 0 );
! qArrow.setPos( Coord( x, y, 0, 0 ) );
send( &qArrow );
}
Index: uotxpackets.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/network/uotxpackets.h,v
retrieving revision 1.116
retrieving revision 1.117
diff -C2 -d -r1.116 -r1.117
*** uotxpackets.h 18 Oct 2004 12:09:53 -0000 1.116
--- uotxpackets.h 3 Nov 2004 02:09:31 -0000 1.117
***************
*** 33,38 ****
#include "qstring.h"
#include "qstringlist.h"
- #include "../typedefs.h"
#include "../coord.h"
#include "../objectdef.h"
--- 33,39 ----
#include "qstring.h"
#include "qstringlist.h"
#include "../coord.h"
+ #include "../inlines.h"
+ #include "../typedefs.h"
#include "../objectdef.h"
***************
*** 40,44 ****
#include "uopacket.h"
! class Coord_cl;
// 0x82: DenyLogin
--- 41,45 ----
#include "uopacket.h"
! class Coord;
// 0x82: DenyLogin
***************
*** 977,985 ****
void setLanguage( const QString& data )
{
! this->setAsciiString( 14, data.left( 3 ).latin1(), QMIN( data.length() + 1, 4 ) );
}
void setName( const QString& data )
{
! this->setAsciiString( 18, data.left( 29 ).latin1(), QMIN( data.length() + 1, 30 ) );
}
void setText( const QString& data );
--- 978,986 ----
void setLanguage( const QString& data )
{
! this->setAsciiString( 14, data.left( 3 ).latin1(), wpMin<uint>( data.length() + 1, 4 ) );
}
void setName( const QString& data )
{
! this->setAsciiString( 18, data.left( 29 ).latin1(), wpMin<uint>( data.length() + 1, 30 ) );
}
void setText( const QString& data );
***************
*** 1025,1029 ****
void setName( const QString& name )
{
! setAsciiString( 7, name.left( 29 ).latin1(), QMIN( name.length() + 1, 30 ) );
}
void setHp( unsigned short data )
--- 1026,1030 ----
void setName( const QString& name )
{
! setAsciiString( 7, name.left( 29 ).latin1(), wpMin<uint>( name.length() + 1, 30 ) );
}
void setHp( unsigned short data )
***************
*** 1176,1180 ****
( *this )[1] = data;
}
! void setCoord( const Coord_cl& coord );
void setDirection( unsigned char data )
{
--- 1177,1181 ----
( *this )[1] = data;
}
! void setCoord( const Coord& coord );
void setDirection( unsigned char data )
{
***************
*** 1251,1255 ****
void setName( const QString& name )
{
! this->setAsciiString( 5, name.left( 59 ).latin1(), QMIN( strlen( name.left( 59 ).latin1() ) + 1, 60 ) );
}
void setFlag( unsigned char flag )
--- 1252,1256 ----
void setName( const QString& name )
{
! this->setAsciiString( 5, name.left( 59 ).latin1(), wpMin<uint>( name.length() + 1, 60 ) );
}
void setFlag( unsigned char flag )
***************
*** 1310,1314 ****
setShort( 9, data );
}
! void setCoord( const Coord_cl& coord );
void setDirection( unsigned char data )
{
--- 1311,1315 ----
setShort( 9, data );
}
! void setCoord( const Coord& coord );
void setDirection( unsigned char data )
{
***************
*** 1389,1393 ****
setShort( 4, data );
}
! void setCoord( const Coord_cl& coord );
};
--- 1390,1394 ----
setShort( 4, data );
}
! void setCoord( const Coord& coord );
};
***************
*** 1604,1608 ****
( *this )[1] = status;
}
! void setPos( const Coord_cl& pos )
{
setShort( 2, pos.x );
--- 1605,1609 ----
( *this )[1] = status;
}
! void setPos( const Coord& pos )
{
setShort( 2, pos.x );
***************
*** 1732,1736 ****
setShort( 10, data );
}
! void setSource( const Coord_cl& pos )
{
setShort( 12, pos.x );
--- 1733,1737 ----
setShort( 10, data );
}
! void setSource( const Coord& pos )
{
setShort( 12, pos.x );
***************
*** 1738,1742 ****
( *this )[16] = pos.z;
}
! void setTarget( const Coord_cl& pos )
{
setShort( 17, pos.x );
--- 1739,1743 ----
( *this )[16] = pos.z;
}
! void setTarget( const Coord& pos )
{
setShort( 17, pos.x );
***************
*** 1986,1990 ****
void setName( const QString& data )
{
! this->setAsciiString( 19, data.left( 29 ).latin1(), QMIN( data.length() + 1, 30 ) );
}
void setParams( const QString& affix, const QString& params )
--- 1987,1991 ----
void setName( const QString& data )
{
! this->setAsciiString( 19, data.left( 29 ).latin1(), wpMin<uint>( data.length() + 1, 30 ) );
}
void setParams( const QString& affix, const QString& params )
***************
*** 2030,2034 ****
setShort( 10, data );
}
! void setSourcePos( const Coord_cl& pos )
{
setShort( 12, pos.x );
--- 2031,2035 ----
setShort( 10, data );
}
! void setSourcePos( const Coord& pos )
{
setShort( 12, pos.x );
***************
*** 2037,2041 ****
}
! void setTargetPos( const Coord_cl& pos )
{
setShort( 17, pos.x );
--- 2038,2042 ----
}
! void setTargetPos( const Coord& pos )
{
setShort( 17, pos.x );
***************
*** 2098,2102 ****
setShort( 10, data );
}
! void setSourcePos( const Coord_cl& pos )
{
setShort( 12, pos.x );
--- 2099,2103 ----
setShort( 10, data );
}
! void setSourcePos( const Coord& pos )
{
setShort( 12, pos.x );
***************
*** 2105,2109 ****
}
! void setTargetPos( const Coord_cl& pos )
{
setShort( 17, pos.x );
--- 2106,2110 ----
}
! void setTargetPos( const Coord& pos )
{
setShort( 17, pos.x );
***************
*** 2391,2395 ****
}
void addTile( unsigned short id, short x, short y, short z );
! void addTile( unsigned short id, const Coord_cl& coords )
{
addTile( id, coords.x, coords.y, coords.z );
--- 2392,2396 ----
}
void addTile( unsigned short id, short x, short y, short z );
! void addTile( unsigned short id, const Coord& coords )
{
addTile( id, coords.x, coords.y, coords.z );
Index: uotxpackets.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/network/uotxpackets.cpp,v
retrieving revision 1.104
retrieving revision 1.105
diff -C2 -d -r1.104 -r1.105
*** uotxpackets.cpp 26 Oct 2004 18:37:36 -0000 1.104
--- uotxpackets.cpp 3 Nov 2004 02:09:31 -0000 1.105
***************
*** 237,241 ****
}
! void cUOTxDenyMove::setCoord( const Coord_cl& coord )
{
setShort( 2, coord.x );
--- 237,241 ----
}
! void cUOTxDenyMove::setCoord( const Coord& coord )
{
setShort( 2, coord.x );
***************
*** 550,554 ****
}
! position = ( position * 5 ) + QMIN( 4, pChar->fame() / 2500 );
if ( pChar->objectType() != enNPC && position < titles.size() )
--- 550,554 ----
}
! position = ( position * 5 ) + wpMin<unsigned int>( 4, pChar->fame() / 2500 );
if ( pChar->objectType() != enNPC && position < titles.size() )
***************
*** 702,706 ****
}
! void cUOTxSendItem::setCoord( const Coord_cl& coord )
{
setShort( 11, coord.x | 0x8000 );
--- 702,706 ----
}
! void cUOTxSendItem::setCoord( const Coord& coord )
{
setShort( 11, coord.x | 0x8000 );
***************
*** 709,713 ****
}
! void cUOTxSoundEffect::setCoord( const Coord_cl& coord )
{
setShort( 6, coord.x );
--- 709,713 ----
}
! void cUOTxSoundEffect::setCoord( const Coord& coord )
{
setShort( 6, coord.x );
Index: encryption.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/network/encryption.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** encryption.h 24 Aug 2004 00:23:22 -0000 1.5
--- encryption.h 3 Nov 2004 02:09:31 -0000 1.6
***************
*** 62,66 ****
};
! typedef SingletonHolder<cKeyManager> KeyManager;
// General Client Encryption Class
--- 62,66 ----
};
! typedef Singleton<cKeyManager> KeyManager;
// General Client Encryption Class
|