Skip to content
Snippets Groups Projects
Commit 63fa5a76 authored by Frederik's avatar Frederik
Browse files

Fix problems from merge

parent 7bca314e
No related branches found
No related tags found
2 merge requests!33Win end screen,!29Merge main into box2d to implement physics
......@@ -7,8 +7,8 @@
#include "Unit.hpp"
#include "highfive/H5File.hpp"
#include "ui/Contextmenu.hpp"
#include "ui/Pausemenu.hpp"
#include "ui/Helpmenu.hpp"
#include "ui/Pausemenu.hpp"
#include <SDL.h>
#include <algorithm>
#include <boost/property_tree/ptree.hpp>
......@@ -179,8 +179,10 @@ int Level::selectBuilding(int tileX, int tileY)
void Level::handleEvent(Engine& engine, SDL_Event& event)
{
if (event.type == SDL_KEYDOWN) {
if (event.key.keysym.sym == SDLK_h) {
if (event.type == SDL_KEYDOWN)
{
if (event.key.keysym.sym == SDLK_h)
{
toggle_Helpmenu = !toggle_Helpmenu;
}
}
......@@ -355,10 +357,10 @@ void Level::render(Engine& engine)
}
m_currentPos.render(engine);
if(toggle_Helpmenu) {
if (toggle_Helpmenu)
{
m_helpMenu.render(engine);
}
}
int Level::addBuilding(Building building)
......@@ -420,6 +422,7 @@ void Level::changeTurn()
m_turnQ.push(temp);
m_turnQ.front().startTurn(m_units, m_buildings);
m_currentPos.setMarkerColor(m_turnQ.front().getFaction());
}
void Level::handleRecruitingEvent(Engine& engine, SDL_Event& event)
......
......@@ -11,23 +11,23 @@ Endscreen::Endscreen(Player& player) : m_moenyLeft(player.getMoney())
std::cout << "Player faction: " << static_cast<int>(player.getFaction()) << std::endl;
switch (player.getFaction())
{
case PlayerFaction::BLUE:
case UnitFaction::UBLUE:
m_color = {0, 0, 255, 255};
m_playerString = "Blue";
break;
case PlayerFaction::GREEN:
case UnitFaction::UGREEN:
m_color = {0, 255, 0, 255};
m_playerString = "Green";
break;
case PlayerFaction::PURPLE:
case UnitFaction::UPURPLE:
m_color = {255, 0, 255, 255};
m_playerString = "Purple";
break;
case PlayerFaction::RED:
case UnitFaction::URED:
m_color = {255, 0, 0, 255};
m_playerString = "Red";
break;
case PlayerFaction::YELLOW:
case UnitFaction::UYELLOW:
m_color = {255, 255, 0, 255};
m_playerString = "Yellow";
break;
......@@ -118,13 +118,7 @@ void Endscreen::handleEvent(Engine& engine, SDL_Event& event)
{
if (event.key.keysym.sym == SDLK_RETURN)
{
std::string basePath = SDL_GetBasePath();
std::string relativePath = "res/main_background.png";
std::string fullPath = basePath + relativePath;
std::shared_ptr<Menu> menu = std::make_shared<Menu>(Menu(0));
menu->loadBackground(engine, fullPath);
engine.pushScene(menu);
engine.returnToMenu();
}
}
} // namespace advanced_wars
......@@ -89,23 +89,23 @@ void TileMarker::setPosition(int tileX, int tileY)
m_y = tileY * 16 * m_renderingScale + (16 * m_renderingScale - m_height);
}
void TileMarker::setMarkerColor(PlayerFaction faction)
void TileMarker::setMarkerColor(UnitFaction faction)
{
switch (faction)
{
case PlayerFaction::RED:
case UnitFaction::URED:
m_markerColor = {255, 0, 0, 255};
break;
case PlayerFaction::BLUE:
case UnitFaction::UBLUE:
m_markerColor = {0, 0, 255, 255};
break;
case PlayerFaction::GREEN:
case UnitFaction::UGREEN:
m_markerColor = {0, 255, 0, 255};
break;
case PlayerFaction::YELLOW:
case UnitFaction::UYELLOW:
m_markerColor = {255, 255, 0, 255};
break;
case PlayerFaction::PURPLE:
case UnitFaction::UPURPLE:
m_markerColor = {255, 0, 255, 255};
break;
default:
......
......@@ -22,7 +22,7 @@ class TileMarker : public Scene
void setPosition(int x, int y);
void setMarkerColor(PlayerFaction faction);
void setMarkerColor(UnitFaction faction);
private:
int m_x;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment