diff options
author | Stijn Buys <ingar@osirion.org> | 2007-11-10 14:28:58 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2007-11-10 14:28:58 +0000 |
commit | 647dddf98545a7df44137e9285229a33184f9552 (patch) | |
tree | 82e93febf2028372ab1519184d27da571365a45f /src | |
parent | bb24e4ad543c3a739625778b9854c49688c8204f (diff) |
deug messages
Diffstat (limited to 'src')
-rw-r--r-- | src/common/console.h | 2 | ||||
-rw-r--r-- | src/common/file.cc | 5 | ||||
-rw-r--r-- | src/common/file.h | 7 |
3 files changed, 11 insertions, 3 deletions
diff --git a/src/common/console.h b/src/common/console.h index 5f80e73..b661afc 100644 --- a/src/common/console.h +++ b/src/common/console.h @@ -15,6 +15,8 @@ /// global define to send a warning message to the system console #define conwarn common::Console::instance->warning() +#define DEBUG 1 + #ifdef DEBUG /// global define to send a debug message to the system console #define condebug common::Console::instance->debug() diff --git a/src/common/file.cc b/src/common/file.cc index 822c678..73537ec 100644 --- a/src/common/file.cc +++ b/src/common/file.cc @@ -17,6 +17,7 @@ std::string File::moddir = ""; void File::open(const char * filename, ios_base::openmode mode) { + file_name.assign(filename); std::string fn; // if moddir is set, try the mods subdir first @@ -58,9 +59,9 @@ void File::open(const char * filename, ios_base::openmode mode) std::ifstream::open(fn.c_str(), mode); if (!this->is_open()) { - condebug << "File could not open " << filename << std::endl; + conmesg << "File could not open " << filename << std::endl; } else { - conmesg << "File opened " << fn << std::endl; + condebug << "File opened " << fn << std::endl; } } diff --git a/src/common/file.h b/src/common/file.h index a377981..842450e 100644 --- a/src/common/file.h +++ b/src/common/file.h @@ -18,7 +18,10 @@ class File : public std::ifstream { public: /// open the file for reading - void open(const char * filename, std::ios_base::openmode mode = std::ios_base::in ); + virtual void open(const char * filename, std::ios_base::openmode mode = std::ios_base::in ); + + /// current filename + inline std::string name() { return file_name; } /// location of the main data files, includes trailing / static std::string datadir; @@ -28,6 +31,8 @@ public: static std::string basedir; /// subdirectory for the current mod, includes trailing / static std::string moddir; +private: + std::string file_name; }; // class File } // namespace common |