Discovered a bug

This commit is contained in:
Kayne Ruse
2014-04-27 22:17:58 +10:00
parent 9a7f7b8684
commit 624369f147
4 changed files with 10 additions and 57 deletions
-46
View File
@@ -1,46 +0,0 @@
/* Copyright: (c) Kayne Ruse 2013, 2014
*
* This software is provided 'as-is', without any express or implied
* warranty. In no event will the authors be held liable for any damages
* arising from the use of this software.
*
* Permission is granted to anyone to use this software for any purpose,
* including commercial applications, and to alter it and redistribute it
* freely, subject to the following restrictions:
*
* 1. The origin of this software must not be misrepresented; you must not
* claim that you wrote the original software. If you use this software
* in a product, an acknowledgment in the product documentation would be
* appreciated but is not required.
*
* 2. Altered source versions must be plainly marked as such, and must not be
* misrepresented as being the original software.
*
* 3. This notice may not be removed or altered from any source
* distribution.
*/
#include "server_application.hpp"
//-------------------------
//player management
//-------------------------
void ServerApplication::LoadPlayer() {
//
}
void ServerApplication::UnloadPlayer() {
//
}
void ServerApplication::CreatePlayer() {
//
}
void ServerApplication::DeletePlayer() {
//
}
void ServerApplication::SavePlayer() {
//
}
+2 -6
View File
@@ -74,12 +74,8 @@ private:
//TODO: a function that only sends to players in a certain proximity
void PumpPacket(SerialPacket);
//player management
void LoadPlayer();
void UnloadPlayer();
void CreatePlayer();
void DeletePlayer();
void SavePlayer();
//TODO: manage the database
//TODO: combat systems
//APIs
UDPNetworkUtility network;
@@ -47,6 +47,7 @@ void ServerApplication::HandleJoinRequest(SerialPacket packet) {
newClient.address = packet.meta.srcAddress;
clientMap[ClientEntry::uidCounter] = newClient;
//TODO: move this into the player management code
//register the new player
PlayerEntry newPlayer;
newPlayer.clientIndex = ClientEntry::uidCounter;
@@ -65,7 +66,7 @@ void ServerApplication::HandleJoinRequest(SerialPacket packet) {
serialize(&packet, buffer);
network.Send(&newClient.address, buffer, PACKET_BUFFER_SIZE);
//TODO: finish the player's initialization
//BUG: the new player object is not being sent to existing clients
//finished this routine
ClientEntry::uidCounter++;
@@ -130,7 +131,7 @@ void ServerApplication::HandleDisconnect(SerialPacket packet) {
}
void ServerApplication::HandleShutdown(SerialPacket packet) {
//TODO: authenticate who is shitting the server down
//TODO: authenticate who is shutting the server down
//end the server
running = false;
@@ -145,6 +146,7 @@ void ServerApplication::HandleShutdown(SerialPacket packet) {
}
void ServerApplication::HandlePlayerUpdate(SerialPacket packet) {
//TODO: this should be moved elsewhere
if (playerMap.find(packet.playerInfo.playerIndex) == playerMap.end()) {
throw(std::runtime_error("Cannot update a non-existant player"));
}
@@ -157,6 +159,7 @@ void ServerApplication::HandlePlayerUpdate(SerialPacket packet) {
}
void ServerApplication::HandleRegionRequest(SerialPacket packet) {
//TODO: this should be moved elsewhere
packet.meta.type = SerialPacket::Type::REGION_CONTENT;
packet.regionInfo.region = regionPager.GetRegion(packet.regionInfo.x, packet.regionInfo.y);
+3 -3
View File
@@ -1,5 +1,8 @@
Please note that due to modificatons, the indicated line may be incorrect.
## BUG
1. server_connections.cpp:68 the new player object is not being sent to existing clients
## TODO
server_application.hpp:74 a function that only sends to players in a certain proximity
server_application.hpp:94 I need to handle multiple map objects
@@ -28,6 +31,3 @@ bbox.hpp:29 This is supposed to interact with the vector
region_pager.hpp:49 delete existing regions
serial_packet.hpp:71 combat packets
setup_server.sql:1 The SQL startup script needs revising
Move PlayerEntry into a proper class
Move ClientEntry into a proper class