ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/common/utils.C
(Generate patch)

Comparing deliantra/server/common/utils.C (file contents):
Revision 1.11 by root, Tue Sep 12 19:20:06 2006 UTC vs.
Revision 1.16 by root, Sat Sep 16 22:24:12 2006 UTC

1
2/*
3 * static char *rcsid_utils_c =
4 * "$Id: utils.C,v 1.11 2006/09/12 19:20:06 root Exp $";
5 */
6
7/* 1/*
8 CrossFire, A Multiplayer game for X-windows 2 CrossFire, A Multiplayer game for X-windows
9 3
10 Copyright (C) 2002 Mark Wedel & Crossfire Development Team 4 Copyright (C) 2002 Mark Wedel & Crossfire Development Team
11 Copyright (C) 1992 Frank Tore Johansen 5 Copyright (C) 1992 Frank Tore Johansen
22 16
23 You should have received a copy of the GNU General Public License 17 You should have received a copy of the GNU General Public License
24 along with this program; if not, write to the Free Software 18 along with this program; if not, write to the Free Software
25 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 19 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
26 20
27 The authors can be reached via e-mail at crossfire-devel@real-time.com 21 The authors can be reached via e-mail at <crossfire@schmorp.de>
28*/ 22*/
29 23
30/* 24/*
31 * General convenience functions for crossfire. 25 * General convenience functions for crossfire.
32 */ 26 */
206} 200}
207 201
208/* decay and destroy persihable items in a map */ 202/* decay and destroy persihable items in a map */
209 203
210void 204void
211decay_objects (mapstruct *m) 205decay_objects (maptile *m)
212{ 206{
213 int x, y, destroy; 207 int x, y, destroy;
214 object *op, *otmp; 208 object *op, *otmp;
215 209
216 if (m->unique) 210 if (m->unique)
549 strcpy (input, tmp); 543 strcpy (input, tmp);
550 544
551 return; 545 return;
552} 546}
553 547
554void * 548/////////////////////////////////////////////////////////////////////////////
555zero_initialised::operator new (size_t s, void *p) 549
550void *alloc (int s) throw (std::bad_alloc)
556{ 551{
557 memset (p, 0, s); 552 void *p = g_slice_alloc (s);
553
554 if (!p)
555 throw std::bad_alloc ();
556
558 return p; 557 return p;
559}
560
561void *
562zero_initialised::operator new (size_t s)
563{
564 //return calloc (1, s);
565 return g_slice_alloc0 (s);
566}
567
568void *
569 zero_initialised::operator new[] (size_t s)
570{
571 //return calloc (1, s);
572 return g_slice_alloc0 (s);
573}
574
575void
576zero_initialised::operator delete (void *p, size_t s)
577{
578 //free (p); return;
579 g_slice_free1 (s, p);
580}
581
582void
583zero_initialised::operator delete[] (void *p, size_t s)
584{
585 //free (p); return;
586 g_slice_free1 (s, p);
587} 558}
588 559
589void assign (char *dst, const char *src, int maxlen) 560void assign (char *dst, const char *src, int maxlen)
590{ 561{
591 if (!src) 562 if (!src)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines