Jim Babwe
This commit is contained in:
@@ -52,6 +52,10 @@ void Connection::getPacks(SOCKET sock) {
|
||||
Input in;
|
||||
while (true) {
|
||||
lsPck = recvPacksFrom(sock, &m_buf, m_addr);
|
||||
|
||||
if (lsPck.empty() && !m_buf.tmp)
|
||||
break;
|
||||
|
||||
for (auto& pck : lsPck) {
|
||||
uint32_t bsize = m_buf.len - (pck - m_buf.ptr);
|
||||
switch (netprot::getType(pck, 1)) {
|
||||
@@ -59,8 +63,7 @@ void Connection::getPacks(SOCKET sock) {
|
||||
case INPUT:
|
||||
if (Deserialize(&in, pck, &bsize)) {
|
||||
m_input_manifest[in.timestamp] = in;
|
||||
if (in.keys.forward == true)
|
||||
std::cout << "!!!!";
|
||||
m_input_vector.push_back(in);
|
||||
}
|
||||
break;
|
||||
default: break;
|
||||
@@ -72,8 +75,7 @@ void Connection::getPacks(SOCKET sock) {
|
||||
|
||||
void Connection::sendPacks(SOCKET sock, std::unordered_map<uint64_t, Connection*> conns) {
|
||||
while (m_last_out < m_output_manifest.size()) {
|
||||
Output out = m_output_manifest.at(m_last_out++);
|
||||
std::cout << "bip";
|
||||
Output out = m_output_vector.at(m_last_out++);
|
||||
for (auto& [key, conn] : conns) {
|
||||
if (m_playinfo.id == conn->GetHash(true))
|
||||
continue;
|
||||
@@ -90,9 +92,9 @@ void Connection::Run(World* world) {
|
||||
if (m_input_manifest.size() < 2)
|
||||
return;
|
||||
|
||||
while (m_last_in < m_input_manifest.size()) {
|
||||
in = m_input_manifest.at(m_last_in + 1);
|
||||
last = m_input_manifest.at(m_last_in);
|
||||
while (m_last_in < m_input_vector.size() - 1) {
|
||||
in = m_input_vector.at(m_last_in + 1);
|
||||
last = m_input_vector.at(m_last_in);
|
||||
|
||||
el = (float)(in.timestamp - last.timestamp) / 1000.;
|
||||
player.get()->SetDirection(in.direction);
|
||||
@@ -108,6 +110,7 @@ void Connection::Run(World* world) {
|
||||
out.id = m_playinfo.id;
|
||||
|
||||
m_output_manifest[out.timestamp] = out;
|
||||
m_output_vector.push_back(out);
|
||||
|
||||
++m_last_in;
|
||||
}
|
||||
|
Reference in New Issue
Block a user