Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1:/tmp/cvs-serv26874
Modified Files:
ai.h ai_humans.cpp combat.cpp dragdrop.cpp items.cpp items.h
npc.h player.cpp spawnregions.cpp spawnregions.h
territories.cpp wolfpack.cpp world.cpp
Log Message:
spawn region fix for items,
spawn region registering loaded objects again,
npc saving fix,
guards
Index: ai.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ai.h,v
retrieving revision 1.19
retrieving revision 1.20
diff -C2 -d -r1.19 -r1.20
*** ai.h 20 Sep 2003 12:01:43 -0000 1.19
--- ai.h 23 Sep 2003 11:53:30 -0000 1.20
***************
*** 427,436 ****
};
! class Human_Guard_Fight : public AbstractAction
{
protected:
! Human_Guard_Fight() : AbstractAction() {}
public:
! Human_Guard_Fight( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ) {}
virtual void execute();
virtual float preCondition();
--- 427,436 ----
};
! class Human_Guard_Called_Fight : public AbstractAction
{
protected:
! Human_Guard_Called_Fight() : AbstractAction() {}
public:
! Human_Guard_Called_Fight( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ) {}
virtual void execute();
virtual float preCondition();
***************
*** 438,447 ****
};
! class Human_Guard_TeleToTarget : public AbstractAction
{
protected:
! Human_Guard_TeleToTarget() : AbstractAction() {}
public:
! Human_Guard_TeleToTarget( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ) {}
virtual void execute();
virtual float preCondition();
--- 438,447 ----
};
! class Human_Guard_Called_TeleToTarget : public AbstractAction
{
protected:
! Human_Guard_Called_TeleToTarget() : AbstractAction() {}
public:
! Human_Guard_Called_TeleToTarget( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ) {}
virtual void execute();
virtual float preCondition();
***************
*** 449,458 ****
};
! class Human_Guard_Disappear : public AbstractAction
{
protected:
! Human_Guard_Disappear() : AbstractAction() {}
public:
! Human_Guard_Disappear( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ) {}
virtual void execute();
virtual float preCondition();
--- 449,458 ----
};
! class Human_Guard_Called_Disappear : public AbstractAction
{
protected:
! Human_Guard_Called_Disappear() : AbstractAction() {}
public:
! Human_Guard_Called_Disappear( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ) {}
virtual void execute();
virtual float preCondition();
***************
*** 460,479 ****
};
! class Human_Guard : public AbstractAI
{
protected:
! Human_Guard() : AbstractAI()
{
notorityOverride_ = 1;
}
public:
! Human_Guard( P_NPC npc );
virtual void init( P_NPC npc );
static void registerInFactory();
! virtual QString name() { return "Human_Guard"; }
};
#endif /* AI_H_HEADER_INCLUDED */
--- 460,537 ----
};
! class cTerritory;
!
! class Human_Guard_Called : public AbstractAI
{
protected:
! Human_Guard_Called() : AbstractAI()
{
notorityOverride_ = 1;
}
+ cTerritory* region_;
+
public:
! Human_Guard_Called( P_NPC npc );
virtual void init( P_NPC npc );
static void registerInFactory();
! virtual QString name() { return "Human_Guard_Called"; }
! };
!
! class Human_Guard_Wander : public Action_Wander
! {
! protected:
! Human_Guard_Wander() : Action_Wander() {}
! public:
! Human_Guard_Wander( P_NPC npc, AbstractAI* ai ) : Action_Wander( npc, ai ) {}
! virtual float preCondition();
! virtual float postCondition();
! };
!
! class Human_Guard_MoveToTarget : public Action_Wander
! {
! protected:
! Human_Guard_MoveToTarget() : Action_Wander() {}
! public:
! Human_Guard_MoveToTarget( P_NPC npc, AbstractAI* ai ) : Action_Wander( npc, ai ) {}
! virtual void execute();
! virtual float preCondition();
! virtual float postCondition();
};
+ class Human_Guard_Fight : public AbstractAction
+ {
+ protected:
+ Human_Guard_Fight() : AbstractAction() {}
+ public:
+ Human_Guard_Fight( P_NPC npc, AbstractAI* ai ) : AbstractAction( npc, ai ) {}
+ virtual void execute();
+ virtual float preCondition();
+ virtual float postCondition();
+ };
+
+ class Human_Guard : public AbstractAI
+ {
+ protected:
+ Human_Guard() : AbstractAI(), m_currentVictim( NULL )
+ {
+ notorityOverride_ = 1;
+ }
+
+ public:
+ Human_Guard( P_NPC npc );
+
+ static void registerInFactory();
+ virtual QString name() { return "Human_Guard"; }
+
+ virtual void check();
+
+ P_CHAR currentVictim() const { return m_currentVictim; }
+ protected:
+ virtual void selectVictim();
+
+ P_CHAR m_currentVictim;
+ };
#endif /* AI_H_HEADER_INCLUDED */
Index: ai_humans.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ai_humans.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** ai_humans.cpp 20 Sep 2003 12:01:44 -0000 1.1
--- ai_humans.cpp 23 Sep 2003 11:53:30 -0000 1.2
***************
*** 224,246 ****
}
! static AbstractAI* productCreator_HG()
{
! return new Human_Guard( NULL );
}
! void Human_Guard::registerInFactory()
{
! AIFactory::instance()->registerType("Human_Guard", productCreator_HG);
}
! Human_Guard::Human_Guard( P_NPC npc ) : AbstractAI( npc )
{
notorityOverride_ = 1;
! m_actions.append( new Human_Guard_Fight( npc, this ) );
! m_actions.append( new Human_Guard_TeleToTarget( npc, this ) );
! m_actions.append( new Human_Guard_Disappear( npc, this ) );
}
! void Human_Guard::init( P_NPC npc )
{
npc->setSummonTime( uiCurrentTime + MY_CLOCKS_PER_SEC * SrvParams->guardDispelTime() );
--- 224,246 ----
}
! static AbstractAI* productCreator_HGC()
{
! return new Human_Guard_Called( NULL );
}
! void Human_Guard_Called::registerInFactory()
{
! AIFactory::instance()->registerType("Human_Guard_Called", productCreator_HGC);
}
! Human_Guard_Called::Human_Guard_Called( P_NPC npc ) : AbstractAI( npc )
{
notorityOverride_ = 1;
! m_actions.append( new Human_Guard_Called_Fight( npc, this ) );
! m_actions.append( new Human_Guard_Called_TeleToTarget( npc, this ) );
! m_actions.append( new Human_Guard_Called_Disappear( npc, this ) );
}
! void Human_Guard_Called::init( P_NPC npc )
{
npc->setSummonTime( uiCurrentTime + MY_CLOCKS_PER_SEC * SrvParams->guardDispelTime() );
***************
*** 248,252 ****
}
! void Human_Guard_Fight::execute()
{
// talk only in about every 10th check
--- 248,252 ----
}
! void Human_Guard_Called_Fight::execute()
{
// talk only in about every 10th check
***************
*** 262,266 ****
}
! float Human_Guard_Fight::preCondition()
{
if( m_npc->combatTarget() == INVALID_SERIAL )
--- 262,266 ----
}
! float Human_Guard_Called_Fight::preCondition()
{
if( m_npc->combatTarget() == INVALID_SERIAL )
***************
*** 268,272 ****
P_CHAR pTarget = World::instance()->findChar( m_npc->combatTarget() );
! if( !pTarget || pTarget->isDead() )
return 0.0f;
--- 268,272 ----
P_CHAR pTarget = World::instance()->findChar( m_npc->combatTarget() );
! if( !pTarget || pTarget->isDead() || pTarget->isInnocent() || pTarget->region() != m_npc->region() )
return 0.0f;
***************
*** 277,286 ****
}
! float Human_Guard_Fight::postCondition()
{
return 1.0f - preCondition();
}
! void Human_Guard_TeleToTarget::execute()
{
m_npc->setSummonTime( uiCurrentTime + MY_CLOCKS_PER_SEC * SrvParams->guardDispelTime() );
--- 277,286 ----
}
! float Human_Guard_Called_Fight::postCondition()
{
return 1.0f - preCondition();
}
! void Human_Guard_Called_TeleToTarget::execute()
{
m_npc->setSummonTime( uiCurrentTime + MY_CLOCKS_PER_SEC * SrvParams->guardDispelTime() );
***************
*** 298,302 ****
}
! float Human_Guard_TeleToTarget::preCondition()
{
if( m_npc->combatTarget() == INVALID_SERIAL )
--- 298,302 ----
}
! float Human_Guard_Called_TeleToTarget::preCondition()
{
if( m_npc->combatTarget() == INVALID_SERIAL )
***************
*** 304,308 ****
P_CHAR pTarget = World::instance()->findChar( m_npc->combatTarget() );
! if( !pTarget || pTarget->isDead() )
return 0.0f;
--- 304,308 ----
P_CHAR pTarget = World::instance()->findChar( m_npc->combatTarget() );
! if( !pTarget || pTarget->isDead() || pTarget->isInnocent() || pTarget->region() != m_npc->region() )
return 0.0f;
***************
*** 313,327 ****
}
! float Human_Guard_TeleToTarget::postCondition()
{
return 1.0f - preCondition();
}
! void Human_Guard_Disappear::execute()
{
// nothing to do
}
! float Human_Guard_Disappear::preCondition()
{
if( m_npc->combatTarget() == INVALID_SERIAL )
--- 313,327 ----
}
! float Human_Guard_Called_TeleToTarget::postCondition()
{
return 1.0f - preCondition();
}
! void Human_Guard_Called_Disappear::execute()
{
// nothing to do
}
! float Human_Guard_Called_Disappear::preCondition()
{
if( m_npc->combatTarget() == INVALID_SERIAL )
***************
*** 329,333 ****
P_CHAR pTarget = World::instance()->findChar( m_npc->combatTarget() );
! if( !pTarget || pTarget->isDead() )
return 1.0f;
--- 329,333 ----
P_CHAR pTarget = World::instance()->findChar( m_npc->combatTarget() );
! if( !pTarget || pTarget->isDead() || pTarget->isInnocent() || pTarget->region() != m_npc->region() )
return 1.0f;
***************
*** 335,341 ****
}
! float Human_Guard_Disappear::postCondition()
{
- // not really needed in this case, but necessary for the system ;)
return 1.0f - preCondition();
! }
\ No newline at end of file
--- 335,483 ----
}
! float Human_Guard_Called_Disappear::postCondition()
{
return 1.0f - preCondition();
! }
!
! static AbstractAI* productCreator_HG()
! {
! return new Human_Guard( NULL );
! }
!
! void Human_Guard::registerInFactory()
! {
! AIFactory::instance()->registerType("Human_Guard", productCreator_HG);
! }
!
! Human_Guard::Human_Guard( P_NPC npc ) : AbstractAI( npc ), m_currentVictim( NULL )
! {
! notorityOverride_ = 1;
! m_actions.append( new Human_Guard_Wander( npc, this ) );
! m_actions.append( new Human_Guard_MoveToTarget( npc, this ) );
! m_actions.append( new Human_Guard_Fight( npc, this ) );
! }
!
! void Human_Guard::check()
! {
! selectVictim();
! AbstractAI::check();
! }
!
! void Human_Guard::selectVictim()
! {
! if( m_currentVictim )
! {
! // Check if the current target is valid, including:
! // - Target not dead.
! // - Target in attack range.
! // - Target not innocent.
! if( m_currentVictim->isDead() || m_currentVictim->isInnocent() )
! m_currentVictim = NULL;
! else if( !m_npc->inRange( m_currentVictim, SrvParams->attack_distance() ) )
! m_currentVictim = NULL;
! }
!
! if( !m_currentVictim )
! {
! // Get a criminal or murderer in range to attack it
! RegionIterator4Chars ri( m_npc->pos(), VISRANGE );
! for( ri.Begin(); !ri.atEnd(); ri++ )
! {
! P_CHAR pChar = ri.GetData();
! if( pChar && !pChar->free && pChar != m_npc && !pChar->isInvulnerable() && !pChar->isHidden() && !pChar->isInvisible() && !pChar->isDead() && !pChar->isInnocent() )
! {
! P_PLAYER pPlayer = dynamic_cast<P_PLAYER>(pChar);
! if( pPlayer && pPlayer->isGMorCounselor() )
! continue;
!
! m_currentVictim = pChar;
! break;
! }
! }
!
! // If we found a new target, let us attack it
! if( m_currentVictim )
! m_npc->fight( m_currentVictim );
! }
!
! }
!
! void Human_Guard_Fight::execute()
! {
! // talk only in about every 10th check
! switch( RandomNum( 0, 20 ) )
! {
! case 0: m_npc->talk( tr( "Thou shalt regret thine actions, swine!" ), -1, 0, true ); break;
! case 1: m_npc->talk( tr( "Death to all Evil!" ), -1, 0, true ); break;
! }
!
! // Fighting is handled within combat..
! }
!
! float Human_Guard_Fight::preCondition()
! {
! Human_Guard* pAI = dynamic_cast< Human_Guard* >(m_ai);
! P_CHAR pTarget = ( pAI ? pAI->currentVictim() : NULL );
!
! if( !pTarget || pTarget->isDead() || pTarget->isInnocent() )
! return 0.0f;
!
! if( pTarget && m_npc->dist( pTarget ) < 2 )
! return 1.0f;
! else
! return 0.0f;
! }
!
! float Human_Guard_Fight::postCondition()
! {
! return 1.0f - preCondition();
! }
!
! void Human_Guard_MoveToTarget::execute()
! {
! Human_Guard* pAI = dynamic_cast< Human_Guard* >(m_ai);
! P_CHAR pTarget = ( pAI ? pAI->currentVictim() : NULL );
!
! if( !pTarget )
! return;
!
! if( SrvParams->pathfind4Combat() )
! movePath( pTarget->pos() );
! else
! moveTo( pTarget->pos() );
! }
!
! float Human_Guard_MoveToTarget::preCondition()
! {
! Human_Guard* pAI = dynamic_cast< Human_Guard* >(m_ai);
! P_CHAR pTarget = ( pAI ? pAI->currentVictim() : NULL );
!
! if( !pTarget || pTarget->isDead() || pTarget->isInnocent() )
! return 0.0f;
!
! if( pTarget && m_npc->dist( pTarget ) >= 2 )
! return 1.0f;
! else
! return 0.0f;
! }
!
! float Human_Guard_MoveToTarget::postCondition()
! {
! return 1.0f - preCondition();
! }
!
! float Human_Guard_Wander::preCondition()
! {
! Human_Guard* pAI = dynamic_cast< Human_Guard* >(m_ai);
! P_CHAR pTarget = ( pAI ? pAI->currentVictim() : NULL );
!
! if( !pTarget || pTarget->isDead() || pTarget->isInnocent() )
! return 1.0f;
!
! return 0.0f;
! }
!
! float Human_Guard_Wander::postCondition()
! {
! return 1.0f - preCondition();
! }
Index: combat.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/combat.cpp,v
retrieving revision 1.155
retrieving revision 1.156
diff -C2 -d -r1.155 -r1.156
*** combat.cpp 20 Sep 2003 12:01:43 -0000 1.155
--- combat.cpp 23 Sep 2003 11:53:31 -0000 1.156
***************
*** 870,874 ****
{
// Only shot if our "head" can see the opponent
! if( !pAttacker->pos().lineOfSight( pDefender->pos() ) )
{
/*
--- 870,874 ----
{
// Only shot if our "head" can see the opponent
! if( pAttacker->pos().lineOfSight( pDefender->pos() ) )
{
/*
***************
*** 876,880 ****
Maybe a 100 ms delay would be appropiate
*/
! mayAttack = false;
}
}
--- 876,880 ----
Maybe a 100 ms delay would be appropiate
*/
! mayAttack = true;
}
}
***************
*** 1046,1050 ****
// Show flying arrows if archery was used
! /* if( fightskill == ARCHERY )
{
if( los )
--- 1046,1050 ----
// Show flying arrows if archery was used
! /* if( fightskill == ARCHERY )
{
if( los )
***************
*** 1263,1269 ****
return;
! if( pRegion->isGuarded() && SrvParams->guardsActive() && !pOffender->isInvulnerable() )
{
! P_NPC pGuard = cCharStuff::createScriptNpc( pRegion->getGuardSect(), pos );
if ( !pGuard )
--- 1263,1271 ----
return;
! if( pRegion->isGuarded() && SrvParams->guardsActive() /*&& !pOffender->isInvulnerable()*/ )
{
! QString guardsect = pRegion->getGuardSect();
!
! P_NPC pGuard = ( guardsect.isNull() ? NULL : cCharStuff::createScriptNpc( guardsect, pos ) );
if ( !pGuard )
Index: dragdrop.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/dragdrop.cpp,v
retrieving revision 1.203
retrieving revision 1.204
diff -C2 -d -r1.203 -r1.204
*** dragdrop.cpp 20 Sep 2003 02:12:26 -0000 1.203
--- dragdrop.cpp 23 Sep 2003 11:53:31 -0000 1.204
***************
*** 168,172 ****
pContainer->addItem( splitItem, false );
splitItem->SetOwnSerial( pItem->ownSerial() );
! splitItem->SetSpawnSerial( pItem->spawnserial );
// He needs to see the new item
--- 168,172 ----
pContainer->addItem( splitItem, false );
splitItem->SetOwnSerial( pItem->ownSerial() );
! splitItem->setSpawnRegion( pItem->spawnregion() );
// He needs to see the new item
***************
*** 174,178 ****
// If we're taking something out of a spawn-region it's spawning "flag" is removed isn't it?
! pItem->SetSpawnSerial( INVALID_SERIAL );
pItem->setAmount( pickedAmount );
}
--- 174,178 ----
// If we're taking something out of a spawn-region it's spawning "flag" is removed isn't it?
! pItem->setSpawnRegion( (char*)0 );
pItem->setAmount( pickedAmount );
}
Index: items.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/items.cpp,v
retrieving revision 1.353
retrieving revision 1.354
diff -C2 -d -r1.353 -r1.354
*** items.cpp 15 Sep 2003 12:49:05 -0000 1.353
--- items.cpp 23 Sep 2003 11:53:31 -0000 1.354
***************
*** 108,112 ****
this->setOwnSerialOnly(src.ownSerial());
this->visible_=src.visible_;
! this->spawnserial=src.spawnserial;
this->priv_=src.priv_;
this->buyprice_ = src.buyprice_;
--- 108,112 ----
this->setOwnSerialOnly(src.ownSerial());
this->visible_=src.visible_;
! this->spawnregion_=src.spawnregion_;
this->priv_=src.priv_;
this->buyprice_ = src.buyprice_;
***************
*** 201,210 ****
}
- void cItem::SetSpawnSerial(long spawnser)
- {
- spawnserial = spawnser;
- flagChanged();
- }
-
void cItem::SetMultiSerial(long mulser)
{
--- 201,204 ----
***************
*** 452,456 ****
addField("owner", ownserial_);
addField("visible", visible_);
! addField("spawn", spawnserial);
addField("priv", priv_);
addField("sellprice", sellprice_);
--- 446,450 ----
addField("owner", ownserial_);
addField("visible", visible_);
! addStrField("spawnregion", spawnregion_);
addField("priv", priv_);
addField("sellprice", sellprice_);
***************
*** 555,559 ****
this->setOwnSerialOnly(-1);
this->visible_=0; // 0=Normally Visible, 1=Owner & GM Visible, 2=GM Visible
! this->spawnserial=-1;
// Everything decays by default.
this->priv_ = 0; // Bit 0, nodecay off/on. Bit 1, newbie item off/on. Bit 2 Dispellable
--- 549,553 ----
this->setOwnSerialOnly(-1);
this->visible_=0; // 0=Normally Visible, 1=Owner & GM Visible, 2=GM Visible
! this->spawnregion_=(char*)0;
// Everything decays by default.
this->priv_ = 0; // Bit 0, nodecay off/on. Bit 1, newbie item off/on. Bit 2 Dispellable
***************
*** 576,580 ****
// Update Top Objects
! SetSpawnSerial( -1 );
SetOwnSerial( -1 );
--- 570,574 ----
// Update Top Objects
! setSpawnRegion( (char*)0 );
SetOwnSerial( -1 );
***************
*** 1876,1880 ****
// Set the outside indices
! pi->SetSpawnSerial( pi->spawnserial );
pi->SetOwnSerial( pi->ownSerial() );
--- 1870,1874 ----
// Set the outside indices
! pi->setSpawnRegion( pi->spawnregion() );
pi->SetOwnSerial( pi->ownSerial() );
***************
*** 1938,1942 ****
ownserial_ = atoi( result[offset++] );
visible_ = atoi( result[offset++] );
! spawnserial = atoi( result[offset++] );
priv_ = atoi( result[offset++] );
sellprice_ = atoi( result[offset++] );
--- 1932,1936 ----
ownserial_ = atoi( result[offset++] );
visible_ = atoi( result[offset++] );
! spawnregion_ = atoi( result[offset++] );
priv_ = atoi( result[offset++] );
sellprice_ = atoi( result[offset++] );
***************
*** 1953,1957 ****
{
cUObject::buildSqlString( fields, tables, conditions );
! fields.push_back( "items.id,items.color,items.cont,items.layer,items.type,items.type2,items.amount,items.decaytime,items.def,items.hidamage,items.lodamage,items.time_unused,items.weight,items.hp,items.maxhp,items.speed,items.poisoned,items.magic,items.owner,items.visible,items.spawn,items.priv,items.sellprice,items.buyprice,items.restock" );
tables.push_back( "items" );
conditions.push_back( "uobjectmap.serial = items.serial" );
--- 1947,1951 ----
{
cUObject::buildSqlString( fields, tables, conditions );
! fields.push_back( "items.id,items.color,items.cont,items.layer,items.type,items.type2,items.amount,items.decaytime,items.def,items.hidamage,items.lodamage,items.time_unused,items.weight,items.hp,items.maxhp,items.speed,items.poisoned,items.magic,items.owner,items.visible,items.spawnregion,items.priv,items.sellprice,items.buyprice,items.restock" );
tables.push_back( "items" );
conditions.push_back( "uobjectmap.serial = items.serial" );
***************
*** 2227,2231 ****
}
! else SET_INT_PROPERTY( "spawn", spawnserial )
else SET_INT_PROPERTY( "sellprice", sellprice_ )
else SET_INT_PROPERTY( "buyprice", buyprice_ )
--- 2221,2225 ----
}
! else SET_STR_PROPERTY( "spawnregion", spawnregion_ )
else SET_INT_PROPERTY( "sellprice", sellprice_ )
else SET_INT_PROPERTY( "buyprice", buyprice_ )
***************
*** 2342,2346 ****
else GET_PROPERTY( "visible", visible_ == 0 ? 1 : 0 )
else GET_PROPERTY( "ownervisible", visible_ == 1 ? 1 : 0 )
! else GET_PROPERTY( "spawn", FindItemBySerial( spawnserial ) )
else GET_PROPERTY( "buyprice", buyprice_ )
--- 2336,2340 ----
else GET_PROPERTY( "visible", visible_ == 0 ? 1 : 0 )
else GET_PROPERTY( "ownervisible", visible_ == 1 ? 1 : 0 )
! else GET_PROPERTY( "spawnregion", spawnregion_ )
else GET_PROPERTY( "buyprice", buyprice_ )
Index: items.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/items.h,v
retrieving revision 1.178
retrieving revision 1.179
diff -C2 -d -r1.178 -r1.179
*** items.h 30 Aug 2003 17:00:09 -0000 1.178
--- items.h 23 Sep 2003 11:53:31 -0000 1.179
***************
*** 108,111 ****
--- 108,113 ----
uchar priv() const { return priv_; }
+ QString spawnregion() const { return spawnregion_; }
+
//***************************END ADDED GETTERS************
***************
*** 134,137 ****
--- 136,140 ----
void setTotalweight( int data );
void setAntispamtimer ( uint data ) { antispamtimer_ = data; flagChanged();}
+ void setSpawnRegion( const QString &data ) { spawnregion_ = data; flagChanged(); }
cItem();
***************
*** 156,161 ****
//*******************************************END ADDED SETTERS**********
- SERIAL spawnserial;
-
bool incognito; //AntiChrist - for items under incognito effect
// ^^ NUTS !! - move that to priv
--- 159,162 ----
***************
*** 174,178 ****
int ownSerial() const {return ownserial_;}
- void SetSpawnSerial(long spawnser);
void SetMultiSerial(long mulser);
--- 175,178 ----
***************
*** 260,263 ****
--- 260,264 ----
int sellprice_;
int buyprice_;
+ QString spawnregion_;
ContainerContent content_;
Index: npc.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/npc.h,v
retrieving revision 1.26
retrieving revision 1.27
diff -C2 -d -r1.26 -r1.27
*** npc.h 20 Sep 2003 13:51:34 -0000 1.26
--- npc.h 23 Sep 2003 11:53:31 -0000 1.27
***************
*** 49,53 ****
const char *objectID() const
{
! return "cUObject";
}
--- 49,53 ----
const char *objectID() const
{
! return "cNPC";
}
Index: player.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/player.cpp,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** player.cpp 14 Sep 2003 16:31:48 -0000 1.41
--- player.cpp 23 Sep 2003 11:53:31 -0000 1.42
***************
*** 834,838 ****
bool cPlayer::isGMorCounselor() const
{
! return account() && ( account()->acl() == "admin" || account()->acl() == "gm" || account()->acl() == "counselor" );
}
--- 834,838 ----
bool cPlayer::isGMorCounselor() const
{
! return account() && ( account()->acl() == "admin" || account()->acl() == "gm" || account()->acl() == "counselor" ) && account()->isStaff();
}
Index: spawnregions.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/spawnregions.cpp,v
retrieving revision 1.50
retrieving revision 1.51
diff -C2 -d -r1.50 -r1.51
*** spawnregions.cpp 11 Sep 2003 16:19:50 -0000 1.50
--- spawnregions.cpp 23 Sep 2003 11:53:31 -0000 1.51
***************
*** 463,464 ****
--- 463,496 ----
return 0;
}
+
+ void cAllSpawnRegions::postWorldLoading()
+ {
+ cCharIterator iChars;
+ for( P_CHAR pChar = iChars.first(); pChar; pChar = iChars.next() )
+ {
+ if( pChar->objectType() == enNPC )
+ {
+ P_NPC pNPC = dynamic_cast< P_NPC >(pChar);
+ QString srname = pNPC->spawnregion();
+ if( !srname.isNull() )
+ {
+ cSpawnRegion* spawnregion = region( srname );
+ if( spawnregion )
+ spawnregion->add( pNPC->serial() );
+ }
+ }
+ }
+
+ cItemIterator iItems;
+ for( P_ITEM pItem = iItems.first(); pItem; pItem = iItems.next() )
+ {
+ QString srname = pItem->spawnregion();
+ if( !srname.isNull() )
+ {
+ cSpawnRegion* spawnregion = region( srname );
+ if( spawnregion )
+ spawnregion->add( pItem->serial() );
+ }
+ }
+ }
+
Index: spawnregions.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/spawnregions.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -C2 -d -r1.18 -r1.19
*** spawnregions.h 6 Jul 2003 13:48:02 -0000 1.18
--- spawnregions.h 23 Sep 2003 11:53:31 -0000 1.19
***************
*** 163,166 ****
--- 163,168 ----
return numItems;
}
+
+ void postWorldLoading( void );
};
Index: territories.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/territories.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -C2 -d -r1.32 -r1.33
*** territories.cpp 11 Sep 2003 12:22:24 -0000 1.32
--- territories.cpp 23 Sep 2003 11:53:31 -0000 1.33
***************
*** 55,59 ****
rainchance_ = 50;
guardSections_ = QStringList();
! guardSections_.push_back( "standard_guard" );
}
--- 55,59 ----
rainchance_ = 50;
guardSections_ = QStringList();
! // guardSections_.push_back( "standard_guard" );
}
***************
*** 239,243 ****
QString cTerritory::getGuardSect( void ) const
{
! return this->guardSections_[ RandomNum( 0, this->guardSections_.size()-1 ) ];
}
--- 239,246 ----
QString cTerritory::getGuardSect( void ) const
{
! if( guardSections_.count() > 0 )
! return this->guardSections_[ RandomNum( 0, this->guardSections_.size()-1 ) ];
! else
! return (char*)0;
}
Index: wolfpack.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/wolfpack.cpp,v
retrieving revision 1.469
retrieving revision 1.470
diff -C2 -d -r1.469 -r1.470
*** wolfpack.cpp 20 Sep 2003 12:01:44 -0000 1.469
--- wolfpack.cpp 23 Sep 2003 11:53:31 -0000 1.470
***************
*** 471,474 ****
--- 471,475 ----
Human_Stablemaster::registerInFactory();
Human_Guard::registerInFactory();
+ Human_Guard_Called::registerInFactory();
Animal_Wild::registerInFactory();
Animal_Domestic::registerInFactory();
Index: world.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/world.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -C2 -d -r1.46 -r1.47
*** world.cpp 13 Sep 2003 13:08:41 -0000 1.46
--- world.cpp 23 Sep 2003 11:53:31 -0000 1.47
***************
*** 50,53 ****
--- 50,54 ----
#include "sectors.h"
#include "territories.h"
+ #include "spawnregions.h"
// Objects ( => Factory later on )
***************
*** 206,210 ****
owner int(11) NOT NULL default '-1',\
visible tinyint(3) NOT NULL default '0',\
! spawn int(11) NOT NULL default '-1',\
priv tinyint(3) NOT NULL default '0',\
sellprice int(11) NOT NULL default '0',\
--- 207,211 ----
owner int(11) NOT NULL default '-1',\
visible tinyint(3) NOT NULL default '0',\
! spawnregion varchar(255) default NULL,\
priv tinyint(3) NOT NULL default '0',\
sellprice int(11) NOT NULL default '0',\
***************
*** 644,647 ****
--- 645,651 ----
pChar->flagUnchanged(); // We've just loaded, nothing changes
}
+
+ // Post process spawnregions
+ SpawnRegions::instance()->postWorldLoading();
Console::instance()->ProgressDone();
|