void Teleport::LoadTeleports()
{
this->t_num = 0;
FILE* mFile;
fopen_s(&mFile,Move,"r");
char Linha[1024];
int map,x1,x2,y1,y2,xp,Vip,lvl,zen;
if(mFile == 0)
{
MessageBox(0, "Movereq.ini Not Found!", "Error.", MB_OK | MB_ICONSTOP);
ExitThread(0);
return;
}
while(!feof(mFile))
{
fgets(Linha, 1024, mFile);
if(!strcmp(Linha, "end"))
break;
if(Linha[strlen(Linha) - 1] == '\n' || Linha[strlen(Linha) - 1] == '\r')
{
if(Linha[0] != '/' || Linha[1] != '/')
{
if(t_num > MAX_TELEPORT_NUMBER)
{
MessageBoxA(NULL,"Error reading teleport file, max /n\number of moves overflowed!","Fatal Error",NULL);
ExitThread(0);
}
char *rest;
strcpy_s(t_struct[this->t_num].t_Name, 30, strtok_s(Linha, " ", &rest));
sscanf_s(rest, "%d %d %d %d %d %d %d %d ",&map,&x1,&y1,&x2,&y2,&lvl,&Vip,&zen);
t_struct[this->t_num].map = map;
t_struct[this->t_num].x1 = x1;
t_struct[this->t_num].x2 = x2;
t_struct[this->t_num].y1 = y1;
t_struct[this->t_num].y2 = y2;
t_struct[this->t_num].Vip = Vip;
t_struct[this->t_num].Money = zen;
t_struct[this->t_num].MinLevel = lvl;
t_num++;
}
}
}
fclose(mFile);
}