Smoothed naming and other conventions

This commit is contained in:
Kayne Ruse
2013-05-24 00:51:04 +10:00
parent cce1a874bf
commit 0b2af1d80f
21 changed files with 176 additions and 257 deletions
+10 -10
View File
@@ -63,9 +63,9 @@ void Lobby::Update() {
void Lobby::Receive() {
//dump to the console
Packet packet;
PacketData packet;
while(netUtil->Receive()) {
memcpy(&packet, netUtil->GetInData(), sizeof(Packet));
memcpy(&packet, netUtil->GetInData(), sizeof(PacketData));
switch(packet.type) {
case PacketList::PONG:
PushServer(&packet);
@@ -149,24 +149,24 @@ void Lobby::KeyUp(SDL_KeyboardEvent const& key) {
void Lobby::PingNetwork() {
//ping the network
Packet packet;
PacketData packet;
packet.type = PacketList::PING;
netUtil->Send("255.255.255.255", configUtil->Integer("server.port"), reinterpret_cast<void*>(&packet), sizeof(Packet));
netUtil->Send("255.255.255.255", configUtil->Integer("server.port"), reinterpret_cast<void*>(&packet), sizeof(PacketData));
//reset the server list
// serverVector.clear();
}
void Lobby::PushServer(Packet* packet) {
Server s;
void Lobby::PushServer(PacketData* packet) {
ServerData s;
s.name = packet->pong.metadata;
s.add = netUtil->GetInPacket()->address;
s.address = netUtil->GetInPacket()->address;
serverVector.push_back(s);
}
void Lobby::JoinRequest(Server* server) {
Packet packet;
void Lobby::JoinRequest(ServerData* server) {
PacketData packet;
packet.type = PacketList::JOINREQUEST;
snprintf(packet.joinRequest.handle, PACKET_STRING_SIZE, "%s", configUtil->CString("handle"));
snprintf(packet.joinRequest.avatar, PACKET_STRING_SIZE, "%s", configUtil->CString("avatar"));
netUtil->Send(&server->add, reinterpret_cast<void*>(&packet), sizeof(Packet));
netUtil->Send(&server->address, reinterpret_cast<void*>(&packet), sizeof(PacketData));
}