Map parser compiles outside of Visual Studio
This commit is contained in:
parent
3845ede3b9
commit
39d66cdd28
@ -8,6 +8,21 @@
|
|||||||
// This Include
|
// This Include
|
||||||
#include "mapparser.h"
|
#include "mapparser.h"
|
||||||
|
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
/*
|
||||||
|
str*_s functions are microsoft only extensions of C string manip.
|
||||||
|
mingw is ok with strtok_r, but is not ok with strcpy_r
|
||||||
|
additionally, old versions of mingw may not be ok with strtok_r at all.
|
||||||
|
*/
|
||||||
|
inline char *strtok_s(char* s, const char* delm, char** context) {
|
||||||
|
return strtok_r(s, delm, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline char *strcpy_s(char *dest, const char *src) {
|
||||||
|
return strcpy(dest, src);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const bool CMapParser::LoadMap(const char* _kpcFileName)
|
const bool CMapParser::LoadMap(const char* _kpcFileName)
|
||||||
{
|
{
|
||||||
std::ifstream InFile;
|
std::ifstream InFile;
|
||||||
@ -149,7 +164,7 @@ EParserState CMapParser::ParseVertex(const std::string _Line)
|
|||||||
strcpy_s(pcLine, _Line.c_str());
|
strcpy_s(pcLine, _Line.c_str());
|
||||||
pcToken = strtok_s(pcLine, kpcDelim, &pcContext);
|
pcToken = strtok_s(pcLine, kpcDelim, &pcContext);
|
||||||
|
|
||||||
TVector3f Vert;
|
Eigen::Vector3f Vert;
|
||||||
int iTokenNum = 0;
|
int iTokenNum = 0;
|
||||||
while(pcToken != nullptr)
|
while(pcToken != nullptr)
|
||||||
{
|
{
|
||||||
@ -158,15 +173,15 @@ EParserState CMapParser::ParseVertex(const std::string _Line)
|
|||||||
double dValue = std::stod(pcToken);
|
double dValue = std::stod(pcToken);
|
||||||
if(iTokenNum == 0)
|
if(iTokenNum == 0)
|
||||||
{
|
{
|
||||||
Vert.m_fX = (float)dValue;
|
Vert[0] = (float)dValue;
|
||||||
}
|
}
|
||||||
else if(iTokenNum == 1)
|
else if(iTokenNum == 1)
|
||||||
{
|
{
|
||||||
Vert.m_fY = (float)dValue;
|
Vert[1] = (float)dValue;
|
||||||
}
|
}
|
||||||
else if(iTokenNum == 2)
|
else if(iTokenNum == 2)
|
||||||
{
|
{
|
||||||
Vert.m_fZ = (float)dValue;
|
Vert[2] = (float)dValue;
|
||||||
}
|
}
|
||||||
iTokenNum++;
|
iTokenNum++;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user