Select Git revision
checkenv.py
Building.hpp 1.46 KiB
/**
* @authors Max Körschen
*/
#pragma once
#include "../core/Engine.hpp"
#include "../core/Scene.hpp"
#include "../entities/Unit.hpp"
#include <unordered_map>
namespace advanced_wars
{
class Building
{
public:
Building(int x, int y, BuildingId id, Faction faction);
void render(Engine& engine, int scale);
int getXPosition();
int getYPosition();
Faction getFaction();
BuildingId getId();
/**
Changes the faction to the specified one
@param faction The new faction the unit will belong to
@return true if building was a headquarter
*/
bool switchFaction(Faction faction);
/*
checks if the tile ontop of the building is free
*/
bool checkSpawn(std::unordered_map<int, std::unique_ptr<Unit>>& units);
/*
checks if the player has enough money for the unit to be recruited
*/
bool checkMoney(int price, int playerMoney);
/**
If the building is clicked, it shows information to the player, here it will be a list of
all available units
*/
void onClick();
/**
* Provides a vector of recruitable units, depending on the building id
*
*/
std::vector<UnitTypeId> recruitableUnits();
private:
int m_x;
int m_y;
BuildingId m_id;
Faction m_faction;
};
} // namespace advanced_wars