From: Clyne Sullivan Date: Mon, 17 Oct 2016 13:54:02 +0000 (-0400) Subject: brice fix X-Git-Url: https://code.bitgloo.com/?a=commitdiff_plain;h=af481dc87d12fde76d82c77b17cfaa08ef77bbd1;p=clyne%2Fgamedev.git brice fix --- diff --git a/src/brice.cpp b/src/brice.cpp index de95f51..5e7237f 100644 --- a/src/brice.cpp +++ b/src/brice.cpp @@ -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) { diff --git a/src/common.cpp b/src/common.cpp index 26f5abc..01a7db8 100644 --- a/src/common.cpp +++ b/src/common.cpp @@ -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];