36 lines
592 B
C++
36 lines
592 B
C++
#ifndef SERVER_H__
|
|
#define SERVER_H__
|
|
|
|
#include <fstream>
|
|
#include <vector>
|
|
#include <string>
|
|
#include "../SQCSim-common/world.h"
|
|
#include "define.h"
|
|
#include "connection.h"
|
|
|
|
class Server {
|
|
public:
|
|
Server(LogDest 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;
|
|
LogDest m_log;
|
|
std::ofstream m_logfile;
|
|
|
|
Connection* m_conn[MAX_CONNECTIONS];
|
|
World* m_world = nullptr;
|
|
|
|
std::string Timestamp();
|
|
void Log(std::string str, bool is_error, bool is_fatal);
|
|
};
|
|
#endif
|