2021-03-22 19:37:34 +03:00
|
|
|
#include <utility>
|
|
|
|
|
#include <cstdint>
|
|
|
|
|
#include "cell.hpp"
|
2021-04-12 01:51:12 +03:00
|
|
|
#include "../game_map.hpp"
|
2021-03-22 19:37:34 +03:00
|
|
|
|
2021-03-24 20:31:44 +03:00
|
|
|
#pragma once
|
2021-03-22 19:37:34 +03:00
|
|
|
|
|
|
|
|
namespace map {
|
2021-03-24 20:31:44 +03:00
|
|
|
class UnitObj { // may be useless
|
2021-03-22 19:37:34 +03:00
|
|
|
private:
|
2021-03-24 20:31:44 +03:00
|
|
|
using Coord = std::pair<int32_t, int32_t>;
|
|
|
|
|
Coord pos;
|
2021-05-18 17:43:03 +03:00
|
|
|
Coord size;
|
|
|
|
|
GameMap* gameMap;
|
|
|
|
|
Cell cellPrototype;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Coord getEndPos() {
|
|
|
|
|
return {pos.first + size.first,
|
|
|
|
|
pos.second + size.second};
|
|
|
|
|
}
|
2021-03-22 19:37:34 +03:00
|
|
|
public:
|
2021-05-18 17:43:03 +03:00
|
|
|
UnitObj() = default;
|
2021-04-12 01:51:12 +03:00
|
|
|
UnitObj(const Coord& pos, const Coord& size,
|
2021-05-18 17:43:03 +03:00
|
|
|
const CellType& cellType,
|
|
|
|
|
const CellPlayer& cellPlayer, GameMap* gameMap) :
|
|
|
|
|
pos(pos), size(size), gameMap(gameMap),
|
|
|
|
|
cellPrototype(cellType, cellPlayer) {}
|
2021-03-22 19:37:34 +03:00
|
|
|
|
2021-05-18 17:43:03 +03:00
|
|
|
void resize(Coord newSize);
|
|
|
|
|
|
|
|
|
|
void move(Coord newPos);
|
|
|
|
|
|
|
|
|
|
void setPlayer(int player);
|
|
|
|
|
|
|
|
|
|
void setCellType(int cellType);
|
2021-03-22 19:37:34 +03:00
|
|
|
};
|
|
|
|
|
}
|