Small Bug fix

This commit is contained in:
Anonymous275 2020-02-03 22:07:22 +02:00
parent 54319f7cdd
commit 996d96639c
2 changed files with 9 additions and 10 deletions

View File

@ -52,14 +52,14 @@ void ServerMain(int Port, int MaxClients) {
/* create a server */ /* create a server */
info("starting server with a maximum of " + to_string(MaxClients) + " Clients...\n"); info("starting server with a maximum of " + to_string(MaxClients) + " Clients...");
server = enet_host_create(&address, MaxClients, 2, 0, 0); server = enet_host_create(&address, MaxClients, 2, 0, 0);
if (server == NULL) { if (server == NULL) {
error("An error occurred while trying to create a server host.\n"); error("An error occurred while trying to create a server host.");
return; return;
} }
info("Waiting for clients on port "+to_string(Port)+"...\n"); info("Waiting for clients on port "+to_string(Port)+"...");
while (true) { while (true) {
host_server(server); host_server(server);

View File

@ -7,6 +7,8 @@
#include <string> #include <string>
#include <fstream> #include <fstream>
#include "logger.h" #include "logger.h"
#include <chrono>
#include <thread>
using namespace std; //nameSpace STD using namespace std; //nameSpace STD
void DebugData(); void DebugData();
@ -22,8 +24,8 @@ string ServerName = "BeamNG-MP FTW";
//Entry //Entry
int main() { int main() {
ParseConfig();
LogInit(); LogInit();
ParseConfig();
if(Debug){ //checks if debug is on if(Debug){ //checks if debug is on
DebugData(); //Prints Debug Data DebugData(); //Prints Debug Data
} }
@ -49,12 +51,9 @@ void SetMainValues(bool D, int P,int MP,string Name,string serverName){
} }
void LogInit(){ void LogInit(){
ifstream InFileStream; ofstream LFS;
InFileStream.open("Server.log"); LFS.open ("Server.log");
if(InFileStream.good()){ LFS.close();
remove("Server.log");
}
InFileStream.close();
} }
void addToLog(basic_string<char> Data){ void addToLog(basic_string<char> Data){