small logging fixes

This commit is contained in:
gmueller 2011-01-25 23:21:03 +01:00
parent 5171a9f42d
commit 04a55c02a7

View File

@ -44,7 +44,7 @@ void Network::initialize(const std::string &hostname) {
throw "An error occurred while trying to create an ENet client host.";
}
std::cout << "[Network] connect to " << host << std::endl;
std::cout << "[Network] connect to " << hostname << std::endl;
enet_address_set_host(&address, hostname.c_str());
address.port = 1234;
@ -58,7 +58,7 @@ void Network::initialize(const std::string &hostname) {
/* Wait up to 5 seconds for the connection attempt to succeed. */
if (enet_host_service(host, &event, 2000) > 0 && event.type
== ENET_EVENT_TYPE_CONNECT) {
std::cout << "[Network] connected" << host << std::endl;
std::cout << "[Network] connected" << std::endl;
} else {
/* Either the 5 seconds are up or a disconnect event was */
/* received. Reset the peer in the event the 5 seconds */
@ -402,9 +402,11 @@ void Network::service(uint32_t timeout) {
while (enet_host_service(host, &event, timeout) > 0) {
switch (event.type) {
case ENET_EVENT_TYPE_CONNECT: {
std::cout << "A new client connected from "
<< event.peer->address.host << " "
<< event.peer->address.port << std::endl;
char hostname[256];
enet_address_get_host(&event.peer->address, hostname,
sizeof(hostname));
std::cout << "[Network] A new client connected from " << hostname
<< std::endl;
// bring new client up to date
size_t i;
for (i = 0; i < GAME_PLAYER_COUNT; i++) {