test-client-godot/modules/networkconnection/network_data.h
2020-05-02 20:52:28 +02:00

97 lines
No EOL
2.5 KiB
C++

/*
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"
#include "core/reference.h"
#include "modules/bitset/bitset.h"
#include "core/ustring.h"
#include "core/dictionary.h"
#include "core/array.h"
//define MAX_LOOP_READ_BY_STEP 10
#define NUM_BITS_IN_LONG_ACK 1024
class NetworkData
{
public:
uint32_t _ack_bit_mask;
bool _recieved_new_server_tick;
uint32_t _current_server_tick;
uint32_t _current_client_tick;
uint32_t _synchronize;
uint32_t _current_received_number;
uint32_t _last_received_number;
uint32_t _current_send_number;
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;
uint32_t _last_received_ack;
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;
uint32_t _last_ack_0[1];
uint32_t _last_ack_1[2];
uint32_t _last_ack_2[4];
Array _server_messages; // Array contains all messages we received (from server)
// Manage GENERIC_MULTI_PART_CODE
Dictionary _block;
Dictionary _block_used; // true if we red this block
//
Array _client_messages; // Array contains all messages we will send
Array _command_to_send; // Array all command to send (all data will be send to _client_messages)
uint8_t _impulse_multi_part_number;
NetworkData();
~NetworkData();
void initialize();
void reset_last_ack();
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