ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/traits.h
(Generate patch)

Comparing deliantra/server/include/traits.h (file contents):
Revision 1.2 by root, Thu Aug 31 17:54:14 2006 UTC vs.
Revision 1.8 by root, Wed Dec 20 09:14:22 2006 UTC

1#ifndef TRAITS_H__ 1#ifndef TRAITS_H__
2#define TRAITS_H__ 2#define TRAITS_H__
3 3
4struct client_container;
5struct client;
4struct pl; 6struct player;
5struct object; 7struct object;
6struct mapstruct; 8struct maptile;
7struct archt; 9struct archetype;
8struct region; 10struct region;
9struct party; 11struct party;
10struct mapstruct;
11struct treasureliststruct; 12struct treasurelist;
12 13
13// could have used templates, but a more traditional C api 14// could have used templates, but a more traditional C api
14// uses more explicit typing which is ok for this purpose. 15// uses more explicit typing which is ok for this purpose.
15enum data_type 16enum data_type
16{ 17{
21 DT_DOUBLE, 22 DT_DOUBLE,
22 DT_STRING, // 0-terminated string 23 DT_STRING, // 0-terminated string
23 DT_DATA, // string + length 24 DT_DATA, // string + length
24 DT_OBJECT, 25 DT_OBJECT,
25 DT_MAP, 26 DT_MAP,
27 DT_CLIENT,
26 DT_PLAYER, 28 DT_PLAYER,
27 DT_ARCH, 29 DT_ARCH,
28 DT_PARTY, 30 DT_PARTY,
29 DT_REGION, 31 DT_REGION,
30 32
34template<typename T> 36template<typename T>
35struct cftype { }; 37struct cftype { };
36 38
37template<> 39template<>
38struct cftype<int> { 40struct cftype<int> {
39 static const data_type dt = DT_INT; 41 static const data_type dt = DT_INT;
40}; 42};
41 43
42template<> 44template<>
43struct cftype<sint64> { 45struct cftype<sint64> {
44 static const data_type dt = DT_INT64; 46 static const data_type dt = DT_INT64;
45}; 47};
46 48
47template<> 49template<>
48struct cftype<double> { 50struct cftype<double> {
49 static const data_type dt = DT_DOUBLE; 51 static const data_type dt = DT_DOUBLE;
50}; 52};
51 53
52template<> 54template<>
53struct cftype<const char *> { 55struct cftype<const char *> {
54 static const data_type dt = DT_STRING; 56 static const data_type dt = DT_STRING;
55}; 57};
56 58
57template<> 59template<>
58struct cftype<object> { 60struct cftype<object> {
59 static const data_type dt = DT_OBJECT; 61 static const data_type dt = DT_OBJECT;
60}; 62};
61 63
62template<> 64template<>
63struct cftype<struct pl> { 65struct cftype<client> {
64 static const data_type dt = DT_PLAYER; 66 static const data_type dt = DT_CLIENT;
65}; 67};
66 68
67template<> 69template<>
68struct cftype<mapstruct> { 70struct cftype<player> {
69 static const data_type dt = DT_MAP; 71 static const data_type dt = DT_PLAYER;
70}; 72};
71 73
72template<> 74template<>
75struct cftype<maptile> {
76 static const data_type dt = DT_MAP;
77};
78
79template<>
73struct cftype<archt> { 80struct cftype<archetype> {
74 static const data_type dt = DT_ARCH; 81 static const data_type dt = DT_ARCH;
75}; 82};
76 83
77template<> 84template<>
78struct cftype<party> { 85struct cftype<party> {
79 static const data_type dt = DT_PARTY; 86 static const data_type dt = DT_PARTY;
80}; 87};
81 88
82template<> 89template<>
83struct cftype<region> { 90struct cftype<region> {
84 static const data_type dt = DT_REGION; 91 static const data_type dt = DT_REGION;
85}; 92};
86 93
87template<> 94template<>
88struct cftype<treasureliststruct> { 95struct cftype<treasurelist> {
89 static const data_type dt = DT_REGION; 96 static const data_type dt = DT_REGION;
90}; 97};
91 98
92#endif 99#endif
93 100

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines