Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv7529
Modified Files:
ChangeLog basics.cpp basics.h commands.cpp definable.cpp
gumps.cpp npc.cpp spawnregions.cpp spawnregions.h uobject.cpp
world.cpp
Log Message:
huge spawnregion changes
Index: basics.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basics.h,v
retrieving revision 1.36
retrieving revision 1.37
diff -C2 -d -r1.36 -r1.37
*** basics.h 22 Aug 2004 12:37:31 -0000 1.36
--- basics.h 2 Oct 2004 22:15:49 -0000 1.37
***************
*** 45,49 ****
int rollDice( const QString& dicePattern );
! bool parseCoordinates( const QString& input, Coord_cl& coord );
int RandomNum( int nLowNum, int nHighNum );
--- 45,49 ----
int rollDice( const QString& dicePattern );
! bool parseCoordinates( const QString& input, Coord_cl& coord, bool ignoreZ = false );
int RandomNum( int nLowNum, int nHighNum );
Index: uobject.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/uobject.cpp,v
retrieving revision 1.188
retrieving revision 1.189
diff -C2 -d -r1.188 -r1.189
*** uobject.cpp 1 Oct 2004 15:15:56 -0000 1.188
--- uobject.cpp 2 Oct 2004 22:15:51 -0000 1.189
***************
*** 781,785 ****
if the object wasn't spawned or removed from the spawnregion.
*/
! PY_PROPERTY( "spawnregion", spawnregion_ ? spawnregion_->name() : QString() )
PY_PROPERTY( "serial", serial_ )
PY_PROPERTY( "free", free ? 1 : 0 )
--- 781,785 ----
if the object wasn't spawned or removed from the spawnregion.
*/
! PY_PROPERTY( "spawnregion", spawnregion_ ? spawnregion_->id() : QString() )
PY_PROPERTY( "serial", serial_ )
PY_PROPERTY( "free", free ? 1 : 0 )
***************
*** 1102,1106 ****
if (spawnregion_) {
writer.writeByte(0xFA);
! writer.writeUtf8(spawnregion_->name());
writer.writeInt(serial_);
}
--- 1102,1106 ----
if (spawnregion_) {
writer.writeByte(0xFA);
! writer.writeUtf8(spawnregion_->id());
writer.writeInt(serial_);
}
Index: commands.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/commands.cpp,v
retrieving revision 1.264
retrieving revision 1.265
diff -C2 -d -r1.264 -r1.265
*** commands.cpp 1 Oct 2004 23:26:37 -0000 1.264
--- commands.cpp 2 Oct 2004 22:15:49 -0000 1.265
***************
*** 330,339 ****
if ( !spawnRegion )
{
! socket->sysMessage( tr( "Spawnregion %1 does not exist" ).arg( args[1] ) );
}
else
{
spawnRegion->reSpawn();
! socket->sysMessage( tr( "Spawnregion '%1' has respawned" ).arg( args[1] ) );
}
}
--- 330,343 ----
if ( !spawnRegion )
{
! if ( !SpawnRegions::instance()->reSpawnGroup( args[1] ) ) {
! socket->sysMessage( tr( "Spawnregion %1 does not exist." ).arg( args[1] ) );
! } else {
! socket->sysMessage( tr( "Spawnregion group '%1' has respawned." ).arg( args[1] ) );
! }
}
else
{
spawnRegion->reSpawn();
! socket->sysMessage( tr( "Spawnregion '%1' has respawned." ).arg( args[1] ) );
}
}
***************
*** 341,345 ****
{
SpawnRegions::instance()->reSpawn();
! socket->sysMessage( tr( "All spawnregions have respawned" ) );
}
}
--- 345,349 ----
{
SpawnRegions::instance()->reSpawn();
! socket->sysMessage( tr( "All spawnregions have respawned." ) );
}
}
***************
*** 357,366 ****
if ( !spawnRegion )
{
! socket->sysMessage( tr( "Spawnregion %1 does not exist" ).arg( args[1] ) );
}
else
{
spawnRegion->deSpawn();
! socket->sysMessage( tr( "Spawnregion '%1' has been cleared" ).arg( args[1] ) );
}
}
--- 361,374 ----
if ( !spawnRegion )
{
! if ( !SpawnRegions::instance()->deSpawnGroup(args[1])) {
! socket->sysMessage( tr( "Spawnregion %1 does not exist." ).arg( args[1] ) );
! } else {
! socket->sysMessage( tr( "Spawnregion group '%1' has been cleared." ).arg( args[1] ) );
! }
}
else
{
spawnRegion->deSpawn();
! socket->sysMessage( tr( "Spawnregion '%1' has been cleared." ).arg( args[1] ) );
}
}
***************
*** 368,372 ****
{
SpawnRegions::instance()->deSpawn();
! socket->sysMessage( tr( "All spawnregions have been cleared" ) );
}
}
--- 376,380 ----
{
SpawnRegions::instance()->deSpawn();
! socket->sysMessage( tr( "All spawnregions have been cleared." ) );
}
}
***************
*** 384,393 ****
if ( !spawnRegion )
{
! socket->sysMessage( tr( "Spawnregion %1 does not exist" ).arg( args[1] ) );
}
else
{
spawnRegion->reSpawnToMax();
! socket->sysMessage( tr( "Spawnregion '%1' has respawned to maximum" ).arg( args[1] ) );
}
}
--- 392,405 ----
if ( !spawnRegion )
{
! if (!SpawnRegions::instance()->reSpawnToMaxGroup( args[1] ) ) {
! socket->sysMessage( tr( "Spawnregion %1 does not exist." ).arg( args[1] ) );
! } else {
! socket->sysMessage( tr( "Spawnregion group '%1' has been filled." ).arg( args[1] ) );
! }
}
else
{
spawnRegion->reSpawnToMax();
! socket->sysMessage( tr( "Spawnregion '%1' has been filled." ).arg( args[1] ) );
}
}
***************
*** 395,399 ****
{
SpawnRegions::instance()->reSpawnToMax();
! socket->sysMessage( tr( "All spawnregions have respawned to maximum" ) );
}
}
--- 407,411 ----
{
SpawnRegions::instance()->reSpawnToMax();
! socket->sysMessage( tr( "All spawnregions have respawned to maximum." ) );
}
}
Index: basics.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basics.cpp,v
retrieving revision 1.40
retrieving revision 1.41
diff -C2 -d -r1.40 -r1.41
*** basics.cpp 22 Aug 2004 12:37:31 -0000 1.40
--- basics.cpp 2 Oct 2004 22:15:49 -0000 1.41
***************
*** 97,106 ****
}
! bool parseCoordinates( const QString& input, Coord_cl& coord )
{
QStringList coords = QStringList::split( ",", input );
// We at least need x, y, z
! if ( coords.size() < 3 )
return false;
--- 97,106 ----
}
! bool parseCoordinates( const QString& input, Coord_cl& coord, bool ignoreZ )
{
QStringList coords = QStringList::split( ",", input );
// We at least need x, y, z
! if ( coords.size() < (ignoreZ ? 2 : 3) )
return false;
***************
*** 115,121 ****
return false;
! Q_INT8 z = coords[2].toShort( &ok );
! if ( !ok )
! return false;
Q_UINT8 map = coord.map; // Current by default
--- 115,124 ----
return false;
! Q_INT8 z = 0;
! if (!ignoreZ) {
! z = coords[2].toShort( &ok );
! if ( !ok )
! return false;
! }
Q_UINT8 map = coord.map; // Current by default
Index: ChangeLog
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ChangeLog,v
retrieving revision 1.92
retrieving revision 1.93
diff -C2 -d -r1.92 -r1.93
*** ChangeLog 2 Oct 2004 09:59:51 -0000 1.92
--- ChangeLog 2 Oct 2004 22:15:49 -0000 1.93
***************
*** 22,25 ****
--- 22,28 ----
- Fixed documentation for the socket object.
- Changed some return values from true to none for socket methods.
+ - Spawnregions have been rewritten for more speed and functionality.
+ Because of that the format changed, please hop on irc and ask for details if you want
+ to convert your scripts.
Wolfpack 12.9.11 Beta (26. September 2004)
Index: spawnregions.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/spawnregions.cpp,v
retrieving revision 1.70
retrieving revision 1.71
diff -C2 -d -r1.70 -r1.71
*** spawnregions.cpp 1 Oct 2004 22:30:43 -0000 1.70
--- spawnregions.cpp 2 Oct 2004 22:15:50 -0000 1.71
***************
*** 43,56 ****
#include "scriptmanager.h"
#include "python/pyspawnregion.h"
using namespace std;
/*****************************************************************************
cSpawnRegion member functions
*****************************************************************************/
! void cSpawnRegion::init( void )
[...969 lines suppressed...]
{
! if ( !objects.contains( region->name() ) )
{
! objects[region->name()].setAutoDelete( false );
}
! objects[region->name()].append( pChar );
pChar->setSpawnregion( 0 ); // Remove from spawnregion before pointer gets invalid
}
--- 865,874 ----
if ( region )
{
! if ( !objects.contains( region->id() ) )
{
! objects[region->id()].setAutoDelete( false );
}
! objects[region->id()].append( pChar );
pChar->setSpawnregion( 0 ); // Remove from spawnregion before pointer gets invalid
}
Index: spawnregions.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/spawnregions.h,v
retrieving revision 1.30
retrieving revision 1.31
diff -C2 -d -r1.30 -r1.31
*** spawnregions.h 1 Oct 2004 22:30:44 -0000 1.30
--- spawnregions.h 2 Oct 2004 22:15:51 -0000 1.31
***************
*** 36,53 ****
#include <map>
! class cSpawnRegion : public cBaseRegion
! {
! OBJECTDEF(cSpawnRegion)
public:
! cSpawnRegion( const cElement* Tag )
! {
! this->init();
! this->name_ = Tag->getAttribute( "id" );
! this->applyDefinition( Tag );
! npcs_.setAutoDelete( false );
! items_.setAutoDelete( false );
}
! void init( void );
// Manage spawned objects
--- 36,57 ----
#include <map>
! // Abstract class for spawn position
! class cSpawnPosition {
! protected:
! unsigned int points_; // The number of points
public:
! virtual unsigned int points() {
! return points_;
}
! virtual Coord_cl findSpot() = 0;
! virtual bool inBounds(const Coord_cl &pos) = 0;
! };
!
! class cSpawnRegion : public cDefinable {
! OBJECTDEF(cSpawnRegion)
! public:
! cSpawnRegion(const cElement* tag);
! ~cSpawnRegion();
// Manage spawned objects
***************
*** 60,78 ****
void checkTimer( void );
! bool findValidSpot( Coord_cl& pos );
// Getters
! QString name( void ) const
! {
! return name_;
}
! unsigned int npcs( void ) const
! {
return npcs_.count();
}
! unsigned int items( void ) const
! {
return items_.count();
}
--- 64,81 ----
void checkTimer( void );
! unsigned int countPoints();
! bool isValidSpot( Coord_cl& pos );
! bool findValidSpot( Coord_cl& pos, int tries = -1 );
// Getters
! const QString &id() const {
! return id_;
}
! unsigned int npcs( void ) const {
return npcs_.count();
}
! unsigned int items( void ) const {
return items_.count();
}
***************
*** 88,101 ****
}
- QStringList npcSections() const
- {
- return npcSections_;
- }
-
- QStringList itemSections() const
- {
- return itemSections_;
- }
-
QPtrList<cUObject> spawnedItems() const
{
--- 91,94 ----
***************
*** 108,122 ****
}
! QStringList rectangles( void )
! {
! QStringList rectList;
! QValueVector<rect_st>::iterator it = this->rectangles_.begin();
! while ( it != this->rectangles_.end() )
! {
! QString rect = QString( "%1,%2->%3,%4" ).arg( ( *it ).x1 ).arg( ( *it ).y1 ).arg( ( *it ).x2 ).arg( ( *it ).y2 );
! rectList.push_back( rect );
! ++it;
! }
! return rectList;
}
--- 101,110 ----
}
! const QStringList &groups() const {
! return groups_;
! }
!
! bool active() const {
! return active_;
}
***************
*** 132,140 ****
private:
! QPtrList<cUObject> items_;
! QPtrList<cUObject> npcs_;
! QStringList npcSections_; // list of npc's sections
! QStringList itemSections_; // list of item's sections
UI16 maxNpcAmt_; // Max amount of characters to spawn
--- 120,140 ----
private:
! QString id_; // Spawnregion id
! QStringList groups_; // Spawngroups
! bool active_; // Is this spawnregion active?
! QPtrList<cSpawnPosition> positions_; // Spawn positions
!
! bool checkFreeSpot_; // The target spot has to be free.
!
! QPtrList<cUObject> items_; // List of spawned items
! QPtrList<cUObject> npcs_; // List of spawned npcs
!
! QPtrList<cElement> itemNodes_; // Pointers to definition elements for NPCs
! QPtrList<cElement> npcNodes_; // Pointers to definition elements for Items
! QValueList<unsigned int> itemNodeFrequencies_; // Frequencies for item nodes
! QValueList<unsigned int> npcNodeFrequencies_; // Frequencies for npc nodes
! unsigned int npcNodesTotal_; // The total spawn frequency value. Speedup property.
! unsigned int itemNodesTotal_; // The total spawn frequency value. Speedup property.
UI16 maxNpcAmt_; // Max amount of characters to spawn
***************
*** 147,152 ****
UI32 maxTime_; // Maximum spawn time in sec
UI32 nextTime_; // Next time for this region to spawn
-
- QValueVector<UI08> z_; // Height, if not specified, z will be chosen
};
--- 147,150 ----
***************
*** 163,168 ****
--- 161,169 ----
void reSpawn( void );
+ bool reSpawnGroup( const QString &group );
void reSpawnToMax( void );
+ bool reSpawnToMaxGroup( const QString &group );
void deSpawn( void );
+ bool deSpawnGroup( const QString &group );
UI16 npcs( void )
Index: gumps.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/gumps.cpp,v
retrieving revision 1.171
retrieving revision 1.172
diff -C2 -d -r1.171 -r1.172
*** gumps.cpp 19 Aug 2004 01:22:51 -0000 1.171
--- gumps.cpp 2 Oct 2004 22:15:50 -0000 1.172
***************
*** 124,131 ****
if ( region )
{
! QStringList allrectangles = region->rectangles();
!
uint page_ = 0;
! uint numrects = allrectangles.size();
uint pages = ( ( uint ) ceil( ( double ) numrects / 10.0f ) );
--- 124,131 ----
if ( region )
{
! /*QStringList allrectangles = region->rectangles();
! */
uint page_ = 0;
! uint numrects = 0; /*allrectangles.size();*/
uint pages = ( ( uint ) ceil( ( double ) numrects / 10.0f ) );
***************
*** 138,150 ****
addText( 170, 90, tr( "Spawnregion Info" ), 0x530 );
// Give information about the spawnregion
! addText( 50, 120, tr( "Name: %1" ).arg( region->name() ), 0x834 );
addText( 50, 140, tr( "NPCs: %1 of %2" ).arg( region->npcs() ).arg( region->maxNpcs() ), 0x834 );
addText( 50, 160, tr( "Items: %1 of %2" ).arg( region->items() ).arg( region->maxItems() ), 0x834 );
! addText( 50, 180, tr( "Coordinates: %1" ).arg( allrectangles.size() ), 0x834 );
// OK button
addButton( 50, 410, 0xF9, 0xF8, 0 ); // Only Exit possible
! for ( page_ = 1; page_ <= pages; page_++ )
{
startPage( page_ );
--- 138,150 ----
addText( 170, 90, tr( "Spawnregion Info" ), 0x530 );
// Give information about the spawnregion
! addText( 50, 120, tr( "Name: %1" ).arg( region->id() ), 0x834 );
addText( 50, 140, tr( "NPCs: %1 of %2" ).arg( region->npcs() ).arg( region->maxNpcs() ), 0x834 );
addText( 50, 160, tr( "Items: %1 of %2" ).arg( region->items() ).arg( region->maxItems() ), 0x834 );
! //addText( 50, 180, tr( "Coordinates: %1" ).arg( allrectangles.size() ), 0x834 );
// OK button
addButton( 50, 410, 0xF9, 0xF8, 0 ); // Only Exit possible
! /*for ( page_ = 1; page_ <= pages; page_++ )
{
startPage( page_ );
***************
*** 176,180 ****
if ( page_ < pages ) // next page
addPageButton( 290, 410, 0x0FA, 0x0FA, page_ + 1 );
! }
}
}
--- 176,180 ----
if ( page_ < pages ) // next page
addPageButton( 290, 410, 0x0FA, 0x0FA, page_ + 1 );
! }*/
}
}
Index: definable.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/definable.cpp,v
retrieving revision 1.21
retrieving revision 1.22
diff -C2 -d -r1.21 -r1.22
*** definable.cpp 2 Jun 2004 15:04:04 -0000 1.21
--- definable.cpp 2 Oct 2004 22:15:50 -0000 1.22
***************
*** 47,50 ****
--- 47,52 ----
else if ( sectionNode->name() == "region" )
wpType = WPDT_REGION;
+ else if ( sectionNode->name() == "spawnregion" )
+ wpType = WPDT_SPAWNREGION;
const cElement* tInherit = Definitions::instance()->getDefinition( wpType, sectionNode->getAttribute( "inherit", "" ) );
Index: world.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/world.cpp,v
retrieving revision 1.132
retrieving revision 1.133
diff -C2 -d -r1.132 -r1.133
*** world.cpp 2 Oct 2004 00:28:47 -0000 1.132
--- world.cpp 2 Oct 2004 22:15:51 -0000 1.133
***************
*** 860,866 ****
gump.setNoClose( true );
gump.setNoDispose( true );
! gump.setNoMove( true );
! gump.setX( -10 );
! gump.setY( -10 );
gump.setType( 0x98FA2C10 );
--- 860,866 ----
gump.setNoClose( true );
gump.setNoDispose( true );
! gump.setNoMove( false );
! gump.setX( 150 );
! gump.setY( 150 );
gump.setType( 0x98FA2C10 );
***************
*** 976,980 ****
if ( pItem->spawnregion() )
{
! QString name = PersistentBroker::instance()->quoteString( pItem->spawnregion()->name() );
QString query = QString( "INSERT INTO spawnregions VALUES('%1',%2);" ).arg( name ).arg( pItem->serial() );
PersistentBroker::instance()->executeQuery( query );
--- 976,980 ----
if ( pItem->spawnregion() )
{
! QString name = PersistentBroker::instance()->quoteString( pItem->spawnregion()->id() );
QString query = QString( "INSERT INTO spawnregions VALUES('%1',%2);" ).arg( name ).arg( pItem->serial() );
PersistentBroker::instance()->executeQuery( query );
***************
*** 989,993 ****
if ( pChar->spawnregion() )
{
! QString name = PersistentBroker::instance()->quoteString( pChar->spawnregion()->name() );
QString query = QString( "INSERT INTO spawnregions VALUES('%1',%2);" ).arg( name ).arg( pChar->serial() );
PersistentBroker::instance()->executeQuery( query );
--- 989,993 ----
if ( pChar->spawnregion() )
{
! QString name = PersistentBroker::instance()->quoteString( pChar->spawnregion()->id() );
QString query = QString( "INSERT INTO spawnregions VALUES('%1',%2);" ).arg( name ).arg( pChar->serial() );
PersistentBroker::instance()->executeQuery( query );
Index: npc.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/npc.cpp,v
retrieving revision 1.117
retrieving revision 1.118
diff -C2 -d -r1.117 -r1.118
*** npc.cpp 28 Sep 2004 09:48:52 -0000 1.117
--- npc.cpp 2 Oct 2004 22:15:50 -0000 1.118
***************
*** 1414,1417 ****
--- 1414,1418 ----
pChar->setOrgBody( pChar->body() );
pChar->setOrgSkin( pChar->skin() );
+ pChar->setOrgName( pChar->name() );
// Now we call onCreate
|