test-client-godot/modules/networkconnection/network_data.h

90 lines
2.2 KiB
C
Raw Normal View History

2020-03-03 21:45:30 +00:00
/*
Header 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/>.
*/
#ifndef NETWORK_DATA_H
#define NETWORK_DATA_H
// #include "core/reference.h"
// #include "core/io/packet_peer_udp.h"
2020-04-11 11:56:47 +00:00
#include "core/reference.h"
2020-03-03 21:45:30 +00:00
#include "modules/bitset/bitset.h"
#include "core/ustring.h"
2020-04-18 22:36:11 +00:00
//#include "core/dictionary.h"
#include "core/array.h"
2020-03-03 21:45:30 +00:00
2020-03-30 20:20:59 +00:00
//define MAX_LOOP_READ_BY_STEP 10
2020-04-10 16:09:06 +00:00
#define NUM_BITS_IN_LONG_ACK 1024
2020-03-03 21:45:30 +00:00
class NetworkData
{
public:
uint32_t _ack_bit_mask;
2020-04-18 22:36:11 +00:00
bool _recieved_new_server_tick;
2020-03-03 21:45:30 +00:00
uint32_t _current_server_tick;
uint32_t _current_client_tick;
uint32_t _synchronize;
uint32_t _current_received_number;
uint32_t _last_received_number;
2020-04-10 16:09:06 +00:00
uint32_t _current_send_number;
2020-03-03 21:45:30 +00:00
uint32_t _ms_per_tick;
uint32_t _current_client_time;
uint32_t _update_time;
int32_t _quit_id;
int32_t _last_ack_bit;
uint32_t _last_ack_in_long_ack;
2020-04-10 16:09:06 +00:00
uint32_t _last_received_ack;
2020-03-03 21:45:30 +00:00
int32_t _client_sync;
int32_t _server_sync;
String _lang;
String _user_addr;
String _user_key;
String _user_id;
BitSet _long_ack_bit_field;
Array _latest_probes;
Array _checksum_msg_xml;
2020-04-10 16:09:06 +00:00
uint32_t _last_ack_0[1];
uint32_t _last_ack_1[2];
uint32_t _last_ack_2[4];
2020-04-18 22:36:11 +00:00
//Dictionary _server_messages;
Array _server_messages;
2020-03-03 21:45:30 +00:00
NetworkData();
~NetworkData();
void initialize();
2020-04-10 16:09:06 +00:00
void reset_last_ack();
2020-03-03 21:45:30 +00:00
void define_lang(String lang);
void define_user(String user_addr, String user_key, String user_id);
void define_checksum_msg_xml(Array & checksum_msg_xml);
};
#endif