Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv20927
Modified Files:
mapobjects.h walking.cpp walking.h
Log Message:
Added player vs character collisions on Felucca (I will make that optional on a per-facet basis).
Hopefully fixed an incompatibility with GCC as well.
Index: mapobjects.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/mapobjects.h,v
retrieving revision 1.11
retrieving revision 1.12
diff -C2 -d -r1.11 -r1.12
*** mapobjects.h 3 Nov 2004 02:09:29 -0000 1.11
--- mapobjects.h 3 Nov 2004 04:47:00 -0000 1.12
***************
*** 228,232 ****
private:
! friend class MapObjectsIterator;
static cUObject * firstIteration( void *state );
--- 228,235 ----
private:
! friend class MapObjectsIterator<cUObject>;
! friend class MapObjectsIterator<cItem>;
! friend class MapObjectsIterator<cMulti>;
! friend class MapObjectsIterator<cBaseChar>;
static cUObject * firstIteration( void *state );
Index: walking.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/walking.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** walking.h 3 Nov 2004 02:09:29 -0000 1.30
--- walking.h 3 Nov 2004 04:47:01 -0000 1.31
***************
*** 63,67 ****
private:
bool consumeStamina( P_PLAYER pChar, bool running );
- bool checkObstacles( P_CHAR pChar, const Coord& newPos, bool running );
bool verifySequence( cUOSocket* socket, Q_UINT8 sequence ) throw();
void checkStealth( P_CHAR );
--- 63,66 ----
Index: walking.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/walking.cpp,v
retrieving revision 1.159
retrieving revision 1.160
diff -C2 -d -r1.159 -r1.160
*** walking.cpp 3 Nov 2004 02:09:29 -0000 1.159
--- walking.cpp 3 Nov 2004 04:47:01 -0000 1.160
***************
*** 554,557 ****
--- 554,603 ----
}
+ // Check if we're going to collide with characters
+ if( player )
+ {
+ // Player vs characters
+ if( player->socket() && player->pos().map == 0 && !player->account()->isStaff() )
+ {
+ // Currently hard-limiting collisions to Felucca; this should be a server option!
+ MapCharsIterator charCollisions = MapObjects::instance()->listCharsAtCoord( newCoord );
+ for( P_CHAR them = charCollisions.first(); them; them = charCollisions.next() )
+ {
+ if( them == player )
+ continue;
+
+ P_PLAYER otherplayer = dynamic_cast<P_PLAYER>( them );
+ if( otherplayer && otherplayer->account()->isStaff() )
+ continue; // no collisions against the staff
+
+ if( wpAbs<SI08>( newCoord.z - them->pos().z ) < P_M_MAX_Z_CLIMB )
+ {
+ // to push another char we must have maximum stamina
+ if( player->stamina() >= player->maxStamina() )
+ {
+ player->socket()->clilocMessage( them->isHidden() ? 1019043 : 1019042 );
+ player->setStamina( player->stamina() - 10 );
+ break;
+ }
+ else
+ {
+ player->socket()->denyMove( sequence );
+ return false;
+ }
+ }
+ }
+ }
+ }
+ else
+ {
+ // NPC vs characters
+ P_NPC npc = dynamic_cast<P_NPC>( pChar );
+ if( npc && CheckForCharacterAtXYZ( pChar, newCoord ) )
+ {
+ npc->clearPath();
+ return false;
+ }
+ }
+
// Check if the char can move to those new coordinates
// It is going to automatically calculate the new coords (!)
***************
*** 568,581 ****
}
- // Check if we're going to collide with characters
- if ( !player && CheckForCharacterAtXYZ( pChar, newCoord ) )
- {
- P_NPC npc = dynamic_cast<P_NPC>( pChar );
- if ( npc ) {
- npc->clearPath();
- }
- return false;
- }
-
// We moved so let's update our location
pChar->moveTo( newCoord );
--- 614,617 ----
***************
*** 600,611 ****
continue;
! unsigned int distance = observer->pos().distance( oldpos );
// If we are a player, send us new characters
if( player && player->socket() )
{
! if ( distance >= player->visualRange() )
{
- // an observer was previously out of range.
player->socket()->sendChar( observer );
}
--- 636,647 ----
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 );
}
***************
*** 617,632 ****
if( otherplayer && otherplayer->socket() )
{
! if( distance > otherplayer->visualRange() )
{
! otherplayer->socket()->sendChar( pChar ); // Previously we were out of range
}
else
{
! otherplayer->socket()->updateChar( pChar ); // Previously we were already known
!
! // If we are now out of range, remove from view (just to be sure)
! if (pChar->dist( otherplayer ) > otherplayer->visualRange()) {
! otherplayer->socket()->removeObject(pChar);
! }
}
}
--- 653,665 ----
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 );
}
}
***************
*** 652,656 ****
{
// x=x,y=y, and distance btw z's <= MAX STEP
! if( abs( pChar->pos().z - pos.z ) <= P_M_MAX_Z_CLIMB )
{
return true;
--- 685,689 ----
{
// x=x,y=y, and distance btw z's <= MAX STEP
! if( wpAbs<SI08>( pChar->pos().z - pos.z ) <= P_M_MAX_Z_CLIMB )
{
return true;
***************
*** 829,842 ****
}
- /*!
- This checks the new tile we're moving to
- for Character we could eventually bump into.
- */
- bool cMovement::checkObstacles( P_CHAR /*pChar*/, const Coord& /*newPos*/, bool /*running*/ )
- {
- // TODO: insert code here
- return true;
- }
-
Q_UINT16 DynTile( const Coord& pos )
{
--- 862,865 ----
|