Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12189
Modified Files:
ChangeLog player.cpp player.h pythonscript.cpp pythonscript.h
timing.cpp
Log Message:
- Changed the semantics of onLogin/onLogout.
- Added onConnect/onDisconnect (exported to python).
- It's no longer possible to login with a char if another char in the same account is still online.
- Fixed a bug that would cause onLogout not to be called.
Index: player.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/player.h,v
retrieving revision 1.62
retrieving revision 1.63
diff -C2 -d -r1.62 -r1.63
*** player.h 3 Nov 2004 02:09:26 -0000 1.62
--- player.h 5 Nov 2004 07:26:52 -0000 1.63
***************
*** 130,135 ****
// Wrapper events
virtual bool onLogin(); // The character enters the world
! virtual bool onDisconnect(); // The socket has disconnected
! virtual bool onLogout(); // The character exits the world
virtual bool onHelp(); // The character wants help
virtual bool onChat(); // The character wants to chat
--- 130,136 ----
// Wrapper events
virtual bool onLogin(); // The character enters the world
! virtual bool onConnect( bool reconnecting ); // A socket attaches to a character
! virtual bool onDisconnect(); // A socket detaches from a character
! virtual bool onLogout(); // The character leaves the world
virtual bool onHelp(); // The character wants help
virtual bool onChat(); // The character wants to chat
Index: ChangeLog
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ChangeLog,v
retrieving revision 1.136
retrieving revision 1.137
diff -C2 -d -r1.136 -r1.137
*** ChangeLog 5 Nov 2004 00:57:07 -0000 1.136
--- ChangeLog 5 Nov 2004 07:26:52 -0000 1.137
***************
*** 25,29 ****
- The deprecated RegionIterators have been removed.
- The SectorIterators have also been replaced with a much faster iterator.
! - The new iterators don't allocate/copy memory anymore.
- The "range" lookup now looks for items within a real circle.
- Multis now have their own structure, and are now separate from items.
--- 25,29 ----
- The deprecated RegionIterators have been removed.
- The SectorIterators have also been replaced with a much faster iterator.
! - The new iterators don't allocate/copy memory anymore.
- The "range" lookup now looks for items within a real circle.
- Multis now have their own structure, and are now separate from items.
***************
*** 39,42 ****
--- 39,46 ----
- Fixed handling of a fixed z value for spawnregions.
- Fixed an exploit (dropping without dragging first)
+ - Changed the semantics of onLogin/onLogout (character entering/leaving the world).
+ - Added onConnect/onDisconnect (socket attaching/detaching to/from a player).
+ - It's no longer possible to login with a char if another char in the same account is still online.
+ - Fixed a bug that would cause onLogout not to be called.
Wolfpack 12.9.12 Beta (18. October 2004)
Index: player.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/player.cpp,v
retrieving revision 1.143
retrieving revision 1.144
diff -C2 -d -r1.143 -r1.144
*** player.cpp 4 Nov 2004 23:12:45 -0000 1.143
--- player.cpp 5 Nov 2004 07:26:52 -0000 1.144
***************
*** 934,942 ****
bool cPlayer::onLogin()
{
MapObjects::instance()->updateOnlineStatus( this, true );
// trigger the script event
bool result = false;
! if ( canHandleEvent( EVENT_LOGIN ) )
{
PyObject* args = Py_BuildValue( "(O&)", PyGetCharObject, this );
--- 934,943 ----
bool cPlayer::onLogin()
{
+ // move the char from the offline to the online chars structure
MapObjects::instance()->updateOnlineStatus( this, true );
// trigger the script event
bool result = false;
! if( canHandleEvent( EVENT_LOGIN ) )
{
PyObject* args = Py_BuildValue( "(O&)", PyGetCharObject, this );
***************
*** 947,963 ****
}
bool cPlayer::onDisconnect()
{
! // TODO: trigger a script event here
! return true;
}
bool cPlayer::onLogout()
{
MapObjects::instance()->updateOnlineStatus( this, false );
// trigger the script event
bool result = false;
! if ( canHandleEvent( EVENT_LOGOUT ) )
{
PyObject* args = Py_BuildValue( "(O&)", PyGetCharObject, this );
--- 948,983 ----
}
+ bool cPlayer::onConnect( bool reconnecting )
+ {
+ bool result = false;
+ if( canHandleEvent( EVENT_CONNECT ) )
+ {
+ PyObject* args = Py_BuildValue( "(O&i)", PyGetCharObject, this, reconnecting );
+ result = callEventHandler( EVENT_CONNECT, args );
+ Py_DECREF( args );
+ }
+ return result;
+ }
+
bool cPlayer::onDisconnect()
{
! bool result = false;
! if( canHandleEvent( EVENT_DISCONNECT ) )
! {
! PyObject* args = Py_BuildValue( "(O&)", PyGetCharObject, this );
! result = callEventHandler( EVENT_DISCONNECT, args );
! Py_DECREF( args );
! }
! return result;
}
bool cPlayer::onLogout()
{
+ // move the char from the online to the offline chars structure
MapObjects::instance()->updateOnlineStatus( this, false );
// trigger the script event
bool result = false;
! if( canHandleEvent( EVENT_LOGOUT ) )
{
PyObject* args = Py_BuildValue( "(O&)", PyGetCharObject, this );
Index: pythonscript.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/pythonscript.h,v
retrieving revision 1.47
retrieving revision 1.48
diff -C2 -d -r1.47 -r1.48
*** pythonscript.h 3 Nov 2004 02:09:26 -0000 1.47
--- pythonscript.h 5 Nov 2004 07:26:52 -0000 1.48
***************
*** 94,97 ****
--- 94,99 ----
EVENT_SNOOPING,
EVENT_REMOTEUSE,
+ EVENT_CONNECT,
+ EVENT_DISCONNECT,
EVENT_COUNT,
};
Index: timing.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/timing.cpp,v
retrieving revision 1.22
retrieving revision 1.23
diff -C2 -d -r1.22 -r1.23
*** timing.cpp 3 Nov 2004 02:09:28 -0000 1.22
--- timing.cpp 5 Nov 2004 07:26:52 -0000 1.23
***************
*** 278,285 ****
P_PLAYER player = dynamic_cast<P_PLAYER>( character );
! if( player && !player->socket() && player->logoutTime() && player->logoutTime() <= time )
{
- player->removeFromView( false );
player->onLogout();
player->setLogoutTime( 0 );
player->resend( false );
--- 278,286 ----
P_PLAYER player = dynamic_cast<P_PLAYER>( character );
! if( player && player->logoutTime() && player->logoutTime() <= time )
{
player->onLogout();
+ player->removeFromView( false );
+ player->setSocket( 0 );
player->setLogoutTime( 0 );
player->resend( false );
Index: pythonscript.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/pythonscript.cpp,v
retrieving revision 1.60
retrieving revision 1.61
diff -C2 -d -r1.60 -r1.61
*** pythonscript.cpp 3 Nov 2004 13:51:08 -0000 1.60
--- pythonscript.cpp 5 Nov 2004 07:26:52 -0000 1.61
***************
*** 134,139 ****
/*
\event onLogin
! \param player The player who logged in.
\condition Triggered when a player enters the world.
*/
"onLogin",
--- 134,141 ----
/*
\event onLogin
! \param player The player that is entering the world.
\condition Triggered when a player enters the world.
+ \notes onLogin isn't called if the character was lingering (as the character didn't
+ really leave the world). See onConnect.
*/
"onLogin",
***************
*** 141,146 ****
/*
\event onLogout
! \param player The player who disconnected.
\condition Triggered when a player leaves the world.
*/
"onLogout",
--- 143,149 ----
/*
\event onLogout
! \param player The player that is leaving the world.
\condition Triggered when a player leaves the world.
+ \notes onLogout takes the char timeout into consideration. See onDisconnect.
*/
"onLogout",
***************
*** 601,604 ****
--- 604,624 ----
"onRemoteUse",
+ /*
+ \event onConnect
+ \param player The player that connected.
+ \param reconnecting True if the player is reconnecting to an online character.
+ \condition Triggered when a player logs in with a character (even if the character was still online).
+ \notes If the character wasn't online, onLogin is called before onConnect.
+ */
+ "onConnect",
+
+ /*
+ \event onDisconnect
+ \param player The player that disconnected.
+ \condition Triggered when a player disconnects.
+ \notes If the character was in a safe-logout zone, onLogout is called immediately after onDisconnect.
+ */
+ "onDisconnect",
+
0
};
|