[colobot] 04/390: Added Exist() to resource manager, updated model
Didier Raboud
odyx at moszumanska.debian.org
Fri Jun 12 14:21:21 UTC 2015
This is an automated email from the git hooks/post-receive script.
odyx pushed a commit to branch upstream/latest
in repository colobot.
commit 0556b5dfbcf8e3fe26ec4c773367d2f77e2c0ec9
Author: Krzysztof Dermont <erihel at gmail.com>
Date: Sun Jun 22 16:29:26 2014 +0200
Added Exist() to resource manager, updated model
---
src/common/resources/resourcemanager.cpp | 6 ++++++
src/common/resources/resourcemanager.h | 1 +
src/graphics/engine/modelfile.cpp | 14 ++++++++------
3 files changed, 15 insertions(+), 6 deletions(-)
diff --git a/src/common/resources/resourcemanager.cpp b/src/common/resources/resourcemanager.cpp
index b01424b..5e8627d 100644
--- a/src/common/resources/resourcemanager.cpp
+++ b/src/common/resources/resourcemanager.cpp
@@ -130,6 +130,12 @@ CSNDFile* CResourceManager::GetSNDFileHandler(const std::string &filename)
}
+bool CResourceManager::Exists(const std::string &filename)
+{
+ return PHYSFS_exists(filename.c_str());
+}
+
+
int CResourceManager::SDLClose(SDL_RWops *context)
{
if (CheckSDLContext(context))
diff --git a/src/common/resources/resourcemanager.h b/src/common/resources/resourcemanager.h
index fec71da..36f6fa5 100644
--- a/src/common/resources/resourcemanager.h
+++ b/src/common/resources/resourcemanager.h
@@ -33,6 +33,7 @@ public:
static std::string GetLanguageLocation();
static SDL_RWops* GetSDLFileHandler(const std::string &filename);
static CSNDFile* GetSNDFileHandler(const std::string &filename);
+ static bool Exists(const std::string &filename);
private:
static int SDLSeek(SDL_RWops *context, int offset, int whence);
diff --git a/src/graphics/engine/modelfile.cpp b/src/graphics/engine/modelfile.cpp
index 99496aa..0e3cbf8 100644
--- a/src/graphics/engine/modelfile.cpp
+++ b/src/graphics/engine/modelfile.cpp
@@ -22,6 +22,8 @@
#include "common/logger.h"
#include "common/stringutils.h"
+#include "common/resources/inputstream.h"
+
#include "graphics/engine/engine.h"
#include "math/geometry.h"
@@ -432,8 +434,8 @@ bool CModelFile::ReadModel(const std::string& fileName)
{
m_triangles.clear();
- std::ifstream stream;
- stream.open(fileName.c_str(), std::ios_base::in | std::ios_base::binary);
+ CInputStream stream;
+ stream.open(fileName.c_str());
if (!stream.good())
{
GetLogger()->Error("Could not open file '%s'\n", fileName.c_str());
@@ -823,8 +825,8 @@ struct NewModelTriangle1
bool CModelFile::ReadTextModel(const std::string& fileName)
{
- std::ifstream stream;
- stream.open(fileName.c_str(), std::ios_base::in);
+ CInputStream stream;
+ stream.open(fileName.c_str());
if (!stream.good())
{
GetLogger()->Error("Could not open file '%s'\n", fileName.c_str());
@@ -1020,8 +1022,8 @@ bool CModelFile::WriteTextModel(std::ostream& stream)
bool CModelFile::ReadBinaryModel(const std::string& fileName)
{
- std::ifstream stream;
- stream.open(fileName.c_str(), std::ios_base::in | std::ios_base::binary);
+ CInputStream stream;
+ stream.open(fileName.c_str());
if (!stream.good())
{
GetLogger()->Error("Could not open file '%s'\n", fileName.c_str());
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/colobot.git
More information about the Pkg-games-commits
mailing list