ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/include/traits.h
Revision: 1.32
Committed: Sat Nov 17 23:40:02 2018 UTC (5 years, 6 months ago) by root
Content type: text/plain
Branch: MAIN
CVS Tags: HEAD
Changes since 1.31: +1 -0 lines
Log Message:
copyright update 2018

File Contents

# User Rev Content
1 root 1.15 /*
2 root 1.20 * This file is part of Deliantra, the Roguelike Realtime MMORPG.
3 root 1.28 *
4 root 1.32 * Copyright (©) 2017,2018 Marc Alexander Lehmann / the Deliantra team
5 root 1.31 * Copyright (©) 2005,2006,2007,2008,2009,2010,2011,2012,2013,2014,2015,2016 Marc Alexander Lehmann / Robin Redeker / the Deliantra team
6 root 1.28 *
7 root 1.22 * Deliantra is free software: you can redistribute it and/or modify it under
8     * the terms of the Affero GNU General Public License as published by the
9     * Free Software Foundation, either version 3 of the License, or (at your
10     * option) any later version.
11 root 1.28 *
12 root 1.17 * This program is distributed in the hope that it will be useful,
13     * but WITHOUT ANY WARRANTY; without even the implied warranty of
14     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15     * GNU General Public License for more details.
16 root 1.28 *
17 root 1.22 * You should have received a copy of the Affero GNU General Public License
18     * and the GNU General Public License along with this program. If not, see
19     * <http://www.gnu.org/licenses/>.
20 root 1.28 *
21 root 1.20 * The authors can be reached via e-mail to <support@deliantra.net>
22 root 1.15 */
23    
24 root 1.30 /* define traits (actually just types at the moment) for basic types */
25    
26 root 1.1 #ifndef TRAITS_H__
27     #define TRAITS_H__
28    
29 root 1.11 #include <inttypes.h>
30    
31     typedef int8_t sint8;
32     typedef uint8_t uint8;
33     typedef int16_t sint16;
34     typedef uint16_t uint16;
35     typedef int32_t sint32;
36     typedef uint32_t uint32;
37     typedef int64_t sint64;
38     typedef uint64_t uint64;
39    
40 root 1.30 typedef uint32 weight_t;
41     typedef sint64 volume_t;
42     typedef uint32 tick_t;
43     typedef uint16 faceidx;
44    
45     inline weight_t
46     weight_to_kg_approx (weight_t w)
47     {
48     // we divide by 1024, because otherwise we need a 64 bit multiply
49     return w >> 10;
50     }
51 root 1.13
52 root 1.14 const int sint32_digits = 11; // number of digits an sint32 uses max.
53     const int sint64_digits = 20;
54    
55 root 1.19 typedef char *octet_string;
56     typedef char *utf8_string;
57 root 1.23 typedef char *any_string;
58 root 1.19 typedef const char *const_octet_string;
59     typedef const char *const_utf8_string;
60 root 1.23 typedef const char *const_any_string;
61 root 1.19
62 root 1.8 struct client_container;
63 root 1.6 struct client;
64 root 1.4 struct player;
65 root 1.1 struct object;
66 root 1.4 struct maptile;
67 root 1.9 struct mapspace;
68 root 1.3 struct archetype;
69 root 1.1 struct region;
70     struct party;
71 root 1.4 struct treasurelist;
72 root 1.12 struct random_map_params;
73 root 1.16 struct faceinfo;
74 root 1.18 struct mapxy;
75 root 1.25 struct materialtype_t;
76 root 1.1
77 root 1.19 typedef object object_ornull;
78     typedef maptile maptile_ornull;
79    
80 root 1.1 // could have used templates, but a more traditional C api
81     // uses more explicit typing which is ok for this purpose.
82     enum data_type
83     {
84     DT_END, // no further arguments
85     DT_AV, // perl-only av that needs to be flattened out
86     DT_INT,
87     DT_INT64,
88     DT_DOUBLE,
89     DT_STRING, // 0-terminated string
90     DT_DATA, // string + length
91 root 1.10 DT_ATTACHABLE, // will go
92 root 1.1 DT_OBJECT,
93     DT_MAP,
94 root 1.7 DT_CLIENT,
95 root 1.1 DT_PLAYER,
96     DT_ARCH,
97     DT_PARTY,
98     DT_REGION,
99    
100     NUM_DATA_TYPES
101     };
102    
103     #endif
104