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

Comparing deliantra/server/include/face.h (file contents):
Revision 1.36 by root, Sat Apr 23 04:56:48 2011 UTC vs.
Revision 1.37 by root, Tue Jan 3 11:23:41 2012 UTC

21 */ 21 */
22 22
23#ifndef FACE_H__ 23#ifndef FACE_H__
24#define FACE_H__ 24#define FACE_H__
25 25
26#include <string> 26#include <util.h>
27#include <tr1/unordered_map> 27#include <tr1/unordered_map>
28 28
29#define CHKSUM_MAXLEN 15 29#define CHKSUM_MAXLEN 15
30#define MAX_FACES 10000 // stupid gcfclient artificially limits 30#define MAX_FACES 10000 // stupid gcfclient artificially limits
31 31
33 33
34extern faceidx blank_face, empty_face, magicmouth_face; 34extern faceidx blank_face, empty_face, magicmouth_face;
35 35
36struct facedata 36struct facedata
37{ 37{
38 std::string data; 38 refcnt_buf data; // no need to be refcounted actually
39 uint8 chksum[CHKSUM_MAXLEN]; 39 uint8 chksum[CHKSUM_MAXLEN];
40 uint8 chksum_len; 40 uint8 chksum_len;
41 41
42 facedata () 42 facedata ()
43 : chksum_len (0) 43 : chksum_len (0)
49 * create a new face with that color. 49 * create a new face with that color.
50 */ 50 */
51struct faceinfo 51struct faceinfo
52{ 52{
53 faceinfo () 53 faceinfo ()
54 : number (0), smooth (0), type (0), smoothlevel (0), visibility (0), magicmap (0) 54 : number (0), smooth (0), type (0), smoothlevel (0), visibility (0), magicmap (0), refcnt (1)
55 { 55 {
56 } 56 }
57 57
58 shstr name; 58 shstr name;
59 std::string meta; 59 std::string meta;
65 uint8 smoothlevel; // smoothlevel is per-face in 2.x servers 65 uint8 smoothlevel; // smoothlevel is per-face in 2.x servers
66 uint8 visibility; 66 uint8 visibility;
67 uint8 magicmap; /* Color to show this in magic map */ 67 uint8 magicmap; /* Color to show this in magic map */
68 68
69 facedata *data (int faceset) const; 69 facedata *data (int faceset) const;
70
71 int refcnt; // reference count - 1
72 void ref () { ++refcnt; }
73 void unref ();
70}; 74};
71 75
72inline void 76inline void
73object_freezer::put (const keyword_string k, faceinfo *v) 77object_freezer::put (const keyword_string k, faceinfo *v)
74{ 78{
92 * If a face is not found, then defidx is returned. This can be useful 96 * If a face is not found, then defidx is returned. This can be useful
93 * if you want some default face used, or can be set to negative so that 97 * if you want some default face used, or can be set to negative so that
94 * it will be known that the face could not be found. 98 * it will be known that the face could not be found.
95 */ 99 */
96faceidx face_find (const char *name, faceidx defidx = 0); 100faceidx face_find (const char *name, faceidx defidx = 0);
101faceidx face_alloc ();
97faceinfo *face_info (faceidx idx); 102faceinfo *face_info (faceidx idx);
98facedata *face_data (faceidx idx, int faceset); 103facedata *face_data (faceidx idx, int faceset);
99 104
100struct MapLook 105struct MapLook
101{ 106{

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines