From af481dc87d12fde76d82c77b17cfaa08ef77bbd1 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Mon, 17 Oct 2016 09:54:02 -0400 Subject: brice fix --- src/brice.cpp | 6 ++++++ src/common.cpp | 6 ++++-- 2 files changed, 10 insertions(+), 2 deletions(-) (limited to 'src') 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]; -- cgit v1.2.3