Click here to Skip to main content
15,885,278 members
Articles / Desktop Programming / MFC

Auto-Task Tool for Web Game Travian

Rate me:
Please Sign up or sign in to vote.
4.84/5 (26 votes)
29 Oct 20075 min read 781.4K   7.1K   45  
Developing Auto-Task Tool for Web Game Travian
#pragma once

#include "TravianAutoTask.h"

// CViewTaskList view

class CViewTaskList : public CListView
{
	DECLARE_DYNCREATE(CViewTaskList)

protected:
	CViewTaskList();           // protected constructor used by dynamic creation
	virtual ~CViewTaskList();

public:
#ifdef _DEBUG
	virtual void AssertValid() const;
#ifndef _WIN32_WCE
	virtual void Dump(CDumpContext& dc) const;
#endif
#endif

protected:
	DECLARE_MESSAGE_MAP()

public:
	void	ClearTasks() { 	if (m_pts) { CTravianTask::ClearTasks(*m_pts); delete m_pts; m_vecTasksInfo.clear(); m_vecToolTipID.clear();} };
	void	SetTasks(Tasks* pts);
	Tasks*	GetTasks() { return m_pts;}
	void	SetTaskState(int nIndex, eTaskExecState eState);

	int		GetImgIndex(eTaskExecState eState) {
		if (eState == E_EXEC_STATE_INITIAL) return 0;
		if (eState == E_EXEC_STATE_FINISHED) return 1;
		if (eState == E_EXEC_STATE_STOPPED) return 2;
		if (eState == E_EXEC_STATE_DELAYED) return 3;
	};
	LPCTSTR	GetStateText(eTaskExecState eState) {
		if (eState == E_EXEC_STATE_INITIAL) return _T("Waiting");
		if (eState == E_EXEC_STATE_FINISHED) return _T("Finished");
		if (eState == E_EXEC_STATE_STOPPED) return _T("Stopped");
		if (eState == E_EXEC_STATE_DELAYED) return _T("Delayed");
	};

protected:
	Tasks*			m_pts;			// only used to display task description
	CImageList		m_imglst;		// task list state img list
	CBitmap			m_bmp;			// helper for m_imglst to store 24bit(true color) bitmap, because CImageList can't do it itself.

	//vector<CStringW>		m_vecTasksInfo;
	vector<CString>			m_vecTasksInfo;
	vector<int>				m_vecToolTipID;
	CToolTipCtrl			m_tt;			// display current pointing task's description tip.

	bool			m_bInited;		// flag of whether view initialized

public:
	virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
	//afx_msg BOOL OnEraseBkgnd(CDC* pDC);
	virtual void OnInitialUpdate();
	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
	virtual BOOL PreTranslateMessage(MSG* pMsg);
};


By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
United States United States
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions