mirror of
https://github.com/glest/glest-source.git
synced 2025-08-17 05:43:59 +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
|
||||
DayTime=1000
|
||||
DebugLogFile=debug.log
|
||||
DebugMode=false
|
||||
DebugPerformance=false
|
||||
DebugMode=true
|
||||
DebugNetwork=false
|
||||
DebugPerformance=false
|
||||
DebugWorldSynch=false
|
||||
DepthBits=16
|
||||
FactoryGraphics=OpenGL
|
||||
FactorySound=OpenAL
|
||||
@@ -45,8 +46,8 @@ FontMenuNormalPrefix=-*-helvetica-*-r-*-*-
|
||||
FontMenuVeryBigBaseSize=25
|
||||
FontSizeAdjustment=0
|
||||
Lang=english
|
||||
MaxLights=8
|
||||
Masterserver=http://soft-haus.com/glest/cgi-bin/
|
||||
MaxLights=2
|
||||
NetPlayerName=unknown
|
||||
NetworkConsistencyChecks=true
|
||||
PhotoMode=false
|
||||
@@ -58,14 +59,14 @@ ServerPort=61357
|
||||
ShadowAlpha=0.2
|
||||
ShadowFrameSkip=2
|
||||
ShadowTextureSize=512
|
||||
Shadows=Projected
|
||||
Shadows=Disabled
|
||||
SoundStaticBuffers=16
|
||||
SoundStreamingBuffers=4
|
||||
SoundVolumeAmbient=80
|
||||
SoundVolumeFx=80
|
||||
SoundVolumeMusic=90
|
||||
StencilBits=0
|
||||
Textures3D=true
|
||||
UnitParticles=true
|
||||
Textures3D=0
|
||||
UnitParticles=1
|
||||
UserData_Root=mydata/
|
||||
Windowed=false
|
||||
Windowed=1
|
||||
|
@@ -140,11 +140,17 @@ public:
|
||||
|
||||
template <typename T>
|
||||
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) {
|
||||
T* ret = NULL;
|
||||
file.seekg(0, ios::beg); //Set position to first
|
||||
try {
|
||||
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
|
||||
continue;
|
||||
}
|
||||
@@ -157,11 +163,17 @@ static inline T* readFromFileReaders(vector<FileReader<T> const *>* readers, con
|
||||
|
||||
template <typename T>
|
||||
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) {
|
||||
T* ret = NULL;
|
||||
file.seekg(0, ios::beg); //Set position to first
|
||||
try {
|
||||
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
|
||||
continue;
|
||||
}
|
||||
|
Reference in New Issue
Block a user