Crossfire Server, Branches 1.12  R18729
cfpython_object.h
Go to the documentation of this file.
1 /*****************************************************************************/
2 /* CFPython - A Python module for Crossfire RPG. */
3 /* Version: 2.0beta8 (also known as "Alexander") */
4 /* Contact: yann.chachkoff@myrealbox.com */
5 /*****************************************************************************/
6 /* That code is placed under the GNU General Public Licence (GPL) */
7 /* (C)2001-2005 by Chachkoff Yann (Feel free to deliver your complaints) */
8 /*****************************************************************************/
9 /* CrossFire, A Multiplayer game for X-windows */
10 /* */
11 /* Copyright (C) 2000 Mark Wedel */
12 /* Copyright (C) 1992 Frank Tore Johansen */
13 /* */
14 /* This program is free software; you can redistribute it and/or modify */
15 /* it under the terms of the GNU General Public License as published by */
16 /* the Free Software Foundation; either version 2 of the License, or */
17 /* (at your option) any later version. */
18 /* */
19 /* This program is distributed in the hope that it will be useful, */
20 /* but WITHOUT ANY WARRANTY; without even the implied warranty of */
21 /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the */
22 /* GNU General Public License for more details. */
23 /* */
24 /* You should have received a copy of the GNU General Public License */
25 /* along with this program; if not, write to the Free Software */
26 /* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
27 /* */
28 /*****************************************************************************/
29 #ifndef CFPYTHON_OBJECT_H
30 #define CFPYTHON_OBJECT_H
31 
32 typedef struct {
33  PyObject_HEAD
34  object *obj;
37 
38 extern PyTypeObject Crossfire_ObjectType;
39 
40 typedef struct {
41  PyObject_HEAD
42  object *obj;
45 
46 extern PyTypeObject Crossfire_PlayerType;
47 
48 #define EXISTCHECK(ob) { \
49  if (!ob || !ob->obj || (was_destroyed(ob->obj, ob->obj->count))) { \
50  PyErr_SetString(PyExc_ReferenceError, "Crossfire object no longer exists"); \
51  return NULL; \
52  } }
53 
59 #define TYPEEXISTCHECK(ob) { \
60  if (!ob || !PyObject_TypeCheck((PyObject*)ob, &Crossfire_ObjectType) || !ob->obj || (was_destroyed(ob->obj, ob->obj->count))) { \
61  PyErr_SetString(PyExc_ReferenceError, "Not a Crossfire object or Crossfire object no longer exists"); \
62  return NULL; \
63  } }
64 
65 #define EXISTCHECK_INT(ob) { \
66  if (!ob || !ob->obj || (was_destroyed(ob->obj, ob->obj->count))) { \
67  PyErr_SetString(PyExc_ReferenceError, "Crossfire object no longer exists"); \
68  return -1; \
69  } }
70 
71 #endif /* CFPYTHON_OBJECT_H */
PyObject_HEAD object * obj
PyTypeObject Crossfire_PlayerType
uint32 tag_t
Definition: object.h:40
PyObject_HEAD object * obj
PyTypeObject Crossfire_ObjectType