mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2025-07-03 08:15:35 +00:00
Fix printing, make CI into unique_ptr (more)
This commit is contained in:
parent
b663563f01
commit
7fce274915
@ -82,4 +82,4 @@ struct ClientInterface{
|
||||
}
|
||||
};
|
||||
|
||||
extern ClientInterface* CI;
|
||||
extern std::unique_ptr<ClientInterface> CI;
|
||||
|
@ -132,6 +132,7 @@ static bool CompositeInputExpected { false };
|
||||
static void ProcessCompositeInput() {
|
||||
if (CompositeInput.size() == 2 && memcmp(CompositeInput.data(), std::array<char, 2> { 91, 65 }.data(), 2) == 0) {
|
||||
// UP ARROW
|
||||
info(std::to_string(ConsoleHistoryReadIndex));
|
||||
if (!ConsoleHistory.empty()) {
|
||||
if (ConsoleHistoryReadIndex != 0) {
|
||||
ConsoleHistoryReadIndex -= 1;
|
||||
@ -140,6 +141,7 @@ static void ProcessCompositeInput() {
|
||||
}
|
||||
} else if (CompositeInput.size() == 2 && memcmp(CompositeInput.data(), std::array<char, 2> { 91, 66 }.data(), 2) == 0) {
|
||||
// DOWN ARROW
|
||||
info(std::to_string(ConsoleHistoryReadIndex));
|
||||
if (!ConsoleHistory.empty()) {
|
||||
if (ConsoleHistoryReadIndex != ConsoleHistory.size() - 1) {
|
||||
ConsoleHistoryReadIndex += 1;
|
||||
|
@ -31,5 +31,5 @@ void Args(int argc, char* argv[]){
|
||||
void InitServer(int argc, char* argv[]){
|
||||
InitLog();
|
||||
Args(argc,argv);
|
||||
CI = new ClientInterface;
|
||||
CI = std::make_unique<ClientInterface>();
|
||||
}
|
||||
|
@ -174,7 +174,7 @@ void Identification(SOCKET TCPSock,Hold*S,RSA*Skey){
|
||||
closesocket(TCPSock);
|
||||
return;
|
||||
}
|
||||
DebugPrintTIDInternal(std::string("Client(") + Name + ")");
|
||||
// DebugPrintTIDInternal(std::string("Client(") + Name + ")");
|
||||
debug(Sec("Name -> ") + Name + Sec(", Role -> ") + Role + Sec(", ID -> ") + DID);
|
||||
for(auto& c : CI->Clients){
|
||||
if(c != nullptr){
|
||||
|
@ -1,6 +1,7 @@
|
||||
#include "Network.h"
|
||||
#include <thread>
|
||||
ClientInterface* CI;
|
||||
#include <memory>
|
||||
std::unique_ptr<ClientInterface> CI;
|
||||
void NetMain(){
|
||||
std::thread TCP(TCPServerMain);
|
||||
TCP.detach();
|
||||
|
@ -113,7 +113,7 @@ void TCPRcv(Client*c){
|
||||
}
|
||||
|
||||
void TCPClient(Client*c){
|
||||
DebugPrintTID();
|
||||
DebugPrintTIDInternal(c->GetName(), true);
|
||||
Assert(c);
|
||||
if(c->GetTCPSock() == -1){
|
||||
CI->RemoveClient(c);
|
||||
|
Loading…
x
Reference in New Issue
Block a user