本文整理汇总了C++中CStaticArray::Count方法的典型用法代码示例。如果您正苦于以下问题:C++ CStaticArray::Count方法的具体用法?C++ CStaticArray::Count怎么用?C++ CStaticArray::Count使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CStaticArray
的用法示例。
在下文中一共展示了CStaticArray::Count方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: InitList
void InitList( CStaticArray<int>& ilistIndex, int iValue)
{
for(int i=0; i<ilistIndex.Count() ; i++)
{
ilistIndex[i]= iValue;
};
}
示例2: ASSERT
void CStaticArray<Type>::MoveArray(CStaticArray<Type> &arOther)
{
ASSERT(this!=NULL);
ASSERT(&arOther!=NULL);
ASSERT(this!=&arOther);
// clear previous contents
Clear();
// if the other array has no elements
if (arOther.Count()==0) {
// no assignment
return;
}
// move data from the other array into this one and clear the other one
sa_Count = arOther.sa_Count;
sa_Array = arOther.sa_Array;
arOther.sa_Count = 0;
arOther.sa_Array = NULL;
}
示例3: RemapVertices
void RemapVertices(BOOL bAsOpened)
{
{INDEX ctSurf = 0;
// fill remap array with indices of vertices in order how they appear per polygons
{FOREACHINDYNAMICCONTAINER(acmMaterials, ConversionMaterial, itcm)
{
_RPT1(_CRT_WARN, "Indices of polygons in surface %d:", ctSurf);
// for each polygon in surface
{FOREACHINDYNAMICCONTAINER(itcm->ms_Polygons, INDEX, itipol)
{
_RPT1(_CRT_WARN, " %d,", *itipol);
}}
_RPT0(_CRT_WARN, "\n");
ctSurf++;
}}
_RPT0(_CRT_WARN, "Polygons and their vertex indices:\n");
for( INDEX ipol=0; ipol<actTriangles.Count(); ipol++)
{
INDEX idxVtx0 = actTriangles[ipol].ct_iVtx[0];
INDEX idxVtx1 = actTriangles[ipol].ct_iVtx[1];
INDEX idxVtx2 = actTriangles[ipol].ct_iVtx[2];
_RPT4(_CRT_WARN, "Indices of vertices in polygon %d : (%d, %d, %d)\n", ipol, idxVtx0, idxVtx1, idxVtx2);
}}
示例4: LoadSkillDataFromFile
//안태훈 수정 끝 //(Open beta)(2004-11-29)
//-----------------------------------------------------------------------------
// Purpose:
// Input : &apSkillData -
// FileName -
// Output : int
//-----------------------------------------------------------------------------
int CSkill::LoadSkillDataFromFile(CStaticArray<CSkill> &apSkillData, const char* FileName)
{
FILE *fp = NULL;
if ((fp = fopen(FileName, "rb")) == NULL)
{
MessageBox(NULL, "File is not Exist.", "error!", MB_OK);
return -1;
}
// [2012/07/18 : Sora] 파일 보안코드 추가
CFileSecure fs;
if( !fs.DecodeFile( fp ) )
{
return -1;
}
fflush(fp);
int i, j, k, iWeapon;
int iLastSkillIndex = 0; //스킬 갯수.
int iLength = -1;
int iReadBytes = 0;
iReadBytes = fread(&iLastSkillIndex, sizeof(int), 1, fp);
apSkillData.New(iLastSkillIndex);
ASSERT(apSkillData.Count() >= iLastSkillIndex && "Invalid Array Count");//여기서 걸리면 고정된 개수의 스킬수 초과한것임. 더 늘릴것.(스킬은 고정배열 사용)
ASSERT(iLastSkillIndex > 0 && "Invalid Skill Data");
//////////////////////////////////////////////////////////////////////////
// MACRO DEFINITION
//////////////////////////////////////////////////////////////////////////
#define LOADINT(d) iReadBytes = fread(&d, sizeof(int), 1, fp);
#define LOADSHORT(d) iReadBytes = fread(&d, sizeof(short), 1, fp);
#define LOADCHAR(d) iReadBytes = fread(&d, sizeof(char), 1, fp);
#define LOADFLOAT(d) iReadBytes = fread(&d, sizeof(float), 1, fp);
#define LOADSTR(d) { int iLen; LOADINT(iLen); iReadBytes = fread(&d, iLen, 1, fp); }
//////////////////////////////////////////////////////////////////////////
CUIManager* pUIManager = CUIManager::getSingleton();
for( i = 0; i < iLastSkillIndex; i++) //스킬 갯수만큼.
{
int iIndex = 1; //스킬번호.
LOADINT(iIndex);
if( fs.IsEndCode( iIndex ) ) // [2012/07/18 : Sora] 파일 end
break;
if(iReadBytes <= 0) break; // EOF
ASSERT(iIndex != -1 && "Invalid Skill Index");
CSkill& SkillData = apSkillData[iIndex];
_SkillData& SD = SkillData.Skill_Data;
SD.index = iIndex;
// 일반
LOADINT(SD.job);
LOADINT(SD.job2);
LOADINT(SD.petindex);
LOADCHAR(SD.type);
LOADINT(SD.flag);
LOADINT(SD.sorcerer);
LOADCHAR(SD.maxLevel);
// 거리
LOADFLOAT(SD.appRange);
LOADFLOAT(SD.fireRange);
LOADFLOAT(SD.fireRange2);
// 타겟
LOADCHAR(SD.targetType);
if( SD.targetType == STT_TARGET_ONE ||
SD.targetType == STT_TARGET_RANGE ||
SD.targetType == STT_PARTY_ONE ||
SD.targetType == STT_TARGET_D120 ||
SD.targetType == STT_TARGET_RECT ||
SD.targetType == STT_GUILD_ONE)
{
SkillData.bNeedTarget = TRUE;
}
// LOADCHAR(SD.targetNum);
// 사용조건
LOADINT(SD.useState);
LOADINT(SD.useWeaponType0);
LOADINT(SD.useWeaponType1);
LOADINT(SD.useMagicIndex1);
LOADCHAR(SD.useMagicLevel1);
LOADINT(SD.useMagicIndex2);
LOADCHAR(SD.useMagicLevel2);
LOADINT(SD.useMagicIndex3);
LOADCHAR(SD.useMagicLevel3);
//.........这里部分代码省略.........
示例5: LoadShopDataFromFile
//-----------------------------------------------------------------------------
// Purpose:
// Input : &apShopData -
// FileName -
// Output : int
//-----------------------------------------------------------------------------
int CShopData::LoadShopDataFromFile(CStaticArray<CShopData> &apShopData, const char* FileName)
{
FILE *fp = NULL;
if ((fp = fopen(FileName, "rb")) == NULL)
{
MessageBox(NULL, "File is not Exist.", "error!", MB_OK);
return -1;
}
int iNumOfShop = 0;
int iLength = 0;
int iReadBytes = 0;
int iLastIndex = 0;
//iReadBytes = fread(&iNumOfShop, sizeof(int), 1, fp); // SHOP 데이터의 갯수.
iReadBytes = fread(&iLastIndex, sizeof(int), 1, fp); // SHOP의 마지막 인덱스.
apShopData.New(iLastIndex);
ASSERT(apShopData.Count() > 0 && "Invalid SHOP Data");
ASSERT(iLastIndex > 0 && "Invalid SHOP Data");
//////////////////////////////////////////////////////////////////////////
// MACRO DEFINITION
//////////////////////////////////////////////////////////////////////////
#define LOADINT(d) iReadBytes = fread(&d, sizeof(int), 1, fp);
#define LOADSHORT(d) iReadBytes = fread(&d, sizeof(short), 1, fp);
#define LOADCHAR(d) iReadBytes = fread(&d, sizeof(char), 1, fp);
#define LOADFLOAT(d) iReadBytes = fread(&d, sizeof(float), 1, fp);
#define LOADSTR(d) { int iLen; LOADINT(iLen); iReadBytes = fread(&d, iLen, 1, fp); }
//////////////////////////////////////////////////////////////////////////
for(int i = 0; i < iLastIndex; ++i)
{
int iIndex = -1;
LOADINT(iIndex);
if(iReadBytes <= 0) break;
CShopData& SD = apShopData[iIndex];
TShopData& ShopData = SD.m_ShopData;
ShopData.iIndex = iIndex;
int iItemCount = 0;
LOADSTR(ShopData.szShopName);
LOADINT(ShopData.iSellRate);
LOADINT(ShopData.iBuyRate);
LOADINT(iItemCount);
SD.m_iNumOfItem = iItemCount;
ASSERT(iItemCount > 0 && "Invalid Item Count!!!");
SD.m_vectorSellItems.resize(iItemCount);
iReadBytes = fread(&SD.m_vectorSellItems[0], sizeof(int), iItemCount, fp); // SHOP이 판매하는 아이템의 갯수.
if(iReadBytes < 0)
{
MessageBox(NULL, "SHOP 데이터 화일이 올바르지 않습니다.", "Error!", MB_OK);
fclose(fp);
return -1;
}
}
fclose(fp);
//////////////////////////////////////////////////////////////////////////
#undef LOADINT
#undef LOADCHAR
#undef LOADFLOAT
#undef LOADSTR
return iLastIndex;
}
示例6: wsprintf
void CObject3D::LoadAny3DFormat_t(
const CTFileName &fnmFileName,
const FLOATmatrix3D &mTransform,
enum LoadType ltLoadType/*= LT_NORMAL*/)
{
#if USE_E3D
BOOL bWasOn = _bBatchLoading;
try {
if (!_bBatchLoading) {
BatchLoading_t(TRUE);
}
// call file load with file's full path name
CTString strFile = _fnmApplicationPath+fnmFileName;
char acFile[MAX_PATH];
wsprintf(acFile,"%s",strFile);
e3_LoadFile(_hwnd, acFile);
_pe3Scene=e3_GetScene(_hwnd);
// if scene is successefuly loaded
if(_pe3Scene != NULL)
{
_pe3Object = _pe3Scene->GetObject3d( 0);
// use different methods to convert into Object3D
switch( ltLoadType)
{
case LT_NORMAL:
FillConversionArrays_t(mTransform);
ConvertArraysToO3D();
break;
case LT_OPENED:
FillConversionArrays_t(mTransform);
RemapVertices(TRUE);
ConvertArraysToO3D();
break;
case LT_UNWRAPPED:
FLOATmatrix3D mOne;
mOne.Diagonal(1.0f);
FillConversionArrays_t(mOne);
if( avTextureVertices.Count() == 0)
{
ThrowF_t("Unable to import mapping from 3D object because it doesn't contain mapping coordinates.");
}
RemapVertices(FALSE);
ConvertArraysToO3D();
break;
}
ClearConversionArrays();
}
else
{
ThrowF_t("Unable to load 3D object: %s", (const char *)fnmFileName);
}
if (!bWasOn) {
BatchLoading_t(FALSE);
}
} catch (char *) {
if (!bWasOn) {
BatchLoading_t(FALSE);
}
throw;
}
#endif
}
示例7: FOREACHINDYNAMICCONTAINER
_RPT1(_CRT_WARN, " %d,", *itipol);
}}
_RPT0(_CRT_WARN, "\n");
ctSurf++;
}}
_RPT0(_CRT_WARN, "Polygons and their vertex indices:\n");
for( INDEX ipol=0; ipol<actTriangles.Count(); ipol++)
{
INDEX idxVtx0 = actTriangles[ipol].ct_iVtx[0];
INDEX idxVtx1 = actTriangles[ipol].ct_iVtx[1];
INDEX idxVtx2 = actTriangles[ipol].ct_iVtx[2];
_RPT4(_CRT_WARN, "Indices of vertices in polygon %d : (%d, %d, %d)\n", ipol, idxVtx0, idxVtx1, idxVtx2);
}}
INDEX ctVertices = avVertices.Count();
aiRemap.New(ctVertices);
// fill remap array with indices of vertices in order how they appear per polygons
FOREACHINDYNAMICCONTAINER(acmMaterials, ConversionMaterial, itcm)
{
// fill remap array with -1
for( INDEX iRemap=0; iRemap<ctVertices; iRemap++)
{
aiRemap[iRemap] = -1;
}
// reset 'vertex in surface' counter
INDEX ctvx = 0;
// for each polygon in surface
{FOREACHINDYNAMICCONTAINER(itcm->ms_Polygons, INDEX, itipol)