35 lines
563 B
C++
35 lines
563 B
C++
#ifndef _SERVER_H__
|
|
#define _SERVER_H__
|
|
|
|
#include <fstream>
|
|
#include <vector>
|
|
#include <string>
|
|
#include "../SQCSim-common/world.h"
|
|
#include "define.h"
|
|
|
|
class Server {
|
|
public:
|
|
Server(LogDest log = LogDest::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;
|
|
World* m_world = nullptr;
|
|
std::vector<Player> m_players;
|
|
|
|
std::string Timestamp();
|
|
void Log(std::string str, bool is_error, bool is_fatal);
|
|
};
|
|
#endif
|