84 lines
No EOL
2.2 KiB
C++
84 lines
No EOL
2.2 KiB
C++
/*
|
|
Library NetworkData
|
|
|
|
Copyright (C) 2019 AleaJactaEst
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
it under the terms of the GNU General Public License as published by
|
|
the Free Software Foundation, either version 3 of the License, or
|
|
(at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
#include "network_data.h"
|
|
|
|
NetworkData::NetworkData()
|
|
{
|
|
this->initialize();
|
|
}
|
|
|
|
NetworkData::~NetworkData()
|
|
{
|
|
}
|
|
|
|
void NetworkData::initialize()
|
|
{
|
|
// Initialize counter
|
|
this->_recieved_new_server_tick = false;
|
|
this->_current_received_number = 0;
|
|
this->_last_received_number = 0;
|
|
this->_quit_id = 0;
|
|
this->_long_ack_bit_field.resize(NUM_BITS_IN_LONG_ACK);
|
|
this->_latest_probes.clear();
|
|
this->_ack_bit_mask = 0;
|
|
this->_last_ack_bit = 0;
|
|
this->_last_ack_in_long_ack = 0;
|
|
this->_current_server_tick = 0;
|
|
this->_current_client_tick = 0;
|
|
this->_ms_per_tick = 100;
|
|
this->_current_client_time = 0;
|
|
|
|
this->_server_sync = 0;
|
|
this->_client_sync = 0;
|
|
|
|
this->_current_send_number = 0;
|
|
}
|
|
|
|
void NetworkData::reset_last_ack()
|
|
{
|
|
int i;
|
|
for(i=0;i<1;++i)
|
|
this->_last_ack_0[i] = 0xffffffff;
|
|
for(i=0;i<2;++i)
|
|
this->_last_ack_1[i] = 0xffffffff;
|
|
for(i=0;i<4;++i)
|
|
this->_last_ack_2[i] = 0xffffffff;
|
|
}
|
|
|
|
void NetworkData::define_lang(String lang)
|
|
{
|
|
this->_lang = lang;
|
|
}
|
|
|
|
void NetworkData::define_user(String user_addr, String user_key, String user_id)
|
|
{
|
|
this->_user_addr = user_addr;
|
|
this->_user_key = user_key;
|
|
this->_user_id = user_id;
|
|
}
|
|
|
|
void NetworkData::define_checksum_msg_xml(Array & checksum_msg_xml)
|
|
{
|
|
//DEBUG_PRINT("Received msg.xml checksum");
|
|
this->_checksum_msg_xml = checksum_msg_xml;
|
|
//DEBUG_PRINT("Received msg.xml checksum " + itos(checksum_msg_xml.size()));
|
|
//DEBUG_PRINT("Received msg.xml checksum " + itos(this->_checksum_msg_xml.size()));
|
|
} |