mirror of
https://github.com/BeamMP/BeamMP-Server.git
synced 2026-02-16 02:30:54 +00:00
Vehicle ghost fix, player list fix
This commit is contained in:
@@ -1,44 +0,0 @@
|
||||
///
|
||||
/// Created by Anonymous275 on 8/25/2020
|
||||
///
|
||||
#pragma once
|
||||
#include <mutex>
|
||||
#include "CustomAssert.h"
|
||||
class Client;
|
||||
void GParser(Client*c, const std::string&Packet);
|
||||
class Buffer{
|
||||
public:
|
||||
void Handle(Client*c,const std::string& Data){
|
||||
Assert(c);
|
||||
Buf += Data;
|
||||
Manage(c);
|
||||
}
|
||||
void clear(){
|
||||
Buf.clear();
|
||||
}
|
||||
private:
|
||||
std::string Buf;
|
||||
void Manage(Client*c){
|
||||
Assert(c);
|
||||
if(!Buf.empty()){
|
||||
std::string::size_type p;
|
||||
if (Buf.at(0) == '\n'){
|
||||
p = Buf.find('\n',1);
|
||||
if(p != std::string::npos){
|
||||
std::string R = Buf.substr(1,p-1);
|
||||
std::string_view B(R.c_str(),R.find(char(0)));
|
||||
GParser(c, B.data());
|
||||
Buf = Buf.substr(p+1);
|
||||
Manage(c);
|
||||
}
|
||||
}else{
|
||||
p = Buf.find('\n');
|
||||
if(p == std::string::npos)Buf.clear();
|
||||
else{
|
||||
Buf = Buf.substr(p);
|
||||
Manage(c);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -9,7 +9,6 @@
|
||||
#include <arpa/inet.h>
|
||||
#define SOCKET int
|
||||
#endif
|
||||
#include "Buffer.h"
|
||||
#include "CustomAssert.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@@ -55,7 +54,6 @@ public:
|
||||
int GetCarCount();
|
||||
void ClearCars();
|
||||
int GetStatus();
|
||||
Buffer Handler;
|
||||
int GetID();
|
||||
};
|
||||
struct ClientInterface{
|
||||
|
||||
Reference in New Issue
Block a user