1 | #ifndef TRAITS_H__ |
1 | #ifndef TRAITS_H__ |
2 | #define TRAITS_H__ |
2 | #define TRAITS_H__ |
3 | |
3 | |
4 | struct pl; |
4 | struct player; |
5 | struct object; |
5 | struct object; |
6 | struct mapstruct; |
6 | struct maptile; |
7 | struct archt; |
7 | struct archetype; |
8 | struct region; |
8 | struct region; |
9 | struct party; |
9 | struct party; |
10 | struct mapstruct; |
10 | struct treasurelist; |
11 | |
11 | |
12 | // could have used templates, but a more traditional C api |
12 | // could have used templates, but a more traditional C api |
13 | // uses more explicit typing which is ok for this purpose. |
13 | // uses more explicit typing which is ok for this purpose. |
14 | enum data_type |
14 | enum data_type |
15 | { |
15 | { |
… | |
… | |
33 | template<typename T> |
33 | template<typename T> |
34 | struct cftype { }; |
34 | struct cftype { }; |
35 | |
35 | |
36 | template<> |
36 | template<> |
37 | struct cftype<int> { |
37 | struct cftype<int> { |
38 | enum { dt = DT_INT }; |
38 | static const data_type dt = DT_INT; |
39 | }; |
39 | }; |
40 | |
40 | |
41 | template<> |
41 | template<> |
42 | struct cftype<sint64> { |
42 | struct cftype<sint64> { |
43 | enum { dt = DT_INT64 }; |
43 | static const data_type dt = DT_INT64; |
44 | }; |
44 | }; |
45 | |
45 | |
46 | template<> |
46 | template<> |
47 | struct cftype<double> { |
47 | struct cftype<double> { |
48 | enum { dt = DT_DOUBLE }; |
48 | static const data_type dt = DT_DOUBLE; |
49 | }; |
49 | }; |
50 | |
50 | |
51 | template<> |
51 | template<> |
52 | struct cftype<const char *> { |
52 | struct cftype<const char *> { |
53 | enum { dt = DT_STRING }; |
53 | static const data_type dt = DT_STRING; |
54 | }; |
54 | }; |
55 | |
55 | |
56 | template<> |
56 | template<> |
57 | struct cftype<object> { |
57 | struct cftype<object> { |
58 | enum { dt = DT_OBJECT }; |
58 | static const data_type dt = DT_OBJECT; |
59 | }; |
59 | }; |
60 | |
60 | |
61 | template<> |
61 | template<> |
62 | struct cftype<struct pl> { |
62 | struct cftype<player> { |
63 | enum { dt = DT_PLAYER }; |
63 | static const data_type dt = DT_PLAYER; |
64 | }; |
64 | }; |
65 | |
65 | |
66 | template<> |
66 | template<> |
67 | struct cftype<mapstruct> { |
67 | struct cftype<maptile> { |
68 | enum { dt = DT_MAP }; |
68 | static const data_type dt = DT_MAP; |
69 | }; |
69 | }; |
70 | |
70 | |
71 | template<> |
71 | template<> |
72 | struct cftype<struct archt> { |
72 | struct cftype<archetype> { |
73 | enum { dt = DT_ARCH }; |
73 | static const data_type dt = DT_ARCH; |
74 | }; |
74 | }; |
75 | |
75 | |
76 | template<> |
76 | template<> |
77 | struct cftype<party> { |
77 | struct cftype<party> { |
78 | enum { dt = DT_PARTY }; |
78 | static const data_type dt = DT_PARTY; |
79 | }; |
79 | }; |
80 | |
80 | |
81 | template<> |
81 | template<> |
82 | struct cftype<region> { |
82 | struct cftype<region> { |
83 | enum { dt = DT_REGION }; |
83 | static const data_type dt = DT_REGION; |
|
|
84 | }; |
|
|
85 | |
|
|
86 | template<> |
|
|
87 | struct cftype<treasurelist> { |
|
|
88 | static const data_type dt = DT_REGION; |
84 | }; |
89 | }; |
85 | |
90 | |
86 | #endif |
91 | #endif |
87 | |
92 | |