Added swgSharedNetworkMessages library

This commit is contained in:
Anonymous
2014-01-15 10:53:01 -07:00
parent cd99b53a31
commit 4e034da0f3
33 changed files with 2389 additions and 0 deletions
+1
View File
@@ -1,2 +1,3 @@
add_subdirectory(swgSharedNetworkMessages)
add_subdirectory(swgSharedUtility)
@@ -0,0 +1,11 @@
cmake_minimum_required(VERSION 2.8)
project(swgSharedNetworkMessages)
if(WIN32)
add_definitions(/D_CRT_SECURE_NO_WARNINGS)
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include/public)
add_subdirectory(src)
@@ -0,0 +1 @@
#include "../../src/shared/combat/CombatActionCompleteMessage.h"
@@ -0,0 +1 @@
#include "../../src/shared/consent/ConsentRequestMessage.h"
@@ -0,0 +1 @@
#include "../../src/shared/core/FirstSwgSharedNetworkMessages.h"
@@ -0,0 +1,2 @@
#include "../../src/shared/combat/MessageQueueCombatAction.h"
@@ -0,0 +1,2 @@
#include "../../src/shared/combat/MessageQueueCombatDamage.h"
@@ -0,0 +1 @@
#include "../../src/shared/permissionList/PermissionListCreateMessage.h"
@@ -0,0 +1 @@
#include "../../src/shared/permissionList/PermissionListModifyMessage.h"
@@ -0,0 +1 @@
#include "../../src/shared/survey/ResourceListForSurveyMessage.h"
@@ -0,0 +1 @@
#include "../../src/shared/core/SetupSwgSharedNetworkMessages.h"
@@ -0,0 +1 @@
#include "../../src/shared/survey/SurveyMessage.h"
@@ -0,0 +1,64 @@
set(SHARED_SOURCES
shared/combat/CombatActionCompleteMessage.cpp
shared/combat/CombatActionCompleteMessage.h
shared/combat/MessageQueueCombatAction.cpp
shared/combat/MessageQueueCombatAction.h
shared/combat/MessageQueueCombatDamage.cpp
shared/combat/MessageQueueCombatDamage.h
shared/consent/ConsentRequestMessage.cpp
shared/consent/ConsentRequestMessage.h
shared/core/FirstSwgSharedNetworkMessages.h
shared/core/SetupSwgSharedNetworkMessages.cpp
shared/core/SetupSwgSharedNetworkMessages.h
shared/permissionList/PermissionListCreateMessage.cpp
shared/permissionList/PermissionListCreateMessage.h
shared/permissionList/PermissionListModifyMessage.cpp
shared/permissionList/PermissionListModifyMessage.h
shared/survey/ResourceListForSurveyMessage.cpp
shared/survey/ResourceListForSurveyMessage.h
shared/survey/SurveyMessage.cpp
shared/survey/SurveyMessage.h
)
if(WIN32)
set(PLATFORM_SOURCES
win32/FirstSwgSharedNetworkMessages.cpp
)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/win32)
else()
set(PLATFORM_SOURCES "")
endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}/shared
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedDebug/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFile/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundation/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedFoundationTypes/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedGame/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMath/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMathArchive/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMemoryManager/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedMessageDispatch/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedNetworkMessages/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedObject/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedRandom/include/public
${SWG_ENGINE_SOURCE_DIR}/shared/library/sharedUtility/include/public
${SWG_GAME_SOURCE_DIR}/shared/library/swgSharedUtility/include/public
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/archive/include
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/localization/include
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/localizationArchive/include/public
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicode/include
${SWG_EXTERNALS_SOURCE_DIR}/ours/library/unicodeArchive/include/public
)
add_library(swgSharedNetworkMessages STATIC
${SHARED_SOURCES}
${PLATFORM_SOURCES}
)
@@ -0,0 +1,46 @@
// ======================================================================
//
// CombatActionCompleteMessage.cpp
// copyright (c) 2001 Sony Online Entertainment
//
// ======================================================================
//-----------------------------------------------------------------------
#include "swgSharedNetworkMessages/FirstSwgSharedNetworkMessages.h"
#include "swgSharedNetworkMessages/CombatActionCompleteMessage.h"
//-----------------------------------------------------------------------
const char * const CombatActionCompleteMessage::MESSAGE_TYPE = "CombatActionCompleteMessage::MESSAGE_TYPE";
//-----------------------------------------------------------------
CombatActionCompleteMessage::CombatActionCompleteMessage (uint32 sequenceId, bool nack) :
GameNetworkMessage (MESSAGE_TYPE),
m_sequenceId (sequenceId & ~(0x80000000))
{
addVariable (m_sequenceId);
//-- set the high bit if this is a nack
if (nack)
m_sequenceId.set (m_sequenceId.get () | 0x80000000);
}
//-----------------------------------------------------------------------
CombatActionCompleteMessage::CombatActionCompleteMessage(Archive::ReadIterator & source) :
GameNetworkMessage (MESSAGE_TYPE),
m_sequenceId ()
{
addVariable (m_sequenceId);
unpack (source);
}
//----------------------------------------------------------------------
CombatActionCompleteMessage::~CombatActionCompleteMessage()
{
}
//-----------------------------------------------------------------------
@@ -0,0 +1,65 @@
// ======================================================================
//
// CombatActionCompleteMessage.h
// copyright (c) 2001 Sony Online Entertainment
//
// ======================================================================
#ifndef INCLUDED_CombatActionCompleteMessage_H
#define INCLUDED_CombatActionCompleteMessage_H
//-----------------------------------------------------------------------
#include "sharedNetworkMessages/GameNetworkMessage.h"
#include "Unicode.h"
#include "unicodeArchive/UnicodeArchive.h"
//-----------------------------------------------------------------------
class GameInByteStream;
class GameOutByteStream;
//-----------------------------------------------------------------------
class CombatActionCompleteMessage : public GameNetworkMessage
{
public:
static const char * const MESSAGE_TYPE;
CombatActionCompleteMessage (uint32 sequenceId, bool nack = false);
explicit CombatActionCompleteMessage (Archive::ReadIterator & source);
virtual ~CombatActionCompleteMessage ();
uint32 getSequenceId () const;
bool isNack () const;
private:
//-- high bit is the nack flag, lower 31 bits is the id
Archive::AutoVariable<uint32> m_sequenceId;
private:
CombatActionCompleteMessage(const CombatActionCompleteMessage&);
CombatActionCompleteMessage& operator= (const CombatActionCompleteMessage&);
};
//-----------------------------------------------------------------------
inline uint32 CombatActionCompleteMessage::getSequenceId () const
{
return m_sequenceId.get () & ~(0x80000000);
}
//----------------------------------------------------------------------
inline bool CombatActionCompleteMessage::isNack () const
{
return (m_sequenceId.get () & 0x80000000) != 0;
}
//-----------------------------------------------------------------
#endif
@@ -0,0 +1,522 @@
//========================================================================
//
// MessageQueueCombatAction.cpp
//
// copyright 2001 Sony Online Entertainment
//
//========================================================================
#include "swgSharedNetworkMessages/FirstSwgSharedNetworkMessages.h"
#include "MessageQueueCombatAction.h"
#include "sharedFoundation/CrcLowerString.h"
#include "swgSharedUtility/Postures.h"
#include <algorithm>
#include <vector>
#include "sharedFoundation/MemoryBlockManager.h"
#include "sharedFoundation/ExitChain.h"
#include "sharedFoundation/GameControllerMessage.h"
#include "sharedMathArchive/VectorArchive.h"
#include "sharedNetworkMessages/ControllerMessageFactory.h"
#include "sharedObject/NetworkIdManager.h"
// ======================================================================
namespace MessageQueueCombatActionNamespace
{
MessageQueueCombatAction::ActionNameLookupFunction s_actionNameLookupFunction;
}
using namespace MessageQueueCombatActionNamespace;
//===================================================================
CONTROLLER_MESSAGE_IMPLEMENTATION(MessageQueueCombatAction, CM_combatAction);
// ======================================================================
/**
* Class constructor.
*/
MessageQueueCombatAction::AttackerData::AttackerData()
: id(),
weapon(),
endPosture(Postures::Upright),
trailBits(0),
clientEffectId(0),
actionNameCrc(0),
useLocation(false),
targetLocation()
{
} // MessageQueueCombatAction::AttackerData::AttackerData
/**
* Class constructor.
*/
MessageQueueCombatAction::DefenderData::DefenderData()
: id(),
endPosture(Postures::Upright),
defense(CombatEngineData::CD_miss),
clientEffectId(0),
hitLocation(0),
damageAmount(0)
{
} // MessageQueueCombatAction::DefenderData:::DefenderData
// ======================================================================
void MessageQueueCombatAction::setActionNameLookupFunction(ActionNameLookupFunction actionNameLookupFunction)
{
s_actionNameLookupFunction = actionNameLookupFunction;
}
// ======================================================================
/**
* Class constructor.
*/
MessageQueueCombatAction::MessageQueueCombatAction(void)
: Data(),
m_actionId(0),
m_attacker(),
m_defenders()
{
} // MessageQueueCombatAction::MessageQueueCombatAction
/**
* Class destructor.
*/
MessageQueueCombatAction::~MessageQueueCombatAction()
{
} // MessageQueueCombatAction::~MessageQueueCombatAction
/**
* Sets the action id based on a string value.
*
* @param id the action id
*/
void MessageQueueCombatAction::setActionId(const std::string & id)
{
m_actionId = CrcLowerString::calculateCrc(id.c_str());
} // MessageQueueCombatAction::setActionId
/**
* Sets the info for the attacker of this action.
*
* @param attacker the attacker's id
*/
void MessageQueueCombatAction::setAttacker(const NetworkId & attacker,
const NetworkId & weapon)
{
m_attacker.id = attacker;
m_attacker.weapon = weapon;
} // MessageQueueCombatAction::setAttacker(const NetworkId &)
/**
* Sets the info for the attacker of this action.
*
* @param attacker the attacker's id
* @param posture the attacker's final posture
*/
void MessageQueueCombatAction::setAttacker(const NetworkId & attacker,
const NetworkId & weapon, Postures::Enumerator posture)
{
m_attacker.id = attacker;
m_attacker.weapon = weapon;
m_attacker.endPosture = posture;
} // MessageQueueCombatAction::setAttacker(const NetworkId &, Postures::Enumerator)
/**
* Sets the posture for the attacker.
*
* @param posture the attacker's final posture
*/
void MessageQueueCombatAction::setAttackerPosture(Postures::Enumerator posture)
{
m_attacker.endPosture = posture;
} // MessageQueueCombatAction::setAttackerPosture
/**
* Sets the trail bit field (trail special effect flags) for the attacker.
*
* @param trailBits the bit field describing the enabled SFX trails for the attacker.
*/
void MessageQueueCombatAction::setAttackerTrailBits(int trailBits)
{
m_attacker.trailBits = trailBits;
} // MessageQueueCombatAction::setAttackerTrailBits
/**
* Sets the client effect id used for the deferred client effect played on the attacker.
*
* @param clientEffectId the id (row number) of the effect to play on the client after a
* deferred amount of time. A value of zero (the default) will play no effect.
*/
void MessageQueueCombatAction::setAttackerActionNameCrc(int actionNameCrc)
{
m_attacker.actionNameCrc = actionNameCrc;
} // MessageQueueCombatAction::setAttackerActionNameCrc
/**
* Sets the client effect id used for the deferred client effect played on the attacker.
*
* @param clientEffectId the id (row number) of the effect to play on the client after a
* deferred amount of time. A value of zero (the default) will play no effect.
*/
void MessageQueueCombatAction::setAttackerClientEffectId(int clientEffectId)
{
m_attacker.clientEffectId = clientEffectId;
} // MessageQueueCombatAction::setAttackerClientEffectId
/**
* Sets the location for a location-based attack.
*
* @param location world-space location that is the target of the attack, if useLocation is true
* @param useLocation whether the attack targets a location
*/
void MessageQueueCombatAction::setAttackerTargetLocation(const Vector &location, const NetworkId &targetCell, bool useLocation)
{
m_attacker.useLocation = useLocation;
m_attacker.targetLocation = location;
m_attacker.targetCell = targetCell;
}
/**
* Adds info about a defender of this action.
*
* @param defender the defender's id
* @param defense the defense used on a failed attack
*/
void MessageQueueCombatAction::addDefender(const NetworkId & defender,
CombatEngineData::CombatDefense defense)
{
m_defenders.push_back(DefenderData());
DefenderData & data = m_defenders.back();
data.id = defender;
data.defense = defense;
} // MessageQueueCombatAction::addDefender(const NetworkId &, CombatEngineData::CombatDefense)
/**
* Adds info about a defender of this action.
*
* @param defender the defender's id
* @param defense the defense used on a failed attack
* @param posture the defender's final posture
* @param clientEffectId the deferred client effect id for the defender.
* @param damageAmount the amount of damage applied to the defender
*/
void MessageQueueCombatAction::addDefender(const NetworkId & defender,
CombatEngineData::CombatDefense defense, Postures::Enumerator posture,
int clientEffectId, int hitLocation, int damageAmount)
{
m_defenders.push_back(DefenderData());
DefenderData & data = m_defenders.back();
data.id = defender;
data.defense = defense;
data.endPosture = posture;
data.clientEffectId = clientEffectId;
data.hitLocation = hitLocation;
data.damageAmount = damageAmount;
} // MessageQueueCombatAction::addDefender(const NetworkId &, CombatEngineData::CombatDefense, Postures::Enumerator)
/**
* Sets the final posture for a defender.
*
* @param defender the defender's id
* @param posture the defender's posture
*/
void MessageQueueCombatAction::setDefenderPosture(const NetworkId & defender, Postures::Enumerator posture)
{
for (DefenderDataVector::iterator iter(m_defenders.begin());
iter != m_defenders.end(); ++iter)
{
DefenderData & data = *iter;
if (data.id == defender)
{
data.endPosture = posture;
return;
}
}
} // MessageQueueCombatAction::setDefenderPosture(const NetworkId &, Postures::Enumerator)
/**
* Sets the final posture for a defender.
*
* @param defender the defender's id
* @param posture the defender's posture
* @param indexHint hint as to the vector index of the defender
*/
void MessageQueueCombatAction::setDefenderPosture(const NetworkId & defender, Postures::Enumerator posture, int indexHint)
{
if (indexHint >= 0 && indexHint < static_cast<int>(m_defenders.size()))
{
DefenderData & data = m_defenders[static_cast<DefenderDataVector::size_type>(indexHint)];
if (data.id == defender)
{
data.endPosture = posture;
return;
}
}
setDefenderPosture(defender, posture);
} // MessageQueueCombatAction::setDefenderPosture(const NetworkId &, Postures::Enumerator, int)
/**
* Sets the amount of damge appied by the attacker.
*
* @param damage amount
*/
void MessageQueueCombatAction::setDefenderDamageAmount(const NetworkId & defender, int damageAmount)
{
for (DefenderDataVector::iterator iter(m_defenders.begin());
iter != m_defenders.end(); ++iter)
{
DefenderData & data = *iter;
if (data.id == defender)
{
data.damageAmount = damageAmount;
return;
}
}
} // MessageQueueCombatAction::setDamageAmount
/**
* Dump out the contents of the message via DEBUG_REPORT_LOG.
*/
void MessageQueueCombatAction::debugDump() const
{
//-- Get attacker and defender objects.
const Object *const attackerObject = NetworkIdManager::getObjectById(m_attacker.id);
UNREF(attackerObject);
const Object *const weaponObject = NetworkIdManager::getObjectById(m_attacker.weapon);
UNREF(weaponObject);
//-- Lookup action name if we have it.
bool hasActionName;
char actionName[256];
if (s_actionNameLookupFunction != NULL)
{
hasActionName = true;
(*s_actionNameLookupFunction)(m_actionId, actionName, sizeof(actionName));
}
else
hasActionName = false;
//-- Start the dump.
DEBUG_REPORT_LOG(true, ("MQCA: START.\n"));
// Print action name or id.
if (!hasActionName)
DEBUG_REPORT_LOG(true, ("MQCA: actionId [0x%08X].\n", static_cast<unsigned int>(m_actionId)));
else
DEBUG_REPORT_LOG(true, ("MQCA: action name [%s].\n", actionName));
// Print attacker info.
DEBUG_REPORT_LOG(true, ("MQCA: attacker: id =[%s].\n", m_attacker.id.getValueString().c_str()));
DEBUG_REPORT_LOG(true, ("MQCA: attacker: template =[%s].\n", attackerObject ? attackerObject->getObjectTemplateName() : "<NULL object>"));
DEBUG_REPORT_LOG(true, ("MQCA: attacker: weapon =[%s].\n", m_attacker.weapon.getValueString().c_str()));
DEBUG_REPORT_LOG(true, ("MQCA: attacker: weapon template =[%s].\n", weaponObject ? weaponObject->getObjectTemplateName() : "<NULL weapon>"));
DEBUG_REPORT_LOG(true, ("MQCA: attacker: end posture =[%s].\n", Postures::getPostureName(m_attacker.endPosture)));
DEBUG_REPORT_LOG(true, ("MQCA: attacker: trailBits =[0x%02x].\n", m_attacker.trailBits));
DEBUG_REPORT_LOG(true, ("MQCA: attacker: client effect id=[%d].\n", m_attacker.clientEffectId));
DEBUG_REPORT_LOG(true, ("MQCA: attacker: action name crc =[%d].\n", m_attacker.actionNameCrc));
DEBUG_REPORT_LOG(true, ("MQCA: attacker: use location =[%s].\n", m_attacker.useLocation ? "TRUE" : "FALSE"));
if(m_attacker.useLocation)
{
DEBUG_REPORT_LOG(true, ("MQCA: attacker: location target =[%5.0f %5.0f %5.0f]", m_attacker.targetLocation.x, m_attacker.targetLocation.y, m_attacker.targetLocation.z));
DEBUG_REPORT_LOG(true, ("MQCA: attacker: location target cell =[%s]", m_attacker.targetCell.getValueString().c_str()));
}
// Print per-defender info.
const DefenderDataVector::size_type defenderCount = m_defenders.size();
DEBUG_REPORT_LOG(true, ("MQCA: defender count [%u].\n", defenderCount));
for (DefenderDataVector::size_type i = 0; i < defenderCount; ++i)
{
const DefenderData &data = m_defenders[i];
const Object *const defenderObject = NetworkIdManager::getObjectById(data.id);
UNREF(defenderObject);
DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: id =[%s].\n", i + 1, data.id.getValueString().c_str()));
DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: template =[%s].\n", i + 1, defenderObject ? defenderObject->getObjectTemplateName() : "<NULL object>"));
DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: end posture =[%s].\n", i + 1, Postures::getPostureName(data.endPosture)));
DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: defense =[%s].\n", i + 1, CombatEngineData::getCombatDefenseName(data.defense)));
DEBUG_REPORT_LOG(true, ("MQCA: defender #%d: client effect id=[%d].\n", i + 1, data.clientEffectId));
}
DEBUG_REPORT_LOG(true, ("MQCA: END.\n"));
} // MessageQueueCombatAction::debugDump()
//
// Get a checksum value that can be used to determine if two MessageQueueCombatAction packets
// can be combined into one. We only look at the attacker info because there can be multiple
// defenders.
//
uint32 MessageQueueCombatAction::getComparisonChecksum( void ) const
{
uint32 retval = 0;
retval += m_actionId;
retval += NetworkId::Hash()(m_attacker.id);
retval += NetworkId::Hash()(m_attacker.weapon);
retval += int(m_attacker.endPosture);
retval += m_attacker.trailBits;
retval += m_attacker.clientEffectId;
retval += m_attacker.actionNameCrc;
retval += m_attacker.useLocation;
retval += static_cast<uint32>(m_attacker.targetLocation.x);
retval += static_cast<uint32>(m_attacker.targetLocation.y);
retval += static_cast<uint32>(m_attacker.targetLocation.z);
return retval;
}
//
// Merge packets (possibly adding another defender if need be...)
//
void MessageQueueCombatAction::mergePacket( MessageQueueCombatAction* pOther )
{
DefenderDataVector::const_iterator oiter;
const DefenderDataVector& odefenders = pOther->getDefenders();
for ( oiter = odefenders.begin(); oiter != odefenders.end(); ++oiter )
{
#if 0
/******** This code does damage aggregation. It may look like a bug since it will make damage numbers higher *********
bool b_defender_merged = false;
DefenderDataVector::iterator miter;
for ( miter = m_defenders.begin(); miter != m_defenders.end(); ++miter )
{
if (( miter->id == oiter->id ) && ( miter->clientEffectId == oiter->clientEffectId ))
{
miter->damageAmount += oiter->damageAmount;
b_defender_merged = true;
}
}
if ( ! b_defender_merged ) // Add another defender for the one we couldn't merge
**********************************************************************************************************************/
#endif
{
m_defenders.push_back( *oiter );
}
}
}
// ----------------------------------------------------------------------
void MessageQueueCombatAction::pack(const MessageQueue::Data* const data, Archive::ByteStream & target)
{
const MessageQueueCombatAction* const msg = safe_cast<const MessageQueueCombatAction*> (data);
if (msg)
{
Archive::put(target, msg->getActionId());
// write the attacker data
const MessageQueueCombatAction::AttackerData & attacker = msg->getAttacker();
Archive::put(target, attacker.id);
Archive::put(target, attacker.weapon);
Archive::put(target, attacker.endPosture);
const uint8 trailBits = static_cast<uint8>(attacker.trailBits);
Archive::put(target, trailBits);
Archive::put(target, static_cast<uint8>(attacker.clientEffectId));
Archive::put(target, attacker.actionNameCrc);
Archive::put(target, attacker.useLocation);
if(attacker.useLocation)
{
Archive::put(target, attacker.targetLocation);
Archive::put(target, attacker.targetCell);
}
// write the defender data
const std::vector<MessageQueueCombatAction::DefenderData> & defenderList = msg->getDefenders();
uint16 count = static_cast<uint16>(defenderList.size());
Archive::put(target, count);
for (std::vector<MessageQueueCombatAction::DefenderData>::const_iterator
iter = defenderList.begin(); iter != defenderList.end(); ++iter)
{
Archive::put(target, (*iter).id);
Archive::put(target, (*iter).endPosture);
uint8 defense = static_cast<uint8>((*iter).defense);
Archive::put(target, defense);
Archive::put(target, static_cast<uint8>((*iter).clientEffectId));
Archive::put(target, static_cast<uint8>((*iter).hitLocation));
Archive::put(target, static_cast<uint16>((*iter).damageAmount));
}
}
} // ControllerMessageFactory::packCombatAction
//-----------------------------------------------------------------------
MessageQueue::Data* MessageQueueCombatAction::unpack(Archive::ReadIterator & source)
{
NetworkId id, weapon;
Postures::Enumerator postureEnd;
uint32 actionId;
uint8 defense;
int actionNameCrc;
MessageQueueCombatAction * msg = new MessageQueueCombatAction;
NOT_NULL(msg);
Archive::get(source, actionId);
msg->setActionId(actionId);
// read the attacker data
Archive::get(source, id);
Archive::get(source, weapon);
Archive::get(source, postureEnd);
msg->setAttacker(id, weapon, postureEnd);
uint8 trailBits = 0;
Archive::get(source, trailBits);
msg->setAttackerTrailBits(static_cast<int>(trailBits));
uint8 clientEffectId;
Archive::get(source, clientEffectId);
msg->setAttackerClientEffectId(static_cast<int>(clientEffectId));
Archive::get(source, actionNameCrc);
msg->setAttackerActionNameCrc(actionNameCrc);
bool useLocation;
Archive::get(source, useLocation);
Vector locationTarget;
NetworkId cellTarget;
if(useLocation)
{
Archive::get(source, locationTarget);
Archive::get(source, cellTarget);
}
msg->setAttackerTargetLocation(locationTarget, cellTarget, useLocation);
// read the defender data
uint8 hitLocation;
uint16 count;
uint16 damageAmount;
Archive::get(source, count);
for (uint16 i = 0; i < count; ++i)
{
Archive::get(source, id);
Archive::get(source, postureEnd);
Archive::get(source, defense);
Archive::get(source, clientEffectId);
Archive::get(source, hitLocation);
Archive::get(source, damageAmount);
msg->addDefender(id, static_cast<CombatEngineData::CombatDefense>(defense), postureEnd, clientEffectId, hitLocation, damageAmount);
}
return msg;
} // ControllerMessageFactory::unpackCombatAction
//-----------------------------------------------------------------------
@@ -0,0 +1,130 @@
//========================================================================
//
// MessageQueueCombatAction.h
//
// copyright 2001 Sony Online Entertainment, Inc.
// All rights reserved.
//
//========================================================================
#ifndef INCLUDED_MessageQueueCombatAction_H
#define INCLUDED_MessageQueueCombatAction_H
#include "sharedFoundation/MessageQueue.h"
#include "sharedFoundation/NetworkId.h"
#include "sharedMath/Vector.h"
#include "swgSharedUtility/CombatEngineData.h"
#include "swgSharedUtility/Postures.def"
#include <string>
#include "sharedNetworkMessages/ControllerMessageMacros.h"
class MemoryBlockManager;
class Object;
class MessageQueueCombatAction : public MessageQueue::Data
{
CONTROLLER_MESSAGE_INTERFACE;
public:
struct AttackerData
{
AttackerData();
NetworkId id;
NetworkId weapon; // attacker's weapon; if cms_invalid, use current weapon
Postures::Enumerator endPosture; // attacker's posture at the end of the frame
int trailBits; // bitfield for trail special effects.
int clientEffectId; // id for client effect to play on the attacker.
int actionNameCrc; // crc for action used by attacker
bool useLocation; // if true, there is a location as the target/defender
Vector targetLocation; // valid if useLocation == TRUE, target of attack
NetworkId targetCell; // valid if useLocation == TRUE
};
struct DefenderData
{
DefenderData();
NetworkId id;
Postures::Enumerator endPosture; // defender's posture at the end of the frame
CombatEngineData::CombatDefense defense;
int clientEffectId; // id for client effect to play on the defender.
int hitLocation; // location to target and play hit
int damageAmount; // amount of damage being applied
};
typedef stdvector<DefenderData>::fwd DefenderDataVector;
typedef void (*ActionNameLookupFunction)(uint32 actionId, char *buffer, int bufferLength);
public:
static void setActionNameLookupFunction(ActionNameLookupFunction actionNameLookupFunction);
public:
MessageQueueCombatAction(void);
virtual ~MessageQueueCombatAction();
MessageQueueCombatAction& operator= (const MessageQueueCombatAction & source);
MessageQueueCombatAction(const MessageQueueCombatAction & source);
uint32 getActionId(void) const;
void setActionId(uint32 id);
void setActionId(const std::string & id);
const AttackerData & getAttacker(void) const;
void setAttacker(const NetworkId & attacker, const NetworkId & weapon);
void setAttacker(const NetworkId & attacker, const NetworkId & weapon, Postures::Enumerator posture);
void setAttackerPosture(Postures::Enumerator posture);
void setAttackerTrailBits(int trailBits);
void setAttackerClientEffectId(int clientEffectId);
void setAttackerActionNameCrc(int actionNameCrc);
void setAttackerTargetLocation(const Vector &location, const NetworkId &cell, bool useLocation);
const DefenderDataVector &getDefenders(void) const;
void addDefender(const NetworkId & defender, CombatEngineData::CombatDefense defense);
void addDefender(const NetworkId & defender, CombatEngineData::CombatDefense defense, Postures::Enumerator posture, int clientEffectId, int hitLocation, int damageAmount);
void setDefenderPosture(const NetworkId & defender, Postures::Enumerator posture);
void setDefenderPosture(const NetworkId & defender, Postures::Enumerator posture, int indexHint);
void setDefenderDamageAmount(const NetworkId & defender, int damageAmount);
void debugDump() const;
// If this value matches between two packets, they can be merged
uint32 getComparisonChecksum( void ) const;
void mergePacket( MessageQueueCombatAction* pOther );
private:
uint32 m_actionId;
AttackerData m_attacker;
DefenderDataVector m_defenders;
};
inline uint32 MessageQueueCombatAction::getActionId(void) const
{
return m_actionId;
} // MessageQueueCombatAction::getActionId
inline void MessageQueueCombatAction::setActionId(uint32 id)
{
m_actionId = id;
} // MessageQueueCombatAction::setActionId
inline const MessageQueueCombatAction::AttackerData &
MessageQueueCombatAction::getAttacker(void) const
{
return m_attacker;
} // MessageQueueCombatAction::getAttacker
inline const stdvector<MessageQueueCombatAction::DefenderData>::fwd &
MessageQueueCombatAction::getDefenders(void) const
{
return m_defenders;
} // MessageQueueCombatAction::getDefenders
#endif // INCLUDED_MessageQueueCombatAction_H
@@ -0,0 +1,113 @@
// ======================================================================
//
// MessageQueueCombatDamage.cpp
// Copyright 2001 Sony Online Entertainment Inc.
// All Rights Reserved.
//
// ======================================================================
#include "swgSharedNetworkMessages/FirstSwgSharedNetworkMessages.h"
#include "MessageQueueCombatDamage.h"
#include <vector>
#include "sharedFoundation/MemoryBlockManager.h"
#include "sharedFoundation/ExitChain.h"
#include "sharedFoundation/GameControllerMessage.h"
#include "sharedNetworkMessages/ControllerMessageFactory.h"
//===================================================================
CONTROLLER_MESSAGE_IMPLEMENTATION(MessageQueueCombatDamage, CM_combatDamage);
//===================================================================
// ======================================================================
/**
* Class constructor.
*/
MessageQueueCombatDamage::MessageQueueCombatDamage(void)
: m_actionId(0),
m_defender(),
m_defenderAttributes(new CurrentAttributeVector)
{
}
// ----------------------------------------------------------------------
/**
* Class destructor.
*/
MessageQueueCombatDamage::~MessageQueueCombatDamage()
{
delete m_defenderAttributes;
}
// ----------------------------------------------------------------------
void MessageQueueCombatDamage::addDefenderAttribute(
Attributes::Enumerator attribute, Attributes::Value value)
{
CurrentAttribute currentAttribute;
currentAttribute.attribute = attribute;
currentAttribute.value = value;
m_defenderAttributes->push_back(currentAttribute);
}
void MessageQueueCombatDamage::pack(const MessageQueue::Data* const data, Archive::ByteStream & target)
{
const MessageQueueCombatDamage* const msg = safe_cast<const MessageQueueCombatDamage*> (data);
if (msg)
{
Archive::put(target, msg->getActionId());
Archive::put(target, msg->getDefender());
const std::vector<MessageQueueCombatDamage::CurrentAttribute> & attribs =
msg->getDefenderAttributes();
uint16 count = static_cast<uint16>(attribs.size());
Archive::put(target, count);
for (std::vector<MessageQueueCombatDamage::CurrentAttribute>::const_iterator
iter = attribs.begin(); iter != attribs.end(); ++iter)
{
Archive::put(target, (*iter).attribute);
Archive::put(target, (*iter).value);
}
}
}
//-----------------------------------------------------------------------
MessageQueue::Data* MessageQueueCombatDamage::unpack(Archive::ReadIterator & source)
{
uint16 actionId;
NetworkId defenderId;
Attributes::Enumerator attribute;
Attributes::Value value;
MessageQueueCombatDamage * msg = new MessageQueueCombatDamage;
NOT_NULL(msg);
Archive::get(source, actionId);
msg->setActionId(actionId);
Archive::get(source, defenderId);
msg->setDefender(defenderId);
uint16 count;
Archive::get(source, count);
for (uint16 i = 0; i < count; ++i)
{
Archive::get(source, attribute);
Archive::get(source, value);
msg->addDefenderAttribute(attribute, value);
}
return msg;
}
//-----------------------------------------------------------------------
// ======================================================================
@@ -0,0 +1,82 @@
//========================================================================
//
// MessageQueueCombatDamage.h
//
// copyright 2001 Sony Online Entertainment, Inc.
// All rights reserved.
//
//========================================================================
#ifndef INCLUDED_MessageQueueCombatDamage_H
#define INCLUDED_MessageQueueCombatDamage_H
#include "sharedFoundation/MessageQueue.h"
#include "sharedFoundation/NetworkId.h"
#include "swgSharedUtility/Attributes.def"
#include "sharedNetworkMessages/ControllerMessageMacros.h"
class MemoryBlockManager;
class MessageQueueCombatDamage : public MessageQueue::Data
{
CONTROLLER_MESSAGE_INTERFACE;
public:
struct CurrentAttribute
{
Attributes::Enumerator attribute;
Attributes::Value value;
};
typedef stdvector<CurrentAttribute>::fwd CurrentAttributeVector;
public:
MessageQueueCombatDamage(void);
virtual ~MessageQueueCombatDamage();
MessageQueueCombatDamage& operator= (const MessageQueueCombatDamage & source);
MessageQueueCombatDamage(const MessageQueueCombatDamage & source);
uint16 getActionId(void) const;
void setActionId(uint16 id);
NetworkId getDefender(void) const;
void setDefender(NetworkId defenderId);
const CurrentAttributeVector & getDefenderAttributes(void) const;
void addDefenderAttribute(Attributes::Enumerator attribute,
Attributes::Value value);
private:
uint16 m_actionId;
NetworkId m_defender;
CurrentAttributeVector *m_defenderAttributes;
};
inline uint16 MessageQueueCombatDamage::getActionId(void) const
{
return m_actionId;
} // MessageQueueCombatDamage::getActionId
inline void MessageQueueCombatDamage::setActionId(uint16 id)
{
m_actionId = id;
} // MessageQueueCombatDamage::setActionId
inline NetworkId MessageQueueCombatDamage::getDefender(void) const
{
return m_defender;
} // MessageQueueCombatDamage::getDefender
inline void MessageQueueCombatDamage::setDefender(NetworkId defenderId)
{
m_defender = defenderId;
} // MessageQueueCombatDamage::setDefender
inline const MessageQueueCombatDamage::CurrentAttributeVector &
MessageQueueCombatDamage::getDefenderAttributes(void) const
{
return *m_defenderAttributes;
} // MessageQueueCombatDamage::getDefenderAttributes
#endif // INCLUDED_MessageQueueCombatDamage_H
@@ -0,0 +1,44 @@
// ======================================================================
//
// ConsentRequestMessage.cpp
// copyright (c) 2001 Sony Online Entertainment
//
// ======================================================================
#include "swgSharedNetworkMessages/FirstSwgSharedNetworkMessages.h"
#include "swgSharedNetworkMessages/ConsentRequestMessage.h"
// ======================================================================
const char * const ConsentRequestMessage::cms_name = "ConsentRequestMessage";
// ======================================================================
ConsentRequestMessage::ConsentRequestMessage(const ProsePackage& question, int id)
: GameNetworkMessage(cms_name),
m_question(question),
m_id(id)
{
addVariable(m_question);
addVariable(m_id);
}
//-----------------------------------------------------------------------
ConsentRequestMessage::ConsentRequestMessage(Archive::ReadIterator & source)
: GameNetworkMessage(cms_name),
m_question(),
m_id()
{
addVariable(m_question);
addVariable(m_id);
unpack(source);
}
// ----------------------------------------------------------------------
ConsentRequestMessage::~ConsentRequestMessage()
{
}
// ======================================================================
@@ -0,0 +1,64 @@
// ======================================================================
//
// ConsentRequestMessage.h
// copyright (c) 2001 Sony Online Entertainment
//
// ======================================================================
#ifndef INCLUDED_ConsentRequestMessage_H
#define INCLUDED_ConsentRequestMessage_H
// ======================================================================
#include "sharedGame/ProsePackage.h"
#include "sharedGame/ProsePackageArchive.h"
#include "sharedNetworkMessages/GameNetworkMessage.h"
//-----------------------------------------------------------------------
/**
* Sent from: Client
* Sent to: Connection Server
* Action: Requests the state of the player's stomach(s).
*/
class ConsentRequestMessage : public GameNetworkMessage
{
public:
static const char * const cms_name;
public:
ConsentRequestMessage (const ProsePackage& question, int id);
explicit ConsentRequestMessage(Archive::ReadIterator & source);
virtual ~ConsentRequestMessage();
public:
const ProsePackage& getQuestion() const;
int getId () const;
private:
ConsentRequestMessage(const ConsentRequestMessage&);
ConsentRequestMessage& operator= (const ConsentRequestMessage&);
private:
Archive::AutoVariable<ProsePackage> m_question;
Archive::AutoVariable<int> m_id;
};
// ----------------------------------------------------------------------
inline const ProsePackage& ConsentRequestMessage::getQuestion() const
{
return m_question.get();
}
// ----------------------------------------------------------------------
inline int ConsentRequestMessage::getId() const
{
return m_id.get();
}
// ======================================================================
#endif
@@ -0,0 +1,24 @@
// ======================================================================
//
// FirstSwgSharedNetworkObject.h
//
// copyright (c) 2001 Sony Online Entertainment
//
// ======================================================================
#ifndef INCLUDED_FirstSwgSharedNetworkObject_H
#define INCLUDED_FirstSwgSharedNetworkObject_H
// ======================================================================
#include "sharedFoundation/FirstSharedFoundation.h"
#include "sharedDebug/FirstSharedDebug.h"
#include "sharedMemoryManager/FirstSharedMemoryManager.h"
#include "sharedNetworkMessages/GameNetworkMessage.h"
#include "Archive/AutoDeltaByteStream.h"
#include "sharedFoundation/NetworkId.h"
#include "unicodeArchive/UnicodeArchive.h"
#include "sharedFoundation/NetworkIdArchive.h"
// ======================================================================
#endif // INCLUDED_FirstSwgSharedNetworkObject_H
@@ -0,0 +1,668 @@
// ======================================================================
//
// SetupSwgSharedNetworkMessages.cpp
// copyright 1998 Bootprint Entertainment
// copyright 2001 Sony Online Entertainment
//
// ======================================================================
#include "swgSharedNetworkMessages/FirstSwgSharedNetworkMessages.h"
#include "swgSharedNetworkMessages/SetupSwgSharedNetworkMessages.h"
#include "StringId.h"
#include "localizationArchive/StringIdArchive.h"
#include "sharedFoundation/ExitChain.h"
#include "sharedFoundation/GameControllerMessage.h"
#include "sharedGame/MatchMakingCharacterResult.h"
#include "sharedGame/ProsePackage.h"
#include "sharedGame/ProsePackageArchive.h"
#include "sharedMath/Sphere.h"
#include "sharedMathArchive/SphereArchive.h"
#include "sharedMathArchive/VectorArchive.h"
#include "sharedNetworkMessages/ControllerMessageFactory.h"
#include "sharedNetworkMessages/MessageQueueCommandTimer.h"
#include "sharedNetworkMessages/MessageQueueGenericValueType.h"
#include "sharedUtility/StartingLocationData.h"
#include "sharedUtility/StartingLocationDataArchive.h"
#include "swgSharedNetworkMessages/MessageQueueCombatAction.h"
#include "swgSharedNetworkMessages/MessageQueueCombatDamage.h"
#include "swgSharedUtility/Behaviors.def"
#include "swgSharedUtility/Locomotions.def"
#include "swgSharedUtility/MentalStates.def"
// ----------------------------------------------------------------------
namespace SetupSwgSharedNetworkMessagesNamespace
{
static bool g_installed = false;
void packAttributeMessage(const MessageQueue::Data * data, Archive::ByteStream & target)
{
const MessageQueueGenericValueType<std::pair<Attributes::Enumerator, Attributes::Value> > * const msg = dynamic_cast<const MessageQueueGenericValueType<std::pair<Attributes::Enumerator, Attributes::Value> > *>(data);
if(msg)
{
Archive::put(target, msg->getValue());
}
}
MessageQueue::Data* unpackAttributeMessage(Archive::ReadIterator & source)
{
std::pair<Attributes::Enumerator, Attributes::Value> v;
Archive::get(source, v);
MessageQueueGenericValueType<std::pair<Attributes::Enumerator, Attributes::Value> > * result = new MessageQueueGenericValueType<std::pair<Attributes::Enumerator, Attributes::Value> >(v);
return result;
}
void packMentalStatesMessage(const MessageQueue::Data * data, Archive::ByteStream & target)
{
const MessageQueueGenericValueType<std::pair<MentalStates::Enumerator, MentalStates::Value> > * const msg = dynamic_cast<const MessageQueueGenericValueType<std::pair<MentalStates::Enumerator, MentalStates::Value> > *>(data);
if(msg)
{
Archive::put(target, msg->getValue());
}
}
MessageQueue::Data* unpackMentalStatesMessage(Archive::ReadIterator & source)
{
std::pair<MentalStates::Enumerator, MentalStates::Value> v;
Archive::get(source, v);
MessageQueueGenericValueType<std::pair<MentalStates::Enumerator, MentalStates::Value> > * result = new MessageQueueGenericValueType<std::pair<MentalStates::Enumerator, MentalStates::Value> >(v);
return result;
}
void packMentalStatesTowardsMessage(const MessageQueue::Data * data, Archive::ByteStream & target)
{
const MessageQueueGenericValueType<std::pair<NetworkId, std::pair<MentalStates::Enumerator, MentalStates::Value> > > * const msg = dynamic_cast<const MessageQueueGenericValueType<std::pair<NetworkId, std::pair<MentalStates::Enumerator, MentalStates::Value> > > *>(data);
if(msg)
{
Archive::put(target, msg->getValue());
}
}
MessageQueue::Data* unpackMentalStatesTowardsMessage(Archive::ReadIterator & source)
{
std::pair<NetworkId, std::pair<MentalStates::Enumerator, MentalStates::Value> > v;
Archive::get(source, v);
MessageQueueGenericValueType<std::pair<NetworkId, std::pair<MentalStates::Enumerator, MentalStates::Value> > > * result = new MessageQueueGenericValueType<std::pair<NetworkId, std::pair<MentalStates::Enumerator, MentalStates::Value> > >(v);
return result;
}
void packIntMessage(const MessageQueue::Data * data, Archive::ByteStream & target)
{
const MessageQueueGenericValueType<int> * const msg = dynamic_cast<const MessageQueueGenericValueType<int> *>(data);
if(msg)
{
Archive::put(target, msg->getValue());
}
}
MessageQueue::Data* unpackIntMessage(Archive::ReadIterator & source)
{
int v;
Archive::get(source, v);
MessageQueueGenericValueType<int> * result = new MessageQueueGenericValueType<int>(v);
return result;
}
void packUint32PairMessage(const MessageQueue::Data * data, Archive::ByteStream & target)
{
const MessageQueueGenericValueType<std::pair<uint32, uint32> > * const msg = dynamic_cast<const MessageQueueGenericValueType<std::pair<uint32, uint32> > *>(data);
if(msg)
{
Archive::put(target, msg->getValue());
}
}
MessageQueue::Data* unpackUint32PairMessage(Archive::ReadIterator & source)
{
std::pair<uint32, uint32> v;
Archive::get(source, v);
MessageQueueGenericValueType<std::pair<uint32, uint32> > * result = new MessageQueueGenericValueType<std::pair<uint32, uint32> >(v);
return result;
}
void packBoolMessage(const MessageQueue::Data * data, Archive::ByteStream & target)
{
const MessageQueueGenericValueType<bool> * const msg = dynamic_cast<const MessageQueueGenericValueType<bool> *>(data);
if(msg)
{
Archive::put(target, msg->getValue());
}
}
MessageQueue::Data* unpackBoolMessage(Archive::ReadIterator & source)
{
bool v;
Archive::get(source, v);
MessageQueueGenericValueType<bool> * result = new MessageQueueGenericValueType<bool>(v);
return result;
}
void packMentalStateTowardClampBehaviorMessage(const MessageQueue::Data * data, Archive::ByteStream & target)
{
const MessageQueueGenericValueType<std::pair<NetworkId, std::pair<MentalStates::Enumerator, std::pair<MentalStates::Value, Behaviors::Enumerator> > > > * const msg = dynamic_cast<const MessageQueueGenericValueType<std::pair<NetworkId, std::pair<MentalStates::Enumerator, std::pair<MentalStates::Value, Behaviors::Enumerator> > > > *>(data);
if(msg)
{
Archive::put(target, msg->getValue());
}
}
MessageQueue::Data* unpackMentalStateTowardClampBehaviorMessage(Archive::ReadIterator & source)
{
std::pair<NetworkId, std::pair<MentalStates::Enumerator, std::pair<MentalStates::Value, Behaviors::Enumerator> > > v;
Archive::get(source, v);
MessageQueueGenericValueType<std::pair<NetworkId, std::pair<MentalStates::Enumerator, std::pair<MentalStates::Value, Behaviors::Enumerator> > > > * result = new MessageQueueGenericValueType<std::pair<NetworkId, std::pair<MentalStates::Enumerator, std::pair<MentalStates::Value, Behaviors::Enumerator> > > >(v);
return result;
}
void packMentalStateDecayMessage(const MessageQueue::Data * data, Archive::ByteStream & target)
{
const MessageQueueGenericValueType<std::pair<MentalStates::Enumerator, float> > * const msg = dynamic_cast<const MessageQueueGenericValueType<std::pair<MentalStates::Enumerator, float> > *>(data);
if(msg)
{
Archive::put(target, msg->getValue());
}
}
MessageQueue::Data* unpackMentalStateDecayMessage(Archive::ReadIterator & source)
{
std::pair<MentalStates::Enumerator, float> v;
Archive::get(source, v);
MessageQueueGenericValueType<std::pair<MentalStates::Enumerator, float> > * result = new MessageQueueGenericValueType<std::pair<MentalStates::Enumerator, float> >(v);
return result;
}
void packLocomotionMessage(const MessageQueue::Data * data, Archive::ByteStream & target)
{
const MessageQueueGenericValueType<Locomotions::Enumerator> * const msg = dynamic_cast<const MessageQueueGenericValueType<Locomotions::Enumerator> *>(data);
if(msg)
{
Archive::put(target, msg->getValue());
}
}
MessageQueue::Data* unpackLocomotionMessage(Archive::ReadIterator & source)
{
Locomotions::Enumerator v;
Archive::get(source, v);
MessageQueueGenericValueType<Locomotions::Enumerator> * result = new MessageQueueGenericValueType<Locomotions::Enumerator>(v);
return result;
}
void packAddToPlayerSpawnQueueMessage(const MessageQueue::Data * data, Archive::ByteStream & target)
{
const MessageQueueGenericValueType<std::pair<NetworkId, unsigned long> > * const msg = dynamic_cast<const MessageQueueGenericValueType<std::pair<NetworkId, unsigned long> > *>(data);
if(msg)
{
Archive::put(target, msg->getValue());
}
}
MessageQueue::Data* unpackAddToPlayerSpawnQueueMessage(Archive::ReadIterator & source)
{
std::pair<NetworkId, unsigned long> v;
Archive::get(source, v);
MessageQueueGenericValueType<std::pair<NetworkId, unsigned long> > * result = new MessageQueueGenericValueType<std::pair<NetworkId, unsigned long> >(v);
return result;
}
void packNetworkIdMessage(const MessageQueue::Data * data, Archive::ByteStream & target)
{
const MessageQueueGenericValueType<NetworkId> * const msg = dynamic_cast<const MessageQueueGenericValueType<NetworkId> *>(data);
if(msg)
{
Archive::put(target, msg->getValue());
}
}
MessageQueue::Data* unpackNetworkIdMessage(Archive::ReadIterator & source)
{
NetworkId v;
Archive::get(source, v);
MessageQueueGenericValueType<NetworkId> * result = new MessageQueueGenericValueType<NetworkId>(v);
return result;
}
void packGenericStringIdMessage(const MessageQueue::Data * data, Archive::ByteStream & target)
{
const MessageQueueGenericValueType<StringId> * const msg = safe_cast<const MessageQueueGenericValueType<StringId> *>(data);
if (msg)
Archive::put (target, msg->getValue ());
}
MessageQueue::Data* unpackGenericStringIdMessage(Archive::ReadIterator & source)
{
StringId v;
Archive::get(source, v);
MessageQueueGenericValueType<StringId> * const result = new MessageQueueGenericValueType<StringId>(v);
return result;
}
void packGenericStringVectorPairMessage(const MessageQueue::Data * data, Archive::ByteStream & target)
{
const MessageQueueGenericValueType<std::pair<std::string, Vector> > * const msg = dynamic_cast<const MessageQueueGenericValueType<std::pair<std::string, Vector> > *>(data);
if(msg)
{
Archive::put(target, msg->getValue());
}
}
MessageQueue::Data* unpackGenericStringVectorPairMessage(Archive::ReadIterator & source)
{
std::pair<std::string, Vector> v;
Archive::get(source, v);
MessageQueueGenericValueType<std::pair<std::string, Vector> > * result = new MessageQueueGenericValueType<std::pair<std::string, Vector> >(v);
return result;
}
void packGenericStringIdProsePackageMessage(const MessageQueue::Data * data, Archive::ByteStream & target)
{
typedef std::pair<std::pair<StringId, ProsePackage>, Unicode::String> Payload;
const MessageQueueGenericValueType<Payload> * const msg = safe_cast<const MessageQueueGenericValueType<Payload> *>(data);
if (msg)
Archive::put (target, msg->getValue ());
}
MessageQueue::Data* unpackGenericStringIdProsePackageMessage(Archive::ReadIterator & source)
{
typedef std::pair<std::pair<StringId, ProsePackage>, Unicode::String> Payload;
Payload v;
Archive::get(source, v);
MessageQueueGenericValueType<Payload> * const result = new MessageQueueGenericValueType<Payload>(v);
return result;
}
void packNetworkIdUnicodeStringPairMessage(const MessageQueue::Data * data, Archive::ByteStream & target)
{
const MessageQueueGenericValueType<std::pair<NetworkId, Unicode::String> > * const msg = dynamic_cast<const MessageQueueGenericValueType<std::pair<NetworkId, Unicode::String> > *>(data);
if(msg)
{
Archive::put(target, msg->getValue());
}
}
MessageQueue::Data* unpackNetworkIdUnicodeStringPairMessage(Archive::ReadIterator & source)
{
std::pair<NetworkId, Unicode::String> v;
Archive::get(source, v);
MessageQueueGenericValueType<std::pair<NetworkId, Unicode::String> > * result = new MessageQueueGenericValueType<std::pair<NetworkId, Unicode::String> >(v);
return result;
}
void packGenericVectorOfUnicodeStrings(const MessageQueue::Data * data, Archive::ByteStream & target)
{
const MessageQueueGenericValueType<std::vector<Unicode::String> > * const msg = dynamic_cast<const MessageQueueGenericValueType<std::vector<Unicode::String> > *>(data);
if(msg)
{
Archive::put(target, msg->getValue());
}
}
MessageQueue::Data* unpackGenericVectorOfUnicodeStrings(Archive::ReadIterator & source)
{
std::vector<Unicode::String> v;
Archive::get(source, v);
MessageQueueGenericValueType<std::vector<Unicode::String> > * const result = new MessageQueueGenericValueType<std::vector<Unicode::String> >(v);
return result;
}
//----------------------------------------------------------------------
void packCharacterMatchResultVectorMessage(const MessageQueue::Data * data, Archive::ByteStream & target)
{
const MessageQueueGenericValueType<MatchMakingCharacterResult> * const msg = dynamic_cast<const MessageQueueGenericValueType<MatchMakingCharacterResult> *>(data);
if(msg)
{
Archive::put(target, msg->getValue());
}
}
MessageQueue::Data* unpackCharacterMatchResultVectorMessage(Archive::ReadIterator & source)
{
MatchMakingCharacterResult v;
Archive::get(source, v);
MessageQueueGenericValueType<MatchMakingCharacterResult> * result = new MessageQueueGenericValueType<MatchMakingCharacterResult>(v);
return result;
}
//----------------------------------------------------------------------
void packStartingLocationSelectionResult(const MessageQueue::Data * data, Archive::ByteStream & target)
{
typedef std::pair<std::string, bool> Payload;
const MessageQueueGenericValueType<Payload> * const msg = safe_cast<const MessageQueueGenericValueType<Payload> *>(data);
if (msg)
Archive::put (target, msg->getValue ());
// packGenericMessage <Payload>(data, target);
}
MessageQueue::Data* unpackStartingLocationSelectionResult(Archive::ReadIterator & source)
{
typedef std::pair<std::string, bool> Payload;
Payload v;
Archive::get(source, v);
MessageQueueGenericValueType<Payload> * const result = new MessageQueueGenericValueType<Payload>(v);
return result;
}
//----------------------------------------------------------------------
void packStartingLocations(const MessageQueue::Data * data, Archive::ByteStream & target)
{
typedef std::pair<StartingLocationData, bool> PayloadData;
typedef std::vector<PayloadData> Payload;
const MessageQueueGenericValueType<Payload> * const msg = safe_cast<const MessageQueueGenericValueType<Payload> *>(data);
if (msg)
Archive::put (target, msg->getValue ());
}
MessageQueue::Data* unpackStartingLocations(Archive::ReadIterator & source)
{
typedef std::pair<StartingLocationData, bool> PayloadData;
typedef std::vector<PayloadData> Payload;
Payload v;
Archive::get(source, v);
MessageQueueGenericValueType<Payload> * const result = new MessageQueueGenericValueType<Payload>(v);
return result;
}
//----------------------------------------------------------------------
void packStringNetworkIdPairVector(const MessageQueue::Data * data, Archive::ByteStream & target)
{
typedef std::pair<NetworkId, std::string> PayloadData;
typedef std::vector<PayloadData> Payload;
const MessageQueueGenericValueType<Payload> * const msg = safe_cast<const MessageQueueGenericValueType<Payload> *>(data);
if (msg)
Archive::put (target, msg->getValue ());
}
MessageQueue::Data* unpackStringNetworkIdPairVector(Archive::ReadIterator & source)
{
typedef std::pair<NetworkId, std::string> PayloadData;
typedef std::vector<PayloadData> Payload;
Payload v;
Archive::get(source, v);
MessageQueueGenericValueType<Payload> * const result = new MessageQueueGenericValueType<Payload>(v);
return result;
}
//----------------------------------------------------------------------
void packSphereVectorMessage(const MessageQueue::Data * data, Archive::ByteStream & target)
{
const MessageQueueGenericValueType<std::vector<Sphere> > * const msg = dynamic_cast<const MessageQueueGenericValueType<std::vector<Sphere> > *>(data);
if(msg)
{
Archive::put(target, msg->getValue());
}
}
MessageQueue::Data* unpackSphereVectorMessage(Archive::ReadIterator & source)
{
std::vector<Sphere> v;
Archive::get(source, v);
MessageQueueGenericValueType<std::vector<Sphere> > * result = new MessageQueueGenericValueType<std::vector<Sphere> >(v);
return result;
}
//----------------------------------------------------------------------
void packNetworkIdBoolPair(const MessageQueue::Data * data, Archive::ByteStream & target)
{
typedef std::pair<NetworkId, bool> Payload;
const MessageQueueGenericValueType<Payload> * const msg = safe_cast<const MessageQueueGenericValueType<Payload> *>(data);
if (msg)
{
Archive::put (target, msg->getValue ());
}
}
MessageQueue::Data* unpackNetworkIdBoolPair(Archive::ReadIterator & source)
{
typedef std::pair<NetworkId, bool> Payload;
Payload v;
Archive::get(source, v);
MessageQueueGenericValueType<Payload> * const result = new MessageQueueGenericValueType<Payload>(v);
return result;
}
//----------------------------------------------------------------------
void packNetworkIdNetworkIdVector(const MessageQueue::Data * data, Archive::ByteStream & target)
{
typedef std::pair<NetworkId, std::vector<NetworkId> > Payload;
const MessageQueueGenericValueType<Payload> * const msg = safe_cast<const MessageQueueGenericValueType<Payload> *>(data);
if (msg)
{
Archive::put(target, msg->getValue().first);
Archive::put(target, msg->getValue().second);
}
}
MessageQueue::Data* unpackNetworkIdNetworkIdVector(Archive::ReadIterator & source)
{
typedef std::pair<NetworkId, std::vector<NetworkId> > Payload;
Payload payload;
Archive::get(source, payload.first);
Archive::get(source, payload.second);
MessageQueueGenericValueType<Payload> * const result = new MessageQueueGenericValueType<Payload>(payload);
return result;
}
//----------------------------------------------------------------------
void packNetworkIdVector(const MessageQueue::Data * data, Archive::ByteStream & target)
{
typedef std::vector<NetworkId> Payload;
const MessageQueueGenericValueType<Payload> * const msg = safe_cast<const MessageQueueGenericValueType<Payload> *>(data);
if (msg)
{
Archive::put(target, msg->getValue());
}
}
MessageQueue::Data* unpackNetworkIdVector(Archive::ReadIterator & source)
{
typedef std::vector<NetworkId> Payload;
Payload payload;
Archive::get(source, payload);
MessageQueueGenericValueType<Payload> * const result = new MessageQueueGenericValueType<Payload>(payload);
return result;
}
//----------------------------------------------------------------------
void packNothing(const MessageQueue::Data *, Archive::ByteStream &)
{
}
MessageQueue::Data* unpackNothing(Archive::ReadIterator &)
{
return NULL;
}
//----------------------------------------------------------------------
void packCommandTimerMessage( const MessageQueue::Data * data, Archive::ByteStream &target )
{
/*
typedef std::pair< byte, std::vector< float > > Payload;
const MessageQueueGenericValueType< Payload > * const msg = safe_cast< const MessageQueueGenericValueType< Payload > * >( data );
if ( msg )
{
Archive::put( target, msg->getValue() );
}
*/
const MessageQueueCommandTimer * msg = safe_cast< const MessageQueueCommandTimer * >( data );
if ( msg )
{
uint32 flags = msg->getFlags();
Archive::put( target, (byte)flags );
Archive::put( target, msg->getSequenceId() );
Archive::put( target, msg->getCommandNameCrc() );
if ( flags & MessageQueueCommandTimer::toBitValue( MessageQueueCommandTimer::F_cooldown ) )
{
Archive::put( target, msg->getCooldownGroup() );
}
if ( flags & MessageQueueCommandTimer::toBitValue( MessageQueueCommandTimer::F_cooldown2 ) )
{
Archive::put( target, msg->getCooldownGroup2() );
}
for ( int i = 0; i < MessageQueueCommandTimer::F_MAX; ++i )
{
MessageQueueCommandTimer::Flags flag = static_cast< MessageQueueCommandTimer::Flags >( i );
if ( flags & MessageQueueCommandTimer::toBitValue( flag ) )
{
Archive::put( target, msg->getCurrentTime( flag ) );
Archive::put( target, msg->getMaxTime( flag ) );
}
}
}
}
MessageQueue::Data* unpackCommandTimerMessage(Archive::ReadIterator & source)
{
/*
typedef std::pair< byte, std::vector< float > > Payload;
Payload v;
Archive::get(source, v);
MessageQueueGenericValueType<Payload> * const result = new MessageQueueGenericValueType<Payload>(v);
return result;
*/
byte flags;
Archive::get( source, flags );
uint32 sequenceId;
Archive::get( source, sequenceId );
uint32 commandNameCrc;
Archive::get( source, commandNameCrc );
int cooldownGroup = NULL_COOLDOWN_GROUP;
if ( flags & MessageQueueCommandTimer::toBitValue( MessageQueueCommandTimer::F_cooldown ) )
{
Archive::get( source, cooldownGroup );
}
int cooldownGroup2 = NULL_COOLDOWN_GROUP;
if ( flags & MessageQueueCommandTimer::toBitValue( MessageQueueCommandTimer::F_cooldown2 ) )
{
Archive::get( source, cooldownGroup2 );
}
MessageQueueCommandTimer *msg = new MessageQueueCommandTimer( sequenceId, cooldownGroup, cooldownGroup2, commandNameCrc );
for ( int i = 0; i < MessageQueueCommandTimer::F_MAX; ++i )
{
MessageQueueCommandTimer::Flags flag = static_cast< MessageQueueCommandTimer::Flags >( i );
if ( flags & MessageQueueCommandTimer::toBitValue( flag ) )
{
float value;
Archive::get( source, value );
msg->setCurrentTime( flag, value );
Archive::get( source, value );
msg->setMaxTime( flag, value );
}
}
return msg;
}
}
using namespace SetupSwgSharedNetworkMessagesNamespace;
// ----------------------------------------------------------------------
void SetupSwgSharedNetworkMessages::install ()
{
DEBUG_FATAL(g_installed, ("SetupSwgSharedNetworkMessages::install - is already installed"));
MessageQueueCombatAction::install();
MessageQueueCombatDamage::install();
ControllerMessageFactory::registerControllerMessageHandler(CM_setAttribute, packAttributeMessage, unpackAttributeMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_setMaxAttribute, packAttributeMessage, unpackAttributeMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_setMentalState, packMentalStatesMessage, unpackMentalStatesMessage );
ControllerMessageFactory::registerControllerMessageHandler(CM_setMaxMentalState, packMentalStatesMessage, unpackMentalStatesMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_setMentalStateToward, packMentalStatesTowardsMessage, unpackMentalStatesTowardsMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_setCover, packIntMessage, unpackIntMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_setMaxHitPoints, packIntMessage, unpackIntMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_setCombatAttitude, packIntMessage, unpackIntMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_setAutoAttack, packBoolMessage, unpackBoolMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_setInvulnerable, packBoolMessage, unpackBoolMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_setMentalStateTowardClampBehavior, packMentalStateTowardClampBehaviorMessage, unpackMentalStateTowardClampBehaviorMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_setMentalStateDecay, packMentalStateDecayMessage, unpackMentalStateDecayMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_setLocomotion, packLocomotionMessage, unpackLocomotionMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_addPlayerToSpawnQueue, packAddToPlayerSpawnQueueMessage, unpackAddToPlayerSpawnQueueMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_removePlayerFromSpawnQueue, packNetworkIdMessage, unpackNetworkIdMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_forwardNpcConversationMessage, packGenericStringIdProsePackageMessage, unpackGenericStringIdProsePackageMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_musicFlourish, packIntMessage, unpackIntMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_npcConversationSelect, packNothing, unpackNothing);
ControllerMessageFactory::registerControllerMessageHandler(CM_craftingSessionEnded, packBoolMessage, unpackBoolMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_biographyRetrieved, packNetworkIdUnicodeStringPairMessage, unpackNetworkIdUnicodeStringPairMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_characterMatchRetrieved, packCharacterMatchResultVectorMessage, unpackCharacterMatchResultVectorMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_startingLocations, packStartingLocations, unpackStartingLocations);
ControllerMessageFactory::registerControllerMessageHandler(CM_startingLocationSelectionResult, packStartingLocationSelectionResult, unpackStartingLocationSelectionResult);
ControllerMessageFactory::registerControllerMessageHandler(CM_disconnect, packNothing, unpackNothing);
ControllerMessageFactory::registerControllerMessageHandler(CM_emergencyDismountForRider, packNothing, unpackNothing);
ControllerMessageFactory::registerControllerMessageHandler(CM_detachRiderForMount, packNothing, unpackNothing);
ControllerMessageFactory::registerControllerMessageHandler(CM_formDataForEdit, packNetworkIdUnicodeStringPairMessage, unpackNetworkIdUnicodeStringPairMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_serverAsteroidDebugData, packSphereVectorMessage, unpackSphereVectorMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_commPlayer, packNetworkIdUnicodeStringPairMessage, unpackNetworkIdUnicodeStringPairMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_clientLookAtTargetComponent, packIntMessage, unpackIntMessage, true);
ControllerMessageFactory::registerControllerMessageHandler(CM_aboutToHyperspace, packGenericStringVectorPairMessage, unpackGenericStringVectorPairMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_playerTransitioningOut, packNothing, unpackNothing);
ControllerMessageFactory::registerControllerMessageHandler(CM_playerTransitioningIn, packNothing, unpackNothing);
ControllerMessageFactory::registerControllerMessageHandler(CM_addIgnoreIntersect, packNetworkIdMessage, unpackNetworkIdMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_removeIgnoreIntersect, packNetworkIdMessage, unpackNetworkIdMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_spaceTerminalRequest, packNetworkIdMessage, unpackNetworkIdMessage, true);
ControllerMessageFactory::registerControllerMessageHandler(CM_spaceTerminalResponse, packStringNetworkIdPairVector, unpackStringNetworkIdPairVector);
ControllerMessageFactory::registerControllerMessageHandler(CM_hyperspaceOrientShipToPointAndLockPlayerInput, packGenericStringVectorPairMessage, unpackGenericStringVectorPairMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_lockPlayerShipInputOnClient, packNothing, unpackNothing);
ControllerMessageFactory::registerControllerMessageHandler(CM_unlockPlayerShipInputOnClient, packNothing, unpackNothing);
ControllerMessageFactory::registerControllerMessageHandler(CM_inviteOtherGroupMembersToLaunchIntoSpace, packNetworkIdMessage, unpackNetworkIdMessage, true);
ControllerMessageFactory::registerControllerMessageHandler(CM_askGroupMemberToLaunchIntoSpace, packNetworkIdMessage, unpackNetworkIdMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_groupMemberInvitationToLaunchIntoSpaceResponse, packNetworkIdBoolPair, unpackNetworkIdBoolPair, true);
ControllerMessageFactory::registerControllerMessageHandler(CM_relayGroupMemberInvitationToLaunchAnswer, packNetworkIdBoolPair, unpackNetworkIdBoolPair);
ControllerMessageFactory::registerControllerMessageHandler(CM_groupOpenLotteryWindowOnClient, packNetworkIdMessage, unpackNetworkIdMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_groupCloseLotteryWindowOnClient, packNetworkIdMessage, unpackNetworkIdMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_groupLotteryWindowHeartbeat, packNetworkIdMessage, unpackNetworkIdMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_groupLotteryWindowCloseResults, packNetworkIdNetworkIdVector, unpackNetworkIdNetworkIdVector, true);
ControllerMessageFactory::registerControllerMessageHandler(CM_commandTimer, packCommandTimerMessage, unpackCommandTimerMessage );
ControllerMessageFactory::registerControllerMessageHandler(CM_requestActivateQuest, packIntMessage, unpackIntMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_requestCompleteQuest, packIntMessage, unpackIntMessage);
ControllerMessageFactory::registerControllerMessageHandler(CM_staticLootItemData, packGenericVectorOfUnicodeStrings, unpackGenericVectorOfUnicodeStrings);
ControllerMessageFactory::registerControllerMessageHandler(CM_showLootBox, packNetworkIdVector, unpackNetworkIdVector);
ControllerMessageFactory::registerControllerMessageHandler(CM_forceActivateQuest, packIntMessage, unpackIntMessage);
g_installed = true;
ExitChain::add (SetupSwgSharedNetworkMessages::remove, "SetupSwgSharedNetworkMessages");
}
// ----------------------------------------------------------------------
void SetupSwgSharedNetworkMessages::remove ( void )
{
DEBUG_FATAL(!g_installed, ("SetupSwgSharedNetworkMessages::remove - not already installed"));
g_installed = false;
}
// ----------------------------------------------------------------------
@@ -0,0 +1,30 @@
// ======================================================================
//
// SetupSwgSharedNetworkMessages.h
// copyright 2001 Sony Online Entertainment
//
// ======================================================================
#ifndef INCLUDED_SetupSwgSharedNetworkMessages_H
#define INCLUDED_SetupSwgSharedNetworkMessages_H
// ======================================================================
class SetupSwgSharedNetworkMessages
{
public:
static void install ( void );
static void remove();
private:
SetupSwgSharedNetworkMessages();
~SetupSwgSharedNetworkMessages();
SetupSwgSharedNetworkMessages(const SetupSwgSharedNetworkMessages&);
SetupSwgSharedNetworkMessages& operator= (const SetupSwgSharedNetworkMessages&);
};
// ======================================================================
#endif
@@ -0,0 +1,74 @@
// ======================================================================
//
// PermissionListCreateMessage.cpp
// copyright (c) 2002 Sony Online Entertainment
//
// ======================================================================
#include "swgSharedNetworkMessages/FirstSwgSharedNetworkMessages.h"
#include "swgSharedNetworkMessages/PermissionListCreateMessage.h"
#include <vector>
// ======================================================================
const char * const PermissionListCreateMessage::MessageType = "PermissionListCreateMessage";
//----------------------------------------------------------------------
PermissionListCreateMessage::PermissionListCreateMessage (const std::vector<Unicode::String> &currentMembers, const std::vector<Unicode::String> &nearbyPeople, Unicode::String listName)
: GameNetworkMessage(MessageType),
m_currentMembers(),
m_nearbyPeople(),
m_listName()
{
m_currentMembers.set(currentMembers);
m_nearbyPeople.set(nearbyPeople);
m_listName.set(listName);
addVariable(m_currentMembers);
addVariable(m_nearbyPeople);
addVariable(m_listName);
}
//-----------------------------------------------------------------------
PermissionListCreateMessage::PermissionListCreateMessage(Archive::ReadIterator & source)
: GameNetworkMessage(MessageType),
m_currentMembers(),
m_nearbyPeople(),
m_listName()
{
addVariable(m_currentMembers);
addVariable(m_nearbyPeople);
addVariable(m_listName);
unpack(source);
}
//----------------------------------------------------------------------
PermissionListCreateMessage::~PermissionListCreateMessage()
{
}
//----------------------------------------------------------------------
const std::vector<Unicode::String>& PermissionListCreateMessage::getCurrentMembers () const
{
return m_currentMembers.get();
}
//----------------------------------------------------------------------
const std::vector<Unicode::String>& PermissionListCreateMessage::getNearbyPeople () const
{
return m_nearbyPeople.get();
}
//----------------------------------------------------------------------
const Unicode::String& PermissionListCreateMessage::getListName () const
{
return m_listName.get();
}
// ======================================================================
@@ -0,0 +1,46 @@
// ======================================================================
//
// PermissionListCreateMessage.h
// copyright (c) 2002 Sony Online Entertainment
//
// ======================================================================
#ifndef INCLUDED_PermissionListCreateMessage_H
#define INCLUDED_PermissionListCreateMessage_H
//-----------------------------------------------------------------------
#include "sharedNetworkMessages/GameNetworkMessage.h"
#include "Unicode.h"
#include "unicodeArchive/UnicodeArchive.h"
//-----------------------------------------------------------------------
class PermissionListCreateMessage : public GameNetworkMessage
{
public:
static const char * const MessageType;
PermissionListCreateMessage (const stdvector<Unicode::String>::fwd &currentMembers, const stdvector<Unicode::String>::fwd &nearbyPeople, Unicode::String listName);
explicit PermissionListCreateMessage (Archive::ReadIterator & source);
virtual ~PermissionListCreateMessage ();
const stdvector<Unicode::String>::fwd& getCurrentMembers () const;
const stdvector<Unicode::String>::fwd& getNearbyPeople () const;
const Unicode::String& getListName () const;
private:
//disabled
PermissionListCreateMessage (const PermissionListCreateMessage&);
PermissionListCreateMessage& operator= (const PermissionListCreateMessage&);
private:
Archive::AutoArray<Unicode::String> m_currentMembers;
Archive::AutoArray<Unicode::String> m_nearbyPeople;
Archive::AutoVariable<Unicode::String> m_listName;
};
// ======================================================================
#endif
@@ -0,0 +1,68 @@
// ======================================================================
//
// PermissionListModifyMessage.cpp
// copyright (c) 2002 Sony Online Entertainment
//
// ======================================================================
#include "swgSharedNetworkMessages/FirstSwgSharedNetworkMessages.h"
#include "swgSharedNetworkMessages/PermissionListModifyMessage.h"
// ======================================================================
PermissionListModifyMessage::PermissionListModifyMessage (const Unicode::String& person, const Unicode::String& listName, const Unicode::String& action)
: GameNetworkMessage("PermissionListModifyMessage"),
m_person (),
m_listName(),
m_action ()
{
m_person.set (person);
m_listName.set(listName);
m_action.set (action);
addVariable (m_person);
addVariable (m_listName);
addVariable (m_action);
}
//-----------------------------------------------------------------------
PermissionListModifyMessage::PermissionListModifyMessage(Archive::ReadIterator & source)
: GameNetworkMessage("PermissionListModifyMessage"),
m_person (),
m_listName(),
m_action ()
{
addVariable(m_person);
addVariable(m_listName);
addVariable(m_action);
unpack (source);
}
//----------------------------------------------------------------------
PermissionListModifyMessage::~PermissionListModifyMessage()
{
}
//----------------------------------------------------------------------
const Unicode::String & PermissionListModifyMessage::getPerson () const
{
return m_person.get();
}
//----------------------------------------------------------------------
const Unicode::String & PermissionListModifyMessage::getListName () const
{
return m_listName.get();
}
//----------------------------------------------------------------------
const Unicode::String & PermissionListModifyMessage::getAction () const
{
return m_action.get();
}
// =====================================================================
@@ -0,0 +1,42 @@
// ======================================================================
//
// PermissionListModifyMessage.h
// copyright (c) 2002 Sony Online Entertainment
//
// ======================================================================
#ifndef INCLUDED_PermissionListModifyMessage_H
#define INCLUDED_PermissionListModifyMessage_H
//-----------------------------------------------------------------------
#include "sharedNetworkMessages/GameNetworkMessage.h"
#include "Unicode.h"
#include "unicodeArchive/UnicodeArchive.h"
//-----------------------------------------------------------------------
class PermissionListModifyMessage : public GameNetworkMessage
{
public:
PermissionListModifyMessage (const Unicode::String& person, const Unicode::String& listName, const Unicode::String& action);
explicit PermissionListModifyMessage (Archive::ReadIterator & source);
virtual ~PermissionListModifyMessage ();
const Unicode::String & getPerson () const;
const Unicode::String & getListName () const;
const Unicode::String & getAction () const;
private:
//disabled
PermissionListModifyMessage (const PermissionListModifyMessage&);
PermissionListModifyMessage& operator= (const PermissionListModifyMessage&);
private:
Archive::AutoVariable<Unicode::String> m_person;
Archive::AutoVariable<Unicode::String> m_listName;
Archive::AutoVariable<Unicode::String> m_action;
};
// ======================================================================
#endif
@@ -0,0 +1,86 @@
// ======================================================================
//
// ResourceListForSurveyMessage.cpp
// copyright (c) 2002 Sony Online Entertainment
//
// ======================================================================
#include "swgSharedNetworkMessages/FirstSwgSharedNetworkMessages.h"
#include "swgSharedNetworkMessages/ResourceListForSurveyMessage.h"
// ======================================================================
const char * const ResourceListForSurveyMessage::MessageType = "ResourceListForSurveyMessage";
//----------------------------------------------------------------------
ResourceListForSurveyMessage::ResourceListForSurveyMessage (const stdvector<DataItem>::fwd &data, const std::string& type, const NetworkId& surveyToolId) :
GameNetworkMessage(MessageType),
m_data(),
m_surveyType(),
m_surveyToolId()
{
m_data.set(data);
m_surveyType.set(type);
m_surveyToolId.set(surveyToolId);
addVariable(m_data);
addVariable(m_surveyType);
addVariable(m_surveyToolId);
}
//-----------------------------------------------------------------------
ResourceListForSurveyMessage::ResourceListForSurveyMessage(Archive::ReadIterator & source) :
GameNetworkMessage(MessageType),
m_data()
{
addVariable(m_data);
addVariable(m_surveyType);
addVariable(m_surveyToolId);
unpack(source);
}
//----------------------------------------------------------------------
ResourceListForSurveyMessage::~ResourceListForSurveyMessage()
{
}
//----------------------------------------------------------------------
const std::vector<ResourceListForSurveyMessage::DataItem> &ResourceListForSurveyMessage::getData() const
{
return m_data.get();
}
//----------------------------------------------------------------------
const std::string& ResourceListForSurveyMessage::getType() const
{
return m_surveyType.get();
}
//----------------------------------------------------------------------
const NetworkId &ResourceListForSurveyMessage::getSurveyToolId() const
{
return m_surveyToolId.get();
}
// =====================================================================
void Archive::put(ByteStream &target, const ResourceList_DataItem &data)
{
put(target,data.resourceName);
put(target,data.resourceId);
put(target,data.parentClassName);
}
void Archive::get(ReadIterator &source, ResourceList_DataItem &data)
{
get(source,data.resourceName);
get(source,data.resourceId);
get(source,data.parentClassName);
}
// ======================================================================
@@ -0,0 +1,65 @@
// ======================================================================
//
// ResourceListForSurveyMessage.h
// copyright (c) 2002 Sony Online Entertainment
//
// ======================================================================
#ifndef INCLUDED_ResourceListForSurveyMessage_H
#define INCLUDED_ResourceListForSurveyMessage_H
//-----------------------------------------------------------------------
#include "sharedNetworkMessages/GameNetworkMessage.h"
#include "Unicode.h"
#include "sharedFoundation/NetworkIdArchive.h"
#include "unicodeArchive/UnicodeArchive.h"
//-----------------------------------------------------------------------
struct ResourceList_DataItem
{
std::string resourceName;
NetworkId resourceId;
std::string parentClassName;
};
//-----------------------------------------------------------------------
class ResourceListForSurveyMessage : public GameNetworkMessage
{
public:
static const char * const MessageType;
typedef ResourceList_DataItem DataItem;
public:
ResourceListForSurveyMessage (const stdvector<DataItem>::fwd &data, const std::string& type, const NetworkId& surveyToolId);
explicit ResourceListForSurveyMessage (Archive::ReadIterator & source);
virtual ~ResourceListForSurveyMessage ();
const std::vector<DataItem> &getData () const;
const std::string& getType () const;
const NetworkId &getSurveyToolId () const;
private:
Archive::AutoArray<DataItem> m_data;
Archive::AutoVariable<std::string> m_surveyType;
Archive::AutoVariable<NetworkId> m_surveyToolId;
private:
ResourceListForSurveyMessage (const ResourceListForSurveyMessage&);
ResourceListForSurveyMessage& operator= (const ResourceListForSurveyMessage&);
};
// ======================================================================
namespace Archive
{
void put(ByteStream &target, const ResourceList_DataItem &data);
void get(ReadIterator &source, ResourceList_DataItem &data);
}
// ======================================================================
#endif
@@ -0,0 +1,64 @@
// ======================================================================
//
// SurveyMessage.cpp
// copyright (c) 2002 Sony Online Entertainment
//
// ======================================================================
#include "swgSharedNetworkMessages/FirstSwgSharedNetworkMessages.h"
#include "swgSharedNetworkMessages/SurveyMessage.h"
#include "sharedMathArchive/VectorArchive.h"
// ======================================================================
const char * const SurveyMessage::MessageType = "SurveyMessage";
//----------------------------------------------------------------------
SurveyMessage::SurveyMessage (const stdvector<DataItem>::fwd &data) :
GameNetworkMessage(MessageType),
m_data()
{
m_data.set(data);
addVariable(m_data);
}
//-----------------------------------------------------------------------
SurveyMessage::SurveyMessage(Archive::ReadIterator & source) :
GameNetworkMessage(MessageType),
m_data()
{
addVariable(m_data);
unpack(source);
}
//----------------------------------------------------------------------
SurveyMessage::~SurveyMessage()
{
}
//----------------------------------------------------------------------
const std::vector<SurveyMessage::DataItem>& SurveyMessage::getData() const
{
return m_data.get();
}
// ======================================================================
void Archive::put(ByteStream &target, const Survey_DataItem &data)
{
put(target,data.m_location);
put(target,data.m_efficiency);
}
void Archive::get(ReadIterator &source, Survey_DataItem &data)
{
get(source,data.m_location);
get(source,data.m_efficiency);
}
// ======================================================================
@@ -0,0 +1,59 @@
// ======================================================================
//
// SurveyMessage.h
// copyright (c) 2002 Sony Online Entertainment
//
// ======================================================================
#ifndef INCLUDED_SurveyMessage_H
#define INCLUDED_SurveyMessage_H
//-----------------------------------------------------------------------
#include "sharedMath/Vector.h"
#include "sharedNetworkMessages/GameNetworkMessage.h"
//-----------------------------------------------------------------------
struct Survey_DataItem
{
Vector m_location;
float m_efficiency;
};
//-----------------------------------------------------------------------
class SurveyMessage : public GameNetworkMessage
{
public:
static const char * const MessageType;
typedef Survey_DataItem DataItem;
public:
SurveyMessage (const stdvector<DataItem>::fwd &data);
explicit SurveyMessage (Archive::ReadIterator & source);
virtual ~SurveyMessage ();
const stdvector<DataItem>::fwd& getData() const;
private:
Archive::AutoArray<DataItem> m_data;
private:
SurveyMessage (const SurveyMessage&);
SurveyMessage& operator= (const SurveyMessage&);
};
// ======================================================================
namespace Archive
{
void put(ByteStream &target, const Survey_DataItem &data);
void get(ReadIterator &source, Survey_DataItem &data);
}
// ======================================================================
#endif
@@ -0,0 +1,9 @@
//========================================================================
//
// FirstSwgSharedNetworkMessages.cpp
//
// copyright 2001 Sony Online Entertainment
//
//========================================================================
#include "swgSharedNetworkMessages/FirstSwgSharedNetworkMessages.h"