void CMarineDlg::GetItemInfo(int stage)
{
char* path=new char[240];
char file[MAX_PATH],number[3];
GetCurrentDirectory(240,path);
strcpy(file,path);
strcat(file,"\\map\\map");
itoa(stage+1,number,10);
strcat(file,number);
strcat(file,".thi");
char temp[10],temp2[15],temp3[10];
int i,j;
for(i=0;i<256;i++){
itoa(i,temp,10);
m_OnGame.ItemInfo[i].type=GetPrivateProfileInt(temp,"type",0,file);
if(m_OnGame.ItemInfo[i].type==0){
m_OnGame.ItemInfo[i].bIsExisted=FALSE;
break;
}
else{
for(j=0;i<16;j++)
{
strcpy(temp2,"x");
itoa(j,temp3,10);
strcat(temp2,temp3);
m_OnGame.ItemInfo[i].step[j].x=GetPrivateProfileInt(temp,temp2,100,file);
strcpy(temp2,"y");
itoa(j,temp3,10);
strcat(temp2,temp3);
m_OnGame.ItemInfo[i].step[j].y=GetPrivateProfileInt(temp,temp2,100,file);
if(m_OnGame.ItemInfo[i].step[j].x==100 || m_OnGame.ItemInfo[i].step[j].y==100){
m_OnGame.ItemInfo[i].bIsExisted=FALSE;
break;
}
else{
m_OnGame.ItemInfo[i].bIsExisted=TRUE;
m_OnGame.ItemInfo[i].now.x=m_OnGame.ItemInfo[i].step[j].x; m_OnGame.ItemInfo[i].now.y=m_OnGame.ItemInfo[i].step[j].y;
}
}
}
}
delete path;
return;
}
|