Here the Code i use
#include <iostream>
#include <fstream>
#include <string>
//define globals
void MapIntAll ( );
void MapFileLoadExternal ( char FileName , int MapSize,int MatrixId);
int MapTerrainCreateMatrix ( );
void MapStringDecode ( char String , char Breaker , int &X,int &Y, int &Z );
char* MapStringGetPart (char *Str , int StartPos , int EndPos);
//globals
char FilePath;int Matrix[16];
//int the map
void MapIntAll ( )
{
//set matrix sets to 0
for(int i=0;i<=16;i++)
{
Matrix[i]=-1;
}
}
void MapFileLoadExternal ( char* FileName , int MapSize,int MatrixId)
{
string playerline, playerdata[256];
int count = 0;
ifstream myfile ("Myfile.txt"));
if (myfile.is_open())
{
while (! myfile.eof() )
{
count++;
getline (myfile,playerline);
playerdata[count] = playerline;
}
myfile.close();
count = 0;
}
else
{
// Didnt work
}
}
int MapTerrainCreateMatrix ( )
{
int a;
//find a mtrix that dont exist
for(int i=0;i<=16;i++)
{if (Matrix[i]==-1){a=i;break;}
return a;
}
void MapStringDecode ( char String , char Breaker , int &X,int &Y, int &Z )
{
//find string lenght
int StrLen,StrPart,Count,EndCount;char* Str;
StrLen=dbLen(String);
StrPart=0;
Count=0;EndCount=0;
//do a for loop
for(int i=0;i<=StrLen;i++)
{
//search through the string
if ( String != Breaker )
{
EndCount++;
}
else
{
Str = MapStringGetPart ( String , Count , EndCount);
if (StrPart=0) {X=dbVal(Str);}
if (StrPart=1) {Y=dbVal(Str);}
if (StrPart=2) {Z=dbVal(Str);}
StrPart++;
Count=EndCount;
}
}
}
char* MapStringGetPart (char *Str , int StartPos , int EndPos)
{
size_t length;
char buffer[20];
string str (Str);
length=str.copy(buffer,EndPos,StartPos);
buffer[length]='\0';
return buffer;
}
Here the Error List
1>------ Build started: Project: LAN First Person Shooter - GDK, Configuration: Debug Win32 ------
1>Compiling...
1>Main.cpp
1>f:\lan first person shooter\gdk\lan first person shooter - gdk\lan first person shooter - gdk\MapSystemMatrix.h(23) : error C2065: 'string' : undeclared identifier
1>f:\lan first person shooter\gdk\lan first person shooter - gdk\lan first person shooter - gdk\MapSystemMatrix.h(23) : error C2146: syntax error : missing ';' before identifier 'playerline'
1>f:\lan first person shooter\gdk\lan first person shooter - gdk\lan first person shooter - gdk\MapSystemMatrix.h(23) : error C2065: 'playerline' : undeclared identifier
1>f:\lan first person shooter\gdk\lan first person shooter - gdk\lan first person shooter - gdk\MapSystemMatrix.h(23) : error C2065: 'playerdata' : undeclared identifier
1>f:\lan first person shooter\gdk\lan first person shooter - gdk\lan first person shooter - gdk\MapSystemMatrix.h(25) : error C2065: 'ifstream' : undeclared identifier
1>f:\lan first person shooter\gdk\lan first person shooter - gdk\lan first person shooter - gdk\MapSystemMatrix.h(25) : error C2146: syntax error : missing ';' before identifier 'myfile'
1>f:\lan first person shooter\gdk\lan first person shooter - gdk\lan first person shooter - gdk\MapSystemMatrix.h(25) : error C2059: syntax error : ')'
1>f:\lan first person shooter\gdk\lan first person shooter - gdk\lan first person shooter - gdk\MapSystemMatrix.h(25) : error C3861: 'myfile': identifier not found
1>f:\lan first person shooter\gdk\lan first person shooter - gdk\lan first person shooter - gdk\MapSystemMatrix.h(26) : error C2065: 'myfile' : undeclared identifier
1>f:\lan first person shooter\gdk\lan first person shooter - gdk\lan first person shooter - gdk\MapSystemMatrix.h(26) : error C2228: left of '.is_open' must have class/struct/union
1> type is ''unknown-type''
1>f:\lan first person shooter\gdk\lan first person shooter - gdk\lan first person shooter - gdk\MapSystemMatrix.h(28) : error C2065: 'myfile' : undeclared identifier
1>f:\lan first person shooter\gdk\lan first person shooter - gdk\lan first person shooter - gdk\MapSystemMatrix.h(28) : error C2228: left of '.eof' must have class/struct/union
1> type is ''unknown-type''
1>f:\lan first person shooter\gdk\lan first person shooter - gdk\lan first person shooter - gdk\MapSystemMatrix.h(28) : fatal error C1903: unable to recover from previous error(s); stopping compilation
1>Build log was saved at "file://f:\LAN First Person Shooter\GDK\LAN First Person Shooter - GDK\LAN First Person Shooter - GDK\Debug\BuildLog.htm"
1>LAN First Person Shooter - GDK - 13 error(s), 0 warning(s)
========== Build: 0 succeeded, 1 failed, 0 up-to-date, 0 skipped ==========
I made this with the GDK wizard. also running it from another GDK project that was empty it came up with the same list
Problem Solution That Never Fails: "Build A Bridge And Get Over It"