diff options
author | Krzysztof Dermont <erihel@gmail.com> | 2014-06-22 21:30:23 +0200 |
---|---|---|
committer | Krzysztof Dermont <erihel@gmail.com> | 2014-06-22 21:30:23 +0200 |
commit | 3aca1de731fa7517db7d4dc00913542412150898 (patch) | |
tree | e508b93952b515fd7b0ea354b62cf71c33d4af3f /src/object/robotmain.cpp | |
parent | 0556b5dfbcf8e3fe26ec4c773367d2f77e2c0ec9 (diff) | |
download | colobot-3aca1de731fa7517db7d4dc00913542412150898.tar.gz colobot-3aca1de731fa7517db7d4dc00913542412150898.tar.bz2 colobot-3aca1de731fa7517db7d4dc00913542412150898.zip |
More work on levels
Diffstat (limited to 'src/object/robotmain.cpp')
-rw-r--r-- | src/object/robotmain.cpp | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/object/robotmain.cpp b/src/object/robotmain.cpp index 1c75137..87cd5fc 100644 --- a/src/object/robotmain.cpp +++ b/src/object/robotmain.cpp @@ -29,6 +29,8 @@ #include "common/profile.h" #include "common/restext.h" +#include "common/resources/inputstream.h" + #include "graphics/engine/camera.h" #include "graphics/engine/cloud.h" #include "graphics/engine/engine.h" @@ -4009,8 +4011,11 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) std::string tempLine; m_dialog->BuildSceneName(tempLine, base, rank); strcpy(filename, tempLine.c_str()); - FILE* file = fopen(filename, "r"); - if (file == NULL) return; + + CInputStream stream; + stream.open(filename); + + if (!stream.is_open()) return; int rankObj = 0; int rankGadget = 0; @@ -4023,7 +4028,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) * may speed up loading */ - while (fgets(line, 500, file) != NULL) + while (stream.getline(line, 500)) { lineNum++; for (int i = 0; i < 500; i++) @@ -5062,7 +5067,7 @@ void CRobotMain::CreateScene(bool soluce, bool fixScene, bool resetObject) GetLogger()->Error("Syntax error in file '%s' (line %d): Unknown command: %s", filename, lineNum, line); // Don't add \n at the end of log message - it's included in line variable } - fclose(file); + stream.close(); if (read[0] == 0) CompileScript(soluce); // compiles all scripts |