summaryrefslogtreecommitdiffstats
path: root/src/object/level
diff options
context:
space:
mode:
Diffstat (limited to 'src/object/level')
-rw-r--r--src/object/level/parser.cpp7
-rw-r--r--src/object/level/parserexceptions.cpp8
-rw-r--r--src/object/level/parserparam.cpp6
3 files changed, 12 insertions, 9 deletions
diff --git a/src/object/level/parser.cpp b/src/object/level/parser.cpp
index e73142e..383931c 100644
--- a/src/object/level/parser.cpp
+++ b/src/object/level/parser.cpp
@@ -32,6 +32,7 @@
#include <boost/algorithm/string/trim.hpp>
#include <boost/algorithm/string/replace.hpp>
+#include <boost/lexical_cast.hpp>
CLevelParser::CLevelParser()
{
@@ -177,11 +178,11 @@ void CLevelParser::Load()
if(line[0] == '\"') {
pos = line.find_first_of("\"", 1);
if(pos == std::string::npos)
- throw CLevelParserException("Unclosed \" in "+m_filename+":"+std::to_string(lineNumber));
+ throw CLevelParserException("Unclosed \" in "+m_filename+":"+boost::lexical_cast<std::string>(lineNumber));
} else if(line[0] == '\'') {
pos = line.find_first_of("'", 1);
if(pos == std::string::npos)
- throw CLevelParserException("Unclosed ' in "+m_filename+":"+std::to_string(lineNumber));
+ throw CLevelParserException("Unclosed ' in "+m_filename+":"+boost::lexical_cast<std::string>(lineNumber));
} else {
pos = line.find_first_of("=");
if(pos != std::string::npos) {
@@ -237,4 +238,4 @@ CLevelParserLine* CLevelParser::Get(std::string command)
return line;
}
throw CLevelParserException("Command not found: "+command);
-} \ No newline at end of file
+}
diff --git a/src/object/level/parserexceptions.cpp b/src/object/level/parserexceptions.cpp
index d5c4620..b495de7 100644
--- a/src/object/level/parserexceptions.cpp
+++ b/src/object/level/parserexceptions.cpp
@@ -19,6 +19,8 @@
#include "object/level/parser.h"
+#include <boost/lexical_cast.hpp>
+
CLevelParserException::CLevelParserException(std::string message) noexcept
{
m_message = message;
@@ -30,11 +32,11 @@ const char* CLevelParserException::what() const noexcept
}
CLevelParserExceptionMissingParam::CLevelParserExceptionMissingParam(CLevelParserParam* thisParam) noexcept
-: CLevelParserException("Missing required param "+thisParam->GetName()+" (in "+thisParam->GetLine()->GetLevel()->GetFilename()+":"+std::to_string(thisParam->GetLine()->GetLineNumber())+")")
+: CLevelParserException("Missing required param "+thisParam->GetName()+" (in "+thisParam->GetLine()->GetLevel()->GetFilename()+":"+boost::lexical_cast<std::string>(thisParam->GetLine()->GetLineNumber())+")")
{
}
CLevelParserExceptionBadParam::CLevelParserExceptionBadParam(CLevelParserParam* thisParam, std::string requestedType) noexcept
-: CLevelParserException("Unable to parse '"+thisParam->GetValue()+"' as "+requestedType+" (param '"+thisParam->GetName()+"' in "+thisParam->GetLine()->GetLevel()->GetFilename()+":"+std::to_string(thisParam->GetLine()->GetLineNumber())+")")
+: CLevelParserException("Unable to parse '"+thisParam->GetValue()+"' as "+requestedType+" (param '"+thisParam->GetName()+"' in "+thisParam->GetLine()->GetLevel()->GetFilename()+":"+boost::lexical_cast<std::string>(thisParam->GetLine()->GetLineNumber())+")")
{
-} \ No newline at end of file
+}
diff --git a/src/object/level/parserparam.cpp b/src/object/level/parserparam.cpp
index 39a953b..50152c5 100644
--- a/src/object/level/parserparam.cpp
+++ b/src/object/level/parserparam.cpp
@@ -650,7 +650,7 @@ const std::string CLevelParserParam::FromObjectType(ObjectType value)
if(value == OBJECT_HUMAN ) return "Me";
if(value == OBJECT_TECH ) return "Tech";
if(value == OBJECT_CONTROLLER ) return "MissionController";
- return std::to_string(static_cast<int>(value));
+ return boost::lexical_cast<std::string>(static_cast<int>(value));
}
ObjectType CLevelParserParam::AsObjectType()
@@ -888,7 +888,7 @@ const std::string CLevelParserParam::FromCameraType(Gfx::CameraType value)
{
if(value == Gfx::CAM_TYPE_ONBOARD) return "ONBOARD";
if(value == Gfx::CAM_TYPE_FIX ) return "FIX";
- return std::to_string(static_cast<int>(value));
+ return boost::lexical_cast<std::string>(static_cast<int>(value));
}
Gfx::CameraType CLevelParserParam::AsCameraType()
@@ -917,7 +917,7 @@ void CLevelParserParam::ParseArray()
for(auto& value : values) {
boost::algorithm::trim(value);
if(value.empty()) continue;
- CLevelParserParam* param = new CLevelParserParam(m_name+"["+std::to_string(i)+"]", value);
+ CLevelParserParam* param = new CLevelParserParam(m_name+"["+boost::lexical_cast<std::string>(i)+"]", value);
param->SetLine(m_line);
m_array.push_back(param);
i++;