Discovered a bug
This commit is contained in:
@@ -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() {
|
|
||||||
//
|
|
||||||
}
|
|
||||||
@@ -74,12 +74,8 @@ private:
|
|||||||
//TODO: a function that only sends to players in a certain proximity
|
//TODO: a function that only sends to players in a certain proximity
|
||||||
void PumpPacket(SerialPacket);
|
void PumpPacket(SerialPacket);
|
||||||
|
|
||||||
//player management
|
//TODO: manage the database
|
||||||
void LoadPlayer();
|
//TODO: combat systems
|
||||||
void UnloadPlayer();
|
|
||||||
void CreatePlayer();
|
|
||||||
void DeletePlayer();
|
|
||||||
void SavePlayer();
|
|
||||||
|
|
||||||
//APIs
|
//APIs
|
||||||
UDPNetworkUtility network;
|
UDPNetworkUtility network;
|
||||||
|
|||||||
@@ -47,6 +47,7 @@ void ServerApplication::HandleJoinRequest(SerialPacket packet) {
|
|||||||
newClient.address = packet.meta.srcAddress;
|
newClient.address = packet.meta.srcAddress;
|
||||||
clientMap[ClientEntry::uidCounter] = newClient;
|
clientMap[ClientEntry::uidCounter] = newClient;
|
||||||
|
|
||||||
|
//TODO: move this into the player management code
|
||||||
//register the new player
|
//register the new player
|
||||||
PlayerEntry newPlayer;
|
PlayerEntry newPlayer;
|
||||||
newPlayer.clientIndex = ClientEntry::uidCounter;
|
newPlayer.clientIndex = ClientEntry::uidCounter;
|
||||||
@@ -65,7 +66,7 @@ void ServerApplication::HandleJoinRequest(SerialPacket packet) {
|
|||||||
serialize(&packet, buffer);
|
serialize(&packet, buffer);
|
||||||
network.Send(&newClient.address, buffer, PACKET_BUFFER_SIZE);
|
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
|
//finished this routine
|
||||||
ClientEntry::uidCounter++;
|
ClientEntry::uidCounter++;
|
||||||
@@ -130,7 +131,7 @@ void ServerApplication::HandleDisconnect(SerialPacket packet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ServerApplication::HandleShutdown(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
|
//end the server
|
||||||
running = false;
|
running = false;
|
||||||
@@ -145,6 +146,7 @@ void ServerApplication::HandleShutdown(SerialPacket packet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ServerApplication::HandlePlayerUpdate(SerialPacket packet) {
|
void ServerApplication::HandlePlayerUpdate(SerialPacket packet) {
|
||||||
|
//TODO: this should be moved elsewhere
|
||||||
if (playerMap.find(packet.playerInfo.playerIndex) == playerMap.end()) {
|
if (playerMap.find(packet.playerInfo.playerIndex) == playerMap.end()) {
|
||||||
throw(std::runtime_error("Cannot update a non-existant player"));
|
throw(std::runtime_error("Cannot update a non-existant player"));
|
||||||
}
|
}
|
||||||
@@ -157,6 +159,7 @@ void ServerApplication::HandlePlayerUpdate(SerialPacket packet) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void ServerApplication::HandleRegionRequest(SerialPacket packet) {
|
void ServerApplication::HandleRegionRequest(SerialPacket packet) {
|
||||||
|
//TODO: this should be moved elsewhere
|
||||||
packet.meta.type = SerialPacket::Type::REGION_CONTENT;
|
packet.meta.type = SerialPacket::Type::REGION_CONTENT;
|
||||||
packet.regionInfo.region = regionPager.GetRegion(packet.regionInfo.x, packet.regionInfo.y);
|
packet.regionInfo.region = regionPager.GetRegion(packet.regionInfo.x, packet.regionInfo.y);
|
||||||
|
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
Please note that due to modificatons, the indicated line may be incorrect.
|
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
|
## TODO
|
||||||
server_application.hpp:74 a function that only sends to players in a certain proximity
|
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
|
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
|
region_pager.hpp:49 delete existing regions
|
||||||
serial_packet.hpp:71 combat packets
|
serial_packet.hpp:71 combat packets
|
||||||
setup_server.sql:1 The SQL startup script needs revising
|
setup_server.sql:1 The SQL startup script needs revising
|
||||||
|
|
||||||
Move PlayerEntry into a proper class
|
|
||||||
Move ClientEntry into a proper class
|
|
||||||
|
|||||||
Reference in New Issue
Block a user