summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorkrzys-h <krzys_h@interia.pl>2014-10-25 12:44:52 +0200
committerkrzys-h <krzys_h@interia.pl>2014-10-25 12:44:52 +0200
commit81062e5e87bc2f34e295e39a95afb1da57d260cf (patch)
tree6facf64561011fc337bd11b9d0985d0a4f537227 /src
parent78d7cc9eefaa5e9e5071094c5a04aaa197aeabda (diff)
downloadcolobot-81062e5e87bc2f34e295e39a95afb1da57d260cf.tar.gz
colobot-81062e5e87bc2f34e295e39a95afb1da57d260cf.tar.bz2
colobot-81062e5e87bc2f34e295e39a95afb1da57d260cf.zip
Fixed linking convert_model (#332)
Diffstat (limited to 'src')
-rw-r--r--src/CMakeLists.txt4
-rw-r--r--src/graphics/engine/modelfile.cpp38
2 files changed, 37 insertions, 5 deletions
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 869f0cb..a8914e1 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -215,7 +215,7 @@ set(LIBS
${LIBSNDFILE_LIBRARY}
${OPTIONAL_LIBS}
${PLATFORM_LIBS}
-${PHYSFS_LIBRARY}
+ ${PHYSFS_LIBRARY}
)
set(COLOBOT_LIBS ${LIBS} PARENT_SCOPE)
@@ -239,7 +239,7 @@ set(SYSTEM_INCLUDES
${LOCALENAME_INCLUDE_DIR}
${OPTIONAL_INCLUDE_DIRS}
${CLIPBOARD_INCLUDE_DIR}
-${PHYSFS_INCLUDE_PATH}
+ ${PHYSFS_INCLUDE_PATH}
)
set(COLOBOT_LOCAL_INCLUDES ${LOCAL_INCLUDES} PARENT_SCOPE)
diff --git a/src/graphics/engine/modelfile.cpp b/src/graphics/engine/modelfile.cpp
index 09c7bbd..c422f18 100644
--- a/src/graphics/engine/modelfile.cpp
+++ b/src/graphics/engine/modelfile.cpp
@@ -24,7 +24,9 @@
#include "common/logger.h"
#include "common/stringutils.h"
+#ifndef MODELFILE_NO_ENGINE
#include "common/resources/inputstream.h"
+#endif
#include "graphics/engine/engine.h"
@@ -436,13 +438,23 @@ bool CModelFile::ReadModel(const std::string& fileName)
{
m_triangles.clear();
+ #ifndef MODELFILE_NO_ENGINE
CInputStream stream;
- stream.open(fileName.c_str());
+ stream.open(fileName);
if (!stream.is_open())
{
GetLogger()->Error("Could not open file '%s'\n", fileName.c_str());
return false;
}
+ #else
+ std::ifstream stream;
+ stream.open(fileName);
+ if (!stream.good())
+ {
+ GetLogger()->Error("Could not open file '%s'\n", fileName.c_str());
+ return false;
+ }
+ #endif
return ReadModel(stream);
}
@@ -827,13 +839,23 @@ struct NewModelTriangle1
bool CModelFile::ReadTextModel(const std::string& fileName)
{
+ #ifndef MODELFILE_NO_ENGINE
CInputStream stream;
- stream.open(fileName.c_str());
+ stream.open(fileName);
if (!stream.is_open())
{
GetLogger()->Error("Could not open file '%s'\n", fileName.c_str());
return false;
}
+ #else
+ std::ifstream stream;
+ stream.open(fileName);
+ if (!stream.good())
+ {
+ GetLogger()->Error("Could not open file '%s'\n", fileName.c_str());
+ return false;
+ }
+ #endif
return ReadTextModel(stream);
}
@@ -1024,13 +1046,23 @@ bool CModelFile::WriteTextModel(std::ostream& stream)
bool CModelFile::ReadBinaryModel(const std::string& fileName)
{
+ #ifndef MODELFILE_NO_ENGINE
CInputStream stream;
- stream.open(fileName.c_str());
+ stream.open(fileName);
if (!stream.is_open())
{
GetLogger()->Error("Could not open file '%s'\n", fileName.c_str());
return false;
}
+ #else
+ std::ifstream stream;
+ stream.open(fileName);
+ if (!stream.good())
+ {
+ GetLogger()->Error("Could not open file '%s'\n", fileName.c_str());
+ return false;
+ }
+ #endif
return ReadBinaryModel(stream);
}