Skip to content
Snippets Groups Projects
Select Git revision
  • 5d73867a935885f24f53abbf93a24fe7eb1f3c0a
  • main default protected
  • nour2
  • aleks4
  • geno2
  • petri-net-output
  • nour
  • deep-rl-1
  • geno3
  • paula
  • aleks2
  • aleks3
  • Nour
  • geno
  • aleks
15 results

checkenv.py

Blame
  • 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