Added support for cleaning up after rejection messages

This commit is contained in:
Kayne Ruse
2014-12-01 22:33:15 +11:00
parent c89f94b681
commit cc167180f6
8 changed files with 136 additions and 8 deletions
+13
View File
@@ -24,6 +24,7 @@
#include "channels.hpp"
#include "utility.hpp"
#include "terminal_error.hpp"
#include <stdexcept>
#include <algorithm>
#include <cmath>
@@ -103,6 +104,9 @@ void InWorld::Update() {
HandlePacket(packetBuffer);
}
}
catch(terminal_error& e) {
throw(e);
}
catch(std::exception& e) {
std::cerr << "HandlePacket Error: " << e.what() << std::endl;
}
@@ -230,6 +234,15 @@ void InWorld::HandlePacket(SerialPacket* const argPacket) {
HandleRegionContent(static_cast<RegionPacket*>(argPacket));
break;
//rejection messages
case SerialPacketType::REGION_REJECTION:
case SerialPacketType::CHARACTER_REJECTION:
throw(terminal_error(static_cast<TextPacket*>(argPacket)->text));
break;
case SerialPacketType::SHUTDOWN_REJECTION:
throw(std::runtime_error(static_cast<TextPacket*>(argPacket)->text));
break;
//errors
default: {
std::ostringstream msg;
+1 -1
View File
@@ -1,5 +1,5 @@
#config
INCLUDES+=. .. ../entities ../../common/gameplay ../../common/graphics ../../common/map ../../common/network ../../common/network/packet_types ../../common/ui ../../common/utilities
INCLUDES+=. .. ../client_utilities ../entities ../../common/gameplay ../../common/graphics ../../common/map ../../common/network ../../common/network/packet_types ../../common/ui ../../common/utilities
LIBS+=
CXXFLAGS+=-std=c++11 $(addprefix -I,$(INCLUDES))