-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathworld.h
81 lines (57 loc) · 1.86 KB
/
world.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#ifndef WORLD_H
#define WORLD_H
#include <SFML/Graphics.hpp>
#include <vector>
#include "unit.h"
#include "hutrie.h"
#include "carrier.h"
#include "worker.h"
#include "soldier.h"
#include "warrior.h"
#include "archer.h"
#include "building.h"
#include "environment.h"
#include "goods.h"
class World
{
public:
World(sf::RenderWindow* hutrieApplication, int applicationWidth, int applicationHeight, int unitRectangleSize = 64);
virtual ~World();
std::vector<Unit*> units;
std::vector<Hutrie*> hutries;
std::vector<Carrier*> carriers;
std::vector<Soldier*> soldiers;
std::vector<Warrior*> warriors;
std::vector<Archer*> archers;
std::vector<Worker*> workers;
std::vector<Building*> buildings;
std::vector<Environment*> environment;
std::vector<unsigned int> barracksIndex;
std::vector<int> goodsBuildingIndex;
std::vector<unsigned int> forestsIndex;
std::vector<unsigned int> rocksIndex;
std::vector<unsigned int> mountainsIndex;
Goods availableGoods;
Goods generalGoods;
int availableSlots;
Unit* lastClickedUnit;
int getHorizontalUnitsCounter() { return horizontalUnitsCounter; }
int getVerticalUnitsCounter() { return verticalUnitsCounter; }
void prepareUnits(int unitIndex, int height, int width, std::vector<Unit*>* usedUnits);
bool isFieldEmpty(std::vector<Unit*> &usedUnits);
unsigned int findSelectedUnitIndex();
void increaseAvailableSlots(int addedSlotsNumber);
void createHutriesHall();
void createEnvironment();
void setStartingGoods();
void destroyElementsOfWorld();
private:
void createForest();
void createMountains();
void createRocks();
void markUnitsAround(int unitIndex, std::string environmentType);
int horizontalUnitsCounter;
int verticalUnitsCounter;
sf::RenderWindow* hutrieApplication;
};
#endif // WORLD_H