Update of /cvsroot/wpdev/wolfpack
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13629
Modified Files:
ChangeLog basedef.cpp basedef.h timing.cpp
Log Message:
GM control for npcs.
added basescript tag for xml
no hunger for gm controlled pets
Index: ChangeLog
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/ChangeLog,v
retrieving revision 1.41
retrieving revision 1.42
diff -C2 -d -r1.41 -r1.42
*** ChangeLog 9 Sep 2004 02:19:56 -0000 1.41
--- ChangeLog 9 Sep 2004 03:19:58 -0000 1.42
***************
*** 39,42 ****
--- 39,47 ----
- The default worldsave driver is now binary.
- Improved the Python interface Unicode support.
+ - Pets should now no longer fight if their owners tell them to stay/stop.
+ - NPCs owned by GMs no longer suffer hunger effects.
+ - Added <basescript>a</basescript> which will prepend the script a to the basescripts list of
+ a basedefinition.
+ - Moved several methods to a common baseclass for char and item base definitions.
Wolfpack 12.9.9 Beta (4. September 2004)
Index: timing.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/timing.cpp,v
retrieving revision 1.13
retrieving revision 1.14
diff -C2 -d -r1.13 -r1.14
*** timing.cpp 7 Sep 2004 03:21:47 -0000 1.13
--- timing.cpp 9 Sep 2004 03:19:58 -0000 1.14
***************
*** 426,468 ****
if ( npc->isTamed() && Config::instance()->hungerRate() && npc->hungerTime() <= time )
{
! if ( npc->hunger() )
! {
! npc->setHunger( npc->hunger() - 1 );
! }
!
! npc->setHungerTime( time + Config::instance()->hungerRate() * MY_CLOCKS_PER_SEC );
!
! switch ( npc->hunger() )
! {
! case 4:
! npc->emote( tr( "*%1 looks a little hungry*" ).arg( npc->name() ), 0x26 );
! break;
! case 3:
! npc->emote( tr( "*%1 looks fairly hungry*" ).arg( npc->name() ), 0x26 );
! break;
! case 2:
! npc->emote( tr( "*%1 looks extremely hungry*" ).arg( npc->name() ), 0x26 );
! break;
! case 1:
! npc->emote( tr( "*%1 looks weak from starvation*" ).arg( npc->name() ), 0x26 );
! break;
! case 0:
! npc->setWanderType( enFreely );
! npc->setTamed( false );
!
! if ( npc->owner() )
{
! npc->setOwner( 0 );
}
! npc->bark( cBaseChar::Bark_Attacking );
! npc->talk( 1043255, npc->name(), 0, false, 0x26 );
! if ( Config::instance()->tamedDisappear() == 1 )
{
! npc->soundEffect( 0x1FE );
! npc->remove();
}
- break;
}
}
--- 426,471 ----
if ( npc->isTamed() && Config::instance()->hungerRate() && npc->hungerTime() <= time )
{
! // Creatures owned by GMs won't hunger.
! if (!npc->owner() || !npc->owner()->isGMorCounselor()) {
! if ( npc->hunger() )
{
! npc->setHunger( npc->hunger() - 1 );
}
! npc->setHungerTime( time + Config::instance()->hungerRate() * MY_CLOCKS_PER_SEC );
! switch ( npc->hunger() )
{
! case 4:
! npc->emote( tr( "*%1 looks a little hungry*" ).arg( npc->name() ), 0x26 );
! break;
! case 3:
! npc->emote( tr( "*%1 looks fairly hungry*" ).arg( npc->name() ), 0x26 );
! break;
! case 2:
! npc->emote( tr( "*%1 looks extremely hungry*" ).arg( npc->name() ), 0x26 );
! break;
! case 1:
! npc->emote( tr( "*%1 looks weak from starvation*" ).arg( npc->name() ), 0x26 );
! break;
! case 0:
! npc->setWanderType( enFreely );
! npc->setTamed( false );
!
! if ( npc->owner() )
! {
! npc->setOwner( 0 );
! }
!
! npc->bark( cBaseChar::Bark_Attacking );
! npc->talk( 1043255, npc->name(), 0, false, 0x26 );
!
! if ( Config::instance()->tamedDisappear() == 1 )
! {
! npc->soundEffect( 0x1FE );
! npc->remove();
! }
! break;
}
}
}
Index: basedef.cpp
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basedef.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -C2 -d -r1.16 -r1.17
*** basedef.cpp 5 Sep 2004 17:43:51 -0000 1.16
--- basedef.cpp 9 Sep 2004 03:19:58 -0000 1.17
***************
*** 63,66 ****
--- 63,98 ----
}
}
+ else if ( node->name() == "bindmenu" )
+ {
+ bindmenu_ = node->text();
+ }
+ else if ( node->name() == "basescripts" )
+ {
+ baseScriptList_ = node->text();
+ refreshScripts();
+ }
+ else if ( node->name() == "basescript" )
+ {
+ if (baseScriptList_.isEmpty()) {
+ baseScriptList_.prepend(node->text());
+ } else {
+ baseScriptList_.prepend(node->text() + ",");
+ }
+ refreshScripts();
+ }
+ }
+
+ void cBaseDef::refreshScripts() {
+ if (loaded) {
+ QStringList scripts = QStringList::split(",", baseScriptList_);
+ QStringList::const_iterator it;
+ baseScripts_.clear();
+ for (it = scripts.begin(); it != scripts.end(); ++it) {
+ cPythonScript *script = ScriptManager::instance()->find((*it).latin1());
+ if (script) {
+ baseScripts_.append(script);
+ }
+ }
+ }
}
***************
*** 149,161 ****
flags_ |= 0x04;
}
- else if ( node->name() == "bindmenu" )
- {
- bindmenu_ = node->text();
- }
- else if ( node->name() == "basescripts" )
- {
- baseScriptList_ = node->text();
- refreshScripts();
- }
else
{
--- 181,184 ----
***************
*** 164,181 ****
}
- void cCharBaseDef::refreshScripts() {
- if (loaded) {
- QStringList scripts = QStringList::split(",", baseScriptList_);
- QStringList::const_iterator it;
- baseScripts_.clear();
- for (it = scripts.begin(); it != scripts.end(); ++it) {
- cPythonScript *script = ScriptManager::instance()->find((*it).latin1());
- if (script) {
- baseScripts_.append(script);
- }
- }
- }
- }
-
// Load this definition from the scripts.
void cCharBaseDef::load()
--- 187,190 ----
***************
*** 269,286 ****
}
- void cItemBaseDef::refreshScripts() {
- if (loaded) {
- QStringList scripts = QStringList::split(",", baseScriptList_);
- QStringList::const_iterator it;
- baseScripts_.clear();
- for (it = scripts.begin(); it != scripts.end(); ++it) {
- cPythonScript *script = ScriptManager::instance()->find((*it).latin1());
- if (script) {
- baseScripts_.append(script);
- }
- }
- }
- }
-
void cItemBaseDef::processNode( const cElement* node )
{
--- 278,281 ----
***************
*** 301,308 ****
type_ = node->value().toUShort();
}
- else if ( node->name() == "bindmenu" )
- {
- bindmenu_ = node->text();
- }
else if ( node->name() == "lightsource" )
{
--- 296,299 ----
***************
*** 317,325 ****
setWaterSource( node->value().toUInt() != 0 );
}
- else if ( node->name() == "basescripts" )
- {
- baseScriptList_ = node->text();
- refreshScripts();
- }
else
{
--- 308,311 ----
Index: basedef.h
===================================================================
RCS file: /cvsroot/wpdev/wolfpack/basedef.h,v
retrieving revision 1.14
retrieving revision 1.15
diff -C2 -d -r1.14 -r1.15
*** basedef.h 6 Sep 2004 22:31:25 -0000 1.14
--- basedef.h 9 Sep 2004 03:19:58 -0000 1.15
***************
*** 46,52 ****
--- 46,58 ----
QMap<QString, unsigned int> intproperties;
QMap<QString, QString> properties;
+
+ QPtrList<cPythonScript> baseScripts_;
+ QCString baseScriptList_;
+ QCString bindmenu_;
bool loaded;
virtual void reset();
+ virtual void load() = 0;
+ void refreshScripts();
public:
void processNode( const cElement* node );
***************
*** 56,60 ****
if (it == intproperties.end()) {
return def;
! } else {
return *it;
}
--- 62,66 ----
if (it == intproperties.end()) {
return def;
! } else {
return *it;
}
***************
*** 82,85 ****
--- 88,109 ----
return id_;
}
+
+ inline const QCString& baseScriptList()
+ {
+ load();
+ return baseScriptList_;
+ }
+
+ inline const QPtrList<cPythonScript> &baseScripts()
+ {
+ load();
+ return baseScripts_;
+ }
+
+ inline const QCString& bindmenu()
+ {
+ load();
+ return bindmenu_;
+ }
};
***************
*** 99,112 ****
QCString carve_;
QCString lootPacks_;
- QCString bindmenu_;
unsigned char controlSlots_;
unsigned char criticalHealth_;
- QPtrList<cPythonScript> baseScripts_;
- QCString baseScriptList_;
// Misc Properties
void load();
! void reset();
! void refreshScripts();
public:
cCharBaseDef( const QCString& id );
--- 123,132 ----
QCString carve_;
QCString lootPacks_;
unsigned char controlSlots_;
unsigned char criticalHealth_;
// Misc Properties
void load();
! void reset();
public:
cCharBaseDef( const QCString& id );
***************
*** 115,130 ****
void processNode( const cElement* node );
- inline const QCString& baseScriptList()
- {
- load();
- return baseScriptList_;
- }
-
- inline const QPtrList<cPythonScript> &baseScripts()
- {
- load();
- return baseScripts_;
- }
-
inline unsigned char controlSlots()
{
--- 135,138 ----
***************
*** 210,219 ****
return lootPacks_;
}
-
- inline const QCString& bindmenu()
- {
- load();
- return bindmenu_;
- }
};
--- 218,221 ----
***************
*** 251,265 ****
unsigned int buyprice_;
unsigned short type_;
- QCString bindmenu_;
unsigned char lightsource_;
unsigned int decaydelay_;
unsigned int flags_;
- QPtrList<cPythonScript> baseScripts_;
- QCString baseScriptList_;
// Misc Properties
void load();
void reset();
- void refreshScripts();
inline void setWaterSource( bool data )
--- 253,263 ----
***************
*** 280,295 ****
void processNode( const cElement* node );
- inline const QCString& baseScriptList()
- {
- load();
- return baseScriptList_;
- }
-
- inline const QPtrList<cPythonScript> & baseScripts()
- {
- load();
- return baseScripts_;
- }
-
inline unsigned int decaydelay()
{
--- 278,281 ----
***************
*** 322,331 ****
}
- inline const QCString& bindmenu()
- {
- load();
- return bindmenu_;
- }
-
inline unsigned char lightsource()
{
--- 308,311 ----
|