Working on lights, I'm conceeding and just using a fixed array. I think it will be faster in the long run, as I won't have to rebind the lights when I add/remove one. Also wrestling with really lame compiler erros with these templated pointers

This commit is contained in:
MitchellHansen
2017-02-08 23:17:10 -08:00
parent 0047db0a65
commit bfb6d922a3
12 changed files with 154 additions and 144 deletions

View File

@@ -18,39 +18,7 @@ void NetworkInput::stop_listening_for_clients() {
void NetworkInput::recieve_from_clients()
{
//// Receive a message from the client
//char buffer[1024];
//std::vector<CustomPacket> packets;
//sf::TcpSocket::Status status;
//do {
// std::size_t received = 0;
// status = socket.receive(buffer, 1024, received);
// while (received < 12) {
// std::size_t tack_on;
// status = socket.receive(&buffer[received], 1024 - received, tack_on);
// received += tack_on;
// }
// int position = 0;
// while (position < received) {
// CustomPacket p;
// memcpy(p.data, &buffer[position], p.size);
// packets.push_back(p);
// position += p.size;
// }
// std::cout << "packet_count = " << packets.size() << std::endl;
// int left_over = 12 - (position - received);
// memcpy(buffer, &buffer[received - left_over], left_over);
//} while (status != sf::TcpSocket::Status::Disconnected);
}
void NetworkInput::dispatch_events()
@@ -128,7 +96,7 @@ void NetworkInput::threaded_client_listener(int port) {
std::cout << "packet_count = " << packets.size() << std::endl;
int left_over = 12 - (position - received);
int left_over = 12 - static_cast<int>(position - received);
std::memcpy(buffer, &buffer[received - left_over], left_over);
} while (status != sf::TcpSocket::Status::Done);