diff --git a/server/server_application.hpp b/server/server_application.hpp index 2563613..372549b 100644 --- a/server/server_application.hpp +++ b/server/server_application.hpp @@ -98,7 +98,7 @@ private: //misc bool running = true; - int clientUID = 0; + int clientIndex = 0; }; #endif diff --git a/server/server_logic.cpp b/server/server_logic.cpp index 803d086..e4e1f5f 100644 --- a/server/server_logic.cpp +++ b/server/server_logic.cpp @@ -223,8 +223,11 @@ void ServerApplication::HandlePacket(SerialPacket* const argPacket) { break; //handle errors - default: - throw(std::runtime_error(std::string() + "Unknown SerialPacketType encountered in the server: " + to_string_custom(static_cast(argPacket->type)) )); + default: { + std::string msg = "Unknown SerialPacketType encountered in the server: "; + msg += to_string_custom(static_cast(argPacket->type)); + throw(std::runtime_error(msg)); + } break; } } \ No newline at end of file diff --git a/server/server_methods.cpp b/server/server_methods.cpp index 3c14eef..d993b83 100644 --- a/server/server_methods.cpp +++ b/server/server_methods.cpp @@ -46,7 +46,7 @@ void ServerApplication::HandleJoinRequest(ClientPacket* const argPacket) { //load the user account //TODO: handle passwords - int accountIndex = accountMgr.LoadAccount(argPacket->username, clientUID); + int accountIndex = accountMgr.LoadAccount(argPacket->username, clientIndex); if (accountIndex < 0) { //TODO: send rejection packet std::cerr << "Error: Account already loaded: " << accountIndex << std::endl; @@ -56,13 +56,13 @@ void ServerApplication::HandleJoinRequest(ClientPacket* const argPacket) { //send the client their info ClientPacket newPacket; newPacket.type = SerialPacketType::JOIN_RESPONSE; - newPacket.clientIndex = clientUID; + newPacket.clientIndex = clientIndex; newPacket.accountIndex = accountIndex; network.SendTo(&newClient.address, static_cast(&newPacket)); //finished this routine - clientMap[clientUID++] = newClient; + clientMap[clientIndex++] = newClient; std::cout << "New connection, " << clientMap.size() << " clients and " << accountMgr.GetContainer()->size() << " accounts total" << std::endl; } diff --git a/todo.txt b/todo.txt index 8bbca12..284be85 100644 --- a/todo.txt +++ b/todo.txt @@ -3,6 +3,7 @@ TODO: A proper logging system TODO: Ping-pong and keep alive system TODO: Move the statistics into their own SQL table, instead of duplicating the structure a dozen times TODO: Get the rooms working, even if only via hotkeys +TODO: Rejection messages TODO: Fix shoddy movement TODO: make the whole thing more fault tolerant