Started work on generic network ordered list object
This commit is contained in:
parent
ed4810e6ee
commit
2f7ebfe083
8 changed files with 439 additions and 130 deletions
|
|
@ -1,19 +1,24 @@
|
|||
#include "NetObjManager.hpp"
|
||||
#include "NetObjPtr.hpp"
|
||||
|
||||
namespace NetworkingObjects {
|
||||
NetObjManager::NetObjManager(std::shared_ptr<NetObjIDGenerator> initIDGen, std::shared_ptr<NetObjManagerTypeList> initTypeList):
|
||||
NetObjManager::NetObjManager(std::shared_ptr<NetObjIDGenerator> initIDGen, std::shared_ptr<NetObjManagerTypeList> initTypeList, bool initIsServer):
|
||||
isServer(initIsServer),
|
||||
idGen(initIDGen),
|
||||
typeList(initTypeList),
|
||||
nextTypeID(0)
|
||||
{}
|
||||
void NetObjManager::read_update_message(cereal::PortableBinaryInputArchive& a) {
|
||||
void NetObjManager::read_update_message(cereal::PortableBinaryInputArchive& a, const std::shared_ptr<NetServer::ClientData>& clientReceivedFrom) {
|
||||
NetObjID id;
|
||||
a(id);
|
||||
auto it = objectData.find(id);
|
||||
if(it == objectData.end())
|
||||
return;
|
||||
auto& netTypeIDData = typeList->netTypeIDData[it->second.netTypeID];
|
||||
netTypeIDData.readUpdateFunc(it->second.p.get(), a);
|
||||
if(isServer)
|
||||
netTypeIDData.readUpdateFuncServer(NetObjPtr<void>(this, id, it->second.p), a, clientReceivedFrom);
|
||||
else
|
||||
netTypeIDData.readUpdateFuncClient(NetObjPtr<void>(this, id, it->second.p), a, clientReceivedFrom);
|
||||
}
|
||||
void NetObjManager::set_client(std::shared_ptr<NetClient> initClient, MessageCommandType initUpdateCommandID) {
|
||||
client = initClient;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue