By default make offline
This commit is contained in:
parent
1a7e424085
commit
67c0696061
@ -78,7 +78,7 @@ target_compile_definitions(space-game001 PRIVATE
|
||||
WIN32_LEAN_AND_MEAN
|
||||
PNG_ENABLED
|
||||
SDL_MAIN_HANDLED
|
||||
NETWORK
|
||||
# NETWORK
|
||||
# SIMPLIFIED
|
||||
)
|
||||
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
#include <boost/beast/core.hpp>
|
||||
#include <boost/beast/core.hpp>
|
||||
#include <boost/beast/websocket.hpp>
|
||||
#include <boost/asio/ip/tcp.hpp>
|
||||
#include <iostream>
|
||||
@ -12,7 +12,7 @@
|
||||
#include <math.h>
|
||||
#include "../src/network/ClientState.h"
|
||||
|
||||
// Âñïîìîãàòåëüíûé split
|
||||
// Вспомогательный split
|
||||
std::vector<std::string> split(const std::string& s, char delimiter) {
|
||||
std::vector<std::string> tokens;
|
||||
std::string token;
|
||||
@ -78,7 +78,7 @@ class Session : public std::enable_shared_from_this<Session> {
|
||||
|
||||
std::lock_guard<std::mutex> lock(g_sessions_mutex);
|
||||
for (auto& session : g_sessions) {
|
||||
if (session->get_id() != id_) { // Íå øëåì îòïðàâèòåëþ
|
||||
if (session->get_id() != id_) { // Не шлем отправителю
|
||||
session->send_message(event_msg);
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,19 +8,11 @@ namespace ZL {
|
||||
}
|
||||
|
||||
void LocalClient::Poll() {
|
||||
|
||||
if (!messageQueue.empty()) {
|
||||
std::string msg = messageQueue.front();
|
||||
messageQueue.pop();
|
||||
std::cout << "LocalClient received message: " << msg << std::endl;
|
||||
}
|
||||
}
|
||||
|
||||
void LocalClient::Send(const std::string& message) {
|
||||
|
||||
if (message == "PING")
|
||||
{
|
||||
messageQueue.push("PONG");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -17,5 +17,9 @@ namespace ZL {
|
||||
|
||||
bool IsConnected() const override { return true; }
|
||||
int GetClientId() const { return 1; }
|
||||
|
||||
std::unordered_map<int, ClientStateInterval> getRemotePlayers() override {
|
||||
return std::unordered_map<int, ClientStateInterval>();
|
||||
}
|
||||
};
|
||||
}
|
||||
@ -1,4 +1,6 @@
|
||||
#include "WebSocketClient.h"
|
||||
#ifdef NETWORK
|
||||
|
||||
#include "WebSocketClient.h"
|
||||
#include <iostream>
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
@ -168,4 +170,6 @@ namespace ZL {
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@ -1,5 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#ifdef NETWORK
|
||||
|
||||
// WebSocketClient.h
|
||||
#include "NetworkInterface.h"
|
||||
#include <queue>
|
||||
@ -53,4 +55,5 @@ namespace ZL {
|
||||
return remotePlayers;
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
Loading…
Reference in New Issue
Block a user