1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-25 05:57:45 +00:00
sapphire/src/servers/sapphire_zone/ServerZone.h

62 lines
1.1 KiB
C
Raw Normal View History

2017-08-08 13:53:47 +02:00
#ifndef __GAMESERVER_H
#define __GAMESERVER_H
2018-03-06 22:22:19 +01:00
#include <Common.h>
2017-08-08 13:53:47 +02:00
#include <boost/shared_ptr.hpp>
#include <mutex>
#include <map>
#include "Forwards.h"
namespace Core {
class ServerZone
{
public:
ServerZone( const std::string& configPath );
2017-08-08 13:53:47 +02:00
~ServerZone();
void run( int32_t argc, char* argv[] );
2017-08-08 13:53:47 +02:00
bool createSession( uint32_t sessionId );
void removeSession( uint32_t sessionId );
void removeSession( std::string playerName );
bool loadSettings( int32_t argc, char* argv[] );
2017-08-08 13:53:47 +02:00
SessionPtr getSession( uint32_t id );
SessionPtr getSession( std::string playerName );
2017-09-14 17:28:24 +02:00
size_t getSessionCount() const;
2017-09-14 17:07:58 +02:00
2017-10-01 17:58:11 +02:00
void mainLoop();
bool isRunning() const;
void printBanner() const;
2017-08-08 13:53:47 +02:00
private:
uint16_t m_port;
std::string m_ip;
2018-02-02 01:22:58 +11:00
int64_t m_lastDBPingTime;
2017-08-08 13:53:47 +02:00
2017-10-01 17:58:11 +02:00
bool m_bRunning;
2017-08-08 13:53:47 +02:00
std::string m_configPath;
std::mutex m_sessionMutex;
std::map< uint32_t, SessionPtr > m_sessionMapById;
std::map< std::string, SessionPtr > m_sessionMapByName;
2017-08-08 13:53:47 +02:00
std::map< uint32_t, uint32_t > m_zones;
};
}
#endif