Initialization
This commit is contained in:
1 parent
cfe3e1ebff
commit
700c90dabc
37 files changed
+4457
No files matched your search
@@ -0,0 +1,87 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Agentsock.h"
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char BASED_CODE THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
IMPLEMENT_DYNAMIC(CAgentSocket, CAsyncSocket)
|
||||
|
||||
CAgentSocket::CAgentSocket() {
|
||||
m_uiPort = 0;
|
||||
m_sSocketAddress = _T("");
|
||||
}
|
||||
|
||||
void CAgentSocket::OnReceive(int nErrorCode) {
|
||||
CAsyncSocket::OnReceive(nErrorCode);
|
||||
}
|
||||
|
||||
BOOL CAgentSocket::Create(UINT nSocketPort, LPCTSTR lpszSocketAddress) {
|
||||
int nSocketType = SOCK_DGRAM;
|
||||
long lEvent = FD_READ | FD_WRITE | FD_ACCEPT | FD_CONNECT | FD_CLOSE;
|
||||
|
||||
// create the socket
|
||||
if (Socket(nSocketType, lEvent)) {
|
||||
// try to bind the socket to any address
|
||||
if (Bind(nSocketPort, lpszSocketAddress))
|
||||
return TRUE;
|
||||
|
||||
// an error occured
|
||||
int nResult = GetLastError();
|
||||
Close();
|
||||
WSASetLastError(nResult);
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
BOOL CAgentSocket::Bind(UINT nSocketPort, LPCTSTR lpszSocketAddress) {
|
||||
int result;
|
||||
|
||||
// bind to INADDR_ANY
|
||||
memset(&sockAddr, 0, sizeof(sockAddr));
|
||||
sockAddr.sin_family = AF_INET;
|
||||
sockAddr.sin_addr.s_addr = htonl(INADDR_ANY);
|
||||
sockAddr.sin_port = htons(0);
|
||||
result = CAsyncSocket::Bind((SOCKADDR *)&sockAddr, sizeof(sockAddr));
|
||||
|
||||
// set the proper values of port and address for the following SendTo commands
|
||||
memset(&sockAddr, 0, sizeof(sockAddr));
|
||||
LPSTR lpszAscii = (LPTSTR)lpszSocketAddress;
|
||||
sockAddr.sin_family = AF_INET;
|
||||
sockAddr.sin_addr.s_addr = inet_addr(lpszAscii);
|
||||
if (sockAddr.sin_addr.s_addr == INADDR_NONE) {
|
||||
// get the address from a nameserver
|
||||
LPHOSTENT lphost;
|
||||
lphost = gethostbyname(lpszAscii);
|
||||
if (lphost != NULL)
|
||||
sockAddr.sin_addr.s_addr = ((LPIN_ADDR)lphost->h_addr)->s_addr;
|
||||
else {
|
||||
WSASetLastError(WSAEINVAL);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
sockAddr.sin_port = htons((u_short)nSocketPort);
|
||||
|
||||
// return the result of the Bind command
|
||||
return result;
|
||||
}
|
||||
|
||||
int CAgentSocket::ReceiveFrom(void *lpBuf, int nBufLen, CString &rSocketAddress, UINT &rSocketPort, int nFlags) {
|
||||
// try to receive data
|
||||
memset(&sockAddr, 0, sizeof(sockAddr));
|
||||
int nSockAddrLen = sizeof(sockAddr);
|
||||
int nResult = CAsyncSocket::ReceiveFrom(lpBuf, nBufLen, (SOCKADDR *)&sockAddr, &nSockAddrLen, nFlags);
|
||||
if (nResult != SOCKET_ERROR) {
|
||||
// succesfull
|
||||
rSocketPort = ntohs(sockAddr.sin_port);
|
||||
rSocketAddress = inet_ntoa(sockAddr.sin_addr);
|
||||
}
|
||||
|
||||
return nResult;
|
||||
}
|
||||
|
||||
int CAgentSocket::SendTo(const void *lpBuf, int nBufLen, UINT nHostPort, LPCTSTR lpszHostAddress, int nFlags) {
|
||||
// send the buffer
|
||||
return CAsyncSocket::SendTo(lpBuf, nBufLen, (SOCKADDR *)&sockAddr, sizeof(sockAddr), nFlags);
|
||||
}
|
||||
+27
@@ -0,0 +1,27 @@
|
||||
#ifndef __AGENTSOCK_H__
|
||||
#define __AGENTSOCK_H__
|
||||
class CAgentSocket : public CAsyncSocket {
|
||||
DECLARE_DYNAMIC(CAgentSocket);
|
||||
|
||||
public:
|
||||
CAgentSocket();
|
||||
BOOL Create(UINT nSocketPort, LPCTSTR lpszSocketAddress);
|
||||
BOOL Bind(UINT nSocketPort, LPCTSTR lpszSocketAddress);
|
||||
BOOL Connect(LPCTSTR lpszHostAddress, UINT nHostPort);
|
||||
int ReceiveFrom(void *lpBuf, int nBufLen, CString &rSocketAddress, UINT &rSocketPort, int nFlags);
|
||||
int SendTo(const void *lpBuf, int nBufLen, UINT nHostPort, LPCTSTR lpszHostAddress, int nFlags);
|
||||
|
||||
void SetPort(UINT port) { m_uiPort = port; };
|
||||
UINT GetPort(void) { return m_uiPort; };
|
||||
CString GetAddress(void) { return m_sSocketAddress; };
|
||||
|
||||
protected:
|
||||
virtual void OnReceive(int nErrorCode);
|
||||
|
||||
private:
|
||||
SOCKADDR_IN sockAddr;
|
||||
UINT m_uiPort;
|
||||
CString m_sSocketAddress;
|
||||
};
|
||||
|
||||
#endif // __AGENTSOCK_H__
|
||||
+513
@@ -0,0 +1,513 @@
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "Agentsock.h"
|
||||
#include <iostream>
|
||||
#include "MicroClientDoc.h"
|
||||
#include "TParseString.h"
|
||||
#include "StrategySystem.h"
|
||||
#include "BaseAgent.h"
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
extern Robot2 r[2][11];
|
||||
extern Robot3 op;
|
||||
extern Robot1 theball;
|
||||
extern CStrategySystem *thePlannerR;
|
||||
extern CStrategySystem *thePlannerL;
|
||||
|
||||
// extern FILE* fp;
|
||||
#define MAX_MSG_LENGTH 1500
|
||||
CBaseAgent::CBaseAgent() {
|
||||
m_bConnected = FALSE;
|
||||
m_iSide = LEFT_TO_RIGHT;
|
||||
m_iNumber = 0;
|
||||
}
|
||||
|
||||
CBaseAgent::CBaseAgent(CMicroClientDoc *m_Doc) {
|
||||
m_pDoc = m_Doc;
|
||||
m_bConnected = FALSE;
|
||||
m_iSide = LEFT_TO_RIGHT;
|
||||
m_iNumber = 0;
|
||||
}
|
||||
CBaseAgent::~CBaseAgent() {
|
||||
DisconnectAgent();
|
||||
}
|
||||
|
||||
BOOL CBaseAgent::ConnectAgent(LPCTSTR lpszTeam, LPCTSTR lpszServer, UINT nPort) {
|
||||
// is the agent already connected (should not happen)
|
||||
if (m_bConnected)
|
||||
return FALSE;
|
||||
|
||||
// create the datagram socket
|
||||
if (!Create(nPort, lpszServer)) {
|
||||
// socket could not be created
|
||||
OnErrorCreatingSocket();
|
||||
return FALSE;
|
||||
}
|
||||
else {
|
||||
m_bConnected = TRUE;
|
||||
m_strTeam = lpszTeam;
|
||||
OnCreatedSocket();
|
||||
Sleep(100);
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
void CBaseAgent::OnCreatedSocket() {
|
||||
CString message;
|
||||
|
||||
// send the (init team) command
|
||||
message.Format("(init %s (version 4.00))", (LPCTSTR)m_strTeam);
|
||||
SendMsg(message);
|
||||
}
|
||||
|
||||
void CBaseAgent::DisconnectAgent() {
|
||||
// is the socket active ?
|
||||
if (m_bConnected) {
|
||||
BYTE Buffer[50];
|
||||
|
||||
ShutDown();
|
||||
while (Receive(Buffer, 50) > 0)
|
||||
;
|
||||
Close();
|
||||
}
|
||||
m_bConnected = FALSE;
|
||||
}
|
||||
|
||||
void CBaseAgent::SendMsg(CString &strText) {
|
||||
int iLength;
|
||||
|
||||
// send the buffer
|
||||
iLength = SendTo(strText, strText.GetLength(), GetPort(), GetAddress(), 0);
|
||||
if (iLength == strText.GetLength())
|
||||
OnSentMessage((LPCTSTR)strText);
|
||||
else {
|
||||
// an error occured
|
||||
#ifdef _DEBUG
|
||||
afxDump << "error writing to socket\n";
|
||||
#endif
|
||||
OnErrorSendingMessage();
|
||||
}
|
||||
}
|
||||
|
||||
void CBaseAgent::OnReceive(int iError) {
|
||||
char buffer[MAX_MSG_LENGTH];
|
||||
int iLength = 0;
|
||||
UINT iPort = GetPort();
|
||||
int iPosition = 0;
|
||||
|
||||
// first call base classes method
|
||||
CAgentSocket::OnReceive(iError);
|
||||
|
||||
// read a message from the socket
|
||||
iLength = ReceiveFrom(buffer, MAX_MSG_LENGTH, GetAddress(), iPort, 0);
|
||||
// the port may have changed
|
||||
SetPort(iPort);
|
||||
|
||||
if (iLength > 0) {
|
||||
// OnReceivedMessage((LPCTSTR) buffer);
|
||||
ParseMessage((LPCTSTR)buffer);
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
thePlannerL->ReceiveData(theball, r[0][0], r[0][1], r[0][2], r[0][3], r[0][4],
|
||||
r[0][5], r[0][6], r[0][7], r[0][8], r[0][9], r[0][10], op);
|
||||
thePlannerL->Action();
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
thePlannerR->ReceiveData(theball, r[0][0], r[0][1], r[0][2], r[0][3], r[0][4],
|
||||
r[0][5], r[0][6], r[0][7], r[0][8], r[0][9], r[0][10], op);
|
||||
thePlannerR->Action();
|
||||
}
|
||||
SendCommand();
|
||||
}
|
||||
else {
|
||||
// an error occured
|
||||
#ifdef _DEBUG
|
||||
afxDump << "error reading socket\n";
|
||||
#endif
|
||||
OnErrorReceivingMessage();
|
||||
}
|
||||
}
|
||||
|
||||
void CBaseAgent::ParseMessage(LPCTSTR str) {
|
||||
switch (str[1]) {
|
||||
case 's':
|
||||
if (str[3] == 'e')
|
||||
|
||||
ParseSee(str);
|
||||
break;
|
||||
case 'i':
|
||||
AfxMessageBox("Init successful");
|
||||
ParseInit(str);
|
||||
break;
|
||||
}
|
||||
// return TRUE;
|
||||
}
|
||||
|
||||
void CBaseAgent::ParseInit(LPCTSTR str) {
|
||||
|
||||
TParseString msg(str);
|
||||
CString tmp;
|
||||
// int number;
|
||||
|
||||
// get the side
|
||||
if ((msg.GetLength() > 6) && (msg.GetAt(6) == 'r')) {
|
||||
AfxMessageBox("right right");
|
||||
SetSide(RIGHT_TO_LEFT);
|
||||
}
|
||||
else {
|
||||
SetSide(LEFT_TO_RIGHT);
|
||||
}
|
||||
|
||||
// return TRUE;
|
||||
}
|
||||
|
||||
void CBaseAgent::ParseSee(LPCTSTR str) {
|
||||
TParseString msg(str);
|
||||
TParseString strObject;
|
||||
|
||||
msg.SetPosition(5);
|
||||
m_iTime = msg.ParseInteger();
|
||||
if (msg.HasErrorOccured())
|
||||
return;
|
||||
|
||||
while (msg.ParseBracket(strObject)) {
|
||||
if (!ParseObject(strObject)) {
|
||||
#ifdef _DEBUG
|
||||
CString error;
|
||||
error.Format(" : error parsing object info at position %d !\n", strObject.GetPosition());
|
||||
afxDump << error << strObject;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
BOOL CBaseAgent::ParseObject(LPCTSTR str) {
|
||||
TParseString msg(str);
|
||||
TParseString name;
|
||||
CString teamname;
|
||||
int team;
|
||||
int iNum;
|
||||
int x;
|
||||
int y;
|
||||
double angle;
|
||||
|
||||
// read the objects name bracket
|
||||
if (!msg.ParseBracket(name)) // name="player TeamName TeamNum"
|
||||
return FALSE;
|
||||
x = msg.ParseInteger();
|
||||
if (msg.HasErrorOccured()) {
|
||||
}
|
||||
y = msg.ParseInteger();
|
||||
if (msg.HasErrorOccured()) {
|
||||
}
|
||||
angle = msg.ParseDouble();
|
||||
if (msg.HasErrorOccured()) {
|
||||
}
|
||||
switch (name.GetAt(0)) {
|
||||
// it is a player
|
||||
case 'P':
|
||||
case 'p':
|
||||
name.SetPosition(7);
|
||||
// read the teamname
|
||||
if (name.ParseString(teamname)) {
|
||||
// ist it my team ?
|
||||
if (teamname.Compare(_T(name)) == 0)
|
||||
team = OWN_TEAM;
|
||||
else
|
||||
team = OTHER_TEAM;
|
||||
|
||||
// read player number
|
||||
iNum = name.ParseInteger();
|
||||
if (msg.HasErrorOccured()) {
|
||||
}
|
||||
}
|
||||
switch (iNum) {
|
||||
case 1:
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
r[0][0].position.x = x;
|
||||
r[0][0].position.y = y;
|
||||
r[0][0].angle = (int)angle;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
op.position1.x = x;
|
||||
op.position1.y = y;
|
||||
}
|
||||
break;
|
||||
case 2: // 左方二号队员的坐标
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
r[0][1].position.x = x;
|
||||
r[0][1].position.y = y;
|
||||
r[0][1].angle = (int)angle;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
op.position2.x = x;
|
||||
op.position2.y = y;
|
||||
}
|
||||
break;
|
||||
case 3: // 左方三号队员的坐标
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
r[0][2].position.x = x;
|
||||
r[0][2].position.y = y;
|
||||
r[0][2].angle = (int)angle;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
op.position3.x = x;
|
||||
op.position3.y = y;
|
||||
}
|
||||
break;
|
||||
case 4: // 左方四号队员的坐标
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
r[0][3].position.x = x;
|
||||
r[0][3].position.y = y;
|
||||
r[0][3].angle = (int)angle;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
op.position4.x = x;
|
||||
op.position4.y = y;
|
||||
}
|
||||
break;
|
||||
case 5: // 左方五号队员的坐标
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
r[0][4].position.x = x;
|
||||
r[0][4].position.y = y;
|
||||
r[0][4].angle = (int)angle;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
op.position5.x = x;
|
||||
op.position5.y = y;
|
||||
}
|
||||
break;
|
||||
case 6: // 左方六号队员的坐标
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
r[0][5].position.x = x;
|
||||
r[0][5].position.y = y;
|
||||
r[0][5].angle = (int)angle;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
op.position6.x = x;
|
||||
op.position6.y = y;
|
||||
}
|
||||
break;
|
||||
case 7: // 左方七号队员的坐标
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
r[0][6].position.x = x;
|
||||
r[0][6].position.y = y;
|
||||
r[0][6].angle = (int)angle;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
op.position7.x = x;
|
||||
op.position7.y = y;
|
||||
}
|
||||
break;
|
||||
case 8: // 左方八号队员的坐标
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
r[0][7].position.x = x;
|
||||
r[0][7].position.y = y;
|
||||
r[0][7].angle = (int)angle;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
op.position8.x = x;
|
||||
op.position8.y = y;
|
||||
}
|
||||
break;
|
||||
case 9: // 左方九号队员的坐标
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
r[0][8].position.x = x;
|
||||
r[0][8].position.y = y;
|
||||
r[0][8].angle = (int)angle;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
op.position9.x = x;
|
||||
op.position9.y = y;
|
||||
}
|
||||
break;
|
||||
case 10: // 左方十号队员的坐标
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
r[0][9].position.x = x;
|
||||
r[0][9].position.y = y;
|
||||
r[0][9].angle = (int)angle;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
op.position10.x = x;
|
||||
op.position10.y = y;
|
||||
}
|
||||
break;
|
||||
case 11: // 左方十一号队员的坐标
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
r[0][10].position.x = x;
|
||||
r[0][10].position.y = y;
|
||||
r[0][10].angle = (int)angle;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
op.position11.x = x;
|
||||
op.position11.y = y;
|
||||
}
|
||||
break;
|
||||
// 下面的是从右向左进攻的队员的坐标处理
|
||||
case 12:
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
op.position1.x = x;
|
||||
op.position1.y = y;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) // 右方一号队员坐标
|
||||
{
|
||||
r[0][0].position.x = x;
|
||||
r[0][0].position.y = y;
|
||||
r[0][0].angle = (int)angle;
|
||||
}
|
||||
break;
|
||||
case 13:
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
op.position2.x = x;
|
||||
op.position2.y = y;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
r[0][1].position.x = x;
|
||||
r[0][1].position.y = y;
|
||||
r[0][1].angle = (int)angle;
|
||||
}
|
||||
break;
|
||||
case 14:
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
op.position3.x = x;
|
||||
op.position3.y = y;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
r[0][2].position.x = x;
|
||||
r[0][2].position.y = y;
|
||||
r[0][2].angle = (int)angle;
|
||||
}
|
||||
break;
|
||||
case 15:
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
op.position4.x = x;
|
||||
op.position4.y = y;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
r[0][3].position.x = x;
|
||||
r[0][3].position.y = y;
|
||||
r[0][3].angle = (int)angle;
|
||||
}
|
||||
break;
|
||||
case 16:
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
op.position5.x = x;
|
||||
op.position5.y = y;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
r[0][4].position.x = x;
|
||||
r[0][4].position.y = y;
|
||||
r[0][4].angle = (int)angle;
|
||||
}
|
||||
break;
|
||||
case 17:
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
op.position6.x = x;
|
||||
op.position6.y = y;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
r[0][5].position.x = x;
|
||||
r[0][5].position.y = y;
|
||||
r[0][5].angle = (int)angle;
|
||||
}
|
||||
break;
|
||||
case 18:
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
op.position7.x = x;
|
||||
op.position7.y = y;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
r[0][6].position.x = x;
|
||||
r[0][6].position.y = y;
|
||||
r[0][6].angle = (int)angle;
|
||||
}
|
||||
break;
|
||||
case 19:
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
op.position8.x = x;
|
||||
op.position8.y = y;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
r[0][7].position.x = x;
|
||||
r[0][7].position.y = y;
|
||||
r[0][7].angle = (int)angle;
|
||||
}
|
||||
break;
|
||||
case 20:
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
op.position9.x = x;
|
||||
op.position9.y = y;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
r[0][8].position.x = x;
|
||||
r[0][8].position.y = y;
|
||||
r[0][8].angle = (int)angle;
|
||||
}
|
||||
break;
|
||||
case 21:
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
op.position10.x = x;
|
||||
op.position10.y = y;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
r[0][9].position.x = x;
|
||||
r[0][9].position.y = y;
|
||||
r[0][9].angle = (int)angle;
|
||||
}
|
||||
break;
|
||||
case 22:
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
op.position11.x = x;
|
||||
op.position11.y = y;
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
r[0][10].position.x = x;
|
||||
r[0][10].position.y = y;
|
||||
r[0][10].angle = (int)angle;
|
||||
}
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case 'b':
|
||||
case 'B':
|
||||
theball.position.x = x;
|
||||
theball.position.y = y;
|
||||
break;
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void CBaseAgent::SendCommand() {
|
||||
CString msg;
|
||||
if (m_iSide == LEFT_TO_RIGHT) {
|
||||
msg.Format("((player left 1) %d %d) ((player left 2) %d %d) ((player left 3) %d %d) ((player left 4) %d %d) ((player left 5) %d %d) ((player left 6) %d %d) ((player left 7) %d %d) ((player left 8) %d %d) ((player left 9) %d %d) ((player left 10) %d %d) ((player left 11) %d %d)",
|
||||
thePlannerL->command[2], thePlannerL->command[3],
|
||||
thePlannerL->command[5], thePlannerL->command[6],
|
||||
thePlannerL->command[8], thePlannerL->command[9],
|
||||
thePlannerL->command[11], thePlannerL->command[12],
|
||||
thePlannerL->command[14], thePlannerL->command[15],
|
||||
thePlannerL->command[17], thePlannerL->command[18],
|
||||
thePlannerL->command[20], thePlannerL->command[21],
|
||||
thePlannerL->command[23], thePlannerL->command[24],
|
||||
thePlannerL->command[26], thePlannerL->command[27],
|
||||
thePlannerL->command[29], thePlannerL->command[30],
|
||||
thePlannerL->command[32], thePlannerL->command[33]);
|
||||
}
|
||||
else if (m_iSide == RIGHT_TO_LEFT) {
|
||||
msg.Format("((player right 1) %d %d) ((player right 2) %d %d) ((player right 3) %d %d) ((player right 4) %d %d) ((player right 5) %d %d) ((player right 6) %d %d) ((player right 7) %d %d) ((player right 8) %d %d) ((player right 9) %d %d) ((player right 10) %d %d) ((player right 11) %d %d)",
|
||||
thePlannerR->command[2], thePlannerR->command[3],
|
||||
thePlannerR->command[5], thePlannerR->command[6],
|
||||
thePlannerR->command[8], thePlannerR->command[9],
|
||||
thePlannerR->command[11], thePlannerR->command[12],
|
||||
thePlannerR->command[14], thePlannerR->command[15],
|
||||
thePlannerR->command[17], thePlannerR->command[18],
|
||||
thePlannerR->command[20], thePlannerR->command[21],
|
||||
thePlannerR->command[23], thePlannerR->command[24],
|
||||
thePlannerR->command[26], thePlannerR->command[27],
|
||||
thePlannerR->command[29], thePlannerR->command[30],
|
||||
thePlannerR->command[32], thePlannerR->command[33]);
|
||||
}
|
||||
|
||||
SendMsg(msg);
|
||||
}
|
||||
+59
@@ -0,0 +1,59 @@
|
||||
// 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:
|
||||
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(){};
|
||||
// the agents actions
|
||||
|
||||
// attribute fuctions
|
||||
BOOL IsConnected() { return m_bConnected; };
|
||||
void SetSide(int side) { m_iSide = side; };
|
||||
|
||||
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
|
||||
|
||||
BOOL m_bConnected; // true, if the agent is currently connected
|
||||
public:
|
||||
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_)
|
||||
Binary file not shown.
@@ -0,0 +1,44 @@
|
||||
// DSetupDlg.cpp : implementation file
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "MicroClient.h"
|
||||
#include "DSetupDlg.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DSetupDlg dialog
|
||||
|
||||
DSetupDlg::DSetupDlg(CWnd *pParent /*=NULL*/)
|
||||
: CDialog(DSetupDlg::IDD, pParent) {
|
||||
//{{AFX_DATA_INIT(DSetupDlg)
|
||||
|
||||
//}}AFX_DATA_INIT
|
||||
m_TeamName = _T("WTU-ATRI");
|
||||
m_ServerName = _T("127.0.0.1");
|
||||
m_Channel = 6000;
|
||||
}
|
||||
|
||||
void DSetupDlg::DoDataExchange(CDataExchange *pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(DSetupDlg)
|
||||
|
||||
//}}AFX_DATA_MAP
|
||||
// DDX_Text(pDX, IDC_TEAM, m_TeamName);
|
||||
// DDX_Text(pDX, IDC_SERVER, m_ServerName);
|
||||
// DDX_Text(pDX, IDC_CHANNEL, m_Channel);
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(DSetupDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(DSetupDlg)
|
||||
// NOTE: the ClassWizard will add message map macros here
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DSetupDlg message handlers
|
||||
+46
@@ -0,0 +1,46 @@
|
||||
#if !defined(AFX_DSETUPDLG_H__AF3ADFE0_2D54_11D4_8C19_000021D262EF__INCLUDED_)
|
||||
#define AFX_DSETUPDLG_H__AF3ADFE0_2D54_11D4_8C19_000021D262EF__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
// DSetupDlg.h : header file
|
||||
//
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// DSetupDlg dialog
|
||||
|
||||
class DSetupDlg : public CDialog {
|
||||
// Construction
|
||||
public:
|
||||
DSetupDlg(CWnd *pParent = NULL); // standard constructor
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(DSetupDlg)
|
||||
enum { IDD = IDD_DIALOG1 };
|
||||
|
||||
//}}AFX_DATA
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(DSetupDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
public:
|
||||
CString m_TeamName;
|
||||
CString m_ServerName;
|
||||
UINT m_Channel;
|
||||
// Implementation
|
||||
protected:
|
||||
// Generated message map functions
|
||||
//{{AFX_MSG(DSetupDlg)
|
||||
// NOTE: the ClassWizard will add member functions here
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_DSETUPDLG_H__AF3ADFE0_2D54_11D4_8C19_000021D262EF__INCLUDED_)
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 663 KiB |
@@ -0,0 +1,145 @@
|
||||
/////////////////////////////////////////////////////////////////
|
||||
#define BORDERNUM 18
|
||||
/////////////////////////////////////////////////////////////////
|
||||
#define HIT_LEFTGOAL 0
|
||||
#define HIT_RIGHTGOAL 1
|
||||
#define HIT_UPBORDER 2
|
||||
#define HIT_DOWNBORDER 3
|
||||
#define HIT_LEFT_GOAL_UPBORDER 4
|
||||
#define HIT_LEFT_GOAL_DOWNBORDER 5
|
||||
#define HIT_RIGHT_GOAL_UPBORDER 6
|
||||
#define HIT_RIGHT_GOAL_DOWNBORDER 7
|
||||
#define HIT_LEFT_UPBORDER 8
|
||||
#define HIT_LEFT_DOWNBORDER 9
|
||||
#define HIT_RIGHT_UPBORDER 10
|
||||
#define HIT_RIGHT_DOWNBORDER 11
|
||||
#define HIT_LEFT_GOALBORDER 12
|
||||
#define HIT_RIGHT_GOALBORDER 13
|
||||
#define HIT_LEFTUPCORNER 14
|
||||
#define HIT_LEFTDOWNCORNER 15
|
||||
#define HIT_RIGHTDOWNCORNER 16
|
||||
#define HIT_RIGHTUPCORNER 17
|
||||
#define HIT_YH1 18
|
||||
#define HIT_YH2 19
|
||||
#define HIT_YHG 20
|
||||
#define HIT_BH1 21
|
||||
#define HIT_BH2 22
|
||||
#define HIT_BHG 23
|
||||
#define HIT_BALL 24
|
||||
/////////////////////////////////////////////////////////////////
|
||||
#define FRONT 0
|
||||
#define RIGHT 1
|
||||
#define BACK 2
|
||||
#define LEFT 3
|
||||
///////////////////////////////////////////////////////////////////
|
||||
#define BALL 0
|
||||
#define HOME1 1
|
||||
#define HOME2 2
|
||||
#define HOME3 3
|
||||
#define HOME4 4
|
||||
#define HOME5 5
|
||||
#define HOME6 6
|
||||
#define HOME7 7
|
||||
#define HOME8 8
|
||||
#define HOME9 9
|
||||
#define HOME10 10
|
||||
#define HGOALIE 11
|
||||
#define C_GO 0xaa
|
||||
#define C_STOP 0x55
|
||||
#define G_OFFSET 20 // 15
|
||||
#define G_ANGLE_BOUND 60
|
||||
#define G_BOUND_BOUND 10
|
||||
///////////////////////////////////////////////////////////////////
|
||||
// ËùÔڰ볡
|
||||
#define GAME_RIGHT 0
|
||||
#define GAME_LEFT 1
|
||||
////////////////////////////////////////////////////////////////////
|
||||
|
||||
#define PI 3.14
|
||||
#define M_PI PI
|
||||
#define square(a) ((a) * (a))
|
||||
#define leng(a, b, c, d) sqrt(square((a) - (c)) + square((b) - (d)))
|
||||
#define pleng(a, b) sqrt(square((a.x) - (b.x)) + square((a.y) - (b.y)))
|
||||
//////////////////////////////////////////
|
||||
#define Atan(y, x) ((x == 0.0 && y == 0.0) ? (0.0) : atan2(y, x))
|
||||
#define RAD2DEG (180.0 / PI)
|
||||
#define DEG2RAD (PI / 180.0)
|
||||
#define Rad2Deg(a) ((double)a * RAD2DEG)
|
||||
#define Deg2Rad(a) ((double)a * DED2RAD)
|
||||
#define ABS(a) ((a) < 0 ? -(a) : (a))
|
||||
/////////////////////////////////////////////////////////////
|
||||
union CCommand {
|
||||
BYTE Stream[3];
|
||||
struct tagData {
|
||||
char Lv;
|
||||
char Rv;
|
||||
char Command;
|
||||
} Data;
|
||||
CCommand &operator=(CCommand &r) {
|
||||
Data.Lv = r.Data.Lv;
|
||||
Data.Rv = r.Data.Rv;
|
||||
Data.Command = r.Data.Command;
|
||||
return *this;
|
||||
}
|
||||
};
|
||||
|
||||
struct Robot1 {
|
||||
int angle;
|
||||
int sAngle;
|
||||
CPoint angleRef;
|
||||
CPoint sAngleRef;
|
||||
CPoint position, oldPosition;
|
||||
CPoint sPosition, sOldPosition;
|
||||
int nMethod;
|
||||
BYTE color[6];
|
||||
BOOL bAlive;
|
||||
|
||||
Robot1(){};
|
||||
BOOL find() { return TRUE; };
|
||||
BOOL entireFind() { return TRUE; };
|
||||
BOOL entireFind(BYTE *lpY, BYTE *lpU, BYTE *lpV) { return TRUE; };
|
||||
};
|
||||
|
||||
struct Robot2 {
|
||||
int angle;
|
||||
int sAngle;
|
||||
CPoint position, oldPosition;
|
||||
CPoint sPosition, sOldPosition;
|
||||
CPoint pos, oldPos, pos1, oldPos1;
|
||||
int nMethod;
|
||||
BYTE color[6];
|
||||
BOOL bAlive;
|
||||
BYTE teamColor[6];
|
||||
|
||||
Robot2(){};
|
||||
BOOL find() { return TRUE; };
|
||||
BOOL entireFind() { return TRUE; };
|
||||
BOOL entireFind(BYTE *lpY, BYTE *lpU, BYTE *lpV) { return TRUE; };
|
||||
};
|
||||
|
||||
struct Robot3 {
|
||||
CPoint position1, oldPosition1;
|
||||
CPoint sPosition1, sOldPosition1;
|
||||
CPoint position2, oldPosition2;
|
||||
CPoint sPosition2, sOldPosition2;
|
||||
CPoint position3, oldPosition3;
|
||||
CPoint position4, oldPosition4;
|
||||
CPoint position5, oldPosition5;
|
||||
CPoint sPosition3, sOldPosition3;
|
||||
CPoint position6, oldPosition6;
|
||||
CPoint position7, oldPosition7;
|
||||
CPoint position8, oldPosition8;
|
||||
CPoint position9, oldPosition9;
|
||||
CPoint position10, oldPosition10;
|
||||
CPoint position11, oldPosition11;
|
||||
int nMethod;
|
||||
BYTE color[6];
|
||||
BOOL bAlive;
|
||||
|
||||
Robot3(){};
|
||||
BOOL find1() { return TRUE; }
|
||||
BOOL find2() { return TRUE; }
|
||||
BOOL find3() { return TRUE; }
|
||||
BOOL entireFind() { return TRUE; }
|
||||
BOOL entireFind(BYTE *lpY, BYTE *lpU, BYTE *lpV) { return TRUE; }
|
||||
};
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
// MainFrm.cpp : implementation of the CMainFrame class
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "MicroClient.h"
|
||||
|
||||
#include "MainFrm.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMainFrame
|
||||
|
||||
IMPLEMENT_DYNCREATE(CMainFrame, CFrameWnd)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
|
||||
//{{AFX_MSG_MAP(CMainFrame)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
ON_WM_CREATE()
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
static UINT indicators[] = {
|
||||
ID_SEPARATOR, // status line indicator
|
||||
ID_INDICATOR_CAPS,
|
||||
ID_INDICATOR_NUM,
|
||||
ID_INDICATOR_SCRL,
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMainFrame construction/destruction
|
||||
|
||||
CMainFrame::CMainFrame() {
|
||||
// TODO: add member initialization code here
|
||||
}
|
||||
|
||||
CMainFrame::~CMainFrame() {
|
||||
}
|
||||
|
||||
int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) {
|
||||
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
|
||||
return -1;
|
||||
|
||||
if (!m_wndToolBar.CreateEx(this, TBSTYLE_FLAT, WS_CHILD | WS_VISIBLE | CBRS_TOP | CBRS_GRIPPER | CBRS_TOOLTIPS | CBRS_FLYBY | CBRS_SIZE_DYNAMIC) ||
|
||||
!m_wndToolBar.LoadToolBar(IDR_MAINFRAME)) {
|
||||
TRACE0("Failed to create toolbar\n");
|
||||
return -1; // fail to create
|
||||
}
|
||||
|
||||
/* if (!m_wndStatusBar.Create(this) ||
|
||||
!m_wndStatusBar.SetIndicators(indicators,
|
||||
sizeof(indicators)/sizeof(UINT)))
|
||||
{
|
||||
TRACE0("Failed to create status bar\n");
|
||||
return -1; // fail to create
|
||||
}*/
|
||||
|
||||
// TODO: Delete these three lines if you don't want the toolbar to
|
||||
// be dockable
|
||||
m_wndToolBar.EnableDocking(CBRS_ALIGN_ANY);
|
||||
EnableDocking(CBRS_ALIGN_ANY);
|
||||
DockControlBar(&m_wndToolBar);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT &cs) {
|
||||
if (!CFrameWnd::PreCreateWindow(cs))
|
||||
return FALSE;
|
||||
// TODO: Modify the Window class or styles here by modifying
|
||||
// the CREATESTRUCT cs
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMainFrame diagnostics
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CMainFrame::AssertValid() const {
|
||||
CFrameWnd::AssertValid();
|
||||
}
|
||||
|
||||
void CMainFrame::Dump(CDumpContext &dc) const {
|
||||
CFrameWnd::Dump(dc);
|
||||
}
|
||||
|
||||
#endif //_DEBUG
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMainFrame message handlers
|
||||
@@ -0,0 +1,55 @@
|
||||
// MainFrm.h : interface of the CMainFrame class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_MAINFRM_H__801AABE9_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
#define AFX_MAINFRM_H__801AABE9_2D67_11D4_A201_00400564C758__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
class CMainFrame : public CFrameWnd {
|
||||
|
||||
protected: // create from serialization only
|
||||
CMainFrame();
|
||||
DECLARE_DYNCREATE(CMainFrame)
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
// Operations
|
||||
public:
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMainFrame)
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT &cs);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CMainFrame();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext &dc) const;
|
||||
#endif
|
||||
|
||||
protected: // control bar embedded members
|
||||
CStatusBar m_wndStatusBar;
|
||||
CToolBar m_wndToolBar;
|
||||
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CMainFrame)
|
||||
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_MAINFRM_H__801AABE9_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
Binary file not shown.
+154
@@ -0,0 +1,154 @@
|
||||
; CLW file contains information for the MFC ClassWizard
|
||||
|
||||
[General Info]
|
||||
Version=1
|
||||
LastClass=CMicroClientDoc
|
||||
LastTemplate=CDialog
|
||||
NewFileInclude1=#include "stdafx.h"
|
||||
NewFileInclude2=#include "MicroClient.h"
|
||||
LastPage=0
|
||||
|
||||
ClassCount=6
|
||||
Class1=CMicroClientApp
|
||||
Class2=CMicroClientDoc
|
||||
Class3=CMicroClientView
|
||||
Class4=CMainFrame
|
||||
|
||||
ResourceCount=5
|
||||
Resource1=IDD_DIALOG1
|
||||
Resource2=IDD_ABOUTBOX
|
||||
Class5=CAboutDlg
|
||||
Class6=DSetupDlg
|
||||
Resource3=IDD_DIALOG1 (Chinese (P.R.C.))
|
||||
Resource4=IDD_ABOUTBOX (Chinese (P.R.C.))
|
||||
Resource5=IDR_MAINFRAME (English (U.S.))
|
||||
|
||||
[CLS:CMicroClientApp]
|
||||
Type=0
|
||||
HeaderFile=MicroClient.h
|
||||
ImplementationFile=MicroClient.cpp
|
||||
Filter=N
|
||||
|
||||
[CLS:CMicroClientDoc]
|
||||
Type=0
|
||||
HeaderFile=MicroClientDoc.h
|
||||
ImplementationFile=MicroClientDoc.cpp
|
||||
Filter=N
|
||||
BaseClass=CDocument
|
||||
VirtualFilter=DC
|
||||
LastObject=ID_CONNECT
|
||||
|
||||
[CLS:CMicroClientView]
|
||||
Type=0
|
||||
HeaderFile=MicroClientView.h
|
||||
ImplementationFile=MicroClientView.cpp
|
||||
Filter=C
|
||||
|
||||
|
||||
[CLS:CMainFrame]
|
||||
Type=0
|
||||
HeaderFile=MainFrm.h
|
||||
ImplementationFile=MainFrm.cpp
|
||||
Filter=T
|
||||
LastObject=ID_DISCONNECT
|
||||
|
||||
|
||||
|
||||
|
||||
[CLS:CAboutDlg]
|
||||
Type=0
|
||||
HeaderFile=MicroClient.cpp
|
||||
ImplementationFile=MicroClient.cpp
|
||||
Filter=D
|
||||
LastObject=CAboutDlg
|
||||
|
||||
[DLG:IDD_ABOUTBOX]
|
||||
Type=1
|
||||
Class=CAboutDlg
|
||||
ControlCount=4
|
||||
Control1=IDC_STATIC,static,1342177283
|
||||
Control2=IDC_STATIC,static,1342308480
|
||||
Control3=IDC_STATIC,static,1342308352
|
||||
Control4=IDOK,button,1342373889
|
||||
|
||||
[DLG:IDD_DIALOG1]
|
||||
Type=1
|
||||
Class=DSetupDlg
|
||||
ControlCount=8
|
||||
Control1=IDOK,button,1342242817
|
||||
Control2=IDCANCEL,button,1342242816
|
||||
Control3=IDC_STATIC,static,1342308352
|
||||
Control4=IDC_TEAM,edit,1350631552
|
||||
Control5=IDC_STATIC,static,1342308352
|
||||
Control6=IDC_SERVER,edit,1350631552
|
||||
Control7=IDC_STATIC,static,1342308352
|
||||
Control8=IDC_CHANNEL,edit,1350631552
|
||||
|
||||
[CLS:DSetupDlg]
|
||||
Type=0
|
||||
HeaderFile=DSetupDlg.h
|
||||
ImplementationFile=DSetupDlg.cpp
|
||||
BaseClass=CDialog
|
||||
Filter=D
|
||||
LastObject=DSetupDlg
|
||||
VirtualFilter=dWC
|
||||
|
||||
[MNU:IDR_MAINFRAME (English (U.S.))]
|
||||
Type=1
|
||||
Class=CMainFrame
|
||||
Command1=ID_FILE_NEW
|
||||
Command2=ID_FILE_OPEN
|
||||
Command3=ID_FILE_SAVE
|
||||
Command4=ID_FILE_SAVE_AS
|
||||
Command5=ID_APP_EXIT
|
||||
Command6=ID_APP_ABOUT
|
||||
CommandCount=6
|
||||
|
||||
[TB:IDR_MAINFRAME (English (U.S.))]
|
||||
Type=1
|
||||
Class=CMainFrame
|
||||
Command1=ID_CONNECT
|
||||
Command2=ID_DISCONNECT
|
||||
Command3=ID_APP_ABOUT
|
||||
CommandCount=3
|
||||
|
||||
[ACL:IDR_MAINFRAME (English (U.S.))]
|
||||
Type=1
|
||||
Class=CMainFrame
|
||||
Command1=ID_FILE_NEW
|
||||
Command2=ID_FILE_OPEN
|
||||
Command3=ID_FILE_SAVE
|
||||
Command4=ID_EDIT_UNDO
|
||||
Command5=ID_EDIT_CUT
|
||||
Command6=ID_EDIT_COPY
|
||||
Command7=ID_EDIT_PASTE
|
||||
Command8=ID_EDIT_UNDO
|
||||
Command9=ID_EDIT_CUT
|
||||
Command10=ID_EDIT_COPY
|
||||
Command11=ID_EDIT_PASTE
|
||||
Command12=ID_NEXT_PANE
|
||||
Command13=ID_PREV_PANE
|
||||
CommandCount=13
|
||||
|
||||
[DLG:IDD_DIALOG1 (Chinese (P.R.C.))]
|
||||
Type=1
|
||||
Class=?
|
||||
ControlCount=8
|
||||
Control1=IDOK,button,1342242817
|
||||
Control2=IDCANCEL,button,1342242816
|
||||
Control3=IDC_STATIC,static,1342308352
|
||||
Control4=IDC_TEAM,edit,1350631552
|
||||
Control5=IDC_STATIC,static,1342308352
|
||||
Control6=IDC_SERVER,edit,1350631552
|
||||
Control7=IDC_STATIC,static,1342308352
|
||||
Control8=IDC_CHANNEL,edit,1350631552
|
||||
|
||||
[DLG:IDD_ABOUTBOX (Chinese (P.R.C.))]
|
||||
Type=1
|
||||
Class=?
|
||||
ControlCount=4
|
||||
Control1=IDC_STATIC,static,1342177283
|
||||
Control2=IDC_STATIC,static,1342308480
|
||||
Control3=IDC_STATIC,static,1342308352
|
||||
Control4=IDOK,button,1342373889
|
||||
|
||||
+150
@@ -0,0 +1,150 @@
|
||||
// MicroClient.cpp : Defines the class behaviors for the application.
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "MicroClient.h"
|
||||
|
||||
#include "MainFrm.h"
|
||||
#include "MicroClientDoc.h"
|
||||
#include "MicroClientView.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMicroClientApp
|
||||
|
||||
BEGIN_MESSAGE_MAP(CMicroClientApp, CWinApp)
|
||||
//{{AFX_MSG_MAP(CMicroClientApp)
|
||||
ON_COMMAND(ID_APP_ABOUT, OnAppAbout)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
//}}AFX_MSG_MAP
|
||||
// Standard file based document commands
|
||||
ON_COMMAND(ID_FILE_NEW, CWinApp::OnFileNew)
|
||||
ON_COMMAND(ID_FILE_OPEN, CWinApp::OnFileOpen)
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMicroClientApp construction
|
||||
|
||||
CMicroClientApp::CMicroClientApp() {
|
||||
// TODO: add construction code here,
|
||||
// Place all significant initialization in InitInstance
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// The one and only CMicroClientApp object
|
||||
|
||||
CMicroClientApp theApp;
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMicroClientApp initialization
|
||||
|
||||
BOOL CMicroClientApp::InitInstance() {
|
||||
if (!AfxSocketInit()) {
|
||||
AfxMessageBox(IDP_SOCKETS_INIT_FAILED);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
AfxEnableControlContainer();
|
||||
|
||||
// Standard initialization
|
||||
// If you are not using these features and wish to reduce the size
|
||||
// of your final executable, you should remove from the following
|
||||
// the specific initialization routines you do not need.
|
||||
|
||||
#ifdef _AFXDLL
|
||||
Enable3dControls(); // Call this when using MFC in a shared DLL
|
||||
#else
|
||||
Enable3dControlsStatic(); // Call this when linking to MFC statically
|
||||
#endif
|
||||
|
||||
// Change the registry key under which our settings are stored.
|
||||
// TODO: You should modify this string to be something appropriate
|
||||
// such as the name of your company or organization.
|
||||
SetRegistryKey(_T("Local AppWizard-Generated Applications"));
|
||||
|
||||
LoadStdProfileSettings(); // Load standard INI file options (including MRU)
|
||||
|
||||
// Register the application's document templates. Document templates
|
||||
// serve as the connection between documents, frame windows and views.
|
||||
|
||||
CSingleDocTemplate *pDocTemplate;
|
||||
pDocTemplate = new CSingleDocTemplate(
|
||||
IDR_MAINFRAME,
|
||||
RUNTIME_CLASS(CMicroClientDoc),
|
||||
RUNTIME_CLASS(CMainFrame), // main SDI frame window
|
||||
RUNTIME_CLASS(CMicroClientView));
|
||||
AddDocTemplate(pDocTemplate);
|
||||
|
||||
// Parse command line for standard shell commands, DDE, file open
|
||||
CCommandLineInfo cmdInfo;
|
||||
ParseCommandLine(cmdInfo);
|
||||
|
||||
// Dispatch commands specified on the command line
|
||||
if (!ProcessShellCommand(cmdInfo))
|
||||
return FALSE;
|
||||
|
||||
// The one and only window has been initialized, so show and update it.
|
||||
m_pMainWnd->ShowWindow(SW_SHOW);
|
||||
m_pMainWnd->SetWindowText("WTU-ATRI");
|
||||
m_pMainWnd->UpdateWindow();
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CAboutDlg dialog used for App About
|
||||
|
||||
class CAboutDlg : public CDialog {
|
||||
public:
|
||||
CAboutDlg();
|
||||
|
||||
// Dialog Data
|
||||
//{{AFX_DATA(CAboutDlg)
|
||||
enum { IDD = IDD_ABOUTBOX };
|
||||
//}}AFX_DATA
|
||||
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CAboutDlg)
|
||||
protected:
|
||||
virtual void DoDataExchange(CDataExchange *pDX); // DDX/DDV support
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
protected:
|
||||
//{{AFX_MSG(CAboutDlg)
|
||||
// No message handlers
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
CAboutDlg::CAboutDlg() : CDialog(CAboutDlg::IDD) {
|
||||
//{{AFX_DATA_INIT(CAboutDlg)
|
||||
//}}AFX_DATA_INIT
|
||||
}
|
||||
|
||||
void CAboutDlg::DoDataExchange(CDataExchange *pDX) {
|
||||
CDialog::DoDataExchange(pDX);
|
||||
//{{AFX_DATA_MAP(CAboutDlg)
|
||||
//}}AFX_DATA_MAP
|
||||
}
|
||||
|
||||
BEGIN_MESSAGE_MAP(CAboutDlg, CDialog)
|
||||
//{{AFX_MSG_MAP(CAboutDlg)
|
||||
// No message handlers
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
// App command to run the dialog
|
||||
void CMicroClientApp::OnAppAbout() {
|
||||
CAboutDlg aboutDlg;
|
||||
aboutDlg.DoModal();
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMicroClientApp message handlers
|
||||
+214
@@ -0,0 +1,214 @@
|
||||
# Microsoft Developer Studio Project File - Name="MicroClient" - Package Owner=<4>
|
||||
# Microsoft Developer Studio Generated Build File, Format Version 6.00
|
||||
# ** DO NOT EDIT **
|
||||
|
||||
# TARGTYPE "Win32 (x86) Application" 0x0101
|
||||
|
||||
CFG=MicroClient - Win32 Debug
|
||||
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
|
||||
!MESSAGE use the Export Makefile command and run
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "MicroClient.mak".
|
||||
!MESSAGE
|
||||
!MESSAGE You can specify a configuration when running NMAKE
|
||||
!MESSAGE by defining the macro CFG on the command line. For example:
|
||||
!MESSAGE
|
||||
!MESSAGE NMAKE /f "MicroClient.mak" CFG="MicroClient - Win32 Debug"
|
||||
!MESSAGE
|
||||
!MESSAGE Possible choices for configuration are:
|
||||
!MESSAGE
|
||||
!MESSAGE "MicroClient - Win32 Release" (based on "Win32 (x86) Application")
|
||||
!MESSAGE "MicroClient - Win32 Debug" (based on "Win32 (x86) Application")
|
||||
!MESSAGE
|
||||
|
||||
# Begin Project
|
||||
# PROP AllowPerConfigDependencies 0
|
||||
# PROP Scc_ProjName ""
|
||||
# PROP Scc_LocalPath ""
|
||||
CPP=cl.exe
|
||||
MTL=midl.exe
|
||||
RSC=rc.exe
|
||||
|
||||
!IF "$(CFG)" == "MicroClient - Win32 Release"
|
||||
|
||||
# PROP BASE Use_MFC 6
|
||||
# PROP BASE Use_Debug_Libraries 0
|
||||
# PROP BASE Output_Dir "Release"
|
||||
# PROP BASE Intermediate_Dir "Release"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 6
|
||||
# PROP Use_Debug_Libraries 0
|
||||
# PROP Output_Dir "Release"
|
||||
# PROP Intermediate_Dir "Release"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /c
|
||||
# ADD CPP /nologo /MD /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /FR /Yu"stdafx.h" /FD /c
|
||||
# ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x804 /d "NDEBUG" /d "_AFXDLL"
|
||||
# ADD RSC /l 0x804 /d "NDEBUG" /d "_AFXDLL"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /subsystem:windows /machine:I386
|
||||
# ADD LINK32 /nologo /subsystem:windows /machine:I386
|
||||
|
||||
!ELSEIF "$(CFG)" == "MicroClient - Win32 Debug"
|
||||
|
||||
# PROP BASE Use_MFC 6
|
||||
# PROP BASE Use_Debug_Libraries 1
|
||||
# PROP BASE Output_Dir "Debug"
|
||||
# PROP BASE Intermediate_Dir "Debug"
|
||||
# PROP BASE Target_Dir ""
|
||||
# PROP Use_MFC 6
|
||||
# PROP Use_Debug_Libraries 1
|
||||
# PROP Output_Dir "Debug"
|
||||
# PROP Intermediate_Dir "Debug"
|
||||
# PROP Target_Dir ""
|
||||
# ADD BASE CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_AFXDLL" /D "_MBCS" /Yu"stdafx.h" /FD /GZ /c
|
||||
# ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32
|
||||
# ADD BASE RSC /l 0x804 /d "_DEBUG" /d "_AFXDLL"
|
||||
# ADD RSC /l 0x804 /d "_DEBUG" /d "_AFXDLL"
|
||||
BSC32=bscmake.exe
|
||||
# ADD BASE BSC32 /nologo
|
||||
# ADD BSC32 /nologo
|
||||
LINK32=link.exe
|
||||
# ADD BASE LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
# ADD LINK32 /nologo /subsystem:windows /debug /machine:I386 /pdbtype:sept
|
||||
|
||||
!ENDIF
|
||||
|
||||
# Begin Target
|
||||
|
||||
# Name "MicroClient - Win32 Release"
|
||||
# Name "MicroClient - Win32 Debug"
|
||||
# Begin Group "Source Files"
|
||||
|
||||
# PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Agentsock.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\BaseAgent.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DSetupDlg.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MainFrm.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MicroClient.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MicroClient.rc
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MicroClientDoc.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MicroClientView.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.cpp
|
||||
# ADD CPP /Yc"stdafx.h"
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StrategySystem.cpp
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TParseString.cpp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Header Files"
|
||||
|
||||
# PROP Default_Filter "h;hpp;hxx;hm;inl"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Agentsock.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\BaseAgent.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\DSetupDlg.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\general.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MainFrm.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MicroClient.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MicroClientDoc.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\MicroClientView.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\Resource.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StdAfx.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\StrategySystem.h
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\TParseString.h
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Group "Resource Files"
|
||||
|
||||
# PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe"
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\MicroClient.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\MicroClient.rc2
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\MicroClientDoc.ico
|
||||
# End Source File
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\res\Toolbar.bmp
|
||||
# End Source File
|
||||
# End Group
|
||||
# Begin Source File
|
||||
|
||||
SOURCE=.\ReadMe.txt
|
||||
# End Source File
|
||||
# End Target
|
||||
# End Project
|
||||
@@ -0,0 +1,29 @@
|
||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
||||
|
||||
###############################################################################
|
||||
|
||||
Project: "MicroClient"=".\MicroClient.dsp" - Package Owner=<4>
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<4>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
Global:
|
||||
|
||||
Package=<5>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
Package=<3>
|
||||
{{{
|
||||
}}}
|
||||
|
||||
###############################################################################
|
||||
|
||||
@@ -0,0 +1,47 @@
|
||||
// MicroClient.h : main header file for the MICROCLIENT application
|
||||
//
|
||||
|
||||
#if !defined(AFX_MICROCLIENT_H__801AABE5_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
#define AFX_MICROCLIENT_H__801AABE5_2D67_11D4_A201_00400564C758__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#ifndef __AFXWIN_H__
|
||||
#error include 'stdafx.h' before including this file for PCH
|
||||
#endif
|
||||
|
||||
#include "resource.h" // main symbols
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMicroClientApp:
|
||||
// See MicroClient.cpp for the implementation of this class
|
||||
//
|
||||
|
||||
class CMicroClientApp : public CWinApp {
|
||||
public:
|
||||
CMicroClientApp();
|
||||
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMicroClientApp)
|
||||
public:
|
||||
virtual BOOL InitInstance();
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
//{{AFX_MSG(CMicroClientApp)
|
||||
afx_msg void OnAppAbout();
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_MICROCLIENT_H__801AABE5_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
Binary file not shown.
+381
@@ -0,0 +1,381 @@
|
||||
// Microsoft Visual C++ generated resource script.
|
||||
//
|
||||
#include "resource.h"
|
||||
|
||||
#define APSTUDIO_READONLY_SYMBOLS
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 2 resource.
|
||||
//
|
||||
#include "afxres.h"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#undef APSTUDIO_READONLY_SYMBOLS
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED
|
||||
#pragma code_page(936)
|
||||
#endif //_WIN32
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// TEXTINCLUDE
|
||||
//
|
||||
|
||||
1 TEXTINCLUDE
|
||||
BEGIN
|
||||
"resource.h\0"
|
||||
END
|
||||
|
||||
2 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#include ""afxres.h""\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
3 TEXTINCLUDE
|
||||
BEGIN
|
||||
"#define _AFX_NO_SPLITTER_RESOURCES\r\n"
|
||||
"#define _AFX_NO_OLE_RESOURCES\r\n"
|
||||
"#define _AFX_NO_TRACKER_RESOURCES\r\n"
|
||||
"#define _AFX_NO_PROPERTY_RESOURCES\r\n"
|
||||
"\r\n"
|
||||
"#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)\r\n"
|
||||
"#ifdef _WIN32\r\n"
|
||||
"LANGUAGE 4, 2\r\n"
|
||||
"#pragma code_page(936)\r\n"
|
||||
"#endif //_WIN32\r\n"
|
||||
"#include ""res\\MicroClient.rc2"" // non-Microsoft Visual C++ edited resources\r\n"
|
||||
"#include ""l.chs\\afxres.rc"" // Standard components\r\n"
|
||||
"#endif\r\n"
|
||||
"\0"
|
||||
END
|
||||
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Icon
|
||||
//
|
||||
|
||||
// Icon with lowest ID value placed first to ensure application icon
|
||||
// remains consistent on all systems.
|
||||
IDR_MAINFRAME ICON "res\\MicroClient.ico"
|
||||
IDR_MICROCTYPE ICON "res\\MicroClientDoc.ico"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Dialog
|
||||
//
|
||||
|
||||
IDD_ABOUTBOX DIALOG 0, 0, 235, 55
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "About WTU-ATRI"
|
||||
FONT 9, "System"
|
||||
BEGIN
|
||||
ICON IDR_MAINFRAME,IDC_STATIC,11,17,20,20
|
||||
LTEXT "WTU-ATRI v3.0",IDC_STATIC,40,10,119,8,SS_NOPREFIX
|
||||
LTEXT "Copyright (C) WTU ATRI",IDC_STATIC,40,25,119,8
|
||||
DEFPUSHBUTTON "OK",IDOK,178,7,50,14,WS_GROUP
|
||||
END
|
||||
|
||||
IDD_DIALOG1 DIALOGEX 0, 0, 187, 88
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "WTU-ATRI"
|
||||
FONT 10, "System", 0, 0, 0x0
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,23,58,42,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,131,57,42,14
|
||||
LTEXT "WTU-ATRI",IDC_STATIC,53,22,82,13
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Version
|
||||
//
|
||||
|
||||
VS_VERSION_INFO VERSIONINFO
|
||||
FILEVERSION 3.0
|
||||
PRODUCTVERSION 3.0
|
||||
FILEFLAGSMASK 0x3fL
|
||||
#ifdef _DEBUG
|
||||
FILEFLAGS 0x1L
|
||||
#else
|
||||
FILEFLAGS 0x0L
|
||||
#endif
|
||||
FILEOS 0x4L
|
||||
FILETYPE 0x1L
|
||||
FILESUBTYPE 0x0L
|
||||
BEGIN
|
||||
BLOCK "StringFileInfo"
|
||||
BEGIN
|
||||
BLOCK "080404B0"
|
||||
BEGIN
|
||||
VALUE "FileDescription", "WTU Ace Team of Robotics Intelligence Client Application"
|
||||
VALUE "FileVersion", "3.0"
|
||||
VALUE "InternalName", "WTU-ATRI"
|
||||
VALUE "LegalCopyright", "Copyright (C) WTU ATRI"
|
||||
VALUE "OriginalFilename", "WTU-ATRI.EXE"
|
||||
VALUE "ProductName", "WTU Ace Team of Robotics Intelligence Client"
|
||||
VALUE "ProductVersion", "3.0"
|
||||
END
|
||||
END
|
||||
BLOCK "VarFileInfo"
|
||||
BEGIN
|
||||
VALUE "Translation", 0x804, 1200
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// DESIGNINFO
|
||||
//
|
||||
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
GUIDELINES DESIGNINFO
|
||||
BEGIN
|
||||
IDD_ABOUTBOX, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 228
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 48
|
||||
END
|
||||
|
||||
IDD_DIALOG1, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 7
|
||||
RIGHTMARGIN, 180
|
||||
TOPMARGIN, 7
|
||||
BOTTOMMARGIN, 81
|
||||
END
|
||||
END
|
||||
#endif // APSTUDIO_INVOKED
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// String Table
|
||||
//
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDP_SOCKETS_INIT_FAILED "Windows 通信端口初始化失败。"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
IDR_MAINFRAME "MicroClient\n\nMicroC\n\n\nMicroClient.Document\nMicroC Document"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
AFX_IDS_APP_TITLE "MicroClient"
|
||||
AFX_IDS_IDLEMESSAGE "就绪"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_INDICATOR_EXT "扩展名"
|
||||
ID_INDICATOR_CAPS "大写"
|
||||
ID_INDICATOR_NUM "数字"
|
||||
ID_INDICATOR_SCRL "滚动"
|
||||
ID_INDICATOR_OVR "改写"
|
||||
ID_INDICATOR_REC "记录"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_FILE_OPEN "打开一个现有文档\n打开"
|
||||
ID_FILE_CLOSE "关闭活动文档\n关闭"
|
||||
ID_FILE_SAVE "保存活动文档\n保存"
|
||||
ID_FILE_SAVE_AS "将活动文档以一个新文件名保存\n另存为"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_FILE_MRU_FILE1 "打开该文档"
|
||||
ID_FILE_MRU_FILE2 "打开该文档"
|
||||
ID_FILE_MRU_FILE3 "打开该文档"
|
||||
ID_FILE_MRU_FILE4 "打开该文档"
|
||||
ID_FILE_MRU_FILE5 "打开该文档"
|
||||
ID_FILE_MRU_FILE6 "打开该文档"
|
||||
ID_FILE_MRU_FILE7 "打开该文档"
|
||||
ID_FILE_MRU_FILE8 "打开该文档"
|
||||
ID_FILE_MRU_FILE9 "打开该文档"
|
||||
ID_FILE_MRU_FILE10 "打开该文档"
|
||||
ID_FILE_MRU_FILE11 "打开该文档"
|
||||
ID_FILE_MRU_FILE12 "打开该文档"
|
||||
ID_FILE_MRU_FILE13 "打开该文档"
|
||||
ID_FILE_MRU_FILE14 "打开该文档"
|
||||
ID_FILE_MRU_FILE15 "打开该文档"
|
||||
ID_FILE_MRU_FILE16 "打开该文档"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_NEXT_PANE "切换到下一个窗格\n下一窗格"
|
||||
ID_PREV_PANE "切换回前一个窗格\n前一窗格"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_WINDOW_SPLIT "将活动的窗口分隔成窗格\n分隔"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_EDIT_CLEAR "删除被选对象\n删除"
|
||||
ID_EDIT_CLEAR_ALL "全部删除\n全部删除"
|
||||
ID_EDIT_COPY "复制被选对象并将其置于剪贴板上\n复制"
|
||||
ID_EDIT_CUT "剪切被选对象并将其置于剪贴板上\n剪切"
|
||||
ID_EDIT_FIND "查找指定的正文\n查找"
|
||||
ID_EDIT_PASTE "插入剪贴板内容\n粘贴"
|
||||
ID_EDIT_REPEAT "重复上一步操作\n重复"
|
||||
ID_EDIT_REPLACE "用不同的正文替换指定的正文\n替换"
|
||||
ID_EDIT_SELECT_ALL "选择整个文档\n选择全部"
|
||||
ID_EDIT_UNDO "撤消最后一步操作\n撤消"
|
||||
ID_EDIT_REDO "重新执行先前已撤消的操作\n重新执行"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_VIEW_TOOLBAR "显示或隐藏工具栏\n显隐工具栏"
|
||||
ID_VIEW_STATUS_BAR "显示或隐藏状态栏\n显隐状态栏"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
AFX_IDS_SCSIZE "改变窗口大小"
|
||||
AFX_IDS_SCMOVE "改变窗口位置"
|
||||
AFX_IDS_SCMINIMIZE "将窗口缩小成图标"
|
||||
AFX_IDS_SCMAXIMIZE "把窗口放大到最大尺寸"
|
||||
AFX_IDS_SCNEXTWINDOW "切换到下一个文档窗口"
|
||||
AFX_IDS_SCPREVWINDOW "切换到先前的文档窗口"
|
||||
AFX_IDS_SCCLOSE "关闭活动的窗口并提示保存所有文档"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
AFX_IDS_SCRESTORE "把窗口恢复到正常大小"
|
||||
AFX_IDS_SCTASKLIST "激活任务表"
|
||||
END
|
||||
|
||||
STRINGTABLE
|
||||
BEGIN
|
||||
ID_CONNECT "连接到服务器"
|
||||
ID_DISCONNECT "断开和服务器的连接"
|
||||
END
|
||||
|
||||
#endif // 中文(中华人民共和国) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// 英语(美国) resources
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
|
||||
#pragma code_page(1252)
|
||||
#endif //_WIN32
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Bitmap
|
||||
//
|
||||
|
||||
IDR_MAINFRAME BITMAP "res\\Toolbar.bmp"
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Toolbar
|
||||
//
|
||||
|
||||
IDR_MAINFRAME TOOLBAR 16, 15
|
||||
BEGIN
|
||||
BUTTON ID_CONNECT
|
||||
BUTTON ID_DISCONNECT
|
||||
BUTTON ID_APP_ABOUT
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Menu
|
||||
//
|
||||
|
||||
IDR_MAINFRAME MENU
|
||||
BEGIN
|
||||
POPUP "File(&F)"
|
||||
BEGIN
|
||||
MENUITEM "New(&N)\tCtrl+N", ID_FILE_NEW
|
||||
MENUITEM "Open(&O)...\tCtrl+O", ID_FILE_OPEN
|
||||
MENUITEM "Save(&S)\tCtrl+S", ID_FILE_SAVE
|
||||
MENUITEM "Save As(&A)...", ID_FILE_SAVE_AS
|
||||
MENUITEM SEPARATOR
|
||||
MENUITEM "Exit(&X)", ID_APP_EXIT
|
||||
END
|
||||
POPUP "Help(&H)"
|
||||
BEGIN
|
||||
MENUITEM "About MicroClient(&A)...", ID_APP_ABOUT
|
||||
END
|
||||
END
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Accelerator
|
||||
//
|
||||
|
||||
IDR_MAINFRAME ACCELERATORS
|
||||
BEGIN
|
||||
"N", ID_FILE_NEW, VIRTKEY, CONTROL
|
||||
"O", ID_FILE_OPEN, VIRTKEY, CONTROL
|
||||
"S", ID_FILE_SAVE, VIRTKEY, CONTROL
|
||||
"Z", ID_EDIT_UNDO, VIRTKEY, CONTROL
|
||||
"X", ID_EDIT_CUT, VIRTKEY, CONTROL
|
||||
"C", ID_EDIT_COPY, VIRTKEY, CONTROL
|
||||
"V", ID_EDIT_PASTE, VIRTKEY, CONTROL
|
||||
VK_BACK, ID_EDIT_UNDO, VIRTKEY, ALT
|
||||
VK_DELETE, ID_EDIT_CUT, VIRTKEY, SHIFT
|
||||
VK_INSERT, ID_EDIT_COPY, VIRTKEY, CONTROL
|
||||
VK_INSERT, ID_EDIT_PASTE, VIRTKEY, SHIFT
|
||||
VK_F6, ID_NEXT_PANE, VIRTKEY
|
||||
VK_F6, ID_PREV_PANE, VIRTKEY, SHIFT
|
||||
END
|
||||
|
||||
#endif // 英语(美国) resources
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
#ifndef APSTUDIO_INVOKED
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Generated from the TEXTINCLUDE 3 resource.
|
||||
//
|
||||
#define _AFX_NO_SPLITTER_RESOURCES
|
||||
#define _AFX_NO_OLE_RESOURCES
|
||||
#define _AFX_NO_TRACKER_RESOURCES
|
||||
#define _AFX_NO_PROPERTY_RESOURCES
|
||||
|
||||
#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_CHS)
|
||||
#ifdef _WIN32
|
||||
LANGUAGE 4, 2
|
||||
#pragma code_page(936)
|
||||
#endif //_WIN32
|
||||
#include "res\MicroClient.rc2" // non-Microsoft Visual C++ edited resources
|
||||
#include "l.chs\afxres.rc" // Standard components
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
#endif // not APSTUDIO_INVOKED
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
Microsoft Visual Studio Solution File, Format Version 11.00
|
||||
# Visual Studio 2010
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "MicroClient", "MicroClient.vcxproj", "{CF6E833A-6ED2-47D9-B368-C26764AB1DF9}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Win32 = Debug|Win32
|
||||
Release|Win32 = Release|Win32
|
||||
Template|Win32 = Template|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{CF6E833A-6ED2-47D9-B368-C26764AB1DF9}.Debug|Win32.ActiveCfg = Debug|Win32
|
||||
{CF6E833A-6ED2-47D9-B368-C26764AB1DF9}.Debug|Win32.Build.0 = Debug|Win32
|
||||
{CF6E833A-6ED2-47D9-B368-C26764AB1DF9}.Release|Win32.ActiveCfg = Release|Win32
|
||||
{CF6E833A-6ED2-47D9-B368-C26764AB1DF9}.Release|Win32.Build.0 = Release|Win32
|
||||
{CF6E833A-6ED2-47D9-B368-C26764AB1DF9}.Template|Win32.ActiveCfg = Template|Win32
|
||||
{CF6E833A-6ED2-47D9-B368-C26764AB1DF9}.Template|Win32.Build.0 = Template|Win32
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
Binary file not shown.
@@ -0,0 +1,410 @@
|
||||
<?xml version="1.0" encoding="gb2312"?>
|
||||
<VisualStudioProject
|
||||
ProjectType="Visual C++"
|
||||
Version="7.10"
|
||||
Name="MicroClient"
|
||||
ProjectGUID="{CF6E833A-6ED2-47D9-B368-C26764AB1DF9}"
|
||||
SccProjectName=""
|
||||
SccLocalPath=""
|
||||
Keyword="MFCProj">
|
||||
<Platforms>
|
||||
<Platform
|
||||
Name="Win32"/>
|
||||
</Platforms>
|
||||
<Configurations>
|
||||
<Configuration
|
||||
Name="Debug|Win32"
|
||||
OutputDirectory=".\Debug"
|
||||
IntermediateDirectory=".\Debug"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
|
||||
BasicRuntimeChecks="3"
|
||||
RuntimeLibrary="3"
|
||||
UsePrecompiledHeader="3"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile=".\Debug/MicroClient.pch"
|
||||
AssemblerListingLocation=".\Debug/"
|
||||
ObjectFile=".\Debug/"
|
||||
ProgramDataBaseFileName=".\Debug/"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"
|
||||
DebugInformationFormat="4"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile=".\Debug/Trump.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
GenerateDebugInformation="TRUE"
|
||||
ProgramDatabaseFile=".\Debug/MicroClient.pdb"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Debug/MicroClient.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="_DEBUG"
|
||||
Culture="2052"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
<Configuration
|
||||
Name="Release|Win32"
|
||||
OutputDirectory=".\Release"
|
||||
IntermediateDirectory=".\Release"
|
||||
ConfigurationType="1"
|
||||
UseOfMFC="2"
|
||||
ATLMinimizesCRunTimeLibraryUsage="FALSE"
|
||||
CharacterSet="2">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
InlineFunctionExpansion="1"
|
||||
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
|
||||
StringPooling="TRUE"
|
||||
RuntimeLibrary="2"
|
||||
EnableFunctionLevelLinking="TRUE"
|
||||
UsePrecompiledHeader="3"
|
||||
PrecompiledHeaderThrough="stdafx.h"
|
||||
PrecompiledHeaderFile=".\Release/MicroClient.pch"
|
||||
AssemblerListingLocation=".\Release/"
|
||||
ObjectFile=".\Release/"
|
||||
ProgramDataBaseFileName=".\Release/"
|
||||
BrowseInformation="1"
|
||||
WarningLevel="3"
|
||||
SuppressStartupBanner="TRUE"/>
|
||||
<Tool
|
||||
Name="VCCustomBuildTool"/>
|
||||
<Tool
|
||||
Name="VCLinkerTool"
|
||||
OutputFile=".\Release/MicroClient.exe"
|
||||
LinkIncremental="1"
|
||||
SuppressStartupBanner="TRUE"
|
||||
ProgramDatabaseFile=".\Release/MicroClient.pdb"
|
||||
SubSystem="2"
|
||||
TargetMachine="1"/>
|
||||
<Tool
|
||||
Name="VCMIDLTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
MkTypLibCompatible="TRUE"
|
||||
SuppressStartupBanner="TRUE"
|
||||
TargetEnvironment="1"
|
||||
TypeLibraryName=".\Release/MicroClient.tlb"
|
||||
HeaderFileName=""/>
|
||||
<Tool
|
||||
Name="VCPostBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreBuildEventTool"/>
|
||||
<Tool
|
||||
Name="VCPreLinkEventTool"/>
|
||||
<Tool
|
||||
Name="VCResourceCompilerTool"
|
||||
PreprocessorDefinitions="NDEBUG"
|
||||
Culture="2052"/>
|
||||
<Tool
|
||||
Name="VCWebServiceProxyGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCXMLDataGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCWebDeploymentTool"/>
|
||||
<Tool
|
||||
Name="VCManagedWrapperGeneratorTool"/>
|
||||
<Tool
|
||||
Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
|
||||
</Configuration>
|
||||
</Configurations>
|
||||
<References>
|
||||
</References>
|
||||
<Files>
|
||||
<Filter
|
||||
Name="Source Files"
|
||||
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
|
||||
<File
|
||||
RelativePath="Agentsock.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="BaseAgent.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="DSetupDlg.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="MainFrm.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="MicroClient.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="MicroClient.rc">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="MicroClientDoc.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="MicroClientView.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="StdAfx.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"
|
||||
UsePrecompiledHeader="1"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""
|
||||
UsePrecompiledHeader="1"
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="StrategySystem.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="TParseString.cpp">
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="0"
|
||||
PreprocessorDefinitions=""
|
||||
BasicRuntimeChecks="3"/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32">
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
Optimization="2"
|
||||
PreprocessorDefinitions=""
|
||||
BrowseInformation="1"/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Header Files"
|
||||
Filter="h;hpp;hxx;hm;inl">
|
||||
<File
|
||||
RelativePath="Agentsock.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="BaseAgent.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="DSetupDlg.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="general.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="MainFrm.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="MicroClient.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="MicroClientDoc.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="MicroClientView.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="Resource.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="StdAfx.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="StrategySystem.h">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="TParseString.h">
|
||||
</File>
|
||||
</Filter>
|
||||
<Filter
|
||||
Name="Resource Files"
|
||||
Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
|
||||
<File
|
||||
RelativePath="res\MicroClient.ico">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="res\MicroClient.rc2">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="res\MicroClientDoc.ico">
|
||||
</File>
|
||||
<File
|
||||
RelativePath="res\Toolbar.bmp">
|
||||
</File>
|
||||
</Filter>
|
||||
<File
|
||||
RelativePath="ReadMe.txt">
|
||||
</File>
|
||||
</Files>
|
||||
<Globals>
|
||||
<Global
|
||||
Name="RESOURCE_FILE"
|
||||
Value="MicroClient.rc"/>
|
||||
</Globals>
|
||||
</VisualStudioProject>
|
||||
@@ -0,0 +1,262 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup Label="ProjectConfigurations">
|
||||
<ProjectConfiguration Include="Debug|Win32">
|
||||
<Configuration>Debug</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Release|Win32">
|
||||
<Configuration>Release</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
<ProjectConfiguration Include="Template|Win32">
|
||||
<Configuration>Template</Configuration>
|
||||
<Platform>Win32</Platform>
|
||||
</ProjectConfiguration>
|
||||
</ItemGroup>
|
||||
<PropertyGroup Label="Globals">
|
||||
<ProjectGuid>{CF6E833A-6ED2-47D9-B368-C26764AB1DF9}</ProjectGuid>
|
||||
<SccProjectName />
|
||||
<SccLocalPath />
|
||||
<Keyword>MFCProj</Keyword>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
|
||||
<ConfigurationType>Application</ConfigurationType>
|
||||
<UseOfMfc>Static</UseOfMfc>
|
||||
<CharacterSet>MultiByte</CharacterSet>
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Label="Configuration" Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">
|
||||
<PlatformToolset>v143</PlatformToolset>
|
||||
</PropertyGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
||||
<ImportGroup Label="ExtensionSettings">
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
|
||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
|
||||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup>
|
||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
|
||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</OutDir>
|
||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir>
|
||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
|
||||
<CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Template|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Template|Win32'" />
|
||||
<CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Template|Win32'" />
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>.\Debug/MicroClient.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\Debug/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>.\Debug/Trump.exe</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<ProgramDatabaseFile>.\Debug/MicroClient.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Debug/MicroClient.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0804</Culture>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<ClCompile>
|
||||
<Optimization>MaxSpeed</Optimization>
|
||||
<InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
|
||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<StringPooling>true</StringPooling>
|
||||
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
|
||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||
<PrecompiledHeader>Use</PrecompiledHeader>
|
||||
<PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
|
||||
<PrecompiledHeaderOutputFile>.\Release/MicroClient.pch</PrecompiledHeaderOutputFile>
|
||||
<AssemblerListingLocation>.\Release/</AssemblerListingLocation>
|
||||
<ObjectFileName>.\Release/</ObjectFileName>
|
||||
<ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
|
||||
<BrowseInformation>true</BrowseInformation>
|
||||
<WarningLevel>Level3</WarningLevel>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<EnableFiberSafeOptimizations>true</EnableFiberSafeOptimizations>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<OutputFile>.\Release/MicroClient.exe</OutputFile>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<ProgramDatabaseFile>.\Release/MicroClient.pdb</ProgramDatabaseFile>
|
||||
<SubSystem>Windows</SubSystem>
|
||||
<TargetMachine>MachineX86</TargetMachine>
|
||||
</Link>
|
||||
<Midl>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MkTypLibCompatible>true</MkTypLibCompatible>
|
||||
<SuppressStartupBanner>true</SuppressStartupBanner>
|
||||
<TargetEnvironment>Win32</TargetEnvironment>
|
||||
<TypeLibraryName>.\Release/MicroClient.tlb</TypeLibraryName>
|
||||
<HeaderFileName>
|
||||
</HeaderFileName>
|
||||
</Midl>
|
||||
<ResourceCompile>
|
||||
<PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<Culture>0x0804</Culture>
|
||||
</ResourceCompile>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Agentsock.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</BrowseInformation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseAgent.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</BrowseInformation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DSetupDlg.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</BrowseInformation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MainFrm.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</BrowseInformation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MicroClient.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</BrowseInformation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MicroClientDoc.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</BrowseInformation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MicroClientView.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</BrowseInformation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</BrowseInformation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StrategySystem.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</BrowseInformation>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TParseString.cpp">
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
|
||||
<Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
|
||||
<PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<BrowseInformation Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</BrowseInformation>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="MicroClient.rc" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Agentsock.h" />
|
||||
<ClInclude Include="BaseAgent.h" />
|
||||
<ClInclude Include="DSetupDlg.h" />
|
||||
<ClInclude Include="general.h" />
|
||||
<ClInclude Include="MainFrm.h" />
|
||||
<ClInclude Include="MicroClient.h" />
|
||||
<ClInclude Include="MicroClientDoc.h" />
|
||||
<ClInclude Include="MicroClientView.h" />
|
||||
<ClInclude Include="Resource.h" />
|
||||
<ClInclude Include="StdAfx.h" />
|
||||
<ClInclude Include="StrategySystem.h" />
|
||||
<ClInclude Include="TParseString.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\MicroClient.ico" />
|
||||
<None Include="res\MicroClient.rc2" />
|
||||
<None Include="res\MicroClientDoc.ico" />
|
||||
<None Include="res\Toolbar.bmp" />
|
||||
<None Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
<ImportGroup Label="ExtensionTargets">
|
||||
</ImportGroup>
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<UserProperties RESOURCE_FILE="MicroClient.rc" />
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
@@ -0,0 +1,107 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<Filter Include="Source Files">
|
||||
<UniqueIdentifier>{fc2752b4-a19b-4197-84de-58549291175c}</UniqueIdentifier>
|
||||
<Extensions>cpp;c;cxx;rc;def;r;odl;idl;hpj;bat</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Header Files">
|
||||
<UniqueIdentifier>{d56192e9-4aec-4c84-aee7-f7e86a635118}</UniqueIdentifier>
|
||||
<Extensions>h;hpp;hxx;hm;inl</Extensions>
|
||||
</Filter>
|
||||
<Filter Include="Resource Files">
|
||||
<UniqueIdentifier>{29e25e0c-78a6-44d3-89e0-1d14c45f973d}</UniqueIdentifier>
|
||||
<Extensions>ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe</Extensions>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClCompile Include="Agentsock.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="BaseAgent.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="DSetupDlg.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MainFrm.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MicroClient.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MicroClientDoc.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="MicroClientView.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StdAfx.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="StrategySystem.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="TParseString.cpp">
|
||||
<Filter>Source Files</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ResourceCompile Include="MicroClient.rc">
|
||||
<Filter>Source Files</Filter>
|
||||
</ResourceCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="Agentsock.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="BaseAgent.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="DSetupDlg.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="general.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MainFrm.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MicroClient.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MicroClientDoc.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="MicroClientView.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="Resource.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="StdAfx.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="StrategySystem.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="TParseString.h">
|
||||
<Filter>Header Files</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="res\MicroClient.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="res\MicroClient.rc2">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="res\MicroClientDoc.ico">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="res\Toolbar.bmp">
|
||||
<Filter>Resource Files</Filter>
|
||||
</None>
|
||||
<None Include="ReadMe.txt" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -0,0 +1,3 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
</Project>
|
||||
@@ -0,0 +1,116 @@
|
||||
// MicroClientDoc.cpp : implementation of the CMicroClientDoc class
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "MicroClient.h"
|
||||
#include "BaseAgent.h"
|
||||
#include "DSetupDlg.h"
|
||||
#include "MicroClientDoc.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMicroClientDoc
|
||||
|
||||
IMPLEMENT_DYNCREATE(CMicroClientDoc, CDocument)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CMicroClientDoc, CDocument)
|
||||
//{{AFX_MSG_MAP(CMicroClientDoc)
|
||||
ON_COMMAND(ID_CONNECT, OnConnect)
|
||||
ON_UPDATE_COMMAND_UI(ID_CONNECT, OnUpdateConnect)
|
||||
ON_COMMAND(ID_DISCONNECT, OnDisconnect)
|
||||
ON_UPDATE_COMMAND_UI(ID_DISCONNECT, OnUpdateDisconnect)
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMicroClientDoc construction/destruction
|
||||
|
||||
CMicroClientDoc::CMicroClientDoc() {
|
||||
// TODO: add one-time construction code here
|
||||
}
|
||||
|
||||
CMicroClientDoc::~CMicroClientDoc() {
|
||||
if (m_pAgent)
|
||||
delete m_pAgent;
|
||||
}
|
||||
|
||||
BOOL CMicroClientDoc::OnNewDocument() {
|
||||
if (!CDocument::OnNewDocument())
|
||||
return FALSE;
|
||||
|
||||
// TODO: add reinitialization code here
|
||||
// (SDI documents will reuse this document)
|
||||
m_pAgent = new CBaseAgent(this);
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMicroClientDoc serialization
|
||||
|
||||
void CMicroClientDoc::Serialize(CArchive &ar) {
|
||||
if (ar.IsStoring()) {
|
||||
// TODO: add storing code here
|
||||
}
|
||||
else {
|
||||
// TODO: add loading code here
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMicroClientDoc diagnostics
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CMicroClientDoc::AssertValid() const {
|
||||
CDocument::AssertValid();
|
||||
}
|
||||
|
||||
void CMicroClientDoc::Dump(CDumpContext &dc) const {
|
||||
CDocument::Dump(dc);
|
||||
}
|
||||
#endif //_DEBUG
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMicroClientDoc commands
|
||||
|
||||
void CMicroClientDoc::OnConnect() {
|
||||
// TODO: Add your command handler code here
|
||||
// m_pAgent->Connect();
|
||||
DSetupDlg Dialog;
|
||||
|
||||
// ask the user for the name of the team and the server
|
||||
Dialog.m_TeamName = _T("WTU-ATRI");
|
||||
Dialog.m_ServerName = _T("127.0.0.1");
|
||||
Dialog.m_Channel = 6000;
|
||||
|
||||
// user can repeat with a different address while(TRUE)
|
||||
{
|
||||
|
||||
// try to connect
|
||||
if (m_pAgent->ConnectAgent(Dialog.m_TeamName, Dialog.m_ServerName, Dialog.m_Channel))
|
||||
return; // TRUE;
|
||||
if (Dialog.DoModal() != IDOK)
|
||||
return; // FALSE;
|
||||
}
|
||||
m_pAgent->teamname = Dialog.m_TeamName;
|
||||
}
|
||||
|
||||
void CMicroClientDoc::OnUpdateConnect(CCmdUI *pCmdUI) {
|
||||
// TODO: Add your command update UI handler code here
|
||||
// pCmdUI->
|
||||
}
|
||||
|
||||
void CMicroClientDoc::OnDisconnect() {
|
||||
// TODO: Add your command handler code here
|
||||
// fclose(fp);
|
||||
}
|
||||
|
||||
void CMicroClientDoc::OnUpdateDisconnect(CCmdUI *pCmdUI) {
|
||||
// TODO: Add your command update UI handler code here
|
||||
// pCmdUI->
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
// MicroClientDoc.h : interface of the CMicroClientDoc class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_MICROCLIENTDOC_H__801AABEB_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
#define AFX_MICROCLIENTDOC_H__801AABEB_2D67_11D4_A201_00400564C758__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
class CBaseAgent;
|
||||
class CMicroClientDoc : public CDocument {
|
||||
protected: // create from serialization only
|
||||
CMicroClientDoc();
|
||||
DECLARE_DYNCREATE(CMicroClientDoc)
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
CBaseAgent *m_pAgent;
|
||||
|
||||
// Operations
|
||||
public:
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMicroClientDoc)
|
||||
public:
|
||||
virtual BOOL OnNewDocument();
|
||||
virtual void Serialize(CArchive &ar);
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CMicroClientDoc();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext &dc) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CMicroClientDoc)
|
||||
afx_msg void OnConnect();
|
||||
afx_msg void OnUpdateConnect(CCmdUI *pCmdUI);
|
||||
afx_msg void OnDisconnect();
|
||||
afx_msg void OnUpdateDisconnect(CCmdUI *pCmdUI);
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_MICROCLIENTDOC_H__801AABEB_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
@@ -0,0 +1,74 @@
|
||||
// MicroClientView.cpp : implementation of the CMicroClientView class
|
||||
//
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "MicroClient.h"
|
||||
|
||||
#include "MicroClientDoc.h"
|
||||
#include "MicroClientView.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMicroClientView
|
||||
|
||||
IMPLEMENT_DYNCREATE(CMicroClientView, CView)
|
||||
|
||||
BEGIN_MESSAGE_MAP(CMicroClientView, CView)
|
||||
//{{AFX_MSG_MAP(CMicroClientView)
|
||||
// NOTE - the ClassWizard will add and remove mapping macros here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code!
|
||||
//}}AFX_MSG_MAP
|
||||
END_MESSAGE_MAP()
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMicroClientView construction/destruction
|
||||
|
||||
CMicroClientView::CMicroClientView() {
|
||||
// TODO: add construction code here
|
||||
}
|
||||
|
||||
CMicroClientView::~CMicroClientView() {
|
||||
}
|
||||
|
||||
BOOL CMicroClientView::PreCreateWindow(CREATESTRUCT &cs) {
|
||||
// TODO: Modify the Window class or styles here by modifying
|
||||
// the CREATESTRUCT cs
|
||||
|
||||
return CView::PreCreateWindow(cs);
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMicroClientView drawing
|
||||
|
||||
void CMicroClientView::OnDraw(CDC *pDC) {
|
||||
CMicroClientDoc *pDoc = GetDocument();
|
||||
ASSERT_VALID(pDoc);
|
||||
// TODO: add draw code for native data here
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMicroClientView diagnostics
|
||||
|
||||
#ifdef _DEBUG
|
||||
void CMicroClientView::AssertValid() const {
|
||||
CView::AssertValid();
|
||||
}
|
||||
|
||||
void CMicroClientView::Dump(CDumpContext &dc) const {
|
||||
CView::Dump(dc);
|
||||
}
|
||||
|
||||
CMicroClientDoc *CMicroClientView::GetDocument() // non-debug version is inline
|
||||
{
|
||||
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CMicroClientDoc)));
|
||||
return (CMicroClientDoc *)m_pDocument;
|
||||
}
|
||||
#endif //_DEBUG
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// CMicroClientView message handlers
|
||||
@@ -0,0 +1,60 @@
|
||||
// MicroClientView.h : interface of the CMicroClientView class
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_MICROCLIENTVIEW_H__801AABED_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
#define AFX_MICROCLIENTVIEW_H__801AABED_2D67_11D4_A201_00400564C758__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
class CMicroClientView : public CView {
|
||||
protected: // create from serialization only
|
||||
CMicroClientView();
|
||||
DECLARE_DYNCREATE(CMicroClientView)
|
||||
|
||||
// Attributes
|
||||
public:
|
||||
CMicroClientDoc *GetDocument();
|
||||
|
||||
// Operations
|
||||
public:
|
||||
// Overrides
|
||||
// ClassWizard generated virtual function overrides
|
||||
//{{AFX_VIRTUAL(CMicroClientView)
|
||||
public:
|
||||
virtual void OnDraw(CDC *pDC); // overridden to draw this view
|
||||
virtual BOOL PreCreateWindow(CREATESTRUCT &cs);
|
||||
|
||||
protected:
|
||||
//}}AFX_VIRTUAL
|
||||
|
||||
// Implementation
|
||||
public:
|
||||
virtual ~CMicroClientView();
|
||||
#ifdef _DEBUG
|
||||
virtual void AssertValid() const;
|
||||
virtual void Dump(CDumpContext &dc) const;
|
||||
#endif
|
||||
|
||||
protected:
|
||||
// Generated message map functions
|
||||
protected:
|
||||
//{{AFX_MSG(CMicroClientView)
|
||||
// NOTE - the ClassWizard will add and remove member functions here.
|
||||
// DO NOT EDIT what you see in these blocks of generated code !
|
||||
//}}AFX_MSG
|
||||
DECLARE_MESSAGE_MAP()
|
||||
};
|
||||
|
||||
#ifndef _DEBUG // debug version in MicroClientView.cpp
|
||||
inline CMicroClientDoc *CMicroClientView::GetDocument() { return (CMicroClientDoc *)m_pDocument; }
|
||||
#endif
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_MICROCLIENTVIEW_H__801AABED_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
+26
@@ -0,0 +1,26 @@
|
||||
//{{NO_DEPENDENCIES}}
|
||||
// Microsoft Developer Studio generated include file.
|
||||
// Used by MicroClient.rc
|
||||
//
|
||||
#define IDD_ABOUTBOX 100
|
||||
#define IDP_SOCKETS_INIT_FAILED 104
|
||||
#define IDR_MAINFRAME 128
|
||||
#define IDR_MICROCTYPE 129
|
||||
#define IDD_DIALOG1 130
|
||||
#define IDC_TEAM 1000
|
||||
#define IDC_SERVER 1001
|
||||
#define IDC_CHANNEL 1002
|
||||
#define ID_CONNECT 32771
|
||||
#define ID_DISCONNECT 32772
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
#ifdef APSTUDIO_INVOKED
|
||||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_3D_CONTROLS 1
|
||||
#define _APS_NEXT_RESOURCE_VALUE 131
|
||||
#define _APS_NEXT_COMMAND_VALUE 32773
|
||||
#define _APS_NEXT_CONTROL_VALUE 1003
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
+105
@@ -0,0 +1,105 @@
|
||||
========================================================================
|
||||
MICROSOFT FOUNDATION CLASS LIBRARY : MicroClient
|
||||
========================================================================
|
||||
|
||||
|
||||
AppWizard has created this MicroClient application for you. This application
|
||||
not only demonstrates the basics of using the Microsoft Foundation classes
|
||||
but is also a starting point for writing your application.
|
||||
|
||||
This file contains a summary of what you will find in each of the files that
|
||||
make up your MicroClient application.
|
||||
|
||||
MicroClient.dsp
|
||||
This file (the project file) contains information at the project level and
|
||||
is used to build a single project or subproject. Other users can share the
|
||||
project (.dsp) file, but they should export the makefiles locally.
|
||||
|
||||
MicroClient.h
|
||||
This is the main header file for the application. It includes other
|
||||
project specific headers (including Resource.h) and declares the
|
||||
CMicroClientApp application class.
|
||||
|
||||
MicroClient.cpp
|
||||
This is the main application source file that contains the application
|
||||
class CMicroClientApp.
|
||||
|
||||
MicroClient.rc
|
||||
This is a listing of all of the Microsoft Windows resources that the
|
||||
program uses. It includes the icons, bitmaps, and cursors that are stored
|
||||
in the RES subdirectory. This file can be directly edited in Microsoft
|
||||
Visual C++.
|
||||
|
||||
MicroClient.clw
|
||||
This file contains information used by ClassWizard to edit existing
|
||||
classes or add new classes. ClassWizard also uses this file to store
|
||||
information needed to create and edit message maps and dialog data
|
||||
maps and to create prototype member functions.
|
||||
|
||||
res\MicroClient.ico
|
||||
This is an icon file, which is used as the application's icon. This
|
||||
icon is included by the main resource file MicroClient.rc.
|
||||
|
||||
res\MicroClient.rc2
|
||||
This file contains resources that are not edited by Microsoft
|
||||
Visual C++. You should place all resources not editable by
|
||||
the resource editor in this file.
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
For the main frame window:
|
||||
|
||||
MainFrm.h, MainFrm.cpp
|
||||
These files contain the frame class CMainFrame, which is derived from
|
||||
CFrameWnd and controls all SDI frame features.
|
||||
|
||||
res\Toolbar.bmp
|
||||
This bitmap file is used to create tiled images for the toolbar.
|
||||
The initial toolbar and status bar are constructed in the CMainFrame
|
||||
class. Edit this toolbar bitmap using the resource editor, and
|
||||
update the IDR_MAINFRAME TOOLBAR array in MicroClient.rc to add
|
||||
toolbar buttons.
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
AppWizard creates one document type and one view:
|
||||
|
||||
MicroClientDoc.h, MicroClientDoc.cpp - the document
|
||||
These files contain your CMicroClientDoc class. Edit these files to
|
||||
add your special document data and to implement file saving and loading
|
||||
(via CMicroClientDoc::Serialize).
|
||||
|
||||
MicroClientView.h, MicroClientView.cpp - the view of the document
|
||||
These files contain your CMicroClientView class.
|
||||
CMicroClientView objects are used to view CMicroClientDoc objects.
|
||||
|
||||
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
Other standard files:
|
||||
|
||||
StdAfx.h, StdAfx.cpp
|
||||
These files are used to build a precompiled header (PCH) file
|
||||
named MicroClient.pch and a precompiled types file named StdAfx.obj.
|
||||
|
||||
Resource.h
|
||||
This is the standard header file, which defines new resource IDs.
|
||||
Microsoft Visual C++ reads and updates this file.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
Other notes:
|
||||
|
||||
AppWizard uses "TODO:" to indicate parts of the source code you
|
||||
should add to or customize.
|
||||
|
||||
If your application uses MFC in a shared DLL, and your application is
|
||||
in a language other than the operating system's current language, you
|
||||
will need to copy the corresponding localized resources MFC42XXX.DLL
|
||||
from the Microsoft Visual C++ CD-ROM onto the system or system32 directory,
|
||||
and rename it to be MFCLOC.DLL. ("XXX" stands for the language abbreviation.
|
||||
For example, MFC42DEU.DLL contains resources translated to German.) If you
|
||||
don't do this, some of the UI elements of your application will remain in the
|
||||
language of the operating system.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
+17
@@ -0,0 +1,17 @@
|
||||
// stdafx.cpp : source file that includes just the standard includes
|
||||
// MicroClient.pch will be the pre-compiled header
|
||||
// stdafx.obj will contain the pre-compiled type information
|
||||
|
||||
#include "stdafx.h"
|
||||
#include "StrategySystem.h"
|
||||
|
||||
// 把接收到的队员的坐标和角度放入r[0][i]里面,对方队员的坐标
|
||||
// 放入op里面
|
||||
// 取每个队员的轮速,在Velocity函数计算里面已经获得了三
|
||||
// 个队员的轮速
|
||||
int nKick;
|
||||
CStrategySystem *thePlannerR = new CStrategySystem(0);
|
||||
CStrategySystem *thePlannerL = new CStrategySystem(1);
|
||||
Robot2 r[2][11];
|
||||
Robot3 op; // 存放对方队员的坐标数据
|
||||
Robot1 theball; // 存放球的坐标数据.
|
||||
@@ -0,0 +1,49 @@
|
||||
// stdafx.h : include file for standard system include files,
|
||||
// or project specific include files that are used frequently, but
|
||||
// are changed infrequently
|
||||
//
|
||||
|
||||
#if !defined(AFX_STDAFX_H__801AABE7_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
#define AFX_STDAFX_H__801AABE7_2D67_11D4_A201_00400564C758__INCLUDED_
|
||||
|
||||
#if _MSC_VER > 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER > 1000
|
||||
|
||||
#define VC_EXTRALEAN // Exclude rarely-used stuff from Windows headers
|
||||
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
#include <afxdisp.h> // MFC Automation classes
|
||||
#include <afxdtctl.h> // MFC support for Internet Explorer 4 Common Controls
|
||||
#ifndef _AFX_NO_AFXCMN_SUPPORT
|
||||
#include <afxcmn.h> // MFC support for Windows Common Controls
|
||||
#endif // _AFX_NO_AFXCMN_SUPPORT
|
||||
|
||||
#include <afxsock.h> // MFC socket extensions
|
||||
#include <math.h>
|
||||
|
||||
#define LEFT_TO_RIGHT 0
|
||||
#define RIGHT_TO_LEFT 1
|
||||
#define MAX_PLAYER 3
|
||||
#define OWN_TEAM 0
|
||||
#define OTHER_TEAM 1
|
||||
|
||||
typedef struct pos_t {
|
||||
short enable;
|
||||
short side;
|
||||
short unum;
|
||||
short angle;
|
||||
short x;
|
||||
short y;
|
||||
} pos_t;
|
||||
|
||||
typedef struct send_to_team {
|
||||
pos_t pos[MAX_PLAYER * 2];
|
||||
|
||||
} send_to_team;
|
||||
|
||||
//{{AFX_INSERT_LOCATION}}
|
||||
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.
|
||||
|
||||
#endif // !defined(AFX_STDAFX_H__801AABE7_2D67_11D4_A201_00400564C758__INCLUDED_)
|
||||
@@ -0,0 +1,759 @@
|
||||
#include "StdAfx.h"
|
||||
#include "StrategySystem.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#define new DEBUG_NEW
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#endif
|
||||
|
||||
IMPLEMENT_DYNAMIC(CStrategySystem, CObject)
|
||||
|
||||
extern int nKick;
|
||||
#define BALL_WIDTH 78
|
||||
#define BALL_LENGTH 156
|
||||
#define BALL_DIS 26
|
||||
#define CORNER 115
|
||||
|
||||
#define ANGLE_BOUND 60
|
||||
#define BOUND_BOUND 12
|
||||
#define G_OFFSET 20
|
||||
#define G_ANGLE_BOUND 60
|
||||
#define G_BOUND_BOUND 10
|
||||
|
||||
void CStrategySystem::Home1(int which) {
|
||||
Robot2 *robot;
|
||||
switch (which) {
|
||||
case HOME1:
|
||||
robot = &home1;
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: Home1
|
||||
}
|
||||
|
||||
void CStrategySystem::Home2(int which) {
|
||||
Robot2 *robot;
|
||||
switch (which) {
|
||||
case HOME2:
|
||||
robot = &home2;
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: Home2
|
||||
}
|
||||
|
||||
void CStrategySystem::Home3(int which) {
|
||||
Robot2 *robot;
|
||||
switch (which) {
|
||||
case HOME3:
|
||||
robot = &home3;
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: Home3
|
||||
}
|
||||
|
||||
void CStrategySystem::Home4(int which) {
|
||||
Robot2 *robot;
|
||||
switch (which) {
|
||||
case HOME4:
|
||||
robot = &home4;
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: Home4
|
||||
}
|
||||
|
||||
void CStrategySystem::Home5(int which) {
|
||||
Robot2 *robot;
|
||||
switch (which) {
|
||||
case HOME5:
|
||||
robot = &home5;
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: Home5
|
||||
}
|
||||
|
||||
void CStrategySystem::Home6(int which) {
|
||||
Robot2 *robot;
|
||||
switch (which) {
|
||||
case HOME6:
|
||||
robot = &home6;
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: Home6
|
||||
}
|
||||
|
||||
void CStrategySystem::Home7(int which) {
|
||||
Robot2 *robot;
|
||||
switch (which) {
|
||||
case HOME7:
|
||||
robot = &home7;
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: Home7
|
||||
}
|
||||
|
||||
void CStrategySystem::Home8(int which) {
|
||||
Robot2 *robot;
|
||||
switch (which) {
|
||||
case HOME8:
|
||||
robot = &home8;
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: Home8
|
||||
}
|
||||
|
||||
void CStrategySystem::Home9(int which) {
|
||||
Robot2 *robot;
|
||||
switch (which) {
|
||||
case HOME9:
|
||||
robot = &home9;
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: Home9
|
||||
}
|
||||
|
||||
void CStrategySystem::Home10(int which) {
|
||||
Robot2 *robot;
|
||||
switch (which) {
|
||||
case HOME10:
|
||||
robot = &home10;
|
||||
break;
|
||||
}
|
||||
|
||||
// TODO: Home10
|
||||
}
|
||||
|
||||
void CStrategySystem::Goalie(int which) {
|
||||
Robot2 *robot;
|
||||
switch (which) {
|
||||
case HGOALIE:
|
||||
robot = &hgoalie;
|
||||
break;
|
||||
}
|
||||
|
||||
static bool flag = true;
|
||||
int gx = ball.position.x < 950 ? 950 : 965;
|
||||
|
||||
// TODO: 防点球
|
||||
// if (CheckBallPosF1() == 1 || isPenalty) {
|
||||
// isPenalty = true;
|
||||
// if (ball.position.y < 409) {
|
||||
// Position(which, CPoint(gx, 217));
|
||||
// }
|
||||
// else {
|
||||
// Position(which, CPoint(gx, 607));
|
||||
// }
|
||||
// if (ball.position.x < 900) {
|
||||
// PositionPro(which, CPoint(ball.position));
|
||||
// }
|
||||
// if (ball.oldPosition.x > ball.position.x || ball.position.x >= 965) {
|
||||
// isPenalty = false;
|
||||
// }
|
||||
// }
|
||||
// else {
|
||||
|
||||
// 球在我方半场且在预测区域远离球门
|
||||
if (ball.position.x > 515 && ball.position.x < 900 || ball.position.x > 900 && ball.position.x < ball.oldPosition.x) {
|
||||
flag = true;
|
||||
if (ball.position.y < 313)
|
||||
Position(which, CPoint(gx, 313));
|
||||
else if (ball.position.y > 505)
|
||||
Position(which, CPoint(gx, 505));
|
||||
else
|
||||
Position(which, CPoint(gx, ball.position.y));
|
||||
}
|
||||
// 球在中预测区域靠近球门
|
||||
else if (ball.position.x > 515 && ball.position.y > 217 && ball.position.y < 607) {
|
||||
double dy = 0;
|
||||
if (flag)
|
||||
dy = (gx - ball.position.x) * ABS(ball.position.y - ball.oldPosition.y) * 1.0 / (ball.position.x - ball.oldPosition.x);
|
||||
flag = false;
|
||||
if (ball.position.y > ball.oldPosition.y)
|
||||
Position(which, CPoint(gx, ball.position.y + dy));
|
||||
else
|
||||
Position(which, CPoint(gx, ball.position.y - dy));
|
||||
if (ball.position.x > 900) {
|
||||
double dy = (robot->position.x - 873) * ABS(ball.position.y - robot->position.y) * 1.0 / (robot->position.x - ball.position.x);
|
||||
if (ball.position.y > robot->position.y)
|
||||
Position(which, CPoint(873, robot->position.y + dy));
|
||||
else
|
||||
Position(which, CPoint(873, robot->position.y - dy));
|
||||
}
|
||||
}
|
||||
// 球在上预测区域靠近球门
|
||||
else if (ball.position.x > 515 && ball.position.y < 217 && ball.position.y >= ball.oldPosition.y) {
|
||||
flag = true;
|
||||
if (robot->position.y > 217) {
|
||||
PositionPro(which, CPoint(ball.position));
|
||||
}
|
||||
Position(which, CPoint(gx, 265));
|
||||
}
|
||||
// 球在下预测区域靠近球门
|
||||
else if (ball.position.x > 515 && ball.position.y <= ball.oldPosition.y) {
|
||||
flag = true;
|
||||
if (robot->position.y < 607) {
|
||||
PositionPro(which, CPoint(ball.position));
|
||||
}
|
||||
Position(which, CPoint(gx, 556));
|
||||
}
|
||||
// 球在对方半场
|
||||
else {
|
||||
flag = true;
|
||||
Position(which, CPoint(gx, 409));
|
||||
}
|
||||
//}
|
||||
}
|
||||
|
||||
void CStrategySystem::Action() {
|
||||
Think();
|
||||
}
|
||||
|
||||
void CStrategySystem::Think() {
|
||||
// switch (m_nStrategy) {
|
||||
// case 0:
|
||||
Strategy0();
|
||||
// break;
|
||||
// case 1:
|
||||
// Strategy1();
|
||||
// break;
|
||||
// case 2:
|
||||
// Strategy2();
|
||||
// break;
|
||||
// case 3:
|
||||
// Strategy3();
|
||||
// break;
|
||||
// case 4:
|
||||
// Strategy4();
|
||||
// break;
|
||||
// case 5:
|
||||
// Strategy5();
|
||||
// break;
|
||||
// }
|
||||
}
|
||||
|
||||
void CStrategySystem::Strategy0() {
|
||||
Home1(HOME1);
|
||||
Home2(HOME2);
|
||||
Home3(HOME3);
|
||||
Home4(HOME4);
|
||||
Home5(HOME5);
|
||||
Home6(HOME6);
|
||||
Home7(HOME7);
|
||||
Home8(HOME8);
|
||||
Home9(HOME9);
|
||||
Home10(HOME10);
|
||||
Goalie(HGOALIE);
|
||||
}
|
||||
|
||||
// void CStrategySystem::Strategy1() {
|
||||
// }
|
||||
|
||||
// void CStrategySystem::Strategy2() {
|
||||
// }
|
||||
|
||||
// void CStrategySystem::Strategy3() {
|
||||
// }
|
||||
|
||||
// void CStrategySystem::Strategy4() {
|
||||
// }
|
||||
|
||||
// void CStrategySystem::Strategy5() {
|
||||
// }
|
||||
|
||||
void CStrategySystem::Angle(int which, int desired_angle) {
|
||||
Robot2 *robot;
|
||||
int theta_e, vL, vR;
|
||||
|
||||
switch (which) {
|
||||
case HOME1:
|
||||
robot = &home1;
|
||||
break;
|
||||
case HOME2:
|
||||
robot = &home2;
|
||||
break;
|
||||
case HOME3:
|
||||
robot = &home3;
|
||||
break;
|
||||
case HOME4:
|
||||
robot = &home4;
|
||||
break;
|
||||
case HOME5:
|
||||
robot = &home5;
|
||||
break;
|
||||
case HOME6:
|
||||
robot = &home6;
|
||||
break;
|
||||
case HOME7:
|
||||
robot = &home7;
|
||||
break;
|
||||
case HOME8:
|
||||
robot = &home8;
|
||||
break;
|
||||
case HOME9:
|
||||
robot = &home9;
|
||||
break;
|
||||
case HOME10:
|
||||
robot = &home10;
|
||||
break;
|
||||
case HGOALIE:
|
||||
robot = &hgoalie;
|
||||
break;
|
||||
}
|
||||
|
||||
theta_e = desired_angle - robot->angle;
|
||||
while (theta_e > 180)
|
||||
theta_e -= 360;
|
||||
while (theta_e < -180)
|
||||
theta_e += 360;
|
||||
if (theta_e < -90)
|
||||
theta_e += 180;
|
||||
else if (theta_e > 90)
|
||||
theta_e -= 180;
|
||||
vL = (int)(60.0 / 90.0 * theta_e);
|
||||
vR = (int)(-60.0 / 90.0 * theta_e);
|
||||
Velocity(which, vL, vR);
|
||||
}
|
||||
|
||||
void CStrategySystem::Velocity(int which, int vL, int vR) {
|
||||
if (vL < -127)
|
||||
vL = -127;
|
||||
if (vL > 127)
|
||||
vL = 127;
|
||||
|
||||
if (vR < -127)
|
||||
vR = -127;
|
||||
if (vR > 127)
|
||||
vR = 127;
|
||||
|
||||
switch (which) {
|
||||
case HOME1:
|
||||
command[2] = vL;
|
||||
command[3] = vR;
|
||||
command[4] = C_GO;
|
||||
break;
|
||||
case HOME2:
|
||||
command[5] = vL;
|
||||
command[6] = vR;
|
||||
command[7] = C_GO;
|
||||
break;
|
||||
case HOME3:
|
||||
command[8] = vL;
|
||||
command[9] = vR;
|
||||
command[10] = C_GO;
|
||||
break;
|
||||
case HOME4:
|
||||
command[11] = vL;
|
||||
command[12] = vR;
|
||||
command[13] = C_GO;
|
||||
break;
|
||||
case HOME5:
|
||||
command[14] = vL;
|
||||
command[15] = vR;
|
||||
command[16] = C_GO;
|
||||
break;
|
||||
case HOME6:
|
||||
command[17] = vL;
|
||||
command[18] = vR;
|
||||
command[19] = C_GO;
|
||||
break;
|
||||
case HOME7:
|
||||
command[20] = vL;
|
||||
command[21] = vR;
|
||||
command[22] = C_GO;
|
||||
break;
|
||||
case HOME8:
|
||||
command[23] = vL;
|
||||
command[24] = vR;
|
||||
command[25] = C_GO;
|
||||
break;
|
||||
case HOME9:
|
||||
command[26] = vL;
|
||||
command[27] = vR;
|
||||
command[28] = C_GO;
|
||||
break;
|
||||
case HOME10:
|
||||
command[29] = vL;
|
||||
command[30] = vR;
|
||||
command[31] = C_GO;
|
||||
break;
|
||||
case HGOALIE:
|
||||
command[32] = vL;
|
||||
command[33] = vR;
|
||||
command[34] = C_GO;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void CStrategySystem::Position(int which, CPoint point) {
|
||||
Robot2 *robot;
|
||||
double distance_e;
|
||||
int dx, dy, desired_angle, theta_e, vL, vR;
|
||||
|
||||
switch (which) {
|
||||
case HOME1:
|
||||
robot = &home1;
|
||||
break;
|
||||
case HOME2:
|
||||
robot = &home2;
|
||||
break;
|
||||
case HOME3:
|
||||
robot = &home3;
|
||||
break;
|
||||
case HOME4:
|
||||
robot = &home4;
|
||||
break;
|
||||
case HOME5:
|
||||
robot = &home5;
|
||||
break;
|
||||
case HOME6:
|
||||
robot = &home6;
|
||||
break;
|
||||
case HOME7:
|
||||
robot = &home7;
|
||||
break;
|
||||
case HOME8:
|
||||
robot = &home8;
|
||||
break;
|
||||
case HOME9:
|
||||
robot = &home9;
|
||||
break;
|
||||
case HOME10:
|
||||
robot = &home10;
|
||||
break;
|
||||
case HGOALIE:
|
||||
robot = &hgoalie;
|
||||
break;
|
||||
}
|
||||
|
||||
dx = point.x - robot->position.x;
|
||||
dy = point.y - robot->position.y;
|
||||
|
||||
distance_e = sqrt(1.0 * dx * dx + 1.0 * dy * dy);
|
||||
|
||||
if (dx == 0 && dy == 0)
|
||||
desired_angle = 90;
|
||||
else
|
||||
desired_angle = (int)(180.0 / M_PI * atan2((double)(dy), (double)(dx)));
|
||||
|
||||
theta_e = desired_angle - robot->angle;
|
||||
|
||||
while (theta_e > 180)
|
||||
theta_e -= 360;
|
||||
while (theta_e < -180)
|
||||
theta_e += 360;
|
||||
|
||||
if (theta_e < -90) {
|
||||
theta_e += 180;
|
||||
distance_e = -distance_e;
|
||||
}
|
||||
else if (theta_e > 90) {
|
||||
theta_e -= 180;
|
||||
distance_e = -distance_e;
|
||||
}
|
||||
|
||||
vL = (int)(5. * (100.0 / 1000.0 * distance_e + 40.0 / 90.0 * theta_e));
|
||||
vR = (int)(5. * (100.0 / 1000.0 * distance_e - 40.0 / 90.0 * theta_e));
|
||||
|
||||
Velocity(which, vL, vR);
|
||||
}
|
||||
|
||||
void CStrategySystem::PositionPro(int which, CPoint point) { // TODO: PositionPro
|
||||
Robot2 *robot;
|
||||
double distance_e;
|
||||
int dx, dy, desired_angle, theta_e, vL, vR;
|
||||
|
||||
switch (which) {
|
||||
case HOME1:
|
||||
robot = &home1;
|
||||
break;
|
||||
case HOME2:
|
||||
robot = &home2;
|
||||
break;
|
||||
case HOME3:
|
||||
robot = &home3;
|
||||
break;
|
||||
case HOME4:
|
||||
robot = &home4;
|
||||
break;
|
||||
case HOME5:
|
||||
robot = &home5;
|
||||
break;
|
||||
case HOME6:
|
||||
robot = &home6;
|
||||
break;
|
||||
case HOME7:
|
||||
robot = &home7;
|
||||
break;
|
||||
case HOME8:
|
||||
robot = &home8;
|
||||
break;
|
||||
case HOME9:
|
||||
robot = &home9;
|
||||
break;
|
||||
case HOME10:
|
||||
robot = &home10;
|
||||
break;
|
||||
case HGOALIE:
|
||||
robot = &hgoalie;
|
||||
break;
|
||||
}
|
||||
|
||||
dx = point.x - robot->position.x;
|
||||
dy = point.y - robot->position.y;
|
||||
|
||||
distance_e = sqrt(1.0 * dx * dx + 1.0 * dy * dy);
|
||||
|
||||
if (dx == 0 && dy == 0)
|
||||
desired_angle = 90;
|
||||
else
|
||||
desired_angle = (int)(180.0 / M_PI * atan2((double)(dy), (double)(dx)));
|
||||
|
||||
theta_e = desired_angle - robot->angle;
|
||||
|
||||
while (theta_e > 180)
|
||||
theta_e -= 360;
|
||||
while (theta_e < -180)
|
||||
theta_e += 360;
|
||||
|
||||
if (theta_e < -90) {
|
||||
theta_e += 180;
|
||||
distance_e = -distance_e;
|
||||
}
|
||||
else if (theta_e > 90) {
|
||||
theta_e -= 180;
|
||||
distance_e = -distance_e;
|
||||
}
|
||||
|
||||
vL = (int)(5. * (100.0 / 1000.0 * distance_e + 40.0 / 90.0 * theta_e));
|
||||
vR = (int)(5. * (100.0 / 1000.0 * distance_e - 40.0 / 90.0 * theta_e));
|
||||
|
||||
Velocity(which, vL, vR);
|
||||
}
|
||||
|
||||
void CStrategySystem::Stop(int which) {
|
||||
int vL, vR;
|
||||
vL = vR = 0;
|
||||
Velocity(which, vL, vR);
|
||||
}
|
||||
|
||||
void CStrategySystem::ReceiveData(Robot1 bal, Robot2 ho1, Robot2 ho2, Robot2 ho3, Robot2 ho4,
|
||||
Robot2 ho5, Robot2 ho6, Robot2 ho7, Robot2 ho8, Robot2 ho9,
|
||||
Robot2 ho10, Robot2 hgo, Robot3 opp) {
|
||||
if (m_nGameArea == GAME_RIGHT) {
|
||||
ball.position = bal.position;
|
||||
|
||||
home1.position = ho1.position;
|
||||
home1.angle = ho1.angle;
|
||||
|
||||
home2.position = ho2.position;
|
||||
home2.angle = ho2.angle;
|
||||
|
||||
home3.position = ho3.position;
|
||||
home3.angle = ho3.angle;
|
||||
|
||||
home4.position = ho4.position;
|
||||
home4.angle = ho4.angle;
|
||||
|
||||
home5.position = ho5.position;
|
||||
home5.angle = ho5.angle;
|
||||
|
||||
home6.position = ho6.position;
|
||||
home6.angle = ho6.angle;
|
||||
|
||||
home7.position = ho7.position;
|
||||
home7.angle = ho7.angle;
|
||||
|
||||
home8.position = ho8.position;
|
||||
home8.angle = ho8.angle;
|
||||
|
||||
home9.position = ho9.position;
|
||||
home9.angle = ho9.angle;
|
||||
|
||||
home10.position = ho10.position;
|
||||
home10.angle = ho10.angle;
|
||||
|
||||
hgoalie.position = hgo.position;
|
||||
hgoalie.angle = hgo.angle;
|
||||
|
||||
opponent.position1 = opp.position1;
|
||||
opponent.position2 = opp.position2;
|
||||
opponent.position3 = opp.position3;
|
||||
opponent.position4 = opp.position4;
|
||||
opponent.position5 = opp.position5;
|
||||
opponent.position6 = opp.position6;
|
||||
opponent.position7 = opp.position7;
|
||||
opponent.position8 = opp.position8;
|
||||
opponent.position9 = opp.position9;
|
||||
opponent.position10 = opp.position10;
|
||||
opponent.position11 = opp.position11;
|
||||
}
|
||||
else {
|
||||
|
||||
ball.position.x = 1030 - bal.position.x;
|
||||
ball.position.y = 818 - bal.position.y;
|
||||
|
||||
home1.position.x = 1030 - ho1.position.x;
|
||||
home1.position.y = 818 - ho1.position.y;
|
||||
if (home1.angle > 0)
|
||||
home1.angle = ho1.angle - 180;
|
||||
else
|
||||
home1.angle = 180 + ho1.angle;
|
||||
home2.position.x = 1030 - ho2.position.x;
|
||||
home2.position.y = 818 - ho2.position.y;
|
||||
if (home2.angle > 0)
|
||||
home2.angle = ho2.angle - 180;
|
||||
else
|
||||
home2.angle = 180 + ho2.angle;
|
||||
home3.position.x = 1030 - ho3.position.x;
|
||||
home3.position.y = 818 - ho3.position.y;
|
||||
if (home3.angle > 0)
|
||||
home3.angle = ho3.angle - 180;
|
||||
else
|
||||
home3.angle = 180 + ho3.angle;
|
||||
home4.position.x = 1030 - ho4.position.x;
|
||||
home4.position.y = 818 - ho4.position.y;
|
||||
if (home4.angle > 0)
|
||||
home4.angle = ho4.angle - 180;
|
||||
else
|
||||
home4.angle = 180 + ho4.angle;
|
||||
home5.position.x = 1030 - ho5.position.x;
|
||||
home5.position.y = 818 - ho5.position.y;
|
||||
if (home5.angle > 0)
|
||||
home5.angle = ho5.angle - 180;
|
||||
else
|
||||
home5.angle = 180 + ho5.angle;
|
||||
//*/
|
||||
home6.position.x = 1030 - ho6.position.x;
|
||||
home6.position.y = 818 - ho6.position.y;
|
||||
///*
|
||||
if (home6.angle > 0)
|
||||
home6.angle = ho6.angle - 180;
|
||||
else
|
||||
home6.angle = 180 + ho6.angle;
|
||||
//*/
|
||||
home7.position.x = 1030 - ho7.position.x;
|
||||
home7.position.y = 818 - ho7.position.y;
|
||||
///*
|
||||
if (home7.angle > 0)
|
||||
home7.angle = ho7.angle - 180;
|
||||
else
|
||||
home7.angle = 180 + ho7.angle;
|
||||
//*/
|
||||
home8.position.x = 1030 - ho8.position.x;
|
||||
home8.position.y = 818 - ho8.position.y;
|
||||
///*
|
||||
if (home8.angle > 0)
|
||||
home8.angle = ho8.angle - 180;
|
||||
else
|
||||
home8.angle = 180 + ho8.angle;
|
||||
//*/
|
||||
home9.position.x = 1030 - ho9.position.x;
|
||||
home9.position.y = 818 - ho9.position.y;
|
||||
///*
|
||||
if (home9.angle > 0)
|
||||
home9.angle = ho9.angle - 180;
|
||||
else
|
||||
home9.angle = 180 + ho9.angle;
|
||||
//*/
|
||||
home10.position.x = 1030 - ho10.position.x;
|
||||
home10.position.y = 818 - ho10.position.y;
|
||||
///*
|
||||
if (home10.angle > 0)
|
||||
home10.angle = ho10.angle - 180;
|
||||
else
|
||||
home10.angle = 180 + ho10.angle;
|
||||
//*/
|
||||
hgoalie.position.x = 1030 - hgo.position.x;
|
||||
hgoalie.position.y = 818 - hgo.position.y;
|
||||
///*
|
||||
if (hgoalie.angle > 0)
|
||||
hgoalie.angle = hgo.angle - 180;
|
||||
else
|
||||
hgoalie.angle = 180 + hgo.angle;
|
||||
//*/
|
||||
opponent.position1.x = 1030 - opp.position1.x;
|
||||
opponent.position2.x = 1030 - opp.position2.x;
|
||||
opponent.position3.x = 1030 - opp.position3.x;
|
||||
opponent.position4.x = 1030 - opp.position4.x;
|
||||
opponent.position5.x = 1030 - opp.position5.x;
|
||||
opponent.position6.x = 1030 - opp.position6.x;
|
||||
opponent.position7.x = 1030 - opp.position7.x;
|
||||
opponent.position8.x = 1030 - opp.position8.x;
|
||||
opponent.position9.x = 1030 - opp.position9.x;
|
||||
opponent.position10.x = 1030 - opp.position10.x;
|
||||
opponent.position11.x = 1030 - opp.position11.x;
|
||||
|
||||
opponent.position1.y = 818 - opp.position1.y;
|
||||
opponent.position2.y = 818 - opp.position2.y;
|
||||
opponent.position3.y = 818 - opp.position3.y;
|
||||
opponent.position4.y = 818 - opp.position4.y;
|
||||
opponent.position5.y = 818 - opp.position5.y;
|
||||
opponent.position6.y = 818 - opp.position6.y;
|
||||
opponent.position7.y = 818 - opp.position7.y;
|
||||
opponent.position8.y = 818 - opp.position8.y;
|
||||
opponent.position9.y = 818 - opp.position9.y;
|
||||
opponent.position10.y = 818 - opp.position10.y;
|
||||
opponent.position11.y = 818 - opp.position11.y;
|
||||
}
|
||||
}
|
||||
|
||||
CStrategySystem::CStrategySystem(int id) {
|
||||
m_OurTeam = id;
|
||||
boundRect.SetRect(65, 95, 965, 723);
|
||||
if (id)
|
||||
m_nGameArea = GAME_LEFT;
|
||||
else
|
||||
m_nGameArea = GAME_RIGHT;
|
||||
for (int i = 0; i < 35; i++)
|
||||
command[i] = 0;
|
||||
C_Home1.Data.Lv = 0;
|
||||
C_Home1.Data.Rv = 0;
|
||||
C_Home1.Data.Command = C_STOP;
|
||||
C_Home2.Data.Lv = 0;
|
||||
C_Home2.Data.Rv = 0;
|
||||
C_Home2.Data.Command = C_STOP;
|
||||
C_Home3.Data.Lv = 0;
|
||||
C_Home3.Data.Rv = 0;
|
||||
C_Home3.Data.Command = C_STOP;
|
||||
C_Home4.Data.Lv = 0;
|
||||
C_Home4.Data.Rv = 0;
|
||||
C_Home4.Data.Command = C_STOP;
|
||||
C_Home5.Data.Lv = 0;
|
||||
C_Home5.Data.Rv = 0;
|
||||
C_Home5.Data.Command = C_STOP;
|
||||
C_Home6.Data.Lv = 0;
|
||||
C_Home6.Data.Rv = 0;
|
||||
C_Home6.Data.Command = C_STOP;
|
||||
C_Home7.Data.Lv = 0;
|
||||
C_Home7.Data.Rv = 0;
|
||||
C_Home7.Data.Command = C_STOP;
|
||||
C_Home8.Data.Lv = 0;
|
||||
C_Home8.Data.Rv = 0;
|
||||
C_Home8.Data.Command = C_STOP;
|
||||
C_Home9.Data.Lv = 0;
|
||||
C_Home9.Data.Rv = 0;
|
||||
C_Home9.Data.Command = C_STOP;
|
||||
C_Home10.Data.Lv = 0;
|
||||
C_Home10.Data.Rv = 0;
|
||||
C_Home10.Data.Command = C_STOP;
|
||||
C_Home11.Data.Lv = 0;
|
||||
C_Home11.Data.Rv = 0;
|
||||
C_Home11.Data.Command = C_STOP;
|
||||
|
||||
m_nStrategy = id; // left = 1, right = 0
|
||||
nKick = 0;
|
||||
nKick2 = 0;
|
||||
nShoot = 0;
|
||||
nSweep = 0;
|
||||
}
|
||||
|
||||
// CStrategySystem::~CStrategySystem() {
|
||||
// }
|
||||
@@ -0,0 +1,71 @@
|
||||
#include "general.h"
|
||||
|
||||
#ifndef _INSIDE_VISUAL_CPP_STRATEGYSYSTEM
|
||||
#define _INSIDE_VISUAL_CPP_STRATEGYSYSTEM
|
||||
class CStrategySystem : public CObject {
|
||||
DECLARE_DYNAMIC(CStrategySystem)
|
||||
public:
|
||||
void Action();
|
||||
// ~CStrategySystem();
|
||||
CStrategySystem(int id);
|
||||
void ReceiveData(Robot1 bal, Robot2 ho1, Robot2 ho2, Robot2 ho3, Robot2 ho4,
|
||||
Robot2 ho5, Robot2 ho6, Robot2 ho7, Robot2 ho8, Robot2 ho9,
|
||||
Robot2 ho10, Robot2 hgo, Robot3 opp);
|
||||
|
||||
#ifdef _DEBUG
|
||||
#endif // _DEBUG
|
||||
private:
|
||||
void Stop(int which);
|
||||
void Position(int which, CPoint point);
|
||||
void PositionPro(int which, CPoint point);
|
||||
void Velocity(int which, int vL, int vR);
|
||||
void Angle(int which, int desired_angle);
|
||||
void Home1(int which);
|
||||
void Home2(int which);
|
||||
void Home3(int which);
|
||||
void Home4(int which);
|
||||
void Home5(int which);
|
||||
void Home6(int which);
|
||||
void Home7(int which);
|
||||
void Home8(int which);
|
||||
void Home9(int which);
|
||||
void Home10(int which);
|
||||
void Goalie(int which);
|
||||
CRect boundRect;
|
||||
int m_nStrategy;
|
||||
int m_OurTeam;
|
||||
int m_nGameArea;
|
||||
double ShootLen;
|
||||
int nShoot;
|
||||
int nSweep;
|
||||
int nKick2;
|
||||
CPoint ShootVar;
|
||||
CPoint KickVar;
|
||||
double KickLen;
|
||||
CCommand C_Home3;
|
||||
CCommand C_Home2;
|
||||
CCommand C_Home1;
|
||||
CCommand C_Home4;
|
||||
CCommand C_Home5;
|
||||
CCommand C_Home6;
|
||||
CCommand C_Home7;
|
||||
CCommand C_Home8;
|
||||
CCommand C_Home9;
|
||||
CCommand C_Home10;
|
||||
CCommand C_Home11;
|
||||
Robot1 ball;
|
||||
Robot2 home1, home2, home3, home4, home5, home6, home7, home8, home9, home10, hgoalie;
|
||||
Robot3 opponent;
|
||||
void Think();
|
||||
void Strategy0();
|
||||
// void Strategy1();
|
||||
// void Strategy2();
|
||||
// void Strategy3();
|
||||
// void Strategy4();
|
||||
// void Strategy5();
|
||||
|
||||
public:
|
||||
int command[35];
|
||||
};
|
||||
|
||||
#endif // _INSIDE_VISUAL_CPP_STRATEGYSYSTEM
|
||||
@@ -0,0 +1,242 @@
|
||||
// TParseString.cpp: implementation of the TParseString class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <afxwin.h> // MFC core and standard components
|
||||
#include <afxext.h> // MFC extensions
|
||||
#include "stdafx.h"
|
||||
#include "TParseString.h"
|
||||
|
||||
#ifdef _DEBUG
|
||||
#undef THIS_FILE
|
||||
static char THIS_FILE[] = __FILE__;
|
||||
#define new DEBUG_NEW
|
||||
#endif
|
||||
|
||||
BOOL TParseString::ParseBracket(TParseString &retString) {
|
||||
int iNoOfOpenBrackets = 1;
|
||||
int iRightPosition = m_iPosition + 1;
|
||||
int iLen = GetLength();
|
||||
m_bErrorOccured = FALSE;
|
||||
// iposition must index an opening bracket
|
||||
if ((m_iPosition >= iLen) || GetAt(m_iPosition) != '(')
|
||||
return FALSE;
|
||||
|
||||
while (iNoOfOpenBrackets > 0) {
|
||||
// reached the end of the string ? error
|
||||
if (iRightPosition >= iLen)
|
||||
return FALSE;
|
||||
|
||||
// look at the next character
|
||||
switch (GetAt(iRightPosition)) {
|
||||
case '(':
|
||||
iNoOfOpenBrackets++;
|
||||
break;
|
||||
|
||||
case ')':
|
||||
iNoOfOpenBrackets--;
|
||||
break;
|
||||
}
|
||||
iRightPosition++;
|
||||
}
|
||||
retString.CString::operator=(Mid(m_iPosition + 1, iRightPosition - m_iPosition - 2));
|
||||
m_iPosition = iRightPosition + 1;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
BOOL TParseString::ParseString(CString &str) {
|
||||
int iRightPos;
|
||||
BOOL bReady = FALSE;
|
||||
int len = GetLength();
|
||||
char tmp;
|
||||
|
||||
m_bErrorOccured = FALSE;
|
||||
OverreadLeadingSpaces();
|
||||
iRightPos = m_iPosition + 1;
|
||||
|
||||
// check, if there is a string
|
||||
if (m_iPosition - 1 >= len) {
|
||||
// the expected string is not there
|
||||
m_iPosition++;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
// search for a ' ' or ')'
|
||||
bReady = FALSE;
|
||||
while (!bReady && (iRightPos < len)) {
|
||||
tmp = GetAt(iRightPos);
|
||||
switch (tmp) {
|
||||
case ' ':
|
||||
case ')':
|
||||
case '\r':
|
||||
case '\n':
|
||||
bReady = TRUE;
|
||||
break;
|
||||
|
||||
default:
|
||||
iRightPos++;
|
||||
}
|
||||
}
|
||||
|
||||
// get the string
|
||||
str = Mid(m_iPosition, iRightPos - m_iPosition);
|
||||
m_iPosition = iRightPos + 1;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
int TParseString::ParseInteger() {
|
||||
int iValue = 0;
|
||||
BOOL bSign = FALSE;
|
||||
BOOL bReady = FALSE;
|
||||
char cChar;
|
||||
int len = GetLength();
|
||||
|
||||
m_bErrorOccured = TRUE;
|
||||
OverreadLeadingSpaces();
|
||||
// read in the number
|
||||
while (!bReady && (m_iPosition < len)) {
|
||||
cChar = GetAt(m_iPosition);
|
||||
switch (cChar) {
|
||||
case '-':
|
||||
// only one - sign expected
|
||||
bSign = TRUE;
|
||||
m_iPosition++;
|
||||
break;
|
||||
|
||||
case '+':
|
||||
m_iPosition++;
|
||||
break;
|
||||
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
iValue = 10 * iValue + cChar - '0';
|
||||
m_bErrorOccured = FALSE;
|
||||
m_iPosition++;
|
||||
break;
|
||||
|
||||
case ')':
|
||||
case ' ':
|
||||
m_iPosition++;
|
||||
// no break here
|
||||
|
||||
default:
|
||||
bReady = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// convert the number if neccessary
|
||||
if (bSign)
|
||||
iValue = -iValue;
|
||||
|
||||
return iValue;
|
||||
}
|
||||
|
||||
double TParseString::ParseDouble() {
|
||||
double dValue = 0.0;
|
||||
double dNumber;
|
||||
BOOL bSign = FALSE;
|
||||
BOOL bReady = FALSE;
|
||||
BOOL bDot = FALSE;
|
||||
double dDivisor = 1.0;
|
||||
char cChar;
|
||||
int len = GetLength();
|
||||
|
||||
m_bErrorOccured = TRUE;
|
||||
// read in the number
|
||||
while (!bReady && (m_iPosition < len)) {
|
||||
cChar = GetAt(m_iPosition);
|
||||
switch (cChar) {
|
||||
case '-':
|
||||
// only one - sign expected
|
||||
bSign = TRUE;
|
||||
m_iPosition++;
|
||||
break;
|
||||
|
||||
case '+':
|
||||
m_iPosition++;
|
||||
break;
|
||||
|
||||
case '0':
|
||||
case '1':
|
||||
case '2':
|
||||
case '3':
|
||||
case '4':
|
||||
case '5':
|
||||
case '6':
|
||||
case '7':
|
||||
case '8':
|
||||
case '9':
|
||||
dValue = 10.0 * dValue + (double)(cChar - '0');
|
||||
dDivisor *= 10.0;
|
||||
m_bErrorOccured = FALSE;
|
||||
m_iPosition++;
|
||||
break;
|
||||
|
||||
case '.':
|
||||
case ',':
|
||||
dDivisor = 1.0;
|
||||
bDot = TRUE;
|
||||
m_iPosition++;
|
||||
break;
|
||||
|
||||
case ')':
|
||||
case ' ':
|
||||
m_iPosition++;
|
||||
// no break here
|
||||
|
||||
default:
|
||||
bReady = TRUE;
|
||||
}
|
||||
}
|
||||
|
||||
// convert the number if neccessary
|
||||
if (bDot)
|
||||
dNumber = dValue / dDivisor;
|
||||
else
|
||||
dNumber = dValue;
|
||||
|
||||
if (bSign)
|
||||
dNumber = -dNumber;
|
||||
|
||||
return dNumber;
|
||||
}
|
||||
|
||||
void TParseString::OverreadLeadingSpaces() {
|
||||
char tmp;
|
||||
|
||||
// overread inital spaces, returns and new lines
|
||||
while (m_iPosition < GetLength()) {
|
||||
tmp = GetAt(m_iPosition);
|
||||
switch (tmp) {
|
||||
case ' ':
|
||||
case '\r':
|
||||
case '\n':
|
||||
m_iPosition++;
|
||||
break;
|
||||
|
||||
default:
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void TParseString::SetPosition(int pos) {
|
||||
if (pos >= GetLength()) {
|
||||
m_iPosition = GetLength() - 1;
|
||||
if (m_iPosition < 0)
|
||||
m_iPosition = 0;
|
||||
}
|
||||
else if (pos < 0)
|
||||
m_iPosition = 0;
|
||||
else
|
||||
m_iPosition = pos;
|
||||
}
|
||||
@@ -0,0 +1,31 @@
|
||||
// TParseString.h: interface for the TParseString class.
|
||||
//
|
||||
//////////////////////////////////////////////////////////////////////
|
||||
|
||||
#if !defined(AFX_TPARSESTRING_H__B6B1C1C4_8CBF_11D1_B242_0000C09B5CBE__INCLUDED_)
|
||||
#define AFX_TPARSESTRING_H__B6B1C1C4_8CBF_11D1_B242_0000C09B5CBE__INCLUDED_
|
||||
|
||||
#if _MSC_VER >= 1000
|
||||
#pragma once
|
||||
#endif // _MSC_VER >= 1000
|
||||
class TParseString : public CString {
|
||||
public:
|
||||
TParseString() { m_iPosition = 0; };
|
||||
TParseString(LPCTSTR name) : CString(name) { m_iPosition = 0; };
|
||||
|
||||
BOOL ParseBracket(TParseString &str);
|
||||
BOOL ParseString(CString &str);
|
||||
int ParseInteger();
|
||||
double ParseDouble();
|
||||
void OverreadLeadingSpaces();
|
||||
|
||||
BOOL HasErrorOccured() const { return m_bErrorOccured; };
|
||||
int GetPosition() const { return m_iPosition; };
|
||||
void SetPosition(int pos);
|
||||
|
||||
private:
|
||||
int m_iPosition;
|
||||
BOOL m_bErrorOccured;
|
||||
};
|
||||
|
||||
#endif // !defined(AFX_TPARSESTRING_H__B6B1C1C4_8CBF_11D1_B242_0000C09B5CBE__INCLUDED_)
|
||||
Reference in new issue
Block a user