source: network-game/common/MessageContainer.cpp@ 233e736

Last change on this file since 233e736 was b35b2b2, checked in by dportnoy <dmp1488@…>, 11 years ago

Added a basic ingame debug console

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