Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv8134
Modified Files:
Timing.cpp accounts.cpp accounts.h basedef.cpp commands.cpp
commands.h coord.cpp maps.cpp maps.h npc.cpp scriptmanager.cpp
speech.cpp srvparams.cpp targetrequests.h tilecache.h
tmpeff.cpp uobject.cpp wolf.dsp wolfpack.cpp
Removed Files:
ai.cpp ai.h ai_animals.cpp ai_humans.cpp ai_monsters.cpp
Log Message:
door generation command ( reference )
fixed some of the copyright notices
minor improvements.
Moving AI to it's own folder
Index: Timing.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/Timing.cpp,v
retrieving revision 1.184
retrieving revision 1.185
diff -C2 -d -r1.184 -r1.185
*** Timing.cpp 5 Jan 2004 06:25:37 -0000 1.184
--- Timing.cpp 22 Jan 2004 04:48:11 -0000 1.185
***************
*** 52,56 ****
#include "player.h"
#include "chars.h"
! #include "ai.h"
#include "inlines.h"
#include "walking.h"
--- 52,56 ----
#include "player.h"
#include "chars.h"
! #include "ai/ai.h"
#include "inlines.h"
#include "walking.h"
Index: accounts.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/accounts.cpp,v
retrieving revision 1.74
retrieving revision 1.75
diff -C2 -d -r1.74 -r1.75
*** accounts.cpp 22 Jan 2004 03:57:26 -0000 1.74
--- accounts.cpp 22 Jan 2004 04:48:11 -0000 1.75
***************
*** 100,123 ****
}
! //#include "console.h"
!
bool cAccount::authorized( const QString& group, const QString& value ) const
{
// No Valid ACL specified
if( !acl_ )
! {// Let's try harder get one.
! acl_ = Commands::instance()->getACL( aclName_ ); // loads if there was any specified.
! if ( !acl_ )
! {
! acl_ = Commands::instance()->getACL( "player" );
! if ( acl_ )
! aclName_ = "player";
! else
! return false;
! }
! }
// No group? No Access!
! QMap< QString, QMap< QString, bool > >::iterator groupIter = acl_->groups.find( group );
if( groupIter == acl_->groups.end() )
return false;
--- 100,115 ----
}
! /*!
! Checks if the account is autorized to perform the action catagorized
! into \a group and \a value pair, found in the ACL
! */
bool cAccount::authorized( const QString& group, const QString& value ) const
{
// No Valid ACL specified
if( !acl_ )
! return false; // Since refreshAcl have already tried to get one, just give up.
// No group? No Access!
! QMap< QString, QMap< QString, bool > >::const_iterator groupIter = acl_->groups.find( group );
if( groupIter == acl_->groups.end() )
return false;
***************
*** 141,154 ****
}
- void cAccounts::remove( cAccount *record )
- {
- if( accounts.contains( record->login() ) )
- accounts.remove( record->login() );
- delete record;
- }
-
void cAccount::refreshAcl()
{
! acl_ = Commands::instance()->getACL( aclName_ );
}
--- 133,145 ----
}
void cAccount::refreshAcl()
{
! acl_ = Commands::instance()->getACL( aclName_ );
!
! // No Valid ACL specified, will set as "player"
! if ( !acl_ )
! {
! acl_ = Commands::instance()->getACL( "player" );
! }
}
***************
*** 409,412 ****
--- 400,406 ----
}
+ /*!
+ Reloads all accounts
+ */
void cAccounts::reload()
{
***************
*** 454,457 ****
--- 448,456 ----
}
+ /*!
+ Creates an account with \a login and \a password. If this is the first account
+ on the system, it will be set with "admin" acl, otherwise, it will default to
+ "player" acl.
+ */
cAccount* cAccounts::createAccount( const QString& login, const QString& password )
{
***************
*** 469,472 ****
--- 468,484 ----
}
+ /*!
+ Removes \a record account from the system
+ */
+ void cAccounts::remove( cAccount *record )
+ {
+ if( accounts.contains( record->login() ) )
+ accounts.remove( record->login() );
+ delete record;
+ }
+
+ /*!
+ Returns the number of loaded accounts
+ */
uint cAccounts::count()
{
***************
*** 474,477 ****
--- 486,493 ----
}
+ /*!
+ Retrieves the account matching \a login or 0 if no such
+ account can be found.
+ */
cAccount* cAccounts::getRecord( const QString& login )
{
Index: accounts.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/accounts.h,v
retrieving revision 1.34
retrieving revision 1.35
diff -C2 -d -r1.34 -r1.35
*** accounts.h 22 Jan 2004 03:57:26 -0000 1.34
--- accounts.h 22 Jan 2004 04:48:11 -0000 1.35
***************
*** 5,9 ****
//
// Copyright 1997, 98 by Marcus Rating (Cironian)
! // Copyright 2001-2003 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
--- 5,9 ----
//
// Copyright 1997, 98 by Marcus Rating (Cironian)
! // 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
***************
*** 30,43 ****
//==================================================================================
-
-
#if !defined(__ACCOUNTS_H__)
#define __ACCOUNTS_H__
- #include "typedefs.h"
- #include "singleton.h"
-
// Library Includes
#include <qstring.h>
#include <qdatetime.h>
#include <qvaluevector.h>
--- 30,39 ----
//==================================================================================
#if !defined(__ACCOUNTS_H__)
#define __ACCOUNTS_H__
// Library Includes
#include <qstring.h>
+ #include <qcstring.h>
#include <qdatetime.h>
#include <qvaluevector.h>
***************
*** 45,49 ****
// Wolfpack includes
! //#include "commands.h"
// Forward Class declarations
--- 41,46 ----
// Wolfpack includes
! #include "typedefs.h"
! #include "singleton.h"
// Forward Class declarations
***************
*** 58,63 ****
QString login_;
QString password_;
! mutable cAcl *acl_;
! mutable QString aclName_;
QValueVector<P_PLAYER> characters_;
QDateTime lastLogin_;
--- 55,60 ----
QString login_;
QString password_;
! cAcl *acl_;
! QString aclName_;
QValueVector<P_PLAYER> characters_;
QDateTime lastLogin_;
Index: basedef.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basedef.cpp,v
retrieving revision 1.4
retrieving revision 1.5
diff -C2 -d -r1.4 -r1.5
*** basedef.cpp 11 Sep 2003 16:19:50 -0000 1.4
--- basedef.cpp 22 Jan 2004 04:48:12 -0000 1.5
***************
*** 4,9 ****
// UO Server Emulation Program
//
! // Copyright 1997, 98 by Marcus Rating (Cironian)
! // Copyright 2001-2003 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
--- 4,8 ----
// 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
Index: commands.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/commands.cpp,v
retrieving revision 1.214
retrieving revision 1.215
diff -C2 -d -r1.214 -r1.215
*** commands.cpp 22 Jan 2004 04:39:18 -0000 1.214
--- commands.cpp 22 Jan 2004 04:48:12 -0000 1.215
***************
*** 4,9 ****
// UO Server Emulation Program
//
! // Copyright 1997, 98 by Marcus Rating (Cironian)
! // Copyright 2001-2003 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
--- 4,8 ----
// 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
***************
*** 77,81 ****
// Check if the priviledges are ok
! if( !pChar->account()->authorized("command", pCommand ))
{
socket->sysMessage( tr( "Access to command '%1' was denied" ).arg( pCommand.lower() ) );
--- 76,80 ----
// Check if the priviledges are ok
! if( !pChar->account()->authorized("command", pCommand.latin1() ))
{
socket->sysMessage( tr( "Access to command '%1' was denied" ).arg( pCommand.lower() ) );
***************
*** 166,170 ****
QMap< QString, bool > group;
! QString groupName;
--- 165,169 ----
QMap< QString, bool > group;
! QCString groupName;
***************
*** 494,498 ****
else if( key == "acl" )
{
! if( !Commands::instance()->getACL( value ) )
{
socket->sysMessage( tr( "You tried to specify an unknown acl '%1'" ).arg( value ) );
--- 493,497 ----
else if( key == "acl" )
{
! if( !Commands::instance()->getACL( value.latin1() ) )
{
socket->sysMessage( tr( "You tried to specify an unknown acl '%1'" ).arg( value ) );
***************
*** 1241,1244 ****
--- 1240,1501 ----
}
+ void commandDoorGenerator( cUOSocket* socket, const QString &command, const QStringList &args ) throw()
+ {
+ class DoorGenerator
+ {
+ enum DoorFacing {
+ WestCW = 0, EastCCW, WestCCW, EastCW, SouthCW, NorthCCW, SouthCCW, NorthCW
+ };
+
+ bool isFrame( int id, int frames[], int size )
+ {
+ id &= 0x3FFF;
+ if ( id > frames[size - 1] )
+ return false;
+
+ for ( int i = 0; i < size; ++i )
+ {
+ int delta = id - frames[i];
+
+ if ( delta < 0 )
+ return false;
+ else if ( delta == 0 )
+ return true;
+ }
+ return false;
+ }
+
+ bool isSouthFrame( int id )
+ {
+ static int SouthFrames[] = {
+ 0x0006,0x0008,0x000B,0x001A,0x001B,0x001F,
+ 0x0038,0x0057,0x0059,0x005B,0x005D,0x0080,
+ 0x0081,0x0082,0x0084,0x0090,0x0091,0x0094,
+ 0x0096,0x0099,0x00A6,0x00A7,0x00AA,0x00AE,
+ 0x00B0,0x00B3,0x00C7,0x00C9,0x00F8,0x00FA,
+ 0x00FD,0x00FE,0x0100,0x0103,0x0104,0x0106,
+ 0x0109,0x0127,0x0129,0x012B,0x012D,0x012F,
+ 0x0131,0x0132,0x0134,0x0135,0x0137,0x0139,
+ 0x013B,0x014C,0x014E,0x014F,0x0151,0x0153,
+ 0x0155,0x0157,0x0158,0x015A,0x015D,0x015E,
+ 0x015F,0x0162,0x01CF,0x01D1,0x01D4,0x01FF,
+ 0x0204,0x0206,0x0208,0x020A };
+ return isFrame( id, SouthFrames, sizeof(SouthFrames) );
+ }
+
+ bool isNorthFrame( int id )
+ {
+ static int NorthFrames[] = {
+ 0x0006,0x0008,0x000D,0x001A,0x001B,0x0020,
+ 0x003A,0x0057,0x0059,0x005B,0x005D,0x0080,
+ 0x0081,0x0082,0x0084,0x0090,0x0091,0x0094,
+ 0x0096,0x0099,0x00A6,0x00A7,0x00AC,0x00AE,
+ 0x00B0,0x00C7,0x00C9,0x00F8,0x00FA,0x00FD,
+ 0x00FE,0x0100,0x0103,0x0104,0x0106,0x0109,
+ 0x0127,0x0129,0x012B,0x012D,0x012F,0x0131,
+ 0x0132,0x0134,0x0135,0x0137,0x0139,0x013B,
+ 0x014C,0x014E,0x014F,0x0151,0x0153,0x0155,
+ 0x0157,0x0158,0x015A,0x015D,0x015E,0x015F,
+ 0x0162,0x01CF,0x01D1,0x01D4,0x01FF,0x0201,
+ 0x0204,0x0208,0x020A };
+ return isFrame( id, NorthFrames, sizeof( NorthFrames ) );
+ }
+
+ bool isEastFrame( int id )
+ {
+ static int EastFrames[] = {
+ 0x0007,0x000A,0x001A,0x001C,0x001E,0x0037,0x0058,
+ 0x0059,0x005C,0x005E,0x0080,0x0081,0x0082,0x0084,
+ 0x0090,0x0092,0x0095,0x0097,0x0098,0x00A6,0x00A8,
+ 0x00AB,0x00AE,0x00AF,0x00B2,0x00C7,0x00C8,0x00EA,
+ 0x00F8,0x00F9,0x00FC,0x00FE,0x00FF,0x0102,0x0104,
+ 0x0105,0x0108,0x0127,0x0128,0x012B,0x012C,0x012E,
+ 0x0130,0x0132,0x0133,0x0135,0x0136,0x0138,0x013A,
+ 0x014C,0x014D,0x014F,0x0150,0x0152,0x0154,0x0156,
+ 0x0158,0x0159,0x015C,0x015E,0x0160,0x0163,0x01CF,
+ 0x01D0,0x01D3,0x01FF,0x0203,0x0205,0x0207,0x0209 };
+ return isFrame( id, EastFrames, sizeof( EastFrames ) );
+ }
+
+ bool isWestFrame( int id )
+ {
+ static int WestFrames[] = {
+ 0x0007,0x000C,0x001A,0x001C,0x0021,0x0039,0x0058,0x0059,
+ 0x005C,0x005E,0x0080,0x0081,0x0082,0x0084,0x0090,0x0092,
+ 0x0095,0x0097,0x0098,0x00A6,0x00A8,0x00AD,0x00AE,0x00AF,
+ 0x00B5,0x00C7,0x00C8,0x00EA,0x00F8,0x00F9,0x00FC,0x00FE,
+ 0x00FF,0x0102,0x0104,0x0105,0x0108,0x0127,0x0128,0x012C,
+ 0x012E,0x0130,0x0132,0x0133,0x0135,0x0136,0x0138,0x013A,
+ 0x014C,0x014D,0x014F,0x0150,0x0152,0x0154,0x0156,0x0158,
+ 0x0159,0x015C,0x015E,0x0160,0x0163,0x01CF,0x01D0,0x01D3,
+ 0x01FF,0x0200,0x0203,0x0207,0x0209 };
+ return isFrame( id, WestFrames, sizeof( WestFrames ) );
+ }
+
+ bool coordHasEastFrame( int x, int y, int z, int map )
+ {
+ StaticsIterator tiles = Map->staticsIterator( Coord_cl( x, y, z, map ), true );
+ for ( ; !tiles.atEnd(); ++tiles )
+ {
+ if ( tiles.data().zoff == z && isEastFrame( tiles.data().itemid ) )
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ bool coordHasSouthFrame( int x, int y, int z, int map )
+ {
+ StaticsIterator tiles = Map->staticsIterator( Coord_cl( x, y, z, map ), true );
+ for ( ; !tiles.atEnd(); ++tiles )
+ {
+ if ( tiles.data().zoff == z && isSouthFrame( tiles.data().itemid ) )
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+ cItem* addDoor( int x, int y, int z, int map, DoorFacing facing )
+ {
+ int doorTop = z + 20;
+
+ if ( y == 1743 && x >= 1343 && x <= 1344 )
+ return 0;
+ if ( y == 1679 && x >= 1392 && x <= 1393 )
+ return 0;
+ if ( x == 1320 && y >= 1618 && y <= 1640 )
+ return 0;
+ if ( x == 1383 && y >= 1642 && y <= 1643 )
+ return 0;
+ if ( !Map->canFit( x, y, z, map, 16) )
+ return 0;
+ cItem* door = cItem::createFromScript( QString::number( 0x6A5 + 2*int(facing), 16 ) );
+ door->moveTo( Coord_cl( x, y, z, map ), true );
+ return door;
+ }
+ public:
+
+ int generate ( int region[], int map, cUOSocket* socket )
+ {
+ int count = 0;
+ for ( int rx = region[0]; rx < region[2]; ++rx )
+ {
+
+ for ( int ry = region[1]; ry < region[3]; ++ry )
+ {
+ StaticsIterator tiles = Map->staticsIterator( map, rx, ry, true );
+ for ( ; !tiles.atEnd(); ++tiles )
+ {
+ int id = tiles.data().itemid;
+ int z = tiles.data().zoff;
+ if ( isWestFrame( id ) )
+ {
+ if ( coordHasEastFrame( rx + 2, ry, z, map ) )
+ {
+ addDoor( rx + 1, ry, z, map, WestCW );
+ ++count;
+ }
+ else if ( coordHasEastFrame( rx + 3, ry, z, map ) )
+ {
+ cItem* first = addDoor( rx + 1, ry, z, map, WestCW );
+ cItem* second = addDoor( rx + 2, ry, z, map, EastCCW );
+ count += 2;
+ if ( first && second )
+ {
+ first->setTag( "link", second->serial() );
+ second->setTag( "link", first->serial() );
+ }
+ else
+ {
+ if ( !first && second )
+ {
+ second->remove();
+ --count;
+ }
+ if ( !second && first )
+ {
+ first->remove();
+ --count;
+ }
+ }
+ }
+ }
+ else if ( isNorthFrame( id ) )
+ {
+ if ( coordHasSouthFrame( rx, ry + 2, z, map ) )
+ {
+ addDoor( rx, ry + 1, z, map, SouthCW );
+ ++count;
+ }
+ else if ( coordHasSouthFrame( rx, ry + 3, z, map ) )
+ {
+ cItem* first = addDoor( rx, ry + 1, z, map, NorthCCW );
+ cItem* second = addDoor( rx, ry + 2, z, map, SouthCW );
+ count += 2;
+ if ( first && second )
+ {
+ first->setTag( "link", second->serial() );
+ second->setTag( "link", first->serial() );
+ }
+ else
+ {
+ if ( !first && second )
+ {
+ second->remove();
+ --count;
+ }
+ if ( !second && first )
+ {
+ first->remove();
+ --count;
+ }
+ }
+ }
+ }
+ }
+ }
+ }
+ return count;
+ }
+ };
+
+ DoorGenerator generator;
+
+ int BritRegions[][4] = {
+ { 250, 750, 775, 1330 },
+ { 525, 2095, 925, 2430 },
+ { 1025, 2155, 1265, 2310 },
+ { 1635, 2430, 1705, 2508 },
+ { 1775, 2605, 2165, 2975 },
+ { 1055, 3520, 1570, 4075 },
+ { 2860, 3310, 3120, 3630 },
+ { 2470, 1855, 3950, 3045 },
+ { 3425, 990, 3900, 1455 },
+ { 4175, 735, 4840, 1600 },
+ { 2375, 330, 3100, 1045 },
+ { 2100, 1090, 2310, 1450 },
+ { 1495, 1400, 1550, 1475 },
+ { 1085, 1520, 1415, 1910 },
+ { 1410, 1500, 1745, 1795 },
+ { 5120, 2300, 6143, 4095 } };
+ int IlshRegions[][4] = { { 0, 0, 288*8, 200*8 } };
+ int MalasRegions[][4] = { { 0, 0, 320*8, 256*8 } };
+
+ socket->sysMessage("Generating doors, please wait ( Slow )");
+ int count = 0;
+ if ( Map->hasMap( 0 ) )
+ {
+ for ( int i = 0; i < 16; ++i )
+ {
+ socket->sysMessage(QString("doing [%1, %2, %3, %4]").arg(BritRegions[i][0]).arg(BritRegions[i][1]).arg(BritRegions[i][2]).arg(BritRegions[i][3]) );
+ count += generator.generate( BritRegions[i], 0, socket );
+ socket->sysMessage( tr("Doors so far: %1").arg(count) );
+ }
+ }
+ }
+
// Command Table (Keep this at the end)
stCommand cCommands::commands[] =
***************
*** 1253,1256 ****
--- 1510,1514 ----
{ "ALLSKILLS", commandAllSkills },
{ "BROADCAST", commandBroadcast },
+ { "DOORGEN", commandDoorGenerator },
{ "FIX", commandFix },
{ "GO", commandGo },
Index: commands.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/commands.h,v
retrieving revision 1.17
retrieving revision 1.18
diff -C2 -d -r1.17 -r1.18
*** commands.h 22 Jan 2004 03:57:27 -0000 1.17
--- commands.h 22 Jan 2004 04:48:12 -0000 1.18
***************
*** 38,41 ****
--- 38,42 ----
#include <qmap.h>
#include <qstring.h>
+ #include <qcstring.h>
#include <qstringlist.h>
#include <qobject.h>
***************
*** 75,84 ****
// Privlevel System
void loadACLs( void );
! cAcl *getACL( const QString& );
};
! inline cAcl *cCommands::getACL( const QString& key )
{
! QMap< QString, cAcl* >::iterator it = _acls.find( key );
if( it != _acls.end() )
--- 76,85 ----
// Privlevel System
void loadACLs( void );
! cAcl *getACL( const QString& ) const;
};
! inline cAcl *cCommands::getACL( const QString& key ) const
{
! QMap< QString, cAcl* >::const_iterator it = _acls.find( key );
if( it != _acls.end() )
Index: coord.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/coord.cpp,v
retrieving revision 1.29
retrieving revision 1.30
diff -C2 -d -r1.29 -r1.30
*** coord.cpp 30 Sep 2003 15:06:29 -0000 1.29
--- coord.cpp 22 Jan 2004 04:48:12 -0000 1.30
***************
*** 4,9 ****
// UO Server Emulation Program
//
! // Copyright 1997, 98 by Marcus Rating (Cironian)
! // Copyright 2001-2003 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
--- 4,8 ----
// 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
Index: maps.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/maps.cpp,v
retrieving revision 1.24
retrieving revision 1.25
diff -C2 -d -r1.24 -r1.25
*** maps.cpp 14 Jan 2004 02:43:11 -0000 1.24
--- maps.cpp 22 Jan 2004 04:48:12 -0000 1.25
***************
*** 4,8 ****
// UO Server Emulation Program
//
! // Copyright 2001-2003 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
--- 4,8 ----
// 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
***************
*** 48,51 ****
--- 48,52 ----
#include <exception>
#include <assert.h>
+ #include <math.h>
class MapsPrivate
***************
*** 148,156 ****
/*!
Registers a map id and corresponding file to be accessible to Wolfpack
*/
bool Maps::registerMap( uint id, const QString& mapfile, uint mapwidth, uint mapheight, const QString& staticsfile, const QString& staticsidx )
{
try {
! MapsPrivate* p = new MapsPrivate( basePath + staticsidx, basePath + mapfile, basePath + staticsfile );
p->height = mapheight;
p->width = mapwidth;
--- 149,173 ----
/*!
Registers a map id and corresponding file to be accessible to Wolfpack
+ It will try it best to match the filenames in a case insensitive way,
+ since it's case sometimes varies and it might became an anoyance configuring the
+ server under Linux.
*/
bool Maps::registerMap( uint id, const QString& mapfile, uint mapwidth, uint mapheight, const QString& staticsfile, const QString& staticsidx )
{
try {
! QDir baseFolder( basePath );
! QStringList files = baseFolder.entryList();
! QString staticsIdxName, mapFileName, staticsFileName;
! for ( QStringList::const_iterator it = files.begin(); it != files.end(); ++it )
! {
! if ( (*it).lower() == staticsidx.lower() )
! staticsIdxName = *it;
! if ( (*it).lower() == mapfile.lower() )
! mapFileName = *it;
! if ( (*it).lower() == staticsfile.lower() )
! staticsFileName = *it;
! }
!
! MapsPrivate* p = new MapsPrivate( basePath + staticsIdxName, basePath + mapFileName, basePath + staticsFileName );
p->height = mapheight;
p->width = mapwidth;
***************
*** 241,246 ****
This method does not take into account dynamic objects that might
be placed in those coordinates, instead it only looks at the map file.
*/
! signed char Maps::mapAverageElevation( const Coord_cl& p ) const
{
// first thing is to get the map where we are standing
--- 258,265 ----
This method does not take into account dynamic objects that might
be placed in those coordinates, instead it only looks at the map file.
+ The optional parameters \a top and \a botton are respectively the highest
+ and lowerst values that composes the average
*/
! signed char Maps::mapAverageElevation( const Coord_cl& p, int* top /* = 0 */, int* botton /* = 0 */ ) const
{
// first thing is to get the map where we are standing
***************
*** 250,254 ****
if (map1.id > 2 && ILLEGAL_Z != mapElevation(p))
{
! // get three other nearby maps to decide on an average z?
INT8 map2z = mapElevation( p + Coord_cl( 1, 0, 0 ) );
INT8 map3z = mapElevation( p + Coord_cl( 0, 1, 0 ) );
--- 269,273 ----
if (map1.id > 2 && ILLEGAL_Z != mapElevation(p))
{
! // get three other nearby titles to decide on an average z?
INT8 map2z = mapElevation( p + Coord_cl( 1, 0, 0 ) );
INT8 map3z = mapElevation( p + Coord_cl( 0, 1, 0 ) );
***************
*** 260,268 ****
if (ILLEGAL_Z == map4z)
testz = map1.z;
! else
! {
! testz = (INT8)((map1.z + map4z) >> 1);
! if (testz%2<0) --testz; // make it round down, not just in the direction of 0
! }
}
else
--- 279,284 ----
if (ILLEGAL_Z == map4z)
testz = map1.z;
! else // round down.
! testz = (signed char)( floor( ( map1.z + map4z ) / 2.0 ) );
}
else
***************
*** 270,278 ****
if (ILLEGAL_Z == map2z || ILLEGAL_Z == map3z)
testz = map1.z;
! else
! {
! testz = (signed char)((map2z + map3z) >> 1);
! if (testz%2<0) --testz; // make it round down, not just in the direction of 0
! }
}
return testz;
--- 286,311 ----
if (ILLEGAL_Z == map2z || ILLEGAL_Z == map3z)
testz = map1.z;
! else // round down
! testz = (signed char)( floor( ( map2z + map3z ) / 2.0 ) );
! }
! if ( top )
! {
! *top = map1.z;
! if ( map2z > *top )
! *top = map2z;
! if ( map3z > *top )
! *top = map3z;
! if ( map4z > *top )
! *top = map4z;
! }
! if ( botton )
! {
! *botton = map1.z;
! if ( map2z < *botton )
! *botton = map2z;
! if ( map3z < *botton )
! *botton = map3z;
! if ( map4z < *botton )
! *botton = map4z;
}
return testz;
***************
*** 281,284 ****
--- 314,339 ----
}
+ bool Maps::canFit( int x, int y, int z, int map, int height ) const
+ {
+ if ( x < 0 || y < 0 || x >= mapTileWidth(map) * 8 || y >= mapTileHeight(map) * 8 )
+ return false;
+
+ map_st map1 = seekMap( map, x, y );
+ land_st land = TileCache::instance()->getLand( map1.id );
+ if ( land.isBlocking() )
+ return false; // There is something here.
+
+ // check statics too
+ StaticsIterator StaticTiles = staticsIterator( Coord_cl( x, y, z, map ) );
+ for ( ; !StaticTiles.atEnd(); ++StaticTiles )
+ {
+ tile_st tile = TileCache::instance()->getTile(StaticTiles->itemid);
+ if ( ( tile.isBlocking() ) && StaticTiles->zoff + tile.height > z )
+ return false;
+ }
+
+ return true;
+ }
+
signed char Maps::dynamicElevation(const Coord_cl& pos) const
{
***************
*** 315,319 ****
}
! signed char Maps::staticTop(const Coord_cl& pos)
{
signed char top = ILLEGAL_Z;
--- 370,374 ----
}
! signed char Maps::staticTop(const Coord_cl& pos) const
{
signed char top = ILLEGAL_Z;
***************
*** 324,328 ****
{
signed char tempTop = msi->zoff + TileCache::instance()->tileHeight(msi->itemid);
! if ((tempTop <= pos.z + MaxZstep) && (tempTop > top))
{
top = tempTop;
--- 379,383 ----
{
signed char tempTop = msi->zoff + TileCache::instance()->tileHeight(msi->itemid);
! if ( (tempTop <= pos.z + MaxZstep) && (tempTop > top) )
{
top = tempTop;
***************
*** 349,355 ****
! StaticsIterator Maps::staticsIterator(uint id, ushort x, ushort y, bool exact /* = true */ ) throw (wpException)
{
! iterator it = d.find( id );
if ( it == d.end() )
throw wpException(QString("[Maps::staticsIterator line %1] map id(%2) not registered!").arg(__LINE__).arg(id) );
--- 404,410 ----
! StaticsIterator Maps::staticsIterator(uint id, ushort x, ushort y, bool exact /* = true */ ) const throw (wpException)
{
! const_iterator it = d.find( id );
if ( it == d.end() )
throw wpException(QString("[Maps::staticsIterator line %1] map id(%2) not registered!").arg(__LINE__).arg(id) );
***************
*** 357,361 ****
}
! StaticsIterator Maps::staticsIterator( const Coord_cl& p, bool exact /* = true */ ) throw (wpException)
{
return staticsIterator( p.map, p.x, p.y, exact );
--- 412,416 ----
}
! StaticsIterator Maps::staticsIterator( const Coord_cl& p, bool exact /* = true */ ) const throw (wpException)
{
return staticsIterator( p.map, p.x, p.y, exact );
***************
*** 390,395 ****
baseY = y / 8;
pos = 0;
!
! load(d, x, y, exact);
}
--- 445,451 ----
baseY = y / 8;
pos = 0;
!
! if ( baseX < d->width && baseY < d->height )
! load(d, x, y, exact);
}
Index: maps.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/maps.h,v
retrieving revision 1.7
retrieving revision 1.8
diff -C2 -d -r1.7 -r1.8
*** maps.h 29 Aug 2003 17:58:58 -0000 1.7
--- maps.h 22 Jan 2004 04:48:12 -0000 1.8
***************
*** 118,129 ****
bool hasMap( uint id ) const;
signed char mapElevation( const Coord_cl& p ) const;
! signed char mapAverageElevation( const Coord_cl& p ) const;
signed char dynamicElevation(const Coord_cl& pos) const;
signed char height(const Coord_cl& pos);
uint mapTileWidth( uint ) const;
uint mapTileHeight( uint ) const;
! signed char staticTop(const Coord_cl& pos);
! StaticsIterator staticsIterator( uint id, ushort x, ushort y, bool exact = true ) throw( wpException );
! StaticsIterator staticsIterator( const Coord_cl&, bool exact = true ) throw( wpException );
};
--- 118,130 ----
bool hasMap( uint id ) const;
signed char mapElevation( const Coord_cl& p ) const;
! signed char mapAverageElevation( const Coord_cl& p, int* top = 0, int* botton = 0 ) const;
signed char dynamicElevation(const Coord_cl& pos) const;
signed char height(const Coord_cl& pos);
uint mapTileWidth( uint ) const;
uint mapTileHeight( uint ) const;
! signed char staticTop(const Coord_cl& pos) const;
! bool canFit( int x, int y, int z, int map, int height ) const;
! StaticsIterator staticsIterator( uint id, ushort x, ushort y, bool exact = true ) const throw( wpException );
! StaticsIterator staticsIterator( const Coord_cl&, bool exact = true ) const throw( wpException );
};
Index: npc.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/npc.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -C2 -d -r1.53 -r1.54
*** npc.cpp 8 Jan 2004 08:33:38 -0000 1.53
--- npc.cpp 22 Jan 2004 04:48:12 -0000 1.54
***************
*** 52,56 ****
#include "walking.h"
#include "skills.h"
! #include "ai.h"
#include "inlines.h"
#include "basics.h"
--- 52,56 ----
#include "walking.h"
#include "skills.h"
! #include "ai/ai.h"
#include "inlines.h"
#include "basics.h"
Index: scriptmanager.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/scriptmanager.cpp,v
retrieving revision 1.9
retrieving revision 1.10
diff -C2 -d -r1.9 -r1.10
*** scriptmanager.cpp 14 Jan 2004 04:55:39 -0000 1.9
--- scriptmanager.cpp 22 Jan 2004 04:48:12 -0000 1.10
***************
*** 4,8 ****
// UO Server Emulation Program
//
! // Copyright 2001-2003 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
--- 4,8 ----
// 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
Index: speech.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/speech.cpp,v
retrieving revision 1.160
retrieving revision 1.161
diff -C2 -d -r1.160 -r1.161
*** speech.cpp 23 Sep 2003 23:55:24 -0000 1.160
--- speech.cpp 22 Jan 2004 04:48:12 -0000 1.161
***************
*** 51,55 ****
#include "npc.h"
#include "chars.h"
! #include "ai.h"
#include "world.h"
#include "inlines.h"
--- 51,55 ----
#include "npc.h"
#include "chars.h"
! #include "ai/ai.h"
#include "world.h"
#include "inlines.h"
***************
*** 417,421 ****
}
! bool BankerSpeech( cUOSocket *socket, P_PLAYER pPlayer, P_CHAR pBanker, const QString& comm )
{
// Needs to be a banker
--- 417,421 ----
}
! bool BankerSpeech( cUOSocket *socket, P_PLAYER pPlayer, P_NPC pBanker, const QString& comm )
{
// Needs to be a banker
***************
*** 423,426 ****
--- 423,429 ----
return false;*/
+ if ( pBanker->ai()->name() != "Banker")
+ return false;
+
if( pPlayer->dist(pBanker) > 6 )
return false;
***************
*** 442,446 ****
}
! bool TrainerSpeech( cUOSocket *socket, P_CHAR pPlayer, P_CHAR pTrainer, const QString& comm )
{
/* if( pPlayer->dist( pTrainer ) > 3 || !pTrainer->isHuman() )
--- 445,449 ----
}
! bool TrainerSpeech( cUOSocket *socket, P_CHAR pPlayer, P_NPC pTrainer, const QString& comm )
{
/* if( pPlayer->dist( pTrainer ) > 3 || !pTrainer->isHuman() )
Index: srvparams.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/srvparams.cpp,v
retrieving revision 1.91
retrieving revision 1.92
diff -C2 -d -r1.91 -r1.92
*** srvparams.cpp 20 Sep 2003 12:01:43 -0000 1.91
--- srvparams.cpp 22 Jan 2004 04:48:12 -0000 1.92
***************
*** 157,161 ****
saveSpawns_ = getBool("General", "Save Spawned Regions", true, true);
lootdecayswithcorpse_ = getBool("General", "Loot Decays With Corpse", true, true);
! invisTimer_ = getDouble("General", "InvisTimer", 60, true);
poisonTimer_ = getNumber("General", "PoisonTimer", 180, true);
hungerDamage_ = getNumber("General", "Hunger Damage", 0, true);
--- 157,161 ----
saveSpawns_ = getBool("General", "Save Spawned Regions", true, true);
lootdecayswithcorpse_ = getBool("General", "Loot Decays With Corpse", true, true);
! invisTimer_ = getDouble("General", "InvisTimer", 60, true);
poisonTimer_ = getNumber("General", "PoisonTimer", 180, true);
hungerDamage_ = getNumber("General", "Hunger Damage", 0, true);
Index: targetrequests.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/targetrequests.h,v
retrieving revision 1.48
retrieving revision 1.49
diff -C2 -d -r1.48 -r1.49
*** targetrequests.h 23 Nov 2003 03:46:22 -0000 1.48
--- targetrequests.h 22 Jan 2004 04:48:12 -0000 1.49
***************
*** 44,48 ****
#include "tilecache.h"
#include "npc.h"
! #include "ai.h"
--- 44,48 ----
#include "tilecache.h"
#include "npc.h"
! #include "ai/ai.h"
Index: tilecache.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/tilecache.h,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** tilecache.h 12 Jan 2003 18:11:32 -0000 1.13
--- tilecache.h 22 Jan 2004 04:48:12 -0000 1.14
***************
*** 89,92 ****
--- 89,94 ----
char unknown2;
char name[20];
+
+ bool isBlocking() const { return flag1 & 0x40; }
};
Index: tmpeff.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/tmpeff.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -C2 -d -r1.66 -r1.67
*** tmpeff.cpp 23 Nov 2003 15:09:45 -0000 1.66
--- tmpeff.cpp 22 Jan 2004 04:48:12 -0000 1.67
***************
*** 49,53 ****
#include "player.h"
#include "npc.h"
! #include "ai.h"
#include "basics.h"
#include "world.h"
--- 49,53 ----
#include "player.h"
#include "npc.h"
! #include "ai/ai.h"
#include "basics.h"
#include "world.h"
Index: uobject.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/uobject.cpp,v
retrieving revision 1.121
retrieving revision 1.122
diff -C2 -d -r1.121 -r1.122
*** uobject.cpp 12 Jan 2004 20:33:15 -0000 1.121
--- uobject.cpp 22 Jan 2004 04:48:12 -0000 1.122
***************
*** 4,9 ****
// UO Server Emulation Program
//
! // Copyright 1997, 98 by Marcus Rating (Cironian)
! // Copyright 2001-2003 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
--- 4,8 ----
// 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
***************
*** 101,104 ****
--- 100,106 ----
}
+ /*!
+ Returns the distance between this object and \a d
+ */
unsigned int cUObject::dist(cUObject* d) const
{
***************
*** 232,236 ****
}
! // Checks if the object has a specific event
bool cUObject::hasEvent( const QString& name ) const
{
--- 234,241 ----
}
! /*!
! Checks if the object has a specific event \a name
! \sa addEvent
! */
bool cUObject::hasEvent( const QString& name ) const
{
***************
*** 249,252 ****
--- 254,260 ----
}
+ /*!
+ Adds an event handler to this object
+ */
void cUObject::addEvent( cPythonScript *Event )
{
***************
*** 324,352 ****
}
- /****************************
- *
- * Scripting events
- *
- ****************************/
- bool cUObject::onCreate( const QString &definition )
- {
- cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_CREATE );
- bool result = false;
-
- if( scriptChain || global )
- {
- PyObject *args = Py_BuildValue( "O&s", PyGetObjectObject, this, definition.latin1() );
-
- result = cPythonScript::callChainedEventHandler( EVENT_SHOWTOOLTIP, scriptChain, args );
-
- if( !result && global )
- result = global->callEventHandler( EVENT_CREATE, args );
-
- Py_DECREF( args );
- }
-
- return result;
- }
-
// If the scripts are reloaded call that for each and every existing object
void cUObject::recreateEvents()
--- 332,335 ----
***************
*** 405,409 ****
name_ = Value;
}
-
//<direction>SE</direction>
else if( TagName == "direction" )
--- 388,391 ----
***************
*** 734,735 ****
--- 716,741 ----
}
+ /****************************
+ *
+ * Scripting events
+ *
+ ****************************/
+ bool cUObject::onCreate( const QString &definition )
+ {
+ cPythonScript *global = ScriptManager::instance()->getGlobalHook( EVENT_CREATE );
+ bool result = false;
+
+ if( scriptChain || global )
+ {
+ PyObject *args = Py_BuildValue( "O&s", PyGetObjectObject, this, definition.latin1() );
+
+ result = cPythonScript::callChainedEventHandler( EVENT_SHOWTOOLTIP, scriptChain, args );
+
+ if( !result && global )
+ result = global->callEventHandler( EVENT_CREATE, args );
+
+ Py_DECREF( args );
+ }
+
+ return result;
+ }
Index: wolf.dsp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolf.dsp,v
retrieving revision 1.244
retrieving revision 1.245
diff -C2 -d -r1.244 -r1.245
*** wolf.dsp 18 Dec 2003 13:27:16 -0000 1.244
--- wolf.dsp 22 Jan 2004 04:48:12 -0000 1.245
***************
*** 77,81 ****
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
! # ADD LINK32 kernel32.lib user32.lib gdi32.lib ole32.lib advapi32.lib ws2_32.lib $(QTDIR)\lib\qt-mt321.lib shell32.lib /nologo /version:12.9 /subsystem:windows /incremental:no /map /debug /machine:I386 /out:"..\wolfpack.exe" /pdbtype:sept
# SUBTRACT LINK32 /pdb:none
--- 77,81 ----
LINK32=link.exe
# ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept
! # ADD LINK32 kernel32.lib user32.lib gdi32.lib ole32.lib advapi32.lib ws2_32.lib $(QTDIR)\lib\qt-mt323.lib shell32.lib /nologo /version:12.9 /subsystem:windows /incremental:no /map /debug /machine:I386 /out:"..\wolfpack.exe" /pdbtype:sept /fixed:no
# SUBTRACT LINK32 /pdb:none
Index: wolfpack.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolfpack.cpp,v
retrieving revision 1.479
retrieving revision 1.480
diff -C2 -d -r1.479 -r1.480
*** wolfpack.cpp 21 Jan 2004 05:05:41 -0000 1.479
--- wolfpack.cpp 22 Jan 2004 04:48:12 -0000 1.480
***************
*** 30,34 ****
#include "accounts.h"
! #include "ai.h"
#include "basedef.h"
#include "basics.h"
--- 30,34 ----
#include "accounts.h"
! #include "ai/ai.h"
#include "basedef.h"
#include "basics.h"
--- ai.cpp DELETED ---
--- ai.h DELETED ---
--- ai_animals.cpp DELETED ---
--- ai_humans.cpp DELETED ---
--- ai_monsters.cpp DELETED ---
|