#include "../common/network/Utils.hpp"
#include "../common/network/Command.hpp"
#include "../common/Logger.hpp"
+#include "version.hpp"
namespace network {
session->Send(network::ServerReceiveClientInfo(
network::Encrypter::GetHash(public_key),
- PROTOCOL_VERSION,
+ (uint16_t)MMO_PROTOCOL_VERSION,
session->udp_port()
));
}
#include "../common/network/Signature.hpp"
#define UDP_MAX_RECEIVE_LENGTH (512)
-#define PROTOCOL_VERSION (1)
#define DEFAULT_WRITE_AVERAGE_LIMIT (200)
namespace network {
}
break;
+ case ClientReceiveUnsupportVersionError:
+ {
+ status_ = STATUS_ERROR_VERSION;
+ }
+ break;
+
// サーバーデータ受信
case ClientReceiveServerInfo:
{
STATUS_READY,
STATUS_ERROR,
STATUS_ERROR_CROWDED,
- STATUS_ERROR_NOSTAGE
+ STATUS_ERROR_NOSTAGE,
+ STATUS_ERROR_VERSION
};
public:
int width, height;
GetScreenState(&width, &height, nullptr);
- message_.set_width(400);
+ message_.set_width(450);
message_.set_text(_T("\90Ú\91±\92\86..."));
message_.set_bgcolor(UIBase::Color(0,0,0,0));
message_.set_textcolor(UIBase::Color(0,0,0,255));
message_.set_text(_T("\83G\83\89\81[\81F\90l\90\94\82ª\91½\82·\82¬\82Ü\82·"));
command_manager_->set_client(ClientUniqPtr());
break;
+ case CommandManager::STATUS_ERROR_VERSION:
+ message_.set_text(_T("\83G\83\89\81[\81F\83T\81[\83o\81[\82Æ\83N\83\89\83C\83A\83\93\83g\82Ì\83o\81[\83W\83\87\83\93\82ª\91Î\89\9e\82µ\82Ä\82¢\82Ü\82¹\82ñ"));
+ command_manager_->set_client(ClientUniqPtr());
+ break;
case CommandManager::STATUS_ERROR_NOSTAGE:
message_.set_text((tformat(_T("\83G\83\89\81[\81F\90Ú\91±\82·\82é\82É\82Í\83X\83e\81[\83W\83f\81[\83^\81u%s\81v\82ª\95K\97v\82Å\82·")) %
unicode::ToTString(command_manager_->stage())).str());
for (auto it = items_.begin(); it != items_.end(); ++it) {
auto item = *it;
UIBasePtr item_ptr = *static_cast<UIBasePtr*>(item->GetPointerFromInternalField(0));
- if (item_ptr->absolute_y() > absolute_y() &&
- item_ptr->absolute_y() + item_ptr->absolute_height() < absolute_y() + absolute_height()) {
+ if (input->GetMousePos().first > absolute_y() &&
+ input->GetMousePos().second < absolute_y() + absolute_height()) {
item_ptr->ProcessInput(input);
}
}
#define MMO_VERSION_MINOR 3
#define MMO_VERSION_REVISION 5
+#define MMO_PROTOCOL_VERSION 2
+
#ifdef MMO_VERSION_BUILD
#define MMO_VERSION_BUILD_TEXT " Build " MMO_VERSION_TOSTRING(MMO_VERSION_BUILD)
#else
void Log(const tstring& prefix, const tstring& format) {
auto out = GetTimeString() + _T("> ") + prefix + format + _T("\n");
OutputDebugString(out.c_str());
- std::cout << unicode::ToString(out);
+ std::cout << unicode::ToString(out) << std::flush;
ofs_ << unicode::ToString(out) << std::flush;
}
void Log(const tstring& prefix, const tstring& format, const T1& t1) {
auto out = GetTimeString() + _T("> ") + prefix + (tformat(format) % t1).str() + _T("\n");
OutputDebugString(out.c_str());
- std::cout << unicode::ToString(out);
+ std::cout << unicode::ToString(out) << std::flush;
ofs_ << unicode::ToString(out) << std::flush;
}
void Log(const tstring& prefix, const tstring& format, const T1& t1, const T2& t2) {
auto out = GetTimeString() + _T("> ") + prefix + (tformat(format) % t1 % t2).str() + _T("\n");
OutputDebugString(out.c_str());
- std::cout << unicode::ToString(out);
+ std::cout << unicode::ToString(out) << std::flush;
ofs_ << unicode::ToString(out) << std::flush;
}
void Log(const tstring& prefix, const tstring& format, const T1& t1, const T2& t2, const T3& t3) {
auto out = GetTimeString() + _T("> ") + prefix + (tformat(format) % t1 % t2 % t3).str() + _T("\n");
OutputDebugString(out.c_str());
- std::cout << unicode::ToString(out);
+ std::cout << unicode::ToString(out) << std::flush;
ofs_ << unicode::ToString(out) << std::flush;
}
void Log(const tstring& prefix, const tstring& format, const T1& t1, const T2& t2, const T3& t3, const T4& t4) {
auto out = GetTimeString() + _T("> ") + prefix + (tformat(format) % t1 % t2 % t3 % t4).str() + _T("\n");
OutputDebugString(out.c_str());
- std::cout << unicode::ToString(out);
+ std::cout << unicode::ToString(out) << std::flush;
ofs_ << unicode::ToString(out) << std::flush;
}
{
}
-ServerReceiveClientInfo::ServerReceiveClientInfo(const std::string& key, uint32_t version, uint16_t udp_port) :
+ServerReceiveClientInfo::ServerReceiveClientInfo(const std::string& key, uint16_t version, uint16_t udp_port) :
Command(header::ServerReceiveClientInfo, Utils::Serialize(key, version, udp_port))
{
// クライアントの情報を受信した (公開鍵のフィンガープリント, UDPポート)
class ServerReceiveClientInfo : public Command {
public:
- ServerReceiveClientInfo(const std::string& key, uint32_t version, uint16_t udp_port);
+ ServerReceiveClientInfo(const std::string& key, uint16_t version, uint16_t udp_port);
};
// 公開鍵を要求された
void Server::Stop()
{
io_service_.stop();
- Logger::Info("stop server");
+ Logger::Info("stop server");
}
void Server::Stop(int innterrupt_type)
{
readed = network::Utils::Deserialize(buffer, &user_id, &count);
}
+ // 現在コマンドがひとつしか無いのでそれ以外は無視
+ if (header != network::header::ServerRequstedStatus) {
+ return;
+ }
+
if (readed < buffer.size()) {
body = buffer.substr(readed);
}
#include "../common/Logger.hpp"
#include "Config.hpp"
#include "Account.hpp"
+#include "version.hpp"
#ifdef __linux__
#include "ServerSigHandler.hpp"
#include <csignal>
if (auto session = c.session().lock()) {
std::string finger_print;
- uint32_t version;
+ uint16_t version;
uint16_t udp_port;
network::Utils::Deserialize(c.body(), &finger_print, &version, &udp_port);
// クライアントのプロトコルバージョンをチェック
- if (version != 1) {
+ if (version != MMO_PROTOCOL_VERSION) {
Logger::Info("Unsupported Client Version : v%d", version);
session->Send(network::ClientReceiveUnsupportVersionError(1));
return;
#define MMO_VERSION_MINOR 1
#define MMO_VERSION_REVISION 5
+#define MMO_PROTOCOL_VERSION 2
+
#ifdef MMO_VERSION_BUILD
#define MMO_VERSION_BUILD_TEXT " Build " MMO_VERSION_TOSTRING(MMO_VERSION_BUILD)
#else