Hahaha il manquait les ChunkMods dans netprot :finnadie:

This commit is contained in:
MarcEricMartel
2023-12-02 10:04:18 -05:00
parent c44d1453ae
commit 20eb410b08
5 changed files with 76 additions and 3 deletions

View File

@@ -122,9 +122,7 @@ void Connection::Run(World* world) {
last = m_input_vector.at(m_last_in);
el = (double)(in.timestamp - last.timestamp) / 1000.;
std::cout << 1. / el << std::endl;
player.get()->SetDirection(in.direction);
std::cout << in.direction << std::endl;
player.get()->ApplyPhysics(player.get()->GetInput(in.keys.forward,
in.keys.backward,
in.keys.left,
@@ -132,7 +130,6 @@ void Connection::Run(World* world) {
in.keys.jump, false, el), world, el);
out.position = player.get()->GetPositionAbs();
player.get()->GetPositionAbs().Afficher();
out.direction = in.direction;
out.timestamp = in.timestamp;
out.id = m_playinfo.id;

View File

@@ -41,6 +41,10 @@ public:
void CleanInputManifest(Timestamp time);
bool m_nsync = true;
std::vector<Bullet> m_bullet_vector;
std::vector<ChunkMod> m_diff_vector;
private:
std::unordered_map<Timestamp, Input> m_input_manifest;
std::vector<Input> m_input_vector;
@@ -48,6 +52,7 @@ private:
std::deque<Output> m_output_vector;
std::unordered_map<Timestamp, Chat> m_chatlog;
SOCKET m_sock;
sockaddr_in m_addr;
LoginInfo m_loginfo;

View File

@@ -230,6 +230,9 @@ void Server::Run() {
}
for (auto& [key, conn] : m_players) {
/* In */
int deadplayers = 0;
std::vector<char*> lsPck;
Input in; Chat chat; Sync sync;
@@ -254,6 +257,8 @@ void Server::Run() {
}
lsPck.clear();
/* Process */
if (conn->m_nsync) {
if (conn->player->AmIDead()) {
++deadplayers;
@@ -261,6 +266,9 @@ void Server::Run() {
continue;
}
conn->Run(m_world);
/* Out */
conn->sendPacks(m_sock_udp, m_players, timer);
}