From: <sg...@us...> - 2003-10-14 04:34:17
|
Update of /cvsroot/libfunutil/libfunutil/lib/funUtil In directory sc8-pr-cvs1:/tmp/cvs-serv16775/lib/funUtil Modified Files: Fudgeish.cpp Fudgeish.h Log Message: doh - changed namespace to fun. Index: Fudgeish.cpp =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/lib/funUtil/Fudgeish.cpp,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Fudgeish.cpp 14 Oct 2003 04:26:10 -0000 1.1 +++ Fudgeish.cpp 14 Oct 2003 04:34:13 -0000 1.2 @@ -4,26 +4,24 @@ #if HAVE_CONFIG_H -#include "config.h" +# include "config.h" #endif #include "Fudgeish.h" -#if FUDGE_USE_ELIB -# include <elib/elib_globals.h> // elib::random() -# include <elib/e-macs.h> // COUT -# define ROLLDF (elib::random(0,3) - 1 ) -#else -# include <stdlib.h> -# include <iostream> -# define ROLLDF ( (::random() % 3) - 1 ) -# define COUT std::cout << __FILE__<<":"<<__LINE__<<": " -// and let's hope ::random() is seeded from somewhere! :) +#if FUDGE_USE_S11N +# include <toolbox/debuggering_macros.h> // COUT #endif +#include <stdlib.h> +#include <iostream> +#define ROLLDF ( (::random() % 3) - 1 ) +#define COUT std::cout << __FILE__<<":"<<__LINE__<<": " +// and let's hope ::random() is seeded from somewhere! :) -namespace fudge + +namespace fun { using namespace std; @@ -72,24 +70,21 @@ return name; } - std::ostream & operator<<( std::ostream & os, const fudge::Buff & ca ) + std::ostream & operator<<( std::ostream & os, const fun::Buff & ca ) { os << "[" << ca.name(); os << " x"<< ca.count(); os << "]"; os << "] Scale="<<ca.scale(); // os << " x"<< ca->count(); - if( ca.offensive() ) os <<" ODF="<<fudge::ratingName(ca.odf()); - if( ca.defensive() ) os <<" DDF="<<fudge::ratingName(ca.ddf()); - // << " Range(?)="<< fudge::ratingName(ca.range()); + if( ca.offensive() ) os <<" ODF="<<fun::ratingName(ca.odf()); + if( ca.defensive() ) os <<" DDF="<<fun::ratingName(ca.ddf()); + // << " Range(?)="<< fun::ratingName(ca.range()); return os; }; dF::dF( short whichside ) -#if FUDGE_USE_ELIB - : s11n::Serializable( "fudge::dF" ) -#endif { this->side( whichside ); }; @@ -131,19 +126,19 @@ } -#if FUDGE_USE_ELIB +#if FUDGE_USE_S11N bool - dF::serialize( s11n::S11nNode & node ) const + dF::s7e( s11n::S11nNode & node ) const { - if( ! this->Serializable::serialize( node ) ) return false; + if( ! this->Serializable::s7e( node ) ) return false; node.set( "side", (this->side() == 0 ? "0" : (this->side()<0 ? "-" : "+") ) ); return true; } bool - dF::deserialize( const s11n::S11nNode &node ) + dF::d9e( const s11n::S11nNode &node ) { - if( ! this->Serializable::deserialize( node ) ) return false; + if( ! this->Serializable::d9e( node ) ) return false; std::string s = node.get_string( "side" ); if ( "+" == s ) this->side( 1 ); else if ( "-" == s ) this->side( -1 ); @@ -151,13 +146,9 @@ // else don't touch it. return true; } -#endif // FUDGE_USE_ELIB +#endif // FUDGE_USE_S11N - DiceBag::DiceBag( int dicecount ) : -#if FUDGE_USE_ELIB - s11n::Serializable( "fudge::DiceBag" ), -#endif -m_lastroll(0) + DiceBag::DiceBag( int dicecount ) : m_lastroll(0) { this->diceCount( dicecount ); //this->m_dice.auto_delete( true ); @@ -175,11 +166,11 @@ return this->m_dice; } -#if FUDGE_USE_ELIB +#if FUDGE_USE_S11N bool - DiceBag::serialize( s11n::S11nNode & node ) const + DiceBag::s7e( s11n::S11nNode & node ) const { - if( ! this->Serializable::serialize( node ) ) return false; + if( ! this->Serializable::s7e( node ) ) return false; //node.serialize_children( "dice", this->dice() ); // i do this instead to keep the file size down. dF's // are INSANELY BLOATED when serialized: @@ -195,11 +186,11 @@ } bool - DiceBag::deserialize( const s11n::S11nNode &node ) + DiceBag::d9e( const s11n::S11nNode &node ) { - if( ! this->Serializable::deserialize( node ) ) return false; + if( ! this->Serializable::d9e( node ) ) return false; //node.deserialize_children( "dice", this->dice() ); - fudge::dF die; + fun::dF die; char c; this->m_lastroll = 0; std::string dice = node.get( "dice", "" ); @@ -212,7 +203,7 @@ } return true; } -#endif // FUDGE_USE_ELIB +#endif // FUDGE_USE_S11N // bool @@ -319,9 +310,6 @@ int MaxVeryHurt, int MaxIncap, int MaxNearDeath ) -#if FUDGE_USE_ELIB - : s11n::Serializable( "fudge::WoundTrack" ) -#endif { this->init(); m_boxes[NoEffect] = 0; @@ -332,11 +320,11 @@ m_boxes[NearDeath] = MaxNearDeath; } -#if FUDGE_USE_ELIB +#if FUDGE_USE_S11N bool - WoundTrack::serialize( s11n::S11nNode & node ) const + WoundTrack::s7e( s11n::S11nNode & node ) const { - if( ! this->Serializable::serialize( node ) ) return false; + if( ! this->Serializable::s7e( node ) ) return false; std::string wname; for( int i = NoEffect; i <= NearDeath; i++ ) @@ -351,9 +339,9 @@ } bool - WoundTrack::deserialize( const s11n::S11nNode &node ) + WoundTrack::d9e( const s11n::S11nNode &node ) { - if( ! this->Serializable::deserialize( node ) ) return false; + if( ! this->Serializable::d9e( node ) ) return false; std::string wname; for( int i = NoEffect; i <= NearDeath; i++ ) { @@ -365,7 +353,7 @@ this->m_migratewounds = node.get( "migrate_wounds", this->m_migratewounds ); return true; } -#endif // FUDGE_USE_ELIB +#endif // FUDGE_USE_S11N Index: Fudgeish.h =================================================================== RCS file: /cvsroot/libfunutil/libfunutil/lib/funUtil/Fudgeish.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- Fudgeish.h 14 Oct 2003 04:26:10 -0000 1.1 +++ Fudgeish.h 14 Oct 2003 04:34:13 -0000 1.2 @@ -7,34 +7,31 @@ #include <iostream> #include <string> -#ifndef FUDGE_USE_ELIB -#define FUDGE_USE_ELIB 0 -// Define FUDGE_USE_ELIB=1 only if you use elib (which is highly -// unlikely). (0==FUDGE_USE_ELIB) is completely untested, but should -// give you a start if you want to use this code outside of the safe -// confines of elib. +#ifndef FUDGE_USE_S11N +# define FUDGE_USE_S11N 0 #endif -#if FUDGE_USE_ELIB -# include <s11n/S11n.h> // serialization +#if FUDGE_USE_S11N // serialization +# include <s11n/Serializable.h> +# include <s11n/s11n_node.h> #endif -/** -License: Public Domain -Author: st...@wa... +// /** +// License: Public Domain +// Author: st...@wa... -namespace fudge contains objects representing some of the core -aspects of the Fudge roleplaying system. To use this code you will -need to replace the random number generator and maybe pull out -some other elib-specific code. +// namespace fudge contains objects representing some of the core +// aspects of the Fudge roleplaying system. To use this code you will +// need to replace the random number generator and maybe pull out +// some other elib-specific code. -Most (99.99%) of the naming and logic here were inspired by Fudge -(http://www.fudgerpg.com). Indeed, the code is for processing common -Fudge-style operations. +// Most (99.99%) of the naming and logic here were inspired by Fudge +// (http://www.fudgerpg.com). Indeed, the code is for processing common +// Fudge-style operations. -*/ +// */ -namespace fudge { +namespace fun { /** Rating lists the Fudge-standard levels used for rating @@ -127,7 +124,7 @@ dF represents a single "Fudge Die" (aka, dF). */ class dF -#if FUDGE_USE_ELIB +#if FUDGE_USE_S11N : public s11n::Serializable #endif { @@ -180,7 +177,7 @@ */ short roll(); -#if FUDGE_USE_ELIB +#if FUDGE_USE_S11N /** de/serialize(): implemented for the Serializable interface. @@ -213,7 +210,7 @@ number of dice. */ class DiceBag -#if FUDGE_USE_ELIB +#if FUDGE_USE_S11N : public s11n::Serializable #endif { @@ -289,7 +286,7 @@ list_type m_dice; int m_lastroll; -#if FUDGE_USE_ELIB +#if FUDGE_USE_S11N public: /** de/serialize(): implemented for the Serializable interface. @@ -306,7 +303,7 @@ boxes for any given wound severity. */ class WoundTrack -#if FUDGE_USE_ELIB +#if FUDGE_USE_S11N : public s11n::Serializable #endif { @@ -483,7 +480,7 @@ virtual int applyDamage( int dmg ); /** - Returns the fudge::Rating severity for dmg damage points. + Returns the fun::Rating severity for dmg damage points. Uses (rather unobjectively) the Fudge-default rules for translating damage points to hits. @@ -534,7 +531,7 @@ bool m_migratewounds; void init(); -#if FUDGE_USE_ELIB +#if FUDGE_USE_S11N public: /** de/serialize(): implemented for the Serializable interface. @@ -551,7 +548,7 @@ exact interpretation of a buff is client-dependent. */ class Buff -#if FUDGE_USE_ELIB +#if FUDGE_USE_S11N : public s11n::Serializable #endif { @@ -561,7 +558,7 @@ this->init(); }; - Buff( const std::string &n, int o, int d, int s=fudge::Scale_Human ) : m_odf(o),m_ddf(d),m_scale(s),m_range(0),m_count(1),m_ablative(false),m_flags(0),m_name(n) + Buff( const std::string &n, int o, int d, int s=fun::Scale_Human ) : m_odf(o),m_ddf(d),m_scale(s),m_range(0),m_count(1),m_ablative(false),m_flags(0),m_name(n) { this->init(); }; |