Changeset 8554263 in network-game for common


Ignore:
Timestamp:
Dec 24, 2013, 8:06:30 PM (11 years ago)
Author:
dportnoy <dmp1488@…>
Branches:
master
Children:
9c18cb7
Parents:
68d94de
Message:

Restructuring and code cleanup

Location:
common
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • common/Common.cpp

    r68d94de r8554263  
    1313#include <cmath>
    1414#include <ctime>
     15#include <cstdlib>
     16#include <cstdio>
    1517
    1618using namespace std;
     
    3032
    3133   return position;
     34}
     35
     36// This might not be cross-platform. Verify that this works correctly or fix it.
     37void error(const char *msg)
     38{
     39    perror(msg);
     40    exit(0);
    3241}
    3342
  • common/Common.h

    r68d94de r8554263  
    2020};
    2121
     22void error(const char *msg);
    2223void set_nonblock(int sock);
    2324unsigned long long getCurrentMillis();
  • common/MessageProcessor.cpp

    r68d94de r8554263  
    4040   int ret =  sendto(sock, (char*)msg, sizeof(NETWORK_MSG), 0, (struct sockaddr *)dest, sizeof(struct sockaddr_in));
    4141
    42    return ret;
     42   if (ret < 0)
     43      error("sendMessage");
     44   else
     45      return ret;
    4346}
    4447
Note: See TracChangeset for help on using the changeset viewer.