]> code.bitgloo.com Git - clyne/gamedev.git/commitdiff
brice fix
authorClyne Sullivan <tullivan99@gmail.com>
Mon, 17 Oct 2016 13:54:02 +0000 (09:54 -0400)
committerClyne Sullivan <tullivan99@gmail.com>
Mon, 17 Oct 2016 13:54:02 +0000 (09:54 -0400)
src/brice.cpp
src/common.cpp

index de95f51e54ffa0290fe35602c24378d96891d4cb..5e7237fbff93f1a3f09d34994424422d771321f9 100644 (file)
@@ -59,6 +59,12 @@ namespace game {
 
        void briceLoad(void) {
                const char *data = readFile("brice.dat");
+
+               if (data == nullptr) {
+                       briceClear();
+                       data = readFile("brice.dat");
+               }
+
                auto datas = StringTokenizer(data, '\n');
 
                if (datas.size() != 0) {
index 26f5abc2212f9015487f767b29b9856b7194c553..01a7db87f4f632f6edc37a09fccf861cf19a3d6e 100644 (file)
@@ -117,8 +117,10 @@ const char *readFile(const char *path)
        unsigned int size;
        GLchar *buf;
 
-       if (!in.is_open())
-               UserError("Error reading file " + (std::string)path + "!");
+       if (!in.is_open()) {
+//             UserError("Error reading file " + (std::string)path + "!");
+               return nullptr;
+       }
 
        in.seekg(0,in.end);
        buf = new GLchar[(size = in.tellg()) + 1];