X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FLevel%2FCampaign.cpp;h=0ff7392de00f3d8198999893e3ad2d2b5198a183;hb=8b6e8f3ad7390309795eb35c0959264cb7924402;hp=2aa5f176a8af91d8f3f8ab5665d9afa3f785f12d;hpb=b84825978803615f45a9f128232e62431042aec0;p=lugaru.git
diff --git a/Source/Level/Campaign.cpp b/Source/Level/Campaign.cpp
index 2aa5f17..0ff7392 100644
--- a/Source/Level/Campaign.cpp
+++ b/Source/Level/Campaign.cpp
@@ -18,9 +18,10 @@ You should have received a copy of the GNU General Public License
along with Lugaru. If not, see .
*/
-#include "Game.h"
-#include "Level/Campaign.h"
-#include "Utils/Folders.h"
+#include "Level/Campaign.hpp"
+
+#include "Game.hpp"
+#include "Utils/Folders.hpp"
#include
@@ -35,8 +36,8 @@ int actuallevel = 0;
std::vector ListCampaigns()
{
errno = 0;
- DIR *campaigns = opendir(Folders::getResourcePath("Campaigns").c_str());
- struct dirent *campaign = NULL;
+ DIR* campaigns = opendir(Folders::getResourcePath("Campaigns").c_str());
+ struct dirent* campaign = NULL;
if (!campaigns) {
perror(("Problem while loading campaigns from " + Folders::getResourcePath("Campaigns")).c_str());
exit(EXIT_FAILURE);
@@ -93,42 +94,49 @@ void LoadCampaign()
}
}
-CampaignLevel::CampaignLevel() :
- width(10),
- choosenext(1)
+CampaignLevel::CampaignLevel()
+ : width(10)
+ , choosenext(1)
{
location.x = 0;
location.y = 0;
}
-int CampaignLevel::getStartX() {
+int CampaignLevel::getStartX()
+{
return 30 + 120 + location.x * 400 / 512;
}
-int CampaignLevel::getStartY() {
+int CampaignLevel::getStartY()
+{
return 30 + 30 + (512 - location.y) * 400 / 512;
}
-int CampaignLevel::getEndX() {
+int CampaignLevel::getEndX()
+{
return getStartX() + width;
}
-int CampaignLevel::getEndY() {
+int CampaignLevel::getEndY()
+{
return getStartY() + width;
}
-XYZ CampaignLevel::getCenter() {
+XYZ CampaignLevel::getCenter()
+{
XYZ center;
center.x = getStartX() + width / 2;
center.y = getStartY() + width / 2;
return center;
}
-int CampaignLevel::getWidth() {
+int CampaignLevel::getWidth()
+{
return width;
}
-istream& CampaignLevel::operator<< (istream& is) {
+istream& CampaignLevel::operator<<(istream& is)
+{
is.ignore(256, ':');
is.ignore(256, ':');
is.ignore(256, ' ');