Map parser compiles outside of Visual Studio

This commit is contained in:
2017-03-30 22:34:19 -07:00
parent 3845ede3b9
commit 39d66cdd28
2 changed files with 294 additions and 279 deletions

View File

@ -8,6 +8,21 @@
// This Include
#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)
{
std::ifstream InFile;
@ -149,7 +164,7 @@ EParserState CMapParser::ParseVertex(const std::string _Line)
strcpy_s(pcLine, _Line.c_str());
pcToken = strtok_s(pcLine, kpcDelim, &pcContext);
TVector3f Vert;
Eigen::Vector3f Vert;
int iTokenNum = 0;
while(pcToken != nullptr)
{
@ -158,15 +173,15 @@ EParserState CMapParser::ParseVertex(const std::string _Line)
double dValue = std::stod(pcToken);
if(iTokenNum == 0)
{
Vert.m_fX = (float)dValue;
Vert[0] = (float)dValue;
}
else if(iTokenNum == 1)
{
Vert.m_fY = (float)dValue;
Vert[1] = (float)dValue;
}
else if(iTokenNum == 2)
{
Vert.m_fZ = (float)dValue;
Vert[2] = (float)dValue;
}
iTokenNum++;
}