X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;ds=sidebyside;f=Source%2FGameTick.cpp;h=84a10da74e0b582f6e37e6ab0099912895165dbd;hb=efadab206c3103525a243756e388560260b4757c;hp=6d9cbe3aef3f96529fb245bafa13a66ee7216346;hpb=adaf84d76926538d8235c721169a8d8346dff87b;p=lugaru.git diff --git a/Source/GameTick.cpp b/Source/GameTick.cpp index 6d9cbe3..84a10da 100644 --- a/Source/GameTick.cpp +++ b/Source/GameTick.cpp @@ -19,6 +19,9 @@ along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ +// Enable full math definitions +#define _USE_MATH_DEFINES + #if PLATFORM_UNIX #include #include @@ -27,8 +30,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #endif + #include #include +#include #include #include "Game.h" #include "openal_wrapper.h" @@ -200,7 +205,7 @@ public: is >> mapname; is.ignore(256, ':'); is >> description; - for (unsigned pos = description.find('_'); pos != string::npos; pos = description.find('_', pos)) { + for (size_t pos = description.find('_'); pos != string::npos; pos = description.find('_', pos)) { description.replace(pos, 1, 1, ' '); } is.ignore(256, ':'); @@ -1609,6 +1614,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;