#ifndef SERVER_H__ #define SERVER_H__ #include #include #include #include #include "../SQCSim-common/world.h" #include "../SQCSim-common/netprotocol.h" #include "define.h" #include "connection.h" using namespace netprot; class Server { public: enum LOG_DEST: unsigned char { CONSOLE, LOGFILE, LOG_LAST }; Server(LOG_DEST log = LOG_DEST::CONSOLE); ~Server(); int Init(); int Ready(); void Run(); private: #ifdef _WIN32 WSADATA m_wsaData; #endif SOCKET m_sock_udp = 0, m_sock_tcp = 0; LOG_DEST m_log; std::ofstream m_logfile; Buffer m_buf; std::map> m_players; std::map m_chatlog; std::vector m_ids; GameInfo m_game; std::unique_ptr m_world = nullptr; const bool m_manual_setup = SRV_MANUAL_SETUP; std::string LogTimestamp(); void Log(std::string str, bool is_error, bool is_fatal); void buildIdList(size_t size); uint64_t getUniqueId(); }; #endif