Changeset 13a8212 in network-game for common


Ignore:
Timestamp:
Oct 7, 2015, 11:52:50 PM (9 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
master
Children:
e2a0a27
Parents:
35d702d
Message:

In the MessageContainer, add a field for when the message was originally sent

Location:
common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • common/MessageContainer.cpp

    r35d702d r13a8212  
    1111   this->msg = mc.msg;
    1212   this->clientAddr = mc.clientAddr;
     13   this->timeSent = mc.timeSent;
    1314   this->isAcked = mc.isAcked;
    1415   this->timeAcked = mc.timeAcked;
     
    1819   this->clientAddr = clientAddr;
    1920   this->msg = msg;
     21   this->timeSent = 0;
    2022   this->isAcked = false;
    2123   this->timeAcked = 0;
     
    2527}
    2628
     29NETWORK_MSG* MessageContainer::getMessage() {
     30   return &msg;
     31}
     32
    2733bool MessageContainer::getAcked() {
    2834   return this->isAcked;
     35}
     36
     37unsigned long long MessageContainer::getTimeSent() {
     38   return this->timeSent;
    2939}
    3040
     
    3343}
    3444
    35 NETWORK_MSG* MessageContainer::getMessage() {
    36    return &msg;
     45void MessageContainer::setAcked(bool acked) {
     46   this->isAcked = acked;
    3747}
    3848
    39 void MessageContainer::setAcked(bool acked) {
    40    cout << "acked before: " << this->isAcked << endl;
    41    this->isAcked = acked;
    42    cout << "acked after: " << this->isAcked << endl;
     49void MessageContainer::setTimeSent(unsigned long long time) {
     50   this->timeSent = time;
    4351}
    44 
    4552
    4653void MessageContainer::setTimeAcked(unsigned long long time) {
  • common/MessageContainer.h

    r35d702d r13a8212  
    5959   struct sockaddr_in clientAddr;
    6060   bool isAcked;
     61   unsigned long long timeSent;
    6162   unsigned long long timeAcked;
    6263
     
    6768   ~MessageContainer();
    6869
     70   NETWORK_MSG* getMessage();
    6971   bool getAcked();
     72   unsigned long long getTimeSent();
    7073   unsigned long long getTimeAcked();
    71    NETWORK_MSG* getMessage();
    7274
    7375   void setAcked(bool acked);
     76   void setTimeSent(unsigned long long time);
    7477   void setTimeAcked(unsigned long long time);
    7578
Note: See TracChangeset for help on using the changeset viewer.