MapInfo.cpp
上传用户:garry_shen
上传日期:2015-04-15
资源大小:45647k
文件大小:3k
- #include "stdafx.h"
- #include "MapInfo.h"
- #include "daintyMapClass.h"
- #include "..hash.h"
- extern char g_tszPathName[256];
- extern CList <CBaseMap*,CBaseMap*>maplist;
- void LoadMap();
- CBaseMap::CBaseMap()
- {
- bPK = TRUE;
- szFamily.Empty();
- }
- CBaseMap::~CBaseMap()
- {
- }
- CString CBaseMap::AddGoods(CGoods *lpEquip)
- {
- CGoods *lpMyEquip;
- POSITION pos;
- BOOL bFind = FALSE;
- if ((lpEquip->lpGoods->nKinds == GK_food) ||
- (lpEquip->lpGoods->nKinds == GK_drug)) {
- pos = listequip.GetHeadPosition();
- while (pos!=NULL) {
- lpMyEquip = listequip.GetNext(pos);
- if (lpMyEquip->lpGoods->szEName == lpEquip->lpGoods->szEName) {
- bFind = TRUE;
- lpMyEquip->nCount += lpEquip->nCount;
- delete lpEquip;
- break;
- }
- }
- if (!bFind) listequip.AddTail(lpEquip);
- } else {
- lpEquip->nCount = 1;
- listequip.AddTail(lpEquip);
- }
- return CString("OK");
- }
- CString CBaseMap::SetGoods(CGoods *lpEquip)
- {
- CGoods *lpMyEquip;
- POSITION pos;
- BOOL bFind = FALSE;
- if (lpEquip->lpGoods->nKinds == GK_flag) {
- pos = listequip.GetHeadPosition();
- while (pos!=NULL) {
- lpMyEquip = listequip.GetNext(pos);
- if (lpMyEquip->lpGoods->szEName == lpEquip->lpGoods->szEName) {
- bFind = TRUE;
- lpMyEquip->nCount = lpEquip->nCount;
- delete lpEquip;
- break;
- }
- }
- if (!bFind) listequip.AddTail(lpEquip);
- }
- else return CString("Not Flag");
- return CString("OK");
- }
- CString CBaseMap::SubGoods(CString szName)
- {
- POSITION lastpos, pos;
- CGoods * lpGoods;
- pos = listequip.GetHeadPosition();
- while (pos != NULL) {
- lastpos = pos;
- lpGoods = listequip.GetNext(pos);
- if (lpGoods != NULL) {
- if ((lpGoods->lpGoods->szEName == szName) ||
- (lpGoods->lpGoods->szCName == szName)) {
- lpGoods->nCount--;
- if (lpGoods->nCount <= 0) {
- listequip.RemoveAt(lastpos);
- delete lpGoods;
- }
- return "OK";
- }
- }
- }
- return "⊿Τ硂