From 84199f8777017744bf9e2a039ae625850dab624e Mon Sep 17 00:00:00 2001 From: =?utf8?q?C=C3=B4me=20BERNIGAUD?= Date: Tue, 17 Mar 2015 23:58:45 +0100 Subject: [PATCH] =?utf8?q?Handle=20the=20case=20where=20the=20current=20ca?= =?utf8?q?mpaign=20has=20been=20deleted=20since=20last=20game.=20(or=20if?= =?utf8?q?=20it=20can=E2=80=99t=20be=20opened=20for=20some=20reason)?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Source/GameTick.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index 6d9cbe3..b216545 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -1609,6 +1609,15 @@ void LoadCampaign() if (!accountactive) return; ifstream ipstream(ConvertFileName((":Data:Campaigns:" + accountactive->getCurrentCampaign() + ".txt").c_str())); + if (!ipstream.good()) { + if (accountactive->getCurrentCampaign() == "main") { + cerr << "Could not found main campaign!" << endl; + return; + } + cerr << "Could not found campaign \"" << accountactive->getCurrentCampaign() << "\", falling back to main." << endl; + accountactive->setCurrentCampaign("main"); + return LoadCampaign(); + } ipstream.ignore(256, ':'); int numlevels; ipstream >> numlevels; -- 2.39.5