Ev'ryday I'm bufferin'.

This commit is contained in:
Marc-Eric Martel
2023-10-27 09:51:40 -04:00
parent 0bc7f29492
commit 9ef44a3993
4 changed files with 82 additions and 50 deletions

View File

@@ -14,7 +14,9 @@ using namespace netprot;
class Server {
public:
Server(LogDest log = LOG_DEST::CONSOLE);
enum LOG_DEST: unsigned char { CONSOLE, LOGFILE, LOG_LAST };
Server(LOG_DEST log = LOG_DEST::CONSOLE);
~Server();
int Init();
@@ -22,18 +24,21 @@ public:
void Run();
private:
#ifdef _WIN32
WSADATA m_wsaData;
#endif
SOCKET m_sock_udp = 0,
m_sock_tcp = 0;
LogDest m_log;
LOG_DEST m_log;
std::ofstream m_logfile;
Buffer m_buf;
std::map<uint64_t, Connection*> m_players;
std::map <Timestamp, netprot::Chat> m_chatlog;
std::map <Timestamp, Chat> m_chatlog;
std::vector<uint64_t> m_ids;
netprot::GameInfo m_game;
GameInfo m_game;
World* m_world = nullptr;
const bool m_manual_setup = SRV_MANUAL_SETUP;
@@ -42,16 +47,8 @@ private:
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);
uint64_t getUniqueId();
};
//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