Fix multiple small issues :)

This commit is contained in:
Lion Kortlepel 2020-11-11 11:24:36 +01:00
parent 8f05cdcc61
commit 308500c01f
6 changed files with 13 additions and 12 deletions

View File

@ -24,7 +24,7 @@ struct VData{
class Client {
private:
std::set<std::unique_ptr<VData>> VehicleData; //ID and Data;
std::string Name = "Unknown Client";
std::string Name = Sec("Unknown Client");
sockaddr_in UDPADDR;
std::string Role;
std::string DID;

View File

@ -5,6 +5,7 @@
#include <iostream>
#include <mutex>
#include <string>
#include "Security/Xor.h"
void InitLog();
#define DebugPrintTID() DebugPrintTIDInternal(__func__, false)
void DebugPrintTIDInternal(const std::string& func, bool overwrite = true); // prints the current thread id in debug mode, to make tracing of crashes and asserts easier

View File

@ -12,12 +12,12 @@ typedef unsigned long DWORD, *PDWORD, *LPDWORD;
#include <unistd.h>
#endif // WIN32
#include "Logger.h"
#include <array>
#include <cstring>
#include <iostream>
#include <mutex>
#include <string>
#include <thread>
#include <array>
std::vector<std::string> QConsoleOut;
std::string CInputBuff;
@ -25,11 +25,11 @@ std::mutex MLock;
std::unique_ptr<Lua> LuaConsole;
void HandleInput(const std::string& cmd) {
std::cout << std::endl;
if (cmd == "exit") {
if (cmd == Sec("exit")) {
_Exit(0);
} else if (cmd == "clear" || cmd == "cls") {
} else if (cmd == Sec("clear") || cmd == Sec("cls")) {
// 2J is clearscreen, H is reset position to top-left
ConsoleOut("\x1b[2J\x1b[H");
ConsoleOut(Sec("\x1b[2J\x1b[H"));
} else {
LuaConsole->Execute(cmd);
}
@ -99,6 +99,7 @@ char _getch(void) {
#endif // WIN32
void SetupConsole() {
error(__func__);
#if defined(WIN32) && !defined(DEBUG)
DWORD outMode = 0;
HANDLE stdoutHandle = GetStdHandle(STD_OUTPUT_HANDLE);

View File

@ -264,7 +264,7 @@ void TCPServerMain(){
#else // unix
// wondering why we need slightly different implementations of this?
// ask ms.
SOCKET client, Listener = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
SOCKET client = -1, Listener = socket(AF_INET,SOCK_STREAM,IPPROTO_TCP);
sockaddr_in addr{};
addr.sin_addr.s_addr = INADDR_ANY;
addr.sin_family = AF_INET;

View File

@ -184,7 +184,6 @@ void GlobalParser(Client*c, const std::string& Pack){
SendToAll(c,Packet,false,false);
return;
}
switch (Code) {
case 'P': // initial connection
#ifdef DEBUG

View File

@ -70,7 +70,7 @@ void TCPRcv(Client*c){
return;
}
BytesRcv += Temp;
}while(BytesRcv < sizeof(Header));
}while(size_t(BytesRcv) < sizeof(Header));
memcpy(&Header,&Data[0],sizeof(Header));
#ifdef DEBUG