pouet pouet
This commit is contained in:
parent
3249d68e60
commit
35c2a5be31
@ -812,7 +812,6 @@ std::vector<netprot::Packet> netprot::recvPacks(SOCKET sock, Buffer* buf) {
|
||||
std::vector<Packet> lsPck;
|
||||
int len = 0, end = 0;
|
||||
bool pck_received = false;
|
||||
char* cursor = nullptr;
|
||||
|
||||
while (true) {
|
||||
while (!pck_received) {
|
||||
@ -823,21 +822,27 @@ std::vector<netprot::Packet> netprot::recvPacks(SOCKET sock, Buffer* buf) {
|
||||
// TODO: Voir si on trouve un footer (5 '\0' d'affilee).
|
||||
// Si oui, mettre l'index du debut du footer dans
|
||||
// la variable "end" et mettre pck_received a true.
|
||||
|
||||
|
||||
|
||||
//buf->ptr
|
||||
|
||||
//end = len;
|
||||
//pck_received = true;
|
||||
}
|
||||
char* cursor = nullptr;
|
||||
|
||||
cursor = &buf->ptr[end];
|
||||
|
||||
lsPck.push_back(getPack(buf));
|
||||
|
||||
while (*cursor == '\0') {
|
||||
cursor++;
|
||||
end++;
|
||||
}
|
||||
while (*cursor == '\0')
|
||||
cursor++, end++;
|
||||
|
||||
if (cursor) { // mettre le début du prochain paquet au début du buffer.
|
||||
memcpy(buf->ptr, cursor, buf->len - end); // et voir s'il y a en un autre
|
||||
len = 0;
|
||||
pck_received = true;
|
||||
pck_received = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -280,7 +280,6 @@ void Engine::Init() {
|
||||
}
|
||||
|
||||
uint64_t seed = SEED;
|
||||
char ch;
|
||||
|
||||
glDisable(GL_FRAMEBUFFER_SRGB);
|
||||
glEnable(GL_DEPTH_TEST);
|
||||
@ -314,11 +313,13 @@ void Engine::Init() {
|
||||
m_whoosh[x] = nullptr;
|
||||
}
|
||||
|
||||
char* ch = new char[2];
|
||||
|
||||
std::cout << "Jouer en ligne? [o/N] ";
|
||||
std::cin >> ch;
|
||||
std::cin.getline(ch, 2);
|
||||
std::cout << std::endl;
|
||||
|
||||
if (ch == 'o' || ch == 'O') {
|
||||
if (*ch == 'o' || *ch == 'O') {
|
||||
char* input = new char[32];
|
||||
std::string playname, srvname;
|
||||
|
||||
@ -358,6 +359,7 @@ void Engine::Init() {
|
||||
}
|
||||
else std::cout << "Erreur de creation de socket." << std::endl;
|
||||
}
|
||||
delete[] ch;
|
||||
|
||||
m_world.SetSeed(seed);
|
||||
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
class RemotePlayer : public Player {
|
||||
public:
|
||||
enum Anim { STILL = 1, RUNNING = 2, JUMPING = 4, SHOOTING = 8, POWERUP = 16, DEAD = 32 };
|
||||
enum Anim: uint8_t { STILL = 1, RUNNING = 2, JUMPING = 4, SHOOTING = 8, POWERUP = 16, DEAD = 32 };
|
||||
|
||||
RemotePlayer(netprot::PlayerInfo pinfo);
|
||||
|
||||
@ -17,6 +17,7 @@ public:
|
||||
|
||||
private:
|
||||
netprot::Output current, previous;
|
||||
std::map<uint64_t, netprot::Output> m_outbuf;
|
||||
netprot::PlayerInfo m_pinfo;
|
||||
float m_aminacc;
|
||||
Anim m_animstate;
|
||||
|
Loading…
Reference in New Issue
Block a user