JOIN_REJECTION works, ready for the rest

This commit is contained in:
Kayne Ruse
2014-09-09 08:39:36 +10:00
parent 4c882682ed
commit 2c06232264
4 changed files with 19 additions and 6 deletions
+9
View File
@@ -25,6 +25,7 @@
#include "utility.hpp"
#include <stdexcept>
#include <iostream>
//-------------------------
//Public access members
@@ -192,6 +193,9 @@ void LobbyMenu::HandlePacket(SerialPacket* const argPacket) {
case SerialPacketType::JOIN_RESPONSE:
HandleJoinResponse(static_cast<ClientPacket*>(argPacket));
break;
case SerialPacketType::JOIN_REJECTION:
HandleJoinRejection(static_cast<TextPacket*>(argPacket));
break;
//handle errors
default:
throw(std::runtime_error(std::string() + "Unknown SerialPacketType encountered in LobbyMenu: " + to_string_custom(static_cast<int>(argPacket->type)) ));
@@ -229,6 +233,11 @@ void LobbyMenu::HandleJoinResponse(ClientPacket* const argPacket) {
network.SendTo(Channels::SERVER, &newPacket);
}
void LobbyMenu::HandleJoinRejection(TextPacket* const argPacket) {
//TODO: Better output
std::cerr << "Error: " << argPacket->text << std::endl;
}
//-------------------------
//server control
//-------------------------
+1
View File
@@ -63,6 +63,7 @@ protected:
void HandlePacket(SerialPacket* const);
void HandleBroadcastResponse(ServerPacket* const);
void HandleJoinResponse(ClientPacket* const);
void HandleJoinRejection(TextPacket* const);
//server control
void SendBroadcastRequest();