-
Notifications
You must be signed in to change notification settings - Fork 0
/
BaseAgent.h
115 lines (67 loc) · 2.54 KB
/
BaseAgent.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
// BaseAgent.h: interface for the CBaseAgent class.
//
//////////////////////////////////////////////////////////////////////
#if !defined(AFX_BASEAGENT_H__7FCEA561_5114_11D1_B242_0000C09B5CBE__INCLUDED_)
#define AFX_BASEAGENT_H__7FCEA561_5114_11D1_B242_0000C09B5CBE__INCLUDED_
#if _MSC_VER >= 1000
#pragma once
#endif // _MSC_VER >= 1000
#include "Agentsock.h"
class CMicroClientDoc;
class CBaseAgent : public CAgentSocket {
public:
BOOL Connect();
CBaseAgent();
CBaseAgent(CMicroClientDoc *m_pDoc);
virtual ~CBaseAgent();
BOOL ConnectAgent(LPCTSTR lpszTeam, LPCTSTR lpszServer, UINT nPort);
void DisconnectAgent(void);
// communication functions
virtual void OnReceive(int nErrorCode);
void SendMsg(CString &strText);
// overridables
virtual void OnCreatedSocket();
virtual void OnSentMessage(LPCTSTR message) {};
virtual void OnReceivedMessage(LPCTSTR message) {};
virtual void OnErrorCreatingSocket() {};
virtual void OnErrorSendingMessage() {};
virtual void OnErrorReceivingMessage() {};
virtual void OnChangedView(int mode, int quality) {};
// the agents actions
void Move(int x, int y);
void Turn(int iMoment);
void Dash(int iPower);
void Kick(int iPower, int iDirection);
void Catch(int iDir);
void Say(CString csMessage);
void ChangeView(int iWidth, int iQuality);
void SenseBody();
void MoveRel(int x); // moves relative to the current position
// attribute fuctions
BOOL IsConnected() { return m_bConnected; };
int GetSide() { return m_iSide; };
void SetSide(int side) { m_iSide = side; };
int GetNumber() { return m_iNumber; };
void SetNumber(int number) { m_iNumber = number; };
protected:
CString m_strTeam; // name of the team the player is in
int m_iSide; // side on which playing
int m_iNumber; // number of the player
int m_iPositionX; // position of the agent x coordinate
int m_iPositionY; // position of the agent y coordinate
int m_iDirection; // view direction of the agent
BOOL m_bConnected; // true, if the agent is currently connected
public:
void writetofile();
void SendCommand();
CString teamname;
BOOL ParseObject(LPCTSTR str);
int m_iTime;
void ParseSee(LPCTSTR str);
int m_iPlayMode;
void ParseInit(LPCTSTR str);
void ParseMessage(LPCTSTR str);
CMicroClientDoc *m_pDoc;
// send_to_team teaminfo;
};
#endif // !defined(AFX_BASEAGENT_H__7FCEA561_5114_11D1_B242_0000C09B5CBE__INCLUDED_)