Changeset 88cdae2 in network-game for common


Ignore:
Timestamp:
Jan 1, 2013, 12:58:18 AM (12 years ago)
Author:
Dmitry Portnoy <dmp1488@…>
Branches:
master
Children:
80b3f94
Parents:
594d2e9
Message:

The user can now move around the screen by clicking once they're logged in. A new message of type MSG_TYPE_PLAYER_MOVE is sent to the server.

Location:
common
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • common/Message.h

    r594d2e9 r88cdae2  
    77#define MSG_TYPE_CHAT         4
    88#define MSG_TYPE_PLAYER       5
     9#define MSG_TYPE_PLAYER_MOVE  6
    910
    1011typedef struct
  • common/Player.cpp

    r594d2e9 r88cdae2  
    5353   ostringstream oss;
    5454
    55    cout << "Player name: " << this->name << endl;
    56 
    57    /*
    58    oss.write((char*)&(this->id), sizeof(int));
    59    oss << this->name;
    60    cout << "first oss str: " << oss.str() << endl;
    61    oss.write("\0", 1);
    62    cout << "second oss str: " << oss.str() << endl;
    63    oss.write((char*)&(this->pos.x), sizeof(int));
    64    cout << "third oss str: " << oss.str() << endl;
    65    oss.write((char*)&(this->pos.y), sizeof(int));
    66    */
    67 
    6855   oss << this->id;
    6956   oss << this->name;
     
    7966   istringstream iss;
    8067   iss.str(buffer);
    81 
    82    /*
    83    iss.read((char*)&(this->id), sizeof(int));
    84    iss >> this->name;
    85    iss.read((char*)&(this->pos.x), sizeof(int));
    86    iss.read((char*)&(this->pos.y), sizeof(int));
    87    */
    8868
    8969   iss >> this->id;
Note: See TracChangeset for help on using the changeset viewer.