--- deliantra/server/include/face.h 2010/10/05 21:40:05 1.35 +++ deliantra/server/include/face.h 2012/01/03 11:23:41 1.37 @@ -1,7 +1,7 @@ /* * This file is part of Deliantra, the Roguelike Realtime MMORPG. * - * Copyright (©) 2005,2006,2007,2008,2009,2010 Marc Alexander Lehmann / Robin Redeker / the Deliantra team + * Copyright (©) 2005,2006,2007,2008,2009,2010,2011 Marc Alexander Lehmann / Robin Redeker / the Deliantra team * * Deliantra is free software: you can redistribute it and/or modify it under * the terms of the Affero GNU General Public License as published by the @@ -23,7 +23,7 @@ #ifndef FACE_H__ #define FACE_H__ -#include +#include #include #define CHKSUM_MAXLEN 15 @@ -35,7 +35,7 @@ struct facedata { - std::string data; + refcnt_buf data; // no need to be refcounted actually uint8 chksum[CHKSUM_MAXLEN]; uint8 chksum_len; @@ -51,7 +51,7 @@ struct faceinfo { faceinfo () - : number (0), smooth (0), type (0), smoothlevel (0), visibility (0), magicmap (0) + : number (0), smooth (0), type (0), smoothlevel (0), visibility (0), magicmap (0), refcnt (1) { } @@ -67,6 +67,10 @@ uint8 magicmap; /* Color to show this in magic map */ facedata *data (int faceset) const; + + int refcnt; // reference count - 1 + void ref () { ++refcnt; } + void unref (); }; inline void @@ -94,6 +98,7 @@ * it will be known that the face could not be found. */ faceidx face_find (const char *name, faceidx defidx = 0); +faceidx face_alloc (); faceinfo *face_info (faceidx idx); facedata *face_data (faceidx idx, int faceset);