* Rename class CFileParser to fileParser (I don't want no freakin MFC naming conventions: prefixing all class-names with a captital 'C')
* Don't use pointers to fileParser for functions where references are lots more appropriate * Mark some functions private instead of public (they're only used by class CHeightMap's implementation) git-svn-id: svn+ssh://svn.gna.org/svn/warzone/trunk@2025 4a71c877-e1ca-e34f-864e-861f7616d084master
parent
073a4793c5
commit
0a8c53b8a8
|
@ -29,7 +29,7 @@
|
|||
#include "debugprint.h"
|
||||
|
||||
|
||||
CFileParser::CFileParser(std::istream& file, short flags) :
|
||||
fileParser::fileParser(std::istream& file, short flags) :
|
||||
m_Flags(flags),
|
||||
m_File(NULL)
|
||||
{
|
||||
|
@ -52,19 +52,19 @@ CFileParser::CFileParser(std::istream& file, short flags) :
|
|||
strcpy(m_Brk,"= \n\r\t");
|
||||
}
|
||||
|
||||
CFileParser::~CFileParser()
|
||||
fileParser::~fileParser()
|
||||
{
|
||||
delete m_File;
|
||||
}
|
||||
|
||||
|
||||
void CFileParser::Rewind(void)
|
||||
void fileParser::Rewind(void)
|
||||
{
|
||||
m_Pos = m_File;
|
||||
}
|
||||
|
||||
|
||||
BOOL CFileParser::ParseString(char *Ident,char *Word,short Size)
|
||||
BOOL fileParser::ParseString(char *Ident,char *Word,short Size)
|
||||
{
|
||||
char Tmp[256];
|
||||
if(Ident) {
|
||||
|
@ -79,7 +79,7 @@ BOOL CFileParser::ParseString(char *Ident,char *Word,short Size)
|
|||
}
|
||||
|
||||
|
||||
BOOL CFileParser::ParseInt(char *Ident,int *Int)
|
||||
BOOL fileParser::ParseInt(char *Ident,int *Int)
|
||||
{
|
||||
char Tmp[256];
|
||||
if(Ident) {
|
||||
|
@ -95,7 +95,7 @@ BOOL CFileParser::ParseInt(char *Ident,int *Int)
|
|||
}
|
||||
|
||||
|
||||
BOOL CFileParser::ParseFloat(char *Ident,float *Float)
|
||||
BOOL fileParser::ParseFloat(char *Ident,float *Float)
|
||||
{
|
||||
char Tmp[256];
|
||||
if(Ident) {
|
||||
|
@ -111,7 +111,7 @@ BOOL CFileParser::ParseFloat(char *Ident,float *Float)
|
|||
}
|
||||
|
||||
|
||||
BOOL CFileParser::ParseDouble(char *Ident,double *Double)
|
||||
BOOL fileParser::ParseDouble(char *Ident,double *Double)
|
||||
{
|
||||
char Tmp[256];
|
||||
if(Ident) {
|
||||
|
@ -127,13 +127,13 @@ BOOL CFileParser::ParseDouble(char *Ident,double *Double)
|
|||
}
|
||||
|
||||
|
||||
void CFileParser::SetBreakCharacters(char *brk)
|
||||
void fileParser::SetBreakCharacters(char *brk)
|
||||
{
|
||||
strcpy(m_Brk,brk);
|
||||
}
|
||||
|
||||
|
||||
int CFileParser::CountTokens(void)
|
||||
int fileParser::CountTokens(void)
|
||||
{
|
||||
char String[MAXTOKENSIZE];
|
||||
|
||||
|
@ -152,7 +152,7 @@ int CFileParser::CountTokens(void)
|
|||
}
|
||||
|
||||
|
||||
void CFileParser::Parse(char *Word,short Size)
|
||||
void fileParser::Parse(char *Word,short Size)
|
||||
{
|
||||
m_LastPos = m_Pos;
|
||||
|
||||
|
@ -189,13 +189,13 @@ void CFileParser::Parse(char *Word,short Size)
|
|||
}
|
||||
|
||||
|
||||
void CFileParser::UnParse(void)
|
||||
void fileParser::UnParse(void)
|
||||
{
|
||||
m_Pos = m_LastPos;
|
||||
}
|
||||
|
||||
|
||||
TokenID *CFileParser::FindTokenID(char *Token,TokenID *IDLookup)
|
||||
TokenID* fileParser::FindTokenID(char *Token,TokenID *IDLookup)
|
||||
{
|
||||
TokenID *TokID = IDLookup;
|
||||
|
||||
|
@ -211,7 +211,7 @@ TokenID *CFileParser::FindTokenID(char *Token,TokenID *IDLookup)
|
|||
}
|
||||
|
||||
|
||||
BOOL CFileParser::FindToken(char *Token)
|
||||
BOOL fileParser::FindToken(char *Token)
|
||||
{
|
||||
char Tmp[256];
|
||||
do {
|
||||
|
@ -226,7 +226,7 @@ BOOL CFileParser::FindToken(char *Token)
|
|||
}
|
||||
|
||||
|
||||
BOOL CFileParser::FindTokenList(char *Token, ...)
|
||||
BOOL fileParser::FindTokenList(char *Token, ...)
|
||||
{
|
||||
BOOL FoundFirst;
|
||||
char *Tok;
|
||||
|
@ -263,25 +263,25 @@ BOOL CFileParser::FindTokenList(char *Token, ...)
|
|||
}
|
||||
|
||||
|
||||
int CFileParser::TokenToInt(char *Word)
|
||||
int fileParser::TokenToInt(char *Word)
|
||||
{
|
||||
return atoi(Word);
|
||||
}
|
||||
|
||||
|
||||
float CFileParser::TokenToFloat(char *Word)
|
||||
float fileParser::TokenToFloat(char *Word)
|
||||
{
|
||||
return (float)atof(Word);
|
||||
}
|
||||
|
||||
|
||||
double CFileParser::TokenToDouble(char *Word)
|
||||
double fileParser::TokenToDouble(char *Word)
|
||||
{
|
||||
return atof(Word);
|
||||
}
|
||||
|
||||
|
||||
char *CFileParser::StringNextToken(char *s,char *tok,short toklen,char *brk)
|
||||
char* fileParser::StringNextToken(char *s,char *tok,short toklen,char *brk)
|
||||
{
|
||||
short i = 0;
|
||||
|
||||
|
@ -323,7 +323,7 @@ char *CFileParser::StringNextToken(char *s,char *tok,short toklen,char *brk)
|
|||
}
|
||||
|
||||
|
||||
char CFileParser::StringFixCase(char chr)
|
||||
char fileParser::StringFixCase(char chr)
|
||||
{
|
||||
if(m_Flags & FP_UPPERCASE) {
|
||||
if( (chr >= 'a') && (chr <='z') ) {
|
||||
|
@ -341,7 +341,7 @@ char CFileParser::StringFixCase(char chr)
|
|||
}
|
||||
|
||||
|
||||
BOOL CFileParser::StringBreakChar(char chr,char *brk)
|
||||
BOOL fileParser::StringBreakChar(char chr,char *brk)
|
||||
{
|
||||
short i;
|
||||
|
||||
|
@ -353,7 +353,7 @@ BOOL CFileParser::StringBreakChar(char chr,char *brk)
|
|||
}
|
||||
|
||||
|
||||
char *CFileParser::StringSkipBlanks(char *p)
|
||||
char* fileParser::StringSkipBlanks(char *p)
|
||||
{
|
||||
while( (*p == ' ') || (*p == 9) || (*p == 10) || (*p == 13) ) {
|
||||
if(*p == 0) return(p);
|
||||
|
@ -365,7 +365,7 @@ char *CFileParser::StringSkipBlanks(char *p)
|
|||
}
|
||||
|
||||
|
||||
char *CFileParser::StringSkipLine(char *p)
|
||||
char* fileParser::StringSkipLine(char *p)
|
||||
{
|
||||
while( (*p != 10) && (*p != 13) && (*p != 0) ) {
|
||||
p++;
|
||||
|
|
|
@ -40,12 +40,12 @@ struct TokenID
|
|||
int ID;
|
||||
};
|
||||
|
||||
class CFileParser
|
||||
class fileParser
|
||||
{
|
||||
public:
|
||||
CFileParser(std::istream& file, short flags);
|
||||
fileParser(std::istream& file, short flags);
|
||||
|
||||
~CFileParser();
|
||||
~fileParser();
|
||||
|
||||
void SetFlags(short Flags) { m_Flags = Flags; }
|
||||
short GetFlags(void) { return m_Flags; }
|
||||
|
|
|
@ -3480,7 +3480,7 @@ BOOL CHeightMap::ReadFeatureStats(char *ScriptFile,char *IMDDir,char *TextDir)
|
|||
if(!file.is_open())
|
||||
return FALSE;
|
||||
|
||||
CFileParser Parser(file, FP_SKIPCOMMENTS);
|
||||
fileParser Parser(file, FP_SKIPCOMMENTS);
|
||||
Parser.SetBreakCharacters("=,\n\r\t");
|
||||
int NumFeatures = Parser.CountTokens()/FEATURE_STATS_SIZE;
|
||||
|
||||
|
@ -3541,7 +3541,7 @@ BOOL CHeightMap::ReadStructureStats(char *ScriptFile,char *IMDDir,char *TextDir)
|
|||
if(!file.is_open())
|
||||
return FALSE;
|
||||
|
||||
CFileParser Parser(file, FP_SKIPCOMMENTS);
|
||||
fileParser Parser(file, FP_SKIPCOMMENTS);
|
||||
Parser.SetBreakCharacters("=,\n\r\t");
|
||||
int NumStructs = Parser.CountTokens()/STRUCTURE_STATS_SIZE;
|
||||
|
||||
|
@ -3718,7 +3718,7 @@ BOOL CHeightMap::ReadTemplateStats(char *ScriptFile,char *IMDDir,char *TextDir)
|
|||
if(!file.is_open())
|
||||
return FALSE;
|
||||
|
||||
CFileParser Parser(file, FP_SKIPCOMMENTS);
|
||||
fileParser Parser(file, FP_SKIPCOMMENTS);
|
||||
Parser.SetBreakCharacters("=,\n\r\t");
|
||||
int NumTemplates = Parser.CountTokens()/DROID_TEMPLATE_STATS_SIZE;
|
||||
|
||||
|
@ -3789,21 +3789,21 @@ BOOL CHeightMap::ReadIMDObjects(char *ScriptFile)
|
|||
m_FeatureSet = new char[strlen(FeatureSet)+1];
|
||||
strcpy(m_FeatureSet,FeatureSet);
|
||||
|
||||
CFileParser Parser(file, FP_SKIPCOMMENTS | FP_QUOTES | FP_LOWERCASE);
|
||||
fileParser Parser(file, FP_SKIPCOMMENTS | FP_QUOTES | FP_LOWERCASE);
|
||||
|
||||
if(!ReadMisc(&Parser,"miscbegin","miscend")) {
|
||||
if(!ReadMisc(Parser,"miscbegin","miscend")) {
|
||||
return FALSE;
|
||||
}
|
||||
if(!ReadFeatures(&Parser,"featuresbegin","featuresend")) {
|
||||
if(!ReadFeatures(Parser,"featuresbegin","featuresend")) {
|
||||
return FALSE;
|
||||
}
|
||||
if(!ReadStructures(&Parser,"structuresbegin","structuresend")) {
|
||||
if(!ReadStructures(Parser,"structuresbegin","structuresend")) {
|
||||
return FALSE;
|
||||
}
|
||||
if(!ReadTemplates(&Parser,"droidsbegin","droidsend")) {
|
||||
if(!ReadTemplates(Parser,"droidsbegin","droidsend")) {
|
||||
return FALSE;
|
||||
}
|
||||
if(!ReadObjects(&Parser,"objectsbegin","objectsend",IMD_OBJECT)) {
|
||||
if(!ReadObjects(Parser,"objectsbegin","objectsend",IMD_OBJECT)) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -3820,7 +3820,7 @@ BOOL CHeightMap::ReadObjectNames(char *FileName)
|
|||
if(!file.is_open())
|
||||
return FALSE;
|
||||
|
||||
CFileParser Parser(file, FP_SKIPCOMMENTS | FP_QUOTES);
|
||||
fileParser Parser(file, FP_SKIPCOMMENTS | FP_QUOTES);
|
||||
|
||||
m_NumNames = 0;
|
||||
|
||||
|
@ -3858,21 +3858,21 @@ int CHeightMap::MatchObjName(char *IDString)
|
|||
}
|
||||
|
||||
|
||||
BOOL CHeightMap::ReadMisc(CFileParser *Parser,char *Begin,char *End)
|
||||
BOOL CHeightMap::ReadMisc(fileParser& Parser,char *Begin,char *End)
|
||||
{
|
||||
char String[256];
|
||||
char TextureName[256];
|
||||
DWORD NumObjects = 0;
|
||||
int ColourIndex = -1;
|
||||
|
||||
Parser->Parse(String,sizeof(String));
|
||||
Parser.Parse(String,sizeof(String));
|
||||
if(strcmp(String,Begin) != 0) {
|
||||
MessageBox(NULL,"Section directive not found!","Error parsing data set!",MB_OK);
|
||||
DebugPrint("%s Not found!\n",Begin);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!Parser->ParseString("tiletextures",TextureName,sizeof(TextureName))) {
|
||||
if(!Parser.ParseString("tiletextures",TextureName,sizeof(TextureName))) {
|
||||
DebugPrint("TILETEXTURES directive not found!\n");
|
||||
MessageBox(NULL,"TILETEXTURES directive not found!","Error parsing data set!",MB_OK);
|
||||
return FALSE;
|
||||
|
@ -3880,7 +3880,7 @@ BOOL CHeightMap::ReadMisc(CFileParser *Parser,char *Begin,char *End)
|
|||
|
||||
strcpy(m_TileTextureName,TextureName);
|
||||
|
||||
if(!Parser->ParseString("objectnames",String,sizeof(String))) {
|
||||
if(!Parser.ParseString("objectnames",String,sizeof(String))) {
|
||||
DebugPrint("OBJECTNAMES directive not found!\n");
|
||||
MessageBox(NULL,"OBJECTNAMES directive not found!","Error parsing data set!",MB_OK);
|
||||
return FALSE;
|
||||
|
@ -3889,7 +3889,7 @@ BOOL CHeightMap::ReadMisc(CFileParser *Parser,char *Begin,char *End)
|
|||
strcpy(m_ObjectNames,String);
|
||||
ReadObjectNames(m_ObjectNames);
|
||||
|
||||
Parser->Parse(String,sizeof(String));
|
||||
Parser.Parse(String,sizeof(String));
|
||||
if(strcmp(String,"brushbegin") != 0) {
|
||||
MessageBox(NULL,"BRUSHBEGIN directive not found!","Error parsing data set!",MB_OK);
|
||||
DebugPrint("BRUSHBEGIN Not found!\n");
|
||||
|
@ -3897,23 +3897,23 @@ BOOL CHeightMap::ReadMisc(CFileParser *Parser,char *Begin,char *End)
|
|||
}
|
||||
|
||||
for(int i=0; i<16; i++) {
|
||||
Parser->ParseInt(NULL,&m_BrushHeightMode[i]);
|
||||
Parser->ParseInt(NULL,&m_BrushHeight[i]);
|
||||
Parser->ParseInt(NULL,&m_BrushRandomRange[i]);
|
||||
Parser.ParseInt(NULL,&m_BrushHeightMode[i]);
|
||||
Parser.ParseInt(NULL,&m_BrushHeight[i]);
|
||||
Parser.ParseInt(NULL,&m_BrushRandomRange[i]);
|
||||
for(int j=0; j<16; j++) {
|
||||
Parser->ParseInt(NULL,&m_BrushTiles[i][j]);
|
||||
Parser->ParseInt(NULL,&m_BrushFlags[i][j]);
|
||||
Parser.ParseInt(NULL,&m_BrushTiles[i][j]);
|
||||
Parser.ParseInt(NULL,&m_BrushFlags[i][j]);
|
||||
}
|
||||
}
|
||||
|
||||
Parser->Parse(String,sizeof(String));
|
||||
Parser.Parse(String,sizeof(String));
|
||||
if(strcmp(String,"brushend") != 0) {
|
||||
MessageBox(NULL,"BRUSHEND directive not found!","Error parsing data set!",MB_OK);
|
||||
DebugPrint("BRUSHEND Not found!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Parser->Parse(String,sizeof(String));
|
||||
Parser.Parse(String,sizeof(String));
|
||||
if(strcmp(String,"typebegin") != 0) {
|
||||
MessageBox(NULL,"TYPEBEGIN directive not found!","Error parsing data set!",MB_OK);
|
||||
DebugPrint("TYPEBEGIN Not found!\n");
|
||||
|
@ -3921,17 +3921,17 @@ BOOL CHeightMap::ReadMisc(CFileParser *Parser,char *Begin,char *End)
|
|||
}
|
||||
|
||||
for(i=0; i<128; i++) {
|
||||
Parser->ParseInt(NULL,&m_TileTypes[i]);
|
||||
Parser.ParseInt(NULL,&m_TileTypes[i]);
|
||||
}
|
||||
|
||||
Parser->Parse(String,sizeof(String));
|
||||
Parser.Parse(String,sizeof(String));
|
||||
if(strcmp(String,"typeend") != 0) {
|
||||
MessageBox(NULL,"TYPEEND directive not found!","Error parsing data set!",MB_OK);
|
||||
DebugPrint("TYPEEND Not found!\n");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Parser->Parse(String,sizeof(String));
|
||||
Parser.Parse(String,sizeof(String));
|
||||
if(strcmp(String,End) != 0) {
|
||||
MessageBox(NULL,"Section directive not found!","Error parsing data set!",MB_OK);
|
||||
DebugPrint("%s Not found!\n",End);
|
||||
|
@ -3943,7 +3943,7 @@ BOOL CHeightMap::ReadMisc(CFileParser *Parser,char *Begin,char *End)
|
|||
|
||||
|
||||
|
||||
BOOL CHeightMap::ReadFeatures(CFileParser *Parser,char *Begin,char *End)
|
||||
BOOL CHeightMap::ReadFeatures(fileParser& Parser,char *Begin,char *End)
|
||||
{
|
||||
char String[256];
|
||||
char Name[256];
|
||||
|
@ -3953,33 +3953,33 @@ BOOL CHeightMap::ReadFeatures(CFileParser *Parser,char *Begin,char *End)
|
|||
DWORD NumObjects = 0;
|
||||
int ColourIndex = -1;
|
||||
|
||||
Parser->Parse(String,sizeof(String));
|
||||
Parser.Parse(String,sizeof(String));
|
||||
if(strcmp(String,Begin) != 0) {
|
||||
MessageBox(NULL,"Section directive not found!","Error parsing data set!",MB_OK);
|
||||
DebugPrint("%s Not found!\n",Begin);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!Parser->ParseString("statsdir",StatsDir,sizeof(StatsDir))) {
|
||||
if(!Parser.ParseString("statsdir",StatsDir,sizeof(StatsDir))) {
|
||||
DebugPrint("STATSDIR directive not found!\n");
|
||||
MessageBox(NULL,"STATSDIR directive not found!","Error parsing data set!",MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!Parser->ParseString("imddir",IMDDir,sizeof(IMDDir))) {
|
||||
if(!Parser.ParseString("imddir",IMDDir,sizeof(IMDDir))) {
|
||||
DebugPrint("IMDDIR directive not found!\n");
|
||||
MessageBox(NULL,"IMDDIR directive not found!","Error parsing data set!",MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!Parser->ParseString("textdir",TextDir,sizeof(TextDir))) {
|
||||
if(!Parser.ParseString("textdir",TextDir,sizeof(TextDir))) {
|
||||
DebugPrint("TEXTDIR directive not found!\n");
|
||||
MessageBox(NULL,"TEXTDIR directive not found!","Error parsing data set!",MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
while(1) {
|
||||
Parser->Parse(String,sizeof(String));
|
||||
Parser.Parse(String,sizeof(String));
|
||||
if(strcmp(String,End) == 0) break;
|
||||
|
||||
sprintf(Name,"%s\\%s%s",g_WorkDirectory,StatsDir,String);
|
||||
|
@ -3994,7 +3994,7 @@ BOOL CHeightMap::ReadFeatures(CFileParser *Parser,char *Begin,char *End)
|
|||
}
|
||||
|
||||
|
||||
BOOL CHeightMap::ReadStructures(CFileParser *Parser,char *Begin,char *End)
|
||||
BOOL CHeightMap::ReadStructures(fileParser& Parser,char *Begin,char *End)
|
||||
{
|
||||
char String[256];
|
||||
char Name[256];
|
||||
|
@ -4004,33 +4004,33 @@ BOOL CHeightMap::ReadStructures(CFileParser *Parser,char *Begin,char *End)
|
|||
DWORD NumObjects = 0;
|
||||
int ColourIndex = -1;
|
||||
|
||||
Parser->Parse(String,sizeof(String));
|
||||
Parser.Parse(String,sizeof(String));
|
||||
if(strcmp(String,Begin) != 0) {
|
||||
MessageBox(NULL,"Section directive not found!","Error parsing data set!",MB_OK);
|
||||
DebugPrint("%s Not found!\n",Begin);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!Parser->ParseString("statsdir",StatsDir,sizeof(StatsDir))) {
|
||||
if(!Parser.ParseString("statsdir",StatsDir,sizeof(StatsDir))) {
|
||||
DebugPrint("STATSDIR directive not found!\n");
|
||||
MessageBox(NULL,"STATSDIR directive not found!","Error parsing data set!",MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!Parser->ParseString("imddir",IMDDir,sizeof(IMDDir))) {
|
||||
if(!Parser.ParseString("imddir",IMDDir,sizeof(IMDDir))) {
|
||||
DebugPrint("IMDDIR directive not found!\n");
|
||||
MessageBox(NULL,"IMDDIR directive not found!","Error parsing data set!",MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!Parser->ParseString("textdir",TextDir,sizeof(TextDir))) {
|
||||
if(!Parser.ParseString("textdir",TextDir,sizeof(TextDir))) {
|
||||
DebugPrint("TEXTDIR directive not found!\n");
|
||||
MessageBox(NULL,"TEXTDIR directive not found!","Error parsing data set!",MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
while(1) {
|
||||
Parser->Parse(String,sizeof(String));
|
||||
Parser.Parse(String,sizeof(String));
|
||||
if(strcmp(String,End) == 0) break;
|
||||
|
||||
sprintf(Name,"%s\\%s%s",g_WorkDirectory,StatsDir,String);
|
||||
|
@ -4045,7 +4045,7 @@ BOOL CHeightMap::ReadStructures(CFileParser *Parser,char *Begin,char *End)
|
|||
}
|
||||
|
||||
|
||||
BOOL CHeightMap::ReadTemplates(CFileParser *Parser,char *Begin,char *End)
|
||||
BOOL CHeightMap::ReadTemplates(fileParser& Parser,char *Begin,char *End)
|
||||
{
|
||||
char String[256];
|
||||
char Name[256];
|
||||
|
@ -4055,33 +4055,33 @@ BOOL CHeightMap::ReadTemplates(CFileParser *Parser,char *Begin,char *End)
|
|||
DWORD NumObjects = 0;
|
||||
int ColourIndex = -1;
|
||||
|
||||
Parser->Parse(String,sizeof(String));
|
||||
Parser.Parse(String,sizeof(String));
|
||||
if(strcmp(String,Begin) != 0) {
|
||||
MessageBox(NULL,"Section directive not found!","Error parsing data set!",MB_OK);
|
||||
DebugPrint("%s Not found!\n",Begin);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!Parser->ParseString("statsdir",StatsDir,sizeof(StatsDir))) {
|
||||
if(!Parser.ParseString("statsdir",StatsDir,sizeof(StatsDir))) {
|
||||
DebugPrint("STATSDIR directive not found!\n");
|
||||
MessageBox(NULL,"STATSDIR directive not found!","Error parsing data set!",MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!Parser->ParseString("imddir",IMDDir,sizeof(IMDDir))) {
|
||||
if(!Parser.ParseString("imddir",IMDDir,sizeof(IMDDir))) {
|
||||
DebugPrint("IMDDIR directive not found!\n");
|
||||
MessageBox(NULL,"IMDDIR directive not found!","Error parsing data set!",MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!Parser->ParseString("textdir",TextDir,sizeof(TextDir))) {
|
||||
if(!Parser.ParseString("textdir",TextDir,sizeof(TextDir))) {
|
||||
DebugPrint("TEXTDIR directive not found!\n");
|
||||
MessageBox(NULL,"TEXTDIR directive not found!","Error parsing data set!",MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
while(1) {
|
||||
Parser->Parse(String,sizeof(String));
|
||||
Parser.Parse(String,sizeof(String));
|
||||
if(strcmp(String,End) == 0) break;
|
||||
|
||||
sprintf(Name,"%s\\%s%s",g_WorkDirectory,StatsDir,String);
|
||||
|
@ -4097,7 +4097,7 @@ BOOL CHeightMap::ReadTemplates(CFileParser *Parser,char *Begin,char *End)
|
|||
|
||||
|
||||
|
||||
BOOL CHeightMap::ReadObjects(CFileParser *Parser,char *Begin,char *End,int TypeID)
|
||||
BOOL CHeightMap::ReadObjects(fileParser& Parser,char *Begin,char *End,int TypeID)
|
||||
{
|
||||
char String[256];
|
||||
char Name[256];
|
||||
|
@ -4111,41 +4111,41 @@ BOOL CHeightMap::ReadObjects(CFileParser *Parser,char *Begin,char *End,int TypeI
|
|||
BOOL TileSnap;
|
||||
int ColourIndex = -1;
|
||||
|
||||
Parser->Parse(String,sizeof(String));
|
||||
Parser.Parse(String,sizeof(String));
|
||||
if(strcmp(String,Begin) != 0) {
|
||||
DebugPrint("%s Not found!\n",Begin);
|
||||
MessageBox(NULL,"Section directive not found!","Error parsing data set!",MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!Parser->ParseString("statsdir",StatsDir,sizeof(StatsDir))) {
|
||||
if(!Parser.ParseString("statsdir",StatsDir,sizeof(StatsDir))) {
|
||||
DebugPrint("STATSDIR directive not found!\n");
|
||||
MessageBox(NULL,"STATSDIR directive not found!","Error parsing data set!",MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!Parser->ParseString("imddir",IMDDir,sizeof(IMDDir))) {
|
||||
if(!Parser.ParseString("imddir",IMDDir,sizeof(IMDDir))) {
|
||||
DebugPrint("IMDDIR directive not found!\n");
|
||||
MessageBox(NULL,"IMDDIR directive not found!","Error parsing data set!",MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if(!Parser->ParseString("textdir",TextDir,sizeof(TextDir))) {
|
||||
if(!Parser.ParseString("textdir",TextDir,sizeof(TextDir))) {
|
||||
DebugPrint("TEXTDIR directive not found!\n");
|
||||
MessageBox(NULL,"TEXTDIR directive not found!","Error parsing data set!",MB_OK);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
while(1) {
|
||||
Parser->Parse(String,sizeof(String));
|
||||
Parser.Parse(String,sizeof(String));
|
||||
if(strcmp(String,End) == 0) break;
|
||||
|
||||
short Flags = Parser->GetFlags();
|
||||
Parser->SetFlags(Flags & ~(FP_LOWERCASE | FP_UPPERCASE));
|
||||
Parser->Parse(Description,sizeof(Description));
|
||||
Parser->SetFlags(Flags);
|
||||
short Flags = Parser.GetFlags();
|
||||
Parser.SetFlags(Flags & ~(FP_LOWERCASE | FP_UPPERCASE));
|
||||
Parser.Parse(Description,sizeof(Description));
|
||||
Parser.SetFlags(Flags);
|
||||
|
||||
Parser->Parse(Type,sizeof(Type));
|
||||
Parser.Parse(Type,sizeof(Type));
|
||||
if(strcmp(Type,"flanged") == 0) {
|
||||
Flanged = TRUE;
|
||||
} else if(strcmp(Type,"overlayed") == 0) {
|
||||
|
@ -4155,7 +4155,7 @@ BOOL CHeightMap::ReadObjects(CFileParser *Parser,char *Begin,char *End,int TypeI
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
Parser->Parse(Type,sizeof(Type));
|
||||
Parser.Parse(Type,sizeof(Type));
|
||||
if(strcmp(Type,"tilesnap") == 0) {
|
||||
TileSnap = TRUE;
|
||||
} else if(strcmp(Type,"nosnap") == 0) {
|
||||
|
@ -4165,7 +4165,7 @@ BOOL CHeightMap::ReadObjects(CFileParser *Parser,char *Begin,char *End,int TypeI
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
Parser->Parse(Type,sizeof(Type));
|
||||
Parser.Parse(Type,sizeof(Type));
|
||||
if(strncmp(Type,"key",3) == 0) {
|
||||
if(sscanf(&Type[3],"%d",&ColourIndex) != 1) {
|
||||
MessageBox(NULL,"Invalid key index.\nShould be number between 0-255","Error parsing data set!",MB_OK);
|
||||
|
@ -4180,7 +4180,7 @@ BOOL CHeightMap::ReadObjects(CFileParser *Parser,char *Begin,char *End,int TypeI
|
|||
|
||||
NORMALTYPE ShadeMode;
|
||||
|
||||
Parser->Parse(Type,sizeof(Type));
|
||||
Parser.Parse(Type,sizeof(Type));
|
||||
if(strcmp(Type,"smoothshade") == 0) {
|
||||
ShadeMode = NT_SMOOTHNORMALS;
|
||||
} else if(strcmp(Type,"flatshade") == 0) {
|
||||
|
|
|
@ -808,13 +808,17 @@ public:
|
|||
BOOL ReadStructureStats(char *ScriptFile,char *IMDDir,char *TextDir);
|
||||
TECH_LEVEL CHeightMap::SetTechLevel(char *pLevel);
|
||||
BOOL ReadTemplateStats(char *ScriptFile,char *IMDDir,char *TextDir);
|
||||
BOOL ReadObjects(CFileParser *Parser,char *Begin,char *End,int TypeID);
|
||||
BOOL ReadObjectNames(char *FileName);
|
||||
int MatchObjName(char *IDString);
|
||||
BOOL ReadMisc(CFileParser *Parser,char *Begin,char *End);
|
||||
BOOL ReadFeatures(CFileParser *Parser,char *Begin,char *End);
|
||||
BOOL ReadStructures(CFileParser *Parser,char *Begin,char *End);
|
||||
BOOL ReadTemplates(CFileParser *Parser,char *Begin,char *End);
|
||||
|
||||
private:
|
||||
BOOL ReadObjects(fileParser& Parser,char *Begin,char *End,int TypeID);
|
||||
BOOL ReadMisc(fileParser& Parser,char *Begin,char *End);
|
||||
BOOL ReadFeatures(fileParser& Parser,char *Begin,char *End);
|
||||
BOOL ReadStructures(fileParser& Parser,char *Begin,char *End);
|
||||
BOOL ReadTemplates(fileParser& Parser,char *Begin,char *End);
|
||||
|
||||
public:
|
||||
BOOL ReadIMDObjects(char *ScriptFile);
|
||||
// BOOL ReadObjects(char *ScripFile);
|
||||
DWORD GetNumIMD(void) { return m_Num3DObjects; }
|
||||
|
|
Loading…
Reference in New Issue