This commit is contained in:
MarcEricMartel
2023-09-28 09:15:39 -04:00
parent df52d4a084
commit 7e043eb9f8
3 changed files with 65 additions and 19 deletions

View File

@@ -3,6 +3,7 @@
#include <fstream>
#include <vector>
#include <set>
#include <string>
#include "../SQCSim-common/world.h"
#include "../SQCSim-common/netprotocol.h"
@@ -27,10 +28,27 @@ private:
LogDest m_log;
std::ofstream m_logfile;
Connection* m_conn[MAX_CONNECTIONS];
std::map<uint64_t, Connection*> m_players;
std::map <Timestamp, netprot::Chat> m_chatlog;
std::vector<uint64_t> m_ids;
netprot::GameInfo m_game;
World* m_world = nullptr;
std::string Timestamp();
void Log(std::string str, bool is_error, bool is_fatal);
void buildIdList(size_t size);
uint64_t getUniqueId();
template <class T> void sendPack(SOCKET sock, T* pack, char** buf, uint32_t* buflen);
};
template <class T>
void Server::sendPack(SOCKET sock, T* pack, char** buf, uint32_t* buflen) {
netprot::Serialize(pack, buf, buflen);
send(sock, *buf, *buflen, 0);
*buflen = BUFFER_LENGTH;
}
#endif