Fixed crash when loading level with incorrect object type

master
krzys-h 2016-04-10 13:27:56 +02:00
parent d3f808f66d
commit dd8a324f9b
2 changed files with 2 additions and 2 deletions

View File

@ -530,7 +530,7 @@ ObjectType CLevelParserParam::ToObjectType(std::string value)
if (value == "Me" ) return OBJECT_HUMAN;
if (value == "Tech" ) return OBJECT_TECH;
if (value == "MissionController" ) return OBJECT_CONTROLLER;
return static_cast<ObjectType>(boost::lexical_cast<int>(value));
return static_cast<ObjectType>(Cast<int>(value, "object"));
}
const std::string CLevelParserParam::FromObjectType(ObjectType value)

View File

@ -123,7 +123,6 @@ public:
bool IsDefined();
static const std::string FromObjectType(ObjectType value);
static ObjectType ToObjectType(std::string value);
private:
void ParseArray();
@ -133,6 +132,7 @@ private:
template<typename T> T Cast(std::string requestedType);
std::string ToPath(std::string path, const std::string defaultDir);
ObjectType ToObjectType(std::string value);
DriveType ToDriveType(std::string value);
ToolType ToToolType(std::string value);
Gfx::WaterType ToWaterType(std::string value);