Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29663
Modified Files:
accounts.h basechar.cpp basechar.h basedef.h basics.cpp
basics.h combat.cpp combat.h commands.cpp commands.h console.h
contextmenu.h coord.cpp coord.h customtags.cpp customtags.h
definitions.cpp definitions.h dragdrop.cpp dragdrop.h
getopts.h guilds.h inlines.h items.cpp items.h log.h multi.cpp
multi.h npc.cpp npc.h persistentbroker.h persistentobject.h
platform.h player.cpp player.h pythonscript.cpp pythonscript.h
scriptmanager.h server.cpp server.h serverconfig.cpp
serverconfig.h singleton.h skills.cpp skills.h
spawnregions.cpp spawnregions.h speech.cpp targetrequests.cpp
targetrequests.h territories.cpp territories.h timers.cpp
timers.h timing.cpp timing.h tracking.cpp trade.cpp typedefs.h
uobject.cpp uobject.h uotime.h walking.cpp walking.h wolf.dsp
wolfpack.pro wolfpack.vcproj world.cpp world.h
Added Files:
mapobjects.cpp mapobjects.h
Removed Files:
sectors.cpp sectors.h
Log Message:
New sectors code and more. A changelog will be sent to the mailing list.
Index: walking.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/walking.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** walking.h 3 Sep 2004 16:55:17 -0000 1.29
--- walking.h 3 Nov 2004 02:09:29 -0000 1.30
***************
*** 47,51 ****
}/* PACK*/;
! bool mayWalk( P_CHAR pChar, Coord_cl& pos );
class cMovement
--- 47,51 ----
}/* PACK*/;
! bool mayWalk( P_CHAR pChar, Coord& pos );
class cMovement
***************
*** 58,76 ****
void CombatWalk( P_CHAR pc );
void NpcMovement( unsigned int currenttime, P_NPC pc_i );
! bool canLandMonsterMoveHere( Coord_cl& ) const;
! bool CheckForCharacterAtXYZ( P_CHAR pc, const Coord_cl& pos );
! Coord_cl calcCoordFromDir( Q_UINT8 dir, const Coord_cl& oldCoords );
private:
bool consumeStamina( P_PLAYER pChar, bool running );
! bool checkObstacles( P_CHAR pChar, const Coord_cl& newPos, bool running );
bool verifySequence( cUOSocket* socket, Q_UINT8 sequence ) throw();
void checkStealth( P_CHAR );
! void sendWalkToOther( P_PLAYER pChar, P_CHAR pWalker, const Coord_cl& oldpos );
void handleItemCollision( P_CHAR pChar );
! void handleTeleporters( P_CHAR pc, const Coord_cl& oldpos );
};
! typedef SingletonHolder<cMovement> Movement;
#endif // __WALKING2_H__
--- 58,76 ----
void CombatWalk( P_CHAR pc );
void NpcMovement( unsigned int currenttime, P_NPC pc_i );
! bool canLandMonsterMoveHere( Coord& ) const;
! bool CheckForCharacterAtXYZ( P_CHAR pc, const Coord& pos );
! Coord calcCoordFromDir( Q_UINT8 dir, const Coord& oldCoords );
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 );
! void sendWalkToOther( P_PLAYER pChar, P_CHAR pWalker, const Coord& oldpos );
void handleItemCollision( P_CHAR pChar );
! void handleTeleporters( P_CHAR pc, const Coord& oldpos );
};
! typedef Singleton<cMovement> Movement;
#endif // __WALKING2_H__
Index: targetrequests.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/targetrequests.h,v
retrieving revision 1.75
retrieving revision 1.76
diff -C2 -d -r1.75 -r1.76
*** targetrequests.h 24 Sep 2004 04:47:38 -0000 1.75
--- targetrequests.h 3 Nov 2004 02:09:28 -0000 1.76
***************
*** 107,111 ****
socket->player()->removeFromView( false );
! Coord_cl newPos = socket->player()->pos();
newPos.x = target->x();
newPos.y = target->y();
--- 107,111 ----
socket->player()->removeFromView( false );
! Coord newPos = socket->player()->pos();
newPos.x = target->x();
newPos.y = target->y();
***************
*** 340,344 ****
// Move the object relatively
! Coord_cl newPos = pObject->pos() + Coord_cl( x, y, z );
pObject->moveTo( newPos );
--- 340,344 ----
// Move the object relatively
! Coord newPos = pObject->pos() + Coord( x, y, z );
pObject->moveTo( newPos );
Index: persistentobject.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/persistentobject.h,v
retrieving revision 1.15
retrieving revision 1.16
diff -C2 -d -r1.15 -r1.16
*** persistentobject.h 19 Aug 2004 01:22:52 -0000 1.15
--- persistentobject.h 3 Nov 2004 02:09:26 -0000 1.16
***************
*** 134,138 ****
};
! typedef SingletonHolder<cBinaryTypemap> BinaryTypemap;
/*
--- 134,138 ----
};
! typedef Singleton<cBinaryTypemap> BinaryTypemap;
/*
***************
*** 188,192 ****
};
! typedef SingletonHolder<cPersistentFactory> PersistentFactory;
/*
--- 188,192 ----
};
! typedef Singleton<cPersistentFactory> PersistentFactory;
/*
Index: timers.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/timers.h,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** timers.h 25 Sep 2004 02:03:20 -0000 1.8
--- timers.h 3 Nov 2004 02:09:28 -0000 1.9
***************
*** 204,208 ****
};
! typedef SingletonHolder<cTimers> Timers;
#endif
--- 204,208 ----
};
! typedef Singleton<cTimers> Timers;
#endif
Index: timers.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/timers.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** timers.cpp 25 Sep 2004 02:03:20 -0000 1.16
--- timers.cpp 3 Nov 2004 02:09:28 -0000 1.17
***************
*** 41,45 ****
#include "persistentbroker.h"
#include "skills.h"
! #include "sectors.h"
#include "basechar.h"
#include "player.h"
--- 41,45 ----
#include "persistentbroker.h"
#include "skills.h"
! #include "mapobjects.h"
#include "basechar.h"
#include "player.h"
Index: getopts.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/getopts.h,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** getopts.h 2 Jun 2004 15:04:05 -0000 1.5
--- getopts.h 3 Nov 2004 02:09:26 -0000 1.6
***************
*** 57,61 ****
};
! typedef SingletonHolder<cGetopts> Getopts;
#endif
--- 57,61 ----
};
! typedef Singleton<cGetopts> Getopts;
#endif
Index: definitions.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/definitions.cpp,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** definitions.cpp 11 Oct 2004 08:05:10 -0000 1.23
--- definitions.cpp 3 Nov 2004 02:09:25 -0000 1.24
***************
*** 31,35 ****
#include <qptrstack.h>
#include <qregexp.h>
- #include <qvaluestack.h>
#include <qstringlist.h>
#include <qvaluevector.h>
--- 31,34 ----
***************
*** 107,115 ****
cDefManagerPrivate* impl;
// Element level within the current file
! QValueStack<int> levels;
// Holds all read elements.
QPtrStack<cElement> elements;
// Files stack (each <include> pushes a file)
! QValueStack<QString> filenames;
// Locators associated to each document
QPtrStack<QXmlLocator> locators;
--- 106,114 ----
cDefManagerPrivate* impl;
// Element level within the current file
! QValueVector<int> levels;
// Holds all read elements.
QPtrStack<cElement> elements;
// Files stack (each <include> pushes a file)
! QValueVector<QString> filenames;
// Locators associated to each document
QPtrStack<QXmlLocator> locators;
***************
*** 147,151 ****
}
! filenames.push( filename );
QXmlInputSource input( &file );
--- 146,150 ----
}
! filenames.push_back( filename );
QXmlInputSource input( &file );
***************
*** 157,161 ****
reader.parse( &input, false );
! filenames.pop();
}
--- 156,160 ----
reader.parse( &input, false );
! filenames.pop_back();
}
***************
*** 167,171 ****
bool startDocument()
{
! levels.push( 0 );
return true;
}
--- 166,170 ----
bool startDocument()
{
! levels.push_back( 0 );
return true;
}
***************
*** 173,177 ****
bool endDocument()
{
! levels.pop();
locators.pop();
return true;
--- 172,176 ----
bool endDocument()
{
! levels.pop_back();
locators.pop();
return true;
***************
*** 180,187 ****
bool startElement( const QString& /*namespaceURI*/, const QString& localName, const QString& qName, const QXmlAttributes& atts )
{
! levels.top()++;
// Ignore document root
! if( levels.top() == 1 )
{
if( levels.isEmpty() )
--- 179,186 ----
bool startElement( const QString& /*namespaceURI*/, const QString& localName, const QString& qName, const QXmlAttributes& atts )
{
! levels.back()++;
// Ignore document root
! if( levels.back() == 1 )
{
if( levels.isEmpty() )
***************
*** 228,232 ****
{
cElement* element = elements.pop();
! if( --( levels.top() ) == 0 )
{
// Ignore root
--- 227,231 ----
{
cElement* element = elements.pop();
! if( --( levels.back() ) == 0 )
{
// Ignore root
***************
*** 259,263 ****
{
Console::instance()->log( LOG_WARNING, tr( "Duplicate %1: %2\n[File: %3, Line: %4]\n" )
! .arg( element->name() ).arg( tagId ).arg( filenames.top() ).arg( locators.current()->lineNumber() ) );
delete element;
}
--- 258,262 ----
{
Console::instance()->log( LOG_WARNING, tr( "Duplicate %1: %2\n[File: %3, Line: %4]\n" )
! .arg( element->name() ).arg( tagId ).arg( filenames.back() ).arg( locators.current()->lineNumber() ) );
delete element;
}
***************
*** 278,282 ****
Console::instance()->log( LOG_WARNING, tr( "Unknown element: %1\n[File: %2, Line: %3]\n" )
! .arg( element->name() ).arg( filenames.top() ).arg( locators.current()->lineNumber() ) );
delete element;
}
--- 277,281 ----
Console::instance()->log( LOG_WARNING, tr( "Unknown element: %1\n[File: %2, Line: %3]\n" )
! .arg( element->name() ).arg( filenames.back() ).arg( locators.current()->lineNumber() ) );
delete element;
}
***************
*** 301,305 ****
{
Console::instance()->log( LOG_WARNING, tr( "%1\n[File: %2, Line: %3, Column: %4" )
! .arg( exception.message(), filenames.top() ).arg( exception.lineNumber() ).arg( exception.columnNumber() ) );
return true; // continue
}
--- 300,304 ----
{
Console::instance()->log( LOG_WARNING, tr( "%1\n[File: %2, Line: %3, Column: %4" )
! .arg( exception.message(), filenames.back() ).arg( exception.lineNumber() ).arg( exception.columnNumber() ) );
return true; // continue
}
***************
*** 307,311 ****
{
Console::instance()->log( LOG_ERROR, tr( "%1\n[File: %2, Line: %3, Column: %4" )
! .arg( exception.message(), filenames.top() ).arg( exception.lineNumber() ).arg( exception.columnNumber() ) );
return true; // continue
}
--- 306,310 ----
{
Console::instance()->log( LOG_ERROR, tr( "%1\n[File: %2, Line: %3, Column: %4" )
! .arg( exception.message(), filenames.back() ).arg( exception.lineNumber() ).arg( exception.columnNumber() ) );
return true; // continue
}
***************
*** 313,317 ****
{
Console::instance()->log( LOG_ERROR, tr( "%1\n[File: %2, Line: %3, Column: %4" )
! .arg( exception.message(), filenames.top() ).arg( exception.lineNumber() ).arg( exception.columnNumber() ) );
return true; // continue
}
--- 312,316 ----
{
Console::instance()->log( LOG_ERROR, tr( "%1\n[File: %2, Line: %3, Column: %4" )
! .arg( exception.message(), filenames.back() ).arg( exception.lineNumber() ).arg( exception.columnNumber() ) );
return true; // continue
}
Index: trade.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/trade.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** trade.cpp 2 Nov 2004 20:45:44 -0000 1.16
--- trade.cpp 3 Nov 2004 02:09:28 -0000 1.17
***************
*** 121,130 ****
// First check: is the item on the vendor in the specified layer
! if (layer == cBaseChar::BuyRestockContainer) {
! amount = QMIN(pItem->restock(), amount);
! } else if (layer == cBaseChar::BuyNoRestockContainer) {
// Not enough of that item is left
! amount = QMIN(pItem->amount(), amount);
! } else {
socket->sysMessage( tr( "Invalid item bought." ) );
socket->send( &clearBuy );
--- 121,135 ----
// First check: is the item on the vendor in the specified layer
! if( layer == cBaseChar::BuyRestockContainer )
! {
! amount = wpMin<Q_UINT16>( pItem->restock(), amount );
! }
! else if( layer == cBaseChar::BuyNoRestockContainer )
! {
// Not enough of that item is left
! amount = wpMin<Q_UINT16>( pItem->amount(), amount );
! }
! else
! {
socket->sysMessage( tr( "Invalid item bought." ) );
socket->send( &clearBuy );
***************
*** 330,334 ****
{
P_ITEM pItem = FindItemBySerial( iter->first );
! Q_UINT16 amount = QMIN(pItem->amount(), iter->second);
// If we can find something to stack with that is already in the vendors
--- 335,339 ----
{
P_ITEM pItem = FindItemBySerial( iter->first );
! Q_UINT16 amount = wpMin<Q_UINT16>( pItem->amount(), iter->second );
// If we can find something to stack with that is already in the vendors
Index: inlines.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/inlines.h,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** inlines.h 26 Oct 2004 18:37:54 -0000 1.32
--- inlines.h 3 Nov 2004 02:09:26 -0000 1.33
***************
*** 31,35 ****
// library Includes
#include <algorithm>
- #include <math.h>
#include <qglobal.h>
#include <qstring.h>
--- 31,34 ----
***************
*** 60,70 ****
}
! inline int roundInt(double n) {
! double f = n - floor(n);
! if (f >= 0.50) {
! return (int)ceil(n);
! } else {
! return (int)floor(n);
! }
}
--- 59,83 ----
}
! template<typename T>
! inline T wpAbs( T a )
! {
! return ( a >= 0 ? a : -a );
! }
!
! template<typename T>
! inline T wpMin( T a, T b )
! {
! return ( a > b ? b : a );
! }
!
! template<typename T>
! inline T wpMax( T a, T b )
! {
! return ( a < b ? b : a );
! }
!
! inline int roundInt( double n )
! {
! return static_cast<int>( n + 0.5 );
}
--- NEW FILE: mapobjects.h ---
/*
* Wolfpack Emu (WP)
* UO Server Emulation Program
*
* Copyright 2001-2004 by holders identified in AUTHORS.txt
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Palace - Suite 330, Boston, MA 02111-1307, USA.
*
* In addition to that license, if you are running this program or modified
* versions of it on a public system you HAVE TO make the complete source of
* the version used by you available or provide people with a location to
* download it.
*
* Wolfpack Homepage: http://wpdev.sf.net/
*/
#if !defined( __MAPOBJECTS_H__ )
#define __MAPOBJECTS_H__
#include "coord.h"
#include "server.h"
#include "singleton.h"
#include <qptrvector.h>
class Coord;
class cItem;
class cMulti;
class cUObject;
class cBaseChar;
class MapObjects;
class MapObjectsGrid;
/*!
Iterator returned by MapObjects::list*() operations.
If you need to iterate many times over the same map region, you CAN reuse the iterator.
All changes made to the map region will instantly affect the iterator.
@warning Do not replicate iterator objects, as they have implicitly shared states.
*/
template<typename T = cUObject>
class MapObjectsIterator
{
public:
//! Constructs an invalid iterator.
inline MapObjectsIterator() : mState( NULL )
{;}
//! Copy constructor.
inline MapObjectsIterator( const MapObjectsIterator &other ) : mState( other.mState )
{
incrementRefCount();
}
inline ~MapObjectsIterator()
{
decrementRefCount();
}
//! Rewinds the iterator and returns the first element (NULL if empty).
inline T * first();
//! Fetches the next element (NULL if there are no more elements).
inline T * next();
//! Copy operator.
MapObjectsIterator & operator=( const MapObjectsIterator &other );
private:
friend class MapObjects;
inline MapObjectsIterator( void *state ) : mState( state )
{
incrementRefCount();
}
inline void incrementRefCount();
inline void decrementRefCount();
private:
void *mState;
};
typedef MapObjectsIterator<cItem> MapItemsIterator;
typedef MapObjectsIterator<cMulti> MapMultisIterator;
typedef MapObjectsIterator<cBaseChar> MapCharsIterator;
/*!
Use MapObjects to efficiently locate objects within specific regions of the game maps.
Supported lookups:
- Objects at an exact coord.
- Objects within a block (a cell of the internal grid structure).
- Objects within a rectangle.
- Objects within a circle (just as fast as the rectangle lookup).
*/
class MapObjects : public cComponent, public Singleton<MapObjects>
{
public:
struct GridSet;
public:
MapObjects();
virtual ~MapObjects();
// Loads default maps
void load();
/*!
Adds a map, with the specified width and height, to the structure.
@pre width and height MUST be multiples of 8.
*/
void addMap( UI08 map, UI16 width, UI16 height );
//! Adds an UObject to the structure.
void add( cUObject *object );
/*!
Updates an UObjects that's already in the structure.
This is equivalent to removing&re-adding the UObject, but much faster.
Must be called just before the object's position changes, with the new position.
*/
void update( cUObject *object, const Coord &newPos );
/*!
This must be called whenever a player's online status changes (as defined by
isOnline(), which takes lingering into consideration).
If 'online' is true, the player's status is considered to have changed from
offline to online; or if it's false, from online to offline.
*/
void updateOnlineStatus( cPlayer *player, bool online );
//! Removes an UObject from the structure.
void remove( cUObject *object );
//! Whether a map is valid.
bool validMap( UI08 map )
{
return ( mMaps.size() > map && mMaps[map] );
}
MapItemsIterator listItemsAtCoord( UI08 map, UI16 x, UI16 y );
MapItemsIterator listItemsInBlock( UI08 map, UI16 x, UI16 y );
MapItemsIterator listItemsInRect( UI08 map, UI16 x1, UI16 y1, UI16 x2, UI16 y2 );
MapItemsIterator listItemsInCircle( UI08 map, UI16 x, UI16 y, UI16 radius );
inline MapItemsIterator listItemsAtCoord( const Coord &pos )
{
return listItemsAtCoord( pos.map, pos.x, pos.y );
}
inline MapItemsIterator listItemsInBlock( const Coord &pos )
{
return listItemsInBlock( pos.map, pos.x, pos.y );
}
inline MapItemsIterator listItemsInRect( const Coord &p1, const Coord &p2 )
{
return listItemsInRect( p1.map, p1.x, p1.y, p2.x, p2.y );
}
inline MapItemsIterator listItemsInCircle( const Coord ¢er, UI16 radius )
{
return listItemsInCircle( center.map, center.x, center.y, radius );
}
MapMultisIterator listMultisAtCoord( UI08 map, UI16 x, UI16 y );
MapMultisIterator listMultisInBlock( UI08 map, UI16 x, UI16 y );
MapMultisIterator listMultisInRect( UI08 map, UI16 x1, UI16 y1, UI16 x2, UI16 y2 );
MapMultisIterator listMultisInCircle( UI08 map, UI16 x, UI16 y, UI16 radius );
inline MapMultisIterator listMultisAtCoord( const Coord &pos )
{
return listMultisAtCoord( pos.map, pos.x, pos.y );
}
inline MapMultisIterator listMultisInBlock( const Coord &pos )
{
return listMultisInBlock( pos.map, pos.x, pos.y );
}
inline MapMultisIterator listMultisInRect( const Coord &p1, const Coord &p2 )
{
return listMultisInRect( p1.map, p1.x, p1.y, p2.x, p2.y );
}
inline MapMultisIterator listMultisInCircle( const Coord ¢er, UI16 radius )
{
return listMultisInCircle( center.map, center.x, center.y, radius );
}
// Use 'offline' to list EITHER the online or offline characters
MapCharsIterator listCharsAtCoord( UI08 map, UI16 x, UI16 y, bool offline = false );
MapCharsIterator listCharsInBlock( UI08 map, UI16 x, UI16 y, bool offline = false );
MapCharsIterator listCharsInRect( UI08 map, UI16 x1, UI16 y1, UI16 x2, UI16 y2, bool offline = false );
MapCharsIterator listCharsInCircle( UI08 map, UI16 x, UI16 y, UI16 radius, bool offline = false );
inline MapCharsIterator listCharsAtCoord( const Coord &pos, bool offline = false )
{
return listCharsAtCoord( pos.map, pos.x, pos.y, offline );
}
inline MapCharsIterator listCharsInBlock( const Coord &pos, bool offline = false )
{
return listCharsInBlock( pos.map, pos.x, pos.y, offline );
}
inline MapCharsIterator listCharsInRect( const Coord &p1, const Coord &p2, bool offline = false )
{
return listCharsInRect( p1.map, p1.x, p1.y, p2.x, p2.y, offline );
}
inline MapCharsIterator listCharsInCircle( const Coord ¢er, UI16 radius, bool offline = false )
{
return listCharsInCircle( center.map, center.x, center.y, radius, offline );
}
private:
friend class MapObjectsIterator;
static cUObject * firstIteration( void *state );
static cUObject * nextIteration( void *state );
static void releaseIterator( void *state );
private:
QPtrVector<GridSet> mMaps;
};
template<typename T>
inline T * MapObjectsIterator<T>::first()
{
return reinterpret_cast<T *>( MapObjects::firstIteration( mState ) );
}
template<typename T>
inline T * MapObjectsIterator<T>::next()
{
return reinterpret_cast<T *>( MapObjects::nextIteration( mState ) );
}
template<typename T>
inline void MapObjectsIterator<T>::incrementRefCount()
{
// first UI16 in state holds our refcount
if( mState )
++( *reinterpret_cast<UI08 *>( mState ) );
}
template<typename T>
inline void MapObjectsIterator<T>::decrementRefCount()
{
// if refcount reaches zero, release the iterator
if( mState && --( *reinterpret_cast<UI08 *>( mState ) ) == 0 )
MapObjects::releaseIterator( mState );
}
template<typename T>
MapObjectsIterator<T> & MapObjectsIterator<T>::operator=( const MapObjectsIterator &other )
{
if( mState != other.mState )
{
// increment other's refcount
if( other.mState )
++( *reinterpret_cast<UI08 *>( other.mState ) );
decrementRefCount();
mState = other.mState;
}
return *this;
}
#endif
Index: tracking.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/tracking.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** tracking.cpp 19 Aug 2004 01:55:56 -0000 1.29
--- tracking.cpp 3 Nov 2004 02:09:28 -0000 1.30
***************
*** 32,36 ****
#include "timers.h"
! #include "sectors.h"
#include "gumps.h"
#include "basechar.h"
--- 32,36 ----
#include "timers.h"
! #include "mapobjects.h"
#include "gumps.h"
#include "basechar.h"
***************
*** 114,120 ****
// 3: Humans
// 4: Players
! cCharSectorIterator* iter = SectorMaps::instance()->findChars( player->pos(), 18 );
!
! for ( P_CHAR pChar = iter->first(); pChar; pChar = iter->next() )
{
// Do the neccesary checks
--- 114,119 ----
// 3: Humans
// 4: Players
! MapCharsIterator iter = MapObjects::instance()->listCharsInCircle( player->pos(), 18 );
! for ( P_CHAR pChar = iter.first(); pChar; pChar = iter.next() )
{
// Do the neccesary checks
***************
*** 171,176 ****
++pAmount;
}
-
- delete iter;
}
};
--- 170,173 ----
Index: scriptmanager.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/scriptmanager.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -C2 -d -r1.10 -r1.11
*** scriptmanager.h 2 Jun 2004 15:04:06 -0000 1.10
--- scriptmanager.h 3 Nov 2004 02:09:26 -0000 1.11
***************
*** 71,75 ****
};
! typedef SingletonHolder<cScriptManager> ScriptManager;
#endif
--- 71,75 ----
};
! typedef Singleton<cScriptManager> ScriptManager;
#endif
Index: uotime.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/uotime.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -d -r1.3 -r1.4
*** uotime.h 2 Jun 2004 15:04:07 -0000 1.3
--- uotime.h 3 Nov 2004 02:09:29 -0000 1.4
***************
*** 67,71 ****
};
! typedef SingletonHolder<cUoTime> UoTime;
#endif
--- 67,71 ----
};
! typedef Singleton<cUoTime> UoTime;
#endif
Index: basechar.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basechar.h,v
retrieving revision 1.92
retrieving revision 1.93
diff -C2 -d -r1.92 -r1.93
*** basechar.h 16 Oct 2004 19:42:55 -0000 1.92
--- basechar.h 3 Nov 2004 02:09:23 -0000 1.93
***************
*** 139,143 ****
virtual bool canSeeChar( P_CHAR character );
virtual bool canSeeItem( P_ITEM item );
! virtual void moveTo( const Coord_cl& pos, bool noremove = false );
/*
--- 139,143 ----
virtual bool canSeeChar( P_CHAR character );
virtual bool canSeeItem( P_ITEM item );
! virtual void moveTo( const Coord& pos, bool noremove = false );
/*
***************
*** 149,158 ****
Line of sight check for a static item
*/
! bool lineOfSight( const Coord_cl& position, unsigned short id, bool debug = false );
/*
Line of Sight check for a map tile
*/
! bool lineOfSight( const Coord_cl& position, bool debug = false );
/*
--- 149,158 ----
Line of sight check for a static item
*/
! bool lineOfSight( const Coord& position, unsigned short id, bool debug = false );
/*
Line of Sight check for a map tile
*/
! bool lineOfSight( const Coord& position, bool debug = false );
/*
***************
*** 285,289 ****
virtual void turnTo( cUObject* object );
! virtual void turnTo( const Coord_cl& pos );
void wear( P_ITEM );
bool isHuman() const;
--- 285,289 ----
virtual void turnTo( cUObject* object );
! virtual void turnTo( const Coord& pos );
void wear( P_ITEM );
bool isHuman() const;
Index: coord.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/coord.cpp,v
retrieving revision 1.64
retrieving revision 1.65
diff -C2 -d -r1.64 -r1.65
*** coord.cpp 13 Oct 2004 14:45:20 -0000 1.64
--- coord.cpp 3 Nov 2004 02:09:25 -0000 1.65
***************
*** 30,34 ****
#include "player.h"
#include "network/network.h"
! #include "sectors.h"
#include "items.h"
#include "inlines.h"
--- 30,34 ----
#include "player.h"
#include "network/network.h"
! #include "mapobjects.h"
#include "items.h"
#include "inlines.h"
***************
*** 46,53 ****
#include <set>
! inline QValueList<Coord_cl> getPointList(const Coord_cl &origin, const Coord_cl &target) {
// Create a list of coordinates we are going to "touch" when looking
// from point a to point b
! QValueList<Coord_cl> pointList;
int xDiff = target.x - origin.x;
--- 46,53 ----
#include <set>
! inline QValueList<Coord> getPointList(const Coord &origin, const Coord &target) {
// Create a list of coordinates we are going to "touch" when looking
// from point a to point b
! QValueList<Coord> pointList;
int xDiff = target.x - origin.x;
***************
*** 76,80 ****
double currentX = origin.x;
! Coord_cl pos = origin;
while (isBetween(currentX, target.x, origin.x) && isBetween(currentY, target.y, origin.y) && isBetween(currentZ, target.z, origin.z)) {
--- 76,80 ----
double currentX = origin.x;
! Coord pos = origin;
while (isBetween(currentX, target.x, origin.x) && isBetween(currentY, target.y, origin.y) && isBetween(currentZ, target.z, origin.z)) {
***************
*** 111,115 ****
// Get blocking tiles at the given x,y,map coordinate
! void getBlockingTiles(const Coord_cl &pos, QValueList<stBlockingItem> &items) {
stBlockingItem item;
--- 111,116 ----
// Get blocking tiles at the given x,y,map coordinate
! void getBlockingTiles( const Coord &pos, QValueList<stBlockingItem> &items )
! {
stBlockingItem item;
***************
*** 144,209 ****
// Search for items at the given location
! cItemSectorIterator *ditems = SectorMaps::instance()->findItems(pos, 0);
!
! for (P_ITEM ditem = ditems->first(); ditem; ditem = ditems->next()) {
// If the item is invisible or a multi, skip past it.
! if (ditem->isMulti()) {
continue;
- }
! tile_st tile = TileCache::instance()->getTile(ditem->id());
// Window and noshoot tiles block
! if (tile.flag2 & 0x30) {
! item.id = ditem->id();
! item.bottom = ditem->pos().z;
// Bridges are only half as high
! item.top = item.bottom + ((tile.flag2 & 0x04) ? (tile.height / 2) : tile.height);
! items.append(item);
}
}
- delete ditems;
-
// Check for multis around the area
! cItemSectorIterator *multis = SectorMaps::instance()->findMultis(pos, BUILDRANGE);
!
// Check if there is an intersecting item for this multi
! for (P_MULTI multi = (P_MULTI)multis->first(); multi; multi = (P_MULTI)multis->next()) {
// Get all items for this multi
! MultiDefinition *data = MultiCache::instance()->getMulti(multi->id() - 0x4000);
! if (data) {
QValueVector<multiItem_st> mitems = data->getEntries();
QValueVector<multiItem_st>::iterator it;
! for (it = mitems.begin(); it != mitems.end(); ++it) {
multiItem_st mitem = *it;
// Skip this multi tile if it's not at the position we need it to be
! if (!mitem.visible || multi->pos().x + mitem.x != pos.x || multi->pos().y + mitem.y != pos.y) {
continue;
}
! tile_st tile = TileCache::instance()->getTile(mitem.tile);
!
// Has to be blocking
! if (tile.flag2 & 0x30) {
! item.bottom = mitem.z + multi->pos().z;
! item.top = item.bottom + ((tile.flag2 & 0x04) ? (tile.height / 2) : tile.height);
item.id = mitem.tile;
! items.append(item);
}
}
}
}
-
- delete multis;
}
// Check for blocking tiles at the given position
! inline bool checkBlockingTiles(const QValueList<stBlockingItem> &items, const Coord_cl &pos, const Coord_cl &target) {
// Iterate trough all blocking tiles
QValueList<stBlockingItem>::const_iterator it;
! for (it = items.begin(); it != items.end(); ++it) {
stBlockingItem item = *it;
--- 145,213 ----
// Search for items at the given location
! MapItemsIterator itemIter = MapObjects::instance()->listItemsAtCoord( pos );
! for( P_ITEM pItem = itemIter.first(); pItem; pItem = itemIter.next() )
! {
// If the item is invisible or a multi, skip past it.
! if( pItem->isMulti() )
continue;
! tile_st tile = TileCache::instance()->getTile( pItem->id() );
// Window and noshoot tiles block
! if( tile.flag2 & 0x30 )
! {
! item.id = pItem->id();
! item.bottom = pItem->pos().z;
// Bridges are only half as high
! item.top = item.bottom + ( ( tile.flag2 & 0x04 ) ? ( tile.height / 2 ) : tile.height );
! items.append( item );
}
}
// Check for multis around the area
! MapMultisIterator multis = MapObjects::instance()->listMultisInCircle( pos, BUILDRANGE );
!
// Check if there is an intersecting item for this multi
! for( P_MULTI pMulti = multis.first(); pMulti; pMulti = multis.next() )
! {
// Get all items for this multi
! MultiDefinition *data = MultiCache::instance()->getMulti( pMulti->id() - 0x4000 );
! if( data )
! {
QValueVector<multiItem_st> mitems = data->getEntries();
QValueVector<multiItem_st>::iterator it;
! for( it = mitems.begin(); it != mitems.end(); ++it )
! {
multiItem_st mitem = *it;
// Skip this multi tile if it's not at the position we need it to be
! if( !mitem.visible || pMulti->pos().x + mitem.x != pos.x || pMulti->pos().y + mitem.y != pos.y )
! {
continue;
}
! tile_st tile = TileCache::instance()->getTile( mitem.tile );
!
// Has to be blocking
! if( tile.flag2 & 0x30 )
! {
! item.bottom = mitem.z + pMulti->pos().z;
! item.top = item.bottom + ( ( tile.flag2 & 0x04 ) ? ( tile.height / 2 ) : tile.height );
item.id = mitem.tile;
! items.append( item );
}
}
}
}
}
// Check for blocking tiles at the given position
! inline bool checkBlockingTiles( const QValueList<stBlockingItem> &items, const Coord &pos, const Coord &target )
! {
// Iterate trough all blocking tiles
QValueList<stBlockingItem>::const_iterator it;
! for (it = items.begin(); it != items.end(); ++it)
! {
stBlockingItem item = *it;
***************
*** 227,231 ****
// Check the line of sight from a source to a target coordinate.
! bool Coord_cl::lineOfSight(const Coord_cl &target, bool debug) const {
// If the target is out of range, save cpu time by not calculating the
// line of sight
--- 231,235 ----
// Check the line of sight from a source to a target coordinate.
! bool Coord::lineOfSight(const Coord &target, bool debug) const {
// If the target is out of range, save cpu time by not calculating the
// line of sight
***************
*** 239,250 ****
}
! QValueList<Coord_cl> pointList = getPointList(*this, target);
int lastX = -1, lastY = -1;
QValueList<stBlockingItem> blockingItems;
! QValueList<Coord_cl>::const_iterator it;
for (it = pointList.begin(); it != pointList.end(); ++it) {
! Coord_cl point = *it;
// Get a fresh tile-list
--- 243,254 ----
}
! QValueList<Coord> pointList = getPointList(*this, target);
int lastX = -1, lastY = -1;
QValueList<stBlockingItem> blockingItems;
! QValueList<Coord>::const_iterator it;
for (it = pointList.begin(); it != pointList.end(); ++it) {
! Coord point = *it;
// Get a fresh tile-list
***************
*** 273,289 ****
}
! Coord_cl Coord_cl::null( 0xFFFF, 0xFFFF, 0xFF, 0xFF );
! Coord_cl::Coord_cl( void )
{
x = y = z = map = 0;
}
! Coord_cl::Coord_cl( const Coord_cl& clCoord )
{
( *this ) = clCoord;
}
! Coord_cl::Coord_cl( UI16 uiX, UI16 uiY, SI08 siZ, UI08 uiMap, UI08 )
{
x = uiX;
--- 277,293 ----
}
! Coord Coord::null( 0xFFFF, 0xFFFF, 0xFF, 0xFF );
! Coord::Coord( void )
{
x = y = z = map = 0;
}
! Coord::Coord( const Coord& clCoord )
{
( *this ) = clCoord;
}
! Coord::Coord( UI16 uiX, UI16 uiY, SI08 siZ, UI08 uiMap, UI08 )
{
x = uiX;
***************
*** 303,307 ****
* @return UI32 : distance result
*/
! unsigned int Coord_cl::distance( const Coord_cl& src ) const
{
UI32 uiResult = ~0U; // Initialize with *infinite*
--- 307,311 ----
* @return UI32 : distance result
*/
! unsigned int Coord::distance( const Coord& src ) const
{
UI32 uiResult = ~0U; // Initialize with *infinite*
***************
*** 315,319 ****
}
! UI32 Coord_cl::distance( const Coord_cl& a, const Coord_cl& b )
{
return a.distance( b );
--- 319,323 ----
}
! UI32 Coord::distance( const Coord& a, const Coord& b )
{
return a.distance( b );
***************
*** 321,325 ****
// Operators
! Coord_cl& Coord_cl::operator=( const Coord_cl& clCoord )
{
x = clCoord.x;
--- 325,329 ----
// Operators
! Coord& Coord::operator=( const Coord& clCoord )
{
x = clCoord.x;
***************
*** 330,354 ****
}
! bool Coord_cl::operator==( const Coord_cl& src ) const
{
return ( x == src.x && y == src.y && z == src.z && map == src.map );
}
! bool Coord_cl::operator!=( const Coord_cl& src ) const
{
return !( x == src.x && y == src.y && z == src.z && map == src.map );
}
! Coord_cl Coord_cl::operator+( const Coord_cl& src ) const
{
! return Coord_cl( this->x + src.x, this->y + src.y, this->z + src.z, this->map );
}
! Coord_cl Coord_cl::operator-( const Coord_cl& src ) const
{
! return Coord_cl( this->x - src.x, this->y - src.y, this->z - src.z, this->map );
}
! void Coord_cl::effect( Q_UINT16 id, Q_UINT8 speed, Q_UINT8 duration, Q_UINT16 hue, Q_UINT16 renderMode ) const
{
cUOTxEffect effect;
--- 334,358 ----
}
! bool Coord::operator==( const Coord& src ) const
{
return ( x == src.x && y == src.y && z == src.z && map == src.map );
}
! bool Coord::operator!=( const Coord& src ) const
{
return !( x == src.x && y == src.y && z == src.z && map == src.map );
}
! Coord Coord::operator+( const Coord& src ) const
{
! return Coord( this->x + src.x, this->y + src.y, this->z + src.z, this->map );
}
! Coord Coord::operator-( const Coord& src ) const
{
! return Coord( this->x - src.x, this->y - src.y, this->z - src.z, this->map );
}
! void Coord::effect( Q_UINT16 id, Q_UINT8 speed, Q_UINT8 duration, Q_UINT16 hue, Q_UINT16 renderMode ) const
{
cUOTxEffect effect;
***************
*** 370,374 ****
// Calculates the direction from one location to another
! unsigned int Coord_cl::direction( const Coord_cl& dest ) const
{
unsigned int dir;
--- 374,378 ----
// Calculates the direction from one location to another
! unsigned int Coord::direction( const Coord& dest ) const
{
unsigned int dir;
***************
*** 400,411 ****
}
! Coord_cl Coord_cl::losCharPoint(bool eye) const {
! Coord_cl result = *this;
result.z += (eye ? 15 : 10);
return result;
}
! Coord_cl Coord_cl::losItemPoint(unsigned short id) const {
! Coord_cl result = *this;
tile_st tile = TileCache::instance()->getTile(id);
--- 404,415 ----
}
! Coord Coord::losCharPoint(bool eye) const {
! Coord result = *this;
result.z += (eye ? 15 : 10);
return result;
}
! Coord Coord::losItemPoint(unsigned short id) const {
! Coord result = *this;
tile_st tile = TileCache::instance()->getTile(id);
***************
*** 415,420 ****
}
! Coord_cl Coord_cl::losMapPoint() const {
! Coord_cl result = *this;
int bottom, top;
--- 419,424 ----
}
! Coord Coord::losMapPoint() const {
! Coord result = *this;
int bottom, top;
***************
*** 430,434 ****
}
! Coord_cl Coord_cl::losTargetPoint(cUORxTarget *target, unsigned char map) {
SERIAL serial = target->serial();
P_ITEM pItem = World::instance()->findItem(serial);
--- 434,438 ----
}
! Coord Coord::losTargetPoint(cUORxTarget *target, unsigned char map) {
SERIAL serial = target->serial();
P_ITEM pItem = World::instance()->findItem(serial);
***************
*** 446,450 ****
return pChar->pos().losCharPoint();
} else {
! return Coord_cl(target->x(), target->y(), target->z(), map);
}
}
--- 450,454 ----
return pChar->pos().losCharPoint();
} else {
! return Coord(target->x(), target->y(), target->z(), map);
}
}
Index: player.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/player.h,v
retrieving revision 1.61
retrieving revision 1.62
diff -C2 -d -r1.61 -r1.62
*** player.h 15 Oct 2004 00:53:10 -0000 1.61
--- player.h 3 Nov 2004 02:09:26 -0000 1.62
***************
*** 76,79 ****
--- 76,80 ----
void save();
bool del();
+ void postload( unsigned int version );
void load( cBufferedReader& reader, unsigned int version );
void save( cBufferedWriter& writer, unsigned int version );
***************
*** 121,129 ****
unsigned int damage( eDamageType type, unsigned int amount, cUObject* source = 0 );
// Wrapper events
! virtual bool onLogin( void ); // The character enters the world
! virtual bool onLogout( void ); // The character enters the world
! virtual bool onHelp( void ); // The character wants help
! virtual bool onChat( void ); // The character wants to chat
virtual bool onCastSpell( unsigned int spell );
void poll( unsigned int time, unsigned int events );
--- 122,137 ----
unsigned int damage( eDamageType type, unsigned int amount, cUObject* source = 0 );
+ //! Returns true if there's a client (socket) attached to the character.
+ bool isConnected();
+
+ //! Returns true if the char is present in the world (may have disconnected, but be lingering).
+ bool isOnline();
+
// 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
virtual bool onCastSpell( unsigned int spell );
void poll( unsigned int time, unsigned int events );
***************
*** 201,205 ****
bool canSeeChar( P_CHAR character );
bool canSeeItem( P_ITEM item );
! virtual void moveTo( const Coord_cl& pos, bool noremove = false );
// cPythonScriptable inherited methods
--- 209,213 ----
bool canSeeChar( P_CHAR character );
bool canSeeItem( P_ITEM item );
! virtual void moveTo( const Coord& pos, bool noremove = false );
// cPythonScriptable inherited methods
***************
*** 524,526 ****
--- 532,544 ----
}
+ inline bool cPlayer::isConnected()
+ {
+ return socket_ != 0;
+ }
+
+ inline bool cPlayer::isOnline()
+ {
+ return socket_ != 0 || logoutTime_ != 0;
+ }
+
#endif /* CPLAYER_H_HEADER_INCLUDED */
Index: coord.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/coord.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -C2 -d -r1.23 -r1.24
*** coord.h 21 Oct 2004 12:11:10 -0000 1.23
--- coord.h 3 Nov 2004 02:09:25 -0000 1.24
***************
*** 35,61 ****
class cUORxTarget;
! class WPEXPORT Coord_cl
{
public:
! Coord_cl( void );
! Coord_cl( const Coord_cl& clCoord );
! Coord_cl( UI16, UI16, SI08 = 0, UI08 uiMap = 0, UI08 uiPlane = 0 );
// Operators
! Coord_cl& operator=( const Coord_cl& clCoord );
! bool operator==( const Coord_cl& ) const;
! bool operator!=( const Coord_cl& ) const;
! Coord_cl operator+( const Coord_cl& src ) const;
! Coord_cl operator-( const Coord_cl& src ) const;
! unsigned int distance( const Coord_cl& src ) const;
! unsigned int direction( const Coord_cl& dest ) const;
! bool lineOfSight(const Coord_cl &dest, bool debug = false) const;
// Utility functions for getting correct LOS points
! Coord_cl losCharPoint(bool eye = false) const;
! Coord_cl losItemPoint(unsigned short id) const;
! Coord_cl losMapPoint() const;
! static Coord_cl losTargetPoint(cUORxTarget *target, unsigned char map);
! static UI32 distance( const Coord_cl& a, const Coord_cl& b );
/*!
--- 35,61 ----
class cUORxTarget;
! class WPEXPORT Coord
{
public:
! Coord( void );
! Coord( const Coord& clCoord );
! Coord( UI16, UI16, SI08 = 0, UI08 uiMap = 0, UI08 uiPlane = 0 );
// Operators
! Coord& operator=( const Coord& clCoord );
! bool operator==( const Coord& ) const;
! bool operator!=( const Coord& ) const;
! Coord operator+( const Coord& src ) const;
! Coord operator-( const Coord& src ) const;
! unsigned int distance( const Coord& src ) const;
! unsigned int direction( const Coord& dest ) const;
! bool lineOfSight(const Coord &dest, bool debug = false) const;
// Utility functions for getting correct LOS points
! Coord losCharPoint(bool eye = false) const;
! Coord losItemPoint(unsigned short id) const;
! Coord losMapPoint() const;
! static Coord losTargetPoint(cUORxTarget *target, unsigned char map);
! static UI32 distance( const Coord& a, const Coord& b );
/*!
***************
*** 64,68 ****
void effect( UI16 id, UI08 speed = 10, UI08 duration = 5, UI16 hue = 0, UI16 renderMode = 0 ) const;
! static Coord_cl null;
public:
--- 64,68 ----
void effect( UI16 id, UI08 speed = 10, UI08 duration = 5, UI16 hue = 0, UI16 renderMode = 0 ) const;
! static Coord null;
public:
Index: combat.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/combat.cpp,v
retrieving revision 1.174
retrieving revision 1.175
diff -C2 -d -r1.174 -r1.175
*** combat.cpp 29 Aug 2004 15:35:03 -0000 1.174
--- combat.cpp 3 Nov 2004 02:09:23 -0000 1.175
***************
*** 72,76 ****
}
! void cCombat::spawnGuard( P_CHAR pOffender, P_CHAR pCaller, const Coord_cl& pos )
{
if ( !pOffender || !pCaller )
--- 72,76 ----
}
! void cCombat::spawnGuard( P_CHAR pOffender, P_CHAR pCaller, const Coord& pos )
{
if ( !pOffender || !pCaller )
--- sectors.h DELETED ---
Index: definitions.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/definitions.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -d -r1.6 -r1.7
*** definitions.h 11 Oct 2004 07:58:00 -0000 1.6
--- definitions.h 3 Nov 2004 02:09:25 -0000 1.7
***************
*** 154,158 ****
};
! typedef SingletonHolder<cDefinitions> Definitions;
#endif // __WPDEFMANAGER_H__
--- 154,158 ----
};
! typedef Singleton<cDefinitions> Definitions;
#endif // __WPDEFMANAGER_H__
Index: wolfpack.vcproj
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolfpack.vcproj,v
retrieving revision 1.54
retrieving revision 1.55
diff -C2 -d -r1.54 -r1.55
*** wolfpack.vcproj 2 Nov 2004 20:45:44 -0000 1.54
--- wolfpack.vcproj 3 Nov 2004 02:09:29 -0000 1.55
***************
*** 391,394 ****
--- 391,400 ----
</File>
<File
+ RelativePath=".\mapobjects.cpp">
+ </File>
+ <File
+ RelativePath=".\mapobjects.h">
+ </File>
+ <File
RelativePath=".\md5.cpp">
</File>
***************
*** 484,493 ****
</File>
<File
- RelativePath=".\sectors.cpp">
- </File>
- <File
- RelativePath=".\sectors.h">
- </File>
- <File
RelativePath=".\server.cpp">
</File>
--- 490,493 ----
Index: dragdrop.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/dragdrop.h,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** dragdrop.h 2 Jun 2004 15:04:05 -0000 1.24
--- dragdrop.h 3 Nov 2004 02:09:26 -0000 1.25
***************
*** 43,49 ****
// Sub-drop Functions
! void dropOnItem( cUOSocket* socket, P_ITEM pItem, P_ITEM pCont, const Coord_cl& dropPos );
void dropOnChar( cUOSocket* socket, P_ITEM pItem, P_CHAR pOtherChar );
! void dropOnGround( cUOSocket* socket, P_ITEM pItem, const Coord_cl& pos );
// Drop-on-char subfunctions
--- 43,49 ----
// Sub-drop Functions
! void dropOnItem( cUOSocket* socket, P_ITEM pItem, P_ITEM pCont, const Coord& dropPos );
void dropOnChar( cUOSocket* socket, P_ITEM pItem, P_CHAR pOtherChar );
! void dropOnGround( cUOSocket* socket, P_ITEM pItem, const Coord& pos );
// Drop-on-char subfunctions
Index: combat.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/combat.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** combat.h 2 Jun 2004 15:04:04 -0000 1.13
--- combat.h 3 Nov 2004 02:09:24 -0000 1.14
***************
*** 33,37 ****
#include <qptrlist.h>
! class Coord_cl;
class cUOSocket;
--- 33,37 ----
#include <qptrlist.h>
! class Coord;
class cUOSocket;
***************
*** 174,181 ****
void playGetHitSoundEffect( P_CHAR pChar );
void playGetHitAnimation( P_CHAR pChar );
! void spawnGuard( P_CHAR pOffender, P_CHAR pCaller, const Coord_cl& pos );
};
! typedef SingletonHolder<cCombat> Combat;
#endif // __COMBAT_H__
--- 174,181 ----
void playGetHitSoundEffect( P_CHAR pChar );
void playGetHitAnimation( P_CHAR pChar );
! void spawnGuard( P_CHAR pOffender, P_CHAR pCaller, const Coord& pos );
};
! typedef Singleton<cCombat> Combat;
#endif // __COMBAT_H__
Index: walking.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/walking.cpp,v
retrieving revision 1.158
retrieving revision 1.159
diff -C2 -d -r1.158 -r1.159
*** walking.cpp 27 Oct 2004 16:19:42 -0000 1.158
--- walking.cpp 3 Nov 2004 02:09:29 -0000 1.159
***************
*** 31,35 ****
// Wolfpack Includes
#include "walking.h"
! #include "sectors.h"
#include "serverconfig.h"
#include "network/network.h"
--- 31,35 ----
// Wolfpack Includes
#include "walking.h"
! #include "mapobjects.h"
#include "serverconfig.h"
#include "network/network.h"
***************
*** 155,159 ****
// The highest items will be @ the beginning
// While walking we always will try the highest first.
! vector< stBlockItem > getBlockingItems( P_CHAR pChar, const Coord_cl& pos )
{
vector<stBlockItem> blockList;
--- 155,159 ----
// The highest items will be @ the beginning
// While walking we always will try the highest first.
! vector< stBlockItem > getBlockingItems( P_CHAR pChar, const Coord& pos )
{
vector<stBlockItem> blockList;
***************
*** 215,233 ****
}
-
// We are only interested in items at pos
// todo: we could impliment blocking for items on the adjacent sides
// during a diagonal move here, but this has yet to be decided.
! RegionIterator4Items iIter( pos, 0 );
!
! P_ITEM pItem;
! for ( iIter.Begin(); !iIter.atEnd(); iIter++ )
{
- pItem = iIter.GetData();
-
- if ( !pItem )
- continue;
-
if ( pChar && pChar->isDead() )
{
--- 215,225 ----
}
// We are only interested in items at pos
// todo: we could impliment blocking for items on the adjacent sides
// during a diagonal move here, but this has yet to be decided.
! MapItemsIterator iIter = MapObjects::instance()->listItemsAtCoord( pos );
! for ( P_ITEM pItem = iIter.first(); pItem; pItem = iIter.next() )
{
if ( pChar && pChar->isDead() )
{
***************
*** 239,243 ****
}
-
tile_st tTile = TileCache::instance()->getTile( pItem->id() );
--- 231,234 ----
***************
*** 262,276 ****
// deal with the multis now, or not.
! cItemSectorIterator* iter = SectorMaps::instance()->findMultis( pos, 18 ); // 18 has been tested with castle sides and corners...
! for ( pItem = iter->first(); pItem; pItem = iter->next() )
{
! MultiDefinition* def = MultiCache::instance()->getMulti( pItem->id() - 0x4000 );
if ( !def )
continue;
QValueVector<multiItem_st> multi = def->getEntries();
! unsigned int j;
! for ( j = 0; j < multi.size(); ++j )
{
! if ( multi[j].visible && ( pItem->pos().x + multi[j].x == pos.x ) && ( pItem->pos().y + multi[j].y == pos.y ) )
{
tile_st tTile = TileCache::instance()->getTile( multi[j].tile );
--- 253,269 ----
// deal with the multis now, or not.
! // 18 has been tested with castle sides and corners...
! MapMultisIterator iter = MapObjects::instance()->listMultisInCircle( pos, 18 );
! for( cMulti *pMulti = iter.first(); pMulti; pMulti = iter.next() )
{
! MultiDefinition* def = MultiCache::instance()->getMulti( pMulti->id() - 0x4000 );
if ( !def )
continue;
+
QValueVector<multiItem_st> multi = def->getEntries();
!
! for( unsigned int j = 0; j < multi.size(); ++j )
{
! if ( multi[j].visible && ( pMulti->pos().x + multi[j].x == pos.x ) && ( pMulti->pos().y + multi[j].y == pos.y ) )
{
tile_st tTile = TileCache::instance()->getTile( multi[j].tile );
***************
*** 280,289 ****
stBlockItem blockItem;
blockItem.height = (tTile.flag2 & 0x04) ? (tTile.height / 2) : tTile.height;
! blockItem.z = pItem->pos().z + multi[j].z;
if ( ( tTile.flag2 & 0x02 ) && !( tTile.flag1 & 0x40 ) )
blockItem.walkable = true;
else
! blockItem.walkable = checkWalkable( pChar, pItem->id() );
blockList.push_back( blockItem );
--- 273,282 ----
stBlockItem blockItem;
blockItem.height = (tTile.flag2 & 0x04) ? (tTile.height / 2) : tTile.height;
! blockItem.z = pMulti->pos().z + multi[j].z;
if ( ( tTile.flag2 & 0x02 ) && !( tTile.flag1 & 0x40 ) )
blockItem.walkable = true;
else
! blockItem.walkable = checkWalkable( pChar, pMulti->id() );
blockList.push_back( blockItem );
***************
*** 293,302 ****
continue;
}
-
- delete iter;
-
// Now we need to evaluate dynamic items [...] (later) ??
-
sort_heap( blockList.begin(), blockList.end(), compareTiles() );
--- 286,291 ----
***************
*** 307,311 ****
// May a character walk here ?
// If yes we auto. set the new z value for pos
! bool mayWalk( P_CHAR pChar, Coord_cl& pos )
{
// Go trough the array top-to-bottom and check
--- 296,300 ----
// May a character walk here ?
// If yes we auto. set the new z value for pos
! bool mayWalk( P_CHAR pChar, Coord& pos )
{
// Go trough the array top-to-bottom and check
***************
*** 442,446 ****
bool handleItemCollision( P_CHAR pChar, P_ITEM pItem )
{
! Coord_cl dPos = pChar->pos();
if ( pItem->onCollide( pChar ) )
--- 431,435 ----
bool handleItemCollision( P_CHAR pChar, P_ITEM pItem )
{
! Coord dPos = pChar->pos();
if ( pItem->onCollide( pChar ) )
***************
*** 451,464 ****
/*!
! Sends items which came in range and
! handles collisions with teleporters
or damaging items.
*/
! void handleItems( P_CHAR pChar, const Coord_cl& oldpos )
{
P_PLAYER player = dynamic_cast<P_PLAYER>( pChar );
! cItemSectorIterator* iter = SectorMaps::instance()->findItems( pChar->pos(), BUILDRANGE );
! for ( cItem*pItem = iter->first(); pItem; pItem = iter->next() )
{
// Check for item collisions here.
--- 440,452 ----
/*!
! Sends items which came in range and handles collisions with teleporters
or damaging items.
*/
! void handleItems( P_CHAR pChar, const Coord& oldpos )
{
P_PLAYER player = dynamic_cast<P_PLAYER>( pChar );
! MapItemsIterator iter = MapObjects::instance()->listItemsInCircle( pChar->pos(), VISRANGE );
! for( P_ITEM pItem = iter.first(); pItem; pItem = iter.next() )
{
// Check for item collisions here.
***************
*** 475,497 ****
// If we are a connected player then send new items
! if ( player && player->socket() )
{
UI32 oldDist = oldpos.distance( pItem->pos() );
! UI32 newDist = pChar->pos().distance( pItem->pos() );
!
! // Was out of range before and now is in range
! if ( pItem->isMulti() )
{
! if ( ( oldDist >= BUILDRANGE ) && ( newDist < BUILDRANGE ) )
! {
! pItem->update( player->socket() );
! }
}
! else
{
! if ( ( oldDist >= player->visualRange() ) && ( newDist < player->visualRange() ) )
! {
! pItem->update( player->socket() );
! }
}
}
--- 463,498 ----
// If we are a connected player then send new items
! if( player && player->socket() )
{
UI32 oldDist = oldpos.distance( pItem->pos() );
! if( oldDist >= player->visualRange() )
{
! // was out of range before and now is in range
! pItem->update( player->socket() );
}
! }
! }
! }
!
! /*!
! Sends multis which came in range and handles collisions with them.
! */
! void handleMultis( P_CHAR pChar, const Coord& oldpos )
! {
! P_PLAYER player = dynamic_cast<P_PLAYER>( pChar );
!
! MapMultisIterator multis = MapObjects::instance()->listMultisInCircle( pChar->pos(), BUILDRANGE );
! for( P_MULTI multi = multis.first(); multi; multi = multis.next() )
! {
! // TODO: handle multi collisions here.
!
! // If we are a connected player then send new multis
! if( player && player->socket() )
! {
! UI32 oldDist = oldpos.distance( multi->pos() );
! if( oldDist >= BUILDRANGE )
{
! // was out of range before and now is in range
! multi->update( player->socket() );
}
}
***************
*** 526,530 ****
// save our original location before we even think about moving
! const Coord_cl oldpos( pChar->pos() );
// If the Direction we're moving to is different from our current direction
--- 527,531 ----
// save our original location before we even think about moving
! const Coord oldpos( pChar->pos() );
// If the Direction we're moving to is different from our current direction
***************
*** 543,547 ****
{
// Note: Do NOT use the copy constructor as it'll create a reference
! Coord_cl newCoord = calcCoordFromDir( dir, pChar->pos() );
// Check if the stamina parameters
--- 544,548 ----
{
// Note: Do NOT use the copy constructor as it'll create a reference
! Coord newCoord = calcCoordFromDir( dir, pChar->pos() );
// Check if the stamina parameters
***************
*** 593,614 ****
pChar->setDirection( dir );
! RegionIterator4Chars ri( pChar->pos(), 18, true );
! for ( ri.Begin(); !ri.atEnd(); ri++ )
{
! P_CHAR observer = ri.GetData();
!
! if ( observer == pChar )
! {
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() )
{
! player->socket()->sendChar( observer ); // We were previously out of range.
}
}
--- 594,612 ----
pChar->setDirection( dir );
! MapCharsIterator ri = MapObjects::instance()->listCharsInCircle( pChar->pos(), VISRANGE );
! for( P_CHAR observer = ri.first(); observer; observer = ri.next() )
{
! if( observer == pChar )
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 );
}
}
***************
*** 617,623 ****
P_PLAYER otherplayer = dynamic_cast<P_PLAYER>( observer );
! if ( otherplayer && otherplayer->socket() )
{
! if ( distance > otherplayer->visualRange() )
{
otherplayer->socket()->sendChar( pChar ); // Previously we were out of range
--- 615,621 ----
P_PLAYER otherplayer = dynamic_cast<P_PLAYER>( observer );
! if( otherplayer && otherplayer->socket() )
{
! if( distance > otherplayer->visualRange() )
{
otherplayer->socket()->sendChar( pChar ); // Previously we were out of range
***************
*** 639,642 ****
--- 637,641 ----
{
handleItems( pChar, oldpos );
+ handleMultis( pChar, oldpos );
handleTeleporters( pChar, oldpos );
}
***************
*** 645,671 ****
}
! bool cMovement::CheckForCharacterAtXYZ( P_CHAR pc, const Coord_cl& pos )
{
! // again this seems to me like we are doing too much work.
! // why should we get all chars in the region using default (18),
! // and then loop through them ignoring all those not at exactly the spot we are going (now) on?
! // why not just get those on the one spot we care about anyways?
!
! RegionIterator4Chars ri( pos, 0 );
! for ( ri.Begin(); !ri.atEnd(); ri++ )
{
! P_CHAR pc_i = ri.GetData();
! if ( pc_i != NULL )
{
! if ( pc_i != pc && !pc_i->isHidden() && !pc_i->isInvisible() )
{
! // x=x,y=y, and distance btw z's <= MAX STEP
! if ( abs( pc_i->pos().z - pos.z ) <= P_M_MAX_Z_CLIMB )
! {
! return true;
! }
}
}
}
return false;
}
--- 644,662 ----
}
! bool cMovement::CheckForCharacterAtXYZ( P_CHAR pc, const Coord& pos )
{
! MapCharsIterator ri = MapObjects::instance()->listCharsAtCoord( pos );
! for( P_CHAR pChar = ri.first(); pChar; pChar = ri.next() )
{
! if( pChar != pc && !pChar->isHidden() && !pChar->isInvisible() )
{
! // 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;
}
}
}
+
return false;
}
***************
*** 707,711 ****
}
! void cMovement::handleTeleporters( P_CHAR pc, const Coord_cl& oldpos )
{
cTerritory* territory = pc->region();
--- 698,702 ----
}
! void cMovement::handleTeleporters...
[truncated message content] |