J
Jon
For the past month I have been porting a DirectX windows game to libSDL
on linux, for right now I am working on the basic syntax of the game
engine, I was having problems with opening, reading, and closeing of
directories, I have fixed that though...who woulda thought that it would
be open, read, and closedir()?
Anyway, I am still working on the syntax, and I have been getting these
errors when I compile:
UEngine.cpp: In member function `void UEngine::doGameMenu()':
UEngine.cpp:677: error: `fileinfo' undeclared (first use this function)
UEngine.cpp:677: error: (Each undeclared identifier is reported only
once for
each function it appears in.)
UEngine.cpp:678: error: `_findnext' undeclared (first use this function)
UEngine.cpp:743: error: aggregate `_finddata_t fileinfo' has incomplete type
and cannot be defined
UEngine.cpp:748: error: `_findfirst' undeclared (first use this function)
UEngine.cpp:830: error: name lookup of `i' changed for new ISO `for' scoping
UEngine.cpp:735: error: using obsolete binding at `i'
I would post the engine code but it's nearly 1000 lines of code, but
here are snippets:
// Go throug the /Skin directory and look for skins
int modCount = 0;
DIR *opendir(const char *Skin);
long filehandle = -1L;
int nRes;
skinCount = 0;
struct dirent *readdir(DIR *Skin);
if(filehandle == -1L)
{
menuOption = -1;
}
else
{
line 677 strcpy(skinList[skinCount],fileinfo.name);
line 678 nRes = _findnext(filehandle,&fileinfo);
skinCount++;
while((-1L != nRes) && (skinCount < 7))
{
strcpy(skinList[skinCount],fileinfo.name);
skinCount++;
nRes = _findnext(filehandle,&fileinfo);
}
}
subMenuOption = selectMenu(skinCount,skinList,skinListHelp,subMenuPos);
// ESC pressed
if(subMenuOption == -2)
menuOption = -1;
// Select skin
if(subMenuOption > -1)
{
strcpy(skinName,skinList[subMenuOption]);
menuOption = -1;
subMenuOption = -1;
subMenuPos = 0;
}
// Show skin preview
strcpy(tempSkinName,skinName);
strcpy(skinName,skinList[subMenuPos]);
BS_DELETE(wndSkinPreview);
wndSkinPreview = new UGameWindow;
wndSkinPreview->Create(800,400,400,200,RenderDevice,createSkinPath("skin_preview.tga"),1.0f);
strcpy(skinName,tempSkinName);
for(i = 0; i < skinCount; i++)
{
delete skinList;
delete skinListHelp;
}
}
int closedir(DIR *Skin);
..........................
line 735 for(int i = 0; i < 7; i++)
{
modList = new char[256];
modListFolder = new char[256];
modListHelp = new char[256];
}
int modCount = 0;
DIR *opendir(const char *Mods);
long filehandle = -1L;
int nRes;
struct dirent *readdir(DIR *Mods);
// Ignore the menu if there are no MODS installed
if(filehandle == -1L)
{
subMenuOption = -1;
menuOption = -1;
subMenuPos = 0;
}
else
{
// Read in first mod
FILE* f;
char path[256];
sprintf(path,"Mods/%s",fileinfo.name);
f = fopen(path,"rt");
fgets(modList[modCount],256,f);
fgets(modListFolder[modCount],256,f);
fgets(modListHelp[modCount],256,f);
fclose(f);
modCount++;
// Scan for next modes
nRes = _findnext(filehandle,&fileinfo);
while(( -1L != nRes) && (modCount < 7))
{
sprintf(path,"Mods/%s",fileinfo.name);
f = fopen(path,"rt");
fgets(modList[modCount],256,f);
fgets(modListFolder[modCount],256,f);
fgets(modListHelp[modCount],256,f);
fclose(f);
modCount++;
nRes = _findnext(filehandle,&fileinfo);
}
}
subMenuOption = selectMenu(modCount,modList,modListHelp,subMenuPos);
// ESC pressed
if(subMenuOption == -2)
{
subMenuOption = -1;
menuOption = -1;
subMenuPos = 0;
}
// Enter pressed, selecting mod
if(subMenuOption > -1)
{
// The mod folder name end with a \n
// we must clear this
modListFolder[subMenuOption][strlen(modListFolder[subMenuOption]) -
1] = 0;
// Set current mod to selected mod
strcpy(modName,modListFolder[subMenuOption]);
menuOption = -1;
// Reload the list with the game levels
FILE* pFile = fopen(createGamePath("LevelList.txt"),"rt");
fscanf(pFile,"%d",&levelCount);
for(int i = 0; i < this->levelCount;i++)
{
this->levelNameList = new char[256];
fscanf(pFile,"%s\n",levelNameList);
}
GameLog.printf("\nBSUCEngine :: Loading modification [%s] with [%d]
levels.",modList[subMenuOption],levelCount);
subMenuOption = -1;
subMenuPos = -1;
subMenuPos = 0;
}
line 831 for(i = 0; i < 7; i++)
on linux, for right now I am working on the basic syntax of the game
engine, I was having problems with opening, reading, and closeing of
directories, I have fixed that though...who woulda thought that it would
be open, read, and closedir()?
Anyway, I am still working on the syntax, and I have been getting these
errors when I compile:
UEngine.cpp: In member function `void UEngine::doGameMenu()':
UEngine.cpp:677: error: `fileinfo' undeclared (first use this function)
UEngine.cpp:677: error: (Each undeclared identifier is reported only
once for
each function it appears in.)
UEngine.cpp:678: error: `_findnext' undeclared (first use this function)
UEngine.cpp:743: error: aggregate `_finddata_t fileinfo' has incomplete type
and cannot be defined
UEngine.cpp:748: error: `_findfirst' undeclared (first use this function)
UEngine.cpp:830: error: name lookup of `i' changed for new ISO `for' scoping
UEngine.cpp:735: error: using obsolete binding at `i'
I would post the engine code but it's nearly 1000 lines of code, but
here are snippets:
// Go throug the /Skin directory and look for skins
int modCount = 0;
DIR *opendir(const char *Skin);
long filehandle = -1L;
int nRes;
skinCount = 0;
struct dirent *readdir(DIR *Skin);
if(filehandle == -1L)
{
menuOption = -1;
}
else
{
line 677 strcpy(skinList[skinCount],fileinfo.name);
line 678 nRes = _findnext(filehandle,&fileinfo);
skinCount++;
while((-1L != nRes) && (skinCount < 7))
{
strcpy(skinList[skinCount],fileinfo.name);
skinCount++;
nRes = _findnext(filehandle,&fileinfo);
}
}
subMenuOption = selectMenu(skinCount,skinList,skinListHelp,subMenuPos);
// ESC pressed
if(subMenuOption == -2)
menuOption = -1;
// Select skin
if(subMenuOption > -1)
{
strcpy(skinName,skinList[subMenuOption]);
menuOption = -1;
subMenuOption = -1;
subMenuPos = 0;
}
// Show skin preview
strcpy(tempSkinName,skinName);
strcpy(skinName,skinList[subMenuPos]);
BS_DELETE(wndSkinPreview);
wndSkinPreview = new UGameWindow;
wndSkinPreview->Create(800,400,400,200,RenderDevice,createSkinPath("skin_preview.tga"),1.0f);
strcpy(skinName,tempSkinName);
for(i = 0; i < skinCount; i++)
{
delete skinList;
delete skinListHelp;
}
}
int closedir(DIR *Skin);
..........................
line 735 for(int i = 0; i < 7; i++)
{
modList = new char[256];
modListFolder = new char[256];
modListHelp = new char[256];
}
int modCount = 0;
DIR *opendir(const char *Mods);
long filehandle = -1L;
int nRes;
struct dirent *readdir(DIR *Mods);
// Ignore the menu if there are no MODS installed
if(filehandle == -1L)
{
subMenuOption = -1;
menuOption = -1;
subMenuPos = 0;
}
else
{
// Read in first mod
FILE* f;
char path[256];
sprintf(path,"Mods/%s",fileinfo.name);
f = fopen(path,"rt");
fgets(modList[modCount],256,f);
fgets(modListFolder[modCount],256,f);
fgets(modListHelp[modCount],256,f);
fclose(f);
modCount++;
// Scan for next modes
nRes = _findnext(filehandle,&fileinfo);
while(( -1L != nRes) && (modCount < 7))
{
sprintf(path,"Mods/%s",fileinfo.name);
f = fopen(path,"rt");
fgets(modList[modCount],256,f);
fgets(modListFolder[modCount],256,f);
fgets(modListHelp[modCount],256,f);
fclose(f);
modCount++;
nRes = _findnext(filehandle,&fileinfo);
}
}
subMenuOption = selectMenu(modCount,modList,modListHelp,subMenuPos);
// ESC pressed
if(subMenuOption == -2)
{
subMenuOption = -1;
menuOption = -1;
subMenuPos = 0;
}
// Enter pressed, selecting mod
if(subMenuOption > -1)
{
// The mod folder name end with a \n
// we must clear this
modListFolder[subMenuOption][strlen(modListFolder[subMenuOption]) -
1] = 0;
// Set current mod to selected mod
strcpy(modName,modListFolder[subMenuOption]);
menuOption = -1;
// Reload the list with the game levels
FILE* pFile = fopen(createGamePath("LevelList.txt"),"rt");
fscanf(pFile,"%d",&levelCount);
for(int i = 0; i < this->levelCount;i++)
{
this->levelNameList = new char[256];
fscanf(pFile,"%s\n",levelNameList);
}
GameLog.printf("\nBSUCEngine :: Loading modification [%s] with [%d]
levels.",modList[subMenuOption],levelCount);
subMenuOption = -1;
subMenuPos = -1;
subMenuPos = 0;
}
line 831 for(i = 0; i < 7; i++)