Adjusted a few comments
This commit is contained in:
@@ -453,7 +453,7 @@ int InWorld::CheckBufferDistance(Region* const region) {
|
|||||||
return std::max(abs(x), abs(y));
|
return std::max(abs(x), abs(y));
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO: eew ugly
|
//TODO: Revise InWorld::UpdateMap() after InWorld::CheckBufferDistance()
|
||||||
void InWorld::UpdateMap() {
|
void InWorld::UpdateMap() {
|
||||||
//prune distant regions
|
//prune distant regions
|
||||||
for (auto it = regionPager.GetContainer()->begin(); it != regionPager.GetContainer()->end(); /* EMPTY */) {
|
for (auto it = regionPager.GetContainer()->begin(); it != regionPager.GetContainer()->end(); /* EMPTY */) {
|
||||||
|
|||||||
@@ -155,6 +155,7 @@ void LobbyMenu::MouseButtonUp(SDL_MouseButtonEvent const& button) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
else if (join.MouseButtonUp(button) == Button::State::HOVER && selection != nullptr && selection->compatible) {
|
else if (join.MouseButtonUp(button) == Button::State::HOVER && selection != nullptr && selection->compatible) {
|
||||||
|
//TODO: The player login information should be collected by the lobby screen
|
||||||
//the vars
|
//the vars
|
||||||
SerialPacket packet;
|
SerialPacket packet;
|
||||||
char buffer[PACKET_BUFFER_SIZE];
|
char buffer[PACKET_BUFFER_SIZE];
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ public:
|
|||||||
virtual Region* SaveRegion(int x, int y) = 0;
|
virtual Region* SaveRegion(int x, int y) = 0;
|
||||||
virtual Region* CreateRegion(int x, int y) = 0;
|
virtual Region* CreateRegion(int x, int y) = 0;
|
||||||
virtual void UnloadRegion(int x, int y) = 0;
|
virtual void UnloadRegion(int x, int y) = 0;
|
||||||
//TODO: delete?
|
//TODO: delete existing regions
|
||||||
|
|
||||||
//accessors & mutators
|
//accessors & mutators
|
||||||
std::list<Region*>* GetContainer() { return ®ionList; }
|
std::list<Region*>* GetContainer() { return ®ionList; }
|
||||||
|
|||||||
@@ -24,7 +24,7 @@
|
|||||||
|
|
||||||
#include "serial_packet.hpp"
|
#include "serial_packet.hpp"
|
||||||
|
|
||||||
/* TODO: Keep the PACKET_BUFFER_SIZE up to date
|
/* NOTE: Keep the PACKET_BUFFER_SIZE up to date
|
||||||
* NOTE: REGION_CONTENT is currently the largest type of packet
|
* NOTE: REGION_CONTENT is currently the largest type of packet
|
||||||
* map content: REGION_WIDTH * REGION_HEIGHT * REGION_DEPTH * sizoeof(region::type_t)
|
* map content: REGION_WIDTH * REGION_HEIGHT * REGION_DEPTH * sizoeof(region::type_t)
|
||||||
* map format: sizeof(int) * 2
|
* map format: sizeof(int) * 2
|
||||||
|
|||||||
@@ -99,8 +99,7 @@ union SerialPacket {
|
|||||||
Metadata meta;
|
Metadata meta;
|
||||||
int clientIndex;
|
int clientIndex;
|
||||||
int playerIndex;
|
int playerIndex;
|
||||||
//TODO: should probably move these into the client info
|
//TODO: should move handle/avatar into clientInfo; these might actually do better during the login system
|
||||||
//TODO: these might actually do better during the login system
|
|
||||||
char handle[PACKET_STRING_SIZE];
|
char handle[PACKET_STRING_SIZE];
|
||||||
char avatar[PACKET_STRING_SIZE];
|
char avatar[PACKET_STRING_SIZE];
|
||||||
Vector2 position;
|
Vector2 position;
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ void ServerApplication::Proc() {
|
|||||||
HandlePacket(packet);
|
HandlePacket(packet);
|
||||||
}
|
}
|
||||||
//give the computer a break
|
//give the computer a break
|
||||||
//TODO: remove this?
|
//TODO: remove this delay?
|
||||||
SDL_Delay(10);
|
SDL_Delay(10);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -252,7 +252,7 @@ void ServerApplication::HandleSynchronize(SerialPacket packet) {
|
|||||||
SerialPacket newPacket;
|
SerialPacket newPacket;
|
||||||
char buffer[PACKET_BUFFER_SIZE];
|
char buffer[PACKET_BUFFER_SIZE];
|
||||||
|
|
||||||
//TODO: map?
|
//TODO: syncronize the map?
|
||||||
|
|
||||||
//players
|
//players
|
||||||
newPacket.meta.type = SerialPacket::Type::PLAYER_UPDATE;
|
newPacket.meta.type = SerialPacket::Type::PLAYER_UPDATE;
|
||||||
@@ -314,13 +314,15 @@ void ServerApplication::HandlePlayerNew(SerialPacket packet) {
|
|||||||
PlayerEntry::uidCounter++;
|
PlayerEntry::uidCounter++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: differentiate between delete and unload
|
||||||
void ServerApplication::HandlePlayerDelete(SerialPacket packet) {
|
void ServerApplication::HandlePlayerDelete(SerialPacket packet) {
|
||||||
//TODO: remove this?
|
|
||||||
//TODO: authenticate who is deleting this player
|
//TODO: authenticate who is deleting this player
|
||||||
if (playerMap.find(packet.playerInfo.playerIndex) == playerMap.end()) {
|
if (playerMap.find(packet.playerInfo.playerIndex) == playerMap.end()) {
|
||||||
throw(std::runtime_error("Cannot delete a non-existant player"));
|
throw(std::runtime_error("Cannot delete a non-existant player"));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//TODO: remove the deleted player from the database?
|
||||||
|
|
||||||
//prep the delete packet
|
//prep the delete packet
|
||||||
SerialPacket delPacket;
|
SerialPacket delPacket;
|
||||||
delPacket.meta.type = SerialPacket::Type::PLAYER_DELETE;
|
delPacket.meta.type = SerialPacket::Type::PLAYER_DELETE;
|
||||||
|
|||||||
@@ -74,7 +74,7 @@ private:
|
|||||||
void HandlePlayerUpdate(SerialPacket);
|
void HandlePlayerUpdate(SerialPacket);
|
||||||
void HandleRegionRequest(SerialPacket);
|
void HandleRegionRequest(SerialPacket);
|
||||||
|
|
||||||
//TODO: a function that 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);
|
||||||
|
|
||||||
//APIs
|
//APIs
|
||||||
|
|||||||
Reference in New Issue
Block a user