/*
Copyright (C) 2003, 2010 - Wolfire Games
-Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
+Copyright (C) 2010-2017 - Lugaru contributors (see AUTHORS file)
This file is part of Lugaru.
bool campaign = false;
int actuallevel = 0;
+std::string campaignEndText[3];
std::vector<std::string> ListCampaigns()
{
std::vector<std::string> campaignNames;
while ((campaign = readdir(campaigns)) != NULL) {
std::string name(campaign->d_name);
- if (name.length() < 5)
+ if (name.length() < 5) {
continue;
+ }
if (!name.compare(name.length() - 4, 4, ".txt")) {
campaignNames.push_back(name.substr(0, name.length() - 4));
}
std::ifstream ipstream(Folders::getResourcePath("Campaigns/" + Account::active().getCurrentCampaign() + ".txt"));
if (!ipstream.good()) {
if (Account::active().getCurrentCampaign() == "main") {
- cerr << "Could not found main campaign!" << endl;
+ cerr << "Could not find main campaign!" << endl;
return;
}
- cerr << "Could not found campaign \"" << Account::active().getCurrentCampaign() << "\", falling back to main." << endl;
+ cerr << "Could not find campaign \"" << Account::active().getCurrentCampaign() << "\", falling back to main." << endl;
Account::active().setCurrentCampaign("main");
return LoadCampaign();
}
ipstream >> cl;
campaignlevels.push_back(cl);
}
+ campaignEndText[0] = "Congratulations!";
+ campaignEndText[1] = string("You have completed ") + Account::active().getCurrentCampaign() + " campaign";
+ campaignEndText[2] = "and restored peace to the island of Lugaru.";
+ if (ipstream.good()) {
+ ipstream.ignore(256, ':');
+ getline(ipstream, campaignEndText[0]);
+ getline(ipstream, campaignEndText[1]);
+ getline(ipstream, campaignEndText[2]);
+ }
ipstream.close();
std::ifstream test(Folders::getResourcePath("Textures/" + Account::active().getCurrentCampaign() + "/World.png"));