source: network-game/common/MessageContainer.cpp@ b4c5b6a

Last change on this file since b4c5b6a was 6319311, checked in by Dmitry Portnoy <dportnoy@…>, 11 years ago

Some redfinition issues related to winsock2 are fixed and a few allegro rendering functions are now in GameRender

  • Property mode set to 100644
File size: 2.0 KB
Line 
1#include "MessageContainer.h"
2
3#include <iostream>
4
5using namespace std;
6
7MessageContainer::MessageContainer() {
8}
9
10MessageContainer::MessageContainer(const MessageContainer& mc) {
11 this->msg = mc.msg;
12 this->clientAddr = mc.clientAddr;
13 this->isAcked = mc.isAcked;
14 this->timeAcked = mc.timeAcked;
15}
16
17MessageContainer::MessageContainer(NETWORK_MSG msg, struct sockaddr_in clientAddr) {
18 this->clientAddr = clientAddr;
19 this->msg = msg;
20 this->isAcked = false;
21 this->timeAcked = 0;
22}
23
24MessageContainer::~MessageContainer() {
25}
26
27bool MessageContainer::getAcked() {
28 return this->isAcked;
29}
30
31unsigned long long MessageContainer::getTimeAcked() {
32 return this->timeAcked;
33}
34
35NETWORK_MSG* MessageContainer::getMessage() {
36 return &msg;
37}
38
39void MessageContainer::setAcked(bool acked) {
40 cout << "acked before: " << this->isAcked << endl;
41 this->isAcked = acked;
42 cout << "acked after: " << this->isAcked << endl;
43}
44
45void MessageContainer::setTimeAcked(unsigned long long time) {
46 this->timeAcked = time;
47}
48
49/*
50string getMsgTypeString(int msgType) {
51 switch(msgType) {
52 case MSG_TYPE_ACK: return "MSG_TYPE_ACK";
53 case MSG_TYPE_REGISTER: return "MSG_TYPE_REGISTER";
54 case MSG_TYPE_LOGIN: return "MSG_TYPE_LOGIN";
55 case MSG_TYPE_LOGOUT: return "MSG_TYPE_LOGOUT";
56 case MSG_TYPE_CHAT: return "MSG_TYPE_CHAT";
57 case MSG_TYPE_PLAYER: return "MSG_TYPE_PLAYER";
58 case MSG_TYPE_PLAYER_MOVE: return "MSG_TYPE_PLAYER_MOVE";
59 case MSG_TYPE_OBJECT: return "MSG_TYPE_OBJECT";
60 case MSG_TYPE_REMOVE_OBJECT: return "MSG_TYPE_REMOVE_OBJECT";
61 case MSG_TYPE_PICKUP_FLAG: return "MSG_TYPE_PICKUP_FLAG";
62 caseMSG_TYPE_DROP_FLAG: return "MSG_TYPE_DROP_FLAG";
63 case MSG_TYPE_SCORE: return "MSG_TYPE_SCORE";
64 case MSG_TYPE_START_ATTACK: return "MSG_TYPE_START_ATACK";
65 case MSG_TYPE_ATTACK: return "MSG_TYPE_ATTACK";
66 case MSG_TYPE_PROJECTILE: return "MSG_TYPE_PROJECTILE";
67 case MSG_TYPE_REMOVE_PROJECTILE: return "MSG_TYPE_REMOVE_PROJECTILE";
68 default: return "Unknown";
69 }
70}
71*/
Note: See TracBrowser for help on using the repository browser.