-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathBuilding.cpp
55 lines (42 loc) · 1.07 KB
/
Building.cpp
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
#include <algorithm>
#include "Building.h"
using namespace Sourcehold::Game;
using namespace Sourcehold::Rendering;
Building::Building(uint32_t mw, uint32_t mh)
: px(0), py(0), mapW(mw), mapH(mh) {
}
Building::Building(std::weak_ptr<Gm1File> file, uint32_t x, uint32_t y,
uint32_t mw, uint32_t mh)
: gm1(file.lock()), px(0), py(0), mapW(mw), mapH(mh) {
PlaceAt(x, y);
}
Building::~Building() {
}
void Building::Preview(uint32_t x, uint32_t y) {
}
void Building::PlaceAt(uint32_t x, uint32_t y) {
px = x;
py = y;
placed = true;
}
void Building::MoveTo(uint32_t x, uint32_t y) {
px = x;
py = y;
}
void Building::Unload() {
gm1.reset();
loaded = false;
}
void Building::Render() {
}
bool Building::CanWalkOn(uint32_t x, uint32_t y) {
uint32_t const index = CoordToLocalIndex(x, y);
return std::find(begin(walkableTiles), end(walkableTiles), index) !=
end(walkableTiles);
}
uint32_t Building::CoordToGlobalIndex(uint32_t x, uint32_t y) {
return 0;
}
uint32_t Building::CoordToLocalIndex(uint32_t x, uint32_t y) {
return 0;
}