Browse Source

Remove redundant bitfield

Adam Johnson 12 years ago
parent
commit
7888cf7010
  1. 8
      Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.cpp
  2. 37
      Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp
  3. 26
      Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.h

8
Sources/Plasma/FeatureLib/pfPython/pyNetLinkingMgr.cpp

@ -67,13 +67,7 @@ void pyNetLinkingMgr::SetEnabled( bool b ) const
void pyNetLinkingMgr::LinkToAge( pyAgeLinkStruct & link, const char* linkAnim, bool linkInSfx, bool linkOutSfx ) void pyNetLinkingMgr::LinkToAge( pyAgeLinkStruct & link, const char* linkAnim, bool linkInSfx, bool linkOutSfx )
{ {
uint32_t sfx = plNetLinkingMgr::kPlayNone; plNetLinkingMgr::GetInstance()->LinkToAge( link.GetAgeLink(), linkAnim, linkInSfx, linkOutSfx );
if (linkInSfx)
hsSetBits(sfx, plNetLinkingMgr::kPlayLinkIn);
if (linkOutSfx)
hsSetBits(sfx, plNetLinkingMgr::kPlayLinkOut);
plNetLinkingMgr::GetInstance()->LinkToAge( link.GetAgeLink(), linkAnim, (plNetLinkingMgr::LinkSfx)sfx );
} }
void pyNetLinkingMgr::LinkToMyPersonalAge() void pyNetLinkingMgr::LinkToMyPersonalAge()

37
Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.cpp

@ -547,14 +547,12 @@ bool plNetLinkingMgr::IProcessVaultNotifyMsg(plVaultNotifyMsg* msg)
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
bool plNetLinkingMgr::IDispatchMsg( plMessage* msg, LinkSfx sfx, uint32_t playerID ) bool plNetLinkingMgr::IDispatchMsg( plMessage* msg, uint32_t playerID )
{ {
plNetClientMgr * nc = plNetClientMgr::GetInstance(); plNetClientMgr * nc = plNetClientMgr::GetInstance();
msg->AddReceiver( plNetClientMgr::GetInstance()->GetKey() ); msg->AddReceiver( plNetClientMgr::GetInstance()->GetKey() );
plLinkToAgeMsg* linkToAge = plLinkToAgeMsg::ConvertNoRef(msg); plLinkToAgeMsg* linkToAge = plLinkToAgeMsg::ConvertNoRef(msg);
if (linkToAge)
linkToAge->PlayLinkSfx(hsTestBits(sfx, kPlayLinkIn), hsTestBits(sfx, kPlayLinkOut));
if ( playerID!=kInvalidPlayerID && playerID!=nc->GetPlayerID() ) if ( playerID!=kInvalidPlayerID && playerID!=nc->GetPlayerID() )
{ {
msg->SetBCastFlag( plMessage::kNetAllowInterAge ); msg->SetBCastFlag( plMessage::kNetAllowInterAge );
@ -570,12 +568,12 @@ bool plNetLinkingMgr::IDispatchMsg( plMessage* msg, LinkSfx sfx, uint32_t player
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////
void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, LinkSfx sfx, uint32_t playerID ) void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, bool linkInSfx, bool linkOutSfx, uint32_t playerID )
{ {
LinkToAge(link, nil, sfx, playerID); LinkToAge(link, nil, linkInSfx, linkOutSfx, playerID);
} }
void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, const char* linkAnim, LinkSfx sfx, uint32_t playerID ) void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, const char* linkAnim, bool linkInSfx, bool linkOutSfx, uint32_t playerID )
{ {
if ( !fLinkingEnabled ) if ( !fLinkingEnabled )
{ {
@ -586,11 +584,12 @@ void plNetLinkingMgr::LinkToAge( plAgeLinkStruct * link, const char* linkAnim, L
plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( link ); plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( link );
if (linkAnim) if (linkAnim)
pMsg->SetLinkInAnimName(linkAnim); pMsg->SetLinkInAnimName(linkAnim);
IDispatchMsg( pMsg, sfx, playerID ); pMsg->PlayLinkSfx(linkInSfx, linkOutSfx);
IDispatchMsg( pMsg, playerID );
} }
// link myself back to my last age // link myself back to my last age
void plNetLinkingMgr::LinkToPrevAge( LinkSfx sfx, uint32_t playerID ) void plNetLinkingMgr::LinkToPrevAge( uint32_t playerID )
{ {
if ( !fLinkingEnabled ) if ( !fLinkingEnabled )
{ {
@ -601,7 +600,7 @@ void plNetLinkingMgr::LinkToPrevAge( LinkSfx sfx, uint32_t playerID )
if (GetPrevAgeLink()->GetAgeInfo()->HasAgeFilename()) if (GetPrevAgeLink()->GetAgeInfo()->HasAgeFilename())
{ {
plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( GetPrevAgeLink() ); plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( GetPrevAgeLink() );
IDispatchMsg( pMsg, sfx, playerID ); IDispatchMsg( pMsg, playerID );
} }
else else
{ {
@ -609,7 +608,7 @@ void plNetLinkingMgr::LinkToPrevAge( LinkSfx sfx, uint32_t playerID )
} }
} }
void plNetLinkingMgr::LinkToMyPersonalAge( LinkSfx sfx, uint32_t playerID ) void plNetLinkingMgr::LinkToMyPersonalAge( uint32_t playerID )
{ {
if ( !fLinkingEnabled ) if ( !fLinkingEnabled )
{ {
@ -627,10 +626,10 @@ void plNetLinkingMgr::LinkToMyPersonalAge( LinkSfx sfx, uint32_t playerID )
link.SetSpawnPoint(hutSpawnPoint); link.SetSpawnPoint(hutSpawnPoint);
plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( &link ); plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( &link );
IDispatchMsg( pMsg, sfx, playerID ); IDispatchMsg( pMsg, playerID );
} }
void plNetLinkingMgr::LinkToMyNeighborhoodAge( LinkSfx sfx, uint32_t playerID ) void plNetLinkingMgr::LinkToMyNeighborhoodAge( uint32_t playerID )
{ {
if ( !fLinkingEnabled ) if ( !fLinkingEnabled )
{ {
@ -646,10 +645,10 @@ void plNetLinkingMgr::LinkToMyNeighborhoodAge( LinkSfx sfx, uint32_t playerID )
link.SetLinkingRules( plNetCommon::LinkingRules::kOwnedBook ); link.SetLinkingRules( plNetCommon::LinkingRules::kOwnedBook );
plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( &link ); plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( &link );
IDispatchMsg( pMsg, sfx, playerID ); IDispatchMsg( pMsg, playerID );
} }
void plNetLinkingMgr::LinkPlayerHere( uint32_t playerID, LinkSfx sfx ) void plNetLinkingMgr::LinkPlayerHere( uint32_t playerID )
{ {
if ( !fLinkingEnabled ) if ( !fLinkingEnabled )
{ {
@ -661,10 +660,10 @@ void plNetLinkingMgr::LinkPlayerHere( uint32_t playerID, LinkSfx sfx )
// send the player our current age info so they can link here. // send the player our current age info so they can link here.
plAgeLinkStruct link; plAgeLinkStruct link;
link.GetAgeInfo()->CopyFrom( GetAgeLink()->GetAgeInfo() ); link.GetAgeInfo()->CopyFrom( GetAgeLink()->GetAgeInfo() );
LinkPlayerToAge( &link, playerID, sfx ); LinkPlayerToAge( &link, playerID );
} }
void plNetLinkingMgr::LinkPlayerToAge( plAgeLinkStruct * link, uint32_t playerID, LinkSfx sfx ) void plNetLinkingMgr::LinkPlayerToAge( plAgeLinkStruct * link, uint32_t playerID )
{ {
if ( !fLinkingEnabled ) if ( !fLinkingEnabled )
{ {
@ -676,7 +675,7 @@ void plNetLinkingMgr::LinkPlayerToAge( plAgeLinkStruct * link, uint32_t playerID
// send the player the age link so they can link there. // send the player the age link so they can link there.
link->SetLinkingRules( plNetCommon::LinkingRules::kBasicLink ); link->SetLinkingRules( plNetCommon::LinkingRules::kBasicLink );
plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( link ); plLinkToAgeMsg* pMsg = new plLinkToAgeMsg( link );
IDispatchMsg( pMsg, sfx, playerID ); IDispatchMsg( pMsg, playerID );
} }
// //
@ -695,7 +694,7 @@ void plNetLinkingMgr::LinkPlayerToPrevAge( uint32_t playerID )
plLinkingMgrMsg* pMsg = new plLinkingMgrMsg(); plLinkingMgrMsg* pMsg = new plLinkingMgrMsg();
pMsg->SetCmd( kLinkPlayerToPrevAge); pMsg->SetCmd( kLinkPlayerToPrevAge);
IDispatchMsg( pMsg, kPlayBoth, playerID ); IDispatchMsg( pMsg, playerID );
} }
void plNetLinkingMgr::LinkToPlayersAge( uint32_t playerID ) void plNetLinkingMgr::LinkToPlayersAge( uint32_t playerID )
@ -711,7 +710,7 @@ void plNetLinkingMgr::LinkToPlayersAge( uint32_t playerID )
plLinkingMgrMsg* pMsg = new plLinkingMgrMsg(); plLinkingMgrMsg* pMsg = new plLinkingMgrMsg();
pMsg->SetCmd( kLinkPlayerHere ); pMsg->SetCmd( kLinkPlayerHere );
pMsg->GetArgs()->AddInt( 0, NetCommGetPlayer()->playerInt ); // send them our id. pMsg->GetArgs()->AddInt( 0, NetCommGetPlayer()->playerInt ); // send them our id.
IDispatchMsg( pMsg, kPlayBoth, playerID ); IDispatchMsg( pMsg, playerID );
} }
//////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////

26
Sources/Plasma/PubUtilLib/plNetClient/plNetLinkingMgr.h

@ -55,16 +55,6 @@ struct plNCAgeLeaver;
class plNetLinkingMgr class plNetLinkingMgr
{ {
public:
enum LinkSfx
{
kPlayNone = 0,
kPlayLinkIn = 1<<0,
kPlayLinkOut = 1<<1,
kPlayBoth = (kPlayLinkIn | kPlayLinkOut)
};
private:
static void NCAgeJoinerCallback ( static void NCAgeJoinerCallback (
plNCAgeJoiner * joiner, plNCAgeJoiner * joiner,
unsigned type, unsigned type,
@ -120,7 +110,7 @@ private:
void IDoLink(plLinkToAgeMsg* link); void IDoLink(plLinkToAgeMsg* link);
bool IProcessVaultNotifyMsg(plVaultNotifyMsg* msg); bool IProcessVaultNotifyMsg(plVaultNotifyMsg* msg);
bool IDispatchMsg( plMessage* msg, LinkSfx sfx, uint32_t playerID ); bool IDispatchMsg( plMessage* msg, uint32_t playerID );
public: public:
@ -135,23 +125,23 @@ public:
bool Linking () const { return !fLinkedIn && !fLinkingEnabled; } bool Linking () const { return !fLinkedIn && !fLinkingEnabled; }
// Link to an age. // Link to an age.
void LinkToAge( plAgeLinkStruct * link, LinkSfx sfx=kPlayBoth, uint32_t playerID=kInvalidPlayerID ); void LinkToAge( plAgeLinkStruct * link, bool linkInSfx=true, bool linkOutSfx=true, uint32_t playerID=kInvalidPlayerID );
void LinkToAge( plAgeLinkStruct * link, const char* linkAnim, LinkSfx sfx=kPlayBoth, uint32_t playerID=kInvalidPlayerID ); void LinkToAge( plAgeLinkStruct * link, const char* linkAnim, bool linkInSfx=true, bool linkOutSfx=true, uint32_t playerID=kInvalidPlayerID );
// Link to my last age. // Link to my last age.
void LinkToPrevAge( LinkSfx sfx=kPlayBoth, uint32_t playerID=kInvalidPlayerID ); void LinkToPrevAge( uint32_t playerID=kInvalidPlayerID );
// Link to my Personal Age // Link to my Personal Age
void LinkToMyPersonalAge( LinkSfx sfx=kPlayBoth, uint32_t playerID=kInvalidPlayerID ); void LinkToMyPersonalAge( uint32_t playerID=kInvalidPlayerID );
// Link to my Neighborhood Age // Link to my Neighborhood Age
void LinkToMyNeighborhoodAge( LinkSfx sfx=kPlayBoth, uint32_t playerID=kInvalidPlayerID ); void LinkToMyNeighborhoodAge( uint32_t playerID=kInvalidPlayerID );
// Link a player here. // Link a player here.
void LinkPlayerHere( uint32_t playerID, LinkSfx sfx=kPlayBoth ); void LinkPlayerHere( uint32_t playerID );
// Link player to specified age // Link player to specified age
void LinkPlayerToAge( plAgeLinkStruct * link, uint32_t playerID, LinkSfx sfx=kPlayBoth ); void LinkPlayerToAge( plAgeLinkStruct * link, uint32_t playerID );
// Link player back to his last age // Link player back to his last age
void LinkPlayerToPrevAge( uint32_t playerID ); void LinkPlayerToPrevAge( uint32_t playerID );

Loading…
Cancel
Save