mirror of
https://github.com/SapphireServer/Sapphire.git
synced 2025-05-31 13:37:45 +00:00
Minimal project for zone
This commit is contained in:
parent
b9363d834d
commit
34f3b36b9f
6 changed files with 147 additions and 3 deletions
|
@ -44,7 +44,7 @@ configure_file( "${CMAKE_CURRENT_SOURCE_DIR}/src/common/Version.cpp.in"
|
||||||
#add_subdirectory( "src/libraries/sapphire/datReader" )
|
#add_subdirectory( "src/libraries/sapphire/datReader" )
|
||||||
#add_subdirectory( "src/libraries/sapphire/mysqlConnector" )
|
#add_subdirectory( "src/libraries/sapphire/mysqlConnector" )
|
||||||
add_subdirectory( "src/common" )
|
add_subdirectory( "src/common" )
|
||||||
#add_subdirectory( "src/servers" )
|
add_subdirectory( "src/sapphire_zone" )
|
||||||
|
|
||||||
#add_subdirectory( "src/tools/exd_common_gen" )
|
#add_subdirectory( "src/tools/exd_common_gen" )
|
||||||
#add_subdirectory( "src/tools/exd_struct_gen" )
|
#add_subdirectory( "src/tools/exd_struct_gen" )
|
||||||
|
|
|
@ -25,8 +25,10 @@ ExternalProject_Add( mysqlConnector_external
|
||||||
INSTALL_DIR ${MYSQLCONNECTOR_ROOT}/bin
|
INSTALL_DIR ${MYSQLCONNECTOR_ROOT}/bin
|
||||||
BUILD_COMMAND ${BUILD_EXEC} )
|
BUILD_COMMAND ${BUILD_EXEC} )
|
||||||
|
|
||||||
|
message( ${MYSQLCONNECTOR_ROOT}/src/MysqlConnector/src/ )
|
||||||
|
|
||||||
add_library( mysqlConnector STATIC IMPORTED )
|
add_library( mysqlConnector STATIC IMPORTED )
|
||||||
set_target_properties( mysqlConnector PROPERTIES IMPORTED_LOCATION ${MYSQLCONNECTOR_LIB_DIR}/mysqlConnector.a )
|
set_target_properties( mysqlConnector PROPERTIES IMPORTED_LOCATION ${MYSQLCONNECTOR_ROOT}/src/MysqlConnector/src/libmysqlConnector.a )
|
||||||
add_dependencies( mysqlConnector mysqlConnector_external )
|
add_dependencies( mysqlConnector mysqlConnector_external )
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
@ -46,7 +48,7 @@ ExternalProject_Add( xivdat_external
|
||||||
BUILD_COMMAND ${BUILD_EXEC} )
|
BUILD_COMMAND ${BUILD_EXEC} )
|
||||||
|
|
||||||
add_library( xivdat STATIC IMPORTED )
|
add_library( xivdat STATIC IMPORTED )
|
||||||
set_target_properties( xivdat PROPERTIES IMPORTED_LOCATION ${XIVDAT_LIB_DIR}/xivdat.a )
|
set_target_properties( xivdat PROPERTIES IMPORTED_LOCATION ${XIVDAT_ROOT}/src/XivDat/src/libxivdat.a )
|
||||||
add_dependencies( xivdat xivdat_external )
|
add_dependencies( xivdat xivdat_external )
|
||||||
|
|
||||||
#############################################################################
|
#############################################################################
|
||||||
|
|
24
src/sapphire_zone/CMakeLists.txt
Normal file
24
src/sapphire_zone/CMakeLists.txt
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
cmake_minimum_required(VERSION 3.0.2)
|
||||||
|
cmake_policy(SET CMP0015 NEW)
|
||||||
|
cmake_policy(SET CMP0014 OLD)
|
||||||
|
|
||||||
|
project( sapphire_zone )
|
||||||
|
|
||||||
|
file(GLOB SERVER_PUBLIC_INCLUDE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
/*.h
|
||||||
|
)
|
||||||
|
|
||||||
|
file(GLOB SERVER_SOURCE_FILES RELATIVE ${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
*.c*
|
||||||
|
)
|
||||||
|
|
||||||
|
add_executable( sapphire_zone ${SERVER_PUBLIC_INCLUDE_FILES} ${SERVER_SOURCE_FILES} )
|
||||||
|
|
||||||
|
target_link_libraries( sapphire_zone common )
|
||||||
|
|
||||||
|
if (UNIX)
|
||||||
|
target_link_libraries( sapphire_zone pthread )
|
||||||
|
target_link_libraries( sapphire_zone dl )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
target_include_directories( sapphire_zone PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}" )
|
63
src/sapphire_zone/ZoneServer.cpp
Normal file
63
src/sapphire_zone/ZoneServer.cpp
Normal file
|
@ -0,0 +1,63 @@
|
||||||
|
#include "ZoneServer.h"
|
||||||
|
|
||||||
|
#include <Version.h>
|
||||||
|
#include <Logging/Logger.h>
|
||||||
|
#include <Config/XMLConfig.h>
|
||||||
|
|
||||||
|
#include <MySqlBase.h>
|
||||||
|
#include <Connection.h>
|
||||||
|
|
||||||
|
#include <Network/Connection.h>
|
||||||
|
#include <Network/Hive.h>
|
||||||
|
|
||||||
|
#include <Exd/ExdDataGenerated.h>
|
||||||
|
#include <Network/PacketContainer.h>
|
||||||
|
#include <Database/DbLoader.h>
|
||||||
|
#include <Database/CharaDbConnection.h>
|
||||||
|
#include <Database/DbWorkerPool.h>
|
||||||
|
#include <Database/PreparedStatement.h>
|
||||||
|
#include <Util/Util.h>
|
||||||
|
|
||||||
|
#include <boost/make_shared.hpp>
|
||||||
|
#include <thread>
|
||||||
|
|
||||||
|
|
||||||
|
Core::ServerZone::ServerZone( const std::string& configPath ) :
|
||||||
|
m_configPath( configPath ),
|
||||||
|
m_bRunning( true ),
|
||||||
|
m_lastDBPingTime( 0 )
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
Core::ServerZone::~ServerZone()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Core::ServerZone::loadSettings( int32_t argc, char* argv[] )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::ServerZone::run( int32_t argc, char* argv[] )
|
||||||
|
{
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::ServerZone::printBanner() const
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Core::ServerZone::mainLoop()
|
||||||
|
{
|
||||||
|
while( isRunning() )
|
||||||
|
{
|
||||||
|
this_thread::sleep_for( chrono::milliseconds( 50 ) );
|
||||||
|
auto currTime = Util::getTimeSeconds();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Core::ZoneServer::isRunning() const
|
||||||
|
{
|
||||||
|
return m_bRunning;
|
||||||
|
}
|
46
src/sapphire_zone/ZoneServer.h
Normal file
46
src/sapphire_zone/ZoneServer.h
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
#ifndef __GAMESERVER_H
|
||||||
|
#define __GAMESERVER_H
|
||||||
|
|
||||||
|
#include <Common.h>
|
||||||
|
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
#include <mutex>
|
||||||
|
#include <map>
|
||||||
|
|
||||||
|
namespace Core {
|
||||||
|
|
||||||
|
class ServerZone
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
ServerZone( const std::string& configPath );
|
||||||
|
~ServerZone();
|
||||||
|
|
||||||
|
void run( int32_t argc, char* argv[] );
|
||||||
|
|
||||||
|
bool loadSettings( int32_t argc, char* argv[] );
|
||||||
|
|
||||||
|
void mainLoop();
|
||||||
|
|
||||||
|
bool isRunning() const;
|
||||||
|
|
||||||
|
void printBanner() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
uint16_t m_port;
|
||||||
|
std::string m_ip;
|
||||||
|
int64_t m_lastDBPingTime;
|
||||||
|
|
||||||
|
bool m_bRunning;
|
||||||
|
|
||||||
|
std::string m_configPath;
|
||||||
|
|
||||||
|
std::map< uint32_t, uint32_t > m_zones;
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
9
src/sapphire_zone/main.cpp
Normal file
9
src/sapphire_zone/main.cpp
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "ZoneServer.h"
|
||||||
|
|
||||||
|
int main()
|
||||||
|
{
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue