Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23127
Modified Files:
npc.cpp player.cpp spawnregions.cpp territories.cpp
uobject.cpp world.cpp
Log Message:
More fixes
Index: territories.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/territories.cpp,v
retrieving revision 1.59
retrieving revision 1.60
diff -C2 -d -r1.59 -r1.60
*** territories.cpp 3 Nov 2004 02:09:28 -0000 1.59
--- territories.cpp 3 Nov 2004 14:45:47 -0000 1.60
***************
*** 382,386 ****
if (rSource) {
rSource->addTeleporter(clSource, clDestination); // Add the teleportation spot
! } else {
Console::instance()->log(LOG_WARNING, tr("Couldn't find source region for teleporter at %1.").arg(source));
}
--- 382,386 ----
if (rSource) {
rSource->addTeleporter(clSource, clDestination); // Add the teleportation spot
! } else if(Maps::instance()->hasMap(clSource.map)) {
Console::instance()->log(LOG_WARNING, tr("Couldn't find source region for teleporter at %1.").arg(source));
}
***************
*** 392,396 ****
if (rDestination) {
rDestination->addTeleporter(clDestination, clSource); // Add the teleportation spot
! } else {
Console::instance()->log(LOG_WARNING, tr("Couldn't find destination region for two-way teleporter at %1.").arg(destination));
}
--- 392,396 ----
if (rDestination) {
rDestination->addTeleporter(clDestination, clSource); // Add the teleportation spot
! } else if(Maps::instance()->hasMap(clDestination.map)) {
Console::instance()->log(LOG_WARNING, tr("Couldn't find destination region for two-way teleporter at %1.").arg(destination));
}
Index: uobject.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/uobject.cpp,v
retrieving revision 1.191
retrieving revision 1.192
diff -C2 -d -r1.191 -r1.192
*** uobject.cpp 3 Nov 2004 13:51:11 -0000 1.191
--- uobject.cpp 3 Nov 2004 14:45:47 -0000 1.192
***************
*** 133,136 ****
--- 133,138 ----
{
// place the object onto the map
+ pos_ = newpos; // This is required since MapObjects transparently checks
+ // for objects->pos()
MapObjects::instance()->add( this );
}
Index: player.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/player.cpp,v
retrieving revision 1.141
retrieving revision 1.142
diff -C2 -d -r1.141 -r1.142
*** player.cpp 3 Nov 2004 02:09:26 -0000 1.141
--- player.cpp 3 Nov 2004 14:45:47 -0000 1.142
***************
*** 102,124 ****
void cPlayer::postload( unsigned int version )
{
! // account removed?
! if( account() == 0 )
! {
! // we need to remove the equipment here.
! cBaseChar::ItemContainer::const_iterator it;
! for( it = content_.begin(); it != content_.end(); ++it )
! {
! P_ITEM item = *it;
! if( !item )
! continue;
! item->remove();
! }
! del();
return;
}
-
- cBaseChar::postload( version );
- MapObjects::instance()->add( this );
}
--- 102,114 ----
void cPlayer::postload( unsigned int version )
{
! cBaseChar::postload( version );
! MapObjects::instance()->add( this );
! // account removed?
! if( account() == 0 ) {
! Console::instance()->log(LOG_WARNING, tr("Removing player %1 (0x%2) because of missing account.\n").arg(orgName_).arg(serial_, 0, 16));
! remove();
return;
}
}
Index: world.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/world.cpp,v
retrieving revision 1.137
retrieving revision 1.138
diff -C2 -d -r1.137 -r1.138
*** world.cpp 3 Nov 2004 02:09:29 -0000 1.137
--- world.cpp 3 Nov 2004 14:45:48 -0000 1.138
***************
*** 438,441 ****
--- 438,444 ----
unsigned int lastpercent = 0;
unsigned int percent = 0;
+ QPtrList<cUObject> invalidSpawnregion;
+ invalidSpawnregion.setAutoDelete(false);
+
do
{
***************
*** 510,514 ****
object->setSpawnregion(region);
} else if (object) {
! object->remove();
}
}
--- 513,517 ----
object->setSpawnregion(region);
} else if (object) {
! invalidSpawnregion.append(object);
}
}
***************
*** 555,563 ****
// post process all loaded objects
QPtrList<PersistentObject>::const_iterator cit(objects.begin());
-
while (cit != objects.end()) {
(*cit)->postload(reader.version());
++cit;
}
}
--- 558,575 ----
// post process all loaded objects
QPtrList<PersistentObject>::const_iterator cit(objects.begin());
while (cit != objects.end()) {
(*cit)->postload(reader.version());
++cit;
}
+
+ // Delete all objects with an invalid spawnregion
+ QPtrList<cUObject>::const_iterator sit(invalidSpawnregion.begin());
+ while (sit != invalidSpawnregion.end()) {
+ (*sit)->remove();
+ ++sit;
+ }
+
+ // Flush the delete queue
+ p->purgePendingObjects();
}
Index: spawnregions.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/spawnregions.cpp,v
retrieving revision 1.83
retrieving revision 1.84
diff -C2 -d -r1.83 -r1.84
*** spawnregions.cpp 3 Nov 2004 13:51:10 -0000 1.83
--- spawnregions.cpp 3 Nov 2004 14:45:47 -0000 1.84
***************
*** 506,509 ****
--- 506,511 ----
void cSpawnRegion::spawnSingleNPC()
{
+ unsigned int pointCount = countPoints();
+
Coord pos;
if ( findValidSpot( pos ) )
***************
*** 562,566 ****
// Apply these settings between the inherited npc and the custom settings in the spawnregion
// file
! if (countPoints() == 1) {
pChar->setWanderType( enHalt ); // Most likely a vendor spawn with only one point
pChar->setWanderX1( pos.x );
--- 564,568 ----
// Apply these settings between the inherited npc and the custom settings in the spawnregion
// file
! if (pointCount == 1) {
pChar->setWanderType( enHalt ); // Most likely a vendor spawn with only one point
pChar->setWanderX1( pos.x );
***************
*** 585,590 ****
pChar->resend(false); // Resend the NPC
onSpawn( pChar ); // Call the onSpawn event
! } else {
! Console::instance()->log(LOG_ERROR, tr("Unable to find valid spot for spawnregion %1.\n").arg(id_));
}
}
--- 587,594 ----
pChar->resend(false); // Resend the NPC
onSpawn( pChar ); // Call the onSpawn event
!
! // Only warn if there is only ONE spot
! } else if(pointCount <= 1) {
! Console::instance()->log(LOG_WARNING, tr("Unable to find valid spot for spawnregion %1.\n").arg(id_));
}
}
***************
*** 592,596 ****
--- 596,602 ----
void cSpawnRegion::spawnSingleItem()
{
+ unsigned int pointCount = countPoints();
Coord pos;
+
if ( findValidSpot( pos ) )
{
***************
*** 653,656 ****
--- 659,664 ----
pItem->update(); // Resend the NPC
onSpawn( pItem ); // Call the onSpawn event
+ } else if(pointCount <= 1) {
+ Console::instance()->log(LOG_WARNING, tr("Unable to find valid spot for spawnregion %1.\n").arg(id_));
}
}
Index: npc.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/npc.cpp,v
retrieving revision 1.126
retrieving revision 1.127
diff -C2 -d -r1.126 -r1.127
*** npc.cpp 3 Nov 2004 02:09:26 -0000 1.126
--- npc.cpp 3 Nov 2004 14:45:47 -0000 1.127
***************
*** 1453,1457 ****
pChar->Init();
pChar->basedef_ = CharBaseDefs::instance()->get( section.latin1() );
! pChar->moveTo( pos );
pChar->applyDefinition( DefSection );
--- 1453,1457 ----
pChar->Init();
pChar->basedef_ = CharBaseDefs::instance()->get( section.latin1() );
! pChar->moveTo( pos, true );
pChar->applyDefinition( DefSection );
|