blob: 540dc52a886261463dc145807db16559168c9e0d (
plain) (
blame)
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
|
#ifndef VIEWS_H_98651096
#define VIEWS_H_98651096
#include "entity.h"
#include <range/v3/all.hpp>
namespace views {
inline auto isMoving()
{
return ranges::view::filter([] (const Entity& entity) {
return entity.moving;
});
}
inline auto isNotMoving()
{
return ranges::view::filter([] (const Entity& entity) {
return !entity.moving;
});
}
inline auto isControllable()
{
return ranges::view::filter([] (const Entity& entity) {
return entity.controllable;
});
}
inline auto isTrack()
{
return ranges::view::filter([] (const Entity& entity) {
return entity.isTrack;
});
}
inline auto isScheduled()
{
return ranges::view::filter([] (const Entity& entity) {
return entity.scheduled;
});
}
inline auto isOnLayer(Layer layer)
{
return ranges::view::filter([layer] (const Entity& entity) {
return entity.layer == layer;
});
}
inline auto canBePushedBy(ColliderType ctype)
{
return ranges::view::filter([ctype] (const Entity& entity) {
return entity.canBePushedBy.count(ctype);
});
}
inline auto atGridPos(vec2s pos)
{
return ranges::view::filter([pos] (const Entity& entity) {
return entity.gridPos == pos;
});
}
inline auto isMovingTo(vec2s pos)
{
return ranges::view::filter([pos] (const Entity& entity) {
return entity.moving && entity.destPos == pos;
});
}
}
#endif /* end of include guard: VIEWS_H_98651096 */
|