Started work on network object system
This commit is contained in:
parent
a2ce579b8b
commit
ed4810e6ee
12 changed files with 394 additions and 74 deletions
26
include/Helpers/NetworkingObjects/NetObjManager.cpp
Normal file
26
include/Helpers/NetworkingObjects/NetObjManager.cpp
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
#include "NetObjManager.hpp"
|
||||
|
||||
namespace NetworkingObjects {
|
||||
NetObjManager::NetObjManager(std::shared_ptr<NetObjIDGenerator> initIDGen, std::shared_ptr<NetObjManagerTypeList> initTypeList):
|
||||
idGen(initIDGen),
|
||||
typeList(initTypeList),
|
||||
nextTypeID(0)
|
||||
{}
|
||||
void NetObjManager::read_update_message(cereal::PortableBinaryInputArchive& a) {
|
||||
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);
|
||||
}
|
||||
void NetObjManager::set_client(std::shared_ptr<NetClient> initClient, MessageCommandType initUpdateCommandID) {
|
||||
client = initClient;
|
||||
updateCommandID = initUpdateCommandID;
|
||||
}
|
||||
void NetObjManager::set_server(std::shared_ptr<NetServer> initServer, MessageCommandType initUpdateCommandID) {
|
||||
server = initServer;
|
||||
updateCommandID = initUpdateCommandID;
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue