From 12c5dfd189cc5feb2d9dc51d1d69b7c1b97dbe52 Mon Sep 17 00:00:00 2001
From: Frederik <frederik@prasch.de>
Date: Mon, 10 Feb 2025 00:17:55 +0100
Subject: [PATCH] Add many doxygen comments

---
 src/game/core/Engine.hpp               |  84 ++++++++-
 src/game/core/Scene.hpp                |   6 +
 src/game/core/Spritesheet.hpp          |  34 ++--
 src/game/core/Tile.hpp                 |  22 ++-
 src/game/effect/Effect.hpp             |  33 +++-
 src/game/entities/Building.hpp         |  45 ++++-
 src/game/entities/Unit.hpp             |  61 ++++---
 src/game/level/Level.hpp               | 228 +++++++++++++++++++++----
 src/game/player/Player.hpp             |  24 ++-
 src/game/ui/TileMarker.hpp             |  63 ++++++-
 src/game/ui/context/ContextMenu.hpp    |  44 ++++-
 src/game/ui/context/RecruitingMenu.hpp |  41 ++++-
 src/game/ui/menu/EndScreen.hpp         |  27 ++-
 src/game/ui/modals/HelpMenu.hpp        |  38 +++++
 src/game/ui/modals/UnitInfoMenu.hpp    |  46 ++++-
 15 files changed, 673 insertions(+), 123 deletions(-)

diff --git a/src/game/core/Engine.hpp b/src/game/core/Engine.hpp
index 431bf01..2160398 100644
--- a/src/game/core/Engine.hpp
+++ b/src/game/core/Engine.hpp
@@ -32,35 +32,101 @@ class Config;
 class Engine
 {
     public:
+        /**
+         * Constructor
+         *
+         * @param window The window to use as main window and render
+         */
         Engine(Window& window);
 
         Engine(const Engine&) = delete;
         Engine& operator=(const Engine&) = delete;
 
+        /**
+         * Returns the state of the engine.
+         *
+         * @return true when running, false when exited
+         */
         bool exited();
 
+        /**
+         * Shut down the engine.
+         */
         void exit();
 
+        /**
+         * Handles the events of the current frame.
+         *
+         * Will give the event handler of the current scene every SDL event that occured.
+         * If the engines scene dequeue was modified since the last pump cycle this will also change
+         * the current scene.
+         */
         void pump();
 
+        /**
+         * Push a scene into the scene dequeue.
+         *
+         * @param A shared pointer to the scene to push
+         */
         void pushScene(std::shared_ptr<Scene> scene);
 
+        /**
+         * Pops a scene from the scene dequeue.
+         *
+         * @return The scene that got removed
+         */
         std::optional<std::shared_ptr<Scene>> popScene();
 
+        /**
+         * Changes the scene to the main menu.
+         */
         void returnToMenu();
 
+        /**
+         * Gets the queue of SDL events that occured.
+         *
+         * @return The dequeue of SDL events
+         */
         std::deque<SDL_Event>& events();
 
+        /**
+         * Sets this engines Spritesheet.
+         *
+         * @param spritesheet The spritesheet
+         */
         void setSpritesheet(Spritesheet& spritesheet);
 
+        /**
+         * Gets the current Spritesheet.
+         *
+         * @return The Spritesheet
+         */
         Spritesheet* getSpritesheet();
 
+        /**
+         * Gets the current stage of the engine.
+         *
+         * @return The stage
+         */
         int getStage();
 
+        /**
+         * Gets the unit config.
+         *
+         * @return The config
+         */
         Config& getUnitConfig();
 
+        /**
+         * Render the current scene.
+         */
         void render();
 
+        /**
+         * Gets the rendering context of the engine.Building
+         *
+         * @return The SDL renderer
+         */
         SDL_Renderer* renderer();
 
         void startGame(const std::string& levelPath);
@@ -70,17 +136,17 @@ class Engine
         ~Engine();
 
     private:
-        Window&                             m_window;
-        SDL_Renderer*                       m_SDLRenderer;
-        std::vector<std::shared_ptr<Scene>> m_scenes;
-        std::optional<Spritesheet*>         m_spritesheet;
-        std::deque<SDL_Event>               m_events;
+        Window&                             m_window;      // The main window
+        SDL_Renderer*                       m_SDLRenderer; // The rendering context
+        std::vector<std::shared_ptr<Scene>> m_scenes;      // The scene dequeue
+        std::optional<Spritesheet*>         m_spritesheet; // The current Spritesheet
+        std::deque<SDL_Event> m_events; // The SDL events that occured since the last pump
 
-        bool m_quit;
-        int  m_stage;
+        bool m_quit;  // Flag for quitting the engine
+        int  m_stage; // The stage for animation purposes
 
-        Config                       m_unitConfig;
-        std::unique_ptr<GameManager> m_gameManager;
+        Config                       m_unitConfig;  // Config with unit stats
+        std::unique_ptr<GameManager> m_gameManager; // The game manager
 };
 
 } // namespace advanced_wars
diff --git a/src/game/core/Scene.hpp b/src/game/core/Scene.hpp
index 35d528e..b98cca8 100644
--- a/src/game/core/Scene.hpp
+++ b/src/game/core/Scene.hpp
@@ -16,6 +16,12 @@ namespace advanced_wars
 // Forward declaration
 class Engine;
 
+/**
+ * @brief Scene Interface
+ *
+ * Everything, that can to be saved in the engines scene stack needs to be renderable and provide
+ * a function to handle SDL events in the pump step.
+ */
 class Scene
 {
     public:
diff --git a/src/game/core/Spritesheet.hpp b/src/game/core/Spritesheet.hpp
index e3c5e87..8fa1c12 100644
--- a/src/game/core/Spritesheet.hpp
+++ b/src/game/core/Spritesheet.hpp
@@ -194,36 +194,38 @@ class Spritesheet
 
     private:
         // Tiles
-        std::vector<std::pair<SDL_Texture*, int>> m_tileTextures;
+        std::vector<std::pair<SDL_Texture*, int>> m_tileTextures; // Vector of all tile Textures
 
-        int m_tileWidth;
-        int m_tileHeight;
+        int m_tileWidth;  // Width of a tile in pixels
+        int m_tileHeight; // Height of a tile in pixels
 
         // Buildings
-        std::vector<SDL_Texture*> m_buildingTextures;
+        std::vector<SDL_Texture*> m_buildingTextures; // Vector of all building textures
 
-        int m_buildingWidth;
-        int m_buildingHeight;
+        int m_buildingWidth;  // Width of a building in pixels
+        int m_buildingHeight; // Height of a building in pixels
 
         // Units
+
+        // vector of all unit textures
         std::vector<std::vector<std::vector<std::pair<SDL_Texture*, int>>>> m_unitTextures;
 
-        int m_unitWidth;
-        int m_unitHeight;
-        int m_unitMovingWidth;
-        int m_unitMovingHeight;
+        int m_unitWidth;        // Width of a unit in pixels
+        int m_unitHeight;       // Height of a unit in pixels
+        int m_unitMovingWidth;  // Width of moving unit
+        int m_unitMovingHeight; // Height of a moving unit
 
         // Effects
-        std::vector<std::pair<SDL_Texture*, int>> m_effectTextures;
+        std::vector<std::pair<SDL_Texture*, int>> m_effectTextures; // vector of all effect textures
 
-        int m_effectWidth;
-        int m_effectHeight;
+        int m_effectWidth;  // Width of an effect in pixels
+        int m_effectHeight; // Height of an effect in pixels
 
         // Numbers
-        SDL_Texture* m_numberTextures;
+        SDL_Texture* m_numberTextures; // Texture of digits 0-9
 
-        int m_numberWidth;
-        int m_numberHeight;
+        int m_numberWidth;  // Width of a digit
+        int m_numberHeight; // Height of a digit
 
         // Bullet
         SDL_Texture* m_bulletTexture;
diff --git a/src/game/core/Tile.hpp b/src/game/core/Tile.hpp
index ad00852..3b42a2c 100644
--- a/src/game/core/Tile.hpp
+++ b/src/game/core/Tile.hpp
@@ -12,18 +12,34 @@
 namespace advanced_wars
 {
 
+/**
+ * @brief Tile representation
+ */
 class Tile
 {
     public:
+        /**
+         * Constructor
+         *
+         * @param id A tileId that describes this tiles type
+         * @param x The tile-based x-position of this tile
+         * @param y The tile-based y-position of this tile
+         */
         Tile(TileId id, int x, int y);
 
+        /**
+         * Renders the tile
+         *
+         * @param engine An engine object with valid rendering context
+         * @param scale The factor to scale the rendering with
+         */
         void                 render(Engine& engine, int scale);
         [[nodiscard]] TileId getType() const;
 
     private:
-        TileId m_id;
-        int    m_x;
-        int    m_y;
+        TileId m_id; // This tiles type
+        int    m_x;  // This tiles x-position
+        int    m_y;  // This tiles y-position
 };
 
 } // namespace advanced_wars
\ No newline at end of file
diff --git a/src/game/effect/Effect.hpp b/src/game/effect/Effect.hpp
index a8e4fba..c81eb26 100644
--- a/src/game/effect/Effect.hpp
+++ b/src/game/effect/Effect.hpp
@@ -20,22 +20,45 @@ enum class EffectId
     SUBMARINE_APPEAR = 4
 };
 
+/**
+ * Representation of an effect animation
+ */
 class Effect
 {
     public:
+        /**
+         * Contructor
+         *
+         * @param x tile-based x-position
+         * @param y tile-based y-position
+         * @param id The kind of effect
+         * @param repeat Enable looping
+         */
         Effect(int x, int y, EffectId id, bool repeat);
 
+        /**
+         * Render this object.
+         *
+         * @param engine An engine object with valid rendering context
+         * @param scale The factor to scale this object with
+         */
         void render(Engine& engine, int scale);
 
+        /**
+         * Gets the state of the effect.
+         *
+         * @return ```true``` if effect rendered one full cycle or should loop,
+         * otherwise ```false```
+         */
         bool isFinished(Engine& engine);
 
     private:
-        int      m_x;
-        int      m_y;
-        EffectId m_id;
+        int      m_x;  // The tile-based x-position
+        int      m_y;  // The tile-based y-position
+        EffectId m_id; // The kind of effect
 
-        bool m_repeat;
-        int  m_start;
+        bool m_repeat; // Flag if the effect should loop
+        int  m_start;  // Starting point of the effect relevant for animation
 };
 
 } // namespace advanced_wars
diff --git a/src/game/entities/Building.hpp b/src/game/entities/Building.hpp
index 22b202c..6267af1 100644
--- a/src/game/entities/Building.hpp
+++ b/src/game/entities/Building.hpp
@@ -16,19 +16,56 @@
 namespace advanced_wars
 {
 
+/**
+ * Representation of a building
+ */
 class Building
 {
     public:
+        /**
+         * Constructor
+         *
+         * @param x The tile-based x-position
+         * @param y The tile-based y-position
+         * @param id The building type
+         * @param faction The faction of this building
+         */
         Building(int x, int y, BuildingId id, Faction faction);
 
+        /**
+         * Render the building.Building
+         *
+         * @param engine An engine object with valid rendering context
+         * @param scale The scaling factor for the current game
+         */
         void render(Engine& engine, int scale);
 
+        /**
+         * X-Position getter
+         *
+         * @return tile-based x-position
+         */
         int getXPosition();
 
+        /**
+         * Y-Position getter
+         *
+         * @return tile-based y-position
+         */
         int getYPosition();
 
+        /**
+         * Faction getter
+         *
+         * @return This building's current faction
+         */
         Faction getFaction();
 
+        /**
+         * ID getter
+         *
+         * @return This building's type
+         */
         BuildingId getId();
 
         /**
@@ -63,10 +100,10 @@ class Building
         std::vector<UnitTypeId> recruitableUnits();
 
     private:
-        int        m_x;
-        int        m_y;
-        BuildingId m_id;
-        Faction    m_faction;
+        int        m_x;       // Tile-basded x-position
+        int        m_y;       // Tile-based y-position
+        BuildingId m_id;      // Building's type
+        Faction    m_faction; // Building's faction
 };
 
 } // namespace advanced_wars
diff --git a/src/game/entities/Unit.hpp b/src/game/entities/Unit.hpp
index 1c84e1e..c9518de 100644
--- a/src/game/entities/Unit.hpp
+++ b/src/game/entities/Unit.hpp
@@ -40,16 +40,35 @@ class Unit
         /// Bewegt die Einheit zu einer neuen Position.
         void moveTo(int posX, int posY);
 
-        /// Berechnet den neuen Zustand basierend auf der Bewegungsrichtung.
+        /**
+         * Recalculates and updates the unit's state based on movement direction.
+         * Ensures that the unit faces the correct direction after a move.
+         *
+         * @param posX The x-coordinate of the desired position.
+         * @param posY The y-coordinate of the desired position.
+         */
         void calcState(int posX, int posY);
 
         /// Zerstört den Physics-Body der Einheit.
         void destroyBody();
 
-        /// Rendert die Einheit auf dem Bildschirm.
+        /**
+         * Renders the unit on the game screen.
+         * Uses the engine's rendering capabilities to draw the unit based on its state and faction.
+         *
+         * @param engine The game engine responsible for rendering.
+         * @param scale Scaling factor for rendering the unit.
+         */
         void render(Engine& engine, int scale);
 
-        /// Rendert die HP-Anzeige über der Einheit.
+        /**
+         * @brief Renders this units current HP
+         *
+         * Should only be used in the original render function of unit
+         *
+         * @param engine A engine object with valid render context
+         * @param scale The scale factor for the rendered visuals
+         */
         void renderHP(Engine& engine, int scale);
 
         // Getter-Methoden
@@ -79,28 +98,28 @@ class Unit
         void setHealth(int health) { m_health = health; }
 
     private:
-        int          m_unitId;
-        int          m_tileX;
-        int          m_tileY;
-        int          m_health;
-        int          m_cost;
-        int          m_ammo;
-        int          m_minRange;
-        int          m_maxRange;
-        int          m_maxHealth;
-        int          m_movementPoints;
-        MovementType m_movementType;
-        Faction      m_faction;
+        int m_unitId;
+        int m_tileX;     // Tile-based x-position
+        int m_tileY;     // Tile-based y-position
+        int m_health;    // Current health of the unit, initialized to max health at construction.
+        int m_cost;      // The cost to train this unit
+        int m_ammo;      // The amount of available ammo for attacks.
+        int m_minRange;  // The minimum range of the unit's attack capability.
+        int m_maxRange;  // The maximum range of the unit's attack capability.
+        int m_maxHealth; // Max health of this unit
+        int m_movementPoints;        // The number of tiles this unit can move per turn.
+        MovementType m_movementType; // The type of movement this unit has (e.g., foot, wheeled).
+        Faction      m_faction;      // The faction to which this unit belongs.
         UnitTypeId   m_unitTypeId;
         UnitState    m_state;
 
-        bool m_hasMoved = false;
-        bool m_hasAttacked = false;
-        bool m_isSelected = false;
-        bool m_isTargeted = false;
+        bool m_hasMoved = false;    // Indicates whether the unit has moved this turn.
+        bool m_hasAttacked = false; // Indicates whether the unit has attacked this turn.
+        bool m_isSelected = false;  // Indicates whether the unit is currently selected.
+        bool m_isTargeted = false;  // Indicates whether the unit is currently targeted by an enemy.
 
-        std::unique_ptr<Weapon> m_primaryWeapon;
-        std::unique_ptr<Weapon> m_secondaryWeapon;
+        std::unique_ptr<Weapon> m_primaryWeapon;   // The unit's secondary weapon.
+        std::unique_ptr<Weapon> m_secondaryWeapon; // The unit's primary weapon.
 
         std::unique_ptr<PhysicsBody> m_physicsBody;
         b2World*                     m_world;
diff --git a/src/game/level/Level.hpp b/src/game/level/Level.hpp
index c184f84..28b5336 100644
--- a/src/game/level/Level.hpp
+++ b/src/game/level/Level.hpp
@@ -35,9 +35,10 @@
 namespace advanced_wars
 {
 
-const int NUM_TILE_IDS = 30; // Aktualisieren, falls weitere IDs hinzugefügt werden
-const int NUM_MOVEMENT_TYPES = 6;
+const int NUM_TILE_IDS = 30;      // update if more tiles are implemented
+const int NUM_MOVEMENT_TYPES = 6; // number of different movement types
 
+// Table describing the movement cost of a movement type to get to a given tile
 const std::array<std::array<int, NUM_MOVEMENT_TYPES>, NUM_TILE_IDS> MOVE_COST_TABLE = {
     {
      // FOOT, WHEELED, TREAD, AIR, SEA, LANDER
@@ -90,6 +91,18 @@ enum class LevelState
 class Level : public Scene
 {
     public:
+        /**
+         * Constructor
+         *
+         * @param name String of the level name
+         * @param width Width of the level in tiles
+         * @param height Height of the level in tiles
+         * @param tiles Vector of the levels tiles
+         * @param buildings Vector of the levels buildings
+         * @param units Vector of the levels starting units
+         * @param effects Vector of the levels starting effects
+         * @param turnQ Vector of Players that will play this level
+         */
         Level(const std::string& path, Engine& engine);
 
         // std::shared_ptr<Level> loadLevel(
@@ -114,44 +127,188 @@ class Level : public Scene
                 button left ->  select field/building/unit/
                                 move to position
         */
+
+        /**
+         * Handle events relevant to this scene.
+         *
+         * @param engine An engine object with valid render context and unit config
+         * @param event The SDL event to handle
+         */
         void handleEvent(Engine& engine, SDL_Event& event) override;
 
+        /**
+         * Add a building to this levels map with a unique id.
+         *
+         * @param building The building to add
+         *
+         * @return The unique id of the building added
+         */
         int addBuilding(Building building);
 
+        /**
+         * Remove a building from this levels map.
+         *
+         * @param id The unique id of the building to remove
+         *
+         * @return The building object that was removed
+         */
         Building removeBuilding(int id);
 
+        /**
+         * Add a unit to this levels map.
+         *
+         * @param unit The unit to add
+         *
+         * @return The unique id of the unit added
+         */
         void addUnit(
             int tileX, int tileY, Faction factionId, UnitTypeId unitTypeId, UnitState unitState,
             Config& config);
 
+        /**
+         * Remove a unit from this levels map.
+         *
+         * @param id The unique id of the unit to remove
+         *
+         * @return The unit object that was removed
+         */
         void removeUnit(int id);
 
+        /**
+         * Add an effect to this levels map.
+         *
+         * @param effect The effect to add
+         *
+         * @return The unique id of the effect added
+         */
         int addEffect(Effect effect);
 
+        /**
+         * Remove an effect from this levels map.
+         *
+         * @param id The unique id of the effect to remove
+         *
+         * @return The effect object that was removed
+         */
         Effect removeEffect(int id);
 
         std::vector<std::pair<int, int>> calculateMovementRange(Unit& unit);
 
+        /**
+         * Returns the movement cost of a given tile.
+         *
+         * @param type The tile type to move to
+         * @param movementType The movementType of the the unit to move
+         *
+         * @return The calculated movement cost
+         */
         int getMoveCost(TileId type, MovementType movementType);
 
         std::pair<int, int> calcTilePos(int mouseX, int mouseY);
-        void                selectEntity(int x, int y);
-        int                 selectUnit(int tileX, int tileY);
-        int                 selectBuilding(int tileX, int tileY);
 
+        /**
+         * @brief Selects the entity at the given position.
+         *
+         * Sets m_selectedUnit or m_selectedBuilding of this level
+         * to the unique id of the entity at (x,y).
+         * Units get preferred if both are on the same position.
+         *
+         * @param x The tile-based x-position
+         * @param y The tile-based y-position
+         */
+        void selectEntity(int x, int y);
+
+        /**
+         * Selects the unit at the given position.
+         *
+         * @param tileX The x-position
+         * @param tileY the y-position
+         *
+         * @return The unique id of the unit or ```-1``` if none was found
+         */
+        int selectUnit(int tileX, int tileY);
+
+        /**
+         * Selects the building at the given position.
+         *
+         * @param tileX The x-position
+         * @param tileY the y-position
+         *
+         * @return The unique id of the building or ```-1``` if none was found
+         */
+        int selectBuilding(int tileX, int tileY);
+
+        /**
+         * Helper function that gets called when in the SELECTING state
+         *
+         * @param engine An engine object with valid rendering context and config
+         * @param event The SDL event to handle
+         */
         void handleSelectingEvents(Engine& engine, SDL_Event& event);
+
+        /**
+         * Helper function that gets called when in the MENUACTIVE state
+         *
+         * @param engine An engine object with valid rendering context and config
+         * @param event The SDL event to handle
+         */
         void handleMenuActiveEvents(Engine& engine, SDL_Event& event);
+
+        /**
+         * Helper function that gets called when in the MOVEMENT state
+         *
+         * @param engine An engine object with valid rendering context and config
+         * @param event The SDL event to handle
+         */
         void handleMovementEvents(Engine& engine, SDL_Event& event);
+
+        /**
+         * Helper function that gets called when in the ATTACKING state
+         *
+         * @param engine An engine object with valid rendering context and config
+         * @param event The SDL event to handle
+         */
         void handleAttackingEvents(Engine& engine, SDL_Event& event);
+
+        /**
+         * Helper function that gets called when in the RECRUITING state
+         *
+         * @param engine An engine object with valid rendering context and config
+         * @param event The SDL event to handle
+         */
         void handleRecruitingEvent(Engine& engine, SDL_Event& event);
 
         bool clickCheckLeft(int mouseX, int mouseY);
         bool clickCheckRight(int mouseX, int mouseY);
 
+        /**
+         * @brief Changes the turn between this levels players.
+         *
+         * This will call the functions of the players to end the turn and setup the next.
+         * After this the front Player in m_turnQ will be the next active player.
+         */
         void changeTurn();
 
+        /**
+         * Helper function that gets called when trying to attack a unit
+         *
+         * @param tilePos (x,y) tile position of the unit to attack
+         */
         void handleAttack(std::pair<int, int> tilePos);
+
+        /**
+         * Helper function that gets called when trying to move
+         *
+         * @param tilePos (x,y) tile position of the tile to move to
+         */
         void handleMovement(std::pair<int, int> tilePos);
+
+        /**
+         * Event Handler for the Cursor
+         *
+         * @param engine An engine object with valid rendering context
+         * @param event The SDL event to handle
+         */
         void handlePositionMarker(Engine& engine, SDL_Event& event);
 
         std::unordered_map<int, std::unique_ptr<Unit>>& getUnits() { return m_units; }
@@ -170,36 +327,37 @@ class Level : public Scene
         void spawnBullet(Unit& attacker, Unit& target);
 
     private:
-        bool                                           m_gameOver = false;
-        std::string                                    m_name;
-        int                                            m_width = 0;
-        int                                            m_height = 0;
-        std::vector<Tile>                              m_tiles;
-        std::unordered_map<int, Building>              m_buildings;
-        std::unordered_map<int, std::unique_ptr<Unit>> m_units;
-        int                                            m_unitIdIterator = 5;
-        std::vector<std::pair<int, int>>               m_reachableTiles;
-        std::vector<std::pair<int, int>>               m_attackableTiles;
-        std::unordered_map<int, Effect>                m_effects;
-        std::unique_ptr<Bullet>                        m_bullet;
-        std::queue<Player>                             m_turnQ;
-
-        int                            m_selectedUnit;
-        int                            m_selectedBuilding;
-        int                            m_captureBuilding;
-        ContextMenu                    m_contextMenu;
-        RecruitingMenu                 m_recruitingMenu;
-        bool                           m_toggleHelpmenu = false;
-        HelpMenu                       m_helpMenu;
-        int                            m_id;
-        LevelState                     m_state;
-        TileMarker                     m_currentPos;
-        bool                           m_showReachableTiles = false;
-        bool                           m_showAttackableTiles = false;
-        std::unordered_set<int>        m_attackableUnitIds;
-        UnitInfoMenu                   m_unitInfoMenu;
-        bool                           m_showUnitInfoMenu = false;
-        std::pair<int, int>            m_unitFallbackPosition;
+        bool                              m_gameOver = false; // toggles game end screen
+        std::string                       m_name;             // name of the level
+        int                               m_width = 0;        // width of the level
+        int                               m_height = 0;       // height of the level
+        std::vector<Tile>                 m_tiles;            // vector of all floor tiles
+        std::unordered_map<int, Building> m_buildings; // map of buildings with unique ids as key
+        std::unordered_map<int, std::unique_ptr<Unit>>
+                                         m_units; // map of units with unique ids as key
+        int                              m_unitIdIterator = 5;
+        std::vector<std::pair<int, int>> m_reachableTiles;
+        std::vector<std::pair<int, int>> m_attackableTiles;
+        std::unordered_map<int, Effect>  m_effects; // map of units with unique ids as key
+        std::unique_ptr<Bullet>          m_bullet;
+        std::queue<Player>               m_turnQ; // player turn order, front is currently active
+
+        int                     m_selectedUnit;     // unique id of the currently selcted unit
+        int                     m_selectedBuilding; // unique id of the currently selected building
+        int                     m_captureBuilding;
+        ContextMenu             m_contextMenu;            // A contextMenu when selecting something
+        RecruitingMenu          m_recruitingMenu;         // Menu when trying to train new units
+        bool                    m_toggleHelpmenu = false; // toggles tutorial screen
+        HelpMenu                m_helpMenu;               // The Tutorial screen
+        int                     m_id;
+        LevelState              m_state;      // Indicates current state of the level
+        TileMarker              m_currentPos; // Cursor for controlling the game
+        bool                    m_showReachableTiles = false;  // toggles tiles to move to
+        bool                    m_showAttackableTiles = false; // toggles tiles to be able to attack
+        std::unordered_set<int> m_attackableUnitIds;           // Ids of attackable units
+        UnitInfoMenu            m_unitInfoMenu;                // Info menu for units
+        bool                    m_showUnitInfoMenu = false;    // toggles unit info menu
+        std::pair<int, int> m_unitFallbackPosition; // fallback position if movement gets canceled
         std::unique_ptr<PhysicsEngine> m_physicsEngine;
         std::unique_ptr<CombatEngine>  m_combatEngine;
         Uint32                         m_lastFrameTime = 0;
diff --git a/src/game/player/Player.hpp b/src/game/player/Player.hpp
index 03eea58..9f33084 100644
--- a/src/game/player/Player.hpp
+++ b/src/game/player/Player.hpp
@@ -18,6 +18,12 @@ class Player
 {
 
     public:
+        /**
+         * Constructor
+         *
+         * @param money The players starting money
+         * @param faction The faction this player will command
+         */
         Player(int money, Faction faction);
         ~Player();
 
@@ -40,17 +46,27 @@ class Player
          */
         void endTurn(std::unordered_map<int, std::unique_ptr<Unit>>& lvUnits);
 
+        /**
+         * @return This players faction
+         */
         Faction getFaction();
 
+        /**
+         * @return This players current money
+         */
         int getMoney();
 
+        /**
+         * Decreses this players money by the given amount.
+         * @param toSpend The money to subtract
+         */
         void spendMoney(int toSpend);
 
     private:
-        int     m_money;
-        bool    m_alive;
-        bool    m_activeTurn;
-        Faction m_faction;
+        int     m_money;      // The players current amound of money
+        bool    m_alive;      // Signals if the player is alive or not
+        bool    m_activeTurn; // Signals if this player is currently the active player
+        Faction m_faction;    // The players commanding faction
 };
 
 } // namespace advanced_wars
diff --git a/src/game/ui/TileMarker.hpp b/src/game/ui/TileMarker.hpp
index 0c06fb5..bac92c4 100644
--- a/src/game/ui/TileMarker.hpp
+++ b/src/game/ui/TileMarker.hpp
@@ -12,29 +12,76 @@ namespace advanced_wars
 class TileMarker : public Scene
 {
     public:
+        /**
+         * Constructor
+         *
+         * Creates a Marker at the given postion.
+         * Needs the boundaries of the level to not step out of them.
+         *
+         * @param renderingScale The rendering scale for the current game
+         * @param tileX The tile-based x-postion where the Marker should start
+         * @param tileY The tile-based y-position where the Marker should start
+         * @param levelWidth The width of the level
+         * @param levelHeight The height of the level
+         */
         TileMarker(int renderingScale, int tileX, int tileY, int levelWidth, int levelHeight);
         TileMarker() = default;
 
+        /**
+         * Render this object
+         *
+         * @param engine An engine object with valid rendering context
+         */
         void render(Engine& engine) override;
 
+        /**
+         * Event Handler for the tile marker
+         *
+         * @param engine An engine object with valid rendering context
+         * @param event The SDL event to handle
+         */
         void handleEvent(Engine& engine, SDL_Event& event) override;
 
+        /**
+         * Position getter
+         *
+         * @return The current position as pair
+         */
         std::pair<int, int> getPosition();
 
+        /**
+         * Position setter
+         *
+         * @param x new x-position
+         * @param y new y-position
+         */
         void setPosition(int x, int y);
 
+        /**
+         * Sets the color of the marker to correspond to the active faction.
+         *
+         * @param faction The faction of which to take the color from
+         */
         void setMarkerColor(Faction faction);
 
+        /**
+         * Sets the outer bounds for the tilemarker.
+         *
+         * Normally this will be the same as the level
+         *
+         * @param width The maximum width
+         * @param height The maximum height
+         */
         void setBounds(int width, int height);
 
     private:
-        int       m_x;
-        int       m_y;
-        int       m_renderingScale;
-        int       m_width;
-        int       m_height;
-        int       m_levelHeight;
-        int       m_levelWidth;
-        SDL_Color m_markerColor;
+        int       m_x;              // x-position
+        int       m_y;              // y-position
+        int       m_renderingScale; // rendering scale, has to be same as the level
+        int       m_width;          // width of the marker (normally same as tile)
+        int       m_height;         // height of the marker (normally same as tile)
+        int       m_levelHeight;    // height of the overlying level
+        int       m_levelWidth;     // width of the overlying level
+        SDL_Color m_markerColor;    // The color of the Marker
 };
 } // namespace advanced_wars
diff --git a/src/game/ui/context/ContextMenu.hpp b/src/game/ui/context/ContextMenu.hpp
index 871147a..e165f52 100644
--- a/src/game/ui/context/ContextMenu.hpp
+++ b/src/game/ui/context/ContextMenu.hpp
@@ -14,29 +14,65 @@
 namespace advanced_wars
 {
 
+/**
+ * A context menu in the game
+ */
 class ContextMenu : public Scene
 {
     public:
+        /**
+         * Constructor
+         */
         ContextMenu();
 
+        /**
+         * Sets this menus options.
+         *
+         * @param A string vector containing the options
+         */
         void setOptions(const std::vector<std::string>& newOptions);
 
+        /**
+         * Render the menu.
+         *
+         * @param engine An engine object with valid rendering context
+         */
         void render(Engine& engine) override;
 
+        /**
+         * Event handler for the menu.
+         *
+         * @param engine An engine object with valid rendering context
+         * @param event The SDL event to handle
+         */
         void handleEvent(Engine& engine, SDL_Event& event) override;
 
+        /**
+         * Sets this menus new position.
+         *
+         * @param x The new x-position
+         * @param y The new y-position
+         */
         void update(int x, int y);
 
+        /**
+         * Gets the currently selected option
+         *
+         * @return The option as string
+         */
         std::string getSelectedOption();
 
+        /**
+         * Destructor
+         */
         ~ContextMenu();
 
     private:
-        std::vector<std::string> m_options;
-        size_t                   m_selectedOption;
+        std::vector<std::string> m_options;        // vector of all options
+        size_t                   m_selectedOption; // The currently selected option
 
-        int m_x;
-        int m_y;
+        int m_x; // x-position
+        int m_y; // y-position
 };
 
 } // namespace advanced_wars
diff --git a/src/game/ui/context/RecruitingMenu.hpp b/src/game/ui/context/RecruitingMenu.hpp
index 8ff1321..d84b5d3 100644
--- a/src/game/ui/context/RecruitingMenu.hpp
+++ b/src/game/ui/context/RecruitingMenu.hpp
@@ -14,26 +14,53 @@ class RecruitingMenu : public Scene
 {
 
     public:
+        /**
+         * Returns the selected Unit
+         *
+         * @return The currently selected UnitId
+         */
         UnitTypeId getSelectedOption();
 
+        /**
+         * Event handler
+         *
+         * @param engine An engine object with valid rendering context
+         * @param event The SDL event to handle
+         */
         void handleEvent(Engine& engine, SDL_Event& event) override;
 
+        /**
+         * Adjusts the position of the menu
+         */
         void update(int x, int y);
 
+        /**
+         * Constructor
+         */
         RecruitingMenu();
 
+        /**
+         * Sets the menu options
+         *
+         * @param recruitableUnits A vector of recuitable units to show
+         */
         void setOptions(const std::vector<UnitTypeId> recruitableUnits);
 
+        /**
+         * Render the menu
+         *
+         * @param engine An engine object with valid rendering context
+         */
         void render(Engine& engine) override;
 
     private:
-        size_t                                            m_selectedOption;
-        std::vector<UnitTypeId>                           m_options;
-        int                                               m_x;
-        int                                               m_y;
-        const std::unordered_map<UnitTypeId, std::string> m_unitNames;
-        std::unordered_map<int, UnitTypeId>               m_cost2UnitId;
-        UnitTypeId                                        m_selectedId;
+        size_t                  m_selectedOption;                    // Currently selected option
+        std::vector<UnitTypeId> m_options;                           // All available options
+        int                     m_x;                                 // x-position
+        int                     m_y;                                 // y-position
+        const std::unordered_map<UnitTypeId, std::string> unitNames; // maps UnitIds to unnits name
+        std::unordered_map<int, UnitTypeId>               cost2UnitId;  // maps cost to unitIds
+        UnitTypeId                                        m_selectedId; // Currently selected Unit
 
         void selectSprite();
 };
diff --git a/src/game/ui/menu/EndScreen.hpp b/src/game/ui/menu/EndScreen.hpp
index 8fc428a..a2a034a 100644
--- a/src/game/ui/menu/EndScreen.hpp
+++ b/src/game/ui/menu/EndScreen.hpp
@@ -5,18 +5,39 @@
 
 namespace advanced_wars
 {
+
+/**
+ * End of Game Screen displaying some info and an option to go back to the menu
+ */
 class Endscreen : public Scene
 {
     public:
+        /**
+         * Constructor
+         *
+         * @param player The winning player
+         */
         Endscreen(Player& player);
+
+        /**
+         * Render the scene
+         *
+         * @param engine An engine object with valid rendering context
+         */
         void render(Engine& engine) override;
 
+        /**
+         * Event handler
+         *
+         * @param engine An engine object with valid rendering context
+         * @param event The SDL event to handle
+         */
         void handleEvent(Engine& engine, SDL_Event& event) override;
 
     private:
-        SDL_Color   m_color;
-        int         m_moenyLeft;
-        std::string m_playerString;
+        SDL_Color   m_color;        // Color for the end-screen (changes based on player)
+        int         m_moenyLeft;    // Money still in possession by the winning player
+        std::string m_playerString; // The players faction in string form
 };
 
 } // namespace advanced_wars
diff --git a/src/game/ui/modals/HelpMenu.hpp b/src/game/ui/modals/HelpMenu.hpp
index c1e9aae..f8ac38d 100644
--- a/src/game/ui/modals/HelpMenu.hpp
+++ b/src/game/ui/modals/HelpMenu.hpp
@@ -10,16 +10,33 @@
 namespace advanced_wars
 {
 
+/**
+ * A tutorial window to look at the rules of the game
+ */
 class HelpMenu : public Scene
 {
 
     public:
+        /**
+         * Event handler
+         *
+         * @param engine An engine object with valid rendering context
+         * @param event The SDL event to handle
+         */
         void handleEvent(Engine& engine, SDL_Event& event);
 
         void update(int x, int y);
 
+        /**
+         * Constructor
+         */
         HelpMenu();
 
+        /**
+         * Render the scene
+         *
+         * @param engine An engine object with valid rendering context
+         */
         void render(Engine& engine) override;
 
     private:
@@ -28,10 +45,31 @@ class HelpMenu : public Scene
         int                                      m_x;
         int                                      m_y;
 
+        /**
+         * Renders the given text at the given position in the box
+         *
+         * @param engine An engine object with valid rendering context
+         * @param text The text to render
+         * @param font The TTF font to use to render the text
+         * @param color The SDL color of the text
+         * @param boxWidth Width of the textbox to render into
+         * @param text_x x-starting position of the text
+         * @param text_y y-starting position of the text
+         */
         void renderTextPortion(
             Engine& engine, std::string text, TTF_Font* font, SDL_Color color, int boxWidth,
             int textX, int textY);
 
+        /**
+         * Renders the given texture at the desired destination
+         *
+         * @param texture The SDL texture to use for rendering
+         * @param engine An engine object with valid rendering context
+         * @param x The x-position where to render to
+         * @param y The y-position where to render to
+         * @param src_x The x-position in the texture
+         * @param src_y The y-position in the texture
+         */
         void renderTexture(SDL_Texture* texture, Engine& engine, int x, int y, int srcX, int srcY);
 };
 
diff --git a/src/game/ui/modals/UnitInfoMenu.hpp b/src/game/ui/modals/UnitInfoMenu.hpp
index 6058ca1..7749f89 100644
--- a/src/game/ui/modals/UnitInfoMenu.hpp
+++ b/src/game/ui/modals/UnitInfoMenu.hpp
@@ -13,23 +13,61 @@
 namespace advanced_wars
 {
 
+/**
+ * Menu to show infos and stats for a Unit
+ */
 class UnitInfoMenu : public Scene
 {
     public:
+        /**
+         * Constructor
+         */
         UnitInfoMenu();
+
+        /**
+         * Event Handler
+         *
+         * @param engine An engine object with valid rendering context
+         * @param event The SDL event to handle
+         */
         void handleEvent(Engine& engine, SDL_Event& event) override;
 
+        /**
+         * Sets the unit to show stats for
+         *
+         * @param unit The unit
+         */
         void setUnit(Unit& unit);
+
+        /**
+         * Renders the menu
+         *
+         * @param An engine object with valid rendering context
+         */
         void render(Engine& engine) override;
+
+        /**
+         * Sets position of menu
+         *
+         * @param x The new x-position
+         * @param y The new y-position
+         */
         void update(int x, int y);
 
     private:
         const int RENDERING_SCALE = 3;
-        int       m_x;
-        int       m_y;
-        Unit*     m_currentUnit;
-        bool      m_isVisible;
+        int       m_x;           // x-position
+        int       m_y;           // y-position
+        Unit*     m_currentUnit; // Current Unit to show stats for
+        bool      m_isVisible;   // Visibility toggle
 
+        /**
+         * Gets string from MovementType
+         *
+         * @param type A movementType
+         *
+         * @return The string describing the movement type
+         */
         std::string getMovementTypeString(MovementType type);
 };
 } // namespace advanced_wars
-- 
GitLab