Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26443
Modified Files:
ChangeLog walking.cpp
Log Message:
Movement fix.
Index: walking.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/walking.cpp,v
retrieving revision 1.160
retrieving revision 1.161
diff -C2 -d -r1.160 -r1.161
*** walking.cpp 3 Nov 2004 04:47:01 -0000 1.160
--- walking.cpp 3 Nov 2004 17:23:10 -0000 1.161
***************
*** 630,634 ****
pChar->setDirection( dir );
! MapCharsIterator ri = MapObjects::instance()->listCharsInCircle( pChar->pos(), VISRANGE );
for( P_CHAR observer = ri.first(); observer; observer = ri.next() )
{
--- 630,637 ----
pChar->setDirection( dir );
! Coord upperLeft = pChar->pos() + Coord(- (VISRANGE + 1), - (VISRANGE + 1));
! Coord lowerRight = pChar->pos() + Coord(VISRANGE + 1, VISRANGE + 1);
!
! MapCharsIterator ri = MapObjects::instance()->listCharsInRect(upperLeft, lowerRight);
for( P_CHAR observer = ri.first(); observer; observer = ri.next() )
{
***************
*** 636,666 ****
continue;
! unsigned int oldDistance = observer->pos().distance( oldpos );
// If we are a player, send us new characters
! if( player && player->socket() )
! {
! // was that observer previously out of range?
! if( oldDistance >= player->visualRange() )
! {
! player->socket()->sendChar( observer );
}
}
// Send our movement to the observer
! P_PLAYER otherplayer = dynamic_cast<P_PLAYER>( observer );
! if( otherplayer && otherplayer->socket() )
! {
! if( oldDistance > otherplayer->visualRange() )
! {
! // previously we were out of range
! otherplayer->socket()->sendChar( pChar );
! }
! else
! {
! // previously we were already known
! otherplayer->socket()->updateChar( pChar );
}
}
}
--- 639,670 ----
continue;
! bool wasVisible = observer->pos().distance(oldpos) <= VISRANGE; // We were previously in range
! bool isVisible = player->dist(observer) <= VISRANGE; // We are now in range
// If we are a player, send us new characters
! if( player && player->socket() ) {
! // Send the observer to us if he was previously not visible and came into range recently
! if( !wasVisible && isVisible ) {
! player->socket()->sendChar(observer);
}
}
// Send our movement to the observer
! P_PLAYER otherplayer = dynamic_cast<P_PLAYER>(observer);
! if (!otherplayer || !otherplayer->socket()) {
! continue; // Skip this character, it's a player.
! // TODO: OnSeePlayer, OnLoosePlayer
! }
!
! if (wasVisible) {
! if (isVisible) {
! otherplayer->socket()->updateChar(pChar); // We walked inside the visible range
! } else {
! otherplayer->socket()->removeObject(pChar); // We walked out of visible range
}
+
+ } else if (isVisible) {
+ otherplayer->socket()->sendChar(pChar); // We walked into visible range
}
}
Index: ChangeLog
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ChangeLog,v
retrieving revision 1.131
retrieving revision 1.132
diff -C2 -d -r1.131 -r1.132
*** ChangeLog 3 Nov 2004 13:51:08 -0000 1.131
--- ChangeLog 3 Nov 2004 17:23:10 -0000 1.132
***************
*** 34,37 ****
--- 34,38 ----
- Fixed adding items to the MapObjects.
- Fixed a bug in the new ContainerCopyIterator.
+ - Fixed movement not correctly being sent to other characters.
Wolfpack 12.9.12 Beta (18. October 2004)
|