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.3 by root, Fri Sep 8 16:53:57 2006 UTC vs.
Revision 1.4 by root, Sat Sep 16 22:24:12 2006 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines