mirror of
https://github.com/OpenFusionProject/OpenFusion.git
synced 2026-04-01 17:20:04 +00:00
* Cleaned up protocol selection. * cmake now works even if protocol option is omitted * make now supports protocol selection * removed PACKET_VERSION/CNPROTO_VERSION* redundancy * ubuntu appveyor script has yet to be written * cleaned up some trailing spaces * Add some test items. Ironically, this change is untested. * [bugfix] Transmit MOTD when entering the game, not when loading screen fades. This fixes unnecessary retransmission when /warping.
55 lines
1.3 KiB
C++
55 lines
1.3 KiB
C++
#include "CNLoginServer.hpp"
|
|
#include "CNShardServer.hpp"
|
|
#include "PlayerManager.hpp"
|
|
#include "ChatManager.hpp"
|
|
#include "ItemManager.hpp"
|
|
#include "NanoManager.hpp"
|
|
#include "NPCManager.hpp"
|
|
|
|
#include "settings.hpp"
|
|
|
|
#if defined(__MINGW32__) && !defined(_GLIBCXX_HAS_GTHREADS)
|
|
#include "mingw/mingw.thread.h"
|
|
#else
|
|
#include <thread>
|
|
#endif
|
|
#include <string>
|
|
|
|
void startShard(CNShardServer* server) {
|
|
server->start();
|
|
}
|
|
|
|
int main() {
|
|
#ifdef _WIN32
|
|
WSADATA wsaData;
|
|
if (WSAStartup(MAKEWORD(1,1), &wsaData) != 0) {
|
|
std::cerr << "OpenFusion: WSAStartup failed" << std::endl;
|
|
exit(EXIT_FAILURE);
|
|
}
|
|
#endif
|
|
settings::init();
|
|
std::cout << "[INFO] Protocol version: " << PROTOCOL_VERSION << std::endl;
|
|
std::cout << "[INFO] Intializing Packet Managers..." << std::endl;
|
|
PlayerManager::init();
|
|
ChatManager::init();
|
|
ItemManager::init();
|
|
NanoManager::init();
|
|
NPCManager::init();
|
|
|
|
std::cout << "[INFO] Starting Server Threads..." << std::endl;
|
|
CNLoginServer loginServer(settings::LOGINPORT);
|
|
CNShardServer shardServer(settings::SHARDPORT);
|
|
|
|
std::thread shardThread(startShard, (CNShardServer*)&shardServer);
|
|
|
|
loginServer.start();
|
|
|
|
shardServer.kill();
|
|
shardThread.join();
|
|
|
|
#ifdef _WIN32
|
|
WSACleanup();
|
|
#endif
|
|
return 0;
|
|
}
|