mirror of
https://github.com/glest/glest-source.git
synced 2025-08-17 21:51:17 +02:00
Tried to fix the wrong error message given if the file could not be found
This commit is contained in:
@@ -15,9 +15,10 @@ ConsoleMaxLinesStored=20
|
|||||||
ConsoleTimeout=20
|
ConsoleTimeout=20
|
||||||
DayTime=1000
|
DayTime=1000
|
||||||
DebugLogFile=debug.log
|
DebugLogFile=debug.log
|
||||||
DebugMode=false
|
DebugMode=true
|
||||||
DebugPerformance=false
|
|
||||||
DebugNetwork=false
|
DebugNetwork=false
|
||||||
|
DebugPerformance=false
|
||||||
|
DebugWorldSynch=false
|
||||||
DepthBits=16
|
DepthBits=16
|
||||||
FactoryGraphics=OpenGL
|
FactoryGraphics=OpenGL
|
||||||
FactorySound=OpenAL
|
FactorySound=OpenAL
|
||||||
@@ -45,8 +46,8 @@ FontMenuNormalPrefix=-*-helvetica-*-r-*-*-
|
|||||||
FontMenuVeryBigBaseSize=25
|
FontMenuVeryBigBaseSize=25
|
||||||
FontSizeAdjustment=0
|
FontSizeAdjustment=0
|
||||||
Lang=english
|
Lang=english
|
||||||
MaxLights=8
|
|
||||||
Masterserver=http://soft-haus.com/glest/cgi-bin/
|
Masterserver=http://soft-haus.com/glest/cgi-bin/
|
||||||
|
MaxLights=2
|
||||||
NetPlayerName=unknown
|
NetPlayerName=unknown
|
||||||
NetworkConsistencyChecks=true
|
NetworkConsistencyChecks=true
|
||||||
PhotoMode=false
|
PhotoMode=false
|
||||||
@@ -58,14 +59,14 @@ ServerPort=61357
|
|||||||
ShadowAlpha=0.2
|
ShadowAlpha=0.2
|
||||||
ShadowFrameSkip=2
|
ShadowFrameSkip=2
|
||||||
ShadowTextureSize=512
|
ShadowTextureSize=512
|
||||||
Shadows=Projected
|
Shadows=Disabled
|
||||||
SoundStaticBuffers=16
|
SoundStaticBuffers=16
|
||||||
SoundStreamingBuffers=4
|
SoundStreamingBuffers=4
|
||||||
SoundVolumeAmbient=80
|
SoundVolumeAmbient=80
|
||||||
SoundVolumeFx=80
|
SoundVolumeFx=80
|
||||||
SoundVolumeMusic=90
|
SoundVolumeMusic=90
|
||||||
StencilBits=0
|
StencilBits=0
|
||||||
Textures3D=true
|
Textures3D=0
|
||||||
UnitParticles=true
|
UnitParticles=1
|
||||||
UserData_Root=mydata/
|
UserData_Root=mydata/
|
||||||
Windowed=false
|
Windowed=1
|
||||||
|
@@ -140,11 +140,17 @@ public:
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T* readFromFileReaders(vector<FileReader<T> const *>* readers, const string& filepath) {
|
static inline T* readFromFileReaders(vector<FileReader<T> const *>* readers, const string& filepath) {
|
||||||
|
//try to assign file
|
||||||
|
ifstream file(filepath.c_str(), ios::in | ios::binary);
|
||||||
|
if (!file.is_open()) { //An error occured; TODO: Which one - throw an exception, print error message?
|
||||||
|
throw runtime_error("Could not open file " + filepath);
|
||||||
|
}
|
||||||
for (typename vector<FileReader<T> const *>::const_iterator i = readers->begin(); i != readers->end(); ++i) {
|
for (typename vector<FileReader<T> const *>::const_iterator i = readers->begin(); i != readers->end(); ++i) {
|
||||||
T* ret = NULL;
|
T* ret = NULL;
|
||||||
|
file.seekg(0, ios::beg); //Set position to first
|
||||||
try {
|
try {
|
||||||
FileReader<T> const * reader = *i;
|
FileReader<T> const * reader = *i;
|
||||||
ret = reader->read(filepath); //It is guaranteed that at least the filepath matches ...
|
ret = reader->read(file, filepath); //It is guaranteed that at least the filepath matches ...
|
||||||
} catch (...) { //TODO: Specific exceptions
|
} catch (...) { //TODO: Specific exceptions
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -157,11 +163,17 @@ static inline T* readFromFileReaders(vector<FileReader<T> const *>* readers, con
|
|||||||
|
|
||||||
template <typename T>
|
template <typename T>
|
||||||
static inline T* readFromFileReaders(vector<FileReader<T> const *>* readers, const string& filepath, T* object) {
|
static inline T* readFromFileReaders(vector<FileReader<T> const *>* readers, const string& filepath, T* object) {
|
||||||
|
//try to assign file
|
||||||
|
ifstream file(filepath.c_str(), ios::in | ios::binary);
|
||||||
|
if (!file.is_open()) { //An error occured; TODO: Which one - throw an exception, print error message?
|
||||||
|
throw runtime_error("Could not open file " + filepath);
|
||||||
|
}
|
||||||
for (typename vector<FileReader<T> const *>::const_iterator i = readers->begin(); i != readers->end(); ++i) {
|
for (typename vector<FileReader<T> const *>::const_iterator i = readers->begin(); i != readers->end(); ++i) {
|
||||||
T* ret = NULL;
|
T* ret = NULL;
|
||||||
|
file.seekg(0, ios::beg); //Set position to first
|
||||||
try {
|
try {
|
||||||
FileReader<T> const * reader = *i;
|
FileReader<T> const * reader = *i;
|
||||||
ret = reader->read(filepath, object); //It is guaranteed that at least the filepath matches ...
|
ret = reader->read(file, filepath, object); //It is guaranteed that at least the filepath matches ...
|
||||||
} catch (...) { //TODO: Specific exceptions
|
} catch (...) { //TODO: Specific exceptions
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user