目标:
1、封装UseAction(char* szpActionName)
2、避免头文件重复包含
3、#ifndef宏
BOOL TActionList::UseAction(char* szpActionName)
#include "StructGame.h"
TBACKPACK_LIST tBackPackList;//背包数组
TMonsterList tMosterList;//怪物数组
TActionList tActionlist;//动作数组
BOOL TActionList::UseAction(char* szpActionName)
{
GetData();//初始化动作数组
for (int i=0;i<12;i++)
{
if ((strcmp(tList[i].szpName,szpActionName)==0))
{
UseAction(i);
return TRUE;
}
}
return FALSE;
}
1、封装UseAction(char* szpActionName)
2、避免头文件重复包含
3、#ifndef宏
BOOL TActionList::UseAction(char* szpActionName)
#include "StructGame.h"
TBACKPACK_LIST tBackPackList;//背包数组
TMonsterList tMosterList;//怪物数组
TActionList tActionlist;//动作数组
BOOL TActionList::UseAction(char* szpActionName)
{
GetData();//初始化动作数组
for (int i=0;i<12;i++)
{
if ((strcmp(tList[i].szpName,szpActionName)==0))
{
UseAction(i);
return TRUE;
}
}
return FALSE;
}